Package: visualboyadvance / 1.8.0.dfsg-4

02_amd64_build_fix.patch Patch series | download
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
Author: Jose Carlos Medeiros <debian@psabs.com.br>
Description: Fixes build on amd64.
--- a/src/prof/prof.cpp
+++ b/src/prof/prof.cpp
@@ -88,6 +88,18 @@
   b[1] = (v >> 8) & 255;
 }
 
+void profPut64(char *b, u64 v)
+{
+  b[0] = v & 255;
+  b[1] = (v >> 8) & 255;
+  b[2] = (v >> 16) & 255;
+  b[3] = (v >> 24) & 255;
+  b[4] = (v >> 32) & 255;
+  b[5] = (v >> 40) & 255;
+  b[6] = (v >> 48) & 255;
+  b[7] = (v >> 56) & 255;
+}
+
 int profWrite8(FILE *f, u8 b)
 {
   if(fwrite(&b, 1, 1, f) != 1)
@@ -105,6 +117,16 @@
   return 0;
 }
 
+int profWrite64(FILE *f, u64 v)
+{
+  char buf[8];
+
+  profPut64(buf, v);
+  if(fwrite(buf, 1, 8, f) != 8)
+    return 1;
+  return 0;
+}
+
 int profWrite(FILE *f, char *buf, unsigned int n)
 {
   if(fwrite(buf, 1, n, f) != n)
@@ -271,7 +293,7 @@
       for (toindex=seg->froms[fromindex]; toindex!=0; toindex=seg->tos[toindex].link) {
       if(profWrite8(fd, GMON_TAG_CG_ARC) ||
          profWrite32(fd, (u32)frompc) ||
-	   profWrite32(fd, (u32)seg->tos[toindex].selfpc) ||
+	   profWrite64(fd, (u64)seg->tos[toindex].selfpc) ||
 	   profWrite32(fd, seg->tos[toindex].count)) {
         systemMessage(0, "mcount: arc");
         fclose(fd);
--- a/src/sdl/debugger.cpp
+++ b/src/sdl/debugger.cpp
@@ -1722,9 +1722,9 @@
   if(mem >= &bios[0] && mem <= &bios[0x3fff])
     return 0x00000000 + (mem - &bios[0]);
   else if(mem >= &workRAM[0] && mem <= &workRAM[0x3ffff])
-    return 0x02000000 + (mem - &workRAM[0]);
+    return 0x02000000 + ((unsigned size_t)mem - (size_t)&workRAM[0]);
   else if(mem >= &internalRAM[0] && mem <= &internalRAM[0x7fff])
-    return 0x03000000 + (mem - &internalRAM[0]);
+    return 0x03000000 + ((unsigned size_t)mem - (size_t)&internalRAM[0]);
   else if(mem >= &ioMem[0] && mem <= &ioMem[0x3ff])
     return 0x04000000 + (mem - &ioMem[0]);
   else if(mem >= &paletteRAM[0] && mem <= &paletteRAM[0x3ff])