Quantcast
Viewing all articles
Browse latest Browse all 5273

General • Re: How can I ensure memory coherence between cores?

Sometimes stack frames get surprisingly large
i sometimes had similar problems with my ext2/ext4 driver, and i found some tricks to help with that

first, compile your project with -fstack-usage
youll then get files like this:

Code:

[clever@amd-nixos:~/apps/rpi/lk-overlay]$ cat ./build-rpi3-test/lib/fs/ext2/dir.c.sudir.c:107:12:ext2_walk  640     staticdir.c:208:5:ext2_lookup 48      staticdir.c:218:10:ext2_opendir       64      staticdir.c:257:10:ext2_readdir       336     staticdir.c:318:10:ext2_closedir      16      static
and boom, 640 bytes of stack for ext2_walk()!
that function can also recursively call itself when it encounters a symlink, so that would just wreck a pico stack

second, the kernel i'm using has stack guards, so basically, there is a magic number at the bottom of the stack, and it will check that at various times, and warn you when youve blown the stack

Statistics: Posted by cleverca22 — Mon Jan 01, 2024 11:28 pm



Viewing all articles
Browse latest Browse all 5273

Trending Articles