void enter_critical_zone();
void exit_critical_zone();
-#define ENTER_CRITICAL_ZONE \
- do { \
- enter_critical_zone(); \
- } while (0)
-#define EXIT_CRITICAL_ZONE \
- do { \
- exit_critical_zone(); \
- } while (0)
+#define ENTER_CRITICAL_ZONE(x) \
+ volatile uint32_t __critical_zone_eflags_##x = 0; \
+ irq_save(__critical_zone_eflags_##x);
+
+
+#define EXIT_CRITICAL_ZONE(x) \
+ irq_restore(__critical_zone_eflags_##x);
#define IRQ_CLOCK 0x00
#define IRQ_KEYBOARD 0x01
extern tty_t *const default_tty;
int printk(const char *fmtstr, ...) {
static char pkbuf[1024];
- ENTER_CRITICAL_ZONE;
+
+ ENTER_CRITICAL_ZONE(EFLAGS);
char *args = (char *)(((char *)&fmtstr) + 4);
int size = vsprintf(pkbuf, fmtstr, args);
tty_write(default_tty, pkbuf, (size_t)size);
serial_write(pkbuf, (size_t)size);
- EXIT_CRITICAL_ZONE;
+ EXIT_CRITICAL_ZONE(EFLAGS);
return 0;
}
extern tty_t *const debug_tty;
int printd(const char *fmtstr, ...) {
static char pdbuf[1024];
- ENTER_CRITICAL_ZONE;
+ ENTER_CRITICAL_ZONE(EFLAGS);
char *args = (char *)(((char *)&fmtstr) + 4);
int size = vsprintf(pdbuf, fmtstr, args);
tty_write(debug_tty, pdbuf, (size_t)size);
serial_write(pdbuf, (size_t)size);
- EXIT_CRITICAL_ZONE;
+ EXIT_CRITICAL_ZONE(EFLAGS);
return 0;
}
int printlo(unsigned int xpos, unsigned int ypos, const char *fmtstr, ...) {
static char plobuf[1024];
char *args = (char *)(((char *)&fmtstr) + 4);
- ENTER_CRITICAL_ZONE;
+ ENTER_CRITICAL_ZONE(EFLAGS);
int size = vsprintf(plobuf, fmtstr, args);
tty_write_at(monitor_tty, xpos, ypos, plobuf, (size_t)size);
- EXIT_CRITICAL_ZONE;
+ EXIT_CRITICAL_ZONE(EFLAGS);
return 0;
}
-serial tcp::6666,server,nowait \
-drive file=HD.IMG,format=raw,index=0,media=disk \
-drive file=kernel.iso,index=1,media=cdrom \
- -drive file=HDb.IMG,format=raw,index=2,media=disk \
-name kernel \
-device ich9-ahci,id=ahci \
-vga std \
-s -S \
&
+ #-drive file=HDb.IMG,format=raw,index=2,media=disk \
#-cpu qemu32,+apic \
#-cpu core2duo-v1,+apic \