diff options
-rw-r--r-- | kernel.c | 12 | ||||
-rw-r--r-- | start.S | 36 |
2 files changed, 33 insertions, 15 deletions
@@ -1,12 +1,4 @@ - -void _main(void) +void main() { - static unsigned char kernel_stack[16 * 1024] = {0}; - register void * stack = &kernel_stack; - asm volatile("mr 1,%0" :: "r" (stack) ); - - while(1) - { - //asm volatile("wait"); - } + while(1); } @@ -60,11 +60,6 @@ relocate_loop: blr finished_relocate: - ;// Set up initial TOC Base - lis 2, opd_load_address@h - ori 2, 2, opd_load_address@l - ld 2,8(2) - ;// Jump to main. b _main @@ -72,6 +67,37 @@ finished_relocate: intvect_system_reset: b _start +.section .text +_main: + ;// Set up initial TOC Base + lis 2, opd_load_address@h + ori 2, 2, opd_load_address@l + ld 2,8(2) + + ;// Set up initial stack + lis 1, kernel_stack@h + ori 1, 1, kernel_stack@l + addi 1, 1, 16368 + + ;// Set up exception stack + lis 3, exception_stack@h + ori 3, 3, exception_stack@l + addi 3, 3, 16368 + mtsprg0 3 + + ;// Call main. + bl main +_main_loop: + b _main_loop + + +.section .data + .balign 1024 +kernel_stack: + .space 16*1024 +exception_stack: + .space 16*1024 + .section .text.hreset hreset: b _start |