Skip to content

Commit 3bbbd58

Browse files
committed
Add notes to resolve #167
1 parent a874f80 commit 3bbbd58

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

www/notes/a86.scrbl

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,12 @@ Each register plays the same role as in x86, so for example
13141314
@defstruct*[Cmovz ([dst register?] [src (or/c register? offset?)])]{
13151315
Move from @racket[src] to @racket[dst] if the zero flag is set.
13161316

1317+
Note that the semantics for conditional moves is not what many people expect.
1318+
The @dst[src] is @emph{always} read, regardless of the condition's evaluation.
1319+
This means that if your source is illegal (such as an offset beyond the bounds
1320+
of memory allocated to the current process), a segmentation fault will arise
1321+
even if the condition ``should have'' prevented the error.
1322+
13171323
@ex[
13181324
(asm-interp
13191325
(prog
@@ -1339,7 +1345,7 @@ Each register plays the same role as in x86, so for example
13391345

13401346

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

16041619
@ex[
16051620
(asm-interp

0 commit comments

Comments
 (0)