mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
target/ppc: Introduce prot_for_access_type
Use this in the three places we currently have a local array indexed by rwx (which happens to have the same values). The types will match up correctly with additional changes. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210518201146.794854-2-richard.henderson@linaro.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
861f10fd52
commit
182357dbb6
4 changed files with 34 additions and 9 deletions
|
@ -29,6 +29,7 @@
|
|||
#include "mmu-hash64.h"
|
||||
#include "exec/log.h"
|
||||
#include "hw/hw.h"
|
||||
#include "internal.h"
|
||||
#include "mmu-book3s-v3.h"
|
||||
#include "helper_regs.h"
|
||||
|
||||
|
@ -876,7 +877,7 @@ int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr,
|
|||
hwaddr ptex;
|
||||
ppc_hash_pte64_t pte;
|
||||
int exec_prot, pp_prot, amr_prot, prot;
|
||||
const int need_prot[] = {PAGE_READ, PAGE_WRITE, PAGE_EXEC};
|
||||
int need_prot;
|
||||
hwaddr raddr;
|
||||
|
||||
assert((rwx == 0) || (rwx == 1) || (rwx == 2));
|
||||
|
@ -996,7 +997,8 @@ skip_slb_search:
|
|||
amr_prot = ppc_hash64_amr_prot(cpu, pte);
|
||||
prot = exec_prot & pp_prot & amr_prot;
|
||||
|
||||
if ((need_prot[rwx] & ~prot) != 0) {
|
||||
need_prot = prot_for_access_type(rwx);
|
||||
if (need_prot & ~prot) {
|
||||
/* Access right violation */
|
||||
qemu_log_mask(CPU_LOG_MMU, "PTE access rejected\n");
|
||||
if (rwx == 2) {
|
||||
|
@ -1012,13 +1014,13 @@ skip_slb_search:
|
|||
ppc_hash64_set_isi(cs, srr1);
|
||||
} else {
|
||||
int dsisr = 0;
|
||||
if (need_prot[rwx] & ~pp_prot) {
|
||||
if (need_prot & ~pp_prot) {
|
||||
dsisr |= DSISR_PROTFAULT;
|
||||
}
|
||||
if (rwx == 1) {
|
||||
dsisr |= DSISR_ISSTORE;
|
||||
}
|
||||
if (need_prot[rwx] & ~amr_prot) {
|
||||
if (need_prot & ~amr_prot) {
|
||||
dsisr |= DSISR_AMR;
|
||||
}
|
||||
ppc_hash64_set_dsi(cs, eaddr, dsisr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue