forked from DrY-Courses/OSF16project2
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbochs-2.2.6-big-endian.patch
63 lines (62 loc) · 2.99 KB
/
bochs-2.2.6-big-endian.patch
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
diff -urp bochs-2.2.6/gdbstub.cc bochs-2.2.6.orig/gdbstub.cc
--- bochs-2.2.6.orig/gdbstub.cc 2006-01-17 09:15:29.000000000 -0800
+++ bochs-2.2.6/gdbstub.cc 2006-04-03 13:47:39.000000000 -0700
@@ -672,35 +672,36 @@
case 'g':
#if !BX_SUPPORT_X86_64
- registers[0] = EAX;
- registers[1] = ECX;
- registers[2] = EDX;
- registers[3] = EBX;
- registers[4] = ESP;
- registers[5] = EBP;
- registers[6] = ESI;
- registers[7] = EDI;
+ WriteHostDWordToLittleEndian(registers + 0, EAX);
+ WriteHostDWordToLittleEndian(registers + 1, ECX);
+ WriteHostDWordToLittleEndian(registers + 2, EDX);
+ WriteHostDWordToLittleEndian(registers + 3, EBX);
+ WriteHostDWordToLittleEndian(registers + 4, ESP);
+ WriteHostDWordToLittleEndian(registers + 5, EBP);
+ WriteHostDWordToLittleEndian(registers + 6, ESI);
+ WriteHostDWordToLittleEndian(registers + 7, EDI);
if (last_stop_reason == GDBSTUB_EXECUTION_BREAKPOINT)
{
- registers[8] = EIP + 1;
+ WriteHostDWordToLittleEndian(registers + 8, EIP + 1);
}
else
{
- registers[8] = EIP;
+ WriteHostDWordToLittleEndian(registers + 8, EIP);
}
- registers[9] = BX_CPU_THIS_PTR read_eflags();
- registers[10] =
- BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value;
- registers[11] =
- BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.value;
- registers[12] =
- BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.value;
- registers[13] =
- BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.value;
- registers[14] =
- BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.value;
- registers[15] =
- BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.value;
+ WriteHostDWordToLittleEndian(registers + 9,
+ BX_CPU_THIS_PTR read_eflags());
+ WriteHostDWordToLittleEndian(registers + 10,
+ BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.value);
+ WriteHostDWordToLittleEndian(registers + 11,
+ BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.value);
+ WriteHostDWordToLittleEndian(registers + 12,
+ BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector.value);
+ WriteHostDWordToLittleEndian(registers + 13,
+ BX_CPU_THIS_PTR sregs[BX_SEG_REG_ES].selector.value);
+ WriteHostDWordToLittleEndian(registers + 14,
+ BX_CPU_THIS_PTR sregs[BX_SEG_REG_FS].selector.value);
+ WriteHostDWordToLittleEndian(registers + 15,
+ BX_CPU_THIS_PTR sregs[BX_SEG_REG_GS].selector.value);
mem2hex((char *)registers, obuf, NUMREGSBYTES);
#else
#define PUTREG(buf, val, len) do { \