From 113c47805cedfb89c80fc4cd60fc22a1c83b96ae Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 5 Sep 2010 16:03:08 +0000 Subject: [PATCH] Update the GAS compatible fathelp.S file to reflect the latest changes to the original file (freeldr PE conversion). This version is tested and works. svn path=/trunk/; revision=48701 --- .../boot/freeldr/freeldr/arch/amd64/fathelp.S | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/fathelp.S b/reactos/boot/freeldr/freeldr/arch/amd64/fathelp.S index f799cb9978a..8aad29bbfe7 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/fathelp.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/fathelp.S @@ -4,10 +4,13 @@ .intel_syntax noprefix +//org 8000h + .text .code16 + #define BootSectorStackTop 0x7bf2 #define DataAreaStartHigh 0x2 #define DataAreaStartLow 0x4 @@ -38,6 +41,8 @@ #define VolumeLabel 43 #define FileSystem 54 +#define BootPartition 0x7dfd + // This code will be stored in the first 512 bytes // of freeldr.sys. The first 3 bytes will be a jmp @@ -46,7 +51,6 @@ // // This code is loaded at 0000:8000 so we have to // encode a jmp instruction to jump to 0000:8200 -//.org 0x8000 .global _mainCRTStartup // For Mingw32 builds where the linker looks for this symbol _mainCRTStartup: @@ -119,14 +123,14 @@ LoadFile5: jmp LoadFile // Load the next cluster (if any) LoadFile_Done: - mov dl, [bp+BootDrive] // Load the boot drive into DL - mov dh, BootPartition // Load the boot partition into DH - push word ptr 0x0000 - push word ptr 0x8000 // We will do a far return to 0000:8000h - -// retf // Transfer control to ROSLDR - .byte 0xcb // == retf + mov dl,BYTE PTR [bp+BootDrive] // Load the boot drive into DL + mov dh,[BootPartition] // Load the boot partition into DH + push 0 // push segment (0x0000) + mov bx, [0x8000 + 0xA8] // load the RVA of the EntryPoint into eax + add bx, 0x8000 // RVA -> VA and skip 3 bytes (jump to fathelper code) + push bx // push offset + retf // Transfer control to FreeLoader // Reads the entire FAT into memory at 7000:0000 ReadFatIntoMemory: @@ -225,15 +229,7 @@ IsFat12_Done: -msgLoading: - .ascii "Loading FreeLoader..." - .byte 0x0d,0x0a,0 - -// times 510-($-$$) db 0 // Pad to 510 bytes -.org 0x1fe - .word 0x0aa55 // BootSector signature - +msgLoading: .asciz "Loading FreeLoader...\r\n" -// pseudo adresses -//.org 0x7dfd -BootPartition: + .org 0x1fe // Pad to 510 bytes + .word 0x0aa55 // BootSector signature -- 2.17.1