aboutsummaryrefslogtreecommitdiff
path: root/kernel/trap.c
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-02 20:47:19 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-02 20:47:19 +0100
commit32e880127366fabc3e8b4fecb642f1cc06b8fd71 (patch)
treedf11bd7d7895ac0dde245383b4a10a51f83fc659 /kernel/trap.c
parenta7287a7891d9ead98221c3de79d46d487e0d68ac (diff)
downloadfbos-32e880127366.tar.gz
fbos-32e880127366.zip
Prepend the name of the task on debug
On 'printk' and 'sys_write' calls, prepend the name of the task that is being executed for each message. This is an easy way to show off that we are doing the right thing with the 'tp' register, even if we don't do much with it. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'kernel/trap.c')
-rw-r--r--kernel/trap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/trap.c b/kernel/trap.c
index 54bf6aa..29f1c21 100644
--- a/kernel/trap.c
+++ b/kernel/trap.c
@@ -52,7 +52,7 @@ __kernel __always_inline void exception_handler(uint64_t cause)
die("Bad syscall\n");
}
- write(message, n);
+ sys_write(message, n);
}
/*
@@ -75,7 +75,7 @@ __aligned(4) __s_interrupt __kernel void interrupt_handler(void)
if (IS_EXCEPTION(cause)) {
exception_handler(cause);
- set_return_address_to(TASK_INIT);
+ prepare_switch_to(TASK_INIT);
goto end;
}
@@ -91,11 +91,11 @@ __aligned(4) __s_interrupt __kernel void interrupt_handler(void)
// BEHOLD! The fizz buzz logic! :D
seconds_elapsed += 1;
if ((seconds_elapsed % 15) == 0) {
- set_return_address_to(TASK_FIZZBUZZ);
+ prepare_switch_to(TASK_FIZZBUZZ);
} else if ((seconds_elapsed % 5) == 0) {
- set_return_address_to(TASK_BUZZ);
+ prepare_switch_to(TASK_BUZZ);
} else if ((seconds_elapsed % 3) == 0) {
- set_return_address_to(TASK_FIZZ);
+ prepare_switch_to(TASK_FIZZ);
}
// Re-enable timer interrupts.