version 1.106, 2013/06/23 09:00:36 |
version 1.112.6.1, 2017/07/20 01:42:39 |
Line 139 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 139 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#include "opt_vm86.h" |
#include "opt_vm86.h" |
#include "opt_xen.h" |
#include "opt_xen.h" |
|
|
#include "npx.h" |
|
#include "assym.h" |
#include "assym.h" |
#include "lapic.h" |
#include "lapic.h" |
#include "ioapic.h" |
#include "ioapic.h" |
Line 698 try586: /* Use the `cpuid' instruction. |
|
Line 697 try586: /* Use the `cpuid' instruction. |
|
* 2. Enable paging and the rest of it. |
* 2. Enable paging and the rest of it. |
*/ |
*/ |
movl %cr0,%eax # get control word |
movl %cr0,%eax # get control word |
# enable paging & NPX emulation |
# enable paging & NPX |
orl $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_EM|CR0_MP|CR0_WP|CR0_AM),%eax |
orl $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax |
movl %eax,%cr0 # and page NOW! |
movl %eax,%cr0 # and page NOW! |
|
|
pushl $begin # jump to high mem |
pushl $begin # jump to high mem |
|
|
/* Set up bootstrap stack. */ |
/* Set up bootstrap stack. */ |
leal (PROC0_STK_OFF+KERNBASE)(%esi),%eax |
leal (PROC0_STK_OFF+KERNBASE)(%esi),%eax |
movl %eax,_C_LABEL(lwp0uarea) |
movl %eax,_C_LABEL(lwp0uarea) |
leal (KSTACK_SIZE-FRAMESIZE)(%eax),%esp |
leal (USPACE-FRAMESIZE)(%eax),%esp |
movl %esi,(KSTACK_SIZE+PCB_CR3)(%eax) # pcb->pcb_cr3 |
movl %esi,PCB_CR3(%eax) # pcb->pcb_cr3 |
xorl %ebp,%ebp # mark end of frames |
xorl %ebp,%ebp # mark end of frames |
|
|
#if defined(MULTIBOOT) |
#if defined(MULTIBOOT) |
|
|
movl %esi, _C_LABEL(lwp0uarea) |
movl %esi, _C_LABEL(lwp0uarea) |
|
|
/* Set up bootstrap stack. */ |
/* Set up bootstrap stack. */ |
leal (KSTACK_SIZE-FRAMESIZE)(%eax),%esp |
leal (USPACE-FRAMESIZE)(%eax),%esp |
xorl %ebp,%ebp # mark end of frames |
xorl %ebp,%ebp # mark end of frames |
|
|
addl $USPACE, %esi |
addl $USPACE, %esi |
Line 881 END(lgdt_finish) |
|
Line 880 END(lgdt_finish) |
|
* |
* |
* This is a trampoline function pushed onto the stack of a newly created |
* This is a trampoline function pushed onto the stack of a newly created |
* process in order to do some additional setup. The trampoline is entered by |
* process in order to do some additional setup. The trampoline is entered by |
* cpu_switch()ing to the process, so we abuse the callee-saved registers used |
* cpu_switchto()ing to the process, so we abuse the callee-saved |
* by cpu_switch() to store the information about the stub to call. |
* registers used by cpu_switchto() to store the information about the |
|
* stub to call. |
* NOTE: This function does not have a normal calling sequence! |
* NOTE: This function does not have a normal calling sequence! |
*/ |
*/ |
NENTRY(lwp_trampoline) |
NENTRY(lwp_trampoline) |
|
|
END(savectx) |
END(savectx) |
|
|
/* |
/* |
* osyscall() |
|
* |
|
* Old call gate entry for syscall |
|
*/ |
|
IDTVEC(osyscall) |
|
#ifndef XEN |
|
/* XXX we are in trouble! interrupts be off here. */ |
|
cli # must be first instruction |
|
#endif |
|
pushfl # set eflags in trap frame |
|
popl 8(%esp) |
|
orl $PSL_I,8(%esp) # re-enable ints on return to user |
|
pushl $7 # size of instruction for restart |
|
jmp syscall1 |
|
IDTVEC_END(osyscall) |
|
|
|
/* |
|
* syscall() |
* syscall() |
* |
* |
* Trap gate entry for syscall |
* Trap gate entry for syscall |
*/ |
*/ |
IDTVEC(syscall) |
IDTVEC(syscall) |
pushl $2 # size of instruction for restart |
pushl $2 # size of instruction for restart |
syscall1: |
|
pushl $T_ASTFLT # trap # for doing ASTs |
pushl $T_ASTFLT # trap # for doing ASTs |
INTRENTRY |
INTRENTRY |
STI(%eax) |
STI(%eax) |
Line 1287 IDTVEC(svr4_fasttrap) |
|
Line 1269 IDTVEC(svr4_fasttrap) |
|
cli |
cli |
jmp 2b |
jmp 2b |
|
|
#if NNPX > 0 |
|
/* |
|
* Special interrupt handlers. Someday intr0-intr15 will be used to count |
|
* interrupts. We'll still need a special exception 16 handler. The busy |
|
* latch stuff in probintr() can be moved to npxprobe(). |
|
*/ |
|
|
|
/* |
|
* void probeintr(void) |
|
*/ |
|
NENTRY(probeintr) |
|
ss |
|
incl _C_LABEL(npx_intrs_while_probing) |
|
pushl %eax |
|
movb $0x20,%al # EOI (asm in strings loses cpp features) |
|
outb %al,$0xa0 # IO_ICU2 |
|
outb %al,$0x20 # IO_ICU1 |
|
movb $0,%al |
|
outb %al,$0xf0 # clear BUSY# latch |
|
popl %eax |
|
iret |
|
END(probeintr) |
|
|
|
/* |
|
* void probetrap(void) |
|
*/ |
|
NENTRY(probetrap) |
|
ss |
|
incl _C_LABEL(npx_traps_while_probing) |
|
fnclex |
|
iret |
|
END(probetrap) |
|
|
|
/* |
/* |
* int npx586bug1(int a, int b) |
* int npx586bug1(int a, int b) |
|
* Used when checking for the FDIV bug on first generations pentiums. |
|
* Anything 120MHz or above is fine. |
*/ |
*/ |
NENTRY(npx586bug1) |
NENTRY(npx586bug1) |
fildl 4(%esp) # x |
fildl 4(%esp) # x |
Line 1335 NENTRY(npx586bug1) |
|
Line 1286 NENTRY(npx586bug1) |
|
popl %eax |
popl %eax |
ret |
ret |
END(npx586bug1) |
END(npx586bug1) |
#endif /* NNPX > 0 */ |
|
|
|
/* |
/* |
* void sse2_idlezero_page(void *pg) |
* void sse2_idlezero_page(void *pg) |