Hello,
Having seen a problem recur in programs running in L4Re just now involving arrays of a relatively large size allocated statically in functions - about 100000 bytes or so - I was wondering if there are any implicit limitations with this form of allocation in L4Re. Is it possible that programs have a limited stack size and that the stack does not expand?
Here is an example of the kind of code that causes an unhandled exception:
uint32_t Spi_gpio::send_units(uint32_t bytes, const uint8_t data[], uint8_t unit_size, uint8_t char_size) { uint32_t chars = bytes / unit_size; int dc[chars];
And the exception looks like this:
Unhandled exception: PC=0x1019ca8 PFA=0xfffd075a LdrFlgs=0x0
The actual cause of the exception is an access to an element in the dc array.
When I eventually get back to my own experiments with initiating programs in L4Re - not involved with the problem reported here - I intend to look more closely at program stack allocation and expansion strategies, so I suppose this is an appropriate prelude to such work.
Thanks for any guidance that might be offered, as always!
Paul
Hi Paul,
stack size is set to 16 pages per default (64bit archs). One can change the stack size by placing the following statement in a program:
#include <l4/re/elf_aux.h>
L4RE_ELF_AUX_ELEM_T(l4re_elf_aux_mword_t, _stack_size, L4RE_ELF_AUX_T_STACK_SIZE, 0x80000);
Adam
On Mon Nov 13, 2023 at 18:04:06 +0100, Paul Boddie wrote:
Hello,
Having seen a problem recur in programs running in L4Re just now involving arrays of a relatively large size allocated statically in functions - about 100000 bytes or so - I was wondering if there are any implicit limitations with this form of allocation in L4Re. Is it possible that programs have a limited stack size and that the stack does not expand?
Here is an example of the kind of code that causes an unhandled exception:
uint32_t Spi_gpio::send_units(uint32_t bytes, const uint8_t data[], uint8_t unit_size, uint8_t char_size) { uint32_t chars = bytes / unit_size; int dc[chars];
And the exception looks like this:
Unhandled exception: PC=0x1019ca8 PFA=0xfffd075a LdrFlgs=0x0
The actual cause of the exception is an access to an element in the dc array.
When I eventually get back to my own experiments with initiating programs in L4Re - not involved with the problem reported here - I intend to look more closely at program stack allocation and expansion strategies, so I suppose this is an appropriate prelude to such work.
Thanks for any guidance that might be offered, as always!
Paul
l4-hackers@os.inf.tu-dresden.de