Skip to content

Commit

Permalink
Add notes to resolve #167
Browse files Browse the repository at this point in the history
  • Loading branch information
pdarragh committed Feb 12, 2024
1 parent a874f80 commit 3bbbd58
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions www/notes/a86.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,12 @@ Each register plays the same role as in x86, so for example
@defstruct*[Cmovz ([dst register?] [src (or/c register? offset?)])]{
Move from @racket[src] to @racket[dst] if the zero flag is set.

Note that the semantics for conditional moves is not what many people expect.
The @dst[src] is @emph{always} read, regardless of the condition's evaluation.
This means that if your source is illegal (such as an offset beyond the bounds
of memory allocated to the current process), a segmentation fault will arise
even if the condition ``should have'' prevented the error.

@ex[
(asm-interp
(prog
Expand All @@ -1339,7 +1345,7 @@ Each register plays the same role as in x86, so for example


@defstruct*[Cmove ([dst register?] [src (or/c register? offset?)])]{
An alias for @racket[Cmovz].
An alias for @racket[Cmovz]. See notes on @racket[Cmovz].

@ex[
(asm-interp
Expand All @@ -1366,6 +1372,7 @@ Each register plays the same role as in x86, so for example

@defstruct*[Cmovnz ([dst register?] [src (or/c register? offset?)])]{
Move from @racket[src] to @racket[dst] if the zero flag is @emph{not} set.
See notes on @racket[Cmovz].

@ex[
(asm-interp
Expand All @@ -1391,7 +1398,7 @@ Each register plays the same role as in x86, so for example
}

@defstruct*[Cmovne ([dst register?] [src (or/c register? offset?)])]{
An alias for @racket[Cmovnz].
An alias for @racket[Cmovnz]. See notes on @racket[Cmovz].

@ex[
(asm-interp
Expand All @@ -1418,6 +1425,7 @@ Each register plays the same role as in x86, so for example

@defstruct*[Cmovl ([dst register?] [src (or/c register? offset?)])]{
Move from @racket[src] to @racket[dst] if the conditional flags are set to ``less than'' (see @secref{a86-flags}).
See also the notes on @racket[Cmovz].

@ex[
(asm-interp
Expand All @@ -1444,6 +1452,7 @@ Each register plays the same role as in x86, so for example

@defstruct*[Cmovle ([dst register?] [src (or/c register? offset?)])]{
Move from @racket[src] to @racket[dst] if the conditional flags are set to ``less than or equal'' (see @secref{a86-flags}).
See also the notes on @racket[Cmovz].

@ex[
(asm-interp
Expand All @@ -1470,6 +1479,7 @@ Each register plays the same role as in x86, so for example

@defstruct*[Cmovg ([dst register?] [src (or/c register? offset?)])]{
Move from @racket[src] to @racket[dst] if the conditional flags are set to ``greather than'' (see @secref{a86-flags}).
See also the notes on @racket[Cmovz].

@ex[
(asm-interp
Expand All @@ -1496,6 +1506,7 @@ Each register plays the same role as in x86, so for example

@defstruct*[Cmovge ([dst register?] [src (or/c register? offset?)])]{
Move from @racket[src] to @racket[dst] if the conditional flags are set to ``greater than or equal'' (see @secref{a86-flags}).
See also the notes on @racket[Cmovz].

@ex[
(asm-interp
Expand All @@ -1522,6 +1533,7 @@ Each register plays the same role as in x86, so for example

@defstruct*[Cmovo ([dst register?] [src (or/c register? offset?)])]{
Move from @racket[src] to @racket[dst] if the overflow flag is set.
See notes on @racket[Cmovz].

@ex[
(asm-interp
Expand All @@ -1548,6 +1560,7 @@ Each register plays the same role as in x86, so for example

@defstruct*[Cmovno ([dst register?] [src (or/c register? offset?)])]{
Move from @racket[src] to @racket[dst] if the overflow flag is @emph{not} set.
See notes on @racket[Cmovz].

@ex[
(asm-interp
Expand All @@ -1574,6 +1587,7 @@ Each register plays the same role as in x86, so for example

@defstruct*[Cmovc ([dst register?] [src (or/c register? offset?)])]{
Move from @racket[src] to @racket[dst] if the carry flag is set.
See notes on @racket[Cmovz].

@ex[
(asm-interp
Expand All @@ -1600,6 +1614,7 @@ Each register plays the same role as in x86, so for example

@defstruct*[Cmovnc ([dst register?] [src (or/c register? offset?)])]{
Move from @racket[src] to @racket[dst] if the carry flag is @emph{not} set.
See notes on @racket[Cmovz].

@ex[
(asm-interp
Expand Down

0 comments on commit 3bbbd58

Please sign in to comment.