Finally got it working with grub

This commit is contained in:
Tyler McGurrin 2025-06-06 16:29:55 -04:00
parent 7b3da2b6a5
commit b41eb73a8c
4 changed files with 9 additions and 39 deletions

View File

@ -4,39 +4,7 @@
;Tyler McGurrin ; ;Tyler McGurrin ;
;/////////////////////; ;/////////////////////;
[bits 32] [bits 32]
section .entry section .multiboot_header
extern __bss_start
extern __end
extern start
global entry
; My Life is totally funnnn
global entry
entry:
; 6 - setup segment registers
mov ax, 0x10
mov ds, ax
mov ss, ax
mov al, 0
cld
rep stosb
; clear BSS (uninit data)
mov edi, __bss_start
mov ecx, __end
sub ecx, edi
xor edx, edx
push edx
call start
cli
hlt
section .text
header_start: header_start:
dd 0xe85250d6 ; magic number dd 0xe85250d6 ; magic number
dd 0 ; protected mode code dd 0 ; protected mode code

View File

@ -1,13 +1,12 @@
ENTRY(entry) ENTRY(start)
OUTPUT_FORMAT("binary")
phys = 0x00100000;
SECTIONS SECTIONS
{ {
. = phys; . = 1M;
.boot : { KEEP(*(.multiboot_header))}
.entry : { __entry_start = .; *(.entry) } .entry : { __entry_start = .; *(.entry) }
.text : { __text_start = ALIGN(8); KEEP(*(multiboot_header)) *(.text) } .text : { __text_start = .; *(.text) }
.data : { __data_start = .; *(.data) } .data : { __data_start = .; *(.data) }
.rodata : { __rodata_start = .; *(.rodata) } .rodata : { __rodata_start = .; *(.rodata) }
.bss : { __bss_start = .; *(.bss) } .bss : { __bss_start = .; *(.bss) }

View File

@ -21,6 +21,9 @@
#include <util/util.h> #include <util/util.h>
#include <version.h> #include <version.h>
extern uint8_t __bss_start;
extern uint8_t __end;
uint16_t DEBUG_COM_PORT = COM1_PORT; uint16_t DEBUG_COM_PORT = COM1_PORT;
void __attribute__((section(".entry"))) start() { void __attribute__((section(".entry"))) start() {

View File

@ -6,4 +6,4 @@
#pragma once #pragma once
#define LOGO " _ _____ _ __________________\n / | / / | / | / / _/_ __/ ____/\n / |/ / /| | / |/ // / / / / __/ \n / /| / ___ |/ /| // / / / / /___ \n/_/ |_/_/ |_/_/ |_/___/ /_/ /_____/ \n" #define LOGO " _ _____ _ __________________\n / | / / | / | / / _/_ __/ ____/\n / |/ / /| | / |/ // / / / / __/ \n / /| / ___ |/ /| // / / / / /___ \n/_/ |_/_/ |_/_/ |_/___/ /_/ /_____/ \n"
#define VERSION "RD-00039" #define VERSION "RD-00040"