mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 10:53:16 +01:00
This implements the infrastructure for read/write system calls where file content is first searched in mm0's page cache and then read-in or written via the vfs read/write functions. modified: tasks/fs0/src/syscalls.c modified: tasks/mm0/include/lib/bit.h modified: tasks/mm0/include/lib/idpool.h modified: tasks/mm0/include/task.h modified: tasks/mm0/include/vm_area.h modified: tasks/mm0/main.c modified: tasks/mm0/src/devzero.c modified: tasks/mm0/src/fault.c new file: tasks/mm0/src/file.c modified: tasks/mm0/src/init.c modified: tasks/mm0/src/lib/bit.c modified: tasks/mm0/src/lib/idpool.c modified: tasks/mm0/src/task.c
45 lines
890 B
C
45 lines
890 B
C
#ifndef __LIB_BIT_H__
|
|
#define __LIB_BIT_H__
|
|
|
|
#include <l4lib/types.h>
|
|
|
|
unsigned int __clz(unsigned int bitvector);
|
|
int find_and_set_first_free_bit(u32 *word, unsigned int lastbit);
|
|
int find_and_set_first_free_contig_bits(u32 *word, unsigned int limit,
|
|
int nbits);
|
|
int check_and_clear_bit(u32 *word, int bit);
|
|
int check_and_clear_contig_bits(u32 *word, int first, int nbits);
|
|
int check_and_set_bit(u32 *word, int bit);
|
|
|
|
|
|
/* Set */
|
|
static inline void setbit(unsigned int *w, unsigned int flags)
|
|
{
|
|
*w |= flags;
|
|
}
|
|
|
|
|
|
/* Clear */
|
|
static inline void clrbit(unsigned int *w, unsigned int flags)
|
|
{
|
|
*w &= ~flags;
|
|
}
|
|
|
|
/* Test */
|
|
static inline int tstbit(unsigned int *w, unsigned int flags)
|
|
{
|
|
return *w & flags;
|
|
}
|
|
|
|
/* Test and clear */
|
|
static inline int tstclr(unsigned int *w, unsigned int flags)
|
|
{
|
|
int res = tstbit(w, flags);
|
|
|
|
clrbit(w, flags);
|
|
|
|
return res;
|
|
}
|
|
|
|
#endif /* __LIB_BIT_H__ */
|