Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / mini / tramp-s390x.c
1 /**
2  * \file
3  * Function    - JIT trampoline code for S/390.
4  *
5  * Name        - Neale Ferguson (Neale.Ferguson@SoftwareAG-usa.com)
6  *
7  * Date        - January, 2004
8  *
9  * Derivation  - From exceptions-x86 & exceptions-ppc
10  *               Paolo Molaro (lupus@ximian.com)
11  *               Dietmar Maurer (dietmar@ximian.com)
12  *
13  * Copyright   - 2001 Ximian, Inc.
14  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
15  *
16  */
17
18 /*------------------------------------------------------------------*/
19 /*                 D e f i n e s                                    */
20 /*------------------------------------------------------------------*/
21
22 #define LMFReg  s390_r13
23
24 /*
25  * Method-specific trampoline code fragment sizes                   
26  */
27 #define SPECIFIC_TRAMPOLINE_SIZE        96
28
29 /*========================= End of Defines =========================*/
30
31 /*------------------------------------------------------------------*/
32 /*                 I n c l u d e s                                  */
33 /*------------------------------------------------------------------*/
34
35 #include <config.h>
36 #include <glib.h>
37 #include <string.h>
38
39 #include <mono/metadata/abi-details.h>
40 #include <mono/metadata/appdomain.h>
41 #include <mono/metadata/gc-internals.h>
42 #include <mono/metadata/marshal.h>
43 #include <mono/metadata/profiler-private.h>
44 #include <mono/metadata/tabledefs.h>
45 #include <mono/arch/s390x/s390x-codegen.h>
46
47 #include "mini.h"
48 #include "mini-s390x.h"
49 #include "support-s390x.h"
50 #include "jit-icalls.h"
51
52 /*========================= End of Includes ========================*/
53
54 /*------------------------------------------------------------------*/
55 /*                 T y p e d e f s                                  */
56 /*------------------------------------------------------------------*/
57
58 typedef struct {
59         guint8  stk[S390_MINIMAL_STACK_SIZE];   /* Standard s390x stack */
60         guint64 saveFn;                         /* Call address         */
61         struct MonoLMF  LMF;                    /* LMF                  */
62 } trampStack_t;
63
64 /*========================= End of Typedefs ========================*/
65
66 /*------------------------------------------------------------------*/
67 /*                   P r o t o t y p e s                            */
68 /*------------------------------------------------------------------*/
69
70 /*========================= End of Prototypes ======================*/
71
72 /*------------------------------------------------------------------*/
73 /*                 G l o b a l   V a r i a b l e s                  */
74 /*------------------------------------------------------------------*/
75
76
77 /*====================== End of Global Variables ===================*/
78
79 /*------------------------------------------------------------------*/
80 /*                                                                  */
81 /* Name         - mono_arch_get_unbox_trampoline                    */
82 /*                                                                  */
83 /* Function     - Return a pointer to a trampoline which does the   */
84 /*                unboxing before calling the method.               */
85 /*                                                                  */
86 /*                When value type methods are called through the    */
87 /*                vtable we need to unbox the 'this' argument.      */
88 /*                                                                  */
89 /* Parameters   - method - Methd pointer                            */
90 /*                addr   - Pointer to native code for method        */
91 /*                                                                  */
92 /*------------------------------------------------------------------*/
93
94 gpointer
95 mono_arch_get_unbox_trampoline (MonoMethod *method, gpointer addr)
96 {
97         guint8 *code, *start;
98         int this_pos = s390_r2;
99         MonoDomain *domain = mono_domain_get ();
100         char trampName[128];
101
102         start = code = mono_domain_code_reserve (domain, 28);
103
104         S390_SET  (code, s390_r1, addr);
105         s390_aghi (code, this_pos, sizeof(MonoObject));
106         s390_br   (code, s390_r1);
107
108         g_assert ((code - start) <= 28);
109
110         mono_arch_flush_icache (start, code - start);
111         MONO_PROFILER_RAISE (jit_code_buffer, (start, code - start, MONO_PROFILER_CODE_BUFFER_UNBOX_TRAMPOLINE, method));
112
113         snprintf(trampName, sizeof(trampName), "%s_unbox_trampoline", method->name);
114
115         mono_tramp_info_register (mono_tramp_info_create (trampName, start, code - start, NULL, NULL), domain);
116
117         return start;
118 }
119
120 /*========================= End of Function ========================*/
121
122 /*------------------------------------------------------------------*/
123 /*                                                                  */
124 /* Name         - mono_arch_patch_callsite                          */
125 /*                                                                  */
126 /* Function     - Patch a non-virtual callsite so it calls @addr.   */
127 /*                                                                  */
128 /*------------------------------------------------------------------*/
129
130 void
131 mono_arch_patch_callsite (guint8 *method_start, guint8 *orig_code, guint8 *addr)
132 {
133         gint32 displace;
134         unsigned short opcode;
135
136         opcode = *((unsigned short *) (orig_code - 2));
137         if (opcode == 0x0dee) {
138                 /* This should be a 'iihf/iilf' sequence */
139                 S390_EMIT_CALL((orig_code - 14), addr);
140                 mono_arch_flush_icache (orig_code - 14, 12);
141         } else {
142                 /* This is the 'brasl' instruction */
143                 orig_code    -= 4;
144                 displace = ((gssize) addr - (gssize) (orig_code - 2)) / 2;
145                 s390_patch_rel (orig_code, displace);
146                 mono_arch_flush_icache (orig_code, 4);
147         }
148 }
149
150 /*========================= End of Function ========================*/
151
152 /*------------------------------------------------------------------*/
153 /*                                                                  */
154 /* Name         - mono_arch_patch_plt_entry.                        */
155 /*                                                                  */
156 /* Function     - Patch a PLT entry - unused as yet.                */
157 /*                                                                  */
158 /*------------------------------------------------------------------*/
159
160 void
161 mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr)
162 {
163         g_assert_not_reached ();
164 }
165
166 /*========================= End of Function ========================*/
167
168 /*------------------------------------------------------------------*/
169 /*                                                                  */
170 /* Name         - mono_arch_create_trampoline_code                  */
171 /*                                                                  */
172 /* Function     - Create the designated type of trampoline according*/
173 /*                to the 'tramp_type' parameter.                    */
174 /*                                                                  */
175 /*------------------------------------------------------------------*/
176
177 guchar*
178 mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInfo **info, gboolean aot)
179 {
180         char *tramp_name;
181         guint8 *buf, *tramp, *code;
182         int i, offset, has_caller;
183         GSList *unwind_ops = NULL;
184         MonoJumpInfo *ji = NULL;
185
186         g_assert (!aot);
187
188         /* Now we'll create in 'buf' the S/390 trampoline code. This
189            is the trampoline code common to all methods  */
190                 
191         code = buf = mono_global_codeman_reserve(512);
192                 
193         if (tramp_type == MONO_TRAMPOLINE_JUMP) 
194                 has_caller = 0;
195         else
196                 has_caller = 1;
197
198         /*-----------------------------------------------------------
199           STEP 0: First create a non-standard function prologue with a
200           stack size big enough to save our registers.
201           -----------------------------------------------------------*/
202                 
203         s390_stmg (buf, s390_r6, s390_r15, STK_BASE, S390_REG_SAVE_OFFSET);
204         s390_lgr  (buf, s390_r11, s390_r15);
205         s390_aghi (buf, STK_BASE, -sizeof(trampStack_t));
206         s390_stg  (buf, s390_r11, 0, STK_BASE, 0);
207
208         /*---------------------------------------------------------------*/
209         /* we build the MonoLMF structure on the stack - see mini-s390.h */
210         /* Keep in sync with the code in mono_arch_emit_prolog           */
211         /*---------------------------------------------------------------*/
212                                                                                         
213         s390_lgr   (buf, LMFReg, STK_BASE);
214         s390_aghi  (buf, LMFReg, G_STRUCT_OFFSET(trampStack_t, LMF));
215                                                                                         
216         /*---------------------------------------------------------------*/     
217         /* Save general and floating point registers in LMF              */     
218         /*---------------------------------------------------------------*/     
219         s390_stmg (buf, s390_r0, s390_r1, LMFReg, G_STRUCT_OFFSET(MonoLMF, gregs[0]));
220         s390_stmg (buf, s390_r2, s390_r5, LMFReg, G_STRUCT_OFFSET(MonoLMF, gregs[2]));
221         s390_mvc  (buf, 10*sizeof(gulong), LMFReg, G_STRUCT_OFFSET(MonoLMF, gregs[6]),
222                    s390_r11, S390_REG_SAVE_OFFSET);
223
224         offset = G_STRUCT_OFFSET(MonoLMF, fregs[0]);
225         for (i = s390_f0; i <= s390_f15; ++i) {
226                 s390_std  (buf, i, 0, LMFReg, offset);
227                 offset += sizeof(gdouble);
228         }
229
230         /*----------------------------------------------------------
231           STEP 1: call 'mono_get_lmf_addr()' to get the address of our
232           LMF. We'll need to restore it after the call to
233           's390_magic_trampoline' and before the call to the native
234           method.
235           ----------------------------------------------------------*/
236                                 
237         S390_SET  (buf, s390_r1, mono_get_lmf_addr);
238         s390_basr (buf, s390_r14, s390_r1);
239                                                                                         
240         /*---------------------------------------------------------------*/     
241         /* Set lmf.lmf_addr = jit_tls->lmf                               */     
242         /*---------------------------------------------------------------*/     
243         s390_stg   (buf, s390_r2, 0, LMFReg,                            
244                             G_STRUCT_OFFSET(MonoLMF, lmf_addr));                        
245                                                                                         
246         /*---------------------------------------------------------------*/     
247         /* Get current lmf                                               */     
248         /*---------------------------------------------------------------*/     
249         s390_lg    (buf, s390_r0, 0, s390_r2, 0);                               
250                                                                                         
251         /*---------------------------------------------------------------*/     
252         /* Set our lmf as the current lmf                                */     
253         /*---------------------------------------------------------------*/     
254         s390_stg   (buf, LMFReg, 0, s390_r2, 0);                                
255                                                                                         
256         /*---------------------------------------------------------------*/     
257         /* Have our lmf.previous_lmf point to the last lmf               */     
258         /*---------------------------------------------------------------*/     
259         s390_stg   (buf, s390_r0, 0, LMFReg,                            
260                             G_STRUCT_OFFSET(MonoLMF, previous_lmf));                    
261                                                                                         
262         /*---------------------------------------------------------------*/     
263         /* save method info                                              */     
264         /*---------------------------------------------------------------*/     
265         s390_lg    (buf, s390_r1, 0, LMFReg, G_STRUCT_OFFSET(MonoLMF, gregs[1]));
266         s390_stg   (buf, s390_r1, 0, LMFReg, G_STRUCT_OFFSET(MonoLMF, method));                         
267                                                                         
268         /*---------------------------------------------------------------*/     
269         /* save the current SP                                           */     
270         /*---------------------------------------------------------------*/     
271         s390_lg    (buf, s390_r1, 0, STK_BASE, 0);
272         s390_stg   (buf, s390_r1, 0, LMFReg, G_STRUCT_OFFSET(MonoLMF, ebp));    
273                                                                         
274         /*---------------------------------------------------------------*/     
275         /* save the current IP                                           */     
276         /*---------------------------------------------------------------*/     
277         if (has_caller) {
278                 s390_lg    (buf, s390_r1, 0, s390_r1, S390_RET_ADDR_OFFSET);
279         } else {
280                 s390_lghi  (buf, s390_r1, 0);
281         }
282         s390_stg   (buf, s390_r1, 0, LMFReg, G_STRUCT_OFFSET(MonoLMF, eip));    
283                                                                                         
284         /*---------------------------------------------------------------*/
285         /* STEP 2: call the C trampoline function                        */
286         /*---------------------------------------------------------------*/
287                                 
288         /* Set arguments */
289
290         /* Arg 1: mgreg_t *regs */
291         s390_la  (buf, s390_r2, 0, LMFReg, G_STRUCT_OFFSET(MonoLMF, gregs[0]));
292                 
293         /* Arg 2: code (next address to the instruction that called us) */
294         if (has_caller) {
295                 s390_lg   (buf, s390_r3, 0, s390_r11, S390_RET_ADDR_OFFSET);
296         } else {
297                 s390_lghi (buf, s390_r3, 0);
298         }
299
300         /* Arg 3: Trampoline argument */
301         s390_lg (buf, s390_r4, 0, LMFReg, G_STRUCT_OFFSET(MonoLMF, gregs[1]));
302
303         /* Arg 4: trampoline address. */
304         S390_SET (buf, s390_r5, buf);
305                 
306         /* Calculate call address and call the C trampoline. Return value will be in r2 */
307         tramp = (guint8*)mono_get_trampoline_func (tramp_type);
308         S390_SET  (buf, s390_r1, tramp);
309         s390_basr (buf, s390_r14, s390_r1);
310                 
311         /* OK, code address is now on r2. Save it, so that we
312            can restore r2 and use it later */
313         s390_stg  (buf, s390_r2, 0, STK_BASE, G_STRUCT_OFFSET(trampStack_t, saveFn));
314
315         /* Check for thread interruption */
316         S390_SET  (buf, s390_r1, (guint8 *)mono_interruption_checkpoint_from_trampoline);
317         s390_basr (buf, s390_r14, s390_r1);
318
319         /*----------------------------------------------------------
320           STEP 3: Restore the LMF
321           ----------------------------------------------------------*/
322         restoreLMF(buf, STK_BASE, sizeof(trampStack_t));
323         
324         /* Reload result */
325         s390_lg   (buf, s390_r1, 0, STK_BASE, G_STRUCT_OFFSET(trampStack_t, saveFn));
326
327         /*----------------------------------------------------------
328           STEP 4: call the compiled method
329           ----------------------------------------------------------*/
330                 
331         /* Restore parameter registers */
332         s390_lmg (buf, s390_r2, s390_r5, LMFReg, G_STRUCT_OFFSET(MonoLMF, gregs[2]));
333                 
334         /* Restore the FP registers */
335         offset = G_STRUCT_OFFSET(MonoLMF, fregs[0]);
336         for (i = s390_f0; i <= s390_f15; ++i) {
337                 s390_ld  (buf, i, 0, LMFReg, offset);
338                 offset += sizeof(gdouble);
339         }
340
341         /* Restore stack pointer and jump to the code -
342          * R14 contains the return address to our caller 
343          */
344         s390_lgr  (buf, STK_BASE, s390_r11);
345         s390_lmg  (buf, s390_r6, s390_r14, STK_BASE, S390_REG_SAVE_OFFSET);
346
347         if (MONO_TRAMPOLINE_TYPE_MUST_RETURN(tramp_type)) {
348                 s390_lgr (buf, s390_r2, s390_r1);
349                 s390_br  (buf, s390_r14);
350         } else {
351                 s390_br  (buf, s390_r1);
352         }
353
354         /* Flush instruction cache, since we've generated code */
355         mono_arch_flush_icache (code, buf - code);
356         MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_GENERICS_TRAMPOLINE, NULL));
357         
358         g_assert (info);
359         tramp_name = mono_get_generic_trampoline_name (tramp_type);
360         *info = mono_tramp_info_create (tramp_name, buf, buf - code, ji, unwind_ops);
361         g_free (tramp_name);
362
363         /* Sanity check */
364         g_assert ((buf - code) <= 512);
365
366         return code;
367 }
368
369 /*========================= End of Function ========================*/
370
371 /*------------------------------------------------------------------*/
372 /*                                                                  */
373 /* Name         - mono_arch_invalidate_method                       */
374 /*                                                                  */
375 /* Function     -                                                   */
376 /*                                                                  */
377 /*------------------------------------------------------------------*/
378
379 void
380 mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
381 {
382         /* FIXME: This is not thread safe */
383         guint8 *code = ji->code_start;
384
385         S390_SET  (code, s390_r1, func);
386         S390_SET  (code, s390_r2, func_arg);
387         s390_br   (code, s390_r1);
388
389 }
390
391 /*========================= End of Function ========================*/
392
393 /*------------------------------------------------------------------*/
394 /*                                                                  */
395 /* Name         - mono_arch_create_specific_trampoline              */
396 /*                                                                  */
397 /* Function     - Creates the given kind of specific trampoline     */
398 /*                                                                  */
399 /*------------------------------------------------------------------*/
400
401 gpointer
402 mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len)
403 {
404         guint8 *code, *buf, *tramp;
405         gint32 displace;
406
407         tramp = mono_get_trampoline_code (tramp_type);
408
409         /*----------------------------------------------------------*/
410         /* This is the method-specific part of the trampoline. Its  */
411         /* purpose is to provide the generic part with the          */
412         /* MonoMethod *method pointer. We'll use r1 to keep it.     */
413         /*----------------------------------------------------------*/
414         code = buf = mono_domain_code_reserve (domain, SPECIFIC_TRAMPOLINE_SIZE);
415
416         S390_SET  (buf, s390_r1, arg1);
417         displace = (tramp - buf) / 2;
418         s390_jg   (buf, displace);
419
420         /* Flush instruction cache, since we've generated code */
421         mono_arch_flush_icache (code, buf - code);
422         MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf,
423                              MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE,
424                              (void *) mono_get_generic_trampoline_simple_name (tramp_type)));
425
426         /* Sanity check */
427         g_assert ((buf - code) <= SPECIFIC_TRAMPOLINE_SIZE);
428
429         if (code_len)
430                 *code_len = buf - code;
431         
432         return code;
433 }       
434
435 /*========================= End of Function ========================*/
436
437 /*------------------------------------------------------------------*/
438 /*                                                                  */
439 /* Name         - mono_arch_create_rgctx_lazy_fetch_trampoline      */
440 /*                                                                  */
441 /* Function     -                                                   */
442 /*                                                                  */
443 /*------------------------------------------------------------------*/
444
445 gpointer
446 mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info, gboolean aot)
447 {
448         guint8 *tramp;
449         guint8 *code, *buf;
450         guint8 **rgctx_null_jumps;
451         gint32 displace;
452         int tramp_size,
453             depth, 
454             index, 
455             iPatch = 0,
456             i;
457         gboolean mrgctx;
458         MonoJumpInfo *ji = NULL;
459         GSList *unwind_ops = NULL;
460
461         mrgctx = MONO_RGCTX_SLOT_IS_MRGCTX (slot);
462         index = MONO_RGCTX_SLOT_INDEX (slot);
463         if (mrgctx)
464                 index += MONO_SIZEOF_METHOD_RUNTIME_GENERIC_CONTEXT / sizeof (gpointer);
465         for (depth = 0; ; ++depth) {
466                 int size = mono_class_rgctx_get_array_size (depth, mrgctx);
467
468                 if (index < size - 1)
469                         break;
470                 index -= size - 1;
471         }
472
473         tramp_size = 48 + 16 * depth;
474         if (mrgctx)
475                 tramp_size += 4;
476         else
477                 tramp_size += 12;
478
479         code = buf = mono_global_codeman_reserve (tramp_size);
480
481         unwind_ops = mono_arch_get_cie_program ();
482
483         rgctx_null_jumps = g_malloc (sizeof (guint8*) * (depth + 2));
484
485         if (mrgctx) {
486                 /* get mrgctx ptr */
487                 s390_lgr (code, s390_r1, s390_r2);
488         } else {
489                 /* load rgctx ptr from vtable */
490                 s390_lg (code, s390_r1, 0, s390_r2, MONO_STRUCT_OFFSET(MonoVTable, runtime_generic_context));
491                 /* is the rgctx ptr null? */
492                 s390_ltgr (code, s390_r1, s390_r1);
493                 /* if yes, jump to actual trampoline */
494                 rgctx_null_jumps [iPatch++] = code;
495                 s390_jge (code, 0);
496         }
497
498         for (i = 0; i < depth; ++i) {
499                 /* load ptr to next array */
500                 if (mrgctx && i == 0)
501                         s390_lg (code, s390_r1, 0, s390_r1, MONO_SIZEOF_METHOD_RUNTIME_GENERIC_CONTEXT);
502                 else
503                         s390_lg (code, s390_r1, 0, s390_r1, 0);
504                 s390_ltgr (code, s390_r1, s390_r1);
505                 /* if the ptr is null then jump to actual trampoline */
506                 rgctx_null_jumps [iPatch++] = code;
507                 s390_jge (code, 0);
508         }
509
510         /* fetch slot */
511         s390_lg (code, s390_r1, 0, s390_r1, (sizeof (gpointer) * (index  + 1)));
512         /* is the slot null? */
513         s390_ltgr (code, s390_r1, s390_r1);
514         /* if yes, jump to actual trampoline */
515         rgctx_null_jumps [iPatch++] = code;
516         s390_jge (code, 0);
517         /* otherwise return r1 */
518         s390_lgr (code, s390_r2, s390_r1);
519         s390_br  (code, s390_r14);
520
521         for (i = 0; i < iPatch; i++) {
522                 displace = ((uintptr_t) code - (uintptr_t) rgctx_null_jumps[i]) / 2;
523                 s390_patch_rel ((rgctx_null_jumps [i] + 2), displace);
524         }
525
526         g_free (rgctx_null_jumps);
527
528         /* move the rgctx pointer to the VTABLE register */
529 #if MONO_ARCH_VTABLE_REG != s390_r2
530         s390_lgr (code, MONO_ARCH_VTABLE_REG, s390_r2);
531 #endif
532
533         tramp = mono_arch_create_specific_trampoline (GUINT_TO_POINTER (slot),
534                 MONO_TRAMPOLINE_RGCTX_LAZY_FETCH, mono_get_root_domain (), NULL);
535
536         /* jump to the actual trampoline */
537         displace = (tramp - code) / 2;
538         s390_jg (code, displace);
539
540         mono_arch_flush_icache (buf, code - buf);
541         MONO_PROFILER_RAISE (jit_code_buffer, (buf, code - buf, MONO_PROFILER_CODE_BUFFER_GENERICS_TRAMPOLINE, NULL));
542
543         g_assert (code - buf <= tramp_size);
544
545         char *name = mono_get_rgctx_fetch_trampoline_name (slot);
546         *info = mono_tramp_info_create (name, buf, code - buf, ji, unwind_ops);
547         g_free (name);
548
549         return(buf);
550 }       
551
552 /*========================= End of Function ========================*/
553
554 /*------------------------------------------------------------------*/
555 /*                                                                  */
556 /* Name         - mono_arch_get_static_rgctx_trampoline             */
557 /*                                                                  */
558 /* Function     - Create a trampoline which sets RGCTX_REG to ARG       */
559 /*                then jumps to ADDR.                               */
560 /*                                                                  */
561 /*------------------------------------------------------------------*/
562
563 gpointer
564 mono_arch_get_static_rgctx_trampoline (gpointer arg, gpointer addr)
565 {
566         guint8 *code, *start;
567         gint32 displace;
568         int buf_len;
569
570         MonoDomain *domain = mono_domain_get ();
571
572         buf_len = 32;
573
574         start = code = mono_domain_code_reserve (domain, buf_len);
575
576         S390_SET  (code, MONO_ARCH_RGCTX_REG, arg);
577         displace = ((uintptr_t) addr - (uintptr_t) code) / 2;
578         s390_jg   (code, displace);
579         g_assert ((code - start) < buf_len);
580
581         mono_arch_flush_icache (start, code - start);
582         MONO_PROFILER_RAISE (jit_code_buffer, (start, code - start, MONO_PROFILER_CODE_BUFFER_HELPER, NULL));
583
584         mono_tramp_info_register (mono_tramp_info_create (NULL, start, code - start, NULL, NULL), domain);
585
586         return(start);
587 }       
588
589 /*========================= End of Function ========================*/
590
591 /*------------------------------------------------------------------*/
592 /*                                                                  */
593 /* Name     - mono_arch_get_enter_icall_trampoline.                 */
594 /*                                                                  */
595 /* Function -                                                       */
596 /*                                                                  */
597 /*------------------------------------------------------------------*/
598
599 gpointer
600 mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info)
601 {
602         g_assert_not_reached ();
603         return NULL;
604 }
605
606 /*========================= End of Function ========================*/