rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2015 Travis Geiselbrecht |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining |
| 5 | * a copy of this software and associated documentation files |
| 6 | * (the "Software"), to deal in the Software without restriction, |
| 7 | * including without limitation the rights to use, copy, modify, merge, |
| 8 | * publish, distribute, sublicense, and/or sell copies of the Software, |
| 9 | * and to permit persons to whom the Software is furnished to do so, |
| 10 | * subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be |
| 13 | * included in all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | #include <asm.h> |
| 24 | |
| 25 | .section ".vectors", "ax" |
| 26 | .globl _vectab |
| 27 | _vectab: |
| 28 | /* vector table here */ |
| 29 | # start vector |
| 30 | brai start |
| 31 | # user exception |
| 32 | brai unhandled_exception |
| 33 | # interrupt |
| 34 | brai microblaze_irq |
| 35 | # break |
| 36 | brai unhandled_exception |
| 37 | # hardware exception |
| 38 | brai unhandled_exception |
| 39 | |
| 40 | # reserved for future |
| 41 | .fill (0x50 - 0x28) |
| 42 | |
| 43 | .section ".text.boot" |
| 44 | FUNCTION(start) |
| 45 | # set the default stack |
| 46 | addik r1, r0, default_stack_top |
| 47 | |
| 48 | # set up small data pointers |
| 49 | addik r2, r0, _SDATA2_START__ |
| 50 | addik r13, r0, _SDATA_START__ |
| 51 | |
| 52 | # set the processor mode to default |
| 53 | mts rmsr, r0 |
| 54 | |
| 55 | # zero out bss sections |
| 56 | addik r5, r0, __bss_start |
| 57 | addik r6, r0, 0 |
| 58 | rsubik r7, r5, __bss_end |
| 59 | brlid r15, memset |
| 60 | nop |
| 61 | |
| 62 | # arguments to main |
| 63 | addik r5, r0, 1 |
| 64 | addik r6, r0, 2 |
| 65 | addik r7, r0, 3 |
| 66 | brlid r15, lk_main |
| 67 | addik r8, r0, 4 |
| 68 | |
| 69 | # shouldn't be here |
| 70 | bri . |
| 71 | |
| 72 | FUNCTION(unhandled_exception) |
| 73 | bri . |
| 74 | |
| 75 | .bss |
| 76 | .align 3 |
| 77 | LOCAL_DATA(default_stack) |
| 78 | .skip 4096 |
| 79 | LOCAL_DATA(default_stack_top) |
| 80 | |
| 81 | /* vim: set ts=4 sw=4 expandtab: */ |
| 82 | |