next up previous contents
Next: Threads Up: Overview Previous: Execution Model

Memory Model

All memory is shared, as are devices (which are typically in the address space) and any other resources in the machine. In fact, no paging support or protection modes are required or implied. The layout of memory is exactly that designed into the hardware.

The basic memory model is similar to that of a single UNIX process. The (usually) low addresses contain processor tables and the executable code. This is typically known as the ``.text'' section and goes in ROM, if ROM is available.

Above that, there is initialized data, uninitialized data and heap space. These ``.data'' and ``.bss'' sections go into RAM. The heap space is ram not otherwise allocated to a section. malloc/free and the default new/delete operators allocate memory from a default heap, but programmers can create other heaps of specialized memory if required.

When appropriate for the CPU at hand, the first stack is placed in high ram and grows downward. Other stacks can exist anywhere in the known RAM and are allocated by the programmer when creating threads. uCR does not support dead zones (which would require paging support) so a stack overrun will make a mess. Be careful, and make sure you allocate sufficient stack space.

If the processor stack grows upwards, the initial stack must be explicitly placed, although some targets have preallocated main stacks. You will have to guess the size of the stack and live within those means, which you must do with all the other stacks anyhow.


next up previous contents
Next: Threads Up: Overview Previous: Execution Model
Stephen Williams
9/2/1997