Code that compiles and works up to initializing the first memcache.

This commit is contained in:
Bahadir Balban
2009-07-29 19:08:29 +03:00
parent dd8f773f10
commit 723cf7bde9
12 changed files with 230 additions and 197 deletions

View File

@@ -7,6 +7,34 @@
#define MUTEX_CONTROL_LOCK L4_MUTEX_LOCK
#define MUTEX_CONTROL_UNLOCK L4_MUTEX_UNLOCK
#include <l4/lib/wait.h>
#include <l4/lib/list.h>
#include <l4/lib/mutex.h>
struct mutex_queue {
unsigned long physical;
struct link list;
struct waitqueue_head wqh_contenders;
struct waitqueue_head wqh_holders;
};
/*
* Mutex queue head keeps the list of all userspace mutexes.
*
* Here, mutex_control_mutex is a single lock for:
* (1) Mutex_queue create/deletion
* (2) List add/removal.
* (3) Wait synchronization:
* - Both waitqueue spinlocks need to be acquired for
* rendezvous inspection to occur atomically. Currently
* it's not done since we rely on this mutex for that.
*/
struct mutex_queue_head {
struct link list;
struct mutex mutex_control_mutex;
int count;
} mutex_queue_head;
void init_mutex_queue_head(void);
#endif

View File

@@ -7,6 +7,8 @@
#define __V5_MM_H__
/* ARM specific definitions */
#define VIRT_MEM_START 0
#define VIRT_MEM_END 0xFFFFFFFF
#define ARM_SECTION_SIZE SZ_1MB
#define ARM_SECTION_MASK (ARM_SECTION_SIZE - 1)
#define ARM_SECTION_BITS 20

View File

@@ -44,11 +44,12 @@ struct container {
* Threads, address spaces, mutex queues, cpu share ...
* Pagers possess these capabilities.
*/
struct capability caps[5] /* threadpool, spacepool, mutexpool, cpupool, mempool */
struct capability caps[5]; /* threadpool, spacepool, mutexpool, cpupool, mempool */
};
/* The array of containers present on the system */
extern struct container container[];
#define CONFIG_MAX_CAPS_USED 11
#define CONFIG_MAX_PAGERS_USED 2
/* Compact, raw capability structure */
struct cap_info {
@@ -78,7 +79,7 @@ struct pager_info {
* One or more virtmem caps,
* Zero or more umutex caps,
*/
struct cap_info caps[];
struct cap_info caps[CONFIG_MAX_CAPS_USED];
};
/*
@@ -86,9 +87,9 @@ struct pager_info {
* used to create run-time containers
*/
struct container_info {
char *name;
char name[64];
int npagers;
struct pager_info pagers[];
struct pager_info pager[CONFIG_MAX_PAGERS_USED];
};
extern struct container_info cinfo[];

View File

@@ -2,7 +2,7 @@
#define __RESOURCES_H__
/* Number of containers defined at compile-time */
#define CONTAINERS_TOTAL 1
#define TOTAL_CONTAINERS 1
#include <l4/generic/capability.h>
@@ -13,6 +13,7 @@ struct boot_resources {
int nthreads;
int nspaces;
int npmds;
int nmutex;
/* Kernel resource usage */
int nkpmds;
@@ -38,14 +39,13 @@ struct kernel_container {
struct mem_cache *pmd_cache;
struct mem_cache *ktcb_cache;
struct mem_cache *address_space_cache;
struct mem_cache *umutex_cache;
struct mem_cache *mutex_cache;
struct mem_cache *cap_cache;
struct mem_cache *cont_cache;
};
extern struct kernel_container kernel_container;
int init_system_resources(struct kernel_container *kcont,
struct boot_resources *bootres);
int init_system_resources(struct kernel_container *kcont);
#endif /* __RESOURCES_H__ */

View File

@@ -36,6 +36,24 @@ static inline struct ktcb *current_task(void)
#define current current_task()
#define need_resched (current->ts_need_resched)
#define SCHED_RQ_TOTAL 2
/* A basic runqueue */
struct runqueue {
struct spinlock lock; /* Lock */
struct link task_list; /* List of tasks in rq */
unsigned int total; /* Total tasks */
};
/* Contains per-container scheduling structures */
struct scheduler {
struct runqueue sched_rq[SCHED_RQ_TOTAL];
struct runqueue *rq_runnable;
struct runqueue *rq_expired;
/* Total priority of all tasks in container */
int prio_total;
};
void sched_init_task(struct ktcb *task, int priority);
void sched_prepare_sleep(void);