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