From: Ben Gras Date: Wed, 25 Apr 2012 15:44:55 +0000 (+0200) Subject: kernel: mon_return cleanup X-Git-Tag: v3.2.1~570 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.dnssec-checkds.html?a=commitdiff_plain;h=b41df2eb0ded35fec1f5c8ee7228ef1ed1747f65;p=minix.git kernel: mon_return cleanup cleanup of boot monitor related code. --- diff --git a/kernel/arch/i386/Makefile.inc b/kernel/arch/i386/Makefile.inc index 407ea69b8..2e13ff885 100644 --- a/kernel/arch/i386/Makefile.inc +++ b/kernel/arch/i386/Makefile.inc @@ -6,7 +6,6 @@ HERE=${.CURDIR}/arch/${ARCH} .PATH: ${HERE} SRCS+= arch_do_vmctl.c \ arch_clock.c \ - do_int86.c \ do_iopenable.c \ do_readbios.c \ do_sdevio.c \ diff --git a/kernel/arch/i386/arch_system.c b/kernel/arch/i386/arch_system.c index 8e1c0de02..fd732d6df 100644 --- a/kernel/arch/i386/arch_system.c +++ b/kernel/arch/i386/arch_system.c @@ -57,11 +57,6 @@ static void ser_dump_proc_cpu(void); static void ser_init(void); #endif -__dead void arch_monitor(void) -{ - monitor(); -} - #define KBCMDP 4 /* kbd controller port (O) */ #define KBC_PULSE0 0xfe /* pulse output bit 0 */ #define IO_KBD 0x060 /* 8042 Keyboard */ @@ -138,7 +133,6 @@ int cpu_has_tsc; __dead void arch_shutdown(int how) { - u16_t magic; vm_stop(); /* Mask all interrupts, including the clock. */ @@ -171,44 +165,10 @@ __dead void arch_shutdown(int how) #if USE_BOOTPARAM if (how == RBT_DEFAULT) { - how = mon_return ? RBT_HALT : RBT_RESET; - } - - if(how != RBT_RESET) { - /* return to boot monitor */ - - outb( INT_CTLMASK, 0); - outb( INT2_CTLMASK, 0); - - /* Return to the boot monitor. Set - * the program if not already done. - */ - if (how != RBT_MONITOR) - arch_set_params("", 1); - - if (mon_return) - arch_monitor(); - - /* monitor command with no monitor: reset or poweroff - * depending on the parameters - */ - if (how == RBT_MONITOR) { - how = RBT_RESET; - } + how = RBT_RESET; } switch (how) { - case RBT_REBOOT: - case RBT_RESET: - /* Reset the system by forcing a processor shutdown. - * First stop the BIOS memory test by setting a soft - * reset flag. - */ - magic = STOP_MEM_CHECK; - phys_copy(vir2phys(&magic), SOFT_RESET_FLAG_ADDR, - SOFT_RESET_FLAG_SIZE); - reset(); - NOT_REACHABLE; case RBT_HALT: /* Poweroff without boot monitor */ @@ -221,11 +181,13 @@ __dead void arch_shutdown(int how) NOT_REACHABLE; default: - /* Not possible! trigger panic */ - assert(how != RBT_MONITOR); - assert(how != RBT_DEFAULT); - assert(how < RBT_INVALID); - panic("unexpected value for how: %d", how); + case RBT_REBOOT: + case RBT_RESET: + /* Reset the system by forcing a processor shutdown. + * First stop the BIOS memory test by setting a soft + * reset flag. + */ + reset(); NOT_REACHABLE; } #else /* !USE_BOOTPARAM */ diff --git a/kernel/arch/i386/do_int86.c b/kernel/arch/i386/do_int86.c deleted file mode 100644 index 3ed1c4b50..000000000 --- a/kernel/arch/i386/do_int86.c +++ /dev/null @@ -1,39 +0,0 @@ -/* The kernel call implemented in this file: - * m_type: SYS_INT86 - * - * The parameters for this kernel call are: - * m1_p1: INT86_REG86 - */ - -#include "kernel/system.h" -#include -#include -#include - -#include "arch_proto.h" - -struct reg86u reg86; - -/*===========================================================================* - * do_int86 * - *===========================================================================*/ -int do_int86(struct proc * caller, message * m_ptr) -{ - data_copy(caller->p_endpoint, (vir_bytes) m_ptr->INT86_REG86, - KERNEL, (vir_bytes) ®86, sizeof(reg86)); - - int86(); - - /* Copy results back to the caller */ - data_copy(KERNEL, (vir_bytes) ®86, - caller->p_endpoint, (vir_bytes) m_ptr->INT86_REG86, sizeof(reg86)); - - /* The BIOS call eats interrupts. Call get_randomness to generate some - * entropy. Normally, get_randomness is called from an interrupt handler. - * Figuring out the exact source is too complicated. CLOCK_IRQ is normally - * not very random. - */ - get_randomness(&krandom, CLOCK_IRQ); - - return(OK); -} diff --git a/kernel/arch/i386/include/arch_proto.h b/kernel/arch/i386/include/arch_proto.h index 61b6a73e2..a19d98ec7 100644 --- a/kernel/arch/i386/include/arch_proto.h +++ b/kernel/arch/i386/include/arch_proto.h @@ -76,7 +76,6 @@ void exception(struct exception_frame * frame); __dead void monitor(void); __dead void reset(void); __dead void x86_triplefault(void); -void int86(void); reg_t read_cr0(void); reg_t read_cr2(void); void write_cr0(unsigned long value); diff --git a/kernel/arch/i386/klib.S b/kernel/arch/i386/klib.S index 648c5cb0a..55bf9b2c9 100644 --- a/kernel/arch/i386/klib.S +++ b/kernel/arch/i386/klib.S @@ -16,120 +16,6 @@ * kernel. */ -/* - * The routines only guarantee to preserve the registers the C compiler - * expects to be preserved (ebx, esi, edi, ebp, esp, segment registers, and - * direction bit in the flags). - */ - -/*===========================================================================*/ -/* monitor */ -/*===========================================================================*/ -/* PUBLIC void monitor(); */ -/* exit Minix and return to the monitor */ -ENTRY(monitor) - movl _C_LABEL(mon_sp), %esp /* restore monitor stack pointer */ - movw $SS_SELECTOR, %dx /* monitor data segment */ - mov %dx, %ds - mov %dx, %es - mov %dx, %fs - mov %dx, %gs - mov %dx, %ss - pop %edi - pop %esi - pop %ebp - lretw /* return to the monitor */ - - -/*===========================================================================*/ -/* int86 */ -/*===========================================================================*/ -/* PUBLIC void int86(); */ -/* let the monitor make an 8086 interrupt call */ -ENTRY(int86) - cmpb $0, _C_LABEL(mon_return) /* is the monitor there? */ - jne 0f - movb $0x01, %ah /* an int 13 error seems appropriate */ - movb %ah, _C_LABEL(reg86)+0 /* reg86.w.f = 1 (set carry flag) */ - movb %ah, _C_LABEL(reg86)+13 /* reg86.b.ah = 0x01 = "invalid command" */ - ret -0: - push %ebp /* save C registers */ - push %esi - push %edi - push %ebx - pushf /* save flags */ - cli /* no interruptions */ - - inb $INT2_CTLMASK - movb %al, %ah - inb $INT_CTLMASK - push %eax /* save interrupt masks */ - movl _C_LABEL(irq_use), %eax /* map of in-use IRQ's */ - and $~(1<