1/* 2 * Copyright (C) 2004-2007 Atmel Corporation 3 * 4 * This file is subject to the terms and conditions of the GNU Lesser General 5 * Public License. See the file "COPYING.LIB" in the main directory of this 6 * archive for more details. 7 */ 8#include <features.h> 9 10 .text 11 12 /* 13 * long int syscall(long int sysno, ...) 14 */ 15 .global syscall 16 .type syscall, @function 17 .align 2 18syscall: 19 stm --sp, r3,r5,r6,lr 20 sub lr, sp, -16 21 mov r8, r12 22 ldm lr, r3,r5,r9-r12 23 scall 24 cp.w r12, -4095 25 brlo .Ldone 26 27#ifdef __PIC__ 28 lddpc r6, .Lgot 29.Lgotcalc: 30 rsub r6, pc 31# ifdef __UCLIBC_HAS_THREADS__ 32 rsub r3, r12, 0 33 mcall r6[__errno_location@got] 34 st.w r12[0], r3 35# else 36 ld.w r3, r6[errno@got] 37 neg r12 38 st.w r3[0], r12 39# endif 40#else 41# ifdef __UCLIBC_HAS_THREADS__ 42 rsub r3, r12, 0 43 mcall .Lerrno_location 44 st.w r12[0], r3 45# else 46 lddpc r3, .Lerrno 47 neg r12 48 st.w r3[0], r12 49# endif 50#endif 51 mov r12, -1 52 53.Ldone: 54 ldm sp++, r3,r5,r6,pc 55 56 .align 2 57#ifdef __PIC__ 58.Lgot: 59 .long .Lgotcalc - _GLOBAL_OFFSET_TABLE_ 60#else 61# ifdef __UCLIBC_HAS_THREADS__ 62.Lerrno_location: 63 .long __errno_location 64# else 65.Lerrno: 66 .long errno 67# endif 68#endif 69 70 71 .size syscall, . - syscall 72