Skip to content

Commit a691c7f

Browse files
committed
* Added more information when kernel crashes
* Updated the Github Actions
1 parent aa6c28d commit a691c7f

File tree

8 files changed

+44
-7
lines changed

8 files changed

+44
-7
lines changed

.github/workflows/makefile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
shell: bash
2323

2424
- name: Create toolchain
25-
run: ./src/scripts/make_toolchain.sh --parallel_build -s ~/sysroot download_i686_elf_tools
25+
run: ./src/scripts/make_toolchain.sh --parallel_build -s ~/sysroot
2626
shell: bash
2727

2828
- name: Compile kernel

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ OSTOOL_DIR=~/sysroot/usr/bin/
1111

1212
CC=i686-elf-gcc
1313
CCVERSION = $(shell echo $(CC) $(shell $(PREFIX)$(CC) --version | grep $(CC) | sed 's/^.* //g'))
14-
CFLAGS= -I$(INCLUDEDIR) -I/usr/include -nostdlib -DKERNEL_COMPILER="\"$(CCVERSION)\"" -lgcc -fno-builtin -fno-exceptions -fno-leading-underscore -ffreestanding -Wall -Wpedantic -ggdb -O0 -D__ENABLE_DEBUG_SYMBOL_LOADING__=1 -D__COMPOSITOR_LOW_END__=1
14+
CFLAGS=
15+
KCFLAGS= -I$(INCLUDEDIR) -I/usr/include -nostdlib -DKERNEL_COMPILER="\"$(CCVERSION)\"" -lgcc -fno-builtin -fno-exceptions -fno-leading-underscore -ffreestanding -Wall -Wpedantic -ggdb -O0 -D__ENABLE_DEBUG_SYMBOL_LOADING__=1 -D__COMPOSITOR_LOW_END__=0 $(CFLAGS)
16+
1517

1618
CXX=$(TOOLDIR)/i686-elf-g++
1719
CXXFLAGS=
@@ -171,7 +173,7 @@ $(ISOFILE): $(IMAGEFILE) $(EXECUTABLE)
171173

172174
%.o : %.c
173175
@echo '[CC] $@'
174-
@$(PREFIX)/$(CC) $(CFLAGS) -c -o $@ $<
176+
@$(PREFIX)/$(CC) $(KCFLAGS) -c -o $@ $<
175177

176178
%.o : %.s
177179
@echo '[GAS] $@'

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Kernel Version
1414

1515

1616
## 🧱 Kernel
17-
The current kernel version for SectorOS-RW4 is v6.23.06.2NR.<br>
17+
The current kernel version for SectorOS-RW4 is v6.23.06.3NR.<br>
1818

1919
## Screenshots
2020
<img src="./assets/Screenshot_01.png"></img>

docs/changelog.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,8 @@
235235
* Updated the sleep routine
236236
* Added entries to mount syscall
237237
* Implemented a function to show message in compositor
238-
* Added function to access memory mapped IO
238+
* Added function to access memory mapped IO
239+
240+
22-06-2023: 07:56 PM IST v6.23.06.3NR
241+
* Added more information when kernel crashes
242+
* Updated the Github Actions

src/include/system.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ typedef uint32_t uintptr_t;
4343
* RELN: index of current release in the current month
4444
* STATUS: [PR]:Prerelease, [AL]:alpha, [NR]:Normal release
4545
*/
46-
#define KERNEL_VERSION "6.23.06.2NR"
46+
#define KERNEL_VERSION "6.23.06.3NR"
4747
#define KERNEL_VERSION_CODENAME "Mystic Mango"
4848

4949
#define KERNEL_ENABLED_OPTIONS "\b"

src/interrupts/exception.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "vga_text.h"
33
#include "debug.h"
44
#include "process.h"
5+
#include "logdisk.h"
56

67
int isLessMSG = 0;
78

@@ -91,6 +92,7 @@ void exception_handler(registers_t cps)
9192
else
9293
{
9394
text_chcolor(VGA_RED, VGA_BLACK);
95+
logdisk_change_policy(LOG_OFF);
9496
printf("KERNEL PANIC. EXCEPTION OCCURRED %d: %s\n", cps.ino, exception_messages[cps.ino]);
9597
printf("Extended stack pointer = 0x%06x\n", cps.esp);
9698
printf("Extended instruction pointer = 0x%06x\n", cps.eip);
@@ -106,6 +108,20 @@ void exception_handler(registers_t cps)
106108
printf("ESI = 0x%06x\n", cps.esi);
107109
printf("EDI = 0x%06x\n", cps.edi);
108110
printf("EBP = 0x%06x\n", cps.ebp);
111+
ldprintf("KERNEL", LOG_ERR, "KERNEL PANIC. EXCEPTION OCCURRED %d: %s", cps.ino, exception_messages[cps.ino]);
112+
ldprintf("KERNEL", LOG_ERR, "Extended stack pointer = 0x%06x", cps.esp);
113+
ldprintf("KERNEL", LOG_ERR, "Extended instruction pointer = 0x%06x", cps.eip);
114+
ldprintf("KERNEL", LOG_ERR, "Code segment selector = 0x%06x", cps.cs);
115+
ldprintf("KERNEL", LOG_ERR, "Extended flags = 0x%06x", cps.eflags);
116+
ldprintf("KERNEL", LOG_ERR, "Error code = 0x%06x", cps.ecode);
117+
ldprintf("KERNEL", LOG_ERR, "Registers:");
118+
ldprintf("KERNEL", LOG_ERR, "EAX = 0x%06x", cps.eax);
119+
ldprintf("KERNEL", LOG_ERR, "EBX = 0x%06x", cps.ebx);
120+
ldprintf("KERNEL", LOG_ERR, "ECX = 0x%06x", cps.ecx);
121+
ldprintf("KERNEL", LOG_ERR, "EDX = 0x%06x", cps.edx);
122+
ldprintf("KERNEL", LOG_ERR, "ESI = 0x%06x", cps.esi);
123+
ldprintf("KERNEL", LOG_ERR, "EDI = 0x%06x", cps.edi);
124+
ldprintf("KERNEL", LOG_ERR, "EBP = 0x%06x", cps.ebp);
109125
serialprintf("KERNEL PANIC. EXCEPTION OCCURRED %d: %s\n", cps.ino, exception_messages[cps.ino]);
110126
serialprintf("Extended stack pointer = 0x%06x\n", cps.esp);
111127
serialprintf("Extended instruction pointer = 0x%06x\n", cps.eip);

src/memory/paging.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "kheap.h"
33
#include "debug.h"
44
#include "elf_loader.h"
5+
#include "logdisk.h"
56

67
extern void * heap_start, * heap_end, * heap_max, * heap_curr;
78
extern bool kheap_enabled;
@@ -303,6 +304,8 @@ page_table_t* copy_page_table(page_directory_t * src_page_dir, page_directory_t
303304
return table;
304305
}
305306

307+
char page_hnd_error[1024];
308+
306309
void page_fault_handler(registers_t* regs)
307310
{
308311
printf("Page fault:\n");
@@ -324,6 +327,15 @@ void page_fault_handler(registers_t* regs)
324327
if(inst_fetch) printf("Instruction fetch ");
325328
printf("]\n");
326329

330+
strcpy(page_hnd_error, "Possible causes: [ ");
331+
if(!present) strcat(page_hnd_error, "Page not present ");
332+
if(rw) strcat(page_hnd_error, "Page is read only ");
333+
if(user) strcat(page_hnd_error, "Page is read only ");
334+
if(reserved) strcat(page_hnd_error, "Overwrote reserved bits ");
335+
if(inst_fetch) strcat(page_hnd_error, "Instruction fetch ");
336+
strcat(page_hnd_error, "]");
337+
ldprintf("Page manager", LOG_ERR, page_hnd_error);
338+
327339
serialprintf("Possible causes: [ ");
328340
if(!present) serialprintf("Page not present ");
329341
if(rw) serialprintf("Page is read only ");
@@ -337,6 +349,9 @@ void page_fault_handler(registers_t* regs)
337349
printf("Faulting address: 0x%x\n", faulting_addr);
338350
printf("Faulting virtual address: 0x%x : {%s+0x%x}\n", faulting_vaddr, vsym.name, vsym.offset);
339351

352+
ldprintf("Page manager", LOG_ERR, "Faulting address: 0x%x", faulting_addr);
353+
ldprintf("Page manager", LOG_ERR, "Faulting virtual address: 0x%x : {%s+0x%x}", faulting_vaddr, vsym.name, vsym.offset);
354+
340355
serialprintf("Faulting address: 0x%x\n", faulting_addr);
341356
serialprintf("Faulting virtual address: 0x%x : {%s+0x%x}\n", faulting_vaddr, vsym.name, vsym.offset);
342357

src/scripts/i686-elf-tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ echo "PARALLEL = ${PARALLEL}"
7777
function main {
7878

7979
installPackages
80-
installMXE
80+
# installMXE
8181

8282
if [[ $ENV_ONLY == true ]]; then
8383
echoColor "Successfully installed build environment. Exiting as 'env' only was specified"

0 commit comments

Comments
 (0)