direct i/o using wine

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
alessandro_maffei
Newbie
Newbie
Posts: 3
Joined: Fri Feb 20, 2009 3:44 pm

direct i/o using wine

Post by alessandro_maffei »

I built a projet that use direct i/o access to $100-$1F0 and $300-$307 i/o address.
I use delphi 6 with a driver to enable direct i/o access in winNT,XP etc.
and all is ok.
Now I'd like to run my project in linux (I choose ubuntu 8.10) but all i/o access are refuse.
Do you know if wine permit the direct use of i/o?
What is the correct methode?
(recompiling wine or the kernel, using a different i/o driver or other...)
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: direct i/o using wine

Post by vitamin »

alessandro_maffei wrote:I built a projet that use direct i/o access to $100-$1F0 and $300-$307 i/o address.
I use delphi 6 with a driver to enable direct i/o access in winNT,XP etc.
and all is ok.
Wine does not support this type of drivers. They can not and will not work on Wine.
You can not access hardware ports on Linux from user space unless you running this program as root. Or used some other mechanism to allow yourself to access ports.

Even if you running program as root, you still have to use ioperm() to enable port access. For more details see for example this HOWTO: http://tldp.org/HOWTO/IO-Port-Programming.html
alessandro_maffei
Newbie
Newbie
Posts: 3
Joined: Fri Feb 20, 2009 3:44 pm

Re: direct i/o using wine

Post by alessandro_maffei »

Even if you running program as root, you still have to use ioperm() to enable port access. For more details see for example this HOWTO: http://tldp.org/HOWTO/IO-Port-Programming.html

it seems that the HOWTO explain how to compiler an application in linux native but I've already an application in binary (exe).
I've see that are more version of wine that the windows API used to enable i/o permission in winXP is corretly implemented (win32).
WinXP Driver dialogs with this API to enable i/o.
Can I implement directly in my application the permission to use i/o so I can use it in winXP and linux (as root)?

The program to run as root is the application or wine?
es: gksu wine myapplication can work?
oiaohm
Level 8
Level 8
Posts: 1020
Joined: Fri Feb 29, 2008 2:54 am

Post by oiaohm »

Running wine as root is highly not recommended some bad things have happened in the past.

Linux kernel is controlling hardware access alessandro_maffei. All hardware access operations would have to be done Linux way or at a speed cost. Like qemu or v86 emulation were the address you were using are virtual.

The kind of operation you are asking for is not simple to be made work. http://tldp.org/HOWTO/IO-Port-Programming-2.html#ss2.2 Note the warning there about using device port system can be completely exploited by any program giving that ablity. This also applies to Windows raw IO support. Due to using raw hardware access any program doing that can in theory take out the OS.

You really need to seriously consider splitting your program in two. Service or a Driver as root and interface as usermode.

Things are forbin from normal users for very good reasons under Linux. You have to consider the security side of what you are doing alessandro_maffei. No point having you program working on Windows and Linux if it equals running insecure.
alessandro_maffei
Newbie
Newbie
Posts: 3
Joined: Fri Feb 20, 2009 3:44 pm

Post by alessandro_maffei »

oiaohm wrote: You really need to seriously consider splitting your program in two. Service or a Driver as root and interface as usermode.
OK, I must change every i/o access of my application to a localhost:xxxx service,
implement the same service at the same port in WinXP and in linux (service with i/o permission), run the service and then run my applicaton.
it's right?
oiaohm wrote: The kind of operation you are asking for is not simple to be made work. http://tldp.org/HOWTO/IO-Port-Programming-2.html#ss2.2 Note the warning there about using device port system can be completely exploited by any program giving that ablity. This also applies to Windows raw IO support. Due to using raw hardware access any program doing that can in theory take out the OS.
using an i/o server native in linux I can use the normal method to implement direct i/o access
oiaohm wrote: Things are forbin from normal users for very good reasons under Linux. You have to consider the security side of what you are doing alessandro_maffei. No point having you program working on Windows and Linux if it equals running insecure.
OK, true!
Best regards, your post is very usefull
oiaohm
Level 8
Level 8
Posts: 1020
Joined: Fri Feb 29, 2008 2:54 am

Post by oiaohm »

Even with localhost secuirty of what you are doing has to be considered.

You don't want two users messing it up lot of care has to be taken. Yes same service interface on both platforms does cure some of the problem. Part of the problem is also the secuirty problems.

Fix both by by problems. Service running as a higher user. Under Linux there are quite a few different ways of doing it.
Locked