Skip to content

Commit

Permalink
[kernel] Update debugging display in kernel, add debug_brk
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Feb 16, 2025
1 parent 6343600 commit a236a22
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
10 changes: 5 additions & 5 deletions elks/arch/i86/mm/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ static int set_brk(segoff_t brk, int increment)

int sys_brk(segoff_t newbrk)
{
dprintk("(%P)BRK %u\n", newbrk);
debug_brk("(%P)BRK %u\n", newbrk);
return set_brk(newbrk, 0);
}

Expand All @@ -277,8 +277,8 @@ int sys_sbrk(int increment, segoff_t *pbrk)
int err;

if (increment) {
dprintk("(%P)SBRK %d\n", increment);
/*dprintk("(%P)SBRK %d, curbreak %u, SP %u\n",
debug_brk("(%P)SBRK %d\n", increment);
/*debug_brk("(%P)SBRK %d, curbreak %u, SP %u\n",
increment, current->t_endbrk, current->t_regs.sp);*/
}
err = verify_area(VERIFY_WRITE, pbrk, sizeof(*pbrk));
Expand All @@ -302,10 +302,10 @@ int sys_fmemalloc(int paras, unsigned short *pseg)
return err;
seg = seg_alloc((segext_t)paras, SEG_FLAG_FDAT);
if (!seg) {
dprintk("(%P)FMEMALLOC %ld FAIL\n", (unsigned long)paras << 4);
debug_brk("(%P)FMEMALLOC %ld FAIL\n", (unsigned long)paras << 4);
return -ENOMEM;
}
dprintk("(%P)FMEMALLOC %ld\n", (unsigned long)paras << 4);
debug_brk("(%P)FMEMALLOC %ld\n", (unsigned long)paras << 4);
seg->pid = current->pid;
put_user(seg->base, pseg);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion elks/fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int sys_lseek(unsigned int fd, loff_t * p_offset, unsigned int origin)
loff_t offset;

offset = (loff_t) get_user_long(p_offset);
debug_file("lseek %d, %ld, %d\n", fd, offset, origin);
debug("lseek %d, %ld, %d\n", fd, offset, origin);
if (fd >= NR_OPEN || !(file = current->files.fd[fd]) || !(file->f_inode))
return -EBADF;
if (origin > 2) return -EINVAL;
Expand Down
7 changes: 7 additions & 0 deletions elks/include/linuxmt/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define DEBUG_LEVEL 0 /* default startup debug level*/
#define DEBUG_BIOS 0 /* BIOS driver*/
#define DEBUG_BLK 0 /* block i/o*/
#define DEBUG_BRK 0 /* sbrk/brk */
#define DEBUG_CACHE 0 /* floppy track cache*/
#define DEBUG_ETH 0 /* ethernet*/
#define DEBUG_FAT 0 /* FAT filesystem*/
Expand Down Expand Up @@ -55,6 +56,12 @@ void debug_setcallback(int evnum, void (*cbfunc)()); /* callback on debug event*
#define debug_blk(...)
#endif

#if DEBUG_BRK
#define debug_brk PRINTK
#else
#define debug_brk(...)
#endif

#if DEBUG_CACHE
#define debug_cache PRINTK
#define debug_cache2 if (debug_level > 1) PRINTK
Expand Down

0 comments on commit a236a22

Please sign in to comment.