source: trunk/libs/newlib/src/libgloss/or1k/README @ 532

Last change on this file since 532 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.9 KB
Line 
1This document describes the internals of the port for OpenRISC
21000. The API is documented in or1k-support.h as Doxygen comments.
3
4# Data Structures
5
6+----------------+ 0x0
7|    vectors     |
8+----------------+
9|  text,data,..  |
10+----------------+
11|      bss       |
12+----------------+
13|      heap      |
14|       vv       |
15|                |
16|       ^^       |
17|    stack(s)    |
18+----------------+ _or1k_board_mem_base +
19                   _or1k_board_mem_size
20
21## Stack and Heap
22
23The stack is allocated at the end of available physical memory which
24is defined by each board as _or1k_board_mem_base and
25_or1k_board_mem_size. The _or1k_stack_top and _or1k_stack_bottom are
26determined by those variables and _or1k_stack_size (which may be
27overwritten in _or1k_board_init_early).
28
29A second stack for exceptions is allocated as we allow exceptions to
30be arbitrary complex and call C functions etc. It is not an option to
31re-use the current software stack as we want to be so generic, that
32this can also be a virtual memory stack at moment of exception. The
33exception starts below the normal software stack and is
34_or1k_exception_stack_size large.
35
36Multicore: For each core a stack and exception stack is allocated and
37the stack pointer set at boot. That is: sp(core0) = _or1k_stack_top,
38sp(core1) = _or1k_stack_top - _or1k_stack_size, etc.
39
40## _or1k_stack_core (multicore only)
41
42An array of pointers to the software stacks (size:
434*or1k_numcores()). It is dynamically allocated from heap in or1k_init
44by calling sbrk(). The pointers contain the values for stack top
45pointers as described above. This variable is essentially used on boot
46of the slave cores to configure the stack register.
47
48## _or1k_exception_stack_core (multicore only)
49
50An array of pointers to the exception stacks (size:
514*or1k_numcores()). It is allocated identical as the stack_core
52array. It is loaded whenever an exception occurs to start with a clean
53stack in the exception.
54
55## _or1k_exception_handler_table
56
57A table of function pointers to the handlers of the exceptions. The
58generic exception handler checks if an exception handler is registered
59and calls it. There are 30 exceptions defined (0x0 is not an exception
60vector and 0x100 is reset which is static). This array resides in BSS
61and is therefore initialized as 0 (no handler registered) after start.
62
63Multicore: As the number of course is not known at compile time, the
64variable is a pointer to and array of arrays (cores x 30) which is
65allocated in or1k_init() on heap (using sbrk).
66
67## _or1k_interrupt_handler_table and _or1k_interrupt_handler_table_data_ptr
68
69The interrupt handlers are stored identical to to the exception handler table.
70
71## _or1k_reent
72
73The struct _or1k_reent contains formerly global data and allows for
74reentrancy. In the single core case, this is an allocated object,
75while it is a pointer to an array of structs in the multicore library.
76It is allocated in _or1k_reent_init() on the heap.
77
Note: See TracBrowser for help on using the repository browser.