Author: tkreuzer Date: Thu Jun 16 22:11:53 2011 New Revision: 52284
URL: http://svn.reactos.org/svn/reactos?rev=52284&view=rev Log: [FREELDR] - Use the new realmode code for PxeCallApi, SoftReboot and ChainLoadBiosBootSectorCode - Remove o386cpi.S from build, the functions are not used - Use constants for function ids - Fix a warning
Modified: trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S trunk/reactos/boot/freeldr/freeldr/arch/i386/i386idt.c trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S trunk/reactos/boot/freeldr/freeldr/arch/realmode/helpers.inc trunk/reactos/boot/freeldr/freeldr/arch/realmode/i386.S trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h
Modified: trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/CMakeL... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] Thu Jun 16 22:11:53 2011 @@ -16,11 +16,8 @@ arch/i386/i386bug.c) if(NOT MSVC) list(APPEND FREELDR_BASE64K_SOURCE - arch/i386/boot.S arch/i386/drvmap.S - arch/i386/i386cpu.S arch/i386/i386pnp.S - arch/i386/i386pxe.S arch/i386/linux.S arch/i386/multiboot.S arch/i386/mb.S) @@ -32,8 +29,6 @@ if(NOT MSVC) list(APPEND FREELDR_BASE64K_SOURCE arch/i386/drvmap.S - arch/i386/i386cpu.S - arch/i386/i386idt.S arch/i386/i386trap.S arch/amd64/mb.S) else()
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S [iso-8859-1] Thu Jun 16 22:11:53 2011 @@ -259,8 +259,8 @@ mov ecx, 9 rep movsd
- /* Set the callback index */ - mov bx, 0 + /* Set the function ID */ + mov bx, FNID_Int386
/* Set continue address and switch to real mode */ mov dword ptr [ContinueAddress], offset Int386_return @@ -282,6 +282,86 @@ ret
+/* + * U16 PxeCallApi(U16 Segment, U16 Offset, U16 Service, VOID *Parameter); + * + * RETURNS: + */ +PUBLIC _PxeCallApi +_PxeCallApi: + push ebp + mov ebp, esp + + pusha + push es + + /* copy entry point */ + mov eax, [ebp + 8] + shl eax, 16 + mov ax, [ebp + 12] + mov dword ptr ds:[BSS_PxeEntryPoint], eax + + /* copy function */ + mov ax, [ebp + 16] + mov word ptr ds:[BSS_PxeFunction], ax + + /* convert pointer to data buffer to segment/offset */ + mov eax, [ebp + 20] + shr eax, 4 + and eax, HEX(0f000) + mov word ptr ds:[BSS_PxeBufferSegment], ax + mov eax, [ebp + 20] + and eax, HEX(0ffff) + mov word ptr ds:[BSS_PxeBufferOffset], ax + + /* Set the function ID and call realmode */ + mov bx, FNID_PxeCallApi + call i386CallRealMode + + pop es + popa + + mov esp, ebp + pop ebp + + mov ax, word ptr [BSS_PxeResult] + + ret + + +PUBLIC _SoftReboot +_SoftReboot: + /* Set the function ID */ + mov bx, FNID_SoftReboot + + /*Switch to real mode (We don't return) */ + jmp SwitchToReal + + +PUBLIC _ChainLoadBiosBootSectorCode +_ChainLoadBiosBootSectorCode: + /* Set the boot drive */ + mov dl, byte ptr [_FrldrBootDrive] + + /* Set the function ID */ + mov bx, FNID_ChainLoadBiosBootSectorCode + + /*Switch to real mode (We don't return) */ + jmp SwitchToReal + + +PUBLIC i386CallRealMode +i386CallRealMode: + /* Set continue address and switch to real mode */ + mov dword ptr [ContinueAddress], offset i386CallRealMode_return + jmp SwitchToReal +i386CallRealMode_return: + ret + + +/* Entrypoint for realmode function calls + * ContinueAddress must be set to the return point from realmode + * bx must be set to the ID of the realmode function to call. */ SwitchToReal: /* Set sane segments */ mov ax, PMODE_DS
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/i386idt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/i386idt.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/i386idt.c [iso-8859-1] Thu Jun 16 22:11:53 2011 @@ -3,7 +3,7 @@
KIDTENTRY DECLSPEC_ALIGN(4) i386Idt[32]; -KDESCRIPTOR i386IdtDescriptor = {0, 255, i386Idt}; +KDESCRIPTOR i386IdtDescriptor = {0, 255, (ULONG)i386Idt};
static void
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S [iso-8859-1] Thu Jun 16 22:11:53 2011 @@ -20,17 +20,11 @@ PUBLIC _lowmem_pagetable _lowmem_pagetable:
-PUBLIC _ChainLoadBiosBootSectorCode -_ChainLoadBiosBootSectorCode: - PUBLIC _BootOldLinuxKernel _BootOldLinuxKernel:
PUBLIC _BootNewLinuxKernel _BootNewLinuxKernel: - -PUBLIC _SoftReboot -_SoftReboot:
PUBLIC _DriveMapOldInt13HandlerAddress _DriveMapOldInt13HandlerAddress: @@ -53,7 +47,4 @@ PUBLIC _PnpBiosSupported _PnpBiosSupported:
-PUBLIC _PxeCallApi -_PxeCallApi: - END
Modified: trunk/reactos/boot/freeldr/freeldr/arch/realmode/helpers.inc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/r... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/realmode/helpers.inc [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/realmode/helpers.inc [iso-8859-1] Thu Jun 16 22:11:53 2011 @@ -102,3 +102,19 @@
/* and jump to location FFFF:0 in ROM */ ljmp16 HEX(0FFFF), HEX(0000) + + +ChainLoadBiosBootSectorCode: + + /* Load segment registers */ + cli + xor ax, ax + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + mov esp, HEX(7C00) + + /* Jump to the bootsector code */ + ljmp16 HEX(0000), HEX(7C00)
Modified: trunk/reactos/boot/freeldr/freeldr/arch/realmode/i386.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/r... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/realmode/i386.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/realmode/i386.S [iso-8859-1] Thu Jun 16 22:11:53 2011 @@ -121,10 +121,13 @@ .word 0 // receives address of PE entry point .word PMODE_CS nop - +// FIXME: use ljmp16 PMODE_CS:inpmode + hexed 32bit jump
callback_table: .word Int386 + .word SoftReboot + .word ChainLoadBiosBootSectorCode + .word PxeCallApi
/* 16-bit stack pointer */
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1] Thu Jun 16 22:11:53 2011 @@ -22,13 +22,23 @@ #define DISKREADBUFFER_SIZE 512
/* These addresses specify the realmode "BSS section" layout */ -#define BSS_RealModeEntry (BSS_START + 0) -#define BSS_CallbackAddress (BSS_START + 4) -#define BSS_CallbackReturn (BSS_START + 8) +#define BSS_RealModeEntry (BSS_START + 0) +#define BSS_CallbackAddress (BSS_START + 4) +#define BSS_CallbackReturn (BSS_START + 8) +#define BSS_RegisterSet (BSS_START + 16) /* size = 36 */ +#define BSS_IntVector (BSS_START + 52) +#define BSS_PxeEntryPoint (BSS_START + 56) +#define BSS_PxeBufferSegment (BSS_START + 60) +#define BSS_PxeBufferOffset (BSS_START + 64) +#define BSS_PxeFunction (BSS_START + 68) +#define BSS_PxeResult (BSS_START + 72)
-#define BSS_RegisterSet (BSS_START + 16) /* size = 36 */ -#define BSS_IntVector (BSS_START + 52) -// next 52 + +/* Realmode function IDs */ +#define FNID_Int386 0 +#define FNID_SoftReboot 1 +#define FNID_ChainLoadBiosBootSectorCode 2 +#define FNID_PxeCallApi 3
/* Layout of the REGS structure */ #define REGS_EAX 0