From 50a64d7e401c083e49e3e44f41923de9aa01488b Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Sat, 6 Aug 2016 22:09:24 +0200 Subject: [PATCH] Exposes vesa resolution --- kernel/include/vesa.hpp | 3 +++ kernel/src/vesa.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/kernel/include/vesa.hpp b/kernel/include/vesa.hpp index 4e6e91d4..23c56b69 100644 --- a/kernel/include/vesa.hpp +++ b/kernel/include/vesa.hpp @@ -35,6 +35,9 @@ void draw_char(size_t x, size_t y, char c, uint8_t r, uint8_t g, uint8_t b); void move_lines_up(size_t y, size_t x, size_t w, size_t lines, size_t n); +uint64_t width(); +uint64_t height(); + } //end of vesa namespace #endif diff --git a/kernel/src/vesa.cpp b/kernel/src/vesa.cpp index 49ce444c..f233dcb9 100644 --- a/kernel/src/vesa.cpp +++ b/kernel/src/vesa.cpp @@ -92,6 +92,16 @@ bool vesa::init(){ return true; } +uint64_t vesa::width(){ + auto& block = *reinterpret_cast(early::vesa_mode_info_address); + return block.width; +} + +uint64_t vesa::height(){ + auto& block = *reinterpret_cast(early::vesa_mode_info_address); + return block.height; +} + uint32_t vesa::make_color(uint8_t r, uint8_t g, uint8_t b){ return (r << red_shift) + (g << green_shift) + (b << blue_shift); }