aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/include/sys.h
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-24 15:08:01 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-24 15:08:01 +0100
commit7e908dabaaf6c67ef5000406a0bb3a6a29beca01 (patch)
treeb0516cc4771ca3a8e202327d2864804afefe4cfc /src/kernel/include/sys.h
parent91c5969cdddf2241418082998e76bdbb836ed03e (diff)
downloadkogata-7e908dabaaf6c67ef5000406a0bb3a6a29beca01.tar.gz
kogata-7e908dabaaf6c67ef5000406a0bb3a6a29beca01.zip
Add PCI IDE driver (only PIO mode, no DMA yet.)
Diffstat (limited to 'src/kernel/include/sys.h')
-rw-r--r--src/kernel/include/sys.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/kernel/include/sys.h b/src/kernel/include/sys.h
index 365e709..944df96 100644
--- a/src/kernel/include/sys.h
+++ b/src/kernel/include/sys.h
@@ -15,6 +15,22 @@ static inline void outl(uint16_t port, uint32_t value) {
asm volatile("outl %1, %0" : : "dN"(port), "a"(value));
}
+static inline void outsb(uint16_t port, const void *addr, size_t cnt) {
+ // write cnt bytes to port
+ asm volatile ("rep outsb" : "+S" (addr), "+c" (cnt) : "d" (port));
+}
+
+static inline void outsw(uint16_t port, const void *addr, size_t cnt) {
+ // write cnt words to port
+ asm volatile ("rep outsw" : "+S" (addr), "+c" (cnt) : "d" (port));
+}
+
+static inline void outsl (uint16_t port, const void *addr, size_t cnt) {
+ // write cnt longwords to port
+ asm volatile ("rep outsl" : "+S" (addr), "+c" (cnt) : "d" (port));
+}
+
+
static inline uint8_t inb(uint16_t port) {
uint8_t ret;
asm volatile("inb %1, %0" : "=a"(ret) : "dN"(port));
@@ -33,6 +49,21 @@ static inline uint32_t inl(uint16_t port) {
return ret;
}
+static inline void insb(uint16_t port, void *addr, size_t cnt) {
+ // read cnt bytes from port and put them at addr
+ asm volatile ("rep insb" : "+D" (addr), "+c" (cnt) : "d" (port) : "memory");
+}
+
+static inline void insw(uint16_t port, void *addr, size_t cnt) {
+ // read cnt words from port and put them at addr
+ asm volatile ("rep insw" : "+D" (addr), "+c" (cnt) : "d" (port) : "memory");
+}
+
+static inline void insl(uint16_t port, void *addr, size_t cnt) {
+ // read cnt longwords from port and put them at addr
+ asm volatile ("rep insl" : "+D" (addr), "+c" (cnt) : "d" (port) : "memory");
+}
+
static inline void invlpg(void* addr) {
asm volatile("invlpg (%0)" : : "r"(addr) : "memory");
}