VirtualBox

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

Last change on this file since 26944 was 24680, checked in by vboxsync, 15 years ago

VMMGC.mac: Use new section definition form on darwin and ditch the 50 warnings we get about redefinining section flags.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1; $Id: VMMGC.mac 24680 2009-11-15 17:21:42Z vboxsync $
2;; @file
3; VMMGC - Raw-mode Context Assembly Macros.
4;
5
6;
7; Copyright (C) 2006-2007 Sun Microsystems, Inc.
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; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18; Clara, CA 95054 USA or visit http://www.sun.com if you need
19; additional information or have any questions.
20;
21
22%ifndef __VMMGC_mac__
23%define __VMMGC_mac__
24
25%include "VBox/asmdefs.mac"
26
27
28;; @def VMMR0_SEG
29; Set the output segment to one of the special VMMR0 segments.
30; @param %1 The segment name.
31; @remark Use BEGINCODE to switch back to the code segment.
32%ifdef ASM_FORMAT_OMF
33 %macro VMMR0_SEG 1
34 segment VMMR0.%1 public CLASS=CONST align=1 use32
35 %endmacro
36 %define VMMR0_SEG_DEFINED
37%endif
38
39%ifdef ASM_FORMAT_ELF
40 %macro VMMR0_SEG 1
41 %ifndef DEFINED_VMMR0_SEG.%1
42 %define DEFINED_VMMR0_SEG.%1 1
43 [section .VMMR0.%1 progbits alloc noexec nowrite align=1 ]
44 %else
45 [section .VMMR0.%1 align=1 ]
46 %endif
47 %endmacro
48 %define VMMR0_SEG_DEFINED
49%endif
50
51%ifdef ASM_FORMAT_MACHO
52 %ifdef __YASM__
53 %macro VMMR0_SEG 1
54 %ifndef DEFINED_VMMR0_SEG.%1
55 %define DEFINED_VMMR0_SEG.%1 1
56 [section VMMR0 %1 align=1 ]
57 %else
58 [section VMMR0 %1 ]
59 %endif
60 %endmacro
61 %else
62 %macro VMMR0_SEG 1
63 [section VMMR0.%1 rdata align=1 ]
64 %endmacro
65 %endif
66 %define VMMR0_SEG_DEFINED
67%endif
68
69%ifdef ASM_FORMAT_PE
70 %macro VMMR0_SEG 1
71 [section .rdata$VMMR0.%1 align=1 ]
72 %endmacro
73 %define VMMR0_SEG_DEFINED
74%endif
75
76%ifndef VMMR0_SEG_DEFINED
77 %error "VMMR0_SEG / ASM_FORMAT_xxx"
78%endif
79
80
81;; @def TRPM_HANDLER
82; Sets up a trap handler.
83;
84; @param %1 The segment name.
85; @param %2 The end address. Use 0 to just handle one instruction.
86; @param %3 Address of the handler function.
87; @param %4 The user data member.
88%macro TRPM_HANDLER 4
89
90VMMR0_SEG %1 ; switch to the record segemnt.
91
92 dd %%current_instr ; uStartEip
93 dd %2 ; uEndEip
94 dd %3 ; pfnHandler
95 dd %4 ; pvUser
96
97BEGINCODE ; back to the code segment.
98%%current_instr:
99
100%endmacro
101
102;; @def TRPM_NP_HANDLER
103; Sets up a segment not present fault handler for the current (=next) instruction.
104;
105; @param %1 Address of the handler function.
106; @param %2 The user data member.
107%macro TRPM_NP_HANDLER 2
108TRPM_HANDLER Trap0b, 0, %1, %2
109%endmacro
110
111
112;; @def TRPM_GP_HANDLER
113; Sets up a general protection fault handler for the current (=next) instruction.
114;
115; @param %1 Address of the handler function.
116; @param %2 The user data member.
117%macro TRPM_GP_HANDLER 2
118TRPM_HANDLER Trap0d, 0, %1, %2
119%endmacro
120
121
122;; @def TRPM_PF_HANDLER
123; Sets up a page fault handler for the current (=next) instruction.
124;
125; @param %1 Address of the handler function.
126; @param %2 The user data member.
127%macro TRPM_PF_HANDLER 2
128TRPM_HANDLER Trap0e, 0, %1, %2
129%endmacro
130
131
132;; @def TRPM_NP_GP_HANDLER
133; Sets up a segment not present fault and genernal protection fault handler
134; for the current (=next) instruction.
135;
136; @param %1 Address of the handler function.
137; @param %2 The user data member.
138%macro TRPM_NP_GP_HANDLER 2
139TRPM_HANDLER Trap0b, 0, %1, %2
140TRPM_HANDLER Trap0d, 0, %1, %2
141%endmacro
142
143
144%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