From 75f76d10aad328a1af5961cb365a2b4325b98d8e Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Tue, 9 May 2023 00:31:22 +0300 Subject: boot: Port to x64_64 Message-Id: <20230508213136.608575-28-bugaevc@gmail.com> --- boot/userland-boot.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'boot/userland-boot.c') diff --git a/boot/userland-boot.c b/boot/userland-boot.c index 2f9bd8cd..f407f0a6 100644 --- a/boot/userland-boot.c +++ b/boot/userland-boot.c @@ -257,7 +257,7 @@ boot_script_exec_cmd (void *hook, { char *args, *p; int arg_len, i; - size_t reg_size; + mach_msg_type_number_t reg_size; void *arg_pos; vm_offset_t stack_start, stack_end; vm_address_t startpc, str_start; @@ -313,8 +313,13 @@ boot_script_exec_cmd (void *hook, reg_size = i386_THREAD_STATE_COUNT; thread_get_state (thread, i386_THREAD_STATE, (thread_state_t) ®s, ®_size); - regs.eip = (int) startpc; - regs.uesp = (int) arg_pos; +#ifdef __x86_64__ + regs.rip = (uintptr_t) startpc; + regs.ursp = (uintptr_t) arg_pos; +#else + regs.eip = (uintptr_t) startpc; + regs.uesp = (uintptr_t) arg_pos; +#endif thread_set_state (thread, i386_THREAD_STATE, (thread_state_t) ®s, reg_size); } -- cgit v1.2.3