aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/user
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2015-03-09 17:27:27 +0100
committerAlex Auvolat <alex@adnab.me>2015-03-09 17:27:27 +0100
commit00ea1bdfe3d0758dc42942c5994664c51badf2f8 (patch)
tree8f1ea691be085f303a56de8977b186545481a292 /src/kernel/user
parent3341e7a3a184b5bea17f0f678b40bc51c92d72a4 (diff)
downloadkogata-00ea1bdfe3d0758dc42942c5994664c51badf2f8.tar.gz
kogata-00ea1bdfe3d0758dc42942c5994664c51badf2f8.zip
Remove kernel region pf handlers ; fix forget-to-zero-out bug.
Diffstat (limited to 'src/kernel/user')
-rw-r--r--src/kernel/user/pager.c8
-rw-r--r--src/kernel/user/process.c10
2 files changed, 12 insertions, 6 deletions
diff --git a/src/kernel/user/pager.c b/src/kernel/user/pager.c
index b1ce9c3..45d2970 100644
--- a/src/kernel/user/pager.c
+++ b/src/kernel/user/pager.c
@@ -47,7 +47,7 @@ error:
void swap_page_in(pager_t *p, size_t offset, size_t len) {
ASSERT(PAGE_ALIGNED(offset));
- void *region = region_alloc(PAGE_SIZE, "Page zeroing area", 0);
+ void *region = region_alloc(PAGE_SIZE, "Page zeroing area");
if (region == 0) return;
for (size_t page = offset; page < offset + len; page += PAGE_SIZE) {
@@ -92,7 +92,7 @@ bool swap_pager_resize(pager_t *p, size_t new_size) {
size_t last_page = PAGE_ALIGN_DOWN(new_size);
if (!PAGE_ALIGNED(new_size) && hashtbl_find(p->pages, (void*)last_page) != 0) {
- void *region = region_alloc(PAGE_SIZE, "Page zeroing area", 0);
+ void *region = region_alloc(PAGE_SIZE, "Page zeroing area");
if (!region) PANIC("TODO");
uint32_t frame = (uint32_t)hashtbl_find(p->pages, (void*)last_page) >> ENT_FRAME_SHIFT;
@@ -154,7 +154,7 @@ void vfs_page_in(pager_t *p, size_t offset, size_t len) {
ASSERT(PAGE_ALIGNED(offset));
ASSERT(p->vfs_pager.ops->read != 0);
- void *region = region_alloc(PAGE_SIZE, "Page loading area", 0);
+ void *region = region_alloc(PAGE_SIZE, "Page loading area");
if (region == 0) return;
for (size_t page = offset; page < offset + len; page += PAGE_SIZE) {
@@ -332,7 +332,7 @@ size_t pager_do_rw(pager_t *p, size_t offset, size_t len, char* buf, bool write)
size_t first_page = PAGE_ALIGN_DOWN(offset);
size_t region_len = offset + len - first_page;
- region = region_alloc(PAGE_ALIGN_UP(region_len), "Temporary pager read/write zone", 0);
+ region = region_alloc(PAGE_ALIGN_UP(region_len), "Temporary pager read/write zone");
if (region == 0) goto end_read;
p->ops->page_in(p, first_page, region_len);
diff --git a/src/kernel/user/process.c b/src/kernel/user/process.c
index d8f1eed..4d79327 100644
--- a/src/kernel/user/process.c
+++ b/src/kernel/user/process.c
@@ -682,8 +682,14 @@ void proc_usermem_pf(void* p, registers_t *regs, void* addr) {
current_process_exit(PS_FAILURE, (addr < (void*)PAGE_SIZE ? FAIL_ZEROPTR : FAIL_SEGFAULT));
}
- bool pr = ((regs->err_code & PF_PRESENT_BIT) != 0);
- ASSERT(!pr);
+ bool pr = (regs->err_code & PF_PRESENT_BIT) != 0;
+ if (pr) {
+ uint32_t frame = pd_get_entry(addr);
+ dbg_printf("UPF 0x%p %s present %d 0x%p\n",
+ addr, (wr ? "write" : "read"),
+ frame >> PTE_FRAME_SHIFT, frame);
+ PANIC("Unexpected fault on present page.");
+ }
addr = (void*)((uint32_t)addr & PAGE_MASK);