[PATCH] PPC64 Poor assembly coding style
Linas Vepstas
linas at austin.ibm.com
Tue Nov 9 05:16:19 EST 2004
Hi,
Doug Maxey reported a bug with the latest/greatest gas assembler
that demonstrates some poor coding style in entry.S and head.S.
The following patch cleans up that style, and also avoids assembler
confusion. Basically, in entry.S,
cmpldi 0,r0,NR_syscalls should be written as either
cmpldi r0,NR_syscalls or as cmpldi cr0,r0,NR_syscalls
All three forms are theoretically equivalent; in practice,
I find the first alternative the cleanest (and also consistent
with usage elsewhere in the files).
The new assembler seems to be mistaking NR_syscalls for a register
number, which is clearly out of bounds (its not in 0..31).
I think it would be cleaner overall to just drop the superfluous
leading cr0. There are two other confusing usages, in head.S:
I propose that
cmpldi cr0,r5,0 should be cmpldi r5,0
cmpld 0,r6,r5 should be cmpld r6,r5
--linas
Signed-off-by: Linas Vepstas <linas at linas.org>
-------------- next part --------------
Hi,
Doug Maxey reported a bug with the latest/greatest gas assembler
that demonstrates some poor coding style in entry.S and head.S.
The following patch cleans up that style, and also avoids assembler
confusion. Basically, in entry.S,
cmpldi 0,r0,NR_syscalls should be written as either
cmpldi r0,NR_syscalls or as cmpldi cr0,r0,NR_syscalls
All three forms are theoretically equivalent; in practice,
I find the first alternative the cleanest (and also consistent
with usage elsewhere in the files).
The new assembler seems to be mistaking NR_syscalls for a register
number, which is clearly out of bounds (its not in 0..31).
I think it would be cleaner overall to just drop the superfluous
leading cr0. There are two other confusing usages, in head.S:
I propose that
cmpldi cr0,r5,0 should be cmpldi r5,0
cmpld 0,r6,r5 should be cmpld r6,r5
--linas
Signed-off-by: Linas Vepstas <linas at linas.org>
===== arch/ppc64/kernel/entry.S 1.46 vs edited =====
--- 1.46/arch/ppc64/kernel/entry.S 2004-10-07 16:52:16 -05:00
+++ edited/arch/ppc64/kernel/entry.S 2004-11-08 11:45:59 -06:00
@@ -122,7 +122,7 @@ SystemCall_common:
andi. r11,r10,_TIF_SYSCALL_T_OR_A
bne- syscall_dotrace
syscall_dotrace_cont:
- cmpldi 0,r0,NR_syscalls
+ cmpldi r0,NR_syscalls
bge- syscall_enosys
system_call: /* label this so stack traces look sane */
===== arch/ppc64/kernel/head.S 1.81 vs edited =====
--- 1.81/arch/ppc64/kernel/head.S 2004-10-19 02:18:43 -05:00
+++ edited/arch/ppc64/kernel/head.S 2004-11-08 11:49:04 -06:00
@@ -1303,7 +1303,7 @@ _GLOBAL(__start_initialization_multiplat
/*
* Are we booted from a PROM Of-type client-interface ?
*/
- cmpldi cr0,r5,0
+ cmpldi r5,0
bne .__boot_from_prom /* yes -> prom */
/* Save parameters */
@@ -1439,7 +1439,7 @@ _GLOBAL(copy_and_flush)
dcbst r6,r3 /* write it to memory */
sync
icbi r6,r3 /* flush the icache line */
- cmpld 0,r6,r5
+ cmpld r6,r5
blt 4b
sync
addi r5,r5,8
More information about the Linuxppc64-dev
mailing list