diff --git a/defs.h b/defs.h
index b414a5f8fdefb62c51c4be4e91c523eee84e1f90..6a1924411fcc85283bac71fc037d17079ee0420e 100644
--- a/defs.h
+++ b/defs.h
@@ -110,7 +110,6 @@ void            yield(void);
 
 // swtch.S
 void            swtch(struct context**, struct context*);
-void            jstack(uint);
 
 // spinlock.c
 void            acquire(struct spinlock*);
@@ -157,7 +156,6 @@ void            pminit(void);
 void            ksegment(void);
 void            kvmalloc(void);
 void            vminit(void);
-void            jkstack();
 void            printstack(void);
 void            printpgdir(pde_t *);
 pde_t*          setupkvm(void);
diff --git a/main.c b/main.c
index 78cd3340300f4d94487ec9498cd7f21335bb2e65..8be66e3eeb2863a0ba664d980eff409e57208f8c 100644
--- a/main.c
+++ b/main.c
@@ -7,7 +7,8 @@
 
 static void bootothers(void);
 static void mpmain(void);
-void jkstack(void) __attribute__((noreturn));
+void jkstack(void)  __attribute__((noreturn));
+void mainc(void);
 
 // Bootstrap processor starts running C code here.
 int
@@ -21,13 +22,24 @@ main(void)
   consoleinit();   // I/O devices & their interrupts
   uartinit();      // serial port
   pminit();        // physical memory for kernel
-  jkstack();       // Jump to mainc on a proper-allocated kernel stack 
+  jkstack();       // Jump to mainc on a properly-allocated stack 
+}
+
+void
+jkstack(void)
+{
+  char *kstack = kalloc(PGSIZE);
+  if (!kstack)
+    panic("jkstack\n");
+  char *top = kstack + PGSIZE;
+  asm volatile("movl %0,%%esp" : : "r" (top));
+  asm volatile("call mainc");
+  panic("jkstack");
 }
 
 void
 mainc(void)
 {
-  cprintf("cpus %p cpu %p\n", cpus, cpu);
   cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
   kvmalloc();      // allocate the kernel page table
   pinit();         // process table
@@ -52,14 +64,12 @@ mpmain(void)
 {
   if(cpunum() != mpbcpu()) {
     ksegment();
-    cprintf("other cpu\n");
     lapicinit(cpunum());
   }
   vminit();        // Run with paging on each processor
-  cprintf("cpu%d: mpmain\n", cpu->id);
+  cprintf("cpu%d: starting\n", cpu->id);
   idtinit();
   xchg(&cpu->booted, 1);
-  cprintf("cpu%d: scheduling\n", cpu->id);
   scheduler();
 }
 
diff --git a/runoff.list b/runoff.list
index 6bbd3868d22be23c62c69a5da578133d90709db5..3258398868983f0df5e4ab61c64f00957744014c 100644
--- a/runoff.list
+++ b/runoff.list
@@ -22,6 +22,7 @@ proc.h
 proc.c
 swtch.S
 kalloc.c
+vm.c
 
 # system calls
 traps.h
diff --git a/sh.c b/sh.c
index e8d65f0cfe1e9d9cf28bb0a4d2eb0c1943a4419a..16e325b1a4f8206946978a878bab710966e9caf1 100644
--- a/sh.c
+++ b/sh.c
@@ -420,7 +420,6 @@ parseexec(char **ps, char *es)
   int tok, argc;
   struct execcmd *cmd;
   struct cmd *ret;
-  int *x = (int *) peek;
   
   if(peek(ps, es, "("))
     return parseblock(ps, es);
diff --git a/swtch.S b/swtch.S
index 49efdf97b405be8c52fe7df1d01c25d05fdc23aa..875131716a9ffeff47f706989131ce38f4782556 100644
--- a/swtch.S
+++ b/swtch.S
@@ -26,11 +26,3 @@ swtch:
   popl %ebx
   popl %ebp
   ret
-
-# Jump on a new stack, fake C calling conventions
-.globl jstack
-jstack:	
-  movl 4(%esp), %esp
-  subl $16, %esp	# space for arguments
-  movl $0, %ebp	        # terminate functions that follow ebp's
-  call mainc	        # continue at mainc
diff --git a/vm.c b/vm.c
index b89efd5614b27e111b2d7e1bea361d3c3ed3d3a2..6689b82128cb15f159a13650487dac39f6c2ee33 100644
--- a/vm.c
+++ b/vm.c
@@ -324,17 +324,6 @@ pminit(void)
   kinit((char *)kernend, freesz);
 }
 
-// Jump to mainc on a properly-allocated kernel stack
-void
-jkstack(void)
-{
-  char *kstack = kalloc(PGSIZE);
-  if (!kstack)
-    panic("jkstack\n");
-  char *top = kstack + PGSIZE;
-  jstack((uint) top);
-}
-
 // Allocate one page table for the machine for the kernel address
 // space for scheduler processes.
 void