Article View: comp.lang.asm.x86
Article #185Re: 32bit Assembler ( figureing out relocations )
From: Mark Grosberg
Date: Sat, 21 Jan 1995 11:05
Date: Sat, 21 Jan 1995 11:05
29 lines
2627 bytes
2627 bytes
Duncan Murdoch (dmurdoch@mast.queensu.ca) wrote: : However, the segmented model does give better protection to data. If you : want, you can allocate a segment of any size, and detect writes to the segment : that are off by one --- a very common error. You can't do that with the flat : model because of the 4K granularity of the page-based protection. Yup. This is one of the things I do miss with 16-Bit OS/2. But, it's quite easy to do the following: Place paddind strings of odd bytes both at the front and back of your memory allocation (a 16-Byte string is a pretty good saftey margin, hint, try using fubar in it!).. Make sure the ending and beginning strings are different (I caught a strange memory move bug in my code with this a while ago)... When you free the memory (you can add some smarts to check for orphaned memory as well) you can check the sanity strings at the edges of the memory block and report them... If you wrap it up in a nice layer around your allocater, debugging even the hardest of pointer errors becomes a breeze (I allow naming memory objects and giving them an ID #, which is also stored in the allocated block -- so runtime dumps of memory allocation are pretty easy to read)... Eventually I may post the code to do this in the public domain for anybody who wants it... But it needs some cleaning first... L8r, Mark G.
Technical Details
Message-ID:
<3fqppg$24t6@tequesta.gate.net>Path:
arc1-ca.pugleaf.net!pad-thai.cam.ov.com!bloom-beacon.mit.edu!hookup!swrinde!howland.reston.ans.net!news.sprintlink.net!tequesta.gate.net!seminole.gate.net!mygReferences:
<2f1d2bb1@ralf> <dmurdoch.1584.2F1EBF70@mast.queensu.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,14c198d00592d0c8 X-Google-Attributes: gid11318c,public X-Google-Thread: 10f6aa,14c198d00592d0c8 X-Google-Attributes: gid10f6aa,public X-Google-Thread: 114917,14c198d00592d0c8 X-Google-Attributes: gid114917,public X-Google-Thread: 102bfa,14c198d00592d0c8 X-Google-Attributes: gid102bfa,public X-Google-Thread: 110292,14c198d00592d0c8 X-Google-Attributes: gid110292,public X-Google-ArrivalTime: 1995-01-21 03:13:17 PST Path: arc1-ca.pugleaf.net!pad-thai.cam.ov.com!bloom-beacon.mit.edu!hookup!swrinde!howland.reston.ans.net!news.sprintlink.net!tequesta.gate.net!seminole.gate.net!myg From: myg@gate.net (Mark Grosberg) Newsgroups: comp.lang.asm.x86,comp.sys.intel,alt.msdos.programmer,comp.os.msdos.programmer,gnu.gcc.help Subject: Re: 32bit Assembler ( figureing out relocations ) Followup-To: comp.lang.asm.x86,comp.sys.intel,alt.msdos.programmer,comp.os.msdos.programmer,gnu.gcc.help Date: 21 Jan 1995 11:05:20 GMT Organization: Custom Computing Services Lines: 30 Message-ID: <3fqppg$24t6@tequesta.gate.net> References: <2f1d2bb1@ralf> <dmurdoch.1584.2F1EBF70@mast.queensu.ca> NNTP-Posting-Host: seminole.gate.net X-Newsreader: TIN [version 1.2 PL2]