limine/common/sys/pic.c
Kacper Słomiński e1f6ac8860
Initial AArch64 port (#205)
* Initial aarch64 port

* Enable chainload on aarch64

No changes necessary since it's all UEFI anyway.

* Add specification for Limine protocol for aarch64

* PROTOCOL: Specify state of information in DT /chosen node

* common: Add spinup code for aarch64

* common: Port elf and term to aarch64

* common: Port vmm to aarch64

Also prepare to drop VMM_FLAG_PRESENT on x86.

* protos: Port limine boot protocol to aarch64

Also drop VMM_FLAG_PRESENT since we never unmap pages anyway.

* test: Add DTB request

* PROTOCOL: Port SMP request to aarch64

* cpu: Add cache maintenance functions for aarch64

* protos/limine, sys: Port SMP to aarch64

Also move common asm macros into a header file.

* test: Start up APs

* vmm: Unify get_next_level and implement large page splitting

* protos/limine: Map framebuffer using correct caching mode on AArch64

* CI: Fix GCC build for aarch64

* entry, menu: Replace uses of naked attribute with separate asm file

GCC does not understand the naked attribute on aarch64, and didn't
understand it for x86 in older versions.
2022-08-18 17:32:54 +02:00

49 lines
810 B
C

#if defined (__x86_64__) || defined (__i386__)
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/pic.h>
#include <sys/cpu.h>
#include <lib/blib.h>
void pic_eoi(int irq) {
if (irq >= 8) {
outb(0xa0, 0x20);
}
outb(0x20, 0x20);
}
// Flush all potentially pending IRQs
void pic_flush(void) {
for (int i = 0; i < 16; i++)
pic_eoi(i);
}
void pic_set_mask(int line, bool status) {
uint16_t port;
uint8_t value;
if (line < 8) {
port = 0x21;
} else {
port = 0xa1;
line -= 8;
}
if (!status)
value = inb(port) & ~((uint8_t)1 << line);
else
value = inb(port) | ((uint8_t)1 << line);
outb(port, value);
}
void pic_mask_all(void) {
outb(0xa1, 0xff);
outb(0x21, 0xff);
}
#endif