Commit 3b46e6242767a2c770c0aba0a6595e9511623c92
1 parent
ef18c883
find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in the regex.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
76 changed files
with
619 additions
and
619 deletions
Too many changes to show.
To preserve performance only 76 of 173 files are displayed.
Changelog
@@ -86,7 +86,7 @@ version 0.8.0: | @@ -86,7 +86,7 @@ version 0.8.0: | ||
86 | (Johannes Schindelin) | 86 | (Johannes Schindelin) |
87 | 87 | ||
88 | version 0.7.2: | 88 | version 0.7.2: |
89 | - | 89 | + |
90 | - x86_64 fixes (Win2000 and Linux 2.6 boot in 32 bit) | 90 | - x86_64 fixes (Win2000 and Linux 2.6 boot in 32 bit) |
91 | - merge self modifying code handling in dirty ram page mecanism. | 91 | - merge self modifying code handling in dirty ram page mecanism. |
92 | - MIPS fixes (Ralf Baechle) | 92 | - MIPS fixes (Ralf Baechle) |
@@ -201,7 +201,7 @@ version 0.5.5: | @@ -201,7 +201,7 @@ version 0.5.5: | ||
201 | - FDC fixes for Win98 | 201 | - FDC fixes for Win98 |
202 | 202 | ||
203 | version 0.5.4: | 203 | version 0.5.4: |
204 | - | 204 | + |
205 | - qemu-fast fixes | 205 | - qemu-fast fixes |
206 | - BIOS area protection fix (aka EMM386.EXE fix) (Mike Nordell) | 206 | - BIOS area protection fix (aka EMM386.EXE fix) (Mike Nordell) |
207 | - keyboard/mouse fix (Mike Nordell) | 207 | - keyboard/mouse fix (Mike Nordell) |
@@ -266,7 +266,7 @@ version 0.5.2: | @@ -266,7 +266,7 @@ version 0.5.2: | ||
266 | - eflags optimisation fix for string operations | 266 | - eflags optimisation fix for string operations |
267 | 267 | ||
268 | version 0.5.1: | 268 | version 0.5.1: |
269 | - | 269 | + |
270 | - float access fixes when using soft mmu | 270 | - float access fixes when using soft mmu |
271 | - PC emulation support on PowerPC | 271 | - PC emulation support on PowerPC |
272 | - A20 support | 272 | - A20 support |
@@ -281,7 +281,7 @@ version 0.5.1: | @@ -281,7 +281,7 @@ version 0.5.1: | ||
281 | - Major SPARC target fixes (dynamically linked programs begin to work) | 281 | - Major SPARC target fixes (dynamically linked programs begin to work) |
282 | 282 | ||
283 | version 0.5.0: | 283 | version 0.5.0: |
284 | - | 284 | + |
285 | - full hardware level VGA emulation | 285 | - full hardware level VGA emulation |
286 | - graphical display with SDL | 286 | - graphical display with SDL |
287 | - added PS/2 mouse and keyboard emulation | 287 | - added PS/2 mouse and keyboard emulation |
@@ -319,7 +319,7 @@ version 0.4.2: | @@ -319,7 +319,7 @@ version 0.4.2: | ||
319 | - SMP kernels can at least be booted | 319 | - SMP kernels can at least be booted |
320 | 320 | ||
321 | version 0.4.1: | 321 | version 0.4.1: |
322 | - | 322 | + |
323 | - more accurate timer support in vl. | 323 | - more accurate timer support in vl. |
324 | - more reliable NE2000 probe in vl. | 324 | - more reliable NE2000 probe in vl. |
325 | - added 2.5.66 kernel in vl-test. | 325 | - added 2.5.66 kernel in vl-test. |
aes.c
@@ -1294,7 +1294,7 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | @@ -1294,7 +1294,7 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||
1294 | AES_encrypt(tmp, tmp, key); | 1294 | AES_encrypt(tmp, tmp, key); |
1295 | memcpy(out, tmp, AES_BLOCK_SIZE); | 1295 | memcpy(out, tmp, AES_BLOCK_SIZE); |
1296 | memcpy(ivec, tmp, AES_BLOCK_SIZE); | 1296 | memcpy(ivec, tmp, AES_BLOCK_SIZE); |
1297 | - } | 1297 | + } |
1298 | } else { | 1298 | } else { |
1299 | while (len >= AES_BLOCK_SIZE) { | 1299 | while (len >= AES_BLOCK_SIZE) { |
1300 | memcpy(tmp, in, AES_BLOCK_SIZE); | 1300 | memcpy(tmp, in, AES_BLOCK_SIZE); |
@@ -1312,6 +1312,6 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | @@ -1312,6 +1312,6 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||
1312 | for(n=0; n < len; ++n) | 1312 | for(n=0; n < len; ++n) |
1313 | out[n] = tmp[n] ^ ivec[n]; | 1313 | out[n] = tmp[n] ^ ivec[n]; |
1314 | memcpy(ivec, tmp, AES_BLOCK_SIZE); | 1314 | memcpy(ivec, tmp, AES_BLOCK_SIZE); |
1315 | - } | 1315 | + } |
1316 | } | 1316 | } |
1317 | } | 1317 | } |
arm-dis.c
@@ -34,7 +34,7 @@ struct thumb_opcode | @@ -34,7 +34,7 @@ struct thumb_opcode | ||
34 | }; | 34 | }; |
35 | 35 | ||
36 | /* format of the assembler string : | 36 | /* format of the assembler string : |
37 | - | 37 | + |
38 | %% % | 38 | %% % |
39 | %<bitfield>d print the bitfield in decimal | 39 | %<bitfield>d print the bitfield in decimal |
40 | %<bitfield>x print the bitfield in hex | 40 | %<bitfield>x print the bitfield in hex |
@@ -104,7 +104,7 @@ static struct arm_opcode arm_opcodes[] = | @@ -104,7 +104,7 @@ static struct arm_opcode arm_opcodes[] = | ||
104 | {0x0c400000, 0x0ff00fff, "mar%c\tacc0, %12-15r, %16-19r"}, | 104 | {0x0c400000, 0x0ff00fff, "mar%c\tacc0, %12-15r, %16-19r"}, |
105 | {0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"}, | 105 | {0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"}, |
106 | {0xf450f000, 0xfc70f000, "pld\t%a"}, | 106 | {0xf450f000, 0xfc70f000, "pld\t%a"}, |
107 | - | 107 | + |
108 | /* V5 Instructions. */ | 108 | /* V5 Instructions. */ |
109 | {0xe1200070, 0xfff000f0, "bkpt\t0x%16-19X%12-15X%8-11X%0-3X"}, | 109 | {0xe1200070, 0xfff000f0, "bkpt\t0x%16-19X%12-15X%8-11X%0-3X"}, |
110 | {0xfa000000, 0xfe000000, "blx\t%B"}, | 110 | {0xfa000000, 0xfe000000, "blx\t%B"}, |
@@ -116,7 +116,7 @@ static struct arm_opcode arm_opcodes[] = | @@ -116,7 +116,7 @@ static struct arm_opcode arm_opcodes[] = | ||
116 | {0xfe000010, 0xff100010, "mcr2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, | 116 | {0xfe000010, 0xff100010, "mcr2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, |
117 | {0xfe100010, 0xff100010, "mrc2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, | 117 | {0xfe100010, 0xff100010, "mrc2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, |
118 | 118 | ||
119 | - /* V5E "El Segundo" Instructions. */ | 119 | + /* V5E "El Segundo" Instructions. */ |
120 | {0x000000d0, 0x0e1000f0, "ldr%cd\t%12-15r, %s"}, | 120 | {0x000000d0, 0x0e1000f0, "ldr%cd\t%12-15r, %s"}, |
121 | {0x000000f0, 0x0e1000f0, "str%cd\t%12-15r, %s"}, | 121 | {0x000000f0, 0x0e1000f0, "str%cd\t%12-15r, %s"}, |
122 | {0x01000080, 0x0ff000f0, "smlabb%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, | 122 | {0x01000080, 0x0ff000f0, "smlabb%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, |
@@ -621,14 +621,14 @@ arm_decode_shift (given, func, stream) | @@ -621,14 +621,14 @@ arm_decode_shift (given, func, stream) | ||
621 | void * stream; | 621 | void * stream; |
622 | { | 622 | { |
623 | func (stream, "%s", arm_regnames[given & 0xf]); | 623 | func (stream, "%s", arm_regnames[given & 0xf]); |
624 | - | 624 | + |
625 | if ((given & 0xff0) != 0) | 625 | if ((given & 0xff0) != 0) |
626 | { | 626 | { |
627 | if ((given & 0x10) == 0) | 627 | if ((given & 0x10) == 0) |
628 | { | 628 | { |
629 | int amount = (given & 0xf80) >> 7; | 629 | int amount = (given & 0xf80) >> 7; |
630 | int shift = (given & 0x60) >> 5; | 630 | int shift = (given & 0x60) >> 5; |
631 | - | 631 | + |
632 | if (amount == 0) | 632 | if (amount == 0) |
633 | { | 633 | { |
634 | if (shift == 3) | 634 | if (shift == 3) |
@@ -636,10 +636,10 @@ arm_decode_shift (given, func, stream) | @@ -636,10 +636,10 @@ arm_decode_shift (given, func, stream) | ||
636 | func (stream, ", rrx"); | 636 | func (stream, ", rrx"); |
637 | return; | 637 | return; |
638 | } | 638 | } |
639 | - | 639 | + |
640 | amount = 32; | 640 | amount = 32; |
641 | } | 641 | } |
642 | - | 642 | + |
643 | func (stream, ", %s #%d", arm_shift[shift], amount); | 643 | func (stream, ", %s #%d", arm_shift[shift], amount); |
644 | } | 644 | } |
645 | else | 645 | else |
@@ -666,7 +666,7 @@ print_insn_arm1 (pc, info, given) | @@ -666,7 +666,7 @@ print_insn_arm1 (pc, info, given) | ||
666 | if ((given & insn->mask) == insn->value) | 666 | if ((given & insn->mask) == insn->value) |
667 | { | 667 | { |
668 | char * c; | 668 | char * c; |
669 | - | 669 | + |
670 | for (c = insn->assembler; *c; c++) | 670 | for (c = insn->assembler; *c; c++) |
671 | { | 671 | { |
672 | if (*c == '%') | 672 | if (*c == '%') |
@@ -682,14 +682,14 @@ print_insn_arm1 (pc, info, given) | @@ -682,14 +682,14 @@ print_insn_arm1 (pc, info, given) | ||
682 | && ((given & 0x02000000) == 0)) | 682 | && ((given & 0x02000000) == 0)) |
683 | { | 683 | { |
684 | int offset = given & 0xfff; | 684 | int offset = given & 0xfff; |
685 | - | 685 | + |
686 | func (stream, "[pc"); | 686 | func (stream, "[pc"); |
687 | 687 | ||
688 | if (given & 0x01000000) | 688 | if (given & 0x01000000) |
689 | { | 689 | { |
690 | if ((given & 0x00800000) == 0) | 690 | if ((given & 0x00800000) == 0) |
691 | offset = - offset; | 691 | offset = - offset; |
692 | - | 692 | + |
693 | /* Pre-indexed. */ | 693 | /* Pre-indexed. */ |
694 | func (stream, ", #%d]", offset); | 694 | func (stream, ", #%d]", offset); |
695 | 695 | ||
@@ -710,7 +710,7 @@ print_insn_arm1 (pc, info, given) | @@ -710,7 +710,7 @@ print_insn_arm1 (pc, info, given) | ||
710 | /* ie ignore the offset. */ | 710 | /* ie ignore the offset. */ |
711 | offset = pc + 8; | 711 | offset = pc + 8; |
712 | } | 712 | } |
713 | - | 713 | + |
714 | func (stream, "\t; "); | 714 | func (stream, "\t; "); |
715 | info->print_address_func (offset, info); | 715 | info->print_address_func (offset, info); |
716 | } | 716 | } |
@@ -767,12 +767,12 @@ print_insn_arm1 (pc, info, given) | @@ -767,12 +767,12 @@ print_insn_arm1 (pc, info, given) | ||
767 | { | 767 | { |
768 | /* PC relative with immediate offset. */ | 768 | /* PC relative with immediate offset. */ |
769 | int offset = ((given & 0xf00) >> 4) | (given & 0xf); | 769 | int offset = ((given & 0xf00) >> 4) | (given & 0xf); |
770 | - | 770 | + |
771 | if ((given & 0x00800000) == 0) | 771 | if ((given & 0x00800000) == 0) |
772 | offset = -offset; | 772 | offset = -offset; |
773 | - | 773 | + |
774 | func (stream, "[pc, #%d]\t; ", offset); | 774 | func (stream, "[pc, #%d]\t; ", offset); |
775 | - | 775 | + |
776 | (*info->print_address_func) | 776 | (*info->print_address_func) |
777 | (offset + pc + 8, info); | 777 | (offset + pc + 8, info); |
778 | } | 778 | } |
@@ -829,7 +829,7 @@ print_insn_arm1 (pc, info, given) | @@ -829,7 +829,7 @@ print_insn_arm1 (pc, info, given) | ||
829 | } | 829 | } |
830 | } | 830 | } |
831 | break; | 831 | break; |
832 | - | 832 | + |
833 | case 'b': | 833 | case 'b': |
834 | (*info->print_address_func) | 834 | (*info->print_address_func) |
835 | (BDISP (given) * 4 + pc + 8, info); | 835 | (BDISP (given) * 4 + pc + 8, info); |
@@ -911,7 +911,7 @@ print_insn_arm1 (pc, info, given) | @@ -911,7 +911,7 @@ print_insn_arm1 (pc, info, given) | ||
911 | { | 911 | { |
912 | bfd_vma address; | 912 | bfd_vma address; |
913 | bfd_vma offset = 0; | 913 | bfd_vma offset = 0; |
914 | - | 914 | + |
915 | if (given & 0x00800000) | 915 | if (given & 0x00800000) |
916 | /* Is signed, hi bits should be ones. */ | 916 | /* Is signed, hi bits should be ones. */ |
917 | offset = (-1) ^ 0x00ffffff; | 917 | offset = (-1) ^ 0x00ffffff; |
@@ -920,7 +920,7 @@ print_insn_arm1 (pc, info, given) | @@ -920,7 +920,7 @@ print_insn_arm1 (pc, info, given) | ||
920 | offset += given & 0x00ffffff; | 920 | offset += given & 0x00ffffff; |
921 | offset <<= 2; | 921 | offset <<= 2; |
922 | address = offset + pc + 8; | 922 | address = offset + pc + 8; |
923 | - | 923 | + |
924 | if (given & 0x01000000) | 924 | if (given & 0x01000000) |
925 | /* H bit allows addressing to 2-byte boundaries. */ | 925 | /* H bit allows addressing to 2-byte boundaries. */ |
926 | address += 2; | 926 | address += 2; |
@@ -976,7 +976,7 @@ print_insn_arm1 (pc, info, given) | @@ -976,7 +976,7 @@ print_insn_arm1 (pc, info, given) | ||
976 | func (stream, "3"); | 976 | func (stream, "3"); |
977 | } | 977 | } |
978 | break; | 978 | break; |
979 | - | 979 | + |
980 | case 'P': | 980 | case 'P': |
981 | switch (given & 0x00080080) | 981 | switch (given & 0x00080080) |
982 | { | 982 | { |
@@ -1040,44 +1040,44 @@ print_insn_arm1 (pc, info, given) | @@ -1040,44 +1040,44 @@ print_insn_arm1 (pc, info, given) | ||
1040 | { | 1040 | { |
1041 | case '-': | 1041 | case '-': |
1042 | c++; | 1042 | c++; |
1043 | - | 1043 | + |
1044 | while (*c >= '0' && *c <= '9') | 1044 | while (*c >= '0' && *c <= '9') |
1045 | bitend = (bitend * 10) + *c++ - '0'; | 1045 | bitend = (bitend * 10) + *c++ - '0'; |
1046 | - | 1046 | + |
1047 | if (!bitend) | 1047 | if (!bitend) |
1048 | abort (); | 1048 | abort (); |
1049 | - | 1049 | + |
1050 | switch (*c) | 1050 | switch (*c) |
1051 | { | 1051 | { |
1052 | case 'r': | 1052 | case 'r': |
1053 | { | 1053 | { |
1054 | long reg; | 1054 | long reg; |
1055 | - | 1055 | + |
1056 | reg = given >> bitstart; | 1056 | reg = given >> bitstart; |
1057 | reg &= (2 << (bitend - bitstart)) - 1; | 1057 | reg &= (2 << (bitend - bitstart)) - 1; |
1058 | - | 1058 | + |
1059 | func (stream, "%s", arm_regnames[reg]); | 1059 | func (stream, "%s", arm_regnames[reg]); |
1060 | } | 1060 | } |
1061 | break; | 1061 | break; |
1062 | case 'd': | 1062 | case 'd': |
1063 | { | 1063 | { |
1064 | long reg; | 1064 | long reg; |
1065 | - | 1065 | + |
1066 | reg = given >> bitstart; | 1066 | reg = given >> bitstart; |
1067 | reg &= (2 << (bitend - bitstart)) - 1; | 1067 | reg &= (2 << (bitend - bitstart)) - 1; |
1068 | - | 1068 | + |
1069 | func (stream, "%d", reg); | 1069 | func (stream, "%d", reg); |
1070 | } | 1070 | } |
1071 | break; | 1071 | break; |
1072 | case 'x': | 1072 | case 'x': |
1073 | { | 1073 | { |
1074 | long reg; | 1074 | long reg; |
1075 | - | 1075 | + |
1076 | reg = given >> bitstart; | 1076 | reg = given >> bitstart; |
1077 | reg &= (2 << (bitend - bitstart)) - 1; | 1077 | reg &= (2 << (bitend - bitstart)) - 1; |
1078 | - | 1078 | + |
1079 | func (stream, "0x%08x", reg); | 1079 | func (stream, "0x%08x", reg); |
1080 | - | 1080 | + |
1081 | /* Some SWI instructions have special | 1081 | /* Some SWI instructions have special |
1082 | meanings. */ | 1082 | meanings. */ |
1083 | if ((given & 0x0fffffff) == 0x0FF00000) | 1083 | if ((given & 0x0fffffff) == 0x0FF00000) |
@@ -1089,20 +1089,20 @@ print_insn_arm1 (pc, info, given) | @@ -1089,20 +1089,20 @@ print_insn_arm1 (pc, info, given) | ||
1089 | case 'X': | 1089 | case 'X': |
1090 | { | 1090 | { |
1091 | long reg; | 1091 | long reg; |
1092 | - | 1092 | + |
1093 | reg = given >> bitstart; | 1093 | reg = given >> bitstart; |
1094 | reg &= (2 << (bitend - bitstart)) - 1; | 1094 | reg &= (2 << (bitend - bitstart)) - 1; |
1095 | - | 1095 | + |
1096 | func (stream, "%01x", reg & 0xf); | 1096 | func (stream, "%01x", reg & 0xf); |
1097 | } | 1097 | } |
1098 | break; | 1098 | break; |
1099 | case 'f': | 1099 | case 'f': |
1100 | { | 1100 | { |
1101 | long reg; | 1101 | long reg; |
1102 | - | 1102 | + |
1103 | reg = given >> bitstart; | 1103 | reg = given >> bitstart; |
1104 | reg &= (2 << (bitend - bitstart)) - 1; | 1104 | reg &= (2 << (bitend - bitstart)) - 1; |
1105 | - | 1105 | + |
1106 | if (reg > 7) | 1106 | if (reg > 7) |
1107 | func (stream, "#%s", | 1107 | func (stream, "#%s", |
1108 | arm_fp_const[reg & 7]); | 1108 | arm_fp_const[reg & 7]); |
@@ -1163,7 +1163,7 @@ print_insn_arm1 (pc, info, given) | @@ -1163,7 +1163,7 @@ print_insn_arm1 (pc, info, given) | ||
1163 | } | 1163 | } |
1164 | break; | 1164 | break; |
1165 | 1165 | ||
1166 | - | 1166 | + |
1167 | default: | 1167 | default: |
1168 | abort (); | 1168 | abort (); |
1169 | } | 1169 | } |
@@ -1252,7 +1252,7 @@ print_insn_thumb (pc, info, given) | @@ -1252,7 +1252,7 @@ print_insn_thumb (pc, info, given) | ||
1252 | if (!*c) /* Check for empty (not NULL) assembler string. */ | 1252 | if (!*c) /* Check for empty (not NULL) assembler string. */ |
1253 | { | 1253 | { |
1254 | long offset; | 1254 | long offset; |
1255 | - | 1255 | + |
1256 | info->bytes_per_chunk = 4; | 1256 | info->bytes_per_chunk = 4; |
1257 | info->bytes_per_line = 4; | 1257 | info->bytes_per_line = 4; |
1258 | 1258 | ||
@@ -1274,16 +1274,16 @@ print_insn_thumb (pc, info, given) | @@ -1274,16 +1274,16 @@ print_insn_thumb (pc, info, given) | ||
1274 | { | 1274 | { |
1275 | info->bytes_per_chunk = 2; | 1275 | info->bytes_per_chunk = 2; |
1276 | info->bytes_per_line = 4; | 1276 | info->bytes_per_line = 4; |
1277 | - | 1277 | + |
1278 | given &= 0xffff; | 1278 | given &= 0xffff; |
1279 | - | 1279 | + |
1280 | for (; *c; c++) | 1280 | for (; *c; c++) |
1281 | { | 1281 | { |
1282 | if (*c == '%') | 1282 | if (*c == '%') |
1283 | { | 1283 | { |
1284 | int domaskpc = 0; | 1284 | int domaskpc = 0; |
1285 | int domasklr = 0; | 1285 | int domasklr = 0; |
1286 | - | 1286 | + |
1287 | switch (*++c) | 1287 | switch (*++c) |
1288 | { | 1288 | { |
1289 | case '%': | 1289 | case '%': |
@@ -1293,11 +1293,11 @@ print_insn_thumb (pc, info, given) | @@ -1293,11 +1293,11 @@ print_insn_thumb (pc, info, given) | ||
1293 | case 'S': | 1293 | case 'S': |
1294 | { | 1294 | { |
1295 | long reg; | 1295 | long reg; |
1296 | - | 1296 | + |
1297 | reg = (given >> 3) & 0x7; | 1297 | reg = (given >> 3) & 0x7; |
1298 | if (given & (1 << 6)) | 1298 | if (given & (1 << 6)) |
1299 | reg += 8; | 1299 | reg += 8; |
1300 | - | 1300 | + |
1301 | func (stream, "%s", arm_regnames[reg]); | 1301 | func (stream, "%s", arm_regnames[reg]); |
1302 | } | 1302 | } |
1303 | break; | 1303 | break; |
@@ -1305,11 +1305,11 @@ print_insn_thumb (pc, info, given) | @@ -1305,11 +1305,11 @@ print_insn_thumb (pc, info, given) | ||
1305 | case 'D': | 1305 | case 'D': |
1306 | { | 1306 | { |
1307 | long reg; | 1307 | long reg; |
1308 | - | 1308 | + |
1309 | reg = given & 0x7; | 1309 | reg = given & 0x7; |
1310 | if (given & (1 << 7)) | 1310 | if (given & (1 << 7)) |
1311 | reg += 8; | 1311 | reg += 8; |
1312 | - | 1312 | + |
1313 | func (stream, "%s", arm_regnames[reg]); | 1313 | func (stream, "%s", arm_regnames[reg]); |
1314 | } | 1314 | } |
1315 | break; | 1315 | break; |
@@ -1331,9 +1331,9 @@ print_insn_thumb (pc, info, given) | @@ -1331,9 +1331,9 @@ print_insn_thumb (pc, info, given) | ||
1331 | { | 1331 | { |
1332 | int started = 0; | 1332 | int started = 0; |
1333 | int reg; | 1333 | int reg; |
1334 | - | 1334 | + |
1335 | func (stream, "{"); | 1335 | func (stream, "{"); |
1336 | - | 1336 | + |
1337 | /* It would be nice if we could spot | 1337 | /* It would be nice if we could spot |
1338 | ranges, and generate the rS-rE format: */ | 1338 | ranges, and generate the rS-rE format: */ |
1339 | for (reg = 0; (reg < 8); reg++) | 1339 | for (reg = 0; (reg < 8); reg++) |
@@ -1370,7 +1370,7 @@ print_insn_thumb (pc, info, given) | @@ -1370,7 +1370,7 @@ print_insn_thumb (pc, info, given) | ||
1370 | { | 1370 | { |
1371 | int bitstart = *c++ - '0'; | 1371 | int bitstart = *c++ - '0'; |
1372 | int bitend = 0; | 1372 | int bitend = 0; |
1373 | - | 1373 | + |
1374 | while (*c >= '0' && *c <= '9') | 1374 | while (*c >= '0' && *c <= '9') |
1375 | bitstart = (bitstart * 10) + *c++ - '0'; | 1375 | bitstart = (bitstart * 10) + *c++ - '0'; |
1376 | 1376 | ||
@@ -1379,7 +1379,7 @@ print_insn_thumb (pc, info, given) | @@ -1379,7 +1379,7 @@ print_insn_thumb (pc, info, given) | ||
1379 | case '-': | 1379 | case '-': |
1380 | { | 1380 | { |
1381 | long reg; | 1381 | long reg; |
1382 | - | 1382 | + |
1383 | c++; | 1383 | c++; |
1384 | while (*c >= '0' && *c <= '9') | 1384 | while (*c >= '0' && *c <= '9') |
1385 | bitend = (bitend * 10) + *c++ - '0'; | 1385 | bitend = (bitend * 10) + *c++ - '0'; |
@@ -1478,7 +1478,7 @@ parse_arm_disassembler_option (option) | @@ -1478,7 +1478,7 @@ parse_arm_disassembler_option (option) | ||
1478 | { | 1478 | { |
1479 | if (option == NULL) | 1479 | if (option == NULL) |
1480 | return; | 1480 | return; |
1481 | - | 1481 | + |
1482 | if (strneq (option, "reg-names-", 10)) | 1482 | if (strneq (option, "reg-names-", 10)) |
1483 | { | 1483 | { |
1484 | int i; | 1484 | int i; |
@@ -1491,7 +1491,7 @@ parse_arm_disassembler_option (option) | @@ -1491,7 +1491,7 @@ parse_arm_disassembler_option (option) | ||
1491 | regname_selected = i; | 1491 | regname_selected = i; |
1492 | break; | 1492 | break; |
1493 | } | 1493 | } |
1494 | - | 1494 | + |
1495 | if (i < 0) | 1495 | if (i < 0) |
1496 | fprintf (stderr, _("Unrecognised register name set: %s\n"), option); | 1496 | fprintf (stderr, _("Unrecognised register name set: %s\n"), option); |
1497 | } | 1497 | } |
@@ -1501,7 +1501,7 @@ parse_arm_disassembler_option (option) | @@ -1501,7 +1501,7 @@ parse_arm_disassembler_option (option) | ||
1501 | force_thumb = 0; | 1501 | force_thumb = 0; |
1502 | else | 1502 | else |
1503 | fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option); | 1503 | fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option); |
1504 | - | 1504 | + |
1505 | return; | 1505 | return; |
1506 | } | 1506 | } |
1507 | 1507 | ||
@@ -1512,7 +1512,7 @@ parse_disassembler_options (options) | @@ -1512,7 +1512,7 @@ parse_disassembler_options (options) | ||
1512 | char * options; | 1512 | char * options; |
1513 | { | 1513 | { |
1514 | char * space; | 1514 | char * space; |
1515 | - | 1515 | + |
1516 | if (options == NULL) | 1516 | if (options == NULL) |
1517 | return; | 1517 | return; |
1518 | 1518 | ||
@@ -1550,25 +1550,25 @@ print_insn_arm (pc, info) | @@ -1550,25 +1550,25 @@ print_insn_arm (pc, info) | ||
1550 | if (info->disassembler_options) | 1550 | if (info->disassembler_options) |
1551 | { | 1551 | { |
1552 | parse_disassembler_options (info->disassembler_options); | 1552 | parse_disassembler_options (info->disassembler_options); |
1553 | - | 1553 | + |
1554 | /* To avoid repeated parsing of these options, we remove them here. */ | 1554 | /* To avoid repeated parsing of these options, we remove them here. */ |
1555 | info->disassembler_options = NULL; | 1555 | info->disassembler_options = NULL; |
1556 | } | 1556 | } |
1557 | - | 1557 | + |
1558 | is_thumb = force_thumb; | 1558 | is_thumb = force_thumb; |
1559 | if (pc & 1) | 1559 | if (pc & 1) |
1560 | { | 1560 | { |
1561 | is_thumb = 1; | 1561 | is_thumb = 1; |
1562 | pc &= ~(bfd_vma) 1; | 1562 | pc &= ~(bfd_vma) 1; |
1563 | } | 1563 | } |
1564 | - | 1564 | + |
1565 | #if 0 | 1565 | #if 0 |
1566 | if (!is_thumb && info->symbols != NULL) | 1566 | if (!is_thumb && info->symbols != NULL) |
1567 | { | 1567 | { |
1568 | if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour) | 1568 | if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour) |
1569 | { | 1569 | { |
1570 | coff_symbol_type * cs; | 1570 | coff_symbol_type * cs; |
1571 | - | 1571 | + |
1572 | cs = coffsymbol (*info->symbols); | 1572 | cs = coffsymbol (*info->symbols); |
1573 | is_thumb = ( cs->native->u.syment.n_sclass == C_THUMBEXT | 1573 | is_thumb = ( cs->native->u.syment.n_sclass == C_THUMBEXT |
1574 | || cs->native->u.syment.n_sclass == C_THUMBSTAT | 1574 | || cs->native->u.syment.n_sclass == C_THUMBSTAT |
@@ -1580,15 +1580,15 @@ print_insn_arm (pc, info) | @@ -1580,15 +1580,15 @@ print_insn_arm (pc, info) | ||
1580 | { | 1580 | { |
1581 | elf_symbol_type * es; | 1581 | elf_symbol_type * es; |
1582 | unsigned int type; | 1582 | unsigned int type; |
1583 | - | 1583 | + |
1584 | es = *(elf_symbol_type **)(info->symbols); | 1584 | es = *(elf_symbol_type **)(info->symbols); |
1585 | type = ELF_ST_TYPE (es->internal_elf_sym.st_info); | 1585 | type = ELF_ST_TYPE (es->internal_elf_sym.st_info); |
1586 | - | 1586 | + |
1587 | is_thumb = (type == STT_ARM_TFUNC) || (type == STT_ARM_16BIT); | 1587 | is_thumb = (type == STT_ARM_TFUNC) || (type == STT_ARM_16BIT); |
1588 | } | 1588 | } |
1589 | } | 1589 | } |
1590 | #endif | 1590 | #endif |
1591 | - | 1591 | + |
1592 | little = (info->endian == BFD_ENDIAN_LITTLE); | 1592 | little = (info->endian == BFD_ENDIAN_LITTLE); |
1593 | info->bytes_per_chunk = 4; | 1593 | info->bytes_per_chunk = 4; |
1594 | info->display_endian = little ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG; | 1594 | info->display_endian = little ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG; |
@@ -1599,17 +1599,17 @@ print_insn_arm (pc, info) | @@ -1599,17 +1599,17 @@ print_insn_arm (pc, info) | ||
1599 | if (status != 0 && is_thumb) | 1599 | if (status != 0 && is_thumb) |
1600 | { | 1600 | { |
1601 | info->bytes_per_chunk = 2; | 1601 | info->bytes_per_chunk = 2; |
1602 | - | 1602 | + |
1603 | status = info->read_memory_func (pc, (bfd_byte *) b, 2, info); | 1603 | status = info->read_memory_func (pc, (bfd_byte *) b, 2, info); |
1604 | b[3] = b[2] = 0; | 1604 | b[3] = b[2] = 0; |
1605 | } | 1605 | } |
1606 | - | 1606 | + |
1607 | if (status != 0) | 1607 | if (status != 0) |
1608 | { | 1608 | { |
1609 | info->memory_error_func (status, pc, info); | 1609 | info->memory_error_func (status, pc, info); |
1610 | return -1; | 1610 | return -1; |
1611 | } | 1611 | } |
1612 | - | 1612 | + |
1613 | given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24); | 1613 | given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24); |
1614 | } | 1614 | } |
1615 | else | 1615 | else |
@@ -1621,13 +1621,13 @@ print_insn_arm (pc, info) | @@ -1621,13 +1621,13 @@ print_insn_arm (pc, info) | ||
1621 | info->memory_error_func (status, pc, info); | 1621 | info->memory_error_func (status, pc, info); |
1622 | return -1; | 1622 | return -1; |
1623 | } | 1623 | } |
1624 | - | 1624 | + |
1625 | if (is_thumb) | 1625 | if (is_thumb) |
1626 | { | 1626 | { |
1627 | if (pc & 0x2) | 1627 | if (pc & 0x2) |
1628 | { | 1628 | { |
1629 | given = (b[2] << 8) | b[3]; | 1629 | given = (b[2] << 8) | b[3]; |
1630 | - | 1630 | + |
1631 | status = info->read_memory_func | 1631 | status = info->read_memory_func |
1632 | ((pc + 4) & ~ 0x3, (bfd_byte *) b, 4, info); | 1632 | ((pc + 4) & ~ 0x3, (bfd_byte *) b, 4, info); |
1633 | if (status != 0) | 1633 | if (status != 0) |
@@ -1635,7 +1635,7 @@ print_insn_arm (pc, info) | @@ -1635,7 +1635,7 @@ print_insn_arm (pc, info) | ||
1635 | info->memory_error_func (status, pc + 4, info); | 1635 | info->memory_error_func (status, pc + 4, info); |
1636 | return -1; | 1636 | return -1; |
1637 | } | 1637 | } |
1638 | - | 1638 | + |
1639 | given |= (b[0] << 24) | (b[1] << 16); | 1639 | given |= (b[0] << 24) | (b[1] << 16); |
1640 | } | 1640 | } |
1641 | else | 1641 | else |
@@ -1644,7 +1644,7 @@ print_insn_arm (pc, info) | @@ -1644,7 +1644,7 @@ print_insn_arm (pc, info) | ||
1644 | else | 1644 | else |
1645 | given = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]); | 1645 | given = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]); |
1646 | } | 1646 | } |
1647 | - | 1647 | + |
1648 | if (info->flags & INSN_HAS_RELOC) | 1648 | if (info->flags & INSN_HAS_RELOC) |
1649 | /* If the instruction has a reloc associated with it, then | 1649 | /* If the instruction has a reloc associated with it, then |
1650 | the offset field in the instruction will actually be the | 1650 | the offset field in the instruction will actually be the |
@@ -1668,7 +1668,7 @@ print_arm_disassembler_options (FILE * stream) | @@ -1668,7 +1668,7 @@ print_arm_disassembler_options (FILE * stream) | ||
1668 | fprintf (stream, _("\n\ | 1668 | fprintf (stream, _("\n\ |
1669 | The following ARM specific disassembler options are supported for use with\n\ | 1669 | The following ARM specific disassembler options are supported for use with\n\ |
1670 | the -M switch:\n")); | 1670 | the -M switch:\n")); |
1671 | - | 1671 | + |
1672 | for (i = NUM_ARM_REGNAMES; i--;) | 1672 | for (i = NUM_ARM_REGNAMES; i--;) |
1673 | fprintf (stream, " reg-names-%s %*c%s\n", | 1673 | fprintf (stream, " reg-names-%s %*c%s\n", |
1674 | regnames[i].name, | 1674 | regnames[i].name, |
arm-semi.c
@@ -401,7 +401,7 @@ uint32_t do_arm_semihosting(CPUState *env) | @@ -401,7 +401,7 @@ uint32_t do_arm_semihosting(CPUState *env) | ||
401 | } | 401 | } |
402 | ts->heap_limit = limit; | 402 | ts->heap_limit = limit; |
403 | } | 403 | } |
404 | - | 404 | + |
405 | ptr = lock_user(ARG(0), 16, 0); | 405 | ptr = lock_user(ARG(0), 16, 0); |
406 | ptr[0] = tswap32(ts->heap_base); | 406 | ptr[0] = tswap32(ts->heap_base); |
407 | ptr[1] = tswap32(ts->heap_limit); | 407 | ptr[1] = tswap32(ts->heap_limit); |
block-bochs.c
@@ -44,7 +44,7 @@ struct bochs_header_v1 { | @@ -44,7 +44,7 @@ struct bochs_header_v1 { | ||
44 | char subtype[16]; // "Undoable" / "Volatile" / "Growing" | 44 | char subtype[16]; // "Undoable" / "Volatile" / "Growing" |
45 | uint32_t version; | 45 | uint32_t version; |
46 | uint32_t header; // size of header | 46 | uint32_t header; // size of header |
47 | - | 47 | + |
48 | union { | 48 | union { |
49 | struct { | 49 | struct { |
50 | uint32_t catalog; // num of entries | 50 | uint32_t catalog; // num of entries |
@@ -64,7 +64,7 @@ struct bochs_header { | @@ -64,7 +64,7 @@ struct bochs_header { | ||
64 | char subtype[16]; // "Undoable" / "Volatile" / "Growing" | 64 | char subtype[16]; // "Undoable" / "Volatile" / "Growing" |
65 | uint32_t version; | 65 | uint32_t version; |
66 | uint32_t header; // size of header | 66 | uint32_t header; // size of header |
67 | - | 67 | + |
68 | union { | 68 | union { |
69 | struct { | 69 | struct { |
70 | uint32_t catalog; // num of entries | 70 | uint32_t catalog; // num of entries |
@@ -83,9 +83,9 @@ typedef struct BDRVBochsState { | @@ -83,9 +83,9 @@ typedef struct BDRVBochsState { | ||
83 | 83 | ||
84 | uint32_t *catalog_bitmap; | 84 | uint32_t *catalog_bitmap; |
85 | int catalog_size; | 85 | int catalog_size; |
86 | - | 86 | + |
87 | int data_offset; | 87 | int data_offset; |
88 | - | 88 | + |
89 | int bitmap_blocks; | 89 | int bitmap_blocks; |
90 | int extent_blocks; | 90 | int extent_blocks; |
91 | int extent_size; | 91 | int extent_size; |
@@ -94,7 +94,7 @@ typedef struct BDRVBochsState { | @@ -94,7 +94,7 @@ typedef struct BDRVBochsState { | ||
94 | static int bochs_probe(const uint8_t *buf, int buf_size, const char *filename) | 94 | static int bochs_probe(const uint8_t *buf, int buf_size, const char *filename) |
95 | { | 95 | { |
96 | const struct bochs_header *bochs = (const void *)buf; | 96 | const struct bochs_header *bochs = (const void *)buf; |
97 | - | 97 | + |
98 | if (buf_size < HEADER_SIZE) | 98 | if (buf_size < HEADER_SIZE) |
99 | return 0; | 99 | return 0; |
100 | 100 | ||
@@ -121,9 +121,9 @@ static int bochs_open(BlockDriverState *bs, const char *filename, int flags) | @@ -121,9 +121,9 @@ static int bochs_open(BlockDriverState *bs, const char *filename, int flags) | ||
121 | if (fd < 0) | 121 | if (fd < 0) |
122 | return -1; | 122 | return -1; |
123 | } | 123 | } |
124 | - | 124 | + |
125 | bs->read_only = 1; // no write support yet | 125 | bs->read_only = 1; // no write support yet |
126 | - | 126 | + |
127 | s->fd = fd; | 127 | s->fd = fd; |
128 | 128 | ||
129 | if (read(fd, &bochs, sizeof(bochs)) != sizeof(bochs)) { | 129 | if (read(fd, &bochs, sizeof(bochs)) != sizeof(bochs)) { |
@@ -161,7 +161,7 @@ static int bochs_open(BlockDriverState *bs, const char *filename, int flags) | @@ -161,7 +161,7 @@ static int bochs_open(BlockDriverState *bs, const char *filename, int flags) | ||
161 | 161 | ||
162 | s->bitmap_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.bitmap) - 1) / 512; | 162 | s->bitmap_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.bitmap) - 1) / 512; |
163 | s->extent_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.extent) - 1) / 512; | 163 | s->extent_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.extent) - 1) / 512; |
164 | - | 164 | + |
165 | s->extent_size = le32_to_cpu(bochs.extra.redolog.extent); | 165 | s->extent_size = le32_to_cpu(bochs.extra.redolog.extent); |
166 | 166 | ||
167 | return 0; | 167 | return 0; |
@@ -180,7 +180,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) | @@ -180,7 +180,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) | ||
180 | // seek to sector | 180 | // seek to sector |
181 | extent_index = offset / s->extent_size; | 181 | extent_index = offset / s->extent_size; |
182 | extent_offset = (offset % s->extent_size) / 512; | 182 | extent_offset = (offset % s->extent_size) / 512; |
183 | - | 183 | + |
184 | if (s->catalog_bitmap[extent_index] == 0xffffffff) | 184 | if (s->catalog_bitmap[extent_index] == 0xffffffff) |
185 | { | 185 | { |
186 | // fprintf(stderr, "page not allocated [%x - %x:%x]\n", | 186 | // fprintf(stderr, "page not allocated [%x - %x:%x]\n", |
@@ -191,17 +191,17 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) | @@ -191,17 +191,17 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) | ||
191 | bitmap_offset = s->data_offset + (512 * s->catalog_bitmap[extent_index] * | 191 | bitmap_offset = s->data_offset + (512 * s->catalog_bitmap[extent_index] * |
192 | (s->extent_blocks + s->bitmap_blocks)); | 192 | (s->extent_blocks + s->bitmap_blocks)); |
193 | block_offset = bitmap_offset + (512 * (s->bitmap_blocks + extent_offset)); | 193 | block_offset = bitmap_offset + (512 * (s->bitmap_blocks + extent_offset)); |
194 | - | 194 | + |
195 | // fprintf(stderr, "sect: %x [ext i: %x o: %x] -> %x bitmap: %x block: %x\n", | 195 | // fprintf(stderr, "sect: %x [ext i: %x o: %x] -> %x bitmap: %x block: %x\n", |
196 | // sector_num, extent_index, extent_offset, | 196 | // sector_num, extent_index, extent_offset, |
197 | // le32_to_cpu(s->catalog_bitmap[extent_index]), | 197 | // le32_to_cpu(s->catalog_bitmap[extent_index]), |
198 | // bitmap_offset, block_offset); | 198 | // bitmap_offset, block_offset); |
199 | - | 199 | + |
200 | // read in bitmap for current extent | 200 | // read in bitmap for current extent |
201 | lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET); | 201 | lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET); |
202 | - | 202 | + |
203 | read(s->fd, &bitmap_entry, 1); | 203 | read(s->fd, &bitmap_entry, 1); |
204 | - | 204 | + |
205 | if (!((bitmap_entry >> (extent_offset % 8)) & 1)) | 205 | if (!((bitmap_entry >> (extent_offset % 8)) & 1)) |
206 | { | 206 | { |
207 | // fprintf(stderr, "sector (%x) in bitmap not allocated\n", | 207 | // fprintf(stderr, "sector (%x) in bitmap not allocated\n", |
@@ -210,7 +210,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) | @@ -210,7 +210,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) | ||
210 | } | 210 | } |
211 | 211 | ||
212 | lseek(s->fd, block_offset, SEEK_SET); | 212 | lseek(s->fd, block_offset, SEEK_SET); |
213 | - | 213 | + |
214 | return 0; | 214 | return 0; |
215 | } | 215 | } |
216 | 216 |
block-cloop.c
@@ -96,7 +96,7 @@ cloop_close: | @@ -96,7 +96,7 @@ cloop_close: | ||
96 | if(inflateInit(&s->zstream) != Z_OK) | 96 | if(inflateInit(&s->zstream) != Z_OK) |
97 | goto cloop_close; | 97 | goto cloop_close; |
98 | s->current_block=s->n_blocks; | 98 | s->current_block=s->n_blocks; |
99 | - | 99 | + |
100 | s->sectors_per_block = s->block_size/512; | 100 | s->sectors_per_block = s->block_size/512; |
101 | bs->total_sectors = s->n_blocks*s->sectors_per_block; | 101 | bs->total_sectors = s->n_blocks*s->sectors_per_block; |
102 | return 0; | 102 | return 0; |
@@ -107,7 +107,7 @@ static inline int cloop_read_block(BDRVCloopState *s,int block_num) | @@ -107,7 +107,7 @@ static inline int cloop_read_block(BDRVCloopState *s,int block_num) | ||
107 | if(s->current_block != block_num) { | 107 | if(s->current_block != block_num) { |
108 | int ret; | 108 | int ret; |
109 | uint32_t bytes = s->offsets[block_num+1]-s->offsets[block_num]; | 109 | uint32_t bytes = s->offsets[block_num+1]-s->offsets[block_num]; |
110 | - | 110 | + |
111 | lseek(s->fd, s->offsets[block_num], SEEK_SET); | 111 | lseek(s->fd, s->offsets[block_num], SEEK_SET); |
112 | ret = read(s->fd, s->compressed_block, bytes); | 112 | ret = read(s->fd, s->compressed_block, bytes); |
113 | if (ret != bytes) | 113 | if (ret != bytes) |
block-cow.c
@@ -85,14 +85,14 @@ static int cow_open(BlockDriverState *bs, const char *filename, int flags) | @@ -85,14 +85,14 @@ static int cow_open(BlockDriverState *bs, const char *filename, int flags) | ||
85 | be32_to_cpu(cow_header.version) != COW_VERSION) { | 85 | be32_to_cpu(cow_header.version) != COW_VERSION) { |
86 | goto fail; | 86 | goto fail; |
87 | } | 87 | } |
88 | - | 88 | + |
89 | /* cow image found */ | 89 | /* cow image found */ |
90 | size = be64_to_cpu(cow_header.size); | 90 | size = be64_to_cpu(cow_header.size); |
91 | bs->total_sectors = size / 512; | 91 | bs->total_sectors = size / 512; |
92 | 92 | ||
93 | pstrcpy(bs->backing_file, sizeof(bs->backing_file), | 93 | pstrcpy(bs->backing_file, sizeof(bs->backing_file), |
94 | cow_header.backing_file); | 94 | cow_header.backing_file); |
95 | - | 95 | + |
96 | /* mmap the bitmap */ | 96 | /* mmap the bitmap */ |
97 | s->cow_bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header); | 97 | s->cow_bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header); |
98 | s->cow_bitmap_addr = mmap(get_mmap_addr(s->cow_bitmap_size), | 98 | s->cow_bitmap_addr = mmap(get_mmap_addr(s->cow_bitmap_size), |
@@ -155,7 +155,7 @@ static int cow_read(BlockDriverState *bs, int64_t sector_num, | @@ -155,7 +155,7 @@ static int cow_read(BlockDriverState *bs, int64_t sector_num, | ||
155 | { | 155 | { |
156 | BDRVCowState *s = bs->opaque; | 156 | BDRVCowState *s = bs->opaque; |
157 | int ret, n; | 157 | int ret, n; |
158 | - | 158 | + |
159 | while (nb_sectors > 0) { | 159 | while (nb_sectors > 0) { |
160 | if (is_changed(s->cow_bitmap, sector_num, nb_sectors, &n)) { | 160 | if (is_changed(s->cow_bitmap, sector_num, nb_sectors, &n)) { |
161 | lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET); | 161 | lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET); |
@@ -184,7 +184,7 @@ static int cow_write(BlockDriverState *bs, int64_t sector_num, | @@ -184,7 +184,7 @@ static int cow_write(BlockDriverState *bs, int64_t sector_num, | ||
184 | { | 184 | { |
185 | BDRVCowState *s = bs->opaque; | 185 | BDRVCowState *s = bs->opaque; |
186 | int ret, i; | 186 | int ret, i; |
187 | - | 187 | + |
188 | lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET); | 188 | lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET); |
189 | ret = write(s->fd, buf, nb_sectors * 512); | 189 | ret = write(s->fd, buf, nb_sectors * 512); |
190 | if (ret != nb_sectors * 512) | 190 | if (ret != nb_sectors * 512) |
block-dmg.c
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | 28 | ||
29 | typedef struct BDRVDMGState { | 29 | typedef struct BDRVDMGState { |
30 | int fd; | 30 | int fd; |
31 | - | 31 | + |
32 | /* each chunk contains a certain number of sectors, | 32 | /* each chunk contains a certain number of sectors, |
33 | * offsets[i] is the offset in the .dmg file, | 33 | * offsets[i] is the offset in the .dmg file, |
34 | * lengths[i] is the length of the compressed chunk, | 34 | * lengths[i] is the length of the compressed chunk, |
@@ -86,7 +86,7 @@ static int dmg_open(BlockDriverState *bs, const char *filename, int flags) | @@ -86,7 +86,7 @@ static int dmg_open(BlockDriverState *bs, const char *filename, int flags) | ||
86 | bs->read_only = 1; | 86 | bs->read_only = 1; |
87 | s->n_chunks = 0; | 87 | s->n_chunks = 0; |
88 | s->offsets = s->lengths = s->sectors = s->sectorcounts = 0; | 88 | s->offsets = s->lengths = s->sectors = s->sectorcounts = 0; |
89 | - | 89 | + |
90 | /* read offset of info blocks */ | 90 | /* read offset of info blocks */ |
91 | if(lseek(s->fd,-0x1d8,SEEK_END)<0) { | 91 | if(lseek(s->fd,-0x1d8,SEEK_END)<0) { |
92 | dmg_close: | 92 | dmg_close: |
@@ -167,7 +167,7 @@ dmg_close: | @@ -167,7 +167,7 @@ dmg_close: | ||
167 | goto dmg_close; | 167 | goto dmg_close; |
168 | 168 | ||
169 | s->current_chunk = s->n_chunks; | 169 | s->current_chunk = s->n_chunks; |
170 | - | 170 | + |
171 | return 0; | 171 | return 0; |
172 | } | 172 | } |
173 | 173 |
block-qcow.c
@@ -80,7 +80,7 @@ static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset); | @@ -80,7 +80,7 @@ static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset); | ||
80 | static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename) | 80 | static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename) |
81 | { | 81 | { |
82 | const QCowHeader *cow_header = (const void *)buf; | 82 | const QCowHeader *cow_header = (const void *)buf; |
83 | - | 83 | + |
84 | if (buf_size >= sizeof(QCowHeader) && | 84 | if (buf_size >= sizeof(QCowHeader) && |
85 | be32_to_cpu(cow_header->magic) == QCOW_MAGIC && | 85 | be32_to_cpu(cow_header->magic) == QCOW_MAGIC && |
86 | be32_to_cpu(cow_header->version) == QCOW_VERSION) | 86 | be32_to_cpu(cow_header->version) == QCOW_VERSION) |
@@ -108,7 +108,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags) | @@ -108,7 +108,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags) | ||
108 | be64_to_cpus(&header.size); | 108 | be64_to_cpus(&header.size); |
109 | be32_to_cpus(&header.crypt_method); | 109 | be32_to_cpus(&header.crypt_method); |
110 | be64_to_cpus(&header.l1_table_offset); | 110 | be64_to_cpus(&header.l1_table_offset); |
111 | - | 111 | + |
112 | if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION) | 112 | if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION) |
113 | goto fail; | 113 | goto fail; |
114 | if (header.size <= 1 || header.cluster_bits < 9) | 114 | if (header.size <= 1 || header.cluster_bits < 9) |
@@ -151,7 +151,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags) | @@ -151,7 +151,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags) | ||
151 | if (!s->cluster_data) | 151 | if (!s->cluster_data) |
152 | goto fail; | 152 | goto fail; |
153 | s->cluster_cache_offset = -1; | 153 | s->cluster_cache_offset = -1; |
154 | - | 154 | + |
155 | /* read the backing file name */ | 155 | /* read the backing file name */ |
156 | if (header.backing_file_offset != 0) { | 156 | if (header.backing_file_offset != 0) { |
157 | len = header.backing_file_size; | 157 | len = header.backing_file_size; |
@@ -177,7 +177,7 @@ static int qcow_set_key(BlockDriverState *bs, const char *key) | @@ -177,7 +177,7 @@ static int qcow_set_key(BlockDriverState *bs, const char *key) | ||
177 | BDRVQcowState *s = bs->opaque; | 177 | BDRVQcowState *s = bs->opaque; |
178 | uint8_t keybuf[16]; | 178 | uint8_t keybuf[16]; |
179 | int len, i; | 179 | int len, i; |
180 | - | 180 | + |
181 | memset(keybuf, 0, 16); | 181 | memset(keybuf, 0, 16); |
182 | len = strlen(key); | 182 | len = strlen(key); |
183 | if (len > 16) | 183 | if (len > 16) |
@@ -262,7 +262,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, | @@ -262,7 +262,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, | ||
262 | uint64_t l2_offset, *l2_table, cluster_offset, tmp; | 262 | uint64_t l2_offset, *l2_table, cluster_offset, tmp; |
263 | uint32_t min_count; | 263 | uint32_t min_count; |
264 | int new_l2_table; | 264 | int new_l2_table; |
265 | - | 265 | + |
266 | l1_index = offset >> (s->l2_bits + s->cluster_bits); | 266 | l1_index = offset >> (s->l2_bits + s->cluster_bits); |
267 | l2_offset = s->l1_table[l1_index]; | 267 | l2_offset = s->l1_table[l1_index]; |
268 | new_l2_table = 0; | 268 | new_l2_table = 0; |
@@ -420,7 +420,7 @@ static int decompress_buffer(uint8_t *out_buf, int out_buf_size, | @@ -420,7 +420,7 @@ static int decompress_buffer(uint8_t *out_buf, int out_buf_size, | ||
420 | inflateEnd(strm); | 420 | inflateEnd(strm); |
421 | return 0; | 421 | return 0; |
422 | } | 422 | } |
423 | - | 423 | + |
424 | static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset) | 424 | static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset) |
425 | { | 425 | { |
426 | int ret, csize; | 426 | int ret, csize; |
@@ -450,7 +450,7 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num, | @@ -450,7 +450,7 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num, | ||
450 | BDRVQcowState *s = bs->opaque; | 450 | BDRVQcowState *s = bs->opaque; |
451 | int ret, index_in_cluster, n; | 451 | int ret, index_in_cluster, n; |
452 | uint64_t cluster_offset; | 452 | uint64_t cluster_offset; |
453 | - | 453 | + |
454 | while (nb_sectors > 0) { | 454 | while (nb_sectors > 0) { |
455 | cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0); | 455 | cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0); |
456 | index_in_cluster = sector_num & (s->cluster_sectors - 1); | 456 | index_in_cluster = sector_num & (s->cluster_sectors - 1); |
@@ -493,7 +493,7 @@ static int qcow_write(BlockDriverState *bs, int64_t sector_num, | @@ -493,7 +493,7 @@ static int qcow_write(BlockDriverState *bs, int64_t sector_num, | ||
493 | BDRVQcowState *s = bs->opaque; | 493 | BDRVQcowState *s = bs->opaque; |
494 | int ret, index_in_cluster, n; | 494 | int ret, index_in_cluster, n; |
495 | uint64_t cluster_offset; | 495 | uint64_t cluster_offset; |
496 | - | 496 | + |
497 | while (nb_sectors > 0) { | 497 | while (nb_sectors > 0) { |
498 | index_in_cluster = sector_num & (s->cluster_sectors - 1); | 498 | index_in_cluster = sector_num & (s->cluster_sectors - 1); |
499 | n = s->cluster_sectors - index_in_cluster; | 499 | n = s->cluster_sectors - index_in_cluster; |
@@ -572,7 +572,7 @@ static void qcow_aio_read_cb(void *opaque, int ret) | @@ -572,7 +572,7 @@ static void qcow_aio_read_cb(void *opaque, int ret) | ||
572 | qemu_aio_release(acb); | 572 | qemu_aio_release(acb); |
573 | return; | 573 | return; |
574 | } | 574 | } |
575 | - | 575 | + |
576 | /* prepare next AIO request */ | 576 | /* prepare next AIO request */ |
577 | acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, | 577 | acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, |
578 | 0, 0, 0, 0); | 578 | 0, 0, 0, 0); |
@@ -627,7 +627,7 @@ static BlockDriverAIOCB *qcow_aio_read(BlockDriverState *bs, | @@ -627,7 +627,7 @@ static BlockDriverAIOCB *qcow_aio_read(BlockDriverState *bs, | ||
627 | acb->buf = buf; | 627 | acb->buf = buf; |
628 | acb->nb_sectors = nb_sectors; | 628 | acb->nb_sectors = nb_sectors; |
629 | acb->n = 0; | 629 | acb->n = 0; |
630 | - acb->cluster_offset = 0; | 630 | + acb->cluster_offset = 0; |
631 | 631 | ||
632 | qcow_aio_read_cb(acb, 0); | 632 | qcow_aio_read_cb(acb, 0); |
633 | return &acb->common; | 633 | return &acb->common; |
@@ -661,7 +661,7 @@ static void qcow_aio_write_cb(void *opaque, int ret) | @@ -661,7 +661,7 @@ static void qcow_aio_write_cb(void *opaque, int ret) | ||
661 | qemu_aio_release(acb); | 661 | qemu_aio_release(acb); |
662 | return; | 662 | return; |
663 | } | 663 | } |
664 | - | 664 | + |
665 | index_in_cluster = acb->sector_num & (s->cluster_sectors - 1); | 665 | index_in_cluster = acb->sector_num & (s->cluster_sectors - 1); |
666 | acb->n = s->cluster_sectors - index_in_cluster; | 666 | acb->n = s->cluster_sectors - index_in_cluster; |
667 | if (acb->n > acb->nb_sectors) | 667 | if (acb->n > acb->nb_sectors) |
@@ -701,7 +701,7 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs, | @@ -701,7 +701,7 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs, | ||
701 | { | 701 | { |
702 | BDRVQcowState *s = bs->opaque; | 702 | BDRVQcowState *s = bs->opaque; |
703 | QCowAIOCB *acb; | 703 | QCowAIOCB *acb; |
704 | - | 704 | + |
705 | s->cluster_cache_offset = -1; /* disable compressed cache */ | 705 | s->cluster_cache_offset = -1; /* disable compressed cache */ |
706 | 706 | ||
707 | acb = qemu_aio_get(bs, cb, opaque); | 707 | acb = qemu_aio_get(bs, cb, opaque); |
@@ -712,7 +712,7 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs, | @@ -712,7 +712,7 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs, | ||
712 | acb->buf = (uint8_t *)buf; | 712 | acb->buf = (uint8_t *)buf; |
713 | acb->nb_sectors = nb_sectors; | 713 | acb->nb_sectors = nb_sectors; |
714 | acb->n = 0; | 714 | acb->n = 0; |
715 | - | 715 | + |
716 | qcow_aio_write_cb(acb, 0); | 716 | qcow_aio_write_cb(acb, 0); |
717 | return &acb->common; | 717 | return &acb->common; |
718 | } | 718 | } |
@@ -774,7 +774,7 @@ static int qcow_create(const char *filename, int64_t total_size, | @@ -774,7 +774,7 @@ static int qcow_create(const char *filename, int64_t total_size, | ||
774 | } else { | 774 | } else { |
775 | header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE); | 775 | header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE); |
776 | } | 776 | } |
777 | - | 777 | + |
778 | /* write all the data */ | 778 | /* write all the data */ |
779 | write(fd, &header, sizeof(header)); | 779 | write(fd, &header, sizeof(header)); |
780 | if (backing_file) { | 780 | if (backing_file) { |
@@ -864,7 +864,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num, | @@ -864,7 +864,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num, | ||
864 | return -1; | 864 | return -1; |
865 | } | 865 | } |
866 | } | 866 | } |
867 | - | 867 | + |
868 | qemu_free(out_buf); | 868 | qemu_free(out_buf); |
869 | return 0; | 869 | return 0; |
870 | } | 870 | } |
block-qcow2.c
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | - Size of compressed clusters is stored in sectors to reduce bit usage | 37 | - Size of compressed clusters is stored in sectors to reduce bit usage |
38 | in the cluster offsets. | 38 | in the cluster offsets. |
39 | - Support for storing additional data (such as the VM state) in the | 39 | - Support for storing additional data (such as the VM state) in the |
40 | - snapshots. | 40 | + snapshots. |
41 | - If a backing store is used, the cluster size is not constrained | 41 | - If a backing store is used, the cluster size is not constrained |
42 | (could be backported to QCOW). | 42 | (could be backported to QCOW). |
43 | - L2 tables have always a size of one cluster. | 43 | - L2 tables have always a size of one cluster. |
@@ -176,7 +176,7 @@ static void check_refcounts(BlockDriverState *bs); | @@ -176,7 +176,7 @@ static void check_refcounts(BlockDriverState *bs); | ||
176 | static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename) | 176 | static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename) |
177 | { | 177 | { |
178 | const QCowHeader *cow_header = (const void *)buf; | 178 | const QCowHeader *cow_header = (const void *)buf; |
179 | - | 179 | + |
180 | if (buf_size >= sizeof(QCowHeader) && | 180 | if (buf_size >= sizeof(QCowHeader) && |
181 | be32_to_cpu(cow_header->magic) == QCOW_MAGIC && | 181 | be32_to_cpu(cow_header->magic) == QCOW_MAGIC && |
182 | be32_to_cpu(cow_header->version) == QCOW_VERSION) | 182 | be32_to_cpu(cow_header->version) == QCOW_VERSION) |
@@ -209,7 +209,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags) | @@ -209,7 +209,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags) | ||
209 | be32_to_cpus(&header.refcount_table_clusters); | 209 | be32_to_cpus(&header.refcount_table_clusters); |
210 | be64_to_cpus(&header.snapshots_offset); | 210 | be64_to_cpus(&header.snapshots_offset); |
211 | be32_to_cpus(&header.nb_snapshots); | 211 | be32_to_cpus(&header.nb_snapshots); |
212 | - | 212 | + |
213 | if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION) | 213 | if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION) |
214 | goto fail; | 214 | goto fail; |
215 | if (header.size <= 1 || | 215 | if (header.size <= 1 || |
@@ -267,7 +267,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags) | @@ -267,7 +267,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags) | ||
267 | if (!s->cluster_data) | 267 | if (!s->cluster_data) |
268 | goto fail; | 268 | goto fail; |
269 | s->cluster_cache_offset = -1; | 269 | s->cluster_cache_offset = -1; |
270 | - | 270 | + |
271 | if (refcount_init(bs) < 0) | 271 | if (refcount_init(bs) < 0) |
272 | goto fail; | 272 | goto fail; |
273 | 273 | ||
@@ -304,7 +304,7 @@ static int qcow_set_key(BlockDriverState *bs, const char *key) | @@ -304,7 +304,7 @@ static int qcow_set_key(BlockDriverState *bs, const char *key) | ||
304 | BDRVQcowState *s = bs->opaque; | 304 | BDRVQcowState *s = bs->opaque; |
305 | uint8_t keybuf[16]; | 305 | uint8_t keybuf[16]; |
306 | int len, i; | 306 | int len, i; |
307 | - | 307 | + |
308 | memset(keybuf, 0, 16); | 308 | memset(keybuf, 0, 16); |
309 | len = strlen(key); | 309 | len = strlen(key); |
310 | if (len > 16) | 310 | if (len > 16) |
@@ -451,7 +451,7 @@ static int grow_l1_table(BlockDriverState *bs, int min_size) | @@ -451,7 +451,7 @@ static int grow_l1_table(BlockDriverState *bs, int min_size) | ||
451 | 451 | ||
452 | /* write new table (align to cluster) */ | 452 | /* write new table (align to cluster) */ |
453 | new_l1_table_offset = alloc_clusters(bs, new_l1_size2); | 453 | new_l1_table_offset = alloc_clusters(bs, new_l1_size2); |
454 | - | 454 | + |
455 | for(i = 0; i < s->l1_size; i++) | 455 | for(i = 0; i < s->l1_size; i++) |
456 | new_l1_table[i] = cpu_to_be64(new_l1_table[i]); | 456 | new_l1_table[i] = cpu_to_be64(new_l1_table[i]); |
457 | ret = bdrv_pwrite(s->hd, new_l1_table_offset, new_l1_table, new_l1_size2); | 457 | ret = bdrv_pwrite(s->hd, new_l1_table_offset, new_l1_table, new_l1_size2); |
@@ -459,7 +459,7 @@ static int grow_l1_table(BlockDriverState *bs, int min_size) | @@ -459,7 +459,7 @@ static int grow_l1_table(BlockDriverState *bs, int min_size) | ||
459 | goto fail; | 459 | goto fail; |
460 | for(i = 0; i < s->l1_size; i++) | 460 | for(i = 0; i < s->l1_size; i++) |
461 | new_l1_table[i] = be64_to_cpu(new_l1_table[i]); | 461 | new_l1_table[i] = be64_to_cpu(new_l1_table[i]); |
462 | - | 462 | + |
463 | /* set new table */ | 463 | /* set new table */ |
464 | data64 = cpu_to_be64(new_l1_table_offset); | 464 | data64 = cpu_to_be64(new_l1_table_offset); |
465 | if (bdrv_pwrite(s->hd, offsetof(QCowHeader, l1_table_offset), | 465 | if (bdrv_pwrite(s->hd, offsetof(QCowHeader, l1_table_offset), |
@@ -501,7 +501,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, | @@ -501,7 +501,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, | ||
501 | BDRVQcowState *s = bs->opaque; | 501 | BDRVQcowState *s = bs->opaque; |
502 | int min_index, i, j, l1_index, l2_index, ret; | 502 | int min_index, i, j, l1_index, l2_index, ret; |
503 | uint64_t l2_offset, *l2_table, cluster_offset, tmp, old_l2_offset; | 503 | uint64_t l2_offset, *l2_table, cluster_offset, tmp, old_l2_offset; |
504 | - | 504 | + |
505 | l1_index = offset >> (s->l2_bits + s->cluster_bits); | 505 | l1_index = offset >> (s->l2_bits + s->cluster_bits); |
506 | if (l1_index >= s->l1_size) { | 506 | if (l1_index >= s->l1_size) { |
507 | /* outside l1 table is allowed: we grow the table if needed */ | 507 | /* outside l1 table is allowed: we grow the table if needed */ |
@@ -600,7 +600,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, | @@ -600,7 +600,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, | ||
600 | written */ | 600 | written */ |
601 | if ((n_end - n_start) < s->cluster_sectors) { | 601 | if ((n_end - n_start) < s->cluster_sectors) { |
602 | uint64_t start_sect; | 602 | uint64_t start_sect; |
603 | - | 603 | + |
604 | start_sect = (offset & ~(s->cluster_size - 1)) >> 9; | 604 | start_sect = (offset & ~(s->cluster_size - 1)) >> 9; |
605 | ret = copy_sectors(bs, start_sect, | 605 | ret = copy_sectors(bs, start_sect, |
606 | cluster_offset, 0, n_start); | 606 | cluster_offset, 0, n_start); |
@@ -672,7 +672,7 @@ static int decompress_buffer(uint8_t *out_buf, int out_buf_size, | @@ -672,7 +672,7 @@ static int decompress_buffer(uint8_t *out_buf, int out_buf_size, | ||
672 | inflateEnd(strm); | 672 | inflateEnd(strm); |
673 | return 0; | 673 | return 0; |
674 | } | 674 | } |
675 | - | 675 | + |
676 | static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset) | 676 | static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset) |
677 | { | 677 | { |
678 | int ret, csize, nb_csectors, sector_offset; | 678 | int ret, csize, nb_csectors, sector_offset; |
@@ -717,7 +717,7 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num, | @@ -717,7 +717,7 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num, | ||
717 | BDRVQcowState *s = bs->opaque; | 717 | BDRVQcowState *s = bs->opaque; |
718 | int ret, index_in_cluster, n, n1; | 718 | int ret, index_in_cluster, n, n1; |
719 | uint64_t cluster_offset; | 719 | uint64_t cluster_offset; |
720 | - | 720 | + |
721 | while (nb_sectors > 0) { | 721 | while (nb_sectors > 0) { |
722 | cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0); | 722 | cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0); |
723 | index_in_cluster = sector_num & (s->cluster_sectors - 1); | 723 | index_in_cluster = sector_num & (s->cluster_sectors - 1); |
@@ -762,7 +762,7 @@ static int qcow_write(BlockDriverState *bs, int64_t sector_num, | @@ -762,7 +762,7 @@ static int qcow_write(BlockDriverState *bs, int64_t sector_num, | ||
762 | BDRVQcowState *s = bs->opaque; | 762 | BDRVQcowState *s = bs->opaque; |
763 | int ret, index_in_cluster, n; | 763 | int ret, index_in_cluster, n; |
764 | uint64_t cluster_offset; | 764 | uint64_t cluster_offset; |
765 | - | 765 | + |
766 | while (nb_sectors > 0) { | 766 | while (nb_sectors > 0) { |
767 | index_in_cluster = sector_num & (s->cluster_sectors - 1); | 767 | index_in_cluster = sector_num & (s->cluster_sectors - 1); |
768 | n = s->cluster_sectors - index_in_cluster; | 768 | n = s->cluster_sectors - index_in_cluster; |
@@ -841,7 +841,7 @@ static void qcow_aio_read_cb(void *opaque, int ret) | @@ -841,7 +841,7 @@ static void qcow_aio_read_cb(void *opaque, int ret) | ||
841 | qemu_aio_release(acb); | 841 | qemu_aio_release(acb); |
842 | return; | 842 | return; |
843 | } | 843 | } |
844 | - | 844 | + |
845 | /* prepare next AIO request */ | 845 | /* prepare next AIO request */ |
846 | acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, | 846 | acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, |
847 | 0, 0, 0, 0); | 847 | 0, 0, 0, 0); |
@@ -948,7 +948,7 @@ static void qcow_aio_write_cb(void *opaque, int ret) | @@ -948,7 +948,7 @@ static void qcow_aio_write_cb(void *opaque, int ret) | ||
948 | qemu_aio_release(acb); | 948 | qemu_aio_release(acb); |
949 | return; | 949 | return; |
950 | } | 950 | } |
951 | - | 951 | + |
952 | index_in_cluster = acb->sector_num & (s->cluster_sectors - 1); | 952 | index_in_cluster = acb->sector_num & (s->cluster_sectors - 1); |
953 | acb->n = s->cluster_sectors - index_in_cluster; | 953 | acb->n = s->cluster_sectors - index_in_cluster; |
954 | if (acb->n > acb->nb_sectors) | 954 | if (acb->n > acb->nb_sectors) |
@@ -988,13 +988,13 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs, | @@ -988,13 +988,13 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs, | ||
988 | { | 988 | { |
989 | BDRVQcowState *s = bs->opaque; | 989 | BDRVQcowState *s = bs->opaque; |
990 | QCowAIOCB *acb; | 990 | QCowAIOCB *acb; |
991 | - | 991 | + |
992 | s->cluster_cache_offset = -1; /* disable compressed cache */ | 992 | s->cluster_cache_offset = -1; /* disable compressed cache */ |
993 | 993 | ||
994 | acb = qcow_aio_setup(bs, sector_num, (uint8_t*)buf, nb_sectors, cb, opaque); | 994 | acb = qcow_aio_setup(bs, sector_num, (uint8_t*)buf, nb_sectors, cb, opaque); |
995 | if (!acb) | 995 | if (!acb) |
996 | return NULL; | 996 | return NULL; |
997 | - | 997 | + |
998 | qcow_aio_write_cb(acb, 0); | 998 | qcow_aio_write_cb(acb, 0); |
999 | return &acb->common; | 999 | return &acb->common; |
1000 | } | 1000 | } |
@@ -1054,7 +1054,7 @@ static int qcow_create(const char *filename, int64_t total_size, | @@ -1054,7 +1054,7 @@ static int qcow_create(const char *filename, int64_t total_size, | ||
1054 | QCowHeader header; | 1054 | QCowHeader header; |
1055 | uint64_t tmp, offset; | 1055 | uint64_t tmp, offset; |
1056 | QCowCreateState s1, *s = &s1; | 1056 | QCowCreateState s1, *s = &s1; |
1057 | - | 1057 | + |
1058 | memset(s, 0, sizeof(*s)); | 1058 | memset(s, 0, sizeof(*s)); |
1059 | 1059 | ||
1060 | fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); | 1060 | fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); |
@@ -1096,7 +1096,7 @@ static int qcow_create(const char *filename, int64_t total_size, | @@ -1096,7 +1096,7 @@ static int qcow_create(const char *filename, int64_t total_size, | ||
1096 | s->refcount_block = qemu_mallocz(s->cluster_size); | 1096 | s->refcount_block = qemu_mallocz(s->cluster_size); |
1097 | if (!s->refcount_block) | 1097 | if (!s->refcount_block) |
1098 | goto fail; | 1098 | goto fail; |
1099 | - | 1099 | + |
1100 | s->refcount_table_offset = offset; | 1100 | s->refcount_table_offset = offset; |
1101 | header.refcount_table_offset = cpu_to_be64(offset); | 1101 | header.refcount_table_offset = cpu_to_be64(offset); |
1102 | header.refcount_table_clusters = cpu_to_be32(1); | 1102 | header.refcount_table_clusters = cpu_to_be32(1); |
@@ -1111,7 +1111,7 @@ static int qcow_create(const char *filename, int64_t total_size, | @@ -1111,7 +1111,7 @@ static int qcow_create(const char *filename, int64_t total_size, | ||
1111 | create_refcount_update(s, s->l1_table_offset, l1_size * sizeof(uint64_t)); | 1111 | create_refcount_update(s, s->l1_table_offset, l1_size * sizeof(uint64_t)); |
1112 | create_refcount_update(s, s->refcount_table_offset, s->cluster_size); | 1112 | create_refcount_update(s, s->refcount_table_offset, s->cluster_size); |
1113 | create_refcount_update(s, s->refcount_block_offset, s->cluster_size); | 1113 | create_refcount_update(s, s->refcount_block_offset, s->cluster_size); |
1114 | - | 1114 | + |
1115 | /* write all the data */ | 1115 | /* write all the data */ |
1116 | write(fd, &header, sizeof(header)); | 1116 | write(fd, &header, sizeof(header)); |
1117 | if (backing_file) { | 1117 | if (backing_file) { |
@@ -1124,7 +1124,7 @@ static int qcow_create(const char *filename, int64_t total_size, | @@ -1124,7 +1124,7 @@ static int qcow_create(const char *filename, int64_t total_size, | ||
1124 | } | 1124 | } |
1125 | lseek(fd, s->refcount_table_offset, SEEK_SET); | 1125 | lseek(fd, s->refcount_table_offset, SEEK_SET); |
1126 | write(fd, s->refcount_table, s->cluster_size); | 1126 | write(fd, s->refcount_table, s->cluster_size); |
1127 | - | 1127 | + |
1128 | lseek(fd, s->refcount_block_offset, SEEK_SET); | 1128 | lseek(fd, s->refcount_block_offset, SEEK_SET); |
1129 | write(fd, s->refcount_block, s->cluster_size); | 1129 | write(fd, s->refcount_block, s->cluster_size); |
1130 | 1130 | ||
@@ -1153,7 +1153,7 @@ static int qcow_make_empty(BlockDriverState *bs) | @@ -1153,7 +1153,7 @@ static int qcow_make_empty(BlockDriverState *bs) | ||
1153 | ret = bdrv_truncate(s->hd, s->l1_table_offset + l1_length); | 1153 | ret = bdrv_truncate(s->hd, s->l1_table_offset + l1_length); |
1154 | if (ret < 0) | 1154 | if (ret < 0) |
1155 | return ret; | 1155 | return ret; |
1156 | - | 1156 | + |
1157 | l2_cache_reset(bs); | 1157 | l2_cache_reset(bs); |
1158 | #endif | 1158 | #endif |
1159 | return 0; | 1159 | return 0; |
@@ -1223,7 +1223,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num, | @@ -1223,7 +1223,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num, | ||
1223 | return -1; | 1223 | return -1; |
1224 | } | 1224 | } |
1225 | } | 1225 | } |
1226 | - | 1226 | + |
1227 | qemu_free(out_buf); | 1227 | qemu_free(out_buf); |
1228 | return 0; | 1228 | return 0; |
1229 | } | 1229 | } |
@@ -1256,7 +1256,7 @@ static int update_snapshot_refcount(BlockDriverState *bs, | @@ -1256,7 +1256,7 @@ static int update_snapshot_refcount(BlockDriverState *bs, | ||
1256 | uint64_t *l1_table, *l2_table, l2_offset, offset, l1_size2, l1_allocated; | 1256 | uint64_t *l1_table, *l2_table, l2_offset, offset, l1_size2, l1_allocated; |
1257 | int64_t old_offset, old_l2_offset; | 1257 | int64_t old_offset, old_l2_offset; |
1258 | int l2_size, i, j, l1_modified, l2_modified, nb_csectors, refcount; | 1258 | int l2_size, i, j, l1_modified, l2_modified, nb_csectors, refcount; |
1259 | - | 1259 | + |
1260 | l2_cache_reset(bs); | 1260 | l2_cache_reset(bs); |
1261 | 1261 | ||
1262 | l2_table = NULL; | 1262 | l2_table = NULL; |
@@ -1278,7 +1278,7 @@ static int update_snapshot_refcount(BlockDriverState *bs, | @@ -1278,7 +1278,7 @@ static int update_snapshot_refcount(BlockDriverState *bs, | ||
1278 | l1_table = s->l1_table; | 1278 | l1_table = s->l1_table; |
1279 | l1_allocated = 0; | 1279 | l1_allocated = 0; |
1280 | } | 1280 | } |
1281 | - | 1281 | + |
1282 | l2_size = s->l2_size * sizeof(uint64_t); | 1282 | l2_size = s->l2_size * sizeof(uint64_t); |
1283 | l2_table = qemu_malloc(l2_size); | 1283 | l2_table = qemu_malloc(l2_size); |
1284 | if (!l2_table) | 1284 | if (!l2_table) |
@@ -1455,7 +1455,7 @@ static int qcow_write_snapshots(BlockDriverState *bs) | @@ -1455,7 +1455,7 @@ static int qcow_write_snapshots(BlockDriverState *bs) | ||
1455 | 1455 | ||
1456 | snapshots_offset = alloc_clusters(bs, snapshots_size); | 1456 | snapshots_offset = alloc_clusters(bs, snapshots_size); |
1457 | offset = snapshots_offset; | 1457 | offset = snapshots_offset; |
1458 | - | 1458 | + |
1459 | for(i = 0; i < s->nb_snapshots; i++) { | 1459 | for(i = 0; i < s->nb_snapshots; i++) { |
1460 | sn = s->snapshots + i; | 1460 | sn = s->snapshots + i; |
1461 | memset(&h, 0, sizeof(h)); | 1461 | memset(&h, 0, sizeof(h)); |
@@ -1465,7 +1465,7 @@ static int qcow_write_snapshots(BlockDriverState *bs) | @@ -1465,7 +1465,7 @@ static int qcow_write_snapshots(BlockDriverState *bs) | ||
1465 | h.date_sec = cpu_to_be32(sn->date_sec); | 1465 | h.date_sec = cpu_to_be32(sn->date_sec); |
1466 | h.date_nsec = cpu_to_be32(sn->date_nsec); | 1466 | h.date_nsec = cpu_to_be32(sn->date_nsec); |
1467 | h.vm_clock_nsec = cpu_to_be64(sn->vm_clock_nsec); | 1467 | h.vm_clock_nsec = cpu_to_be64(sn->vm_clock_nsec); |
1468 | - | 1468 | + |
1469 | id_str_size = strlen(sn->id_str); | 1469 | id_str_size = strlen(sn->id_str); |
1470 | name_size = strlen(sn->name); | 1470 | name_size = strlen(sn->name); |
1471 | h.id_str_size = cpu_to_be16(id_str_size); | 1471 | h.id_str_size = cpu_to_be16(id_str_size); |
@@ -1533,7 +1533,7 @@ static int find_snapshot_by_id_or_name(BlockDriverState *bs, const char *name) | @@ -1533,7 +1533,7 @@ static int find_snapshot_by_id_or_name(BlockDriverState *bs, const char *name) | ||
1533 | { | 1533 | { |
1534 | BDRVQcowState *s = bs->opaque; | 1534 | BDRVQcowState *s = bs->opaque; |
1535 | int i, ret; | 1535 | int i, ret; |
1536 | - | 1536 | + |
1537 | ret = find_snapshot_by_id(bs, name); | 1537 | ret = find_snapshot_by_id(bs, name); |
1538 | if (ret >= 0) | 1538 | if (ret >= 0) |
1539 | return ret; | 1539 | return ret; |
@@ -1552,7 +1552,7 @@ static int qcow_snapshot_create(BlockDriverState *bs, | @@ -1552,7 +1552,7 @@ static int qcow_snapshot_create(BlockDriverState *bs, | ||
1552 | QCowSnapshot *snapshots1, sn1, *sn = &sn1; | 1552 | QCowSnapshot *snapshots1, sn1, *sn = &sn1; |
1553 | int i, ret; | 1553 | int i, ret; |
1554 | uint64_t *l1_table = NULL; | 1554 | uint64_t *l1_table = NULL; |
1555 | - | 1555 | + |
1556 | memset(sn, 0, sizeof(*sn)); | 1556 | memset(sn, 0, sizeof(*sn)); |
1557 | 1557 | ||
1558 | if (sn_info->id_str[0] == '\0') { | 1558 | if (sn_info->id_str[0] == '\0') { |
@@ -1663,7 +1663,7 @@ static int qcow_snapshot_delete(BlockDriverState *bs, const char *snapshot_id) | @@ -1663,7 +1663,7 @@ static int qcow_snapshot_delete(BlockDriverState *bs, const char *snapshot_id) | ||
1663 | BDRVQcowState *s = bs->opaque; | 1663 | BDRVQcowState *s = bs->opaque; |
1664 | QCowSnapshot *sn; | 1664 | QCowSnapshot *sn; |
1665 | int snapshot_index, ret; | 1665 | int snapshot_index, ret; |
1666 | - | 1666 | + |
1667 | snapshot_index = find_snapshot_by_id_or_name(bs, snapshot_id); | 1667 | snapshot_index = find_snapshot_by_id_or_name(bs, snapshot_id); |
1668 | if (snapshot_index < 0) | 1668 | if (snapshot_index < 0) |
1669 | return -ENOENT; | 1669 | return -ENOENT; |
@@ -1731,7 +1731,7 @@ static int refcount_init(BlockDriverState *bs) | @@ -1731,7 +1731,7 @@ static int refcount_init(BlockDriverState *bs) | ||
1731 | { | 1731 | { |
1732 | BDRVQcowState *s = bs->opaque; | 1732 | BDRVQcowState *s = bs->opaque; |
1733 | int ret, refcount_table_size2, i; | 1733 | int ret, refcount_table_size2, i; |
1734 | - | 1734 | + |
1735 | s->refcount_block_cache = qemu_malloc(s->cluster_size); | 1735 | s->refcount_block_cache = qemu_malloc(s->cluster_size); |
1736 | if (!s->refcount_block_cache) | 1736 | if (!s->refcount_block_cache) |
1737 | goto fail; | 1737 | goto fail; |
@@ -1839,7 +1839,7 @@ static int64_t alloc_bytes(BlockDriverState *bs, int size) | @@ -1839,7 +1839,7 @@ static int64_t alloc_bytes(BlockDriverState *bs, int size) | ||
1839 | BDRVQcowState *s = bs->opaque; | 1839 | BDRVQcowState *s = bs->opaque; |
1840 | int64_t offset, cluster_offset; | 1840 | int64_t offset, cluster_offset; |
1841 | int free_in_cluster; | 1841 | int free_in_cluster; |
1842 | - | 1842 | + |
1843 | assert(size > 0 && size <= s->cluster_size); | 1843 | assert(size > 0 && size <= s->cluster_size); |
1844 | if (s->free_byte_offset == 0) { | 1844 | if (s->free_byte_offset == 0) { |
1845 | s->free_byte_offset = alloc_clusters(bs, s->cluster_size); | 1845 | s->free_byte_offset = alloc_clusters(bs, s->cluster_size); |
@@ -2043,7 +2043,7 @@ static void inc_refcounts(BlockDriverState *bs, | @@ -2043,7 +2043,7 @@ static void inc_refcounts(BlockDriverState *bs, | ||
2043 | BDRVQcowState *s = bs->opaque; | 2043 | BDRVQcowState *s = bs->opaque; |
2044 | int64_t start, last, cluster_offset; | 2044 | int64_t start, last, cluster_offset; |
2045 | int k; | 2045 | int k; |
2046 | - | 2046 | + |
2047 | if (size <= 0) | 2047 | if (size <= 0) |
2048 | return; | 2048 | return; |
2049 | 2049 | ||
@@ -2086,7 +2086,7 @@ static int check_refcounts_l1(BlockDriverState *bs, | @@ -2086,7 +2086,7 @@ static int check_refcounts_l1(BlockDriverState *bs, | ||
2086 | goto fail; | 2086 | goto fail; |
2087 | for(i = 0;i < l1_size; i++) | 2087 | for(i = 0;i < l1_size; i++) |
2088 | be64_to_cpus(&l1_table[i]); | 2088 | be64_to_cpus(&l1_table[i]); |
2089 | - | 2089 | + |
2090 | l2_size = s->l2_size * sizeof(uint64_t); | 2090 | l2_size = s->l2_size * sizeof(uint64_t); |
2091 | l2_table = qemu_malloc(l2_size); | 2091 | l2_table = qemu_malloc(l2_size); |
2092 | if (!l2_table) | 2092 | if (!l2_table) |
@@ -2165,7 +2165,7 @@ static void check_refcounts(BlockDriverState *bs) | @@ -2165,7 +2165,7 @@ static void check_refcounts(BlockDriverState *bs) | ||
2165 | /* header */ | 2165 | /* header */ |
2166 | inc_refcounts(bs, refcount_table, nb_clusters, | 2166 | inc_refcounts(bs, refcount_table, nb_clusters, |
2167 | 0, s->cluster_size); | 2167 | 0, s->cluster_size); |
2168 | - | 2168 | + |
2169 | check_refcounts_l1(bs, refcount_table, nb_clusters, | 2169 | check_refcounts_l1(bs, refcount_table, nb_clusters, |
2170 | s->l1_table_offset, s->l1_size, 1); | 2170 | s->l1_table_offset, s->l1_size, 1); |
2171 | 2171 |
block-raw.c
@@ -142,7 +142,7 @@ static int raw_pread(BlockDriverState *bs, int64_t offset, | @@ -142,7 +142,7 @@ static int raw_pread(BlockDriverState *bs, int64_t offset, | ||
142 | { | 142 | { |
143 | BDRVRawState *s = bs->opaque; | 143 | BDRVRawState *s = bs->opaque; |
144 | int ret; | 144 | int ret; |
145 | - | 145 | + |
146 | ret = fd_open(bs); | 146 | ret = fd_open(bs); |
147 | if (ret < 0) | 147 | if (ret < 0) |
148 | return ret; | 148 | return ret; |
@@ -194,7 +194,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset, | @@ -194,7 +194,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset, | ||
194 | { | 194 | { |
195 | BDRVRawState *s = bs->opaque; | 195 | BDRVRawState *s = bs->opaque; |
196 | int ret; | 196 | int ret; |
197 | - | 197 | + |
198 | ret = fd_open(bs); | 198 | ret = fd_open(bs); |
199 | if (ret < 0) | 199 | if (ret < 0) |
200 | return ret; | 200 | return ret; |
@@ -259,7 +259,7 @@ void qemu_aio_init(void) | @@ -259,7 +259,7 @@ void qemu_aio_init(void) | ||
259 | struct sigaction act; | 259 | struct sigaction act; |
260 | 260 | ||
261 | aio_initialized = 1; | 261 | aio_initialized = 1; |
262 | - | 262 | + |
263 | sigfillset(&act.sa_mask); | 263 | sigfillset(&act.sa_mask); |
264 | act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ | 264 | act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ |
265 | act.sa_handler = aio_signal_handler; | 265 | act.sa_handler = aio_signal_handler; |
@@ -547,7 +547,7 @@ BlockDriver bdrv_raw = { | @@ -547,7 +547,7 @@ BlockDriver bdrv_raw = { | ||
547 | raw_close, | 547 | raw_close, |
548 | raw_create, | 548 | raw_create, |
549 | raw_flush, | 549 | raw_flush, |
550 | - | 550 | + |
551 | .bdrv_aio_read = raw_aio_read, | 551 | .bdrv_aio_read = raw_aio_read, |
552 | .bdrv_aio_write = raw_aio_write, | 552 | .bdrv_aio_write = raw_aio_write, |
553 | .bdrv_aio_cancel = raw_aio_cancel, | 553 | .bdrv_aio_cancel = raw_aio_cancel, |
@@ -576,7 +576,7 @@ kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator ) | @@ -576,7 +576,7 @@ kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator ) | ||
576 | if ( KERN_SUCCESS != kernResult ) { | 576 | if ( KERN_SUCCESS != kernResult ) { |
577 | printf( "IOMasterPort returned %d\n", kernResult ); | 577 | printf( "IOMasterPort returned %d\n", kernResult ); |
578 | } | 578 | } |
579 | - | 579 | + |
580 | classesToMatch = IOServiceMatching( kIOCDMediaClass ); | 580 | classesToMatch = IOServiceMatching( kIOCDMediaClass ); |
581 | if ( classesToMatch == NULL ) { | 581 | if ( classesToMatch == NULL ) { |
582 | printf( "IOServiceMatching returned a NULL dictionary.\n" ); | 582 | printf( "IOServiceMatching returned a NULL dictionary.\n" ); |
@@ -588,7 +588,7 @@ kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator ) | @@ -588,7 +588,7 @@ kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator ) | ||
588 | { | 588 | { |
589 | printf( "IOServiceGetMatchingServices returned %d\n", kernResult ); | 589 | printf( "IOServiceGetMatchingServices returned %d\n", kernResult ); |
590 | } | 590 | } |
591 | - | 591 | + |
592 | return kernResult; | 592 | return kernResult; |
593 | } | 593 | } |
594 | 594 | ||
@@ -614,7 +614,7 @@ kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFIndex ma | @@ -614,7 +614,7 @@ kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFIndex ma | ||
614 | } | 614 | } |
615 | IOObjectRelease( nextMedia ); | 615 | IOObjectRelease( nextMedia ); |
616 | } | 616 | } |
617 | - | 617 | + |
618 | return kernResult; | 618 | return kernResult; |
619 | } | 619 | } |
620 | 620 | ||
@@ -634,7 +634,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) | @@ -634,7 +634,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) | ||
634 | 634 | ||
635 | kernResult = FindEjectableCDMedia( &mediaIterator ); | 635 | kernResult = FindEjectableCDMedia( &mediaIterator ); |
636 | kernResult = GetBSDPath( mediaIterator, bsdPath, sizeof( bsdPath ) ); | 636 | kernResult = GetBSDPath( mediaIterator, bsdPath, sizeof( bsdPath ) ); |
637 | - | 637 | + |
638 | if ( bsdPath[ 0 ] != '\0' ) { | 638 | if ( bsdPath[ 0 ] != '\0' ) { |
639 | strcat(bsdPath,"s0"); | 639 | strcat(bsdPath,"s0"); |
640 | /* some CDs don't have a partition 0 */ | 640 | /* some CDs don't have a partition 0 */ |
@@ -646,7 +646,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) | @@ -646,7 +646,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) | ||
646 | } | 646 | } |
647 | filename = bsdPath; | 647 | filename = bsdPath; |
648 | } | 648 | } |
649 | - | 649 | + |
650 | if ( mediaIterator ) | 650 | if ( mediaIterator ) |
651 | IOObjectRelease( mediaIterator ); | 651 | IOObjectRelease( mediaIterator ); |
652 | } | 652 | } |
@@ -883,7 +883,7 @@ BlockDriver bdrv_host_device = { | @@ -883,7 +883,7 @@ BlockDriver bdrv_host_device = { | ||
883 | raw_close, | 883 | raw_close, |
884 | NULL, | 884 | NULL, |
885 | raw_flush, | 885 | raw_flush, |
886 | - | 886 | + |
887 | .bdrv_aio_read = raw_aio_read, | 887 | .bdrv_aio_read = raw_aio_read, |
888 | .bdrv_aio_write = raw_aio_write, | 888 | .bdrv_aio_write = raw_aio_write, |
889 | .bdrv_aio_cancel = raw_aio_cancel, | 889 | .bdrv_aio_cancel = raw_aio_cancel, |
@@ -999,7 +999,7 @@ static int raw_pread(BlockDriverState *bs, int64_t offset, | @@ -999,7 +999,7 @@ static int raw_pread(BlockDriverState *bs, int64_t offset, | ||
999 | OVERLAPPED ov; | 999 | OVERLAPPED ov; |
1000 | DWORD ret_count; | 1000 | DWORD ret_count; |
1001 | int ret; | 1001 | int ret; |
1002 | - | 1002 | + |
1003 | memset(&ov, 0, sizeof(ov)); | 1003 | memset(&ov, 0, sizeof(ov)); |
1004 | ov.Offset = offset; | 1004 | ov.Offset = offset; |
1005 | ov.OffsetHigh = offset >> 32; | 1005 | ov.OffsetHigh = offset >> 32; |
@@ -1021,7 +1021,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset, | @@ -1021,7 +1021,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset, | ||
1021 | OVERLAPPED ov; | 1021 | OVERLAPPED ov; |
1022 | DWORD ret_count; | 1022 | DWORD ret_count; |
1023 | int ret; | 1023 | int ret; |
1024 | - | 1024 | + |
1025 | memset(&ov, 0, sizeof(ov)); | 1025 | memset(&ov, 0, sizeof(ov)); |
1026 | ov.Offset = offset; | 1026 | ov.Offset = offset; |
1027 | ov.OffsetHigh = offset >> 32; | 1027 | ov.OffsetHigh = offset >> 32; |
@@ -1256,7 +1256,7 @@ BlockDriver bdrv_raw = { | @@ -1256,7 +1256,7 @@ BlockDriver bdrv_raw = { | ||
1256 | raw_close, | 1256 | raw_close, |
1257 | raw_create, | 1257 | raw_create, |
1258 | raw_flush, | 1258 | raw_flush, |
1259 | - | 1259 | + |
1260 | #if 0 | 1260 | #if 0 |
1261 | .bdrv_aio_read = raw_aio_read, | 1261 | .bdrv_aio_read = raw_aio_read, |
1262 | .bdrv_aio_write = raw_aio_write, | 1262 | .bdrv_aio_write = raw_aio_write, |
@@ -1335,7 +1335,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) | @@ -1335,7 +1335,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) | ||
1335 | } | 1335 | } |
1336 | } | 1336 | } |
1337 | s->type = find_device_type(bs, filename); | 1337 | s->type = find_device_type(bs, filename); |
1338 | - | 1338 | + |
1339 | if ((flags & BDRV_O_ACCESS) == O_RDWR) { | 1339 | if ((flags & BDRV_O_ACCESS) == O_RDWR) { |
1340 | access_flags = GENERIC_READ | GENERIC_WRITE; | 1340 | access_flags = GENERIC_READ | GENERIC_WRITE; |
1341 | } else { | 1341 | } else { |
@@ -1406,7 +1406,7 @@ BlockDriver bdrv_host_device = { | @@ -1406,7 +1406,7 @@ BlockDriver bdrv_host_device = { | ||
1406 | raw_close, | 1406 | raw_close, |
1407 | NULL, | 1407 | NULL, |
1408 | raw_flush, | 1408 | raw_flush, |
1409 | - | 1409 | + |
1410 | #if 0 | 1410 | #if 0 |
1411 | .bdrv_aio_read = raw_aio_read, | 1411 | .bdrv_aio_read = raw_aio_read, |
1412 | .bdrv_aio_write = raw_aio_write, | 1412 | .bdrv_aio_write = raw_aio_write, |
block-vmdk.c
@@ -110,7 +110,7 @@ static int vmdk_probe(const uint8_t *buf, int buf_size, const char *filename) | @@ -110,7 +110,7 @@ static int vmdk_probe(const uint8_t *buf, int buf_size, const char *filename) | ||
110 | 110 | ||
111 | #define CHECK_CID 1 | 111 | #define CHECK_CID 1 |
112 | 112 | ||
113 | -#define SECTOR_SIZE 512 | 113 | +#define SECTOR_SIZE 512 |
114 | #define DESC_SIZE 20*SECTOR_SIZE // 20 sectors of 512 bytes each | 114 | #define DESC_SIZE 20*SECTOR_SIZE // 20 sectors of 512 bytes each |
115 | #define HEADER_SIZE 512 // first sector of 512 bytes | 115 | #define HEADER_SIZE 512 // first sector of 512 bytes |
116 | 116 | ||
@@ -308,7 +308,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file) | @@ -308,7 +308,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file) | ||
308 | 308 | ||
309 | fail_gd: | 309 | fail_gd: |
310 | qemu_free(gd_buf); | 310 | qemu_free(gd_buf); |
311 | - fail_rgd: | 311 | + fail_rgd: |
312 | qemu_free(rgd_buf); | 312 | qemu_free(rgd_buf); |
313 | fail: | 313 | fail: |
314 | close(p_fd); | 314 | close(p_fd); |
@@ -341,7 +341,7 @@ static int vmdk_parent_open(BlockDriverState *bs, const char * filename) | @@ -341,7 +341,7 @@ static int vmdk_parent_open(BlockDriverState *bs, const char * filename) | ||
341 | p_name += sizeof("parentFileNameHint") + 1; | 341 | p_name += sizeof("parentFileNameHint") + 1; |
342 | if ((end_name = strchr(p_name,'\"')) == 0) | 342 | if ((end_name = strchr(p_name,'\"')) == 0) |
343 | return -1; | 343 | return -1; |
344 | - | 344 | + |
345 | strncpy(s->hd->backing_file, p_name, end_name - p_name); | 345 | strncpy(s->hd->backing_file, p_name, end_name - p_name); |
346 | if (stat(s->hd->backing_file, &file_buf) != 0) { | 346 | if (stat(s->hd->backing_file, &file_buf) != 0) { |
347 | path_combine(parent_img_name, sizeof(parent_img_name), | 347 | path_combine(parent_img_name, sizeof(parent_img_name), |
@@ -761,8 +761,8 @@ static int vmdk_create(const char *filename, int64_t total_size, | @@ -761,8 +761,8 @@ static int vmdk_create(const char *filename, int64_t total_size, | ||
761 | header.check_bytes[1] = 0x20; | 761 | header.check_bytes[1] = 0x20; |
762 | header.check_bytes[2] = 0xd; | 762 | header.check_bytes[2] = 0xd; |
763 | header.check_bytes[3] = 0xa; | 763 | header.check_bytes[3] = 0xa; |
764 | - | ||
765 | - /* write all the data */ | 764 | + |
765 | + /* write all the data */ | ||
766 | write(fd, &magic, sizeof(magic)); | 766 | write(fd, &magic, sizeof(magic)); |
767 | write(fd, &header, sizeof(header)); | 767 | write(fd, &header, sizeof(header)); |
768 | 768 | ||
@@ -773,7 +773,7 @@ static int vmdk_create(const char *filename, int64_t total_size, | @@ -773,7 +773,7 @@ static int vmdk_create(const char *filename, int64_t total_size, | ||
773 | for (i = 0, tmp = header.rgd_offset + gd_size; | 773 | for (i = 0, tmp = header.rgd_offset + gd_size; |
774 | i < gt_count; i++, tmp += gt_size) | 774 | i < gt_count; i++, tmp += gt_size) |
775 | write(fd, &tmp, sizeof(tmp)); | 775 | write(fd, &tmp, sizeof(tmp)); |
776 | - | 776 | + |
777 | /* write backup grain directory */ | 777 | /* write backup grain directory */ |
778 | lseek(fd, le64_to_cpu(header.gd_offset) << 9, SEEK_SET); | 778 | lseek(fd, le64_to_cpu(header.gd_offset) << 9, SEEK_SET); |
779 | for (i = 0, tmp = header.gd_offset + gd_size; | 779 | for (i = 0, tmp = header.gd_offset + gd_size; |
block-vpc.c
@@ -65,7 +65,7 @@ struct vpc_subheader { | @@ -65,7 +65,7 @@ struct vpc_subheader { | ||
65 | 65 | ||
66 | typedef struct BDRVVPCState { | 66 | typedef struct BDRVVPCState { |
67 | int fd; | 67 | int fd; |
68 | - | 68 | + |
69 | int pagetable_entries; | 69 | int pagetable_entries; |
70 | uint32_t *pagetable; | 70 | uint32_t *pagetable; |
71 | 71 | ||
@@ -74,7 +74,7 @@ typedef struct BDRVVPCState { | @@ -74,7 +74,7 @@ typedef struct BDRVVPCState { | ||
74 | uint8_t *pageentry_u8; | 74 | uint8_t *pageentry_u8; |
75 | uint32_t *pageentry_u32; | 75 | uint32_t *pageentry_u32; |
76 | uint16_t *pageentry_u16; | 76 | uint16_t *pageentry_u16; |
77 | - | 77 | + |
78 | uint64_t last_bitmap; | 78 | uint64_t last_bitmap; |
79 | #endif | 79 | #endif |
80 | } BDRVVPCState; | 80 | } BDRVVPCState; |
@@ -97,7 +97,7 @@ static int vpc_open(BlockDriverState *bs, const char *filename, int flags) | @@ -97,7 +97,7 @@ static int vpc_open(BlockDriverState *bs, const char *filename, int flags) | ||
97 | return -1; | 97 | return -1; |
98 | 98 | ||
99 | bs->read_only = 1; // no write support yet | 99 | bs->read_only = 1; // no write support yet |
100 | - | 100 | + |
101 | s->fd = fd; | 101 | s->fd = fd; |
102 | 102 | ||
103 | if (read(fd, &header, HEADER_SIZE) != HEADER_SIZE) | 103 | if (read(fd, &header, HEADER_SIZE) != HEADER_SIZE) |
@@ -153,13 +153,13 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) | @@ -153,13 +153,13 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num) | ||
153 | 153 | ||
154 | pagetable_index = offset / s->pageentry_size; | 154 | pagetable_index = offset / s->pageentry_size; |
155 | pageentry_index = (offset % s->pageentry_size) / 512; | 155 | pageentry_index = (offset % s->pageentry_size) / 512; |
156 | - | 156 | + |
157 | if (pagetable_index > s->pagetable_entries || s->pagetable[pagetable_index] == 0xffffffff) | 157 | if (pagetable_index > s->pagetable_entries || s->pagetable[pagetable_index] == 0xffffffff) |
158 | return -1; // not allocated | 158 | return -1; // not allocated |
159 | 159 | ||
160 | bitmap_offset = 512 * s->pagetable[pagetable_index]; | 160 | bitmap_offset = 512 * s->pagetable[pagetable_index]; |
161 | block_offset = bitmap_offset + 512 + (512 * pageentry_index); | 161 | block_offset = bitmap_offset + 512 + (512 * pageentry_index); |
162 | - | 162 | + |
163 | // printf("sector: %" PRIx64 ", index: %x, offset: %x, bioff: %" PRIx64 ", bloff: %" PRIx64 "\n", | 163 | // printf("sector: %" PRIx64 ", index: %x, offset: %x, bioff: %" PRIx64 ", bloff: %" PRIx64 "\n", |
164 | // sector_num, pagetable_index, pageentry_index, | 164 | // sector_num, pagetable_index, pageentry_index, |
165 | // bitmap_offset, block_offset); | 165 | // bitmap_offset, block_offset); |
block-vvfat.c
@@ -153,7 +153,7 @@ static inline int array_roll(array_t* array,int index_to,int index_from,int coun | @@ -153,7 +153,7 @@ static inline int array_roll(array_t* array,int index_to,int index_from,int coun | ||
153 | index_to<0 || index_to>=array->next || | 153 | index_to<0 || index_to>=array->next || |
154 | index_from<0 || index_from>=array->next) | 154 | index_from<0 || index_from>=array->next) |
155 | return -1; | 155 | return -1; |
156 | - | 156 | + |
157 | if(index_to==index_from) | 157 | if(index_to==index_from) |
158 | return 0; | 158 | return 0; |
159 | 159 | ||
@@ -167,7 +167,7 @@ static inline int array_roll(array_t* array,int index_to,int index_from,int coun | @@ -167,7 +167,7 @@ static inline int array_roll(array_t* array,int index_to,int index_from,int coun | ||
167 | memmove(to+is*count,to,from-to); | 167 | memmove(to+is*count,to,from-to); |
168 | else | 168 | else |
169 | memmove(from,from+is*count,to-from); | 169 | memmove(from,from+is*count,to-from); |
170 | - | 170 | + |
171 | memcpy(to,buf,is*count); | 171 | memcpy(to,buf,is*count); |
172 | 172 | ||
173 | free(buf); | 173 | free(buf); |
@@ -319,10 +319,10 @@ typedef struct BDRVVVFATState { | @@ -319,10 +319,10 @@ typedef struct BDRVVVFATState { | ||
319 | BlockDriverState* bs; /* pointer to parent */ | 319 | BlockDriverState* bs; /* pointer to parent */ |
320 | unsigned int first_sectors_number; /* 1 for a single partition, 0x40 for a disk with partition table */ | 320 | unsigned int first_sectors_number; /* 1 for a single partition, 0x40 for a disk with partition table */ |
321 | unsigned char first_sectors[0x40*0x200]; | 321 | unsigned char first_sectors[0x40*0x200]; |
322 | - | 322 | + |
323 | int fat_type; /* 16 or 32 */ | 323 | int fat_type; /* 16 or 32 */ |
324 | array_t fat,directory,mapping; | 324 | array_t fat,directory,mapping; |
325 | - | 325 | + |
326 | unsigned int cluster_size; | 326 | unsigned int cluster_size; |
327 | unsigned int sectors_per_cluster; | 327 | unsigned int sectors_per_cluster; |
328 | unsigned int sectors_per_fat; | 328 | unsigned int sectors_per_fat; |
@@ -332,7 +332,7 @@ typedef struct BDRVVVFATState { | @@ -332,7 +332,7 @@ typedef struct BDRVVVFATState { | ||
332 | uint32_t sector_count; /* total number of sectors of the partition */ | 332 | uint32_t sector_count; /* total number of sectors of the partition */ |
333 | uint32_t cluster_count; /* total number of clusters of this partition */ | 333 | uint32_t cluster_count; /* total number of clusters of this partition */ |
334 | uint32_t max_fat_value; | 334 | uint32_t max_fat_value; |
335 | - | 335 | + |
336 | int current_fd; | 336 | int current_fd; |
337 | mapping_t* current_mapping; | 337 | mapping_t* current_mapping; |
338 | unsigned char* cluster; /* points to current cluster */ | 338 | unsigned char* cluster; /* points to current cluster */ |
@@ -358,7 +358,7 @@ static void init_mbr(BDRVVVFATState* s) | @@ -358,7 +358,7 @@ static void init_mbr(BDRVVVFATState* s) | ||
358 | partition_t* partition=&(real_mbr->partition[0]); | 358 | partition_t* partition=&(real_mbr->partition[0]); |
359 | 359 | ||
360 | memset(s->first_sectors,0,512); | 360 | memset(s->first_sectors,0,512); |
361 | - | 361 | + |
362 | partition->attributes=0x80; /* bootable */ | 362 | partition->attributes=0x80; /* bootable */ |
363 | partition->start_head=1; | 363 | partition->start_head=1; |
364 | partition->start_sector=1; | 364 | partition->start_sector=1; |
@@ -478,7 +478,7 @@ static inline uint8_t fat_chksum(const direntry_t* entry) | @@ -478,7 +478,7 @@ static inline uint8_t fat_chksum(const direntry_t* entry) | ||
478 | for(i=0;i<11;i++) | 478 | for(i=0;i<11;i++) |
479 | chksum=(((chksum&0xfe)>>1)|((chksum&0x01)?0x80:0)) | 479 | chksum=(((chksum&0xfe)>>1)|((chksum&0x01)?0x80:0)) |
480 | +(unsigned char)entry->name[i]; | 480 | +(unsigned char)entry->name[i]; |
481 | - | 481 | + |
482 | return chksum; | 482 | return chksum; |
483 | } | 483 | } |
484 | 484 | ||
@@ -554,7 +554,7 @@ static inline void init_fat(BDRVVVFATState* s) | @@ -554,7 +554,7 @@ static inline void init_fat(BDRVVVFATState* s) | ||
554 | s->sectors_per_fat * 0x200 / s->fat.item_size - 1); | 554 | s->sectors_per_fat * 0x200 / s->fat.item_size - 1); |
555 | } | 555 | } |
556 | memset(s->fat.pointer,0,s->fat.size); | 556 | memset(s->fat.pointer,0,s->fat.size); |
557 | - | 557 | + |
558 | switch(s->fat_type) { | 558 | switch(s->fat_type) { |
559 | case 12: s->max_fat_value=0xfff; break; | 559 | case 12: s->max_fat_value=0xfff; break; |
560 | case 16: s->max_fat_value=0xffff; break; | 560 | case 16: s->max_fat_value=0xffff; break; |
@@ -579,9 +579,9 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s, | @@ -579,9 +579,9 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s, | ||
579 | memcpy(entry->name,filename,strlen(filename)); | 579 | memcpy(entry->name,filename,strlen(filename)); |
580 | return entry; | 580 | return entry; |
581 | } | 581 | } |
582 | - | 582 | + |
583 | entry_long=create_long_filename(s,filename); | 583 | entry_long=create_long_filename(s,filename); |
584 | - | 584 | + |
585 | i = strlen(filename); | 585 | i = strlen(filename); |
586 | for(j = i - 1; j>0 && filename[j]!='.';j--); | 586 | for(j = i - 1; j>0 && filename[j]!='.';j--); |
587 | if (j > 0) | 587 | if (j > 0) |
@@ -592,7 +592,7 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s, | @@ -592,7 +592,7 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s, | ||
592 | entry=array_get_next(&(s->directory)); | 592 | entry=array_get_next(&(s->directory)); |
593 | memset(entry->name,0x20,11); | 593 | memset(entry->name,0x20,11); |
594 | strncpy(entry->name,filename,i); | 594 | strncpy(entry->name,filename,i); |
595 | - | 595 | + |
596 | if(j > 0) | 596 | if(j > 0) |
597 | for (i = 0; i < 3 && filename[j+1+i]; i++) | 597 | for (i = 0; i < 3 && filename[j+1+i]; i++) |
598 | entry->extension[i] = filename[j+1+i]; | 598 | entry->extension[i] = filename[j+1+i]; |
@@ -675,7 +675,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index) | @@ -675,7 +675,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index) | ||
675 | mapping->end = mapping->begin; | 675 | mapping->end = mapping->begin; |
676 | return -1; | 676 | return -1; |
677 | } | 677 | } |
678 | - | 678 | + |
679 | i = mapping->info.dir.first_dir_index = | 679 | i = mapping->info.dir.first_dir_index = |
680 | first_cluster == 0 ? 0 : s->directory.next; | 680 | first_cluster == 0 ? 0 : s->directory.next; |
681 | 681 | ||
@@ -774,7 +774,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index) | @@ -774,7 +774,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index) | ||
774 | 774 | ||
775 | direntry = (direntry_t*)array_get(&(s->directory), mapping->dir_index); | 775 | direntry = (direntry_t*)array_get(&(s->directory), mapping->dir_index); |
776 | set_begin_of_direntry(direntry, mapping->begin); | 776 | set_begin_of_direntry(direntry, mapping->begin); |
777 | - | 777 | + |
778 | return 0; | 778 | return 0; |
779 | } | 779 | } |
780 | 780 | ||
@@ -825,7 +825,7 @@ static int init_directories(BDRVVVFATState* s, | @@ -825,7 +825,7 @@ static int init_directories(BDRVVVFATState* s, | ||
825 | */ | 825 | */ |
826 | i = 1+s->sectors_per_cluster*0x200*8/s->fat_type; | 826 | i = 1+s->sectors_per_cluster*0x200*8/s->fat_type; |
827 | s->sectors_per_fat=(s->sector_count+i)/i; /* round up */ | 827 | s->sectors_per_fat=(s->sector_count+i)/i; /* round up */ |
828 | - | 828 | + |
829 | array_init(&(s->mapping),sizeof(mapping_t)); | 829 | array_init(&(s->mapping),sizeof(mapping_t)); |
830 | array_init(&(s->directory),sizeof(direntry_t)); | 830 | array_init(&(s->directory),sizeof(direntry_t)); |
831 | 831 | ||
@@ -987,7 +987,7 @@ DLOG(if (stderr == NULL) { | @@ -987,7 +987,7 @@ DLOG(if (stderr == NULL) { | ||
987 | s->qcow_filename = NULL; | 987 | s->qcow_filename = NULL; |
988 | s->fat2 = NULL; | 988 | s->fat2 = NULL; |
989 | s->downcase_short_names = 1; | 989 | s->downcase_short_names = 1; |
990 | - | 990 | + |
991 | if (!strstart(dirname, "fat:", NULL)) | 991 | if (!strstart(dirname, "fat:", NULL)) |
992 | return -1; | 992 | return -1; |
993 | 993 | ||
@@ -1709,7 +1709,7 @@ static int check_directory_consistency(BDRVVVFATState *s, | @@ -1709,7 +1709,7 @@ static int check_directory_consistency(BDRVVVFATState *s, | ||
1709 | } else | 1709 | } else |
1710 | /* new directory */ | 1710 | /* new directory */ |
1711 | schedule_mkdir(s, cluster_num, strdup(path)); | 1711 | schedule_mkdir(s, cluster_num, strdup(path)); |
1712 | - | 1712 | + |
1713 | lfn_init(&lfn); | 1713 | lfn_init(&lfn); |
1714 | do { | 1714 | do { |
1715 | int i; | 1715 | int i; |
@@ -2069,7 +2069,7 @@ static int commit_mappings(BDRVVVFATState* s, | @@ -2069,7 +2069,7 @@ static int commit_mappings(BDRVVVFATState* s, | ||
2069 | 2069 | ||
2070 | mapping = next_mapping; | 2070 | mapping = next_mapping; |
2071 | } | 2071 | } |
2072 | - | 2072 | + |
2073 | cluster = c1; | 2073 | cluster = c1; |
2074 | } | 2074 | } |
2075 | 2075 |
block.c
@@ -180,7 +180,7 @@ int bdrv_create(BlockDriver *drv, | @@ -180,7 +180,7 @@ int bdrv_create(BlockDriver *drv, | ||
180 | void get_tmp_filename(char *filename, int size) | 180 | void get_tmp_filename(char *filename, int size) |
181 | { | 181 | { |
182 | char temp_dir[MAX_PATH]; | 182 | char temp_dir[MAX_PATH]; |
183 | - | 183 | + |
184 | GetTempPath(MAX_PATH, temp_dir); | 184 | GetTempPath(MAX_PATH, temp_dir); |
185 | GetTempFileName(temp_dir, "qem", 0, filename); | 185 | GetTempFileName(temp_dir, "qem", 0, filename); |
186 | } | 186 | } |
@@ -202,7 +202,7 @@ static int is_windows_drive_prefix(const char *filename) | @@ -202,7 +202,7 @@ static int is_windows_drive_prefix(const char *filename) | ||
202 | (filename[0] >= 'A' && filename[0] <= 'Z')) && | 202 | (filename[0] >= 'A' && filename[0] <= 'Z')) && |
203 | filename[1] == ':'); | 203 | filename[1] == ':'); |
204 | } | 204 | } |
205 | - | 205 | + |
206 | static int is_windows_drive(const char *filename) | 206 | static int is_windows_drive(const char *filename) |
207 | { | 207 | { |
208 | if (is_windows_drive_prefix(filename) && | 208 | if (is_windows_drive_prefix(filename) && |
@@ -251,7 +251,7 @@ static BlockDriver *find_image_format(const char *filename) | @@ -251,7 +251,7 @@ static BlockDriver *find_image_format(const char *filename) | ||
251 | BlockDriver *drv1, *drv; | 251 | BlockDriver *drv1, *drv; |
252 | uint8_t buf[2048]; | 252 | uint8_t buf[2048]; |
253 | BlockDriverState *bs; | 253 | BlockDriverState *bs; |
254 | - | 254 | + |
255 | /* detect host devices. By convention, /dev/cdrom[N] is always | 255 | /* detect host devices. By convention, /dev/cdrom[N] is always |
256 | recognized as a host CDROM */ | 256 | recognized as a host CDROM */ |
257 | if (strstart(filename, "/dev/cdrom", NULL)) | 257 | if (strstart(filename, "/dev/cdrom", NULL)) |
@@ -268,7 +268,7 @@ static BlockDriver *find_image_format(const char *filename) | @@ -268,7 +268,7 @@ static BlockDriver *find_image_format(const char *filename) | ||
268 | } | 268 | } |
269 | } | 269 | } |
270 | #endif | 270 | #endif |
271 | - | 271 | + |
272 | drv = find_protocol(filename); | 272 | drv = find_protocol(filename); |
273 | /* no need to test disk image formats for vvfat */ | 273 | /* no need to test disk image formats for vvfat */ |
274 | if (drv == &bdrv_vvfat) | 274 | if (drv == &bdrv_vvfat) |
@@ -324,7 +324,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, | @@ -324,7 +324,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, | ||
324 | int ret, open_flags; | 324 | int ret, open_flags; |
325 | char tmp_filename[PATH_MAX]; | 325 | char tmp_filename[PATH_MAX]; |
326 | char backing_filename[PATH_MAX]; | 326 | char backing_filename[PATH_MAX]; |
327 | - | 327 | + |
328 | bs->read_only = 0; | 328 | bs->read_only = 0; |
329 | bs->is_temporary = 0; | 329 | bs->is_temporary = 0; |
330 | bs->encrypted = 0; | 330 | bs->encrypted = 0; |
@@ -332,7 +332,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, | @@ -332,7 +332,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, | ||
332 | if (flags & BDRV_O_SNAPSHOT) { | 332 | if (flags & BDRV_O_SNAPSHOT) { |
333 | BlockDriverState *bs1; | 333 | BlockDriverState *bs1; |
334 | int64_t total_size; | 334 | int64_t total_size; |
335 | - | 335 | + |
336 | /* if snapshot, we create a temporary backing file and open it | 336 | /* if snapshot, we create a temporary backing file and open it |
337 | instead of opening 'filename' directly */ | 337 | instead of opening 'filename' directly */ |
338 | 338 | ||
@@ -347,7 +347,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, | @@ -347,7 +347,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, | ||
347 | } | 347 | } |
348 | total_size = bdrv_getlength(bs1) >> SECTOR_BITS; | 348 | total_size = bdrv_getlength(bs1) >> SECTOR_BITS; |
349 | bdrv_delete(bs1); | 349 | bdrv_delete(bs1); |
350 | - | 350 | + |
351 | get_tmp_filename(tmp_filename, sizeof(tmp_filename)); | 351 | get_tmp_filename(tmp_filename, sizeof(tmp_filename)); |
352 | realpath(filename, backing_filename); | 352 | realpath(filename, backing_filename); |
353 | if (bdrv_create(&bdrv_qcow2, tmp_filename, | 353 | if (bdrv_create(&bdrv_qcow2, tmp_filename, |
@@ -540,7 +540,7 @@ int bdrv_write(BlockDriverState *bs, int64_t sector_num, | @@ -540,7 +540,7 @@ int bdrv_write(BlockDriverState *bs, int64_t sector_num, | ||
540 | if (bs->read_only) | 540 | if (bs->read_only) |
541 | return -EACCES; | 541 | return -EACCES; |
542 | if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { | 542 | if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { |
543 | - memcpy(bs->boot_sector_data, buf, 512); | 543 | + memcpy(bs->boot_sector_data, buf, 512); |
544 | } | 544 | } |
545 | if (drv->bdrv_pwrite) { | 545 | if (drv->bdrv_pwrite) { |
546 | int ret, len; | 546 | int ret, len; |
@@ -919,7 +919,7 @@ int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, | @@ -919,7 +919,7 @@ int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, | ||
919 | return -ENOTSUP; | 919 | return -ENOTSUP; |
920 | return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors); | 920 | return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors); |
921 | } | 921 | } |
922 | - | 922 | + |
923 | int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) | 923 | int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) |
924 | { | 924 | { |
925 | BlockDriver *drv = bs->drv; | 925 | BlockDriver *drv = bs->drv; |
@@ -1062,7 +1062,7 @@ BlockDriverAIOCB *bdrv_aio_read(BlockDriverState *bs, int64_t sector_num, | @@ -1062,7 +1062,7 @@ BlockDriverAIOCB *bdrv_aio_read(BlockDriverState *bs, int64_t sector_num, | ||
1062 | 1062 | ||
1063 | if (!drv) | 1063 | if (!drv) |
1064 | return NULL; | 1064 | return NULL; |
1065 | - | 1065 | + |
1066 | /* XXX: we assume that nb_sectors == 0 is suppored by the async read */ | 1066 | /* XXX: we assume that nb_sectors == 0 is suppored by the async read */ |
1067 | if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { | 1067 | if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { |
1068 | memcpy(buf, bs->boot_sector_data, 512); | 1068 | memcpy(buf, bs->boot_sector_data, 512); |
@@ -1085,7 +1085,7 @@ BlockDriverAIOCB *bdrv_aio_write(BlockDriverState *bs, int64_t sector_num, | @@ -1085,7 +1085,7 @@ BlockDriverAIOCB *bdrv_aio_write(BlockDriverState *bs, int64_t sector_num, | ||
1085 | if (bs->read_only) | 1085 | if (bs->read_only) |
1086 | return NULL; | 1086 | return NULL; |
1087 | if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { | 1087 | if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { |
1088 | - memcpy(bs->boot_sector_data, buf, 512); | 1088 | + memcpy(bs->boot_sector_data, buf, 512); |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | return drv->bdrv_aio_write(bs, sector_num, buf, nb_sectors, cb, opaque); | 1091 | return drv->bdrv_aio_write(bs, sector_num, buf, nb_sectors, cb, opaque); |
block_int.h
@@ -79,7 +79,7 @@ struct BlockDriver { | @@ -79,7 +79,7 @@ struct BlockDriver { | ||
79 | int (*bdrv_media_changed)(BlockDriverState *bs); | 79 | int (*bdrv_media_changed)(BlockDriverState *bs); |
80 | int (*bdrv_eject)(BlockDriverState *bs, int eject_flag); | 80 | int (*bdrv_eject)(BlockDriverState *bs, int eject_flag); |
81 | int (*bdrv_set_locked)(BlockDriverState *bs, int locked); | 81 | int (*bdrv_set_locked)(BlockDriverState *bs, int locked); |
82 | - | 82 | + |
83 | BlockDriverAIOCB *free_aiocb; | 83 | BlockDriverAIOCB *free_aiocb; |
84 | struct BlockDriver *next; | 84 | struct BlockDriver *next; |
85 | }; | 85 | }; |
@@ -111,7 +111,7 @@ struct BlockDriverState { | @@ -111,7 +111,7 @@ struct BlockDriverState { | ||
111 | /* async read/write emulation */ | 111 | /* async read/write emulation */ |
112 | 112 | ||
113 | void *sync_aiocb; | 113 | void *sync_aiocb; |
114 | - | 114 | + |
115 | /* NOTE: the following infos are only hints for real hardware | 115 | /* NOTE: the following infos are only hints for real hardware |
116 | drivers. They are not used by the block driver */ | 116 | drivers. They are not used by the block driver */ |
117 | int cyls, heads, secs, translation; | 117 | int cyls, heads, secs, translation; |
cocoa.m
@@ -84,7 +84,7 @@ static void cocoa_update(DisplayState *ds, int x, int y, int w, int h) | @@ -84,7 +84,7 @@ static void cocoa_update(DisplayState *ds, int x, int y, int w, int h) | ||
84 | MacSetRectRgn (temp, x, y, | 84 | MacSetRectRgn (temp, x, y, |
85 | x + w, y + h); | 85 | x + w, y + h); |
86 | MacUnionRgn (dirty, temp, dirty); | 86 | MacUnionRgn (dirty, temp, dirty); |
87 | - | 87 | + |
88 | /* Flush the dirty region */ | 88 | /* Flush the dirty region */ |
89 | QDFlushPortBuffer ( [ qd_view qdPort ], dirty ); | 89 | QDFlushPortBuffer ( [ qd_view qdPort ], dirty ); |
90 | DisposeRgn (dirty); | 90 | DisposeRgn (dirty); |
@@ -102,9 +102,9 @@ static void cocoa_resize(DisplayState *ds, int w, int h) | @@ -102,9 +102,9 @@ static void cocoa_resize(DisplayState *ds, int w, int h) | ||
102 | static void *screen_pixels; | 102 | static void *screen_pixels; |
103 | static int screen_pitch; | 103 | static int screen_pitch; |
104 | NSRect contentRect; | 104 | NSRect contentRect; |
105 | - | 105 | + |
106 | //printf("resizing to %d %d\n", w, h); | 106 | //printf("resizing to %d %d\n", w, h); |
107 | - | 107 | + |
108 | contentRect = NSMakeRect (0, 0, w, h); | 108 | contentRect = NSMakeRect (0, 0, w, h); |
109 | if(window) | 109 | if(window) |
110 | { | 110 | { |
@@ -119,33 +119,33 @@ static void cocoa_resize(DisplayState *ds, int w, int h) | @@ -119,33 +119,33 @@ static void cocoa_resize(DisplayState *ds, int w, int h) | ||
119 | fprintf(stderr, "(cocoa) can't create window\n"); | 119 | fprintf(stderr, "(cocoa) can't create window\n"); |
120 | exit(1); | 120 | exit(1); |
121 | } | 121 | } |
122 | - | 122 | + |
123 | if(qd_view) | 123 | if(qd_view) |
124 | [qd_view release]; | 124 | [qd_view release]; |
125 | - | 125 | + |
126 | qd_view = [ [ NSQuickDrawView alloc ] initWithFrame:contentRect ]; | 126 | qd_view = [ [ NSQuickDrawView alloc ] initWithFrame:contentRect ]; |
127 | - | 127 | + |
128 | if(!qd_view) | 128 | if(!qd_view) |
129 | { | 129 | { |
130 | fprintf(stderr, "(cocoa) can't create qd_view\n"); | 130 | fprintf(stderr, "(cocoa) can't create qd_view\n"); |
131 | exit(1); | 131 | exit(1); |
132 | } | 132 | } |
133 | - | 133 | + |
134 | [ window setAcceptsMouseMovedEvents:YES ]; | 134 | [ window setAcceptsMouseMovedEvents:YES ]; |
135 | [ window setTitle:@"Qemu" ]; | 135 | [ window setTitle:@"Qemu" ]; |
136 | [ window setReleasedWhenClosed:NO ]; | 136 | [ window setReleasedWhenClosed:NO ]; |
137 | - | 137 | + |
138 | /* Set screen to black */ | 138 | /* Set screen to black */ |
139 | [ window setBackgroundColor: [NSColor blackColor] ]; | 139 | [ window setBackgroundColor: [NSColor blackColor] ]; |
140 | - | 140 | + |
141 | /* set window position */ | 141 | /* set window position */ |
142 | [ window center ]; | 142 | [ window center ]; |
143 | - | 143 | + |
144 | [ qd_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable ]; | 144 | [ qd_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable ]; |
145 | [ [ window contentView ] addSubview:qd_view ]; | 145 | [ [ window contentView ] addSubview:qd_view ]; |
146 | [ qd_view release ]; | 146 | [ qd_view release ]; |
147 | [ window makeKeyAndOrderFront:nil ]; | 147 | [ window makeKeyAndOrderFront:nil ]; |
148 | - | 148 | + |
149 | /* Careful here, the window seems to have to be onscreen to do that */ | 149 | /* Careful here, the window seems to have to be onscreen to do that */ |
150 | LockPortBits ( [ qd_view qdPort ] ); | 150 | LockPortBits ( [ qd_view qdPort ] ); |
151 | screen_pixels = GetPixBaseAddr ( GetPortPixMap ( [ qd_view qdPort ] ) ); | 151 | screen_pixels = GetPixBaseAddr ( GetPortPixMap ( [ qd_view qdPort ] ) ); |
@@ -154,9 +154,9 @@ static void cocoa_resize(DisplayState *ds, int w, int h) | @@ -154,9 +154,9 @@ static void cocoa_resize(DisplayState *ds, int w, int h) | ||
154 | { | 154 | { |
155 | int vOffset = [ window frame ].size.height - | 155 | int vOffset = [ window frame ].size.height - |
156 | [ qd_view frame ].size.height - [ qd_view frame ].origin.y; | 156 | [ qd_view frame ].size.height - [ qd_view frame ].origin.y; |
157 | - | 157 | + |
158 | int hOffset = [ qd_view frame ].origin.x; | 158 | int hOffset = [ qd_view frame ].origin.x; |
159 | - | 159 | + |
160 | screen_pixels += (vOffset * screen_pitch) + hOffset * (device_bpp/8); | 160 | screen_pixels += (vOffset * screen_pitch) + hOffset * (device_bpp/8); |
161 | } | 161 | } |
162 | ds->data = screen_pixels; | 162 | ds->data = screen_pixels; |
@@ -310,38 +310,38 @@ int keymap[] = | @@ -310,38 +310,38 @@ int keymap[] = | ||
310 | 208,// 125 0x7D 0xd0 E0,50 D ARROW QZ_DOWN | 310 | 208,// 125 0x7D 0xd0 E0,50 D ARROW QZ_DOWN |
311 | 200,// 126 0x7E 0xc8 E0,48 U ARROW QZ_UP | 311 | 200,// 126 0x7E 0xc8 E0,48 U ARROW QZ_UP |
312 | /* completed according to http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/SDL_QuartzKeys.h?rev=1.6&content-type=text/x-cvsweb-markup */ | 312 | /* completed according to http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/SDL_QuartzKeys.h?rev=1.6&content-type=text/x-cvsweb-markup */ |
313 | - | 313 | + |
314 | /* Aditional 104 Key XP-Keyboard Scancodes from http://www.computer-engineering.org/ps2keyboard/scancodes1.html */ | 314 | /* Aditional 104 Key XP-Keyboard Scancodes from http://www.computer-engineering.org/ps2keyboard/scancodes1.html */ |
315 | /* | 315 | /* |
316 | - 219 // 0xdb e0,5b L GUI | ||
317 | - 220 // 0xdc e0,5c R GUI | ||
318 | - 221 // 0xdd e0,5d APPS | ||
319 | - // E0,2A,E0,37 PRNT SCRN | ||
320 | - // E1,1D,45,E1,9D,C5 PAUSE | ||
321 | - 83 // 0x53 0x53 KP . | ||
322 | -// ACPI Scan Codes | ||
323 | - 222 // 0xde E0, 5E Power | ||
324 | - 223 // 0xdf E0, 5F Sleep | ||
325 | - 227 // 0xe3 E0, 63 Wake | ||
326 | -// Windows Multimedia Scan Codes | ||
327 | - 153 // 0x99 E0, 19 Next Track | ||
328 | - 144 // 0x90 E0, 10 Previous Track | ||
329 | - 164 // 0xa4 E0, 24 Stop | ||
330 | - 162 // 0xa2 E0, 22 Play/Pause | ||
331 | - 160 // 0xa0 E0, 20 Mute | ||
332 | - 176 // 0xb0 E0, 30 Volume Up | 316 | + 219 // 0xdb e0,5b L GUI |
317 | + 220 // 0xdc e0,5c R GUI | ||
318 | + 221 // 0xdd e0,5d APPS | ||
319 | + // E0,2A,E0,37 PRNT SCRN | ||
320 | + // E1,1D,45,E1,9D,C5 PAUSE | ||
321 | + 83 // 0x53 0x53 KP . | ||
322 | +// ACPI Scan Codes | ||
323 | + 222 // 0xde E0, 5E Power | ||
324 | + 223 // 0xdf E0, 5F Sleep | ||
325 | + 227 // 0xe3 E0, 63 Wake | ||
326 | +// Windows Multimedia Scan Codes | ||
327 | + 153 // 0x99 E0, 19 Next Track | ||
328 | + 144 // 0x90 E0, 10 Previous Track | ||
329 | + 164 // 0xa4 E0, 24 Stop | ||
330 | + 162 // 0xa2 E0, 22 Play/Pause | ||
331 | + 160 // 0xa0 E0, 20 Mute | ||
332 | + 176 // 0xb0 E0, 30 Volume Up | ||
333 | 174 // 0xae E0, 2E Volume Down | 333 | 174 // 0xae E0, 2E Volume Down |
334 | - 237 // 0xed E0, 6D Media Select | ||
335 | - 236 // 0xec E0, 6C E-Mail | ||
336 | - 161 // 0xa1 E0, 21 Calculator | 334 | + 237 // 0xed E0, 6D Media Select |
335 | + 236 // 0xec E0, 6C E-Mail | ||
336 | + 161 // 0xa1 E0, 21 Calculator | ||
337 | 235 // 0xeb E0, 6B My Computer | 337 | 235 // 0xeb E0, 6B My Computer |
338 | - 229 // 0xe5 E0, 65 WWW Search | ||
339 | - 178 // 0xb2 E0, 32 WWW Home | ||
340 | - 234 // 0xea E0, 6A WWW Back | 338 | + 229 // 0xe5 E0, 65 WWW Search |
339 | + 178 // 0xb2 E0, 32 WWW Home | ||
340 | + 234 // 0xea E0, 6A WWW Back | ||
341 | 233 // 0xe9 E0, 69 WWW Forward | 341 | 233 // 0xe9 E0, 69 WWW Forward |
342 | - 232 // 0xe8 E0, 68 WWW Stop | 342 | + 232 // 0xe8 E0, 68 WWW Stop |
343 | 231 // 0xe7 E0, 67 WWW Refresh | 343 | 231 // 0xe7 E0, 67 WWW Refresh |
344 | - 230 // 0xe6 E0, 66 WWW Favorites | 344 | + 230 // 0xe6 E0, 66 WWW Favorites |
345 | */ | 345 | */ |
346 | }; | 346 | }; |
347 | 347 | ||
@@ -366,10 +366,10 @@ static void cocoa_refresh(DisplayState *ds) | @@ -366,10 +366,10 @@ static void cocoa_refresh(DisplayState *ds) | ||
366 | NSDate *distantPast; | 366 | NSDate *distantPast; |
367 | NSEvent *event; | 367 | NSEvent *event; |
368 | NSAutoreleasePool *pool; | 368 | NSAutoreleasePool *pool; |
369 | - | 369 | + |
370 | pool = [ [ NSAutoreleasePool alloc ] init ]; | 370 | pool = [ [ NSAutoreleasePool alloc ] init ]; |
371 | distantPast = [ NSDate distantPast ]; | 371 | distantPast = [ NSDate distantPast ]; |
372 | - | 372 | + |
373 | vga_hw_update(); | 373 | vga_hw_update(); |
374 | 374 | ||
375 | do { | 375 | do { |
@@ -415,8 +415,8 @@ static void cocoa_refresh(DisplayState *ds) | @@ -415,8 +415,8 @@ static void cocoa_refresh(DisplayState *ds) | ||
415 | 415 | ||
416 | case NSKeyDown: | 416 | case NSKeyDown: |
417 | { | 417 | { |
418 | - int keycode = cocoa_keycode_to_qemu([event keyCode]); | ||
419 | - | 418 | + int keycode = cocoa_keycode_to_qemu([event keyCode]); |
419 | + | ||
420 | /* handle command Key Combos */ | 420 | /* handle command Key Combos */ |
421 | if ([event modifierFlags] & NSCommandKeyMask) { | 421 | if ([event modifierFlags] & NSCommandKeyMask) { |
422 | switch ([event keyCode]) { | 422 | switch ([event keyCode]) { |
@@ -427,7 +427,7 @@ static void cocoa_refresh(DisplayState *ds) | @@ -427,7 +427,7 @@ static void cocoa_refresh(DisplayState *ds) | ||
427 | return; | 427 | return; |
428 | } | 428 | } |
429 | } | 429 | } |
430 | - | 430 | + |
431 | /* handle control + alt Key Combos */ | 431 | /* handle control + alt Key Combos */ |
432 | if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) { | 432 | if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) { |
433 | switch (keycode) { | 433 | switch (keycode) { |
@@ -482,10 +482,10 @@ static void cocoa_refresh(DisplayState *ds) | @@ -482,10 +482,10 @@ static void cocoa_refresh(DisplayState *ds) | ||
482 | } | 482 | } |
483 | } | 483 | } |
484 | break; | 484 | break; |
485 | - | 485 | + |
486 | case NSKeyUp: | 486 | case NSKeyUp: |
487 | { | 487 | { |
488 | - int keycode = cocoa_keycode_to_qemu([event keyCode]); | 488 | + int keycode = cocoa_keycode_to_qemu([event keyCode]); |
489 | if (is_graphic_console()) { | 489 | if (is_graphic_console()) { |
490 | if (keycode & 0x80) | 490 | if (keycode & 0x80) |
491 | kbd_put_keycode(0xe0); | 491 | kbd_put_keycode(0xe0); |
@@ -493,7 +493,7 @@ static void cocoa_refresh(DisplayState *ds) | @@ -493,7 +493,7 @@ static void cocoa_refresh(DisplayState *ds) | ||
493 | } | 493 | } |
494 | } | 494 | } |
495 | break; | 495 | break; |
496 | - | 496 | + |
497 | case NSMouseMoved: | 497 | case NSMouseMoved: |
498 | if (grab) { | 498 | if (grab) { |
499 | int dx = [event deltaX]; | 499 | int dx = [event deltaX]; |
@@ -503,11 +503,11 @@ static void cocoa_refresh(DisplayState *ds) | @@ -503,11 +503,11 @@ static void cocoa_refresh(DisplayState *ds) | ||
503 | kbd_mouse_event(dx, dy, dz, buttons); | 503 | kbd_mouse_event(dx, dy, dz, buttons); |
504 | } | 504 | } |
505 | break; | 505 | break; |
506 | - | 506 | + |
507 | case NSLeftMouseDown: | 507 | case NSLeftMouseDown: |
508 | if (grab) { | 508 | if (grab) { |
509 | int buttons = 0; | 509 | int buttons = 0; |
510 | - | 510 | + |
511 | /* leftclick+command simulates rightclick */ | 511 | /* leftclick+command simulates rightclick */ |
512 | if ([event modifierFlags] & NSCommandKeyMask) { | 512 | if ([event modifierFlags] & NSCommandKeyMask) { |
513 | buttons |= MOUSE_EVENT_RBUTTON; | 513 | buttons |= MOUSE_EVENT_RBUTTON; |
@@ -519,7 +519,7 @@ static void cocoa_refresh(DisplayState *ds) | @@ -519,7 +519,7 @@ static void cocoa_refresh(DisplayState *ds) | ||
519 | [NSApp sendEvent: event]; | 519 | [NSApp sendEvent: event]; |
520 | } | 520 | } |
521 | break; | 521 | break; |
522 | - | 522 | + |
523 | case NSLeftMouseDragged: | 523 | case NSLeftMouseDragged: |
524 | if (grab) { | 524 | if (grab) { |
525 | int dx = [event deltaX]; | 525 | int dx = [event deltaX]; |
@@ -534,7 +534,7 @@ static void cocoa_refresh(DisplayState *ds) | @@ -534,7 +534,7 @@ static void cocoa_refresh(DisplayState *ds) | ||
534 | kbd_mouse_event(dx, dy, dz, buttons); | 534 | kbd_mouse_event(dx, dy, dz, buttons); |
535 | } | 535 | } |
536 | break; | 536 | break; |
537 | - | 537 | + |
538 | case NSLeftMouseUp: | 538 | case NSLeftMouseUp: |
539 | if (grab) { | 539 | if (grab) { |
540 | kbd_mouse_event(0, 0, 0, 0); | 540 | kbd_mouse_event(0, 0, 0, 0); |
@@ -546,18 +546,18 @@ static void cocoa_refresh(DisplayState *ds) | @@ -546,18 +546,18 @@ static void cocoa_refresh(DisplayState *ds) | ||
546 | //[NSApp sendEvent: event]; | 546 | //[NSApp sendEvent: event]; |
547 | } | 547 | } |
548 | break; | 548 | break; |
549 | - | 549 | + |
550 | case NSRightMouseDown: | 550 | case NSRightMouseDown: |
551 | if (grab) { | 551 | if (grab) { |
552 | int buttons = 0; | 552 | int buttons = 0; |
553 | - | 553 | + |
554 | buttons |= MOUSE_EVENT_RBUTTON; | 554 | buttons |= MOUSE_EVENT_RBUTTON; |
555 | kbd_mouse_event(0, 0, 0, buttons); | 555 | kbd_mouse_event(0, 0, 0, buttons); |
556 | } else { | 556 | } else { |
557 | [NSApp sendEvent: event]; | 557 | [NSApp sendEvent: event]; |
558 | } | 558 | } |
559 | break; | 559 | break; |
560 | - | 560 | + |
561 | case NSRightMouseDragged: | 561 | case NSRightMouseDragged: |
562 | if (grab) { | 562 | if (grab) { |
563 | int dx = [event deltaX]; | 563 | int dx = [event deltaX]; |
@@ -568,7 +568,7 @@ static void cocoa_refresh(DisplayState *ds) | @@ -568,7 +568,7 @@ static void cocoa_refresh(DisplayState *ds) | ||
568 | kbd_mouse_event(dx, dy, dz, buttons); | 568 | kbd_mouse_event(dx, dy, dz, buttons); |
569 | } | 569 | } |
570 | break; | 570 | break; |
571 | - | 571 | + |
572 | case NSRightMouseUp: | 572 | case NSRightMouseUp: |
573 | if (grab) { | 573 | if (grab) { |
574 | kbd_mouse_event(0, 0, 0, 0); | 574 | kbd_mouse_event(0, 0, 0, 0); |
@@ -576,7 +576,7 @@ static void cocoa_refresh(DisplayState *ds) | @@ -576,7 +576,7 @@ static void cocoa_refresh(DisplayState *ds) | ||
576 | [NSApp sendEvent: event]; | 576 | [NSApp sendEvent: event]; |
577 | } | 577 | } |
578 | break; | 578 | break; |
579 | - | 579 | + |
580 | case NSOtherMouseDragged: | 580 | case NSOtherMouseDragged: |
581 | if (grab) { | 581 | if (grab) { |
582 | int dx = [event deltaX]; | 582 | int dx = [event deltaX]; |
@@ -587,7 +587,7 @@ static void cocoa_refresh(DisplayState *ds) | @@ -587,7 +587,7 @@ static void cocoa_refresh(DisplayState *ds) | ||
587 | kbd_mouse_event(dx, dy, dz, buttons); | 587 | kbd_mouse_event(dx, dy, dz, buttons); |
588 | } | 588 | } |
589 | break; | 589 | break; |
590 | - | 590 | + |
591 | case NSOtherMouseDown: | 591 | case NSOtherMouseDown: |
592 | if (grab) { | 592 | if (grab) { |
593 | int buttons = 0; | 593 | int buttons = 0; |
@@ -597,7 +597,7 @@ static void cocoa_refresh(DisplayState *ds) | @@ -597,7 +597,7 @@ static void cocoa_refresh(DisplayState *ds) | ||
597 | [NSApp sendEvent:event]; | 597 | [NSApp sendEvent:event]; |
598 | } | 598 | } |
599 | break; | 599 | break; |
600 | - | 600 | + |
601 | case NSOtherMouseUp: | 601 | case NSOtherMouseUp: |
602 | if (grab) { | 602 | if (grab) { |
603 | kbd_mouse_event(0, 0, 0, 0); | 603 | kbd_mouse_event(0, 0, 0, 0); |
@@ -605,14 +605,14 @@ static void cocoa_refresh(DisplayState *ds) | @@ -605,14 +605,14 @@ static void cocoa_refresh(DisplayState *ds) | ||
605 | [NSApp sendEvent: event]; | 605 | [NSApp sendEvent: event]; |
606 | } | 606 | } |
607 | break; | 607 | break; |
608 | - | 608 | + |
609 | case NSScrollWheel: | 609 | case NSScrollWheel: |
610 | if (grab) { | 610 | if (grab) { |
611 | int dz = [event deltaY]; | 611 | int dz = [event deltaY]; |
612 | kbd_mouse_event(0, 0, -dz, 0); | 612 | kbd_mouse_event(0, 0, -dz, 0); |
613 | } | 613 | } |
614 | break; | 614 | break; |
615 | - | 615 | + |
616 | default: [NSApp sendEvent:event]; | 616 | default: [NSApp sendEvent:event]; |
617 | } | 617 | } |
618 | } | 618 | } |
@@ -641,9 +641,9 @@ void cocoa_display_init(DisplayState *ds, int full_screen) | @@ -641,9 +641,9 @@ void cocoa_display_init(DisplayState *ds, int full_screen) | ||
641 | ds->dpy_update = cocoa_update; | 641 | ds->dpy_update = cocoa_update; |
642 | ds->dpy_resize = cocoa_resize; | 642 | ds->dpy_resize = cocoa_resize; |
643 | ds->dpy_refresh = cocoa_refresh; | 643 | ds->dpy_refresh = cocoa_refresh; |
644 | - | 644 | + |
645 | cocoa_resize(ds, 640, 400); | 645 | cocoa_resize(ds, 640, 400); |
646 | - | 646 | + |
647 | atexit(cocoa_cleanup); | 647 | atexit(cocoa_cleanup); |
648 | } | 648 | } |
649 | 649 | ||
@@ -661,17 +661,17 @@ void cocoa_display_init(DisplayState *ds, int full_screen) | @@ -661,17 +661,17 @@ void cocoa_display_init(DisplayState *ds, int full_screen) | ||
661 | ------------------------------------------------------ | 661 | ------------------------------------------------------ |
662 | */ | 662 | */ |
663 | static void QZ_SetPortAlphaOpaque () | 663 | static void QZ_SetPortAlphaOpaque () |
664 | -{ | 664 | +{ |
665 | /* Assume 32 bit if( bpp == 32 )*/ | 665 | /* Assume 32 bit if( bpp == 32 )*/ |
666 | if ( 1 ) { | 666 | if ( 1 ) { |
667 | - | 667 | + |
668 | uint32_t *pixels = (uint32_t*) current_ds.data; | 668 | uint32_t *pixels = (uint32_t*) current_ds.data; |
669 | uint32_t rowPixels = current_ds.linesize / 4; | 669 | uint32_t rowPixels = current_ds.linesize / 4; |
670 | uint32_t i, j; | 670 | uint32_t i, j; |
671 | - | 671 | + |
672 | for (i = 0; i < current_ds.height; i++) | 672 | for (i = 0; i < current_ds.height; i++) |
673 | for (j = 0; j < current_ds.width; j++) { | 673 | for (j = 0; j < current_ds.width; j++) { |
674 | - | 674 | + |
675 | pixels[ (i * rowPixels) + j ] |= 0xFF000000; | 675 | pixels[ (i * rowPixels) + j ] |= 0xFF000000; |
676 | } | 676 | } |
677 | } | 677 | } |
@@ -680,32 +680,32 @@ static void QZ_SetPortAlphaOpaque () | @@ -680,32 +680,32 @@ static void QZ_SetPortAlphaOpaque () | ||
680 | @implementation QemuWindow | 680 | @implementation QemuWindow |
681 | - (void)miniaturize:(id)sender | 681 | - (void)miniaturize:(id)sender |
682 | { | 682 | { |
683 | - | 683 | + |
684 | /* make the alpha channel opaque so anim won't have holes in it */ | 684 | /* make the alpha channel opaque so anim won't have holes in it */ |
685 | QZ_SetPortAlphaOpaque (); | 685 | QZ_SetPortAlphaOpaque (); |
686 | - | 686 | + |
687 | [ super miniaturize:sender ]; | 687 | [ super miniaturize:sender ]; |
688 | - | 688 | + |
689 | } | 689 | } |
690 | - (void)display | 690 | - (void)display |
691 | -{ | 691 | +{ |
692 | /* | 692 | /* |
693 | This method fires just before the window deminaturizes from the Dock. | 693 | This method fires just before the window deminaturizes from the Dock. |
694 | - | 694 | + |
695 | We'll save the current visible surface, let the window manager redraw any | 695 | We'll save the current visible surface, let the window manager redraw any |
696 | UI elements, and restore the SDL surface. This way, no expose event | 696 | UI elements, and restore the SDL surface. This way, no expose event |
697 | is required, and the deminiaturize works perfectly. | 697 | is required, and the deminiaturize works perfectly. |
698 | */ | 698 | */ |
699 | - | 699 | + |
700 | /* make sure pixels are fully opaque */ | 700 | /* make sure pixels are fully opaque */ |
701 | QZ_SetPortAlphaOpaque (); | 701 | QZ_SetPortAlphaOpaque (); |
702 | - | 702 | + |
703 | /* save current visible SDL surface */ | 703 | /* save current visible SDL surface */ |
704 | [ self cacheImageInRect:[ qd_view frame ] ]; | 704 | [ self cacheImageInRect:[ qd_view frame ] ]; |
705 | - | 705 | + |
706 | /* let the window manager redraw controls, border, etc */ | 706 | /* let the window manager redraw controls, border, etc */ |
707 | [ super display ]; | 707 | [ super display ]; |
708 | - | 708 | + |
709 | /* restore visible SDL surface */ | 709 | /* restore visible SDL surface */ |
710 | [ self restoreCachedImage ]; | 710 | [ self restoreCachedImage ]; |
711 | } | 711 | } |
@@ -742,13 +742,13 @@ static void QZ_SetPortAlphaOpaque () | @@ -742,13 +742,13 @@ static void QZ_SetPortAlphaOpaque () | ||
742 | if( gArgc <= 1 || strncmp (gArgv[1], "-psn", 4) == 0) | 742 | if( gArgc <= 1 || strncmp (gArgv[1], "-psn", 4) == 0) |
743 | { | 743 | { |
744 | NSOpenPanel *op = [[NSOpenPanel alloc] init]; | 744 | NSOpenPanel *op = [[NSOpenPanel alloc] init]; |
745 | - | 745 | + |
746 | cocoa_resize(¤t_ds, 640, 400); | 746 | cocoa_resize(¤t_ds, 640, 400); |
747 | - | 747 | + |
748 | [op setPrompt:@"Boot image"]; | 748 | [op setPrompt:@"Boot image"]; |
749 | - | 749 | + |
750 | [op setMessage:@"Select the disk image you want to boot.\n\nHit the \"Cancel\" button to quit"]; | 750 | [op setMessage:@"Select the disk image you want to boot.\n\nHit the \"Cancel\" button to quit"]; |
751 | - | 751 | + |
752 | [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cow",@"cloop",@"vmdk",nil] | 752 | [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cow",@"cloop",@"vmdk",nil] |
753 | modalForWindow:window modalDelegate:self | 753 | modalForWindow:window modalDelegate:self |
754 | didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; | 754 | didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; |
@@ -774,20 +774,20 @@ static void QZ_SetPortAlphaOpaque () | @@ -774,20 +774,20 @@ static void QZ_SetPortAlphaOpaque () | ||
774 | { | 774 | { |
775 | exit(0); | 775 | exit(0); |
776 | } | 776 | } |
777 | - | 777 | + |
778 | if(returnCode == NSOKButton) | 778 | if(returnCode == NSOKButton) |
779 | { | 779 | { |
780 | char *bin = "qemu"; | 780 | char *bin = "qemu"; |
781 | char *img = (char*)[ [ sheet filename ] cString]; | 781 | char *img = (char*)[ [ sheet filename ] cString]; |
782 | - | 782 | + |
783 | char **argv = (char**)malloc( sizeof(char*)*3 ); | 783 | char **argv = (char**)malloc( sizeof(char*)*3 ); |
784 | - | 784 | + |
785 | asprintf(&argv[0], "%s", bin); | 785 | asprintf(&argv[0], "%s", bin); |
786 | asprintf(&argv[1], "-hda"); | 786 | asprintf(&argv[1], "-hda"); |
787 | asprintf(&argv[2], "%s", img); | 787 | asprintf(&argv[2], "%s", img); |
788 | - | 788 | + |
789 | printf("Using argc %d argv %s -hda %s\n", 3, bin, img); | 789 | printf("Using argc %d argv %s -hda %s\n", 3, bin, img); |
790 | - | 790 | + |
791 | [self startEmulationWithArgc:3 argv:(char**)argv]; | 791 | [self startEmulationWithArgc:3 argv:(char**)argv]; |
792 | } | 792 | } |
793 | } | 793 | } |
@@ -827,10 +827,10 @@ static void setApplicationMenu(void) | @@ -827,10 +827,10 @@ static void setApplicationMenu(void) | ||
827 | NSMenuItem *menuItem; | 827 | NSMenuItem *menuItem; |
828 | NSString *title; | 828 | NSString *title; |
829 | NSString *appName; | 829 | NSString *appName; |
830 | - | 830 | + |
831 | appName = @"Qemu"; | 831 | appName = @"Qemu"; |
832 | appleMenu = [[NSMenu alloc] initWithTitle:@""]; | 832 | appleMenu = [[NSMenu alloc] initWithTitle:@""]; |
833 | - | 833 | + |
834 | /* Add menu items */ | 834 | /* Add menu items */ |
835 | title = [@"About " stringByAppendingString:appName]; | 835 | title = [@"About " stringByAppendingString:appName]; |
836 | [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; | 836 | [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; |
@@ -850,7 +850,7 @@ static void setApplicationMenu(void) | @@ -850,7 +850,7 @@ static void setApplicationMenu(void) | ||
850 | title = [@"Quit " stringByAppendingString:appName]; | 850 | title = [@"Quit " stringByAppendingString:appName]; |
851 | [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; | 851 | [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; |
852 | 852 | ||
853 | - | 853 | + |
854 | /* Put menu into the menubar */ | 854 | /* Put menu into the menubar */ |
855 | menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; | 855 | menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; |
856 | [menuItem setSubmenu:appleMenu]; | 856 | [menuItem setSubmenu:appleMenu]; |
@@ -872,17 +872,17 @@ static void setupWindowMenu(void) | @@ -872,17 +872,17 @@ static void setupWindowMenu(void) | ||
872 | NSMenuItem *menuItem; | 872 | NSMenuItem *menuItem; |
873 | 873 | ||
874 | windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; | 874 | windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; |
875 | - | 875 | + |
876 | /* "Minimize" item */ | 876 | /* "Minimize" item */ |
877 | menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; | 877 | menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; |
878 | [windowMenu addItem:menuItem]; | 878 | [windowMenu addItem:menuItem]; |
879 | [menuItem release]; | 879 | [menuItem release]; |
880 | - | 880 | + |
881 | /* Put menu into the menubar */ | 881 | /* Put menu into the menubar */ |
882 | windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; | 882 | windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; |
883 | [windowMenuItem setSubmenu:windowMenu]; | 883 | [windowMenuItem setSubmenu:windowMenu]; |
884 | [[NSApp mainMenu] addItem:windowMenuItem]; | 884 | [[NSApp mainMenu] addItem:windowMenuItem]; |
885 | - | 885 | + |
886 | /* Tell the application object that this is now the window menu */ | 886 | /* Tell the application object that this is now the window menu */ |
887 | [NSApp setWindowsMenu:windowMenu]; | 887 | [NSApp setWindowsMenu:windowMenu]; |
888 | 888 | ||
@@ -896,14 +896,14 @@ static void CustomApplicationMain(void) | @@ -896,14 +896,14 @@ static void CustomApplicationMain(void) | ||
896 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | 896 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
897 | QemuCocoaGUIController *gui_controller; | 897 | QemuCocoaGUIController *gui_controller; |
898 | CPSProcessSerNum PSN; | 898 | CPSProcessSerNum PSN; |
899 | - | 899 | + |
900 | [NSApplication sharedApplication]; | 900 | [NSApplication sharedApplication]; |
901 | - | 901 | + |
902 | if (!CPSGetCurrentProcess(&PSN)) | 902 | if (!CPSGetCurrentProcess(&PSN)) |
903 | if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) | 903 | if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) |
904 | if (!CPSSetFrontProcess(&PSN)) | 904 | if (!CPSSetFrontProcess(&PSN)) |
905 | [NSApplication sharedApplication]; | 905 | [NSApplication sharedApplication]; |
906 | - | 906 | + |
907 | /* Set up the menubar */ | 907 | /* Set up the menubar */ |
908 | [NSApp setMainMenu:[[NSMenu alloc] init]]; | 908 | [NSApp setMainMenu:[[NSMenu alloc] init]]; |
909 | setApplicationMenu(); | 909 | setApplicationMenu(); |
@@ -912,10 +912,10 @@ static void CustomApplicationMain(void) | @@ -912,10 +912,10 @@ static void CustomApplicationMain(void) | ||
912 | /* Create SDLMain and make it the app delegate */ | 912 | /* Create SDLMain and make it the app delegate */ |
913 | gui_controller = [[QemuCocoaGUIController alloc] init]; | 913 | gui_controller = [[QemuCocoaGUIController alloc] init]; |
914 | [NSApp setDelegate:gui_controller]; | 914 | [NSApp setDelegate:gui_controller]; |
915 | - | 915 | + |
916 | /* Start the main event loop */ | 916 | /* Start the main event loop */ |
917 | [NSApp run]; | 917 | [NSApp run]; |
918 | - | 918 | + |
919 | [gui_controller release]; | 919 | [gui_controller release]; |
920 | [pool release]; | 920 | [pool release]; |
921 | } | 921 | } |
console.c
@@ -210,7 +210,7 @@ static void vga_fill_rect (DisplayState *ds, | @@ -210,7 +210,7 @@ static void vga_fill_rect (DisplayState *ds, | ||
210 | { | 210 | { |
211 | uint8_t *d, *d1; | 211 | uint8_t *d, *d1; |
212 | int x, y, bpp; | 212 | int x, y, bpp; |
213 | - | 213 | + |
214 | bpp = (ds->depth + 7) >> 3; | 214 | bpp = (ds->depth + 7) >> 3; |
215 | d1 = ds->data + | 215 | d1 = ds->data + |
216 | ds->linesize * posy + bpp * posx; | 216 | ds->linesize * posy + bpp * posx; |
@@ -591,7 +591,7 @@ static void console_scroll(int ydelta) | @@ -591,7 +591,7 @@ static void console_scroll(int ydelta) | ||
591 | { | 591 | { |
592 | TextConsole *s; | 592 | TextConsole *s; |
593 | int i, y1; | 593 | int i, y1; |
594 | - | 594 | + |
595 | s = active_console; | 595 | s = active_console; |
596 | if (!s || (s->console_type == GRAPHIC_CONSOLE)) | 596 | if (!s || (s->console_type == GRAPHIC_CONSOLE)) |
597 | return; | 597 | return; |
@@ -1047,7 +1047,7 @@ static void kbd_send_chars(void *opaque) | @@ -1047,7 +1047,7 @@ static void kbd_send_chars(void *opaque) | ||
1047 | TextConsole *s = opaque; | 1047 | TextConsole *s = opaque; |
1048 | int len; | 1048 | int len; |
1049 | uint8_t buf[16]; | 1049 | uint8_t buf[16]; |
1050 | - | 1050 | + |
1051 | len = qemu_chr_can_read(s->chr); | 1051 | len = qemu_chr_can_read(s->chr); |
1052 | if (len > s->out_fifo.count) | 1052 | if (len > s->out_fifo.count) |
1053 | len = s->out_fifo.count; | 1053 | len = s->out_fifo.count; |
@@ -1192,7 +1192,7 @@ CharDriverState *text_console_init(DisplayState *ds, const char *p) | @@ -1192,7 +1192,7 @@ CharDriverState *text_console_init(DisplayState *ds, const char *p) | ||
1192 | s->out_fifo.buf = s->out_fifo_buf; | 1192 | s->out_fifo.buf = s->out_fifo_buf; |
1193 | s->out_fifo.buf_size = sizeof(s->out_fifo_buf); | 1193 | s->out_fifo.buf_size = sizeof(s->out_fifo_buf); |
1194 | s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s); | 1194 | s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s); |
1195 | - | 1195 | + |
1196 | if (!color_inited) { | 1196 | if (!color_inited) { |
1197 | color_inited = 1; | 1197 | color_inited = 1; |
1198 | for(j = 0; j < 2; j++) { | 1198 | for(j = 0; j < 2; j++) { |
cpu-exec.c
@@ -84,13 +84,13 @@ static TranslationBlock *tb_find_slow(target_ulong pc, | @@ -84,13 +84,13 @@ static TranslationBlock *tb_find_slow(target_ulong pc, | ||
84 | unsigned int h; | 84 | unsigned int h; |
85 | target_ulong phys_pc, phys_page1, phys_page2, virt_page2; | 85 | target_ulong phys_pc, phys_page1, phys_page2, virt_page2; |
86 | uint8_t *tc_ptr; | 86 | uint8_t *tc_ptr; |
87 | - | 87 | + |
88 | spin_lock(&tb_lock); | 88 | spin_lock(&tb_lock); |
89 | 89 | ||
90 | tb_invalidated_flag = 0; | 90 | tb_invalidated_flag = 0; |
91 | - | 91 | + |
92 | regs_to_env(); /* XXX: do it just before cpu_gen_code() */ | 92 | regs_to_env(); /* XXX: do it just before cpu_gen_code() */ |
93 | - | 93 | + |
94 | /* find translated block using physical mappings */ | 94 | /* find translated block using physical mappings */ |
95 | phys_pc = get_phys_addr_code(env, pc); | 95 | phys_pc = get_phys_addr_code(env, pc); |
96 | phys_page1 = phys_pc & TARGET_PAGE_MASK; | 96 | phys_page1 = phys_pc & TARGET_PAGE_MASK; |
@@ -135,7 +135,7 @@ static TranslationBlock *tb_find_slow(target_ulong pc, | @@ -135,7 +135,7 @@ static TranslationBlock *tb_find_slow(target_ulong pc, | ||
135 | tb->flags = flags; | 135 | tb->flags = flags; |
136 | cpu_gen_code(env, tb, CODE_GEN_MAX_SIZE, &code_gen_size); | 136 | cpu_gen_code(env, tb, CODE_GEN_MAX_SIZE, &code_gen_size); |
137 | code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1)); | 137 | code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1)); |
138 | - | 138 | + |
139 | /* check next page if needed */ | 139 | /* check next page if needed */ |
140 | virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; | 140 | virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; |
141 | phys_page2 = -1; | 141 | phys_page2 = -1; |
@@ -143,7 +143,7 @@ static TranslationBlock *tb_find_slow(target_ulong pc, | @@ -143,7 +143,7 @@ static TranslationBlock *tb_find_slow(target_ulong pc, | ||
143 | phys_page2 = get_phys_addr_code(env, virt_page2); | 143 | phys_page2 = get_phys_addr_code(env, virt_page2); |
144 | } | 144 | } |
145 | tb_link_phys(tb, phys_pc, phys_page2); | 145 | tb_link_phys(tb, phys_pc, phys_page2); |
146 | - | 146 | + |
147 | found: | 147 | found: |
148 | /* we add the TB in the virtual pc hash table */ | 148 | /* we add the TB in the virtual pc hash table */ |
149 | env->tb_jmp_cache[tb_jmp_cache_hash_func(pc)] = tb; | 149 | env->tb_jmp_cache[tb_jmp_cache_hash_func(pc)] = tb; |
@@ -371,7 +371,7 @@ int cpu_exec(CPUState *env1) | @@ -371,7 +371,7 @@ int cpu_exec(CPUState *env1) | ||
371 | #if defined(__sparc__) && !defined(HOST_SOLARIS) | 371 | #if defined(__sparc__) && !defined(HOST_SOLARIS) |
372 | /* g1 can be modified by some libc? functions */ | 372 | /* g1 can be modified by some libc? functions */ |
373 | tmp_T0 = T0; | 373 | tmp_T0 = T0; |
374 | -#endif | 374 | +#endif |
375 | interrupt_request = env->interrupt_request; | 375 | interrupt_request = env->interrupt_request; |
376 | if (__builtin_expect(interrupt_request, 0)) { | 376 | if (__builtin_expect(interrupt_request, 0)) { |
377 | if (interrupt_request & CPU_INTERRUPT_DEBUG) { | 377 | if (interrupt_request & CPU_INTERRUPT_DEBUG) { |
@@ -565,7 +565,7 @@ int cpu_exec(CPUState *env1) | @@ -565,7 +565,7 @@ int cpu_exec(CPUState *env1) | ||
565 | #endif | 565 | #endif |
566 | #if defined(__sparc__) && !defined(HOST_SOLARIS) | 566 | #if defined(__sparc__) && !defined(HOST_SOLARIS) |
567 | T0 = tmp_T0; | 567 | T0 = tmp_T0; |
568 | -#endif | 568 | +#endif |
569 | /* see if we can patch the calling TB. When the TB | 569 | /* see if we can patch the calling TB. When the TB |
570 | spans two pages, we cannot safely do a direct | 570 | spans two pages, we cannot safely do a direct |
571 | jump. */ | 571 | jump. */ |
@@ -796,7 +796,7 @@ void cpu_x86_fsave(CPUX86State *s, uint8_t *ptr, int data32) | @@ -796,7 +796,7 @@ void cpu_x86_fsave(CPUX86State *s, uint8_t *ptr, int data32) | ||
796 | 796 | ||
797 | saved_env = env; | 797 | saved_env = env; |
798 | env = s; | 798 | env = s; |
799 | - | 799 | + |
800 | helper_fsave((target_ulong)ptr, data32); | 800 | helper_fsave((target_ulong)ptr, data32); |
801 | 801 | ||
802 | env = saved_env; | 802 | env = saved_env; |
@@ -808,7 +808,7 @@ void cpu_x86_frstor(CPUX86State *s, uint8_t *ptr, int data32) | @@ -808,7 +808,7 @@ void cpu_x86_frstor(CPUX86State *s, uint8_t *ptr, int data32) | ||
808 | 808 | ||
809 | saved_env = env; | 809 | saved_env = env; |
810 | env = s; | 810 | env = s; |
811 | - | 811 | + |
812 | helper_frstor((target_ulong)ptr, data32); | 812 | helper_frstor((target_ulong)ptr, data32); |
813 | 813 | ||
814 | env = saved_env; | 814 | env = saved_env; |
@@ -953,7 +953,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | @@ -953,7 +953,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | ||
953 | { | 953 | { |
954 | TranslationBlock *tb; | 954 | TranslationBlock *tb; |
955 | int ret; | 955 | int ret; |
956 | - | 956 | + |
957 | if (cpu_single_env) | 957 | if (cpu_single_env) |
958 | env = cpu_single_env; /* XXX: find a correct solution for multithread */ | 958 | env = cpu_single_env; /* XXX: find a correct solution for multithread */ |
959 | #if defined(DEBUG_SIGNAL) | 959 | #if defined(DEBUG_SIGNAL) |
@@ -1042,7 +1042,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | @@ -1042,7 +1042,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | ||
1042 | { | 1042 | { |
1043 | TranslationBlock *tb; | 1043 | TranslationBlock *tb; |
1044 | int ret; | 1044 | int ret; |
1045 | - | 1045 | + |
1046 | if (cpu_single_env) | 1046 | if (cpu_single_env) |
1047 | env = cpu_single_env; /* XXX: find a correct solution for multithread */ | 1047 | env = cpu_single_env; /* XXX: find a correct solution for multithread */ |
1048 | #if defined(DEBUG_SIGNAL) | 1048 | #if defined(DEBUG_SIGNAL) |
@@ -1092,7 +1092,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | @@ -1092,7 +1092,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | ||
1092 | { | 1092 | { |
1093 | TranslationBlock *tb; | 1093 | TranslationBlock *tb; |
1094 | int ret; | 1094 | int ret; |
1095 | - | 1095 | + |
1096 | if (cpu_single_env) | 1096 | if (cpu_single_env) |
1097 | env = cpu_single_env; /* XXX: find a correct solution for multithread */ | 1097 | env = cpu_single_env; /* XXX: find a correct solution for multithread */ |
1098 | #if defined(DEBUG_SIGNAL) | 1098 | #if defined(DEBUG_SIGNAL) |
@@ -1137,7 +1137,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | @@ -1137,7 +1137,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, | ||
1137 | { | 1137 | { |
1138 | TranslationBlock *tb; | 1138 | TranslationBlock *tb; |
1139 | int ret; | 1139 | int ret; |
1140 | - | 1140 | + |
1141 | if (cpu_single_env) | 1141 | if (cpu_single_env) |
1142 | env = cpu_single_env; /* XXX: find a correct solution for multithread */ | 1142 | env = cpu_single_env; /* XXX: find a correct solution for multithread */ |
1143 | #if defined(DEBUG_SIGNAL) | 1143 | #if defined(DEBUG_SIGNAL) |
@@ -1371,7 +1371,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | @@ -1371,7 +1371,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
1371 | unsigned long pc; | 1371 | unsigned long pc; |
1372 | int is_write; | 1372 | int is_write; |
1373 | uint32_t insn; | 1373 | uint32_t insn; |
1374 | - | 1374 | + |
1375 | /* XXX: is there a standard glibc define ? */ | 1375 | /* XXX: is there a standard glibc define ? */ |
1376 | pc = regs[1]; | 1376 | pc = regs[1]; |
1377 | /* XXX: need kernel patch to get write flag faster */ | 1377 | /* XXX: need kernel patch to get write flag faster */ |
@@ -1403,7 +1403,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | @@ -1403,7 +1403,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
1403 | struct ucontext *uc = puc; | 1403 | struct ucontext *uc = puc; |
1404 | unsigned long pc; | 1404 | unsigned long pc; |
1405 | int is_write; | 1405 | int is_write; |
1406 | - | 1406 | + |
1407 | pc = uc->uc_mcontext.gregs[R15]; | 1407 | pc = uc->uc_mcontext.gregs[R15]; |
1408 | /* XXX: compute is_write */ | 1408 | /* XXX: compute is_write */ |
1409 | is_write = 0; | 1409 | is_write = 0; |
@@ -1421,7 +1421,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | @@ -1421,7 +1421,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
1421 | struct ucontext *uc = puc; | 1421 | struct ucontext *uc = puc; |
1422 | unsigned long pc; | 1422 | unsigned long pc; |
1423 | int is_write; | 1423 | int is_write; |
1424 | - | 1424 | + |
1425 | pc = uc->uc_mcontext.gregs[16]; | 1425 | pc = uc->uc_mcontext.gregs[16]; |
1426 | /* XXX: compute is_write */ | 1426 | /* XXX: compute is_write */ |
1427 | is_write = 0; | 1427 | is_write = 0; |
@@ -1473,7 +1473,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | @@ -1473,7 +1473,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
1473 | struct ucontext *uc = puc; | 1473 | struct ucontext *uc = puc; |
1474 | unsigned long pc; | 1474 | unsigned long pc; |
1475 | int is_write; | 1475 | int is_write; |
1476 | - | 1476 | + |
1477 | pc = uc->uc_mcontext.psw.addr; | 1477 | pc = uc->uc_mcontext.psw.addr; |
1478 | /* XXX: compute is_write */ | 1478 | /* XXX: compute is_write */ |
1479 | is_write = 0; | 1479 | is_write = 0; |
@@ -1490,7 +1490,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | @@ -1490,7 +1490,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, | ||
1490 | struct ucontext *uc = puc; | 1490 | struct ucontext *uc = puc; |
1491 | greg_t pc = uc->uc_mcontext.pc; | 1491 | greg_t pc = uc->uc_mcontext.pc; |
1492 | int is_write; | 1492 | int is_write; |
1493 | - | 1493 | + |
1494 | /* XXX: compute is_write */ | 1494 | /* XXX: compute is_write */ |
1495 | is_write = 0; | 1495 | is_write = 0; |
1496 | return handle_cpu_signal(pc, (unsigned long)info->si_addr, | 1496 | return handle_cpu_signal(pc, (unsigned long)info->si_addr, |
darwin-user/syscall.c
@@ -1336,7 +1336,7 @@ static inline long bswap_syctl(int * mib, int count, void *buf, int size) | @@ -1336,7 +1336,7 @@ static inline long bswap_syctl(int * mib, int count, void *buf, int size) | ||
1336 | if(!(sysctl = sysctl->childs)) | 1336 | if(!(sysctl = sysctl->childs)) |
1337 | break; | 1337 | break; |
1338 | } | 1338 | } |
1339 | - | 1339 | + |
1340 | if(ret->childs) | 1340 | if(ret->childs) |
1341 | qerror("we shouldn't have a directory element\n"); | 1341 | qerror("we shouldn't have a directory element\n"); |
1342 | 1342 | ||
@@ -1375,7 +1375,7 @@ long do___sysctl(int * name, uint32_t namelen, void * oldp, size_t * oldlenp, vo | @@ -1375,7 +1375,7 @@ long do___sysctl(int * name, uint32_t namelen, void * oldp, size_t * oldlenp, vo | ||
1375 | //bswap_syctl(name, namelen, newp, newlen); | 1375 | //bswap_syctl(name, namelen, newp, newlen); |
1376 | tswap32s((uint32_t*)oldlenp); | 1376 | tswap32s((uint32_t*)oldlenp); |
1377 | } | 1377 | } |
1378 | - | 1378 | + |
1379 | if(name) /* Sometimes sysctl is called with no arg1, ignore */ | 1379 | if(name) /* Sometimes sysctl is called with no arg1, ignore */ |
1380 | ret = get_errno(sysctl(name, namelen, oldp, oldlenp, newp, newlen)); | 1380 | ret = get_errno(sysctl(name, namelen, oldp, oldlenp, newp, newlen)); |
1381 | 1381 |
dis-asm.h
@@ -67,7 +67,7 @@ enum bfd_architecture | @@ -67,7 +67,7 @@ enum bfd_architecture | ||
67 | #define bfd_mach_mcf5249 16 | 67 | #define bfd_mach_mcf5249 16 |
68 | #define bfd_mach_mcf547x 17 | 68 | #define bfd_mach_mcf547x 17 |
69 | #define bfd_mach_mcf548x 18 | 69 | #define bfd_mach_mcf548x 18 |
70 | - bfd_arch_vax, /* DEC Vax */ | 70 | + bfd_arch_vax, /* DEC Vax */ |
71 | bfd_arch_i960, /* Intel 960 */ | 71 | bfd_arch_i960, /* Intel 960 */ |
72 | /* The order of the following is important. | 72 | /* The order of the following is important. |
73 | lower number indicates a machine type that | 73 | lower number indicates a machine type that |
disas.c
@@ -176,7 +176,7 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags) | @@ -176,7 +176,7 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags) | ||
176 | print_insn = print_insn_sparc; | 176 | print_insn = print_insn_sparc; |
177 | #ifdef TARGET_SPARC64 | 177 | #ifdef TARGET_SPARC64 |
178 | disasm_info.mach = bfd_mach_sparc_v9b; | 178 | disasm_info.mach = bfd_mach_sparc_v9b; |
179 | -#endif | 179 | +#endif |
180 | #elif defined(TARGET_PPC) | 180 | #elif defined(TARGET_PPC) |
181 | if (flags) | 181 | if (flags) |
182 | disasm_info.endian = BFD_ENDIAN_LITTLE; | 182 | disasm_info.endian = BFD_ENDIAN_LITTLE; |
@@ -298,7 +298,7 @@ const char *lookup_symbol(target_ulong orig_addr) | @@ -298,7 +298,7 @@ const char *lookup_symbol(target_ulong orig_addr) | ||
298 | Elf32_Sym *sym; | 298 | Elf32_Sym *sym; |
299 | struct syminfo *s; | 299 | struct syminfo *s; |
300 | target_ulong addr; | 300 | target_ulong addr; |
301 | - | 301 | + |
302 | for (s = syminfos; s; s = s->next) { | 302 | for (s = syminfos; s; s = s->next) { |
303 | sym = s->disas_symtab; | 303 | sym = s->disas_symtab; |
304 | for (i = 0; i < s->disas_num_syms; i++) { | 304 | for (i = 0; i < s->disas_num_syms; i++) { |
dyngen.c
@@ -375,7 +375,7 @@ int elf_must_swap(struct elfhdr *h) | @@ -375,7 +375,7 @@ int elf_must_swap(struct elfhdr *h) | ||
375 | return (h->e_ident[EI_DATA] == ELFDATA2MSB) != | 375 | return (h->e_ident[EI_DATA] == ELFDATA2MSB) != |
376 | (swaptest.b[0] == 0); | 376 | (swaptest.b[0] == 0); |
377 | } | 377 | } |
378 | - | 378 | + |
379 | void elf_swap_ehdr(struct elfhdr *h) | 379 | void elf_swap_ehdr(struct elfhdr *h) |
380 | { | 380 | { |
381 | swab16s(&h->e_type); /* Object file type */ | 381 | swab16s(&h->e_type); /* Object file type */ |
@@ -483,11 +483,11 @@ int load_object(const char *filename) | @@ -483,11 +483,11 @@ int load_object(const char *filename) | ||
483 | ElfW(Sym) *sym; | 483 | ElfW(Sym) *sym; |
484 | char *shstr; | 484 | char *shstr; |
485 | ELF_RELOC *rel; | 485 | ELF_RELOC *rel; |
486 | - | 486 | + |
487 | fd = open(filename, O_RDONLY); | 487 | fd = open(filename, O_RDONLY); |
488 | if (fd < 0) | 488 | if (fd < 0) |
489 | error("can't open file '%s'", filename); | 489 | error("can't open file '%s'", filename); |
490 | - | 490 | + |
491 | /* Read ELF header. */ | 491 | /* Read ELF header. */ |
492 | if (read(fd, &ehdr, sizeof (ehdr)) != sizeof (ehdr)) | 492 | if (read(fd, &ehdr, sizeof (ehdr)) != sizeof (ehdr)) |
493 | error("unable to read file header"); | 493 | error("unable to read file header"); |
@@ -524,7 +524,7 @@ int load_object(const char *filename) | @@ -524,7 +524,7 @@ int load_object(const char *filename) | ||
524 | /* read all section data */ | 524 | /* read all section data */ |
525 | sdata = malloc(sizeof(void *) * ehdr.e_shnum); | 525 | sdata = malloc(sizeof(void *) * ehdr.e_shnum); |
526 | memset(sdata, 0, sizeof(void *) * ehdr.e_shnum); | 526 | memset(sdata, 0, sizeof(void *) * ehdr.e_shnum); |
527 | - | 527 | + |
528 | for(i = 0;i < ehdr.e_shnum; i++) { | 528 | for(i = 0;i < ehdr.e_shnum; i++) { |
529 | sec = &shdr[i]; | 529 | sec = &shdr[i]; |
530 | if (sec->sh_type != SHT_NOBITS) | 530 | if (sec->sh_type != SHT_NOBITS) |
@@ -569,7 +569,7 @@ int load_object(const char *filename) | @@ -569,7 +569,7 @@ int load_object(const char *filename) | ||
569 | 569 | ||
570 | symtab = (ElfW(Sym) *)sdata[symtab_sec - shdr]; | 570 | symtab = (ElfW(Sym) *)sdata[symtab_sec - shdr]; |
571 | strtab = (char *)sdata[symtab_sec->sh_link]; | 571 | strtab = (char *)sdata[symtab_sec->sh_link]; |
572 | - | 572 | + |
573 | nb_syms = symtab_sec->sh_size / sizeof(ElfW(Sym)); | 573 | nb_syms = symtab_sec->sh_size / sizeof(ElfW(Sym)); |
574 | if (do_swap) { | 574 | if (do_swap) { |
575 | for(i = 0, sym = symtab; i < nb_syms; i++, sym++) { | 575 | for(i = 0, sym = symtab; i < nb_syms; i++, sym++) { |
@@ -609,7 +609,7 @@ void sym_ent_name(struct external_syment *ext_sym, EXE_SYM *sym) | @@ -609,7 +609,7 @@ void sym_ent_name(struct external_syment *ext_sym, EXE_SYM *sym) | ||
609 | { | 609 | { |
610 | char *q; | 610 | char *q; |
611 | int c, i, len; | 611 | int c, i, len; |
612 | - | 612 | + |
613 | if (ext_sym->e.e.e_zeroes != 0) { | 613 | if (ext_sym->e.e.e_zeroes != 0) { |
614 | q = sym->st_name; | 614 | q = sym->st_name; |
615 | for(i = 0; i < 8; i++) { | 615 | for(i = 0; i < 8; i++) { |
@@ -643,7 +643,7 @@ char *name_for_dotdata(struct coff_rel *rel) | @@ -643,7 +643,7 @@ char *name_for_dotdata(struct coff_rel *rel) | ||
643 | if (sym->st_syment->e_scnum == data_shndx && | 643 | if (sym->st_syment->e_scnum == data_shndx && |
644 | text_data >= sym->st_value && | 644 | text_data >= sym->st_value && |
645 | text_data < sym->st_value + sym->st_size) { | 645 | text_data < sym->st_value + sym->st_size) { |
646 | - | 646 | + |
647 | return sym->st_name; | 647 | return sym->st_name; |
648 | 648 | ||
649 | } | 649 | } |
@@ -709,7 +709,7 @@ int load_object(const char *filename) | @@ -709,7 +709,7 @@ int load_object(const char *filename) | ||
709 | ); | 709 | ); |
710 | if (fd < 0) | 710 | if (fd < 0) |
711 | error("can't open file '%s'", filename); | 711 | error("can't open file '%s'", filename); |
712 | - | 712 | + |
713 | /* Read COFF header. */ | 713 | /* Read COFF header. */ |
714 | if (read(fd, &fhdr, sizeof (fhdr)) != sizeof (fhdr)) | 714 | if (read(fd, &fhdr, sizeof (fhdr)) != sizeof (fhdr)) |
715 | error("unable to read file header"); | 715 | error("unable to read file header"); |
@@ -726,7 +726,7 @@ int load_object(const char *filename) | @@ -726,7 +726,7 @@ int load_object(const char *filename) | ||
726 | /* read all section data */ | 726 | /* read all section data */ |
727 | sdata = malloc(sizeof(void *) * fhdr.f_nscns); | 727 | sdata = malloc(sizeof(void *) * fhdr.f_nscns); |
728 | memset(sdata, 0, sizeof(void *) * fhdr.f_nscns); | 728 | memset(sdata, 0, sizeof(void *) * fhdr.f_nscns); |
729 | - | 729 | + |
730 | const char *p; | 730 | const char *p; |
731 | for(i = 0;i < fhdr.f_nscns; i++) { | 731 | for(i = 0;i < fhdr.f_nscns; i++) { |
732 | sec = &shdr[i]; | 732 | sec = &shdr[i]; |
@@ -747,7 +747,7 @@ int load_object(const char *filename) | @@ -747,7 +747,7 @@ int load_object(const char *filename) | ||
747 | if (!data_sec) | 747 | if (!data_sec) |
748 | error("could not find .data section"); | 748 | error("could not find .data section"); |
749 | coff_data_shndx = data_sec - shdr; | 749 | coff_data_shndx = data_sec - shdr; |
750 | - | 750 | + |
751 | coff_symtab = load_data(fd, fhdr.f_symptr, fhdr.f_nsyms*SYMESZ); | 751 | coff_symtab = load_data(fd, fhdr.f_symptr, fhdr.f_nsyms*SYMESZ); |
752 | for (i = 0, ext_sym = coff_symtab; i < nb_syms; i++, ext_sym++) { | 752 | for (i = 0, ext_sym = coff_symtab; i < nb_syms; i++, ext_sym++) { |
753 | for(i=0;i<8;i++) | 753 | for(i=0;i<8;i++) |
@@ -758,7 +758,7 @@ int load_object(const char *filename) | @@ -758,7 +758,7 @@ int load_object(const char *filename) | ||
758 | 758 | ||
759 | n_strtab = load_data(fd, (fhdr.f_symptr + fhdr.f_nsyms*SYMESZ), STRTAB_SIZE); | 759 | n_strtab = load_data(fd, (fhdr.f_symptr + fhdr.f_nsyms*SYMESZ), STRTAB_SIZE); |
760 | strtab = load_data(fd, (fhdr.f_symptr + fhdr.f_nsyms*SYMESZ), *n_strtab); | 760 | strtab = load_data(fd, (fhdr.f_symptr + fhdr.f_nsyms*SYMESZ), *n_strtab); |
761 | - | 761 | + |
762 | nb_syms = fhdr.f_nsyms; | 762 | nb_syms = fhdr.f_nsyms; |
763 | 763 | ||
764 | for (i = 0, ext_sym = coff_symtab; i < nb_syms; i++, ext_sym++) { | 764 | for (i = 0, ext_sym = coff_symtab; i < nb_syms; i++, ext_sym++) { |
@@ -805,12 +805,12 @@ int load_object(const char *filename) | @@ -805,12 +805,12 @@ int load_object(const char *filename) | ||
805 | } else { | 805 | } else { |
806 | sym->st_size = 0; | 806 | sym->st_size = 0; |
807 | } | 807 | } |
808 | - | 808 | + |
809 | sym->st_type = ext_sym->e_type; | 809 | sym->st_type = ext_sym->e_type; |
810 | sym->st_shndx = ext_sym->e_scnum; | 810 | sym->st_shndx = ext_sym->e_scnum; |
811 | } | 811 | } |
812 | 812 | ||
813 | - | 813 | + |
814 | /* find text relocations, if any */ | 814 | /* find text relocations, if any */ |
815 | sec = &shdr[coff_text_shndx]; | 815 | sec = &shdr[coff_text_shndx]; |
816 | coff_relocs = load_data(fd, sec->s_relptr, sec->s_nreloc*RELSZ); | 816 | coff_relocs = load_data(fd, sec->s_relptr, sec->s_nreloc*RELSZ); |
@@ -870,7 +870,7 @@ static char *get_sym_name(EXE_SYM *sym) | @@ -870,7 +870,7 @@ static char *get_sym_name(EXE_SYM *sym) | ||
870 | 870 | ||
871 | if ( sym->n_type & N_STAB ) /* Debug symbols are ignored */ | 871 | if ( sym->n_type & N_STAB ) /* Debug symbols are ignored */ |
872 | return "debug"; | 872 | return "debug"; |
873 | - | 873 | + |
874 | if(!name) | 874 | if(!name) |
875 | return name; | 875 | return name; |
876 | if(name[0]=='_') | 876 | if(name[0]=='_') |
@@ -953,23 +953,23 @@ static const char * find_reloc_name_in_sec_ptr(int address, struct section * sec | @@ -953,23 +953,23 @@ static const char * find_reloc_name_in_sec_ptr(int address, struct section * sec | ||
953 | { | 953 | { |
954 | unsigned int tocindex, symindex, size; | 954 | unsigned int tocindex, symindex, size; |
955 | const char *name = 0; | 955 | const char *name = 0; |
956 | - | 956 | + |
957 | /* Sanity check */ | 957 | /* Sanity check */ |
958 | if(!( address >= sec_hdr->addr && address < (sec_hdr->addr + sec_hdr->size) ) ) | 958 | if(!( address >= sec_hdr->addr && address < (sec_hdr->addr + sec_hdr->size) ) ) |
959 | return (char*)0; | 959 | return (char*)0; |
960 | - | 960 | + |
961 | if( sec_hdr->flags & S_SYMBOL_STUBS ){ | 961 | if( sec_hdr->flags & S_SYMBOL_STUBS ){ |
962 | size = sec_hdr->reserved2; | 962 | size = sec_hdr->reserved2; |
963 | if(size == 0) | 963 | if(size == 0) |
964 | error("size = 0"); | 964 | error("size = 0"); |
965 | - | 965 | + |
966 | } | 966 | } |
967 | else if( sec_hdr->flags & S_LAZY_SYMBOL_POINTERS || | 967 | else if( sec_hdr->flags & S_LAZY_SYMBOL_POINTERS || |
968 | sec_hdr->flags & S_NON_LAZY_SYMBOL_POINTERS) | 968 | sec_hdr->flags & S_NON_LAZY_SYMBOL_POINTERS) |
969 | size = sizeof(unsigned long); | 969 | size = sizeof(unsigned long); |
970 | else | 970 | else |
971 | return 0; | 971 | return 0; |
972 | - | 972 | + |
973 | /* Compute our index in toc */ | 973 | /* Compute our index in toc */ |
974 | tocindex = (address - sec_hdr->addr)/size; | 974 | tocindex = (address - sec_hdr->addr)/size; |
975 | symindex = tocdylib[sec_hdr->reserved1 + tocindex]; | 975 | symindex = tocdylib[sec_hdr->reserved1 + tocindex]; |
@@ -1015,7 +1015,7 @@ static const char * get_reloc_name(EXE_RELOC * rel, int * sslide) | @@ -1015,7 +1015,7 @@ static const char * get_reloc_name(EXE_RELOC * rel, int * sslide) | ||
1015 | 1015 | ||
1016 | /* Intruction contains an offset to the symbols pointed to, in the rel->r_symbolnum section */ | 1016 | /* Intruction contains an offset to the symbols pointed to, in the rel->r_symbolnum section */ |
1017 | sectoffset = *(uint32_t *)(text + rel->r_address) & 0xffff; | 1017 | sectoffset = *(uint32_t *)(text + rel->r_address) & 0xffff; |
1018 | - | 1018 | + |
1019 | if(sectnum==0xffffff) | 1019 | if(sectnum==0xffffff) |
1020 | return 0; | 1020 | return 0; |
1021 | 1021 | ||
@@ -1041,7 +1041,7 @@ static const char * get_reloc_name(EXE_RELOC * rel, int * sslide) | @@ -1041,7 +1041,7 @@ static const char * get_reloc_name(EXE_RELOC * rel, int * sslide) | ||
1041 | 1041 | ||
1042 | if(rel->r_pcrel) | 1042 | if(rel->r_pcrel) |
1043 | sectoffset += rel->r_address; | 1043 | sectoffset += rel->r_address; |
1044 | - | 1044 | + |
1045 | if (rel->r_type == PPC_RELOC_BR24) | 1045 | if (rel->r_type == PPC_RELOC_BR24) |
1046 | name = (char *)find_reloc_name_in_sec_ptr((int)sectoffset, §ion_hdr[sectnum-1]); | 1046 | name = (char *)find_reloc_name_in_sec_ptr((int)sectoffset, §ion_hdr[sectnum-1]); |
1047 | 1047 | ||
@@ -1080,11 +1080,11 @@ int load_object(const char *filename) | @@ -1080,11 +1080,11 @@ int load_object(const char *filename) | ||
1080 | unsigned int i, j; | 1080 | unsigned int i, j; |
1081 | EXE_SYM *sym; | 1081 | EXE_SYM *sym; |
1082 | struct nlist *syment; | 1082 | struct nlist *syment; |
1083 | - | 1083 | + |
1084 | fd = open(filename, O_RDONLY); | 1084 | fd = open(filename, O_RDONLY); |
1085 | if (fd < 0) | 1085 | if (fd < 0) |
1086 | error("can't open file '%s'", filename); | 1086 | error("can't open file '%s'", filename); |
1087 | - | 1087 | + |
1088 | /* Read Mach header. */ | 1088 | /* Read Mach header. */ |
1089 | if (read(fd, &mach_hdr, sizeof (mach_hdr)) != sizeof (mach_hdr)) | 1089 | if (read(fd, &mach_hdr, sizeof (mach_hdr)) != sizeof (mach_hdr)) |
1090 | error("unable to read file header"); | 1090 | error("unable to read file header"); |
@@ -1093,13 +1093,13 @@ int load_object(const char *filename) | @@ -1093,13 +1093,13 @@ int load_object(const char *filename) | ||
1093 | if (!check_mach_header(mach_hdr)) { | 1093 | if (!check_mach_header(mach_hdr)) { |
1094 | error("bad Mach header"); | 1094 | error("bad Mach header"); |
1095 | } | 1095 | } |
1096 | - | 1096 | + |
1097 | if (mach_hdr.cputype != CPU_TYPE_POWERPC) | 1097 | if (mach_hdr.cputype != CPU_TYPE_POWERPC) |
1098 | error("Unsupported CPU"); | 1098 | error("Unsupported CPU"); |
1099 | - | 1099 | + |
1100 | if (mach_hdr.filetype != MH_OBJECT) | 1100 | if (mach_hdr.filetype != MH_OBJECT) |
1101 | error("Unsupported Mach Object"); | 1101 | error("Unsupported Mach Object"); |
1102 | - | 1102 | + |
1103 | /* read segment headers */ | 1103 | /* read segment headers */ |
1104 | for(i=0, j=sizeof(mach_hdr); i<mach_hdr.ncmds ; i++) | 1104 | for(i=0, j=sizeof(mach_hdr); i<mach_hdr.ncmds ; i++) |
1105 | { | 1105 | { |
@@ -1143,7 +1143,7 @@ int load_object(const char *filename) | @@ -1143,7 +1143,7 @@ int load_object(const char *filename) | ||
1143 | /* read all section data */ | 1143 | /* read all section data */ |
1144 | sdata = (uint8_t **)malloc(sizeof(void *) * segment->nsects); | 1144 | sdata = (uint8_t **)malloc(sizeof(void *) * segment->nsects); |
1145 | memset(sdata, 0, sizeof(void *) * segment->nsects); | 1145 | memset(sdata, 0, sizeof(void *) * segment->nsects); |
1146 | - | 1146 | + |
1147 | /* Load the data in section data */ | 1147 | /* Load the data in section data */ |
1148 | for(i = 0; i < segment->nsects; i++) { | 1148 | for(i = 0; i < segment->nsects; i++) { |
1149 | sdata[i] = load_data(fd, section_hdr[i].offset, section_hdr[i].size); | 1149 | sdata[i] = load_data(fd, section_hdr[i].offset, section_hdr[i].size); |
@@ -1159,10 +1159,10 @@ int load_object(const char *filename) | @@ -1159,10 +1159,10 @@ int load_object(const char *filename) | ||
1159 | /* Make sure dysym was loaded */ | 1159 | /* Make sure dysym was loaded */ |
1160 | if(!(int)dysymtabcmd) | 1160 | if(!(int)dysymtabcmd) |
1161 | error("could not find __DYSYMTAB segment"); | 1161 | error("could not find __DYSYMTAB segment"); |
1162 | - | 1162 | + |
1163 | /* read the table of content of the indirect sym */ | 1163 | /* read the table of content of the indirect sym */ |
1164 | tocdylib = load_data( fd, dysymtabcmd->indirectsymoff, dysymtabcmd->nindirectsyms * sizeof(uint32_t) ); | 1164 | tocdylib = load_data( fd, dysymtabcmd->indirectsymoff, dysymtabcmd->nindirectsyms * sizeof(uint32_t) ); |
1165 | - | 1165 | + |
1166 | /* Make sure symtab was loaded */ | 1166 | /* Make sure symtab was loaded */ |
1167 | if(!(int)symtabcmd) | 1167 | if(!(int)symtabcmd) |
1168 | error("could not find __SYMTAB segment"); | 1168 | error("could not find __SYMTAB segment"); |
@@ -1178,12 +1178,12 @@ int load_object(const char *filename) | @@ -1178,12 +1178,12 @@ int load_object(const char *filename) | ||
1178 | struct nlist *sym_follow, *sym_next = 0; | 1178 | struct nlist *sym_follow, *sym_next = 0; |
1179 | unsigned int j; | 1179 | unsigned int j; |
1180 | memset(sym, 0, sizeof(*sym)); | 1180 | memset(sym, 0, sizeof(*sym)); |
1181 | - | 1181 | + |
1182 | if ( syment->n_type & N_STAB ) /* Debug symbols are skipped */ | 1182 | if ( syment->n_type & N_STAB ) /* Debug symbols are skipped */ |
1183 | continue; | 1183 | continue; |
1184 | - | 1184 | + |
1185 | memcpy(sym, syment, sizeof(*syment)); | 1185 | memcpy(sym, syment, sizeof(*syment)); |
1186 | - | 1186 | + |
1187 | /* Find the following symbol in order to get the current symbol size */ | 1187 | /* Find the following symbol in order to get the current symbol size */ |
1188 | for(j = 0, sym_follow = symtab_std; j < nb_syms; j++, sym_follow++) { | 1188 | for(j = 0, sym_follow = symtab_std; j < nb_syms; j++, sym_follow++) { |
1189 | if ( sym_follow->n_sect != 1 || sym_follow->n_type & N_STAB || !(sym_follow->n_value > sym->st_value)) | 1189 | if ( sym_follow->n_sect != 1 || sym_follow->n_type & N_STAB || !(sym_follow->n_value > sym->st_value)) |
@@ -1286,9 +1286,9 @@ int arm_emit_ldr_info(const char *name, unsigned long start_offset, | @@ -1286,9 +1286,9 @@ int arm_emit_ldr_info(const char *name, unsigned long start_offset, | ||
1286 | uint8_t data_allocated[1024]; | 1286 | uint8_t data_allocated[1024]; |
1287 | unsigned int data_index; | 1287 | unsigned int data_index; |
1288 | int type; | 1288 | int type; |
1289 | - | 1289 | + |
1290 | memset(data_allocated, 0, sizeof(data_allocated)); | 1290 | memset(data_allocated, 0, sizeof(data_allocated)); |
1291 | - | 1291 | + |
1292 | p = p_start; | 1292 | p = p_start; |
1293 | min_offset = p_end - p_start; | 1293 | min_offset = p_end - p_start; |
1294 | spare = 0x7fffffff; | 1294 | spare = 0x7fffffff; |
@@ -1478,7 +1478,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | @@ -1478,7 +1478,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | ||
1478 | } | 1478 | } |
1479 | copy_size = len; | 1479 | copy_size = len; |
1480 | } | 1480 | } |
1481 | -#endif | 1481 | +#endif |
1482 | #elif defined(HOST_PPC) | 1482 | #elif defined(HOST_PPC) |
1483 | { | 1483 | { |
1484 | uint8_t *p; | 1484 | uint8_t *p; |
@@ -1510,7 +1510,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | @@ -1510,7 +1510,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | ||
1510 | #endif | 1510 | #endif |
1511 | if (get32((uint32_t *)p) != 0x6bfa8001) | 1511 | if (get32((uint32_t *)p) != 0x6bfa8001) |
1512 | error("ret expected at the end of %s", name); | 1512 | error("ret expected at the end of %s", name); |
1513 | - copy_size = p - p_start; | 1513 | + copy_size = p - p_start; |
1514 | } | 1514 | } |
1515 | #elif defined(HOST_IA64) | 1515 | #elif defined(HOST_IA64) |
1516 | { | 1516 | { |
@@ -1611,14 +1611,14 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | @@ -1611,14 +1611,14 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | ||
1611 | } else { | 1611 | } else { |
1612 | error("No save at the beginning of %s", name); | 1612 | error("No save at the beginning of %s", name); |
1613 | } | 1613 | } |
1614 | - | 1614 | + |
1615 | /* Skip a preceeding nop, if present. */ | 1615 | /* Skip a preceeding nop, if present. */ |
1616 | if (p > p_start) { | 1616 | if (p > p_start) { |
1617 | skip_insn = get32((uint32_t *)(p - 0x4)); | 1617 | skip_insn = get32((uint32_t *)(p - 0x4)); |
1618 | if (skip_insn == 0x01000000) | 1618 | if (skip_insn == 0x01000000) |
1619 | p -= 4; | 1619 | p -= 4; |
1620 | } | 1620 | } |
1621 | - | 1621 | + |
1622 | copy_size = p - p_start; | 1622 | copy_size = p - p_start; |
1623 | } | 1623 | } |
1624 | #elif defined(HOST_ARM) | 1624 | #elif defined(HOST_ARM) |
@@ -1700,7 +1700,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | @@ -1700,7 +1700,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | ||
1700 | } | 1700 | } |
1701 | } | 1701 | } |
1702 | } | 1702 | } |
1703 | - | 1703 | + |
1704 | nb_args = 0; | 1704 | nb_args = 0; |
1705 | while (nb_args < MAX_ARGS && args_present[nb_args]) | 1705 | while (nb_args < MAX_ARGS && args_present[nb_args]) |
1706 | nb_args++; | 1706 | nb_args++; |
@@ -1784,7 +1784,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | @@ -1784,7 +1784,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | ||
1784 | if (strstart(sym_name, "__op_label", &p)) { | 1784 | if (strstart(sym_name, "__op_label", &p)) { |
1785 | uint8_t *ptr; | 1785 | uint8_t *ptr; |
1786 | unsigned long offset; | 1786 | unsigned long offset; |
1787 | - | 1787 | + |
1788 | /* test if the variable refers to a label inside | 1788 | /* test if the variable refers to a label inside |
1789 | the code we are generating */ | 1789 | the code we are generating */ |
1790 | #ifdef CONFIG_FORMAT_COFF | 1790 | #ifdef CONFIG_FORMAT_COFF |
@@ -1828,7 +1828,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | @@ -1828,7 +1828,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | ||
1828 | } | 1828 | } |
1829 | } | 1829 | } |
1830 | } | 1830 | } |
1831 | -#endif | 1831 | +#endif |
1832 | if (val >= start_offset && val <= start_offset + copy_size) { | 1832 | if (val >= start_offset && val <= start_offset + copy_size) { |
1833 | n = strtol(p, NULL, 10); | 1833 | n = strtol(p, NULL, 10); |
1834 | fprintf(outfile, " label_offsets[%d] = %ld + (gen_code_ptr - gen_code_buf);\n", n, (long)(val - start_offset)); | 1834 | fprintf(outfile, " label_offsets[%d] = %ld + (gen_code_ptr - gen_code_buf);\n", n, (long)(val - start_offset)); |
@@ -1973,7 +1973,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | @@ -1973,7 +1973,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size, | ||
1973 | n, reloc_offset); | 1973 | n, reloc_offset); |
1974 | continue; | 1974 | continue; |
1975 | } | 1975 | } |
1976 | - | 1976 | + |
1977 | get_reloc_expr(relname, sizeof(relname), sym_name); | 1977 | get_reloc_expr(relname, sizeof(relname), sym_name); |
1978 | type = ELF32_R_TYPE(rel->r_info); | 1978 | type = ELF32_R_TYPE(rel->r_info); |
1979 | addend = rel->r_addend; | 1979 | addend = rel->r_addend; |
@@ -2652,7 +2652,7 @@ int gen_file(FILE *outfile, int out_type) | @@ -2652,7 +2652,7 @@ int gen_file(FILE *outfile, int out_type) | ||
2652 | gen_code(name, sym->st_value, sym->st_size, outfile, 0); | 2652 | gen_code(name, sym->st_value, sym->st_size, outfile, 0); |
2653 | } | 2653 | } |
2654 | } | 2654 | } |
2655 | - | 2655 | + |
2656 | } else { | 2656 | } else { |
2657 | /* generate big code generation switch */ | 2657 | /* generate big code generation switch */ |
2658 | 2658 | ||
@@ -2695,7 +2695,7 @@ fprintf(outfile, | @@ -2695,7 +2695,7 @@ fprintf(outfile, | ||
2695 | eliminating the neeed to jump around the pool. | 2695 | eliminating the neeed to jump around the pool. |
2696 | 2696 | ||
2697 | We currently generate: | 2697 | We currently generate: |
2698 | - | 2698 | + |
2699 | [ For this example we assume merging would move op1_pool out of range. | 2699 | [ For this example we assume merging would move op1_pool out of range. |
2700 | In practice we should be able to combine many ops before the offset | 2700 | In practice we should be able to combine many ops before the offset |
2701 | limits are reached. ] | 2701 | limits are reached. ] |
dyngen.h
@@ -51,7 +51,7 @@ static void inline flush_icache_range(unsigned long start, unsigned long stop) | @@ -51,7 +51,7 @@ static void inline flush_icache_range(unsigned long start, unsigned long stop) | ||
51 | 51 | ||
52 | start &= ~(MIN_CACHE_LINE_SIZE - 1); | 52 | start &= ~(MIN_CACHE_LINE_SIZE - 1); |
53 | stop = (stop + MIN_CACHE_LINE_SIZE - 1) & ~(MIN_CACHE_LINE_SIZE - 1); | 53 | stop = (stop + MIN_CACHE_LINE_SIZE - 1) & ~(MIN_CACHE_LINE_SIZE - 1); |
54 | - | 54 | + |
55 | for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) { | 55 | for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) { |
56 | asm volatile ("dcbst 0,%0" : : "r"(p) : "memory"); | 56 | asm volatile ("dcbst 0,%0" : : "r"(p) : "memory"); |
57 | } | 57 | } |
@@ -169,12 +169,12 @@ static uint8_t *arm_flush_ldr(uint8_t *gen_code_ptr, | @@ -169,12 +169,12 @@ static uint8_t *arm_flush_ldr(uint8_t *gen_code_ptr, | ||
169 | arm_reloc_pc24((uint32_t *)gen_code_ptr, 0xeafffffe, target); | 169 | arm_reloc_pc24((uint32_t *)gen_code_ptr, 0xeafffffe, target); |
170 | gen_code_ptr += 4; | 170 | gen_code_ptr += 4; |
171 | } | 171 | } |
172 | - | 172 | + |
173 | /* copy the data */ | 173 | /* copy the data */ |
174 | data_ptr = gen_code_ptr; | 174 | data_ptr = gen_code_ptr; |
175 | memcpy(gen_code_ptr, data_start, data_size); | 175 | memcpy(gen_code_ptr, data_start, data_size); |
176 | gen_code_ptr += data_size; | 176 | gen_code_ptr += data_size; |
177 | - | 177 | + |
178 | /* patch the ldr to point to the data */ | 178 | /* patch the ldr to point to the data */ |
179 | for(le = ldr_start; le < ldr_end; le++) { | 179 | for(le = ldr_start; le < ldr_end; le++) { |
180 | ptr = (uint32_t *)le->ptr; | 180 | ptr = (uint32_t *)le->ptr; |
elf_ops.h
@@ -75,13 +75,13 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab) | @@ -75,13 +75,13 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab) | ||
75 | sizeof(struct elf_shdr) * ehdr->e_shnum); | 75 | sizeof(struct elf_shdr) * ehdr->e_shnum); |
76 | if (!shdr_table) | 76 | if (!shdr_table) |
77 | return -1; | 77 | return -1; |
78 | - | 78 | + |
79 | if (must_swab) { | 79 | if (must_swab) { |
80 | for (i = 0; i < ehdr->e_shnum; i++) { | 80 | for (i = 0; i < ehdr->e_shnum; i++) { |
81 | glue(bswap_shdr, SZ)(shdr_table + i); | 81 | glue(bswap_shdr, SZ)(shdr_table + i); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | - | 84 | + |
85 | symtab = glue(find_section, SZ)(shdr_table, ehdr->e_shnum, SHT_SYMTAB); | 85 | symtab = glue(find_section, SZ)(shdr_table, ehdr->e_shnum, SHT_SYMTAB); |
86 | if (!symtab) | 86 | if (!symtab) |
87 | goto fail; | 87 | goto fail; |
@@ -176,7 +176,7 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, | @@ -176,7 +176,7 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, | ||
176 | glue(bswap_phdr, SZ)(ph); | 176 | glue(bswap_phdr, SZ)(ph); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | - | 179 | + |
180 | total_size = 0; | 180 | total_size = 0; |
181 | for(i = 0; i < ehdr.e_phnum; i++) { | 181 | for(i = 0; i < ehdr.e_phnum; i++) { |
182 | ph = &phdr[i]; | 182 | ph = &phdr[i]; |
exec-all.h
@@ -68,7 +68,7 @@ typedef void (GenOpFunc)(void); | @@ -68,7 +68,7 @@ typedef void (GenOpFunc)(void); | ||
68 | typedef void (GenOpFunc1)(long); | 68 | typedef void (GenOpFunc1)(long); |
69 | typedef void (GenOpFunc2)(long, long); | 69 | typedef void (GenOpFunc2)(long, long); |
70 | typedef void (GenOpFunc3)(long, long, long); | 70 | typedef void (GenOpFunc3)(long, long, long); |
71 | - | 71 | + |
72 | #if defined(TARGET_I386) | 72 | #if defined(TARGET_I386) |
73 | 73 | ||
74 | void optimize_flags_init(void); | 74 | void optimize_flags_init(void); |
@@ -287,7 +287,7 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, | @@ -287,7 +287,7 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, | ||
287 | if (!tb->jmp_next[n]) { | 287 | if (!tb->jmp_next[n]) { |
288 | /* patch the native jump address */ | 288 | /* patch the native jump address */ |
289 | tb_set_jmp_target(tb, n, (unsigned long)tb_next->tc_ptr); | 289 | tb_set_jmp_target(tb, n, (unsigned long)tb_next->tc_ptr); |
290 | - | 290 | + |
291 | /* add in TB jmp circular list */ | 291 | /* add in TB jmp circular list */ |
292 | tb->jmp_next[n] = tb_next->jmp_first; | 292 | tb->jmp_next[n] = tb_next->jmp_first; |
293 | tb_next->jmp_first = (TranslationBlock *)((long)(tb) | (n)); | 293 | tb_next->jmp_first = (TranslationBlock *)((long)(tb) | (n)); |
@@ -398,7 +398,7 @@ static inline int testandset (int *p) | @@ -398,7 +398,7 @@ static inline int testandset (int *p) | ||
398 | static inline int testandset (int *p) | 398 | static inline int testandset (int *p) |
399 | { | 399 | { |
400 | long int readval = 0; | 400 | long int readval = 0; |
401 | - | 401 | + |
402 | __asm__ __volatile__ ("lock; cmpxchgl %2, %0" | 402 | __asm__ __volatile__ ("lock; cmpxchgl %2, %0" |
403 | : "+m" (*p), "+a" (readval) | 403 | : "+m" (*p), "+a" (readval) |
404 | : "r" (1) | 404 | : "r" (1) |
@@ -409,7 +409,7 @@ static inline int testandset (int *p) | @@ -409,7 +409,7 @@ static inline int testandset (int *p) | ||
409 | static inline int testandset (int *p) | 409 | static inline int testandset (int *p) |
410 | { | 410 | { |
411 | long int readval = 0; | 411 | long int readval = 0; |
412 | - | 412 | + |
413 | __asm__ __volatile__ ("lock; cmpxchgl %2, %0" | 413 | __asm__ __volatile__ ("lock; cmpxchgl %2, %0" |
414 | : "+m" (*p), "+a" (readval) | 414 | : "+m" (*p), "+a" (readval) |
415 | : "r" (1) | 415 | : "r" (1) |
@@ -464,7 +464,7 @@ static inline int testandset (int *spinlock) | @@ -464,7 +464,7 @@ static inline int testandset (int *spinlock) | ||
464 | __asm__ __volatile__("swp %0, %1, [%2]" | 464 | __asm__ __volatile__("swp %0, %1, [%2]" |
465 | : "=r"(ret) | 465 | : "=r"(ret) |
466 | : "0"(1), "r"(spinlock)); | 466 | : "0"(1), "r"(spinlock)); |
467 | - | 467 | + |
468 | return ret; | 468 | return ret; |
469 | } | 469 | } |
470 | #elif defined(__mc68000) | 470 | #elif defined(__mc68000) |
exec.c
@@ -175,10 +175,10 @@ static void page_init(void) | @@ -175,10 +175,10 @@ static void page_init(void) | ||
175 | { | 175 | { |
176 | SYSTEM_INFO system_info; | 176 | SYSTEM_INFO system_info; |
177 | DWORD old_protect; | 177 | DWORD old_protect; |
178 | - | 178 | + |
179 | GetSystemInfo(&system_info); | 179 | GetSystemInfo(&system_info); |
180 | qemu_real_host_page_size = system_info.dwPageSize; | 180 | qemu_real_host_page_size = system_info.dwPageSize; |
181 | - | 181 | + |
182 | VirtualProtect(code_gen_buffer, sizeof(code_gen_buffer), | 182 | VirtualProtect(code_gen_buffer, sizeof(code_gen_buffer), |
183 | PAGE_EXECUTE_READWRITE, &old_protect); | 183 | PAGE_EXECUTE_READWRITE, &old_protect); |
184 | } | 184 | } |
@@ -189,11 +189,11 @@ static void page_init(void) | @@ -189,11 +189,11 @@ static void page_init(void) | ||
189 | 189 | ||
190 | start = (unsigned long)code_gen_buffer; | 190 | start = (unsigned long)code_gen_buffer; |
191 | start &= ~(qemu_real_host_page_size - 1); | 191 | start &= ~(qemu_real_host_page_size - 1); |
192 | - | 192 | + |
193 | end = (unsigned long)code_gen_buffer + sizeof(code_gen_buffer); | 193 | end = (unsigned long)code_gen_buffer + sizeof(code_gen_buffer); |
194 | end += qemu_real_host_page_size - 1; | 194 | end += qemu_real_host_page_size - 1; |
195 | end &= ~(qemu_real_host_page_size - 1); | 195 | end &= ~(qemu_real_host_page_size - 1); |
196 | - | 196 | + |
197 | mprotect((void *)start, end - start, | 197 | mprotect((void *)start, end - start, |
198 | PROT_READ | PROT_WRITE | PROT_EXEC); | 198 | PROT_READ | PROT_WRITE | PROT_EXEC); |
199 | } | 199 | } |
@@ -345,7 +345,7 @@ void tb_flush(CPUState *env1) | @@ -345,7 +345,7 @@ void tb_flush(CPUState *env1) | ||
345 | nb_tbs > 0 ? (code_gen_ptr - code_gen_buffer) / nb_tbs : 0); | 345 | nb_tbs > 0 ? (code_gen_ptr - code_gen_buffer) / nb_tbs : 0); |
346 | #endif | 346 | #endif |
347 | nb_tbs = 0; | 347 | nb_tbs = 0; |
348 | - | 348 | + |
349 | for(env = first_cpu; env != NULL; env = env->next_cpu) { | 349 | for(env = first_cpu; env != NULL; env = env->next_cpu) { |
350 | memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *)); | 350 | memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *)); |
351 | } | 351 | } |
@@ -382,7 +382,7 @@ static void tb_page_check(void) | @@ -382,7 +382,7 @@ static void tb_page_check(void) | ||
382 | { | 382 | { |
383 | TranslationBlock *tb; | 383 | TranslationBlock *tb; |
384 | int i, flags1, flags2; | 384 | int i, flags1, flags2; |
385 | - | 385 | + |
386 | for(i = 0;i < CODE_GEN_PHYS_HASH_SIZE; i++) { | 386 | for(i = 0;i < CODE_GEN_PHYS_HASH_SIZE; i++) { |
387 | for(tb = tb_phys_hash[i]; tb != NULL; tb = tb->phys_hash_next) { | 387 | for(tb = tb_phys_hash[i]; tb != NULL; tb = tb->phys_hash_next) { |
388 | flags1 = page_get_flags(tb->pc); | 388 | flags1 = page_get_flags(tb->pc); |
@@ -491,7 +491,7 @@ static inline void tb_phys_invalidate(TranslationBlock *tb, unsigned int page_ad | @@ -491,7 +491,7 @@ static inline void tb_phys_invalidate(TranslationBlock *tb, unsigned int page_ad | ||
491 | unsigned int h, n1; | 491 | unsigned int h, n1; |
492 | target_ulong phys_pc; | 492 | target_ulong phys_pc; |
493 | TranslationBlock *tb1, *tb2; | 493 | TranslationBlock *tb1, *tb2; |
494 | - | 494 | + |
495 | /* remove the TB from the hash list */ | 495 | /* remove the TB from the hash list */ |
496 | phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK); | 496 | phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK); |
497 | h = tb_phys_hash_func(phys_pc); | 497 | h = tb_phys_hash_func(phys_pc); |
@@ -571,7 +571,7 @@ static void build_page_bitmap(PageDesc *p) | @@ -571,7 +571,7 @@ static void build_page_bitmap(PageDesc *p) | ||
571 | { | 571 | { |
572 | int n, tb_start, tb_end; | 572 | int n, tb_start, tb_end; |
573 | TranslationBlock *tb; | 573 | TranslationBlock *tb; |
574 | - | 574 | + |
575 | p->code_bitmap = qemu_malloc(TARGET_PAGE_SIZE / 8); | 575 | p->code_bitmap = qemu_malloc(TARGET_PAGE_SIZE / 8); |
576 | if (!p->code_bitmap) | 576 | if (!p->code_bitmap) |
577 | return; | 577 | return; |
@@ -624,7 +624,7 @@ static void tb_gen_code(CPUState *env, | @@ -624,7 +624,7 @@ static void tb_gen_code(CPUState *env, | ||
624 | tb->cflags = cflags; | 624 | tb->cflags = cflags; |
625 | cpu_gen_code(env, tb, CODE_GEN_MAX_SIZE, &code_gen_size); | 625 | cpu_gen_code(env, tb, CODE_GEN_MAX_SIZE, &code_gen_size); |
626 | code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1)); | 626 | code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1)); |
627 | - | 627 | + |
628 | /* check next page if needed */ | 628 | /* check next page if needed */ |
629 | virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; | 629 | virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; |
630 | phys_page2 = -1; | 630 | phys_page2 = -1; |
@@ -634,7 +634,7 @@ static void tb_gen_code(CPUState *env, | @@ -634,7 +634,7 @@ static void tb_gen_code(CPUState *env, | ||
634 | tb_link_phys(tb, phys_pc, phys_page2); | 634 | tb_link_phys(tb, phys_pc, phys_page2); |
635 | } | 635 | } |
636 | #endif | 636 | #endif |
637 | - | 637 | + |
638 | /* invalidate all TBs which intersect with the target physical page | 638 | /* invalidate all TBs which intersect with the target physical page |
639 | starting in range [start;end[. NOTE: start and end must refer to | 639 | starting in range [start;end[. NOTE: start and end must refer to |
640 | the same physical page. 'is_cpu_write_access' should be true if called | 640 | the same physical page. 'is_cpu_write_access' should be true if called |
@@ -700,7 +700,7 @@ void tb_invalidate_phys_page_range(target_ulong start, target_ulong end, | @@ -700,7 +700,7 @@ void tb_invalidate_phys_page_range(target_ulong start, target_ulong end, | ||
700 | that the modification is after the current PC, but it | 700 | that the modification is after the current PC, but it |
701 | would require a specialized function to partially | 701 | would require a specialized function to partially |
702 | restore the CPU state */ | 702 | restore the CPU state */ |
703 | - | 703 | + |
704 | current_tb_modified = 1; | 704 | current_tb_modified = 1; |
705 | cpu_restore_state(current_tb, env, | 705 | cpu_restore_state(current_tb, env, |
706 | env->mem_write_pc, NULL); | 706 | env->mem_write_pc, NULL); |
@@ -819,7 +819,7 @@ static void tb_invalidate_phys_page(target_ulong addr, | @@ -819,7 +819,7 @@ static void tb_invalidate_phys_page(target_ulong addr, | ||
819 | that the modification is after the current PC, but it | 819 | that the modification is after the current PC, but it |
820 | would require a specialized function to partially | 820 | would require a specialized function to partially |
821 | restore the CPU state */ | 821 | restore the CPU state */ |
822 | - | 822 | + |
823 | current_tb_modified = 1; | 823 | current_tb_modified = 1; |
824 | cpu_restore_state(current_tb, env, pc, puc); | 824 | cpu_restore_state(current_tb, env, pc, puc); |
825 | #if defined(TARGET_I386) | 825 | #if defined(TARGET_I386) |
@@ -1024,7 +1024,7 @@ static inline void tb_reset_jump_recursive2(TranslationBlock *tb, int n) | @@ -1024,7 +1024,7 @@ static inline void tb_reset_jump_recursive2(TranslationBlock *tb, int n) | ||
1024 | } | 1024 | } |
1025 | *ptb = tb->jmp_next[n]; | 1025 | *ptb = tb->jmp_next[n]; |
1026 | tb->jmp_next[n] = NULL; | 1026 | tb->jmp_next[n] = NULL; |
1027 | - | 1027 | + |
1028 | /* suppress the jump to next tb in generated code */ | 1028 | /* suppress the jump to next tb in generated code */ |
1029 | tb_reset_jump(tb, n); | 1029 | tb_reset_jump(tb, n); |
1030 | 1030 | ||
@@ -1103,7 +1103,7 @@ int cpu_breakpoint_insert(CPUState *env, target_ulong pc) | @@ -1103,7 +1103,7 @@ int cpu_breakpoint_insert(CPUState *env, target_ulong pc) | ||
1103 | { | 1103 | { |
1104 | #if defined(TARGET_HAS_ICE) | 1104 | #if defined(TARGET_HAS_ICE) |
1105 | int i; | 1105 | int i; |
1106 | - | 1106 | + |
1107 | for(i = 0; i < env->nb_breakpoints; i++) { | 1107 | for(i = 0; i < env->nb_breakpoints; i++) { |
1108 | if (env->breakpoints[i] == pc) | 1108 | if (env->breakpoints[i] == pc) |
1109 | return 0; | 1109 | return 0; |
@@ -1112,7 +1112,7 @@ int cpu_breakpoint_insert(CPUState *env, target_ulong pc) | @@ -1112,7 +1112,7 @@ int cpu_breakpoint_insert(CPUState *env, target_ulong pc) | ||
1112 | if (env->nb_breakpoints >= MAX_BREAKPOINTS) | 1112 | if (env->nb_breakpoints >= MAX_BREAKPOINTS) |
1113 | return -1; | 1113 | return -1; |
1114 | env->breakpoints[env->nb_breakpoints++] = pc; | 1114 | env->breakpoints[env->nb_breakpoints++] = pc; |
1115 | - | 1115 | + |
1116 | breakpoint_invalidate(env, pc); | 1116 | breakpoint_invalidate(env, pc); |
1117 | return 0; | 1117 | return 0; |
1118 | #else | 1118 | #else |
@@ -1249,7 +1249,7 @@ static int cmp1(const char *s1, int n, const char *s2) | @@ -1249,7 +1249,7 @@ static int cmp1(const char *s1, int n, const char *s2) | ||
1249 | return 0; | 1249 | return 0; |
1250 | return memcmp(s1, s2, n) == 0; | 1250 | return memcmp(s1, s2, n) == 0; |
1251 | } | 1251 | } |
1252 | - | 1252 | + |
1253 | /* takes a comma separated list of log masks. Return 0 if error. */ | 1253 | /* takes a comma separated list of log masks. Return 0 if error. */ |
1254 | int cpu_str_to_log_mask(const char *str) | 1254 | int cpu_str_to_log_mask(const char *str) |
1255 | { | 1255 | { |
@@ -1703,7 +1703,7 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr, | @@ -1703,7 +1703,7 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr, | ||
1703 | /* if code is present, we only map as read only and save the | 1703 | /* if code is present, we only map as read only and save the |
1704 | original mapping */ | 1704 | original mapping */ |
1705 | VirtPageDesc *vp; | 1705 | VirtPageDesc *vp; |
1706 | - | 1706 | + |
1707 | vp = virt_page_find_alloc(vaddr >> TARGET_PAGE_BITS, 1); | 1707 | vp = virt_page_find_alloc(vaddr >> TARGET_PAGE_BITS, 1); |
1708 | vp->phys_addr = pd; | 1708 | vp->phys_addr = pd; |
1709 | vp->prot = prot; | 1709 | vp->prot = prot; |
@@ -2008,7 +2008,7 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr, | @@ -2008,7 +2008,7 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr, | ||
2008 | } | 2008 | } |
2009 | } | 2009 | } |
2010 | } | 2010 | } |
2011 | - | 2011 | + |
2012 | /* since each CPU stores ram addresses in its TLB cache, we must | 2012 | /* since each CPU stores ram addresses in its TLB cache, we must |
2013 | reset the modified entries */ | 2013 | reset the modified entries */ |
2014 | /* XXX: slow ! */ | 2014 | /* XXX: slow ! */ |
@@ -2492,7 +2492,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, | @@ -2492,7 +2492,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, | ||
2492 | target_phys_addr_t page; | 2492 | target_phys_addr_t page; |
2493 | unsigned long pd; | 2493 | unsigned long pd; |
2494 | PhysPageDesc *p; | 2494 | PhysPageDesc *p; |
2495 | - | 2495 | + |
2496 | while (len > 0) { | 2496 | while (len > 0) { |
2497 | page = addr & TARGET_PAGE_MASK; | 2497 | page = addr & TARGET_PAGE_MASK; |
2498 | l = (page + TARGET_PAGE_SIZE) - addr; | 2498 | l = (page + TARGET_PAGE_SIZE) - addr; |
@@ -2504,7 +2504,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, | @@ -2504,7 +2504,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, | ||
2504 | } else { | 2504 | } else { |
2505 | pd = p->phys_offset; | 2505 | pd = p->phys_offset; |
2506 | } | 2506 | } |
2507 | - | 2507 | + |
2508 | if (is_write) { | 2508 | if (is_write) { |
2509 | if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { | 2509 | if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { |
2510 | io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); | 2510 | io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); |
@@ -2583,7 +2583,7 @@ void cpu_physical_memory_write_rom(target_phys_addr_t addr, | @@ -2583,7 +2583,7 @@ void cpu_physical_memory_write_rom(target_phys_addr_t addr, | ||
2583 | target_phys_addr_t page; | 2583 | target_phys_addr_t page; |
2584 | unsigned long pd; | 2584 | unsigned long pd; |
2585 | PhysPageDesc *p; | 2585 | PhysPageDesc *p; |
2586 | - | 2586 | + |
2587 | while (len > 0) { | 2587 | while (len > 0) { |
2588 | page = addr & TARGET_PAGE_MASK; | 2588 | page = addr & TARGET_PAGE_MASK; |
2589 | l = (page + TARGET_PAGE_SIZE) - addr; | 2589 | l = (page + TARGET_PAGE_SIZE) - addr; |
@@ -2595,7 +2595,7 @@ void cpu_physical_memory_write_rom(target_phys_addr_t addr, | @@ -2595,7 +2595,7 @@ void cpu_physical_memory_write_rom(target_phys_addr_t addr, | ||
2595 | } else { | 2595 | } else { |
2596 | pd = p->phys_offset; | 2596 | pd = p->phys_offset; |
2597 | } | 2597 | } |
2598 | - | 2598 | + |
2599 | if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM && | 2599 | if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM && |
2600 | (pd & ~TARGET_PAGE_MASK) != IO_MEM_ROM && | 2600 | (pd & ~TARGET_PAGE_MASK) != IO_MEM_ROM && |
2601 | !(pd & IO_MEM_ROMD)) { | 2601 | !(pd & IO_MEM_ROMD)) { |
@@ -2629,7 +2629,7 @@ uint32_t ldl_phys(target_phys_addr_t addr) | @@ -2629,7 +2629,7 @@ uint32_t ldl_phys(target_phys_addr_t addr) | ||
2629 | } else { | 2629 | } else { |
2630 | pd = p->phys_offset; | 2630 | pd = p->phys_offset; |
2631 | } | 2631 | } |
2632 | - | 2632 | + |
2633 | if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && | 2633 | if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && |
2634 | !(pd & IO_MEM_ROMD)) { | 2634 | !(pd & IO_MEM_ROMD)) { |
2635 | /* I/O case */ | 2635 | /* I/O case */ |
@@ -2659,7 +2659,7 @@ uint64_t ldq_phys(target_phys_addr_t addr) | @@ -2659,7 +2659,7 @@ uint64_t ldq_phys(target_phys_addr_t addr) | ||
2659 | } else { | 2659 | } else { |
2660 | pd = p->phys_offset; | 2660 | pd = p->phys_offset; |
2661 | } | 2661 | } |
2662 | - | 2662 | + |
2663 | if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && | 2663 | if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && |
2664 | !(pd & IO_MEM_ROMD)) { | 2664 | !(pd & IO_MEM_ROMD)) { |
2665 | /* I/O case */ | 2665 | /* I/O case */ |
@@ -2712,7 +2712,7 @@ void stl_phys_notdirty(target_phys_addr_t addr, uint32_t val) | @@ -2712,7 +2712,7 @@ void stl_phys_notdirty(target_phys_addr_t addr, uint32_t val) | ||
2712 | } else { | 2712 | } else { |
2713 | pd = p->phys_offset; | 2713 | pd = p->phys_offset; |
2714 | } | 2714 | } |
2715 | - | 2715 | + |
2716 | if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { | 2716 | if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { |
2717 | io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); | 2717 | io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); |
2718 | io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val); | 2718 | io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val); |
@@ -2736,7 +2736,7 @@ void stq_phys_notdirty(target_phys_addr_t addr, uint64_t val) | @@ -2736,7 +2736,7 @@ void stq_phys_notdirty(target_phys_addr_t addr, uint64_t val) | ||
2736 | } else { | 2736 | } else { |
2737 | pd = p->phys_offset; | 2737 | pd = p->phys_offset; |
2738 | } | 2738 | } |
2739 | - | 2739 | + |
2740 | if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { | 2740 | if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { |
2741 | io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); | 2741 | io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); |
2742 | #ifdef TARGET_WORDS_BIGENDIAN | 2742 | #ifdef TARGET_WORDS_BIGENDIAN |
@@ -2767,7 +2767,7 @@ void stl_phys(target_phys_addr_t addr, uint32_t val) | @@ -2767,7 +2767,7 @@ void stl_phys(target_phys_addr_t addr, uint32_t val) | ||
2767 | } else { | 2767 | } else { |
2768 | pd = p->phys_offset; | 2768 | pd = p->phys_offset; |
2769 | } | 2769 | } |
2770 | - | 2770 | + |
2771 | if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { | 2771 | if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { |
2772 | io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); | 2772 | io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); |
2773 | io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val); | 2773 | io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val); |
@@ -2842,7 +2842,7 @@ void dump_exec_info(FILE *f, | @@ -2842,7 +2842,7 @@ void dump_exec_info(FILE *f, | ||
2842 | int i, target_code_size, max_target_code_size; | 2842 | int i, target_code_size, max_target_code_size; |
2843 | int direct_jmp_count, direct_jmp2_count, cross_page; | 2843 | int direct_jmp_count, direct_jmp2_count, cross_page; |
2844 | TranslationBlock *tb; | 2844 | TranslationBlock *tb; |
2845 | - | 2845 | + |
2846 | target_code_size = 0; | 2846 | target_code_size = 0; |
2847 | max_target_code_size = 0; | 2847 | max_target_code_size = 0; |
2848 | cross_page = 0; | 2848 | cross_page = 0; |
gdbstub.c
@@ -252,7 +252,7 @@ static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf) | @@ -252,7 +252,7 @@ static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf) | ||
252 | registers[41] = 0; /* foseg */ | 252 | registers[41] = 0; /* foseg */ |
253 | registers[42] = 0; /* fooff */ | 253 | registers[42] = 0; /* fooff */ |
254 | registers[43] = 0; /* fop */ | 254 | registers[43] = 0; /* fop */ |
255 | - | 255 | + |
256 | for(i = 0; i < 16; i++) | 256 | for(i = 0; i < 16; i++) |
257 | tswapls(®isters[i]); | 257 | tswapls(®isters[i]); |
258 | for(i = 36; i < 44; i++) | 258 | for(i = 36; i < 44; i++) |
@@ -748,7 +748,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) | @@ -748,7 +748,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) | ||
748 | uint8_t mem_buf[2000]; | 748 | uint8_t mem_buf[2000]; |
749 | uint32_t *registers; | 749 | uint32_t *registers; |
750 | target_ulong addr, len; | 750 | target_ulong addr, len; |
751 | - | 751 | + |
752 | #ifdef DEBUG_GDB | 752 | #ifdef DEBUG_GDB |
753 | printf("command='%s'\n", line_buf); | 753 | printf("command='%s'\n", line_buf); |
754 | #endif | 754 | #endif |
@@ -1201,7 +1201,7 @@ static void gdb_accept(void *opaque) | @@ -1201,7 +1201,7 @@ static void gdb_accept(void *opaque) | ||
1201 | /* set short latency */ | 1201 | /* set short latency */ |
1202 | val = 1; | 1202 | val = 1; |
1203 | setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); | 1203 | setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); |
1204 | - | 1204 | + |
1205 | s = &gdbserver_state; | 1205 | s = &gdbserver_state; |
1206 | memset (s, 0, sizeof (GDBState)); | 1206 | memset (s, 0, sizeof (GDBState)); |
1207 | s->env = first_cpu; /* XXX: allow to change CPU */ | 1207 | s->env = first_cpu; /* XXX: allow to change CPU */ |
hw/acpi.c
@@ -87,7 +87,7 @@ static void pm_update_sci(PIIX4PMState *s) | @@ -87,7 +87,7 @@ static void pm_update_sci(PIIX4PMState *s) | ||
87 | { | 87 | { |
88 | int sci_level, pmsts; | 88 | int sci_level, pmsts; |
89 | int64_t expire_time; | 89 | int64_t expire_time; |
90 | - | 90 | + |
91 | pmsts = get_pmsts(s); | 91 | pmsts = get_pmsts(s); |
92 | sci_level = (((pmsts & s->pmen) & | 92 | sci_level = (((pmsts & s->pmen) & |
93 | (RTC_EN | PWRBTN_EN | GBL_EN | TMROF_EN)) != 0); | 93 | (RTC_EN | PWRBTN_EN | GBL_EN | TMROF_EN)) != 0); |
@@ -239,7 +239,7 @@ static uint32_t pm_smi_readb(void *opaque, uint32_t addr) | @@ -239,7 +239,7 @@ static uint32_t pm_smi_readb(void *opaque, uint32_t addr) | ||
239 | { | 239 | { |
240 | PIIX4PMState *s = opaque; | 240 | PIIX4PMState *s = opaque; |
241 | uint32_t val; | 241 | uint32_t val; |
242 | - | 242 | + |
243 | addr &= 1; | 243 | addr &= 1; |
244 | if (addr == 0) { | 244 | if (addr == 0) { |
245 | val = s->apmc; | 245 | val = s->apmc; |
@@ -480,9 +480,9 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base) | @@ -480,9 +480,9 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base) | ||
480 | pci_conf[0x0b] = 0x06; // bridge device | 480 | pci_conf[0x0b] = 0x06; // bridge device |
481 | pci_conf[0x0e] = 0x00; // header_type | 481 | pci_conf[0x0e] = 0x00; // header_type |
482 | pci_conf[0x3d] = 0x01; // interrupt pin 1 | 482 | pci_conf[0x3d] = 0x01; // interrupt pin 1 |
483 | - | 483 | + |
484 | pci_conf[0x40] = 0x01; /* PM io base read only bit */ | 484 | pci_conf[0x40] = 0x01; /* PM io base read only bit */ |
485 | - | 485 | + |
486 | register_ioport_write(0xb2, 2, 1, pm_smi_writeb, s); | 486 | register_ioport_write(0xb2, 2, 1, pm_smi_writeb, s); |
487 | register_ioport_read(0xb2, 2, 1, pm_smi_readb, s); | 487 | register_ioport_read(0xb2, 2, 1, pm_smi_readb, s); |
488 | 488 |
hw/adb.c
@@ -299,31 +299,31 @@ static int adb_mouse_poll(ADBDevice *d, uint8_t *obuf) | @@ -299,31 +299,31 @@ static int adb_mouse_poll(ADBDevice *d, uint8_t *obuf) | ||
299 | if (s->last_buttons_state == s->buttons_state && | 299 | if (s->last_buttons_state == s->buttons_state && |
300 | s->dx == 0 && s->dy == 0) | 300 | s->dx == 0 && s->dy == 0) |
301 | return 0; | 301 | return 0; |
302 | - | 302 | + |
303 | dx = s->dx; | 303 | dx = s->dx; |
304 | if (dx < -63) | 304 | if (dx < -63) |
305 | dx = -63; | 305 | dx = -63; |
306 | else if (dx > 63) | 306 | else if (dx > 63) |
307 | dx = 63; | 307 | dx = 63; |
308 | - | 308 | + |
309 | dy = s->dy; | 309 | dy = s->dy; |
310 | if (dy < -63) | 310 | if (dy < -63) |
311 | dy = -63; | 311 | dy = -63; |
312 | else if (dy > 63) | 312 | else if (dy > 63) |
313 | dy = 63; | 313 | dy = 63; |
314 | - | 314 | + |
315 | s->dx -= dx; | 315 | s->dx -= dx; |
316 | s->dy -= dy; | 316 | s->dy -= dy; |
317 | s->last_buttons_state = s->buttons_state; | 317 | s->last_buttons_state = s->buttons_state; |
318 | - | 318 | + |
319 | dx &= 0x7f; | 319 | dx &= 0x7f; |
320 | dy &= 0x7f; | 320 | dy &= 0x7f; |
321 | - | 321 | + |
322 | if (!(s->buttons_state & MOUSE_EVENT_LBUTTON)) | 322 | if (!(s->buttons_state & MOUSE_EVENT_LBUTTON)) |
323 | dy |= 0x80; | 323 | dy |= 0x80; |
324 | if (!(s->buttons_state & MOUSE_EVENT_RBUTTON)) | 324 | if (!(s->buttons_state & MOUSE_EVENT_RBUTTON)) |
325 | dx |= 0x80; | 325 | dx |= 0x80; |
326 | - | 326 | + |
327 | obuf[0] = dy; | 327 | obuf[0] = dy; |
328 | obuf[1] = dx; | 328 | obuf[1] = dx; |
329 | return 2; | 329 | return 2; |
@@ -334,7 +334,7 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *obuf, | @@ -334,7 +334,7 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *obuf, | ||
334 | { | 334 | { |
335 | MouseState *s = d->opaque; | 335 | MouseState *s = d->opaque; |
336 | int cmd, reg, olen; | 336 | int cmd, reg, olen; |
337 | - | 337 | + |
338 | if ((buf[0] & 0x0f) == ADB_FLUSH) { | 338 | if ((buf[0] & 0x0f) == ADB_FLUSH) { |
339 | /* flush mouse fifo */ | 339 | /* flush mouse fifo */ |
340 | s->buttons_state = s->last_buttons_state; | 340 | s->buttons_state = s->last_buttons_state; |
hw/alpha_palcode.c
@@ -937,7 +937,7 @@ static int paddr_from_pte (uint64_t *paddr, int *zbitsp, int *prot, | @@ -937,7 +937,7 @@ static int paddr_from_pte (uint64_t *paddr, int *zbitsp, int *prot, | ||
937 | } | 937 | } |
938 | } | 938 | } |
939 | *paddr = (pfn << page_bits) | (vaddr & page_mask); | 939 | *paddr = (pfn << page_bits) | (vaddr & page_mask); |
940 | - | 940 | + |
941 | return 0; | 941 | return 0; |
942 | } | 942 | } |
943 | 943 |
hw/apic.c
@@ -222,7 +222,7 @@ static void apic_bus_deliver(const uint32_t *deliver_bitmask, | @@ -222,7 +222,7 @@ static void apic_bus_deliver(const uint32_t *deliver_bitmask, | ||
222 | foreach_apic(apic_iter, deliver_bitmask, | 222 | foreach_apic(apic_iter, deliver_bitmask, |
223 | apic_init_ipi(apic_iter) ); | 223 | apic_init_ipi(apic_iter) ); |
224 | return; | 224 | return; |
225 | - | 225 | + |
226 | case APIC_DM_EXTINT: | 226 | case APIC_DM_EXTINT: |
227 | /* handled in I/O APIC code */ | 227 | /* handled in I/O APIC code */ |
228 | break; | 228 | break; |
@@ -471,7 +471,7 @@ int apic_get_interrupt(CPUState *env) | @@ -471,7 +471,7 @@ int apic_get_interrupt(CPUState *env) | ||
471 | return -1; | 471 | return -1; |
472 | if (!(s->spurious_vec & APIC_SV_ENABLE)) | 472 | if (!(s->spurious_vec & APIC_SV_ENABLE)) |
473 | return -1; | 473 | return -1; |
474 | - | 474 | + |
475 | /* XXX: spurious IRQ handling */ | 475 | /* XXX: spurious IRQ handling */ |
476 | intno = get_highest_priority_int(s->irr); | 476 | intno = get_highest_priority_int(s->irr); |
477 | if (intno < 0) | 477 | if (intno < 0) |
@@ -505,7 +505,7 @@ static uint32_t apic_get_current_count(APICState *s) | @@ -505,7 +505,7 @@ static uint32_t apic_get_current_count(APICState *s) | ||
505 | static void apic_timer_update(APICState *s, int64_t current_time) | 505 | static void apic_timer_update(APICState *s, int64_t current_time) |
506 | { | 506 | { |
507 | int64_t next_time, d; | 507 | int64_t next_time, d; |
508 | - | 508 | + |
509 | if (!(s->lvt[APIC_LVT_TIMER] & APIC_LVT_MASKED)) { | 509 | if (!(s->lvt[APIC_LVT_TIMER] & APIC_LVT_MASKED)) { |
510 | d = (current_time - s->initial_count_load_time) >> | 510 | d = (current_time - s->initial_count_load_time) >> |
511 | s->count_shift; | 511 | s->count_shift; |
@@ -834,7 +834,7 @@ int apic_init(CPUState *env) | @@ -834,7 +834,7 @@ int apic_init(CPUState *env) | ||
834 | 834 | ||
835 | register_savevm("apic", s->id, 2, apic_save, apic_load, s); | 835 | register_savevm("apic", s->id, 2, apic_save, apic_load, s); |
836 | qemu_register_reset(apic_reset, s); | 836 | qemu_register_reset(apic_reset, s); |
837 | - | 837 | + |
838 | local_apics[s->id] = s; | 838 | local_apics[s->id] = s; |
839 | return 0; | 839 | return 0; |
840 | } | 840 | } |
@@ -868,7 +868,7 @@ static void ioapic_service(IOAPICState *s) | @@ -868,7 +868,7 @@ static void ioapic_service(IOAPICState *s) | ||
868 | vector = pic_read_irq(isa_pic); | 868 | vector = pic_read_irq(isa_pic); |
869 | else | 869 | else |
870 | vector = entry & 0xff; | 870 | vector = entry & 0xff; |
871 | - | 871 | + |
872 | apic_get_delivery_bitmask(deliver_bitmask, dest, dest_mode); | 872 | apic_get_delivery_bitmask(deliver_bitmask, dest, dest_mode); |
873 | apic_bus_deliver(deliver_bitmask, delivery_mode, | 873 | apic_bus_deliver(deliver_bitmask, delivery_mode, |
874 | vector, polarity, trig_mode); | 874 | vector, polarity, trig_mode); |
@@ -1042,6 +1042,6 @@ IOAPICState *ioapic_init(void) | @@ -1042,6 +1042,6 @@ IOAPICState *ioapic_init(void) | ||
1042 | 1042 | ||
1043 | register_savevm("ioapic", 0, 1, ioapic_save, ioapic_load, s); | 1043 | register_savevm("ioapic", 0, 1, ioapic_save, ioapic_load, s); |
1044 | qemu_register_reset(ioapic_reset, s); | 1044 | qemu_register_reset(ioapic_reset, s); |
1045 | - | 1045 | + |
1046 | return s; | 1046 | return s; |
1047 | } | 1047 | } |
hw/cdrom.c
@@ -41,7 +41,7 @@ int cdrom_read_toc(int nb_sectors, uint8_t *buf, int msf, int start_track) | @@ -41,7 +41,7 @@ int cdrom_read_toc(int nb_sectors, uint8_t *buf, int msf, int start_track) | ||
41 | { | 41 | { |
42 | uint8_t *q; | 42 | uint8_t *q; |
43 | int len; | 43 | int len; |
44 | - | 44 | + |
45 | if (start_track > 1 && start_track != 0xaa) | 45 | if (start_track > 1 && start_track != 0xaa) |
46 | return -1; | 46 | return -1; |
47 | q = buf + 2; | 47 | q = buf + 2; |
@@ -85,7 +85,7 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num) | @@ -85,7 +85,7 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num) | ||
85 | { | 85 | { |
86 | uint8_t *q; | 86 | uint8_t *q; |
87 | int len; | 87 | int len; |
88 | - | 88 | + |
89 | q = buf + 2; | 89 | q = buf + 2; |
90 | *q++ = 1; /* first session */ | 90 | *q++ = 1; /* first session */ |
91 | *q++ = 1; /* last session */ | 91 | *q++ = 1; /* last session */ |
@@ -101,7 +101,7 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num) | @@ -101,7 +101,7 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num) | ||
101 | *q++ = 1; /* first track */ | 101 | *q++ = 1; /* first track */ |
102 | *q++ = 0x00; /* disk type */ | 102 | *q++ = 0x00; /* disk type */ |
103 | *q++ = 0x00; | 103 | *q++ = 0x00; |
104 | - | 104 | + |
105 | *q++ = 1; /* session number */ | 105 | *q++ = 1; /* session number */ |
106 | *q++ = 0x14; /* data track */ | 106 | *q++ = 0x14; /* data track */ |
107 | *q++ = 0; /* track number */ | 107 | *q++ = 0; /* track number */ |
@@ -113,7 +113,7 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num) | @@ -113,7 +113,7 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num) | ||
113 | *q++ = 1; /* last track */ | 113 | *q++ = 1; /* last track */ |
114 | *q++ = 0x00; | 114 | *q++ = 0x00; |
115 | *q++ = 0x00; | 115 | *q++ = 0x00; |
116 | - | 116 | + |
117 | *q++ = 1; /* session number */ | 117 | *q++ = 1; /* session number */ |
118 | *q++ = 0x14; /* data track */ | 118 | *q++ = 0x14; /* data track */ |
119 | *q++ = 0; /* track number */ | 119 | *q++ = 0; /* track number */ |
hw/cirrus_vga.c
@@ -275,7 +275,7 @@ typedef struct PCICirrusVGAState { | @@ -275,7 +275,7 @@ typedef struct PCICirrusVGAState { | ||
275 | } PCICirrusVGAState; | 275 | } PCICirrusVGAState; |
276 | 276 | ||
277 | static uint8_t rop_to_index[256]; | 277 | static uint8_t rop_to_index[256]; |
278 | - | 278 | + |
279 | /*************************************** | 279 | /*************************************** |
280 | * | 280 | * |
281 | * prototypes. | 281 | * prototypes. |
@@ -788,7 +788,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s) | @@ -788,7 +788,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s) | ||
788 | { | 788 | { |
789 | int copy_count; | 789 | int copy_count; |
790 | uint8_t *end_ptr; | 790 | uint8_t *end_ptr; |
791 | - | 791 | + |
792 | if (s->cirrus_srccounter > 0) { | 792 | if (s->cirrus_srccounter > 0) { |
793 | if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) { | 793 | if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) { |
794 | cirrus_bitblt_common_patterncopy(s, s->cirrus_bltbuf); | 794 | cirrus_bitblt_common_patterncopy(s, s->cirrus_bltbuf); |
@@ -1148,7 +1148,7 @@ static int cirrus_get_bpp(VGAState *s1) | @@ -1148,7 +1148,7 @@ static int cirrus_get_bpp(VGAState *s1) | ||
1148 | static void cirrus_get_resolution(VGAState *s, int *pwidth, int *pheight) | 1148 | static void cirrus_get_resolution(VGAState *s, int *pwidth, int *pheight) |
1149 | { | 1149 | { |
1150 | int width, height; | 1150 | int width, height; |
1151 | - | 1151 | + |
1152 | width = (s->cr[0x01] + 1) * 8; | 1152 | width = (s->cr[0x01] + 1) * 8; |
1153 | height = s->cr[0x12] | | 1153 | height = s->cr[0x12] | |
1154 | ((s->cr[0x07] & 0x02) << 7) | | 1154 | ((s->cr[0x07] & 0x02) << 7) | |
@@ -2223,7 +2223,7 @@ static void cirrus_cursor_invalidate(VGAState *s1) | @@ -2223,7 +2223,7 @@ static void cirrus_cursor_invalidate(VGAState *s1) | ||
2223 | s->last_hw_cursor_y != s->hw_cursor_y) { | 2223 | s->last_hw_cursor_y != s->hw_cursor_y) { |
2224 | 2224 | ||
2225 | invalidate_cursor1(s); | 2225 | invalidate_cursor1(s); |
2226 | - | 2226 | + |
2227 | s->last_hw_cursor_size = size; | 2227 | s->last_hw_cursor_size = size; |
2228 | s->last_hw_cursor_x = s->hw_cursor_x; | 2228 | s->last_hw_cursor_x = s->hw_cursor_x; |
2229 | s->last_hw_cursor_y = s->hw_cursor_y; | 2229 | s->last_hw_cursor_y = s->hw_cursor_y; |
@@ -2240,7 +2240,7 @@ static void cirrus_cursor_draw_line(VGAState *s1, uint8_t *d1, int scr_y) | @@ -2240,7 +2240,7 @@ static void cirrus_cursor_draw_line(VGAState *s1, uint8_t *d1, int scr_y) | ||
2240 | unsigned int color0, color1; | 2240 | unsigned int color0, color1; |
2241 | const uint8_t *palette, *src; | 2241 | const uint8_t *palette, *src; |
2242 | uint32_t content; | 2242 | uint32_t content; |
2243 | - | 2243 | + |
2244 | if (!(s->sr[0x12] & CIRRUS_CURSOR_SHOW)) | 2244 | if (!(s->sr[0x12] & CIRRUS_CURSOR_SHOW)) |
2245 | return; | 2245 | return; |
2246 | /* fast test to see if the cursor intersects with the scan line */ | 2246 | /* fast test to see if the cursor intersects with the scan line */ |
@@ -2252,7 +2252,7 @@ static void cirrus_cursor_draw_line(VGAState *s1, uint8_t *d1, int scr_y) | @@ -2252,7 +2252,7 @@ static void cirrus_cursor_draw_line(VGAState *s1, uint8_t *d1, int scr_y) | ||
2252 | if (scr_y < s->hw_cursor_y || | 2252 | if (scr_y < s->hw_cursor_y || |
2253 | scr_y >= (s->hw_cursor_y + h)) | 2253 | scr_y >= (s->hw_cursor_y + h)) |
2254 | return; | 2254 | return; |
2255 | - | 2255 | + |
2256 | src = s->vram_ptr + s->real_vram_size - 16 * 1024; | 2256 | src = s->vram_ptr + s->real_vram_size - 16 * 1024; |
2257 | if (s->sr[0x12] & CIRRUS_CURSOR_LARGE) { | 2257 | if (s->sr[0x12] & CIRRUS_CURSOR_LARGE) { |
2258 | src += (s->sr[0x13] & 0x3c) * 256; | 2258 | src += (s->sr[0x13] & 0x3c) * 256; |
@@ -2379,7 +2379,7 @@ static void cirrus_linear_writeb(void *opaque, target_phys_addr_t addr, | @@ -2379,7 +2379,7 @@ static void cirrus_linear_writeb(void *opaque, target_phys_addr_t addr, | ||
2379 | unsigned mode; | 2379 | unsigned mode; |
2380 | 2380 | ||
2381 | addr &= s->cirrus_addr_mask; | 2381 | addr &= s->cirrus_addr_mask; |
2382 | - | 2382 | + |
2383 | if (((s->sr[0x17] & 0x44) == 0x44) && | 2383 | if (((s->sr[0x17] & 0x44) == 0x44) && |
2384 | ((addr & s->linear_mmio_mask) == s->linear_mmio_mask)) { | 2384 | ((addr & s->linear_mmio_mask) == s->linear_mmio_mask)) { |
2385 | /* memory-mapped I/O */ | 2385 | /* memory-mapped I/O */ |
@@ -2600,7 +2600,7 @@ static void cirrus_update_memory_access(CirrusVGAState *s) | @@ -2600,7 +2600,7 @@ static void cirrus_update_memory_access(CirrusVGAState *s) | ||
2600 | } else if (s->gr[0x0B] & 0x02) { | 2600 | } else if (s->gr[0x0B] & 0x02) { |
2601 | goto generic_io; | 2601 | goto generic_io; |
2602 | } | 2602 | } |
2603 | - | 2603 | + |
2604 | mode = s->gr[0x05] & 0x7; | 2604 | mode = s->gr[0x05] & 0x7; |
2605 | if (mode < 4 || mode > 5 || ((s->gr[0x0B] & 0x4) == 0)) { | 2605 | if (mode < 4 || mode > 5 || ((s->gr[0x0B] & 0x4) == 0)) { |
2606 | s->cirrus_linear_write[0] = cirrus_linear_mem_writeb; | 2606 | s->cirrus_linear_write[0] = cirrus_linear_mem_writeb; |
@@ -3190,7 +3190,7 @@ void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base, | @@ -3190,7 +3190,7 @@ void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base, | ||
3190 | CirrusVGAState *s; | 3190 | CirrusVGAState *s; |
3191 | 3191 | ||
3192 | s = qemu_mallocz(sizeof(CirrusVGAState)); | 3192 | s = qemu_mallocz(sizeof(CirrusVGAState)); |
3193 | - | 3193 | + |
3194 | vga_common_init((VGAState *)s, | 3194 | vga_common_init((VGAState *)s, |
3195 | ds, vga_ram_base, vga_ram_offset, vga_ram_size); | 3195 | ds, vga_ram_base, vga_ram_offset, vga_ram_size); |
3196 | cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0); | 3196 | cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0); |
@@ -3231,7 +3231,7 @@ void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, | @@ -3231,7 +3231,7 @@ void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, | ||
3231 | uint8_t *pci_conf; | 3231 | uint8_t *pci_conf; |
3232 | CirrusVGAState *s; | 3232 | CirrusVGAState *s; |
3233 | int device_id; | 3233 | int device_id; |
3234 | - | 3234 | + |
3235 | device_id = CIRRUS_ID_CLGD5446; | 3235 | device_id = CIRRUS_ID_CLGD5446; |
3236 | 3236 | ||
3237 | /* setup PCI configuration registers */ | 3237 | /* setup PCI configuration registers */ |
hw/cirrus_vga_rop2.h
@@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
34 | #define PUTPIXEL() ROP_OP(((uint32_t *)d)[0], col) | 34 | #define PUTPIXEL() ROP_OP(((uint32_t *)d)[0], col) |
35 | #else | 35 | #else |
36 | #error unsupported DEPTH | 36 | #error unsupported DEPTH |
37 | -#endif | 37 | +#endif |
38 | 38 | ||
39 | static void | 39 | static void |
40 | glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH) | 40 | glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH) |
hw/cuda.c
@@ -116,10 +116,10 @@ typedef struct CUDAState { | @@ -116,10 +116,10 @@ typedef struct CUDAState { | ||
116 | uint8_t anh; /* A-side data, no handshake */ | 116 | uint8_t anh; /* A-side data, no handshake */ |
117 | 117 | ||
118 | CUDATimer timers[2]; | 118 | CUDATimer timers[2]; |
119 | - | 119 | + |
120 | uint8_t last_b; /* last value of B register */ | 120 | uint8_t last_b; /* last value of B register */ |
121 | uint8_t last_acr; /* last value of B register */ | 121 | uint8_t last_acr; /* last value of B register */ |
122 | - | 122 | + |
123 | int data_in_size; | 123 | int data_in_size; |
124 | int data_in_index; | 124 | int data_in_index; |
125 | int data_out_index; | 125 | int data_out_index; |
@@ -196,7 +196,7 @@ static int64_t get_next_irq_time(CUDATimer *s, int64_t current_time) | @@ -196,7 +196,7 @@ static int64_t get_next_irq_time(CUDATimer *s, int64_t current_time) | ||
196 | counter = (d - (s->counter_value + 1)) % (s->latch + 2); | 196 | counter = (d - (s->counter_value + 1)) % (s->latch + 2); |
197 | counter = (s->latch - counter) & 0xffff; | 197 | counter = (s->latch - counter) & 0xffff; |
198 | } | 198 | } |
199 | - | 199 | + |
200 | /* Note: we consider the irq is raised on 0 */ | 200 | /* Note: we consider the irq is raised on 0 */ |
201 | if (counter == 0xffff) { | 201 | if (counter == 0xffff) { |
202 | next_time = d + s->latch + 1; | 202 | next_time = d + s->latch + 1; |
@@ -317,7 +317,7 @@ static uint32_t cuda_readb(void *opaque, target_phys_addr_t addr) | @@ -317,7 +317,7 @@ static uint32_t cuda_readb(void *opaque, target_phys_addr_t addr) | ||
317 | static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) | 317 | static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) |
318 | { | 318 | { |
319 | CUDAState *s = opaque; | 319 | CUDAState *s = opaque; |
320 | - | 320 | + |
321 | addr = (addr >> 9) & 0xf; | 321 | addr = (addr >> 9) & 0xf; |
322 | #ifdef DEBUG_CUDA | 322 | #ifdef DEBUG_CUDA |
323 | printf("cuda: write: reg=0x%x val=%02x\n", addr, val); | 323 | printf("cuda: write: reg=0x%x val=%02x\n", addr, val); |
hw/esp.c
@@ -531,7 +531,7 @@ static void esp_save(QEMUFile *f, void *opaque) | @@ -531,7 +531,7 @@ static void esp_save(QEMUFile *f, void *opaque) | ||
531 | static int esp_load(QEMUFile *f, void *opaque, int version_id) | 531 | static int esp_load(QEMUFile *f, void *opaque, int version_id) |
532 | { | 532 | { |
533 | ESPState *s = opaque; | 533 | ESPState *s = opaque; |
534 | - | 534 | + |
535 | if (version_id != 3) | 535 | if (version_id != 3) |
536 | return -EINVAL; // Cannot emulate 2 | 536 | return -EINVAL; // Cannot emulate 2 |
537 | 537 |
hw/grackle_pci.c
@@ -118,12 +118,12 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic) | @@ -118,12 +118,12 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic) | ||
118 | d->config[0x1a] = 0x00; // subordinate_bus | 118 | d->config[0x1a] = 0x00; // subordinate_bus |
119 | d->config[0x1c] = 0x00; | 119 | d->config[0x1c] = 0x00; |
120 | d->config[0x1d] = 0x00; | 120 | d->config[0x1d] = 0x00; |
121 | - | 121 | + |
122 | d->config[0x20] = 0x00; // memory_base | 122 | d->config[0x20] = 0x00; // memory_base |
123 | d->config[0x21] = 0x00; | 123 | d->config[0x21] = 0x00; |
124 | d->config[0x22] = 0x01; // memory_limit | 124 | d->config[0x22] = 0x01; // memory_limit |
125 | d->config[0x23] = 0x00; | 125 | d->config[0x23] = 0x00; |
126 | - | 126 | + |
127 | d->config[0x24] = 0x00; // prefetchable_memory_base | 127 | d->config[0x24] = 0x00; // prefetchable_memory_base |
128 | d->config[0x25] = 0x00; | 128 | d->config[0x25] = 0x00; |
129 | d->config[0x26] = 0x00; // prefetchable_memory_limit | 129 | d->config[0x26] = 0x00; // prefetchable_memory_limit |
@@ -145,12 +145,12 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic) | @@ -145,12 +145,12 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic) | ||
145 | d->config[0x1a] = 0x1; // subordinate_bus | 145 | d->config[0x1a] = 0x1; // subordinate_bus |
146 | d->config[0x1c] = 0x10; // io_base | 146 | d->config[0x1c] = 0x10; // io_base |
147 | d->config[0x1d] = 0x20; // io_limit | 147 | d->config[0x1d] = 0x20; // io_limit |
148 | - | 148 | + |
149 | d->config[0x20] = 0x80; // memory_base | 149 | d->config[0x20] = 0x80; // memory_base |
150 | d->config[0x21] = 0x80; | 150 | d->config[0x21] = 0x80; |
151 | d->config[0x22] = 0x90; // memory_limit | 151 | d->config[0x22] = 0x90; // memory_limit |
152 | d->config[0x23] = 0x80; | 152 | d->config[0x23] = 0x80; |
153 | - | 153 | + |
154 | d->config[0x24] = 0x00; // prefetchable_memory_base | 154 | d->config[0x24] = 0x00; // prefetchable_memory_base |
155 | d->config[0x25] = 0x84; | 155 | d->config[0x25] = 0x84; |
156 | d->config[0x26] = 0x00; // prefetchable_memory_limit | 156 | d->config[0x26] = 0x00; // prefetchable_memory_limit |
hw/gt64xxx.c
@@ -287,10 +287,10 @@ static void gt64120_pci_mapping(GT64120State *s) | @@ -287,10 +287,10 @@ static void gt64120_pci_mapping(GT64120State *s) | ||
287 | /* Update IO mapping */ | 287 | /* Update IO mapping */ |
288 | if ((s->regs[GT_PCI0IOLD] & 0x7f) <= s->regs[GT_PCI0IOHD]) | 288 | if ((s->regs[GT_PCI0IOLD] & 0x7f) <= s->regs[GT_PCI0IOHD]) |
289 | { | 289 | { |
290 | - /* Unmap old IO address */ | 290 | + /* Unmap old IO address */ |
291 | if (s->PCI0IO_length) | 291 | if (s->PCI0IO_length) |
292 | { | 292 | { |
293 | - cpu_register_physical_memory(s->PCI0IO_start, s->PCI0IO_length, IO_MEM_UNASSIGNED); | 293 | + cpu_register_physical_memory(s->PCI0IO_start, s->PCI0IO_length, IO_MEM_UNASSIGNED); |
294 | } | 294 | } |
295 | /* Map new IO address */ | 295 | /* Map new IO address */ |
296 | s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21; | 296 | s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21; |
hw/heathrow_pic.c
@@ -88,7 +88,7 @@ static uint32_t pic_readl (void *opaque, target_phys_addr_t addr) | @@ -88,7 +88,7 @@ static uint32_t pic_readl (void *opaque, target_phys_addr_t addr) | ||
88 | HeathrowPIC *pic; | 88 | HeathrowPIC *pic; |
89 | unsigned int n; | 89 | unsigned int n; |
90 | uint32_t value; | 90 | uint32_t value; |
91 | - | 91 | + |
92 | n = ((addr & 0xfff) - 0x10) >> 4; | 92 | n = ((addr & 0xfff) - 0x10) >> 4; |
93 | if (n >= 2) { | 93 | if (n >= 2) { |
94 | value = 0; | 94 | value = 0; |
@@ -159,7 +159,7 @@ static void heathrow_pic_set_irq(void *opaque, int num, int level) | @@ -159,7 +159,7 @@ static void heathrow_pic_set_irq(void *opaque, int num, int level) | ||
159 | qemu_irq *heathrow_pic_init(int *pmem_index) | 159 | qemu_irq *heathrow_pic_init(int *pmem_index) |
160 | { | 160 | { |
161 | HeathrowPICS *s; | 161 | HeathrowPICS *s; |
162 | - | 162 | + |
163 | s = qemu_mallocz(sizeof(HeathrowPICS)); | 163 | s = qemu_mallocz(sizeof(HeathrowPICS)); |
164 | s->pics[0].level_triggered = 0; | 164 | s->pics[0].level_triggered = 0; |
165 | s->pics[1].level_triggered = 0x1ff00000; | 165 | s->pics[1].level_triggered = 0x1ff00000; |
hw/i8254.c
@@ -309,7 +309,7 @@ static uint32_t pit_ioport_read(void *opaque, uint32_t addr) | @@ -309,7 +309,7 @@ static uint32_t pit_ioport_read(void *opaque, uint32_t addr) | ||
309 | PITState *pit = opaque; | 309 | PITState *pit = opaque; |
310 | int ret, count; | 310 | int ret, count; |
311 | PITChannelState *s; | 311 | PITChannelState *s; |
312 | - | 312 | + |
313 | addr &= 3; | 313 | addr &= 3; |
314 | s = &pit->channels[addr]; | 314 | s = &pit->channels[addr]; |
315 | if (s->status_latched) { | 315 | if (s->status_latched) { |
@@ -391,7 +391,7 @@ static void pit_save(QEMUFile *f, void *opaque) | @@ -391,7 +391,7 @@ static void pit_save(QEMUFile *f, void *opaque) | ||
391 | PITState *pit = opaque; | 391 | PITState *pit = opaque; |
392 | PITChannelState *s; | 392 | PITChannelState *s; |
393 | int i; | 393 | int i; |
394 | - | 394 | + |
395 | for(i = 0; i < 3; i++) { | 395 | for(i = 0; i < 3; i++) { |
396 | s = &pit->channels[i]; | 396 | s = &pit->channels[i]; |
397 | qemu_put_be32s(f, &s->count); | 397 | qemu_put_be32s(f, &s->count); |
@@ -419,7 +419,7 @@ static int pit_load(QEMUFile *f, void *opaque, int version_id) | @@ -419,7 +419,7 @@ static int pit_load(QEMUFile *f, void *opaque, int version_id) | ||
419 | PITState *pit = opaque; | 419 | PITState *pit = opaque; |
420 | PITChannelState *s; | 420 | PITChannelState *s; |
421 | int i; | 421 | int i; |
422 | - | 422 | + |
423 | if (version_id != 1) | 423 | if (version_id != 1) |
424 | return -EINVAL; | 424 | return -EINVAL; |
425 | 425 |
hw/i8259.c
@@ -155,7 +155,7 @@ void pic_update_irq(PicState2 *s) | @@ -155,7 +155,7 @@ void pic_update_irq(PicState2 *s) | ||
155 | printf("pic%d: imr=%x irr=%x padd=%d\n", | 155 | printf("pic%d: imr=%x irr=%x padd=%d\n", |
156 | i, s->pics[i].imr, s->pics[i].irr, | 156 | i, s->pics[i].imr, s->pics[i].irr, |
157 | s->pics[i].priority_add); | 157 | s->pics[i].priority_add); |
158 | - | 158 | + |
159 | } | 159 | } |
160 | } | 160 | } |
161 | printf("pic: cpu_interrupt\n"); | 161 | printf("pic: cpu_interrupt\n"); |
@@ -243,7 +243,7 @@ int pic_read_irq(PicState2 *s) | @@ -243,7 +243,7 @@ int pic_read_irq(PicState2 *s) | ||
243 | intno = s->pics[0].irq_base + irq; | 243 | intno = s->pics[0].irq_base + irq; |
244 | } | 244 | } |
245 | pic_update_irq(s); | 245 | pic_update_irq(s); |
246 | - | 246 | + |
247 | #ifdef DEBUG_IRQ_LATENCY | 247 | #ifdef DEBUG_IRQ_LATENCY |
248 | printf("IRQ%d latency=%0.3fus\n", | 248 | printf("IRQ%d latency=%0.3fus\n", |
249 | irq, | 249 | irq, |
@@ -429,7 +429,7 @@ uint32_t pic_intack_read(PicState2 *s) | @@ -429,7 +429,7 @@ uint32_t pic_intack_read(PicState2 *s) | ||
429 | ret = pic_poll_read(&s->pics[1], 0x80) + 8; | 429 | ret = pic_poll_read(&s->pics[1], 0x80) + 8; |
430 | /* Prepare for ISR read */ | 430 | /* Prepare for ISR read */ |
431 | s->pics[0].read_reg_select = 1; | 431 | s->pics[0].read_reg_select = 1; |
432 | - | 432 | + |
433 | return ret; | 433 | return ret; |
434 | } | 434 | } |
435 | 435 | ||
@@ -448,7 +448,7 @@ static uint32_t elcr_ioport_read(void *opaque, uint32_t addr1) | @@ -448,7 +448,7 @@ static uint32_t elcr_ioport_read(void *opaque, uint32_t addr1) | ||
448 | static void pic_save(QEMUFile *f, void *opaque) | 448 | static void pic_save(QEMUFile *f, void *opaque) |
449 | { | 449 | { |
450 | PicState *s = opaque; | 450 | PicState *s = opaque; |
451 | - | 451 | + |
452 | qemu_put_8s(f, &s->last_irr); | 452 | qemu_put_8s(f, &s->last_irr); |
453 | qemu_put_8s(f, &s->irr); | 453 | qemu_put_8s(f, &s->irr); |
454 | qemu_put_8s(f, &s->imr); | 454 | qemu_put_8s(f, &s->imr); |
@@ -470,7 +470,7 @@ static void pic_save(QEMUFile *f, void *opaque) | @@ -470,7 +470,7 @@ static void pic_save(QEMUFile *f, void *opaque) | ||
470 | static int pic_load(QEMUFile *f, void *opaque, int version_id) | 470 | static int pic_load(QEMUFile *f, void *opaque, int version_id) |
471 | { | 471 | { |
472 | PicState *s = opaque; | 472 | PicState *s = opaque; |
473 | - | 473 | + |
474 | if (version_id != 1) | 474 | if (version_id != 1) |
475 | return -EINVAL; | 475 | return -EINVAL; |
476 | 476 | ||
@@ -510,7 +510,7 @@ void pic_info(void) | @@ -510,7 +510,7 @@ void pic_info(void) | ||
510 | { | 510 | { |
511 | int i; | 511 | int i; |
512 | PicState *s; | 512 | PicState *s; |
513 | - | 513 | + |
514 | if (!isa_pic) | 514 | if (!isa_pic) |
515 | return; | 515 | return; |
516 | 516 |
hw/ide.c
@@ -392,7 +392,7 @@ typedef struct BMDMAState { | @@ -392,7 +392,7 @@ typedef struct BMDMAState { | ||
392 | uint8_t cmd; | 392 | uint8_t cmd; |
393 | uint8_t status; | 393 | uint8_t status; |
394 | uint32_t addr; | 394 | uint32_t addr; |
395 | - | 395 | + |
396 | struct PCIIDEState *pci_dev; | 396 | struct PCIIDEState *pci_dev; |
397 | /* current transfer state */ | 397 | /* current transfer state */ |
398 | uint32_t cur_addr; | 398 | uint32_t cur_addr; |
@@ -469,7 +469,7 @@ static void ide_identify(IDEState *s) | @@ -469,7 +469,7 @@ static void ide_identify(IDEState *s) | ||
469 | put_le16(p + 22, 4); /* ecc bytes */ | 469 | put_le16(p + 22, 4); /* ecc bytes */ |
470 | padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */ | 470 | padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */ |
471 | padstr((uint8_t *)(p + 27), "QEMU HARDDISK", 40); /* model */ | 471 | padstr((uint8_t *)(p + 27), "QEMU HARDDISK", 40); /* model */ |
472 | -#if MAX_MULT_SECTORS > 1 | 472 | +#if MAX_MULT_SECTORS > 1 |
473 | put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS); | 473 | put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS); |
474 | #endif | 474 | #endif |
475 | put_le16(p + 48, 1); /* dword I/O */ | 475 | put_le16(p + 48, 1); /* dword I/O */ |
@@ -923,7 +923,7 @@ static void ide_sector_write(IDEState *s) | @@ -923,7 +923,7 @@ static void ide_sector_write(IDEState *s) | ||
923 | ide_transfer_start(s, s->io_buffer, 512 * n1, ide_sector_write); | 923 | ide_transfer_start(s, s->io_buffer, 512 * n1, ide_sector_write); |
924 | } | 924 | } |
925 | ide_set_sector(s, sector_num + n); | 925 | ide_set_sector(s, sector_num + n); |
926 | - | 926 | + |
927 | bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n, | 927 | bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n, |
928 | ide_sector_write_aio_cb, bm); | 928 | ide_sector_write_aio_cb, bm); |
929 | } | 929 | } |
@@ -1246,7 +1246,7 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret) | @@ -1246,7 +1246,7 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret) | ||
1246 | bm->aiocb = NULL; | 1246 | bm->aiocb = NULL; |
1247 | return; | 1247 | return; |
1248 | } | 1248 | } |
1249 | - | 1249 | + |
1250 | s->io_buffer_index = 0; | 1250 | s->io_buffer_index = 0; |
1251 | if (s->cd_sector_size == 2352) { | 1251 | if (s->cd_sector_size == 2352) { |
1252 | n = 1; | 1252 | n = 1; |
@@ -1375,7 +1375,7 @@ static void ide_atapi_cmd(IDEState *s) | @@ -1375,7 +1375,7 @@ static void ide_atapi_cmd(IDEState *s) | ||
1375 | buf[9] = 0x12; | 1375 | buf[9] = 0x12; |
1376 | buf[10] = 0x08; | 1376 | buf[10] = 0x08; |
1377 | buf[11] = 0x00; | 1377 | buf[11] = 0x00; |
1378 | - | 1378 | + |
1379 | buf[12] = 0x70; | 1379 | buf[12] = 0x70; |
1380 | buf[13] = 3 << 5; | 1380 | buf[13] = 3 << 5; |
1381 | buf[14] = (1 << 0) | (1 << 3) | (1 << 5); | 1381 | buf[14] = (1 << 0) | (1 << 3) | (1 << 5); |
@@ -1501,7 +1501,7 @@ static void ide_atapi_cmd(IDEState *s) | @@ -1501,7 +1501,7 @@ static void ide_atapi_cmd(IDEState *s) | ||
1501 | int start, eject; | 1501 | int start, eject; |
1502 | start = packet[4] & 1; | 1502 | start = packet[4] & 1; |
1503 | eject = (packet[4] >> 1) & 1; | 1503 | eject = (packet[4] >> 1) & 1; |
1504 | - | 1504 | + |
1505 | if (eject && !start) { | 1505 | if (eject && !start) { |
1506 | /* eject the disk */ | 1506 | /* eject the disk */ |
1507 | bdrv_eject(s->bs, 1); | 1507 | bdrv_eject(s->bs, 1); |
@@ -2330,7 +2330,7 @@ static uint32_t ide_data_readl(void *opaque, uint32_t addr) | @@ -2330,7 +2330,7 @@ static uint32_t ide_data_readl(void *opaque, uint32_t addr) | ||
2330 | IDEState *s = ((IDEState *)opaque)->cur_drive; | 2330 | IDEState *s = ((IDEState *)opaque)->cur_drive; |
2331 | uint8_t *p; | 2331 | uint8_t *p; |
2332 | int ret; | 2332 | int ret; |
2333 | - | 2333 | + |
2334 | p = s->data_ptr; | 2334 | p = s->data_ptr; |
2335 | ret = cpu_to_le32(*(uint32_t *)p); | 2335 | ret = cpu_to_le32(*(uint32_t *)p); |
2336 | p += 4; | 2336 | p += 4; |
@@ -2509,7 +2509,7 @@ static void ide_init_ioport(IDEState *ide_state, int iobase, int iobase2) | @@ -2509,7 +2509,7 @@ static void ide_init_ioport(IDEState *ide_state, int iobase, int iobase2) | ||
2509 | register_ioport_read(iobase2, 1, 1, ide_status_read, ide_state); | 2509 | register_ioport_read(iobase2, 1, 1, ide_status_read, ide_state); |
2510 | register_ioport_write(iobase2, 1, 1, ide_cmd_write, ide_state); | 2510 | register_ioport_write(iobase2, 1, 1, ide_cmd_write, ide_state); |
2511 | } | 2511 | } |
2512 | - | 2512 | + |
2513 | /* data ports */ | 2513 | /* data ports */ |
2514 | register_ioport_write(iobase, 2, 2, ide_data_writew, ide_state); | 2514 | register_ioport_write(iobase, 2, 2, ide_data_writew, ide_state); |
2515 | register_ioport_read(iobase, 2, 2, ide_data_readw, ide_state); | 2515 | register_ioport_read(iobase, 2, 2, ide_data_readw, ide_state); |
@@ -2584,7 +2584,7 @@ void isa_ide_init(int iobase, int iobase2, qemu_irq irq, | @@ -2584,7 +2584,7 @@ void isa_ide_init(int iobase, int iobase2, qemu_irq irq, | ||
2584 | ide_state = qemu_mallocz(sizeof(IDEState) * 2); | 2584 | ide_state = qemu_mallocz(sizeof(IDEState) * 2); |
2585 | if (!ide_state) | 2585 | if (!ide_state) |
2586 | return; | 2586 | return; |
2587 | - | 2587 | + |
2588 | ide_init2(ide_state, hd0, hd1, irq); | 2588 | ide_init2(ide_state, hd0, hd1, irq); |
2589 | ide_init_ioport(ide_state, iobase, iobase2); | 2589 | ide_init_ioport(ide_state, iobase, iobase2); |
2590 | } | 2590 | } |
@@ -2671,7 +2671,7 @@ static uint32_t bmdma_readb(void *opaque, uint32_t addr) | @@ -2671,7 +2671,7 @@ static uint32_t bmdma_readb(void *opaque, uint32_t addr) | ||
2671 | BMDMAState *bm = opaque; | 2671 | BMDMAState *bm = opaque; |
2672 | PCIIDEState *pci_dev; | 2672 | PCIIDEState *pci_dev; |
2673 | uint32_t val; | 2673 | uint32_t val; |
2674 | - | 2674 | + |
2675 | switch(addr & 3) { | 2675 | switch(addr & 3) { |
2676 | case 0: | 2676 | case 0: |
2677 | val = bm->cmd; | 2677 | val = bm->cmd; |
@@ -2835,7 +2835,7 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table, | @@ -2835,7 +2835,7 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table, | ||
2835 | pci_conf[0x0a] = 0x01; // class_sub = PCI_IDE | 2835 | pci_conf[0x0a] = 0x01; // class_sub = PCI_IDE |
2836 | pci_conf[0x0b] = 0x01; // class_base = PCI_mass_storage | 2836 | pci_conf[0x0b] = 0x01; // class_base = PCI_mass_storage |
2837 | pci_conf[0x0e] = 0x00; // header_type | 2837 | pci_conf[0x0e] = 0x00; // header_type |
2838 | - | 2838 | + |
2839 | if (secondary_ide_enabled) { | 2839 | if (secondary_ide_enabled) { |
2840 | /* XXX: if not enabled, really disable the seconday IDE controller */ | 2840 | /* XXX: if not enabled, really disable the seconday IDE controller */ |
2841 | pci_conf[0x51] = 0x80; /* enable IDE1 */ | 2841 | pci_conf[0x51] = 0x80; /* enable IDE1 */ |
@@ -2853,7 +2853,7 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table, | @@ -2853,7 +2853,7 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table, | ||
2853 | PCI_ADDRESS_SPACE_IO, bmdma_map); | 2853 | PCI_ADDRESS_SPACE_IO, bmdma_map); |
2854 | 2854 | ||
2855 | pci_conf[0x3d] = 0x01; // interrupt on pin 1 | 2855 | pci_conf[0x3d] = 0x01; // interrupt on pin 1 |
2856 | - | 2856 | + |
2857 | for(i = 0; i < 4; i++) | 2857 | for(i = 0; i < 4; i++) |
2858 | d->ide_if[i].pci_dev = (PCIDevice *)d; | 2858 | d->ide_if[i].pci_dev = (PCIDevice *)d; |
2859 | 2859 | ||
@@ -2945,7 +2945,7 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, | @@ -2945,7 +2945,7 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, | ||
2945 | { | 2945 | { |
2946 | PCIIDEState *d; | 2946 | PCIIDEState *d; |
2947 | uint8_t *pci_conf; | 2947 | uint8_t *pci_conf; |
2948 | - | 2948 | + |
2949 | /* register a function 1 of PIIX3 */ | 2949 | /* register a function 1 of PIIX3 */ |
2950 | d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE", | 2950 | d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE", |
2951 | sizeof(PCIIDEState), | 2951 | sizeof(PCIIDEState), |
@@ -3133,7 +3133,7 @@ int pmac_ide_init (BlockDriverState **hd_table, qemu_irq irq) | @@ -3133,7 +3133,7 @@ int pmac_ide_init (BlockDriverState **hd_table, qemu_irq irq) | ||
3133 | 3133 | ||
3134 | ide_if = qemu_mallocz(sizeof(IDEState) * 2); | 3134 | ide_if = qemu_mallocz(sizeof(IDEState) * 2); |
3135 | ide_init2(&ide_if[0], hd_table[0], hd_table[1], irq); | 3135 | ide_init2(&ide_if[0], hd_table[0], hd_table[1], irq); |
3136 | - | 3136 | + |
3137 | pmac_ide_memory = cpu_register_io_memory(0, pmac_ide_read, | 3137 | pmac_ide_memory = cpu_register_io_memory(0, pmac_ide_read, |
3138 | pmac_ide_write, &ide_if[0]); | 3138 | pmac_ide_write, &ide_if[0]); |
3139 | return pmac_ide_memory; | 3139 | return pmac_ide_memory; |
hw/iommu.c
@@ -279,7 +279,7 @@ static void iommu_save(QEMUFile *f, void *opaque) | @@ -279,7 +279,7 @@ static void iommu_save(QEMUFile *f, void *opaque) | ||
279 | { | 279 | { |
280 | IOMMUState *s = opaque; | 280 | IOMMUState *s = opaque; |
281 | int i; | 281 | int i; |
282 | - | 282 | + |
283 | for (i = 0; i < IOMMU_NREGS; i++) | 283 | for (i = 0; i < IOMMU_NREGS; i++) |
284 | qemu_put_be32s(f, &s->regs[i]); | 284 | qemu_put_be32s(f, &s->regs[i]); |
285 | qemu_put_be64s(f, &s->iostart); | 285 | qemu_put_be64s(f, &s->iostart); |
@@ -289,7 +289,7 @@ static int iommu_load(QEMUFile *f, void *opaque, int version_id) | @@ -289,7 +289,7 @@ static int iommu_load(QEMUFile *f, void *opaque, int version_id) | ||
289 | { | 289 | { |
290 | IOMMUState *s = opaque; | 290 | IOMMUState *s = opaque; |
291 | int i; | 291 | int i; |
292 | - | 292 | + |
293 | if (version_id != 2) | 293 | if (version_id != 2) |
294 | return -EINVAL; | 294 | return -EINVAL; |
295 | 295 | ||
@@ -322,7 +322,7 @@ void *iommu_init(target_phys_addr_t addr) | @@ -322,7 +322,7 @@ void *iommu_init(target_phys_addr_t addr) | ||
322 | 322 | ||
323 | iommu_io_memory = cpu_register_io_memory(0, iommu_mem_read, iommu_mem_write, s); | 323 | iommu_io_memory = cpu_register_io_memory(0, iommu_mem_read, iommu_mem_write, s); |
324 | cpu_register_physical_memory(addr, IOMMU_NREGS * 4, iommu_io_memory); | 324 | cpu_register_physical_memory(addr, IOMMU_NREGS * 4, iommu_io_memory); |
325 | - | 325 | + |
326 | register_savevm("iommu", addr, 2, iommu_save, iommu_load, s); | 326 | register_savevm("iommu", addr, 2, iommu_save, iommu_load, s); |
327 | qemu_register_reset(iommu_reset, s); | 327 | qemu_register_reset(iommu_reset, s); |
328 | return s; | 328 | return s; |
hw/m48t59.c
@@ -90,7 +90,7 @@ static void get_time (m48t59_t *NVRAM, struct tm *tm) | @@ -90,7 +90,7 @@ static void get_time (m48t59_t *NVRAM, struct tm *tm) | ||
90 | static void set_time (m48t59_t *NVRAM, struct tm *tm) | 90 | static void set_time (m48t59_t *NVRAM, struct tm *tm) |
91 | { | 91 | { |
92 | time_t now, new_time; | 92 | time_t now, new_time; |
93 | - | 93 | + |
94 | new_time = mktime(tm); | 94 | new_time = mktime(tm); |
95 | now = time(NULL); | 95 | now = time(NULL); |
96 | NVRAM->time_offset = new_time - now; | 96 | NVRAM->time_offset = new_time - now; |
@@ -510,7 +510,7 @@ static uint32_t NVRAM_readb (void *opaque, uint32_t addr) | @@ -510,7 +510,7 @@ static uint32_t NVRAM_readb (void *opaque, uint32_t addr) | ||
510 | static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value) | 510 | static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value) |
511 | { | 511 | { |
512 | m48t59_t *NVRAM = opaque; | 512 | m48t59_t *NVRAM = opaque; |
513 | - | 513 | + |
514 | addr -= NVRAM->mem_base; | 514 | addr -= NVRAM->mem_base; |
515 | m48t59_write(NVRAM, addr, value & 0xff); | 515 | m48t59_write(NVRAM, addr, value & 0xff); |
516 | } | 516 | } |
@@ -518,7 +518,7 @@ static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value) | @@ -518,7 +518,7 @@ static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value) | ||
518 | static void nvram_writew (void *opaque, target_phys_addr_t addr, uint32_t value) | 518 | static void nvram_writew (void *opaque, target_phys_addr_t addr, uint32_t value) |
519 | { | 519 | { |
520 | m48t59_t *NVRAM = opaque; | 520 | m48t59_t *NVRAM = opaque; |
521 | - | 521 | + |
522 | addr -= NVRAM->mem_base; | 522 | addr -= NVRAM->mem_base; |
523 | m48t59_write(NVRAM, addr, (value >> 8) & 0xff); | 523 | m48t59_write(NVRAM, addr, (value >> 8) & 0xff); |
524 | m48t59_write(NVRAM, addr + 1, value & 0xff); | 524 | m48t59_write(NVRAM, addr + 1, value & 0xff); |
@@ -527,7 +527,7 @@ static void nvram_writew (void *opaque, target_phys_addr_t addr, uint32_t value) | @@ -527,7 +527,7 @@ static void nvram_writew (void *opaque, target_phys_addr_t addr, uint32_t value) | ||
527 | static void nvram_writel (void *opaque, target_phys_addr_t addr, uint32_t value) | 527 | static void nvram_writel (void *opaque, target_phys_addr_t addr, uint32_t value) |
528 | { | 528 | { |
529 | m48t59_t *NVRAM = opaque; | 529 | m48t59_t *NVRAM = opaque; |
530 | - | 530 | + |
531 | addr -= NVRAM->mem_base; | 531 | addr -= NVRAM->mem_base; |
532 | m48t59_write(NVRAM, addr, (value >> 24) & 0xff); | 532 | m48t59_write(NVRAM, addr, (value >> 24) & 0xff); |
533 | m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff); | 533 | m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff); |
@@ -539,7 +539,7 @@ static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr) | @@ -539,7 +539,7 @@ static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr) | ||
539 | { | 539 | { |
540 | m48t59_t *NVRAM = opaque; | 540 | m48t59_t *NVRAM = opaque; |
541 | uint32_t retval; | 541 | uint32_t retval; |
542 | - | 542 | + |
543 | addr -= NVRAM->mem_base; | 543 | addr -= NVRAM->mem_base; |
544 | retval = m48t59_read(NVRAM, addr); | 544 | retval = m48t59_read(NVRAM, addr); |
545 | return retval; | 545 | return retval; |
@@ -549,7 +549,7 @@ static uint32_t nvram_readw (void *opaque, target_phys_addr_t addr) | @@ -549,7 +549,7 @@ static uint32_t nvram_readw (void *opaque, target_phys_addr_t addr) | ||
549 | { | 549 | { |
550 | m48t59_t *NVRAM = opaque; | 550 | m48t59_t *NVRAM = opaque; |
551 | uint32_t retval; | 551 | uint32_t retval; |
552 | - | 552 | + |
553 | addr -= NVRAM->mem_base; | 553 | addr -= NVRAM->mem_base; |
554 | retval = m48t59_read(NVRAM, addr) << 8; | 554 | retval = m48t59_read(NVRAM, addr) << 8; |
555 | retval |= m48t59_read(NVRAM, addr + 1); | 555 | retval |= m48t59_read(NVRAM, addr + 1); |
hw/mc146818rtc.c
@@ -110,7 +110,7 @@ static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data) | @@ -110,7 +110,7 @@ static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data) | ||
110 | #ifdef DEBUG_CMOS | 110 | #ifdef DEBUG_CMOS |
111 | printf("cmos: write index=0x%02x val=0x%02x\n", | 111 | printf("cmos: write index=0x%02x val=0x%02x\n", |
112 | s->cmos_index, data); | 112 | s->cmos_index, data); |
113 | -#endif | 113 | +#endif |
114 | switch(s->cmos_index) { | 114 | switch(s->cmos_index) { |
115 | case RTC_SECONDS_ALARM: | 115 | case RTC_SECONDS_ALARM: |
116 | case RTC_MINUTES_ALARM: | 116 | case RTC_MINUTES_ALARM: |
@@ -283,7 +283,7 @@ static void rtc_update_second(void *opaque) | @@ -283,7 +283,7 @@ static void rtc_update_second(void *opaque) | ||
283 | qemu_mod_timer(s->second_timer, s->next_second_time); | 283 | qemu_mod_timer(s->second_timer, s->next_second_time); |
284 | } else { | 284 | } else { |
285 | rtc_next_second(&s->current_tm); | 285 | rtc_next_second(&s->current_tm); |
286 | - | 286 | + |
287 | if (!(s->cmos_data[RTC_REG_B] & REG_B_SET)) { | 287 | if (!(s->cmos_data[RTC_REG_B] & REG_B_SET)) { |
288 | /* update in progress bit */ | 288 | /* update in progress bit */ |
289 | s->cmos_data[RTC_REG_A] |= REG_A_UIP; | 289 | s->cmos_data[RTC_REG_A] |= REG_A_UIP; |
@@ -411,7 +411,7 @@ static void rtc_save(QEMUFile *f, void *opaque) | @@ -411,7 +411,7 @@ static void rtc_save(QEMUFile *f, void *opaque) | ||
411 | 411 | ||
412 | qemu_put_buffer(f, s->cmos_data, 128); | 412 | qemu_put_buffer(f, s->cmos_data, 128); |
413 | qemu_put_8s(f, &s->cmos_index); | 413 | qemu_put_8s(f, &s->cmos_index); |
414 | - | 414 | + |
415 | qemu_put_be32s(f, &s->current_tm.tm_sec); | 415 | qemu_put_be32s(f, &s->current_tm.tm_sec); |
416 | qemu_put_be32s(f, &s->current_tm.tm_min); | 416 | qemu_put_be32s(f, &s->current_tm.tm_min); |
417 | qemu_put_be32s(f, &s->current_tm.tm_hour); | 417 | qemu_put_be32s(f, &s->current_tm.tm_hour); |
hw/mips_malta.c
@@ -510,9 +510,9 @@ static void write_bootloader (CPUState *env, unsigned long bios_offset, int64_t | @@ -510,9 +510,9 @@ static void write_bootloader (CPUState *env, unsigned long bios_offset, int64_t | ||
510 | stl_raw(p++, 0x00000000); /* nop */ | 510 | stl_raw(p++, 0x00000000); /* nop */ |
511 | 511 | ||
512 | /* YAMON service vector */ | 512 | /* YAMON service vector */ |
513 | - stl_raw(phys_ram_base + bios_offset + 0x500, 0xbfc00580); /* start: */ | 513 | + stl_raw(phys_ram_base + bios_offset + 0x500, 0xbfc00580); /* start: */ |
514 | stl_raw(phys_ram_base + bios_offset + 0x504, 0xbfc0083c); /* print_count: */ | 514 | stl_raw(phys_ram_base + bios_offset + 0x504, 0xbfc0083c); /* print_count: */ |
515 | - stl_raw(phys_ram_base + bios_offset + 0x520, 0xbfc00580); /* start: */ | 515 | + stl_raw(phys_ram_base + bios_offset + 0x520, 0xbfc00580); /* start: */ |
516 | stl_raw(phys_ram_base + bios_offset + 0x52c, 0xbfc00800); /* flush_cache: */ | 516 | stl_raw(phys_ram_base + bios_offset + 0x52c, 0xbfc00800); /* flush_cache: */ |
517 | stl_raw(phys_ram_base + bios_offset + 0x534, 0xbfc00808); /* print: */ | 517 | stl_raw(phys_ram_base + bios_offset + 0x534, 0xbfc00808); /* print: */ |
518 | stl_raw(phys_ram_base + bios_offset + 0x538, 0xbfc00800); /* reg_cpu_isr: */ | 518 | stl_raw(phys_ram_base + bios_offset + 0x538, 0xbfc00800); /* reg_cpu_isr: */ |
hw/ne2000.c
@@ -212,7 +212,7 @@ static int ne2000_buffer_full(NE2000State *s) | @@ -212,7 +212,7 @@ static int ne2000_buffer_full(NE2000State *s) | ||
212 | static int ne2000_can_receive(void *opaque) | 212 | static int ne2000_can_receive(void *opaque) |
213 | { | 213 | { |
214 | NE2000State *s = opaque; | 214 | NE2000State *s = opaque; |
215 | - | 215 | + |
216 | if (s->cmd & E8390_STOP) | 216 | if (s->cmd & E8390_STOP) |
217 | return 1; | 217 | return 1; |
218 | return !ne2000_buffer_full(s); | 218 | return !ne2000_buffer_full(s); |
@@ -228,14 +228,14 @@ static void ne2000_receive(void *opaque, const uint8_t *buf, int size) | @@ -228,14 +228,14 @@ static void ne2000_receive(void *opaque, const uint8_t *buf, int size) | ||
228 | uint8_t buf1[60]; | 228 | uint8_t buf1[60]; |
229 | static const uint8_t broadcast_macaddr[6] = | 229 | static const uint8_t broadcast_macaddr[6] = |
230 | { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | 230 | { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
231 | - | 231 | + |
232 | #if defined(DEBUG_NE2000) | 232 | #if defined(DEBUG_NE2000) |
233 | printf("NE2000: received len=%d\n", size); | 233 | printf("NE2000: received len=%d\n", size); |
234 | #endif | 234 | #endif |
235 | 235 | ||
236 | if (s->cmd & E8390_STOP || ne2000_buffer_full(s)) | 236 | if (s->cmd & E8390_STOP || ne2000_buffer_full(s)) |
237 | return; | 237 | return; |
238 | - | 238 | + |
239 | /* XXX: check this */ | 239 | /* XXX: check this */ |
240 | if (s->rxcr & 0x10) { | 240 | if (s->rxcr & 0x10) { |
241 | /* promiscuous: receive all */ | 241 | /* promiscuous: receive all */ |
@@ -252,10 +252,10 @@ static void ne2000_receive(void *opaque, const uint8_t *buf, int size) | @@ -252,10 +252,10 @@ static void ne2000_receive(void *opaque, const uint8_t *buf, int size) | ||
252 | if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) | 252 | if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) |
253 | return; | 253 | return; |
254 | } else if (s->mem[0] == buf[0] && | 254 | } else if (s->mem[0] == buf[0] && |
255 | - s->mem[2] == buf[1] && | ||
256 | - s->mem[4] == buf[2] && | ||
257 | - s->mem[6] == buf[3] && | ||
258 | - s->mem[8] == buf[4] && | 255 | + s->mem[2] == buf[1] && |
256 | + s->mem[4] == buf[2] && | ||
257 | + s->mem[6] == buf[3] && | ||
258 | + s->mem[8] == buf[4] && | ||
259 | s->mem[10] == buf[5]) { | 259 | s->mem[10] == buf[5]) { |
260 | /* match */ | 260 | /* match */ |
261 | } else { | 261 | } else { |
@@ -718,11 +718,11 @@ static int ne2000_load(QEMUFile* f,void* opaque,int version_id) | @@ -718,11 +718,11 @@ static int ne2000_load(QEMUFile* f,void* opaque,int version_id) | ||
718 | void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd) | 718 | void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd) |
719 | { | 719 | { |
720 | NE2000State *s; | 720 | NE2000State *s; |
721 | - | 721 | + |
722 | s = qemu_mallocz(sizeof(NE2000State)); | 722 | s = qemu_mallocz(sizeof(NE2000State)); |
723 | if (!s) | 723 | if (!s) |
724 | return; | 724 | return; |
725 | - | 725 | + |
726 | register_ioport_write(base, 16, 1, ne2000_ioport_write, s); | 726 | register_ioport_write(base, 16, 1, ne2000_ioport_write, s); |
727 | register_ioport_read(base, 16, 1, ne2000_ioport_read, s); | 727 | register_ioport_read(base, 16, 1, ne2000_ioport_read, s); |
728 | 728 | ||
@@ -749,7 +749,7 @@ void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd) | @@ -749,7 +749,7 @@ void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd) | ||
749 | s->macaddr[3], | 749 | s->macaddr[3], |
750 | s->macaddr[4], | 750 | s->macaddr[4], |
751 | s->macaddr[5]); | 751 | s->macaddr[5]); |
752 | - | 752 | + |
753 | register_savevm("ne2000", 0, 2, ne2000_save, ne2000_load, s); | 753 | register_savevm("ne2000", 0, 2, ne2000_save, ne2000_load, s); |
754 | } | 754 | } |
755 | 755 | ||
@@ -786,7 +786,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -786,7 +786,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
786 | PCINE2000State *d; | 786 | PCINE2000State *d; |
787 | NE2000State *s; | 787 | NE2000State *s; |
788 | uint8_t *pci_conf; | 788 | uint8_t *pci_conf; |
789 | - | 789 | + |
790 | d = (PCINE2000State *)pci_register_device(bus, | 790 | d = (PCINE2000State *)pci_register_device(bus, |
791 | "NE2000", sizeof(PCINE2000State), | 791 | "NE2000", sizeof(PCINE2000State), |
792 | devfn, | 792 | devfn, |
@@ -800,7 +800,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -800,7 +800,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
800 | pci_conf[0x0b] = 0x02; | 800 | pci_conf[0x0b] = 0x02; |
801 | pci_conf[0x0e] = 0x00; // header_type | 801 | pci_conf[0x0e] = 0x00; // header_type |
802 | pci_conf[0x3d] = 1; // interrupt pin 0 | 802 | pci_conf[0x3d] = 1; // interrupt pin 0 |
803 | - | 803 | + |
804 | pci_register_io_region(&d->dev, 0, 0x100, | 804 | pci_register_io_region(&d->dev, 0, 0x100, |
805 | PCI_ADDRESS_SPACE_IO, ne2000_map); | 805 | PCI_ADDRESS_SPACE_IO, ne2000_map); |
806 | s = &d->ne2000; | 806 | s = &d->ne2000; |
@@ -819,7 +819,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -819,7 +819,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
819 | s->macaddr[3], | 819 | s->macaddr[3], |
820 | s->macaddr[4], | 820 | s->macaddr[4], |
821 | s->macaddr[5]); | 821 | s->macaddr[5]); |
822 | - | 822 | + |
823 | /* XXX: instance number ? */ | 823 | /* XXX: instance number ? */ |
824 | register_savevm("ne2000", 0, 3, ne2000_save, ne2000_load, s); | 824 | register_savevm("ne2000", 0, 3, ne2000_save, ne2000_load, s); |
825 | } | 825 | } |
hw/openpic.c
@@ -475,7 +475,7 @@ static uint32_t read_doorbell_register (openpic_t *opp, | @@ -475,7 +475,7 @@ static uint32_t read_doorbell_register (openpic_t *opp, | ||
475 | 475 | ||
476 | return retval; | 476 | return retval; |
477 | } | 477 | } |
478 | - | 478 | + |
479 | static void write_doorbell_register (penpic_t *opp, int n_dbl, | 479 | static void write_doorbell_register (penpic_t *opp, int n_dbl, |
480 | uint32_t offset, uint32_t value) | 480 | uint32_t offset, uint32_t value) |
481 | { | 481 | { |
@@ -831,7 +831,7 @@ static uint32_t openpic_cpu_read (void *opaque, uint32_t addr) | @@ -831,7 +831,7 @@ static uint32_t openpic_cpu_read (void *opaque, uint32_t addr) | ||
831 | IRQ_dst_t *dst; | 831 | IRQ_dst_t *dst; |
832 | uint32_t retval; | 832 | uint32_t retval; |
833 | int idx, n_IRQ; | 833 | int idx, n_IRQ; |
834 | - | 834 | + |
835 | DPRINTF("%s: addr %08x\n", __func__, addr); | 835 | DPRINTF("%s: addr %08x\n", __func__, addr); |
836 | retval = 0xFFFFFFFF; | 836 | retval = 0xFFFFFFFF; |
837 | if (addr & 0xF) | 837 | if (addr & 0xF) |
@@ -1005,7 +1005,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus, | @@ -1005,7 +1005,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus, | ||
1005 | openpic_t *opp; | 1005 | openpic_t *opp; |
1006 | uint8_t *pci_conf; | 1006 | uint8_t *pci_conf; |
1007 | int i, m; | 1007 | int i, m; |
1008 | - | 1008 | + |
1009 | /* XXX: for now, only one CPU is supported */ | 1009 | /* XXX: for now, only one CPU is supported */ |
1010 | if (nb_cpus != 1) | 1010 | if (nb_cpus != 1) |
1011 | return NULL; | 1011 | return NULL; |
@@ -1023,7 +1023,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus, | @@ -1023,7 +1023,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus, | ||
1023 | pci_conf[0x0b] = 0x08; | 1023 | pci_conf[0x0b] = 0x08; |
1024 | pci_conf[0x0e] = 0x00; // header_type | 1024 | pci_conf[0x0e] = 0x00; // header_type |
1025 | pci_conf[0x3d] = 0x00; // no interrupt pin | 1025 | pci_conf[0x3d] = 0x00; // no interrupt pin |
1026 | - | 1026 | + |
1027 | /* Register I/O spaces */ | 1027 | /* Register I/O spaces */ |
1028 | pci_register_io_region((PCIDevice *)opp, 0, 0x40000, | 1028 | pci_register_io_region((PCIDevice *)opp, 0, 0x40000, |
1029 | PCI_ADDRESS_SPACE_MEM, &openpic_map); | 1029 | PCI_ADDRESS_SPACE_MEM, &openpic_map); |
@@ -1032,7 +1032,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus, | @@ -1032,7 +1032,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus, | ||
1032 | } | 1032 | } |
1033 | opp->mem_index = cpu_register_io_memory(0, openpic_read, | 1033 | opp->mem_index = cpu_register_io_memory(0, openpic_read, |
1034 | openpic_write, opp); | 1034 | openpic_write, opp); |
1035 | - | 1035 | + |
1036 | // isu_base &= 0xFFFC0000; | 1036 | // isu_base &= 0xFFFC0000; |
1037 | opp->nb_cpus = nb_cpus; | 1037 | opp->nb_cpus = nb_cpus; |
1038 | /* Set IRQ types */ | 1038 | /* Set IRQ types */ |
hw/parallel.c
@@ -88,7 +88,7 @@ static void | @@ -88,7 +88,7 @@ static void | ||
88 | parallel_ioport_write_sw(void *opaque, uint32_t addr, uint32_t val) | 88 | parallel_ioport_write_sw(void *opaque, uint32_t addr, uint32_t val) |
89 | { | 89 | { |
90 | ParallelState *s = opaque; | 90 | ParallelState *s = opaque; |
91 | - | 91 | + |
92 | pdebug("write addr=0x%02x val=0x%02x\n", addr, val); | 92 | pdebug("write addr=0x%02x val=0x%02x\n", addr, val); |
93 | 93 | ||
94 | addr &= 7; | 94 | addr &= 7; |
hw/pc.c
@@ -182,7 +182,7 @@ static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table | @@ -182,7 +182,7 @@ static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table | ||
182 | val = 65535; | 182 | val = 65535; |
183 | rtc_set_memory(s, 0x34, val); | 183 | rtc_set_memory(s, 0x34, val); |
184 | rtc_set_memory(s, 0x35, val >> 8); | 184 | rtc_set_memory(s, 0x35, val >> 8); |
185 | - | 185 | + |
186 | switch(boot_device) { | 186 | switch(boot_device) { |
187 | case 'a': | 187 | case 'a': |
188 | case 'b': | 188 | case 'b': |
@@ -209,7 +209,7 @@ static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table | @@ -209,7 +209,7 @@ static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table | ||
209 | 209 | ||
210 | val = (cmos_get_fd_drive_type(fd0) << 4) | cmos_get_fd_drive_type(fd1); | 210 | val = (cmos_get_fd_drive_type(fd0) << 4) | cmos_get_fd_drive_type(fd1); |
211 | rtc_set_memory(s, 0x10, val); | 211 | rtc_set_memory(s, 0x10, val); |
212 | - | 212 | + |
213 | val = 0; | 213 | val = 0; |
214 | nb = 0; | 214 | nb = 0; |
215 | if (fd0 < 3) | 215 | if (fd0 < 3) |
@@ -294,7 +294,7 @@ void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) | @@ -294,7 +294,7 @@ void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) | ||
294 | { | 294 | { |
295 | static const char shutdown_str[8] = "Shutdown"; | 295 | static const char shutdown_str[8] = "Shutdown"; |
296 | static int shutdown_index = 0; | 296 | static int shutdown_index = 0; |
297 | - | 297 | + |
298 | switch(addr) { | 298 | switch(addr) { |
299 | /* Bochs BIOS messages */ | 299 | /* Bochs BIOS messages */ |
300 | case 0x400: | 300 | case 0x400: |
@@ -783,7 +783,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, | @@ -783,7 +783,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, | ||
783 | /* map all the bios at the top of memory */ | 783 | /* map all the bios at the top of memory */ |
784 | cpu_register_physical_memory((uint32_t)(-bios_size), | 784 | cpu_register_physical_memory((uint32_t)(-bios_size), |
785 | bios_size, bios_offset | IO_MEM_ROM); | 785 | bios_size, bios_offset | IO_MEM_ROM); |
786 | - | 786 | + |
787 | bochs_bios_init(); | 787 | bochs_bios_init(); |
788 | 788 | ||
789 | if (linux_boot) | 789 | if (linux_boot) |
@@ -914,7 +914,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, | @@ -914,7 +914,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, | ||
914 | smbus_eeprom_device_init(smbus, 0x50 + i, eeprom_buf + (i * 256)); | 914 | smbus_eeprom_device_init(smbus, 0x50 + i, eeprom_buf + (i * 256)); |
915 | } | 915 | } |
916 | } | 916 | } |
917 | - | 917 | + |
918 | if (i440fx_state) { | 918 | if (i440fx_state) { |
919 | i440fx_init_memory_mappings(i440fx_state); | 919 | i440fx_init_memory_mappings(i440fx_state); |
920 | } | 920 | } |
hw/pci.c
@@ -105,7 +105,7 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name, | @@ -105,7 +105,7 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name, | ||
105 | 105 | ||
106 | if (pci_irq_index >= PCI_DEVICES_MAX) | 106 | if (pci_irq_index >= PCI_DEVICES_MAX) |
107 | return NULL; | 107 | return NULL; |
108 | - | 108 | + |
109 | if (devfn < 0) { | 109 | if (devfn < 0) { |
110 | for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) { | 110 | for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) { |
111 | if (!bus->devices[devfn]) | 111 | if (!bus->devices[devfn]) |
@@ -166,7 +166,7 @@ static void pci_update_mappings(PCIDevice *d) | @@ -166,7 +166,7 @@ static void pci_update_mappings(PCIDevice *d) | ||
166 | PCIIORegion *r; | 166 | PCIIORegion *r; |
167 | int cmd, i; | 167 | int cmd, i; |
168 | uint32_t last_addr, new_addr, config_ofs; | 168 | uint32_t last_addr, new_addr, config_ofs; |
169 | - | 169 | + |
170 | cmd = le16_to_cpu(*(uint16_t *)(d->config + PCI_COMMAND)); | 170 | cmd = le16_to_cpu(*(uint16_t *)(d->config + PCI_COMMAND)); |
171 | for(i = 0; i < PCI_NUM_REGIONS; i++) { | 171 | for(i = 0; i < PCI_NUM_REGIONS; i++) { |
172 | r = &d->io_regions[i]; | 172 | r = &d->io_regions[i]; |
@@ -367,7 +367,7 @@ void pci_data_write(void *opaque, uint32_t addr, uint32_t val, int len) | @@ -367,7 +367,7 @@ void pci_data_write(void *opaque, uint32_t addr, uint32_t val, int len) | ||
367 | PCIBus *s = opaque; | 367 | PCIBus *s = opaque; |
368 | PCIDevice *pci_dev; | 368 | PCIDevice *pci_dev; |
369 | int config_addr, bus_num; | 369 | int config_addr, bus_num; |
370 | - | 370 | + |
371 | #if defined(DEBUG_PCI) && 0 | 371 | #if defined(DEBUG_PCI) && 0 |
372 | printf("pci_data_write: addr=%08x val=%08x len=%d\n", | 372 | printf("pci_data_write: addr=%08x val=%08x len=%d\n", |
373 | addr, val, len); | 373 | addr, val, len); |
@@ -440,7 +440,7 @@ static void pci_set_irq(void *opaque, int irq_num, int level) | @@ -440,7 +440,7 @@ static void pci_set_irq(void *opaque, int irq_num, int level) | ||
440 | PCIDevice *pci_dev = (PCIDevice *)opaque; | 440 | PCIDevice *pci_dev = (PCIDevice *)opaque; |
441 | PCIBus *bus; | 441 | PCIBus *bus; |
442 | int change; | 442 | int change; |
443 | - | 443 | + |
444 | change = level - pci_dev->irq_state[irq_num]; | 444 | change = level - pci_dev->irq_state[irq_num]; |
445 | if (!change) | 445 | if (!change) |
446 | return; | 446 | return; |
@@ -556,7 +556,7 @@ void pci_for_each_device(int bus_num, void (*fn)(PCIDevice *d)) | @@ -556,7 +556,7 @@ void pci_for_each_device(int bus_num, void (*fn)(PCIDevice *d)) | ||
556 | PCIBus *bus = first_bus; | 556 | PCIBus *bus = first_bus; |
557 | PCIDevice *d; | 557 | PCIDevice *d; |
558 | int devfn; | 558 | int devfn; |
559 | - | 559 | + |
560 | while (bus && bus->bus_num != bus_num) | 560 | while (bus && bus->bus_num != bus_num) |
561 | bus = bus->next; | 561 | bus = bus->next; |
562 | if (bus) { | 562 | if (bus) { |
hw/pckbd.c
@@ -338,7 +338,7 @@ static void kbd_reset(void *opaque) | @@ -338,7 +338,7 @@ static void kbd_reset(void *opaque) | ||
338 | static void kbd_save(QEMUFile* f, void* opaque) | 338 | static void kbd_save(QEMUFile* f, void* opaque) |
339 | { | 339 | { |
340 | KBDState *s = (KBDState*)opaque; | 340 | KBDState *s = (KBDState*)opaque; |
341 | - | 341 | + |
342 | qemu_put_8s(f, &s->write_cmd); | 342 | qemu_put_8s(f, &s->write_cmd); |
343 | qemu_put_8s(f, &s->status); | 343 | qemu_put_8s(f, &s->status); |
344 | qemu_put_8s(f, &s->mode); | 344 | qemu_put_8s(f, &s->mode); |
@@ -348,7 +348,7 @@ static void kbd_save(QEMUFile* f, void* opaque) | @@ -348,7 +348,7 @@ static void kbd_save(QEMUFile* f, void* opaque) | ||
348 | static int kbd_load(QEMUFile* f, void* opaque, int version_id) | 348 | static int kbd_load(QEMUFile* f, void* opaque, int version_id) |
349 | { | 349 | { |
350 | KBDState *s = (KBDState*)opaque; | 350 | KBDState *s = (KBDState*)opaque; |
351 | - | 351 | + |
352 | if (version_id != 3) | 352 | if (version_id != 3) |
353 | return -EINVAL; | 353 | return -EINVAL; |
354 | qemu_get_8s(f, &s->write_cmd); | 354 | qemu_get_8s(f, &s->write_cmd); |
hw/pcnet.c
@@ -731,7 +731,7 @@ static void pcnet_s_reset(PCNetState *s) | @@ -731,7 +731,7 @@ static void pcnet_s_reset(PCNetState *s) | ||
731 | s->rdra = 0; | 731 | s->rdra = 0; |
732 | s->tdra = 0; | 732 | s->tdra = 0; |
733 | s->rap = 0; | 733 | s->rap = 0; |
734 | - | 734 | + |
735 | s->bcr[BCR_BSBC] &= ~0x0080; | 735 | s->bcr[BCR_BSBC] &= ~0x0080; |
736 | 736 | ||
737 | s->csr[0] = 0x0004; | 737 | s->csr[0] = 0x0004; |
@@ -770,7 +770,7 @@ static void pcnet_update_irq(PCNetState *s) | @@ -770,7 +770,7 @@ static void pcnet_update_irq(PCNetState *s) | ||
770 | { | 770 | { |
771 | int isr = 0; | 771 | int isr = 0; |
772 | s->csr[0] &= ~0x0080; | 772 | s->csr[0] &= ~0x0080; |
773 | - | 773 | + |
774 | #if 1 | 774 | #if 1 |
775 | if (((s->csr[0] & ~s->csr[3]) & 0x5f00) || | 775 | if (((s->csr[0] & ~s->csr[3]) & 0x5f00) || |
776 | (((s->csr[4]>>1) & ~s->csr[4]) & 0x0115) || | 776 | (((s->csr[4]>>1) & ~s->csr[4]) & 0x0115) || |
@@ -790,11 +790,11 @@ static void pcnet_update_irq(PCNetState *s) | @@ -790,11 +790,11 @@ static void pcnet_update_irq(PCNetState *s) | ||
790 | (!!(s->csr[5] & 0x0008) && !!(s->csr[5] & 0x0010)) /* MPINT */) | 790 | (!!(s->csr[5] & 0x0008) && !!(s->csr[5] & 0x0010)) /* MPINT */) |
791 | #endif | 791 | #endif |
792 | { | 792 | { |
793 | - | 793 | + |
794 | isr = CSR_INEA(s); | 794 | isr = CSR_INEA(s); |
795 | s->csr[0] |= 0x0080; | 795 | s->csr[0] |= 0x0080; |
796 | } | 796 | } |
797 | - | 797 | + |
798 | if (!!(s->csr[4] & 0x0080) && CSR_INEA(s)) { /* UINT */ | 798 | if (!!(s->csr[4] & 0x0080) && CSR_INEA(s)) { /* UINT */ |
799 | s->csr[4] &= ~0x0080; | 799 | s->csr[4] &= ~0x0080; |
800 | s->csr[4] |= 0x0040; | 800 | s->csr[4] |= 0x0040; |
@@ -834,7 +834,7 @@ static void pcnet_init(PCNetState *s) | @@ -834,7 +834,7 @@ static void pcnet_init(PCNetState *s) | ||
834 | #ifdef PCNET_DEBUG | 834 | #ifdef PCNET_DEBUG |
835 | printf("pcnet_init init_addr=0x%08x\n", PHYSADDR(s,CSR_IADR(s))); | 835 | printf("pcnet_init init_addr=0x%08x\n", PHYSADDR(s,CSR_IADR(s))); |
836 | #endif | 836 | #endif |
837 | - | 837 | + |
838 | if (BCR_SSIZE32(s)) { | 838 | if (BCR_SSIZE32(s)) { |
839 | struct pcnet_initblk32 initblk; | 839 | struct pcnet_initblk32 initblk; |
840 | s->phys_mem_read(s->dma_opaque, PHYSADDR(s,CSR_IADR(s)), | 840 | s->phys_mem_read(s->dma_opaque, PHYSADDR(s,CSR_IADR(s)), |
@@ -898,7 +898,7 @@ static void pcnet_init(PCNetState *s) | @@ -898,7 +898,7 @@ static void pcnet_init(PCNetState *s) | ||
898 | s->rdra, CSR_RCVRL(s), s->tdra, CSR_XMTRL(s)); | 898 | s->rdra, CSR_RCVRL(s), s->tdra, CSR_XMTRL(s)); |
899 | #endif | 899 | #endif |
900 | 900 | ||
901 | - s->csr[0] |= 0x0101; | 901 | + s->csr[0] |= 0x0101; |
902 | s->csr[0] &= ~0x0004; /* clear STOP bit */ | 902 | s->csr[0] &= ~0x0004; /* clear STOP bit */ |
903 | } | 903 | } |
904 | 904 | ||
@@ -910,7 +910,7 @@ static void pcnet_start(PCNetState *s) | @@ -910,7 +910,7 @@ static void pcnet_start(PCNetState *s) | ||
910 | 910 | ||
911 | if (!CSR_DTX(s)) | 911 | if (!CSR_DTX(s)) |
912 | s->csr[0] |= 0x0010; /* set TXON */ | 912 | s->csr[0] |= 0x0010; /* set TXON */ |
913 | - | 913 | + |
914 | if (!CSR_DRX(s)) | 914 | if (!CSR_DRX(s)) |
915 | s->csr[0] |= 0x0020; /* set RXON */ | 915 | s->csr[0] |= 0x0020; /* set RXON */ |
916 | 916 | ||
@@ -976,7 +976,7 @@ static void pcnet_rdte_poll(PCNetState *s) | @@ -976,7 +976,7 @@ static void pcnet_rdte_poll(PCNetState *s) | ||
976 | #endif | 976 | #endif |
977 | } | 977 | } |
978 | } | 978 | } |
979 | - | 979 | + |
980 | if (CSR_CRDA(s)) { | 980 | if (CSR_CRDA(s)) { |
981 | struct pcnet_RMD rmd; | 981 | struct pcnet_RMD rmd; |
982 | RMDLOAD(&rmd, PHYSADDR(s,CSR_CRDA(s))); | 982 | RMDLOAD(&rmd, PHYSADDR(s,CSR_CRDA(s))); |
@@ -991,7 +991,7 @@ static void pcnet_rdte_poll(PCNetState *s) | @@ -991,7 +991,7 @@ static void pcnet_rdte_poll(PCNetState *s) | ||
991 | } else { | 991 | } else { |
992 | CSR_CRBC(s) = CSR_CRST(s) = 0; | 992 | CSR_CRBC(s) = CSR_CRST(s) = 0; |
993 | } | 993 | } |
994 | - | 994 | + |
995 | if (CSR_NRDA(s)) { | 995 | if (CSR_NRDA(s)) { |
996 | struct pcnet_RMD rmd; | 996 | struct pcnet_RMD rmd; |
997 | RMDLOAD(&rmd, PHYSADDR(s,CSR_NRDA(s))); | 997 | RMDLOAD(&rmd, PHYSADDR(s,CSR_NRDA(s))); |
@@ -1030,14 +1030,14 @@ static int pcnet_tdte_poll(PCNetState *s) | @@ -1030,14 +1030,14 @@ static int pcnet_tdte_poll(PCNetState *s) | ||
1030 | if (CSR_CXDA(s)) { | 1030 | if (CSR_CXDA(s)) { |
1031 | struct pcnet_TMD tmd; | 1031 | struct pcnet_TMD tmd; |
1032 | 1032 | ||
1033 | - TMDLOAD(&tmd, PHYSADDR(s,CSR_CXDA(s))); | 1033 | + TMDLOAD(&tmd, PHYSADDR(s,CSR_CXDA(s))); |
1034 | 1034 | ||
1035 | CSR_CXBC(s) = GET_FIELD(tmd.length, TMDL, BCNT); | 1035 | CSR_CXBC(s) = GET_FIELD(tmd.length, TMDL, BCNT); |
1036 | CSR_CXST(s) = tmd.status; | 1036 | CSR_CXST(s) = tmd.status; |
1037 | } else { | 1037 | } else { |
1038 | CSR_CXBC(s) = CSR_CXST(s) = 0; | 1038 | CSR_CXBC(s) = CSR_CXST(s) = 0; |
1039 | } | 1039 | } |
1040 | - | 1040 | + |
1041 | return !!(CSR_CXST(s) & 0x8000); | 1041 | return !!(CSR_CXST(s) & 0x8000); |
1042 | } | 1042 | } |
1043 | 1043 | ||
@@ -1046,7 +1046,7 @@ static int pcnet_can_receive(void *opaque) | @@ -1046,7 +1046,7 @@ static int pcnet_can_receive(void *opaque) | ||
1046 | PCNetState *s = opaque; | 1046 | PCNetState *s = opaque; |
1047 | if (CSR_STOP(s) || CSR_SPND(s)) | 1047 | if (CSR_STOP(s) || CSR_SPND(s)) |
1048 | return 0; | 1048 | return 0; |
1049 | - | 1049 | + |
1050 | if (s->recv_pos > 0) | 1050 | if (s->recv_pos > 0) |
1051 | return 0; | 1051 | return 0; |
1052 | 1052 | ||
@@ -1093,7 +1093,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size) | @@ -1093,7 +1093,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size) | ||
1093 | nrda = s->rdra + | 1093 | nrda = s->rdra + |
1094 | (CSR_RCVRL(s) - rcvrc) * | 1094 | (CSR_RCVRL(s) - rcvrc) * |
1095 | (BCR_SWSTYLE(s) ? 16 : 8 ); | 1095 | (BCR_SWSTYLE(s) ? 16 : 8 ); |
1096 | - RMDLOAD(&rmd, PHYSADDR(s,nrda)); | 1096 | + RMDLOAD(&rmd, PHYSADDR(s,nrda)); |
1097 | if (GET_FIELD(rmd.status, RMDS, OWN)) { | 1097 | if (GET_FIELD(rmd.status, RMDS, OWN)) { |
1098 | #ifdef PCNET_DEBUG_RMD | 1098 | #ifdef PCNET_DEBUG_RMD |
1099 | printf("pcnet - scan buffer: RCVRC=%d PREV_RCVRC=%d\n", | 1099 | printf("pcnet - scan buffer: RCVRC=%d PREV_RCVRC=%d\n", |
@@ -1119,7 +1119,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size) | @@ -1119,7 +1119,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size) | ||
1119 | int pktcount = 0; | 1119 | int pktcount = 0; |
1120 | 1120 | ||
1121 | memcpy(src, buf, size); | 1121 | memcpy(src, buf, size); |
1122 | - | 1122 | + |
1123 | #if 1 | 1123 | #if 1 |
1124 | /* no need to compute the CRC */ | 1124 | /* no need to compute the CRC */ |
1125 | src[size] = 0; | 1125 | src[size] = 0; |
@@ -1136,7 +1136,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size) | @@ -1136,7 +1136,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size) | ||
1136 | while (size < 46) { | 1136 | while (size < 46) { |
1137 | src[size++] = 0; | 1137 | src[size++] = 0; |
1138 | } | 1138 | } |
1139 | - | 1139 | + |
1140 | while (p != &src[size]) { | 1140 | while (p != &src[size]) { |
1141 | CRC(fcs, *p++); | 1141 | CRC(fcs, *p++); |
1142 | } | 1142 | } |
@@ -1178,7 +1178,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size) | @@ -1178,7 +1178,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size) | ||
1178 | PCNET_RECV_STORE(); | 1178 | PCNET_RECV_STORE(); |
1179 | } | 1179 | } |
1180 | } | 1180 | } |
1181 | - } | 1181 | + } |
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | #undef PCNET_RECV_STORE | 1184 | #undef PCNET_RECV_STORE |
@@ -1203,22 +1203,22 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size) | @@ -1203,22 +1203,22 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size) | ||
1203 | #endif | 1203 | #endif |
1204 | #ifdef PCNET_DEBUG_RMD | 1204 | #ifdef PCNET_DEBUG_RMD |
1205 | PRINT_RMD(&rmd); | 1205 | PRINT_RMD(&rmd); |
1206 | -#endif | 1206 | +#endif |
1207 | 1207 | ||
1208 | while (pktcount--) { | 1208 | while (pktcount--) { |
1209 | if (CSR_RCVRC(s) <= 1) | 1209 | if (CSR_RCVRC(s) <= 1) |
1210 | CSR_RCVRC(s) = CSR_RCVRL(s); | 1210 | CSR_RCVRC(s) = CSR_RCVRL(s); |
1211 | else | 1211 | else |
1212 | - CSR_RCVRC(s)--; | 1212 | + CSR_RCVRC(s)--; |
1213 | } | 1213 | } |
1214 | - | 1214 | + |
1215 | pcnet_rdte_poll(s); | 1215 | pcnet_rdte_poll(s); |
1216 | 1216 | ||
1217 | - } | 1217 | + } |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | pcnet_poll(s); | 1220 | pcnet_poll(s); |
1221 | - pcnet_update_irq(s); | 1221 | + pcnet_update_irq(s); |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | static void pcnet_transmit(PCNetState *s) | 1224 | static void pcnet_transmit(PCNetState *s) |
@@ -1226,7 +1226,7 @@ static void pcnet_transmit(PCNetState *s) | @@ -1226,7 +1226,7 @@ static void pcnet_transmit(PCNetState *s) | ||
1226 | target_phys_addr_t xmit_cxda = 0; | 1226 | target_phys_addr_t xmit_cxda = 0; |
1227 | int count = CSR_XMTRL(s)-1; | 1227 | int count = CSR_XMTRL(s)-1; |
1228 | s->xmit_pos = -1; | 1228 | s->xmit_pos = -1; |
1229 | - | 1229 | + |
1230 | if (!CSR_TXON(s)) { | 1230 | if (!CSR_TXON(s)) { |
1231 | s->csr[0] &= ~0x0008; | 1231 | s->csr[0] &= ~0x0008; |
1232 | return; | 1232 | return; |
@@ -1332,7 +1332,7 @@ static void pcnet_poll_timer(void *opaque) | @@ -1332,7 +1332,7 @@ static void pcnet_poll_timer(void *opaque) | ||
1332 | pcnet_transmit(s); | 1332 | pcnet_transmit(s); |
1333 | } | 1333 | } |
1334 | 1334 | ||
1335 | - pcnet_update_irq(s); | 1335 | + pcnet_update_irq(s); |
1336 | 1336 | ||
1337 | if (!CSR_STOP(s) && !CSR_SPND(s) && !CSR_DPOLL(s)) { | 1337 | if (!CSR_STOP(s) && !CSR_SPND(s) && !CSR_DPOLL(s)) { |
1338 | uint64_t now = qemu_get_clock(vm_clock) * 33; | 1338 | uint64_t now = qemu_get_clock(vm_clock) * 33; |
@@ -1592,11 +1592,11 @@ static void pcnet_aprom_writeb(void *opaque, uint32_t addr, uint32_t val) | @@ -1592,11 +1592,11 @@ static void pcnet_aprom_writeb(void *opaque, uint32_t addr, uint32_t val) | ||
1592 | PCNetState *s = opaque; | 1592 | PCNetState *s = opaque; |
1593 | #ifdef PCNET_DEBUG | 1593 | #ifdef PCNET_DEBUG |
1594 | printf("pcnet_aprom_writeb addr=0x%08x val=0x%02x\n", addr, val); | 1594 | printf("pcnet_aprom_writeb addr=0x%08x val=0x%02x\n", addr, val); |
1595 | -#endif | 1595 | +#endif |
1596 | /* Check APROMWE bit to enable write access */ | 1596 | /* Check APROMWE bit to enable write access */ |
1597 | if (pcnet_bcr_readw(s,2) & 0x80) | 1597 | if (pcnet_bcr_readw(s,2) & 0x80) |
1598 | s->prom[addr & 15] = val; | 1598 | s->prom[addr & 15] = val; |
1599 | -} | 1599 | +} |
1600 | 1600 | ||
1601 | static uint32_t pcnet_aprom_readb(void *opaque, uint32_t addr) | 1601 | static uint32_t pcnet_aprom_readb(void *opaque, uint32_t addr) |
1602 | { | 1602 | { |
@@ -1685,7 +1685,7 @@ static void pcnet_ioport_writel(void *opaque, uint32_t addr, uint32_t val) | @@ -1685,7 +1685,7 @@ static void pcnet_ioport_writel(void *opaque, uint32_t addr, uint32_t val) | ||
1685 | pcnet_bcr_writew(s, BCR_BSBC, pcnet_bcr_readw(s, BCR_BSBC) | 0x0080); | 1685 | pcnet_bcr_writew(s, BCR_BSBC, pcnet_bcr_readw(s, BCR_BSBC) | 0x0080); |
1686 | #ifdef PCNET_DEBUG_IO | 1686 | #ifdef PCNET_DEBUG_IO |
1687 | printf("device switched into dword i/o mode\n"); | 1687 | printf("device switched into dword i/o mode\n"); |
1688 | -#endif | 1688 | +#endif |
1689 | } | 1689 | } |
1690 | pcnet_update_irq(s); | 1690 | pcnet_update_irq(s); |
1691 | } | 1691 | } |
@@ -1695,7 +1695,7 @@ static uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr) | @@ -1695,7 +1695,7 @@ static uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr) | ||
1695 | PCNetState *s = opaque; | 1695 | PCNetState *s = opaque; |
1696 | uint32_t val = -1; | 1696 | uint32_t val = -1; |
1697 | pcnet_poll_timer(s); | 1697 | pcnet_poll_timer(s); |
1698 | - if (BCR_DWIO(s)) { | 1698 | + if (BCR_DWIO(s)) { |
1699 | switch (addr & 0x0f) { | 1699 | switch (addr & 0x0f) { |
1700 | case 0x00: /* RDP */ | 1700 | case 0x00: /* RDP */ |
1701 | val = pcnet_csr_readw(s, s->rap); | 1701 | val = pcnet_csr_readw(s, s->rap); |
@@ -1730,7 +1730,7 @@ static void pcnet_ioport_map(PCIDevice *pci_dev, int region_num, | @@ -1730,7 +1730,7 @@ static void pcnet_ioport_map(PCIDevice *pci_dev, int region_num, | ||
1730 | 1730 | ||
1731 | register_ioport_write(addr, 16, 1, pcnet_aprom_writeb, d); | 1731 | register_ioport_write(addr, 16, 1, pcnet_aprom_writeb, d); |
1732 | register_ioport_read(addr, 16, 1, pcnet_aprom_readb, d); | 1732 | register_ioport_read(addr, 16, 1, pcnet_aprom_readb, d); |
1733 | - | 1733 | + |
1734 | register_ioport_write(addr + 0x10, 0x10, 2, pcnet_ioport_writew, d); | 1734 | register_ioport_write(addr + 0x10, 0x10, 2, pcnet_ioport_writew, d); |
1735 | register_ioport_read(addr + 0x10, 0x10, 2, pcnet_ioport_readw, d); | 1735 | register_ioport_read(addr + 0x10, 0x10, 2, pcnet_ioport_readw, d); |
1736 | register_ioport_write(addr + 0x10, 0x10, 4, pcnet_ioport_writel, d); | 1736 | register_ioport_write(addr + 0x10, 0x10, 4, pcnet_ioport_writel, d); |
@@ -1967,11 +1967,11 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -1967,11 +1967,11 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
1967 | 1967 | ||
1968 | d = (PCNetState *)pci_register_device(bus, "PCNet", sizeof(PCNetState), | 1968 | d = (PCNetState *)pci_register_device(bus, "PCNet", sizeof(PCNetState), |
1969 | devfn, NULL, NULL); | 1969 | devfn, NULL, NULL); |
1970 | - | 1970 | + |
1971 | pci_conf = d->dev.config; | 1971 | pci_conf = d->dev.config; |
1972 | - | 1972 | + |
1973 | *(uint16_t *)&pci_conf[0x00] = cpu_to_le16(0x1022); | 1973 | *(uint16_t *)&pci_conf[0x00] = cpu_to_le16(0x1022); |
1974 | - *(uint16_t *)&pci_conf[0x02] = cpu_to_le16(0x2000); | 1974 | + *(uint16_t *)&pci_conf[0x02] = cpu_to_le16(0x2000); |
1975 | *(uint16_t *)&pci_conf[0x04] = cpu_to_le16(0x0007); | 1975 | *(uint16_t *)&pci_conf[0x04] = cpu_to_le16(0x0007); |
1976 | *(uint16_t *)&pci_conf[0x06] = cpu_to_le16(0x0280); | 1976 | *(uint16_t *)&pci_conf[0x06] = cpu_to_le16(0x0280); |
1977 | pci_conf[0x08] = 0x10; | 1977 | pci_conf[0x08] = 0x10; |
@@ -1979,10 +1979,10 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -1979,10 +1979,10 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
1979 | pci_conf[0x0a] = 0x00; // ethernet network controller | 1979 | pci_conf[0x0a] = 0x00; // ethernet network controller |
1980 | pci_conf[0x0b] = 0x02; | 1980 | pci_conf[0x0b] = 0x02; |
1981 | pci_conf[0x0e] = 0x00; // header_type | 1981 | pci_conf[0x0e] = 0x00; // header_type |
1982 | - | 1982 | + |
1983 | *(uint32_t *)&pci_conf[0x10] = cpu_to_le32(0x00000001); | 1983 | *(uint32_t *)&pci_conf[0x10] = cpu_to_le32(0x00000001); |
1984 | *(uint32_t *)&pci_conf[0x14] = cpu_to_le32(0x00000000); | 1984 | *(uint32_t *)&pci_conf[0x14] = cpu_to_le32(0x00000000); |
1985 | - | 1985 | + |
1986 | pci_conf[0x3d] = 1; // interrupt pin 0 | 1986 | pci_conf[0x3d] = 1; // interrupt pin 0 |
1987 | pci_conf[0x3e] = 0x06; | 1987 | pci_conf[0x3e] = 0x06; |
1988 | pci_conf[0x3f] = 0xff; | 1988 | pci_conf[0x3f] = 0xff; |
@@ -1993,10 +1993,10 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -1993,10 +1993,10 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
1993 | 1993 | ||
1994 | pci_register_io_region((PCIDevice *)d, 0, PCNET_IOPORT_SIZE, | 1994 | pci_register_io_region((PCIDevice *)d, 0, PCNET_IOPORT_SIZE, |
1995 | PCI_ADDRESS_SPACE_IO, pcnet_ioport_map); | 1995 | PCI_ADDRESS_SPACE_IO, pcnet_ioport_map); |
1996 | - | 1996 | + |
1997 | pci_register_io_region((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE, | 1997 | pci_register_io_region((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE, |
1998 | PCI_ADDRESS_SPACE_MEM, pcnet_mmio_map); | 1998 | PCI_ADDRESS_SPACE_MEM, pcnet_mmio_map); |
1999 | - | 1999 | + |
2000 | d->irq = d->dev.irq[0]; | 2000 | d->irq = d->dev.irq[0]; |
2001 | d->phys_mem_read = pci_physical_memory_read; | 2001 | d->phys_mem_read = pci_physical_memory_read; |
2002 | d->phys_mem_write = pci_physical_memory_write; | 2002 | d->phys_mem_write = pci_physical_memory_write; |
hw/pflash_cfi02.c
@@ -222,7 +222,7 @@ static void pflash_write (pflash_t *pfl, uint32_t offset, uint32_t value, | @@ -222,7 +222,7 @@ static void pflash_write (pflash_t *pfl, uint32_t offset, uint32_t value, | ||
222 | offset -= (uint32_t)(long)pfl->storage; | 222 | offset -= (uint32_t)(long)pfl->storage; |
223 | else | 223 | else |
224 | offset -= pfl->base; | 224 | offset -= pfl->base; |
225 | - | 225 | + |
226 | DPRINTF("%s: offset " TARGET_FMT_lx " %08x %d\n", __func__, | 226 | DPRINTF("%s: offset " TARGET_FMT_lx " %08x %d\n", __func__, |
227 | offset, value, width); | 227 | offset, value, width); |
228 | /* Set the device in I/O access mode */ | 228 | /* Set the device in I/O access mode */ |
hw/pl011.c
@@ -44,7 +44,7 @@ static const unsigned char pl011_id[] = | @@ -44,7 +44,7 @@ static const unsigned char pl011_id[] = | ||
44 | static void pl011_update(pl011_state *s) | 44 | static void pl011_update(pl011_state *s) |
45 | { | 45 | { |
46 | uint32_t flags; | 46 | uint32_t flags; |
47 | - | 47 | + |
48 | flags = s->int_level & s->int_enabled; | 48 | flags = s->int_level & s->int_enabled; |
49 | qemu_set_irq(s->irq, flags != 0); | 49 | qemu_set_irq(s->irq, flags != 0); |
50 | } | 50 | } |
hw/pl110.c
@@ -117,7 +117,7 @@ static void pl110_update_display(void *opaque) | @@ -117,7 +117,7 @@ static void pl110_update_display(void *opaque) | ||
117 | 117 | ||
118 | if (!pl110_enabled(s)) | 118 | if (!pl110_enabled(s)) |
119 | return; | 119 | return; |
120 | - | 120 | + |
121 | switch (s->ds->depth) { | 121 | switch (s->ds->depth) { |
122 | case 0: | 122 | case 0: |
123 | return; | 123 | return; |
@@ -151,7 +151,7 @@ static void pl110_update_display(void *opaque) | @@ -151,7 +151,7 @@ static void pl110_update_display(void *opaque) | ||
151 | fn = fntable[s->bpp + 12]; | 151 | fn = fntable[s->bpp + 12]; |
152 | else | 152 | else |
153 | fn = fntable[s->bpp]; | 153 | fn = fntable[s->bpp]; |
154 | - | 154 | + |
155 | src_width = s->cols; | 155 | src_width = s->cols; |
156 | switch (s->bpp) { | 156 | switch (s->bpp) { |
157 | case BPP_1: | 157 | case BPP_1: |
hw/pl181.c
@@ -177,7 +177,7 @@ error: | @@ -177,7 +177,7 @@ error: | ||
177 | /* Transfer data between the card and the FIFO. This is complicated by | 177 | /* Transfer data between the card and the FIFO. This is complicated by |
178 | the FIFO holding 32-bit words and the card taking data in single byte | 178 | the FIFO holding 32-bit words and the card taking data in single byte |
179 | chunks. FIFO bytes are transferred in little-endian order. */ | 179 | chunks. FIFO bytes are transferred in little-endian order. */ |
180 | - | 180 | + |
181 | static void pl181_fifo_run(pl181_state *s) | 181 | static void pl181_fifo_run(pl181_state *s) |
182 | { | 182 | { |
183 | uint32_t bits; | 183 | uint32_t bits; |
hw/ppc.c
@@ -623,7 +623,7 @@ struct ppcemb_timer_t { | @@ -623,7 +623,7 @@ struct ppcemb_timer_t { | ||
623 | uint64_t wdt_next; /* Tick for next WDT interrupt */ | 623 | uint64_t wdt_next; /* Tick for next WDT interrupt */ |
624 | struct QEMUTimer *wdt_timer; | 624 | struct QEMUTimer *wdt_timer; |
625 | }; | 625 | }; |
626 | - | 626 | + |
627 | /* Fixed interval timer */ | 627 | /* Fixed interval timer */ |
628 | static void cpu_4xx_fit_cb (void *opaque) | 628 | static void cpu_4xx_fit_cb (void *opaque) |
629 | { | 629 | { |
hw/ppc405_boards.c
@@ -511,7 +511,7 @@ static void taihu_405ep_init(int ram_size, int vga_ram_size, int boot_device, | @@ -511,7 +511,7 @@ static void taihu_405ep_init(int ram_size, int vga_ram_size, int boot_device, | ||
511 | target_ulong kernel_base, kernel_size, initrd_base, initrd_size; | 511 | target_ulong kernel_base, kernel_size, initrd_base, initrd_size; |
512 | int linux_boot; | 512 | int linux_boot; |
513 | int fl_idx, fl_sectors; | 513 | int fl_idx, fl_sectors; |
514 | - | 514 | + |
515 | /* RAM is soldered to the board so the size cannot be changed */ | 515 | /* RAM is soldered to the board so the size cannot be changed */ |
516 | ram_bases[0] = 0x00000000; | 516 | ram_bases[0] = 0x00000000; |
517 | ram_sizes[0] = 0x04000000; | 517 | ram_sizes[0] = 0x04000000; |
hw/ppc405_uc.c
@@ -2212,7 +2212,7 @@ static void ppc4xx_gpt_set_outputs (ppc4xx_gpt_t *gpt) | @@ -2212,7 +2212,7 @@ static void ppc4xx_gpt_set_outputs (ppc4xx_gpt_t *gpt) | ||
2212 | } | 2212 | } |
2213 | mask = mask >> 1; | 2213 | mask = mask >> 1; |
2214 | } | 2214 | } |
2215 | - | 2215 | + |
2216 | } | 2216 | } |
2217 | 2217 | ||
2218 | static void ppc4xx_gpt_set_irqs (ppc4xx_gpt_t *gpt) | 2218 | static void ppc4xx_gpt_set_irqs (ppc4xx_gpt_t *gpt) |
@@ -2228,7 +2228,7 @@ static void ppc4xx_gpt_set_irqs (ppc4xx_gpt_t *gpt) | @@ -2228,7 +2228,7 @@ static void ppc4xx_gpt_set_irqs (ppc4xx_gpt_t *gpt) | ||
2228 | qemu_irq_lower(gpt->irqs[i]); | 2228 | qemu_irq_lower(gpt->irqs[i]); |
2229 | mask = mask >> 1; | 2229 | mask = mask >> 1; |
2230 | } | 2230 | } |
2231 | - | 2231 | + |
2232 | } | 2232 | } |
2233 | 2233 | ||
2234 | static void ppc4xx_gpt_compute_timer (ppc4xx_gpt_t *gpt) | 2234 | static void ppc4xx_gpt_compute_timer (ppc4xx_gpt_t *gpt) |
hw/ppc_chrp.c
@@ -173,7 +173,7 @@ static void macio_init(PCIBus *bus, int device_id) | @@ -173,7 +173,7 @@ static void macio_init(PCIBus *bus, int device_id) | ||
173 | d->config[0x0e] = 0x00; // header_type | 173 | d->config[0x0e] = 0x00; // header_type |
174 | 174 | ||
175 | d->config[0x3d] = 0x01; // interrupt on pin 1 | 175 | d->config[0x3d] = 0x01; // interrupt on pin 1 |
176 | - | 176 | + |
177 | dbdma_mem_index = cpu_register_io_memory(0, dbdma_read, dbdma_write, NULL); | 177 | dbdma_mem_index = cpu_register_io_memory(0, dbdma_read, dbdma_write, NULL); |
178 | 178 | ||
179 | pci_register_io_region(d, 0, 0x80000, | 179 | pci_register_io_region(d, 0, 0x80000, |
@@ -208,7 +208,7 @@ static int vga_osi_call(CPUState *env) | @@ -208,7 +208,7 @@ static int vga_osi_call(CPUState *env) | ||
208 | { | 208 | { |
209 | static int vga_vbl_enabled; | 209 | static int vga_vbl_enabled; |
210 | int linesize; | 210 | int linesize; |
211 | - | 211 | + |
212 | // printf("osi_call R5=%d\n", env->gpr[5]); | 212 | // printf("osi_call R5=%d\n", env->gpr[5]); |
213 | 213 | ||
214 | /* same handler as PearPC, coming from the original MOL video | 214 | /* same handler as PearPC, coming from the original MOL video |
@@ -280,14 +280,14 @@ static uint8_t nvram_chksum(const uint8_t *buf, int n) | @@ -280,14 +280,14 @@ static uint8_t nvram_chksum(const uint8_t *buf, int n) | ||
280 | void pmac_format_nvram_partition(uint8_t *buf, int len) | 280 | void pmac_format_nvram_partition(uint8_t *buf, int len) |
281 | { | 281 | { |
282 | char partition_name[12] = "wwwwwwwwwwww"; | 282 | char partition_name[12] = "wwwwwwwwwwww"; |
283 | - | 283 | + |
284 | buf[0] = 0x7f; /* free partition magic */ | 284 | buf[0] = 0x7f; /* free partition magic */ |
285 | buf[1] = 0; /* checksum */ | 285 | buf[1] = 0; /* checksum */ |
286 | buf[2] = len >> 8; | 286 | buf[2] = len >> 8; |
287 | buf[3] = len; | 287 | buf[3] = len; |
288 | memcpy(buf + 4, partition_name, 12); | 288 | memcpy(buf + 4, partition_name, 12); |
289 | buf[1] = nvram_chksum(buf, 16); | 289 | buf[1] = nvram_chksum(buf, 16); |
290 | -} | 290 | +} |
291 | 291 | ||
292 | /* PowerPC CHRP hardware initialisation */ | 292 | /* PowerPC CHRP hardware initialisation */ |
293 | static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, | 293 | static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, |
@@ -355,7 +355,7 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, | @@ -355,7 +355,7 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, | ||
355 | bios_size = (bios_size + 0xfff) & ~0xfff; | 355 | bios_size = (bios_size + 0xfff) & ~0xfff; |
356 | cpu_register_physical_memory((uint32_t)(-bios_size), | 356 | cpu_register_physical_memory((uint32_t)(-bios_size), |
357 | bios_size, bios_offset | IO_MEM_ROM); | 357 | bios_size, bios_offset | IO_MEM_ROM); |
358 | - | 358 | + |
359 | /* allocate and load VGA BIOS */ | 359 | /* allocate and load VGA BIOS */ |
360 | vga_bios_offset = bios_offset + bios_size; | 360 | vga_bios_offset = bios_offset + bios_size; |
361 | snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); | 361 | snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); |
@@ -376,7 +376,7 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, | @@ -376,7 +376,7 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, | ||
376 | vga_bios_size += 8; | 376 | vga_bios_size += 8; |
377 | } | 377 | } |
378 | vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff; | 378 | vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff; |
379 | - | 379 | + |
380 | if (linux_boot) { | 380 | if (linux_boot) { |
381 | kernel_base = KERNEL_LOAD_ADDR; | 381 | kernel_base = KERNEL_LOAD_ADDR; |
382 | /* now we can load the kernel */ | 382 | /* now we can load the kernel */ |
@@ -427,24 +427,24 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, | @@ -427,24 +427,24 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, | ||
427 | 427 | ||
428 | /* XXX: suppress that */ | 428 | /* XXX: suppress that */ |
429 | dummy_irq = i8259_init(NULL); | 429 | dummy_irq = i8259_init(NULL); |
430 | - | 430 | + |
431 | /* XXX: use Mac Serial port */ | 431 | /* XXX: use Mac Serial port */ |
432 | serial_init(0x3f8, dummy_irq[4], serial_hds[0]); | 432 | serial_init(0x3f8, dummy_irq[4], serial_hds[0]); |
433 | - | 433 | + |
434 | for(i = 0; i < nb_nics; i++) { | 434 | for(i = 0; i < nb_nics; i++) { |
435 | if (!nd_table[i].model) | 435 | if (!nd_table[i].model) |
436 | nd_table[i].model = "ne2k_pci"; | 436 | nd_table[i].model = "ne2k_pci"; |
437 | pci_nic_init(pci_bus, &nd_table[i], -1); | 437 | pci_nic_init(pci_bus, &nd_table[i], -1); |
438 | } | 438 | } |
439 | - | 439 | + |
440 | pci_cmd646_ide_init(pci_bus, &bs_table[0], 0); | 440 | pci_cmd646_ide_init(pci_bus, &bs_table[0], 0); |
441 | 441 | ||
442 | /* cuda also initialize ADB */ | 442 | /* cuda also initialize ADB */ |
443 | cuda_mem_index = cuda_init(pic[0x12]); | 443 | cuda_mem_index = cuda_init(pic[0x12]); |
444 | - | 444 | + |
445 | adb_kbd_init(&adb_bus); | 445 | adb_kbd_init(&adb_bus); |
446 | adb_mouse_init(&adb_bus); | 446 | adb_mouse_init(&adb_bus); |
447 | - | 447 | + |
448 | { | 448 | { |
449 | MacIONVRAMState *nvr; | 449 | MacIONVRAMState *nvr; |
450 | nvr = macio_nvram_init(); | 450 | nvr = macio_nvram_init(); |
@@ -534,14 +534,14 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, | @@ -534,14 +534,14 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, | ||
534 | #endif | 534 | #endif |
535 | /* cuda also initialize ADB */ | 535 | /* cuda also initialize ADB */ |
536 | cuda_mem_index = cuda_init(pic[0x19]); | 536 | cuda_mem_index = cuda_init(pic[0x19]); |
537 | - | 537 | + |
538 | adb_kbd_init(&adb_bus); | 538 | adb_kbd_init(&adb_bus); |
539 | adb_mouse_init(&adb_bus); | 539 | adb_mouse_init(&adb_bus); |
540 | - | 540 | + |
541 | macio_init(pci_bus, 0x0022); | 541 | macio_init(pci_bus, 0x0022); |
542 | - | 542 | + |
543 | nvram = m48t59_init(dummy_irq[8], 0xFFF04000, 0x0074, NVRAM_SIZE, 59); | 543 | nvram = m48t59_init(dummy_irq[8], 0xFFF04000, 0x0074, NVRAM_SIZE, 59); |
544 | - | 544 | + |
545 | arch_name = "MAC99"; | 545 | arch_name = "MAC99"; |
546 | } | 546 | } |
547 | 547 | ||
@@ -578,7 +578,7 @@ static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device, | @@ -578,7 +578,7 @@ static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device, | ||
578 | kernel_filename, kernel_cmdline, | 578 | kernel_filename, kernel_cmdline, |
579 | initrd_filename, cpu_model, 0); | 579 | initrd_filename, cpu_model, 0); |
580 | } | 580 | } |
581 | - | 581 | + |
582 | static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device, | 582 | static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device, |
583 | DisplayState *ds, const char **fd_filename, | 583 | DisplayState *ds, const char **fd_filename, |
584 | int snapshot, | 584 | int snapshot, |
hw/ps2.c
@@ -146,7 +146,7 @@ uint32_t ps2_read_data(void *opaque) | @@ -146,7 +146,7 @@ uint32_t ps2_read_data(void *opaque) | ||
146 | PS2State *s = (PS2State *)opaque; | 146 | PS2State *s = (PS2State *)opaque; |
147 | PS2Queue *q; | 147 | PS2Queue *q; |
148 | int val, index; | 148 | int val, index; |
149 | - | 149 | + |
150 | q = &s->queue; | 150 | q = &s->queue; |
151 | if (q->count == 0) { | 151 | if (q->count == 0) { |
152 | /* NOTE: if no data left, we return the last keyboard one | 152 | /* NOTE: if no data left, we return the last keyboard one |
@@ -311,7 +311,7 @@ static void ps2_mouse_event(void *opaque, | @@ -311,7 +311,7 @@ static void ps2_mouse_event(void *opaque, | ||
311 | s->mouse_buttons == buttons_state) | 311 | s->mouse_buttons == buttons_state) |
312 | return; | 312 | return; |
313 | s->mouse_buttons = buttons_state; | 313 | s->mouse_buttons = buttons_state; |
314 | - | 314 | + |
315 | if (!(s->mouse_status & MOUSE_STATUS_REMOTE) && | 315 | if (!(s->mouse_status & MOUSE_STATUS_REMOTE) && |
316 | (s->common.queue.count < (PS2_QUEUE_SIZE - 16))) { | 316 | (s->common.queue.count < (PS2_QUEUE_SIZE - 16))) { |
317 | for(;;) { | 317 | for(;;) { |
hw/rtl8139.c
@@ -890,10 +890,10 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d | @@ -890,10 +890,10 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d | ||
890 | ++s->tally_counters.RxOkMul; | 890 | ++s->tally_counters.RxOkMul; |
891 | 891 | ||
892 | } else if (s->phys[0] == buf[0] && | 892 | } else if (s->phys[0] == buf[0] && |
893 | - s->phys[1] == buf[1] && | ||
894 | - s->phys[2] == buf[2] && | ||
895 | - s->phys[3] == buf[3] && | ||
896 | - s->phys[4] == buf[4] && | 893 | + s->phys[1] == buf[1] && |
894 | + s->phys[2] == buf[2] && | ||
895 | + s->phys[3] == buf[3] && | ||
896 | + s->phys[4] == buf[4] && | ||
897 | s->phys[5] == buf[5]) { | 897 | s->phys[5] == buf[5]) { |
898 | /* match */ | 898 | /* match */ |
899 | if (!(s->RxConfig & AcceptMyPhys)) | 899 | if (!(s->RxConfig & AcceptMyPhys)) |
@@ -2420,17 +2420,17 @@ static uint16_t rtl8139_TSAD_read(RTL8139State *s) | @@ -2420,17 +2420,17 @@ static uint16_t rtl8139_TSAD_read(RTL8139State *s) | ||
2420 | |((s->TxStatus[2] & TxUnderrun)?TSAD_TUN2:0) | 2420 | |((s->TxStatus[2] & TxUnderrun)?TSAD_TUN2:0) |
2421 | |((s->TxStatus[1] & TxUnderrun)?TSAD_TUN1:0) | 2421 | |((s->TxStatus[1] & TxUnderrun)?TSAD_TUN1:0) |
2422 | |((s->TxStatus[0] & TxUnderrun)?TSAD_TUN0:0) | 2422 | |((s->TxStatus[0] & TxUnderrun)?TSAD_TUN0:0) |
2423 | - | 2423 | + |
2424 | |((s->TxStatus[3] & TxAborted )?TSAD_TABT3:0) | 2424 | |((s->TxStatus[3] & TxAborted )?TSAD_TABT3:0) |
2425 | |((s->TxStatus[2] & TxAborted )?TSAD_TABT2:0) | 2425 | |((s->TxStatus[2] & TxAborted )?TSAD_TABT2:0) |
2426 | |((s->TxStatus[1] & TxAborted )?TSAD_TABT1:0) | 2426 | |((s->TxStatus[1] & TxAborted )?TSAD_TABT1:0) |
2427 | |((s->TxStatus[0] & TxAborted )?TSAD_TABT0:0) | 2427 | |((s->TxStatus[0] & TxAborted )?TSAD_TABT0:0) |
2428 | - | 2428 | + |
2429 | |((s->TxStatus[3] & TxHostOwns )?TSAD_OWN3:0) | 2429 | |((s->TxStatus[3] & TxHostOwns )?TSAD_OWN3:0) |
2430 | |((s->TxStatus[2] & TxHostOwns )?TSAD_OWN2:0) | 2430 | |((s->TxStatus[2] & TxHostOwns )?TSAD_OWN2:0) |
2431 | |((s->TxStatus[1] & TxHostOwns )?TSAD_OWN1:0) | 2431 | |((s->TxStatus[1] & TxHostOwns )?TSAD_OWN1:0) |
2432 | |((s->TxStatus[0] & TxHostOwns )?TSAD_OWN0:0) ; | 2432 | |((s->TxStatus[0] & TxHostOwns )?TSAD_OWN0:0) ; |
2433 | - | 2433 | + |
2434 | 2434 | ||
2435 | DEBUG_PRINT(("RTL8139: TSAD read val=0x%04x\n", ret)); | 2435 | DEBUG_PRINT(("RTL8139: TSAD read val=0x%04x\n", ret)); |
2436 | 2436 | ||
@@ -3410,7 +3410,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -3410,7 +3410,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
3410 | PCIRTL8139State *d; | 3410 | PCIRTL8139State *d; |
3411 | RTL8139State *s; | 3411 | RTL8139State *s; |
3412 | uint8_t *pci_conf; | 3412 | uint8_t *pci_conf; |
3413 | - | 3413 | + |
3414 | d = (PCIRTL8139State *)pci_register_device(bus, | 3414 | d = (PCIRTL8139State *)pci_register_device(bus, |
3415 | "RTL8139", sizeof(PCIRTL8139State), | 3415 | "RTL8139", sizeof(PCIRTL8139State), |
3416 | devfn, | 3416 | devfn, |
@@ -3458,7 +3458,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -3458,7 +3458,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
3458 | s->cplus_txbuffer = NULL; | 3458 | s->cplus_txbuffer = NULL; |
3459 | s->cplus_txbuffer_len = 0; | 3459 | s->cplus_txbuffer_len = 0; |
3460 | s->cplus_txbuffer_offset = 0; | 3460 | s->cplus_txbuffer_offset = 0; |
3461 | - | 3461 | + |
3462 | /* XXX: instance number ? */ | 3462 | /* XXX: instance number ? */ |
3463 | register_savevm("rtl8139", 0, 3, rtl8139_save, rtl8139_load, s); | 3463 | register_savevm("rtl8139", 0, 3, rtl8139_save, rtl8139_load, s); |
3464 | 3464 |
hw/serial.c
@@ -142,7 +142,7 @@ static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val) | @@ -142,7 +142,7 @@ static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val) | ||
142 | { | 142 | { |
143 | SerialState *s = opaque; | 143 | SerialState *s = opaque; |
144 | unsigned char ch; | 144 | unsigned char ch; |
145 | - | 145 | + |
146 | addr &= 7; | 146 | addr &= 7; |
147 | #ifdef DEBUG_SERIAL | 147 | #ifdef DEBUG_SERIAL |
148 | printf("serial: write addr=0x%02x val=0x%02x\n", addr, val); | 148 | printf("serial: write addr=0x%02x val=0x%02x\n", addr, val); |
hw/slavio_intctl.c
@@ -308,7 +308,7 @@ static void slavio_intctl_save(QEMUFile *f, void *opaque) | @@ -308,7 +308,7 @@ static void slavio_intctl_save(QEMUFile *f, void *opaque) | ||
308 | { | 308 | { |
309 | SLAVIO_INTCTLState *s = opaque; | 309 | SLAVIO_INTCTLState *s = opaque; |
310 | int i; | 310 | int i; |
311 | - | 311 | + |
312 | for (i = 0; i < MAX_CPUS; i++) { | 312 | for (i = 0; i < MAX_CPUS; i++) { |
313 | qemu_put_be32s(f, &s->intreg_pending[i]); | 313 | qemu_put_be32s(f, &s->intreg_pending[i]); |
314 | } | 314 | } |
hw/slavio_serial.c
@@ -136,7 +136,7 @@ static uint32_t get_queue(void *opaque) | @@ -136,7 +136,7 @@ static uint32_t get_queue(void *opaque) | ||
136 | ChannelState *s = opaque; | 136 | ChannelState *s = opaque; |
137 | SERIOQueue *q = &s->queue; | 137 | SERIOQueue *q = &s->queue; |
138 | int val; | 138 | int val; |
139 | - | 139 | + |
140 | if (q->count == 0) { | 140 | if (q->count == 0) { |
141 | return 0; | 141 | return 0; |
142 | } else { | 142 | } else { |
hw/slavio_timer.c
@@ -210,7 +210,7 @@ static int slavio_timer_load(QEMUFile *f, void *opaque, int version_id) | @@ -210,7 +210,7 @@ static int slavio_timer_load(QEMUFile *f, void *opaque, int version_id) | ||
210 | { | 210 | { |
211 | SLAVIO_TIMERState *s = opaque; | 211 | SLAVIO_TIMERState *s = opaque; |
212 | uint32_t tmp; | 212 | uint32_t tmp; |
213 | - | 213 | + |
214 | if (version_id != 2) | 214 | if (version_id != 2) |
215 | return -EINVAL; | 215 | return -EINVAL; |
216 | 216 |
hw/smbus_eeprom.c
@@ -94,7 +94,7 @@ static uint8_t eeprom_read_data(SMBusDevice *dev, uint8_t cmd, int n) | @@ -94,7 +94,7 @@ static uint8_t eeprom_read_data(SMBusDevice *dev, uint8_t cmd, int n) | ||
94 | void smbus_eeprom_device_init(i2c_bus *bus, uint8_t addr, uint8_t *buf) | 94 | void smbus_eeprom_device_init(i2c_bus *bus, uint8_t addr, uint8_t *buf) |
95 | { | 95 | { |
96 | SMBusEEPROMDevice *eeprom; | 96 | SMBusEEPROMDevice *eeprom; |
97 | - | 97 | + |
98 | eeprom = (SMBusEEPROMDevice *)smbus_device_init(bus, addr, | 98 | eeprom = (SMBusEEPROMDevice *)smbus_device_init(bus, addr, |
99 | sizeof(SMBusEEPROMDevice)); | 99 | sizeof(SMBusEEPROMDevice)); |
100 | 100 |
hw/smc91c111.c
@@ -649,7 +649,7 @@ static void smc91c111_receive(void *opaque, const uint8_t *buf, int size) | @@ -649,7 +649,7 @@ static void smc91c111_receive(void *opaque, const uint8_t *buf, int size) | ||
649 | /* Pad short packets. */ | 649 | /* Pad short packets. */ |
650 | if (size < 64) { | 650 | if (size < 64) { |
651 | int pad; | 651 | int pad; |
652 | - | 652 | + |
653 | if (size & 1) | 653 | if (size & 1) |
654 | *(p++) = buf[size - 1]; | 654 | *(p++) = buf[size - 1]; |
655 | pad = 64 - size; | 655 | pad = 64 - size; |
hw/tcx.c
@@ -208,7 +208,7 @@ static void tcx_update_display(void *opaque) | @@ -208,7 +208,7 @@ static void tcx_update_display(void *opaque) | ||
208 | case 0: | 208 | case 0: |
209 | return; | 209 | return; |
210 | } | 210 | } |
211 | - | 211 | + |
212 | for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE) { | 212 | for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE) { |
213 | if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) { | 213 | if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) { |
214 | if (y_start < 0) | 214 | if (y_start < 0) |
@@ -353,7 +353,7 @@ static void tcx24_invalidate_display(void *opaque) | @@ -353,7 +353,7 @@ static void tcx24_invalidate_display(void *opaque) | ||
353 | static void tcx_save(QEMUFile *f, void *opaque) | 353 | static void tcx_save(QEMUFile *f, void *opaque) |
354 | { | 354 | { |
355 | TCXState *s = opaque; | 355 | TCXState *s = opaque; |
356 | - | 356 | + |
357 | qemu_put_be16s(f, (uint16_t *)&s->height); | 357 | qemu_put_be16s(f, (uint16_t *)&s->height); |
358 | qemu_put_be16s(f, (uint16_t *)&s->width); | 358 | qemu_put_be16s(f, (uint16_t *)&s->width); |
359 | qemu_put_be16s(f, (uint16_t *)&s->depth); | 359 | qemu_put_be16s(f, (uint16_t *)&s->depth); |
hw/usb-hid.c
@@ -102,7 +102,7 @@ static const uint8_t qemu_mouse_config_descriptor[] = { | @@ -102,7 +102,7 @@ static const uint8_t qemu_mouse_config_descriptor[] = { | ||
102 | 5: Remote wakeup, | 102 | 5: Remote wakeup, |
103 | 4..0: resvd */ | 103 | 4..0: resvd */ |
104 | 50, /* u8 MaxPower; */ | 104 | 50, /* u8 MaxPower; */ |
105 | - | 105 | + |
106 | /* USB 1.1: | 106 | /* USB 1.1: |
107 | * USB 2.0, single TT organization (mandatory): | 107 | * USB 2.0, single TT organization (mandatory): |
108 | * one interface, protocol 0 | 108 | * one interface, protocol 0 |
@@ -124,7 +124,7 @@ static const uint8_t qemu_mouse_config_descriptor[] = { | @@ -124,7 +124,7 @@ static const uint8_t qemu_mouse_config_descriptor[] = { | ||
124 | 0x01, /* u8 if_bInterfaceSubClass; */ | 124 | 0x01, /* u8 if_bInterfaceSubClass; */ |
125 | 0x02, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ | 125 | 0x02, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ |
126 | 0x07, /* u8 if_iInterface; */ | 126 | 0x07, /* u8 if_iInterface; */ |
127 | - | 127 | + |
128 | /* HID descriptor */ | 128 | /* HID descriptor */ |
129 | 0x09, /* u8 bLength; */ | 129 | 0x09, /* u8 bLength; */ |
130 | 0x21, /* u8 bDescriptorType; */ | 130 | 0x21, /* u8 bDescriptorType; */ |
@@ -157,7 +157,7 @@ static const uint8_t qemu_tablet_config_descriptor[] = { | @@ -157,7 +157,7 @@ static const uint8_t qemu_tablet_config_descriptor[] = { | ||
157 | 5: Remote wakeup, | 157 | 5: Remote wakeup, |
158 | 4..0: resvd */ | 158 | 4..0: resvd */ |
159 | 50, /* u8 MaxPower; */ | 159 | 50, /* u8 MaxPower; */ |
160 | - | 160 | + |
161 | /* USB 1.1: | 161 | /* USB 1.1: |
162 | * USB 2.0, single TT organization (mandatory): | 162 | * USB 2.0, single TT organization (mandatory): |
163 | * one interface, protocol 0 | 163 | * one interface, protocol 0 |
@@ -474,7 +474,7 @@ static int usb_mouse_poll(USBHIDState *hs, uint8_t *buf, int len) | @@ -474,7 +474,7 @@ static int usb_mouse_poll(USBHIDState *hs, uint8_t *buf, int len) | ||
474 | 0, "QEMU USB Mouse"); | 474 | 0, "QEMU USB Mouse"); |
475 | s->mouse_grabbed = 1; | 475 | s->mouse_grabbed = 1; |
476 | } | 476 | } |
477 | - | 477 | + |
478 | dx = int_clamp(s->dx, -128, 127); | 478 | dx = int_clamp(s->dx, -128, 127); |
479 | dy = int_clamp(s->dy, -128, 127); | 479 | dy = int_clamp(s->dy, -128, 127); |
480 | dz = int_clamp(s->dz, -128, 127); | 480 | dz = int_clamp(s->dz, -128, 127); |
@@ -482,7 +482,7 @@ static int usb_mouse_poll(USBHIDState *hs, uint8_t *buf, int len) | @@ -482,7 +482,7 @@ static int usb_mouse_poll(USBHIDState *hs, uint8_t *buf, int len) | ||
482 | s->dx -= dx; | 482 | s->dx -= dx; |
483 | s->dy -= dy; | 483 | s->dy -= dy; |
484 | s->dz -= dz; | 484 | s->dz -= dz; |
485 | - | 485 | + |
486 | b = 0; | 486 | b = 0; |
487 | if (s->buttons_state & MOUSE_EVENT_LBUTTON) | 487 | if (s->buttons_state & MOUSE_EVENT_LBUTTON) |
488 | b |= 0x01; | 488 | b |= 0x01; |
@@ -490,7 +490,7 @@ static int usb_mouse_poll(USBHIDState *hs, uint8_t *buf, int len) | @@ -490,7 +490,7 @@ static int usb_mouse_poll(USBHIDState *hs, uint8_t *buf, int len) | ||
490 | b |= 0x02; | 490 | b |= 0x02; |
491 | if (s->buttons_state & MOUSE_EVENT_MBUTTON) | 491 | if (s->buttons_state & MOUSE_EVENT_MBUTTON) |
492 | b |= 0x04; | 492 | b |= 0x04; |
493 | - | 493 | + |
494 | buf[0] = b; | 494 | buf[0] = b; |
495 | buf[1] = dx; | 495 | buf[1] = dx; |
496 | buf[2] = dy; | 496 | buf[2] = dy; |
@@ -512,7 +512,7 @@ static int usb_tablet_poll(USBHIDState *hs, uint8_t *buf, int len) | @@ -512,7 +512,7 @@ static int usb_tablet_poll(USBHIDState *hs, uint8_t *buf, int len) | ||
512 | 1, "QEMU USB Tablet"); | 512 | 1, "QEMU USB Tablet"); |
513 | s->mouse_grabbed = 1; | 513 | s->mouse_grabbed = 1; |
514 | } | 514 | } |
515 | - | 515 | + |
516 | dz = int_clamp(s->dz, -128, 127); | 516 | dz = int_clamp(s->dz, -128, 127); |
517 | s->dz -= dz; | 517 | s->dz -= dz; |
518 | 518 |
hw/usb-hub.c
@@ -118,7 +118,7 @@ static const uint8_t qemu_hub_config_descriptor[] = { | @@ -118,7 +118,7 @@ static const uint8_t qemu_hub_config_descriptor[] = { | ||
118 | 5: Remote wakeup, | 118 | 5: Remote wakeup, |
119 | 4..0: resvd */ | 119 | 4..0: resvd */ |
120 | 0x00, /* u8 MaxPower; */ | 120 | 0x00, /* u8 MaxPower; */ |
121 | - | 121 | + |
122 | /* USB 1.1: | 122 | /* USB 1.1: |
123 | * USB 2.0, single TT organization (mandatory): | 123 | * USB 2.0, single TT organization (mandatory): |
124 | * one interface, protocol 0 | 124 | * one interface, protocol 0 |
@@ -140,7 +140,7 @@ static const uint8_t qemu_hub_config_descriptor[] = { | @@ -140,7 +140,7 @@ static const uint8_t qemu_hub_config_descriptor[] = { | ||
140 | 0x00, /* u8 if_bInterfaceSubClass; */ | 140 | 0x00, /* u8 if_bInterfaceSubClass; */ |
141 | 0x00, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ | 141 | 0x00, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ |
142 | 0x00, /* u8 if_iInterface; */ | 142 | 0x00, /* u8 if_iInterface; */ |
143 | - | 143 | + |
144 | /* one endpoint (status change endpoint) */ | 144 | /* one endpoint (status change endpoint) */ |
145 | 0x07, /* u8 ep_bLength; */ | 145 | 0x07, /* u8 ep_bLength; */ |
146 | 0x05, /* u8 ep_bDescriptorType; Endpoint */ | 146 | 0x05, /* u8 ep_bDescriptorType; Endpoint */ |
@@ -167,11 +167,11 @@ static void usb_hub_attach(USBPort *port1, USBDevice *dev) | @@ -167,11 +167,11 @@ static void usb_hub_attach(USBPort *port1, USBDevice *dev) | ||
167 | { | 167 | { |
168 | USBHubState *s = port1->opaque; | 168 | USBHubState *s = port1->opaque; |
169 | USBHubPort *port = &s->ports[port1->index]; | 169 | USBHubPort *port = &s->ports[port1->index]; |
170 | - | 170 | + |
171 | if (dev) { | 171 | if (dev) { |
172 | if (port->port.dev) | 172 | if (port->port.dev) |
173 | usb_attach(port1, NULL); | 173 | usb_attach(port1, NULL); |
174 | - | 174 | + |
175 | port->wPortStatus |= PORT_STAT_CONNECTION; | 175 | port->wPortStatus |= PORT_STAT_CONNECTION; |
176 | port->wPortChange |= PORT_STAT_C_CONNECTION; | 176 | port->wPortChange |= PORT_STAT_C_CONNECTION; |
177 | if (dev->speed == USB_SPEED_LOW) | 177 | if (dev->speed == USB_SPEED_LOW) |
hw/usb-msd.c
@@ -99,7 +99,7 @@ static const uint8_t qemu_msd_config_descriptor[] = { | @@ -99,7 +99,7 @@ static const uint8_t qemu_msd_config_descriptor[] = { | ||
99 | 5: Remote wakeup, | 99 | 5: Remote wakeup, |
100 | 4..0: resvd */ | 100 | 4..0: resvd */ |
101 | 0x00, /* u8 MaxPower; */ | 101 | 0x00, /* u8 MaxPower; */ |
102 | - | 102 | + |
103 | /* one interface */ | 103 | /* one interface */ |
104 | 0x09, /* u8 if_bLength; */ | 104 | 0x09, /* u8 if_bLength; */ |
105 | 0x04, /* u8 if_bDescriptorType; Interface */ | 105 | 0x04, /* u8 if_bDescriptorType; Interface */ |
@@ -110,7 +110,7 @@ static const uint8_t qemu_msd_config_descriptor[] = { | @@ -110,7 +110,7 @@ static const uint8_t qemu_msd_config_descriptor[] = { | ||
110 | 0x06, /* u8 if_bInterfaceSubClass; SCSI */ | 110 | 0x06, /* u8 if_bInterfaceSubClass; SCSI */ |
111 | 0x50, /* u8 if_bInterfaceProtocol; Bulk Only */ | 111 | 0x50, /* u8 if_bInterfaceProtocol; Bulk Only */ |
112 | 0x00, /* u8 if_iInterface; */ | 112 | 0x00, /* u8 if_iInterface; */ |
113 | - | 113 | + |
114 | /* Bulk-In endpoint */ | 114 | /* Bulk-In endpoint */ |
115 | 0x07, /* u8 ep_bLength; */ | 115 | 0x07, /* u8 ep_bLength; */ |
116 | 0x05, /* u8 ep_bDescriptorType; Endpoint */ | 116 | 0x05, /* u8 ep_bDescriptorType; Endpoint */ |
hw/usb-uhci.c
@@ -149,7 +149,7 @@ static void uhci_reset(UHCIState *s) | @@ -149,7 +149,7 @@ static void uhci_reset(UHCIState *s) | ||
149 | static void uhci_ioport_writeb(void *opaque, uint32_t addr, uint32_t val) | 149 | static void uhci_ioport_writeb(void *opaque, uint32_t addr, uint32_t val) |
150 | { | 150 | { |
151 | UHCIState *s = opaque; | 151 | UHCIState *s = opaque; |
152 | - | 152 | + |
153 | addr &= 0x1f; | 153 | addr &= 0x1f; |
154 | switch(addr) { | 154 | switch(addr) { |
155 | case 0x0c: | 155 | case 0x0c: |
@@ -178,7 +178,7 @@ static uint32_t uhci_ioport_readb(void *opaque, uint32_t addr) | @@ -178,7 +178,7 @@ static uint32_t uhci_ioport_readb(void *opaque, uint32_t addr) | ||
178 | static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val) | 178 | static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val) |
179 | { | 179 | { |
180 | UHCIState *s = opaque; | 180 | UHCIState *s = opaque; |
181 | - | 181 | + |
182 | addr &= 0x1f; | 182 | addr &= 0x1f; |
183 | #ifdef DEBUG | 183 | #ifdef DEBUG |
184 | printf("uhci writew port=0x%04x val=0x%04x\n", addr, val); | 184 | printf("uhci writew port=0x%04x val=0x%04x\n", addr, val); |
@@ -458,7 +458,7 @@ static int uhci_handle_td(UHCIState *s, UHCI_TD *td, int *int_mask) | @@ -458,7 +458,7 @@ static int uhci_handle_td(UHCIState *s, UHCI_TD *td, int *int_mask) | ||
458 | if (td->ctrl & TD_CTRL_IOC) { | 458 | if (td->ctrl & TD_CTRL_IOC) { |
459 | *int_mask |= 0x01; | 459 | *int_mask |= 0x01; |
460 | } | 460 | } |
461 | - | 461 | + |
462 | if (!(td->ctrl & TD_CTRL_ACTIVE)) | 462 | if (!(td->ctrl & TD_CTRL_ACTIVE)) |
463 | return 1; | 463 | return 1; |
464 | 464 | ||
@@ -807,7 +807,7 @@ void usb_uhci_piix3_init(PCIBus *bus, int devfn) | @@ -807,7 +807,7 @@ void usb_uhci_piix3_init(PCIBus *bus, int devfn) | ||
807 | pci_conf[0x0e] = 0x00; // header_type | 807 | pci_conf[0x0e] = 0x00; // header_type |
808 | pci_conf[0x3d] = 4; // interrupt pin 3 | 808 | pci_conf[0x3d] = 4; // interrupt pin 3 |
809 | pci_conf[0x60] = 0x10; // release number | 809 | pci_conf[0x60] = 0x10; // release number |
810 | - | 810 | + |
811 | for(i = 0; i < NB_PORTS; i++) { | 811 | for(i = 0; i < NB_PORTS; i++) { |
812 | qemu_register_usb_port(&s->ports[i].port, s, i, uhci_attach); | 812 | qemu_register_usb_port(&s->ports[i].port, s, i, uhci_attach); |
813 | } | 813 | } |
hw/usb.h
@@ -119,7 +119,7 @@ struct USBDevice { | @@ -119,7 +119,7 @@ struct USBDevice { | ||
119 | void (*handle_destroy)(USBDevice *dev); | 119 | void (*handle_destroy)(USBDevice *dev); |
120 | 120 | ||
121 | int speed; | 121 | int speed; |
122 | - | 122 | + |
123 | /* The following fields are used by the generic USB device | 123 | /* The following fields are used by the generic USB device |
124 | layer. They are here just to avoid creating a new structure for | 124 | layer. They are here just to avoid creating a new structure for |
125 | them. */ | 125 | them. */ |
@@ -129,7 +129,7 @@ struct USBDevice { | @@ -129,7 +129,7 @@ struct USBDevice { | ||
129 | int (*handle_data)(USBDevice *dev, USBPacket *p); | 129 | int (*handle_data)(USBDevice *dev, USBPacket *p); |
130 | uint8_t addr; | 130 | uint8_t addr; |
131 | char devname[32]; | 131 | char devname[32]; |
132 | - | 132 | + |
133 | int state; | 133 | int state; |
134 | uint8_t setup_buf[8]; | 134 | uint8_t setup_buf[8]; |
135 | uint8_t data_buf[1024]; | 135 | uint8_t data_buf[1024]; |