f3da086ac3
Assert that the `local_irq` of each levels should only ranges from `0` to `CONFIG_MAX_IRQ_PER_AGGREGATOR`, so that it doesn't overflow the other aggregators. Also, assert that the output of `z_get_sw_isr_table_idx` shouldn't overflow the ISR table. Update the `sw_isr_table` tests to test the range of `CONFIG_MAX_IRQ_PER_AGGREGATOR` instead of the entire range of level bits. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
24 lines
489 B
C
24 lines
489 B
C
/*
|
|
* Copyright (c) 2018 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include "sw_isr_common.h"
|
|
#include <zephyr/sw_isr_table.h>
|
|
#include <zephyr/irq.h>
|
|
#include <zephyr/sys/__assert.h>
|
|
|
|
/*
|
|
* Common code for arches that use software ISR tables (CONFIG_GEN_ISR_TABLES)
|
|
*/
|
|
|
|
unsigned int __weak z_get_sw_isr_table_idx(unsigned int irq)
|
|
{
|
|
unsigned int table_idx = irq - CONFIG_GEN_IRQ_START_VECTOR;
|
|
|
|
__ASSERT_NO_MSG(table_idx < IRQ_TABLE_SIZE);
|
|
|
|
return table_idx;
|
|
}
|