[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/15] fix argument passing to bootstrap modules
From: |
Luca Dariz |
Subject: |
[PATCH 03/15] fix argument passing to bootstrap modules |
Date: |
Tue, 28 Jun 2022 12:10:42 +0200 |
* kern/bootstrap.c: use rpc_ vm types to put the bootstrap module
arguments on the stack, make it consistent with user-space types.
Signed-off-by: Luca Dariz <luca@orpolo.org>
---
kern/bootstrap.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index 60648c9d..259821ae 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -612,7 +612,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
* and align to integer boundary
*/
arg_len += (sizeof(integer_t)
- + (arg_count + 1 + envc + 1) * sizeof(char *));
+ + (arg_count + 1 + envc + 1) * sizeof(rpc_vm_offset_t));
arg_len = (arg_len + sizeof(integer_t) - 1) & ~(sizeof(integer_t)-1);
/*
@@ -633,7 +633,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
*/
string_pos = (arg_pos
+ sizeof(integer_t)
- + (arg_count + 1 + envc + 1) * sizeof(char *));
+ + (arg_count + 1 + envc + 1) * sizeof(rpc_vm_offset_t));
/*
* first the argument count
@@ -651,10 +651,8 @@ build_args_and_stack(struct exec_info *boot_exec_info,
arg_item_len = strlen(arg_ptr) + 1; /* include trailing 0 */
/* set string pointer */
- (void) copyout(&string_pos,
- arg_pos,
- sizeof (char *));
- arg_pos += sizeof(char *);
+ (void) copyout(&string_pos, arg_pos, sizeof (rpc_vm_offset_t));
+ arg_pos += sizeof(rpc_vm_offset_t);
/* copy string */
(void) copyout(arg_ptr, string_pos, arg_item_len);
@@ -664,8 +662,8 @@ build_args_and_stack(struct exec_info *boot_exec_info,
/*
* Null terminator for argv.
*/
- (void) copyout(&zero, arg_pos, sizeof(char *));
- arg_pos += sizeof(char *);
+ (void) copyout(&zero, arg_pos, sizeof(rpc_vm_offset_t));
+ arg_pos += sizeof(rpc_vm_offset_t);
/*
* Then the strings and string pointers for each environment variable
@@ -675,10 +673,8 @@ build_args_and_stack(struct exec_info *boot_exec_info,
arg_item_len = strlen(arg_ptr) + 1; /* include trailing 0 */
/* set string pointer */
- (void) copyout(&string_pos,
- arg_pos,
- sizeof (char *));
- arg_pos += sizeof(char *);
+ (void) copyout(&string_pos, arg_pos, sizeof (rpc_vm_offset_t));
+ arg_pos += sizeof(rpc_vm_offset_t);
/* copy string */
(void) copyout(arg_ptr, string_pos, arg_item_len);
@@ -688,7 +684,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
/*
* Null terminator for envp.
*/
- (void) copyout(&zero, arg_pos, sizeof(char *));
+ (void) copyout(&zero, arg_pos, sizeof(rpc_vm_offset_t));
}
--
2.30.2
- [PATCH 00/15] Add preliminary support for 32-bit userspace on a x86_64 kernel, Luca Dariz, 2022/06/28
- [PATCH 01/15] fix rpc types for KERNEL_USER stubs, Luca Dariz, 2022/06/28
- [PATCH 03/15] fix argument passing to bootstrap modules,
Luca Dariz <=
- [PATCH 06/15] kmsg: fix msg body alignment, Luca Dariz, 2022/06/28
- [PATCH 09/15] x86_64: fix exception stack alignment, Luca Dariz, 2022/06/28
- [PATCH 04/15] compute mach port size from the corresponding type, Luca Dariz, 2022/06/28
- [PATCH 05/15] sign-extend mask in vm_map() with 32-bit userspace, Luca Dariz, 2022/06/28
- [PATCH 08/15] use port name type in mach_port_names(), Luca Dariz, 2022/06/28
- [PATCH 10/15] x86_64: expand and shrink messages in copy{in, out}msg routines, Luca Dariz, 2022/06/28
- [PATCH 02/15] simplify ipc_kmsg_copyout_body() usage, Luca Dariz, 2022/06/28
- [PATCH 07/15] fix host_info structure definition, Luca Dariz, 2022/06/28
- [PATCH 11/15] update syscall signature with rpc_vm_* and mach_port_name_t, Luca Dariz, 2022/06/28
- [PATCH 15/15] enable syscalls on x86_64, Luca Dariz, 2022/06/28