add: inb, outb
This commit is contained in:
parent
907eb7cf7d
commit
0ad16863ba
4
headers/sys/io.h
Normal file
4
headers/sys/io.h
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
inline uint8_t inb(uint16_t port);
|
||||
inline void outb(uint16_t port, uint8_t val);
|
10
src/sys/io/inb.c
Normal file
10
src/sys/io/inb.c
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
inline uint8_t inb(uint16_t port)
|
||||
{
|
||||
uint8_t ret;
|
||||
__asm__ volatile ( "inb %w1, %b0"
|
||||
: "=a"(ret)
|
||||
: "Nd"(port)
|
||||
: "memory");
|
||||
return ret;
|
||||
}
|
4
src/sys/io/outb.c
Normal file
4
src/sys/io/outb.c
Normal file
@ -0,0 +1,4 @@
|
||||
inline void outb(uint16_t port, uint8_t val)
|
||||
{
|
||||
__asm__ volatile ( "outb %b0, %w1" : : "a"(val), "Nd"(port) : "memory");
|
||||
}
|
Loading…
Reference in New Issue
Block a user