changes
console/console.c: fixed bootstrap stack h/rpb.h: ctb_term_type instead of ctb_baud
This commit is contained in:
parent
e61899cbbf
commit
fa1512e206
2 changed files with 19 additions and 29 deletions
|
@ -69,6 +69,8 @@
|
||||||
|
|
||||||
#define PAGE_SIZE (8192)
|
#define PAGE_SIZE (8192)
|
||||||
|
|
||||||
|
#define KSTACK_REGION_VA 0x20040000
|
||||||
|
|
||||||
#define KSEG 0xfffffc0000000000
|
#define KSEG 0xfffffc0000000000
|
||||||
#define K1BASE 0xfffffc8000000000
|
#define K1BASE 0xfffffc8000000000
|
||||||
#define KSEG_TO_PHYS(x) (((ulong)x) & ~KSEG)
|
#define KSEG_TO_PHYS(x) (((ulong)x) & ~KSEG)
|
||||||
|
@ -470,6 +472,7 @@ unixBoot(int argc, char **argv)
|
||||||
/* Region 1 */
|
/* Region 1 */
|
||||||
second[SECOND(0x20000000) + i] = KPTE(PFN(third_kernel) + i);
|
second[SECOND(0x20000000) + i] = KPTE(PFN(third_kernel) + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Region 2 */
|
/* Region 2 */
|
||||||
second[SECOND(0x40000000)] = KPTE(PFN(second));
|
second[SECOND(0x40000000)] = KPTE(PFN(second));
|
||||||
|
|
||||||
|
@ -489,8 +492,9 @@ unixBoot(int argc, char **argv)
|
||||||
#define DATABASE_END 0x20020000
|
#define DATABASE_END 0x20020000
|
||||||
|
|
||||||
ulong *dbPage = (ulong*)unix_boot_alloc(1);
|
ulong *dbPage = (ulong*)unix_boot_alloc(1);
|
||||||
|
bzero(dbPage, PAGE_SIZE);
|
||||||
second[SECOND(DATABASE_BASE)] = KPTE(PFN(dbPage));
|
second[SECOND(DATABASE_BASE)] = KPTE(PFN(dbPage));
|
||||||
for (i = DATABASE_BASE; i < DATABASE_END ; i += 8096) {
|
for (i = DATABASE_BASE; i < DATABASE_END ; i += PAGE_SIZE) {
|
||||||
ulong *db = (ulong*)unix_boot_alloc(1);
|
ulong *db = (ulong*)unix_boot_alloc(1);
|
||||||
dbPage[THIRD(i)] = KPTE(PFN(db));
|
dbPage[THIRD(i)] = KPTE(PFN(db));
|
||||||
}
|
}
|
||||||
|
@ -511,7 +515,7 @@ unixBoot(int argc, char **argv)
|
||||||
|
|
||||||
/* Set up third_kernel after it's loaded, when we know where it is */
|
/* Set up third_kernel after it's loaded, when we know where it is */
|
||||||
kern_first_page = (KSEG_TO_PHYS(m5Conf.kernStart)/PAGE_SIZE);
|
kern_first_page = (KSEG_TO_PHYS(m5Conf.kernStart)/PAGE_SIZE);
|
||||||
kernel_end = ksp_top = ROUNDUP8K(m5Conf.kernEnd);
|
kernel_end = ROUNDUP8K(m5Conf.kernEnd);
|
||||||
bootadr = m5Conf.entryPoint;
|
bootadr = m5Conf.entryPoint;
|
||||||
|
|
||||||
printf_lock("HWRPB 0x%x l1pt 0x%x l2pt 0x%x l3pt_rpb 0x%x l3pt_kernel 0x%x"
|
printf_lock("HWRPB 0x%x l1pt 0x%x l2pt 0x%x l3pt_rpb 0x%x l3pt_kernel 0x%x"
|
||||||
|
@ -523,35 +527,21 @@ unixBoot(int argc, char **argv)
|
||||||
kernel_end - m5Conf.kernStart );
|
kernel_end - m5Conf.kernStart );
|
||||||
panic("kernel too big\n");
|
panic("kernel too big\n");
|
||||||
}
|
}
|
||||||
|
printf_lock("kstart = 0x%x, kend = 0x%x, kentry = 0x%x, numCPUs = 0x%x\n", m5Conf.kernStart, m5Conf.kernEnd, m5Conf.entryPoint, m5Conf.numCPUs);
|
||||||
|
|
||||||
/* Map the kernel's pages into the third level of region 2 */
|
ksp_bottom = (ulong)unix_boot_alloc(1);
|
||||||
for (ptr = m5Conf.kernStart; ptr < kernel_end; ptr += PAGE_SIZE) {
|
ksp_top = ksp_bottom + PAGE_SIZE;
|
||||||
third_kernel[THIRD_XXX(ptr)] = KPTE(PFN(ptr));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* blow 2 pages of phys mem for guards since it maintains 1-to-1 mapping */
|
ptr = (ulong) ksp_bottom;
|
||||||
ksp = ksp_top + (3 * PAGE_SIZE);
|
bzero((char *)ptr, PAGE_SIZE);
|
||||||
if (ksp - m5Conf.kernStart > (0x800000*NUM_KERNEL_THIRD)) {
|
dbPage[THIRD(KSTACK_REGION_VA)] = 0; /* Stack Guard Page */
|
||||||
printf_lock("Kernel stack pushd us over 8MB\n");
|
dbPage[THIRD(KSTACK_REGION_VA + PAGE_SIZE)] = KPTE(PFN(ptr)); /* Kernel Stack Page */
|
||||||
panic("ksp too big\n");
|
dbPage[THIRD(KSTACK_REGION_VA + 2*PAGE_SIZE)] = 0; /* Stack Guard Page */
|
||||||
}
|
|
||||||
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 */
|
|
||||||
|
|
||||||
/* put argv into the bottom of the stack - argv starts at 1 because
|
/* put argv into the bottom of the stack - argv starts at 1 because
|
||||||
* the command thatr got us here (i.e. "unixboot) is in argv[0].
|
* the command thatr got us here (i.e. "unixboot) is in argv[0].
|
||||||
*/
|
*/
|
||||||
ksp -= 8; /* Back up one longword */
|
ksp = ksp_top - 8; /* Back up one longword */
|
||||||
ksp -= argc * sizeof(char *); /* Make room for argv */
|
ksp -= argc * sizeof(char *); /* Make room for argv */
|
||||||
kargv = (char **) ksp;
|
kargv = (char **) ksp;
|
||||||
for (i = 1; i < argc; i++) { /* Copy arguments to stack */
|
for (i = 1; i < argc; i++) { /* Copy arguments to stack */
|
||||||
|
@ -563,7 +553,7 @@ unixBoot(int argc, char **argv)
|
||||||
kargv[kargc] = NULL; /* just to be sure; doesn't seem to be used */
|
kargv[kargc] = NULL; /* just to be sure; doesn't seem to be used */
|
||||||
ksp -= sizeof(char *); /* point above last arg for no real reason */
|
ksp -= sizeof(char *); /* point above last arg for no real reason */
|
||||||
|
|
||||||
free_pfn = PFN(ptr);
|
free_pfn = PFN(kernel_end);
|
||||||
|
|
||||||
bcopy((char *)&m5_rpb, (char *)rpb, sizeof(struct rpb));
|
bcopy((char *)&m5_rpb, (char *)rpb, sizeof(struct rpb));
|
||||||
|
|
||||||
|
@ -610,7 +600,7 @@ unixBoot(int argc, char **argv)
|
||||||
bcopy((char *)&m5_rpb_percpu, (char *)thisCPU,
|
bcopy((char *)&m5_rpb_percpu, (char *)thisCPU,
|
||||||
sizeof(struct rpb_percpu));
|
sizeof(struct rpb_percpu));
|
||||||
|
|
||||||
thisCPU->rpb_pcb.rpb_ksp = ksp;
|
thisCPU->rpb_pcb.rpb_ksp = (KSTACK_REGION_VA + 2*PAGE_SIZE - (ksp_top - ksp));
|
||||||
thisCPU->rpb_pcb.rpb_ptbr = PFN(first);
|
thisCPU->rpb_pcb.rpb_ptbr = PFN(first);
|
||||||
|
|
||||||
thisCPU->rpb_logout = KSEG_TO_PHYS(percpu_logout);
|
thisCPU->rpb_logout = KSEG_TO_PHYS(percpu_logout);
|
||||||
|
@ -642,7 +632,7 @@ unixBoot(int argc, char **argv)
|
||||||
ctb_tt->ctb_csr = 0;
|
ctb_tt->ctb_csr = 0;
|
||||||
ctb_tt->ctb_tivec = 0x6c0; /* matches tlaser pal code */
|
ctb_tt->ctb_tivec = 0x6c0; /* matches tlaser pal code */
|
||||||
ctb_tt->ctb_rivec = 0x680; /* matches tlaser pal code */
|
ctb_tt->ctb_rivec = 0x680; /* matches tlaser pal code */
|
||||||
ctb_tt->ctb_baud = 9600;
|
ctb_tt->ctb_term_type = 2;
|
||||||
ctb_tt->ctb_put_sts = 0;
|
ctb_tt->ctb_put_sts = 0;
|
||||||
ctb_tt->ctb_get_sts = 0;
|
ctb_tt->ctb_get_sts = 0;
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ struct ctb_tt {
|
||||||
long ctb_csr; /* 020: CSR Address */
|
long ctb_csr; /* 020: CSR Address */
|
||||||
long ctb_tivec; /* 028: <63>=tie; interrupt vector */
|
long ctb_tivec; /* 028: <63>=tie; interrupt vector */
|
||||||
long ctb_rivec; /* 030: <63>=rie; interrupt vector */
|
long ctb_rivec; /* 030: <63>=rie; interrupt vector */
|
||||||
long ctb_baud; /* 038: baud rate */
|
long ctb_term_type; /* 038: baud rate */
|
||||||
long ctb_put_sts; /* 040: PUTS callback extended status */
|
long ctb_put_sts; /* 040: PUTS callback extended status */
|
||||||
long ctb_get_sts; /* 048: GETS callback extended status */
|
long ctb_get_sts; /* 048: GETS callback extended status */
|
||||||
long ctb_rsvd[1]; /* 050: reserved for console use */
|
long ctb_rsvd[1]; /* 050: reserved for console use */
|
||||||
|
|
Loading…
Reference in a new issue