From: kettenis Date: Sun, 2 May 2021 08:15:23 +0000 (+0000) Subject: Initialize the per-CPU pointer register early. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e59fe0f2bfbcae20c88c1af8f00183dcd21e9a71;p=openbsd Initialize the per-CPU pointer register early. ok drahn@ --- diff --git a/sys/arch/riscv64/riscv64/machdep.c b/sys/arch/riscv64/riscv64/machdep.c index d418d10383c..ad092e9ba2c 100644 --- a/sys/arch/riscv64/riscv64/machdep.c +++ b/sys/arch/riscv64/riscv64/machdep.c @@ -517,7 +517,6 @@ void initriscv(struct riscv_bootparams *rbp) { vaddr_t vstart, vend; - struct cpu_info *pcpup; long kvo = rbp->kern_delta; //should be PA - VA paddr_t memstart, memend; @@ -527,6 +526,9 @@ initriscv(struct riscv_bootparams *rbp) int (*map_func_save)(bus_space_tag_t, bus_addr_t, bus_size_t, int, bus_space_handle_t *); + /* Set the per-CPU pointer. */ + __asm volatile("mv tp, %0" :: "r"(&cpu_info_primary)); + // NOTE that 1GB of ram is mapped in by default in // the bootstrap memory config, so nothing is necessary // until pmap_bootstrap_finalize is called?? @@ -602,16 +604,6 @@ initriscv(struct riscv_bootparams *rbp) #endif } - /* Set the pcpu data, this is needed by pmap_bootstrap */ - // smp - pcpup = &cpu_info_primary; - - /* - * backup the pcpu pointer in tp to - * restore kernel context when entering the kernel from userland. - */ - __asm __volatile("mv tp, %0" :: "r"(pcpup)); - sbi_init(); cache_setup();//dummy for now