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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Sep 17 20:09:55 BST 2023


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

--- Comment #31 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Dmitry Selyutin from comment #30)
> Yeah, since git (almost) never forgets, I've already dropped the generated
> file. The link's still actual anyway (I committed a revert), so you might
> take a look.

i did. it's cool. would be nice to know what the function parameters are,
from somewhere. or at least the number of arguments, that's the most
critical information. is that known? i may have missed it

> Say we had invoked "sc" insn in ISACaller, and we have registers around.

sim.gpr (or, self.gpr)

> However, some of the registers are just pointers, some are descriptors.
> How'd I copy the memory from these simulated memory cells?

manually. see comment #26.  sim.mem (or, self.mem. look in mem.py)

> As for
> descriptors, we obviously cannot pass them as is, and we'll kinda end up
> doing parts of OS job (e.g. introducing a map of sim:host descriptors and
> vice versa).

siiiigh, yeeeees. i had a think and i don't believe the cavatools trick will
work in ISACaller: instead we will have to *literally* implement the syscalls
one by one.

as in: the implementation of write() would be done *by hand* by:

    fd = self.gpr(3)
    buf = self.gpr(4)
    count = self.gpr(5)
    actual_buf = bytes()
    for i in range(count):
       actual_bytes.append(self.mem.ld(buf+i, 1) # something like that
    self.gpr(3) = sys.write(fd, actual_bytes)

and errno somehow will need to get created/emulated/set, no idea how to do
that.

> I assume this needs a trap mechanism by system call identifier in simulator.
> Am I right?

yeeeees - i did describe it somewhere, you need to "spot that a jump to address
0xC00 has been made". normally this would ACTUALLY contain (in a linux kernel)
an ACTUAL implementation (binary code) of an ACTUAL systemcall/OS
implementation
however just like in riscv-spike and cavatools we are going to "hack it",
by enabling an option to ISACaller that just goes "if PC == xyz call this
special function instead of trying to execute instructions *AT* that address"

all quite dreadful but pretty standard - qemu, spike, cavatools - they all do
it.

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


More information about the libre-soc-bugs mailing list