svn commit: r274431 - in projects/arm64: lib/libc/arm64 lib/libc/arm64/sys sys/arm64/arm64 sys/arm64/include
Andrew Turner
andrew at FreeBSD.org
Wed Nov 12 13:19:32 UTC 2014
Author: andrew
Date: Wed Nov 12 13:19:30 2014
New Revision: 274431
URL: https://svnweb.freebsd.org/changeset/base/274431
Log:
Set the C bit in spsr to indicate when syscalls fail, and use it to
set errno on failure.
Added:
projects/arm64/lib/libc/arm64/sys/cerror.S
- copied, changed from r274430, projects/arm64/sys/arm64/include/asm.h
Modified:
projects/arm64/lib/libc/arm64/SYS.h
projects/arm64/lib/libc/arm64/sys/Makefile.inc
projects/arm64/sys/arm64/arm64/vm_machdep.c
projects/arm64/sys/arm64/include/asm.h
Modified: projects/arm64/lib/libc/arm64/SYS.h
==============================================================================
--- projects/arm64/lib/libc/arm64/SYS.h Wed Nov 12 13:19:25 2014 (r274430)
+++ projects/arm64/lib/libc/arm64/SYS.h Wed Nov 12 13:19:30 2014 (r274431)
@@ -48,6 +48,7 @@ END(__sys_##name)
ENTRY(__sys_##name); \
WEAK_REFERENCE(__sys_##name, _##name); \
_SYSCALL(name); \
+ b.cs PIC_SYM(cerror, PLT); \
ret; \
END(__sys_##name)
@@ -56,6 +57,7 @@ ENTRY(__sys_##name); \
WEAK_REFERENCE(__sys_##name, name); \
WEAK_REFERENCE(__sys_##name, _##name); \
_SYSCALL(name); \
+ b.cs PIC_SYM(cerror, PLT); \
ret; \
END(__sys_##name)
Modified: projects/arm64/lib/libc/arm64/sys/Makefile.inc
==============================================================================
--- projects/arm64/lib/libc/arm64/sys/Makefile.inc Wed Nov 12 13:19:25 2014 (r274430)
+++ projects/arm64/lib/libc/arm64/sys/Makefile.inc Wed Nov 12 13:19:30 2014 (r274431)
@@ -2,7 +2,8 @@
SRCS+= __vdso_gettc.c
-#MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S
+#MDASM= Ovfork.S brk.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S
+MDASM= cerror.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o
Copied and modified: projects/arm64/lib/libc/arm64/sys/cerror.S (from r274430, projects/arm64/sys/arm64/include/asm.h)
==============================================================================
--- projects/arm64/sys/arm64/include/asm.h Wed Nov 12 13:19:25 2014 (r274430, copy source)
+++ projects/arm64/lib/libc/arm64/sys/cerror.S Wed Nov 12 13:19:30 2014 (r274431)
@@ -25,26 +25,17 @@
*
*/
-#ifndef _MACHINE_ASM_H_
-#define _MACHINE_ASM_H_
+#include <machine/asm.h>
+__FBSDID("$FreeBSD$");
-#undef __FBSDID
-#if !defined(lint) && !defined(STRIP_FBSDID)
-#define __FBSDID(s) .ident s
-#else
-#define __FBSDID(s) /* nothing */
-#endif
-
-#define _C_LABEL(x) x
-
-#define ENTRY(sym) \
- .text; .globl sym; .align 2; sym:
-#define END(sym) .size sym, . - sym
-
-#define WEAK_REFERENCE(sym, alias) \
- .weak alias; \
- .set alias,sym
-
-#define UINT64_C(x) (x)
-
-#endif /* _MACHINE_ASM_H_ */
+ENTRY(cerror)
+ sub sp, sp, #16
+ stp x0, lr, [sp]
+ bl PIC_SYM(_C_LABEL(__error), PLT)
+ ldp x1, lr, [sp]
+ str x1, [x0]
+ movn x0, #0
+ movn x1, #0
+ add sp, sp, #16
+ ret
+END(cerror)
Modified: projects/arm64/sys/arm64/arm64/vm_machdep.c
==============================================================================
--- projects/arm64/sys/arm64/arm64/vm_machdep.c Wed Nov 12 13:19:25 2014 (r274430)
+++ projects/arm64/sys/arm64/arm64/vm_machdep.c Wed Nov 12 13:19:30 2014 (r274431)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <vm/uma.h>
#include <vm/uma_int.h>
+#include <machine/armreg.h>
#include <machine/cpu.h>
#include <machine/pcb.h>
#include <machine/frame.h>
@@ -115,6 +116,7 @@ cpu_set_syscall_retval(struct thread *td
case 0:
frame->tf_x[0] = td->td_retval[0];
frame->tf_x[1] = td->td_retval[1];
+ frame->tf_spsr &= ~PSR_C; /* carry bit */
break;
case ERESTART:
frame->tf_elr -= 4;
@@ -122,6 +124,7 @@ cpu_set_syscall_retval(struct thread *td
case EJUSTRETURN:
break;
default:
+ frame->tf_spsr |= PSR_C; /* carry bit */
frame->tf_x[0] = error;
break;
}
Modified: projects/arm64/sys/arm64/include/asm.h
==============================================================================
--- projects/arm64/sys/arm64/include/asm.h Wed Nov 12 13:19:25 2014 (r274430)
+++ projects/arm64/sys/arm64/include/asm.h Wed Nov 12 13:19:30 2014 (r274431)
@@ -47,4 +47,10 @@
#define UINT64_C(x) (x)
+#if defined(PIC)
+#define PIC_SYM(x,y) x ## @ ## y
+#else
+#define PIC_SYM(x,y) x
+#endif
+
#endif /* _MACHINE_ASM_H_ */
More information about the svn-src-projects
mailing list