Skip to contentSkip to conversation

m68knommu : Fix strace support for 68328/68360

PATCH In review Philippe De Muyter 3 participants 4 messages Aug 17, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m68knommu : Fix strace support for 68328/68360

strace is enabled using the flags' field of the thread_info' struct. 68360 version of entry.S did test a wrong bit in a wrong structure (task_struct).
68328 version of entry.S did test the right bit in the right structure, but wrongly, because the `flags' field is 32 bit wide, while the used assembler insn (btst) only accesses a 8 bit byte in memory.

Fix both using code already used in the coldfire version of entry.S Also fix some spaces/tabs issues.

---
 arch/m68knommu/platform/68328/entry.S |   16 ++++++++--------
 arch/m68knommu/platform/68360/entry.S |    7 ++++++-
 2 files changed, 14 insertions(+), 9 deletions(-)
arch/m68knommu/platform/68328/entry.S +8 -8
index 9d80d2c..74229f7 100644
@@ -43,7 +43,7 @@ badsys:
 	jra	ret_from_exception
 
 do_trace:
-	movel	#-ENOSYS,%sp@(PT_OFF_D0)	/* needed for strace*/
+	movel	#-ENOSYS,%sp@(PT_OFF_D0) /* needed for strace*/
 	subql	#4,%sp
 	SAVE_SWITCH_STACK
 	jbsr	syscall_trace
@@ -57,7 +57,7 @@ do_trace:
 	lea	sys_call_table, %a0
 	jbsr	%a0@(%d1)
 
-1:	movel	%d0,%sp@(PT_OFF_D0)		/* save the return value */
+1:	movel	%d0,%sp@(PT_OFF_D0)	/* save the return value */
 	subql	#4,%sp			/* dummy return address */
 	SAVE_SWITCH_STACK
 	jbsr	syscall_trace
@@ -71,16 +71,16 @@ ENTRY(system_call)
 	SAVE_ALL
 
 	/* save top of frame*/
-	pea     %sp@
-	jbsr    set_esp0
-	addql   #4,%sp
+	pea	%sp@
+	jbsr	set_esp0
+	addql	#4,%sp
 
 	movel	%sp@(PT_OFF_ORIG_D0),%d0
 
 	movel	%sp,%d1			/* get thread_info pointer */
 	andl	#-THREAD_SIZE,%d1
 	movel	%d1,%a2
-	btst    #TIF_SYSCALL_TRACE,%a2@(TI_FLAGS)
+	btst	#(TIF_SYSCALL_TRACE%8),%a2@(TI_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
 	jne	do_trace
 	cmpl	#NR_syscalls,%d0
 	jcc	badsys
@@ -88,10 +88,10 @@ ENTRY(system_call)
 	lea	sys_call_table,%a0
 	movel	%a0@(%d0), %a0
 	jbsr	%a0@
-	movel	%d0,%sp@(PT_OFF_D0)		/* save the return value*/
+	movel	%d0,%sp@(PT_OFF_D0)	/* save the return value*/
 
 ret_from_exception:
-	btst	#5,%sp@(PT_OFF_SR)		/* check if returning to kernel*/
+	btst	#5,%sp@(PT_OFF_SR)	/* check if returning to kernel*/
 	jeq	Luser_return		/* if so, skip resched, signals*/
 
 Lkernel_return:
arch/m68knommu/platform/68360/entry.S +6 -1
index 6d3460a..d5ad408 100644
@@ -71,7 +71,12 @@ ENTRY(system_call)
 	jbsr	set_esp0
 	addql	#4,%sp
 
-	btst	#PF_TRACESYS_BIT,%a2@(TASK_FLAGS+PF_TRACESYS_OFF)
+	movel	%sp@(PT_OFF_ORIG_D0),%d0
+
+	movel	%sp,%d1			/* get thread_info pointer */
+	andl	#-THREAD_SIZE,%d1
+	movel	%d1,%a2
+	btst	#(TIF_SYSCALL_TRACE%8),%a2@(TI_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
 	jne	do_trace
 	cmpl	#NR_syscalls,%d0
 	jcc	badsys
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 16 lines · Philippe De Muyter

 do_trace:
-       movel   #-ENOSYS,%sp@(PT_OFF_D0)        /* needed for strace*/
+       movel   #-ENOSYS,%sp@(PT_OFF_D0) /* needed for strace*/ subql   #4,%sp

-1:     movel   %d0,%sp@(PT_OFF_D0)             /* save the return value */ +1:     movel   %d0,%sp@(PT_OFF_D0)     /* save the return value */ subql   #4,%sp                  /* dummy return address */ /* save top of frame*/
-       pea     %sp@
-       jbsr    set_esp0
-       addql   #4,%sp
+       pea     %sp@
+       jbsr    set_esp0
+       addql   #4,%sp
jbsr %a0@

arch/m68knommu/platform/68328/entry.S ENTRY(system_call) · line 95

Quoted 7 lines
arch/m68knommu/platform/68328/entry.S +2 -2
-       movel   %d0,%sp@(PT_OFF_D0)             /* save the return value*/
+       movel   %d0,%sp@(PT_OFF_D0)     /* save the return value*/
 
 ret_from_exception:
-       btst    #5,%sp@(PT_OFF_SR)              /* check if returning to kernel*/
+       btst    #5,%sp@(PT_OFF_SR)      /* check if returning to kernel*/
       jeq     Luser_return            /* if so, skip resched, signals*/

unless i'm missing something, you're only changing whitespace here. and these account for more than half the patch. please keep whitespace changes separate from real changes.
-mike

#2 lore raw
Quoted 2 lines · Mike Frysinger

unless i'm missing something, you're only changing whitespace here.

That's true,

Quoted 2 lines

and these account for more than half the patch. please keep whitespace changes separate from real changes.

but that makes comparing the resulting files 68328/entry.S and 68360/entry.S easier.

Philippe

Signature · 2 lines
Philippe De Muyter  phdm at macqel dot be  Tel +32 27029044
Macq Electronique SA  rue de l'Aeronef 2  B-1140 Bruxelles  Fax +32 27029077
#3 lore raw
Quoted 11 lines · Philippe De Muyter
Quoted 2 lines · Mike Frysinger

unless i'm missing something, you're only changing whitespace here.

That's true,

Quoted 2 lines

and these account for more than half the patch.  please keep whitespace changes separate from real changes.

but that makes comparing the resulting files 68328/entry.S and 68360/entry.S easier.

Hence please create two patches:
- The first one to fix up the whitespace,
- The second one to fix the bugs.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds