From ef10fa11e3e038977c4e7546a958fdf80b2cc95e Mon Sep 17 00:00:00 2001 From: "E. C. Masloch" Date: Tue, 6 Feb 2024 20:36:09 +0100 Subject: [PATCH] boot32, boot32lb: fix and update memory layout maps --- boot/boot32.asm | 55 +++++++++++++++++++++++------------------------ boot/boot32lb.asm | 30 +++++++++++++++----------- 2 files changed, 44 insertions(+), 41 deletions(-) diff --git a/boot/boot32.asm b/boot/boot32.asm index 19f6d9d..cd5327c 100644 --- a/boot/boot32.asm +++ b/boot/boot32.asm @@ -1,31 +1,30 @@ -; +--------+ -; | | -; | | -; |--------| 4000:0000 -; | | -; | FAT | -; | | -; |--------| 2000:0000 -; |BOOT SEC| -; |RELOCATE| -; |--------| 1FE0:0000 -; | | -; | | -; | | -; | | -; |--------| -; |BOOT SEC| -; |ORIGIN | 07C0:0000 -; |--------| -; | | -; | | -; | | -; |--------| -; |KERNEL | -; |LOADED | -; |--------| 0060:0000 -; | | -; +--------+ + +; Memory layout for the FreeDOS FAT32 single stage boot process: +; +; ... +; |-------| 1FE0h:7E00h = 27C00h (159 KiB) +; |BOOTSEC| loader relocates itself here first thing, +; |RELOC. | before loading root directory/FAT/kernel file +; |-------| 1FE0h:7C00h = 27A00h (158 KiB) +; | STACK | below relocated loader, above FAT sector (size 22 KiB) +; ... +; |-------| 2200h:2000h = 24000h (144 KiB) +; | FAT | (only 1 sector buffered, maximum sector size 8 KiB) +; |-------| 2200h:0000h = 22000h (136 KiB) +; ... +; |-------| 0000h:7E00h = 07E00h (31.5 KiB) +; |BOOTSEC| overwritten by the kernel, so the +; |ORIGIN | bootsector relocates itself up... +; |-------| 0000h:7C00h = 07C00h (31 KiB) +; ... +; |-------| +; |KERNEL | maximum size 128 KiB (overwrites bootsec origin) +; |LOADED | (holds 1 sector directory buffer before kernel file load) +; |-------| 0060h:0000h = 00600h (1.5 KiB) +; ... +; The kernel load segment may be patched using the SYS /L switch. +; We support values between 0x60 and 0x200 here, with file size +; of up to 128 KiB (rounded to cluster size). Default is 0x60. ;%define MULTI_SEC_READ 1 diff --git a/boot/boot32lb.asm b/boot/boot32lb.asm index fdffdb1..708861a 100644 --- a/boot/boot32lb.asm +++ b/boot/boot32lb.asm @@ -27,27 +27,31 @@ ; Memory layout for the FreeDOS FAT32 single stage boot process: - +; ; ... -; |-------| 1FE0:7E00 -; |BOOTSEC| -; |RELOC. | -; |-------| 1FE0:7C00 +; |-------| 1FE0h:7E00h = 27C00h (159 KiB) +; |BOOTSEC| loader relocates itself here first thing, +; |RELOC. | before loading root directory/FAT/kernel file +; |-------| 1FE0h:7C00h = 27A00h (158 KiB) +; | STACK | below relocated loader, above FAT sector (size 22 KiB) ; ... -; |-------| 2000:0200 -; | FAT | (only 1 sector buffered) -; |-------| 2000:0000 +; |-------| 2200h:2000h = 24000h (144 KiB) +; | FAT | (only 1 sector buffered, maximum sector size 8 KiB) +; |-------| 2200h:0000h = 22000h (136 KiB) ; ... -; |-------| 0000:7E00 +; |-------| 0000h:7E00h = 07E00h (31.5 KiB) ; |BOOTSEC| overwritten by the kernel, so the ; |ORIGIN | bootsector relocates itself up... -; |-------| 0000:7C00 +; |-------| 0000h:7C00h = 07C00h (31 KiB) ; ... ; |-------| -; |KERNEL | maximum size 134k (overwrites bootsec origin) -; |LOADED | (holds 1 sector directory buffer before kernel load) -; |-------| 0060:0000 +; |KERNEL | maximum size 128 KiB (overwrites bootsec origin) +; |LOADED | (holds 1 sector directory buffer before kernel file load) +; |-------| 0060h:0000h = 00600h (1.5 KiB) ; ... +; The kernel load segment may be patched using the SYS /L switch. +; We support values between 0x60 and 0x200 here, with file size +; of up to 128 KiB (rounded to cluster size). Default is 0x60. segment .text