Search
lxdream.org :: lxdream/test/crt0.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/crt0.s
changeset 185:6755a04c447f
author nkeynes
date Mon May 26 11:01:42 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change hange 64-bit configuration to use sizeof(void *) rather than the system id
returned by config.guess - config.guess gets it wrong in some situations.
view annotate diff log raw
     1 	.section .text
     2 	.global	start
     3 	.global ___exit
     4 	.global _atexit
     5 start:
     6 	mov.l	setup_cache_k,r0
     7 	mov.l	p2_mask,r1
     8 	or	r1,r0
     9 	jmp	@r0
    10 	nop
    11 setup_cache:
    12 	mov.l	ccr_addr,r0
    13 	mov.w	ccr_data,r1
    14 	mov.l	r1,@r0
    15 	mov.l	start_2_k,r0	
    16 	nop
    17 	nop
    18 	nop
    19 	nop
    20 	nop
    21 	nop
    22 	nop
    23 	jmp	@r0	
    24 	nop
    25 start_2:		
    26 	mov.l	old_stack_k,r14
    27 	mov.l	r15,@r14
    28 	mov.l	old_pr_k,r14
    29 	sts	pr,r15
    30 	mov.l	r15,@r14
    31 	mov.l	stack_k,r15
    33 	! zero out bss
    34 	mov.l	edata_k,r0
    35 	mov.l	end_k,r1
    36 	mov	#0,r2
    37 start_l:
    38 	mov.l	r2,@r0
    39 	add	#4,r0
    40 	cmp/ge	r0,r1
    41 	bt	start_l
    43 #if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY)
    44 	mov.l set_fpscr_k, r1
    45 	jsr @r1
    46 	mov #0,r4
    47 	lds r3,fpscr
    48 #endif /*  defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) */
    50 	! call the mainline	
    51 	mov.l	main_k,r0
    52 	jsr	@r0
    53 	or	r0,r0
    55 	! call exit
    56 	mov	r0,r4
    57 	mov.l	exit_k,r0
    58 	jsr	@r0
    59 	or	r0,r0
    61 ___exit:
    62 	mov.l	old_pr_k,r14
    63 	mov.l	@r14,r15	
    64 	lds	r15,pr
    65 	mov.l	old_stack_k,r14
    66 	mov.l	@r14,r15	
    67 	rts
    68 	nop
    70 _atexit:
    71 	rts
    72 	nop
    74 	.align 4
    75 #if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
    76 set_fpscr_k:
    77 	.long	___set_fpscr
    78 #endif /*  defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) */
    79 stack_k:
    80 	.long	_stack	
    81 edata_k:
    82 	.long	_edata
    83 end_k:
    84 	.long	_end
    85 main_k:
    86 	.long	_main
    87 exit_k:
    88 	.long	_exit
    90 old_stack_k:
    91 	.long	_old_stack
    92 old_pr_k:
    93 	.long	_old_pr
    95 _old_stack:
    96 	.long	0
    97 _old_pr:
    98 	.long	0
   100 setup_cache_k:
   101 	.long	setup_cache
   102 start_2_k:	
   103 	.long	start_2	
   104 p2_mask:
   105 	.long	0xa0000000
   106 ccr_addr:
   107 	.long	0xff00001c
   108 ccr_data:
   109 	.word	0x090b
   111 	.align 4
   113 #ifdef __ELF__
   114 	.section .stack,"aw"
   115 #else
   116 	.section .stack
   117 #endif
   118 ! _stack:	.long	0xdeaddead
.