Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x86: disallow BT with memory operands #948

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
([PR #937](https://github.com/jasmin-lang/jasmin/pull/937);
fixes [#895](https://github.com/jasmin-lang/jasmin/issues/895)).

- Disable x86 `BT` instruction with in-memory operands
([PR #948](https://github.com/jasmin-lang/jasmin/pull/948);
fixes [#931](https://github.com/jasmin-lang/jasmin/issues/931)).

## Other changes

- The deprecated legacy interface to the LATEX pretty-printer has been removed
Expand Down
6 changes: 3 additions & 3 deletions proofs/compiler/x86_instr_decl.v
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ Definition x86_SETcc (b:bool) : tpl (w_ty U8) := wrepr U8 (Z.b2z b).
Definition Ox86_SETcc_instr :=
mk_instr_pp "SETcc" b_ty w8_ty [:: Eu 0] [:: Eu 1] (reg_msb_flag U8) x86_SETcc check_setcc 2 (primM SETcc) (pp_ct "set" U8).

Definition check_bt (_:wsize) := [:: [::rm true; ri U8]].
Definition check_bt of wsize := [:: [:: r; ri U8 ]].

Definition x86_BT sz (x y: word sz) : tpl (b_ty) :=
Some (wbit x y).
Expand Down Expand Up @@ -1231,10 +1231,10 @@ Definition x86_BTX op sz (x y: word sz) : tpl (bw_ty sz) :=
(:: Some (wbit_n x (Z.to_nat bit)) & op sz (wrepr sz (2 ^ bit)) x).

Definition Ox86_BTR_instr :=
mk_instr_w2_bw "BTR" (x86_BTX wandn) (λ _, [:: [:: r ; ri U8 ] ]) (prim_16_64 BTR) size_16_64 (pp_iname "btr").
mk_instr_w2_bw "BTR" (x86_BTX wandn) check_bt (prim_16_64 BTR) size_16_64 (pp_iname "btr").

Definition Ox86_BTS_instr :=
mk_instr_w2_bw "BTS" (x86_BTX (@wor)) (λ _, [:: [:: r ; ri U8 ] ]) (prim_16_64 BTS) size_16_64 (pp_iname "bts").
mk_instr_w2_bw "BTS" (x86_BTX (@wor)) check_bt (prim_16_64 BTS) size_16_64 (pp_iname "bts").

Definition x86_PEXT sz (v1 v2: word sz): tpl (w_ty sz) :=
@pextr sz v1 v2.
Expand Down