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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Sep 18 20:29:14 BST 2023


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

--- Comment #52 from Dmitry Selyutin <ghostmansd at gmail.com> ---
Folks, I've played a bit more with these shiny system call tables, and added a
simple class which can be used as a basis for ppc/ppc64/i386/amd64 conversion:

https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;h=b80670cfb193d148ff0419a14318e0f63900ef76

Usage example:

    from openpower.syscalls import Dispatcher

    dispatcher = Dispatcher(guest="ppc", host="amd64", logger=print)
    print(dispatcher(identifier=20))
    print(dispatcher(identifier=207))
    print(dispatcher.getpid())
    print(dispatcher.gettid())


This works as if somebody arrived to us with system calls 20 and 207 on PPC and
attempted to wrap their execution to amd64 (which luckily is the platform I
use). Basically it checks guest syscall table by identifier, finds the entry,
then finds the backward mapping in host syscall table, then briefly inspects
the arguments count (though we might even attempt to validate these). I also
added a wrapper to call them by names, not just identifiers. The output is:

getpid 20 => 39
15293
getpid 20 => 39
15293
gettid 207 => 186
15293
gettid 207 => 186
1529

Note that these are equal due to obvious reasons (I'm too lazy to fork a
thread).

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


More information about the libre-soc-bugs mailing list