Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Commit

Permalink
MMU cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
klange committed May 24, 2021
1 parent 819606f commit cc5ab34
Show file tree
Hide file tree
Showing 5 changed files with 374 additions and 208 deletions.
4 changes: 2 additions & 2 deletions apps/compositor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ static void redraw_windows(yutani_globals_t * yg) {

if ((!yg->bottom_z || yg->bottom_z->anim_mode) && renderer_blit_screen) {
/* TODO: Need to clear with Cairo backend */
draw_fill(yg->backend_ctx, rgb(110,110,110));
draw_fill(yg->backend_ctx, rgb(5,5,5));
}

if (renderer_set_clip) renderer_set_clip(yg);
Expand Down Expand Up @@ -2103,7 +2103,7 @@ int main(int argc, char * argv[]) {
yg->width = yg->backend_ctx->width;
yg->height = yg->backend_ctx->height;

draw_fill(yg->backend_ctx, rgb(110,110,110));
draw_fill(yg->backend_ctx, rgb(5,5,5));
flip(yg->backend_ctx);

yg->backend_framebuffer = yg->backend_ctx->backbuffer;
Expand Down
3 changes: 2 additions & 1 deletion base/usr/include/kernel/arch/x86_64/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define MMU_FLAG_WRITETHROUGH 0x08
#define MMU_FLAG_SPEC 0x10
#define MMU_FLAG_WC (MMU_FLAG_NOCACHE | MMU_FLAG_WRITETHROUGH | MMU_FLAG_SPEC)
#define MMU_FLAG_NOEXECUTE 0x20

#define MMU_GET_MAKE 0x01

Expand All @@ -29,8 +30,8 @@ void mmu_invalidate(uintptr_t addr);
uintptr_t mmu_allocate_a_frame(void);
uintptr_t mmu_allocate_n_frames(int n);
union PML * mmu_get_kernel_directory(void);
void mmu_set_kernel_heap(uintptr_t heap_start);
void * mmu_map_from_physical(uintptr_t frameaddress);
void * mmu_map_mmio_region(uintptr_t physical_address, size_t size);

size_t mmu_count_user(union PML * from);
size_t mmu_count_shm(union PML * from);
Expand Down
6 changes: 2 additions & 4 deletions kernel/arch/x86_64/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void ap_main(void) {
switch_next();
}

uintptr_t lapic_final = 0xffffff1fd0000000;
uintptr_t lapic_final = 0;
void lapic_send_ipi(int i, uint32_t val) {
*((volatile uint32_t*)(lapic_final + 0x310)) = (i << 24);
asm volatile ("":::"memory");
Expand Down Expand Up @@ -177,9 +177,7 @@ void acpi_initialize(void) {
if (!lapic_base || cores <= 1) return;

/* Allocate a virtual address with which we can poke the lapic */
union PML * p = mmu_get_page(lapic_final, MMU_GET_MAKE);
mmu_frame_map_address(p, MMU_FLAG_KERNEL | MMU_FLAG_WRITABLE | MMU_FLAG_NOCACHE | MMU_FLAG_WRITETHROUGH, lapic_base);
mmu_invalidate(lapic_final);
lapic_final = (uintptr_t)mmu_map_mmio_region(lapic_base, 0x1000);

/* Map the bootstrap code */
memcpy(mmu_map_from_physical(0x1000), &_ap_bootstrap_start, (uintptr_t)&_ap_bootstrap_end - (uintptr_t)&_ap_bootstrap_start);
Expand Down
Loading

0 comments on commit cc5ab34

Please sign in to comment.