Skip to contentSkip to conversation

sparc64 reverse cas and casx arguments

PATCH In review Igor Kovalenko 2 participants 3 messages Sep 21, 2008 – Sep 22, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc64 reverse cas and casx arguments

Hi!

The following patch should fix a problem with sparc64 cas and casx emulation where value to be stored and value to be compared are passed in reverse order to helper function.

This also fixes a problem with booting linux iso where kernel tries to clear memory bitmap bit with casx but fails to find any cleared bit later.

Please apply.

PS: if anyone can send me a patch for gdb to load and use System.map file while doing remote debugging that would be great :)

Signature · 2 lines
Kind regards,
Igor V. Kovalenko
op_helper.c +4 -4
Index: target-sparc/op_helper.c
===================================================================
@@ -2194,8 +2226,8 @@
     helper_st_asi(addr, val, asi, size);
 }
 
-target_ulong helper_cas_asi(target_ulong addr, target_ulong val1,
-                            target_ulong val2, uint32_t asi)
+target_ulong helper_cas_asi(target_ulong addr, target_ulong val2,
+                            target_ulong val1, uint32_t asi)
 {
     target_ulong ret;
 
@@ -2207,8 +2239,8 @@
     return ret;
 }
 
-target_ulong helper_casx_asi(target_ulong addr, target_ulong val1,
-                             target_ulong val2, uint32_t asi)
+target_ulong helper_casx_asi(target_ulong addr, target_ulong val2,
+                             target_ulong val1, uint32_t asi)
 {
     target_ulong ret;
 
#1 lore raw
Quoted 11 lines · Igor Kovalenko

Hi!

The following patch should fix a problem with sparc64 cas and casx emulation where value to be stored and value to be compared are passed in reverse order to helper function.

This also fixes a problem with booting linux iso where kernel tries to clear memory bitmap bit with casx but fails to find any cleared bit later.

Please apply.

Thanks for spotting. I think a cleaner solution would be to rearrange the code so that the argument names match the instruction field names.

Quoted 2 lines

PS: if anyone can send me a patch for gdb to load and use System.map file while doing remote debugging that would be great :)

I have usually compiled the kernel with -g flag and then used the vmlinux file when debugging.

#2 lore raw
Quoted 9 lines · Blue Swirl
Quoted 6 lines · Igor Kovalenko

Hi!

The following patch should fix a problem with sparc64 cas and casx emulation where value to be stored and value to be compared are passed in reverse order to helper function.

Thanks for spotting. I think a cleaner solution would be to rearrange the code so that the argument names match the instruction field names.

I think the problem is at call site but anyway obviously the committed change fixes the problem.

Quoted 6 lines
Quoted 2 lines

PS: if anyone can send me a patch for gdb to load and use System.map file while doing remote debugging that would be great :)

I have usually compiled the kernel with -g flag and then used the vmlinux file when debugging.

... I wanted to save some time building the kernel for officially released distribution (this time, gentoo 2008.0)

Signature · 2 lines
Kind regards,
Igor V. Kovalenko