m32r support for klibc
PATCH 26/43 m32r support for klibc
The parts of klibc specific to the m32r architecture.
Signed-off-by H. Peter Anvin <[email protected]>
---
commit 7ba219f9bcddda38ddc9010b54fd10431292f744
tree 1cf287dfd321d6b980789f49bb0750e8a4217c22
parent 951dc85bd690c6cc5a971815665da947160cbe51
author H. Peter Anvin <[email protected]> Sun, 25 Jun 2006 16:58:27 -0700 committer H. Peter Anvin <[email protected]> Sun, 25 Jun 2006 16:58:27 -0700
usr/include/arch/m32r/klibc/archconfig.h | 14 +++++++++ usr/include/arch/m32r/klibc/archsetjmp.h | 21 +++++++++++++ usr/include/arch/m32r/klibc/archsignal.h | 14 +++++++++ usr/include/arch/m32r/klibc/archstat.h | 39 +++++++++++++++++++++++++ usr/include/arch/m32r/klibc/archsys.h | 12 ++++++++ usr/klibc/arch/m32r/MCONFIG | 18 +++++++++++ usr/klibc/arch/m32r/Makefile.inc | 19 ++++++++++++ usr/klibc/arch/m32r/crt0.S | 24 +++++++++++++++ usr/klibc/arch/m32r/setjmp.S | 47 ++++++++++++++++++++++++++++++ usr/klibc/arch/m32r/syscall.S | 29 +++++++++++++++++++ usr/klibc/arch/m32r/sysstub.ph | 25 ++++++++++++++++ 11 files changed, 262 insertions(+), 0 deletions(-)
usr/include/arch/m32r/klibc/archconfig.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* include/arch/m32r/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/m32r/klibc/archsetjmp.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* arch/m32r/include/klibc/archsetjmp.h +*/ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { +unsigned long __r8; +unsigned long __r9; +unsigned long __r10; +unsigned long __r11; +unsigned long __r12; +unsigned long __r13; +unsigned long __r14; +unsigned long __r15; +}; + +typedef struct __jmp_buf jmp_buf [1 ]; + +#endif /* _KLIBC_ARCHSETJMP_H */
usr/include/arch/m32r/klibc/archsignal.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* arch/m32r/include/klibc/archsignal.h +* +* Architecture-specific signal definitions +* +*/ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +#include <asm/signal.h> +/* No special stuff for this architecture */ + +#endif
usr/include/arch/m32r/klibc/archstat.h new file +39 -0
@@ -0,0 +1,39 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#include <klibc/stathelp.h> + +#define _STATBUF_ST_NSEC + +/* This matches struct stat64 in glibc2.1, hence the absolutely +* insane amounts of padding around dev_t's. +*/ +struct stat { +__stdev64 (st_dev); +unsigned char __pad0[4 ]; + +unsigned long __st_ino; + +unsigned int st_mode; +unsigned int st_nlink; + +unsigned long st_uid; +unsigned long st_gid; + +__stdev64 (st_rdev); +unsigned char __pad3[4 ]; + +long long st_size; +unsigned long st_blksize; + +unsigned long st_blocks;/* Number 512-byte blocks allocated. */ +unsigned long __pad4;/* future possible st_blocks high bits */ + +struct timespec st_atim; +struct timespec st_mtim; +struct timespec st_ctim; + +unsigned long long st_ino; +}; + +#endif
usr/include/arch/m32r/klibc/archsys.h new file +12 -0
@@ -0,0 +1,12 @@ +/* +* arch/m32r/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/m32r/MCONFIG new file +18 -0
@@ -0,0 +1,18 @@ +# -*- makefile -*- +# +# arch/m32r/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 = 32 + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# 224 MB - normal binaries start at 0 (?) +# (lib?)gcc on cris seems to insist on producing .init and .fini sections +KLIBCSHAREDFLAGS = --section-start .init=0x0e000100
usr/klibc/arch/m32r/Makefile.inc new file +19 -0
@@ -0,0 +1,19 @@ +# -*- makefile -*- +# +# arch/m32r/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 \ + libgcc/__divdi3.o \ + libgcc/__moddi3.o \ + libgcc/__udivdi3.o \ + libgcc/__umoddi3.o \ + libgcc/__udivmoddi4.o + +archclean:
usr/klibc/arch/m32r/crt0.S new file +24 -0
@@ -0,0 +1,24 @@ +# +# arch/m32r/crt0.S +# +# Does arch-specific initialization and invokes __libc_init +# with the appropriate arguments. +# +# See __static_init.c or __shared_init.c for the expected +# arguments. +# + + .text + .balign 4 + .type _start,@function + .globl _start +_start: + /* Save the address of the ELF argument array */ + mv r0, sp + + /* atexit() function (assume null) */ + xor r1, r1 + + bl __libc_init + + .size _start, .-_start
usr/klibc/arch/m32r/setjmp.S new file +47 -0
47 lines not on this page · raw message
usr/klibc/arch/m32r/syscall.S new file +29 -0
@@ -0,0 +1,29 @@ +/* + * arch/m32r/syscall.S + * + * r7 contains the syscall number (set by stub); + * r0..r3 contains arguments 0-3 per standard calling convention; + * r4..r5 contains arguments 4-5, but we have to get those from + * the stack. + */ + + .section ".text","ax" + .balign 4 + .globl __syscall_common + .type __syscall_common,@function +__syscall_common: + ld r4,@sp + ld r5,@(4,sp) + trap #2 + cmpi r0, #-4096 + bnc 1f + jmp r14 +1: + seth r2,#high(errno) + or3 r2,r2,#low(errno) + neg r1,r0 + st r1,@r7 + ldi r0,#-1 + jmp r14 + + .size __syscall_common,.-__syscall_common
usr/klibc/arch/m32r/sysstub.ph new file +25 -0
@@ -0,0 +1,25 @@ +# -*- perl -*- +# +# arch/m32r/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.type\t${fname},\@function\n"; + print OUT "\t.globl\t${fname}\n"; + print OUT "\t.balign\t4\n"; + print OUT "${fname}:\n"; + print OUT "\tldi\tr7,#__NR_${sname}\n"; + print OUT "\tbra\t__syscall_common\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + close(OUT); +} + +1;