Author: hbelusca
Date: Thu Feb 11 22:33:03 2016
New Revision: 70709
URL:
http://svn.reactos.org/svn/reactos?rev=70709&view=rev
Log:
[FREELDR]: Continue removing code not related to freeldr entry-point from entry.S, and
adopt source file names for i386 architecture similar to those of amd64.
Added:
trunk/reactos/boot/freeldr/freeldr/arch/i386/int386.S
- copied, changed from r70708, trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S
trunk/reactos/boot/freeldr/freeldr/arch/i386/pnpbios.S
- copied unchanged from r70708,
trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S
Removed:
trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S
Modified:
trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt
trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S
Modified: trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/CMake…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] Thu Feb 11 22:33:03
2016
@@ -96,7 +96,8 @@
if(ARCH STREQUAL "i386")
list(APPEND FREELDR_COMMON_ASM_SOURCE
arch/i386/entry.S
- arch/i386/i386pnp.S
+ arch/i386/int386.S
+ arch/i386/pnpbios.S
arch/i386/i386trap.S
arch/i386/linux.S
arch/i386/mb.S
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- 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 Feb 11 22:33:03
2016
@@ -52,6 +52,7 @@
/* Continue execution */
jmp dword ptr ds:[ContinueAddress]
+PUBLIC ContinueAddress
ContinueAddress:
.long _FrldrStartup
@@ -95,60 +96,6 @@
jmp stop
nop
nop
-
-Int386_regsin:
- .long 0
-Int386_regsout:
- .long 0
-
-/*
- * int Int386(int ivec, REGS* in, REGS* out);
- */
-PUBLIC _Int386
-_Int386:
-
- /* Get the function parameters */
- mov eax, dword ptr [esp + 4]
- mov dword ptr ds:[BSS_IntVector], eax
- mov eax, dword ptr [esp + 8]
- mov dword ptr [Int386_regsin], eax
- mov eax, dword ptr [esp + 12]
- mov dword ptr [Int386_regsout], eax
-
- /* Save all registers + segment registers */
- push ds
- push es
- push fs
- push gs
- pusha
-
- /* Copy input registers */
- mov esi, dword ptr [Int386_regsin]
- mov edi, BSS_RegisterSet
- mov ecx, REGS_SIZE / 4
- rep movsd
-
- /* Set the function ID */
- mov bx, FNID_Int386
-
- /* Set continue address and switch to real mode */
- mov dword ptr [ContinueAddress], offset Int386_return
- jmp SwitchToReal
-
-Int386_return:
-
- /* Copy output registers */
- mov esi, BSS_RegisterSet
- mov edi, dword ptr [Int386_regsout]
- mov ecx, REGS_SIZE / 4
- rep movsd
-
- popa
- pop gs
- pop fs
- pop es
- pop ds
- ret
/*
@@ -195,7 +142,7 @@
/* Set the function ID */
mov bx, FNID_Reboot
- /*Switch to real mode (We don't return) */
+ /* Switch to real mode (we don't return) */
jmp SwitchToReal
@@ -207,7 +154,7 @@
/* Set the function ID */
mov bx, FNID_ChainLoadBiosBootSectorCode
- /*Switch to real mode (We don't return) */
+ /* Switch to real mode (we don't return) */
jmp SwitchToReal
@@ -223,6 +170,7 @@
/* 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. */
+PUBLIC SwitchToReal
SwitchToReal:
/* Set sane segments */
mov ax, PMODE_DS
Removed: trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S (removed)
@@ -1,184 +0,0 @@
-/*
- * FreeLoader
- * Copyright (C) 2003 Eric Kohl
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <asm.inc>
-#include <arch/pc/x86common.h>
-
-EXTERN i386CallRealMode:PROC
-
-.code32
-
-/*
- * U32 PnpBiosSupported(VOID);
- *
- * RETURNS:
- */
-PUBLIC _PnpBiosSupported
-_PnpBiosSupported:
-
- push edi
- push esi
- push ecx
- push edx
-
- xor edi, edi
-
- /* init esi */
- mov esi, HEX(0F0000)
-
-pnp_again:
- mov eax, [esi]
- cmp eax, HEX(506E5024) /* "$PnP" */
- je pnp_found
-
- cmp esi, HEX(0FFFF0)
- je pnp_not_found
-
-pnp_add:
- add esi, 16
- jmp pnp_again
-
-pnp_found:
- /* first calculate the checksum */
- push esi
-
- push HEX(21)
- pop ecx
- xor edx, edx
-
-pnp_loop:
- lodsb
- add dl, al
- loop pnp_loop
-
- test dl, dl
- pop esi
- jnz pnp_add
-
- mov edi, esi
-
- /* Calculate the bios entry point (far pointer) */
- xor eax, eax
- mov ax, [esi + HEX(0F)]
- shl eax, 16
- mov ax, [esi + HEX(0D)]
- mov dword ptr ds:[BSS_PnpBiosEntryPoint], eax
-
- /* Store bios data segment */
- mov ax, [esi + HEX(1B)]
- mov word ptr ds:[BSS_PnpBiosDataSegment], ax
-
-pnp_not_found:
- mov eax, edi
-
- pop edx
- pop ecx
- pop esi
- pop edi
-
- ret
-
-
-/*
- * U32 PnpBiosGetDeviceNodeCount(U32 *NodeSize, U32 *NodeCount);
- *
- * RETURNS:
- */
-PUBLIC _PnpBiosGetDeviceNodeCount
-_PnpBiosGetDeviceNodeCount:
-
- push ebp
- mov ebp, esp
-
- pusha
- push es
-
- mov bx, FNID_PnpBiosGetDeviceNodeCount
- call i386CallRealMode
-
- mov esi, [ebp + 8]
- mov ax, [BSS_PnpNodeSize]
- movzx ecx, ax
- mov [esi], ecx
-
- mov esi, [ebp + 12]
- mov ax, [BSS_PnpNodeCount]
- movzx ecx, ax
- mov [esi], ecx
-
- pop es
- popa
-
- mov esp, ebp
- pop ebp
-
- mov eax, dword ptr [BSS_PnpResult]
-
- ret
-
-
-/*
- * U32 PnpBiosGetDeviceNode(U8 *NodeId, U8 *NodeBuffer);
- *
- * RETURNS:
- */
-PUBLIC _PnpBiosGetDeviceNode
-_PnpBiosGetDeviceNode:
-
- push ebp
- mov ebp, esp
-
- pusha
- push es
-
- /* get current node number */
- mov esi, [ebp + 8]
- mov al, [esi]
- mov byte ptr ds:[BSS_PnpNodeNumber], al
-
- /* convert pointer to node buffer to segment/offset */
- mov eax, [ebp + 12]
- shr eax, 4
- and eax, HEX(0f000)
- mov word ptr ds:[BSS_PnpBiosBufferSegment], ax
- mov eax, [ebp + 12]
- and eax, HEX(0ffff)
- mov word ptr ds:[BSS_PnpBiosBufferOffset], ax
-
- mov bx, FNID_PnpBiosGetDeviceNode
- call i386CallRealMode
-
- /* update node number */
- mov esi, [ebp + 8]
- mov al, byte ptr ds:[BSS_PnpNodeNumber]
- mov [esi], al
-
- pop es
- popa
-
- mov esp, ebp
- pop ebp
-
- mov eax, [BSS_PnpResult]
-
- ret
-
-END
-
-/* EOF */
Copied: trunk/reactos/boot/freeldr/freeldr/arch/i386/int386.S (from r70708,
trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/int386.S [iso-8859-1] Thu Feb 11 22:33:03
2016
@@ -21,80 +21,10 @@
#include <arch/pc/x86common.h>
#include <arch/pc/pcbios.h>
-EXTERN _BootMain:PROC
-EXTERN _InitIdt:PROC
-EXTERN _i386Idt:DWORD
-//EXTERN _i386idtptr:FWORD
-
.code32
-PUBLIC _RealEntryPoint
-_RealEntryPoint:
-
- /* Setup segment selectors */
- mov ax, PMODE_DS
- mov ds, ax
- mov es, ax
- mov fs, ax
- mov gs, ax
- mov ss, ax
-
- /* Setup protected mode stack */
- mov esp, dword ptr ds:[stack32]
-
- /* Load the IDT */
-#ifdef _USE_ML
- lidt fword ptr ds:[i386idtptr]
-#else
- lidt i386idtptr
-#endif
-
- /* Continue execution */
- jmp dword ptr ds:[ContinueAddress]
-
-ContinueAddress:
- .long _FrldrStartup
-
-
-_FrldrStartup:
-
- /* Store BootDrive and BootPartition */
- mov byte ptr ds:[_FrldrBootDrive], dl
- xor eax, eax
- mov al, dh
- mov dword ptr ds:[_FrldrBootPartition], eax
-
- /* Patch long jump with real mode entry point */
- mov eax, dword ptr ds:[BSS_RealModeEntry]
- mov dword ptr ds:[SwitchToReal16Address], eax
-
- /* Initialize the idt */
- call _InitIdt
-
-#ifndef _USE_ML
- /* Clean out bss */
- xor eax, eax
- mov edi, offset __bss_start__
- mov ecx, offset __bss_end__ + 3
- sub ecx, edi
- shr ecx, 2
- rep stosd
-
- /* Pass the command line to BootMain */
- mov eax, offset cmdline
-#else
- xor eax, eax
-#endif
-
- /* GO! */
- push eax
- call _BootMain
-
- /* We should never get here */
-stop:
- jmp stop
- nop
- nop
+EXTERN SwitchToReal:PROC
+EXTERN ContinueAddress:DWORD
Int386_regsin:
.long 0
@@ -150,160 +80,4 @@
pop ds
ret
-
-/*
- * U16 PxeCallApi(U16 Segment, U16 Offset, U16 Service, VOID *Parameter);
- *
- * RETURNS:
- */
-PUBLIC _PxeCallApi
-_PxeCallApi:
- /* copy entry point */
- mov eax, [esp + 4]
- shl eax, 16
- mov ax, [esp + 8]
- mov dword ptr ds:[BSS_PxeEntryPoint], eax
-
- /* copy function */
- mov ax, [esp + 12]
- mov word ptr ds:[BSS_PxeFunction], ax
-
- /* convert pointer to data buffer to segment/offset */
- mov eax, [esp + 16]
- shr eax, 4
- and eax, HEX(0f000)
- mov word ptr ds:[BSS_PxeBufferSegment], ax
- mov eax, [esp + 16]
- and eax, HEX(0ffff)
- mov word ptr ds:[BSS_PxeBufferOffset], ax
-
- pusha
-
- /* Set the function ID and call realmode */
- mov bx, FNID_PxeCallApi
- call i386CallRealMode
-
- popa
-
- mov ax, word ptr [BSS_PxeResult]
-
- ret
-
-
-PUBLIC _Reboot
-_Reboot:
- /* Set the function ID */
- mov bx, FNID_Reboot
-
- /*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
- mov ds, ax
- mov es, ax
- mov fs, ax
- mov gs, ax
- mov ss, ax
-
- /* Save 32-bit stack pointer */
- mov dword ptr [stack32], esp
-
- /* jmp to 16-bit segment to set the limit correctly */
- .byte HEX(0ea) // jmp far RMODE_CS:switch_to_real16
-SwitchToReal16Address:
- .long 0 // receives address of switch_to_real16
- .word RMODE_CS
- nop
-
-
- /* 16-bit stack pointer */
-stack16:
- .word STACK16ADDR
-
- /* 32-bit stack pointer */
-stack32:
- .long STACKADDR
-
- .align 4 /* force 4-byte alignment */
-gdt:
- /* NULL Descriptor */
- .word HEX(0000)
- .word HEX(0000)
- .word HEX(0000)
- .word HEX(0000)
-
- /* 32-bit flat CS */
- .word HEX(FFFF)
- .word HEX(0000)
- .word HEX(9A00)
- .word HEX(00CF)
-
- /* 32-bit flat DS */
- .word HEX(FFFF)
- .word HEX(0000)
- .word HEX(9200)
- .word HEX(00CF)
-
- /* 16-bit real mode CS */
- .word HEX(FFFF)
- .word HEX(0000)
- .word HEX(9E00)
- .word HEX(0000)
-
- /* 16-bit real mode DS */
- .word HEX(FFFF)
- .word HEX(0000)
- .word HEX(9200)
- .word HEX(0000)
-
-/* GDT table pointer */
-gdtptr:
- .word HEX(27) /* Limit */
- .long gdt /* Base Address */
-
-/* Real-mode IDT pointer */
-rmode_idtptr:
- .word HEX(3ff) /* Limit */
- .long 0 /* Base Address */
-
-PUBLIC i386idtptr
-i386idtptr:
- .word 255 /* Limit */
- .long _i386Idt /* Base Address */
-
-PUBLIC _FrldrBootDrive
-_FrldrBootDrive:
- .byte 0
-
-PUBLIC _FrldrBootPartition
-_FrldrBootPartition:
- .long 0
-
END