Friday, June 25, 2010

/dev/mem

Hacking on my "Dingux emulator", I recently came across some applications that behaved rather erratically. So I looked into the source code of one of them, and I found that while the application itself uses SDL throughout, the Dingoo-specific GUI tacked on mmap()s the JZ4740 I/O registers to get user input. This, of course, spectacularly and needlessly fails on everything that is not a Dingoo A-320.

Here's some advice: Once you have chosen one level of abstraction, you stay there. And when you're porting somebody else's code who chose to develop on top of SDL, you also stay there, whether you like it or not!

And, generally, using /dev/mem to sidestep the operating system is wrong. Always.


Unless you're me, of course. But even then it's a hack. Thanks for listening.

No comments:

Post a Comment