summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
Diffstat (limited to 'kern')
-rw-r--r--kern/exception.c18
-rw-r--r--kern/ipc_mig.c14
2 files changed, 11 insertions, 21 deletions
diff --git a/kern/exception.c b/kern/exception.c
index 7954fba..6e84c0a 100644
--- a/kern/exception.c
+++ b/kern/exception.c
@@ -603,30 +603,18 @@ exception_raise(
ip_unlock(reply_port);
{
- ipc_entry_t table;
+ kern_return_t kr;
ipc_entry_t entry;
- mach_port_index_t index;
-
- /* optimized ipc_entry_get */
-
- table = space->is_table;
- index = table->ie_next;
- if (index == 0)
+ kr = ipc_entry_get (space, &exc->Head.msgh_remote_port, &entry);
+ if (kr)
goto abort_copyout;
-
- entry = &table[index];
- table->ie_next = entry->ie_next;
- entry->ie_request = 0;
-
{
mach_port_gen_t gen;
assert((entry->ie_bits &~ IE_BITS_GEN_MASK) == 0);
gen = entry->ie_bits + IE_BITS_GEN_ONE;
- exc->Head.msgh_remote_port = MACH_PORT_MAKE(index, gen);
-
/* optimized ipc_right_copyout */
entry->ie_bits = gen | (MACH_PORT_TYPE_SEND_ONCE | 1);
diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c
index cc61ec7..22dac42 100644
--- a/kern/ipc_mig.c
+++ b/kern/ipc_mig.c
@@ -310,16 +310,18 @@ mig_strncpy(dest, src, len)
MACRO_BEGIN \
ipc_space_t space = current_space(); \
ipc_entry_t entry; \
- mach_port_index_t index = MACH_PORT_INDEX(name); \
\
is_read_lock(space); \
assert(space->is_active); \
\
- if ((index >= space->is_table_size) || \
- (((entry = &space->is_table[index])->ie_bits & \
- (IE_BITS_GEN_MASK|MACH_PORT_TYPE_SEND)) != \
- (MACH_PORT_GEN(name) | MACH_PORT_TYPE_SEND))) { \
- is_read_unlock(space); \
+ entry = ipc_entry_lookup (space, name); \
+ if (entry == IE_NULL) { \
+ is_read_unlock (space); \
+ abort; \
+ } \
+ \
+ if (IE_BITS_TYPE (entry->ie_bits) != MACH_PORT_TYPE_SEND) { \
+ is_read_unlock (space); \
abort; \
} \
\