git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: kprintf now goes into dedicated pseudo-dev rather than flooding the framebuffer
[lunaix-os.git]
/
lunaix-os
/
kernel
/
spike.c
diff --git
a/lunaix-os/kernel/spike.c
b/lunaix-os/kernel/spike.c
index 4686b12ce3667f3b51f26ae609b78a0acf246a1c..63414c25e4bac73508e6a16c484477572464cfdd 100644
(file)
--- a/
lunaix-os/kernel/spike.c
+++ b/
lunaix-os/kernel/spike.c
@@
-1,10
+1,10
@@
-#include <arch/x86/interrupts.h>
-#include <klibc/stdio.h>
+#include <klibc/strfmt.h>
#include <lunaix/spike.h>
#include <lunaix/spike.h>
+#include <sys/interrupts.h>
static char buffer[1024];
static char buffer[1024];
-void
+void
noret
__assert_fail(const char* expr, const char* file, unsigned int line)
{
ksprintf(buffer, "%s (%s:%u)", expr, file, line);
__assert_fail(const char* expr, const char* file, unsigned int line)
{
ksprintf(buffer, "%s (%s:%u)", expr, file, line);
@@
-13,16
+13,16
@@
__assert_fail(const char* expr, const char* file, unsigned int line)
// This is a convention we made that the LUNAIX_SYS_PANIC syscall will
// print the panic message passed via %edi. (see
// kernel/asm/x86/interrupts.c)
// This is a convention we made that the LUNAIX_SYS_PANIC syscall will
// print the panic message passed via %edi. (see
// kernel/asm/x86/interrupts.c)
-
asm("int %0" ::"i"(LUNAIX_SYS_PANIC), "D"(buffer)
);
+
cpu_trap_panic(buffer
);
-
DO_SPIN
// never reach
+
spin();
// never reach
}
}
-void
+void
noret
panick(const char* msg)
{
panick(const char* msg)
{
-
asm("int %0" ::"i"(LUNAIX_SYS_PANIC), "D"(msg)
);
- DO_SPIN
+
cpu_trap_panic(msg
);
+ spin();
}
void
}
void
@@
-30,9
+30,9
@@
panickf(const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
{
va_list args;
va_start(args, fmt);
-
__ksprintf_internal
(buffer, fmt, 1024, args);
+
ksnprintfv
(buffer, fmt, 1024, args);
va_end(args);
asm("int %0" ::"i"(LUNAIX_SYS_PANIC), "D"(buffer));
va_end(args);
asm("int %0" ::"i"(LUNAIX_SYS_PANIC), "D"(buffer));
- DO_SPIN
+ spin();
}
}