mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
exchange_registers(), modified thread_control calls seem to work
- Fixed do_mmap() so that it returns mapped address, and various bugs. - A child seems to fork with new setup, but with incorrect return value. Need to use and test exregs() for fork + clone. - Shmat searches an unmapped area if input arg is invalid, do_mmap() should do this.
This commit is contained in:
@@ -11,10 +11,16 @@
|
||||
#include INC_GLUE(context.h)
|
||||
#include <l4/types.h>
|
||||
|
||||
enum exregs_flags {
|
||||
EXREGS_SET_PAGER = 1,
|
||||
};
|
||||
|
||||
/* Structure passed by userspace pagers for exchanging registers */
|
||||
struct exregs_data {
|
||||
exregs_context_t context;
|
||||
u32 valid_vect;
|
||||
u32 flags;
|
||||
l4id_t pagerid;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -75,16 +75,9 @@ static inline void irq_local_disable()
|
||||
/* This is filled on entry to irq handler, only if a process was interrupted.*/
|
||||
extern unsigned int preempted_psr;
|
||||
|
||||
#include <l4/generic/tcb.h>
|
||||
static inline int task_in_kernel(struct tcb *t)
|
||||
{
|
||||
return ((t->context.spsr & ARM_MODE_MASK) == ARM_MODE_SVC) ? 1 : 0;
|
||||
}
|
||||
|
||||
static inline int task_in_user(struct tcb *t)
|
||||
{
|
||||
return !task_in_kernel(t);
|
||||
}
|
||||
/* Implementing these as functions cause circular include dependency for tcb.h */
|
||||
#define TASK_IN_KERNEL(tcb) (((tcb)->context.spsr & ARM_MODE_MASK) == ARM_MODE_SVC)
|
||||
#define TASK_IN_USER(tcb) (!TASK_IN_KERNEL(tcb))
|
||||
|
||||
static inline int in_kernel()
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@ static inline struct ktcb *current_task(void)
|
||||
| SCHED_FL_SUSPEND)
|
||||
|
||||
void sched_runqueue_init(void);
|
||||
void sched_init_task(struct ktcb *task);
|
||||
void sched_start_task(struct ktcb *task);
|
||||
void sched_resume_task(struct ktcb *task);
|
||||
void sched_suspend_task(struct ktcb *task);
|
||||
|
||||
@@ -102,12 +102,6 @@ static inline int add_task_global(struct ktcb *new)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void set_task_flags(struct ktcb *task, unsigned int fl)
|
||||
{
|
||||
task->flags |= fl;
|
||||
}
|
||||
|
||||
/*
|
||||
* Each task is allocated a unique global id. A thread group can only belong to
|
||||
* a single leader, and every thread can only belong to a single thread group.
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* them and they'll be copied onto real registers upon a context
|
||||
* switch to that task. exchange_registers() system call is
|
||||
* designed for this, whose input structure is defined further
|
||||
* below.
|
||||
*/
|
||||
typedef struct arm_context {
|
||||
u32 spsr; /* 0x0 */
|
||||
|
||||
Reference in New Issue
Block a user