Homebrew Can I increase stack size beyond 65535? (libctru)

  • Thread starter Thread starter ske2004
  • Start date Start date
  • Views Views 250
  • Replies Replies 4

ske2004

New Member
Newbie
Joined
Nov 2, 2025
Messages
3
Reaction score
0
Trophies
0
Age
21
XP
8
Country
Brazil
Hello! I'm new to homebrew, sorry if this isn't the right place.

I'm using libctru to run a custom scripting language. At one point it allocates around 64kb of memory onto stack and causes stack smashing.

There's a weak symbol called __stacksize__, so I can set a custom stack size, but it's a uint16, so it's limited to 64kb. Is this an inherent limitation of 3DS or ARM, or limtation chosen by libctru?

(maybe better to move those 64k to heap but they're very temporary >o>)
 
I saw that in `ExHeader_CodeSetInfo` stack_size is a u32.
(10 minutes later)
It maybe possible! `initSystem` is weak too, that's where the stack is set up.
 
Lol, I'm dumb. `word` in arm is 32 bit, not 16 bit.
But it's weird that setting stack size to 0x10000 doesn't work
Post automatically merged:

Oh my god, I'm dumb. When I exported it as `uint16_t __stacksize__ = 0xFFFF` it worked, but when I did `uint32_t __stacksize__ = 0x10000` it didn't. Of course, when I declared it as `uint16_t` it probably took some junk bytes around it and it happened to fit, but `0x10000` just wasn't enough xd

Case closed! thanks everyone!
 
Last edited by ske2004,

Site & Scene News

Popular threads in this forum