Skip to content

Commit

Permalink
or1k: Fix multicore stack calculation
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
roestefan authored and wallento committed Mar 10, 2016
1 parent 170db75 commit 64ea894
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions libgloss/or1k/or1k-internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

#include "include/or1k-support.h"

extern uint32_t* _or1k_stack_top;
extern uint8_t* _or1k_stack_top;
extern size_t _or1k_stack_size;
extern uint32_t* _or1k_stack_bottom;
extern uint8_t* _or1k_stack_bottom;

extern uint32_t* _or1k_exception_stack_top;
extern uint8_t* _or1k_exception_stack_top;
extern size_t _or1k_exception_stack_size;
extern uint32_t* _or1k_exception_stack_bottom;
extern uint8_t* _or1k_exception_stack_bottom;

#ifdef __OR1K_MULTICORE__
extern uint32_t* *_or1k_stack_core;
extern uint32_t* *_or1k_exception_stack_core;
extern uint8_t* *_or1k_stack_core;
extern uint8_t* *_or1k_exception_stack_core;
#endif


Expand Down
16 changes: 8 additions & 8 deletions libgloss/or1k/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@

#ifdef __OR1K_MULTICORE__
// Define pointers to arrays
uint32_t* *_or1k_stack_core;
uint32_t* *_or1k_exception_stack_core;
uint8_t* *_or1k_stack_core;
uint8_t* *_or1k_exception_stack_core;
uint32_t* *_or1k_exception_level;
#else
// Define scalar
uint32_t _or1k_exception_level;
#endif

uint32_t* _or1k_stack_top;
uint32_t* _or1k_stack_bottom;
uint8_t* _or1k_stack_top;
uint8_t* _or1k_stack_bottom;

uint32_t* _or1k_exception_stack_top;
uint32_t* _or1k_exception_stack_bottom;
uint8_t* _or1k_exception_stack_top;
uint8_t* _or1k_exception_stack_bottom;

void _or1k_init() {
#ifdef __OR1K_MULTICORE__
uint32_t c;

// Initialize stacks
_or1k_stack_core = _sbrk_r(0, sizeof(uint32_t*) * or1k_numcores());
_or1k_exception_stack_core = _sbrk_r(0, sizeof(uint32_t*) * or1k_numcores());
_or1k_stack_core = _sbrk_r(0, sizeof(uint8_t*) * or1k_numcores());
_or1k_exception_stack_core = _sbrk_r(0, sizeof(uint8_t*) * or1k_numcores());

_or1k_stack_core[0] = _or1k_stack_top;
_or1k_exception_stack_core[0] = _or1k_exception_stack_top;
Expand Down

0 comments on commit 64ea894

Please sign in to comment.