Hacker News new | ask | show | jobs
by dgaudet 2489 days ago
since C pretty much requires a stack, and a stack requires "RAM" of some form, it used to be necessary that the memory system be trained prior to executing any C code. however once the cache grew large enough, and appropriate "cache as ram" hooks were designed, it became possible to stand up a stack before even the memory system was alive. this definitely reduces the footprint which has to be assembly.
2 comments

CAR definitely works when a typical CPU these days has more RAM than an entire PC from the early 90s, but it's something that BIOSes (even pre-UEFI) have been doing for a long time, probably ever since CPUs had built-in caches that were large enough.
8051 C Programmers remember their 8-bit stack pointer (256 words of stack space).

Enough for C to work out in most programs. Modern x86 systems have 64kB of L1 cache and 2MB of L3 cache to work with. Modern systems have more cache than the amount of full-RAM early systems had...

8051 programmers would love to have 256 bytes of stack (8051 word is byte). But because IRAM is needed for register banks (8-32 bytes, depending on how many you use), C library temporaries etc. you're really left with just 40-100 bytes of stack.