Commit Graph

20 Commits

Author SHA1 Message Date
Kartik Agaram 2eb174d697 4908
Fix CI.

a) Update canonical binaries.
b) Fix an out-of-bounds access in `clear-stream`. This also required supporting
   a new instruction in `subx run` to load an imm8 into rm8.
2019-01-05 01:07:37 -08:00
Kartik Agaram 431627b242 4886 2018-12-28 21:26:42 -08:00
Kartik Agaram 51bf3554b7 4882 2018-12-28 10:43:00 -08:00
Kartik Agaram 5f3b3e7aea 4830
New helper: printing a byte in textual (hex) form.

This required adding instructions for bitwise shift operations.
2018-12-03 23:26:56 -08:00
Kartik Agaram 50dcc0c122 4776
Crenshaw compiler now runs natively as well.

It turns out I was misreading the Intel manual, and the jump instructions
that I thought take disp16 operands actually take disp32 operands by default
on both i686 and x86_64 processors. The disp16 versions are some holdover
from the 16-bit days.

This was the first time I've used one of these erstwhile-disp16 instructions,
but I still haven't tested most of them. We'll see if we run into future
issues.
2018-11-25 13:46:53 -08:00
Kartik Agaram 4524da2bb6 4718 2018-10-24 15:52:41 -07:00
Kartik Agaram bfc997cfda 4714
Improve error-checking for unnecessary displacement operands.
2018-10-23 23:18:31 -07:00
Kartik Agaram 0e0a90420e 4697 2018-10-14 00:29:48 -07:00
Kartik Agaram 0f851e48aa 4695 2018-10-14 00:00:39 -07:00
Kartik Agaram 06d9b1a541 4694
Check for duplicate docstrings.
2018-10-13 23:55:07 -07:00
Kartik Agaram 94ad882e82 4668 2018-10-05 21:30:22 -07:00
Kartik Agaram 7d4e351a0d 4503
Include LEA (load effective address) in the SubX subset of x86 ISA.
2018-09-22 23:19:39 -07:00
Kartik Agaram 45967d2106 4578 - subx: implement inc/dec operations 2018-09-21 16:03:31 -07:00
Kartik Agaram f75c7021d5 4544
Attempt #3 at fixing CI.
In the process the feature gets a lot less half-baked.

Ridiculously misleading that we had `has_metadata()` was special-cased
to one specific transform. I suck.
2018-09-12 21:27:04 -07:00
Kartik Agaram e07a3f2886 4537
Streamline the factorial function; we don't need to save a stack variable
into a register before operating on it. All instructions can take a stack
variable directly.

In the process we found two bugs:

a) Opcode f7 was not implemented correctly. It was internally consistent
but I'd never validated it against a natively running program. Turns out
it encodes multiple instructions, not just 'not'.

b) The way we look up imm32 operands was sometimes reading them before
disp8/disp32 operands.
2018-09-07 22:19:13 -07:00
Kartik Agaram f1b3d7b967 4527 - reading commandline arguments
The new example ex9 doesn't yet work natively.

In the process I've emulated the kernel's role in providing args, implemented
a couple of instructions acting on 8-bit operands (useful for ASCII string
operations), and begun the start of the standard library (ascii_length
is the same as strlen).

At the level of SubX we're just only going to support ASCII.
2018-08-30 01:15:45 -07:00
Kartik Agaram 3a5df2cbef 4503 2018-08-11 10:33:26 -07:00
Kartik Agaram 99e48220f9 4501 2018-08-11 10:22:51 -07:00
Kartik Agaram 90b01a1b27 4499
More tweaks for check passes. Ensure they're never first-class
transforms.
2018-08-09 21:46:12 -07:00
Kartik Agaram 7f7d3dcca5 4483
Reorganize layers in accordance with the plan in layer 29.
2018-08-04 23:16:07 -07:00