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

@@ -5,7 +5,7 @@
#include <string.h>
#include <sync.h>
#include <kdebug.h>
#include <monitor.h>
#include <kmonitor.h>
#include <assert.h>
#define STACKFRAME_DEPTH 20

View File

@@ -2,7 +2,7 @@
#include <string.h>
#include <mmu.h>
#include <trap.h>
#include <monitor.h>
#include <kmonitor.h>
#include <kdebug.h>
/* *
@@ -82,7 +82,7 @@ runcmd(char *buf, struct trapframe *tf) {
/***** Implementations of basic kernel monitor commands *****/
void
monitor(struct trapframe *tf) {
kmonitor(struct trapframe *tf) {
cprintf("Welcome to the kernel debug monitor!!\n");
cprintf("Type 'help' for a list of commands.\n");

View File

@@ -3,7 +3,7 @@
#include <trap.h>
void monitor(struct trapframe *tf);
void kmonitor(struct trapframe *tf);
int mon_help(int argc, char **argv, struct trapframe *tf);
int mon_kerninfo(int argc, char **argv, struct trapframe *tf);

View File

@@ -1,7 +1,7 @@
#include <defs.h>
#include <stdio.h>
#include <intr.h>
#include <monitor.h>
#include <kmonitor.h>
static bool is_panic = 0;
@@ -27,7 +27,7 @@ __panic(const char *file, int line, const char *fmt, ...) {
panic_dead:
intr_disable();
while (1) {
monitor(NULL);
kmonitor(NULL);
}
}

View File

@@ -12,9 +12,10 @@
#include <ide.h>
#include <swap.h>
#include <proc.h>
#include <kmonitor.h>
int kern_init(void) __attribute__((noreturn));
void grade_backtrace(void);
static void lab1_switch_test(void);
int

View File

@@ -482,7 +482,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();
@@ -628,7 +628,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

@@ -92,7 +92,7 @@ swap_out(struct mm_struct *mm, int n, int in_tick)
cprintf("i %d, swap_out: call swap_out_victim failed\n",i);
break;
}
assert(!PageReserved(page));
//assert(!PageReserved(page));
//cprintf("SWAP: choose victim page 0x%08x\n", page);
@@ -182,7 +182,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());
@@ -272,8 +272,8 @@ check_swap(void)
struct Page *p = le2page(le, page_link);
count --, total -= p->property;
}
assert(count == 0);
cprintf("count is %d, total is %d\n",count,total);
//assert(count == 0);
cprintf("check_swap() succeeded!\n");
}

View File

@@ -304,8 +304,11 @@ quick_check() {
## kernel image
osimg=$(make_print ucoreimg)
## swap image
swapimg=$(make_print swapimg)
## set default qemu-options
qemuopts="-hda $osimg"
qemuopts="-hda $osimg -drive file=$swapimg,media=disk,cache=writeback"
## set break-function, default is readline
brkfun=readline
@@ -316,7 +319,7 @@ quick_run 'Check VMM'
pts=5
quick_check 'check pmm' \
'memory management: buddy_pmm_manager' \
'memory management: default_pmm_manager' \
'check_alloc_page() succeeded!' \
'check_pgdir() succeeded!' \
'check_boot_pgdir() succeeded!'
@@ -340,11 +343,29 @@ quick_check 'check vmm' \
'check_pgfault() succeeded!' \
'check_vmm() succeeded.'
pts=20
quick_check 'check swap page fault' \
'page fault at 0x00001000: K/W [no page found].' \
'page fault at 0x00002000: K/W [no page found].' \
'page fault at 0x00003000: K/W [no page found].' \
'page fault at 0x00004000: K/W [no page found].' \
'write Virt Page e in fifo_check_swap' \
'page fault at 0x00005000: K/W [no page found].' \
'page fault at 0x00001000: K/W [no page found]' \
'page fault at 0x00002000: K/W [no page found].' \
'page fault at 0x00003000: K/W [no page found].' \
'page fault at 0x00004000: K/W [no page found].' \
'check_swap() succeeded!'
pts=5
quick_check 'check ticks' \
'++ setup timer interrupts' \
'100 ticks' \
'End of Test.'
'++ setup timer interrupts'
pts=30
quick_check 'check initproc' \
'this initproc, pid = 1, name = "init"' \
'To U: "Hello world!!".' \
'To U: "en.., Bye, Bye. :)"'
## print final-score
show_final