snapshot. working on vm bootstrapping problems, and resolution of undefined
symbols.
This commit is contained in:
parent
42255b6429
commit
3f3c6b44f5
|
@ -1 +1 @@
|
|||
revision 1.2 intentionally removed
|
||||
revision 1.3 intentionally removed
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
#include "sys/systm.h"
|
||||
#include "sys/types.h"
|
||||
|
||||
#include "../include/pte.h"
|
||||
#include "../include/control.h"
|
||||
|
||||
#define CONTROL_ALIGN(x) (x & CONTROL_ADDR_MASK)
|
||||
#define CONTROL_ADDR_BUILD(space, va) (CONTROL_ALIGN(va)|space)
|
||||
|
||||
static vm_offset_t temp_seg_va = NULL;
|
||||
|
||||
int get_context()
|
||||
{
|
||||
int c;
|
||||
|
||||
c = get_control_byte((char *) CONTEXT_REG);
|
||||
return c & CONTEXT_MASK;
|
||||
}
|
||||
|
||||
void set_context(int c)
|
||||
{
|
||||
set_control_byte((char *) CONTEXT_REG, c & CONTEXT_MASK);
|
||||
}
|
||||
|
||||
vm_offset_t get_pte(va)
|
||||
vm_offset_t va;
|
||||
{
|
||||
return (vm_offset_t)
|
||||
get_control_word((char *) CONTROL_ADDR_BUILD(PGMAP_BASE, va));
|
||||
}
|
||||
void set_pte(va, pte)
|
||||
vm_offset_t va,pte;
|
||||
{
|
||||
set_control_word((char *) CONTROL_ADDR_BUILD(PGMAP_BASE, va),
|
||||
(unsigned int) pte);
|
||||
}
|
||||
|
||||
unsigned char get_segmap(va)
|
||||
vm_offset_t va;
|
||||
{
|
||||
return get_control_byte((char *) CONTROL_ADDR_BUILD(SEGMAP_BASE, va));
|
||||
}
|
||||
void set_segmap(va, sme)
|
||||
vm_offset_t va;
|
||||
unsigned char sme;
|
||||
{
|
||||
set_control_byte((char *) CONTROL_ADDR_BUILD(SEGMAP_BASE, va), sme);
|
||||
}
|
||||
|
||||
void set_temp_seg_addr(va)
|
||||
vm_offset_t va;
|
||||
{
|
||||
if (va)
|
||||
temp_seg_va = va;
|
||||
}
|
||||
|
||||
vm_offset_t get_pte_pmeg(pmeg_num, page_num)
|
||||
unsigned char pmeg_num;
|
||||
unsigned int page_num;
|
||||
{
|
||||
vm_offset_t pte, va;
|
||||
|
||||
set_segmap(temp_seg_va, pmeg_num);
|
||||
va += NBPG*page_num;
|
||||
pte = get_pte(va);
|
||||
set_segmap(temp_seg_va, SEGINV);
|
||||
return pte;
|
||||
}
|
||||
|
||||
void set_pte_pmeg(pmeg_num, page_num,pte)
|
||||
unsigned char pmeg_num;
|
||||
unsigned int page_num;
|
||||
vm_offset_t pte;
|
||||
{
|
||||
vm_offset_t va;
|
||||
|
||||
set_segmap(temp_seg_va, pmeg_num);
|
||||
va += NBPG*page_num;
|
||||
set_pte(va, pte);
|
||||
set_segmap(temp_seg_va, SEGINV);
|
||||
}
|
||||
|
|
@ -38,8 +38,12 @@
|
|||
|
||||
#include "../include/cpu.h"
|
||||
#include "../include/trap.h"
|
||||
#include "sys/types.h"
|
||||
#include "sys/cdefs.h"
|
||||
#include "sys/vm.h"
|
||||
#include "../include/pcb.h"
|
||||
#include "../include/psl.h"
|
||||
#include "../include/pte.h"
|
||||
#include "../include/control.h"
|
||||
#include "../include/param.h"
|
||||
#include "../include/memmap.h"
|
||||
|
@ -48,7 +52,7 @@
|
|||
main()
|
||||
{
|
||||
struct pcb *pcb = (struct pcb *) 0;
|
||||
|
||||
struct vmmeter *vm = (struct vmmeter *)0;
|
||||
/* 68k isms */
|
||||
printf("#define\tPSL_HIGHIPL %d\n", PSL_HIGHIPL);
|
||||
printf("#define\tFC_CONTROL %d\n", FC_CONTROL);
|
||||
|
@ -58,7 +62,7 @@ main()
|
|||
printf("#define\tCONTEXT_REG %d\n", CONTEXT_REG);
|
||||
printf("#define\tCONTEXT_NUM %d\n", CONTEXT_NUM);
|
||||
printf("#define\tSEGMAP_BASE %d\n", SEGMAP_BASE);
|
||||
printf("#define\tSEG_SIZE %d\n", SEG_SIZE);
|
||||
printf("#define\tNBSG %d\n", NBSG);
|
||||
|
||||
/* sun3 memory map */
|
||||
printf("#define\tMAINMEM_MONMAP %d\n", MAINMEM_MONMAP);
|
||||
|
@ -67,7 +71,19 @@ main()
|
|||
/* errno-isms */
|
||||
printf("#define\tEFAULT %d\n", EFAULT);
|
||||
printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG);
|
||||
printf("#define\tPC_ONFAULT %d\n", &pcb->pcb_onfault
|
||||
/* unix structure-isms */
|
||||
printf("#define\tPC_ONFAULT %d\n", &pcb->pcb_onfault);
|
||||
printf("#define\tSIZEOF_PCB %d\n", sizeof(struct pcb));
|
||||
/* vm statistics */
|
||||
printf("#define\tV_SWTCH %d\n", &vm->v_swtch);
|
||||
printf("#define\tV_TRAP %d\n", &vm->v_trap);
|
||||
printf("#define\tV_SYSCALL %d\n", &vm->v_syscall);
|
||||
printf("#define\tV_INTR %d\n", &vm->v_intr);
|
||||
printf("#define\tV_SOFT %d\n", &vm->v_soft);
|
||||
printf("#define\tV_PDMA %d\n", &vm->v_pdma);
|
||||
printf("#define\tV_FAULTS %d\n", &vm->v_faults);
|
||||
printf("#define\tV_PGREC %d\n", &vm->v_pgrec);
|
||||
printf("#define\tV_FASTPGREC %d\n", &vm->v_fastpgrec);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
.text
|
||||
ENTRY(_insque)
|
||||
ENTRY(insque)
|
||||
movw sr,d0
|
||||
movw #PSL_HIGHIPL,sr | atomic
|
||||
movl sp@(8),a0 | where to insert (after)
|
||||
|
@ -16,7 +16,7 @@ ENTRY(_insque)
|
|||
movw d0,sr
|
||||
rts
|
||||
|
||||
ENTRY(_remque)
|
||||
ENTRY(remque)
|
||||
movw sr,d0
|
||||
movw #PSL_HIGHIPL,sr | atomic
|
||||
movl sp@(4),a0 | element to remove (e)
|
||||
|
|
|
@ -38,7 +38,7 @@ perpmeg:
|
|||
movsb d1, a0@ | establish mapping
|
||||
addql #1, d1
|
||||
addl #SEG_SIZE, a0
|
||||
cmpl #(MAINMEM_MONMAP / NBSEG), d1 | are we done
|
||||
cmpl #(MAINMEM_MONMAP / NBSG), d1 | are we done
|
||||
bne perpmeg
|
||||
|
||||
|
||||
|
@ -62,8 +62,9 @@ bsszero: clrl a0@
|
|||
cmpl a0, a1
|
||||
bne bsszero
|
||||
movl #_start, sp
|
||||
jsr _bootstrap
|
||||
|
||||
jsr _sun3_bootstrap
|
||||
jsr _main
|
||||
rts |should never get here
|
||||
.text
|
||||
/*
|
||||
* Icode is copied out to process 1 to exec init.
|
||||
|
|
|
@ -17,18 +17,41 @@ static void initialize_vector_table()
|
|||
setvbr(vector_table);
|
||||
}
|
||||
|
||||
void sun3_vm_init()
|
||||
{
|
||||
|
||||
void bootstrap()
|
||||
|
||||
/*
|
||||
* initialize vpage[2]
|
||||
* allocate msgbuf physical memory
|
||||
* possibly allocate virtual segment for temp_seg_addr
|
||||
* get/compute information about available physical memory
|
||||
* get/compute information about start/end of kernel virtual addresses
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
void sun3_bootstrap()
|
||||
{
|
||||
static char hello[] = "hello world";
|
||||
int i;
|
||||
|
||||
/*
|
||||
* would do bzero of bss here but our bzero only works <64k stuff
|
||||
* so we've bailed and done it in locore right before this routine :)
|
||||
*/
|
||||
|
||||
for (i=0; i < 11; i++) {
|
||||
mon_putchar(hello[i]);
|
||||
}
|
||||
mon_printf("\nPROM Version: %d\n", romp->romvecVersion);
|
||||
initialize_vector_table();
|
||||
|
||||
initialize_vector_table(); /* point interrupts/exceptions to our table */
|
||||
|
||||
sun3_vm_init(); /* handle kernel mapping problems, etc */
|
||||
|
||||
pmap_bootstrap(); /* */
|
||||
|
||||
mon_exit_to_mon();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ ENTRY(setvbr)
|
|||
/* void control_copy_byte(caddr_t from, caddr_t to, int size)*/
|
||||
|
||||
ENTRY(control_copy_byte)
|
||||
|
||||
movl sp@(4), a0 |a0 = from
|
||||
movl sp@(8), a1 |a1 = to
|
||||
movl sp@(12), d1 |d1 = size
|
||||
|
@ -28,6 +27,45 @@ loop: movsb a0@+, d2
|
|||
movc d0, sfc
|
||||
movl sp@+, d2
|
||||
rts
|
||||
|
||||
/*
|
||||
* unsigned char get_control_byte (char *)
|
||||
*/
|
||||
|
||||
ENTRY(get_control_byte)
|
||||
movl sp@(4), a0
|
||||
moveq #0, d0
|
||||
movsb a0@, d0
|
||||
rts
|
||||
|
||||
/*
|
||||
* unsigned int get_control_word (char *)
|
||||
*/
|
||||
|
||||
ENTRY(get_control_word)
|
||||
movl sp@(4), a0
|
||||
movsl a0@, d0
|
||||
rts
|
||||
|
||||
/*
|
||||
* void set_control_byte (char *, unsigned char)
|
||||
*/
|
||||
|
||||
ENTRY(set_control_byte)
|
||||
movl sp@(4), a0
|
||||
movl sp@(8), d0
|
||||
movsb d0, a0@
|
||||
rts
|
||||
|
||||
/*
|
||||
* void set_control_word (char *, unsigned int)
|
||||
*/
|
||||
|
||||
ENTRY(set_control_word)
|
||||
movl sp@(4), a0
|
||||
movl sp@(8), d0
|
||||
movsl d0, a0@
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
#include "control.h"
|
||||
#include "sys/systm.h"
|
||||
#include "sys/types.h"
|
||||
#include "sys/reboot.h"
|
||||
#include "sys/buf.h"
|
||||
#include "../include/control.h"
|
||||
#include "../include/mon.h"
|
||||
#include "../dev/idprom.h"
|
||||
|
||||
|
||||
|
@ -23,7 +28,7 @@ void cpu_startup()
|
|||
}
|
||||
|
||||
|
||||
consinit()
|
||||
void consinit()
|
||||
{
|
||||
mon_printf("determining console:");
|
||||
cninit();
|
||||
|
@ -39,12 +44,14 @@ void cpu_reset()
|
|||
|
||||
int waittime = -1;
|
||||
|
||||
boot(howto)
|
||||
void boot(howto)
|
||||
int howto;
|
||||
{
|
||||
if ((howto&RB_NOSYNC) == 0 && waittime < 0 && bfreelist[0].b_forw) {
|
||||
struct buf *bp;
|
||||
int iter, nbusy;
|
||||
extern struct pcb proc0;
|
||||
|
||||
|
||||
waittime = 0;
|
||||
(void) splnet();
|
||||
|
@ -74,7 +81,6 @@ boot(howto)
|
|||
}
|
||||
resettodr();
|
||||
splhigh();
|
||||
devtype = major(rootdev);
|
||||
if (howto&RB_HALT) {
|
||||
printf("\n");
|
||||
printf("The operating system has halted.\n");
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -245,6 +245,7 @@ Lswnofpsave:
|
|||
addql #8,sp
|
||||
movl _curpcb,a1 | restore p_addr
|
||||
Lswnochg:
|
||||
#if 0
|
||||
|
||||
#ifdef PROFTIMER
|
||||
#ifdef notdef
|
||||
|
@ -336,7 +337,7 @@ Lresfprest:
|
|||
movw a1@(PCB_PS),sr | no, restore PS
|
||||
moveq #1,d0 | return 1 (for alternate returns)
|
||||
rts
|
||||
|
||||
#endif
|
||||
/*
|
||||
* savectx(pcb, altreturn)
|
||||
* Update pcb, saving current processor state and arranging
|
||||
|
|
|
@ -17,18 +17,41 @@ static void initialize_vector_table()
|
|||
setvbr(vector_table);
|
||||
}
|
||||
|
||||
void sun3_vm_init()
|
||||
{
|
||||
|
||||
void bootstrap()
|
||||
|
||||
/*
|
||||
* initialize vpage[2]
|
||||
* allocate msgbuf physical memory
|
||||
* possibly allocate virtual segment for temp_seg_addr
|
||||
* get/compute information about available physical memory
|
||||
* get/compute information about start/end of kernel virtual addresses
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
void sun3_bootstrap()
|
||||
{
|
||||
static char hello[] = "hello world";
|
||||
int i;
|
||||
|
||||
/*
|
||||
* would do bzero of bss here but our bzero only works <64k stuff
|
||||
* so we've bailed and done it in locore right before this routine :)
|
||||
*/
|
||||
|
||||
for (i=0; i < 11; i++) {
|
||||
mon_putchar(hello[i]);
|
||||
}
|
||||
mon_printf("\nPROM Version: %d\n", romp->romvecVersion);
|
||||
initialize_vector_table();
|
||||
|
||||
initialize_vector_table(); /* point interrupts/exceptions to our table */
|
||||
|
||||
sun3_vm_init(); /* handle kernel mapping problems, etc */
|
||||
|
||||
pmap_bootstrap(); /* */
|
||||
|
||||
mon_exit_to_mon();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
|
||||
/*#include "../dev/device.h"*/
|
||||
|
||||
#include "sd.h"
|
||||
/*#include "sd.h" XXX */
|
||||
#define NSD 0
|
||||
|
||||
/*
|
||||
* Generic configuration; all in one
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "proc.h"
|
||||
#include "malloc.h"
|
||||
#include "buf.h"
|
||||
#include "user.h"
|
||||
|
||||
#include "../include/cpu.h"
|
||||
|
||||
#include "vm/vm.h"
|
||||
#include "vm/vm_kern.h"
|
||||
#include "pte.h"
|
||||
|
||||
extern vm_map_t phys_map;
|
||||
|
||||
/*
|
||||
* Map an IO request into kernel virtual address space. Requests fall into
|
||||
* one of five catagories:
|
||||
*
|
||||
* B_PHYS|B_UAREA: User u-area swap.
|
||||
* Address is relative to start of u-area (p_addr).
|
||||
* B_PHYS|B_PAGET: User page table swap.
|
||||
* Address is a kernel VA in usrpt (Usrptmap).
|
||||
* B_PHYS|B_DIRTY: Dirty page push.
|
||||
* Address is a VA in proc2's address space.
|
||||
* B_PHYS|B_PGIN: Kernel pagein of user pages.
|
||||
* Address is VA in user's address space.
|
||||
* B_PHYS: User "raw" IO request.
|
||||
* Address is VA in user's address space.
|
||||
*
|
||||
* All requests are (re)mapped into kernel VA space via the useriomap
|
||||
* (a name with only slightly more meaning than "kernelmap")
|
||||
*/
|
||||
vmapbuf(bp)
|
||||
register struct buf *bp;
|
||||
{
|
||||
register int npf;
|
||||
register caddr_t addr;
|
||||
register long flags = bp->b_flags;
|
||||
struct proc *p;
|
||||
int off;
|
||||
vm_offset_t kva;
|
||||
register vm_offset_t pa;
|
||||
|
||||
if ((flags & B_PHYS) == 0)
|
||||
panic("vmapbuf");
|
||||
addr = bp->b_saveaddr = bp->b_un.b_addr;
|
||||
off = (int)addr & PGOFSET;
|
||||
p = bp->b_proc;
|
||||
npf = btoc(round_page(bp->b_bcount + off));
|
||||
kva = kmem_alloc_wait(phys_map, ctob(npf));
|
||||
bp->b_un.b_addr = (caddr_t) (kva + off);
|
||||
while (npf--) {
|
||||
pa = pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),
|
||||
(vm_offset_t)addr);
|
||||
if (pa == 0)
|
||||
panic("vmapbuf: null page frame");
|
||||
pmap_enter(vm_map_pmap(phys_map), kva, trunc_page(pa),
|
||||
VM_PROT_READ|VM_PROT_WRITE, TRUE);
|
||||
addr += PAGE_SIZE;
|
||||
kva += PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the io map PTEs associated with this IO operation.
|
||||
* We also invalidate the TLB entries and restore the original b_addr.
|
||||
*/
|
||||
vunmapbuf(bp)
|
||||
register struct buf *bp;
|
||||
{
|
||||
register int npf;
|
||||
register caddr_t addr = bp->b_un.b_addr;
|
||||
vm_offset_t kva;
|
||||
|
||||
if ((bp->b_flags & B_PHYS) == 0)
|
||||
panic("vunmapbuf");
|
||||
npf = btoc(round_page(bp->b_bcount + ((int)addr & PGOFSET)));
|
||||
kva = (vm_offset_t)((int)addr & ~PGOFSET);
|
||||
kmem_free_wakeup(phys_map, kva, ctob(npf));
|
||||
bp->b_un.b_addr = bp->b_saveaddr;
|
||||
bp->b_saveaddr = NULL;
|
||||
}
|
Loading…
Reference in New Issue