mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
Just learned SysV ABI calling conventions and clean-up stuff
This commit is contained in:
parent
f836157c90
commit
32c7c99bc2
@ -23,11 +23,12 @@
|
||||
; along with OS/K. If not, see <https://www.gnu.org/licenses/>. ;
|
||||
;=----------------------------------------------------------------------------=;
|
||||
|
||||
[global temporize]
|
||||
[global bitemporize]
|
||||
[global tritemporize]
|
||||
global temporize
|
||||
global bitemporize
|
||||
global tritemporize
|
||||
|
||||
[BITS 64]
|
||||
[section .text]
|
||||
|
||||
temporize:
|
||||
push rcx
|
||||
|
@ -24,6 +24,7 @@
|
||||
;=----------------------------------------------------------------------------=;
|
||||
|
||||
[BITS 32]
|
||||
[section .text]
|
||||
|
||||
; ---------------------------------------------------------------------------- ;
|
||||
; Checks if the CPU is compatible with 64-bits operating systems ;
|
||||
|
@ -22,7 +22,9 @@
|
||||
; You should have received a copy of the GNU General Public License ;
|
||||
; along with OS/K. If not, see <https://www.gnu.org/licenses/>. ;
|
||||
;=----------------------------------------------------------------------------=;
|
||||
[global testf]
|
||||
|
||||
[BITS 64]
|
||||
[section .text]
|
||||
|
||||
;;VIDEO
|
||||
%define TRAM 0xB8000 ; [T]ext[RAM]
|
||||
@ -30,16 +32,12 @@
|
||||
%define VGA_HEIGHT 80
|
||||
|
||||
;; GLOBAL DATA
|
||||
|
||||
NextTRAM dq 0xB8000 ; Last position of cursor
|
||||
NextTRAM32 dq 0xB8000 ; Last position of cursor
|
||||
VGA_X32 dq 0
|
||||
VGA_HEIGHT64 dq VGA_HEIGHT
|
||||
VGA_X dq 0
|
||||
|
||||
;; TEXT
|
||||
|
||||
[BITS 64]
|
||||
|
||||
testf:
|
||||
push rsi
|
||||
|
@ -31,9 +31,10 @@
|
||||
%include "boot/loader/cpu/cpu.inc"
|
||||
%include "boot/loader/mem/structures.inc"
|
||||
|
||||
[BITS 32]
|
||||
[global MB_start]
|
||||
global MB_start
|
||||
extern StartKern
|
||||
|
||||
[BITS 32]
|
||||
[section .multiboot]
|
||||
|
||||
;; MAGNIFICENT MULTIBOOT HEADER FOR GRUB ------------------------------------ ;;
|
||||
@ -50,8 +51,8 @@ MB_start:
|
||||
mov esp, KERNEL_STACK ; Setup the stack
|
||||
push 0 ; Reset EFLAGS
|
||||
popf
|
||||
push eax ; 2nd argument is magic number
|
||||
push ebx ; 1st argument multiboot info pointer
|
||||
mov [mbInfo], ebx
|
||||
mov [mbMagic], eax
|
||||
mov ecx, eax ; For debug
|
||||
call _loader
|
||||
add esp, 8 ; Cleanup arguments "A la MIPS"
|
||||
@ -100,12 +101,6 @@ mbInfo dq 0
|
||||
mbMagic dq 0
|
||||
|
||||
lbegin:
|
||||
|
||||
pop ebx ; 1st argument multiboot info pointer
|
||||
mov [mbInfo], ebx
|
||||
pop eax ; 2nd argument is magic number
|
||||
mov [mbMagic], eax
|
||||
|
||||
call clear ; Clear the screen
|
||||
|
||||
;; BEGIN OF CHECKLIST
|
||||
@ -160,10 +155,8 @@ _loader64:
|
||||
;; Launch the kernel !
|
||||
call tritemporize ; Let time to see
|
||||
|
||||
extern StartKern
|
||||
|
||||
mov rsi, [mbInfo]
|
||||
mov rdi, [mbMagic]
|
||||
mov rdi, [mbInfo]
|
||||
mov rsi, [mbMagic]
|
||||
call StartKern
|
||||
|
||||
;; We must never reach this point ------------------------------------------- ;;
|
||||
|
@ -24,7 +24,7 @@
|
||||
;=----------------------------------------------------------------------------=;
|
||||
|
||||
[BITS 32]
|
||||
|
||||
[section .text]
|
||||
; ---------------------------------------------------------------------------- ;
|
||||
; Constructor for the page tables in protected mode ;
|
||||
; ---------------------------------------------------------------------------- ;
|
||||
|
@ -24,7 +24,7 @@
|
||||
;=----------------------------------------------------------------------------=;
|
||||
|
||||
[BITS 32]
|
||||
section .rodata
|
||||
[section .rodata]
|
||||
;; GDT WITH DOC
|
||||
ALIGN 4096
|
||||
GDT64:
|
||||
@ -44,7 +44,7 @@ GDT64:
|
||||
dq GDT64
|
||||
|
||||
;; EMPTY PAGE TABLES (identity of the first 1GiB)
|
||||
section .bss
|
||||
[section .bss]
|
||||
ALIGN 4096
|
||||
PML4_table:
|
||||
resb 4096
|
||||
|
@ -40,6 +40,6 @@ noreturn void StartKern(void *mbInfo, int mbMagic)
|
||||
InitTerms();
|
||||
|
||||
// We're out
|
||||
StartPanic("We had\n *mbInfo : %p\n mbMagic : %x\n\nGoodbye World :(", mbInfo, mbMagic);
|
||||
StartPanic("We had\n *mbInfo : %p\n mbMagic : %p\n\nGoodbye World :(", mbInfo, mbMagic);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user