Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / target / nios2 / mmu.h
blob5b085900fbf9a0729967ae4832fad89b7da85cef
1 /*
2 * Altera Nios II MMU emulation for qemu.
4 * Copyright (C) 2012 Chris Wulff <crwulff@gmail.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see
18 * <http://www.gnu.org/licenses/lgpl-2.1.html>
21 #ifndef NIOS2_MMU_H
22 #define NIOS2_MMU_H
24 #include "cpu.h"
26 typedef struct Nios2TLBEntry {
27 target_ulong tag;
28 target_ulong data;
29 } Nios2TLBEntry;
31 typedef struct Nios2MMU {
32 int tlb_entry_mask;
33 uint32_t pteaddr_wr;
34 uint32_t tlbacc_wr;
35 uint32_t tlbmisc_wr;
36 Nios2TLBEntry *tlb;
37 } Nios2MMU;
39 typedef struct Nios2MMULookup {
40 target_ulong vaddr;
41 target_ulong paddr;
42 int prot;
43 } Nios2MMULookup;
45 void mmu_flip_um(CPUNios2State *env, unsigned int um);
46 unsigned int mmu_translate(CPUNios2State *env,
47 Nios2MMULookup *lu,
48 target_ulong vaddr, int rw, int mmu_idx);
49 void mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v);
50 void mmu_init(CPUNios2State *env);
52 #endif /* NIOS2_MMU_H */