2012-07-20 11:50:39 +04: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 21:17:22 +03:00
|
|
|
#include "qemu/osdep.h"
|
2012-07-20 11:50:39 +04:00
|
|
|
#include "cpu.h"
|
2016-03-15 15:18:37 +03:00
|
|
|
#include "exec/exec-all.h"
|
2014-03-28 22:42:10 +04:00
|
|
|
#include "exec/cpu_ldst.h"
|
2012-07-20 11:50:39 +04:00
|
|
|
|
|
|
|
#ifndef CONFIG_USER_ONLY
|
|
|
|
|
2013-08-27 02:28:06 +04:00
|
|
|
void tlb_fill(CPUState *cs, target_ulong addr, int is_write,
|
2012-07-20 11:50:39 +04:00
|
|
|
int mmu_idx, uintptr_t retaddr)
|
|
|
|
{
|
2012-07-20 11:50:40 +04:00
|
|
|
int ret;
|
|
|
|
|
2013-08-27 02:28:06 +04:00
|
|
|
ret = openrisc_cpu_handle_mmu_fault(cs, addr, is_write, mmu_idx);
|
2012-07-20 11:50:40 +04:00
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
if (retaddr) {
|
|
|
|
/* now we have a real cpu fault. */
|
2013-09-01 18:51:34 +04:00
|
|
|
cpu_restore_state(cs, retaddr);
|
2012-07-20 11:50:40 +04:00
|
|
|
}
|
|
|
|
/* Raise Exception. */
|
2013-08-27 19:52:12 +04:00
|
|
|
cpu_loop_exit(cs);
|
2012-07-20 11:50:40 +04:00
|
|
|
}
|
2012-07-20 11:50:39 +04:00
|
|
|
}
|
|
|
|
#endif
|