From: firewind Newsgroups: comp.os.msdos.djgpp Subject: Re: how to convert real mode pointer into protected mode ? Date: 20 Aug 1997 23:06:39 GMT Organization: Netcom Lines: 70 Message-ID: <5tft9v$cjg@sjx-ixn8.ix.netcom.com> References: <33F82B88 DOT 642 AT chem DOT uw DOT edu DOT pl> <5tasf6$cvc AT dfw-ixnews12 DOT ix DOT netcom DOT com> <33F97B9B DOT 74D7 AT chem DOT uw DOT edu DOT pl> <5tdcql$1qv AT sjx-ixn4 DOT ix DOT netcom DOT com> <33FAC1BA DOT 389E AT chem DOT uw DOT edu DOT pl> NNTP-Posting-Host: elp-tx1-07.ix.netcom.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Wojciech Galazka wrote: > > And if you have a correct structure definition, you can compute > > the size of the structure, can't you? > This is not always correct. Taking the previous example > struct foo { > short size; > struct { > short min; > short max; > } * minmax; > } > This the definition of the structure. What > I get referenced to is however > struct true_foo { > short size; > struct { > short min; > short max; > } minmax[size]; > } > I cannot just copy the entire structure by dosmemget because I > don't know the value of 'size' So the procedure would be. > 1 farpeekw() the value of size > 2 dosmemget(0 size number of minmax structures. Right, sorry, I didn't pay attention to the definition before. (Stupid me!) > But the whole problem of all this thread is that I try > to avoid copying at all. Why I'm forced to copy some data. > when this data has already had its place somewhere under 1 MB? > Copying is a time-consuming task. > > So you want to read the data -without- copying it to protected mode? AFAIK, > > this is not possible. > Oh no, that sounds incredible to me :))) > And if so then my answer is why ? Well, AFAICS, your only option, then, is to enable near pointers with the macro __djgpp_nearptr_toggle (or is it _enable?) and work with that... > > I couldn't find __dpmi_map_physical_memory but you mentioned > > __dpmi_map_conventional_memory_in_memory_block in a previous post, so I > > assume that's what you mean. The description for this function in the libc > > docs says: > > > > "This function maps conventional memory (even when virtualized) to > > virtual memory. Pass the handle, offset, and number of pages." > > > > Anyway, I > > fail to see how this remapped memory is used; does a correct call make > > ES:DI a valid pointer? I'll test this later. > > > > The proper use if __dpmi_map_conventional_memory_in_memory_block > is still a mystery to me. And what;s worse it requires DPMI 1.0 > (Imagine, Microsoft's DPMI servers don't support it and claim they won't > it in the future either) That's bad if you want your program to run on as many machines as possible... BTW, any DPMI gurus out there who can explain the function..? > > To the point: I fail to see why dosmemget cannot be used here. > To avoid copying. Okay, I see that now. I (incorrectly) assumed you just wanted to access it, didn't think -how- made a difference. :)