From b0039d6972f631ca7fdff2379d50ad31c3781a7d Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sun, 8 Jun 2014 11:17:08 +0200 Subject: device: fix net_rcv_msg-messages Previously, all net_rcv_msg-messages sent by net_deliver were malformed. It never was a problem in practice, since the messages are not complex and thus the kernel does not try to parse the message. struct net_rcv_msg contains an additional field of type boolean_t. This field has no associated type descriptor, so it must not be included in the message. * device/net_io.c (net_deliver): Account for the extra field in the msgh_size calculation. --- device/net_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/device/net_io.c b/device/net_io.c index 82b6fb9..a9d318e 100644 --- a/device/net_io.c +++ b/device/net_io.c @@ -467,6 +467,7 @@ boolean_t net_deliver(boolean_t nonblocking) /* remember message sizes must be rounded up */ kmsg->ikm_header.msgh_size = (((mach_msg_size_t) (sizeof(struct net_rcv_msg) + - sizeof net_kmsg(kmsg)->sent - NET_RCV_MAX + count)) + 3) &~ 3; kmsg->ikm_header.msgh_local_port = MACH_PORT_NULL; kmsg->ikm_header.msgh_kind = MACH_MSGH_KIND_NORMAL; -- cgit v1.2.3 From e4b4e64ba7d2679df6508f27ce75d90cba7f5cb5 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Mon, 9 Jun 2014 15:12:03 +0200 Subject: kern: set the name of the kernel task to 'gnumach' * kern/taks.c (task_init): Set the name of the kernel task to 'gnumach'. --- kern/task.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kern/task.c b/kern/task.c index 66eb25c..20acc6a 100644 --- a/kern/task.c +++ b/kern/task.c @@ -70,6 +70,7 @@ void task_init(void) * for other initialization. (:-() */ (void) task_create(TASK_NULL, FALSE, &kernel_task); + (void) task_set_name(kernel_task, "gnumach"); } kern_return_t task_create( -- cgit v1.2.3 From 1d1a672bcac7b36ff35e48fb9633d56c8e733343 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Mon, 9 Jun 2014 15:15:58 +0200 Subject: ddb: print task names if available * ddb/db_print.c (db_print_task): Print task name if available. * i386/i386/db_interface.c (db_task_name): Likewise. * i386/i386/db_machdep.h (DB_GNUMACH_TASK_NAME): Remove unused definition. --- ddb/db_print.c | 7 ++++++- i386/i386/db_interface.c | 4 ++-- i386/i386/db_machdep.h | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ddb/db_print.c b/ddb/db_print.c index c015d84..1cbff64 100644 --- a/ddb/db_print.c +++ b/ddb/db_print.c @@ -258,7 +258,12 @@ db_print_task( } else { if (flag & OPTION_TASK_TITLE) db_printf(" TASK THREADS\n"); - db_printf("%3d (%0*X): ", task_id, 2*sizeof(vm_offset_t), task); + if (task->name[0]) + db_printf("%3d %s (%0*X): ", task_id, task->name, + 2*sizeof(vm_offset_t), task); + else + db_printf("%3d (%0*X): ", task_id, + 2*sizeof(vm_offset_t), task); if (task->thread_count == 0) { db_printf("no threads\n"); } else { diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c index 1337685..b442b86 100644 --- a/i386/i386/db_interface.c +++ b/i386/i386/db_interface.c @@ -730,8 +730,8 @@ db_task_name( vm_offset_t vaddr, kaddr; unsigned sp; - if (task->map->pmap == kernel_pmap) { - db_printf(DB_GNUMACH_TASK_NAME); + if (task->name[0]) { + db_printf("%s", task->name); return; } diff --git a/i386/i386/db_machdep.h b/i386/i386/db_machdep.h index c6ea3ca..ae1f9c0 100644 --- a/i386/i386/db_machdep.h +++ b/i386/i386/db_machdep.h @@ -93,7 +93,6 @@ db_regs_t ddb_regs; /* register state */ #define DB_TASK_NAME_TITLE "COMMAND " #define DB_TASK_NAME_LEN 23 #define DB_NULL_TASK_NAME "? " -#define DB_GNUMACH_TASK_NAME "gnumach " /* macro for checking if a thread has used floating-point */ -- cgit v1.2.3 From 5fdfd14beb86088faa058bcd6c2b27bb41a1a510 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Mon, 9 Jun 2014 15:25:57 +0200 Subject: ddb: use db_thread_stat to format the flags * ddb/db_print.c (db_print_thread): Use db_thread_stat to format the flags. --- ddb/db_print.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ddb/db_print.c b/ddb/db_print.c index 1cbff64..e711ab6 100644 --- a/ddb/db_print.c +++ b/ddb/db_print.c @@ -194,12 +194,8 @@ db_print_thread( 2*sizeof(vm_offset_t), thread); else db_printf("(%0*X) ", 2*sizeof(vm_offset_t), thread); - db_printf("%c%c%c%c%c", - (thread->state & TH_RUN) ? 'R' : ' ', - (thread->state & TH_WAIT) ? 'W' : ' ', - (thread->state & TH_SUSP) ? 'S' : ' ', - (thread->state & TH_UNINT)? 'N' : ' ', - db_thread_fp_used(thread) ? 'F' : ' '); + char status[8]; + db_printf("%s", db_thread_stat(thread, status)); if (thread->state & TH_SWAPPED) { if (thread->swap_func) { db_printf("("); -- cgit v1.2.3 From 24367e94ccb1e1b74b865d27ec31184184cd98e7 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Mon, 9 Jun 2014 17:40:18 +0200 Subject: i386: reformat the key map * i386/i386at/kd.c (key_map): Remove superfluous newlines so that every entry fits into one line. This way line numbers can be used as an index into the map. --- i386/i386at/kd.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c index 9f9faf4..5371fb2 100644 --- a/i386/i386at/kd.c +++ b/i386/i386at/kd.c @@ -240,8 +240,7 @@ unsigned char key_map[NUMKEYS][WIDTH_KMAP] = { {K_LBRKT,NC,NC, K_LBRACE,NC,NC, K_ESC,NC,NC, 0x1b,K_LBRKT,NC, 0x1b,0x4e,K_LBRACE}, {K_RBRKT,NC,NC, K_RBRACE,NC,NC, K_GS,NC,NC, 0x1b,K_RBRKT,NC, 0x1b,0x4e,K_RBRACE}, {K_CR,NC,NC, K_CR,NC,NC, K_CR,NC,NC, 0x1b,K_CR,NC,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_F1, K_F1A, K_F1S}, {K_F2, K_F2S, K_F2, K_F2A, K_F2S}, {K_F3, K_F3S, K_F3, K_F3A, K_F3S}, @@ -285,20 +280,16 @@ unsigned char key_map[NUMKEYS][WIDTH_KMAP] = { {K_F8, K_F8S, K_F8, K_F8A, K_F8S}, {K_F9, K_F9S, K_F9, K_F9A, K_F9S}, {K_F10, K_F10S, K_F10, K_F10A, K_F10S}, -{K_SCAN,K_NLCKSC,NC, K_SCAN,K_NLCKSC,NC, K_SCAN,K_NLCKSC,NC, - K_SCAN,K_NLCKSC,NC, K_SCAN,K_NLCKSC,NC}, +{K_SCAN,K_NLCKSC,NC, K_SCAN,K_NLCKSC,NC, K_SCAN,K_NLCKSC,NC, K_SCAN,K_NLCKSC,NC, K_SCAN,K_NLCKSC,NC}, {K_SCRL, K_NUL,NC,NC, K_SCRL, K_SCRL, K_NUL,NC,NC}, {K_HOME, K_SEVEN,NC,NC, K_HOME, K_HOME, 0x1b,0x4e,K_SEVEN}, {K_UA, K_EIGHT,NC,NC, K_UA, K_UA, 0x1b,0x4e,K_EIGHT}, {K_PUP, K_NINE,NC,NC, K_PUP, K_PUP, 0x1b,0x4e,K_NINE}, -{0x1b,0x5b,0x53, K_MINUS,NC,NC, 0x1b,0x5b,0x53, 0x1b,0x5b,0x53, - 0x1b,0x4e,0x2d}, +{0x1b,0x5b,0x53, K_MINUS,NC,NC, 0x1b,0x5b,0x53, 0x1b,0x5b,0x53, 0x1b,0x4e,0x2d}, {K_LA, K_FOUR,NC,NC, K_LA, K_LA, 0x1b,0x4e,K_FOUR}, -{0x1b,0x5b,0x47, K_FIVE,NC,NC, 0x1b,0x5b,0x47, 0x1b,0x5b,0x47, - 0x1b,0x4e,0x35}, +{0x1b,0x5b,0x47, K_FIVE,NC,NC, 0x1b,0x5b,0x47, 0x1b,0x5b,0x47, 0x1b,0x4e,0x35}, {K_RA, K_SIX,NC,NC, K_RA, K_RA, 0x1b,0x4e,K_SIX}, -{0x1b,0x5b,0x54, K_PLUS,NC,NC, 0x1b,0x5b,0x54, 0x1b,0x5b,0x54, - 0x1b,0x4e,0x2b}, +{0x1b,0x5b,0x54, K_PLUS,NC,NC, 0x1b,0x5b,0x54, 0x1b,0x5b,0x54, 0x1b,0x4e,0x2b}, {K_END, K_ONE,NC,NC, K_END, K_END, 0x1b,0x4e,K_ONE}, {K_DA, K_TWO,NC,NC, K_DA, K_DA, 0x1b,0x4e,K_TWO}, {K_PDN, K_THREE,NC,NC, K_PDN, K_PDN, 0x1b,0x4e,K_THREE}, -- cgit v1.2.3 From d18f4890ffb8d407a9c94c251f01712ecef767ca Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Mon, 9 Jun 2014 18:15:47 +0200 Subject: i386: remap some keys As a convenience for the nice people using our debugger, remap some keys to the readline-like shortcuts supported by dde. * i386/i386at/kd.c (kdcnmaygetc): Remap some keys. --- i386/i386at/kd.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c index 5371fb2..7339767 100644 --- a/i386/i386at/kd.c +++ b/i386/i386at/kd.c @@ -3029,6 +3029,39 @@ kdcnmaygetc(void) #ifdef notdef cnsetleds(state2leds(kd_state)); #endif + } else if (! up + && c == K_ESC + && key_map[scancode][char_idx+1] == 0x5b) { + /* As a convenience for the nice + people using our debugger, remap + some keys to the readline-like + shortcuts supported by dde. + + XXX This is a workaround for the + limited kernel getchar interface. + It is only used by the debugger. */ + c = key_map[scancode][char_idx+2]; + switch (c) { +#define _MAP(A,B,C) (C) +#define MAP(T) _MAP(T) +#define CTRL(c) ((c) & 0x1f) + case MAP(K_HOME): c = CTRL('a'); break; + case MAP(K_UA): c = CTRL('p'); break; + case MAP(K_LA): c = CTRL('b'); break; + case MAP(K_RA): c = CTRL('f'); break; + case MAP(K_DA): c = CTRL('n'); break; + case MAP(K_END): c = CTRL('e'); break; + /* delete */ + case 0x39: c = CTRL('d'); break; +#undef CTRL +#undef MAP +#undef _MAP + default: + /* Retain the old behavior. */ + c = K_ESC; + } + + return(c); } else if (!up) { /* regular key-down */ if (c == K_CR) -- cgit v1.2.3 From 0ab9ef8ab8c57ab83cb01bef37ca6d30395a43a2 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Mon, 9 Jun 2014 18:33:30 +0200 Subject: doc: explain the floating point flag in kdb output * doc/mach.texi (Kernel Debugger Commands): Explain the floating point flag. --- doc/mach.texi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/mach.texi b/doc/mach.texi index 49c0d67..2da670f 100644 --- a/doc/mach.texi +++ b/doc/mach.texi @@ -7029,8 +7029,9 @@ session. If the execution is resumed again, the numbers may change. The current thread can be distinguished from others by a @code{#} after the thread id instead of @code{:}. Without @code{l} option, it only shows thread id, thread structure address and the status for each -thread. The status consists of 5 letters, R(run), W(wait), S(suspended), -O(swapped out) and N(interruptible), and if corresponding +thread. The status consists of 6 letters, R(run), W(wait), S(suspended), +O(swapped out), N(interruptible), and F(loating) point arithmetic used (if +supported by the platform). If the corresponding status bit is off, @code{.} is printed instead. If @code{l} option is specified, more detail information is printed for each thread. -- cgit v1.2.3