mirror of
https://github.com/drasko/codezero.git
synced 2026-01-13 03:13:15 +01:00
Mutex test progress
- Mutex test added. Forked tasks demonstrate produce/consumer using a shared mmap'ed page. - Added l4lib assembler syscall - Added forgotten SWI to mutex control offset in syscall page. - Added mutex head initialization - Contended child successfully sleeps in a waitqueue. Issues: - Somehow the child's produced page buffer is altered at about [4020] offset. Parent fails to validate buffer therefore. - Need to add syncing to test so that parent does not unlock and lock again before child has a chance to lock buffer and produce.
This commit is contained in:
@@ -24,23 +24,29 @@ struct mutex_queue {
|
||||
|
||||
struct mutex_queue_head {
|
||||
struct list_head list;
|
||||
|
||||
/*
|
||||
* Lock for mutex_queue create/deletion and also list add/removal.
|
||||
* Both operations are done jointly so a single lock is enough.
|
||||
*/
|
||||
struct mutex mutex_control_mutex;
|
||||
int count;
|
||||
} mutex_queue_head;
|
||||
|
||||
/*
|
||||
* Lock for mutex_queue create/deletion and also list add/removal.
|
||||
* Both operations are done jointly so a single lock is enough.
|
||||
*/
|
||||
struct mutex mutex_control_mutex;
|
||||
|
||||
void init_mutex_queue_head(void)
|
||||
{
|
||||
memset(&mutex_queue_head, 0, sizeof (mutex_queue_head));
|
||||
INIT_LIST_HEAD(&mutex_queue_head.list);
|
||||
mutex_init(&mutex_queue_head.mutex_control_mutex);
|
||||
}
|
||||
void mutex_queue_head_lock()
|
||||
{
|
||||
mutex_lock(&mutex_control_mutex);
|
||||
mutex_lock(&mutex_queue_head.mutex_control_mutex);
|
||||
}
|
||||
|
||||
void mutex_queue_head_unlock()
|
||||
{
|
||||
mutex_unlock(&mutex_control_mutex);
|
||||
mutex_unlock(&mutex_queue_head.mutex_control_mutex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user