You are not logged in.
Hey all,
I'm by no means anywhere near qualified to say I'm a programmer, but I am trying to get a bit of code written in C++ and originally on Linux ported over to Solaris. There is one function left that I'm having trouble finding a replacement/alternative for, and that is the function "insw" from sys/io.h. Solaris doesn't have the sys/io.h header and I've been all over the net trying to find a solution with no success. Does anyone know how to help?
Thanks!
Last edited by JazzplayerL9 (2010-04-10 23:29:54)
Offline
insw's actual definition is in sys/io.h, and looks like this:
static __inline void
insw (unsigned short int __port, void *addr, unsigned long int __count)
{
__asm__ __volatile__ ("cld ; rep ; insw":"=D" (addr), "=c" (__count)
:"d" (__port), "0" (addr), "1" (__count));
}
This is designed to be inlined in C or else it will break, but in C++, dropping the `static' from the definition and sticking it in some header file will work. Oh, and use `inline' instead of `__inline'.
EDIT: This is x86/x86_64-specific. It's more complicated on other architectures; have a look at the arch/<your arch> folder in the kernel source for other implementations.
Last edited by tavianator (2010-04-10 22:51:45)
Offline
Thanks for the help, that worked just fine. Got the program to build, but running it gives me more errors I'll have to figure out.
Offline