Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Feb 2010 11:31:36 -0800 (PST)
From:      Neelkanth Natu <neelnatu@yahoo.com>
To:        Rui Paulo <rpaulo@freebsd.org>, "C. Jayachandran" <c.jayachandran@gmail.com>
Cc:        freebsd-mips@freebsd.org
Subject:   Re: mips ptrace.S fix
Message-ID:  <296949.49663.qm@web34402.mail.mud.yahoo.com>
In-Reply-To: <98a59be81002030227u43b0e601q2eebb383debc230b@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi JC,

Your patch looks good. I have a few comments though. See inline:

Index: lib/libc/mips/sys/ptrace.S
===================================================================
--- lib/libc/mips/sys/ptrace.S	(revision 203379)
+++ lib/libc/mips/sys/ptrace.S	(working copy)
@@ -42,14 +42,26 @@
 #endif /* LIBC_SCCS and not lint */
 
 LEAF(ptrace)
+	.frame	sp,40,ra

>> space missing after the ','

+	.mask	0x80000000, -8
 #ifdef __ABICALLS__
 	.set    noreorder
 	.cpload t9
 	.set    reorder
 #endif
+	subu	sp, sp, 40
+	sw	ra,  32(sp)
+#ifdef __ABICALLS__
+	.cprestore 16
+#endif
 	la	t9, _C_LABEL(__error)	# locate address of errno
-	jalr	t9
+	jalr	t9	

>> this change is not required - the newly added line has a tab at the end.

+#ifdef __ABICALLS__
+	lw	gp, 16(sp)
+#endif

>> this is redundant - the assembler will generate exactly the same line of
>> code due to the .cprestore directive above.

 	sw	zero, 0(v0)
+	lw	ra, 32(sp)
+	addu	sp, sp, 40
 	li	v0, SYS_ptrace
 	syscall
 	bne	a3, zero, 1f

best
Neel

--- On Wed, 2/3/10, C. Jayachandran <c.jayachandran@gmail.com> wrote:

> From: C. Jayachandran <c.jayachandran@gmail.com>
> Subject: Re: mips ptrace.S fix
> To: "Rui Paulo" <rpaulo@freebsd.org>
> Cc: freebsd-mips@freebsd.org
> Date: Wednesday, February 3, 2010, 2:27 AM
> On Wed, Feb 3, 2010 at 3:49 PM, Rui
> Paulo <rpaulo@freebsd.org>
> wrote:
> > On 3 Feb 2010, at 03:06, C. Jayachandran wrote:
> >
> >> The ptrace system call implementation seems to
> have a bug, we need to
> >> save ra and gp before calling the __error, and
> that will need a stack
> >> frame.
> >>
> >> I've attached a patch that should fix this for o32
> ABI - but it really
> >> should be written with ABI-independent macros, any
> clue on how to do
> >> this which will take care of n32/64 too will be
> helpful.
> >>
> >> I also have some initial patches for making gdb
> work on MIPS. . That
> >> patch is also attached, but it is work in
> progress, only the static
> >> executables work now.
> >
> > I think you forgot the attachments or they were
> stripped out.
> 
> I think the attachments were stripped out, may be by the
> mailing list
> itself.  I had them as attachments since I was worried
> that gmail will
> damage white-space if I did it inline.
> 
> Is there a standard way of submitting patches to the list?
> For now I
> have the patches at:
>  http://sites.google.com/site/cjayachandran/files (the
> files are
> ptrace.S.patch and gdb.patch)
> 
> Thanks,
> JC.
> _______________________________________________
> freebsd-mips@freebsd.org
> mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-mips
> To unsubscribe, send any mail to "freebsd-mips-unsubscribe@freebsd.org"
> 


      



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?296949.49663.qm>