]> git.dujemihanovic.xyz Git - nameless-os.git/blob - kernel/entry.s
a02df92d4703df4ada20654b433158c80ee1373f
[nameless-os.git] / kernel / entry.s
1 ; when our kernel source has functions before _start and we blindly transfer control to the beginning
2 ; of the kernel binary, it will wrongly execute the other functions
3 ; the solution is to link a small assembly routine (this) which executes a known label within the kernel
4 ; so that this routine comes before the kernel in the resulting binary
5 ; we cannot link the boot sector code and the kernel because the former needs to be a raw binary, while the
6 ; kernel is compiled into an ELF object file which contains some metadata on the kernel code
7
8 bits 32 ; this is started in protected mode
9 extern _start ; the known label in the kernel source we will execute is, well, not in this assembly routine
10
11 call _start ; call the known label
12 jmp $ ; it should never return, but hang forever if it does