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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Thu Sep 14 03:46:55 BST 2023


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

--- Comment #22 from Jacob Lifshay <programmerjake at gmail.com> ---
Andrey, while I was reading the code you wrote:
https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/test/syscall/syscall_cases.py;h=2e64315833810a7c38ee9733cba1e9e04e38ceeb;hb=1be8996cbea4d5bcb96ed9a91c2f0dbfcacf7ee1#l38

you need to pass a pointer to the bytes to the write syscall, not put the bytes
directly in the register.

so, to write data to memory, do:
initial_mem = {}
base_addr = 0x10000  # arbitrarily selected, must not overlap something else
for idx, v in enumerate(the_bytes):
    # write v as 1 byte at address idx + base_addr
    initial_mem[idx + base_addr] = v, 1
initial_regs[4] = base_addr  # pointer to start of data we just wrote
...
self.add_case(self.program, initial_regs, initial_mem=initial_mem, ...)

for an example, see:
https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/test/algorithms/svp64_utf_8_validation.py;h=054fd481dab0040dcb302f0506ab04bc8b52c864;hb=1be8996cbea4d5bcb96ed9a91c2f0dbfcacf7ee1#l352

in the example, note that those *_LUT constants are lists of enums, hence why I
used int(v) to convert them before assigning to initial_mem

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


More information about the libre-soc-bugs mailing list