Chris Wulff | 032c76b | 2017-01-18 23:01:41 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Altera Nios II MMU emulation for qemu. |
| 3 | * |
| 4 | * Copyright (C) 2012 Chris Wulff <crwulff@gmail.com> |
| 5 | * |
| 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. |
| 10 | * |
| 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. |
| 15 | * |
| 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> |
| 19 | */ |
| 20 | #ifndef MMU_NIOS2_H |
| 21 | #define MMU_NIOS2_H |
| 22 | |
| 23 | typedef struct Nios2TLBEntry { |
| 24 | target_ulong tag; |
| 25 | target_ulong data; |
| 26 | } Nios2TLBEntry; |
| 27 | |
| 28 | typedef struct Nios2MMU { |
| 29 | int tlb_entry_mask; |
| 30 | uint32_t pteaddr_wr; |
| 31 | uint32_t tlbacc_wr; |
| 32 | uint32_t tlbmisc_wr; |
| 33 | Nios2TLBEntry *tlb; |
| 34 | } Nios2MMU; |
| 35 | |
| 36 | typedef struct Nios2MMULookup { |
| 37 | target_ulong vaddr; |
| 38 | target_ulong paddr; |
| 39 | int prot; |
| 40 | } Nios2MMULookup; |
| 41 | |
| 42 | void mmu_flip_um(CPUNios2State *env, unsigned int um); |
| 43 | unsigned int mmu_translate(CPUNios2State *env, |
| 44 | Nios2MMULookup *lu, |
| 45 | target_ulong vaddr, int rw, int mmu_idx); |
| 46 | void mmu_read_debug(CPUNios2State *env, uint32_t rn); |
| 47 | void mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v); |
| 48 | void mmu_init(CPUNios2State *env); |
| 49 | |
| 50 | #endif /* MMU_NIOS2_H */ |