[Libre-soc-bugs] [Bug 982] Support PowerPC ABI in ISACaller

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Wed Oct 18 20:47:17 BST 2023


https://bugs.libre-soc.org/show_bug.cgi?id=982

--- Comment #97 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Dmitry Selyutin from comment #96)
> I had to jiggle the commits somewhat due to addition of the arguments, and
> also I decided that it's better for syscall tests to be decoupled.
> 
> 1. Redundant check for SVP64 is dropped:

great

> https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;
> h=ba551ab85cb1dd7a0fd283b9fe3f70781429fc9c
> 
> 2. use_syscall_emu parameter is now supported in test_runner, caller and
> runner modules:

exxxcellent. the enabling mmap is good. otherwise it all goes horribly
awry...

> https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;
> h=91d8332a0ea5fa54ebdfe070a4ef383f1189dc64
> https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;
> h=1776e7690367a5f24f32722283a322560d345f55
> https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;
> h=434cdd300e70fcb307f8d00b0553ec19ea67952a
> 
> 3. Host-backed memory is now activated with some croaking around:

yehh no surpriiise but a good way to do it

> https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;
> h=c35dd70d41b1ccea51319071d80b18b723692f13
> 
> 4. Tests are decoupled, the commit which poked test_caller.py is dropped:

gooood.

> https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;
> h=e69f8bfcc7c7c04459c408cdc5c06e3680ebc926
> 
> Is there anything else to be added considering the description and the title
> of the task?

ok there is a unit test needed in trap_cases.py (see comment #94)
which will demonstrate why the following is not correct to do:


1952         # TODO, asmregs is from the spec, e.g. add RT,RA,RB
1953         # see http://bugs.libre-riscv.org/show_bug.cgi?id=282
1954         asmop = yield from self.get_assembly_name()
1955         log("call", ins_name, asmop,
1956             kind=LogKind.InstrInOuts)
1957 

      (put a comment here please, "in user mode emulate syscalls"
       or something)

1958         if asmop in ("sc", "scv"):
1959             if self.syscall is not None:
1960                 identifier = self.gpr(0)
1961                 arguments = map(self.gpr, range(3, 9))
1962                 result = self.syscall(identifier, *arguments)
1963                 self.gpr.write(3, result, False, self.namespace["XLEN"])
1964                 self.update_pc_next()
1965                 return
1966     >>>     else:   <<<<
1967     >>>>        self.call_trap(0x700, PIb.ILLEG) <<<<
1968     >>>         return <<<<

what lines 1966 to 1968 are doing is making "sc" *ILLEGAL* to
even execute.  

if scemu is not active (equivalent of qemu-user) you *MUST*
let sc's pseudocode be executed just like any other instruction:
https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=openpower/isa/system.mdwn;h=74f06c50#l13

   7 # System Call
   8 
   9 SC-Form
  10 
  11 * sc LEV
  12 
  13 Pseudo-code:
  14 
  15     SRR0 <-iea CIA + 4
  16     SRR1[33:36] <- 0
  17     SRR1[42:47] <- 0
  18     SRR1[0:32]  <- MSR[0:32]
  19     SRR1[37:41] <- MSR[37:41]
  20     SRR1[48:63] <- MSR[48:63]
  21     MSR <- new_value
  22     NIA <- 0x0000_0000_0000_0C00
  23 
  24 Special Registers Altered:
  25 
  26     SRR0 SRR1 MSR


so those three lines must go, as they prohibit us from running
the "sc" instruction when the simulator is in the same type
of mode as "qemu-system".

i will write an sc unit test and commit it so that you can run it,
and see what i mean ok?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list