Add harware reading and writing functions
This commit is contained in:
parent
94c1eb2279
commit
904cb38128
|
@ -1,5 +1,10 @@
|
||||||
|
#pragma once
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
/* A temporary file, to get the system compiling. */
|
/* A temporary file, to get the system compiling. */
|
||||||
|
|
||||||
size_t strlen(const char*);
|
size_t strlen(const char*);
|
||||||
|
|
||||||
|
unsigned char inb(unsigned short);
|
||||||
|
|
||||||
|
void outb(unsigned short, unsigned char);
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
size_t strlen(const char* string) {
|
size_t strlen(const char* string) {
|
||||||
|
@ -6,3 +7,13 @@ size_t strlen(const char* string) {
|
||||||
size++;
|
size++;
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned char inb(unsigned short port) {
|
||||||
|
unsigned char ptr;
|
||||||
|
asm volatile("inb %1, %0" : "=a" (ptr) : "dN" (port));
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void outb(unsigned short port, unsigned char data) {
|
||||||
|
asm volatile("outb %1, %0" : : "dN" (port), "a" (data));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user