1 | /* $Id: PGMPhysRWTmpl.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * PGM - Page Manager and Monitor, Physical Memory Access Template.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2022 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 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Read physical memory. (one byte/word/dword)
|
---|
31 | *
|
---|
32 | * This API respects access handlers and MMIO. Use PGMPhysSimpleReadGCPhys() if you
|
---|
33 | * want to ignore those.
|
---|
34 | *
|
---|
35 | * @param pVM The cross context VM structure.
|
---|
36 | * @param GCPhys Physical address start reading from.
|
---|
37 | * @param enmOrigin Who is calling.
|
---|
38 | */
|
---|
39 | VMMDECL(PGMPHYS_DATATYPE) PGMPHYSFN_READNAME(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin)
|
---|
40 | {
|
---|
41 | Assert(VM_IS_EMT(pVM));
|
---|
42 | PGMPHYS_DATATYPE val;
|
---|
43 | VBOXSTRICTRC rcStrict = PGMPhysRead(pVM, GCPhys, &val, sizeof(val), enmOrigin);
|
---|
44 | AssertMsg(rcStrict == VINF_SUCCESS, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); NOREF(rcStrict);
|
---|
45 | return val;
|
---|
46 | }
|
---|
47 |
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Write to physical memory. (one byte/word/dword)
|
---|
51 | *
|
---|
52 | * This API respects access handlers and MMIO. Use PGMPhysSimpleReadGCPhys() if you
|
---|
53 | * want to ignore those.
|
---|
54 | *
|
---|
55 | * @param pVM The cross context VM structure.
|
---|
56 | * @param GCPhys Physical address to write to.
|
---|
57 | * @param val What to write.
|
---|
58 | * @param enmOrigin Who is calling.
|
---|
59 | */
|
---|
60 | VMMDECL(void) PGMPHYSFN_WRITENAME(PVM pVM, RTGCPHYS GCPhys, PGMPHYS_DATATYPE val, PGMACCESSORIGIN enmOrigin)
|
---|
61 | {
|
---|
62 | Assert(VM_IS_EMT(pVM));
|
---|
63 | VBOXSTRICTRC rcStrict = PGMPhysWrite(pVM, GCPhys, &val, sizeof(val), enmOrigin);
|
---|
64 | AssertMsg(rcStrict == VINF_SUCCESS, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); NOREF(rcStrict);
|
---|
65 | }
|
---|
66 |
|
---|
67 | #undef PGMPHYSFN_READNAME
|
---|
68 | #undef PGMPHYSFN_WRITENAME
|
---|
69 | #undef PGMPHYS_DATATYPE
|
---|
70 | #undef PGMPHYS_DATASIZE
|
---|
71 |
|
---|