Skip to contentSkip to conversation

target-sh4: fix index of address read error exception

PATCH Applied Alexandre Courbot 2 participants 6 messages Jan 25, 2011 – Jan 26, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-sh4: fix index of address read error exception

Exception index of address read error should be 0x0e0.

---
 target-sh4/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-sh4/helper.c +1 -1
index 45449ea..2d76f22 100644
@@ -479,7 +479,7 @@ int cpu_sh4_handle_mmu_fault(CPUState * env, target_ulong address, int rw,
 	    break;
 	case MMU_IADDR_ERROR:
 	case MMU_DADDR_ERROR_READ:
-	    env->exception_index = 0x0c0;
+	    env->exception_index = 0x0e0;
 	    break;
 	case MMU_DADDR_ERROR_WRITE:
 	    env->exception_index = 0x100;
Signature · 1 line
1.7.3.5
#1 lore raw

PATCH 1/1 target-sh4: update PTEH upon MMU exception

Update the PTEH register to contain the VPN at which an MMU exception occured as specified by the SH4 reference.

---
 target-sh4/helper.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
target-sh4/helper.c +3 -0
index 2d76f22..c34d2f5 100644
@@ -453,6 +453,9 @@ int cpu_sh4_handle_mmu_fault(CPUState * env, target_ulong address, int rw,
 
     if (ret != MMU_OK) {
 	env->tea = address;
+	if (ret != MMU_DTLB_MULTIPLE && ret != MMU_ITLB_MULTIPLE)
+	    env->pteh = (env->pteh & PTEH_ASID_MASK) |
+		    (address & PTEH_VPN_MASK);
 	switch (ret) {
 	case MMU_ITLB_MISS:
 	case MMU_DTLB_MISS_READ:
Signature · 1 line
1.7.3.5
#2 lore raw

Re: [Qemu-devel] [PATCH] target-sh4: update PTEH upon MMU exception

Quoted 11 lines · Alexandre Courbot

Update the PTEH register to contain the VPN at which an MMU exception occured as specified by the SH4 reference.

---
 target-sh4/helper.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
target-sh4/helper.c +0 -0
index 2d76f22..c34d2f5 100644

target-sh4/helper.c int cpu_sh4_handle_mmu_fault(CPUState * env, target_ulong address, int rw, · line 458

Quoted 6 lines
target-sh4/helper.c +3 -0
@@ -453,6 +453,9 @@ int cpu_sh4_handle_mmu_fault(CPUState * env, target_ulong address, int rw,
 
     if (ret != MMU_OK) {
 	env->tea = address;
+	if (ret != MMU_DTLB_MULTIPLE && ret != MMU_ITLB_MULTIPLE)
+	    env->pteh = (env->pteh & PTEH_ASID_MASK) |
+		    (address & PTEH_VPN_MASK);

The code in itself is correct, however you should follow CODING_STYLE and write the if the following way:

    if () {
    }
Quoted 8 lines
target-sh4/helper.c +0 -0
 	switch (ret) {
 	case MMU_ITLB_MISS:
 	case MMU_DTLB_MISS_READ:
Signature · 1 line
1.7.3.5
Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#3 lore raw

PATCH v2 1/1 target-sh4: update PTEH upon MMU exception

Update the PTEH register to contain the VPN at which an MMU exception occured as specified by the SH4 reference.

---
 target-sh4/helper.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
target-sh4/helper.c +4 -0
index 19b309b..8f8c66c 100644
@@ -453,6 +453,10 @@ int cpu_sh4_handle_mmu_fault(CPUState * env, target_ulong address, int rw,
 
     if (ret != MMU_OK) {
 	env->tea = address;
+	if (ret != MMU_DTLB_MULTIPLE && ret != MMU_ITLB_MULTIPLE) {
+	    env->pteh = (env->pteh & PTEH_ASID_MASK) |
+		    (address & PTEH_VPN_MASK);
+	}
 	switch (ret) {
 	case MMU_ITLB_MISS:
 	case MMU_DTLB_MISS_READ:
Signature · 1 line
1.7.3.5
#4 lore raw

Re: [Qemu-devel] [PATCH v2] target-sh4: update PTEH upon MMU exception

Quoted 7 lines · Alexandre Courbot

Update the PTEH register to contain the VPN at which an MMU exception occured as specified by the SH4 reference.

---
 target-sh4/helper.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Thanks, applied.

Quoted 20 lines
target-sh4/helper.c +4 -0
index 19b309b..8f8c66c 100644
@@ -453,6 +453,10 @@ int cpu_sh4_handle_mmu_fault(CPUState * env, target_ulong address, int rw,
 
     if (ret != MMU_OK) {
 	env->tea = address;
+	if (ret != MMU_DTLB_MULTIPLE && ret != MMU_ITLB_MULTIPLE) {
+	    env->pteh = (env->pteh & PTEH_ASID_MASK) |
+		    (address & PTEH_VPN_MASK);
+	}
 	switch (ret) {
 	case MMU_ITLB_MISS:
 	case MMU_DTLB_MISS_READ:
Signature · 1 line
1.7.3.5
Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#5 lore raw
In reply to Alexandre Courbot
Quoted 10 lines · Alexandre Courbot

Exception index of address read error should be 0x0e0.

---
 target-sh4/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-sh4/helper.c +0 -0
index 45449ea..2d76f22 100644

target-sh4/helper.c int cpu_sh4_handle_mmu_fault(CPUState * env, target_ulong address, int rw, · line 485

Quoted 8 lines
target-sh4/helper.c +1 -1
@@ -479,7 +479,7 @@ int cpu_sh4_handle_mmu_fault(CPUState * env, target_ulong address, int rw,
 	    break;
 	case MMU_IADDR_ERROR:
 	case MMU_DADDR_ERROR_READ:
-	    env->exception_index = 0x0c0;
+	    env->exception_index = 0x0e0;
 	    break;
 	case MMU_DADDR_ERROR_WRITE:
 	    env->exception_index = 0x100;

Thanks, applied.

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net