1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
; $Id: pcibio32.asm $
;; @file
; BIOS32 service directory and 32-bit PCI BIOS entry point
;
;
; Copyright (C) 2006-2023 Oracle and/or its affiliates.
;
; This file is part of VirtualBox base platform packages, as
; available from https://www.virtualbox.org.
;
; 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, in version 3 of the
; License.
;
; 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, see <https://www.gnu.org/licenses>.
;
; SPDX-License-Identifier: GPL-3.0-only
; --------------------------------------------------------------------
; Public symbols for debugging only
public pcibios32_entry
public bios32_service
; The BIOS32 service directory header must be located in the E0000h-FFFF0h
; range on a paragraph boundary. Note that the actual 32-bit code need not
; be located below 1MB at all.
_DATA segment public 'DATA'
align 16
bios32_directory:
db '_32_' ; ASCII signature
dw bios32_service ; Entry point address...
dw 000Fh ; ...hardcoded to F000 segment
db 0 ; Revision
db 1 ; Length in paras - must be 1
db 0 ; Checksum calculated later
db 5 dup(0) ; Unused, must be zero
_DATA ends
.386
extrn _pci32_function:near
BIOS32 segment public 'CODE' use32
;
; The BIOS32 Service Directory - must be less than 4K in size (easy!).
;
bios32_service proc far
pushfd
cmp bl, 0 ; Only function 0 supported
jnz b32_bad_func
cmp eax, 'ICP$' ; "$PCI"
mov al, 80h ; Unknown service
jnz b32_done
mov ebx, 000f0000h ; Base address (linear)
mov ecx, 0f000h ; Length of service
mov edx, pcibios32_entry ; Entry point offset from base
xor al, al ; Indicate success
b32_done:
popfd
retf
b32_bad_func:
mov al, 81h ; Unsupported function
jmp b32_done
bios32_service endp
;
; The 32-bit PCI BIOS entry point - simply calls into C code.
;
pcibios32_entry proc far
pushfd ; Preserve flags
cld ; Just in case...
push es ; Call into C implementation
pushad
call _pci32_function
popad
pop es
popfd ; Restore flags and return
retf
pcibios32_entry endp
BIOS32 ends
end
|