cleanup of boot monitor related code.
.PATH: ${HERE}
SRCS+= arch_do_vmctl.c \
arch_clock.c \
- do_int86.c \
do_iopenable.c \
do_readbios.c \
do_sdevio.c \
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 */
__dead void arch_shutdown(int how)
{
- u16_t magic;
vm_stop();
/* Mask all interrupts, including the clock. */
#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 */
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 */
+++ /dev/null
-/* 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 <minix/type.h>
-#include <minix/endpoint.h>
-#include <machine/int86.h>
-
-#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);
-}
__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);
* 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<<CLOCK_IRQ), %eax /* keep the clock ticking */
- outb $INT_CTLMASK /* enable all unused IRQ's and vv. */
- movb %ah, %al
- outb $INT2_CTLMASK
-
- mov $SS_SELECTOR, %eax /* monitor data segment */
- mov %ax, %ss
- xchgl _C_LABEL(mon_sp), %esp /* switch stacks */
- push _C_LABEL(reg86)+36 /* parameters used in INT call */
- push _C_LABEL(reg86)+32
- push _C_LABEL(reg86)+28
- push _C_LABEL(reg86)+24
- push _C_LABEL(reg86)+20
- push _C_LABEL(reg86)+16
- push _C_LABEL(reg86)+12
- push _C_LABEL(reg86)+8
- push _C_LABEL(reg86)+4
- push _C_LABEL(reg86)+0
- mov %ax, %ds /* remaining data selectors */
- mov %ax, %es
- mov %ax, %fs
- mov %ax, %gs
- push %cs
- push $return /* kernel return address and selector */
- ljmpw *20+2*4+10*4+2*4(%esp)
-return:
- pop _C_LABEL(reg86)+0
- pop _C_LABEL(reg86)+4
- pop _C_LABEL(reg86)+8
- pop _C_LABEL(reg86)+12
- pop _C_LABEL(reg86)+16
- pop _C_LABEL(reg86)+20
- pop _C_LABEL(reg86)+24
- pop _C_LABEL(reg86)+28
- pop _C_LABEL(reg86)+32
- pop _C_LABEL(reg86)+36
- lgdt _C_LABEL(gdt)+GDT_SELECTOR /* reload global descriptor table */
- ljmp $CS_SELECTOR, $csinit
-csinit:
- mov $DS_SELECTOR, %eax
- mov %ax, %ds
- mov %ax, %es
- mov %ax, %fs
- mov %ax, %gs
- mov %ax, %ss
- xchgl _C_LABEL(mon_sp), %esp /* unswitch stacks */
- lidt _C_LABEL(gdt)+IDT_SELECTOR /* reload interrupt descriptor table */
-
- pop %eax
- outb $INT_CTLMASK /* restore interrupt masks */
- movb %ah, %al
- outb $INT2_CTLMASK
-
-6:
- addl %ecx, _C_LABEL(lost_ticks) /* record lost clock ticks */
-
- popf /* restore flags */
- pop %ebx /* restore C registers */
- pop %edi
- pop %esi
- pop %ebp
- ret
-
-
ENTRY(__main)
ret
mov %esp, %ebp
push %esi
push %edi
- cmp $0, 4(%ebp) /* monitor return vector is */
- je noret /* nonzero if return possible */
- incl _C_LABEL(mon_return)
-noret:
- movl %esp, _C_LABEL(mon_sp) /* save stack pointer for later return */
-
/* Copy the monitor global descriptor table to the address space of kernel and */
/* switch over to it. Prot_init() can then update it with immediate effect. */
EXTERN u32_t system_hz; /* HZ value */
/* Miscellaneous. */
-EXTERN reg_t mon_sp; /* boot monitor stack */
-EXTERN int mon_return; /* true if we can return to monitor */
EXTERN int do_serial_debug;
EXTERN int serial_debug_baud;
EXTERN time_t boottime;
int is_fpu(void);
void ser_putc(char);
__dead void arch_shutdown(int);
-__dead void arch_monitor(void);
void restore_user_context(struct proc * p);
void read_tsc(u32_t *high, u32_t *low);
int arch_init_profile_clock(u32_t freq);
/* i386-specific. */
#if _MINIX_CHIP == _CHIP_INTEL
- map(SYS_INT86, do_int86); /* real-mode BIOS calls */
map(SYS_READBIOS, do_readbios); /* read from BIOS locations */
map(SYS_IOPENABLE, do_iopenable); /* Enable I/O */
map(SYS_SDEVIO, do_sdevio); /* phys_insb, _insw, _outsb, _outsw */
#define do_vdevio NULL
#endif
-int do_int86(struct proc * caller, message *m_ptr);
-
int do_sdevio(struct proc * caller, message *m_ptr);
#if ! USE_SDEVIO
#define do_sdevio NULL