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_port.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'ipc/ipc_port.c') diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c index 86a4ee2a..a0006cf4 100644 --- a/ipc/ipc_port.c +++ b/ipc/ipc_port.c @@ -96,7 +96,7 @@ ipc_port_timestamp(void) kern_return_t ipc_port_dnrequest( ipc_port_t port, - mach_port_t name, + mach_port_name_t name, ipc_port_t soright, ipc_port_request_index_t *indexp) { @@ -234,7 +234,7 @@ ipc_port_dngrow(ipc_port_t port) ipc_port_t ipc_port_dncancel( ipc_port_t port, - mach_port_t name, + mach_port_name_t name, ipc_port_request_index_t index) { ipc_port_request_t ipr, table; @@ -506,9 +506,9 @@ ipc_port_clear_receiver( void ipc_port_init( - ipc_port_t port, - ipc_space_t space, - mach_port_t name) + ipc_port_t port, + ipc_space_t space, + mach_port_name_t name) { /* port->ip_kobject doesn't have to be initialized */ @@ -553,11 +553,11 @@ ipc_port_init( kern_return_t ipc_port_alloc( ipc_space_t space, - mach_port_t *namep, + mach_port_name_t *namep, ipc_port_t *portp) { ipc_port_t port; - mach_port_t name; + mach_port_name_t name; kern_return_t kr; kr = ipc_object_alloc(space, IOT_PORT, @@ -593,7 +593,7 @@ ipc_port_alloc( kern_return_t ipc_port_alloc_name( ipc_space_t space, - mach_port_t name, + mach_port_name_t name, ipc_port_t *portp) { ipc_port_t port; @@ -734,7 +734,7 @@ ipc_port_destroy( for (index = 1; index < size; index++) { ipc_port_request_t ipr = &dnrequests[index]; - mach_port_t name = ipr->ipr_name; + mach_port_name_t name = ipr->ipr_name; ipc_port_t soright; if (name == MACH_PORT_NULL) @@ -911,7 +911,7 @@ ipc_port_check_circularity( ipc_port_t ipc_port_lookup_notify( ipc_space_t space, - mach_port_t name) + mach_port_name_t name) { ipc_port_t port; ipc_entry_t entry; @@ -1008,12 +1008,12 @@ ipc_port_copy_send( * Nothing locked. */ -mach_port_t +mach_port_name_t ipc_port_copyout_send( ipc_port_t sright, ipc_space_t space) { - mach_port_t name; + mach_port_name_t name; if (IP_VALID(sright)) { kern_return_t kr; @@ -1029,7 +1029,7 @@ ipc_port_copyout_send( name = MACH_PORT_NULL; } } else - name = (mach_port_t) sright; + name = (mach_port_name_t) sright; return name; } @@ -1197,7 +1197,7 @@ ipc_port_alloc_special(ipc_space_t space) * the fast rpc path). */ - ipc_port_init(port, space, (mach_port_t)port); + ipc_port_init(port, space, (mach_port_name_t)port); return port; } -- cgit v1.2.3