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
1fb2a1df44
Add interrupts enabled flag to spec, add interrupt return actions to spec
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-03-06 12:19:07 -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
bdd30274ed
Add interrupts draft to spec
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-03-04 14:23:57 -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
2b8663037f
First part of libvm transition
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-03-03 19:05:50 -05:00
74139b7c65
Remove defunct TODO from spec
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-03-03 18:34:56 -05:00
ef03ea9137
Update assembler infrastructure to be more modular
...
Assembler has more discrete passes now, but things are kind of bare on
the error message front. But, everything is working as it did
previously, so we can move on to more interesting things.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-03-03 18:10:08 -05:00
ad7c22c168
Remove include_paths() methods from AsmSession
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-28 15:08:17 -05:00
782a2ea4e9
Remove examples/constants.asm, update deadbeef.asm to not use it
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-27 17:33:44 -05:00
4b96902831
Scrap preprocessor, add .include directive instead
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-27 15:52:17 -05:00
0eb394ddf5
Update build.rs
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-26 14:27:30 -05:00
381a59f5fe
Clean up main.rs some, add preprocessor
...
* Preprocessor uses an LRPAR generated lexer and a custom parser to
filter comments and set defines. Includes and conditional compilation
will come next.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-26 14:24:30 -05:00
79d37a4e7b
Add documentation to the Source and Dest value_len() and len() functions
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-26 10:26:18 -05:00
44dc34e52d
Update spec for push and pop operations
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-26 10:25:46 -05:00
cd95011e7b
Add function call test
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-26 10:19:26 -05:00
a4e1d43a74
Add factorial asm example
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-26 10:16:38 -05:00
7a6c2d80ab
Add call/ret/push/pop instructions
...
* Call/ret/push/pop are implemented and appear to be working
* Call/ret/push/pop is specified in the 0x2000 block, replacing the
mov instruction
* Mov instruction is now specified in the 0x3000 block
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-26 10:14:48 -05:00
bd34cdad63
Add compile and compile_out options, and extended input/output options
...
* compile flag and compile_out argument to the driver allow the program
to be compiled only
* if '-' is supplied to compile_out, it will output to STDOUT instead
* if '-' is supplied to input, it will read from STDIN instead
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 18:12:28 -05:00
d11dbbcdf5
Add meta section len() and to_bytes()
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 17:56:16 -05:00
86d46b2a50
Add data section names and conversion to object file format
...
* Data section names are encoded in the object file format
* Objects can be converted into their file format layouts
* Add writing/reading test to make sure that an object converted to
bytes and then back from bytes is equal to hopefully catch major
object translations
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 16:39:32 -05:00
700ea6c54f
Add section name to data section spec
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 16:38:43 -05:00
461cf59bb0
Update intermediate object representation
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 15:08:49 -05:00
ef83cf7ef3
Add max_mem and size parsing for arg parsing
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 14:55:14 -05:00
b4637e2070
Comments in main.rs
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 14:21:39 -05:00
07abfc96b5
Add structopt for arg parsing
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 14:19:12 -05:00
bc4f59ecad
Add bitwise tests, squash all arithmetic tests into test_arithmetic
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 14:10:21 -05:00
362590292a
Add some integration tests and runner
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 13:48:03 -05:00
145739aee2
Add brackets to lexer in preparation for arrays
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 13:47:28 -05:00
0ff189bc1b
Minor code cleanup and surpress warnings for unused inst and register constants
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 13:46:38 -05:00
b8a769c80f
Add sized int value defs
...
Integer value definitions now respect their sizes (.u8, .u16, etc)
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 13:45:41 -05:00
1c05b3bb44
Update main to return the given status instead of printing the status out when halted
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 13:45:04 -05:00
aff2da591b
Add rerun_except crate to prevent building when .asm files are changed
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 13:44:15 -05:00
795a890502
Add IDiv instruction for signed integer division
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 13:44:03 -05:00
5619c9dc87
Add address deref, syntax, and deref sizes
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-25 12:07:24 -05:00
bdd08c6c5b
Fix bug when generating single-source instructions
...
Single-source instructions need their source spec to be in the the top 4
bits of the source/dest spec, and it was incorrectly being set in the
bottom 4 bits. This affected jump instructions, as they would
be reading the instruction at the given address rather than jumping
to it.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-19 14:11:57 -05:00
2413f9f362
Remove LALRPOP parser
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-18 17:55:11 -05:00
b0ef49bc2a
Add assembler and execution logic
...
Most everything works, but there's one small bug with the execution
involving jumps - still have to figure that one out.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-18 17:44:41 -05:00
0598bd1526
Rename vm::common -> vm::addr
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-17 16:22:15 -05:00
bf6b0dfba9
Remove vm::obj::assemble mod
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-17 16:17:55 -05:00
2c4b56e362
Use lrpar for parsing, big 'ol syntax overhaul
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-17 16:15:06 -05:00
cf9ba376aa
Add value directives and strings
...
.string, .zstring, .u64, .u32, .u16, .u8 are used before an ImmValue to
determine how the memory should be laid out for that value.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-11 17:49:17 -05:00
95d4eb0a60
Move test.asm -> examples directory
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-11 13:57:33 -05:00
6feeeea028
Add binary number parsing
...
Signed-off-by: Alek Ratzloff <alekratz@gmail.com >
2020-02-10 19:10:17 -05:00