summaryrefslogtreecommitdiffstats
path: root/src/VBox/ValidationKit/bootsectors/bootsector2-api.mac
blob: d744439137621c97e8801d33c8ea008b11f62119 (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
; $Id: bootsector2-api.mac $
;; @file
; Bootsector2 API definition for use by split images (kernel < 1MB < image).
;

;
; Copyright (C) 2007-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>.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
; in the VirtualBox distribution, in which case the provisions of the
; CDDL are applicable instead of those of the GPL.
;
; You may elect to license modified versions of this file under the
; terms and conditions of either the GPL or the CDDL or both.
;
; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
;

%ifndef ___bootsector2_api_mac
%define ___bootsector2_api_mac

;*******************************************************************************
;*      Header Files                                                           *
;*******************************************************************************
%include "iprt/asmdefs.mac"
%include "iprt/x86.mac"
%include "bootsector2-structures.mac"

;;
; The load address for big images.
%define BS2_BIG_LOAD_ADDR       0x120000


;;
; API Template for lazy birds.
;
%macro BS2_API_TEMPLATE 0,

 BS2_API_TEMPLATE_ACTION(Bs2DisableA20)
 BS2_API_TEMPLATE_ACTION(Bs2DisableA20ViaKbd)
 BS2_API_TEMPLATE_ACTION(Bs2DisableA20ViaPortA)
 BS2_API_TEMPLATE_ACTION(Bs2DisableNX)
 BS2_API_TEMPLATE_ACTION(Bs2EnableA20)
 BS2_API_TEMPLATE_ACTION(Bs2EnableA20ViaKbd)
 BS2_API_TEMPLATE_ACTION(Bs2EnableA20ViaPortA)
 BS2_API_TEMPLATE_ACTION(Bs2EnableNX)
 BS2_API_TEMPLATE_ACTION(Bs2IsNXSupported)
 BS2_API_TEMPLATE_ACTION(Bs2KbdRead)
 BS2_API_TEMPLATE_ACTION(Bs2KbdWait)
 BS2_API_TEMPLATE_ACTION(Bs2KbdWrite)
 BS2_API_TEMPLATE_ACTION(Bs2PanicIfVMMDevTestingIsMissing)
 BS2_API_TEMPLATE_ACTION(Bs2SetupNX)
 BS2_API_TEMPLATE_ACTION(CalcBenchmarkIterations)
 BS2_API_TEMPLATE_ACTION(CalcTestPerSecond)
 BS2_API_TEMPLATE_ACTION(GetElapsedNanoTS)
 BS2_API_TEMPLATE_ACTION(GetNanoTS)
 BS2_API_TEMPLATE_ACTION(PrintChr)
 BS2_API_TEMPLATE_ACTION(PrintF)
 BS2_API_TEMPLATE_ACTION(PrintStr)
 BS2_API_TEMPLATE_ACTION(PrintStrColonSpaces)
 BS2_API_TEMPLATE_ACTION(PrintStrSpacesColonSpace)
 BS2_API_TEMPLATE_ACTION(PrintU32)
 BS2_API_TEMPLATE_ACTION(ReportResult)
 BS2_API_TEMPLATE_ACTION(Shutdown)
 BS2_API_TEMPLATE_ACTION(StrFormatF)
 BS2_API_TEMPLATE_ACTION(StrFormatV)
 BS2_API_TEMPLATE_ACTION(StrLen)
 BS2_API_TEMPLATE_ACTION(TestCheckTrap)
 BS2_API_TEMPLATE_ACTION(TestDumpCurrentRegisters)
 BS2_API_TEMPLATE_ACTION(TestDumpRegisters)
 BS2_API_TEMPLATE_ACTION(TestFailed)
 BS2_API_TEMPLATE_ACTION(TestFailedF)
 BS2_API_TEMPLATE_ACTION(TestInit)
 BS2_API_TEMPLATE_ACTION(TestRestoreRegisters)
 BS2_API_TEMPLATE_ACTION(TestSaveRegisters)
 BS2_API_TEMPLATE_ACTION(testSendStrCmd)
 BS2_API_TEMPLATE_ACTION(TestSkipped)
 BS2_API_TEMPLATE_ACTION(TestSub)
 BS2_API_TEMPLATE_ACTION(testSubCleanup)
 BS2_API_TEMPLATE_ACTION(TestSubDone)
 BS2_API_TEMPLATE_ACTION(TestSubErrorCount)
 BS2_API_TEMPLATE_ACTION(TestTerm)
 BS2_API_TEMPLATE_ACTION(TestValueReg)
 BS2_API_TEMPLATE_ACTION(TestValueU32)
 BS2_API_TEMPLATE_ACTION(TestInstallTrapRecs)

%endmacro


;;
; This defines the API pointers.
;
ABSOLUTE 0x500
;; Start the structure with a magic number.
NAME(g_u32Bs2ApiMagic):    resd 1
;; And a version number.
NAME(g_u32Bs2ApiVersion):  resd 1

; The real mode and v8086 mode entry points (far pointers).
%undef BS2_API_TEMPLATE_ACTION
%define BS2_API_TEMPLATE_ACTION(a_Name) NAME(g_pfn %+ a_Name %+ _r86): resd 1
BS2_API_TEMPLATE

; The 16-bit protected mode entry points (far pointers).
%undef BS2_API_TEMPLATE_ACTION
%define BS2_API_TEMPLATE_ACTION(a_Name) NAME(g_pfn %+ a_Name %+ _p16): resd 1
BS2_API_TEMPLATE

; The 32-bit protected mode entry points (flat pointers).
%undef BS2_API_TEMPLATE_ACTION
%define BS2_API_TEMPLATE_ACTION(a_Name) NAME(g_pfn %+ a_Name %+ _p32): resd 1
BS2_API_TEMPLATE

; The 64-bit protected (long) mode entry points.
%undef BS2_API_TEMPLATE_ACTION
%define BS2_API_TEMPLATE_ACTION(a_Name) NAME(g_pfn %+ a_Name %+ _p64): resq 1
BS2_API_TEMPLATE

;; End the structure with a magic so it's integrity can be verified.
NAME(g_u32Bs2ApiEndMagic) resd 1

;;
; The current API magic value (Douglas Carl Engelbart).
%define BS2_API_MAGIC       0x19250130

;;
; The current API version.
%define BS2_API_VERSION     0x00010000

BEGINCODE


;; @name Service trap vector interface.
; @{
%define BS2_SYSCALL_TO_RING0        0
%define BS2_SYSCALL_TO_RING1        1
%define BS2_SYSCALL_TO_RING2        2
%define BS2_SYSCALL_TO_RING3        3

;; The service vector.
%define BS2_TRAP_SYSCALL            20h
;; @}

%endif