Added assembly for reading/writing to IO locations.
This commit is contained in:
parent
e0c0d8cfa3
commit
c98464d1c7
16
kernel/arch/i386/io.nim
Normal file
16
kernel/arch/i386/io.nim
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
type
|
||||||
|
IOPacket* = tuple
|
||||||
|
port: uint16
|
||||||
|
value: uint8
|
||||||
|
|
||||||
|
{.push stackTrace:off.}
|
||||||
|
proc outb*(data: IOPacket) =
|
||||||
|
asm """
|
||||||
|
outb `data.value` `data.port`
|
||||||
|
"""
|
||||||
|
|
||||||
|
proc inb*(port: uint16): uint =
|
||||||
|
asm """
|
||||||
|
inb `port` `result`
|
||||||
|
"""
|
||||||
|
{.pop.}
|
Loading…
Reference in New Issue
Block a user