10

I am reading some code of Linux. The keyboard.S has something like

outb %al,$0x61

and

inb $0x61,%al

I think the pending 'b' means 'byte', but i still cannot find what these instructions mean.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
onemach
  • 4,265
  • 6
  • 34
  • 52
  • 1
    Intel cores have an I/O bus, distinct from the memory bus. Port 0x61 is a keyboard control register. http://www.tek-tips.com/viewthread.cfm?qid=258828 – Hans Passant Dec 03 '11 at 05:52
  • 1
    Possible duplicate of [What are IN & OUT instructions in x86 used for?](http://stackoverflow.com/questions/3215878/what-are-in-out-instructions-in-x86-used-for) – Ciro Santilli OurBigBook.com Oct 30 '15 at 20:21

2 Answers2

19

OUT and IN are instructions for transferring data between I/O ports. Those are a couple of links I found which provide a bit more information.

As you mentioned, the b is the byte form of those instructions, which is appropriate since you're using the lower byte of ax (al).

nemo
  • 55,207
  • 13
  • 135
  • 135
AusCBloke
  • 18,014
  • 6
  • 40
  • 44
5

Yes, the out port and in port instructions can be encoded for 8 bits of data or 16 bits of data. The b indicates byte which is the 8 bit version.

old_timer
  • 69,149
  • 8
  • 89
  • 168