71a72,73
> #define KSTACK_REGION_VA 0x20040000
>
472a475
>
491a495
> bzero(dbPage, PAGE_SIZE);
493c497
< for (i = DATABASE_BASE; i < DATABASE_END ; i += 8096) {
---
> for (i = DATABASE_BASE; i < DATABASE_END ; i += PAGE_SIZE) {
514c518
< kernel_end = ksp_top = ROUNDUP8K(m5Conf.kernEnd);
---
> kernel_end = ROUNDUP8K(m5Conf.kernEnd);
525a530
> printf_lock("kstart = 0x%x, kend = 0x%x, kentry = 0x%x, numCPUs = 0x%x\n", m5Conf.kernStart, m5Conf.kernEnd, m5Conf.entryPoint, m5Conf.numCPUs);
527,530c532,533
< /* Map the kernel's pages into the third level of region 2 */
< for (ptr = m5Conf.kernStart; ptr < kernel_end; ptr += PAGE_SIZE) {
< third_kernel[THIRD_XXX(ptr)] = KPTE(PFN(ptr));
< }
---
> ksp_bottom = (ulong)unix_boot_alloc(1);
> ksp_top = ksp_bottom + PAGE_SIZE;
532,549c535,539
< /* blow 2 pages of phys mem for guards since it maintains 1-to-1 mapping */
< ksp = ksp_top + (3 * PAGE_SIZE);
< if (ksp - m5Conf.kernStart > (0x800000*NUM_KERNEL_THIRD)) {
< printf_lock("Kernel stack pushd us over 8MB\n");
< panic("ksp too big\n");
< }
< if (THIRD_XXX((ulong)ksp_top) > NUM_KERNEL_THIRD * 1024) {
< panic("increase NUM_KERNEL_THIRD, and change THIRD_XXX\n");
< }
< ptr = (ulong) ksp_top;
< bzero((char *)ptr, PAGE_SIZE * 2);
< third_kernel[THIRD_XXX(ptr)] = 0; /* Stack Guard Page */
< ptr += PAGE_SIZE;
< third_kernel[THIRD_XXX(ptr)] = KPTE(PFN(ptr)); /* Kernel Stack Pages */
< ptr += PAGE_SIZE;
< third_kernel[THIRD_XXX(ptr)] = KPTE(PFN(ptr));
< ptr += PAGE_SIZE;
< third_kernel[THIRD_XXX(ptr)] = 0; /* Stack Guard Page */
---
> ptr = (ulong) ksp_bottom;
> bzero((char *)ptr, PAGE_SIZE);
> dbPage[THIRD(KSTACK_REGION_VA)] = 0; /* Stack Guard Page */
> dbPage[THIRD(KSTACK_REGION_VA + PAGE_SIZE)] = KPTE(PFN(ptr)); /* Kernel Stack Page */
> dbPage[THIRD(KSTACK_REGION_VA + 2*PAGE_SIZE)] = 0; /* Stack Guard Page */
554c544
< ksp -= 8; /* Back up one longword */
---
> ksp = ksp_top - 8; /* Back up one longword */
566c556
< free_pfn = PFN(ptr);
---
> free_pfn = PFN(kernel_end);
613c603
< thisCPU->rpb_pcb.rpb_ksp = ksp;
---
> thisCPU->rpb_pcb.rpb_ksp = (KSTACK_REGION_VA + 2*PAGE_SIZE - (ksp_top - ksp));
645c635
< ctb_tt->ctb_baud = 9600;
---
> ctb_tt->ctb_term_type = 2;