Some commenting
This commit is contained in:
parent
2179aa3ce0
commit
2458a3db69
@ -19,19 +19,19 @@ _start:
|
|||||||
mov edi, eax
|
mov edi, eax
|
||||||
mov esi, ebx
|
mov esi, ebx
|
||||||
|
|
||||||
// Temporary stack for booting
|
//; Temporary stack for booting
|
||||||
mov esp, offset V2P(BootStack)
|
mov esp, offset V2P(BootStack)
|
||||||
|
|
||||||
// Enable Page Address Extension
|
//; Enable Page Address Extension
|
||||||
mov eax, cr4
|
mov eax, cr4
|
||||||
or eax, 1<<5
|
or eax, 1<<5
|
||||||
mov cr4, eax
|
mov cr4, eax
|
||||||
|
|
||||||
// Load Page Table (defined in boot/boot_PT.S)
|
//; Load Page Table (defined in boot/boot_PT.S)
|
||||||
mov eax, offset V2P(BootP4)
|
mov eax, offset V2P(BootP4)
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
|
|
||||||
// Enable Long Mode
|
//; Enable Long Mode
|
||||||
mov ecx, 0xC0000080
|
mov ecx, 0xC0000080
|
||||||
rdmsr
|
rdmsr
|
||||||
or eax, 1<<8
|
or eax, 1<<8
|
||||||
@ -42,16 +42,16 @@ _start:
|
|||||||
or eax, 1<<31
|
or eax, 1<<31
|
||||||
mov cr0, eax
|
mov cr0, eax
|
||||||
|
|
||||||
// Load GDT (defined in cpu/gdt.c)
|
//; Load GDT (defined in cpu/gdt.c)
|
||||||
lgdt [V2P(GDTp)]
|
lgdt [V2P(GDTp)]
|
||||||
|
|
||||||
// Jump into long mode
|
//; Jump into long mode
|
||||||
jmp 0x8:V2P(long_mode_start)
|
jmp 0x8:V2P(long_mode_start)
|
||||||
|
|
||||||
.code64
|
.code64
|
||||||
long_mode_start:
|
long_mode_start:
|
||||||
|
|
||||||
// Clear out selectors
|
//; Clear out selectors
|
||||||
mov eax, 0x0
|
mov eax, 0x0
|
||||||
mov ss, eax
|
mov ss, eax
|
||||||
mov ds, eax
|
mov ds, eax
|
||||||
@ -84,7 +84,7 @@ upper_memory:
|
|||||||
|
|
||||||
.reload_cs:
|
.reload_cs:
|
||||||
|
|
||||||
.extern kmain
|
.extern kmain //; boot/kmain.c
|
||||||
movabs rax, offset kmain
|
movabs rax, offset kmain
|
||||||
call rax
|
call rax
|
||||||
|
|
||||||
|
@ -42,8 +42,9 @@ struct fbinfo {
|
|||||||
|
|
||||||
int parse_multiboot2(struct taglist *tags)
|
int parse_multiboot2(struct taglist *tags)
|
||||||
{
|
{
|
||||||
struct tag *tag = incptr(tags, sizeof(struct taglist));
|
|
||||||
struct mmap *mmap;
|
struct mmap *mmap;
|
||||||
|
|
||||||
|
struct tag *tag = incptr(tags, sizeof(struct taglist));
|
||||||
while(tag->type)
|
while(tag->type)
|
||||||
{
|
{
|
||||||
debug("Tag type: %d\n", tag->type);
|
debug("Tag type: %d\n", tag->type);
|
||||||
@ -64,6 +65,7 @@ int parse_multiboot2(struct taglist *tags)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tags are 8 byte alligned, so make sure we look for the next one in the right place
|
||||||
int padded_size = tag->size + ((tag->size % 8)?(8-(tag->size%8)):0);
|
int padded_size = tag->size + ((tag->size % 8)?(8-(tag->size%8)):0);
|
||||||
tag = incptr(tag, padded_size);
|
tag = incptr(tag, padded_size);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,9 @@ Multiboot2Header:
|
|||||||
.long MBOOT2_LENGTH
|
.long MBOOT2_LENGTH
|
||||||
.long MBOOT2_CHECKSUM
|
.long MBOOT2_CHECKSUM
|
||||||
|
|
||||||
.short 0
|
//; Multiboot tag list
|
||||||
|
|
||||||
|
.short 0 //; End tag
|
||||||
.short 0
|
.short 0
|
||||||
.long 8
|
.long 8
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ void interrupt_init()
|
|||||||
|
|
||||||
idtr.addr = idt;
|
idtr.addr = idt;
|
||||||
idtr.len = sizeof(idt)-1;
|
idtr.len = sizeof(idt)-1;
|
||||||
load_idt(&idtr);
|
load_idt(&idtr); // cpu/registers.S
|
||||||
}
|
}
|
||||||
|
|
||||||
registers *int_handler(registers *r)
|
registers *int_handler(registers *r)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user