1 /* crt0.S -- startup file for hppa.
3 * Copyright (c) 1995 Cygnus Support
5 * The authors hereby grant permission to use, copy, modify, distribute,
6 * and license this software and its documentation for any purpose, provided
7 * that existing copyright notices are retained in all copies and that this
8 * notice is included verbatim in any distributions. No written agreement,
9 * license, or royalty fee is required for any of the authorized uses.
10 * Modifications to this software may be copyrighted by their authors
11 * and need not follow the licensing terms described here, provided that
12 * the new terms are clearly indicated on the first page of each file where
16 .COPYRIGHT "crt0.o for the PA"
21 * Set up the standard spaces (sections) These definitions come
22 * from /lib/pcc_prefix.s.
27 * stuff we need that's defined elsewhere.
31 .IMPORT _bss_start, DATA
36 * start -- set things up so the application will run.
40 .CALLINFO SAVE_SP, FRAME=48
44 /* FIXME: this writes to page zero */
45 ;; setup the %30 (stack pointer) with some memory
47 ldo R%_stack(%r30),%r30
49 ;; we need to set %r27 (global data pointer) here too
51 ldo R%$global$(%r27),%r27 ; same problem as above
54 * zerobss -- zero out the bss section
56 ; load the start of bss
58 ldo R%_bss_start(%r4),%r4
66 addi -1,%r5,%r5 ; decrement _bss_end
67 stb %r0,0(0,%r5) ; we do this by bytes for now even
68 ; though it's slower, it's safer
69 combf,= %r4,%r5, L$bssloop
75 * Call the main routine from the application to get it going.
76 * main (argc, argv, environ)
77 * We pass argv as a pointer to NULL.
84 * Call exit() from the C library with the return value from main()
93 * _exit -- Exit from the application. Normally we cause a user trap
94 * to return to the ROM monitor for another run.
102 ;; This just causes a breakpoint exception
110 * _sr4export -- support for called functions. (mostly for GDB)
112 .EXPORT _sr4export, ENTRY
120 ldw -24(%sr0,%sp),%rp