summaryrefslogtreecommitdiff
path: root/kernel/x86.h
blob: 9d1ba93ea5b828372a06289e3971ee91fc8bb815 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef FOOLOS_X86_H
#define FOOLOS_X86_H

#include "lib/int/stdint.h"

// todo: cli/sti??
// http://wiki.osdev.org/Interrupt_Service_Routines
// Black Magic: Strongly Discouraged!
#define X86_IRQ_BEGIN asm("\ncli\npusha");
#define X86_IRQ_END   asm("mov $0x20, %al\nout %al, $0x20\nmov $0x20, %al\noutb %al,$0xa0\npopa\nleave\nsti\niret");

void sleep(int i); // TODO : Real sleep!

void x86_outb(int port, uint8_t data);
uint8_t x86_inb(int port);
void x86_outw(int port, uint16_t data);
uint16_t x86_inw(int port);
void x86_outl(int port, uint32_t data);
uint32_t x86_inl(int port);
void x86_set_pdbr(uint32_t addr);
void x86_paging_enable();
void x86_flush_tlb(uint32_t addr);
void x86_int_enable();
uint32_t x86_get_cr0();
uint32_t x86_get_cr1();
uint32_t x86_get_cr2();
uint32_t x86_get_cr3();
uint32_t x86_get_cr4();
uint8_t x86_xchg(uint8_t *addr, uint8_t val);

#endif