Merge branch 'master' of git+ssh://amsterdam.csail.mit.edu/home/am0/6.828/xv6

This commit is contained in:
Robert Morris 2012-08-28 12:57:13 -04:00
commit c1ee7eb4d3
9 changed files with 27 additions and 16 deletions

4
defs.h
View file

@ -74,7 +74,7 @@ void kbdintr(void);
int cpunum(void); int cpunum(void);
extern volatile uint* lapic; extern volatile uint* lapic;
void lapiceoi(void); void lapiceoi(void);
void lapicinit(int); void lapicinit(void);
void lapicstartap(uchar, uint); void lapicstartap(uchar, uint);
void microdelay(int); void microdelay(int);
@ -164,7 +164,7 @@ void uartputc(int);
void seginit(void); void seginit(void);
void kvmalloc(void); void kvmalloc(void);
void vmenable(void); void vmenable(void);
pde_t* setupkvm(); pde_t* setupkvm(void);
char* uva2ka(pde_t*, char*); char* uva2ka(pde_t*, char*);
int allocuvm(pde_t*, uint, uint); int allocuvm(pde_t*, uint, uint);
int deallocuvm(pde_t*, uint, uint); int deallocuvm(pde_t*, uint, uint);

2
exec.c
View file

@ -29,7 +29,7 @@ exec(char *path, char **argv)
if(elf.magic != ELF_MAGIC) if(elf.magic != ELF_MAGIC)
goto bad; goto bad;
if((pgdir = setupkvm(kalloc)) == 0) if((pgdir = setupkvm()) == 0)
goto bad; goto bad;
// Load program into memory. // Load program into memory.

View file

@ -50,7 +50,7 @@ lapicw(int index, int value)
//PAGEBREAK! //PAGEBREAK!
void void
lapicinit(int c) lapicinit(void)
{ {
if(!lapic) if(!lapic)
return; return;

4
main.c
View file

@ -20,7 +20,7 @@ main(void)
kinit1(end, P2V(4*1024*1024)); // phys page allocator kinit1(end, P2V(4*1024*1024)); // phys page allocator
kvmalloc(); // kernel page table kvmalloc(); // kernel page table
mpinit(); // collect info about this machine mpinit(); // collect info about this machine
lapicinit(mpbcpu()); lapicinit();
seginit(); // set up segments seginit(); // set up segments
cprintf("\ncpu%d: starting xv6\n\n", cpu->id); cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
picinit(); // interrupt controller picinit(); // interrupt controller
@ -48,7 +48,7 @@ mpenter(void)
{ {
switchkvm(); switchkvm();
seginit(); seginit();
lapicinit(cpunum()); lapicinit();
mpmain(); mpmain();
} }

14
printpcs Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
# Decode the symbols from a panic EIP list
# Find a working addr2line
for p in i386-jos-elf-addr2line addr2line; do
if which $p 2>&1 >/dev/null && \
$p -h 2>&1 | grep -q '\belf32-i386\b'; then
break
fi
done
# Enable as much pretty-printing as this addr2line can do
$p $($p -h | grep ' -[aipsf] ' | awk '{print $1}') -e kernel "$@"

2
proc.c
View file

@ -83,7 +83,7 @@ userinit(void)
p = allocproc(); p = allocproc();
initproc = p; initproc = p;
if((p->pgdir = setupkvm(kalloc)) == 0) if((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?"); panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
p->sz = PGSIZE; p->sz = PGSIZE;

View file

@ -129,9 +129,7 @@ syscall(void)
int num; int num;
num = proc->tf->eax; num = proc->tf->eax;
if(num >= 0 && num < SYS_open && syscalls[num]) { if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
proc->tf->eax = syscalls[num]();
} else if (num >= SYS_open && num < NELEM(syscalls) && syscalls[num]) {
proc->tf->eax = syscalls[num](); proc->tf->eax = syscalls[num]();
} else { } else {
cprintf("%d %s: unknown sys call %d\n", cprintf("%d %s: unknown sys call %d\n",

View file

@ -13,7 +13,6 @@
#define SYS_sbrk 12 #define SYS_sbrk 12
#define SYS_sleep 13 #define SYS_sleep 13
#define SYS_uptime 14 #define SYS_uptime 14
#define SYS_open 15 #define SYS_open 15
#define SYS_write 16 #define SYS_write 16
#define SYS_mknod 17 #define SYS_mknod 17

10
vm.c
View file

@ -118,15 +118,15 @@ static struct kmap {
uint phys_end; uint phys_end;
int perm; int perm;
} kmap[] = { } kmap[] = {
{ (void*) KERNBASE, 0, EXTMEM, PTE_W}, // I/O space { (void*)KERNBASE, 0, EXTMEM, PTE_W}, // I/O space
{ (void*) KERNLINK, V2P(KERNLINK), V2P(data), 0}, // kernel text+rodata { (void*)KERNLINK, V2P(KERNLINK), V2P(data), 0}, // kernel text+rodata
{ (void*) data, V2P(data), PHYSTOP, PTE_W}, // kernel data, memory { (void*)data, V2P(data), PHYSTOP, PTE_W}, // kernel data+memory
{ (void*) DEVSPACE, DEVSPACE, 0, PTE_W}, // more devices { (void*)DEVSPACE, DEVSPACE, 0, PTE_W}, // more devices
}; };
// Set up kernel part of a page table. // Set up kernel part of a page table.
pde_t* pde_t*
setupkvm() setupkvm(void)
{ {
pde_t *pgdir; pde_t *pgdir;
struct kmap *k; struct kmap *k;