about summary refs log tree commit diff stats
path: root/subx/sib.pdf
Commit message (Expand)AuthorAgeFilesLines
* 4692 - update online help for subxKartik Agaram2018-10-131-0/+0
mu/commit/subx/022div.cc?h=main&id=83c67014034bbf9072d7e4555b0e51e815a95756'>83c67014 ^
91534c2a ^



















83c67014 ^
91534c2a ^






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38








                                                            
                     



















                                                                                       
                     






                                       
//: helper for division operations: sign-extend EAX into EDX

:(before "End Initialize Op Names")
put_new(Name, "99", "sign-extend EAX into EDX (cdq)");

:(code)
void test_cdq() {
  Reg[EAX].i = 10;
  run(
      "== code 0x1\n"
      "99\n"
  );
  CHECK_TRACE_CONTENTS(
      "run: sign-extend EAX into EDX\n"
      "run: EDX is now 0x00000000\n"
  );
}

:(before "End Single-Byte Opcodes")
case 0x99: {  // sign-extend EAX into EDX
  trace(Callstack_depth+1, "run") << "sign-extend EAX into EDX" << end();
  Reg[EDX].i = (Reg[EAX].i < 0) ? -1 : 0;
  trace(Callstack_depth+1, "run") << "EDX is now 0x" << HEXWORD << Reg[EDX].u << end();
  break;
}

:(code)
void test_cdq_negative() {
  Reg[EAX].i = -10;
  run(
      "== code 0x1\n"
      "99\n"
  );
  CHECK_TRACE_CONTENTS(
      "run: sign-extend EAX into EDX\n"
      "run: EDX is now 0xffffffff\n"
  );
}