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 :)

-Artturi


diff --git a/sys/arch/arm64/arm64/pmap.c b/sys/arch/arm64/arm64/pmap.c
index 4dd2df4a2e2..4cb59b78d2a 100644
--- a/sys/arch/arm64/arm64/pmap.c
+++ b/sys/arch/arm64/arm64/pmap.c
@@ -1940,6 +1940,9 @@ pmap_map_stolen(vaddr_t kernel_start)
                }
        }
 
+       va += PAGE_SIZE;
+       memhook = (char *)va;
+
        return va + PAGE_SIZE;
 }
 

Reply via email to