Commit d4934d18f36dbd974e28c700a55e9393395a18c4

Authored by pbrook
1 parent 564e571a

Implement ARMv7 MMU access permissions.

Signed-off-by: Paul Brook <paul@codesourcery.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6099 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 11 additions and 1 deletions
target-arm/helper.c
@@ -900,12 +900,16 @@ static inline int check_ap(CPUState *env, int ap, int domain, int access_type, @@ -900,12 +900,16 @@ static inline int check_ap(CPUState *env, int ap, int domain, int access_type,
900 return PAGE_READ | PAGE_WRITE; 900 return PAGE_READ | PAGE_WRITE;
901 case 3: 901 case 3:
902 return PAGE_READ | PAGE_WRITE; 902 return PAGE_READ | PAGE_WRITE;
903 - case 4: case 7: /* Reserved. */ 903 + case 4: /* Reserved. */
904 return 0; 904 return 0;
905 case 5: 905 case 5:
906 return is_user ? 0 : prot_ro; 906 return is_user ? 0 : prot_ro;
907 case 6: 907 case 6:
908 return prot_ro; 908 return prot_ro;
  909 + case 7:
  910 + if (!arm_feature (env, ARM_FEATURE_V7))
  911 + return 0;
  912 + return prot_ro;
909 default: 913 default:
910 abort(); 914 abort();
911 } 915 }
@@ -1085,6 +1089,12 @@ static int get_phys_addr_v6(CPUState *env, uint32_t address, int access_type, @@ -1085,6 +1089,12 @@ static int get_phys_addr_v6(CPUState *env, uint32_t address, int access_type,
1085 if (xn && access_type == 2) 1089 if (xn && access_type == 2)
1086 goto do_fault; 1090 goto do_fault;
1087 1091
  1092 + /* The simplified model uses AP[0] as an access control bit. */
  1093 + if ((env->cp15.c1_sys & (1 << 29)) && (ap & 1) == 0) {
  1094 + /* Access flag fault. */
  1095 + code = (code == 15) ? 6 : 3;
  1096 + goto do_fault;
  1097 + }
1088 *prot = check_ap(env, ap, domain, access_type, is_user); 1098 *prot = check_ap(env, ap, domain, access_type, is_user);
1089 if (!*prot) { 1099 if (!*prot) {
1090 /* Access permission fault. */ 1100 /* Access permission fault. */