diff mbox

target-sh4: update PTEH upon MMU exception

Message ID 1295931077-29499-2-git-send-email-gnurou@gmail.com
State New
Headers show

Commit Message

Alexandre Courbot Jan. 25, 2011, 4:51 a.m. UTC
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(-)

Comments

Aurelien Jarno Jan. 25, 2011, 8:05 a.m. UTC | #1
On Tue, Jan 25, 2011 at 01:51:17PM +0900, Alexandre Courbot wrote:
> 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(-)
> 
> diff --git a/target-sh4/helper.c b/target-sh4/helper.c
> index 2d76f22..c34d2f5 100644
> --- a/target-sh4/helper.c
> +++ b/target-sh4/helper.c
> @@ -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 () {
    }

>  	switch (ret) {
>  	case MMU_ITLB_MISS:
>  	case MMU_DTLB_MISS_READ:
> -- 
> 1.7.3.5
> 
> 
>
diff mbox

Patch

diff --git a/target-sh4/helper.c b/target-sh4/helper.c
index 2d76f22..c34d2f5 100644
--- a/target-sh4/helper.c
+++ b/target-sh4/helper.c
@@ -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: