target/openrisc: Make coreid and numcores variable
authorStafford Horne <shorne@gmail.com>
Sat, 17 Jun 2017 16:50:06 +0000 (01:50 +0900)
committerStafford Horne <shorne@gmail.com>
Fri, 20 Oct 2017 21:35:47 +0000 (06:35 +0900)
Previously coreid and numcores were hard coded as 0 and 1 respectively
as OpenRISC QEMU did not have multicore support.

Multicore support is now being added so these registers need to have
configured values.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Stafford Horne <shorne@gmail.com>
target/openrisc/sys_helper.c

index abdef5d6a51c3dc5f3efbb4716865c29e444efa9..dc6e5cc7f27df68e96df951dd4bb92a4f6c51583 100644 (file)
@@ -23,6 +23,7 @@
 #include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 #include "exception.h"
+#include "sysemu/sysemu.h"
 
 #define TO_SPR(group, number) (((group) << 11) + (number))
 
@@ -249,10 +250,10 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env,
         return env->esr;
 
     case TO_SPR(0, 128): /* COREID */
-        return 0;
+        return cpu->parent_obj.cpu_index;
 
     case TO_SPR(0, 129): /* NUMCORES */
-        return 1;
+        return max_cpus;
 
     case TO_SPR(0, 1024) ... TO_SPR(0, 1024 + (16 * 32)): /* Shadow GPRs */
         idx = (spr - 1024);