-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.c
34 lines (29 loc) · 813 Bytes
/
common.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* common.c - Global functions
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-
* ShareAlike 3.0 Unported License. To view a copy of this license, visit
* http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to:
* Creative Commons
* 444 Castro Street, Suite 900
* Mountain View, California, 94041, USA.
*
* Author(s): Drew Cross <drew@ddcross.com>
*/
#include "common.h"
//Writes a byte out to the specified port
void outb(u16int port, u8int value)
{
asm volatile ("outb %1, %0" : : "dN" (port), "a" (value));
}
u8int inb(u16int port)
{
u8int ret;
asm volatile("inb %1, %0" : "=a" (ret) : "dN" (port));
return ret;
}
u16int inw(u16int port)
{
u16int ret;
asm volatile ("inw %1, %0" : "=a" (ret) : "dN" (port));
return ret;
}