Commit 3b46e6242767a2c770c0aba0a6595e9511623c92

Authored by ths
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

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