fix risc-v gp(global pointer register) problem

This commit is contained in:
acevest
2019-09-24 10:19:57 +08:00
parent 0872cbfbd4
commit c972a9cf5b
2 changed files with 5 additions and 1 deletions

View File

@@ -101,6 +101,10 @@ __KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
}
#endif
cpu_data_t gp;
asm("mv %0, gp"::"r"(gp));
regs->gp = (cpu_data_t)gp; // gp: global pointer
regs->a0 = (cpu_data_t)arg; // a0: argument
regs->ra = (cpu_data_t)0xACE00ACE; // ra: return address
regs->mstatus = (cpu_data_t)(MSTATUS_MPP | MSTATUS_MPIE); // return to machine mode and enable interrupt

View File

@@ -175,7 +175,7 @@
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.usenewlibnosys.584568698" name="Do not use syscalls (--specs=nosys.specs)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.usenewlibnosys" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.other.328577347" name="Other linker flags" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.other" useByScannerDiscovery="false" value="-W -mno-relax" valueType="string"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.other.328577347" name="Other linker flags" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.other" useByScannerDiscovery="false" value="" valueType="string"/>
<inputType id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.input.316705344" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.input">