forked from len0rd/rockbox
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
This commit is contained in:
parent
0bfdb73b4d
commit
440fcb86d6
3 changed files with 12 additions and 13 deletions
|
@ -8,7 +8,7 @@ AS=$(PREFIX)gcc
|
||||||
OC=$(PREFIX)objcopy
|
OC=$(PREFIX)objcopy
|
||||||
DEFINES=
|
DEFINES=
|
||||||
INCLUDES=-I$(CURDIR)
|
INCLUDES=-I$(CURDIR)
|
||||||
GCCOPTS=-march=mips32r2 -G0 -msoft-float
|
GCCOPTS=-Os -march=mips32r2 -G128 -msoft-float
|
||||||
BUILD_DIR=$(CURDIR)/build/
|
BUILD_DIR=$(CURDIR)/build/
|
||||||
ROOT_DIR=$(CURDIR)/..
|
ROOT_DIR=$(CURDIR)/..
|
||||||
|
|
||||||
|
|
|
@ -130,38 +130,34 @@ stack_munge_loop:
|
||||||
bne t0, sp, stack_munge_loop
|
bne t0, sp, stack_munge_loop
|
||||||
addiu t0, 4
|
addiu t0, 4
|
||||||
|
|
||||||
|
# setup Global Pointer
|
||||||
|
la gp, _gp
|
||||||
|
|
||||||
# jump to C code with enabled interrupts
|
# jump to C code with enabled interrupts
|
||||||
la t0, main
|
la t0, main
|
||||||
jr.hb t0
|
jr.hb t0
|
||||||
ei
|
ei
|
||||||
|
|
||||||
.extern exception_jmp_ctx_ptr
|
|
||||||
.global tlb_refill_handler
|
.global tlb_refill_handler
|
||||||
.section .exception.tlb_refill,"ax",%progbits
|
.section .exception.tlb_refill,"ax",%progbits
|
||||||
|
|
||||||
tlb_refill_handler:
|
tlb_refill_handler:
|
||||||
|
j restore_exception_jmp
|
||||||
li a0, EXCEPTION_ADDR
|
li a0, EXCEPTION_ADDR
|
||||||
la k0, restore_exception_jmp
|
|
||||||
jr k0
|
|
||||||
nop
|
|
||||||
|
|
||||||
.global cache_error_handler
|
.global cache_error_handler
|
||||||
.section .exception.cache_error,"ax",%progbits
|
.section .exception.cache_error,"ax",%progbits
|
||||||
|
|
||||||
cache_error_handler:
|
cache_error_handler:
|
||||||
|
j restore_exception_jmp
|
||||||
li a0, EXCEPTION_ADDR
|
li a0, EXCEPTION_ADDR
|
||||||
la k0, restore_exception_jmp
|
|
||||||
jr k0
|
|
||||||
nop
|
|
||||||
|
|
||||||
.global general_exception_handler
|
.global general_exception_handler
|
||||||
.section .exception.general_exception,"ax",%progbits
|
.section .exception.general_exception,"ax",%progbits
|
||||||
|
|
||||||
general_exception_handler:
|
general_exception_handler:
|
||||||
|
j restore_exception_jmp
|
||||||
li a0, EXCEPTION_UNSP
|
li a0, EXCEPTION_UNSP
|
||||||
la k0, restore_exception_jmp
|
|
||||||
jr k0
|
|
||||||
nop
|
|
||||||
|
|
||||||
/* s0-s7 not saved as this are callee saved registers
|
/* s0-s7 not saved as this are callee saved registers
|
||||||
* CO_STATUS is not saved as nested interrupts are not supported
|
* CO_STATUS is not saved as nested interrupts are not supported
|
||||||
|
@ -249,8 +245,6 @@ restore:
|
||||||
addiu sp, sp, 84
|
addiu sp, sp, 84
|
||||||
move sp, k1
|
move sp, k1
|
||||||
eret
|
eret
|
||||||
nop
|
|
||||||
|
|
||||||
.set reorder
|
.set reorder
|
||||||
.set at
|
.set at
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,11 @@ SECTIONS
|
||||||
*(.rodata*)
|
*(.rodata*)
|
||||||
*(.data*)
|
*(.data*)
|
||||||
*(.rel.dyn)
|
*(.rel.dyn)
|
||||||
|
|
||||||
|
. = ALIGN(8);
|
||||||
|
_gp = ABSOLUTE(. + 0x7ff0);
|
||||||
|
|
||||||
|
*(.sdata*)
|
||||||
} > IRAM
|
} > IRAM
|
||||||
|
|
||||||
.bss (NOLOAD) :
|
.bss (NOLOAD) :
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue