summaryrefslogtreecommitdiffstats
path: root/documentation/memtest86_build_process/24_08_22_memtest_build_process
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/memtest86_build_process/24_08_22_memtest_build_process')
-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)