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