/* sections */ #include #include #include #include #include #include "archconst.h" #include "kernel/const.h" #include "sconst.h" #include /* * This file contains a number of assembly code utility routines needed by the * 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<