summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-04-06 22:22:22 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-04-06 22:22:22 +0200
commitc7f7552f72ef54ee02018fe7686be6d12d83a5dc (patch)
treea8fdd9dc65bfae0a3cf450fbfbfdcd2c81270d32
parent6f828d10c88d68f8c2abebfd07df82af93c5ed71 (diff)
Print mach system calls
To see the initial calls from userland.
-rw-r--r--ipc/mach_msg.c2
-rw-r--r--kern/eventcount.c4
-rw-r--r--kern/ipc_host.c2
-rw-r--r--kern/ipc_mig.c28
-rw-r--r--kern/ipc_tt.c6
-rw-r--r--kern/syscall_subr.c8
-rw-r--r--kern/syscall_sw.c2
7 files changed, 51 insertions, 1 deletions
diff --git a/ipc/mach_msg.c b/ipc/mach_msg.c
index fe7d9ac8..8b589377 100644
--- a/ipc/mach_msg.c
+++ b/ipc/mach_msg.c
@@ -397,6 +397,8 @@ mach_msg_trap(
panic("oops");
printf("ID %d, %d %d %x\n", khdr.msgh_id, khdr.msgh_size, khdr.msgh_seqno, khdr.msgh_bits);
+ printf("%s %x @%p ", __func__, option, msg);
+
/* first check for common cases */
if (option == (MACH_SEND_MSG|MACH_RCV_MSG)) {
diff --git a/kern/eventcount.c b/kern/eventcount.c
index a9d7bd41..23ac4473 100644
--- a/kern/eventcount.c
+++ b/kern/eventcount.c
@@ -139,6 +139,8 @@ kern_return_t evc_wait(natural_t ev_id)
kern_return_t ret;
evc_t ev;
+ printf("%s\n", __func__);
+
if ((ev_id >= MAX_EVCS) ||
((ev = all_eventcounters[ev_id]) == 0) ||
(ev->ev_id != ev_id) || (ev->sanity != ev))
@@ -185,6 +187,8 @@ kern_return_t evc_wait_clear(natural_t ev_id)
spl_t s;
evc_t ev;
+ printf("%s\n", __func__);
+
if ((ev_id >= MAX_EVCS) ||
((ev = all_eventcounters[ev_id]) == 0) ||
(ev->ev_id != ev_id) || (ev->sanity != ev))
diff --git a/kern/ipc_host.c b/kern/ipc_host.c
index a02eb6f6..6868b0f8 100644
--- a/kern/ipc_host.c
+++ b/kern/ipc_host.c
@@ -99,6 +99,8 @@ mach_host_self(void)
{
ipc_port_t sright;
+ printf("%s\n", __func__);
+
sright = ipc_port_make_send(realhost.host_self);
return ipc_port_copyout_send(sright, current_space());
}
diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c
index 22dac420..9b4609df 100644
--- a/kern/ipc_mig.c
+++ b/kern/ipc_mig.c
@@ -636,6 +636,8 @@ syscall_vm_map(
vm_offset_t addr;
kern_return_t result;
+ printf("%s\n", __func__);
+
map = port_name_to_map(target_map);
if (map == VM_MAP_NULL)
return MACH_SEND_INTERRUPTED;
@@ -674,6 +676,8 @@ kern_return_t syscall_vm_allocate(
vm_offset_t addr;
kern_return_t result;
+ printf("%s\n", __func__);
+
map = port_name_to_map(target_map);
if (map == VM_MAP_NULL)
return MACH_SEND_INTERRUPTED;
@@ -695,6 +699,8 @@ kern_return_t syscall_vm_deallocate(
vm_map_t map;
kern_return_t result;
+ printf("%s\n", __func__);
+
map = port_name_to_map(target_map);
if (map == VM_MAP_NULL)
return MACH_SEND_INTERRUPTED;
@@ -715,6 +721,8 @@ kern_return_t syscall_task_create(
mach_port_t name;
kern_return_t result;
+ printf("%s\n", __func__);
+
t = port_name_to_task(parent_task);
if (t == TASK_NULL)
return MACH_SEND_INTERRUPTED;
@@ -739,6 +747,8 @@ kern_return_t syscall_task_terminate(mach_port_t task)
task_t t;
kern_return_t result;
+ printf("%s\n", __func__);
+
t = port_name_to_task(task);
if (t == TASK_NULL)
return MACH_SEND_INTERRUPTED;
@@ -754,6 +764,8 @@ kern_return_t syscall_task_suspend(mach_port_t task)
task_t t;
kern_return_t result;
+ printf("%s\n", __func__);
+
t = port_name_to_task(task);
if (t == TASK_NULL)
return MACH_SEND_INTERRUPTED;
@@ -773,6 +785,8 @@ kern_return_t syscall_task_set_special_port(
ipc_port_t port;
kern_return_t result;
+ printf("%s\n", __func__);
+
t = port_name_to_task(task);
if (t == TASK_NULL)
return MACH_SEND_INTERRUPTED;
@@ -806,6 +820,8 @@ syscall_mach_port_allocate(
mach_port_t name;
kern_return_t kr;
+ printf("%s\n", __func__);
+
space = port_name_to_space(task);
if (space == IS_NULL)
return MACH_SEND_INTERRUPTED;
@@ -827,6 +843,8 @@ syscall_mach_port_allocate_name(
ipc_space_t space;
kern_return_t kr;
+ printf("%s\n", __func__);
+
space = port_name_to_space(task);
if (space == IS_NULL)
return MACH_SEND_INTERRUPTED;
@@ -845,6 +863,8 @@ syscall_mach_port_deallocate(
ipc_space_t space;
kern_return_t kr;
+ printf("%s\n", __func__);
+
space = port_name_to_space(task);
if (space == IS_NULL)
return MACH_SEND_INTERRUPTED;
@@ -867,6 +887,8 @@ syscall_mach_port_insert_right(
mach_msg_type_name_t newtype;
kern_return_t kr;
+ printf("%s\n", __func__);
+
space = port_name_to_space(task);
if (space == IS_NULL)
return MACH_SEND_INTERRUPTED;
@@ -900,6 +922,8 @@ kern_return_t syscall_thread_depress_abort(mach_port_t thread)
thread_t t;
kern_return_t result;
+ printf("%s\n", __func__);
+
t = port_name_to_thread(thread);
if (t == THREAD_NULL)
return MACH_SEND_INTERRUPTED;
@@ -925,6 +949,8 @@ syscall_device_write_request(mach_port_t device_name,
/*ipc_port_t reply_port;*/
io_return_t res;
+ printf("%s\n", __func__);
+
/*
* First try to translate the device name.
*
@@ -976,6 +1002,8 @@ syscall_device_writev_request(mach_port_t device_name,
/*ipc_port_t reply_port;*/
io_return_t res;
+ printf("%s\n", __func__);
+
/*
* First try to translate the device name.
*
diff --git a/kern/ipc_tt.c b/kern/ipc_tt.c
index 04a5a92f..18624c55 100644
--- a/kern/ipc_tt.c
+++ b/kern/ipc_tt.c
@@ -517,6 +517,8 @@ mach_task_self(void)
task_t task = current_task();
ipc_port_t sright;
+ printf("%s\n", __func__);
+
sright = retrieve_task_self_fast(task);
return ipc_port_copyout_send(sright, task->itk_space);
}
@@ -539,6 +541,8 @@ mach_thread_self(void)
task_t task = thread->task;
ipc_port_t sright;
+ printf("%s\n", __func__);
+
sright = retrieve_thread_self_fast(thread);
return ipc_port_copyout_send(sright, task->itk_space);
}
@@ -561,6 +565,8 @@ mach_reply_port(void)
mach_port_t name;
kern_return_t kr;
+ printf("%s\n", __func__);
+
kr = ipc_port_alloc(current_task()->itk_space, &name, &port);
if (kr == KERN_SUCCESS)
ip_unlock(port);
diff --git a/kern/syscall_subr.c b/kern/syscall_subr.c
index 6d23462c..c79152c9 100644
--- a/kern/syscall_subr.c
+++ b/kern/syscall_subr.c
@@ -75,6 +75,8 @@ boolean_t swtch(void)
{
processor_t myprocessor;
+ printf("%s\n", __func__);
+
#if NCPUS > 1
myprocessor = current_processor();
if (myprocessor->runq.count == 0 &&
@@ -107,6 +109,8 @@ boolean_t swtch_pri(int pri)
thread_t thread = current_thread();
processor_t myprocessor;
+ printf("%s\n", __func__);
+
#if NCPUS > 1
myprocessor = current_processor();
if (myprocessor->runq.count == 0 &&
@@ -160,6 +164,8 @@ kern_return_t thread_switch(
processor_t myprocessor;
ipc_port_t port;
+ printf("%s\n", __func__);
+
/*
* Process option.
*/
@@ -381,6 +387,8 @@ thread_depress_abort(thread_t thread)
void
mach_print(const char *s)
{
+ printf("%s\n", __func__);
+
printf("%s", s);
}
#endif /* MACH_KDB */
diff --git a/kern/syscall_sw.c b/kern/syscall_sw.c
index a383e467..f16f560c 100644
--- a/kern/syscall_sw.c
+++ b/kern/syscall_sw.c
@@ -58,7 +58,7 @@
* the positive numbers) are reserved for Unix.
*/
-boolean_t kern_invalid_debug = FALSE;
+boolean_t kern_invalid_debug = TRUE;
mach_port_t null_port(void)
{