Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/arch/arm Rework SYSTRAP for thumb.
details: https://anonhg.NetBSD.org/src/rev/331633013f85
branches: trunk
changeset: 789367:331633013f85
user: matt <matt%NetBSD.org@localhost>
date: Fri Aug 16 22:20:49 2013 +0000
description:
Rework SYSTRAP for thumb.
Add END to PSEUDO_NOERROR and PSEUDO
diffstat:
lib/libc/arch/arm/SYS.h | 53 +++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 45 insertions(+), 8 deletions(-)
diffs (87 lines):
diff -r 3482c275e115 -r 331633013f85 lib/libc/arch/arm/SYS.h
--- a/lib/libc/arch/arm/SYS.h Fri Aug 16 21:59:01 2013 +0000
+++ b/lib/libc/arch/arm/SYS.h Fri Aug 16 22:20:49 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: SYS.h,v 1.12 2013/08/01 05:32:33 matt Exp $ */
+/* $NetBSD: SYS.h,v 1.13 2013/08/16 22:20:49 matt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -38,11 +38,40 @@
#include <sys/syscall.h>
#include <arm/swi.h>
-#ifdef __STDC__
-#define SYSTRAP(x) swi SWI_OS_NETBSD | SYS_ ## x
+#ifndef __STDC__
+#error __STDC__ not defined
+#endif
+
+#if !defined(__thumb__)
+#define SYSTRAP(x) svc #SWI_OS_NETBSD | SYS_ ## x
+#else
+.macro emitsvc x
+ mov ip, r0
+.ifeq \x / 256
+ movs r0, #\x
+.else
+#if defined(_ARM_ARCH_7)
+ movw r0, #\x
#else
-#define SYSTRAP(x) swi SWI_OS_NETBSD | SYS_/**/x
-#endif
+.ifeq (\x & 3)
+ movs r0, #(\x / 4)
+ lsls r0, r0, #3
+.else
+.ifeq (\x & 1)
+ movs r0, #(\x / 2)
+ lsls r0, r0, #1
+.else
+ movs r0, #(\x / 256)
+ lsls r0, r0, #8
+ adds r0, r0, #(\x & 255)
+.endif
+.endif
+#endif /* !_ARM_ARCH_7 */
+.endif
+ svc #255
+.endm
+#define SYSTRAP(x) emitsvc SYS_ ## x
+#endif /* __thumb__ */
#define CERROR _C_LABEL(__cerror)
#define CURBRK _C_LABEL(__curbrk)
@@ -51,9 +80,15 @@
ENTRY(x); \
SYSTRAP(y)
+#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
+#define _INVOKE_CERROR() bcs CERROR
+#else
+#define _INVOKE_CERROR() \
+ bcc 86f; push {r4,lr}; bl CERROR; pop {r4,pc}; 86:
+#endif
#define _SYSCALL(x, y) \
_SYSCALL_NOERROR(x,y); \
- bcs CERROR
+ _INVOKE_CERROR()
#define SYSCALL_NOERROR(x) \
_SYSCALL_NOERROR(x,x)
@@ -64,11 +99,13 @@
#define PSEUDO_NOERROR(x,y) \
_SYSCALL_NOERROR(x,y); \
- RET
+ RET; \
+ END(x)
#define PSEUDO(x,y) \
_SYSCALL(x,y); \
- RET
+ RET; \
+ END(x)
#define RSYSCALL_NOERROR(x) \
Home |
Main Index |
Thread Index |
Old Index