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