From: "Alexei A. Frounze" Newsgroups: comp.os.msdos.djgpp Subject: Re: Help with Inline ASM... Date: Fri, 14 Apr 2000 20:31:30 +0400 Organization: MTU-Intel ISP Lines: 62 Message-ID: <38F747E2.7793F51B@mtu-net.ru> References: <3 DOT 0 DOT 6 DOT 32 DOT 20000413223445 DOT 007be930 AT pop DOT crosswinds DOT net> <38F6A5DD DOT BE4550F8 AT mtu-net DOT ru> <38F7075A DOT D14F07E4 AT is DOT elta DOT co DOT il> NNTP-Posting-Host: ppp96-173.dialup.mtu-net.ru Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Trace: gavrilo.mtu.ru 955731544 49909 212.188.96.173 (14 Apr 2000 16:59:04 GMT) X-Complaints-To: usenet-abuse AT mtu DOT ru NNTP-Posting-Date: 14 Apr 2000 16:59:04 GMT X-Mailer: Mozilla 4.61 [en] (Win95; I) X-Accept-Language: en,ru To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > "Alexei A. Frounze" wrote: > > > > But don't put something like: > > > > mov [cs:number], value > > > > use > > > > mov [ds:number], value > > > > since you're in PMode with flat memory model. > > Flat memory model is not an issue here. The problem is that the code segment > whose selector is loaded into the CS register is marked as executable, and > such segments cannot be written in protected mode. Please read all the following text until its end. Then reply. You're right, we can not modify segment marked as executable/read. But since data segment is mapped on the code segment as well, you may modify it just uding the DS selector. > > Btw, DJGPP doesn't use a flat memory model at all. The details of this were > discussed several months ago here, so you can find them by searching at > http://www.delorie.com/djgpp/mail-archives/. Wait a minute. Some string constants are stored to the code segment by GCC. And they are accessible in data segment as well, since data segment is mapped onto the code segment too. Or do you mean, that EXE files contain all the relocation entries? If so, why I see in each EXE only the following: 1. COFF header 2. optional COFF header (for already linked programs) 3. .text section (w/o relocation entries) 4. .data section (w/o relocation entries) 5. .bss section (w/o relocation entries) 6. string table 7. symbol table According to the sections, the .data section starts just after the .text section and the .bss esctions starts just after the .data section. So, it's a true flat memory model (but only virtual addresses don't equal physicals. i.e. VGA video buffer is not accessible at the 0xA0000 virtual address). The only problem might be that code segment pages are marked as read-only. But since sections are not always 4KB aligned and their sizes are not in 4KB blocks, I can tell you that there is no page level protection for writing. bye. Alexei A. Frounze ----------------------------------------- Homepage: http://alexfru.chat.ru Mirror: http://members.xoom.com/alexfru