diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-03-26 13:40:36 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-03-26 13:40:36 +0000 |
commit | efce79f09ae6daa77cd322df0d532beec3f445f5 (patch) | |
tree | ae936850c5671b8bea0abf0d33bf2196f7abc796 /libc/sysdeps/linux/arm/vfork.S | |
parent | 17e961d9c708ab202760ce830f8efe73e91bb129 (diff) |
Paul Brook writes:
The attached patch adds support for compiling arm uClibc as pure Thumb code.
This is needed because some recent ARM codes do not implement traditional ARM
mode. Specifically:
* Cortex-M1 - An extremely minimal FPGA based core that only implements
Thumb-1 (aka ARMv6-M).
* Cortex-M3 - A Thumb-2 only ARMv7-M core.
Most of uClibc already builds in Thumb mode, all that is left are a handful of
assembly bits.
Tested on arm-uclinuxeabi.
Diffstat (limited to 'libc/sysdeps/linux/arm/vfork.S')
-rw-r--r-- | libc/sysdeps/linux/arm/vfork.S | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S index e9f63d46e..42595b026 100644 --- a/libc/sysdeps/linux/arm/vfork.S +++ b/libc/sysdeps/linux/arm/vfork.S @@ -6,6 +6,7 @@ */ #include <features.h> +#include <bits/arm_asm.h> #define _ERRNO_H #include <bits/errno.h> @@ -18,11 +19,47 @@ .type __vfork,%function .align 4 +#if defined(__thumb__) && !defined(__thumb2__) +.thumb_func +__vfork: +#ifdef __NR_vfork + DO_CALL (vfork) + ldr r1, =0xfffff000 + cmp r0, r1 + bcs 1f + bx lr +1: + + /* Check if vfork even exists. */ + ldr r1, =-ENOSYS + cmp r0, r1 + bne __error + + /* If we don't have vfork, use fork. */ + DO_CALL (fork) + ldr r1, =0xfffff000 + cmp r0, r1 + + /* Syscall worked. Return to child/parent */ + bcs 1f + bx lr +1: + +__error: + push {r3, lr} + bl __syscall_error + POP_RET +.pool + +#endif + +#else __vfork: #ifdef __NR_vfork DO_CALL (vfork) cmn r0, #4096 + IT(t, cc) #if defined(__USE_BX__) bxcc lr #else @@ -40,6 +77,7 @@ __vfork: cmn r0, #4096 /* Syscall worked. Return to child/parent */ + IT(t, cc) #if defined(__USE_BX__) bxcc lr #else @@ -48,8 +86,10 @@ __vfork: __error: b __syscall_error +#endif .size __vfork,.-__vfork + weak_alias(__vfork,vfork) libc_hidden_weak(vfork) #endif |