Xref: news2.mv.net comp.os.msdos.djgpp:5763 From: Charles Sandmann Newsgroups: comp.os.msdos.djgpp Subject: Re: Locking RAM for hardware interrupts Date: Mon, 08 Jul 1996 22:35:27 CDT Organization: Rice University, Houston, Texas Lines: 27 Message-ID: <31e1d37f.sandmann@clio.rice.edu> References: <836858848 DOT 164 DOT 0 AT abwillms DOT demon DOT co DOT uk> Reply-To: sandmann AT clio DOT rice DOT edu NNTP-Posting-Host: clio.rice.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp > My proposal is: make a crt0 flag that locks the /program image/ rather > than /all memory/. Why? This is so easy to do there is no reason to have a custom flag for it. The start will always be 0x10a8 and the end will be etext. The reason there is a flag for all memory is that it may be fragmented to hell with some DPMI servers, and you can't lock memory between the blocks you own (there was no easy way to handle it in this case, so a lock all was convenient). The flag you propose is like 5 lines of code, but by adding it to a crt0 flag every image ever linked gets a copy of it, even though most wouldn't use it. The routine at a time method is better, but here's a simple example... #include #include extern unsigned etext __asm__ ("etext"); void lock_all_code(void) { __dpmi_meminfo lockmem; /* lock all code addresses for HW interrupts */ lockmem.address = __djgpp_base_address + 0x10a8; lockmem.size = (unsigned)&etext - 0x10a8; __dpmi_lock_linear_region(&lockmem); }