From mboxrd@z Thu Jan 1 00:00:00 1970 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <13426df10711061028g73f7f4bdy22b4fe882087573@mail.gmail.com> References: <11F071B3-1B01-4272-9EA4-1C2BD50BCC0B@telus.net> <4730B27F.7030608@gmail.com> <4730BBBF.5060202@gmail.com> <13426df10711061028g73f7f4bdy22b4fe882087573@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <587DB984-56A2-44B8-A921-919AF4BBF1E5@telus.net> Content-Transfer-Encoding: 7bit From: Paul Lalonde Subject: Re: [9fans] Memory management questions/not plan-9 specific Date: Tue, 6 Nov 2007 12:12:34 -0800 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Topicbox-Message-UUID: ebd20e1c-ead2-11e9-9d60-3106f5b1d025 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ah, I see the light. I'll give it a shot :-) Paul On Nov 6, 2007, at 10:28 AM, ron minnich wrote: > On 11/6/07, Robert William Fuller wrote: >> Paul Lalonde wrote: >>> >>> On Nov 6, 2007, at 10:29 AM, Robert William Fuller wrote: >>>>> In UNIX, set up a signal handler for SIGSEGV. >>> >>> Not quite enough - I still need to reserve some address space. mmap >>> doesn't let me reserve it without backing it. >> >> It does by default on Linux :-) >> > > mmap /dev/zero over the region you want. Or not, you can just any > piece of your address space, actually. > > mprotect it (page-aligned, now!0 so you can't access it. record the > fact that you did this. i.e. set up data structures that allow you to > tell, in the segv handler, that it's a "page fault" and not a true > screwup in your code. > > in the segv handler, get the fault address and type, search your > structs, figure out what to do. Be sure to compute page frame from the > address, etc. etc. fix it up with memprotect. record what you did. > return. > > that's pretty much what I did. > > ron -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin) iD8DBQFHMMqypJeHo/Fbu1wRAqUQAJ4hn3Di6umwfmDRkz2l9vGoxlAoZACgsXgc ejFMKTf4qP4qJLIOPkzcwMQ= =HC5E -----END PGP SIGNATURE-----