From 04104fc051d44f4f9b3328f29b4be91fa4060f34 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 28 Apr 2021 23:12:17 +0200 Subject: Started conversion to Grub (#17) Yes, the CI won't like this. --- kernel/entry.asm | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 kernel/entry.asm (limited to 'kernel/entry.asm') diff --git a/kernel/entry.asm b/kernel/entry.asm new file mode 100644 index 0000000..10b6b25 --- /dev/null +++ b/kernel/entry.asm @@ -0,0 +1,41 @@ +bits 32 + +%define STACK_POINTER 0x00500000 ; The initial stack pointer in kernel mode +%define MULTIBOOT_MAGIC 0x1badb002 +%define MULTIBOOT_PAGE_ALIGN 0x1 +%define MULTIBOOT_MEMORY_INFO 0x2 +%define MULTIBOOT_VIDEO_MODE 0x4 +%define MULTIBOOT_FLAGS (MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_VIDEO_MODE) +%define MULTIBOOT_CHECKSUM -(MULTIBOOT_MAGIC + MULTIBOOT_FLAGS) + +section .text +align 4 + +dd MULTIBOOT_MAGIC +dd MULTIBOOT_FLAGS +dd MULTIBOOT_CHECKSUM + +; MULTIBOOT_MEMORY_INFO +dd 0x00000000 +dd 0x00000000 +dd 0x00000000 +dd 0x00000000 +dd 0x00000000 + +; MULTIBOOT_VIDEO_MODE +dd 0x00000000 +dd 1280 +dd 1024 +dd 32 + +global boot_entry +extern kernel_main +boot_entry: + mov esp, STACK_POINTER + push ebx + push eax + + cli + call kernel_main + hlt + jmp $ -- cgit v1.2.3