[Libre-soc-bugs] [Bug 1169] Add ELF and mmap support to ISACaller -- no dynamic linking

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Fri Dec 1 09:51:26 GMT 2023


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

--- Comment #43 from Jacob Lifshay <programmerjake at gmail.com> ---
I got a statically-linked hello world to work! I also had to do a bunch of
debugging and fixing the syscall support, I cleaned up some of the kludges and
fixed the tests to match.

I made ISACaller call load_elf (through MemMMap.initialize), since that way
it's easier to use from both unit tests and from pypowersim. basically, you
just pass a ELFFile in instead of a Program.

ELF relocations aren't implemented yet...

https://git.libre-soc.org/?p=openpower-isa.git;a=shortlog;h=404f6e2ff5b321137448fac1d5642fc6d8e45ad2

commit 404f6e2ff5b321137448fac1d5642fc6d8e45ad2
Author: Jacob Lifshay <programmerjake at gmail.com>
Date:   Fri Dec 1 01:17:05 2023 -0800

    openpower/test/elf/simple_cases: add some simple ELF test cases

commit d8b3085bdd04006749e95339a4998d3e63132125
Author: Jacob Lifshay <programmerjake at gmail.com>
Date:   Thu Nov 30 23:55:41 2023 -0800

    add utilities for testing ELF files

commit 1dae051bb1ee50e1420472613aed3f8799e405f0
Author: Jacob Lifshay <programmerjake at gmail.com>
Date:   Thu Nov 30 23:54:48 2023 -0800

    SimRunner: support running an ELFFile

commit 1bbec2049bb76dbf2e40ccd2461daefa3c8f795f
Author: Jacob Lifshay <programmerjake at gmail.com>
Date:   Thu Nov 30 23:51:08 2023 -0800

    ISACaller: support loading an ELFFile

commit 0aac36feb016237c6523b6416a8419711cb919dc
Author: Jacob Lifshay <programmerjake at gmail.com>
Date:   Thu Nov 30 23:46:50 2023 -0800

    mem.py: add load_elf

commit 3bdcd0937ceb6788389679b7a465b7a1fab328a6
Author: Jacob Lifshay <programmerjake at gmail.com>
Date:   Thu Nov 30 23:40:51 2023 -0800

    mem.py: fix SIGBUS when accessing file mapped by mmap_syscall

    this fixes SIGBUS errors caused by accessing beyond the end of a
    file but still in the last page of the file, which is a valid thing to
    do, except that we have to account for host pages having a different
    size than emulated pages and map zeros to fill out the rest of the
    emulated page.

commit 3e1c1a5a256ecc6b93e04e6671a486dc3eb7f272
Author: Jacob Lifshay <programmerjake at gmail.com>
Date:   Thu Nov 30 23:29:18 2023 -0800

    caller.py: implement write syscall

commit 3d14be23fa58008aa8ed012295cd4d6fe3b45eb2
Author: Jacob Lifshay <programmerjake at gmail.com>
Date:   Thu Nov 30 23:27:48 2023 -0800

    caller.py: implement exit_group syscall

commit cdd445a72085ee3faa35826a2c0449907a0504f7
Author: Jacob Lifshay <programmerjake at gmail.com>
Date:   Thu Nov 30 23:15:45 2023 -0800

    ISACaller: fix syscall emulation

    there were two bugs fixed:
    1. sc emulation was missing a `return`, so it tried to run sc
       again after running sc and rfid, giving the wrong CIA and
       MSR values.
    2. the code to replace and restore the instruction with rfid
       had the wrong endian on the load, so it was corrupting the
       instruction for the next time it was used. I just deleted
       the save/replace/restore code since it isn't needed anymore.

    I then changed the syscall tests to ensure both the
    bugs above don't happen again.

commit dcd540c1055af5cabb2c18c67bbe5d6d1b70b744
Author: Jacob Lifshay <programmerjake at gmail.com>
Date:   Wed Nov 29 19:04:26 2023 -0800

    setup: add pyelftools v0.30 as dependency

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


More information about the libre-soc-bugs mailing list