summaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
authorRegia König2022-08-25 15:08:09 +0200
committerRegia König2022-08-25 15:08:09 +0200
commite7897de9471e1d94ad79e2b03fcb8afc685760f1 (patch)
tree567f08f0754d65f0fd7865efa88c4809fdc890b4 /documentation
parentAnalyse memtest86 binary structure (diff)
downloadmemtest86-e7897de9471e1d94ad79e2b03fcb8afc685760f1.tar.gz
memtest86-e7897de9471e1d94ad79e2b03fcb8afc685760f1.tar.xz
memtest86-e7897de9471e1d94ad79e2b03fcb8afc685760f1.zip
Setup.S documentation and new command in create_debug.sh
Diffstat (limited to 'documentation')
-rw-r--r--documentation/memtest86_build_process/24_08_22_memtest_build_process39
1 files changed, 39 insertions, 0 deletions
diff --git a/documentation/memtest86_build_process/24_08_22_memtest_build_process b/documentation/memtest86_build_process/24_08_22_memtest_build_process
index 9847a5b..fc8f33c 100644
--- a/documentation/memtest86_build_process/24_08_22_memtest_build_process
+++ b/documentation/memtest86_build_process/24_08_22_memtest_build_process
@@ -203,3 +203,42 @@ coff_header:
#
# setup.S
#
+Collects memory map information from the BIOS, disables APM, enables A20 and performs
+the switch from real mode to protected mode before jumping to the main program entry
+point.
+
+The memory map information is stored in the 4KB block of memory immediately following
+the setup code. The layout of the information matches the Linux boot_params struct.
+A pointer to this block is passed to the main program, for compatibility with the Linux
+32-bit boot protocol.
+
+. # define BOOT_PARAMS_START (SETUP_SECS * 512) || SETUP_SEC is defined in boot.h
+. # define BOOT_PARAMS_END (BOOT_PARAMS_START + 4096) <--- here are the 4K
+
+ .section ".setup", "ax", @progbits
+ .code16
+
+Emulate the Linux boot header, to allow loading by other boot loaders. Indicate that the
+main program code should be loaded in high memory.
+
+ .globl setup
+setup: jmp do_setup
+
+101: do_setup:
+ Reload the segment registers, except for the stack
+ Get the memory map and disable APM
+ Disable interrupts
+ Enable A20
+ ...
+
+179: flush:
+ Reload the segment registers and jump to the main test program <------------!!!!
+
+ ...
+188: jump:
+ data32 ljmp $KERNEL_CS, $0
+
+
+
+389: Pad to the declared size
+ .org (ESTUP_SECS*512)