mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
target/hppa: Use privilege helper in hppa_get_physical_address()
Convert hppa_get_physical_address() to use the privilege helper macro. Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
88b7ad10dd
commit
3d066afc68
1 changed files with 5 additions and 4 deletions
|
@ -73,7 +73,7 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx,
|
||||||
int type, hwaddr *pphys, int *pprot)
|
int type, hwaddr *pphys, int *pprot)
|
||||||
{
|
{
|
||||||
hwaddr phys;
|
hwaddr phys;
|
||||||
int prot, r_prot, w_prot, x_prot;
|
int prot, r_prot, w_prot, x_prot, priv;
|
||||||
hppa_tlb_entry *ent;
|
hppa_tlb_entry *ent;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
@ -97,9 +97,10 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx,
|
||||||
phys = ent->pa + (addr & ~TARGET_PAGE_MASK);
|
phys = ent->pa + (addr & ~TARGET_PAGE_MASK);
|
||||||
|
|
||||||
/* Map TLB access_rights field to QEMU protection. */
|
/* Map TLB access_rights field to QEMU protection. */
|
||||||
r_prot = (mmu_idx <= ent->ar_pl1) * PAGE_READ;
|
priv = MMU_IDX_TO_PRIV(mmu_idx);
|
||||||
w_prot = (mmu_idx <= ent->ar_pl2) * PAGE_WRITE;
|
r_prot = (priv <= ent->ar_pl1) * PAGE_READ;
|
||||||
x_prot = (ent->ar_pl2 <= mmu_idx && mmu_idx <= ent->ar_pl1) * PAGE_EXEC;
|
w_prot = (priv <= ent->ar_pl2) * PAGE_WRITE;
|
||||||
|
x_prot = (ent->ar_pl2 <= priv && priv <= ent->ar_pl1) * PAGE_EXEC;
|
||||||
switch (ent->ar_type) {
|
switch (ent->ar_type) {
|
||||||
case 0: /* read-only: data page */
|
case 0: /* read-only: data page */
|
||||||
prot = r_prot;
|
prot = r_prot;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue