Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

PSP manipulation from DPMI programs (Developers)

posted by Laaca Homepage, Czech republic, 16.02.2023, 00:02

I am trying to debug my test program which should create a new environment variable and then call the child process with normal Exec call.

I have no problems to do it in real mode:
1) Get my PSP (INT 21h/62h)
2) from PSP:2Ch get the segment address of the buffer with environment
3) Copy it to new buffer, modify it and place the PSP:2Ch to my new buffer.

OK.
But when I try to follow this scheme in DPMI (Freepascal) I am not able to get it to work.
I thought that oroginal PSP:2Ch is a segment somewhere to low DOS memory and my new buffer bust be also in the DOS memory.
But after some googling I found this article:
http://www.delorie.com/djgpp/doc/dpmi/ch4.1.html

And mainly this part is confusing to me:
The environment pointer in the client program's PSP is automatically converted to a selector during the mode switch. If the client wishes to free the memory occupied by the environment, it should do so before entering protected mode and zero the word at PSP:2CH (segment address of the environment>. The client may change the environment point in the PSP after entering protected mode but it must restore it to the selector created by the DPMI host before terminating. The client should not modify or free the PSP or environment descriptors supplied by the DPMI host.

So this means that the PSP:2Ch does not point to common DOS memory pool but to some own selector?
Why?
And if I want to create a new environment variable I have to do all the boring stuff with allocating DPMI selector, set its base, limit and so on?

---
DOS-u-akbar!

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 142 users online (0 registered, 142 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum