+ /*---------------------------------------------------------------*/
+ /* we build the MonoLMF structure on the stack - see mini-s390.h */
+ /* Keep in sync with the code in mono_arch_emit_prolog */
+ /*---------------------------------------------------------------*/
+ lmfOffset = CREATE_STACK_SIZE - sizeof(MonoLMF);
+
+ s390_lgr (buf, s390_r13, STK_BASE);
+ s390_aghi (buf, s390_r13, lmfOffset);
+
+ /*---------------------------------------------------------------*/
+ /* Set lmf.lmf_addr = jit_tls->lmf */
+ /*---------------------------------------------------------------*/
+ s390_stg (buf, s390_r2, 0, s390_r13,
+ G_STRUCT_OFFSET(MonoLMF, lmf_addr));
+
+ /*---------------------------------------------------------------*/
+ /* Get current lmf */
+ /*---------------------------------------------------------------*/
+ s390_lg (buf, s390_r0, 0, s390_r2, 0);
+
+ /*---------------------------------------------------------------*/
+ /* Set our lmf as the current lmf */
+ /*---------------------------------------------------------------*/
+ s390_stg (buf, s390_r13, 0, s390_r2, 0);
+
+ /*---------------------------------------------------------------*/
+ /* Have our lmf.previous_lmf point to the last lmf */
+ /*---------------------------------------------------------------*/
+ s390_stg (buf, s390_r0, 0, s390_r13,
+ G_STRUCT_OFFSET(MonoLMF, previous_lmf));
+
+ /*---------------------------------------------------------------*/
+ /* save method info */
+ /*---------------------------------------------------------------*/
+ s390_lg (buf, s390_r1, 0, STK_BASE, METHOD_SAVE_OFFSET);
+ s390_stg (buf, s390_r1, 0, s390_r13,
+ G_STRUCT_OFFSET(MonoLMF, method));
+
+ /*---------------------------------------------------------------*/
+ /* save the current SP */
+ /*---------------------------------------------------------------*/
+ s390_lg (buf, s390_r1, 0, STK_BASE, 0);
+ s390_stg (buf, s390_r1, 0, s390_r13, G_STRUCT_OFFSET(MonoLMF, ebp));
+
+ /*---------------------------------------------------------------*/
+ /* save the current IP */
+ /*---------------------------------------------------------------*/
+ if (tramp_type == MONO_TRAMPOLINE_JUMP) {
+ s390_lghi (buf, s390_r1, 0);
+ } else {
+ s390_lg (buf, s390_r1, 0, s390_r1, S390_RET_ADDR_OFFSET);
+// s390_la (buf, s390_r1, 0, s390_r1, 0);
+ }
+ s390_stg (buf, s390_r1, 0, s390_r13, G_STRUCT_OFFSET(MonoLMF, eip));
+
+ /*---------------------------------------------------------------*/
+ /* Save general and floating point registers */
+ /*---------------------------------------------------------------*/
+ s390_stmg (buf, s390_r2, s390_r12, s390_r13,
+ G_STRUCT_OFFSET(MonoLMF, gregs[2]));
+ for (i = 0; i < 16; i++) {
+ s390_std (buf, i, 0, s390_r13,
+ G_STRUCT_OFFSET(MonoLMF, fregs[i]));
+ }
+
+ /*---------------------------------------------------------------*/
+ /* STEP 2: call 's390_magic_trampoline()', who will compile the */
+ /* code and fix the method vtable entry for us */
+ /*---------------------------------------------------------------*/