lib/os/heap: introduce option to force big heap mode
This option allows forcing big heap mode. Useful on for getting 8-byte aligned blocks on 32-bit machines. Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
This commit is contained in:
parent
80b9080f9d
commit
b6b6d39bb6
3 changed files with 17 additions and 0 deletions
|
@ -13,6 +13,10 @@ config SPARC_NWIN
|
|||
help
|
||||
Number of implemented register windows.
|
||||
|
||||
# ISA requires 8-byte alignment for 64-bit data access
|
||||
config SYS_HEAP_ALWAYS_BIG_MODE
|
||||
default y
|
||||
|
||||
config GEN_ISR_TABLES
|
||||
default y
|
||||
|
||||
|
|
|
@ -46,6 +46,16 @@ config SYS_HEAP_ALLOC_LOOPS
|
|||
keeps the maximum runtime at a tight bound so that the heap
|
||||
is useful in locked or ISR contexts.
|
||||
|
||||
config SYS_HEAP_ALWAYS_BIG_MODE
|
||||
bool "Always use the heap big chunks mode"
|
||||
help
|
||||
The sys_heap allocator by default returns pointers to blocks
|
||||
which are guaranteed to be aligned to the pointer size.
|
||||
By enabling the "big chunks" mode, the returned blocks are
|
||||
guaranteed to be 8 byte aligned, also on 32-bit platforms.
|
||||
If this option is enabled, the "big chunks" mode will always
|
||||
be used by sys_heap.
|
||||
|
||||
config PRINTK64
|
||||
bool "Enable 64 bit printk conversions (DEPRECATED)"
|
||||
help
|
||||
|
|
|
@ -66,6 +66,9 @@ struct z_heap {
|
|||
|
||||
static inline bool big_heap_chunks(size_t chunks)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_SYS_HEAP_ALWAYS_BIG_MODE)) {
|
||||
return 1;
|
||||
}
|
||||
return sizeof(void *) > 4U || chunks > 0x7fffU;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue