Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3847

Bare metal, Assembly language • Re: rpi4 os: context switch breaks irq

$
0
0
I did try to safe the daif reg before the context switch:

Code:

.globl cpu_switch_tocpu_switch_to:    mrs x10, daif    mov x10, #THREAD_CPU_CONTEXT    add x8, x0, x10    mov x9, sp    // Store callee-saved registers    str x19, [x8], #8    str x20, [x8], #8    str x21, [x8], #8    str x22, [x8], #8    str x23, [x8], #8    str x24, [x8], #8    str x25, [x8], #8    str x26, [x8], #8    str x27, [x8], #8    str x28, [x8], #8    str x29, [x8], #8    str x9, [x8], #8    str x30, [x8]    // Restore callee-saved registers    add x8, x1, x10    ldr x19, [x8], #8    ldr x20, [x8], #8    ldr x21, [x8], #8    ldr x22, [x8], #8    ldr x23, [x8], #8    ldr x24, [x8], #8    ldr x25, [x8], #8    ldr x26, [x8], #8    ldr x27, [x8], #8    ldr x28, [x8], #8    ldr x29, [x8], #8    ldr x9, [x8], #8    ldr x30, [x8]    msr daif, x10    mov sp, x9    ret    
It sadly didnt change a thing. I had an idea what could be the problem let me know what you think of it:

The interrupt fires and calls the timer which calls the timer_tick. In the scheduler the context switches. But the context switch is still in the interrupt routine. It never calls eret to leave the interrupt. After the context switch the programm just executes task 2. It would eret when the context switches back to task 1 but if I want to use the timer before it could bring some problems (At least I think). Does this sound like it could bring up some problems for you? And how would I fix this?

Statistics: Posted by JonasPfi — Sat Oct 19, 2024 10:13 am



Viewing all articles
Browse latest Browse all 3847

Trending Articles