From 5b2bcf08bcd1e6844bdd6e2bbc516274a36f6800 Mon Sep 17 00:00:00 2001 From: rain Date: Mon, 15 Feb 2021 15:22:01 +0800 Subject: [PATCH] 0.451s-boot: load 4KB of loader, not 512B --- LINES | 2 ++ README.md | 2 ++ boot/x86/boot.asm | 25 ++++++++++++++++++++++--- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/LINES b/LINES index a69de44..b384f38 100644 --- a/LINES +++ b/LINES @@ -6,3 +6,5 @@ 2021-2-15 0.432: 432 lines, 4 files, rain +2021-2-15 0.451: 451 lines, 4 files, rain + diff --git a/README.md b/README.md index ad037e6..9dc49ef 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,6 @@ Cunix kernel `0.432s-boot`: make directory `include/`, and add segment.inc, but it doesn't work. :-) +`0.451s-boot`: + `boot` can load 8 sectors (4KB) of loader (not 1 sector). diff --git a/boot/x86/boot.asm b/boot/x86/boot.asm index 8b09f3d..e32a117 100644 --- a/boot/x86/boot.asm +++ b/boot/x86/boot.asm @@ -71,21 +71,40 @@ load_loader: mov cl, 0x02 mov bx, 0x8000 +.read_loop: call read_sector_chs mov di, diskpanic_message jc .try_lba +; read 8 sectors + add cl, 0x02 + add bx, 0x0200 + + cmp cl, 0x0a + je .ret + + jmp .read_loop + +.ret: ret + .try_lba: - mov cl, 0x02 - mov bx, 0x8000 call read_sector_lba jc panic - ret + + add cl, 0x02 + add bx, 0x0200 + + cmp cl, 0x0a + je .ret + + jmp .read_loop + + read_sector_chs: mov ax, 0x0201 -- GitLab