From 9ce85441f842f639a06205c1df1abd90487b8dc4 Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Wed, 22 Feb 2006 08:54:46 +0000 Subject: Cleaned up the assembler code a little. --- libc/sysdeps/linux/cris/crt1.S | 60 ++++++++++++++++++++---------------------- libc/sysdeps/linux/cris/crti.S | 57 ++++++++++++++++++--------------------- libc/sysdeps/linux/cris/crtn.S | 42 +++++++++++++---------------- 3 files changed, 73 insertions(+), 86 deletions(-) (limited to 'libc/sysdeps/linux/cris') diff --git a/libc/sysdeps/linux/cris/crt1.S b/libc/sysdeps/linux/cris/crt1.S index e0ba8a4dd..b07e36b51 100644 --- a/libc/sysdeps/linux/cris/crt1.S +++ b/libc/sysdeps/linux/cris/crt1.S @@ -2,28 +2,30 @@ #include + .syntax no_register_prefix + /* The first piece of initialized data. */ -.data -.global __data_start -.align 2 -.type __data_start, @object -.size __data_start, 4 + .data + .global __data_start + .align 2 + .type __data_start, @object + .size __data_start, 4 __data_start: .dword 0 -.text -.align 1 -.global _start -.type _start,%function + .text + .align 1 + .global _start + .type _start, %function #if defined(__UCLIBC_CTOR_DTOR__) -.type _init,%function -.type _fini,%function + .type _init, %function + .type _fini, %function #else -.weak _init -.weak _fini + .weak _init + .weak _fini #endif -.type main,%function -.type __uClibc_main,%function + .type main, %function + .type __uClibc_main, %function /* * On the stack we have argc. We can calculate argv/envp @@ -39,20 +41,16 @@ __data_start: */ _start: - pop $r10 - move.d $sp, $r11 - jump .L1 - -.L1: - Push $srp - Subq 4,$sp - move.d $r10,$r9 - move.d $r11,$r12 - move.d _fini,$r13 - move.d $r13,[$sp] - move.d main,$r10 - move.d $r9,$r11 - move.d _init,$r13 + move.d main, r10 + move.d [sp+], r11 + move.d sp, r12 + subq 4, sp + move srp, [sp] + subq 4, sp + move.d _fini, r13 + move.d r13, [sp] + move.d _init, r13 /* Leave control to the libc */ - jsr __uClibc_main -.size _start,.-_start + jsr __uClibc_main + nop + .size _start, .-_start diff --git a/libc/sysdeps/linux/cris/crti.S b/libc/sysdeps/linux/cris/crti.S index 78a1862ef..0740c765d 100644 --- a/libc/sysdeps/linux/cris/crti.S +++ b/libc/sysdeps/linux/cris/crti.S @@ -1,36 +1,29 @@ -#NO_APP - .file "initfini.c" -#APP - - .section .init -#NO_APP - .align 1 - .global _init +/* glibc's sysdeps/cris/elf/initfini.c used for reference [PROLOG] */ + + .section .init + .align 1 + .global _init .type _init, @function _init: - Push $srp - subq 4,$sp - movem $r0,[$sp] - move.d $pc,$r0 - sub.d .:GOTOFF,$r0 -#APP - - .align 1 - - - .section .fini -#NO_APP - .align 1 - .global _fini + subq 4,$sp + move.d $r1,[$sp] + move $srp,$r1 + subq 4,$sp + move.d $r0,[$sp] + move.d $pc,$r0 + sub.d .:GOTOFF,$r0 + .align 1 + + .section .fini + .align 1 + .global _fini .type _fini, @function _fini: - Push $srp - subq 4,$sp - movem $r0,[$sp] - move.d $pc,$r0 - sub.d .:GOTOFF,$r0 -#APP - .align 1 - - -/*@TRAILER_BEGINS*/ + subq 4,$sp + move.d $r1,[$sp] + move $srp,$r1 + subq 4,$sp + move.d $r0,[$sp] + move.d $pc,$r0 + sub.d .:GOTOFF,$r0 + .align 1 diff --git a/libc/sysdeps/linux/cris/crtn.S b/libc/sysdeps/linux/cris/crtn.S index e9d8a963f..951ae5449 100644 --- a/libc/sysdeps/linux/cris/crtn.S +++ b/libc/sysdeps/linux/cris/crtn.S @@ -1,27 +1,23 @@ -#NO_APP - .file "initfini.c" -#APP - - .section .init -#NO_APP - .align 1 - .global _init +/* glibc's sysdeps/cris/elf/initfini.c used for reference [EPILOG] */ + + .section .init + .align 1 + .global _init .type _init, @function -#NO_APP - movem [$sp+],$r0 - Jump [$sp+] + move.d [$sp+],$r0 + move $r1,$srp + move.d [$sp+],$r1 + Ret + nop .size _init, .-_init -#APP - - .section .fini -#NO_APP - .align 1 - .global _fini + + .section .fini + .align 1 + .global _fini .type _fini, @function -#NO_APP - movem [$sp+],$r0 - Jump [$sp+] + move.d [$sp+],$r0 + move $r1,$srp + move.d [$sp+],$r1 + Ret + nop .size _fini, .-_fini -#APP - -/*@TRAILER_BEGINS*/ -- cgit v1.2.3