mirror of
https://github.com/drasko/codezero.git
synced 2026-01-16 21:03:16 +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:
@@ -79,12 +79,8 @@ void do_exchange_registers(struct ktcb *task, struct exregs_data *exregs)
|
||||
task->pagerid = exregs->pagerid;
|
||||
|
||||
/* Set thread's utcb if supplied */
|
||||
if (exregs->flags & EXREGS_SET_UTCB) {
|
||||
BUG(); /* Check that physical and virtual addresses are in range */
|
||||
task->utcb_phys = exregs->utcb_phys;
|
||||
task->utcb_virt = exregs->utcb_virt;
|
||||
}
|
||||
|
||||
if (exregs->flags & EXREGS_SET_UTCB)
|
||||
task->utcb_address = exregs->utcb_address;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -139,6 +135,12 @@ int sys_exchange_registers(syscall_context_t *regs)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Check UTCB is in valid range */
|
||||
if (exregs->flags & EXREGS_SET_UTCB &&
|
||||
!(exregs->utcb_address >= UTCB_AREA_START &&
|
||||
exregs->utcb_address < UTCB_AREA_END))
|
||||
return -EINVAL;
|
||||
|
||||
/* Copy registers */
|
||||
do_exchange_registers(task, exregs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user