public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* assembler -> linux system calls
@ 2001-08-23 20:56 Bart Vandewoestyne
  2001-08-23 21:10 ` Richard B. Johnson
  2001-08-23 23:36 ` Alan Cox
  0 siblings, 2 replies; 4+ messages in thread
From: Bart Vandewoestyne @ 2001-08-23 20:56 UTC (permalink / raw)
  To: linux-kernel

I am trying to write a linux device driver for a data acquisition
card.  The little homepage for my project is at
http://mc303.ulyssis.org/heim/
There is already a DOS driver available, and I am trying to port the
DOS code right now.

Somewhere in the DOS code, there is some assembler code included:

.RADIX 16
.MODEL SMALL

.486


.CODE

      PUBLIC _inpl

_inpl PROC FAR

      push   bp
      mov    bp,sp

      mov    dx, Word Ptr [bp+6]
      in     EAX,dx

;     bswap  EAX

      push   EAX
      pop    ax
      pop    dx

      mov    sp,bp
      pop    bp
      ret
_inpl ENDP


      PUBLIC _inplI

_inplI PROC FAR

      push   bp
      mov    bp,sp

      mov    dx, Word Ptr [bp+6]
      in     EAX,dx

      push   EAX
      pop    ax
      pop    dx

      mov    sp,bp
      pop    bp
      ret
_inplI ENDP



      PUBLIC _swem

_swem PROC FAR

      push   bp
      mov    bp,sp

      mov    EAX, DWord Ptr [bp+6]

      bswap  EAX

      push   EAX
      pop    ax
      pop    dx

      mov    sp,bp
      pop    bp
      ret
_swem ENDP


      PUBLIC _outpl

_outpl PROC FAR

      push   bp
      mov    bp,sp

      mov    dx, Word Ptr [bp+0ah]
      mov    ax, Word Ptr [bp+8]
      push   ax
      push   dx
      pop    EAX
      mov    dx, Word Ptr [bp+6]
      out    dx,EAX

      mov    sp,bp
      pop    bp
      ret
_outpl ENDP


      PUBLIC _outplI

_outplI PROC FAR

      push   bp
      mov    bp,sp

      mov    dx, Word Ptr [bp+8]
      mov    ax, Word Ptr [bp+0ah]
      push   ax
      push   dx
      pop    EAX
      mov    dx, Word Ptr [bp+6]
      out    dx,EAX

      mov    sp,bp
      pop    bp
      ret
_outplI ENDP

      END


I would like to know by what linux native system calls I can replace
the commands inpl, inplI, outpl, outplI, swem.  I guess the following
mapping should do it:

DOS assembler	-> 	Linux

inpl			inpl
inplI			???
outpl			outpl
outplI			???
swem			???


Could somebody tell me what function to use where the question marks
are written?  Are the other mappings from inpl and outpl also correct?

Thanks for helping me out,
mc303

PS: The DOS code is also at http://mc303.ulyssis.org/heim

-- 
Ing. Bart Vandewoestyne			 Bart.Vandewoestyne@pandora.be
Hugo Verrieststraat 48			       GSM: +32 (0)478 397 697
B-8550 Zwevegem			 http://users.pandora.be/vandewoestyne
----------------------------------------------------------------------
"Any fool can know, the point is to understand." - Albert Einstein

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: assembler -> linux system calls
  2001-08-23 20:56 assembler -> linux system calls Bart Vandewoestyne
@ 2001-08-23 21:10 ` Richard B. Johnson
  2001-08-23 21:30   ` Bart Vandewoestyne
  2001-08-23 23:36 ` Alan Cox
  1 sibling, 1 reply; 4+ messages in thread
From: Richard B. Johnson @ 2001-08-23 21:10 UTC (permalink / raw)
  To: Bart Vandewoestyne; +Cc: linux-kernel

On Thu, 23 Aug 2001, Bart Vandewoestyne wrote:

> I am trying to write a linux device driver for a data acquisition
> card.  The little homepage for my project is at
> http://mc303.ulyssis.org/heim/
> There is already a DOS driver available, and I am trying to port the
> DOS code right now.
> 
> Somewhere in the DOS code, there is some assembler code included:
[SNIPPED...]

File:
/usr/include/asm/io.h
...contains most of the I/O macros you need.

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

    I was going to compile a list of innovations that could be
    attributed to Microsoft. Once I realized that Ctrl-Alt-Del
    was handled in the BIOS, I found that there aren't any.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: assembler -> linux system calls
  2001-08-23 21:10 ` Richard B. Johnson
@ 2001-08-23 21:30   ` Bart Vandewoestyne
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Vandewoestyne @ 2001-08-23 21:30 UTC (permalink / raw)
  To: root; +Cc: linux-kernel

"Richard B. Johnson" wrote:
> 
> On Thu, 23 Aug 2001, Bart Vandewoestyne wrote:
> 
> > I am trying to write a linux device driver for a data acquisition
> > card.  The little homepage for my project is at
> > http://mc303.ulyssis.org/heim/
> > There is already a DOS driver available, and I am trying to port the
> > DOS code right now.
> >
> > Somewhere in the DOS code, there is some assembler code included:

-> assembler code at: http://mc303.ulyssis.org/heim/downloads/INPL.ASM

> File:
> /usr/include/asm/io.h
> ...contains most of the I/O macros you need.

Hmm... I looked through that file, and it only talks about inl and
outl functions.  I guess the 'inpl' from the assembler code can be
mapped to 'inl' from /usr/include/asm/io.h and the same for 'outpl',
but what about 'inplI' and 'outplI' from the assembler code?  My
assembler skills ar zero, so I don't know if i can also just replace
those by 'inl' and 'outl' from the linux source...

Greetzzz,
mc303

-- 
Ing. Bart Vandewoestyne			 Bart.Vandewoestyne@pandora.be
Hugo Verrieststraat 48			       GSM: +32 (0)478 397 697
B-8550 Zwevegem			 http://users.pandora.be/vandewoestyne
----------------------------------------------------------------------
"Any fool can know, the point is to understand." - Albert Einstein

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: assembler -> linux system calls
  2001-08-23 20:56 assembler -> linux system calls Bart Vandewoestyne
  2001-08-23 21:10 ` Richard B. Johnson
@ 2001-08-23 23:36 ` Alan Cox
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Cox @ 2001-08-23 23:36 UTC (permalink / raw)
  To: Bart Vandewoestyne; +Cc: linux-kernel

> Could somebody tell me what function to use where the question marks
> are written?  Are the other mappings from inpl and outpl also correct?

The look like the inb/inw/outb/outw functions. Im not sure how DOS asm
maps byte and word sized in and out

swmem is a byte swap. There isnt a trivial equivalent because its almost
never the case you want to byteswap but you want to convert endiannesses
htons() will probably do the right thing while you figure it out

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-08-23 23:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-23 20:56 assembler -> linux system calls Bart Vandewoestyne
2001-08-23 21:10 ` Richard B. Johnson
2001-08-23 21:30   ` Bart Vandewoestyne
2001-08-23 23:36 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox