fix tab/spaces
This commit is contained in:
@@ -28,8 +28,8 @@ loader_alloc_pages(
|
||||
bootsvc->AllocatePages(AllocateAnyPages, mem_type, page_count, &addr);
|
||||
}
|
||||
CHECK_EFI_STATUS_OR_RETURN(status,
|
||||
L"Allocating %d kernel pages type %x",
|
||||
page_count, mem_type);
|
||||
L"Allocating %d kernel pages type %x",
|
||||
page_count, mem_type);
|
||||
|
||||
*length = page_count * PAGE_SIZE;
|
||||
*pages = (void *)addr;
|
||||
|
||||
@@ -95,8 +95,8 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table)
|
||||
}
|
||||
|
||||
con_printf(L" Kernel version %d.%d.%d %x%s\r\n",
|
||||
version->major, version->minor, version->patch, version->gitsha & 0x0fffffff,
|
||||
version->gitsha & 0xf0000000 ? "*" : "");
|
||||
version->major, version->minor, version->patch, version->gitsha & 0x0fffffff,
|
||||
version->gitsha & 0xf0000000 ? "*" : "");
|
||||
con_printf(L" Entrypoint 0x%x\r\n", version->entrypoint);
|
||||
|
||||
void (*kernel_main)() = version->entrypoint;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "utility.h"
|
||||
|
||||
struct error_code_desc {
|
||||
EFI_STATUS code;
|
||||
CHAR16 *name;
|
||||
EFI_STATUS code;
|
||||
CHAR16 *name;
|
||||
};
|
||||
|
||||
// Based off the gnu-efi table
|
||||
|
||||
@@ -19,10 +19,10 @@ enum psf2_flags {
|
||||
struct psf2_header {
|
||||
uint8_t magic[4];
|
||||
uint32_t version;
|
||||
uint32_t header_size; // offset of bitmaps in file
|
||||
uint32_t header_size; // offset of bitmaps in file
|
||||
uint32_t flags;
|
||||
uint32_t length; // number of glyphs
|
||||
uint32_t charsize; // number of bytes for each character
|
||||
uint32_t length; // number of glyphs
|
||||
uint32_t charsize; // number of bytes for each character
|
||||
uint32_t height, width; // max dimensions of glyphs
|
||||
};
|
||||
|
||||
@@ -36,35 +36,32 @@ font::load(void const *data)
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t const *font_data = static_cast<uint8_t const *>(data) + psf2->header_size;
|
||||
return font{
|
||||
psf2->height,
|
||||
psf2->width,
|
||||
psf2->length,
|
||||
font_data};
|
||||
uint8_t const *font_data = static_cast<uint8_t const *>(data) + psf2->header_size;
|
||||
return font{
|
||||
psf2->height,
|
||||
psf2->width,
|
||||
psf2->length,
|
||||
font_data};
|
||||
}
|
||||
|
||||
font::font() :
|
||||
m_height(0),
|
||||
m_width(0),
|
||||
m_count(0),
|
||||
m_data(nullptr)
|
||||
m_count(0),
|
||||
m_data(nullptr)
|
||||
{}
|
||||
|
||||
font::font(unsigned height, unsigned width, unsigned count, uint8_t const *data) :
|
||||
m_height(height),
|
||||
m_width(width),
|
||||
m_count(count),
|
||||
m_data(data)
|
||||
m_size(width, height),
|
||||
m_count(count),
|
||||
m_data(data)
|
||||
{}
|
||||
|
||||
void
|
||||
font::draw_glyph(
|
||||
screen &s,
|
||||
uint32_t glyph,
|
||||
screen::pixel_t color,
|
||||
screen::coord_t x,
|
||||
screen::coord_t y) const
|
||||
screen &s,
|
||||
uint32_t glyph,
|
||||
screen::pixel_t color,
|
||||
unsigned x,
|
||||
unsigned y) const
|
||||
{
|
||||
unsigned bwidth = (m_width+7)/8;
|
||||
uint8_t const *data = m_data + (glyph * glyph_bytes());
|
||||
|
||||
@@ -6,28 +6,28 @@
|
||||
class font
|
||||
{
|
||||
public:
|
||||
static font load(void const *data);
|
||||
static font load(void const *data);
|
||||
|
||||
unsigned glyph_bytes() const { return m_height * ((m_width + 7) / 8); }
|
||||
unsigned count() const { return m_count; }
|
||||
unsigned width() const { return m_width; }
|
||||
unsigned height() const { return m_height; }
|
||||
bool valid() const { return m_count > 0; }
|
||||
unsigned glyph_bytes() const { return m_height * ((m_width + 7) / 8); }
|
||||
unsigned count() const { return m_count; }
|
||||
unsigned width() const { return m_width; }
|
||||
unsigned height() const { return m_height; }
|
||||
bool valid() const { return m_count > 0; }
|
||||
|
||||
void draw_glyph(
|
||||
screen &s,
|
||||
uint32_t glyph,
|
||||
screen::pixel_t color,
|
||||
screen::coord_t x,
|
||||
screen::coord_t y) const;
|
||||
void draw_glyph(
|
||||
screen &s,
|
||||
uint32_t glyph,
|
||||
screen::pixel_t color,
|
||||
unsigned x,
|
||||
unsigned y) const;
|
||||
|
||||
private:
|
||||
font();
|
||||
font(unsigned height, unsigned width, unsigned count, uint8_t const *data);
|
||||
font();
|
||||
font(unsigned height, unsigned width, unsigned count, uint8_t const *data);
|
||||
|
||||
unsigned m_height;
|
||||
unsigned m_width;
|
||||
unsigned m_count;
|
||||
uint8_t const *m_data;
|
||||
unsigned m_height;
|
||||
unsigned m_width;
|
||||
unsigned m_count;
|
||||
uint8_t const *m_data;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include "screen.h"
|
||||
|
||||
extern "C" {
|
||||
void do_the_set_registers(popcorn_data *header);
|
||||
void kernel_main(popcorn_data *header);
|
||||
void do_the_set_registers(popcorn_data *header);
|
||||
void kernel_main(popcorn_data *header);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -4,12 +4,12 @@ screen::color_masks::color_masks(pixel_t r, pixel_t g, pixel_t b) : r(r), g(g),
|
||||
screen::resolution::resolution(coord_t w, coord_t h) : w(w), h(h) {}
|
||||
|
||||
screen::screen(
|
||||
void *framebuffer,
|
||||
coord_t hres, coord_t vres,
|
||||
pixel_t rmask, pixel_t gmask, pixel_t bmask) :
|
||||
m_framebuffer(static_cast<pixel_t *>(framebuffer)),
|
||||
m_masks(rmask, gmask, bmask),
|
||||
m_resolution(hres, vres)
|
||||
void *framebuffer,
|
||||
coord_t hres, coord_t vres,
|
||||
pixel_t rmask, pixel_t gmask, pixel_t bmask) :
|
||||
m_framebuffer(static_cast<pixel_t *>(framebuffer)),
|
||||
m_masks(rmask, gmask, bmask),
|
||||
m_resolution(hres, vres)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,24 +5,25 @@
|
||||
class screen
|
||||
{
|
||||
public:
|
||||
using coord_t = uint32_t;
|
||||
using pixel_t = uint32_t;
|
||||
using coord_t = uint32_t;
|
||||
using pixel_t = uint32_t;
|
||||
|
||||
screen(
|
||||
void *framebuffer,
|
||||
coord_t hres, coord_t vres,
|
||||
pixel_t rmask, pixel_t gmask, pixel_t bmask);
|
||||
screen(
|
||||
void *framebuffer,
|
||||
coord_t hres, coord_t vres,
|
||||
pixel_t rmask, pixel_t gmask, pixel_t bmask);
|
||||
|
||||
void fill(pixel_t color);
|
||||
void draw_pixel(coord_t x, coord_t y, pixel_t color);
|
||||
|
||||
screen() = delete;
|
||||
screen(const screen &) = delete;
|
||||
|
||||
void fill(pixel_t color);
|
||||
void draw_pixel(unsigned x, unsigned y, pixel_t color);
|
||||
|
||||
struct color_masks {
|
||||
pixel_t r, g, b;
|
||||
color_masks(pixel_t r, pixel_t g, pixel_t b);
|
||||
};
|
||||
screen() = delete;
|
||||
screen(const screen &) = delete;
|
||||
|
||||
struct resolution {
|
||||
coord_t w, h;
|
||||
|
||||
Reference in New Issue
Block a user