Skip to content

Commit

Permalink
[kernel] Change heap and stack overflow kernel error messages, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Dec 6, 2024
1 parent 156dbc5 commit 55ac8fa
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions elks/arch/i86/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ void stack_check(void)
/* optional: check stack over min stack*/
if (current->t_regs.sp < current->t_begstack - current->t_minstack) {
if (current->t_minstack) /* display if protected stack*/
printk("(%P)STACK OVER MINSTACK by %u BYTES\n",
printk("(%P)STACK OUTSIDE PROTECTED LIMIT by %u\n",
current->t_begstack - current->t_minstack - current->t_regs.sp);
}

/* check stack overflow heap*/
if (current->t_regs.sp > end)
return;
}
printk("(%P)STACK OVERFLOW BY %u BYTES\n", end - current->t_regs.sp);
printk("(%P)STACK OVERFLOW by %u\n", end - current->t_regs.sp);
do_exit(SIGSEGV);
}

Expand Down
4 changes: 2 additions & 2 deletions elks/arch/i86/mm/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ int sys_brk(segoff_t newbrk)

if (current->t_begstack > current->t_endbrk) { /* stack above heap?*/
if (newbrk > current->t_begstack - current->t_minstack) {
printk("sys_brk(%d) fail: brk %x over by %u bytes\n",
current->pid, newbrk, newbrk - (current->t_begstack - current->t_minstack));
printk("(%d)CAN'T EXPAND HEAP by %u\n",
current->pid, newbrk - (current->t_begstack - current->t_minstack));
return -ENOMEM;
}
}
Expand Down
1 change: 1 addition & 0 deletions elks/tools/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ bin/exomizer
bin/eman
bin/ewcc
bin/ewlink
bin/ecc
bin/fixomf
elftoolchain-0.7.1
bin/mattrib
Expand Down
7 changes: 5 additions & 2 deletions elks/tools/objtools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CLEANDEP =

CLEANME = ../bin/objdump86 ../bin/omfdump ../bin/omf2elf \
../bin/os2toelks ../bin/os2dump \
../bin/ewcc ../bin/ewlink
../bin/ewcc ../bin/ewlink ../bin/ecc

DEPEND =

Expand All @@ -42,7 +42,7 @@ include $(BASEDIR)/Makefile-rules

CFLAGS += -Wall -Wextra -O3

all: ../bin/objdump86 ../bin/omf2elf ../bin/omfdump ../bin/os2toelks ../bin/os2dump ../bin/ewcc ../bin/ewlink
all: ../bin/objdump86 ../bin/omf2elf ../bin/omfdump ../bin/os2toelks ../bin/os2dump ../bin/ewcc ../bin/ewlink ../bin/ecc

../bin/objdump86: objdump86.o
$(CC) -o ../bin/objdump86 $(CFLAGS) $^
Expand All @@ -65,5 +65,8 @@ all: ../bin/objdump86 ../bin/omf2elf ../bin/omfdump ../bin/os2toelks ../bin/os2d
../bin/ewlink: ewlink
cp -p ewlink ../bin

../bin/ecc: ecc
cp -p ecc ../bin

#########################################################################
### Dependencies:
File renamed without changes.
3 changes: 1 addition & 2 deletions elks/tools/objtools/ewcc
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ WATCINCLUDE=$WATCOM/h
# -Wc,-wcd=N # disable warning N
# -Wc,-fpi87 # inline 8087 fp
# -Wc,-x # ignore INCLUDE environment variable
# -fno-stack-check # don't generate stack check code
# -fnostdlib # don't refere standard libraries
# unused:
# -fno-stack-check # don't generate stack check code
# -ztNum # specify far data threshold (default 32767, or 256 if no Num)
# -mhard-emu-float # -Wc,-fpi (inline 8087 w/emulation)
# -msoft-float # -Wc,-fpc
Expand All @@ -61,7 +61,6 @@ CCFLAGS="\
-Wc,-zev \
-Wc,-zls \
-Wc,-x \
-fno-stack-check \
-fnostdlib \
-Wall -Wextra \
-Wc,-wcd=303 \
Expand Down

0 comments on commit 55ac8fa

Please sign in to comment.