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