Skip to content

Commit 64ea894

Browse files
roestefanwallento
authored andcommitted
or1k: Fix multicore stack calculation
Change the type of the stack pointers to enable pointer calculations at byte granularity, which is needed for the calculation of _or1k_stack_core[c] and _or1k_exception_stack_core[c] with _or1k_stack_size and _or1k_exception_stack_size. (util.c:53-54)
1 parent 170db75 commit 64ea894

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

libgloss/or1k/or1k-internals.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
#include "include/or1k-support.h"
88

9-
extern uint32_t* _or1k_stack_top;
9+
extern uint8_t* _or1k_stack_top;
1010
extern size_t _or1k_stack_size;
11-
extern uint32_t* _or1k_stack_bottom;
11+
extern uint8_t* _or1k_stack_bottom;
1212

13-
extern uint32_t* _or1k_exception_stack_top;
13+
extern uint8_t* _or1k_exception_stack_top;
1414
extern size_t _or1k_exception_stack_size;
15-
extern uint32_t* _or1k_exception_stack_bottom;
15+
extern uint8_t* _or1k_exception_stack_bottom;
1616

1717
#ifdef __OR1K_MULTICORE__
18-
extern uint32_t* *_or1k_stack_core;
19-
extern uint32_t* *_or1k_exception_stack_core;
18+
extern uint8_t* *_or1k_stack_core;
19+
extern uint8_t* *_or1k_exception_stack_core;
2020
#endif
2121

2222

libgloss/or1k/util.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,27 @@
2424

2525
#ifdef __OR1K_MULTICORE__
2626
// Define pointers to arrays
27-
uint32_t* *_or1k_stack_core;
28-
uint32_t* *_or1k_exception_stack_core;
27+
uint8_t* *_or1k_stack_core;
28+
uint8_t* *_or1k_exception_stack_core;
2929
uint32_t* *_or1k_exception_level;
3030
#else
3131
// Define scalar
3232
uint32_t _or1k_exception_level;
3333
#endif
3434

35-
uint32_t* _or1k_stack_top;
36-
uint32_t* _or1k_stack_bottom;
35+
uint8_t* _or1k_stack_top;
36+
uint8_t* _or1k_stack_bottom;
3737

38-
uint32_t* _or1k_exception_stack_top;
39-
uint32_t* _or1k_exception_stack_bottom;
38+
uint8_t* _or1k_exception_stack_top;
39+
uint8_t* _or1k_exception_stack_bottom;
4040

4141
void _or1k_init() {
4242
#ifdef __OR1K_MULTICORE__
4343
uint32_t c;
4444

4545
// Initialize stacks
46-
_or1k_stack_core = _sbrk_r(0, sizeof(uint32_t*) * or1k_numcores());
47-
_or1k_exception_stack_core = _sbrk_r(0, sizeof(uint32_t*) * or1k_numcores());
46+
_or1k_stack_core = _sbrk_r(0, sizeof(uint8_t*) * or1k_numcores());
47+
_or1k_exception_stack_core = _sbrk_r(0, sizeof(uint8_t*) * or1k_numcores());
4848

4949
_or1k_stack_core[0] = _or1k_stack_top;
5050
_or1k_exception_stack_core[0] = _or1k_exception_stack_top;

0 commit comments

Comments
 (0)