kernel: show current task id, thread id, and cpu id in test messages

This commit is contained in:
2024-09-17 17:49:34 +01:00
parent ef05233dcf
commit 8497962af6

View File

@@ -15,10 +15,6 @@
#include <socks/tty.h> #include <socks/tty.h>
#include <stdint.h> #include <stdint.h>
#ifdef KEXT_NET_DOORSTUCK_SOCKS_FBCON
#include <socks/fbcon.h>
#endif
extern unsigned long get_rflags(void); extern unsigned long get_rflags(void);
extern char __pstart[], __pend[]; extern char __pstart[], __pend[];
@@ -30,19 +26,30 @@ void print_kernel_banner(void)
static void hang(void) static void hang(void)
{ {
struct task *self = current_task();
struct thread *thread = current_thread();
while (1) { while (1) {
printk("%d: tick", this_cpu()); printk("[cpu %u, task %u, thread %u]: tick",
this_cpu(),
self->t_id,
thread->tr_id);
milli_sleep(2000); milli_sleep(2000);
} }
} }
void background_thread(void) void background_thread(void)
{ {
struct task *self = current_task();
struct thread *thread = current_thread();
printk("background_thread() running on processor %u", this_cpu()); printk("background_thread() running on processor %u", this_cpu());
milli_sleep(1000); milli_sleep(1000);
while (1) { while (1) {
printk("%d: tock", this_cpu()); printk("[cpu %u, task %u, thread %u]: tock",
this_cpu(),
self->t_id,
thread->tr_id);
milli_sleep(2000); milli_sleep(2000);
} }
} }