VirtualBox

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

Last change on this file since 5999 was 5999, checked in by vboxsync, 17 years ago

The Giant CDDL Dual-License Header Change.

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