diff options
author | stefan <stefan@s00.xyz> | 2023-04-19 20:50:10 -0400 |
---|---|---|
committer | stefan <stefan@s00.xyz> | 2023-04-19 20:50:10 -0400 |
commit | 83e17e29456ec9b6d45f4d9f2634eb280c6f414f (patch) | |
tree | 004a9b2a7cd3f0c7bb4224b59204680bd5d79681 /sys/include | |
parent | af1ce4b2e637ceb418ea72d51c49a3eee276a938 (diff) | |
download | sv-83e17e29456ec9b6d45f4d9f2634eb280c6f414f.tar.gz |
ticket locks
Diffstat (limited to 'sys/include')
-rw-r--r-- | sys/include/asm.h | 1 | ||||
-rw-r--r-- | sys/include/fdt.h | 2 | ||||
-rw-r--r-- | sys/include/kalloc.h (renamed from sys/include/mm/kalloc.h) | 0 | ||||
-rw-r--r-- | sys/include/spinlock.h | 22 |
4 files changed, 14 insertions, 11 deletions
diff --git a/sys/include/asm.h b/sys/include/asm.h index 86e6354..0995f88 100644 --- a/sys/include/asm.h +++ b/sys/include/asm.h @@ -50,6 +50,7 @@ read_tp(void) { uint64_t x; asm volatile("addi %0, tp, 0" : "=r"(x)); + return x; } #endif /* _ASM_H */ diff --git a/sys/include/fdt.h b/sys/include/fdt.h index ca1cea0..77c9d6e 100644 --- a/sys/include/fdt.h +++ b/sys/include/fdt.h @@ -40,7 +40,7 @@ struct fdt_node_header { char name[]; }; -void walk_fdt(struct fdt_header *header); +void fdt_walk(struct fdt_header *header); #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */ #define FDT_TAGSIZE sizeof(fdt32_t) diff --git a/sys/include/mm/kalloc.h b/sys/include/kalloc.h index 10adbda..10adbda 100644 --- a/sys/include/mm/kalloc.h +++ b/sys/include/kalloc.h diff --git a/sys/include/spinlock.h b/sys/include/spinlock.h index ef81499..82c1585 100644 --- a/sys/include/spinlock.h +++ b/sys/include/spinlock.h @@ -1,15 +1,17 @@ -#ifndef _LOCK_H -#define _LOCK_H +#ifndef _SPINLOCK_H +#define _SPINLOCK_H -struct spinlock { - int locked; - int tp; -}; +/* fifo ticket lock implementation */ -void initlock(struct spinlock *); +typedef struct _spinlock { + int ticket; + int turn; +} spinlock_t; -void acquire(struct spinlock *); +void initlock(spinlock_t *); -void release(struct spinlock *); +void acquire(spinlock_t *); -#endif /* _LOCK_H */ +void release(spinlock_t *); + +#endif /* _SPINLOCK_H */ |