excp_helper.c (1393B)
1/* 2 * x86 exception helpers - user-mode specific code 3 * 4 * Copyright (c) 2003 Fabrice Bellard 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 <http://www.gnu.org/licenses/>. 18 */ 19 20#include "qemu/osdep.h" 21#include "cpu.h" 22#include "exec/exec-all.h" 23#include "tcg/helper-tcg.h" 24 25bool x86_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, 26 MMUAccessType access_type, int mmu_idx, 27 bool probe, uintptr_t retaddr) 28{ 29 X86CPU *cpu = X86_CPU(cs); 30 CPUX86State *env = &cpu->env; 31 32 env->cr[2] = addr; 33 env->error_code = (access_type == MMU_DATA_STORE) << PG_ERROR_W_BIT; 34 env->error_code |= PG_ERROR_U_MASK; 35 cs->exception_index = EXCP0E_PAGE; 36 env->exception_is_int = 0; 37 env->exception_next_eip = -1; 38 cpu_loop_exit_restore(cs, retaddr); 39}