wake-0 / fhvOS

This repository contains an os for the arm cortex a8 in combination with beaglebone.
GNU General Public License v2.0
7 stars 1 forks source link

[Context Switch] Clean up assembler #68

Closed trylimits closed 9 years ago

trylimits commented 9 years ago

We should clean up the assembler code for a context switch, for both cases, switching from timer ISR and dabt handler. Pseudo code:

// Assembler
Save context
Pass pointer to context to ISR (The ISR then can change the context)
Restore context

Atm we have separate assembler functions for getting the context and restoring the context. This way we still are facing the problem of not being able to restore the stack pointer if a context is restored.

The suggested concept will solve this issue.

trylimits commented 9 years ago

I cleaned up the asm code for timer ISR and dabt ISR according to the suggested pseudo code. The context is passed to the ISRs (timer and dabt) as reference/pointer which can be changed by the ISR itself. The context will be restored properly after the ISR handler returns.

The cleaned up asm code ensures a restored stack pointer in any case. I just tested the context switch with 5 processes and the os ran for 4 hours (probably forever). So it seems this change also solves the "1h-issue".