diff --git a/libc/calls/munmap-metal.c b/libc/calls/munmap-metal.c index d1a1afc8a..ee9715264 100644 --- a/libc/calls/munmap-metal.c +++ b/libc/calls/munmap-metal.c @@ -26,8 +26,8 @@ noasan int sys_munmap_metal(void *addr, size_t size) { mm = (struct mman *)(BANE + 0x0500); for (i = 0; i < size; i += 4096) { e = __get_virtual(mm, __get_pml4t(), (uint64_t)addr + i, false); - if (e) *e = ~PAGE_V; - invlpg(e); + if (e) *e = ~(PAGE_V | PAGE_RSRV); + invlpg((uint64_t)addr + i); } return 0; } diff --git a/libc/runtime/mman.internal.h b/libc/runtime/mman.internal.h index 2488a4ac2..64c0fcb95 100644 --- a/libc/runtime/mman.internal.h +++ b/libc/runtime/mman.internal.h @@ -40,7 +40,7 @@ struct mman { COSMOPOLITAN_C_END_ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ -/* Values for mman::pc_video_type. TODO: implement graphics modes. */ +/* Values for mman::pc_video_type. */ #define PC_VIDEO_TEXT 0 #define PC_VIDEO_BGR565 1 #define PC_VIDEO_BGR555 2 diff --git a/libc/runtime/pc.internal.h b/libc/runtime/pc.internal.h index 9ef963f11..24c552c3a 100644 --- a/libc/runtime/pc.internal.h +++ b/libc/runtime/pc.internal.h @@ -145,15 +145,15 @@ │ (If this maps 2MB/1GB page and CR4.PGE) Global┐││││││││ │ (If IsPage 2MB/1GB, see Intel V3A § 11.12) PAT │││││││││ │ │ │││││││││ - │ ┌────────────────────────────────────┤ │││││││││ - │ Must Be 0┐│ Next Page Table Address (!IsPage) │ │││││││││ - │ │├────────────────────────────────────┤ │││││││││ - │ ││ Physical Address 4KB │ │││││││││ - │┌───┐┌─────┐│├───────────────────────────┐ │ign│││││││││ - ││PKE││ ign │││ Physical Address 2MB │ │┌┴┐│││││││││ - ││ ││ ││├──────────────────┐ │ ││ ││││││││││ - ││ ││ │││ Phys. Addr. 1GB │ │ ││ ││││││││││ - ││ ││ │││ │ │ ││ ││││││││││ + │ ┌─────────────────────────────────────┤ │││││││││ + │ Must Be 0┐│ Next Page Table Address (!IsPage) │ │││││││││ + │ │├─────────────────────────────────────┤ │││││││││ + │ ││ Physical Address 4KB │ │││││││││ + │┌──┐┌─────┐│├────────────────────────────┐ │ign│││││││││ + ││PK││ ign │││ Physical Address 2MB │ │┌┴┐│││││││││ + ││ ││ ││├───────────────────┐ │ ││ ││││││││││ + ││ ││ │││ Phys. Addr. 1GB │ │ ││ ││││││││││ + ││ ││ │││ │ │ ││ ││││││││││ 6666555555555544444444443333333333222222222211111111110000000000 3210987654321098765432109876543210987654321098765432109876543210*/ #define PAGE_V /* */ 0b000000000001 @@ -163,7 +163,7 @@ #define PAGE_2MB /* */ 0b000110000000 #define PAGE_1GB /* */ 0b000110000000 #define PAGE_IGN1 /* */ 0b111000000000 -#define PAGE_RSRV /* blinkenlights reservation */ 0b001000000000 +#define PAGE_RSRV /* blinkenlights/libc reservation */ 0b001000000000 #define PAGE_GROD /* blinkenlights MAP_GROWSDOWN */ 0b010000000000 #define PAGE_TA 0x00007ffffffff000 #define PAGE_PA2 0x00007fffffe00000 diff --git a/libc/vga/rlinit-vesa.S b/libc/vga/rlinit-vesa.S index fac5ad39b..be53ff6c4 100644 --- a/libc/vga/rlinit-vesa.S +++ b/libc/vga/rlinit-vesa.S @@ -582,7 +582,6 @@ _rlinit_vesa: mov $'\n',%al jmp .putc .endfn .putnl - .previous str.inform: #define SHGLYPH "\x7f" @@ -629,3 +628,5 @@ str.mode_list_start: .byte PC_VIDEO_RGBX8888,32, 8, 0, 8, 8, 8,16 .byte PC_VIDEO_BGRX8888,32, 8,16, 8, 8, 8, 0 .type_list_end: + + .previous