2021-11-03 19:03:38 +00:00
|
|
|
/*
|
|
|
|
* Multiboot
|
|
|
|
*/
|
|
|
|
.set ALIGN, 1<<0 /* align loaded modules on page boundaries */
|
|
|
|
.set MEMINFO, 1<<1 /* provide memory map */
|
|
|
|
.set FLAGS, ALIGN | MEMINFO /* this is the Multiboot 'flag' field */
|
|
|
|
.set MAGIC, 0x1BADB002 /* 'magic number' lets bootloader find the header */
|
|
|
|
.set CHECKSUM, -(MAGIC + FLAGS) /* checksum of above, to prove we are multiboot */
|
|
|
|
|
|
|
|
.section .multiboot
|
|
|
|
.align 4
|
|
|
|
.long MAGIC
|
|
|
|
.long FLAGS
|
|
|
|
.long CHECKSUM
|
|
|
|
|
|
|
|
|
|
|
|
.section .bss
|
|
|
|
.align 16
|
|
|
|
stack_bottom:
|
|
|
|
.skip 16384 # 16 KiB
|
|
|
|
stack_top:
|
|
|
|
|
|
|
|
.section .text
|
2022-09-10 18:06:49 +00:00
|
|
|
.include "./source/kernel/gdt/gdt.s"
|
|
|
|
.include "./source/kernel/irs_table.s"
|
|
|
|
.include "./source/kernel/irq_table.s"
|
2023-02-03 19:01:31 +00:00
|
|
|
.include "./source/kernel/interrupts/idt/idt.s"
|
2022-09-10 18:06:49 +00:00
|
|
|
.include "./source/kernel/memory/paging.s"
|
2021-11-03 19:03:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
.global _start
|
|
|
|
.type _start, @function
|
|
|
|
_start:
|
|
|
|
/*Setup the stack pointer to point to the beginning of our stack */
|
|
|
|
/* I believe its a high address growing down to lower adress for the stack on x86*/
|
|
|
|
mov $stack_top, %esp
|
|
|
|
|
|
|
|
/*Reset EFLAGS*/
|
|
|
|
pushl $0
|
|
|
|
popf
|
|
|
|
|
|
|
|
/* push the pointer to the Multiboot information structure*/
|
|
|
|
pushl %ebx
|
|
|
|
|
|
|
|
/* push the magic value */
|
|
|
|
pushl %eax
|
|
|
|
|
|
|
|
call early_main
|
|
|
|
|
2021-11-16 20:17:49 +00:00
|
|
|
|
2021-12-20 20:53:57 +00:00
|
|
|
mov %cr0, %eax
|
|
|
|
or $1, %eax
|
|
|
|
mov %eax, %cr0
|
2021-11-16 20:17:49 +00:00
|
|
|
|
2021-12-20 20:53:57 +00:00
|
|
|
|
|
|
|
call kernel_main
|
2021-11-16 20:17:49 +00:00
|
|
|
|
|
|
|
|
2021-12-20 20:53:57 +00:00
|
|
|
cli
|
|
|
|
1: hlt
|
|
|
|
jmp 1b
|
2021-11-16 20:17:49 +00:00
|
|
|
|
|
|
|
|
2021-12-20 20:53:57 +00:00
|
|
|
.size _start, . - _start
|
2021-11-16 20:17:49 +00:00
|
|
|
|
|
|
|
|