mirror of
https://github.com/drasko/codezero.git
synced 2026-02-27 09:13:13 +01:00
New UTCB implementation almost working.
- KIP's pointer to UTCB seems to work with existing l4lib ipc functions. - Works up to clone() - In clone we mmap() the same UTCB on each new thread - excessive. - Generally during page fault handling, cloned threads may fault on the same page multiple times even though a single handling would be enough for all of them. Need to detect and handle this.
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
struct initdata {
|
||||
struct bootdesc *bootdesc;
|
||||
struct page_bitmap page_map;
|
||||
unsigned long pager_utcb_virt;
|
||||
unsigned long pager_utcb_phys;
|
||||
struct list_head boot_file_list;
|
||||
};
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include <lib/spinlock.h>
|
||||
|
||||
struct id_pool {
|
||||
struct spinlock lock;
|
||||
int nwords;
|
||||
int bitlimit;
|
||||
u32 bitmap[];
|
||||
};
|
||||
|
||||
|
||||
@@ -54,21 +54,18 @@ struct task_vma_head {
|
||||
int tcb_refs;
|
||||
};
|
||||
|
||||
/*
|
||||
* TLS and UTCB bookkeeping:
|
||||
*
|
||||
* This structure is shared among threads whose utcbs are on the same
|
||||
* physical page. Threads with utcbs on different physical pages have
|
||||
* their own utcb_data structure, even though they are in the same
|
||||
* address space, and share their vm_area_list structure.
|
||||
*/
|
||||
struct utcb_data {
|
||||
unsigned long phys; /* Physical utcb address */
|
||||
unsigned long virt; /* Virtual utcb address */
|
||||
u32 bit; /* Bitvector of free utcb slots on page */
|
||||
struct page *p; /* Physical page */
|
||||
struct utcb_desc {
|
||||
struct list_head list;
|
||||
unsigned long utcb_base;
|
||||
struct id_pool *slots;
|
||||
};
|
||||
|
||||
struct utcb_head {
|
||||
struct list_head list;
|
||||
int tcb_refs;
|
||||
};
|
||||
|
||||
|
||||
/* Stores all task information that can be kept in userspace. */
|
||||
struct tcb {
|
||||
/* Task list */
|
||||
@@ -119,8 +116,11 @@ struct tcb {
|
||||
/* Default ipc-shared-page information */
|
||||
void *shared_page;
|
||||
|
||||
/* Task's utcb data */
|
||||
struct utcb_data *utcb;
|
||||
/* Chain of utcb descriptors */
|
||||
struct utcb_head *utcb_head;
|
||||
|
||||
/* Unique utcb address of this task */
|
||||
unsigned long utcb_address;
|
||||
|
||||
/* Virtual memory areas */
|
||||
struct task_vma_head *vm_area_head;
|
||||
|
||||
Reference in New Issue
Block a user