]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
semihosting: Retrieve stack top from image_info
authorRichard Henderson <richard.henderson@linaro.org>
Sat, 2 Aug 2025 00:12:01 +0000 (10:12 +1000)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 27 Aug 2025 20:39:25 +0000 (06:39 +1000)
Remove the write-once field TaskState.stack_base, and use the
same value from struct image_info.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
linux-user/aarch64/cpu_loop.c
linux-user/arm/cpu_loop.c
linux-user/m68k/cpu_loop.c
linux-user/qemu.h
linux-user/riscv/cpu_loop.c
semihosting/arm-compat-semi.c

index fea43cefa6bc96a92819c4205aa5f4a680fd4abb..b65999a75bff17e99dec7d8d9f625972a091560d 100644 (file)
@@ -168,7 +168,6 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
         qemu_guest_getrandom_nofail(&env->keys, sizeof(env->keys));
     }
 
-    ts->stack_base = info->start_stack;
     ts->heap_base = info->brk;
     /* This will be filled in on the first SYS_HEAPINFO call.  */
     ts->heap_limit = 0;
index 33f63951a958a5a48ced2d1e187264d691e5c940..e40d6beafa27916a98e085f3c411b4b95282e213 100644 (file)
@@ -504,7 +504,6 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
     arm_rebuild_hflags(env);
 #endif
 
-    ts->stack_base = info->start_stack;
     ts->heap_base = info->brk;
     /* This will be filled in on the first SYS_HEAPINFO call.  */
     ts->heap_limit = 0;
index 5da91b997ae382b05987d542a35a40a444a8fcdd..3aaaf02ca4ee9b3c7db03c8af8a018a3a178d39d 100644 (file)
@@ -117,7 +117,6 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
     env->aregs[7] = regs->usp;
     env->sr = regs->sr;
 
-    ts->stack_base = info->start_stack;
     ts->heap_base = info->brk;
     /* This will be filled in on the first SYS_HEAPINFO call.  */
     ts->heap_limit = 0;
index 0b19fa43e651169565aec604820536d516101d9a..b6621536b36e231dd37b0427e744f6678b64c54d 100644 (file)
@@ -127,7 +127,6 @@ struct TaskState {
     abi_ulong heap_base;
     abi_ulong heap_limit;
 #endif
-    abi_ulong stack_base;
     int used; /* non zero if used */
     struct image_info *info;
     struct linux_binprm *bprm;
index 3ac8bbfec1f49f576bb5daf16d8ae9652d99896c..541de765ffae4c683035ad4d4716291ffb033108 100644 (file)
@@ -109,7 +109,6 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
         exit(EXIT_FAILURE);
     }
 
-    ts->stack_base = info->start_stack;
     ts->heap_base = info->brk;
     /* This will be filled in on the first SYS_HEAPINFO call.  */
     ts->heap_limit = 0;
index 86e5260e504be48e47189ca0f094811acd6189ce..bc04b02eba8e077b4a772a619c3e867432ef13aa 100644 (file)
@@ -696,7 +696,11 @@ void do_common_semihosting(CPUState *cs)
 
             retvals[0] = ts->heap_base;
             retvals[1] = ts->heap_limit;
-            retvals[2] = ts->stack_base;
+            /*
+             * Note that semihosting is *not* thread aware.
+             * Always return the stack base of the main thread.
+             */
+            retvals[2] = ts->info->start_stack;
             retvals[3] = 0; /* Stack limit.  */
 #else
             retvals[0] = info.heapbase;  /* Heap Base */