mirror of
https://github.com/drasko/codezero.git
synced 2026-02-27 01:03:14 +01:00
Code that compiles and works up to initializing the first memcache.
This commit is contained in:
@@ -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[];
|
||||
|
||||
@@ -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__ */
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user