Files
jerryscript/jerry-libc/target/posix/jerry-asm.S
T
Akos Kiss 4b0b8f3d4f Merge darwin and linux jerry-libc targets into a single posix target
The two target implementations are very close clones of each other.
The only known differences are the following:

* The asm component of the linux target has `.type` and `.size`
  declarations for the functions defined therein, while the darwin
  target doesn't support those.

* Linux uses `__NR_xxx` mnemonics for syscall numbers, while darwin
  uses `SYS_xxx` format.

* Darwin does not have `exit_group` syscall but `exit` only.

* The linux target has a commented out `jrt_set_mem_limits` fuction
  declaration at the end of the C source. (Based on its name, this
  function does not really belong here.)

Simple preprocessor macros can unify the first three differences.
While for the sake of legacy, we can keep the fourth commented-out
code in the code base; it might turn out to be useful elsewhere in
the future. Since it remains commented out it wont cause any
problems on any OSs.

So, this patch gets rid of a lot of duplication.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-15 10:20:27 +02:00

77 lines
1.3 KiB
ArmAsm

#if defined (__TARGET_HOST_x64)
#include "arch/x86-64.h"
#elif defined (__TARGET_HOST_x86)
#include "arch/x86-32.h"
#elif defined (__TARGET_HOST_ARMv7)
#include "arch/arm-v7.h"
#else
#error "Unsupported architecture"
#endif /* !__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7 */
#if defined (__linux__)
.macro func _name
.global \_name
.type \_name, %function
\_name:
.endm
.macro endfunc _name
.size \_name, .-\_name
.endm
#elif defined (__APPLE__) && defined (__MACH__)
.macro func _name
.global \_name
\_name:
.endm
.macro endfunc _name
.endm
#else
#error "Unsupported OS"
#endif /* !__linux && !(__APPLE__ && __MACH__) */
func _start
_START
endfunc _start
func syscall_0
SYSCALL_0
endfunc syscall_0
func syscall_1
SYSCALL_1
endfunc syscall_1
func syscall_2
SYSCALL_2
endfunc syscall_2
func syscall_3
SYSCALL_3
endfunc syscall_3
/**
* setjmp (jmp_buf env)
*
* See also:
* longjmp
*
* @return 0 - if returns from direct call,
* nonzero - if returns after longjmp.
*/
func setjmp
_SETJMP
endfunc setjmp
/**
* longjmp (jmp_buf env, int val)
*
* Note:
* if val is not 0, then it would be returned from setjmp,
* otherwise - 0 would be returned.
*
* See also:
* setjmp
*/
func longjmp
_LONGJMP
endfunc longjmp