boot/stage2/main.c (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#include "linker.h"
#include "paging.h"
/*
#define VGA_TEXTMODE_COLUMNS 80
#define VGA_TEXTMODE_LINES 25
#define VGA_TEXTMODE_CELLS (VGA_TEXTMODE_COLUMNS * VGA_TEXTMODE_LINES)
#define VGA_TEXT_COLOR 0x02
uint8_t const *display_start = (uint8_t*)0xB8000;
uint8_t *display = (uint8_t*)0xB8000;
void simple_clear(void) {
display = (uint8_t*)display_start;
for (int i = 0; i < VGA_TEXTMODE_CELLS; i++) {
display[2 * i] = 0x00;
display[2 * i + 1] = 0x00;
}
}
void simple_print(const char *src) {
while (*src) {
*display++ = *src++;
*display++ = VGA_TEXT_COLOR;
}
}
void simple_println(const char *src) {
simple_print(src);
while ((display - display_start) % (2 * VGA_TEXTMODE_COLUMNS)) {
display++;
display++;
}
}
*/
void copy_kernel(void) {
uint8_t *kernel_dest = (uint8_t*)0x00100000;
uint8_t *kernel_src = (SS_VMA + (KERNEL_LMA - SS_LMA));
for (uint32_t i = 0; i < KERNEL_SIZE + APP_SIZE; i++) {
kernel_dest[i] = kernel_src[i];
}
}