update lab1-8 codes and docs. now version is 0.2

This commit is contained in:
chyyuu
2012-08-26 18:04:26 +08:00
parent 15f7ebf37b
commit d537948e30
134 changed files with 1268 additions and 1005 deletions

View File

@@ -487,7 +487,7 @@ check_slab(void) {
void *v0, *v1;
size_t nr_free_pages_store = nr_free_pages();
size_t slab_allocated_store = slab_allocated();
size_t kernel_allocated_store = slab_allocated();
/* slab must be empty now */
check_slab_empty();
@@ -633,7 +633,7 @@ check_pass:
check_slab_empty();
assert(slab_allocated() == 0);
assert(nr_free_pages_store == nr_free_pages());
assert(slab_allocated_store == slab_allocated());
assert(kernel_allocated_store == slab_allocated());
cprintf("check_slab() succeeded!\n");
}

View File

@@ -184,7 +184,7 @@ check_swap(void)
list_entry_t *le = &free_list;
while ((le = list_next(le)) != &free_list) {
struct Page *p = le2page(le, page_link);
//assert(PageProperty(p));
assert(PageProperty(p));
count ++, total += p->property;
}
assert(total == nr_free_pages());
@@ -277,7 +277,7 @@ check_swap(void)
struct Page *p = le2page(le, page_link);
count --, total -= p->property;
}
cprintf("count is %d, total is %d\n",count,total);
cprintf("count is %d, total is %d\n",count,total);
//assert(count == 0);
cprintf("check_swap() succeeded!\n");

View File

@@ -460,6 +460,15 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
* page_insert build the map of phy addr of an Page with the linear addr la
* swap_map_swappable set the page swappable
*/
/*
* LAB5 CHALLENGE ( the implmentation Copy on Write)
There are 2 situlations when code comes here.
1) *ptep & PTE_P == 1, it means one process try to write a readonly page.
If the vma includes this addr is writable, then we can set the page writable by rewrite the *ptep.
This method could be used to implement the Copy on Write (COW) thchnology(a fast fork process method).
2) *ptep & PTE_P == 0 & but *ptep!=0, it means this pte is a swap entry.
We should add the LAB3's results here.
*/
if(swap_init_ok) {
struct Page *page=NULL;
//(1According to the mm AND addr, try to load the content of right disk page