Avoid possible division by zero.

This commit is contained in:
Eric Norum
2006-02-06 21:43:58 +00:00
parent 4fca5bd51a
commit b468898f15
3 changed files with 8 additions and 2 deletions

View File

@@ -1,3 +1,7 @@
2006-02-06 Eric Norum <norume@aps.anl.gov>
* clock/clock.c: Avoid division by zero.
2006-01-29 Eric Norum <norume@aps.anl.gov>
* clock/clock.c, network/network.c, startup/bspstart.c:

View File

@@ -108,7 +108,9 @@ void _BSP_Thread_Idle_body(void)
int rtems_bsp_cpu_load_percentage(void)
{
return 100 - ((100 * (FILTERED_IDLE >> FILTER_SHIFT)) / MAX_IDLE_COUNT);
return MAX_IDLE_COUNT ?
(100 - ((100 * (FILTERED_IDLE >> FILTER_SHIFT)) / MAX_IDLE_COUNT)) :
0;
}
#include "../../../shared/clockdrv_shell.c"

View File

@@ -223,7 +223,7 @@ void bsp_start( void )
Cpu_table.interrupt_stack_size = 4096;
{
extern void _BSP_Thread_Idle_body(void);
_CPU_Table.idle_task = _BSP_Thread_Idle_body;
Cpu_table.idle_task = _BSP_Thread_Idle_body;
}
Cpu_table.interrupt_vector_table = (m68k_isr *)0; /* vectors at start of RAM */