]> git.lizzy.rs Git - loadnothing.git/commitdiff
Maybe load stage 2? Not sure
authorHimbeerserverDE <himbeerserverde@gmail.com>
Tue, 13 Sep 2022 14:03:05 +0000 (16:03 +0200)
committerHimbeerserverDE <himbeerserverde@gmail.com>
Tue, 13 Sep 2022 14:03:05 +0000 (16:03 +0200)
stage1/boot.asm
stage2/.cargo/config.toml
stage2/Cargo.toml

index 559d916ca2e1bc1ec93b72741a73fb4aca142782..ff80f2a3be9fa7a5a62e622abd66af882b495a54 100644 (file)
@@ -1,7 +1,7 @@
 [org 0x7c00]
 
 %define STAGE2START 0x7e00
-%define STAGE2SIZE 0x7f
+%define STAGE2SECTORS (STAGE2SIZE + 511) / 512
 
 ; Initialize registers
 xor ax, ax
@@ -64,30 +64,30 @@ boot:
 
        ; Move cursor to 0, 0 on page 0
        mov ah, 0x02
-       mov bh, 0           ; Page
-       mov dh, 0           ; Row
-       mov dl, 0           ; Column
+       mov bh, 0             ; Page
+       mov dh, 0             ; Row
+       mov dl, 0             ; Column
        int 0x10
 
-       mov ch, 33          ; Our string is 33 characters long
+       mov ch, 33            ; Our string is 33 characters long
        mov si, hello
        call print_bytes_si
 
-       mov ah, 0x02        ; Read sectors
-       mov al, STAGE2SIZE  ; Stage 2 size (16 MiB) in sectors
-       xor ch, ch          ; Cylinder 0
-       mov cl, 2           ; Second sector, they start at 1
-       xor dh, dh          ; Head 0
-       mov dl, 0x80        ; Hard Drive 1
-       mov bx, STAGE2START ; Memory address to load stage 2 into
+       mov ah, 0x02          ; Read sectors
+       mov al, STAGE2SECTORS ; Stage 2 size in sectors
+       xor ch, ch            ; Cylinder 0
+       mov cl, 2             ; Second sector, they start at 1
+       xor dh, dh            ; Head 0
+       mov dl, 0x80          ; Hard Drive 1
+       mov bx, STAGE2START   ; Memory address to load stage 2 into
        int 0x13
 
-       jc stage2_error     ; Carry flag is set if there was an error
+       jc stage2_error       ; Carry flag is set if there was an error
 
-       cmp al, STAGE2SIZE  ; Have we read as many sectors as we requested?
+       cmp al, STAGE2SECTORS ; Have we read as many sectors as we requested?
        jne stage2_error
 
-       jmp STAGE2START     ; Hand over control to stage 2
+       jmp STAGE2START       ; Hand over control to stage 2
 
 hello db 'Welcome to loadnothing stage 1!', 13, 10 ; \r\n
 error db 'Error reading stage 2 from disk', 13, 10 ; \r\n
index 845acf4b638a702fc08b8eb59ead903edf262479..354486a8db9541caa3211b9cd557cfbaaeb12a30 100644 (file)
@@ -1,6 +1,6 @@
 [unstable]
 build-std = ["core", "compiler_builtins"]
-build-std-features = ["compiler-builtins-mem"]
+build-std-features = ["compiler-builtins-mem", "panic_immediate_abort"]
 
 [build]
 target = "x86_64-loadnothing.json"
index eaf63ed2af18aa8f01ffc220ab0be559a54ca320..c1cd277ae18e794bc26c7bf7b5b005197e0dd768 100644 (file)
@@ -10,5 +10,9 @@ panic = "abort"
 
 [profile.release]
 panic = "abort"
+strip = true
+opt-level = "z"
+lto = true
+codegen-units = 1
 
 [dependencies]