Date: Mon, 2 Nov 1998 15:51:16 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Christian Hofrichter cc: djgpp AT delorie DOT com Subject: Re: Neeed some help about protected-mode-memory-management In-Reply-To: <363D8E66.CD0DDE3D@gmx.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Please note that usually it is best not to ask too many different questions in a single longish message. On Mon, 2 Nov 1998, Christian Hofrichter wrote: > How can I get the offset of a variable or a function ? > > offset=&variable; Yes. > offset=function or offset=&function Any one will do. > How can I get the size of a function ? In general, you can't. If you need this, write your function in assembly. There's a trick of putting two dummy functions before and after the one whose size you need, and subtracting the addresses to get the size. But this isn't guaranteed to work, although with present versions of the compiler it does work. > Why do I have to lock the memory when I want to access a linear address > ? I mean when this space is swaped to disk and I want to access it with > a selector and an offset, doesn't the dpmi-server reload it from disk > automaticly ? It does, and you don't have to lock it, unless you touch it inside an interrupt handler. Paging from within an interrupt handler is not allowed, see section 18.11 of the DJGPP FAQ list for details about this. > When I want to copy memory-blocks in the space above 1 MB (in > assembler), is this the same procedure like in real-mode with the > difference that I have to store the selectors in the registers where I > had to store the segments in the real-mode before ? I don't understand the question. In protected mode, segments and selectors are the same (more precisely, you can only refer to a segment by its selector). So the answer is yes and no. And besides, you can use memcpy to copy blocks rather than reinvent the wheel in assembly. > Can I have direct access to memory in the space above1 MB without using > the FAT DS method ? Not clear enough, since your program's variables are all above 1MB and you have direct access to them. If you mean direct access to absolute addresses (like to memory-mapped peripheral devices), then the answer is no; you need to use one of the methods described in section 18.4 of the FAQ. FAT DS is one of them, but by no means the recommended one. > Can I have direct access to memory in the space under 1 MB without > using the FAT DS method ? Same as above. > When I map linear memory, what does it mean ? Please explain what function do you use to ``map linear memory''. The answer depends on that. > How can I get the physical address when I have a selector and an offset > (this memory-space is not swaped to disk) ? You can't get the physical address without messing with the descriptor tables (which is DPMI server-dependent, and usually very hard). > Do the memory-copy-routines - for the protected-mode in Djgpp- move 4 > bytes at one time ? Yes. (You could look in the sources, btw.)