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:
Bahadir Balban
2008-09-15 15:59:44 +03:00
parent 4fb5277123
commit df2317e7aa
17 changed files with 196 additions and 284 deletions

View File

@@ -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;
};

View File

@@ -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()
{

View File

@@ -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);

View File

@@ -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.

View File

@@ -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 */