Search
lxdream.org :: lxdream/test/lib/crt0.s
lxdream 0.9.1
released Jun 29
Download Now
filename test/lib/crt0.s
changeset 976:e57a25d9eb7d
prev812:8cc61d5ea1f8
author nkeynes
date Fri Dec 02 18:18:04 2011 +1000 (10 years ago)
permissions -rw-r--r--
last change SH4 shadow-mode tweaks
- Fix exceptions generated by the translator to account for the excepting
instruction(s) in the cycle counts.
- Compare floating point regs bitwise rather than with FP comparisons
(otherwise can fail due to nan != nan)
- Dump the translated block when we abort with an inconsistency
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 	mov.l sr_data, r1
    51 	ldc r1, sr
    53 	! call the mainline	
    54 	mov.l	main_k,r0
    55 	jsr	@r0
    56 	or	r0,r0
    58 	! call exit
    59 	mov	r0,r4
    60 	mov.l	exit_k,r0
    61 	jsr	@r0
    62 	or	r0,r0
    64 ___exit:
    65 	mov.l	old_pr_k,r14
    66 	mov.l	@r14,r15	
    67 	lds	r15,pr
    68 	mov.l	old_stack_k,r14
    69 	mov.l	@r14,r15	
    70 	rts
    71 	nop
    73 _atexit:
    74 	rts
    75 	nop
    77 	.align 4
    78 #if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
    79 set_fpscr_k:
    80 	.long	___set_fpscr
    81 #endif /*  defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) */
    82 stack_k:
    83 	.long	_stack	
    84 edata_k:
    85 	.long	_edata
    86 end_k:
    87 	.long	_end
    88 main_k:
    89 	.long	_main
    90 exit_k:
    91 	.long	_exit
    93 old_stack_k:
    94 	.long	_old_stack
    95 old_pr_k:
    96 	.long	_old_pr
    98 _old_stack:
    99 	.long	0
   100 _old_pr:
   101 	.long	0
   103 setup_cache_k:
   104 	.long	setup_cache
   105 start_2_k:	
   106 	.long	start_2	
   107 p2_mask:
   108 	.long	0xa0000000
   109 sr_data:
   110 	.long   0x400000f0
   111 ccr_addr:
   112 	.long	0xff00001c
   113 ccr_data:
   114 	.word	0x090b
   116 	.align 4
   118 #ifdef __ELF__
   119 	.section .stack,"aw"
   120 #else
   121 	.section .stack
   122 #endif
   123 ! _stack:	.long	0xdeaddead
.