#define AP_MAGIC (0x12481020)
#endif /* MP */
-
+
.globl _NtProcessStartup
.globl _start
.globl _init_stack
.globl _init_stack_top
.globl _trap_stack
-.globl _trap_stack_top
+.globl _trap_stack_top
.globl _unmap_me
.globl _unmap_me2
.globl _unmap_me3
.globl _pagetable_start
.globl _pagetable_end
.globl _pae_pagedirtable
-
+
/*
* This is called by the realmode loader, with protected mode
* enabled, paging disabled and the segment registers pointing
/* Align 32 bits boundary */
.align 4
-
+
/* Multiboot header */
multiboot_header:
/* magic */
/* entry_addr */
.long (0x200000 + _start - KERNEL_BASE)
-_multiboot_entry:
+_multiboot_entry:
/*
* This must be PIC because we haven't set up paging yet
- */
-
+ */
+
/*
* Gcc expects this at all times
*/
/*
* Save the multiboot or application processor magic
*/
- movl %eax, %edx
+ movl %eax, %edx
- cmpl $AP_MAGIC, %edx
+ cmpl $AP_MAGIC, %edx
je .m1
#endif /* MP */
addl $4, %edi
cmpl $6144, %edi
jl .l4
-
+
#ifdef MP
/*
* Initialize the page table that maps the APIC register address space
*/
-
+
/*
- * FIXME: APIC register address space can be non-standard so do the
- * mapping later
+ * FIXME: APIC register address space can be non-standard so do the
+ * mapping later
*/
movl $V2P(apic_pagetable), %esi
movl $0, %edi
movl $0xa0003, %eax
movl $0x20, %ecx
movl $0xE80, %edi
-.l9:
+.l9:
movl %eax, (%esi, %edi)
add $4, %edi
add $0x1000, %eax
/*
* Set up the PDBR
- */
+ */
movl $(V2P(startup_pagedirectory)), %eax
movl %eax, %cr3
/*
* Do an absolute jump because we now want to execute above 0xc0000000
- */
+ */
movl $.l2, %eax
jmp *%eax
.l2:
-
+
/*
* Load the GDTR and IDTR with new tables located above
* 0xc0000000
*/
-
+
/* FIXME: Application processors should have their own GDT/IDT */
lgdt _KiGdtDescriptor
lidt _KiIdtDescriptor
#ifdef MP
- cmpl $AP_MAGIC, %edx
- jne .m2
+ cmpl $AP_MAGIC, %edx
+ jne .m2
/*
* This is an application processor executing
.l8:
jmp .l8
-
+
.m2:
#endif /* MP */
pushl $KERNEL_CS
pushl $__main
lret
-
+
/*
* Catch illegal returns from main, try bug checking the system,
* if that fails then loop forever.
.l6:
jmp .l6
-
+
/*
* This needs to be page aligned so put it at the beginning of the bss
* segment
.fill 4096, 1, 0
kernel_pagetable:
- .fill 2*4096, 1, 0
+ .fill 2*4096, 1, 0
kernelmap_pagetable:
.fill 4096, 1, 0
.fill 4096, 1, 0
#ifdef MP
apic_pagetable:
- .fill 4096, 1, 0
+ .fill 4096, 1, 0
#endif /* MP */
kpcr_pagetable:
- .fill 4096, 1, 0
+ .fill 4096, 1, 0
_pagetable_end:
_unmap_me:
.fill 4096, 1, 0
-
+
_init_stack:
.fill 3*4096, 1, 0
-_init_stack_top:
+_init_stack_top:
-_unmap_me2:
+_unmap_me2:
.fill 4096, 1, 0
-
-_trap_stack:
+
+_trap_stack:
.fill 3*4096, 1, 0
-_trap_stack_top:
-
-_unmap_me3:
- .fill 4096, 1, 0
+_trap_stack_top:
+
+_unmap_me3:
+ .fill 4096, 1, 0