Jacob Lifshay [Thu, 7 Dec 2023 08:55:22 +0000 (00:55 -0800)]
load_elf: dump a sequence of gdb commands for easy debugging
dumps a sequence of gdb commands that can easily be copied from
the output and pasted into gdb to reset the stack to what load_elf
uses, instead of what gdb's execve does.
Jacob Lifshay [Thu, 7 Dec 2023 08:53:20 +0000 (00:53 -0800)]
MemMMap: fix brk_syscall -- use unrounded input address as heap end
it should use the input address as given when tracking the end of
the heap and returning addresses. it still needs to align addresses
when mapping/unmapping pages.
Jacob Lifshay [Thu, 7 Dec 2023 08:52:48 +0000 (00:52 -0800)]
load_elf: add forgotten auxv entries
Jacob Lifshay [Thu, 7 Dec 2023 07:36:14 +0000 (23:36 -0800)]
load_elf: copy linux's auxv, argv, and env layout
Jacob Lifshay [Wed, 6 Dec 2023 09:11:56 +0000 (01:11 -0800)]
load_elf: match linux better for statically-linked binaries
we still need more auxv entries, but the rest should match close
enough now.
Jacob Lifshay [Wed, 6 Dec 2023 09:09:42 +0000 (01:09 -0800)]
elf/simple_cases: enable debug info for statically-linked glibc demo
Jacob Lifshay [Wed, 6 Dec 2023 09:08:25 +0000 (01:08 -0800)]
MemMMap: raise error for bad load/fetch addresses when emulating mmap
Jacob Lifshay [Wed, 6 Dec 2023 09:07:42 +0000 (01:07 -0800)]
caller.py: don't try to make zero-sized memory accesses, they error
Jacob Lifshay [Wed, 6 Dec 2023 09:06:26 +0000 (01:06 -0800)]
test/elf/__init__: make objdump go to default log kind -- it's quieter
Jacob Lifshay [Mon, 4 Dec 2023 10:15:47 +0000 (02:15 -0800)]
caller.py: implement writev syscall
Jacob Lifshay [Mon, 4 Dec 2023 10:15:30 +0000 (02:15 -0800)]
fixedsync.mdwn: add sync instruction
Jacob Lifshay [Mon, 4 Dec 2023 10:13:52 +0000 (02:13 -0800)]
MemMMap: use modified_pages.discard instead of remove since pages may not be modified
Jacob Lifshay [Mon, 4 Dec 2023 09:45:23 +0000 (01:45 -0800)]
test/ldst: add fixedsync tests for b/h/w/d ll/sc, but not quadword
quadword probably doesn't work correctly and probably requires a bit of work
Jacob Lifshay [Mon, 4 Dec 2023 09:43:26 +0000 (01:43 -0800)]
major/minor_62: add FIXMEs to lq/stq to match the FIXMEs on lqarx/stqcx.
Jacob Lifshay [Mon, 4 Dec 2023 09:42:31 +0000 (01:42 -0800)]
fixedsync/minor_31: add stqcx. because I'm adding the others anyway
Jacob Lifshay [Mon, 4 Dec 2023 09:41:04 +0000 (01:41 -0800)]
fixedsync/minor_31: add lqarx because I'm adding the others anyway
Jacob Lifshay [Mon, 4 Dec 2023 09:37:29 +0000 (01:37 -0800)]
minor_62.csv: add unofficial and comment2 fields
Jacob Lifshay [Mon, 4 Dec 2023 09:36:57 +0000 (01:36 -0800)]
major.csv: add unofficial and comment2 fields
Jacob Lifshay [Mon, 4 Dec 2023 08:23:09 +0000 (00:23 -0800)]
fixedsync.mdwn: implement other sizes: lbarx lharx ldarx stbcx. sthcx. stdcx.
still unimplemented: lqarx and stqcx.
Jacob Lifshay [Mon, 4 Dec 2023 08:21:15 +0000 (00:21 -0800)]
fixedsync.mdwn: fix stwcx. pseudocode
Jacob Lifshay [Mon, 4 Dec 2023 08:19:31 +0000 (00:19 -0800)]
ISACaller: add PowerISA spec. reference for real_page_size
Jacob Lifshay [Mon, 4 Dec 2023 08:18:10 +0000 (00:18 -0800)]
ISACaller: implement real_addr pseudo-code helper
Jacob Lifshay [Mon, 4 Dec 2023 08:17:02 +0000 (00:17 -0800)]
test/state: support memory in ExpectedState
Luke Kenneth Casson Leighton [Sun, 3 Dec 2023 20:30:27 +0000 (20:30 +0000)]
add initial lwarx unit test and pseudocode
Luke Kenneth Casson Leighton [Sun, 3 Dec 2023 18:42:57 +0000 (18:42 +0000)]
add WIP lrsc mdwn for stbcx
Luke Kenneth Casson Leighton [Sun, 3 Dec 2023 10:11:28 +0000 (10:11 +0000)]
take every opportunity *not* to go onto a separate line with commas
bad:
- log("is priv", instr_is_privileged, hex(self.msr.value),
- self.msr[MSRb.PR])
good:
- if instr_is_privileged and self.msr[MSRb.PR] == 1:
+ PR = self.msr[MSRb.PR]
+ log("is priv", instr_is_privileged, hex(self.msr.value), PR)
+ if instr_is_privileged and PR == 1:
Jacob Lifshay [Sun, 3 Dec 2023 08:51:13 +0000 (00:51 -0800)]
elf/simple_cases: add hello world statically-linked to glibc
it errors when reaching stwcx.
Jacob Lifshay [Sun, 3 Dec 2023 09:23:04 +0000 (01:23 -0800)]
caller.py: implement readlink/readlinkat syscalls
Jacob Lifshay [Sun, 3 Dec 2023 08:49:08 +0000 (00:49 -0800)]
caller.py: implement a pile of syscalls
this implements read, mmap, mmap2, brk, openat, uname, and newuname.
it also stubs out munmap, mprotect, and pkey_mprotect so programs
don't crash cpython.
Jacob Lifshay [Sun, 3 Dec 2023 08:47:05 +0000 (00:47 -0800)]
load_elf: set mem.heap_range so brk works
Jacob Lifshay [Sun, 3 Dec 2023 08:46:01 +0000 (00:46 -0800)]
Mem: speed up log_fancy by using make_sim_state_dict()
Jacob Lifshay [Sun, 3 Dec 2023 08:44:48 +0000 (00:44 -0800)]
ppc_flags: include more headers for uname, openat, etc.
Jacob Lifshay [Sun, 3 Dec 2023 08:42:51 +0000 (00:42 -0800)]
syscalls/__init__: log which syscall is made
this is very handy when looking at logs, since you no longer have to
manually translate syscall numbers to syscall names.
Jacob Lifshay [Sun, 3 Dec 2023 07:57:21 +0000 (23:57 -0800)]
MemMMap/SimState: speed up SimState.get_mem() for large memories
make MemMMap use struct.Struct.unpack_from to read a whole page at
once, rather than doing a sequence of loads. This makes an ELF
binary statically-linked to glibc able to run many instructions per
second rather than one every tens of seconds or so.
Jacob Lifshay [Sun, 3 Dec 2023 07:50:57 +0000 (23:50 -0800)]
MemMMap: log mmap calls
Jacob Lifshay [Sun, 3 Dec 2023 07:50:08 +0000 (23:50 -0800)]
mem.py: make MMapEmuBlock use hex for repr
Jacob Lifshay [Sun, 3 Dec 2023 07:45:41 +0000 (23:45 -0800)]
Mem: don't log loads when dumping, you'll see the memory dump anyway
this avoids a giant list of memory-load log messages immediately
followed by a much nicer memory dump, just show the memory dump
without logging every single load needed to create the memory dump.
This also makes memory-dumping faster for large memories.
Jacob Lifshay [Sun, 3 Dec 2023 03:23:22 +0000 (19:23 -0800)]
MemMMap: finish implementing brk_syscall
Luke Kenneth Casson Leighton [Sun, 3 Dec 2023 18:08:36 +0000 (18:08 +0000)]
project standard is to use c standard string specifiers NOT format
NOT php-style "f"
Luke Kenneth Casson Leighton [Sun, 3 Dec 2023 18:07:33 +0000 (18:07 +0000)]
project standard is to use c standard string specifiers NOT format
NOT php-style "f"
Luke Kenneth Casson Leighton [Sun, 3 Dec 2023 18:05:30 +0000 (18:05 +0000)]
project standard is to use c standard string specifiers NOT format
NOT php-style "f"
Luke Kenneth Casson Leighton [Sun, 3 Dec 2023 18:02:43 +0000 (18:02 +0000)]
project standard is to use c standard string specifiers NOT format
NOT php-style "f"
Luke Kenneth Casson Leighton [Sun, 3 Dec 2023 17:45:53 +0000 (17:45 +0000)]
bug 1228: dcbt* to match against nop, not dc* in ISACaller
Luke Kenneth Casson Leighton [Sun, 3 Dec 2023 11:32:28 +0000 (11:32 +0000)]
bug 1231: all dc* instructions to be treated as nop
https://bugs.libre-soc.org/show_bug.cgi?id=1231#c1
Jacob Lifshay [Fri, 1 Dec 2023 20:57:34 +0000 (12:57 -0800)]
elf/simple_cases: deepcopy is unnecessary, call dict.copy
Luke Kenneth Casson Leighton [Fri, 1 Dec 2023 17:49:51 +0000 (17:49 +0000)]
bug 1169: elf-support correct syntax errors
Luke Kenneth Casson Leighton [Fri, 1 Dec 2023 14:42:25 +0000 (14:42 +0000)]
bug 1169: elf support, minor coding style adjustment, clearer
Jacob Lifshay [Fri, 1 Dec 2023 09:17:05 +0000 (01:17 -0800)]
openpower/test/elf/simple_cases: add some simple ELF test cases
Jacob Lifshay [Fri, 1 Dec 2023 07:55:41 +0000 (23:55 -0800)]
add utilities for testing ELF files
Jacob Lifshay [Fri, 1 Dec 2023 07:54:48 +0000 (23:54 -0800)]
SimRunner: support running an ELFFile
Jacob Lifshay [Fri, 1 Dec 2023 07:51:08 +0000 (23:51 -0800)]
ISACaller: support loading an ELFFile
Jacob Lifshay [Fri, 1 Dec 2023 07:46:50 +0000 (23:46 -0800)]
mem.py: add load_elf
Jacob Lifshay [Fri, 1 Dec 2023 07:40:51 +0000 (23:40 -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.
Jacob Lifshay [Fri, 1 Dec 2023 07:29:18 +0000 (23:29 -0800)]
caller.py: implement write syscall
Jacob Lifshay [Fri, 1 Dec 2023 07:27:48 +0000 (23:27 -0800)]
caller.py: implement exit_group syscall
Jacob Lifshay [Fri, 1 Dec 2023 07:15:45 +0000 (23:15 -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.
Jacob Lifshay [Thu, 30 Nov 2023 03:04:26 +0000 (19:04 -0800)]
setup: add pyelftools v0.30 as dependency
Jacob Lifshay [Mon, 27 Nov 2023 05:43:46 +0000 (21:43 -0800)]
add g++-powerpc64le-linux-gnu to .gitlab-ci.yml
Jacob Lifshay [Mon, 27 Nov 2023 03:14:21 +0000 (19:14 -0800)]
add mmap_syscall tests
Jacob Lifshay [Mon, 27 Nov 2023 03:13:25 +0000 (19:13 -0800)]
implement MemMMap.mmap_syscall
Jacob Lifshay [Mon, 27 Nov 2023 03:11:35 +0000 (19:11 -0800)]
add ppc_flags.py so we can get the ppc versions of all the flags we need
tells gcc to dump all #defines, and parses that.
Luke Kenneth Casson Leighton [Fri, 1 Dec 2023 17:57:12 +0000 (17:57 +0000)]
replace print() with log()
Luke Kenneth Casson Leighton [Fri, 1 Dec 2023 17:54:16 +0000 (17:54 +0000)]
replace print() with log()
Luke Kenneth Casson Leighton [Fri, 1 Dec 2023 17:52:24 +0000 (17:52 +0000)]
replace print() with log()
Jacob Lifshay [Thu, 30 Nov 2023 22:55:08 +0000 (14:55 -0800)]
pytest: try to improve scheduling
Jacob Lifshay [Thu, 30 Nov 2023 22:54:05 +0000 (14:54 -0800)]
test_caller_svp64_powmod: rename to test_aaa_caller_svp64_powmod so pytest tries to run it earlier
Jacob Lifshay [Thu, 30 Nov 2023 22:21:36 +0000 (14:21 -0800)]
speed up CI by disabling logging and VCD generation
Jacob Lifshay [Thu, 30 Nov 2023 22:20:54 +0000 (14:20 -0800)]
test/runner: allow disabling VCD using SIM_NO_VCD=1 env var
Jacob Lifshay [Tue, 17 Oct 2023 05:22:50 +0000 (22:22 -0700)]
powmod asm tests pass!
Jacob Lifshay [Mon, 16 Oct 2023 23:09:07 +0000 (16:09 -0700)]
switch powmod to using new divmod implementation -- test not enabled yet
Jacob Lifshay [Mon, 16 Oct 2023 23:08:44 +0000 (16:08 -0700)]
call log, not print
Jacob Lifshay [Mon, 16 Oct 2023 22:39:17 +0000 (15:39 -0700)]
make parser work for pypy
pypy's ast classes' constructors seem to only work if all arguments or
no arguments are passed, not only some of them.
Jacob Lifshay [Mon, 16 Oct 2023 04:17:09 +0000 (21:17 -0700)]
add comments telling people to keep the asm and python versions in sync
Jacob Lifshay [Mon, 16 Oct 2023 04:06:02 +0000 (21:06 -0700)]
divmod: asm version of Knuth's algorithm D works!
Jacob Lifshay [Mon, 16 Oct 2023 03:59:36 +0000 (20:59 -0700)]
add labels to DIVMOD REGEX log
Jacob Lifshay [Mon, 16 Oct 2023 03:54:12 +0000 (20:54 -0700)]
put DIVMOD REGEX under new LogType: LogType.OutputMatching
Jacob Lifshay [Fri, 13 Oct 2023 22:13:15 +0000 (15:13 -0700)]
WIP divmod: finished writing out asm knuth's algorithm d, still buggy
Jacob Lifshay [Thu, 12 Oct 2023 03:29:51 +0000 (20:29 -0700)]
WIP getting asm version of knuth's algorithm d working
Jacob Lifshay [Wed, 11 Oct 2023 05:07:17 +0000 (22:07 -0700)]
WIP divmod: implemented division by single word
Jacob Lifshay [Wed, 11 Oct 2023 05:05:49 +0000 (22:05 -0700)]
support ignoring integer registers for ExpectedState
Jacob Lifshay [Wed, 11 Oct 2023 05:03:38 +0000 (22:03 -0700)]
convert assigned values to SVSHAPE when writing to SVSHAPE[0-3] SPRs
this makes mtspr SVSHAPE0, reg properly maintain ISACaller invariants
Jacob Lifshay [Tue, 10 Oct 2023 04:05:17 +0000 (21:05 -0700)]
add WIP Knuth's algorithm D assembly
Jacob Lifshay [Tue, 10 Oct 2023 03:38:30 +0000 (20:38 -0700)]
divmod: assign registers to variables
Jacob Lifshay [Tue, 10 Oct 2023 03:35:40 +0000 (20:35 -0700)]
adapt divmod algorithm for putting variables in registers
Jacob Lifshay [Tue, 10 Oct 2023 03:30:43 +0000 (20:30 -0700)]
add more features for _DivModRegsRegexLogger
Jacob Lifshay [Tue, 10 Oct 2023 01:25:43 +0000 (18:25 -0700)]
finish moving Knuth algorithm D into a class
Jacob Lifshay [Tue, 10 Oct 2023 01:21:40 +0000 (18:21 -0700)]
merely indent function
[skip ci]
Jacob Lifshay [Tue, 10 Oct 2023 01:19:25 +0000 (18:19 -0700)]
start adding DivModKnuthAlgorithmD class
Jacob Lifshay [Tue, 10 Oct 2023 01:18:28 +0000 (18:18 -0700)]
format code
Jacob Lifshay [Mon, 9 Oct 2023 04:46:57 +0000 (21:46 -0700)]
finish writing python_divmod_knuth_algorithm_d
Jacob Lifshay [Mon, 9 Oct 2023 04:46:14 +0000 (21:46 -0700)]
fix generating invalid divmod tests
Jacob Lifshay [Mon, 9 Oct 2023 04:43:00 +0000 (21:43 -0700)]
speed up divmod shift-sub tests by removing most test cases
Jacob Lifshay [Sat, 7 Oct 2023 00:08:35 +0000 (17:08 -0700)]
add WIP knuth algorithm D python implementation
Jacob Lifshay [Fri, 6 Oct 2023 22:21:07 +0000 (15:21 -0700)]
rename divmod algorithm -> divmod_shift_sub in prep for adding divmod based on Knuth's Algorithm D
Jacob Lifshay [Fri, 6 Oct 2023 02:57:29 +0000 (19:57 -0700)]
add WIP powmod_256 -- asm test is currently disabled since divmod is too slow
Jacob Lifshay [Fri, 6 Oct 2023 02:53:45 +0000 (19:53 -0700)]
fix assemble to properly look for whole symbols to replace
previously if there were labels foo and foobar, it would partially
replace foobar giving 0x<addr>bar, which is wrong.
also optimized to use dict instead of linear search for label names
Luke Kenneth Casson Leighton [Thu, 30 Nov 2023 03:03:14 +0000 (03:03 +0000)]
whitespace in pseudocode to aid clarity
Luke Kenneth Casson Leighton [Mon, 27 Nov 2023 10:08:43 +0000 (10:08 +0000)]
got sv.bc working for pospopcount
Luke Kenneth Casson Leighton [Mon, 27 Nov 2023 09:47:29 +0000 (09:47 +0000)]
try ctrtest mode in pospopcount
Luke Kenneth Casson Leighton [Thu, 23 Nov 2023 07:03:49 +0000 (07:03 +0000)]
reduce indentation