> Date: Sun, 24 Dec 2017 00:25:30 +0200
> From: Artturi Alm <artturi....@gmail.com>
> 
> On Sat, Dec 23, 2017 at 03:41:02PM +0200, Artturi Alm wrote:
> > Hi,
> > 
> > spotted this while looking at how deep the hole suggested by mpi@ is.
> > memhook is used by mmrw minor case 0, and the diff below fixes that.
> > rest of it should be logically solid improvement, but given the state
> > of arm64 internals w/all the "// XXXshit", and how sacred these arch-md
> > bootstraps are to be above all cleanup, i guess i'll come up w/minimal
> > diff later.
> > 
> > -Artturi
> > 
> 
> and now with the minimal dirty version to fix this:
> a64pine# dmesg | head -1
> OpenBSD 6.2-current (GENERIC) #123: Thu Dec 21 14:27:12 MST 2017
> a64pine# sysctl ddb.trigger=1
> Stopped at      ddb_sysctl+0x118:
> ddb> pp memhook
> memhook:        (unsigned char *)0x0
> ddb> c
> ddb.trigger: 0 -> 1
> a64pine#
> 
> return value of pmap_map_stolen() is essentially the vstart used in initarm(),
> and it's called only once near the end of pmap_bootstrap(), so this does fit
> well w/the obscure spirit of arm bootstrap code w/o cleaning anything :)

Well, putting it there makes no sense.

Anyway, now that you've made it a little bit more obvious what you're
fixing, here is a diff that makes a little bit more sense.

ok?


Index: arch/arm64/arm64/pmap.c
===================================================================
RCS file: /cvs/src/sys/arch/arm64/arm64/pmap.c,v
retrieving revision 1.38
diff -u -p -r1.38 pmap.c
--- arch/arm64/arm64/pmap.c     27 Aug 2017 19:33:02 -0000      1.38
+++ arch/arm64/arm64/pmap.c     24 Dec 2017 10:56:10 -0000
@@ -133,6 +133,10 @@ vaddr_t pmap_map_stolen(vaddr_t);
 void pmap_physload_avail(void);
 extern caddr_t msgbufaddr;
 
+char *memhook;
+vaddr_t zero_page;
+vaddr_t copy_src_page;
+vaddr_t copy_dst_page;
 
 /* XXX - panic on pool get failures? */
 struct pool pmap_pmap_pool;
@@ -1201,6 +1205,9 @@ pmap_bootstrap(long kvo, paddr_t lpt1,  
 
        printf("all mapped\n");
 
+       memhook = (char *)vstart;
+       vstart += PAGE_SIZE;
+
        return vstart;
 }
 
@@ -1649,11 +1656,6 @@ void
 pmap_update(pmap_t pm)
 {
 }
-
-char *memhook;
-vaddr_t zero_page;
-vaddr_t copy_src_page;
-vaddr_t copy_dst_page;
 
 int
 pmap_is_referenced(struct vm_page *pg)

Reply via email to