Mail Archives: djgpp/1999/10/20/13:18:31
Eli Zaretskii wrote:
>
>On Sun, 17 Oct 1999 kriiid AT my-deja DOT com wrote:
>
>> Well, the first question is: when I get SIGSEGV there is written
>> information about segments. What does limit section mean?
>
>It's one less than the segment size in bytes.
>
>> I thought
>> this is size of segment. But now I don't think so, cause values like
>> 0x8ffff are not really possible
>
>Why not? 0x8ffff is 589823 bytes: not too much for a typical DJGPP
>program. Especially since 524288 bytes (512K) out of this amount is
>the run-time stack, which is allocated at startup in its entirety.
Well... I ment it's incredibly small. At least for me. So what if I'd
like to allocate ie. 10 MB? Would djgpp extend this segment to ~11MB?
It look pretty inefficient (if it is done for every malloc).
>> the most essential function - allocating memory (501h). So I
>> made program which just allocates some memory. I run it under
windows.
>> So, linear address is 05DAC000h. And now the funny part. Base address
>> of DS/CS is 83046000h ;-). So now I've got a problem.
>
>Please explain why this is ``a problem''. I don't see any problem
>here. You might base your judgement on some incorrect assumptions.
May be.
Well I try to access this memory using DS or CS. So the offset would
have to be negative.
Of course I can create new segment for this memory, but I think it
wouldn't be comfortible to use it...
>> So I run it under DOS.
>> Allocated addres is 200B0000h, while base addres is 10000000h. It
looks
>> OK, but when I try to write there I get a beautiful SIGSEGV.
>
>Post the code that you used to do this. There's probably some bug in
>how you access that memory.
mov ax,6
mov bx,ds
int 31h
jc memer
shl ecx,16
mov cx,dx
mov [base],ecx
mov ax,0501h
mov bx,0
mov cx,8000
int 31h
jc memer
shl ebx,16
add ebx,ecx
mov [precoo],ebx
And then I just use [precoo]...
So you say it's wrong
>In general, I suggest to read the DPMI spec carefully. For example,
>it tells you that allocating memory does not yet allow to access it.
>You also need either to enlarge your DS segment to allow for the
>newly-allocated memory be part of it, and sometimes change the base
>address as well, or create a separate selector for the allocated
>memory.
Thanks... I'll try this.
Changing base is not really a good idea, because what to do with data
allocated within DS using db or something.
>Do you have some particular application for calling DPMI functions
>directly, rather than using malloc? If so, I suggest to tell what
>application do you have in mind;
I'm actually coding an intro, so it have to be small.
May the Force be with ya,
Michal 'CreeD' Szostakiewicz
buttman AT boss DOT staszic DOT waw DOT pl ew. gerwek AT polbox DOT com
ICQ - 2482112
"Only in America we stamp our God
<<In God we Trust>>"
Sent via Deja.com http://www.deja.com/
Before you buy.
- Raw text -