Commit b6b6d39b authored by Martin Åberg's avatar Martin Åberg Committed by Anas Nashif
Browse files

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: default avatarMartin Åberg <martin.aberg@gaisler.com>
parent 80b9080f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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

+10 −0
Original line number Diff line number Diff line
@@ -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
+3 −0
Original line number Diff line number Diff line
@@ -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;
}