Added new startup logger, tab support and new iso image

This commit is contained in:
Marco Cetica 2020-08-24 01:12:39 +02:00
parent 50dc3ab1c7
commit 0728dc0dbc
7 changed files with 38 additions and 27 deletions

View File

@ -34,7 +34,7 @@ After that, you can build iceOS just by running the command listed below.
2. Type `make run` to start it in QEMU or `make bochs` to start it with bochs(only for debug purposes).
You can also find a ISO file
[here](https://github.com/ice-bit/iceOS/raw/master/imgs/iceOS.iso)(md5sum: `342691301699a73102fa6a57abea6989`)
[here](https://github.com/ice-bit/iceOS/raw/master/imgs/iceOS.iso)(md5sum: `5a969460e63eb5c4dcfa943dc2a3f39f`)
## Features
iceOS has the following features:
@ -48,7 +48,7 @@ iceOS has the following features:
- [ ] Usermode
## Tutorial
I'm also writing a tutorial about this project. If you are interested about OS development and you're looking for a detailed _step-by-step_ tutorial, have a look at my [website](https://osdev.marcocetica.com).
I'm also writing a tutorial about this project. If you are interested about OS development and you're looking for a detailed _step-by-step_ tutorial, have a look at my [website](https://marcocetica.com/bl).
## License

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -22,7 +22,7 @@ void move_cursor(uint16_t pos) {
outb(VGA_DATA_PORT, pos & 0x00FF);
}
void cursor_adv() {
void cursor_adv() { // TODO: specify number of adv. with a parameter
if(fb_col < VGA_WIDTH - 1)
fb_col++;
else
@ -57,6 +57,8 @@ void kprint_c(uint8_t *buf, uint32_t len, uint8_t fg, uint8_t bg) {
uint8_t c = buf[i];
if(c == '\n' || c == '\r')
newline();
else if(c == '\t')
tab();
else {
pos = fb_col + (fb_row * VGA_WIDTH);
write_cell(pos, (uint8_t)c, fg, bg);
@ -125,4 +127,9 @@ void newline() {
fb_col = 1;
move_cursor(fb_col + (fb_row * VGA_WIDTH));
}
}
void tab() {
for(uint8_t i = 0; i < 4; i++)
cursor_adv(); // Increment cursor 4 times
}

View File

@ -46,7 +46,8 @@ enum TTY_COLORS {
#define VGA_HIGH_BYTE 14
#define VGA_LOW_BYTE 15
/* Kernel's VGA API */
/* Kernel's VGA API */
// FIXME: Set these functions to static
void write_cell(int16_t i, uint8_t c, uint8_t fg, uint8_t bg);
void move_cursor(uint16_t pos);
void cursor_adv();
@ -59,5 +60,6 @@ void clear_prompt();
void clear_row(uint8_t row);
void scroll(); // Scroll one row
void newline();
void tab();
#endif
#endif

View File

@ -18,43 +18,45 @@
#include <stdint.h>
#define PRTOK printf("\n["); printf_color(" OK ", LIGHT_GREEN, BLACK); printf("]"); // Ugly hack to print "[ OK ]"
#define PRTAT printf("\n["); printf_color(" ** ", LIGHT_BROWN, BLACK); printf("]"); // Ugly hack to print "[ * ]"
void kernel_main() {
printf_color("\n[STATUS]", LIGHT_GREEN, BLACK);
printf_color(" - Loading kernel, wait please...", WHITE, BLACK);
printf("Loading kernel, wait please...");
gdt_setup(); // Setup Global Descriptor Table
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
printf_color(" - Loaded GDT", WHITE, BLACK);
PRTOK
printf(" - Loaded GDT");
idt_setup(); // Setup Interrupt Descriptor Table
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
printf_color(" - Loaded IDT", WHITE, BLACK);
PRTOK
printf(" - Loaded IDT");
init_timer(1); // Initialize PIT driver
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
printf_color(" - Loaded PIT", WHITE, BLACK);
PRTOK
printf(" - Loaded PIT");
init_keyboard(); // Initialize keyboard driver
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
printf_color(" - Loaded PS/2 driver", WHITE, BLACK);
PRTOK
printf(" - Loaded PS/2 driver");
init_paging(); // Initialize paging
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
printf_color(" - Loaded Paging", WHITE, BLACK);
PRTOK
printf(" - Loaded Paging");
printf_color("\n[TEST]", LIGHT_BROWN, BLACK); // Testing heap
printf_color(" - Testing heap..\n", LIGHT_BROWN, BLACK);
PRTAT
printf(" - Testing heap...\t");
uint32_t x = kmalloc(32), y = kmalloc(32);
printf("x: %x, y: %x", x, y);
kfree((void*)y);
uint32_t z = kmalloc(8);
printf(", z: %x\n", z); // If z is equal to y, heap's anti-fragmentation algorithm works
printf(", z: %x", z); // If z is equal to y, heap's anti-fragmentation algorithm works
ASSERT(z == y);
kfree((void*)z), kfree((void*)x);
printf_color("[STATUS]", LIGHT_GREEN, BLACK);
printf_color(" - Heap works!", WHITE, BLACK);
PRTOK
printf(" - Heap works!");
iceos_ascii_logo();
init_prompt(); // Initialize frame buffer

View File

@ -120,10 +120,10 @@ void processCommand(uint8_t *cmd) {
void iceos_ascii_logo() {
printf_color("\n\n"
"##############################################\n#",
"###################################################\n#",
LIGHT_BLUE, BLACK);
printf_color(" iceOS - developed by Marco Cetica (c) 2019 ",
printf_color(" iceOS - developed by Marco Cetica (c) 2019-2020 ",
LIGHT_MAGENTA, BLACK);
printf_color("#\n##############################################\n",
printf_color("#\n###################################################\n",
LIGHT_BLUE, BLACK);
}
}