Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/boot.c | 5 +---- src/kbd.c | 2 +- src/stacks.c | 10 ++++++++++ src/stacks.h | 1 + src/util.h | 3 --- 5 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/boot.c b/src/boot.c index 9be8b2a..5837ad0 100644 --- a/src/boot.c +++ b/src/boot.c @@ -689,10 +689,7 @@ boot_fail(void) yield_toirq(); } printf("Rebooting.\n"); - struct bregs br; - memset(&br, 0, sizeof(br)); - br.code = SEGOFF(SEG_BIOS, (u32)reset_vector); - farcall16big(&br); + reset(); }
// Determine next boot method and attempt a boot using it. diff --git a/src/kbd.c b/src/kbd.c index 33a95a3..3677a12 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -502,7 +502,7 @@ __process_key(u8 scancode) == (KF0_CTRLACTIVE|KF0_ALTACTIVE))) { // Ctrl+alt+del - reset machine. SET_BDA(soft_reset_flag, 0x1234); - reset_vector(); + reset(); } if (scancode >= ARRAY_SIZE(scan_to_scanascii)) { dprintf(1, "KBD: int09h_handler(): unknown scancode read: 0x%02x!\n" diff --git a/src/stacks.c b/src/stacks.c index beccc0f..df719fd 100644 --- a/src/stacks.c +++ b/src/stacks.c @@ -238,6 +238,16 @@ __call16_int(struct bregs *callregs, u16 offset) farcall16(callregs); }
+// Reset the machine +void +reset(void) +{ + extern void reset_vector(void) __noreturn; + if (!MODESEGMENT) + call16(0, 0, reset_vector); + reset_vector(); +} +
/**************************************************************** * Threads diff --git a/src/stacks.h b/src/stacks.h index d8584f2..22fb943 100644 --- a/src/stacks.h +++ b/src/stacks.h @@ -17,6 +17,7 @@ inline void __call16_int(struct bregs *callregs, u16 offset); extern void irq_trampoline_ ##nr (); \ __call16_int((callregs), (u32)&irq_trampoline_ ##nr ); \ } while (0) +void reset(void); extern struct thread_info MainThread; struct thread_info *getCurThread(void); void yield(void); diff --git a/src/util.h b/src/util.h index 8b078e8..ed90e03 100644 --- a/src/util.h +++ b/src/util.h @@ -217,9 +217,6 @@ void reloc_preinit(void *f, void *arg); // resume.c extern int HaveRunPost;
-// romlayout.S -void reset_vector(void) __noreturn; - // serial.c void serial_setup(void); void lpt_setup(void);