mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Project restructure (no new code added)
Moved all header files into include/ and removed their C counterparts -> code inside .h files Also added a kernel.ld linker file since we don't have many code files in src/ now, i removed src/kernel/ only real code change is that i moved memcopy() and memset() into string.h from system.h
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#ifndef SYSTEM_H
|
||||
#define SYSTEM_H
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
// Port functions
|
||||
uint8_t inb(uint16_t port) {
|
||||
uint8_t result;
|
||||
asm volatile("inb %1, %0" : "=a"(result) : "Nd"(port));
|
||||
return result;
|
||||
}
|
||||
|
||||
void outb(uint16_t port, uint8_t data) {
|
||||
asm volatile("outb %0, %1" :: "a"(data), "Nd"(port));
|
||||
}
|
||||
|
||||
uint16_t inw(uint16_t port) {
|
||||
uint16_t result;
|
||||
asm volatile("inw %1, %0" : "=a"(result) : "Nd"(port));
|
||||
return result;
|
||||
}
|
||||
|
||||
void outw(uint16_t port, uint16_t data) {
|
||||
asm volatile("outw %0, %1" :: "a"(data), "Nd"(port));
|
||||
}
|
||||
|
||||
|
||||
// Assembly stuff
|
||||
void cli() {
|
||||
asm volatile("cli");
|
||||
}
|
||||
|
||||
void sti() {
|
||||
asm volatile("sti");
|
||||
}
|
||||
|
||||
void hlt() {
|
||||
asm volatile("hlt");
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user