flat assembler
Message board for the users of flat assembler.

Index > Windows > in and out

Author
Thread Post new topic Reply to topic
Judgemaster



Joined: 09 Mar 2004
Posts: 1
Judgemaster 09 Mar 2004, 02:44
I was just wandering if it is possible to use the asm commands 'in' and 'out' while programming for windows. I wanted to know if I can use them as a direct way to monitor keyboard input, but so far using either of them crashes my program.
Post 09 Mar 2004, 02:44
View user's profile Send private message Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 09 Mar 2004, 12:44
Best to use them only in ring0 for win nt and winxp.
Post 09 Mar 2004, 12:44
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 09 Mar 2004, 19:17
roticv is right.

Generally, every ring3 task has bit array that defines which ports it can access and which not. But i don't know how to get this list under windoze, but i think all ports are disallowed.
Post 09 Mar 2004, 19:17
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 977
Location: Czechoslovakia
MazeGen 09 Mar 2004, 20:30
I/O instructions, like STI and CLI instructions, are "trusted", what means you can use them only if CPL<=IOPL. In fact, this condition is not true on most win systems, surely not on higher than 9x.
As vid said, there is additionally the bit array that defines which ports are not illegal when not CPL<=IOPL. Unfortunatelly, that array is located in TSS (task state segment) and is not accesible in ring3 at all.

_________________
x86asm.net
Post 09 Mar 2004, 20:30
View user's profile Send private message Visit poster's website Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 215
Location: Budapest, Hungary
Endre 12 Mar 2004, 11:37
If you use cygwin (a unix environment for win32) you may have to take a look at the link below, since they have developed a driver (named ioperm.sys) for supporting the well known ioperm() and iopl() functions, which you can change the privilege levels with.

http://openwince.sourceforge.net/ioperm/

Üdv.
Endre
Post 12 Mar 2004, 11:37
View user's profile Send private message Reply with quote
VitalOne



Joined: 29 Jul 2003
Posts: 54
Location: USA
VitalOne 12 Mar 2004, 23:29
Isn't it possible making a VXD file?
Post 12 Mar 2004, 23:29
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 13 Mar 2004, 02:15
vxd works only on 9x, while .sys works on nt..
Post 13 Mar 2004, 02:15
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 215
Location: Budapest, Hungary
Endre 13 Mar 2004, 10:17
As I see you have the following opportunities:

1. Use of microsoft DDK (I guess this is the best if you want own DMA operations too)
2. Use of any hack-driver (like the mentioned ioperm.sys for cygwin). In this case you may still have to care about your virual address problem, since you can't see physical address from user-space, however devices need it for instance for DMA as well as for memory mapped IO (MMIO).
3. Change to any of the open-source unix systems. There you can use ioperm and iopl (they are sytem calls consequently interrupts) as root. Although the virtual/physical address problem is still standing, so you will be compelled to hack your kernel (for linux it is not so complicated.)
4. Use of DOS with any 32bit extender or you can write a little code to switch to 32bit flat-mode.

Did I give a miss something?

Üdv.
Endre
Post 13 Mar 2004, 10:17
View user's profile Send private message Reply with quote
HarryTuttle



Joined: 26 Sep 2003
Posts: 211
Location: Poland
HarryTuttle 16 Mar 2004, 13:53
u forgot something Wink but generaly O.K.
WinIo

_________________
Microsoft: brings power of yesterday to computers of today.
Post 16 Mar 2004, 13:53
View user's profile Send private message Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 215
Location: Budapest, Hungary
Endre 17 Mar 2004, 14:44
Thanks, it seems to solve each above mentioned problem.
Post 17 Mar 2004, 14:44
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.