mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-09 03:10:27 +00:00
Bare metal VGA: allow for 64-bit video frame buffer address
This commit is contained in:
parent
388c4f6060
commit
0d594ecd85
3 changed files with 9 additions and 5 deletions
|
@ -26,8 +26,9 @@ struct mman {
|
||||||
or pixels (graphics) */
|
or pixels (graphics) */
|
||||||
unsigned short pc_video_height; /* 0x1d2e — height in chars. (text)
|
unsigned short pc_video_height; /* 0x1d2e — height in chars. (text)
|
||||||
or pixels (graphics) */
|
or pixels (graphics) */
|
||||||
uint32_t pc_video_framebuffer; /* 0x1d30 */
|
uint64_t pc_video_framebuffer; /* 0x1d30 — physical address of
|
||||||
uint32_t pc_video_framebuffer_size; /* 0x1d34 */
|
video frame buffer */
|
||||||
|
uint64_t pc_video_framebuffer_size; /* 0x1d38 */
|
||||||
};
|
};
|
||||||
|
|
||||||
COSMOPOLITAN_C_END_
|
COSMOPOLITAN_C_END_
|
||||||
|
|
|
@ -66,6 +66,9 @@
|
||||||
movw $25,mm+"struct mman::pc_video_height"
|
movw $25,mm+"struct mman::pc_video_height"
|
||||||
movl $0xb8000,mm+"struct mman::pc_video_framebuffer"
|
movl $0xb8000,mm+"struct mman::pc_video_framebuffer"
|
||||||
movl $0x8000,mm+"struct mman::pc_video_framebuffer_size"
|
movl $0x8000,mm+"struct mman::pc_video_framebuffer_size"
|
||||||
|
xor %eax,%eax
|
||||||
|
mov %eax,mm+"struct mman::pc_video_framebuffer"+4
|
||||||
|
mov %eax,mm+"struct mman::pc_video_framebuffer_size"+4
|
||||||
mov $0x1003,%ax # enable/disable VGA text blinking
|
mov $0x1003,%ax # enable/disable VGA text blinking
|
||||||
#ifdef VGA_USE_BLINK
|
#ifdef VGA_USE_BLINK
|
||||||
mov $1,%bx
|
mov $1,%bx
|
||||||
|
|
|
@ -62,7 +62,8 @@ __attribute__((__constructor__)) static textstartup void _vga_init(void) {
|
||||||
if (IsMetal()) {
|
if (IsMetal()) {
|
||||||
struct mman *mm = (struct mman *)(BANE + 0x0500);
|
struct mman *mm = (struct mman *)(BANE + 0x0500);
|
||||||
unsigned short height = mm->pc_video_height, width = mm->pc_video_width;
|
unsigned short height = mm->pc_video_height, width = mm->pc_video_width;
|
||||||
void * vid_buf = (void *)(BANE + mm->pc_video_framebuffer);
|
uint64_t vid_buf_phy = mm->pc_video_framebuffer;
|
||||||
|
void *vid_buf = (void *)(BANE + vid_buf_phy);
|
||||||
size_t vid_buf_sz = mm->pc_video_framebuffer_size;
|
size_t vid_buf_sz = mm->pc_video_framebuffer_size;
|
||||||
/*
|
/*
|
||||||
* Get the initial cursor position from the BIOS data area. Also get
|
* Get the initial cursor position from the BIOS data area. Also get
|
||||||
|
@ -78,8 +79,7 @@ __attribute__((__constructor__)) static textstartup void _vga_init(void) {
|
||||||
if (chr_ht_hi != 0 || chr_ht > 32)
|
if (chr_ht_hi != 0 || chr_ht > 32)
|
||||||
chr_ht = 32;
|
chr_ht = 32;
|
||||||
/* Make sure the video buffer is mapped into virtual memory. */
|
/* Make sure the video buffer is mapped into virtual memory. */
|
||||||
__invert_memory_area(mm, __get_pml4t(), (uint64_t)vid_buf, vid_buf_sz,
|
__invert_memory_area(mm, __get_pml4t(), vid_buf_phy, vid_buf_sz, PAGE_RW);
|
||||||
PAGE_RW);
|
|
||||||
/*
|
/*
|
||||||
* Initialize our tty structure from the current screen contents,
|
* Initialize our tty structure from the current screen contents,
|
||||||
* current cursor position, & character height.
|
* current cursor position, & character height.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue