mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-22 00:38:06 +08:00
2006-05-30 Shaun Jackman <sjackman@gmail.com>
* arm/Makefile.in: Add Linux syscall interface. * arm/linux-crt0.S: New file. * arm/linux-syscall.h: New file. * arm/linux-syscalls0.S: New file. * arm/linux-syscalls1.c: New file.
This commit is contained in:
parent
56057f0394
commit
47e55476be
@ -1,3 +1,11 @@
|
||||
2006-05-30 Shaun Jackman <sjackman@gmail.com>
|
||||
|
||||
* arm/Makefile.in: Add Linux syscall interface.
|
||||
* arm/linux-crt0.S: New file.
|
||||
* arm/linux-syscall.h: New file.
|
||||
* arm/linux-syscalls0.S: New file.
|
||||
* arm/linux-syscalls1.c: New file.
|
||||
|
||||
2006-05-23 Fred Fish <fnf@specifix.com>
|
||||
|
||||
* mips/configure.in: Change mipsisa64-*-* to
|
||||
|
@ -53,6 +53,12 @@ OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
||||
@BUILD_CRT0_FALSE@CRT0 =
|
||||
@BUILD_CRT0_FALSE@CRT0_INSTALL =
|
||||
|
||||
LINUX_CRT0 = linux-crt0.o
|
||||
LINUX_BSP = libgloss-linux.a
|
||||
LINUX_OBJS = linux-syscalls0.o linux-syscalls1.o
|
||||
LINUX_SCRIPTS = linux.specs
|
||||
LINUX_INSTALL = install-linux
|
||||
|
||||
REDBOOT_CRT0 = redboot-crt0.o
|
||||
REDBOOT_OBJS = redboot-syscalls.o
|
||||
REDBOOT_SCRIPTS = redboot.ld redboot.specs
|
||||
@ -87,7 +93,7 @@ IQ80310_INSTALL = install-iq80310
|
||||
# build a test program for each target board. Just trying to get
|
||||
# it to link is a good test, so we ignore all the errors for now.
|
||||
#
|
||||
all: ${CRT0} ${REDBOOT_CRT0} ${REDBOOT_OBJS} ${RDPMON_CRT0} ${RDPMON_BSP} ${RDIMON_CRT0} ${RDIMON_BSP}
|
||||
all: ${CRT0} ${LINUX_CRT0} ${LINUX_BSP} ${REDBOOT_CRT0} ${REDBOOT_OBJS} ${RDPMON_CRT0} ${RDPMON_BSP} ${RDIMON_CRT0} ${RDIMON_BSP}
|
||||
|
||||
#
|
||||
# here's where we build the test programs for each target
|
||||
@ -115,6 +121,10 @@ rdimon-syscalls.o: syscalls.c
|
||||
rdimon-libcfunc.o: libcfunc.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
|
||||
|
||||
$(LINUX_BSP): $(LINUX_OBJS)
|
||||
${AR} ${ARFLAGS} $@ $^
|
||||
${RANLIB} $@
|
||||
|
||||
$(RDPMON_BSP): $(RDPMON_OBJS)
|
||||
${AR} ${ARFLAGS} $@ $^
|
||||
${RANLIB} $@
|
||||
@ -130,11 +140,15 @@ distclean maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status *~
|
||||
|
||||
.PHONY: install info install-info clean-info
|
||||
install: ${CRT0_INSTALL} ${REDBOOT_INSTALL} ${RDPMON_INSTALL} ${RDIMON_INSTALL} ${IQ80310_INSTALL} ${PID_INSTALL}
|
||||
install: ${CRT0_INSTALL} ${LINUX_INSTALL} ${REDBOOT_INSTALL} ${RDPMON_INSTALL} ${RDIMON_INSTALL} ${IQ80310_INSTALL} ${PID_INSTALL}
|
||||
|
||||
install-crt0:
|
||||
${INSTALL_DATA} ${CRT0} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x
|
||||
|
||||
install-linux:
|
||||
set -e; for x in ${LINUX_CRT0} ${LINUX_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
set -e; for x in ${LINUX_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
|
||||
install-redboot:
|
||||
set -e; for x in ${REDBOOT_CRT0} ${REDBOOT_OBJS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
set -e; for x in ${REDBOOT_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
|
||||
|
46
libgloss/arm/linux-crt0.S
Normal file
46
libgloss/arm/linux-crt0.S
Normal file
@ -0,0 +1,46 @@
|
||||
/** Linux startup code for the ARM processor.
|
||||
* Written by Shaun Jackman <sjackman@gmail.com>.
|
||||
* Copyright 2006 Pathway Connectivity
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
.global _start
|
||||
.type _start, %function
|
||||
_start:
|
||||
#if __thumb__
|
||||
/* Switch to Thumb mode. */
|
||||
adr r0, _start_thumb+1
|
||||
bx r0
|
||||
.size _start, .-_start
|
||||
.global _start_thumb
|
||||
.thumb_func
|
||||
_start_thumb:
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Clear the BSS. This task is normally handled by the kernel. */
|
||||
ldr r0, =__bss_start
|
||||
mov r1, #0
|
||||
ldr r2, =_end
|
||||
sub r2, r2, r0
|
||||
bl memset
|
||||
#endif
|
||||
|
||||
pop {r0} @ argc
|
||||
mov r1, sp @ argv
|
||||
lsl r2, r0, #2
|
||||
add r2, r1
|
||||
add r2, #4 @ envp
|
||||
ldr r3, =environ
|
||||
str r2, [r3]
|
||||
bl main
|
||||
bl exit
|
||||
b .
|
||||
|
||||
#if __thumb__
|
||||
.size _start_thumb, .-_start_thumb
|
||||
#else
|
||||
.size _start, .-_start
|
||||
#endif
|
318
libgloss/arm/linux-syscall.h
Normal file
318
libgloss/arm/linux-syscall.h
Normal file
@ -0,0 +1,318 @@
|
||||
/** Linux system call numbers for the ARM processor.
|
||||
* Written by Shaun Jackman <sjackman@gmail.com>
|
||||
* Copyright 2006 Pathway Connectivity
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#ifndef _LIBGLOSS_ARM_LINUX_UNISTD_H
|
||||
#define _LIBGLOSS_ARM_LINUX_UNISTD_H
|
||||
|
||||
#if __thumb__
|
||||
# define SYS_BASE 0
|
||||
#else
|
||||
# define SYS_BASE 0x900000
|
||||
#endif
|
||||
|
||||
#define SYS_restart_syscall (SYS_BASE+ 0)
|
||||
#define SYS_exit (SYS_BASE+ 1)
|
||||
#define SYS_fork (SYS_BASE+ 2)
|
||||
#define SYS_read (SYS_BASE+ 3)
|
||||
#define SYS_write (SYS_BASE+ 4)
|
||||
#define SYS_open (SYS_BASE+ 5)
|
||||
#define SYS_close (SYS_BASE+ 6)
|
||||
/* SYS_waitpid was 7 */
|
||||
#define SYS_creat (SYS_BASE+ 8)
|
||||
#define SYS_link (SYS_BASE+ 9)
|
||||
#define SYS_unlink (SYS_BASE+ 10)
|
||||
#define SYS_execve (SYS_BASE+ 11)
|
||||
#define SYS_chdir (SYS_BASE+ 12)
|
||||
#define SYS_time (SYS_BASE+ 13)
|
||||
#define SYS_mknod (SYS_BASE+ 14)
|
||||
#define SYS_chmod (SYS_BASE+ 15)
|
||||
#define SYS_lchown (SYS_BASE+ 16)
|
||||
/* SYS_break was 17 */
|
||||
/* SYS_stat was 18 */
|
||||
#define SYS_lseek (SYS_BASE+ 19)
|
||||
#define SYS_getpid (SYS_BASE+ 20)
|
||||
#define SYS_mount (SYS_BASE+ 21)
|
||||
#define SYS_umount (SYS_BASE+ 22)
|
||||
#define SYS_setuid (SYS_BASE+ 23)
|
||||
#define SYS_getuid (SYS_BASE+ 24)
|
||||
#define SYS_stime (SYS_BASE+ 25)
|
||||
#define SYS_ptrace (SYS_BASE+ 26)
|
||||
#define SYS_alarm (SYS_BASE+ 27)
|
||||
/* SYS_fstat was 28 */
|
||||
#define SYS_pause (SYS_BASE+ 29)
|
||||
#define SYS_utime (SYS_BASE+ 30)
|
||||
/* SYS_stty was 31 */
|
||||
/* SYS_gtty was 32 */
|
||||
#define SYS_access (SYS_BASE+ 33)
|
||||
#define SYS_nice (SYS_BASE+ 34)
|
||||
/* SYS_ftime was 35 */
|
||||
#define SYS_sync (SYS_BASE+ 36)
|
||||
#define SYS_kill (SYS_BASE+ 37)
|
||||
#define SYS_rename (SYS_BASE+ 38)
|
||||
#define SYS_mkdir (SYS_BASE+ 39)
|
||||
#define SYS_rmdir (SYS_BASE+ 40)
|
||||
#define SYS_dup (SYS_BASE+ 41)
|
||||
#define SYS_pipe (SYS_BASE+ 42)
|
||||
#define SYS_times (SYS_BASE+ 43)
|
||||
/* SYS_prof was 44 */
|
||||
#define SYS_brk (SYS_BASE+ 45)
|
||||
#define SYS_setgid (SYS_BASE+ 46)
|
||||
#define SYS_getgid (SYS_BASE+ 47)
|
||||
/* SYS_signal was 48 */
|
||||
#define SYS_geteuid (SYS_BASE+ 49)
|
||||
#define SYS_getegid (SYS_BASE+ 50)
|
||||
#define SYS_acct (SYS_BASE+ 51)
|
||||
#define SYS_umount2 (SYS_BASE+ 52)
|
||||
/* SYS_lock was 53 */
|
||||
#define SYS_ioctl (SYS_BASE+ 54)
|
||||
#define SYS_fcntl (SYS_BASE+ 55)
|
||||
/* SYS_mpx was 56 */
|
||||
#define SYS_setpgid (SYS_BASE+ 57)
|
||||
/* SYS_ulimit was 58 */
|
||||
/* SYS_olduname was 59 */
|
||||
#define SYS_umask (SYS_BASE+ 60)
|
||||
#define SYS_chroot (SYS_BASE+ 61)
|
||||
#define SYS_ustat (SYS_BASE+ 62)
|
||||
#define SYS_dup2 (SYS_BASE+ 63)
|
||||
#define SYS_getppid (SYS_BASE+ 64)
|
||||
#define SYS_getpgrp (SYS_BASE+ 65)
|
||||
#define SYS_setsid (SYS_BASE+ 66)
|
||||
#define SYS_sigaction (SYS_BASE+ 67)
|
||||
/* SYS_sgetmask was 68 */
|
||||
/* SYS_ssetmask was 69 */
|
||||
#define SYS_setreuid (SYS_BASE+ 70)
|
||||
#define SYS_setregid (SYS_BASE+ 71)
|
||||
#define SYS_sigsuspend (SYS_BASE+ 72)
|
||||
#define SYS_sigpending (SYS_BASE+ 73)
|
||||
#define SYS_sethostname (SYS_BASE+ 74)
|
||||
#define SYS_setrlimit (SYS_BASE+ 75)
|
||||
#define SYS_getrlimit (SYS_BASE+ 76)
|
||||
#define SYS_getrusage (SYS_BASE+ 77)
|
||||
#define SYS_gettimeofday (SYS_BASE+ 78)
|
||||
#define SYS_settimeofday (SYS_BASE+ 79)
|
||||
#define SYS_getgroups (SYS_BASE+ 80)
|
||||
#define SYS_setgroups (SYS_BASE+ 81)
|
||||
#define SYS_select (SYS_BASE+ 82)
|
||||
#define SYS_symlink (SYS_BASE+ 83)
|
||||
/* SYS_lstat was 84 */
|
||||
#define SYS_readlink (SYS_BASE+ 85)
|
||||
#define SYS_uselib (SYS_BASE+ 86)
|
||||
#define SYS_swapon (SYS_BASE+ 87)
|
||||
#define SYS_reboot (SYS_BASE+ 88)
|
||||
#define SYS_readdir (SYS_BASE+ 89)
|
||||
#define SYS_mmap (SYS_BASE+ 90)
|
||||
#define SYS_munmap (SYS_BASE+ 91)
|
||||
#define SYS_truncate (SYS_BASE+ 92)
|
||||
#define SYS_ftruncate (SYS_BASE+ 93)
|
||||
#define SYS_fchmod (SYS_BASE+ 94)
|
||||
#define SYS_fchown (SYS_BASE+ 95)
|
||||
#define SYS_getpriority (SYS_BASE+ 96)
|
||||
#define SYS_setpriority (SYS_BASE+ 97)
|
||||
/* SYS_profil was 98 */
|
||||
#define SYS_statfs (SYS_BASE+ 99)
|
||||
#define SYS_fstatfs (SYS_BASE+100)
|
||||
/* SYS_ioperm was 101 */
|
||||
#define SYS_socketcall (SYS_BASE+102)
|
||||
#define SYS_syslog (SYS_BASE+103)
|
||||
#define SYS_setitimer (SYS_BASE+104)
|
||||
#define SYS_getitimer (SYS_BASE+105)
|
||||
#define SYS_stat (SYS_BASE+106)
|
||||
#define SYS_lstat (SYS_BASE+107)
|
||||
#define SYS_fstat (SYS_BASE+108)
|
||||
/* SYS_uname was 109 */
|
||||
/* SYS_iopl was 110 */
|
||||
#define SYS_vhangup (SYS_BASE+111)
|
||||
/* SYS_idle was 112 */
|
||||
#define SYS_syscall (SYS_BASE+113)
|
||||
#define SYS_wait4 (SYS_BASE+114)
|
||||
#define SYS_swapoff (SYS_BASE+115)
|
||||
#define SYS_sysinfo (SYS_BASE+116)
|
||||
#define SYS_ipc (SYS_BASE+117)
|
||||
#define SYS_fsync (SYS_BASE+118)
|
||||
#define SYS_sigreturn (SYS_BASE+119)
|
||||
#define SYS_clone (SYS_BASE+120)
|
||||
#define SYS_setdomainname (SYS_BASE+121)
|
||||
#define SYS_uname (SYS_BASE+122)
|
||||
/* SYS_modify_ldt was 123 */
|
||||
#define SYS_adjtimex (SYS_BASE+124)
|
||||
#define SYS_mprotect (SYS_BASE+125)
|
||||
#define SYS_sigprocmask (SYS_BASE+126)
|
||||
/* SYS_create_module was 127 */
|
||||
#define SYS_init_module (SYS_BASE+128)
|
||||
#define SYS_delete_module (SYS_BASE+129)
|
||||
/* SYS_get_kernel_syms was 130 */
|
||||
#define SYS_quotactl (SYS_BASE+131)
|
||||
#define SYS_getpgid (SYS_BASE+132)
|
||||
#define SYS_fchdir (SYS_BASE+133)
|
||||
#define SYS_bdflush (SYS_BASE+134)
|
||||
#define SYS_sysfs (SYS_BASE+135)
|
||||
#define SYS_personality (SYS_BASE+136)
|
||||
/* SYS_afs_syscall was 137 */
|
||||
#define SYS_setfsuid (SYS_BASE+138)
|
||||
#define SYS_setfsgid (SYS_BASE+139)
|
||||
#define SYS__llseek (SYS_BASE+140)
|
||||
#define SYS_getdents (SYS_BASE+141)
|
||||
#define SYS__newselect (SYS_BASE+142)
|
||||
#define SYS_flock (SYS_BASE+143)
|
||||
#define SYS_msync (SYS_BASE+144)
|
||||
#define SYS_readv (SYS_BASE+145)
|
||||
#define SYS_writev (SYS_BASE+146)
|
||||
#define SYS_getsid (SYS_BASE+147)
|
||||
#define SYS_fdatasync (SYS_BASE+148)
|
||||
#define SYS__sysctl (SYS_BASE+149)
|
||||
#define SYS_mlock (SYS_BASE+150)
|
||||
#define SYS_munlock (SYS_BASE+151)
|
||||
#define SYS_mlockall (SYS_BASE+152)
|
||||
#define SYS_munlockall (SYS_BASE+153)
|
||||
#define SYS_sched_setparam (SYS_BASE+154)
|
||||
#define SYS_sched_getparam (SYS_BASE+155)
|
||||
#define SYS_sched_setscheduler (SYS_BASE+156)
|
||||
#define SYS_sched_getscheduler (SYS_BASE+157)
|
||||
#define SYS_sched_yield (SYS_BASE+158)
|
||||
#define SYS_sched_get_priority_max (SYS_BASE+159)
|
||||
#define SYS_sched_get_priority_min (SYS_BASE+160)
|
||||
#define SYS_sched_rr_get_interval (SYS_BASE+161)
|
||||
#define SYS_nanosleep (SYS_BASE+162)
|
||||
#define SYS_mremap (SYS_BASE+163)
|
||||
#define SYS_setresuid (SYS_BASE+164)
|
||||
#define SYS_getresuid (SYS_BASE+165)
|
||||
/* SYS_vm86 was 166 */
|
||||
/* SYS_query_module was 167 */
|
||||
#define SYS_poll (SYS_BASE+168)
|
||||
#define SYS_nfsservctl (SYS_BASE+169)
|
||||
#define SYS_setresgid (SYS_BASE+170)
|
||||
#define SYS_getresgid (SYS_BASE+171)
|
||||
#define SYS_prctl (SYS_BASE+172)
|
||||
#define SYS_rt_sigreturn (SYS_BASE+173)
|
||||
#define SYS_rt_sigaction (SYS_BASE+174)
|
||||
#define SYS_rt_sigprocmask (SYS_BASE+175)
|
||||
#define SYS_rt_sigpending (SYS_BASE+176)
|
||||
#define SYS_rt_sigtimedwait (SYS_BASE+177)
|
||||
#define SYS_rt_sigqueueinfo (SYS_BASE+178)
|
||||
#define SYS_rt_sigsuspend (SYS_BASE+179)
|
||||
#define SYS_pread64 (SYS_BASE+180)
|
||||
#define SYS_pwrite64 (SYS_BASE+181)
|
||||
#define SYS_chown (SYS_BASE+182)
|
||||
#define SYS_getcwd (SYS_BASE+183)
|
||||
#define SYS_capget (SYS_BASE+184)
|
||||
#define SYS_capset (SYS_BASE+185)
|
||||
#define SYS_sigaltstack (SYS_BASE+186)
|
||||
#define SYS_sendfile (SYS_BASE+187)
|
||||
/* reserved 188 */
|
||||
/* reserved 189 */
|
||||
#define SYS_vfork (SYS_BASE+190)
|
||||
#define SYS_ugetrlimit (SYS_BASE+191)
|
||||
#define SYS_mmap2 (SYS_BASE+192)
|
||||
#define SYS_truncate64 (SYS_BASE+193)
|
||||
#define SYS_ftruncate64 (SYS_BASE+194)
|
||||
#define SYS_stat64 (SYS_BASE+195)
|
||||
#define SYS_lstat64 (SYS_BASE+196)
|
||||
#define SYS_fstat64 (SYS_BASE+197)
|
||||
#define SYS_lchown32 (SYS_BASE+198)
|
||||
#define SYS_getuid32 (SYS_BASE+199)
|
||||
#define SYS_getgid32 (SYS_BASE+200)
|
||||
#define SYS_geteuid32 (SYS_BASE+201)
|
||||
#define SYS_getegid32 (SYS_BASE+202)
|
||||
#define SYS_setreuid32 (SYS_BASE+203)
|
||||
#define SYS_setregid32 (SYS_BASE+204)
|
||||
#define SYS_getgroups32 (SYS_BASE+205)
|
||||
#define SYS_setgroups32 (SYS_BASE+206)
|
||||
#define SYS_fchown32 (SYS_BASE+207)
|
||||
#define SYS_setresuid32 (SYS_BASE+208)
|
||||
#define SYS_getresuid32 (SYS_BASE+209)
|
||||
#define SYS_setresgid32 (SYS_BASE+210)
|
||||
#define SYS_getresgid32 (SYS_BASE+211)
|
||||
#define SYS_chown32 (SYS_BASE+212)
|
||||
#define SYS_setuid32 (SYS_BASE+213)
|
||||
#define SYS_setgid32 (SYS_BASE+214)
|
||||
#define SYS_setfsuid32 (SYS_BASE+215)
|
||||
#define SYS_setfsgid32 (SYS_BASE+216)
|
||||
#define SYS_getdents64 (SYS_BASE+217)
|
||||
#define SYS_pivot_root (SYS_BASE+218)
|
||||
#define SYS_mincore (SYS_BASE+219)
|
||||
#define SYS_madvise (SYS_BASE+220)
|
||||
#define SYS_fcntl64 (SYS_BASE+221)
|
||||
/* SYS_tux reserved 222 */
|
||||
/* unused 223 */
|
||||
#define SYS_gettid (SYS_BASE+224)
|
||||
#define SYS_readahead (SYS_BASE+225)
|
||||
#define SYS_setxattr (SYS_BASE+226)
|
||||
#define SYS_lsetxattr (SYS_BASE+227)
|
||||
#define SYS_fsetxattr (SYS_BASE+228)
|
||||
#define SYS_getxattr (SYS_BASE+229)
|
||||
#define SYS_lgetxattr (SYS_BASE+230)
|
||||
#define SYS_fgetxattr (SYS_BASE+231)
|
||||
#define SYS_listxattr (SYS_BASE+232)
|
||||
#define SYS_llistxattr (SYS_BASE+233)
|
||||
#define SYS_flistxattr (SYS_BASE+234)
|
||||
#define SYS_removexattr (SYS_BASE+235)
|
||||
#define SYS_lremovexattr (SYS_BASE+236)
|
||||
#define SYS_fremovexattr (SYS_BASE+237)
|
||||
#define SYS_tkill (SYS_BASE+238)
|
||||
#define SYS_sendfile64 (SYS_BASE+239)
|
||||
#define SYS_futex (SYS_BASE+240)
|
||||
#define SYS_sched_setaffinity (SYS_BASE+241)
|
||||
#define SYS_sched_getaffinity (SYS_BASE+242)
|
||||
#define SYS_io_setup (SYS_BASE+243)
|
||||
#define SYS_io_destroy (SYS_BASE+244)
|
||||
#define SYS_io_getevents (SYS_BASE+245)
|
||||
#define SYS_io_submit (SYS_BASE+246)
|
||||
#define SYS_io_cancel (SYS_BASE+247)
|
||||
#define SYS_exit_group (SYS_BASE+248)
|
||||
#define SYS_lookup_dcookie (SYS_BASE+249)
|
||||
#define SYS_epoll_create (SYS_BASE+250)
|
||||
#define SYS_epoll_ctl (SYS_BASE+251)
|
||||
#define SYS_epoll_wait (SYS_BASE+252)
|
||||
#define SYS_remap_file_pages (SYS_BASE+253)
|
||||
/* SYS_set_thread_area reserved 254 */
|
||||
/* SYS_get_thread_area reserved 255 */
|
||||
#define SYS_set_tid_address (SYS_BASE+256)
|
||||
#define SYS_timer_create (SYS_BASE+257)
|
||||
#define SYS_timer_settime (SYS_BASE+258)
|
||||
#define SYS_timer_gettime (SYS_BASE+259)
|
||||
#define SYS_timer_getoverrun (SYS_BASE+260)
|
||||
#define SYS_timer_delete (SYS_BASE+261)
|
||||
#define SYS_clock_settime (SYS_BASE+262)
|
||||
#define SYS_clock_gettime (SYS_BASE+263)
|
||||
#define SYS_clock_getres (SYS_BASE+264)
|
||||
#define SYS_clock_nanosleep (SYS_BASE+265)
|
||||
#define SYS_statfs64 (SYS_BASE+266)
|
||||
#define SYS_fstatfs64 (SYS_BASE+267)
|
||||
#define SYS_tgkill (SYS_BASE+268)
|
||||
#define SYS_utimes (SYS_BASE+269)
|
||||
#define SYS_arm_fadvise64_64 (SYS_BASE+270)
|
||||
#define SYS_pciconfig_iobase (SYS_BASE+271)
|
||||
#define SYS_pciconfig_read (SYS_BASE+272)
|
||||
#define SYS_pciconfig_write (SYS_BASE+273)
|
||||
#define SYS_mq_open (SYS_BASE+274)
|
||||
#define SYS_mq_unlink (SYS_BASE+275)
|
||||
#define SYS_mq_timedsend (SYS_BASE+276)
|
||||
#define SYS_mq_timedreceive (SYS_BASE+277)
|
||||
#define SYS_mq_notify (SYS_BASE+278)
|
||||
#define SYS_mq_getsetattr (SYS_BASE+279)
|
||||
#define SYS_waitid (SYS_BASE+280)
|
||||
|
||||
#define SYS_SOCKET 1
|
||||
#define SYS_BIND 2
|
||||
#define SYS_CONNECT 3
|
||||
#define SYS_LISTEN 4
|
||||
#define SYS_ACCEPT 5
|
||||
#define SYS_GETSOCKNAME 6
|
||||
#define SYS_GETPEERNAME 7
|
||||
#define SYS_SOCKETPAIR 8
|
||||
#define SYS_SEND 9
|
||||
#define SYS_RECV 10
|
||||
#define SYS_SENDTO 11
|
||||
#define SYS_RECVFROM 12
|
||||
#define SYS_SHUTDOWN 13
|
||||
#define SYS_SETSOCKOPT 14
|
||||
#define SYS_GETSOCKOPT 15
|
||||
#define SYS_SENDMSG 16
|
||||
#define SYS_RECVMSG 17
|
||||
|
||||
#endif /* _LIBGLOSS_ARM_LINUX_UNISTD_H */
|
196
libgloss/arm/linux-syscalls0.S
Normal file
196
libgloss/arm/linux-syscalls0.S
Normal file
@ -0,0 +1,196 @@
|
||||
/** Linux system call interface for the ARM processor.
|
||||
* Written by Shaun Jackman <sjackman@gmail.com>.
|
||||
* Copyright 2006 Pathway Connectivity
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include "linux-syscall.h"
|
||||
|
||||
#if __thumb__
|
||||
# define FUNC(name) .type name, %function; .thumb_func; name:
|
||||
# define SET .thumb_set
|
||||
#else
|
||||
# define FUNC(name) .type name, %function; name:
|
||||
# define SET .set
|
||||
#endif
|
||||
|
||||
#define GLOBAL(name) .global name; FUNC(name)
|
||||
#define SIZE(name) .size name, .-name
|
||||
|
||||
#if __thumb__
|
||||
|
||||
# define SYSCALL0(name) \
|
||||
GLOBAL(_ ## name); \
|
||||
mov r12, r7; \
|
||||
mov r7, #SYS_ ## name; \
|
||||
swi; \
|
||||
mov r7, r12; \
|
||||
b _set_errno; \
|
||||
SIZE(_ ## name)
|
||||
|
||||
/* static int _syscall3(int a, int b, int c, int number); */
|
||||
FUNC(_syscall3)
|
||||
push { r7 }
|
||||
mov r7, r3
|
||||
swi
|
||||
pop { r7 }
|
||||
b _set_errno
|
||||
SIZE(_syscall3)
|
||||
|
||||
# define SYSCALL3(name) \
|
||||
GLOBAL(_ ## name); \
|
||||
mov r3, #SYS_ ## name; \
|
||||
b _syscall3; \
|
||||
SIZE(_ ## name)
|
||||
|
||||
# define SYSCALL6(name) \
|
||||
GLOBAL(_ ## name); \
|
||||
push { r4 - r5, r7 }; \
|
||||
ldr r4, [sp, #12]; \
|
||||
ldr r5, [sp, #16]; \
|
||||
mov r7, #SYS_ ## name; \
|
||||
swi; \
|
||||
pop { r4 - r5, r7 }; \
|
||||
b _set_errno; \
|
||||
SIZE(_ ## name)
|
||||
|
||||
# define SYSCALL4(name) SYSCALL6(name)
|
||||
|
||||
#else /* __thumb__ */
|
||||
|
||||
# define SYSCALL4(name) \
|
||||
GLOBAL(_ ## name); \
|
||||
swi #SYS_ ## name; \
|
||||
b _set_errno; \
|
||||
SIZE(_ ## name)
|
||||
|
||||
# define SYSCALL6(name) \
|
||||
GLOBAL(_ ## name); \
|
||||
push { r4 - r5 }; \
|
||||
ldr r4, [sp, #8]; \
|
||||
ldr r5, [sp, #12]; \
|
||||
swi #SYS_ ## name; \
|
||||
pop { r4 - r5 }; \
|
||||
b _set_errno; \
|
||||
SIZE(_ ## name)
|
||||
|
||||
#define SYSCALL0(name) SYSCALL3(name)
|
||||
#define SYSCALL3(name) SYSCALL4(name)
|
||||
|
||||
#endif /* __thumb__ */
|
||||
|
||||
#define SYSCALL1(name) SYSCALL3(name)
|
||||
#define SYSCALL2(name) SYSCALL3(name)
|
||||
#define SYSCALL5(name) SYSCALL6(name)
|
||||
|
||||
SYSCALL1(alarm)
|
||||
SYSCALL1(brk)
|
||||
SYSCALL1(chdir)
|
||||
SYSCALL2(chmod)
|
||||
SYSCALL3(chown)
|
||||
SYSCALL1(close)
|
||||
SYSCALL1(dup)
|
||||
SYSCALL2(dup2)
|
||||
SYSCALL3(execve)
|
||||
SYSCALL1(exit)
|
||||
SYSCALL3(fcntl)
|
||||
SYSCALL2(fstat)
|
||||
SYSCALL3(getdents)
|
||||
SYSCALL0(getpid)
|
||||
SYSCALL2(gettimeofday)
|
||||
SYSCALL3(ioctl)
|
||||
SYSCALL2(kill)
|
||||
SYSCALL2(link)
|
||||
SYSCALL3(lseek)
|
||||
SYSCALL2(lstat)
|
||||
SYSCALL2(mkdir)
|
||||
SYSCALL3(mknod)
|
||||
SYSCALL2(nanosleep)
|
||||
SYSCALL3(open)
|
||||
SYSCALL3(read)
|
||||
SYSCALL3(readlink)
|
||||
SYSCALL4(reboot)
|
||||
SYSCALL1(rmdir)
|
||||
SYSCALL5(select)
|
||||
SYSCALL2(socketcall)
|
||||
SYSCALL2(stat)
|
||||
SYSCALL1(stime)
|
||||
SYSCALL2(symlink)
|
||||
SYSCALL1(sysinfo)
|
||||
SYSCALL1(times)
|
||||
SYSCALL2(truncate)
|
||||
SYSCALL1(umask)
|
||||
SYSCALL1(unlink)
|
||||
SYSCALL2(utime)
|
||||
SYSCALL0(vfork)
|
||||
SYSCALL4(wait4)
|
||||
SYSCALL3(write)
|
||||
|
||||
#define ALIAS(name) .GLOBAL name; SET name, _ ## name
|
||||
|
||||
ALIAS(alarm)
|
||||
ALIAS(chdir)
|
||||
ALIAS(chmod)
|
||||
ALIAS(chown)
|
||||
ALIAS(dup)
|
||||
ALIAS(dup2)
|
||||
ALIAS(getdents)
|
||||
ALIAS(ioctl)
|
||||
ALIAS(lstat)
|
||||
ALIAS(mkdir)
|
||||
ALIAS(mknod)
|
||||
ALIAS(nanosleep)
|
||||
ALIAS(readlink)
|
||||
ALIAS(reboot)
|
||||
ALIAS(rmdir)
|
||||
ALIAS(select)
|
||||
ALIAS(stime)
|
||||
ALIAS(symlink)
|
||||
ALIAS(sysinfo)
|
||||
ALIAS(truncate)
|
||||
ALIAS(umask)
|
||||
ALIAS(utime)
|
||||
ALIAS(vfork)
|
||||
ALIAS(wait4)
|
||||
|
||||
# define SOCKETCALL(name, NAME) \
|
||||
GLOBAL(name); \
|
||||
push { r0 - r3 }; \
|
||||
mov r0, #SYS_ ## NAME; \
|
||||
b _socketcall_tail; \
|
||||
SIZE(name)
|
||||
|
||||
FUNC(_socketcall_tail)
|
||||
mov r1, sp
|
||||
push { lr }
|
||||
bl _socketcall
|
||||
pop { r3 }
|
||||
add sp, #16
|
||||
bx r3
|
||||
SIZE(_socketcall_tail)
|
||||
|
||||
#define SOCKETCALL2(name, NAME) SOCKETCALL(name, NAME)
|
||||
#define SOCKETCALL3(name, NAME) SOCKETCALL(name, NAME)
|
||||
#define SOCKETCALL4(name, NAME) SOCKETCALL(name, NAME)
|
||||
#define SOCKETCALL5(name, NAME) SOCKETCALL(name, NAME)
|
||||
#define SOCKETCALL6(name, NAME) SOCKETCALL(name, NAME)
|
||||
|
||||
SOCKETCALL3(accept, ACCEPT)
|
||||
SOCKETCALL3(bind, BIND)
|
||||
SOCKETCALL3(connect, CONNECT)
|
||||
SOCKETCALL3(getpeername, GETPEERNAME)
|
||||
SOCKETCALL3(getsockname, GETSOCKNAME)
|
||||
SOCKETCALL5(getsockopt, GETSOCKOPT)
|
||||
SOCKETCALL2(listen, LISTEN)
|
||||
SOCKETCALL4(recv, RECV)
|
||||
SOCKETCALL6(recvfrom, RECVFROM)
|
||||
SOCKETCALL3(recvmsg, RECVMSG)
|
||||
SOCKETCALL4(send, SEND)
|
||||
SOCKETCALL3(sendmsg, SENDMSG)
|
||||
SOCKETCALL6(sendto, SENDTO)
|
||||
SOCKETCALL5(setsockopt, SETSOCKOPT)
|
||||
SOCKETCALL2(shutdown, SHUTDOWN)
|
||||
SOCKETCALL3(socket, SOCKET)
|
||||
SOCKETCALL4(socketpair, SOCKETPAIR)
|
64
libgloss/arm/linux-syscalls1.c
Normal file
64
libgloss/arm/linux-syscalls1.c
Normal file
@ -0,0 +1,64 @@
|
||||
/** Linux system call interface.
|
||||
* Written by Shaun Jackman <sjackman@gmail.com>.
|
||||
* Copyright 2006 Pathway Connectivity
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* is freely granted, provided that this notice is preserved.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern char _end[];
|
||||
static void *curbrk = _end;
|
||||
|
||||
extern void *_brk(void *addr);
|
||||
|
||||
int brk(void *addr)
|
||||
{
|
||||
void *newbrk;
|
||||
if (curbrk == addr)
|
||||
return 0;
|
||||
newbrk = _brk(addr);
|
||||
curbrk = newbrk;
|
||||
if (newbrk < addr) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *_sbrk(intptr_t incr)
|
||||
{
|
||||
void *oldbrk = curbrk;
|
||||
if (brk(oldbrk + incr) == -1)
|
||||
return (void *)-1;
|
||||
return oldbrk;
|
||||
}
|
||||
|
||||
void *sbrk(intptr_t incr) __attribute__((alias("_sbrk")));
|
||||
|
||||
int _set_errno(int n)
|
||||
{
|
||||
if (n < 0) {
|
||||
errno = -n;
|
||||
return -1;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
#include <sys/wait.h>
|
||||
|
||||
struct rusage;
|
||||
|
||||
pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage);
|
||||
|
||||
pid_t _wait(int *status)
|
||||
{
|
||||
return wait4(-1, status, 0, NULL);
|
||||
}
|
||||
|
||||
pid_t waitpid(pid_t pid, int *status, int options)
|
||||
{
|
||||
return wait4(pid, status, options, NULL);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user