Mail Archives: djgpp/1995/07/31/23:12:18
Xref: | news-dnh.mv.net comp.os.msdos.djgpp:1266
|
Path: | news-dnh.mv.net!mv!news.sprintlink.net!hookup!news.mcgill.ca!news
|
From: | nverever <nverever AT ee>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Memory protection problems
|
Date: | 29 Jul 1995 04:54:17 GMT
|
Organization: | McGill University Computing Centre
|
Lines: | 24
|
Nntp-Posting-Host: | o-09.das.mcgill.ca
|
To: | djgpp AT sun DOT soe DOT clarkson DOT edu
|
Dj-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Ok, I'm writting a tight inline assembler function that takes 3 parameters so far.
The thing is, that one of those parameters is a pointer in memory that is allocated
when the program is loaded first, but stays constant after that. I was thinking that
I could save the time of passing the parameter if I wrote an initialisation routine that
would modify an inline instruction such as "movl $0, %edx" and replace the constant $0
with whatever the pointer is. Sounds great,but I hit a problem I could of guessed should
be there, I get an exception fault when I try to modify the opcode. I figure this is probably
because the selector in cs is read-only. If that is indeed the problem, I know that it's
possible to change the selector to read/write and then back to read only with some
dpmi functions, but I don't have a dpmi server on my system and I assume that most
people don't either. Help on this solution if it could work would be appreciated.
Also, I heard that it's possible to make an array of bytes and make the program execute those
instructions. If this is really so I could simply copy the function into an array, modify the desired
instructions and call that new function. The only problem, is that I don't know how to call
that new function if this can be done at all since it's in the data selector, not the code selector.
Oh yeah, I'm using djgpp v1.something I guess with go32 v.1.12.maint3 if that helps...
Greatfull for any help....
Patrick Mitran
- Raw text -