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);
extern volatile uint* lapic;
void lapiceoi(void);
void lapicinit(int);
void lapicinit(void);
void lapicstartap(uchar, uint);
void microdelay(int);
@ -164,7 +164,7 @@ void uartputc(int);
void seginit(void);
void kvmalloc(void);
void vmenable(void);
pde_t* setupkvm();
pde_t* setupkvm(void);
char* uva2ka(pde_t*, char*);
int allocuvm(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)
goto bad;
if((pgdir = setupkvm(kalloc)) == 0)
if((pgdir = setupkvm()) == 0)
goto bad;
// Load program into memory.

View file

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

4
main.c
View file

@ -20,7 +20,7 @@ main(void)
kinit1(end, P2V(4*1024*1024)); // phys page allocator
kvmalloc(); // kernel page table
mpinit(); // collect info about this machine
lapicinit(mpbcpu());
lapicinit();
seginit(); // set up segments
cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
picinit(); // interrupt controller
@ -48,7 +48,7 @@ mpenter(void)
{
switchkvm();
seginit();
lapicinit(cpunum());
lapicinit();
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();
initproc = p;
if((p->pgdir = setupkvm(kalloc)) == 0)
if((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
p->sz = PGSIZE;

View file

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

View file

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

10
vm.c
View file

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