From e4e3014f3ee86c540bcff05ee28f4b0165cfb920 Mon Sep 17 00:00:00 2001 From: ltrk2 <107155950+ltrk2@users.noreply.github.com> Date: Thu, 11 May 2023 12:14:47 -0700 Subject: [PATCH] Store entry point arguments in fibre's own context (s390x) --- src/asm/jump_s390x_sysv_elf_gas.S | 10 +++++----- src/asm/make_s390x_sysv_elf_gas.S | 2 +- src/asm/ontop_s390x_sysv_elf_gas.S | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/asm/jump_s390x_sysv_elf_gas.S b/src/asm/jump_s390x_sysv_elf_gas.S index c2a578b..1dc5600 100644 --- a/src/asm/jump_s390x_sysv_elf_gas.S +++ b/src/asm/jump_s390x_sysv_elf_gas.S @@ -131,11 +131,11 @@ jump_fcontext: ltg %r2,GR_OFFSET(%r15) jnz use_return_slot - /* We restore a make_fcontext context. Use the function - argument slot in the context we just saved and allocate the - register save area for the target function. */ - la %r2,ARG_OFFSET(%r1) - aghi %r15,-REG_SAVE_AREA_SIZE + /* We're restoring a context created by make_fcontext. + Use the function argument slot in the current context + and make sure it isn't deallocated. */ + la %r2,ARG_OFFSET(%r15) + aghi %r15,-CONTEXT_SIZE use_return_slot: /* Save the two fields in transfer_t. When calling a diff --git a/src/asm/make_s390x_sysv_elf_gas.S b/src/asm/make_s390x_sysv_elf_gas.S index e7e2d5f..97778dd 100644 --- a/src/asm/make_s390x_sysv_elf_gas.S +++ b/src/asm/make_s390x_sysv_elf_gas.S @@ -71,7 +71,7 @@ r4 - The address of the context function make_fcontext: .machine "z10" - /* Align the stack to an 8 byte boundary. */ + /* Align the stack to an 16 byte boundary. */ nill %r2,0xfff0 /* Allocate stack space for the context. */ diff --git a/src/asm/ontop_s390x_sysv_elf_gas.S b/src/asm/ontop_s390x_sysv_elf_gas.S index 709b3d6..fa7d112 100644 --- a/src/asm/ontop_s390x_sysv_elf_gas.S +++ b/src/asm/ontop_s390x_sysv_elf_gas.S @@ -82,6 +82,7 @@ created via make_fcontext. */ ontop_fcontext: + .machine "z10" /* Reserve stack space to store the current context. */ aghi %r15,-CONTEXT_SIZE