mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] arm asm for vfork
@ 2018-04-30  1:36 patrick.oppenlander
  2018-04-30  1:36 ` patrick.oppenlander
  0 siblings, 1 reply; 12+ messages in thread
From: patrick.oppenlander @ 2018-04-30  1:36 UTC (permalink / raw)
  To: musl

I have an application which requires proper vfork support so I had a go at
adding it to musl.

Hope this is useful,

Patrick




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

* [PATCH] arm asm for vfork
  2018-04-30  1:36 [PATCH] arm asm for vfork patrick.oppenlander
@ 2018-04-30  1:36 ` patrick.oppenlander
  2018-04-30  2:09   ` Rich Felker
  0 siblings, 1 reply; 12+ messages in thread
From: patrick.oppenlander @ 2018-04-30  1:36 UTC (permalink / raw)
  To: musl; +Cc: Patrick Oppenlander

From: Patrick Oppenlander <patrick.oppenlander@gmail.com>

---
 src/process/arm/vfork.s | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 src/process/arm/vfork.s

diff --git a/src/process/arm/vfork.s b/src/process/arm/vfork.s
new file mode 100644
index 00000000..f01fe1d0
--- /dev/null
+++ b/src/process/arm/vfork.s
@@ -0,0 +1,12 @@
+.syntax unified
+.global __vfork
+.weak vfork
+.type __vfork,%function
+.type vfork,%function
+__vfork:
+vfork:
+	mov ip, r7
+	mov r7, 190
+	swi 0
+	mov r7, ip
+	b __syscall_ret
-- 
2.17.0



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

* Re: [PATCH] arm asm for vfork
  2018-04-30  1:36 ` patrick.oppenlander
@ 2018-04-30  2:09   ` Rich Felker
  2018-04-30  2:32     ` Patrick Oppenlander
  0 siblings, 1 reply; 12+ messages in thread
From: Rich Felker @ 2018-04-30  2:09 UTC (permalink / raw)
  To: patrick.oppenlander; +Cc: musl

On Mon, Apr 30, 2018 at 11:36:22AM +1000, patrick.oppenlander@gmail.com wrote:
> From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
> 
> ---
>  src/process/arm/vfork.s | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>  create mode 100644 src/process/arm/vfork.s
> 
> diff --git a/src/process/arm/vfork.s b/src/process/arm/vfork.s
> new file mode 100644
> index 00000000..f01fe1d0
> --- /dev/null
> +++ b/src/process/arm/vfork.s
> @@ -0,0 +1,12 @@
> +.syntax unified
> +.global __vfork
> +.weak vfork
> +.type __vfork,%function
> +.type vfork,%function
> +__vfork:
> +vfork:
> +	mov ip, r7
> +	mov r7, 190
> +	swi 0
> +	mov r7, ip
> +	b __syscall_ret
> -- 
> 2.17.0

Thanks. We'll need this for nommu users; right now that's not so
practical but it will be once we get fdpic added.

I haven't tested, but the patch looks right. Elsewhere we use svc
instead of swi; not sure if that matters.

Rich


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

* Re: [PATCH] arm asm for vfork
  2018-04-30  2:09   ` Rich Felker
@ 2018-04-30  2:32     ` Patrick Oppenlander
  2018-07-18  2:20       ` Patrick Oppenlander
  0 siblings, 1 reply; 12+ messages in thread
From: Patrick Oppenlander @ 2018-04-30  2:32 UTC (permalink / raw)
  To: Rich Felker; +Cc: musl

You're right, it's not particularly pleasant. I have an MIMXRT1050-EVK
board which is what this is for -- it's a 600MHz Cortex-M7 with a
32MiB DRAM for about $80USD. More than enough to run my kernel and a
few other bits and pieces for now even with the overhead of copying
the program text.

Are there plans for fdpic in musl as soon as GCC supports it?

SVC is just a name change from SWI. Old habits die hard I guess. In my
brain SWI makes more sense as it really is an interrupt and not a
call.

I won't bother resubmitting a patch for that though.

Patrick




On Mon, Apr 30, 2018 at 12:09 PM, Rich Felker <dalias@libc.org> wrote:
> On Mon, Apr 30, 2018 at 11:36:22AM +1000, patrick.oppenlander@gmail.com wrote:
>> From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
>>
>> ---
>>  src/process/arm/vfork.s | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>  create mode 100644 src/process/arm/vfork.s
>>
>> diff --git a/src/process/arm/vfork.s b/src/process/arm/vfork.s
>> new file mode 100644
>> index 00000000..f01fe1d0
>> --- /dev/null
>> +++ b/src/process/arm/vfork.s
>> @@ -0,0 +1,12 @@
>> +.syntax unified
>> +.global __vfork
>> +.weak vfork
>> +.type __vfork,%function
>> +.type vfork,%function
>> +__vfork:
>> +vfork:
>> +     mov ip, r7
>> +     mov r7, 190
>> +     swi 0
>> +     mov r7, ip
>> +     b __syscall_ret
>> --
>> 2.17.0
>
> Thanks. We'll need this for nommu users; right now that's not so
> practical but it will be once we get fdpic added.
>
> I haven't tested, but the patch looks right. Elsewhere we use svc
> instead of swi; not sure if that matters.
>
> Rich


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

* Re: [PATCH] arm asm for vfork
  2018-04-30  2:32     ` Patrick Oppenlander
@ 2018-07-18  2:20       ` Patrick Oppenlander
  2018-07-18  2:35         ` Rich Felker
  2018-07-18 13:44         ` Christopher Friedt
  0 siblings, 2 replies; 12+ messages in thread
From: Patrick Oppenlander @ 2018-07-18  2:20 UTC (permalink / raw)
  Cc: musl

[-- Attachment #1: Type: text/plain, Size: 2088 bytes --]

Hi Rich,

I saw another thread where it was mentioned you may be doing a 1.20
release some time soon.

Is there any chance this could get merged in time? I've been running
it for months without any issues now.

Attached is an updated patch using svc rather than swi.

Thanks,

Patrick
On Mon, Apr 30, 2018 at 12:32 PM Patrick Oppenlander
<patrick.oppenlander@gmail.com> wrote:
>
> You're right, it's not particularly pleasant. I have an MIMXRT1050-EVK
> board which is what this is for -- it's a 600MHz Cortex-M7 with a
> 32MiB DRAM for about $80USD. More than enough to run my kernel and a
> few other bits and pieces for now even with the overhead of copying
> the program text.
>
> Are there plans for fdpic in musl as soon as GCC supports it?
>
> SVC is just a name change from SWI. Old habits die hard I guess. In my
> brain SWI makes more sense as it really is an interrupt and not a
> call.
>
> I won't bother resubmitting a patch for that though.
>
> Patrick
>
>
>
>
> On Mon, Apr 30, 2018 at 12:09 PM, Rich Felker <dalias@libc.org> wrote:
> > On Mon, Apr 30, 2018 at 11:36:22AM +1000, patrick.oppenlander@gmail.com wrote:
> >> From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
> >>
> >> ---
> >>  src/process/arm/vfork.s | 12 ++++++++++++
> >>  1 file changed, 12 insertions(+)
> >>  create mode 100644 src/process/arm/vfork.s
> >>
> >> diff --git a/src/process/arm/vfork.s b/src/process/arm/vfork.s
> >> new file mode 100644
> >> index 00000000..f01fe1d0
> >> --- /dev/null
> >> +++ b/src/process/arm/vfork.s
> >> @@ -0,0 +1,12 @@
> >> +.syntax unified
> >> +.global __vfork
> >> +.weak vfork
> >> +.type __vfork,%function
> >> +.type vfork,%function
> >> +__vfork:
> >> +vfork:
> >> +     mov ip, r7
> >> +     mov r7, 190
> >> +     swi 0
> >> +     mov r7, ip
> >> +     b __syscall_ret
> >> --
> >> 2.17.0
> >
> > Thanks. We'll need this for nommu users; right now that's not so
> > practical but it will be once we get fdpic added.
> >
> > I haven't tested, but the patch looks right. Elsewhere we use svc
> > instead of swi; not sure if that matters.
> >
> > Rich

[-- Attachment #2: 0001-arm-asm-for-vfork.patch --]
[-- Type: text/x-patch, Size: 690 bytes --]

From b0e59bb68cb102fa8d397628a3248a2049150d74 Mon Sep 17 00:00:00 2001
From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
Date: Tue, 10 Apr 2018 11:01:25 +1000
Subject: [PATCH] arm asm for vfork

---
 src/process/arm/vfork.s | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 src/process/arm/vfork.s

diff --git a/src/process/arm/vfork.s b/src/process/arm/vfork.s
new file mode 100644
index 00000000..db4e7b43
--- /dev/null
+++ b/src/process/arm/vfork.s
@@ -0,0 +1,12 @@
+.syntax unified
+.global __vfork
+.weak vfork
+.type __vfork,%function
+.type vfork,%function
+__vfork:
+vfork:
+	mov ip, r7
+	mov r7, 190
+	svc 0
+	mov r7, ip
+	b __syscall_ret
-- 
2.18.0


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

* Re: [PATCH] arm asm for vfork
  2018-07-18  2:20       ` Patrick Oppenlander
@ 2018-07-18  2:35         ` Rich Felker
  2018-07-18  4:14           ` Patrick Oppenlander
  2018-07-18 13:44         ` Christopher Friedt
  1 sibling, 1 reply; 12+ messages in thread
From: Rich Felker @ 2018-07-18  2:35 UTC (permalink / raw)
  To: musl

On Wed, Jul 18, 2018 at 12:20:00PM +1000, Patrick Oppenlander wrote:
> Hi Rich,
> 
> I saw another thread where it was mentioned you may be doing a 1.20
> release some time soon.
> 
> Is there any chance this could get merged in time? I've been running
> it for months without any issues now.
> 
> Attached is an updated patch using svc rather than swi.

Thanks. One detail:

> diff --git a/src/process/arm/vfork.s b/src/process/arm/vfork.s
> new file mode 100644
> index 00000000..db4e7b43
> --- /dev/null
> +++ b/src/process/arm/vfork.s
> @@ -0,0 +1,12 @@
> +.syntax unified
> +.global __vfork
> +.weak vfork
> +.type __vfork,%function
> +.type vfork,%function
> +__vfork:
> +vfork:
> +	mov ip, r7
> +	mov r7, 190
> +	svc 0
> +	mov r7, ip
> +	b __syscall_ret
> -- 

I think there needs to be a ".hidden __syscall_ret" (by de facto musl
convention, on the line before it's used) here. It *might* be ok
having the reference omit .hidden as long as the definition is hidden
at link-time (which it is), but I'm not convinced the tooling won't
complain about a branch to a destination that's not known to be
link-time constant displacement.

If you have no other changes or comments I'm happy to just --amend
that into the patch when I commit it.

Rich


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

* Re: [PATCH] arm asm for vfork
  2018-07-18  2:35         ` Rich Felker
@ 2018-07-18  4:14           ` Patrick Oppenlander
  2018-09-06 15:02             ` Patrick Oppenlander
  0 siblings, 1 reply; 12+ messages in thread
From: Patrick Oppenlander @ 2018-07-18  4:14 UTC (permalink / raw)
  To: musl

On Wed, Jul 18, 2018 at 12:35 PM Rich Felker <dalias@libc.org> wrote:
> I think there needs to be a ".hidden __syscall_ret" (by de facto musl
> convention, on the line before it's used) here. It *might* be ok
> having the reference omit .hidden as long as the definition is hidden
> at link-time (which it is), but I'm not convinced the tooling won't
> complain about a branch to a destination that's not known to be
> link-time constant displacement.

If that's the case  i386, s390x, x86_64 and x32 may need attention in
vfork.s as they're doing it the same way.

> If you have no other changes or comments I'm happy to just --amend
> that into the patch when I commit it.

No problem with that at all.

Thanks,

Patrick


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

* Re: [PATCH] arm asm for vfork
  2018-07-18  2:20       ` Patrick Oppenlander
  2018-07-18  2:35         ` Rich Felker
@ 2018-07-18 13:44         ` Christopher Friedt
  1 sibling, 0 replies; 12+ messages in thread
From: Christopher Friedt @ 2018-07-18 13:44 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 116 bytes --]

I'm actually excited for this, having done something similar with another
embedded libc for cortex-m3 a while back.

[-- Attachment #2: Type: text/html, Size: 145 bytes --]

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

* Re: [PATCH] arm asm for vfork
  2018-07-18  4:14           ` Patrick Oppenlander
@ 2018-09-06 15:02             ` Patrick Oppenlander
  2018-09-06 15:19               ` Rich Felker
  0 siblings, 1 reply; 12+ messages in thread
From: Patrick Oppenlander @ 2018-09-06 15:02 UTC (permalink / raw)
  To: musl

On Wed, Jul 18, 2018 at 6:14 AM Patrick Oppenlander
<patrick.oppenlander@gmail.com> wrote:
>
> On Wed, Jul 18, 2018 at 12:35 PM Rich Felker <dalias@libc.org> wrote:
> > I think there needs to be a ".hidden __syscall_ret" (by de facto musl
> > convention, on the line before it's used) here. It *might* be ok
> > having the reference omit .hidden as long as the definition is hidden
> > at link-time (which it is), but I'm not convinced the tooling won't
> > complain about a branch to a destination that's not known to be
> > link-time constant displacement.
>
> If that's the case  i386, s390x, x86_64 and x32 may need attention in
> vfork.s as they're doing it the same way.
>
> > If you have no other changes or comments I'm happy to just --amend
> > that into the patch when I commit it.
>
> No problem with that at all.
>

I guess this one slipped through the cracks for 1.20.

Any chance of you taking a look soon?

Thanks,

Patrick


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

* Re: [PATCH] arm asm for vfork
  2018-09-06 15:02             ` Patrick Oppenlander
@ 2018-09-06 15:19               ` Rich Felker
  2018-09-07  2:05                 ` Rich Felker
  0 siblings, 1 reply; 12+ messages in thread
From: Rich Felker @ 2018-09-06 15:19 UTC (permalink / raw)
  To: musl

On Thu, Sep 06, 2018 at 05:02:14PM +0200, Patrick Oppenlander wrote:
> On Wed, Jul 18, 2018 at 6:14 AM Patrick Oppenlander
> <patrick.oppenlander@gmail.com> wrote:
> >
> > On Wed, Jul 18, 2018 at 12:35 PM Rich Felker <dalias@libc.org> wrote:
> > > I think there needs to be a ".hidden __syscall_ret" (by de facto musl
> > > convention, on the line before it's used) here. It *might* be ok
> > > having the reference omit .hidden as long as the definition is hidden
> > > at link-time (which it is), but I'm not convinced the tooling won't
> > > complain about a branch to a destination that's not known to be
> > > link-time constant displacement.
> >
> > If that's the case  i386, s390x, x86_64 and x32 may need attention in
> > vfork.s as they're doing it the same way.
> >
> > > If you have no other changes or comments I'm happy to just --amend
> > > that into the patch when I commit it.
> >
> > No problem with that at all.
> >
> 
> I guess this one slipped through the cracks for 1.20.
> 
> Any chance of you taking a look soon?

Indeed! Sorry about that. I'm in the middle of a big shuffle of messy
stuff in the source tree right now, but ping me again soon if you
don't see action on it in the next couple days.

Rich


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

* Re: [PATCH] arm asm for vfork
  2018-09-06 15:19               ` Rich Felker
@ 2018-09-07  2:05                 ` Rich Felker
  2018-09-07  6:29                   ` Patrick Oppenlander
  0 siblings, 1 reply; 12+ messages in thread
From: Rich Felker @ 2018-09-07  2:05 UTC (permalink / raw)
  To: musl

On Thu, Sep 06, 2018 at 11:19:14AM -0400, Rich Felker wrote:
> On Thu, Sep 06, 2018 at 05:02:14PM +0200, Patrick Oppenlander wrote:
> > On Wed, Jul 18, 2018 at 6:14 AM Patrick Oppenlander
> > <patrick.oppenlander@gmail.com> wrote:
> > >
> > > On Wed, Jul 18, 2018 at 12:35 PM Rich Felker <dalias@libc.org> wrote:
> > > > I think there needs to be a ".hidden __syscall_ret" (by de facto musl
> > > > convention, on the line before it's used) here. It *might* be ok
> > > > having the reference omit .hidden as long as the definition is hidden
> > > > at link-time (which it is), but I'm not convinced the tooling won't
> > > > complain about a branch to a destination that's not known to be
> > > > link-time constant displacement.
> > >
> > > If that's the case  i386, s390x, x86_64 and x32 may need attention in
> > > vfork.s as they're doing it the same way.
> > >
> > > > If you have no other changes or comments I'm happy to just --amend
> > > > that into the patch when I commit it.
> > >
> > > No problem with that at all.
> > >
> > 
> > I guess this one slipped through the cracks for 1.20.
> > 
> > Any chance of you taking a look soon?
> 
> Indeed! Sorry about that. I'm in the middle of a big shuffle of messy
> stuff in the source tree right now, but ping me again soon if you
> don't see action on it in the next couple days.

I have it queued in my tree now, along with fixing .hidden for the
other archs and the cleanup work I'm doing. Depending on how the rest
of this goes there might still be some delay seeing it, but the risk
of it being forgotten is basically zero now. :-)

Rich


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

* Re: [PATCH] arm asm for vfork
  2018-09-07  2:05                 ` Rich Felker
@ 2018-09-07  6:29                   ` Patrick Oppenlander
  0 siblings, 0 replies; 12+ messages in thread
From: Patrick Oppenlander @ 2018-09-07  6:29 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1895 bytes --]

On Fri., 7 Sep. 2018, 04:06 Rich Felker, <dalias@libc.org> wrote:

> On Thu, Sep 06, 2018 at 11:19:14AM -0400, Rich Felker wrote:
> > On Thu, Sep 06, 2018 at 05:02:14PM +0200, Patrick Oppenlander wrote:
> > > On Wed, Jul 18, 2018 at 6:14 AM Patrick Oppenlander
> > > <patrick.oppenlander@gmail.com> wrote:
> > > >
> > > > On Wed, Jul 18, 2018 at 12:35 PM Rich Felker <dalias@libc.org>
> wrote:
> > > > > I think there needs to be a ".hidden __syscall_ret" (by de facto
> musl
> > > > > convention, on the line before it's used) here. It *might* be ok
> > > > > having the reference omit .hidden as long as the definition is
> hidden
> > > > > at link-time (which it is), but I'm not convinced the tooling won't
> > > > > complain about a branch to a destination that's not known to be
> > > > > link-time constant displacement.
> > > >
> > > > If that's the case  i386, s390x, x86_64 and x32 may need attention in
> > > > vfork.s as they're doing it the same way.
> > > >
> > > > > If you have no other changes or comments I'm happy to just --amend
> > > > > that into the patch when I commit it.
> > > >
> > > > No problem with that at all.
> > > >
> > >
> > > I guess this one slipped through the cracks for 1.20.
> > >
> > > Any chance of you taking a look soon?
> >
> > Indeed! Sorry about that. I'm in the middle of a big shuffle of messy
> > stuff in the source tree right now, but ping me again soon if you
> > don't see action on it in the next couple days.
>
> I have it queued in my tree now, along with fixing .hidden for the
> other archs and the cleanup work I'm doing. Depending on how the rest
> of this goes there might still be some delay seeing it, but the risk
> of it being forgotten is basically zero now. :-)
>

Perfect, thanks!

I'm not in a hurry for it (away from dayjob for a month traveling) just
wanted to send a gentle reminder so that it wasn't forgotten.

Patrick

[-- Attachment #2: Type: text/html, Size: 2829 bytes --]

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

end of thread, other threads:[~2018-09-07  6:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-30  1:36 [PATCH] arm asm for vfork patrick.oppenlander
2018-04-30  1:36 ` patrick.oppenlander
2018-04-30  2:09   ` Rich Felker
2018-04-30  2:32     ` Patrick Oppenlander
2018-07-18  2:20       ` Patrick Oppenlander
2018-07-18  2:35         ` Rich Felker
2018-07-18  4:14           ` Patrick Oppenlander
2018-09-06 15:02             ` Patrick Oppenlander
2018-09-06 15:19               ` Rich Felker
2018-09-07  2:05                 ` Rich Felker
2018-09-07  6:29                   ` Patrick Oppenlander
2018-07-18 13:44         ` Christopher Friedt

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).