This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH or1k, 1/2] Fix multicore stack calculation


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

please apply the attached patch that fixes the stack calculation for
the OpenRISC libgloss.

Best,
Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlbhpewACgkQuMYtsrn2U9y26wCeN5GmdIo2cNjAqr1ANJucLU0u
q9MAn0b/TaJd+nht9aHjA5WlI4nj4o1n
=Ulg8
-----END PGP SIGNATURE-----
commit f3c4a4e095b0e80d5cef08e3f0c88f88a85c3134
Author: Stefan Roesch <stefan.roesch@tum.de>
Date:   Wed Mar 9 16:04:36 2016 +0100

    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)

diff --git a/libgloss/or1k/or1k-internals.h b/libgloss/or1k/or1k-internals.h
index b24ad13..3aabdb0 100644
--- a/libgloss/or1k/or1k-internals.h
+++ b/libgloss/or1k/or1k-internals.h
@@ -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
 
 
diff --git a/libgloss/or1k/util.c b/libgloss/or1k/util.c
index 5e853f3..d2ee84d 100644
--- a/libgloss/or1k/util.c
+++ b/libgloss/or1k/util.c
@@ -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;

Attachment: or1k_multicore_stack.patch.sig
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]