:: commit 536a82627b3df25819d4171b537b433ca068402f

mintsuki <mintsuki@protonmail.com> — 2020-11-17 00:24

parents: 85b4d063a8

panic: Do not print stacktrace if map file is not loaded. Fix places where we erroneously appended a newline to a panic string

diff --git a/limine-pxe.bin b/limine-pxe.bin
index 1fbde1fe..99518289 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index 098bef8b..e120cc78 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index 5882c063..a7309900 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/drivers/disk.c b/stage2/drivers/disk.c
index 47568ea0..1b641449 100644
--- a/stage2/drivers/disk.c
+++ b/stage2/drivers/disk.c
@@ -52,7 +52,7 @@ static int cache_block(int drive, uint64_t block, int sector_size) {
 
     if (r.eflags & EFLAGS_CF) {
         int ah = (r.eax >> 8) & 0xff;
-        panic("Disk error %x. Drive %x, LBA %x.\n", ah, drive, dap->lba);
+        panic("Disk error %x. Drive %x, LBA %x.", ah, drive, dap->lba);
     }
 
     cached_block = block;
@@ -75,7 +75,7 @@ int disk_get_sector_size(int drive) {
 
     if (r.eflags & EFLAGS_CF) {
         int ah = (r.eax >> 8) & 0xff;
-        panic("Disk error %x. Drive %x.\n", ah, drive);
+        panic("Disk error %x. Drive %x.", ah, drive);
     }
 
     return drive_params.bytes_per_sect;
diff --git a/stage2/fs/ext2.c b/stage2/fs/ext2.c
index db487b27..b90fc110 100644
--- a/stage2/fs/ext2.c
+++ b/stage2/fs/ext2.c
@@ -296,7 +296,7 @@ int ext2_open(struct ext2_file_handle *ret, struct part *part, const char *path)
     struct ext2_superblock *sb = &ret->sb;

 

     if (sb->s_state == EXT2_FS_UNRECOVERABLE_ERRORS)

-        panic("ext2: unrecoverable errors found\n");

+        panic("ext2: unrecoverable errors found");

 

     ret->block_size = ((uint64_t)1024 << ret->sb.s_log_block_size);

 

diff --git a/stage2/lib/trace.c b/stage2/lib/trace.c
index 5ecfe369..5bd88a15 100644
--- a/stage2/lib/trace.c
+++ b/stage2/lib/trace.c
@@ -45,8 +45,10 @@ char *trace_address(size_t *off, size_t addr) {
 }
 
 void print_stacktrace(size_t *base_ptr) {
-    if (!stage2_map)
-        print("trace: Symbol names won't be resolved due to missing map file.\n");
+    if (!stage2_map) {
+        print("trace: Stack trace omitted due to unavailable map file.\n");
+        return;
+    }
 
     if (base_ptr == NULL) {
         asm volatile (
diff --git a/stage2/protos/stivale.c b/stage2/protos/stivale.c
index 6c390dd6..559d0949 100644
--- a/stage2/protos/stivale.c
+++ b/stage2/protos/stivale.c
@@ -130,7 +130,7 @@ void stivale_load(char *config, char *cmdline) {
 
         struct file_handle f;
         if (!uri_open(&f, module_file))
-            panic("Requested module with path \"%s\" not found!\n", module_file);
+            panic("Requested module with path \"%s\" not found!", module_file);
 
         void *module_addr = (void *)(((uint32_t)top_used_addr & 0xfff) ?
             ((uint32_t)top_used_addr & ~((uint32_t)0xfff)) + 0x1000 :
diff --git a/stage2/protos/stivale2.c b/stage2/protos/stivale2.c
index 9d77aae6..3ec78b6d 100644
--- a/stage2/protos/stivale2.c
+++ b/stage2/protos/stivale2.c
@@ -182,7 +182,7 @@ void stivale2_load(char *config, char *cmdline) {
 
         struct file_handle f;
         if (!uri_open(&f, module_file))
-            panic("Requested module with path \"%s\" not found!\n", module_file);
+            panic("Requested module with path \"%s\" not found!", module_file);
 
         void *module_addr = (void *)(((uint32_t)top_used_addr & 0xfff) ?
             ((uint32_t)top_used_addr & ~((uint32_t)0xfff)) + 0x1000 :
diff --git a/stage2/pxe/pxe.c b/stage2/pxe/pxe.c
index 6f46fe44..e3b5051e 100644
--- a/stage2/pxe/pxe.c
+++ b/stage2/pxe/pxe.c
@@ -28,7 +28,7 @@ void pxe_init(void) {
 
     if (pxenv->version < 0x201) {
         //we won't support pxe < 2.1, grub does this too and it seems to work fine
-        panic("\npxe version too old");
+        panic("pxe version too old");
     }
 
     struct bangpxe* bangpxe = (struct bangpxe*)((((pxenv->pxe_ptr & 0xffff0000) >> 16) << 4) + (pxenv->pxe_ptr & 0xffff));
tab: 248 wrap: offon