OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [libgloss/] [i386/] [cygmon-crt0.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 56 joel
/*
2
 * crt0 startup code for user programs running under Cygmon
3
 *
4
 * Copyright (c) 1998 Cygnus Support
5
 *
6
 * The authors hereby grant permission to use, copy, modify, distribute,
7
 * and license this software and its documentation for any purpose, provided
8
 * that existing copyright notices are retained in all copies and that this
9
 * notice is included verbatim in any distributions. No written agreement,
10
 * license, or royalty fee is required for any of the authorized uses.
11
 * Modifications to this software may be copyrighted by their authors
12
 * and need not follow the licensing terms described here, provided that
13
 * the new terms are clearly indicated on the first page of each file where
14
 * they apply.
15
 */
16
 
17
#ifndef NEED_UNDERSCORE
18
#define SYM(X) X
19
#else
20
#define SYM(X) _ ## X
21
#endif
22
 
23
.data
24
        .align  8
25
SYM(environ):
26
        .long   0
27
 
28
SYM(argc):
29
        .long   0
30
 
31
        .text
32
        .align 4
33
 
34
        .globl SYM(_start)
35
SYM(_start):
36
        /* see if the stack is already setup. if not, then default
37
         *  to using the value of %sp as set by the ROM monitor
38
         */
39
        lea __stack,%eax
40
        cmpl $0,%eax
41
        jz 1f
42
        mov %eax, %esp
43
1:
44
        mov $0, %ebp
45
 
46
        lea __bss_start, %eax
47
2:
48
        movb $0,(%eax)
49
        inc %eax
50
        cmp $__bss_end,%eax
51
        jl 2b
52
 
53
2:
54
        pushl $SYM(__sigtramp)
55
        pushl $0
56
        call SYM(__install_signal_handler)
57
        add $4, %esp
58
 
59
        pushl $SYM(__do_global_dtors)
60
        call SYM(atexit)
61
        add $4, %esp
62
 
63
        call SYM(__do_global_ctors)
64
 
65
        pushl $SYM(argc)
66
        call SYM(__get_program_arguments)
67
        add $4, %esp
68
 
69
        pushl %eax
70
        lea SYM(argc), %ebx
71
        pushl (%ebx)
72
        call SYM(main)
73
        add $8, %esp
74
 
75
        /* call exit from the C library so atexit gets called, and the
76
         * C++ destructors get run. This calls our exit routine below
77
         * when it's done.
78
         */
79
        pushl %eax
80
        call    SYM(exit)
81
3:
82
        jmp 3b

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.