Hi,
Me and a nd a few other people at irc.qnxstart.com #qnx have been
working on getting ZSNES working, and there have already been some patches
sent to the CVS for inclusion, so we may see a working version of ZSNES on
QNX6 soon (assuming SDL gets fixed soon
). The tweeks that were done were
quite minimal, for example:
…
void MakeCodeWriteable (unsigned long startaddr, unsigned long length)
{
int r;
unsigned int addr;
int psize = getpagesize();
//fprintf(stderr, “Unprotecting 0x%x to 0x%x\n”, startaddr,
startaddr+length);
addr = (startaddr & ~(psize -1)) - psize;
r = mprotect ((char *) addr, length + startaddr - addr + psize, 7);
if (r < 0)
fprintf (stderr, “Error! Memory NOT unprotected.\n”);
}
…
This was a landmind of issues for QNX6 for two reasons, one getpagesize()
was commented out of unistd.h (meaning ZSNES couldnt get the systems page
size), and two the following line would only work in linux:
r = mprotect ((char *) addr, length + startaddr - addr + psize, 7);
Nottice the 7? Not a very posix-compliant thing to do, however, this was
quickly corrected by changing it to this:
r = mprotect ((char *) addr, length + startaddr - addr + psize, PROT_READ |
PROT_WRITE | PROT_EXEC);
As for the getpagesize() issue, we used the following quick hack:
#ifdef QNXNTO
#define getpagesize() 4096
#endif
Yes, it is sometimes just that simple 
Other little things had to be done, for example, it was littered with
#ifdef LINUX, which ment a great deal of code would not be compiled,
simply adding #define LINUX fixed it rather quickly. Emmm… I think
thats about it, if you have any questions just ask 
Travis “TheAlien” Coady
smallfri@bigfoot.com
“Kosta K” <kosta_k@phreaker.net> wrote in message
news:9ebmgg$p4l$1@inn.qnx.com…
Ok, i am determined to have a goood sns emulator on QNX6. I need hints,
how-tos… anything, that would help on porting something like this.
Can anyone offer me any tips especially since i’ve never ported
aplications
before?
Thanks,
Kosta.
–
Webpage: > http://members.nbci.com/gwurb/