--- qemu/target-microblaze/op_helper.c 2018/04/24 19:19:36 1.1.1.6 +++ qemu/target-microblaze/op_helper.c 2018/04/24 19:36:31 1.1.1.7 @@ -2,6 +2,7 @@ * Microblaze helper routines. * * Copyright (c) 2009 Edgar E. Iglesias . + * Copyright (c) 2009-2012 PetaLogix Qld Pty Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -42,12 +43,11 @@ NULL, it means that the function was called in C code (i.e. not from generated code or from helper.c) */ /* XXX: fix it to restore all registers */ -void tlb_fill(CPUState *env1, target_ulong addr, int is_write, int mmu_idx, - void *retaddr) +void tlb_fill(CPUMBState *env1, target_ulong addr, int is_write, int mmu_idx, + uintptr_t retaddr) { TranslationBlock *tb; - CPUState *saved_env; - unsigned long pc; + CPUMBState *saved_env; int ret; saved_env = env; @@ -57,12 +57,11 @@ void tlb_fill(CPUState *env1, target_ulo if (unlikely(ret)) { if (retaddr) { /* now we have a real cpu fault */ - pc = (unsigned long)retaddr; - tb = tb_find_pc(pc); + tb = tb_find_pc(retaddr); if (tb) { /* the PC is inside the translated code. It means that we have a virtual CPU fault */ - cpu_restore_state(tb, env, pc); + cpu_restore_state(tb, env, retaddr); } } cpu_loop_exit(env); @@ -165,6 +164,11 @@ uint32_t helper_cmpu(uint32_t a, uint32_ return t; } +uint32_t helper_clz(uint32_t t0) +{ + return clz32(t0); +} + uint32_t helper_carry(uint32_t a, uint32_t b, uint32_t cf) { uint32_t ncf; @@ -478,6 +482,17 @@ void helper_memalign(uint32_t addr, uint } } +void helper_stackprot(uint32_t addr) +{ + if (addr < env->slr || addr > env->shr) { + qemu_log("Stack protector violation at %x %x %x\n", + addr, env->slr, env->shr); + env->sregs[SR_EAR] = addr; + env->sregs[SR_ESR] = ESR_EC_STACKPROT; + helper_raise_exception(EXCP_HW_EXCP); + } +} + #if !defined(CONFIG_USER_ONLY) /* Writes/reads to the MMU's special regs end up here. */ uint32_t helper_mmu_read(uint32_t rn) @@ -490,10 +505,10 @@ void helper_mmu_write(uint32_t rn, uint3 mmu_write(env, rn, v); } -void cpu_unassigned_access(CPUState *env1, target_phys_addr_t addr, +void cpu_unassigned_access(CPUMBState *env1, target_phys_addr_t addr, int is_write, int is_exec, int is_asi, int size) { - CPUState *saved_env; + CPUMBState *saved_env; saved_env = env; env = env1;