URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [sys/] [go32/] [crt0.S] - Rev 1765
Compare with Previous | Blame | View Log
/*** Called as start(argc, argv, envp)*//* gs:edx points to prog_info structure. All other registers are OBSOLETE** but included for backwards compatibility*//* These symbols are for global constructors and destructors */#if 0.section .ctor.globl ___go32_first_ctor___go32_first_ctor:.section .dtor.globl ___go32_last_ctor___go32_last_ctor:.globl ___go32_first_dtor___go32_first_dtor:.data.globl ___go32_last_dtor___go32_last_dtor:#endif.text.globl _start_start:.globl startstart:#ifdef EMU387pushapush %gs#endifmovl %eax,__hard_mastermovl %esi,___pidmovl %edi,___transfer_buffermovl %ebx,_ScreenPrimarymovl %ebp,_ScreenSecondarycmpl $0, %edxje Lcopy_nonemovw %gs,%cxmovw %ds,%axcmpw %cx,%axje Lcopy_nonemovl %gs:(%edx), %ecxcmpl __go32_info_block, %ecxjbe Lcopy_lessmovl __go32_info_block, %ecxLcopy_less:movl $__go32_info_block, %ediaddl $3, %ecxandl $0xfffffffc, %ecxmovl %ecx, (%edi)addl $4, %ediaddl $4, %edxsubl $4, %ecxLcopy_more:movl %gs:(%edx), %eaxmovl %eax, (%edi)addl $4, %edxaddl $4, %edisubl $4, %ecxjnz Lcopy_moremovl __go32_info_block+4, %eaxmovl %eax, _ScreenPrimarymovl __go32_info_block+8, %eaxmovl %eax, _ScreenSecondary/* Backward compatibility - do not copy this one!** movl __go32_info_block+12, %eax** movl %eax, ___transfer_buffer*/movl __go32_info_block+20, %eaxmovl %eax, ___pidmovl __go32_info_block+24, %eaxmovl %eax, __hard_masterjmp Lcopy_doneLcopy_none:movl %ebx,__go32_info_block+4movl %ebp,__go32_info_block+8movl %edi,__go32_info_block+12movl $4096,__go32_info_block+16movl %esi,__go32_info_block+20movl %eax,__go32_info_block+24movl $28, __go32_info_blockLcopy_done:#ifndef EMU387call __setstack#endifxorl %esi,%esixorl %edi,%edixorl %ebp,%ebpxorl %ebx,%ebxmovl %esp,%ebx#ifdef MAKE_GCRT0call mcount_init /* initialize the profiler */#endifmovl 8(%ebx),%eaxpushl %eaxmovl %eax,_environpushl 4(%ebx)pushl (%ebx)call ___maincall _mainaddl $12,%esp#ifdef EMU387pop %gspopa#elsepushl %eaxcall _exitexit_again:movl $0x4c00,%eaxint $0x21jmp exit_again#endifret#ifdef MAKE_GCRT0.globl __exit__exit:call mcount_write /* make sure we dump the output */exit_again2:movb 4(%esp),%almovb $0x4c,%ahint $0x21jmp exit_again2/* Here is where we initialize the timer interrupt - specific to go32 *//* In this case, the timer calls mcount_isr */.globl mcount_isr_initmcount_isr_init:movw __go32_info_block+36, %ax /* run mode */cmp $1,%axjb skip_mcountcmp $3,%axja skip_mcountmovw $16,%axmovw %ax,%gsmovzbl __hard_master,%eax /* timer is on irq 0 */shll $3,%eax /* times 8 bpv *//* movl $960,%eax vector 0x78 * 8 bpv */movw %gs:(%eax),%cxmovw %cx,mc_chainmovw %gs:6(%eax),%cxmovw %cx,mc_chain_himovw %gs:2(%eax),%cxmovw %cx,mc_chain_selmovl $mcount_isr,%ecxmovw %cx,%gs:(%eax)movw $0xd8,%gs:2(%eax) /* selector 27 == 32-bit code */movw $0x8f00,%gs:4(%eax)rorl $16,%ecxmovw %cx,%gs:6(%eax)movw %ds,%axmovw %ax,%gsskip_mcount:movl mcount_histogram,%eaxmovl $1,(%eax)ret/* Obtain the PC where we interrupted, and bump the histogram. We should *//* do error checking here, but we don't. This routine is specific to go32 *//* in some spots */mcount_isr:pushl %eaxcmpl $1,mcount_skipje L0movl 4(%esp),%eax /* get the PC */subl $0x1020,%eax /* to fit in low..high */andl $0xfffffffc,%eaxshrl $1,%eax /* now points to one 4-byte entry */addl mcount_histogram,%eaxincw (%eax)L0:popl %eaxljmp mc_chain /* chain to the next timer vector */iret#endif.data.globl _environ_environ:.long 0.globl ___pid___pid:.long 42.globl ___transfer_buffer___transfer_buffer:.long 0.globl _ScreenPrimary_ScreenPrimary:.long 0.globl _ScreenSecondary_ScreenSecondary:.long 0.globl __hard_master.globl __hard_slave.globl __core_select__hard_master:.byte 0__hard_slave:.byte 0__core_select:.short 0#ifdef MAKE_GCRT0mc_chain:.short 0mc_chain_hi:.short 0mc_chain_sel:.short 0#endif
