Commit graph

31 commits

Author SHA1 Message Date
Fabian 75dbbbc55a Update rustfmt 2020-12-31 19:14:30 -06:00
Fabian ca2409b024 Pass asize_32 and get_seg_prefix to string instructions 2020-12-31 19:14:30 -06:00
Fabian 80a69939a1 c2rust cleanup: Use bool 2020-12-31 19:14:29 -06:00
Fabian 034ecd5390 c2rust cleanup: Remove unnecessary type annotations on let bindings 2020-12-31 19:14:29 -06:00
Fabian 764879bad1 s/reg32s/reg32 2020-12-31 19:14:29 -06:00
Fabian ce10336747 Minor: Remove unused functions 2020-08-30 19:37:15 -05:00
Fabian 7c4ed66c20 Cleanup: Rename trigger_gp_non_raising to trigger_gp 2020-08-30 19:37:15 -05:00
Fabian f14e9528d6 Custom code generation for cmovcc (0F40-0F4F) 2020-08-30 19:37:15 -05:00
Fabian 8d6baff91c Fix rustfmt 2020-08-30 19:29:54 -05:00
Fabian cb1348fdc7 c2rust cleanup: Restore hex constants 2020-08-30 19:29:54 -05:00
Fabian 435608d9f0 c2rust cleanup: Remove unused mut 2020-08-30 19:29:54 -05:00
Fabian d895985e83 c2rust cleanup: Turn while loops into for loops 2020-08-30 19:29:54 -05:00
Fabian 96b703f87c Keep track of whether fpu or mmx register has been written recently, store proper register in fx?save 2020-08-30 19:29:54 -05:00
Amaan Cheval 6cc262bdba cleanup: Use OrPageFault type alias for clarity 2020-08-30 19:29:54 -05:00
Fabian 3cb7f7a0b4 Clean up casts of physical and virtual addresses 2020-08-30 19:29:54 -05:00
Fabian 0a50a8474e c2rust cleanup: Remove unnecessary suffixes on numbers 2020-08-30 19:29:54 -05:00
Fabian b5ed5f7c5b c2rust cleanup: Remove -> () 2020-08-30 19:29:54 -05:00
Fabian cb80830881 c2rust cleanup: Enable mutable_transmutes warnings 2020-08-30 19:29:54 -05:00
Fabian 44bc613af3 c2rust cleanup: Remove dbg_log_c 2020-08-30 19:29:54 -05:00
Fabian ef796d7f62 c2rust cleanup: Remove fresh variables 2020-08-30 19:29:54 -05:00
Fabian 3a00eedf21 c2rust cleanup: Re-enable some warnings 2020-08-30 19:29:54 -05:00
Fabian d08f5fd460 c2rust cleanup: Fix comments 2020-08-30 19:29:54 -05:00
Fabian 2b27510198 sse: Warn on unimplemented mxcsr features 2020-08-30 19:29:54 -05:00
Fabian ebf9cb1750 Remove extern from functions 2020-08-30 19:29:53 -05:00
Fabian c489463c83 rust2c cleanup: Fix warnings 2020-08-30 19:29:53 -05:00
Fabian 4b34beeb79 c2rust cleanup: Use Rust imports instead of linking 2020-08-30 19:29:53 -05:00
Fabian a5cbf53da5 Fix jit in presence of new page fault handling
Makes the following a block boundary:

- push
- Any non-custom instruction that uses modrm encoding
- Any sse/fpu instruction

This commit affects performance negatively. In order to fix this, the
above instructions need to be implemented using custom code generators
for the memory access.
2020-08-30 19:29:53 -05:00
Fabian 2c47c85325 Fix format strings 2020-08-30 19:29:53 -05:00
Fabian 25949fff70 Handle page faults in instructions using return_on_pagefault and writable_or_pagefault 2020-08-30 19:29:53 -05:00
Fabian a88420910d Handle pagefaults without JS exceptions
This commit makes the return type of most basic memory access primitives
Result, where the Err(()) case means a page fault happened, the
instruction should be aborted and execution should continue at the page
fault handler.

The following primites have a Result return type: safe_{read,write}*,
translate_address_*, read_imm*, writable_or_pagefault, get_phys_eip,
modrm_resolve, push*, pop*.

Any instruction needs to handle the page fault cases and abort
execution appropriately. The return_on_pagefault! macro has been
provided to get the same behaviour as the previously used JS exceptions
(local to the function).

Calls from JavaScript abort on a pagefault, except for
writable_or_pagefault, which returns a boolean. JS needs to check
before calling any function that may pagefault.

This commit does not yet pervasively apply return_on_pagefault!, this
will be added in the next commit.

Jitted code does not yet properly handle the new form of page faults,
this will be added in a later commit.
2020-08-30 19:29:53 -05:00
Fabian 0a68bc9393 Check in generated Rust files 2020-08-30 19:29:53 -05:00