diff --git a/utils/hwstub/stub/atj213x/Makefile b/utils/hwstub/stub/atj213x/Makefile index d653017a0f..81dfd30f54 100644 --- a/utils/hwstub/stub/atj213x/Makefile +++ b/utils/hwstub/stub/atj213x/Makefile @@ -8,7 +8,7 @@ AS=$(PREFIX)gcc OC=$(PREFIX)objcopy DEFINES= INCLUDES=-I$(CURDIR) -GCCOPTS=-march=mips32r2 -G0 -msoft-float +GCCOPTS=-Os -march=mips32r2 -G128 -msoft-float BUILD_DIR=$(CURDIR)/build/ ROOT_DIR=$(CURDIR)/.. diff --git a/utils/hwstub/stub/atj213x/crt0.S b/utils/hwstub/stub/atj213x/crt0.S index 7d5bcde9b2..32797b513a 100644 --- a/utils/hwstub/stub/atj213x/crt0.S +++ b/utils/hwstub/stub/atj213x/crt0.S @@ -130,38 +130,34 @@ stack_munge_loop: bne t0, sp, stack_munge_loop addiu t0, 4 + # setup Global Pointer + la gp, _gp + # jump to C code with enabled interrupts la t0, main jr.hb t0 ei - .extern exception_jmp_ctx_ptr .global tlb_refill_handler .section .exception.tlb_refill,"ax",%progbits tlb_refill_handler: + j restore_exception_jmp li a0, EXCEPTION_ADDR - la k0, restore_exception_jmp - jr k0 - nop .global cache_error_handler .section .exception.cache_error,"ax",%progbits cache_error_handler: + j restore_exception_jmp li a0, EXCEPTION_ADDR - la k0, restore_exception_jmp - jr k0 - nop .global general_exception_handler .section .exception.general_exception,"ax",%progbits general_exception_handler: + j restore_exception_jmp li a0, EXCEPTION_UNSP - la k0, restore_exception_jmp - jr k0 - nop /* s0-s7 not saved as this are callee saved registers * CO_STATUS is not saved as nested interrupts are not supported @@ -249,8 +245,6 @@ restore: addiu sp, sp, 84 move sp, k1 eret - nop .set reorder .set at - diff --git a/utils/hwstub/stub/atj213x/hwstub.lds b/utils/hwstub/stub/atj213x/hwstub.lds index 06912fb56f..818e836452 100644 --- a/utils/hwstub/stub/atj213x/hwstub.lds +++ b/utils/hwstub/stub/atj213x/hwstub.lds @@ -28,6 +28,11 @@ SECTIONS *(.rodata*) *(.data*) *(.rel.dyn) + + . = ALIGN(8); + _gp = ABSOLUTE(. + 0x7ff0); + + *(.sdata*) } > IRAM .bss (NOLOAD) :