target/ppc: Check effective address validity
PATCH 1/1 target/ppc: Check effective address validity
For Radix translation, the EA range is 64-bits. when EA(2:11) are nonzero, a segment interrupt should occur.
Signed-off-by Cédric Le Goater <[email protected]>
--- target/ppc/mmu-radix64.h | 1 + target/ppc/mmu-radix64.c | 5 +++++ 2 files changed, 6 insertions(+)
target/ppc/mmu-radix64.h +1 -0
@@ -5,6 +5,7 @@/* Radix Quadrants */ #define R_EADDR_MASK 0x3FFFFFFFFFFFFFFF +#define R_EADDR_VALID_MASK 0xC00FFFFFFFFFFFFF#define R_EADDR_QUADRANT 0xC000000000000000#define R_EADDR_QUADRANT0 0x0000000000000000#define R_EADDR_QUADRANT1 0x4000000000000000
target/ppc/mmu-radix64.c +5 -0
@@ -32,6 +32,11 @@ static bool ppc_radix64_get_fully_qualified_addr(const CPUPPCState *env,vaddr eaddr, uint64_t *lpid, uint64_t *pid) { + /* When EA(2:11) are nonzero, raise a segment interrupt */ + if (eaddr & ~R_EADDR_VALID_MASK) { + return false; + } +if (msr_hv) {/* MSR[HV] -> Hypervisor/bare metal */ switch (eaddr &R_EADDR_QUADRANT ) {case R_EADDR_QUADRANT0 :
Signature · 1 line
2.31.1
Quoted 5 lines · Cédric Le Goater
For Radix translation, the EA range is 64-bits. when EA(2:11) are nonzero, a segment interrupt should occur.
Signed-off-by Cédric Le Goater <[email protected]>---
Looks ok to me.
Reviewed-by Frederic Barrat <[email protected]>
Fred
Quoted 32 lines
target/ppc/mmu-radix64.h | 1 + target/ppc/mmu-radix64.c | 5 +++++ 2 files changed, 6 insertions(+)target/ppc/mmu-radix64.h +1
-0@@ -5,6 +5,7 @@/* Radix Quadrants */ #define R_EADDR_MASK 0x3FFFFFFFFFFFFFFF +#define R_EADDR_VALID_MASK 0xC00FFFFFFFFFFFFF#define R_EADDR_QUADRANT 0xC000000000000000#define R_EADDR_QUADRANT0 0x0000000000000000#define R_EADDR_QUADRANT1 0x4000000000000000target/ppc/mmu-radix64.c +5
-0@@ -32,6 +32,11 @@ static bool ppc_radix64_get_fully_qualified_addr(const CPUPPCState *env,vaddr eaddr, uint64_t *lpid, uint64_t *pid) { + /* When EA(2:11) are nonzero, raise a segment interrupt */ + if (eaddr & ~R_EADDR_VALID_MASK) { + return false; + } +if (msr_hv) {/* MSR[HV] -> Hypervisor/bare metal */ switch (eaddr &R_EADDR_QUADRANT ) {case R_EADDR_QUADRANT0 :
Cédric Le Goater
AppliedQuoted 4 lines · Cédric Le Goater
For Radix translation, the EA range is 64-bits. when EA(2:11) are nonzero, a segment interrupt should occur.
Signed-off-by Cédric Le Goater <[email protected]>
Applied in ppc-next.
Thanks,
C.