From 958686efa2175abe3f7044890c2c2370e29147f2 Mon Sep 17 00:00:00 2001 From: Flavio Cruz Date: Wed, 30 Nov 2022 02:14:20 -0500 Subject: Update ipc/ directory to use mach_port_name_t Make it explicit where we use port names versus actual ports. For the 64 bit kernel, port names and ports are of different size so this corrects the syscall arguments and internal structs to have the right size. This patch also uncovered several issues we need to solve to make GNUMach work well on 64 bits. First, the mach_msg call will receive 4 byte port names while the kernel "thinks" they are 8 bytes, which will be a problem. Also, when we send a message, the kernel translates the port names into port pointers in the message copied from user space. This also won't work on 64 bits. In this patch, I added several TODOs to fix the issues later. Message-Id: --- ipc/ipc_entry.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'ipc/ipc_entry.c') diff --git a/ipc/ipc_entry.c b/ipc/ipc_entry.c index 0414ba5f..c24ea46c 100644 --- a/ipc/ipc_entry.c +++ b/ipc/ipc_entry.c @@ -67,7 +67,7 @@ struct kmem_cache ipc_entry_cache; kern_return_t ipc_entry_alloc( ipc_space_t space, - mach_port_t *namep, + mach_port_name_t *namep, ipc_entry_t *entryp) { kern_return_t kr; @@ -97,10 +97,10 @@ ipc_entry_alloc( entry->ie_bits = 0; entry->ie_object = IO_NULL; entry->ie_request = 0; - entry->ie_name = (mach_port_t) key; + entry->ie_name = (mach_port_name_t) key; *entryp = entry; - *namep = (mach_port_t) key; + *namep = (mach_port_name_t) key; return KERN_SUCCESS; } @@ -121,7 +121,7 @@ ipc_entry_alloc( kern_return_t ipc_entry_alloc_name( ipc_space_t space, - mach_port_t name, + mach_port_name_t name, ipc_entry_t *entryp) { kern_return_t kr; @@ -198,12 +198,11 @@ ipc_entry_alloc_name( ipc_entry_t db_ipc_object_by_name( const task_t task, - mach_port_t name) + mach_port_name_t name) { ipc_space_t space = task->itk_space; ipc_entry_t entry; - entry = ipc_entry_lookup(space, name); if(entry != IE_NULL) { iprintf("(task 0x%x, name 0x%x) ==> object 0x%x", -- cgit v1.2.3