Patchwork [5/8] sparc64: use symbolic name for MMU index

login
register
mail settings
Submitter Igor V. Kovalenko
Date June 1, 2010, 8:12 p.m.
Message ID <20100601201242.5908.21696.stgit@skyserv>
Download mbox | patch
Permalink /patch/54302/
State New
Headers show

Comments

Igor V. Kovalenko - June 1, 2010, 8:12 p.m.
From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
---
 target-sparc/op_helper.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)
Blue Swirl - June 2, 2010, 4:16 p.m.
On Tue, Jun 1, 2010 at 8:12 PM, Igor V. Kovalenko
<igor.v.kovalenko@gmail.com> wrote:
> From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>
> Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
> ---
>  target-sparc/op_helper.c |   28 ++++++++++++++++------------
>  1 files changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
> index f5e153d..b9af52b 100644
> --- a/target-sparc/op_helper.c
> +++ b/target-sparc/op_helper.c
> @@ -3322,18 +3322,19 @@ void helper_stdf(target_ulong addr, int mem_idx)
>     helper_check_align(addr, 7);
>  #if !defined(CONFIG_USER_ONLY)
>     switch (mem_idx) {
> -    case 0:
> +    case MMU_USER_IDX:
>         stfq_user(addr, DT0);
>         break;
> -    case 1:
> +    case MMU_KERNEL_IDX:
>         stfq_kernel(addr, DT0);
>         break;
>  #ifdef TARGET_SPARC64
> -    case 2:
> +    case MMU_HYPV_IDX:
>         stfq_hypv(addr, DT0);
>         break;
>  #endif
>     default:
> +        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);

Are these going to be useful or just leftover debugging?

>         break;
>     }
>  #else
> @@ -3346,18 +3347,19 @@ void helper_lddf(target_ulong addr, int mem_idx)
>     helper_check_align(addr, 7);
>  #if !defined(CONFIG_USER_ONLY)
>     switch (mem_idx) {
> -    case 0:
> +    case MMU_USER_IDX:
>         DT0 = ldfq_user(addr);
>         break;
> -    case 1:
> +    case MMU_KERNEL_IDX:
>         DT0 = ldfq_kernel(addr);
>         break;
>  #ifdef TARGET_SPARC64
> -    case 2:
> +    case MMU_HYPV_IDX:
>         DT0 = ldfq_hypv(addr);
>         break;
>  #endif
>     default:
> +        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);

The function name is not correct for this and other cases below.

>         break;
>     }
>  #else
> @@ -3373,24 +3375,25 @@ void helper_ldqf(target_ulong addr, int mem_idx)
>     helper_check_align(addr, 7);
>  #if !defined(CONFIG_USER_ONLY)
>     switch (mem_idx) {
> -    case 0:
> +    case MMU_USER_IDX:
>         u.ll.upper = ldq_user(addr);
>         u.ll.lower = ldq_user(addr + 8);
>         QT0 = u.q;
>         break;
> -    case 1:
> +    case MMU_KERNEL_IDX:
>         u.ll.upper = ldq_kernel(addr);
>         u.ll.lower = ldq_kernel(addr + 8);
>         QT0 = u.q;
>         break;
>  #ifdef TARGET_SPARC64
> -    case 2:
> +    case MMU_HYPV_IDX:
>         u.ll.upper = ldq_hypv(addr);
>         u.ll.lower = ldq_hypv(addr + 8);
>         QT0 = u.q;
>         break;
>  #endif
>     default:
> +        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);
>         break;
>     }
>  #else
> @@ -3408,24 +3411,25 @@ void helper_stqf(target_ulong addr, int mem_idx)
>     helper_check_align(addr, 7);
>  #if !defined(CONFIG_USER_ONLY)
>     switch (mem_idx) {
> -    case 0:
> +    case MMU_USER_IDX:
>         u.q = QT0;
>         stq_user(addr, u.ll.upper);
>         stq_user(addr + 8, u.ll.lower);
>         break;
> -    case 1:
> +    case MMU_KERNEL_IDX:
>         u.q = QT0;
>         stq_kernel(addr, u.ll.upper);
>         stq_kernel(addr + 8, u.ll.lower);
>         break;
>  #ifdef TARGET_SPARC64
> -    case 2:
> +    case MMU_HYPV_IDX:
>         u.q = QT0;
>         stq_hypv(addr, u.ll.upper);
>         stq_hypv(addr + 8, u.ll.lower);
>         break;
>  #endif
>     default:
> +        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);
>         break;
>     }
>  #else
>
>
>
Igor V. Kovalenko - June 2, 2010, 6:45 p.m.
On Wed, Jun 2, 2010 at 8:16 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Tue, Jun 1, 2010 at 8:12 PM, Igor V. Kovalenko
> <igor.v.kovalenko@gmail.com> wrote:
>> From: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>>
>> Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
>> ---
>>  target-sparc/op_helper.c |   28 ++++++++++++++++------------
>>  1 files changed, 16 insertions(+), 12 deletions(-)
>>
>> diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
>> index f5e153d..b9af52b 100644
>> --- a/target-sparc/op_helper.c
>> +++ b/target-sparc/op_helper.c
>> @@ -3322,18 +3322,19 @@ void helper_stdf(target_ulong addr, int mem_idx)
>>     helper_check_align(addr, 7);
>>  #if !defined(CONFIG_USER_ONLY)
>>     switch (mem_idx) {
>> -    case 0:
>> +    case MMU_USER_IDX:
>>         stfq_user(addr, DT0);
>>         break;
>> -    case 1:
>> +    case MMU_KERNEL_IDX:
>>         stfq_kernel(addr, DT0);
>>         break;
>>  #ifdef TARGET_SPARC64
>> -    case 2:
>> +    case MMU_HYPV_IDX:
>>         stfq_hypv(addr, DT0);
>>         break;
>>  #endif
>>     default:
>> +        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);
>
> Are these going to be useful or just leftover debugging?
>
>>         break;
>>     }
>>  #else
>> @@ -3346,18 +3347,19 @@ void helper_lddf(target_ulong addr, int mem_idx)
>>     helper_check_align(addr, 7);
>>  #if !defined(CONFIG_USER_ONLY)
>>     switch (mem_idx) {
>> -    case 0:
>> +    case MMU_USER_IDX:
>>         DT0 = ldfq_user(addr);
>>         break;
>> -    case 1:
>> +    case MMU_KERNEL_IDX:
>>         DT0 = ldfq_kernel(addr);
>>         break;
>>  #ifdef TARGET_SPARC64
>> -    case 2:
>> +    case MMU_HYPV_IDX:
>>         DT0 = ldfq_hypv(addr);
>>         break;
>>  #endif
>>     default:
>> +        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);
>
> The function name is not correct for this and other cases below.
>
>>         break;
>>     }
>>  #else
>> @@ -3373,24 +3375,25 @@ void helper_ldqf(target_ulong addr, int mem_idx)
>>     helper_check_align(addr, 7);
>>  #if !defined(CONFIG_USER_ONLY)
>>     switch (mem_idx) {
>> -    case 0:
>> +    case MMU_USER_IDX:
>>         u.ll.upper = ldq_user(addr);
>>         u.ll.lower = ldq_user(addr + 8);
>>         QT0 = u.q;
>>         break;
>> -    case 1:
>> +    case MMU_KERNEL_IDX:
>>         u.ll.upper = ldq_kernel(addr);
>>         u.ll.lower = ldq_kernel(addr + 8);
>>         QT0 = u.q;
>>         break;
>>  #ifdef TARGET_SPARC64
>> -    case 2:
>> +    case MMU_HYPV_IDX:
>>         u.ll.upper = ldq_hypv(addr);
>>         u.ll.lower = ldq_hypv(addr + 8);
>>         QT0 = u.q;
>>         break;
>>  #endif
>>     default:
>> +        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);
>>         break;
>>     }
>>  #else
>> @@ -3408,24 +3411,25 @@ void helper_stqf(target_ulong addr, int mem_idx)
>>     helper_check_align(addr, 7);
>>  #if !defined(CONFIG_USER_ONLY)
>>     switch (mem_idx) {
>> -    case 0:
>> +    case MMU_USER_IDX:
>>         u.q = QT0;
>>         stq_user(addr, u.ll.upper);
>>         stq_user(addr + 8, u.ll.lower);
>>         break;
>> -    case 1:
>> +    case MMU_KERNEL_IDX:
>>         u.q = QT0;
>>         stq_kernel(addr, u.ll.upper);
>>         stq_kernel(addr + 8, u.ll.lower);
>>         break;
>>  #ifdef TARGET_SPARC64
>> -    case 2:
>> +    case MMU_HYPV_IDX:
>>         u.q = QT0;
>>         stq_hypv(addr, u.ll.upper);
>>         stq_hypv(addr + 8, u.ll.lower);
>>         break;
>>  #endif
>>     default:
>> +        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);
>>         break;
>>     }
>>  #else

I'll fix names, turn printf into DPRINTF_MMU and resend.

Patch

diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index f5e153d..b9af52b 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -3322,18 +3322,19 @@  void helper_stdf(target_ulong addr, int mem_idx)
     helper_check_align(addr, 7);
 #if !defined(CONFIG_USER_ONLY)
     switch (mem_idx) {
-    case 0:
+    case MMU_USER_IDX:
         stfq_user(addr, DT0);
         break;
-    case 1:
+    case MMU_KERNEL_IDX:
         stfq_kernel(addr, DT0);
         break;
 #ifdef TARGET_SPARC64
-    case 2:
+    case MMU_HYPV_IDX:
         stfq_hypv(addr, DT0);
         break;
 #endif
     default:
+        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);
         break;
     }
 #else
@@ -3346,18 +3347,19 @@  void helper_lddf(target_ulong addr, int mem_idx)
     helper_check_align(addr, 7);
 #if !defined(CONFIG_USER_ONLY)
     switch (mem_idx) {
-    case 0:
+    case MMU_USER_IDX:
         DT0 = ldfq_user(addr);
         break;
-    case 1:
+    case MMU_KERNEL_IDX:
         DT0 = ldfq_kernel(addr);
         break;
 #ifdef TARGET_SPARC64
-    case 2:
+    case MMU_HYPV_IDX:
         DT0 = ldfq_hypv(addr);
         break;
 #endif
     default:
+        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);
         break;
     }
 #else
@@ -3373,24 +3375,25 @@  void helper_ldqf(target_ulong addr, int mem_idx)
     helper_check_align(addr, 7);
 #if !defined(CONFIG_USER_ONLY)
     switch (mem_idx) {
-    case 0:
+    case MMU_USER_IDX:
         u.ll.upper = ldq_user(addr);
         u.ll.lower = ldq_user(addr + 8);
         QT0 = u.q;
         break;
-    case 1:
+    case MMU_KERNEL_IDX:
         u.ll.upper = ldq_kernel(addr);
         u.ll.lower = ldq_kernel(addr + 8);
         QT0 = u.q;
         break;
 #ifdef TARGET_SPARC64
-    case 2:
+    case MMU_HYPV_IDX:
         u.ll.upper = ldq_hypv(addr);
         u.ll.lower = ldq_hypv(addr + 8);
         QT0 = u.q;
         break;
 #endif
     default:
+        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);
         break;
     }
 #else
@@ -3408,24 +3411,25 @@  void helper_stqf(target_ulong addr, int mem_idx)
     helper_check_align(addr, 7);
 #if !defined(CONFIG_USER_ONLY)
     switch (mem_idx) {
-    case 0:
+    case MMU_USER_IDX:
         u.q = QT0;
         stq_user(addr, u.ll.upper);
         stq_user(addr + 8, u.ll.lower);
         break;
-    case 1:
+    case MMU_KERNEL_IDX:
         u.q = QT0;
         stq_kernel(addr, u.ll.upper);
         stq_kernel(addr + 8, u.ll.lower);
         break;
 #ifdef TARGET_SPARC64
-    case 2:
+    case MMU_HYPV_IDX:
         u.q = QT0;
         stq_hypv(addr, u.ll.upper);
         stq_hypv(addr + 8, u.ll.lower);
         break;
 #endif
     default:
+        printf("helper_stdf: need to check MMU idx %d\n", mem_idx);
         break;
     }
 #else