Skip to content

Commit 4f6bd7e

Browse files
committed
setup, vga: map VGA memory area
This is needed to get rid of "Low memory" mappings. Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
1 parent 015fb7a commit 4f6bd7e

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

common/setup.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include <drivers/pic.h>
5353
#include <drivers/pit.h>
5454
#include <drivers/serial.h>
55+
#include <drivers/vga.h>
5556

5657
bool opt_debug = false;
5758
bool_cmd("debug", opt_debug);
@@ -234,6 +235,7 @@ void __noreturn __text_init kernel_start(uint32_t multiboot_magic,
234235

235236
map_multiboot_areas();
236237
map_bios_area();
238+
map_vga_area();
237239

238240
write_cr3(cr3.paddr);
239241
WRITE_SP(get_free_pages_top(PAGE_ORDER_2M, GFP_KERNEL));

drivers/vga.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,11 @@ void vga_write(const char *buf, size_t len, vga_color_t color) {
7979
scroll_screen = screen;
8080
write_vga_buffer(screen);
8181
}
82+
83+
void map_vga_area(void) {
84+
for (mfn_t vga_mfn = paddr_to_mfn(VGA_START_ADDR);
85+
vga_mfn < paddr_to_mfn(VGA_END_ADDR); vga_mfn++) {
86+
vmap_4k(mfn_to_virt(vga_mfn), vga_mfn, L1_PROT);
87+
kmap_4k(vga_mfn, L1_PROT);
88+
}
89+
}

include/drivers/vga.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,6 @@ extern void vga_scroll_up(void);
5959
extern void vga_scroll_down(void);
6060

6161
extern void vga_write(const char *buf, size_t len, vga_color_t color);
62+
63+
extern void map_vga_area(void);
6264
#endif /* KTF_DRV_VGA_H */

0 commit comments

Comments
 (0)