1/* 2 * Copyright (c) 2003, 2004 3 * The Regents of The University of Michigan 4 * All Rights Reserved 5 * 6 * This code is part of the M5 simulator, developed by Nathan Binkert, 7 * Erik Hallnor, Steve Raasch, and Steve Reinhardt, with contributions 8 * from Ron Dreslinski, Dave Greene, Lisa Hsu, Ali Saidi, and Andrew --- 55 unchanged lines hidden (view full) --- 64#include "cserve.h" 65#include "rpb.h" 66 67#define CONS_INT_TX 0x01 /* interrupt enable / state bits */ 68#define CONS_INT_RX 0x02 69 70#define PAGE_SIZE (8192) 71 |
72#define KSEG 0xfffffc0000000000 73#define K1BASE 0xfffffc8000000000 74#define KSEG_TO_PHYS(x) (((ulong)x) & ~KSEG) 75 76#define ROUNDUP8(x) ((ulong)(((ulong)x)+7) & ~7) 77#define ROUNDUP128(x) ((ulong)(((ulong)x) + 127) & ~127) 78#define ROUNDUP8K(x) ((ulong)(((ulong)(x)) + 8191) & ~8191) 79 --- 428 unchanged lines hidden (view full) --- 508 } 509 510 /* Protect the PAL pages */ 511 for (i = 1; i < PFN(first); i++) 512 third_rpb[HWRPB_PAGES + MDT_BITMAP_PAGES + i] = KPTE(i); 513 514 /* Set up third_kernel after it's loaded, when we know where it is */ 515 kern_first_page = (KSEG_TO_PHYS(m5Conf.kernStart)/PAGE_SIZE); |
516 kernel_end = ksp_top = ROUNDUP8K(m5Conf.kernEnd); |
517 bootadr = m5Conf.entryPoint; 518 519 printf_lock("HWRPB 0x%x l1pt 0x%x l2pt 0x%x l3pt_rpb 0x%x l3pt_kernel 0x%x" 520 " l2reserv 0x%x\n", 521 rpb, first, second, third_rpb, third_kernel, reservedFixup); 522 if (kernel_end - m5Conf.kernStart > (0x800000*NUM_KERNEL_THIRD)) { 523 printf_lock("Kernel is more than 8MB 0x%x - 0x%x = 0x%x\n", 524 kernel_end, m5Conf.kernStart, 525 kernel_end - m5Conf.kernStart ); 526 panic("kernel too big\n"); 527 } 528 printf_lock("kstart = 0x%x, kend = 0x%x, kentry = 0x%x, numCPUs = 0x%x\n", m5Conf.kernStart, m5Conf.kernEnd, m5Conf.entryPoint, m5Conf.numCPUs); |
529 /* Map the kernel's pages into the third level of region 2 */ 530 //for (ptr = m5Conf.kernStart; ptr < kernel_end; ptr += PAGE_SIZE) { 531 // third_kernel[THIRD_XXX(ptr)] = KPTE(PFN(ptr)); 532 //} |
533 |
534 ksp_top = (ulong)unix_boot_alloc(1); 535 ksp = ksp_top + PAGE_SIZE; |
536 |
537 //if (ksp - m5Conf.kernStart > (0x800000*NUM_KERNEL_THIRD)) { 538 // printf_lock("Kernel stack pushd us over 8MB\n"); 539 // panic("ksp too big\n"); 540 //} 541 //if (THIRD_XXX((ulong)ksp_top) > NUM_KERNEL_THIRD * 1024) { 542 // panic("increase NUM_KERNEL_THIRD, and change THIRD_XXX\n"); 543 //} 544 ptr = (ulong) ksp_top; 545 bzero((char *)ptr, PAGE_SIZE * 2); 546 dbPage[THIRD(0x20040000)] = 0; /* Stack Guard Page */ 547 dbPage[THIRD(0x20042000)] = KPTE(PFN(ptr)); /* Kernel Stack Pages */ 548 dbPage[THIRD(0x20046000)] = 0; /* Stack Guard Page */ |
549 550 /* put argv into the bottom of the stack - argv starts at 1 because 551 * the command thatr got us here (i.e. "unixboot) is in argv[0]. 552 */ |
553 ksp -= 8; /* Back up one longword */ |
554 ksp -= argc * sizeof(char *); /* Make room for argv */ 555 kargv = (char **) ksp; 556 for (i = 1; i < argc; i++) { /* Copy arguments to stack */ 557 ksp -= ((strlen(argv[i]) + 1) + 7) & ~0x7; 558 kargv[i-1] = (char *) ksp; 559 strcpy(kargv[i - 1], argv[i]); 560 } 561 kargc = i - 1; --- 42 unchanged lines hidden (view full) --- 604 for (i = 0; i < m5Conf.numCPUs; i++) { 605 struct rpb_percpu *thisCPU = (struct rpb_percpu*) 606 ((ulong)rpb_percpu + percpu_size * i); 607 608 bzero((char *)thisCPU, percpu_size); 609 bcopy((char *)&m5_rpb_percpu, (char *)thisCPU, 610 sizeof(struct rpb_percpu)); 611 |
612 thisCPU->rpb_pcb.rpb_ksp = (0x20044000 - 0x18); |
613 thisCPU->rpb_pcb.rpb_ptbr = PFN(first); 614 615 thisCPU->rpb_logout = KSEG_TO_PHYS(percpu_logout); 616 thisCPU->rpb_logout_len = PAGE_SIZE; 617 618 printf_lock("KSP: 0x%x PTBR 0x%x\n", 619 thisCPU->rpb_pcb.rpb_ksp, thisCPU->rpb_pcb.rpb_ptbr); 620 } --- 6 unchanged lines hidden (view full) --- 627 rpb_ctb = (struct rpb_ctb *) nextPtr; 628 ctb_tt = (struct ctb_tt*) rpb_ctb; 629 630 rpb->rpb_ctb_off = ((ulong)rpb_ctb) - (ulong)rpb; 631 rpb->rpb_ctb_size = sizeof(struct rpb_ctb); 632 633 bzero((char *)rpb_ctb, sizeof(struct ctb_tt)); 634 |
635 rpb_ctb->rpb_type = CONS_REM; |
636 rpb_ctb->rpb_length = sizeof(ctb_tt) - sizeof(rpb_ctb); 637 638 /* 639 * uart initizliation 640 */ |
641 ctb_tt->ctb_tintr_vec = 0x6c0; /* matches tlaser pal code */ 642 ctb_tt->ctb_rintr_vec = 0x680; /* matches tlaser pal code */ 643 ctb_tt->ctb_term_type = CTB_GRAPHICS; |
644 645 rpb_crb = (struct rpb_crb *) (((ulong)rpb_ctb) + sizeof(struct ctb_tt)); 646 rpb->rpb_crb_off = ((ulong)rpb_crb) - (ulong)rpb; 647 648 bzero((char *)rpb_crb, sizeof(struct rpb_crb)); 649 650 /* 651 * console callback stuff (m5) --- 461 unchanged lines hidden --- |