diff options
author | nthnluu <nate1299@me.com> | 2024-01-28 21:20:27 -0500 |
---|---|---|
committer | nthnluu <nate1299@me.com> | 2024-01-28 21:20:27 -0500 |
commit | c63f340d90800895f007de64b7d2d14624263331 (patch) | |
tree | 2c0849fa597dd6da831c8707b6f2603403778d7b /kernel/vm/anon.c |
Created student weenix repository
Diffstat (limited to 'kernel/vm/anon.c')
-rw-r--r-- | kernel/vm/anon.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/kernel/vm/anon.c b/kernel/vm/anon.c new file mode 100644 index 0000000..a998d70 --- /dev/null +++ b/kernel/vm/anon.c @@ -0,0 +1,65 @@ +#include "mm/mobj.h" +#include "mm/page.h" +#include "mm/pframe.h" +#include "mm/slab.h" + +#include "util/debug.h" +#include "util/string.h" + +/* for debugging/verification purposes */ +int anon_count = 0; + +static slab_allocator_t *anon_allocator; + +static long anon_fill_pframe(mobj_t *o, pframe_t *pf); + +static long anon_flush_pframe(mobj_t *o, pframe_t *pf); + +static void anon_destructor(mobj_t *o); + +static mobj_ops_t anon_mobj_ops = {.get_pframe = NULL, + .fill_pframe = anon_fill_pframe, + .flush_pframe = anon_flush_pframe, + .destructor = anon_destructor}; + +/* + * Initialize anon_allocator using the slab allocator. + */ +void anon_init() +{ + NOT_YET_IMPLEMENTED("VM: ***none***"); +} + +/* + * The mobj should be locked upon successful return. Use mobj_init and + * mobj_lock. + */ +mobj_t *anon_create() +{ + NOT_YET_IMPLEMENTED("VM: ***none***"); + return NULL; +} + +/* + * This function is not complicated -- think about what the pframe should look + * like for an anonymous object + */ +static long anon_fill_pframe(mobj_t *o, pframe_t *pf) +{ + NOT_YET_IMPLEMENTED("VM: ***none***"); + return 0; +} + +static long anon_flush_pframe(mobj_t *o, pframe_t *pf) { return 0; } + +/* + * Release all resources associated with an anonymous object. + * + * Hints: + * 1) Call mobj_default_destructor() to free pframes + * 2) Free the mobj + */ +static void anon_destructor(mobj_t *o) +{ + NOT_YET_IMPLEMENTED("VM: ***none***"); +} |