Just learned SysV ABI calling conventions and clean-up stuff

This commit is contained in:
Adrien Bourmault 2019-03-12 22:11:00 +01:00
parent f836157c90
commit 32c7c99bc2
7 changed files with 19 additions and 26 deletions

View File

@ -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

View File

@ -24,6 +24,7 @@
;=----------------------------------------------------------------------------=;
[BITS 32]
[section .text]
; ---------------------------------------------------------------------------- ;
; Checks if the CPU is compatible with 64-bits operating systems ;

View File

@ -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

View File

@ -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 ------------------------------------------- ;;

View File

@ -24,7 +24,7 @@
;=----------------------------------------------------------------------------=;
[BITS 32]
[section .text]
; ---------------------------------------------------------------------------- ;
; Constructor for the page tables in protected mode ;
; ---------------------------------------------------------------------------- ;

View File

@ -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

View File

@ -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);
}