From owner-svn-src-projects@FreeBSD.ORG Mon Apr 9 08:01:18 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41E711065675; Mon, 9 Apr 2012 08:01:18 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23EFA8FC0A; Mon, 9 Apr 2012 08:01:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3981Hgf049433; Mon, 9 Apr 2012 08:01:17 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3981HqY049430; Mon, 9 Apr 2012 08:01:17 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201204090801.q3981HqY049430@svn.freebsd.org> From: Andrew Turner Date: Mon, 9 Apr 2012 08:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234053 - in projects/arm_eabi: lib/libc/arm sys/arm/arm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Apr 2012 08:01:18 -0000 Author: andrew Date: Mon Apr 9 08:01:17 2012 New Revision: 234053 URL: http://svn.freebsd.org/changeset/base/234053 Log: Switch the syscall interface on EABI. The syscall we are after is now passed in r7. The value, while still placed in the instruction, is unused. r7 was chosen as it is what Linux uses and there is no point being different. This should help someone add Thumb support as we can now express all possible syscall values. The Thumb swi instruction only has 8 bits for the the syscall value. Modified: projects/arm_eabi/lib/libc/arm/SYS.h projects/arm_eabi/sys/arm/arm/trap.c Modified: projects/arm_eabi/lib/libc/arm/SYS.h ============================================================================== --- projects/arm_eabi/lib/libc/arm/SYS.h Mon Apr 9 04:44:39 2012 (r234052) +++ projects/arm_eabi/lib/libc/arm/SYS.h Mon Apr 9 08:01:17 2012 (r234053) @@ -39,7 +39,15 @@ #include #include +#ifdef __ARM_EABI__ +#define SYSTRAP(x) \ + mov ip, r7; \ + ldr r7, =SYS_ ## x; \ + swi 0 | SYS_ ## x; \ + mov r7, ip +#else #define SYSTRAP(x) swi 0 | SYS_ ## x +#endif #define CERROR _C_LABEL(cerror) #define CURBRK _C_LABEL(curbrk) Modified: projects/arm_eabi/sys/arm/arm/trap.c ============================================================================== --- projects/arm_eabi/sys/arm/arm/trap.c Mon Apr 9 04:44:39 2012 (r234052) +++ projects/arm_eabi/sys/arm/arm/trap.c Mon Apr 9 08:01:17 2012 (r234053) @@ -868,7 +868,11 @@ cpu_fetch_syscall_args(struct thread *td register_t *ap; int error; +#ifdef __ARM_EABI__ + sa->code = td->td_frame->tf_r7; +#else sa->code = sa->insn & 0x000fffff; +#endif ap = &td->td_frame->tf_r0; if (sa->code == SYS_syscall) { sa->code = *ap++; @@ -902,22 +906,24 @@ cpu_fetch_syscall_args(struct thread *td #include "../../kern/subr_syscall.c" static void -syscall(struct thread *td, trapframe_t *frame, u_int32_t insn) +syscall(struct thread *td, trapframe_t *frame) { struct syscall_args sa; int error; - td->td_frame = frame; - sa.insn = insn; - switch (insn & SWI_OS_MASK) { + sa.insn = *(u_int32_t *)(frame->tf_pc - INSN_SIZE); +#ifndef __ARM_EABI__ + /* TODO: Also add the above line when we don't need it in the EABI case */ + switch (sa.insn & SWI_OS_MASK) { case 0: /* XXX: we need our own one. */ - sa.nap = 4; break; default: call_trapsignal(td, SIGILL, 0); userret(td, frame); return; } +#endif + sa.nap = 4; error = syscallenter(td, &sa); KASSERT(error != 0 || td->td_ar == NULL, @@ -929,7 +935,6 @@ void swi_handler(trapframe_t *frame) { struct thread *td = curthread; - uint32_t insn; td->td_frame = frame; @@ -943,7 +948,6 @@ swi_handler(trapframe_t *frame) userret(td, frame); return; } - insn = *(u_int32_t *)(frame->tf_pc - INSN_SIZE); /* * Enable interrupts if they were enabled before the exception. * Since all syscalls *should* come from user mode it will always @@ -956,6 +960,6 @@ swi_handler(trapframe_t *frame) enable_interrupts(F32_bit); } - syscall(td, frame, insn); + syscall(td, frame); }