aboutsummaryrefslogtreecommitdiff
path: root/src/util/lock.c
blob: 50091b0b75b6b74087a50efd6f6304c42573bdd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <cpu.h>
#include <cpu/atomic/swap.h>
#include <util/mutex.h>
#include <util/lock.h>

// TODO: Improve locking for system
//  1. Deadlock prevention by going through mutex list
void lock(struct Lock* l)
{
	unsigned long mode = getmode() & 0x1F;
	if (mode == 0x10) {
		sys1(SYS_LOCK, l);
	}
}

void unlock(struct Lock* l)
{
	unsigned long mode = getmode() & 0x1F;
	if (mode == 0x10) {
		sys1(SYS_UNLOCK, l);
	}
}