2012-07-20 09:50:39 +02:00
|
|
|
/*
|
|
|
|
* OpenRISC MMU helper routines
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011-2012 Jia Liu <proljc@gmail.com>
|
|
|
|
* Zhizhou Zhang <etouzh@gmail.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-01-26 19:17:22 +01:00
|
|
|
#include "qemu/osdep.h"
|
2012-07-20 09:50:39 +02:00
|
|
|
#include "cpu.h"
|
2016-03-15 13:18:37 +01:00
|
|
|
#include "exec/exec-all.h"
|
2014-03-28 19:42:10 +01:00
|
|
|
#include "exec/cpu_ldst.h"
|
2012-07-20 09:50:39 +02:00
|
|
|
|
|
|
|
#ifndef CONFIG_USER_ONLY
|
|
|
|
|
2016-06-14 14:26:17 +02:00
|
|
|
void tlb_fill(CPUState *cs, target_ulong addr, MMUAccessType access_type,
|
2012-07-20 09:50:39 +02:00
|
|
|
int mmu_idx, uintptr_t retaddr)
|
|
|
|
{
|
2012-07-20 09:50:40 +02:00
|
|
|
int ret;
|
|
|
|
|
2016-06-14 14:26:17 +02:00
|
|
|
ret = openrisc_cpu_handle_mmu_fault(cs, addr, access_type, mmu_idx);
|
2012-07-20 09:50:40 +02:00
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
if (retaddr) {
|
|
|
|
/* now we have a real cpu fault. */
|
2013-09-01 16:51:34 +02:00
|
|
|
cpu_restore_state(cs, retaddr);
|
2012-07-20 09:50:40 +02:00
|
|
|
}
|
|
|
|
/* Raise Exception. */
|
2013-08-27 17:52:12 +02:00
|
|
|
cpu_loop_exit(cs);
|
2012-07-20 09:50:40 +02:00
|
|
|
}
|
2012-07-20 09:50:39 +02:00
|
|
|
}
|
|
|
|
#endif
|