bdb@cl.cam.ac.uk (Brian Brunswick) (03/01/91)
The other day I was trying to debug something with a pointer bug in it, and it was crashing the system totally each time it ran. I whined about the lack of proper memory protection in RiscOs, and my friend suggested that the memory below 32K was only not protected due to ancient compatibility - most of the system would work with it write protected for user mode. So I whipped up a quick proglet to do this, and he was indeed correct - enough of the system works, certainly sufficiently to easily find my bug from the backtrace due to the abort. Here follows the few lines of basic needed. --- cut --- REM>PROT0 REM By Brian.Brunswick@uk.ac.cam.cl SYS"OS_ReadMemMapInfo" TO pagesize,pages DIM p (pages+1)*12 FOR I=0 TO pages-1 p!(I*12)=I NEXT p!(pages*12)=-1 SYS"OS_ReadMemMapEntries",p FOR I=0 TO pages-1 IF p!(I*12+4)=0 THEN p!(I*12+8)=1 NEXT SYS"OS_SetMemMapEntries",p --- cut --- I have since found that printing seems to die with this thing in though. And I would suspect that suspicious applications might well do too. It might be interesting to build up a list of things grungy enough to die, as indications of nasty hackery at work. Now if only we could protect the RMA space too, those system crashes might be a thing of the past.... Brian.Brunswick@uk.ac.cam.cl Disclaimer. Short sig rules!