diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-06-07 09:27:07 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-06-07 09:27:07 +0000 |
commit | 7d71afb8fea0a80f1625d096256c38e4ca18b695 (patch) | |
tree | f6d9c9f37e225bf11d16c5700422fbd037f4f80c | |
parent | d60b2b525d05970219a0c1b718c304fffa8c1d5a (diff) |
Enable translation in the trap handlers.
Initialize msgbuf.
-rw-r--r-- | sys/arch/powerpc64/include/trap.h | 5 | ||||
-rw-r--r-- | sys/arch/powerpc64/powerpc64/machdep.c | 11 | ||||
-rw-r--r-- | sys/arch/powerpc64/powerpc64/pmap.c | 14 | ||||
-rw-r--r-- | sys/arch/powerpc64/powerpc64/trap_subr.S | 9 |
4 files changed, 25 insertions, 14 deletions
diff --git a/sys/arch/powerpc64/include/trap.h b/sys/arch/powerpc64/include/trap.h index df82996505c..3b328a529a4 100644 --- a/sys/arch/powerpc64/include/trap.h +++ b/sys/arch/powerpc64/include/trap.h @@ -142,8 +142,7 @@ #define EXC_PGM_PRIV (1UL << 18) #define EXC_PGM_TRAP (1UL << 17) -/* Magic pointer to store TOC base and other info for trap handlers */ -#define TRAP_ENTRY 0x1f0 -#define TRAP_TOCBASE 0x1f8 +/* Magic pointer to store trap handler entry point */ +#define TRAP_ENTRY 0x1f8 #endif /* _MACHINE_TRAP_H_ */ diff --git a/sys/arch/powerpc64/powerpc64/machdep.c b/sys/arch/powerpc64/powerpc64/machdep.c index b5dad3d5460..4dab9b7f2f7 100644 --- a/sys/arch/powerpc64/powerpc64/machdep.c +++ b/sys/arch/powerpc64/powerpc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.12 2020/06/06 22:36:22 kettenis Exp $ */ +/* $OpenBSD: machdep.c,v 1.13 2020/06/07 09:27:06 kettenis Exp $ */ /* * Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org> @@ -118,7 +118,6 @@ init_powernv(void *fdt, void *tocbase) __syncicache(EXC_RSVD, EXC_LAST - EXC_RSVD); *((void **)TRAP_ENTRY) = generictrap; - *((void **)TRAP_TOCBASE) = tocbase; /* We're now ready to take traps. */ msr = mfmsr(); @@ -179,7 +178,7 @@ init_powernv(void *fdt, void *tocbase) #ifdef DDB /* Load symbols from initrd. */ db_machine_init(); - if (initrd_reg.addr != 0) + if (initrd_reg.size != 0) memreg_remove(&initrd_reg); #endif @@ -194,14 +193,12 @@ init_powernv(void *fdt, void *tocbase) atop(start), atop(end), 0); } -#ifdef notyet - initmsgbuf((caddr_t)uvm_pageboot_alloc(MSGBUFSIZE), MSGBUFSIZE); -#endif - /* Enable translation. */ msr = mfmsr(); mtmsr(msr | (PSL_DR|PSL_IR)); isync(); + + initmsgbuf((caddr_t)uvm_pageboot_alloc(MSGBUFSIZE), MSGBUFSIZE); } void diff --git a/sys/arch/powerpc64/powerpc64/pmap.c b/sys/arch/powerpc64/powerpc64/pmap.c index eb86769c4e8..1b73c23197e 100644 --- a/sys/arch/powerpc64/powerpc64/pmap.c +++ b/sys/arch/powerpc64/powerpc64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.3 2020/06/06 22:36:22 kettenis Exp $ */ +/* $OpenBSD: pmap.c,v 1.4 2020/06/07 09:27:06 kettenis Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot @@ -470,6 +470,10 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot) extern struct fdt_reg memreg[]; extern int nmemreg; +#ifdef DDB +extern struct fdt_reg initrd_reg; +#endif + void memreg_add(const struct fdt_reg *); void memreg_remove(const struct fdt_reg *); @@ -700,6 +704,14 @@ pmap_bootstrap(void) pmap_kenter_pa(pa, pa, prot); } +#ifdef DDB + /* Map initrd. */ + start = initrd_reg.addr; + end = initrd_reg.addr + initrd_reg.size; + for (pa = start; pa < end; pa += PAGE_SIZE) + pmap_kenter_pa(pa, pa, PROT_READ | PROT_WRITE); +#endif + /* Allocate partition table. */ pmap_pat = pmap_steal_avail(PATMEMSZ, PATMEMSZ); memset(pmap_pat, 0, PATMEMSZ); diff --git a/sys/arch/powerpc64/powerpc64/trap_subr.S b/sys/arch/powerpc64/powerpc64/trap_subr.S index 332420481a9..bd5b47bc98e 100644 --- a/sys/arch/powerpc64/powerpc64/trap_subr.S +++ b/sys/arch/powerpc64/powerpc64/trap_subr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: trap_subr.S,v 1.3 2020/05/27 22:22:04 gkoehler Exp $ */ +/* $OpenBSD: trap_subr.S,v 1.4 2020/06/07 09:27:06 kettenis Exp $ */ /* $NetBSD: trap_subr.S,v 1.20 2002/04/22 23:20:08 kleink Exp $ */ /*- @@ -43,7 +43,10 @@ mfsprg0 r #define GET_TOCBASE(r) \ - ld r, TRAP_TOCBASE(0) + bl 99f; \ +99: mflr r; \ + addis r, r, (.TOC. - 99b)@ha; \ + addi r, r, (.TOC. - 99b)@l; /* * FRAME_SETUP assumes: @@ -69,7 +72,7 @@ std %r30, (savearea+CPUSAVE_SRR1)(%r31); /* save SRR1 */ \ mfsprg1 %r31; /* get saved SP (clears SPRG1) */ \ mfmsr %r30; \ - ori %r30, %r30, (PSL_RI)@l; /* XXX */ \ + ori %r30, %r30, (PSL_DR|PSL_IR|PSL_RI)@l; /* relocation on */ \ mtmsr %r30; /* stack can now be accessed */ \ isync; \ stdu %r31, -(FRAMELEN+288)(%r1); /* save it in the callframe */ \ |