VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMGC/VMMGC.mac@ 1

Last change on this file since 1 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1;; @file
2;
3; VMMGC - Guest Context Assembly Macros.
4
5; Copyright (C) 2006 InnoTek Systemberatung GmbH
6;
7; This file is part of VirtualBox Open Source Edition (OSE), as
8; available from http://www.virtualbox.org. This file is free software;
9; you can redistribute it and/or modify it under the terms of the GNU
10; General Public License as published by the Free Software Foundation,
11; in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
12; distribution. VirtualBox OSE is distributed in the hope that it will
13; be useful, but WITHOUT ANY WARRANTY of any kind.
14;
15; If you received this file as part of a commercial VirtualBox
16; distribution, then only the terms of your commercial VirtualBox
17; license agreement apply instead of the previous paragraph.
18
19%ifndef __VMMGC_mac__
20%define __VMMGC_mac__
21
22%include "VBox/nasm.mac"
23
24
25;; @def VMMR0_SEG
26; Set the output segment to one of the special VMMR0 segments.
27; @param %1 The segment name.
28; @remark Use BEGINCODE to switch back to the code segment.
29%ifdef ASM_FORMAT_OMF
30 %macro VMMR0_SEG 1
31 segment VMMR0.%1 public CLASS=CONST align=1 use32
32 %endmacro
33 %define VMMR0_SEG_DEFINED
34%endif
35
36%ifdef ASM_FORMAT_ELF
37 %macro VMMR0_SEG 1
38 [section .VMMR0.%1 progbits alloc noexec nowrite align=1 ]
39 %endmacro
40 %define VMMR0_SEG_DEFINED
41%endif
42
43%ifdef ASM_FORMAT_MACHO
44 %macro VMMR0_SEG 1
45 [section VMMR0.%1 rdata align=1 ]
46 %endmacro
47 %define VMMR0_SEG_DEFINED
48%endif
49
50%ifdef ASM_FORMAT_PE
51 %macro VMMR0_SEG 1
52 [section .VMMR0.%1 rdata align=1 ]
53 %endmacro
54 %define VMMR0_SEG_DEFINED
55%endif
56
57%ifndef VMMR0_SEG_DEFINED
58 %error "VMMR0_SEG / ASM_FORMAT_xxx"
59%endif
60
61
62;; @def TRPM_HANDLER
63; Sets up a trap handler.
64;
65; @param %1 The segment name.
66; @param %2 The end address. Use 0 to just handle one instruction.
67; @param %3 Address of the handler function.
68; @param %4 The user data member.
69%macro TRPM_HANDLER 4
70
71VMMR0_SEG %1 ; switch to the record segemnt.
72
73 dd %%current_instr ; uStartEip
74 dd %2 ; uEndEip
75 dd %3 ; pfnHandler
76 dd %4 ; pvUser
77
78BEGINCODE ; back to the code segment.
79%%current_instr:
80
81%endmacro
82
83;; @def TRPM_NP_HANDLER
84; Sets up a segment not present fault handler for the current (=next) instruction.
85;
86; @param %1 Address of the handler function.
87; @param %2 The user data member.
88%macro TRPM_NP_HANDLER 2
89TRPM_HANDLER Trap0b, 0, %1, %2
90%endmacro
91
92
93;; @def TRPM_GP_HANDLER
94; Sets up a general protection fault handler for the current (=next) instruction.
95;
96; @param %1 Address of the handler function.
97; @param %2 The user data member.
98%macro TRPM_GP_HANDLER 2
99TRPM_HANDLER Trap0d, 0, %1, %2
100%endmacro
101
102
103;; @def TRPM_PF_HANDLER
104; Sets up a page fault handler for the current (=next) instruction.
105;
106; @param %1 Address of the handler function.
107; @param %2 The user data member.
108%macro TRPM_PF_HANDLER 2
109TRPM_HANDLER Trap0e, 0, %1, %2
110%endmacro
111
112
113;; @def TRPM_NP_GP_HANDLER
114; Sets up a segment not present fault and genernal protection fault handler
115; for the current (=next) instruction.
116;
117; @param %1 Address of the handler function.
118; @param %2 The user data member.
119%macro TRPM_NP_GP_HANDLER 2
120TRPM_HANDLER Trap0b, 0, %1, %2
121TRPM_HANDLER Trap0d, 0, %1, %2
122%endmacro
123
124
125%endif
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