feat: add fadt based lapic timer calibration
This commit is contained in:
parent
54d48e7d91
commit
61dfda6a70
7 changed files with 257 additions and 28 deletions
33
kernel/include/util/port_io.h
Normal file
33
kernel/include/util/port_io.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
|
||||
#include "util/number.h"
|
||||
|
||||
inline uint8_t port_read_8(uint16_t port) {
|
||||
uint8_t value = 0;
|
||||
__asm__ volatile("inb %1, %0" : "=a"(value) : "Nd"(port));
|
||||
return value;
|
||||
}
|
||||
|
||||
inline uint16_t port_read_16(uint16_t port) {
|
||||
uint16_t value = 0;
|
||||
__asm__ volatile("inw %1, %0" : "=a"(value) : "Nd"(port));
|
||||
return value;
|
||||
}
|
||||
|
||||
inline uint32_t port_read_32(uint16_t port) {
|
||||
uint32_t value = 0;
|
||||
__asm__ volatile("inl %1, %0" : "=a"(value) : "Nd"(port));
|
||||
return value;
|
||||
}
|
||||
|
||||
inline void port_write_8(uint16_t port, uint8_t value) {
|
||||
__asm__ volatile("outb %0, %1" : : "a"(value), "Nd"(port));
|
||||
}
|
||||
|
||||
inline void port_write_16(uint16_t port, uint16_t value) {
|
||||
__asm__ volatile("outw %0, %1" : : "a"(value), "Nd"(port));
|
||||
}
|
||||
|
||||
inline void port_write_32(uint16_t port, uint32_t value) {
|
||||
__asm__ volatile("outl %0, %1" : : "a"(value), "Nd"(port));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue