// // Created by rick on 23-08-21. // #include void *lapic = NULL; void lapic_set_addr(uint32_t addr) { lapic = (void *) addr; } void lapic_write(uint32_t offset, uint32_t value) { *(volatile uint32_t *) ((uintptr_t) lapic + offset) = value; } uint32_t lapic_read(uint32_t offset) { if (lapic == NULL) { return UINT32_MAX; } return *(volatile uint32_t *) ((uintptr_t) lapic + offset); } uint32_t lapic_get_id() { return lapic_read(LAPIC_REG_ID); } uint32_t lapic_get_version() { return lapic_read(LAPIC_REG_VERSION); }