summaryrefslogtreecommitdiffstats
path: root/src/VBox/ValidationKit/bootsectors/bootsector2-common-traprec-template.mac
blob: 2c16f780480c845cef990d42e52f1d9e7bedbdfb (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
; $Id: bootsector2-common-traprec-template.mac $
;; @file
; Boot sector 2 - Trap Records, Code Template.
;

;
; 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
;

%include "bootsector2-template-header.mac"


;;
; Internal worker for reporting a missing trap
;
; The callee cleans up the arguments on the stack.
;
; @param    [xBP + xCB*2]   bExpected   Expected exception number.
; @param    [xBP + xCB*2+1] szExpected  The name of the exception (2 bytes + terminator).
; @uses     None
;
BEGINPROC TMPL_NM_CMN(TestFailedMissingTrapInternal)
        push    xBP
        mov     xBP, xSP
        pushf
        push    sAX

        movzx   eax, byte [xBP + xCB*2]
        push    xAX
        lea     sAX, [sBP + xCB*2+1]
%ifdef TMPL_16BIT
        push    ss
%endif
        push    xAX
%ifdef TMPL_16BIT
        push    cs
%endif
        push    .szFmt
        call    TMPL_NM_CMN(TestFailedF)
%ifdef TMPL_16BIT
        add     xSP, xCB*5
%else
        add     xSP, xCB*3
%endif

        pop     sAX
        popf
        leave
        ret     sCB
.szFmt: db 'Missing trap #%s (%RX8)', 13, 10, 0
ENDPROC   TMPL_NM_CMN(TestFailedMissingTrapInternal)

%ifndef TestFailedMissingTrapTemplate_defined
 ;;
 ; Internal template.
 %macro TestFailedMissingTrapTemplate 4
   BEGINPROC TMPL_NM_CMN(TestFailedMissingTrap_%1)
       push    dword RT_MAKE_U32_FROM_U8(%1, %2, %3, %4)
       call    TMPL_NM_CMN(TestFailedMissingTrapInternal)
       ret
   ENDPROC   TMPL_NM_CMN(TestFailedMissingTrap_%1)
 %endmacro
 %define TestFailedMissingTrapTemplate_defined
%endif

TestFailedMissingTrapTemplate X86_XCPT_DE,  'D', 'E', 0
TestFailedMissingTrapTemplate X86_XCPT_DB,  'D', 'B', 0
TestFailedMissingTrapTemplate X86_XCPT_NMI, 'N', 'M', 0
TestFailedMissingTrapTemplate X86_XCPT_BP,  'B', 'P', 0
TestFailedMissingTrapTemplate X86_XCPT_OF,  'O', 'F', 0
TestFailedMissingTrapTemplate X86_XCPT_BR,  'B', 'R', 0
TestFailedMissingTrapTemplate X86_XCPT_UD,  'U', 'D', 0
TestFailedMissingTrapTemplate X86_XCPT_NM,  'N', 'M', 0
;TestFailedMissingTrapTemplate X86_XCPT_DF,  'D', 'F', 0
;TestFailedMissingTrapTemplate X86_XCPT_CO_SEG_OVERRUN, 'C', 'O', 0
TestFailedMissingTrapTemplate X86_XCPT_TS,  'T', 'S', 0
TestFailedMissingTrapTemplate X86_XCPT_NP,  'N', 'P', 0
TestFailedMissingTrapTemplate X86_XCPT_SS,  'S', 'S', 0
TestFailedMissingTrapTemplate X86_XCPT_GP,  'G', 'P', 0
TestFailedMissingTrapTemplate X86_XCPT_PF,  'P', 'F', 0
TestFailedMissingTrapTemplate X86_XCPT_MF,  'M', 'F', 0
TestFailedMissingTrapTemplate X86_XCPT_AC,  'A', 'C', 0
;TestFailedMissingTrapTemplate X86_XCPT_MC,  'M', 'C', 0
TestFailedMissingTrapTemplate X86_XCPT_XF,  'X', 'F', 0


%include "bootsector2-template-footer.mac"