parisc support for klibc
PATCH 30/43 parisc support for klibc
The parts of klibc specific to the parisc architecture.
Signed-off-by H. Peter Anvin <[email protected]>
---
commit 078d6614054391efe17093f8d70340e2c0644ffb
tree 63a4bf899e5ca2ef3c0a8e9ef3098273012f7a33
parent ebd2860ad3dc19cb11fd5b9cc235cab54e9165f4
author H. Peter Anvin <[email protected]> Sun, 25 Jun 2006 16:58:36 -0700 committer H. Peter Anvin <[email protected]> Sun, 25 Jun 2006 16:58:36 -0700
usr/include/arch/parisc/klibc/archconfig.h | 14 ++++ usr/include/arch/parisc/klibc/archsetjmp.h | 14 ++++ usr/include/arch/parisc/klibc/archsignal.h | 25 ++++++++ usr/include/arch/parisc/klibc/archstat.h | 29 +++++++++ usr/include/arch/parisc/klibc/archsys.h | 12 ++++ usr/klibc/arch/parisc/MCONFIG | 12 ++++ usr/klibc/arch/parisc/Makefile.inc | 16 +++++ usr/klibc/arch/parisc/crt0.S | 37 ++++++++++++ usr/klibc/arch/parisc/setjmp.S | 88 ++++++++++++++++++++++++++++ usr/klibc/arch/parisc/syscall.S | 36 +++++++++++ usr/klibc/arch/parisc/sysstub.ph | 28 +++++++++ 11 files changed, 311 insertions(+), 0 deletions(-)
usr/include/arch/parisc/klibc/archconfig.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* include/arch/parisc/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 + +/* All defaults */ + +#endif /* _KLIBC_ARCHCONFIG_H */
usr/include/arch/parisc/klibc/archsetjmp.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* arch/parisc/include/klibc/archsetjmp.h +*/ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { +double regs[21 ]; +}; + +typedef struct __jmp_buf jmp_buf [1 ]; + +#endif /* _SETJMP_H */
usr/include/arch/parisc/klibc/archsignal.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* arch/parisc/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_SZ (_NSIG / LONG_BIT) + +typedef struct { +unsigned long sig[_NSIG_SZ]; +}sigset_t ; + +struct sigaction { +__sighandler_t sa_handler; +unsigned long sa_flags; +sigset_t sa_mask; +}; + +#endif
usr/include/arch/parisc/klibc/archstat.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#include <klibc/stathelp.h> + +#define _STATBUF_ST_NSEC + +struct stat { +__stdev64 (st_dev); +unsigned int __pad1; + +unsigned int __st_ino;/* Not actually filled in */ +unsigned int st_mode; +unsigned int st_nlink; +unsigned int st_uid; +unsigned int st_gid; +__stdev64 (st_rdev); +unsigned int __pad2; +signed long long st_size; +signed int st_blksize; + +signed long long st_blocks; +struct timespec st_atim; +struct timespec st_mtim; +struct timespec st_ctim; +unsigned long long st_ino; +}; + +#endif
usr/include/arch/parisc/klibc/archsys.h new file +12 -0
@@ -0,0 +1,12 @@ +/* +* arch/parisc/include/klibc/archsys.h +* +* Architecture-specific syscall definitions +*/ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */
usr/klibc/arch/parisc/MCONFIG new file +12 -0
@@ -0,0 +1,12 @@ +# -*- makefile -*- +# +# arch/parisc/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +KLIBCOPTFLAGS = -Os -fomit-frame-pointer +KLIBCBITSIZE = 32 +KLIBCSHAREDFLAGS = -Ttext 0x40001000
usr/klibc/arch/parisc/Makefile.inc new file +16 -0
@@ -0,0 +1,16 @@ +# -*- makefile -*- +# +# arch/parisc/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)/setjmp.o \ + arch/$(KLIBCARCH)/syscall.o + +KLIBCARCHOOBJS = $(patsubst %o,%.lo,%(KLIBCARCHOBJS)) + +archclean:
usr/klibc/arch/parisc/crt0.S new file +37 -0
@@ -0,0 +1,37 @@ + .align 4 + + .import $global$, data + .import __libc_init, code + + .global _start + .export _start, ENTRY + .type _start,@function + + .proc + .callinfo + +_start: +/* extend the stack by 64-bytes */ + ldo 64(%sp), %sp + +/* %r25 = argc + * %r24 = argv + * envp = argv + (argc + 1) + * elfdata = (argv - 4) + */ + ldo -4(%r24), %r26 + +/* load global data */ + ldil L%$global$, %dp + ldo R%$global$(%dp), %dp + +/* parisc abi puts the atexit pointer in %r23, see ELF_PLAT_INIT() */ + copy %r23, %r25 + +/* branch to __libc_init */ + bl __libc_init,%r2 + nop +/* break miserably if we ever return */ + iitlbp %r0,(%sr0,%r0) /* illegal instruction */ + nop + .procend
usr/klibc/arch/parisc/setjmp.S new file +88 -0
88 lines not on this page · raw message
usr/klibc/arch/parisc/syscall.S new file +36 -0
@@ -0,0 +1,36 @@ +/* + * arch/parisc/syscall.S + * + * %r20 contains the system call number, %r2 contains whence we came + * + */ + + .text + .align 64 ; cache-width aligned + .globl __syscall_common + .type __syscall_common,@function +__syscall_common: + ldo 0x40(%sp),%sp + stw %rp,-0x54(%sp) ; save return pointer + + ldw -0x74(%sp),%r22 ; %arg4 + ldw -0x78(%sp),%r21 ; %arg5 + + ble 0x100(%sr2, %r0) ; jump to gateway page + nop ; can we move a load here? + + ldi -0x1000,%r19 ; %r19 = -4096 + sub %r0,%ret0,%r22 ; %r22 = -%ret0 + cmpb,>>=,n %r19,%ret0,1f ; if %ret0 >= -4096UL + ldi -1,%ret0 ; nullified on taken forward + + /* store %r22 to errno... */ + ldil L%errno,%r1 + ldo R%errno(%r1),%r1 + stw %r22,0(%r1) +1: + ldw -0x54(%sp),%rp ; restore return pointer + bv %r0(%rp) ; jump back + ldo -0x40(%sp),%sp + + .size __syscall_common,.-__syscall_common
usr/klibc/arch/parisc/sysstub.ph new file +28 -0
@@ -0,0 +1,28 @@ +# -*- perl -*- +# +# arch/parisc/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 4\n"; + print OUT "\t.import __syscall_common, code\n"; + print OUT "\t.global ${fname}\n"; + print OUT "\t.export ${fname}, code\n"; + print OUT "\t.proc\n"; + print OUT "\.callinfo\n"; + print OUT "${fname}:\n"; + print OUT "\tb\t__syscall_common\n"; + print OUT "\t ldo\t__NR_${sname}(%r0),%r20\n"; + print OUT "\t.procend\n"; + close(OUT); +} + +1;