diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2023-09-28 22:04:11 +0200 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2023-09-28 22:04:11 +0200 |
commit | 440fcb86d69aa6d42b032d0315b2263a348cbd9e (patch) | |
tree | 246aaf25d08fb59c69b302feb8a08f9a824646f6 | |
parent | 0bfdb73b4d7512ca223ca44417612bcbfe2536a1 (diff) | |
download | rockbox-440fcb86d6.tar.gz rockbox-440fcb86d6.zip |
ATJ213x: minor changes to hwstub port
1) Make use of $gp addressing. This saves some bin size and makes
code slightly faster.
2) Substitute jr with simple j instruction in exception handling.
Code is small and j can easily encode target address.
3) Remove nop after eret in interrupt handler. According to mips32r2
ISA manual eret does not have branch delay slot.
Change-Id: If63feb12eef189f08f7b50c832a8091be5e6f570
-rw-r--r-- | utils/hwstub/stub/atj213x/Makefile | 2 | ||||
-rw-r--r-- | utils/hwstub/stub/atj213x/crt0.S | 18 | ||||
-rw-r--r-- | utils/hwstub/stub/atj213x/hwstub.lds | 5 |
3 files changed, 12 insertions, 13 deletions
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) : |