Author: tkreuzer
Date: Fri Jun 17 08:36:49 2011
New Revision: 52292

URL: http://svn.reactos.org/svn/reactos?rev=52292&view=rev
Log:
[FREELDR]
- Use new relmode code for PnpBios stuff

Added:
    trunk/reactos/boot/freeldr/freeldr/arch/realmode/pnp.inc
    trunk/reactos/boot/freeldr/freeldr/arch/realmode/pxe.inc
Modified:
    trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S
    trunk/reactos/boot/freeldr/freeldr/arch/realmode/i386.S
    trunk/reactos/boot/freeldr/freeldr/include/arch/pc/hardware.h
    trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S?rev=52292&r1=52291&r2=52292&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S [iso-8859-1] Fri Jun 
17 08:36:49 2011
@@ -28,11 +28,6 @@
  *
  * RETURNS:
  */
-_pnp_bios_entry_point:
-       .long   0
-_pnp_bios_data_segment:
-       .word   0
-
 PUBLIC _PnpBiosSupported
 _PnpBiosSupported:
 
@@ -82,11 +77,11 @@
        mov ax, [esi + 15]
        shl eax, 16
        mov ax, [esi + 0x0D]
-       mov _pnp_bios_entry_point, eax
+       mov [BSS_PnpBiosEntryPoint], eax
 
        /* Store bios data segment */
        mov ax, [esi + 0x1B]
-       mov _pnp_bios_data_segment, ax
+       mov word ptr ds:[BSS_PnpBiosDataSegment], ax
 
 pnp_not_found:
        mov eax, edi
@@ -104,13 +99,6 @@
  *
  * RETURNS:
  */
-_pnp_result:
-       .long   0
-_pnp_node_size:
-       .word   0
-_pnp_node_count:
-       .word   0
-
 PUBLIC _PnpBiosGetDeviceNodeCount
 _PnpBiosGetDeviceNodeCount:
 
@@ -120,39 +108,16 @@
        pusha
        push es
 
-       call switch_to_real
-       .code16
-
-       mov ax, word ptr [_pnp_bios_data_segment]
-       push ax
-
-       push cs
-       mov ax, offset _pnp_node_size
-       push ax
-
-       push cs
-       mov ax, offset _pnp_node_count
-       push ax
-
-       push 0
-
-       call dword ptr [_pnp_bios_entry_point]
-       add sp, 12
-
-       movzx ecx, ax
-       mov _pnp_result, ecx
-
-
-       call switch_to_prot
-       .code32
+    mov bx, FNID_PnpBiosGetDeviceNodeCount
+    call i386CallRealMode
 
        mov esi, [ebp + 8]
-       mov ax, _pnp_node_size
+       mov ax, [BSS_PnpNodeSize]
        movzx ecx, ax
        mov [esi], ecx
 
        mov esi, [ebp + 12]
-       mov ax, _pnp_node_count
+       mov ax, [BSS_PnpNodeCount]
        movzx ecx, ax
        mov [esi], eax
 
@@ -162,7 +127,7 @@
        mov esp, ebp
        pop ebp
 
-       mov eax, _pnp_result
+       mov eax, dword ptr [BSS_PnpResult]
 
        ret
 
@@ -172,14 +137,6 @@
  *
  * RETURNS:
  */
-_pnp_buffer_segment:
-       .word   0
-_pnp_buffer_offset:
-       .word   0
-
-_pnp_node_number:
-       .byte   0
-
 EXTERN(_PnpBiosGetDeviceNode)
        .code32
 
@@ -192,54 +149,23 @@
        /* get current node number */
        mov esi, [ebp + 8]
        mov al, [esi]
-       mov _pnp_node_number, al
+       mov [BSS_PnpNodeNumber], al
 
        /* convert pointer to node buffer to segment/offset */
        mov eax, [ebp + 12]
        shr eax, 4
        and eax, 0xf000
-       mov _pnp_buffer_segment, ax
+       mov word ptr [BSS_PnpBiosBufferSegment], ax
        mov eax, [ebp + 12]
        and eax, 0xffff
-       mov _pnp_buffer_offset, ax
+       mov [BSS_PnpBiosBufferOffset], ax
 
-       call switch_to_real
-       .code16
-
-       /* push bios segment */
-       mov ax, word ptr [_pnp_bios_data_segment]
-       push ax
-
-       /* push control flag */
-       push 1
-
-       /* push pointer to node buffer (segment/offset) */
-       mov ax, word ptr [_pnp_buffer_segment]
-       push ax
-       mov ax, word ptr [_pnp_buffer_offset]
-       push ax
-
-       /* push pointer to node number (segment/offset) */
-       push cs
-       mov ax, offset _pnp_node_number
-       push ax
-
-       /* push function number */
-       push 1
-
-       /* call entry point */
-       call dword ptr [_pnp_bios_entry_point]
-       add sp, 14
-
-       movzx ecx, ax
-       mov _pnp_result, ecx
-
-       call switch_to_prot
-       .code32
+    mov bx, FNID_PnpBiosGetDeviceNode
+    call i386CallRealMode
 
        /* update node number */
        mov esi, [ebp + 8]
-       mov al, _pnp_node_number
+       mov al, [BSS_PnpNodeNumber]
        mov [esi], al
 
        pop es
@@ -248,7 +174,7 @@
        mov esp, ebp
        pop ebp
 
-       mov eax, _pnp_result
+       mov eax, [BSS_PnpResult]
 
        ret
 

Modified: trunk/reactos/boot/freeldr/freeldr/arch/realmode/i386.S
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/realmode/i386.S?rev=52292&r1=52291&r2=52292&view=diff
==============================================================================
--- 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] Fri 
Jun 17 08:36:49 2011
@@ -123,11 +123,15 @@
     nop
 // FIXME: use ljmp16 PMODE_CS:inpmode + hexed 32bit jump
 
+
+
 callback_table:
     .word Int386
     .word SoftReboot
     .word ChainLoadBiosBootSectorCode
     .word PxeCallApi
+    .word PnpBiosGetDeviceNodeCount
+    .word PnpBiosGetDeviceNode
 
 
     /* 16-bit stack pointer */
@@ -180,6 +184,8 @@
 //.org 1024
 
 #include "int386.inc"
+#include "pxe.inc"
+#include "pnp.inc"
 #include "helpers.inc"
 
 .org (FREELDR_PE_BASE - FREELDR_BASE)

Added: trunk/reactos/boot/freeldr/freeldr/arch/realmode/pnp.inc
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/realmode/pnp.inc?rev=52292&view=auto
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/realmode/pnp.inc (added)
+++ trunk/reactos/boot/freeldr/freeldr/arch/realmode/pnp.inc [iso-8859-1] Fri 
Jun 17 08:36:49 2011
@@ -1,0 +1,58 @@
+
+
+PnpBiosGetDeviceNodeCount:
+
+       mov ax, word ptr [BSS_PnpBiosDataSegment]
+       push ax
+
+       push cs
+       mov ax, BSS_PnpNodeSize
+       push ax
+
+       push cs
+       mov ax, BSS_PnpNodeCount
+       push ax
+
+       push 0
+
+       call dword ptr [BSS_PnpBiosEntryPoint]
+       add sp, 12
+
+       movzx ecx, ax
+       mov dword ptr [BSS_PnpResult], ecx
+
+    ret
+
+
+PnpBiosGetDeviceNode:
+
+       /* push bios segment */
+       mov ax, word ptr [BSS_PnpBiosDataSegment]
+       push ax
+
+       /* push control flag */
+       push 1
+
+       /* push pointer to node buffer (segment/offset) */
+       mov ax, word ptr [BSS_PnpBiosBufferSegment]
+       push ax
+       mov ax, word ptr [BSS_PnpBiosBufferOffset]
+       push ax
+
+       /* push pointer to node number (segment/offset) */
+       push cs
+       mov ax, BSS_PnpNodeNumber
+       push ax
+
+       /* push function number */
+       push 1
+
+       /* call entry point */
+       call dword ptr [BSS_PnpBiosEntryPoint]
+       add sp, 14
+
+       movzx ecx, ax
+       mov [BSS_PnpResult], ecx
+
+    ret
+

Added: trunk/reactos/boot/freeldr/freeldr/arch/realmode/pxe.inc
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/realmode/pxe.inc?rev=52292&view=auto
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/realmode/pxe.inc (added)
+++ trunk/reactos/boot/freeldr/freeldr/arch/realmode/pxe.inc [iso-8859-1] Fri 
Jun 17 08:36:49 2011
@@ -1,0 +1,33 @@
+/*
+ *  FreeLoader
+ *  Copyright (C) 2011  Hervé Poussineau
+ *
+ *  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.
+ */
+
+
+PxeCallApi:
+
+       mov ax, [BSS_PxeBufferSegment]
+       push ax
+       mov ax, [BSS_PxeBufferOffset]
+       push ax
+       mov ax, [BSS_PxeFunction]
+       push ax
+       call dword ptr [BSS_PxeEntryPoint]
+       add esp, 6
+       mov [BSS_PxeResult], ax
+
+    ret

Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/hardware.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/include/arch/pc/hardware.h?rev=52292&r1=52291&r2=52292&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/pc/hardware.h [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/pc/hardware.h [iso-8859-1] 
Fri Jun 17 08:36:49 2011
@@ -71,15 +71,6 @@
 /* hwpci.c */
 VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber);
 
-/* i386cpu.S */
-ULONG CpuidSupported(VOID);
-VOID GetCpuid(ULONG Level,
-             ULONG *eax,
-             ULONG *ebx,
-             ULONG *ecx,
-             ULONG *edx);
-ULONGLONG RDTSC(VOID);
-
 /* i386pnp.S */
 ULONG_PTR PnpBiosSupported(VOID);
 ULONG PnpBiosGetDeviceNodeCount(ULONG *NodeSize,

Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h?rev=52292&r1=52291&r2=52292&view=diff
==============================================================================
--- 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] 
Fri Jun 17 08:36:49 2011
@@ -22,16 +22,24 @@
 #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_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_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_PnpBiosEntryPoint    (BSS_START + 76)
+#define BSS_PnpBiosDataSegment   (BSS_START + 80)
+#define BSS_PnpBiosBufferSegment (BSS_START + 84)
+#define BSS_PnpBiosBufferOffset  (BSS_START + 88)
+#define BSS_PnpNodeSize          (BSS_START + 92)
+#define BSS_PnpNodeCount         (BSS_START + 96)
+#define BSS_PnpNodeNumber        (BSS_START + 100)
+#define BSS_PnpResult            (BSS_START + 104)
 
 
 /* Realmode function IDs */
@@ -39,6 +47,8 @@
 #define FNID_SoftReboot 1
 #define FNID_ChainLoadBiosBootSectorCode 2
 #define FNID_PxeCallApi 3
+#define FNID_PnpBiosGetDeviceNodeCount 4
+#define FNID_PnpBiosGetDeviceNode 5
 
 /* Layout of the REGS structure */
 #define REGS_EAX 0


Reply via email to