Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: mem.h | |
5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | * | |
8 | * The above named program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public | |
10 | * License version 2 as published by the Free Software Foundation. | |
11 | * | |
12 | * The above named program is distributed in the hope that it will be | |
13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public | |
18 | * License along with this work; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | * | |
21 | * ========== Copyright Header End ============================================ | |
22 | */ | |
23 | /* | |
24 | * Copyright (C) 1991-2005 Sun Microsystems, Inc. | |
25 | * All rights reserved. | |
26 | */ | |
27 | ||
28 | #include "Memory.h" | |
29 | ||
30 | #ifndef __MEM_H__ | |
31 | #define __MEM_H__ | |
32 | ||
33 | #pragma ident "@(#)1.20 07/06/22 mem.h" | |
34 | ||
35 | // old fashion mem methods; | |
36 | // newer methods from Memory.h where possible should be used instead | |
37 | ||
38 | ||
39 | typedef SMemory memT; | |
40 | ||
41 | // a global pointer to mem object, one for the system | |
42 | extern memT *mm1; | |
43 | ||
44 | ||
45 | inline uint64_t memread8s(memT * msp, uint64_t paddr) { return msp->SMemory::ld8s(paddr); } | |
46 | inline uint64_t memread8u(memT * msp, uint64_t paddr) { return msp->SMemory::ld8u(paddr); } | |
47 | inline uint64_t memread16s(memT * msp, uint64_t paddr) { return msp->SMemory::ld16s(paddr); } | |
48 | inline uint64_t memread16u(memT * msp, uint64_t paddr) { return msp->SMemory::ld16u(paddr); } | |
49 | inline uint64_t memread32s(memT * msp, uint64_t paddr) { return msp->SMemory::ld32s(paddr); } | |
50 | inline uint64_t memread32u(memT * msp, uint64_t paddr) { return msp->SMemory::ld32u(paddr); } | |
51 | inline uint64_t memread64s(memT * msp, uint64_t paddr) { return msp->SMemory::ld64(paddr); } | |
52 | inline uint64_t memread64u(memT * msp, uint64_t paddr) { return msp->SMemory::ld64(paddr); } | |
53 | ||
54 | inline int memread8u_blk_nl (memT * msp, uint64_t paddr, unsigned char *tgt, int n) { return msp->block_read(paddr, tgt, n); } | |
55 | inline int memwrite8u_blk_nl(memT * msp, uint64_t paddr, const unsigned char *src, int n) { return msp->block_write(paddr, src, n); } | |
56 | ||
57 | ||
58 | inline void memwrite8s(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st8(paddr, uint8_t(value)); } | |
59 | inline void memwrite8s_nl(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st8(paddr, uint8_t(value)); } | |
60 | inline void memwrite8u(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st8(paddr, uint8_t(value)); } | |
61 | inline void memwrite8u_nl(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st8(paddr, uint8_t(value)); } | |
62 | inline void memwrite16s(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st16(paddr, uint16_t(value)); } | |
63 | inline void memwrite16s_nl(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st16(paddr, uint16_t(value)); } | |
64 | inline void memwrite16u(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st16(paddr, uint16_t(value)); } | |
65 | inline void memwrite16u_nl(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st16(paddr, uint16_t(value)); } | |
66 | inline void memwrite32s(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st32(paddr, uint32_t(value)); } | |
67 | inline void memwrite32s_nl(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st32(paddr, uint32_t(value)); } | |
68 | inline void memwrite32u(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st32(paddr, uint32_t(value)); } | |
69 | inline void memwrite32u_nl(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st32(paddr, uint32_t(value)); } | |
70 | inline void memwrite64s(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st64(paddr, value); } | |
71 | inline void memwrite64s_nl(memT * msp, uint64_t paddr, uint64_t value) { msp->st64_nl(paddr, value); } | |
72 | inline void memwrite64u(memT * msp, uint64_t paddr, uint64_t value) { msp->SMemory::st64(paddr, value); } | |
73 | inline void memwrite64u_nl(memT * msp, uint64_t paddr, uint64_t value) { msp->st64_nl(paddr, value); } | |
74 | ||
75 | ||
76 | inline uint64_t mem_ldstub(memT *msp, uint64_t paddr) { return msp->SMemory::ldstub(paddr); } | |
77 | inline uint64_t mem_swap(memT *msp, uint64_t paddr, uint64_t value) { return msp->SMemory::swap(paddr, uint32_t(value)); } | |
78 | inline uint64_t mem_cas(memT *msp, uint64_t paddr, uint64_t rs2, uint64_t rd) { return msp->SMemory::cas(paddr, uint32_t(rd), uint32_t(rs2));} | |
79 | inline uint64_t mem_casx(memT *msp, uint64_t paddr, uint64_t rs2, uint64_t rd) { return msp->SMemory::casx(paddr,rd,rs2); } | |
80 | ||
81 | ||
82 | #endif /* _MEM_H */ |