mirror of
https://github.com/drasko/codezero.git
synced 2026-02-02 05:03:14 +01:00
- Added mutex_trylock() - Implemented most of exchange_registers() - thread_control() now needs a lock for operations that can modify thread context. - thread_start() does not initialise scheduler flags, now done in thread_create. TODO: - Fork/clone'ed threads should retain their context in tcb, not syscall stack. - exchange_registers() calls in userspace need cleaning up.
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
#ifndef __ARM_CONTEXT_H__
|
|
#define __ARM_CONTEXT_H__
|
|
|
|
#include <l4/types.h>
|
|
|
|
/*
|
|
* This describes the register context of each task. Simply set
|
|
* them as regular structure fields, and they'll be copied onto
|
|
* real registers upon a context switch to that task. Normally
|
|
* exchange_registers() system call is designed for this, whose
|
|
* input structure is defined further below.
|
|
*/
|
|
typedef struct arm_context {
|
|
u32 spsr; /* 0x0 */
|
|
u32 r0; /* 0x4 */
|
|
u32 r1; /* 0x8 */
|
|
u32 r2; /* 0xC */
|
|
u32 r3; /* 0x10 */
|
|
u32 r4; /* 0x14 */
|
|
u32 r5; /* 0x18 */
|
|
u32 r6; /* 0x1C */
|
|
u32 r7; /* 0x20 */
|
|
u32 r8; /* 0x24 */
|
|
u32 r9; /* 0x28 */
|
|
u32 r10; /* 0x2C */
|
|
u32 r11; /* 0x30 */
|
|
u32 r12; /* 0x34 */
|
|
u32 sp; /* 0x38 */
|
|
u32 lr; /* 0x3C */
|
|
u32 pc; /* 0x40 */
|
|
} __attribute__((__packed__)) task_context_t;
|
|
|
|
|
|
typedef struct arm_exregs_context {
|
|
u32 r0; /* 0x4 */
|
|
u32 r1; /* 0x8 */
|
|
u32 r2; /* 0xC */
|
|
u32 r3; /* 0x10 */
|
|
u32 r4; /* 0x14 */
|
|
u32 r5; /* 0x18 */
|
|
u32 r6; /* 0x1C */
|
|
u32 r7; /* 0x20 */
|
|
u32 r8; /* 0x24 */
|
|
u32 r9; /* 0x28 */
|
|
u32 r10; /* 0x2C */
|
|
u32 r11; /* 0x30 */
|
|
u32 r12; /* 0x34 */
|
|
u32 sp; /* 0x38 */
|
|
u32 lr; /* 0x3C */
|
|
u32 pc; /* 0x40 */
|
|
} __attribute__((__packed__)) exregs_context_t;
|
|
|
|
#endif /* __ARM_CONTEXT_H__ */
|