Move architecture-depedendent libc internal headers to jerry-libc/arch folder.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
@@ -1,92 +0,0 @@
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ASM_ARM_H
|
||||
#define ASM_ARM_H
|
||||
|
||||
/*
|
||||
* mov syscall_no (%r0) -> %r7
|
||||
* svc #0
|
||||
*/
|
||||
#define SYSCALL_0 \
|
||||
push {r4-r12, lr}; \
|
||||
\
|
||||
mov r7, r0; \
|
||||
\
|
||||
svc #0; \
|
||||
\
|
||||
pop {r4-r12, pc};
|
||||
|
||||
/*
|
||||
* mov syscall_no (%r0) -> %r7
|
||||
* mov arg1 (%r1) -> %r0
|
||||
* svc #0
|
||||
*/
|
||||
#define SYSCALL_1 \
|
||||
push {r4-r12, lr}; \
|
||||
\
|
||||
mov r7, r0; \
|
||||
mov r0, r1; \
|
||||
\
|
||||
svc #0; \
|
||||
\
|
||||
pop {r4-r12, pc};
|
||||
|
||||
/*
|
||||
* mov syscall_no (%r0) -> %r7
|
||||
* mov arg1 (%r1) -> %r0
|
||||
* mov arg2 (%r2) -> %r1
|
||||
* svc #0
|
||||
*/
|
||||
#define SYSCALL_2 \
|
||||
push {r4-r12, lr}; \
|
||||
\
|
||||
mov r7, r0; \
|
||||
mov r0, r1; \
|
||||
mov r1, r2; \
|
||||
\
|
||||
svc #0; \
|
||||
\
|
||||
pop {r4-r12, pc};
|
||||
|
||||
/*
|
||||
* mov syscall_no (%r0) -> %r7
|
||||
* mov arg1 (%r1) -> %r0
|
||||
* mov arg2 (%r2) -> %r1
|
||||
* mov arg3 (%r3) -> %r2
|
||||
* svc #0
|
||||
*/
|
||||
#define SYSCALL_3 \
|
||||
push {r4-r12, lr}; \
|
||||
\
|
||||
mov r7, r0; \
|
||||
mov r0, r1; \
|
||||
mov r1, r2; \
|
||||
mov r2, r3; \
|
||||
\
|
||||
svc #0; \
|
||||
\
|
||||
pop {r4-r12, pc};
|
||||
|
||||
#define _START \
|
||||
ldr r0, [sp, #0]; \
|
||||
add r1, sp, #4; \
|
||||
bl main; \
|
||||
\
|
||||
bl exit; \
|
||||
1: \
|
||||
b 1b
|
||||
|
||||
#endif /* !ASM_ARM_H */
|
||||
@@ -1,78 +0,0 @@
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ASM_X64_H
|
||||
#define ASM_X64_H
|
||||
|
||||
/*
|
||||
* mov syscall_no (%rdi) -> %rax
|
||||
* syscall
|
||||
*/
|
||||
#define SYSCALL_0 \
|
||||
mov %rdi, %rax; \
|
||||
syscall; \
|
||||
ret;
|
||||
|
||||
/*
|
||||
* mov syscall_no (%rdi) -> %rax
|
||||
* mov arg1 (%rsi) -> %rdi
|
||||
* syscall
|
||||
*/
|
||||
#define SYSCALL_1 \
|
||||
mov %rdi, %rax; \
|
||||
mov %rsi, %rdi; \
|
||||
syscall; \
|
||||
ret;
|
||||
|
||||
/*
|
||||
* mov syscall_no (%rdi) -> %rax
|
||||
* mov arg1 (%rsi) -> %rdi
|
||||
* mov arg2 (%rdx) -> %rsi
|
||||
* syscall
|
||||
*/
|
||||
#define SYSCALL_2 \
|
||||
mov %rdi, %rax; \
|
||||
mov %rsi, %rdi; \
|
||||
mov %rdx, %rsi; \
|
||||
syscall; \
|
||||
ret;
|
||||
|
||||
/*
|
||||
* mov syscall_no (%rdi) -> %rax
|
||||
* mov arg1 (%rsi) -> %rdi
|
||||
* mov arg2 (%rdx) -> %rsi
|
||||
* mov arg3 (%rcx) -> %rdx
|
||||
* syscall
|
||||
*/
|
||||
#define SYSCALL_3 \
|
||||
mov %rdi, %rax; \
|
||||
mov %rsi, %rdi; \
|
||||
mov %rdx, %rsi; \
|
||||
mov %rcx, %rdx; \
|
||||
syscall; \
|
||||
ret;
|
||||
|
||||
#define _START \
|
||||
mov (%rsp), %rdi; \
|
||||
mov %rsp, %rsi; \
|
||||
add $8, %rsi; \
|
||||
callq main; \
|
||||
\
|
||||
mov %rax, %rdi; \
|
||||
callq exit; \
|
||||
1: \
|
||||
jmp 1b
|
||||
|
||||
#endif /* !ASM_X64_H */
|
||||
@@ -1,109 +0,0 @@
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ASM_X86_H
|
||||
#define ASM_X86_H
|
||||
|
||||
/*
|
||||
* mov syscall_no -> %eax
|
||||
* int $0x80
|
||||
* mov %eax -> ret
|
||||
*/
|
||||
#define SYSCALL_0 \
|
||||
push %edi; \
|
||||
push %esi; \
|
||||
push %ebx; \
|
||||
mov 0x10 (%esp), %eax; \
|
||||
int $0x80; \
|
||||
pop %ebx; \
|
||||
pop %esi; \
|
||||
pop %edi; \
|
||||
ret;
|
||||
|
||||
/*
|
||||
* mov syscall_no -> %eax
|
||||
* mov arg1 -> %ebx
|
||||
* int $0x80
|
||||
* mov %eax -> ret
|
||||
*/
|
||||
#define SYSCALL_1 \
|
||||
push %edi; \
|
||||
push %esi; \
|
||||
push %ebx; \
|
||||
mov 0x10 (%esp), %eax; \
|
||||
mov 0x14 (%esp), %ebx; \
|
||||
int $0x80; \
|
||||
pop %ebx; \
|
||||
pop %esi; \
|
||||
pop %edi; \
|
||||
ret;
|
||||
|
||||
/*
|
||||
* mov syscall_no -> %eax
|
||||
* mov arg1 -> %ebx
|
||||
* mov arg2 -> %ecx
|
||||
* int $0x80
|
||||
* mov %eax -> ret
|
||||
*/
|
||||
#define SYSCALL_2 \
|
||||
push %edi; \
|
||||
push %esi; \
|
||||
push %ebx; \
|
||||
mov 0x10 (%esp), %eax; \
|
||||
mov 0x14 (%esp), %ebx; \
|
||||
mov 0x18 (%esp), %ecx; \
|
||||
int $0x80; \
|
||||
pop %ebx; \
|
||||
pop %esi; \
|
||||
pop %edi; \
|
||||
ret;
|
||||
|
||||
/*
|
||||
* mov syscall_no -> %eax
|
||||
* mov arg1 -> %ebx
|
||||
* mov arg2 -> %ecx
|
||||
* mov arg3 -> %edx
|
||||
* int $0x80
|
||||
* mov %eax -> ret
|
||||
*/
|
||||
#define SYSCALL_3 \
|
||||
push %edi; \
|
||||
push %esi; \
|
||||
push %ebx; \
|
||||
mov 0x10 (%esp), %eax; \
|
||||
mov 0x14 (%esp), %ebx; \
|
||||
mov 0x18 (%esp), %ecx; \
|
||||
mov 0x1c (%esp), %edx; \
|
||||
int $0x80; \
|
||||
pop %ebx; \
|
||||
pop %esi; \
|
||||
pop %edi; \
|
||||
ret;
|
||||
|
||||
#define _START \
|
||||
mov %esp, %eax; \
|
||||
add $4, %eax; \
|
||||
push %eax; \
|
||||
mov 0x4 (%esp), %eax; \
|
||||
push %eax; \
|
||||
\
|
||||
call main; \
|
||||
\
|
||||
push %eax; \
|
||||
call exit; \
|
||||
1: \
|
||||
jmp 1b
|
||||
|
||||
#endif /* !ASM_X86_H */
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifdef __TARGET_HOST_x64
|
||||
# include "asm_x64.h"
|
||||
# include "arch/x86-64.h"
|
||||
#elif defined (__TARGET_HOST_x86)
|
||||
# include "asm_x86.h"
|
||||
# include "arch/x86-32.h"
|
||||
#elif defined (__TARGET_HOST_ARMv7)
|
||||
# include "asm_arm.h"
|
||||
# include "arch/arm-v7.h"
|
||||
#else /* !__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7 */
|
||||
# error "!__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7"
|
||||
#endif /* !__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7 */
|
||||
|
||||
@@ -29,15 +29,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef __TARGET_HOST_x64
|
||||
# include "asm_x64.h"
|
||||
#elif defined (__TARGET_HOST_x86)
|
||||
# include "asm_x86.h"
|
||||
#elif defined (__TARGET_HOST_ARMv7)
|
||||
# include "asm_arm.h"
|
||||
#else /* !__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7 */
|
||||
# error "!__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7 "
|
||||
#endif /* !__TARGET_HOST_x64 && !__TARGET_HOST_x86 && !__TARGET_HOST_ARMv7 */
|
||||
#include "jerry-libc-defs.h"
|
||||
|
||||
LIBC_UNREACHABLE_STUB_FOR (int raise (int sig_no __attr_unused___))
|
||||
|
||||
Reference in New Issue
Block a user