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