1cc8eae8aSDavid Gibson /* 2cc8eae8aSDavid Gibson * PowerPC MMU stub handling for user mode emulation 3cc8eae8aSDavid Gibson * 4cc8eae8aSDavid Gibson * Copyright (c) 2003-2007 Jocelyn Mayer 5cc8eae8aSDavid Gibson * Copyright (c) 2013 David Gibson, IBM Corporation. 6cc8eae8aSDavid Gibson * 7cc8eae8aSDavid Gibson * This library is free software; you can redistribute it and/or 8cc8eae8aSDavid Gibson * modify it under the terms of the GNU Lesser General Public 9cc8eae8aSDavid Gibson * License as published by the Free Software Foundation; either 10cc8eae8aSDavid Gibson * version 2 of the License, or (at your option) any later version. 11cc8eae8aSDavid Gibson * 12cc8eae8aSDavid Gibson * This library is distributed in the hope that it will be useful, 13cc8eae8aSDavid Gibson * but WITHOUT ANY WARRANTY; without even the implied warranty of 14cc8eae8aSDavid Gibson * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15cc8eae8aSDavid Gibson * Lesser General Public License for more details. 16cc8eae8aSDavid Gibson * 17cc8eae8aSDavid Gibson * You should have received a copy of the GNU Lesser General Public 18cc8eae8aSDavid Gibson * License along with this library; if not, see <http://www.gnu.org/licenses/>. 19cc8eae8aSDavid Gibson */ 20cc8eae8aSDavid Gibson 210d75590dSPeter Maydell #include "qemu/osdep.h" 22cc8eae8aSDavid Gibson #include "cpu.h" 23*351bc97eSRichard Henderson #include "exec/exec-all.h" 24cc8eae8aSDavid Gibson 25*351bc97eSRichard Henderson 26*351bc97eSRichard Henderson bool ppc_cpu_tlb_fill(CPUState *cs, vaddr address, int size, 27*351bc97eSRichard Henderson MMUAccessType access_type, int mmu_idx, 28*351bc97eSRichard Henderson bool probe, uintptr_t retaddr) 29cc8eae8aSDavid Gibson { 307510454eSAndreas Färber PowerPCCPU *cpu = POWERPC_CPU(cs); 317510454eSAndreas Färber CPUPPCState *env = &cpu->env; 32cc8eae8aSDavid Gibson int exception, error_code; 33cc8eae8aSDavid Gibson 34*351bc97eSRichard Henderson if (access_type == MMU_INST_FETCH) { 35cc8eae8aSDavid Gibson exception = POWERPC_EXCP_ISI; 36cc8eae8aSDavid Gibson error_code = 0x40000000; 37cc8eae8aSDavid Gibson } else { 38cc8eae8aSDavid Gibson exception = POWERPC_EXCP_DSI; 39cc8eae8aSDavid Gibson error_code = 0x40000000; 40*351bc97eSRichard Henderson if (access_type == MMU_DATA_STORE) { 41cc8eae8aSDavid Gibson error_code |= 0x02000000; 42cc8eae8aSDavid Gibson } 43cc8eae8aSDavid Gibson env->spr[SPR_DAR] = address; 44cc8eae8aSDavid Gibson env->spr[SPR_DSISR] = error_code; 45cc8eae8aSDavid Gibson } 4627103424SAndreas Färber cs->exception_index = exception; 47cc8eae8aSDavid Gibson env->error_code = error_code; 48*351bc97eSRichard Henderson cpu_loop_exit_restore(cs, retaddr); 49cc8eae8aSDavid Gibson } 50