Author: tkreuzer
Date: Fri Jun 17 08:49:22 2011
New Revision: 52293

URL: http://svn.reactos.org/svn/reactos?rev=52293&view=rev
Log:
[FREELDR]
Fix build with good old rbuild

Added:
    trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S   (with props)
Modified:
    trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt
    trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S

Modified: trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt?rev=52293&r1=52292&r2=52293&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] Fri Jun 17 
08:49:22 2011
@@ -13,11 +13,11 @@
         arch/i386/entry.S
         arch/i386/i386idt.c
         arch/i386/i386trap.S
+        arch/i386/i386pnp.cmake.S
         arch/i386/i386bug.c)
     if(NOT MSVC)
         list(APPEND FREELDR_BASE64K_SOURCE
             arch/i386/drvmap.S
-            arch/i386/i386pnp.S
             arch/i386/linux.S
             arch/i386/multiboot.S
             arch/i386/mb.S)

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=52293&r1=52292&r2=52293&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:49:22 2011
@@ -28,6 +28,11 @@
  *
  * RETURNS:
  */
+_pnp_bios_entry_point:
+       .long   0
+_pnp_bios_data_segment:
+       .word   0
+
 PUBLIC _PnpBiosSupported
 _PnpBiosSupported:
 
@@ -77,11 +82,11 @@
        mov ax, [esi + 15]
        shl eax, 16
        mov ax, [esi + 0x0D]
-       mov [BSS_PnpBiosEntryPoint], eax
+       mov _pnp_bios_entry_point, eax
 
        /* Store bios data segment */
        mov ax, [esi + 0x1B]
-       mov word ptr ds:[BSS_PnpBiosDataSegment], ax
+       mov _pnp_bios_data_segment, ax
 
 pnp_not_found:
        mov eax, edi
@@ -99,6 +104,13 @@
  *
  * RETURNS:
  */
+_pnp_result:
+       .long   0
+_pnp_node_size:
+       .word   0
+_pnp_node_count:
+       .word   0
+
 PUBLIC _PnpBiosGetDeviceNodeCount
 _PnpBiosGetDeviceNodeCount:
 
@@ -108,16 +120,39 @@
        pusha
        push es
 
-    mov bx, FNID_PnpBiosGetDeviceNodeCount
-    call i386CallRealMode
+       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 esi, [ebp + 8]
-       mov ax, [BSS_PnpNodeSize]
+       mov ax, _pnp_node_size
        movzx ecx, ax
        mov [esi], ecx
 
        mov esi, [ebp + 12]
-       mov ax, [BSS_PnpNodeCount]
+       mov ax, _pnp_node_count
        movzx ecx, ax
        mov [esi], eax
 
@@ -127,7 +162,7 @@
        mov esp, ebp
        pop ebp
 
-       mov eax, dword ptr [BSS_PnpResult]
+       mov eax, _pnp_result
 
        ret
 
@@ -137,6 +172,14 @@
  *
  * RETURNS:
  */
+_pnp_buffer_segment:
+       .word   0
+_pnp_buffer_offset:
+       .word   0
+
+_pnp_node_number:
+       .byte   0
+
 EXTERN(_PnpBiosGetDeviceNode)
        .code32
 
@@ -149,23 +192,54 @@
        /* get current node number */
        mov esi, [ebp + 8]
        mov al, [esi]
-       mov [BSS_PnpNodeNumber], al
+       mov _pnp_node_number, al
 
        /* convert pointer to node buffer to segment/offset */
        mov eax, [ebp + 12]
        shr eax, 4
        and eax, 0xf000
-       mov word ptr [BSS_PnpBiosBufferSegment], ax
+       mov _pnp_buffer_segment, ax
        mov eax, [ebp + 12]
        and eax, 0xffff
-       mov [BSS_PnpBiosBufferOffset], ax
-
-    mov bx, FNID_PnpBiosGetDeviceNode
-    call i386CallRealMode
+       mov _pnp_buffer_offset, 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
 
        /* update node number */
        mov esi, [ebp + 8]
-       mov al, [BSS_PnpNodeNumber]
+       mov al, _pnp_node_number
        mov [esi], al
 
        pop es
@@ -174,7 +248,7 @@
        mov esp, ebp
        pop ebp
 
-       mov eax, [BSS_PnpResult]
+       mov eax, _pnp_result
 
        ret
 

Added: trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S?rev=52293&view=auto
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S (added)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S [iso-8859-1] 
Fri Jun 17 08:49:22 2011
@@ -1,0 +1,181 @@
+/*
+ *  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>
+
+.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 + 15]
+       shl eax, 16
+       mov ax, [esi + 0x0D]
+       mov [BSS_PnpBiosEntryPoint], eax
+
+       /* Store bios data segment */
+       mov ax, [esi + 0x1B]
+       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], eax
+
+       pop es
+       popa
+
+       mov esp, ebp
+       pop ebp
+
+       mov eax, dword ptr [BSS_PnpResult]
+
+       ret
+
+
+/*
+ * U32 PnpBiosGetDeviceNode(U8 *NodeId, U8 *NodeBuffer);
+ *
+ * RETURNS:
+ */
+EXTERN(_PnpBiosGetDeviceNode)
+       .code32
+
+       push ebp
+       mov ebp, esp
+
+       pusha
+       push es
+
+       /* get current node number */
+       mov esi, [ebp + 8]
+       mov al, [esi]
+       mov [BSS_PnpNodeNumber], al
+
+       /* convert pointer to node buffer to segment/offset */
+       mov eax, [ebp + 12]
+       shr eax, 4
+       and eax, 0xf000
+       mov word ptr [BSS_PnpBiosBufferSegment], ax
+       mov eax, [ebp + 12]
+       and eax, 0xffff
+       mov [BSS_PnpBiosBufferOffset], ax
+
+    mov bx, FNID_PnpBiosGetDeviceNode
+    call i386CallRealMode
+
+       /* update node number */
+       mov esi, [ebp + 8]
+       mov al, [BSS_PnpNodeNumber]
+       mov [esi], al
+
+       pop es
+       popa
+
+       mov esp, ebp
+       pop ebp
+
+       mov eax, [BSS_PnpResult]
+
+       ret
+
+/* EOF */

Propchange: trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to