makes bootup multi core able
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <picotls.h>
|
#include <picotls.h>
|
||||||
|
#include <tx_port.h>
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define EXTERN_C extern "C"
|
#define EXTERN_C extern "C"
|
||||||
#else
|
#else
|
||||||
@@ -50,7 +50,6 @@ extern int main(void);
|
|||||||
|
|
||||||
// The linker script will place this in the reset entry point.
|
// The linker script will place this in the reset entry point.
|
||||||
// It will be 'called' with no stack or C runtime configuration.
|
// It will be 'called' with no stack or C runtime configuration.
|
||||||
// NOTE - this only supports a single hart.
|
|
||||||
// tp will not be initialized
|
// tp will not be initialized
|
||||||
void _start(void) {
|
void _start(void) {
|
||||||
// Setup SP and GP
|
// Setup SP and GP
|
||||||
@@ -64,6 +63,24 @@ void _start(void) {
|
|||||||
"la gp, __global_pointer$;"
|
"la gp, __global_pointer$;"
|
||||||
".option pop;"
|
".option pop;"
|
||||||
"la sp, _sp;"
|
"la sp, _sp;"
|
||||||
|
#if defined(__riscv_zicsr)
|
||||||
|
"csrr t0, mhartid;"
|
||||||
|
#else
|
||||||
|
"li t0, 0;"
|
||||||
|
#endif
|
||||||
|
"la t1, __stack_size;"
|
||||||
|
"la t1, __stack_size;"
|
||||||
|
"la sp, _sp;"
|
||||||
|
// Loop incase M extension is not present
|
||||||
|
"1:;"
|
||||||
|
"beqz t0, 2f;"
|
||||||
|
"sub sp, sp, t1;"
|
||||||
|
"addi t0, t0, -1;"
|
||||||
|
"j 1b;"
|
||||||
|
"2:;"
|
||||||
|
#ifdef TX_THREAD_SMP_MAX_CORES
|
||||||
|
"call _tx_thread_smp_initialize_wait;"
|
||||||
|
#endif
|
||||||
"jal zero, _initialize;"
|
"jal zero, _initialize;"
|
||||||
: /* output: none %0 */
|
: /* output: none %0 */
|
||||||
: /* input: none */
|
: /* input: none */
|
||||||
|
|||||||
Reference in New Issue
Block a user