I tried to set a kerneld db breakpoint on amd64 current (6.99.6) but the
system just dumped - couldn't see why since it all scrolled away.
Attempts to write into code space fault in ddb.
The following makes it work - but is clearly ott.
--- arch/amd64/amd64/db_memrw.c 23 Nov 2011 01:15:02 -0000 1.9
+++ arch/amd64/amd64/db_memrw.c 30 Apr 2012 20:49:21 -0000
@@ -146,6 +146,7 @@ db_write_text(vaddr_t addr, size_t size,
pmap_pte_clearbits(ppte, PG_KR);
pmap_pte_setbits(ppte, PG_KW);
pmap_update_pg(pgva);
+ tlbflushg();
/*
* Page is now writable. Do as much access as we
@@ -160,6 +161,7 @@ db_write_text(vaddr_t addr, size_t size,
pmap_pte_clearbits(ppte, PG_KW);
pmap_pte_setbits(ppte, PG_KR);
pmap_update_pg(pgva);
+ tlbflushg();
} while (size != 0);
}
pmap_update_pg(addr) is just the single instruction 'invlpg adddr'
tlbflushg() is a full tlb zap.
Not looked at what invlpg is supposed to do, or whether it is
an adequate synchronising instruction.
cpu is an intel i7.