remove hard tabs!
This commit is contained in:
parent
8ae84716d6
commit
05de14800b
80
src/boot.S
80
src/boot.S
@ -25,54 +25,54 @@ doesn't make sense to return from this function as the bootloader is gone.
|
|||||||
.global _start
|
.global _start
|
||||||
.type _start, @function
|
.type _start, @function
|
||||||
_start:
|
_start:
|
||||||
/*
|
/*
|
||||||
The bootloader has loaded us into 32-bit protected mode on a x86
|
The bootloader has loaded us into 32-bit protected mode on a x86
|
||||||
machine. Interrupts are disabled. Paging is disabled. The processor
|
machine. Interrupts are disabled. Paging is disabled. The processor
|
||||||
state is as defined in the multiboot standard. The kernel has full
|
state is as defined in the multiboot standard. The kernel has full
|
||||||
control of the CPU. The kernel can only make use of hardware features
|
control of the CPU. The kernel can only make use of hardware features
|
||||||
and any code it provides as part of itself. There's no printf
|
and any code it provides as part of itself. There's no printf
|
||||||
function, unless the kernel provides its own <stdio.h> header and a
|
function, unless the kernel provides its own <stdio.h> header and a
|
||||||
printf implementation. There are no security restrictions, no
|
printf implementation. There are no security restrictions, no
|
||||||
safeguards, no debugging mechanisms, only what the kernel provides
|
safeguards, no debugging mechanisms, only what the kernel provides
|
||||||
itself. It has absolute and complete power over the
|
itself. It has absolute and complete power over the
|
||||||
machine.
|
machine.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
To set up a stack, we set the esp register to point to the top of the
|
To set up a stack, we set the esp register to point to the top of the
|
||||||
stack (as it grows downwards on x86 systems). This is necessarily done
|
stack (as it grows downwards on x86 systems). This is necessarily done
|
||||||
in assembly as languages such as C cannot function without a stack.
|
in assembly as languages such as C cannot function without a stack.
|
||||||
*/
|
*/
|
||||||
mov $stack_top, %esp
|
mov $stack_top, %esp
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is a good place to initialize crucial processor state before the
|
This is a good place to initialize crucial processor state before the
|
||||||
high-level kernel is entered. It's best to minimize the early
|
high-level kernel is entered. It's best to minimize the early
|
||||||
environment where crucial features are offline. Note that the
|
environment where crucial features are offline. Note that the
|
||||||
processor is not fully initialized yet: Features such as floating
|
processor is not fully initialized yet: Features such as floating
|
||||||
point instructions and instruction set extensions are not initialized
|
point instructions and instruction set extensions are not initialized
|
||||||
yet. The GDT should be loaded here. Paging should be enabled here.
|
yet. The GDT should be loaded here. Paging should be enabled here.
|
||||||
C++ features such as global constructors and exceptions will require
|
C++ features such as global constructors and exceptions will require
|
||||||
runtime support to work as well.
|
runtime support to work as well.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Enter the high-level kernel. The ABI requires the stack is 16-byte
|
Enter the high-level kernel. The ABI requires the stack is 16-byte
|
||||||
aligned at the time of the call instruction (which afterwards pushes
|
aligned at the time of the call instruction (which afterwards pushes
|
||||||
the return pointer of size 4 bytes). The stack was originally 16-byte
|
the return pointer of size 4 bytes). The stack was originally 16-byte
|
||||||
aligned above and we've pushed a multiple of 16 bytes to the
|
aligned above and we've pushed a multiple of 16 bytes to the
|
||||||
stack since (pushed 0 bytes so far), so the alignment has thus been
|
stack since (pushed 0 bytes so far), so the alignment has thus been
|
||||||
preserved and the call is well defined.
|
preserved and the call is well defined.
|
||||||
*/
|
*/
|
||||||
push $0
|
push $0
|
||||||
push $0
|
push $0
|
||||||
push $0
|
push $0
|
||||||
push %ebx
|
push %ebx
|
||||||
call hos_main
|
call hos_main
|
||||||
|
|
||||||
cli
|
cli
|
||||||
1: hlt
|
1: hlt
|
||||||
jmp 1b
|
jmp 1b
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set the size of the _start symbol to the current location '.' minus its start.
|
Set the size of the _start symbol to the current location '.' minus its start.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user