All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] [PATCH] vfork() for parisc
@ 2006-07-24  3:14 Kyle McMartin
       [not found] ` <44C693EA.5080704@zytor.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle McMartin @ 2006-07-24  3:14 UTC (permalink / raw)
  To: klibc; +Cc: parisc-linux

Implement "pid_t vfork(void)" for parisc.

Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
---

Ugh. vfork() me harder.

 Kbuild  |    2 +-
 vfork.S |   31 +++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/usr/klibc/arch/parisc/Kbuild b/usr/klibc/arch/parisc/Kbuild
index d57a873..57ca5c2 100644
--- a/usr/klibc/arch/parisc/Kbuild
+++ b/usr/klibc/arch/parisc/Kbuild
@@ -2,7 +2,7 @@ #
 # klibc files for parisc
 #
 
-klib-y := setjmp.o syscall.o
+klib-y := setjmp.o syscall.o vfork.o
 
 always  := crt0.o
 targets := crt0.o
diff --git a/usr/klibc/arch/parisc/vfork.S b/usr/klibc/arch/parisc/vfork.S
new file mode 100644
index 0000000..97ebc8f
--- /dev/null
+++ b/usr/klibc/arch/parisc/vfork.S
@@ -0,0 +1,31 @@
+/*
+ * arch/parisc/vfork.S, "vfork() me harder. ugh." -- kyle
+ *
+ * %r20 contains the system call number, %rp contains whence we came,
+ * %rp is saved and restored across the syscall, thankfully.
+ *
+ */
+
+	.text
+	.align 64				; cache-width aligned
+	.globl	vfork
+	.type	vfork,@function
+vfork:
+	/* pid_t vfork(void) */
+	ble		0x100(%sr2, %r0)	; jump to gateway page
+	nop
+
+	ldi		-0x1000,%r19		; %r19 = -4096
+	sub		%r0,%ret0,%r22		; %r22 = -%ret0
+	cmpb,>>=,n	%r19,%ret0,1f		; if %ret0 >= -4096UL
+	ldi		-1,%ret0		; nullified on taken forward
+
+	/* store %r22 to errno... */
+	ldil		L%errno,%r1
+	ldo		R%errno(%r1),%r1
+	stw		%r22,0(%r1)
+1:
+	bv		%r0(%rp)		; jump back
+	nop
+
+	.size vfork,.-vfork
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [parisc-linux] Re: [klibc] [PATCH] vfork() for parisc
       [not found]   ` <20060725221524.GA5625@athena.road.mcmartin.ca>
@ 2006-07-25 22:28     ` H. Peter Anvin
  0 siblings, 0 replies; 2+ messages in thread
From: H. Peter Anvin @ 2006-07-25 22:28 UTC (permalink / raw)
  To: Kyle McMartin; +Cc: klibc, parisc-linux

Kyle McMartin wrote:
> On Tue, Jul 25, 2006 at 02:58:02PM -0700, H. Peter Anvin wrote:
>> Kyle McMartin wrote:
>>> Implement "pid_t vfork(void)" for parisc.
>>>
>> Dumb question... where does %r20 get set?  This isn't invoked by a 
>> system call stub; it's the entire function.
>>
> 
> Oh. Nowhere then. We can set it in the branch delay slot.
> 

Cool.  Could you do a "make test" and run usr/klibc/tests/vfork to verify?

(For completeness sake: klibc supports generating stubs for alternate 
system call conventions by using the following syntax in SYSCALLS.def:

returntype syscall@convention(args...);

The string "convention" gets passed to sysstub.ph; on most architectures 
it simply replaces the string "common" in "__syscall_common".

However, there isn't exactly any point to do that for single-shot system 
  call conventions, like vfork() and pipe() on many platforms.

	-hpa
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-07-25 22:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-24  3:14 [parisc-linux] [PATCH] vfork() for parisc Kyle McMartin
     [not found] ` <44C693EA.5080704@zytor.com>
     [not found]   ` <20060725221524.GA5625@athena.road.mcmartin.ca>
2006-07-25 22:28     ` [parisc-linux] Re: [klibc] " H. Peter Anvin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.