Repos / kernel.git / commitdiff
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4f233fd)
raw | patch | inline | side by side (parent: 4f233fd)
| author | zhaoyanbai <zhaoyanbai@126.com> | |
| Tue, 16 May 2023 07:54:14 +0000 (15:54 +0800) | ||
| committer | zhaoyanbai <zhaoyanbai@126.com> | |
| Tue, 16 May 2023 07:54:14 +0000 (15:54 +0800) |
| kernel/printk.c | patch | blob | history |
diff --git a/kernel/printk.c b/kernel/printk.c
--- a/kernel/printk.c
+++ b/kernel/printk.c
*--------------------------------------------------------------------------
*/
+#include <irq.h>
#include <system.h>
#include <tty.h>
-
int vsprintf(char *buf, const char *fmt, char *args);
char pkbuf[1024];
extern tty_t default_tty;
int printk(const char *fmtstr, ...) {
+ unsigned long iflags;
+ irq_save(iflags);
char *args = (char *)(((char *)&fmtstr) + 4);
int size = vsprintf(pkbuf, fmtstr, args);
tty_write(&default_tty, pkbuf, (size_t)size);
+ irq_restore(iflags);
return 0;
}
extern tty_t debug_tty;
char pdbuf[1024];
int printd(const char *fmtstr, ...) {
+ unsigned long iflags;
+ irq_save(iflags);
char *args = (char *)(((char *)&fmtstr) + 4);
int size = vsprintf(pdbuf, fmtstr, args);
tty_write(&debug_tty, pdbuf, (size_t)size);
+ irq_restore(iflags);
return 0;
}
char plobuf[1024];
extern tty_t monitor_tty;
int printlo(unsigned int xpos, unsigned int ypos, const char *fmtstr, ...) {
+ unsigned long iflags;
+ irq_save(iflags);
char *args = (char *)(((char *)&fmtstr) + 4);
int size = vsprintf(plobuf, fmtstr, args);
tty_write_at(&monitor_tty, xpos, ypos, plobuf, (size_t)size);
+ irq_restore(iflags);
return 0;
}