Seeings as we know where the interrupt table is, why don't we just set the relevant location? E.g.
Code: Select all
void my_swi_routine()
{
....
}
void kernel_main()
{
*0x8 = my_swi_routine;
...
}
Code: Select all
void my_swi_routine()
{
....
}
void kernel_main()
{
*0x8 = my_swi_routine;
...
}
Code: Select all
section .text.boot
.globl _start
_start:
ldr pc,reset_handler
ldr pc,undefined_handler
ldr pc,swi_handler
ldr pc,prefetch_handler
ldr pc,data_handler
ldr pc,unused_handler
ldr pc,irq_handler
ldr pc,fiq_handler
reset_handler: .word reset
undefined_handler: .word hang
swi_handler: .word hang
prefetch_handler: .word hang
data_handler: .word hang
unused_handler: .word hang
irq_handler: .word irq
fiq_handler: .word hang
Despite the ability to place zImage anywhere within memory, convention has it that it is loaded at the base of physical RAM plus an offset of 0x8000 (32K). This leaves space for the parameter block usually placed at offset 0x100, zero page exception vectors and page tables. This convention is very common.
Aha. I see what I'm missing. The point is that the interrupt table is not a vector of addresses, but a vector of instructions. swi_routine is an address, not an instruction, so that approach won't work.blippy wrote: ↑Mon Jul 27, 2020 6:30 amSeeings as we know where the interrupt table is, why don't we just set the relevant location? E.g.
I figure I must be missing something.Code: Select all
void my_swi_routine() { .... } void kernel_main() { *0x8 = my_swi_routine; ... }
Code: Select all
ldr pc, irq_handler
Ah, I see. That explains it.
Code: Select all
ldr pc,reset_handler
Code: Select all
b reset_handler