[69300] | 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 | ;
|
---|
[38699] | 5 |
|
---|
[69300] | 6 | ;
|
---|
[98103] | 7 | ; Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[69300] | 8 | ;
|
---|
[96407] | 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
|
---|
[69498] | 26 | ; --------------------------------------------------------------------
|
---|
[38699] | 27 |
|
---|
| 28 |
|
---|
[42392] | 29 | ; Public symbols for debugging only
|
---|
| 30 | public pcibios32_entry
|
---|
| 31 | public bios32_service
|
---|
[38699] | 32 |
|
---|
[42392] | 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.
|
---|
[38699] | 36 |
|
---|
[42392] | 37 | _DATA segment public 'DATA'
|
---|
[38699] | 38 |
|
---|
| 39 | align 16
|
---|
[42392] | 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
|
---|
[38699] | 48 |
|
---|
[42392] | 49 | _DATA ends
|
---|
[38699] | 50 |
|
---|
[42392] | 51 | .386
|
---|
[38699] | 52 |
|
---|
[42392] | 53 | extrn _pci32_function:near
|
---|
[38699] | 54 |
|
---|
[42392] | 55 | BIOS32 segment public 'CODE' use32
|
---|
[38699] | 56 |
|
---|
[42392] | 57 | ;
|
---|
| 58 | ; The BIOS32 Service Directory - must be less than 4K in size (easy!).
|
---|
| 59 | ;
|
---|
| 60 | bios32_service proc far
|
---|
[42127] | 61 |
|
---|
[38699] | 62 | pushfd
|
---|
| 63 |
|
---|
[42392] | 64 | cmp bl, 0 ; Only function 0 supported
|
---|
| 65 | jnz b32_bad_func
|
---|
[38699] | 66 |
|
---|
[42392] | 67 | cmp eax, 'ICP$' ; "$PCI"
|
---|
| 68 | mov al, 80h ; Unknown service
|
---|
| 69 | jnz b32_done
|
---|
[38699] | 70 |
|
---|
[42392] | 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
|
---|
[38699] | 78 |
|
---|
[42392] | 79 | b32_bad_func:
|
---|
| 80 | mov al, 81h ; Unsupported function
|
---|
| 81 | jmp b32_done
|
---|
[38699] | 82 |
|
---|
[42392] | 83 | bios32_service endp
|
---|
[38699] | 84 |
|
---|
[42392] | 85 | ;
|
---|
| 86 | ; The 32-bit PCI BIOS entry point - simply calls into C code.
|
---|
| 87 | ;
|
---|
| 88 | pcibios32_entry proc far
|
---|
[38699] | 89 |
|
---|
[42392] | 90 | pushfd ; Preserve flags
|
---|
| 91 | cld ; Just in case...
|
---|
[38699] | 92 |
|
---|
[42392] | 93 | push es ; Call into C implementation
|
---|
| 94 | pushad
|
---|
| 95 | call _pci32_function
|
---|
| 96 | popad
|
---|
| 97 | pop es
|
---|
[38699] | 98 |
|
---|
[42392] | 99 | popfd ; Restore flags and return
|
---|
[38699] | 100 | retf
|
---|
| 101 |
|
---|
[42392] | 102 | pcibios32_entry endp
|
---|
[38699] | 103 |
|
---|
| 104 |
|
---|
| 105 | BIOS32 ends
|
---|
| 106 |
|
---|
| 107 | end
|
---|
[69300] | 108 |
|
---|