mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 15:52:57 +00:00
[FREELDR]
Fix build with good old rbuild svn path=/trunk/; revision=52293
This commit is contained in:
parent
2372dd2207
commit
cebb902036
3 changed files with 270 additions and 15 deletions
|
@ -13,11 +13,11 @@ if(ARCH MATCHES i386)
|
||||||
arch/i386/entry.S
|
arch/i386/entry.S
|
||||||
arch/i386/i386idt.c
|
arch/i386/i386idt.c
|
||||||
arch/i386/i386trap.S
|
arch/i386/i386trap.S
|
||||||
|
arch/i386/i386pnp.cmake.S
|
||||||
arch/i386/i386bug.c)
|
arch/i386/i386bug.c)
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
list(APPEND FREELDR_BASE64K_SOURCE
|
list(APPEND FREELDR_BASE64K_SOURCE
|
||||||
arch/i386/drvmap.S
|
arch/i386/drvmap.S
|
||||||
arch/i386/i386pnp.S
|
|
||||||
arch/i386/linux.S
|
arch/i386/linux.S
|
||||||
arch/i386/multiboot.S
|
arch/i386/multiboot.S
|
||||||
arch/i386/mb.S)
|
arch/i386/mb.S)
|
||||||
|
|
|
@ -28,6 +28,11 @@
|
||||||
*
|
*
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
*/
|
*/
|
||||||
|
_pnp_bios_entry_point:
|
||||||
|
.long 0
|
||||||
|
_pnp_bios_data_segment:
|
||||||
|
.word 0
|
||||||
|
|
||||||
PUBLIC _PnpBiosSupported
|
PUBLIC _PnpBiosSupported
|
||||||
_PnpBiosSupported:
|
_PnpBiosSupported:
|
||||||
|
|
||||||
|
@ -77,11 +82,11 @@ pnp_loop:
|
||||||
mov ax, [esi + 15]
|
mov ax, [esi + 15]
|
||||||
shl eax, 16
|
shl eax, 16
|
||||||
mov ax, [esi + 0x0D]
|
mov ax, [esi + 0x0D]
|
||||||
mov [BSS_PnpBiosEntryPoint], eax
|
mov _pnp_bios_entry_point, eax
|
||||||
|
|
||||||
/* Store bios data segment */
|
/* Store bios data segment */
|
||||||
mov ax, [esi + 0x1B]
|
mov ax, [esi + 0x1B]
|
||||||
mov word ptr ds:[BSS_PnpBiosDataSegment], ax
|
mov _pnp_bios_data_segment, ax
|
||||||
|
|
||||||
pnp_not_found:
|
pnp_not_found:
|
||||||
mov eax, edi
|
mov eax, edi
|
||||||
|
@ -99,6 +104,13 @@ pnp_not_found:
|
||||||
*
|
*
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
*/
|
*/
|
||||||
|
_pnp_result:
|
||||||
|
.long 0
|
||||||
|
_pnp_node_size:
|
||||||
|
.word 0
|
||||||
|
_pnp_node_count:
|
||||||
|
.word 0
|
||||||
|
|
||||||
PUBLIC _PnpBiosGetDeviceNodeCount
|
PUBLIC _PnpBiosGetDeviceNodeCount
|
||||||
_PnpBiosGetDeviceNodeCount:
|
_PnpBiosGetDeviceNodeCount:
|
||||||
|
|
||||||
|
@ -108,16 +120,39 @@ _PnpBiosGetDeviceNodeCount:
|
||||||
pusha
|
pusha
|
||||||
push es
|
push es
|
||||||
|
|
||||||
mov bx, FNID_PnpBiosGetDeviceNodeCount
|
call switch_to_real
|
||||||
call i386CallRealMode
|
.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 esi, [ebp + 8]
|
||||||
mov ax, [BSS_PnpNodeSize]
|
mov ax, _pnp_node_size
|
||||||
movzx ecx, ax
|
movzx ecx, ax
|
||||||
mov [esi], ecx
|
mov [esi], ecx
|
||||||
|
|
||||||
mov esi, [ebp + 12]
|
mov esi, [ebp + 12]
|
||||||
mov ax, [BSS_PnpNodeCount]
|
mov ax, _pnp_node_count
|
||||||
movzx ecx, ax
|
movzx ecx, ax
|
||||||
mov [esi], eax
|
mov [esi], eax
|
||||||
|
|
||||||
|
@ -127,7 +162,7 @@ _PnpBiosGetDeviceNodeCount:
|
||||||
mov esp, ebp
|
mov esp, ebp
|
||||||
pop ebp
|
pop ebp
|
||||||
|
|
||||||
mov eax, dword ptr [BSS_PnpResult]
|
mov eax, _pnp_result
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -137,6 +172,14 @@ _PnpBiosGetDeviceNodeCount:
|
||||||
*
|
*
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
*/
|
*/
|
||||||
|
_pnp_buffer_segment:
|
||||||
|
.word 0
|
||||||
|
_pnp_buffer_offset:
|
||||||
|
.word 0
|
||||||
|
|
||||||
|
_pnp_node_number:
|
||||||
|
.byte 0
|
||||||
|
|
||||||
EXTERN(_PnpBiosGetDeviceNode)
|
EXTERN(_PnpBiosGetDeviceNode)
|
||||||
.code32
|
.code32
|
||||||
|
|
||||||
|
@ -149,23 +192,54 @@ EXTERN(_PnpBiosGetDeviceNode)
|
||||||
/* get current node number */
|
/* get current node number */
|
||||||
mov esi, [ebp + 8]
|
mov esi, [ebp + 8]
|
||||||
mov al, [esi]
|
mov al, [esi]
|
||||||
mov [BSS_PnpNodeNumber], al
|
mov _pnp_node_number, al
|
||||||
|
|
||||||
/* convert pointer to node buffer to segment/offset */
|
/* convert pointer to node buffer to segment/offset */
|
||||||
mov eax, [ebp + 12]
|
mov eax, [ebp + 12]
|
||||||
shr eax, 4
|
shr eax, 4
|
||||||
and eax, 0xf000
|
and eax, 0xf000
|
||||||
mov word ptr [BSS_PnpBiosBufferSegment], ax
|
mov _pnp_buffer_segment, ax
|
||||||
mov eax, [ebp + 12]
|
mov eax, [ebp + 12]
|
||||||
and eax, 0xffff
|
and eax, 0xffff
|
||||||
mov [BSS_PnpBiosBufferOffset], ax
|
mov _pnp_buffer_offset, ax
|
||||||
|
|
||||||
mov bx, FNID_PnpBiosGetDeviceNode
|
call switch_to_real
|
||||||
call i386CallRealMode
|
.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 */
|
/* update node number */
|
||||||
mov esi, [ebp + 8]
|
mov esi, [ebp + 8]
|
||||||
mov al, [BSS_PnpNodeNumber]
|
mov al, _pnp_node_number
|
||||||
mov [esi], al
|
mov [esi], al
|
||||||
|
|
||||||
pop es
|
pop es
|
||||||
|
@ -174,7 +248,7 @@ EXTERN(_PnpBiosGetDeviceNode)
|
||||||
mov esp, ebp
|
mov esp, ebp
|
||||||
pop ebp
|
pop ebp
|
||||||
|
|
||||||
mov eax, [BSS_PnpResult]
|
mov eax, _pnp_result
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
181
reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S
Normal file
181
reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S
Normal file
|
@ -0,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 */
|
Loading…
Add table
Add a link
Reference in a new issue