Search
lxdream.org :: lxdream/test/crt0.s :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/crt0.s
changeset 185:6755a04c447f
author nkeynes
date Tue Jul 11 01:35:27 2006 +0000 (13 years ago)
permissions -rw-r--r--
last change First commit of system test framework. 3 initial test cases (incomplete):
testide, testmath, and testta
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/crt0.s Tue Jul 11 01:35:27 2006 +0000
1.3 @@ -0,0 +1,119 @@
1.4 + .section .text
1.5 + .global start
1.6 + .global ___exit
1.7 + .global _atexit
1.8 +start:
1.9 + mov.l setup_cache_k,r0
1.10 + mov.l p2_mask,r1
1.11 + or r1,r0
1.12 + jmp @r0
1.13 + nop
1.14 +setup_cache:
1.15 + mov.l ccr_addr,r0
1.16 + mov.w ccr_data,r1
1.17 + mov.l r1,@r0
1.18 + mov.l start_2_k,r0
1.19 + nop
1.20 + nop
1.21 + nop
1.22 + nop
1.23 + nop
1.24 + nop
1.25 + nop
1.26 + jmp @r0
1.27 + nop
1.28 +start_2:
1.29 + mov.l old_stack_k,r14
1.30 + mov.l r15,@r14
1.31 + mov.l old_pr_k,r14
1.32 + sts pr,r15
1.33 + mov.l r15,@r14
1.34 + mov.l stack_k,r15
1.35 +
1.36 + ! zero out bss
1.37 + mov.l edata_k,r0
1.38 + mov.l end_k,r1
1.39 + mov #0,r2
1.40 +start_l:
1.41 + mov.l r2,@r0
1.42 + add #4,r0
1.43 + cmp/ge r0,r1
1.44 + bt start_l
1.45 +
1.46 +#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY)
1.47 + mov.l set_fpscr_k, r1
1.48 + jsr @r1
1.49 + mov #0,r4
1.50 + lds r3,fpscr
1.51 +#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) */
1.52 +
1.53 + ! call the mainline
1.54 + mov.l main_k,r0
1.55 + jsr @r0
1.56 + or r0,r0
1.57 +
1.58 + ! call exit
1.59 + mov r0,r4
1.60 + mov.l exit_k,r0
1.61 + jsr @r0
1.62 + or r0,r0
1.63 +
1.64 +___exit:
1.65 + mov.l old_pr_k,r14
1.66 + mov.l @r14,r15
1.67 + lds r15,pr
1.68 + mov.l old_stack_k,r14
1.69 + mov.l @r14,r15
1.70 + rts
1.71 + nop
1.72 +
1.73 +_atexit:
1.74 + rts
1.75 + nop
1.76 +
1.77 + .align 4
1.78 +#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
1.79 +set_fpscr_k:
1.80 + .long ___set_fpscr
1.81 +#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) */
1.82 +stack_k:
1.83 + .long _stack
1.84 +edata_k:
1.85 + .long _edata
1.86 +end_k:
1.87 + .long _end
1.88 +main_k:
1.89 + .long _main
1.90 +exit_k:
1.91 + .long _exit
1.92 +
1.93 +old_stack_k:
1.94 + .long _old_stack
1.95 +old_pr_k:
1.96 + .long _old_pr
1.97 +
1.98 +_old_stack:
1.99 + .long 0
1.100 +_old_pr:
1.101 + .long 0
1.102 +
1.103 +setup_cache_k:
1.104 + .long setup_cache
1.105 +start_2_k:
1.106 + .long start_2
1.107 +p2_mask:
1.108 + .long 0xa0000000
1.109 +ccr_addr:
1.110 + .long 0xff00001c
1.111 +ccr_data:
1.112 + .word 0x090b
1.113 +
1.114 + .align 4
1.115 +
1.116 +#ifdef __ELF__
1.117 + .section .stack,"aw"
1.118 +#else
1.119 + .section .stack
1.120 +#endif
1.121 +! _stack: .long 0xdeaddead
1.122 +
.