VirtualBox

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

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

Biggest check-in ever. New source code headers for all (C) innotek files.

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