version 1.145, 2017/02/02 19:12:09 |
version 1.145.6.3, 2018/03/13 15:47:44 |
Line 343 _C_LABEL(Multiboot_Header): |
|
Line 343 _C_LABEL(Multiboot_Header): |
|
jne 1f |
jne 1f |
|
|
/* |
/* |
* Indeed, a multiboot-compliant boot loader executed us. We copy |
* Indeed, a multiboot-compliant boot loader executed us. We switch |
* the received Multiboot information structure into kernel's data |
* to the temporary stack, and copy the received Multiboot information |
* space to process it later -- after we are relocated. It will |
* structure into kernel's data space to process it later -- after we |
* be safer to run complex C code than doing it at this point. |
* are relocated. It will be safer to run complex C code than doing it |
|
* at this point. |
*/ |
*/ |
|
movl $_RELOC(tmpstk),%esp |
pushl %ebx /* Address of Multiboot information */ |
pushl %ebx /* Address of Multiboot information */ |
call _C_LABEL(multiboot_pre_reloc) |
call _C_LABEL(multiboot_pre_reloc) |
addl $4,%esp |
addl $4,%esp |
|
|
addl $PDE_SIZE,%esp /* pop paddr_t */ |
addl $PDE_SIZE,%esp /* pop paddr_t */ |
addl $NGDT*8,%esp /* pop temporary gdt */ |
addl $NGDT*8,%esp /* pop temporary gdt */ |
|
|
#ifdef SAFARI_FIFO_HACK |
|
movb $5,%al |
|
movw $0x37b,%dx |
|
outb %al,%dx |
|
movw $0x37f,%dx |
|
inb %dx,%al |
|
movb %al,%cl |
|
|
|
orb $1,%cl |
|
|
|
movb $5,%al |
|
movw $0x37b,%dx |
|
outb %al,%dx |
|
movw $0x37f,%dx |
|
movb %cl,%al |
|
outb %al,%dx |
|
#endif /* SAFARI_FIFO_HACK */ |
|
|
|
call _C_LABEL(main) |
call _C_LABEL(main) |
#else /* XEN */ |
#else /* XEN */ |
/* First, reset the PSL. */ |
/* First, reset the PSL. */ |
|
|
addl $4,%esp |
addl $4,%esp |
#else |
#else |
movl PCB_ESP0(%ebx),%eax |
movl PCB_ESP0(%ebx),%eax |
movl %eax,CPUVAR(ESP0) |
movl CPUVAR(TSS),%ecx |
|
movl %eax,TSS_ESP0(%ecx) |
#endif |
#endif |
|
|
/* Don't bother with the rest if switching to a system process. */ |
/* Don't bother with the rest if switching to a system process. */ |
|
|
movl PCB_IOMAP(%ebx),%eax |
movl PCB_IOMAP(%ebx),%eax |
orl %eax,%eax |
orl %eax,%eax |
jnz .Lcopy_iobitmap |
jnz .Lcopy_iobitmap |
movl $(IOMAP_INVALOFF << 16),CPUVAR(IOBASE) |
movl CPUVAR(TSS),%eax |
|
movl $(IOMAP_INVALOFF << 16),TSS_IOBASE(%eax) |
.Liobitmap_done: |
.Liobitmap_done: |
|
|
/* Is this process using RAS (restartable atomic sequences)? */ |
/* Is this process using RAS (restartable atomic sequences)? */ |
|
|
pushl %esi |
pushl %esi |
pushl %edi |
pushl %edi |
movl %eax,%esi /* pcb_iomap */ |
movl %eax,%esi /* pcb_iomap */ |
movl CPUVAR(SELF),%edi |
movl CPUVAR(TSS),%edi |
leal CPU_INFO_IOMAP(%edi),%edi |
leal TSS_IOMAP(%edi),%edi |
rep |
rep |
movsl |
movsl |
popl %edi |
popl %edi |
popl %esi |
popl %esi |
movl $((CPU_INFO_IOMAP - CPU_INFO_TSS) << 16),CPUVAR(IOBASE) |
movl CPUVAR(TSS),%eax |
|
movl $((TSS_IOMAP - TSS_TSS) << 16),TSS_IOBASE(%eax) |
jmp .Liobitmap_done |
jmp .Liobitmap_done |
END(cpu_switchto) |
END(cpu_switchto) |
|
|
|
|
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) |