diff options
author | H. Peter Anvin <hpa@zytor.com> | 2004-06-10 05:30:21 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2004-06-10 05:30:21 +0000 |
commit | 39fb2d94eafcb877c22a9b2571d56cd71d330f60 (patch) | |
tree | 99f5b312a7098211bb17ae9053aa62318bf99f85 | |
parent | 16cef1d7c2db3a5cc3bf7f2262eb1335be8dd0fe (diff) | |
download | klibc-39fb2d94eafcb877c22a9b2571d56cd71d330f60.tar.gz |
More work on the cris architecture, but apparently it needsklibc-0.135
multiply/divide helper functions, and might have some problem with ld?
-rw-r--r-- | klibc/Makefile | 2 | ||||
-rw-r--r-- | klibc/arch/cris/MCONFIG | 7 | ||||
-rw-r--r-- | klibc/arch/cris/Makefile.inc | 5 | ||||
-rw-r--r-- | klibc/arch/cris/crt0.S | 27 | ||||
-rw-r--r-- | klibc/arch/cris/setjmp.S | 26 | ||||
-rw-r--r-- | klibc/arch/cris/syscall.S | 25 | ||||
-rw-r--r-- | klibc/arch/cris/sysstub.ph | 23 |
7 files changed, 53 insertions, 62 deletions
diff --git a/klibc/Makefile b/klibc/Makefile index b05a7e44c8c7c..2ef8076e357fb 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -71,7 +71,7 @@ tests/% : tests/%.o $(LIB) $(CRT0) $(STRIP) $@.stripped tests/%.shared : tests/%.o interp.o $(SOLIB) - $(LD) $(LDFLAGS) -o $@ -e main interp.o tests/$*.o -R $(SOLIB) $(LIBGCC) + $(LD) $(LDFLAGS) -o $@ $(EMAIN) interp.o tests/$*.o -R $(SOLIB) $(LIBGCC) cp $@ $@.stripped $(STRIP) $@.stripped diff --git a/klibc/arch/cris/MCONFIG b/klibc/arch/cris/MCONFIG index 33e0c4806bbab..618157672a49e 100644 --- a/klibc/arch/cris/MCONFIG +++ b/klibc/arch/cris/MCONFIG @@ -13,5 +13,8 @@ BITSIZE = 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 -# 96? MB - normal binaries start at 128? MB -SHAREDFLAGS = -Ttext 0x06000200 +# 1008 MB - normal binaries start at 0 +SHAREDFLAGS = -Ttext 0x3f000200 + +# How to tell the linker main() is the entrypoint +EMAIN := -e _main diff --git a/klibc/arch/cris/Makefile.inc b/klibc/arch/cris/Makefile.inc index 9c8ed6dc44cab..ab350965c2ebe 100644 --- a/klibc/arch/cris/Makefile.inc +++ b/klibc/arch/cris/Makefile.inc @@ -10,11 +10,6 @@ ARCHOBJS = \ arch/$(ARCH)/setjmp.o \ arch/$(ARCH)/syscall.o \ - libgcc/__ashldi3.o \ - libgcc/__ashrdi3.o \ - libgcc/__lshrdi3.o \ - libgcc/__muldi3.o \ - libgcc/__negdi2.o \ libgcc/__divdi3.o \ libgcc/__moddi3.o \ libgcc/__udivdi3.o \ diff --git a/klibc/arch/cris/crt0.S b/klibc/arch/cris/crt0.S index 34fe875cc2d57..73a262fe91aa8 100644 --- a/klibc/arch/cris/crt0.S +++ b/klibc/arch/cris/crt0.S @@ -8,22 +8,21 @@ # arguments. # - .set noreorder - .text .balign 4 - .type _start,@function - .globl _start -_start: - # Set up a dummy stack frame to keep gcc from getting confused - push $p8 # p8 == 0 - push $p8 # p8 == 0 - - # Save the address of the ELF argument array - move.d $sp,$r10 # Address of ELF arguments + .type __start,@function + .globl __start +__start: + /* Save the address of the ELF argument array */ + move.d $sp,$r10 /* Address of ELF arguments */ - jump __libc_init - moveq.d 0,$r11 # atexit() function [assume null] + /* atexit() function (assume null) */ + moveq 0,$r11 + + /* Set up a dummy stack frame to keep gcc from getting confused */ + push $r11 + jump ___libc_init + push $r11 - .size _start, .-_start + .size __start, .-__start diff --git a/klibc/arch/cris/setjmp.S b/klibc/arch/cris/setjmp.S index 8506810588652..cc451037a80d5 100644 --- a/klibc/arch/cris/setjmp.S +++ b/klibc/arch/cris/setjmp.S @@ -11,28 +11,26 @@ # return address # - .set noreorder - .text - .align 4 - .globl setjmp - .type setjmp, @function -setjmp: - movem $r8,[$r10+] # Save $r8..$r0 at $r10.. + .balign 4 + .globl _setjmp + .type _setjmp, @function +_setjmp: + movem $r8,[$r10+] /* Save $r8..$r0 at $r10... */ move.d $sp,[$r10+] ret move $srp,[$r10+] - .size setjmp,.-setjmp + .size _setjmp,.-_setjmp .text - .align 4 - .globl longjmp - .type longjmp, @function -longjmp: - movem [$r10+],$r8 # Load $r8..$r0 from $r10.. + .balign 4 + .globl _longjmp + .type _longjmp, @function +_longjmp: + movem [$r10+],$r8 /* Load $r8..$r0 from $r10... */ move.d [$r10+],$sp jump [$r10+] move.d $r11,$r10 - .size longjmp,.-longjmp + .size _longjmp,.-_longjmp diff --git a/klibc/arch/cris/syscall.S b/klibc/arch/cris/syscall.S index 12d8ce7a1c6a9..b913b1e2e1925 100644 --- a/klibc/arch/cris/syscall.S +++ b/klibc/arch/cris/syscall.S @@ -7,26 +7,23 @@ * to save $srp around the system call. */ - .set noreorder - - .text - .subsection ".syscall" - .align 4 - .globl __syscall_common - .type __syscall_common,@function -__syscall_common: + .section ".text","ax" + .balign 4 + .globl ___syscall_common + .type ___syscall_common,@function +___syscall_common: push $srp - move.d [$sp+4],$mof - move.d [$sp+8],$srp + move [$sp+4],$mof + move [$sp+8],$srp break 13 - cmpq.d -4096,$r10 + cmp.d -4096,$r10 blt 1f neg.d $r10,$r11 - move.d $r11,[errno] - moveq.d -1,$r10 + move.d $r11,[_errno] + moveq -1,$r10 1: jump [sp+] nop - .size __syscall_common,.-__syscall_common + .size ___syscall_common,.-___syscall_common diff --git a/klibc/arch/cris/sysstub.ph b/klibc/arch/cris/sysstub.ph index cc4ca3a95ec67..42e94f2cea9df 100644 --- a/klibc/arch/cris/sysstub.ph +++ b/klibc/arch/cris/sysstub.ph @@ -5,25 +5,24 @@ # Script to generate system call stubs # -# We use a subsection for the syscall stubs, so we can be -# sure they're within reach of a 16-bit BA - sub make_sysstub($$$$@) { my($fname, $type, $sname, $stype, @args) = @_; open(OUT, '>', "syscalls/${fname}.S"); print OUT "#include <asm/unistd.h>\n"; print OUT "\n"; - print OUT "\t.set noreorder\n"; - print OUT "\n"; print OUT "\t.text\n"; - print OUT "\t.subsection \".syscall\"\n"; - print OUT "\t.type ${fname},\@function\n"; - print OUT "\t.globl ${fname}\n"; - print OUT "${fname}:\n"; - print OUT "\tba\t__syscall_common\n"; - print OUT "\t move.d\t__NR_${sname}, $r9\n"; - print OUT "\t.size ${fname},.-${fname}\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 "\tjump\t___syscall_common\n"; + print OUT "#if __NR_${sname} <= 31\n"; + print OUT "\t moveq\t__NR_${sname}, \$r9\n"; + print OUT "#else\n"; + print OUT "\t move.d\t__NR_${sname}, \$r9\n"; + print OUT "#endif\n"; + print OUT "\t.size _${fname},.-_${fname}\n"; close(OUT); } |