Commit Graph

15 Commits

Author SHA1 Message Date
8c4a9991fd Fix dumb mistake in address calculation for interrupts, add more registers to interrupt call stack
Interrupts need to be on 8-byte (or 64-bit) bounds. I had mistakenly
decided to shift right by 5 (which isn't even dividing by 64, it's 32)
-but since this an address pointing at byte ranges, that should be
divided by 8, or >> 3.

Additionally, interrupts add all 32 general purpose registers to the
stack because otherwise they become useless.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-09 18:24:54 -04:00
d0f8d93edf Run rustfmt
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-09 16:47:30 -04:00
63c81f07f7 Fix alignment calculation and padding
Aligned values are a little funky, because the size of the line can't be
determined without knowing what address we're at. So the
DataLines iterator now takes a start address, so it is able to correctly
calculate alignment padding.

Also, the length of the data section uses the DataLines iterator now so
there isn't a complex re-implementation of the same logic.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-09 16:43:04 -04:00
65972fcbbe Change instruction encodings to avoid null instructions
Lots of null bytes in a row are a common thing, so the instructions
available can't start with a null pair of bytes anymore.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-09 15:11:32 -04:00
90155b0cb3 Add alignment syntax, datasection pos/line iterator, disassembler
* Interrupts require functions being aligned on 64-bit boundaries.
  Alignment is now allowed via the .align <intsize> directive, aligning
  the current address to a new alignment.
* Datasection iteration doesn't require keeping track of the current
  position.
* Rudimentary disassembler for breaking down the contents of an object

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-07 18:01:31 -05:00
1f93732a7c Reorganize instruction assembler logic (fixing a known bug), add interrupts to frontend
* Instruction assembler used to use macros for handling source,
  dest-source, source-source, etc instructions. It did not have a
  source-source implementation, however, so the two source-source
  instructions (cmpeq and cmplt) were treated as dest-source. This has
  been refactored into some local methods that handle this now.
* Syntax for interrupts and interrupt returns are implemented and appear
  to be working

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-06 12:53:07 -05:00
fbe2c529af Add decoding of INT and IRET instructions
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-06 12:52:46 -05:00
34b1147fe6 Add int and iret instruction definitions to the VM backend
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-06 12:30:49 -05:00
58262eab40 Move examples to libvm source base and add symlink to root directory
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-06 12:18:20 -05:00
b1f2de198e Add interrupt definition syntax and interrupt handling in VM execution state
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-06 12:17:05 -05:00
bf83601cdf Add interrupt struct and IVT reader
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-04 16:41:37 -05:00
ce352c000c Add IVT register and interrupt module
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-04 14:37:00 -05:00
711bfeb7f9 Squash some warnings
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-03 19:34:41 -05:00
bac1b413dc Remove structopt where appropriate
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-03 19:33:55 -05:00
5ffca7bcf0 Second part of VM lib transition
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2020-03-03 19:07:35 -05:00