ia64 support for klibc
PATCH 25/43 ia64 support for klibc
The parts of klibc specific to the ia64 architecture.
Signed-off-by H. Peter Anvin <[email protected]>
---
commit 951dc85bd690c6cc5a971815665da947160cbe51
tree 0843c8aa67a3c46a362d12c392c41c25d85ac9cd
parent bd0599e5290ca1a16bb7a68f7c362d395c612eb3
author H. Peter Anvin <[email protected]> Sun, 25 Jun 2006 16:58:24 -0700 committer H. Peter Anvin <[email protected]> Sun, 25 Jun 2006 16:58:24 -0700
usr/include/arch/ia64/klibc/archconfig.h | 17 + usr/include/arch/ia64/klibc/archsetjmp.h | 17 + usr/include/arch/ia64/klibc/archsignal.h | 32 +++ usr/include/arch/ia64/klibc/archstat.h | 26 ++ usr/include/arch/ia64/klibc/archsys.h | 217 +++++++++++++++++++ usr/klibc/arch/ia64/MCONFIG | 11 + usr/klibc/arch/ia64/Makefile.inc | 26 ++ usr/klibc/arch/ia64/crt0.S | 27 ++ usr/klibc/arch/ia64/pipe.c | 41 ++++ usr/klibc/arch/ia64/setjmp.S | 343 ++++++++++++++++++++++++++++++ usr/klibc/arch/ia64/syscall.S | 20 ++ usr/klibc/arch/ia64/sysstub.ph | 29 +++ usr/klibc/arch/ia64/vfork.S | 42 ++++ 13 files changed, 848 insertions(+), 0 deletions(-)
usr/include/arch/ia64/klibc/archconfig.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* include/arch/ia64/klibc/archconfig.h +* +* See include/klibc/sysconfig.h for the options that can be set in +* this file. +* +*/ + +#ifndef _KLIBC_ARCHCONFIG_H +#define _KLIBC_ARCHCONFIG_H + +/* IA64 doesn't have sys_fork, but it does have an MMU */ +#define _KLIBC_NO_MMU 0 +/* IA64 doesn't have sys_vfork, it has architecture-specific code */ +#define _KLIBC_REAL_VFORK 1 + +#endif /* _KLIBC_ARCHCONFIG_H */
usr/include/arch/ia64/klibc/archsetjmp.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* arch/ia64/include/klibc/archsetjmp.h +* +* Code borrowed from the FreeBSD kernel. +* +*/ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +/* User code must not depend on the internal representation of jmp_buf. */ +#define _JBLEN 0x200 + +/* guaranteed 128-bit alignment! */ +typedef char jmp_buf [_JBLEN] __attribute__ ((aligned (16 ))); + +#endif
usr/include/arch/ia64/klibc/archsignal.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* arch/ia64/include/klibc/archsignal.h +* +* Architecture-specific signal definitions. +* +*/ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +#include <asm/signal.h> +#define _NSIG 64 +#define _NSIG_BPW 64 +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) + +typedef struct { +unsigned long sig[_NSIG_WORDS]; +}sigset_t ; + +struct sigaction { +union { +__sighandler_t _sa_handler; +void (*_sa_sigaction) (int ,struct siginfo *,void *); + } _u; +sigset_t sa_mask; +int sa_flags; +}; + +#define sa_handler _u._sa_handler +#define sa_sigaction _u._sa_sigaction + +#endif
usr/include/arch/ia64/klibc/archstat.h new file +26 -0
@@ -0,0 +1,26 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#include <klibc/stathelp.h> + +#define _STATBUF_ST_NSEC + +struct stat { +__stdev64 (st_dev); +unsigned long st_ino; +unsigned long st_nlink; +unsigned int st_mode; +unsigned int st_uid; +unsigned int st_gid; +unsigned int __pad0; +__stdev64 (st_rdev); +unsigned long st_size; +struct timespec st_atim; +struct timespec st_mtim; +struct timespec st_ctim; +unsigned long st_blksize; +long st_blocks; +unsigned long __unused[3 ]; +}; + +#endif
usr/include/arch/ia64/klibc/archsys.h new file +217 -0
217 lines not on this page · raw message
usr/klibc/arch/ia64/MCONFIG new file +11 -0
@@ -0,0 +1,11 @@ +# -*- makefile -*- +# +# arch/ia64/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +KLIBCOPTFLAGS = -Os +KLIBCBITSIZE = 64
usr/klibc/arch/ia64/Makefile.inc new file +26 -0
@@ -0,0 +1,26 @@ +# -*- makefile -*- +# +# arch/ia64/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +KLIBCARCHOBJS = \ + arch/$(KLIBCARCH)/vfork.o \ + arch/$(KLIBCARCH)/setjmp.o \ + arch/$(KLIBCARCH)/pipe.o \ + arch/$(KLIBCARCH)/syscall.o \ + libgcc/__divdi3.o \ + libgcc/__divsi3.o \ + libgcc/__udivdi3.o \ + libgcc/__udivsi3.o \ + libgcc/__umodsi3.o \ + libgcc/__umoddi3.o \ + libgcc/__udivmodsi4.o \ + libgcc/__udivmoddi4.o + +KLIBCARCHSOOBJS = $(patsubst %o,%.lo,%(KLIBCARCHOBJS)) + +archclean:
usr/klibc/arch/ia64/crt0.S new file +27 -0
@@ -0,0 +1,27 @@ + +#include <asm/fpu.h> + + .align 32 + .global _start + + .proc _start + .type _start,@function +_start: + .prologue + .save rp, r0 + + alloc r2 = ar.pfs,0,0,2,0 + movl r3 = FPSR_DEFAULT + ;; + adds out0= 16,sp /* argc pointer */ + movl gp = @gprel(0f) +0: mov r9 = ip + ;; + sub gp = r9, gp /* back-compute gp value */ + + .body + br.call.sptk.few rp = __libc_init + ;; + break 0 /* break miserably if we ever return */ + + .endp _start
usr/klibc/arch/ia64/pipe.c new file +41 -0
41 lines not on this page · raw message
usr/klibc/arch/ia64/setjmp.S new file +343 -0
343 lines not on this page · raw message
usr/klibc/arch/ia64/syscall.S new file +20 -0
@@ -0,0 +1,20 @@ +# +# arch/ia64/syscall.S +# + +#include <asm/unistd.h> + + .text + .align 32 + .proc __syscall_error + .globl __syscall_error +__syscall_error: + addl r2 = @ltoffx(errno),gp + ;; + ld8.mov r3 = [r2],errno + ;; + st4 [r3] = r8 + mov r8 = -1 + br.ret.sptk.many b0 + .size __syscall_error, .-__syscall_error + .endp __syscall_error
usr/klibc/arch/ia64/sysstub.ph new file +29 -0
@@ -0,0 +1,29 @@ +# -*- perl -*- +# +# arch/ia64/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "${outputdir}/${fname}.S"); + print OUT "#include <asm/unistd.h>\n"; + print OUT "\n"; + print OUT "\t.text\n"; + print OUT "\t.align 32\n"; + print OUT "\t.proc ${fname}\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "${fname}:\n"; + print OUT "\tmov\tr15 = __NR_${sname}\n"; + print OUT "\tbreak __BREAK_SYSCALL\n"; + print OUT "\tcmp.eq p6,p0 = -1,r10\n"; + print OUT "(p6)\tbr.few __syscall_error\n"; + print OUT "\tbr.ret.sptk.many b0\n"; + print OUT "\t.size\t${fname},.-${fname}\n"; + print OUT "\t.endp\t${fname}\n"; + close(OUT); +} + +1;
usr/klibc/arch/ia64/vfork.S new file +42 -0
42 lines not on this page · raw message