forked from PoliEcho-holding-org/kern
Slighly changed everything :)
- Makefile changes - Linker script updates - Made it comply with C17 - Removed entry.asm (finally)
This commit is contained in:
@@ -9,8 +9,6 @@
|
||||
#define WRITE_COMMAND 0x30
|
||||
#define CACHE_FLUSH 0xE7
|
||||
|
||||
extern uint8_t driveNum;
|
||||
|
||||
void diskRead(uint32_t lbaAddress, uint8_t sectorCount, char* dst) {
|
||||
outb(PIO_PORT + 6, ((lbaAddress >> 24) & 0x0f) | 0xe0); // 6 - Use LBA; 4 - Drive number; 3-0 - Highest lba address nibble
|
||||
outb(PIO_PORT + 2, sectorCount); // Sector count register
|
||||
|
||||
+5
-5
@@ -6,27 +6,27 @@
|
||||
// Port functions
|
||||
uint8_t inb(uint16_t port) {
|
||||
uint8_t result;
|
||||
asm volatile("inb %1, %0" : "=a"(result) : "Nd"(port));
|
||||
__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));
|
||||
__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));
|
||||
__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));
|
||||
__asm__ volatile("outw %0, %1" :: "a"(data), "Nd"(port));
|
||||
}
|
||||
|
||||
void ioWait() {
|
||||
// Waits ~1 I/O Cycle (Linux uses this so it should be good)
|
||||
asm volatile("outb %%al, $0x80" : : "a"(0));
|
||||
__asm__ volatile("outb %%al, $0x80" : : "a"(0));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user