diff options
5 files changed, 237 insertions, 0 deletions
diff --git a/debian/patches/random-fixes0001-kern-bootstrap-drop-into-the-debugger.patch b/debian/patches/random-fixes0001-kern-bootstrap-drop-into-the-debugger.patch new file mode 100644 index 0000000..ad26fe2 --- /dev/null +++ b/debian/patches/random-fixes0001-kern-bootstrap-drop-into-the-debugger.patch @@ -0,0 +1,40 @@ +From f1401610bbb8363e7f015f07b825320dd69c13ca Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 27 Sep 2015 14:35:27 +0200 +Subject: [PATCH gnumach 1/4] kern/bootstrap: drop into the debugger + +* kern/bootstrap.c (boot_script_prompt_task_resume): Drop into the +debugger instead of merely waiting for return using `safe_gets', which +disables interrupts, making it impossible to break into the debugger +using the magic keys. +--- + kern/bootstrap.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/kern/bootstrap.c b/kern/bootstrap.c +index aad0fb1..249c605 100644 +--- a/kern/bootstrap.c ++++ b/kern/bootstrap.c +@@ -824,10 +824,18 @@ boot_script_task_resume (struct cmd *cmd) + int + boot_script_prompt_task_resume (struct cmd *cmd) + { ++#if ! MACH_KDB + char xx[5]; ++#endif ++ ++ printf ("Pausing for %s...\n", cmd->path); + +- printf ("Hit return to resume %s...", cmd->path); ++#if ! MACH_KDB ++ printf ("Hit <return> to resume bootstrap."); + safe_gets (xx, sizeof xx); ++#else ++ SoftDebugger("Hit `c<return>' to resume bootstrap."); ++#endif + + return boot_script_task_resume (cmd); + } +-- +2.1.4 + diff --git a/debian/patches/random-fixes0002-Fix-build-with-DDEBUG.patch b/debian/patches/random-fixes0002-Fix-build-with-DDEBUG.patch new file mode 100644 index 0000000..5c90081 --- /dev/null +++ b/debian/patches/random-fixes0002-Fix-build-with-DDEBUG.patch @@ -0,0 +1,77 @@ +From 16a8848a4f04b429d0c76c72118a7b39002cd9c2 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 27 Sep 2015 14:40:02 +0200 +Subject: [PATCH gnumach 2/4] Fix build with -DDEBUG + +* device/cirbuf.c: Add missing include. +* i386/i386/debug.h (dump_ss): Hide declaration from assembler. +* i386/i386/debug_i386.c: Fix include. +* kern/sched_prim.h: Add missing include, fix declaration. +--- + device/cirbuf.c | 2 ++ + i386/i386/debug.h | 2 ++ + i386/i386/debug_i386.c | 2 +- + kern/sched_prim.h | 4 +++- + 4 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/device/cirbuf.c b/device/cirbuf.c +index dfb06df..391297c 100644 +--- a/device/cirbuf.c ++++ b/device/cirbuf.c +@@ -42,6 +42,8 @@ + /* if c_cl == c_cf - 1, buffer is full */ + + #if DEBUG ++#include <mach/boolean.h> ++ + boolean_t cb_check_enable = FALSE; + #define CB_CHECK(cb) if (cb_check_enable) cb_check(cb) + +diff --git a/i386/i386/debug.h b/i386/i386/debug.h +index e94649b..84397ba 100644 +--- a/i386/i386/debug.h ++++ b/i386/i386/debug.h +@@ -23,10 +23,12 @@ + #ifndef _I386_DEBUG_ + #define _I386_DEBUG_ + ++#ifndef __ASSEMBLER__ + /* Dump a saved state. + Probably a good idea to have this around + even when DEBUG isn't turned on. */ + void dump_ss(const struct i386_saved_state *st); ++#endif /* __ASSEMBLER__ */ + + #ifdef DEBUG + +diff --git a/i386/i386/debug_i386.c b/i386/i386/debug_i386.c +index 7657808..f0fe2ae 100644 +--- a/i386/i386/debug_i386.c ++++ b/i386/i386/debug_i386.c +@@ -128,7 +128,7 @@ debug_trace_dump(void) + splx(s); + } + +-#include "syscall_sw.h" ++#include <kern/syscall_sw.h> + + int syscall_trace = 0; + +diff --git a/kern/sched_prim.h b/kern/sched_prim.h +index bb1865c..dfb2f54 100644 +--- a/kern/sched_prim.h ++++ b/kern/sched_prim.h +@@ -176,7 +176,9 @@ void do_thread_scan(void); + thread_t choose_pset_thread(processor_t myprocessor, processor_set_t pset); + + #if DEBUG +-void checkrq(run_queue_t rq, char *msg); ++#include <kern/sched.h> /* for run_queue_t */ ++ ++void checkrq(run_queue_t rq, const char *msg); + void thread_check(thread_t th, run_queue_t rq); + #endif /* DEBUG */ + +-- +2.1.4 + diff --git a/debian/patches/random-fixes0003-i386-improve-syscall-tracing.patch b/debian/patches/random-fixes0003-i386-improve-syscall-tracing.patch new file mode 100644 index 0000000..41aa5f4 --- /dev/null +++ b/debian/patches/random-fixes0003-i386-improve-syscall-tracing.patch @@ -0,0 +1,72 @@ +From 625801e5ada58af77861c72514ebc5521a67398f Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 27 Sep 2015 15:34:36 +0200 +Subject: [PATCH gnumach 3/4] i386: improve syscall tracing + +* kern/syscall_sw.h (mach_trap_t): Turn unused field into `mach_trap_name'. +(MACH_TRAP, MACH_TRAP_STACK): Record name. +* i386/i386/debug_i386.c (syscall_trace_print): Use the name and +format the arguments to look like c. +--- + i386/i386/debug_i386.c | 21 ++++++++++++++++----- + kern/syscall_sw.h | 6 +++--- + 2 files changed, 19 insertions(+), 8 deletions(-) + +diff --git a/i386/i386/debug_i386.c b/i386/i386/debug_i386.c +index f0fe2ae..7a33350 100644 +--- a/i386/i386/debug_i386.c ++++ b/i386/i386/debug_i386.c +@@ -137,11 +137,22 @@ syscall_trace_print(int syscallvec, ...) + { + int syscallnum = syscallvec >> 4; + int i; +- +- printf("syscall -%d:", syscallnum); +- for (i = 0; i < mach_trap_table[syscallnum].mach_trap_arg_count; i++) +- printf(" %08x", (&syscallvec)[1+i]); +- printf("\n"); ++ const mach_trap_t *trap = &mach_trap_table[syscallnum]; ++ ++ printf("0x%08x:0x%08x:%s(", ++ current_task(), current_thread(), trap->mach_trap_name); ++ for (i = 0; i < trap->mach_trap_arg_count; i++) { ++ unsigned long value = (&syscallvec)[1+i]; ++ /* Use a crude heuristic to format pointers. */ ++ if (value > 1024) ++ printf("0x%08x", value); ++ else ++ printf("%d", value); ++ ++ if (i + 1 < trap->mach_trap_arg_count) ++ printf(", "); ++ } ++ printf(")\n"); + + return syscallvec; + } +diff --git a/kern/syscall_sw.h b/kern/syscall_sw.h +index 87fc1bb..1edf1c7 100644 +--- a/kern/syscall_sw.h ++++ b/kern/syscall_sw.h +@@ -37,15 +37,15 @@ typedef struct { + int mach_trap_arg_count; + int (*mach_trap_function)(); + boolean_t mach_trap_stack; +- int mach_trap_unused; ++ const char *mach_trap_name; + } mach_trap_t; + + extern mach_trap_t mach_trap_table[]; + extern int mach_trap_count; + + #define MACH_TRAP(name, arg_count) \ +- { (arg_count), (int (*)()) (name), FALSE, 0 } ++ { (arg_count), (int (*)()) (name), FALSE, #name } + #define MACH_TRAP_STACK(name, arg_count) \ +- { (arg_count), (int (*)()) (name), TRUE, 0 } ++ { (arg_count), (int (*)()) (name), TRUE, #name } + + #endif /* _KERN_SYSCALL_SW_H_ */ +-- +2.1.4 + diff --git a/debian/patches/random-fixes0004-i386-trace-syscalls-of-a-single-task.patch b/debian/patches/random-fixes0004-i386-trace-syscalls-of-a-single-task.patch new file mode 100644 index 0000000..123d76f --- /dev/null +++ b/debian/patches/random-fixes0004-i386-trace-syscalls-of-a-single-task.patch @@ -0,0 +1,44 @@ +From 5e8955c2ad4b51acc96fdb671c4fef924dbc7f82 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 27 Sep 2015 15:38:46 +0200 +Subject: [PATCH gnumach 4/4] i386: trace syscalls of a single task + +* i386/i386/debug_i386.c (syscall_trace_task): New variable. +(syscall_trace_print): If set, trace only syscalls from this task. +--- + i386/i386/debug_i386.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/i386/i386/debug_i386.c b/i386/i386/debug_i386.c +index 7a33350..233caa7 100644 +--- a/i386/i386/debug_i386.c ++++ b/i386/i386/debug_i386.c +@@ -131,6 +131,7 @@ debug_trace_dump(void) + #include <kern/syscall_sw.h> + + int syscall_trace = 0; ++task_t syscall_trace_task; + + int + syscall_trace_print(int syscallvec, ...) +@@ -139,6 +140,9 @@ syscall_trace_print(int syscallvec, ...) + int i; + const mach_trap_t *trap = &mach_trap_table[syscallnum]; + ++ if (syscall_trace_task && syscall_trace_task != current_task()) ++ goto out; ++ + printf("0x%08x:0x%08x:%s(", + current_task(), current_thread(), trap->mach_trap_name); + for (i = 0; i < trap->mach_trap_arg_count; i++) { +@@ -154,6 +158,7 @@ syscall_trace_print(int syscallvec, ...) + } + printf(")\n"); + ++ out: + return syscallvec; + } + +-- +2.1.4 + diff --git a/debian/patches/series b/debian/patches/series index c8a3f31..946b480 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -16,3 +16,7 @@ fix-locking0005-ipc-fix-locking-issues.patch vm-cache-policy0001-VM-cache-policy-change.patch vm-cache-policy0002-vm-keep-track-of-clean-pages.patch vm-cache-policy0003-vm-evict-clean-pages-first.patch +random-fixes0001-kern-bootstrap-drop-into-the-debugger.patch +random-fixes0002-Fix-build-with-DDEBUG.patch +random-fixes0003-i386-improve-syscall-tracing.patch +random-fixes0004-i386-trace-syscalls-of-a-single-task.patch |