dynamic HZ, library stacktrace

This commit is contained in:
Ben Gras 2008-12-11 14:54:42 +00:00
parent b6b361a474
commit 70f1f28439
4 changed files with 16 additions and 39 deletions

View file

@ -14,7 +14,7 @@ LIBS = -lsys
$(CC) $(CFLAGS) -o $@ -c $<
OBJ = buf.o clock.o inet.o inet_config.o \
mnx_eth.o mq.o qp.o sr.o stacktrace.o \
mnx_eth.o mq.o qp.o sr.o \
$g/udp.o $g/arp.o $g/eth.o $g/event.o \
$g/icmp.o $g/io.o $g/ip.o $g/ip_ioctl.o \
$g/ip_lib.o $g/ip_read.o $g/ip_write.o \

View file

@ -87,6 +87,10 @@ int killer_inet= 0;
extern int inet_buf_debug;
#endif
#if HZ_DYNAMIC
u32_t system_hz;
#endif
_PROTOTYPE( void main, (void) );
FORWARD _PROTOTYPE( void nw_conf, (void) );
@ -110,6 +114,10 @@ PUBLIC void main()
printf("%s\n", version);
#endif
#if HZ_DYNAMIC
system_hz = sys_hz();
#endif
/* Read configuration. */
nw_conf();
@ -315,7 +323,7 @@ int line;
PUBLIC void inet_panic()
{
printf("\ninet stacktrace: ");
stacktrace();
util_stacktrace();
#ifdef __minix_vmd
sys_abort(RBT_PANIC);
#else /* Minix 3 */

View file

@ -88,7 +88,7 @@ _PROTOTYPE( void inet_panic, (void) ) _NORETURN;
printf("warning at %s, %d: ", this_file, __LINE__), \
printf print_list, \
printf("\ninet stacktrace: "), \
stacktrace() \
util_stacktrace() \
)
#else
#define ip_warning(print_list) ((void) 0)
@ -109,7 +109,11 @@ _PROTOTYPE( void inet_panic, (void) ) _NORETURN;
extern int this_proc;
extern char version[];
void stacktrace ARGS(( void ));
#ifndef HZ
EXTERN u32_t system_hz;
#define HZ system_hz
#define HZ_DYNAMIC 1
#endif
#endif /* INET__INET_H */

View file

@ -1,35 +0,0 @@
/*
stacktrace.c
Created: Jan 19, 1993 by Philip Homburg
Copyright 1995 Philip Homburg
*/
#include "inet.h"
PUBLIC void stacktrace()
{
typedef unsigned int reg_t;
reg_t bp, pc, hbp;
extern reg_t get_bp ARGS(( void ));
bp= get_bp();
while(bp)
{
pc= ((reg_t *)bp)[1];
hbp= ((reg_t *)bp)[0];
printf("0x%lx ", (unsigned long)pc);
if (hbp != 0 && hbp <= bp)
{
printf("???");
break;
}
bp= hbp;
}
printf("\n");
}
/*
* $PchId: stacktrace.c,v 1.6 1996/05/07 21:11:34 philip Exp $
*/