VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/utils/cpu/exceptionsR3-asm.asm@ 98103

Last change on this file since 98103 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1; $Id: exceptionsR3-asm.asm 98103 2023-01-17 14:15:46Z vboxsync $
2;; @file
3; exceptionsR3-asm.asm - assembly helpers.
4;
5
6;
7; Copyright (C) 2009-2023 Oracle and/or its affiliates.
8;
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; The contents of this file may alternatively be used under the terms
26; of the Common Development and Distribution License Version 1.0
27; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28; in the VirtualBox distribution, in which case the provisions of the
29; CDDL are applicable instead of those of the GPL.
30;
31; You may elect to license modified versions of this file under the
32; terms and conditions of either the GPL or the CDDL or both.
33;
34; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35;
36
37
38;*******************************************************************************
39;* Header Files *
40;*******************************************************************************
41%include "iprt/asmdefs.mac"
42
43
44;*******************************************************************************
45;* Defined Constants And Macros *
46;*******************************************************************************
47%ifdef RT_ARCH_AMD64
48 %define TST_XCPT_MAGIC 0123456789abcdef0h
49%else
50 %define TST_XCPT_MAGIC 012345678h
51%endif
52
53%macro tstXcptAsmProlog 0
54 push xBP
55 push xDI
56 push xSI
57 push xBX
58 %ifdef RT_ARCH_X86
59 push gs
60 push fs
61 push es
62 push ds
63 %endif
64 %ifdef RT_ARCH_AMD64
65 push r10
66 push r11
67 push r12
68 push r13
69 push r14
70 push r15
71 %endif
72
73 mov xAX, TST_XCPT_MAGIC
74 mov xBX, xAX
75 mov xCX, xAX
76 mov xDX, xAX
77 mov xDI, xAX
78 mov xSI, xAX
79 mov xBP, xAX
80 %ifdef RT_ARCH_AMD64
81 mov r8, xAX
82 mov r9, xAX
83 mov r10, xAX
84 mov r11, xAX
85 mov r12, xAX
86 mov r13, xAX
87 mov r14, xAX
88 mov r15, xAX
89 %endif
90%endmacro
91
92%macro tstXcptAsmEpilog 0
93 %ifdef RT_ARCH_AMD64
94 pop r15
95 pop r14
96 pop r13
97 pop r12
98 pop r11
99 pop r10
100 %endif
101 %ifdef RT_ARCH_X86
102 pop ds
103 pop es
104 pop fs
105 pop gs
106 %endif
107 pop xBX
108 pop xSI
109 pop xDI
110 pop xBP
111%endmacro
112
113
114BEGINCODE
115
116;;
117BEGINPROC tstXcptAsmNullPtrRead
118; tstXcptAsmProlog
119 xor eax, eax
120GLOBALNAME tstXcptAsmNullPtrRead_PC
121 mov al, [xAX]
122; tstXcptAsmEpilog
123 ret
124ENDPROC tstXcptAsmNullPtrRead
125
126
127;;
128BEGINPROC tstXcptAsmNullPtrWrite
129 tstXcptAsmProlog
130 xor eax, eax
131GLOBALNAME tstXcptAsmNullPtrWrite_PC
132 mov [xAX], al
133 tstXcptAsmEpilog
134 ret
135ENDPROC tstXcptAsmNullPtrWrite
136
137
138;;
139BEGINPROC tstXcptAsmSysCall
140 tstXcptAsmProlog
141GLOBALNAME tstXcptAsmSysCall_PC
142 syscall
143 tstXcptAsmEpilog
144 ret
145ENDPROC tstXcptAsmSysCall
146
147
148;;
149BEGINPROC tstXcptAsmSysEnter
150 tstXcptAsmProlog
151GLOBALNAME tstXcptAsmSysEnter_PC
152%ifdef RT_ARCH_AMD64
153 db 00fh, 034h ; test this on 64-bit, yasm complains...
154%else
155 sysenter
156%endif
157 tstXcptAsmEpilog
158 ret
159ENDPROC tstXcptAsmSysEnter
160
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette