From e7897de9471e1d94ad79e2b03fcb8afc685760f1 Mon Sep 17 00:00:00 2001 From: Regia König Date: Thu, 25 Aug 2022 15:08:09 +0200 Subject: Setup.S documentation and new command in create_debug.sh --- .../24_08_22_memtest_build_process | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'documentation') 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) -- cgit v1.2.3-55-g7522