[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.

svn path=/trunk/; revision=70709
This commit is contained in:
Hermès Bélusca-Maïto 2016-02-11 22:33:03 +00:00
parent 6c834bbca5
commit 0455477600
4 changed files with 89 additions and 57 deletions

View file

@ -96,7 +96,8 @@ list(APPEND FREELDR_COMMON_SOURCE
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

View file

@ -52,6 +52,7 @@ _RealEntryPoint:
/* Continue execution */
jmp dword ptr ds:[ContinueAddress]
PUBLIC ContinueAddress
ContinueAddress:
.long _FrldrStartup
@ -96,60 +97,6 @@ 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
/*
* U16 PxeCallApi(U16 Segment, U16 Offset, U16 Service, VOID *Parameter);
@ -195,7 +142,7 @@ _Reboot:
/* 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 @@ _ChainLoadBiosBootSectorCode:
/* 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 @@ i386CallRealMode_return:
/* 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

View file

@ -0,0 +1,83 @@
/*
* FreeLoader
* Copyright (C) 1998-2002 Brian Palmer <brianp@sginet.com>
*
* 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>
#include <arch/pc/pcbios.h>
.code32
EXTERN SwitchToReal:PROC
EXTERN ContinueAddress:DWORD
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
END