summaryrefslogtreecommitdiff
path: root/src/kernel/util.h
diff options
context:
space:
mode:
authorBenji Dial <Benji3.141@gmail.com>2020-08-11 11:33:21 -0400
committerBenji Dial <Benji3.141@gmail.com>2020-08-11 11:33:21 -0400
commit63167f223e1f54910f6b80e698390ee60aec79ee (patch)
tree41844f646bdcb5c9ba241bb5867c5e4f51737d52 /src/kernel/util.h
parent77d7a284c02bc6b1b3a3a92ad5d957172cee9b81 (diff)
downloadportland-os-63167f223e1f54910f6b80e698390ee60aec79ee.tar.gz
lots of progress
currently, BAR fields of IDE drives are all returning zero, and the ATA read function isn't working. i'm not sure why. i'm going to work on VESA next, and come back to the IDE driver later
Diffstat (limited to 'src/kernel/util.h')
-rw-r--r--src/kernel/util.h61
1 files changed, 51 insertions, 10 deletions
diff --git a/src/kernel/util.h b/src/kernel/util.h
index e02c819..243541c 100644
--- a/src/kernel/util.h
+++ b/src/kernel/util.h
@@ -1,13 +1,54 @@
+#ifndef UTIL_H
+#define UTIL_H
+
#include <stdint.h>
+#include "drive.h"
+
+static inline void outb(uint16_t port, uint8_t value) {
+ asm (
+ "outb %0, %1"
+ : : "a"(value), "Nd"(port));
+}
+static inline uint8_t inb(uint16_t port) {
+ uint8_t value;
+ asm volatile (
+ "inb %1, %0"
+ : "=a"(value) : "Nd"(port));
+ return value;
+}
+static inline void outw(uint16_t port, uint16_t value) {
+ asm (
+ "outw %0, %1"
+ : : "a"(value), "Nd"(port));
+}
+static inline uint16_t inw(uint16_t port) {
+ uint16_t value;
+ asm volatile (
+ "inw %1, %0"
+ : "=a"(value) : "Nd"(port));
+ return value;
+}
+static inline void outd(uint16_t port, uint32_t value) {
+ asm (
+ "outl %0, %1"
+ : : "a"(value), "Nd"(port));
+}
+static inline uint32_t ind(uint16_t port) {
+ uint32_t value;
+ asm volatile (
+ "inl %1, %0"
+ : "=a"(value) : "Nd"(port));
+ return value;
+}
void memcpy(void *to, void *from, uint32_t n);
-void outb(uint16_t port, uint8_t value);
-uint8_t inb(uint16_t port);
-void outw(uint16_t port, uint16_t value);
-uint16_t inw(uint16_t port);
-void u32_dec(uint32_t n, uint8_t *b);
-void u16_dec(uint16_t n, uint8_t *b);
-void u8_dec(uint8_t n, uint8_t *b);
-void u32_hex(uint32_t n, uint8_t *b);
-void u16_hex(uint16_t n, uint8_t *b);
-void u8_hex(uint8_t n, uint8_t *b); \ No newline at end of file
+void fmcpy(void *to, struct drive *d, drive_file_id_t f, uint32_t from, uint32_t n);
+
+void u32_dec(uint32_t n, char *b);
+void u16_dec(uint16_t n, char *b);
+void u8_dec(uint8_t n, char *b);
+void u32_hex(uint32_t n, char *b);
+void u16_hex(uint16_t n, char *b);
+void u8_hex(uint8_t n, char *b);
+
+#endif \ No newline at end of file