Last change
on this file since 509 was
444,
checked in by satin@…, 7 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.5 KB
|
Rev | Line | |
---|
[444] | 1 | /* linux-crt0 -- Startup routines for the Linux BSP. |
---|
| 2 | * |
---|
| 3 | * Copyright (c) 2011 Edgar E. Iglesias |
---|
| 4 | * |
---|
| 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 |
---|
| 13 | * they apply. |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | .section .text |
---|
| 17 | .globl _start |
---|
| 18 | .ent _start |
---|
| 19 | .type _start, @function |
---|
| 20 | _start: |
---|
| 21 | la r13, r0, _SDA_BASE_ |
---|
| 22 | la r2, r0, _SDA2_BASE_ |
---|
| 23 | |
---|
| 24 | brlid r15, __init |
---|
| 25 | nop |
---|
| 26 | |
---|
| 27 | lwi r5, r1, 0 |
---|
| 28 | addik r6, r1, 4 |
---|
| 29 | |
---|
| 30 | # Add argc * 4. |
---|
| 31 | addk r7, r5, r5 |
---|
| 32 | addk r7, r7, r7 |
---|
| 33 | |
---|
| 34 | brlid r15, main |
---|
| 35 | # Now add 4 + r1 (i.e r6) in the delayslot. |
---|
| 36 | addk r7, r7, r6 |
---|
| 37 | |
---|
| 38 | brlid r15, exit |
---|
| 39 | addik r5, r3, 0 |
---|
| 40 | .size _start, . - _start |
---|
| 41 | .end _start |
---|
| 42 | |
---|
| 43 | /* Replacement for the GCC provided crti.S. This one avoids the |
---|
| 44 | setup of stack protection regs (which result in privilieged |
---|
| 45 | insn exceptions when running in user-space). */ |
---|
| 46 | .section .init, "ax" |
---|
| 47 | .global __init |
---|
| 48 | .align 2 |
---|
| 49 | __init: |
---|
| 50 | addik r1, r1, -8 |
---|
| 51 | sw r15, r0, r1 |
---|
| 52 | |
---|
| 53 | .section .fini, "ax" |
---|
| 54 | .global __fini |
---|
| 55 | .align 2 |
---|
| 56 | __fini: |
---|
| 57 | addik r1, r1, -8 |
---|
| 58 | sw r15, r0, r1 |
---|
Note: See
TracBrowser
for help on using the repository browser.