diff options
author | Marvin Borner | 2020-04-15 22:03:14 +0200 |
---|---|---|
committer | Marvin Borner | 2020-04-15 22:03:14 +0200 |
commit | fc26e84ef8c6255926811fe639e3e466b756e581 (patch) | |
tree | a1308c6f32ea37e6fe714dab7dbe6818aae27d73 /src | |
parent | d549c18ac15d531bcdb067180d1d895cf952b59f (diff) |
Added even more colors!
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/fs/ata.c | 2 | ||||
-rw-r--r-- | src/kernel/fs/ext2/ext2.c | 3 | ||||
-rw-r--r-- | src/kernel/system.c | 32 | ||||
-rw-r--r-- | src/kernel/system.h | 10 |
4 files changed, 24 insertions, 23 deletions
diff --git a/src/kernel/fs/ata.c b/src/kernel/fs/ata.c index 96cc270..817bb98 100644 --- a/src/kernel/fs/ata.c +++ b/src/kernel/fs/ata.c @@ -269,7 +269,7 @@ void ata_device_detect(ata_dev_t *dev, int primary) pci_write_field(ata_device, PCI_COMMAND, pci_command_reg); } - log("Detected drive: %d", dev->drive); + log("Detected drive: %s", dev->mountpoint); vfs_mount(dev->mountpoint, create_ata_device(dev)); } diff --git a/src/kernel/fs/ext2/ext2.c b/src/kernel/fs/ext2/ext2.c index 5fcc929..b14d726 100644 --- a/src/kernel/fs/ext2/ext2.c +++ b/src/kernel/fs/ext2/ext2.c @@ -765,6 +765,7 @@ void ext2_init(char *device_path, char *mountpoint) ext2fs->sb = kmalloc(SUPERBLOCK_SIZE); ext2fs->block_size = 1024; read_disk_block(ext2fs, 1, (void *)ext2fs->sb); + log("%x", ext2fs->sb->ext2_magic); ext2fs->block_size = (1024 << ext2fs->sb->log2block_size); ext2fs->blocks_per_group = ext2fs->sb->blocks_per_group; ext2fs->inodes_per_group = ext2fs->sb->inodes_per_group; @@ -786,4 +787,4 @@ void ext2_init(char *device_path, char *mountpoint) inode_t *root_inode = kcalloc(sizeof(inode_t), 1); read_inode_metadata(ext2fs, root_inode, ROOT_INODE_NUMBER); vfs_mount(mountpoint, get_ext2_root(ext2fs, root_inode)); -}
\ No newline at end of file +} diff --git a/src/kernel/system.c b/src/kernel/system.c index 1133063..80b38e3 100644 --- a/src/kernel/system.c +++ b/src/kernel/system.c @@ -42,49 +42,40 @@ void vga_log(char *msg) void _debug(const char *f, const char *fmt, ...) { - vesa_set_color(vesa_dark_white); - printf("[%s] DBG: ", f); - + serial_printf(MAG "[%s] " RES, f); va_list args; va_start(args, fmt); - vprintf(fmt, args); + serial_vprintf(fmt, args); va_end(args); - vesa_set_color(default_text_color); - writec('\n'); + serial_put('\n'); } void _info(const char *f, const char *fmt, ...) { - vesa_set_color(vesa_blue); - printf("[%s] INF: ", f); - + serial_printf(BLU "[%s] " RES, f); va_list args; va_start(args, fmt); - vprintf(fmt, args); + serial_vprintf(fmt, args); va_end(args); - vesa_set_color(default_text_color); - writec('\n'); + serial_put('\n'); } void _warn(const char *f, const char *fmt, ...) { - vesa_set_color(vesa_dark_yellow); - printf("[%s] WRN: ", f); - + serial_printf(YEL "[%s] " RES, f); va_list args; va_start(args, fmt); - vprintf(fmt, args); + serial_vprintf(fmt, args); va_end(args); - vesa_set_color(default_text_color); - writec('\n'); + serial_put('\n'); } void _log(const char *f, const char *fmt, ...) { - serial_printf("\x1B[34m[%s]\x1B[37m ", f); + serial_printf(CYN "[%s] " RES, f); va_list args; va_start(args, fmt); serial_vprintf(fmt, args); @@ -107,8 +98,7 @@ const char *random_message[10] = { "Uh... Did I do that?", void _panic(const char *f, const char *msg) { cli(); - vesa_set_color(vesa_dark_red); - _log(f, "PNC: %s - System halted!", msg); + _log(f, RED "PNC: %s - System halted!" RES, msg); printf("[%s] PNC: %s - System halted!\n\n", f, msg); printf("> %s", random_message[get_time() % 10]); halt_loop(); diff --git a/src/kernel/system.h b/src/kernel/system.h index 74f0185..b85865c 100644 --- a/src/kernel/system.h +++ b/src/kernel/system.h @@ -105,4 +105,14 @@ void halt_loop(); */ void v86(uint8_t code, regs16_t *regs); +// Colors +#define RED "\x1B[31m" +#define GRN "\x1B[32m" +#define YEL "\x1B[33m" +#define BLU "\x1B[34m" +#define MAG "\x1B[35m" +#define CYN "\x1B[36m" +#define WHT "\x1B[37m" +#define RES "\x1B[0m" + #endif |