New console terminal block structure, fix kernel stack pointer.

console/console.c:
    Use virtual addresses for kernel stack pointer, use new ctb structure.
h/rpb.h:
    Update console terminal block structure.
This commit is contained in:
Benjamin Nash 2005-07-26 12:42:02 -04:00
parent fce2978d41
commit 5da70b93db
2 changed files with 94 additions and 41 deletions

View file

@ -470,6 +470,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 +490,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));
} }
@ -523,30 +525,27 @@ 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 */ /* Map the kernel's pages into the third level of region 2 */
for (ptr = m5Conf.kernStart; ptr < kernel_end; ptr += PAGE_SIZE) { //for (ptr = m5Conf.kernStart; ptr < kernel_end; ptr += PAGE_SIZE) {
third_kernel[THIRD_XXX(ptr)] = KPTE(PFN(ptr)); // third_kernel[THIRD_XXX(ptr)] = KPTE(PFN(ptr));
} //}
/* blow 2 pages of phys mem for guards since it maintains 1-to-1 mapping */ ksp_top = (ulong)unix_boot_alloc(1);
ksp = ksp_top + (3 * PAGE_SIZE); ksp = ksp_top + PAGE_SIZE;
if (ksp - m5Conf.kernStart > (0x800000*NUM_KERNEL_THIRD)) {
printf_lock("Kernel stack pushd us over 8MB\n"); //if (ksp - m5Conf.kernStart > (0x800000*NUM_KERNEL_THIRD)) {
panic("ksp too big\n"); // 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"); //if (THIRD_XXX((ulong)ksp_top) > NUM_KERNEL_THIRD * 1024) {
} // panic("increase NUM_KERNEL_THIRD, and change THIRD_XXX\n");
//}
ptr = (ulong) ksp_top; ptr = (ulong) ksp_top;
bzero((char *)ptr, PAGE_SIZE * 2); bzero((char *)ptr, PAGE_SIZE * 2);
third_kernel[THIRD_XXX(ptr)] = 0; /* Stack Guard Page */ dbPage[THIRD(0x20040000)] = 0; /* Stack Guard Page */
ptr += PAGE_SIZE; dbPage[THIRD(0x20042000)] = KPTE(PFN(ptr)); /* Kernel Stack Pages */
third_kernel[THIRD_XXX(ptr)] = KPTE(PFN(ptr)); /* Kernel Stack Pages */ dbPage[THIRD(0x20046000)] = 0; /* Stack Guard Page */
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].
@ -563,7 +562,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 +609,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 = (0x20044000 - 0x18);
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);
@ -633,18 +632,15 @@ unixBoot(int argc, char **argv)
bzero((char *)rpb_ctb, sizeof(struct ctb_tt)); bzero((char *)rpb_ctb, sizeof(struct ctb_tt));
rpb_ctb->rpb_type = CONS_DZ; rpb_ctb->rpb_type = CONS_REM;
rpb_ctb->rpb_length = sizeof(ctb_tt) - sizeof(rpb_ctb); rpb_ctb->rpb_length = sizeof(ctb_tt) - sizeof(rpb_ctb);
/* /*
* uart initizliation * uart initizliation
*/ */
ctb_tt->ctb_csr = 0; ctb_tt->ctb_tintr_vec = 0x6c0; /* matches tlaser pal code */
ctb_tt->ctb_tivec = 0x6c0; /* matches tlaser pal code */ ctb_tt->ctb_rintr_vec = 0x680; /* matches tlaser pal code */
ctb_tt->ctb_rivec = 0x680; /* matches tlaser pal code */ ctb_tt->ctb_term_type = CTB_GRAPHICS;
ctb_tt->ctb_baud = 9600;
ctb_tt->ctb_put_sts = 0;
ctb_tt->ctb_get_sts = 0;
rpb_crb = (struct rpb_crb *) (((ulong)rpb_ctb) + sizeof(struct ctb_tt)); rpb_crb = (struct rpb_crb *) (((ulong)rpb_ctb) + sizeof(struct ctb_tt));
rpb->rpb_crb_off = ((ulong)rpb_crb) - (ulong)rpb; rpb->rpb_crb_off = ((ulong)rpb_crb) - (ulong)rpb;

View file

@ -22,6 +22,36 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $NetBSD: rpb.h,v 1.20 1998/04/15 00:47:33 mjacob Exp $ */
/* $FreeBSD: src/sys/alpha/include/rpb.h,v 1.9 2001/03/30 22:04:08 gallatin Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Keith Bostic, Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
/* /*
* Defines for the architected startup addresses. * Defines for the architected startup addresses.
*/ */
@ -258,17 +288,44 @@ struct rpb_mdt {
* UART console device. * UART console device.
*/ */
struct ctb_tt { struct ctb_tt {
long ctb_type; /* 000: console type */
long ctb_unit; /* 008: console unit */ long ctb_type; /* 0: always 4 */
long ctb_resv; /* 010: reserved */ long ctb_unit; /* 8: */
long ctb_length; /* 018: byte length of device dep portion */ long ctb_reserved; /* 16: */
long ctb_csr; /* 020: CSR Address */ long ctb_len; /* 24: bytes of info */
long ctb_tivec; /* 028: <63>=tie; interrupt vector */ long ctb_ipl; /* 32: console ipl level */
long ctb_rivec; /* 030: <63>=rie; interrupt vector */ long ctb_tintr_vec; /* 40: transmit vec (0x800) */
long ctb_baud; /* 038: baud rate */ long ctb_rintr_vec; /* 48: receive vec (0x800) */
long ctb_put_sts; /* 040: PUTS callback extended status */ #define CTB_GRAPHICS 3 /* graphics device */
long ctb_get_sts; /* 048: GETS callback extended status */ #define CTB_NETWORK 0xC0 /* network device */
long ctb_rsvd[1]; /* 050: reserved for console use */ #define CTB_PRINTERPORT 2 /* printer port on the SCC */
long ctb_term_type; /* 56: terminal type */
long ctb_keybd_type; /* 64: keyboard nationality */
long ctb_keybd_trans; /* 72: trans. table addr */
long ctb_keybd_map; /* 80: map table addr */
long ctb_keybd_state; /* 88: keyboard flags */
long ctb_keybd_last; /* 96: last key entered */
long ctb_font_us; /* 104: US font table addr */
long ctb_font_mcs; /* 112: MCS font table addr */
long ctb_font_width; /* 120: font width, height */
long ctb_font_height; /* 128: in pixels */
long ctb_mon_width; /* 136: monitor width, height */
long ctb_mon_height; /* 144: in pixels */
long ctb_dpi; /* 152: monitor dots per inch */
long ctb_planes; /* 160: # of planes */
long ctb_cur_width; /* 168: cursor width, height */
long ctb_cur_height; /* 176: in pixels */
long ctb_head_cnt; /* 184: # of heads */
long ctb_opwindow; /* 192: opwindow on screen */
long ctb_head_offset; /* 200: offset to head info */
long ctb_putchar; /* 208: output char to TURBO */
long ctb_io_state; /* 216: I/O flags */
long ctb_listen_state; /* 224: listener flags */
long ctb_xaddr; /* 232: extended info addr */
long ctb_turboslot; /* 248: TURBOchannel slot # */
long ctb_server_off; /* 256: offset to server info */
long ctb_line_off; /* 264: line parameter offset */
char ctb_csd; /* 272: console specific data */
}; };
/* /*