mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Rearranged devzero. More bugs to fix.
This commit is contained in:
@@ -71,6 +71,7 @@ void handle_fs_requests(void)
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// printf("\n%s: Started.\n", __FUNCTION__);
|
||||
initialise();
|
||||
|
||||
wait_pager(PAGER_TID);
|
||||
|
||||
@@ -22,7 +22,8 @@ void init_mm_descriptors(struct page_bitmap *page_map,
|
||||
struct bootdesc *bootdesc, struct membank *membank);
|
||||
void init_physmem(struct initdata *initdata, struct membank *membank);
|
||||
|
||||
void init_zero_page(void);
|
||||
void init_devzero(void);
|
||||
struct vm_file *get_devzero(void);
|
||||
void *get_zero_page(void);
|
||||
void put_zero_page(void);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
static void *zpage_p;
|
||||
static struct page *zpage;
|
||||
static struct vm_file devzero;
|
||||
|
||||
void init_zero_page(void)
|
||||
{
|
||||
@@ -35,6 +36,21 @@ void init_zero_page(void)
|
||||
zpage->count++;
|
||||
}
|
||||
|
||||
void init_devzero(void)
|
||||
{
|
||||
init_zero_page();
|
||||
|
||||
INIT_LIST_HEAD(&devzero.list);
|
||||
INIT_LIST_HEAD(&devzero.page_cache_list);
|
||||
devzero.length = (unsigned int)-1;
|
||||
devzero.inode.i_addr = -1;
|
||||
}
|
||||
|
||||
struct vm_file *get_devzero(void)
|
||||
{
|
||||
return &devzero;
|
||||
}
|
||||
|
||||
void *get_zero_page(void)
|
||||
{
|
||||
zpage->count++;
|
||||
@@ -317,7 +317,6 @@ int do_anon_page(struct fault_data *fault)
|
||||
|
||||
/* Add the page to it's owner's list of in-memory pages */
|
||||
BUG_ON(!list_empty(&page->list));
|
||||
BUG();
|
||||
list_add(&page->list, &page->owner->page_cache_list);
|
||||
|
||||
/* The offset of this page in its owner file */
|
||||
@@ -400,8 +399,6 @@ int do_page_fault(struct fault_data *fault)
|
||||
err = do_file_page(fault);
|
||||
|
||||
/* Return the ipc and by doing so restart the faulty thread */
|
||||
printf("Finished handling fault. Restarting thread by returning.\n");
|
||||
|
||||
l4_ipc_return(err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ void init_mm(struct initdata *initdata)
|
||||
printf("%s: Initialised page allocator.\n", __TASKNAME__);
|
||||
|
||||
/* Initialise the zero page */
|
||||
init_zero_page();
|
||||
init_devzero();
|
||||
printf("%s: Initialised zero page.\n", __TASKNAME__);
|
||||
|
||||
init_utcb();
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
#include <posix/sys/types.h>
|
||||
#include <task.h>
|
||||
#include <mmap.h>
|
||||
#include <memory.h>
|
||||
#include <l4lib/arch/syscalls.h>
|
||||
|
||||
static struct vm_file devzero;
|
||||
|
||||
/* Swap related bookkeeping.
|
||||
static struct vm_file shm_swap_file;
|
||||
static struct id_pool *swap_file_offset_pool;
|
||||
@@ -253,7 +252,6 @@ int vma_swapfile_realloc(struct vm_area *vma, unsigned long pfn_start,
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* This shrinks the vma from *one* end only, either start or end */
|
||||
int vma_shrink(struct vm_area *vma, struct tcb *task, unsigned long pfn_start,
|
||||
unsigned long pfn_end)
|
||||
@@ -441,7 +439,7 @@ int do_mmap(struct vm_file *mapfile, unsigned long f_offset, struct tcb *t,
|
||||
|
||||
if (!mapfile) {
|
||||
if (flags & VMA_ANON) {
|
||||
mapfile = &devzero;
|
||||
mapfile = get_devzero();
|
||||
f_offset = 0;
|
||||
} else
|
||||
BUG();
|
||||
|
||||
Reference in New Issue
Block a user