From 04554776007aaa9063255dda7d8eba31dbf7c26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Thu, 11 Feb 2016 22:33:03 +0000 Subject: [PATCH] [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 --- reactos/boot/freeldr/freeldr/CMakeLists.txt | 3 +- .../boot/freeldr/freeldr/arch/i386/entry.S | 60 +------------- .../boot/freeldr/freeldr/arch/i386/int386.S | 83 +++++++++++++++++++ .../arch/i386/{i386pnp.S => pnpbios.S} | 0 4 files changed, 89 insertions(+), 57 deletions(-) create mode 100644 reactos/boot/freeldr/freeldr/arch/i386/int386.S rename reactos/boot/freeldr/freeldr/arch/i386/{i386pnp.S => pnpbios.S} (100%) diff --git a/reactos/boot/freeldr/freeldr/CMakeLists.txt b/reactos/boot/freeldr/freeldr/CMakeLists.txt index 475a1a1d5cc..23e6f33e3cf 100644 --- a/reactos/boot/freeldr/freeldr/CMakeLists.txt +++ b/reactos/boot/freeldr/freeldr/CMakeLists.txt @@ -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 diff --git a/reactos/boot/freeldr/freeldr/arch/i386/entry.S b/reactos/boot/freeldr/freeldr/arch/i386/entry.S index bc54e2c3151..90a40272d4f 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/entry.S +++ b/reactos/boot/freeldr/freeldr/arch/i386/entry.S @@ -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 diff --git a/reactos/boot/freeldr/freeldr/arch/i386/int386.S b/reactos/boot/freeldr/freeldr/arch/i386/int386.S new file mode 100644 index 00000000000..e1c371956d5 --- /dev/null +++ b/reactos/boot/freeldr/freeldr/arch/i386/int386.S @@ -0,0 +1,83 @@ +/* + * FreeLoader + * Copyright (C) 1998-2002 Brian Palmer + * + * 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 +#include +#include + +.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 diff --git a/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S b/reactos/boot/freeldr/freeldr/arch/i386/pnpbios.S similarity index 100% rename from reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S rename to reactos/boot/freeldr/freeldr/arch/i386/pnpbios.S