Commit Graph

2769 Commits

Author SHA1 Message Date
wtfsck 7c36c1e96d Merge branch 'master' into java 2022-07-07 21:32:29 +02:00
wtfsck c894e45cb4 Add build-java, update yml and other files 2022-07-07 21:28:36 +02:00
wtfsck 456e293989 Add empty Java `README.md` 2022-07-07 21:28:30 +02:00
wtfsck 255449818d Only gen `db`/`dw`/`dd`/`dq` tests in one of the files 2022-07-03 21:58:32 +02:00
wtfsck ab06c8ef66 Indent generated methods 2022-07-03 14:40:43 +02:00
wtfsck e657c5514f Pass a `StringComparer` instance to `Dictionary` ctor 2022-07-03 14:40:38 +02:00
wtfsck af43714434 Add Java `CodeAssembler` tests 2022-07-03 13:59:37 +02:00
wtfsck 985b215f8f Throw NPE 2022-07-02 22:10:54 +02:00
wtfsck ef6edd2b18 Add Java `Formatter` tests 2022-07-02 21:51:49 +02:00
wtfsck 7947e244ed Add `FileUtils.readAllLines()` 2022-07-02 21:51:40 +02:00
wtfsck 95914d09aa Remove `public` from test class 2022-07-02 21:51:31 +02:00
wtfsck 69d38a1844 Rename to `FormatterTestCase` 2022-07-02 21:51:25 +02:00
wtfsck 1e53394105 Remove `NumberBaseCount` and use `IcedConstants` 2022-07-02 21:51:18 +02:00
wtfsck 94b68ca62e Add back `0xFFFF` masks 2022-07-02 21:51:12 +02:00
wtfsck a8dee87ddc Fix Clippy (Rust 1.62.0) warnings 2022-07-02 21:51:05 +02:00
wtfsck a3e8b08e45 Add Java instruction info tests 2022-06-23 22:40:31 +02:00
wtfsck 12b0c7f510 Add Java block encoder tests 2022-06-23 22:40:24 +02:00
wtfsck beb9e70ea4 Add Java opcode info tests 2022-06-22 22:09:57 +02:00
wtfsck a3c07ab057 Add Java dec/enc tests 2022-06-22 22:09:52 +02:00
wtfsck b611eebc5c Store regs in `int` and return only low 16 bits (opcode bits) 2022-06-22 22:09:47 +02:00
wtfsck 01bceb16f2 Add Java encoder misc tests 2022-06-22 22:09:40 +02:00
wtfsck d313726070 Fix stuff discovered by encoder misc tests
- Mask `byte` with `0xFF`
- Call `getCode()` instead of `getOpCode()`
2022-06-22 22:09:35 +02:00
wtfsck 8c7bc3eacd Add Java `Encoder` tests 2022-06-22 22:09:29 +02:00
wtfsck e5ad1062a4 Add `[gs]etRawOpMask()` and update `Debug.Assert`
- Added `[gs]etRawOpMask()`, used by `Decoder` and `Encoder`
- Fix `Debug.Assert` to include ZeroBytesHandler that was added a while
  ago
2022-06-22 22:09:24 +02:00
wtfsck 81d1a854e0 Add Java instruction tests 2022-06-22 22:09:19 +02:00
wtfsck d38492e098 Fix stuff detected by instruction tests
- Throw `NullPointerException` if input is null, not
  `IllegalArgumentException`.
- `setMemoryDisplacement32()` now zero extends the input
- `getImmediate()` zero-extends the unsigned immediates (`imm{8,16,32}`)
- `ipRelativeMemoryAddress()` clears upper bits if reg is `EIP`
- `initializeSignedImmediate()` allows some more values since Java
  doesn't have unsigned numbers. Eg. allow `0xFF80` if it's a
  int8->int16 value.
- Encoder had some methods with params with the same name as some of its
  fields. Add `this.` to write to the field and not the param.
2022-06-22 22:09:13 +02:00
wtfsck e5b344ceac Copy instructions before mutating them 2022-06-22 22:09:03 +02:00
wtfsck a7386c085d Merge 2 dupe `CodeWriterImpl` classes 2022-06-22 22:08:59 +02:00
wtfsck c02876e64a Change byte/short param types to int 2022-06-22 22:08:54 +02:00
wtfsck c1547bcacc Add Java `Decoder` tests 2022-06-22 22:08:48 +02:00
wtfsck acd944d70f Add Java `junit-jupiter-params` dep 2022-06-21 23:54:04 +02:00
wtfsck 068f83d3ef Fix porting bugs discovered by the decoder tests
Most are due to Java having no unsigned numbers.

- `was_ulong = was_uint & 0xFFFF_FFFF` => `was_ulong = (long)was_uint & 0xFFFF_FFFFL`
- `was_ulong & 0xFFFF_FFFF` => `was_ulong & 0xFFFF_FFFFL`
- `was_ulong > 0xFFFF_FFFF` => `was_ulong > 0xFFFF_FFFFL`
- `was_ulong = was_uint` => `was_ulong = was_uint & 0xFFFF_FFFFL`
- `was_uint < value` => `Integer.compareUnsigned(was_uint, value) < 0`
- `was_ubyte` => `was_ubyte & 0xFF`
- Internal `Instruction` methods were removed since we can't make them
  `internal` so the public API was used but some of them required
  slightly different input (raw values).
    - `setOpMask()`
    - `setMemoryDisplSize()`
    - `setMemoryIndexScale()` => use new `setRawMemoryIndexScale()`
    - `InternalSetHasRepePrefix()` => repe=true, repne=false
    - `InternalSetHasRepnePrefix()` => repe=false, repne=true

Added/renamed:

- Added `setRawMemoryIndexScale()`
- Renamed `ByteArrayCodeReader.getCount()` => `size()`
2022-06-21 23:53:57 +02:00
wtfsck 21b986a0b2 Update generated str->int classes 2022-06-21 23:53:47 +02:00
wtfsck 90d1dec769 Add `HexUtils` 2022-06-21 23:53:42 +02:00
wtfsck 761633685f Change return type to `Iterable<T>` 2022-06-21 23:53:36 +02:00
wtfsck 556d34ee75 Add `NumberConverter` 2022-06-20 21:39:01 +02:00
wtfsck dc569ce982 Add `CodeUtils` 2022-06-20 21:38:56 +02:00
wtfsck 1893c983d7 Add `PathUtils` 2022-06-20 21:38:51 +02:00
wtfsck 6d7e440e72 Generate classes to convert string -> enum variants (tests) 2022-06-20 21:38:47 +02:00
wtfsck ad78eef4e6 Use `{@code XXX}` instead of `<code>XXX</code>` in javadocs 2022-06-20 21:38:37 +02:00
wtfsck d625bcf95a Add missing `final` to a few classes 2022-06-20 21:38:32 +02:00
wtfsck ea4293a66e Methods should start with a lowercase char 2022-06-20 21:38:26 +02:00
wtfsck 6f69cdbfbe Add missing `@Override` 2022-06-20 21:38:21 +02:00
wtfsck d40f82a03b Update `decode(Instruction)` docs 2022-06-20 21:38:16 +02:00
wtfsck fc0b9e091d Remove useless parens 2022-06-20 21:38:09 +02:00
wtfsck 876059ddbd Add back `internal` 2022-06-19 20:12:11 +02:00
wtfsck aedc0a20ac Use unsigned shr 2022-06-19 19:33:31 +02:00
wtfsck 11bf7f31c7 Update docs 2022-06-19 19:26:24 +02:00
wtfsck f15991baba Impl Java `Instruction.toString()` (masm formatter) 2022-06-19 19:21:32 +02:00
wtfsck 252c32a568 Add Java `StringOutput` 2022-06-19 19:21:27 +02:00