or1k: Add support for numcores and coreid sprs

These are needed when running GCC tests for newlib toolchains built with
multicore support.  Without these SPRs we get the following warnings
when running tests.

    spawn or1k-elf-run ./20000112-1.exe^M
    WARNING: l.mfspr with invalid SPR address 0x80^M
    WARNING: l.mfspr with invalid SPR address 0x81^M
    WARNING: l.mfspr with invalid SPR address 0x81^M
    WARNING: l.mfspr with invalid SPR address 0x81^M

Support is added by defining the SPRs in the cgen machine definition and
regenerating the machine code.  In or1k/or1k.c we initialize NUMCORES to
1 and COREID to 0 as the sim has only one CPU.  In or1k/traps.c we allow
returning the NUMCORES and COREID spr values in the mfspr function.

Signed-off-by: Stafford Horne <shorne@gmail.com>
This commit is contained in:
Stafford Horne
2025-06-01 06:39:01 +01:00
parent 942f6390e2
commit 5eb0dd3623
7 changed files with 330 additions and 273 deletions

View File

@@ -243,6 +243,8 @@
(.unsplice
(.map (.pmacro (n) (.splice SYS (.sym "ESR" n) (.add n #x40) (.str "Exception supervision register " n)))
(.iota #x10)))
(SYS COREID #x080 "Core identifier register")
(SYS NUMCORES #x081 "Number of cores register")
(.unsplice
(.map (.pmacro (n) (.splice SYS (.sym "GPR" n) (.add n #x400) (.str "General purpose register " n)))
(.iota #x200)))