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
This commit is contained in:
ths 2007-09-17 08:09:54 +00:00
parent ef18c8839e
commit 3b46e62427
173 changed files with 1557 additions and 1557 deletions

View File

@ -86,7 +86,7 @@ version 0.8.0:
(Johannes Schindelin) (Johannes Schindelin)
version 0.7.2: version 0.7.2:
- x86_64 fixes (Win2000 and Linux 2.6 boot in 32 bit) - x86_64 fixes (Win2000 and Linux 2.6 boot in 32 bit)
- merge self modifying code handling in dirty ram page mecanism. - merge self modifying code handling in dirty ram page mecanism.
- MIPS fixes (Ralf Baechle) - MIPS fixes (Ralf Baechle)
@ -201,7 +201,7 @@ version 0.5.5:
- FDC fixes for Win98 - FDC fixes for Win98
version 0.5.4: version 0.5.4:
- qemu-fast fixes - qemu-fast fixes
- BIOS area protection fix (aka EMM386.EXE fix) (Mike Nordell) - BIOS area protection fix (aka EMM386.EXE fix) (Mike Nordell)
- keyboard/mouse fix (Mike Nordell) - keyboard/mouse fix (Mike Nordell)
@ -266,7 +266,7 @@ version 0.5.2:
- eflags optimisation fix for string operations - eflags optimisation fix for string operations
version 0.5.1: version 0.5.1:
- float access fixes when using soft mmu - float access fixes when using soft mmu
- PC emulation support on PowerPC - PC emulation support on PowerPC
- A20 support - A20 support
@ -281,7 +281,7 @@ version 0.5.1:
- Major SPARC target fixes (dynamically linked programs begin to work) - Major SPARC target fixes (dynamically linked programs begin to work)
version 0.5.0: version 0.5.0:
- full hardware level VGA emulation - full hardware level VGA emulation
- graphical display with SDL - graphical display with SDL
- added PS/2 mouse and keyboard emulation - added PS/2 mouse and keyboard emulation
@ -319,7 +319,7 @@ version 0.4.2:
- SMP kernels can at least be booted - SMP kernels can at least be booted
version 0.4.1: version 0.4.1:
- more accurate timer support in vl. - more accurate timer support in vl.
- more reliable NE2000 probe in vl. - more reliable NE2000 probe in vl.
- added 2.5.66 kernel in vl-test. - added 2.5.66 kernel in vl-test.

4
aes.c
View File

@ -1294,7 +1294,7 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
AES_encrypt(tmp, tmp, key); AES_encrypt(tmp, tmp, key);
memcpy(out, tmp, AES_BLOCK_SIZE); memcpy(out, tmp, AES_BLOCK_SIZE);
memcpy(ivec, tmp, AES_BLOCK_SIZE); memcpy(ivec, tmp, AES_BLOCK_SIZE);
} }
} else { } else {
while (len >= AES_BLOCK_SIZE) { while (len >= AES_BLOCK_SIZE) {
memcpy(tmp, in, AES_BLOCK_SIZE); memcpy(tmp, in, AES_BLOCK_SIZE);
@ -1312,6 +1312,6 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
for(n=0; n < len; ++n) for(n=0; n < len; ++n)
out[n] = tmp[n] ^ ivec[n]; out[n] = tmp[n] ^ ivec[n];
memcpy(ivec, tmp, AES_BLOCK_SIZE); memcpy(ivec, tmp, AES_BLOCK_SIZE);
} }
} }
} }

128
arm-dis.c
View File

@ -34,7 +34,7 @@ struct thumb_opcode
}; };
/* format of the assembler string : /* format of the assembler string :
%% % %% %
%<bitfield>d print the bitfield in decimal %<bitfield>d print the bitfield in decimal
%<bitfield>x print the bitfield in hex %<bitfield>x print the bitfield in hex
@ -104,7 +104,7 @@ static struct arm_opcode arm_opcodes[] =
{0x0c400000, 0x0ff00fff, "mar%c\tacc0, %12-15r, %16-19r"}, {0x0c400000, 0x0ff00fff, "mar%c\tacc0, %12-15r, %16-19r"},
{0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"}, {0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"},
{0xf450f000, 0xfc70f000, "pld\t%a"}, {0xf450f000, 0xfc70f000, "pld\t%a"},
/* V5 Instructions. */ /* V5 Instructions. */
{0xe1200070, 0xfff000f0, "bkpt\t0x%16-19X%12-15X%8-11X%0-3X"}, {0xe1200070, 0xfff000f0, "bkpt\t0x%16-19X%12-15X%8-11X%0-3X"},
{0xfa000000, 0xfe000000, "blx\t%B"}, {0xfa000000, 0xfe000000, "blx\t%B"},
@ -116,7 +116,7 @@ static struct arm_opcode arm_opcodes[] =
{0xfe000010, 0xff100010, "mcr2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, {0xfe000010, 0xff100010, "mcr2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"},
{0xfe100010, 0xff100010, "mrc2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"}, {0xfe100010, 0xff100010, "mrc2\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"},
/* V5E "El Segundo" Instructions. */ /* V5E "El Segundo" Instructions. */
{0x000000d0, 0x0e1000f0, "ldr%cd\t%12-15r, %s"}, {0x000000d0, 0x0e1000f0, "ldr%cd\t%12-15r, %s"},
{0x000000f0, 0x0e1000f0, "str%cd\t%12-15r, %s"}, {0x000000f0, 0x0e1000f0, "str%cd\t%12-15r, %s"},
{0x01000080, 0x0ff000f0, "smlabb%c\t%16-19r, %0-3r, %8-11r, %12-15r"}, {0x01000080, 0x0ff000f0, "smlabb%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
@ -621,14 +621,14 @@ arm_decode_shift (given, func, stream)
void * stream; void * stream;
{ {
func (stream, "%s", arm_regnames[given & 0xf]); func (stream, "%s", arm_regnames[given & 0xf]);
if ((given & 0xff0) != 0) if ((given & 0xff0) != 0)
{ {
if ((given & 0x10) == 0) if ((given & 0x10) == 0)
{ {
int amount = (given & 0xf80) >> 7; int amount = (given & 0xf80) >> 7;
int shift = (given & 0x60) >> 5; int shift = (given & 0x60) >> 5;
if (amount == 0) if (amount == 0)
{ {
if (shift == 3) if (shift == 3)
@ -636,10 +636,10 @@ arm_decode_shift (given, func, stream)
func (stream, ", rrx"); func (stream, ", rrx");
return; return;
} }
amount = 32; amount = 32;
} }
func (stream, ", %s #%d", arm_shift[shift], amount); func (stream, ", %s #%d", arm_shift[shift], amount);
} }
else else
@ -666,7 +666,7 @@ print_insn_arm1 (pc, info, given)
if ((given & insn->mask) == insn->value) if ((given & insn->mask) == insn->value)
{ {
char * c; char * c;
for (c = insn->assembler; *c; c++) for (c = insn->assembler; *c; c++)
{ {
if (*c == '%') if (*c == '%')
@ -682,14 +682,14 @@ print_insn_arm1 (pc, info, given)
&& ((given & 0x02000000) == 0)) && ((given & 0x02000000) == 0))
{ {
int offset = given & 0xfff; int offset = given & 0xfff;
func (stream, "[pc"); func (stream, "[pc");
if (given & 0x01000000) if (given & 0x01000000)
{ {
if ((given & 0x00800000) == 0) if ((given & 0x00800000) == 0)
offset = - offset; offset = - offset;
/* Pre-indexed. */ /* Pre-indexed. */
func (stream, ", #%d]", offset); func (stream, ", #%d]", offset);
@ -710,7 +710,7 @@ print_insn_arm1 (pc, info, given)
/* ie ignore the offset. */ /* ie ignore the offset. */
offset = pc + 8; offset = pc + 8;
} }
func (stream, "\t; "); func (stream, "\t; ");
info->print_address_func (offset, info); info->print_address_func (offset, info);
} }
@ -767,12 +767,12 @@ print_insn_arm1 (pc, info, given)
{ {
/* PC relative with immediate offset. */ /* PC relative with immediate offset. */
int offset = ((given & 0xf00) >> 4) | (given & 0xf); int offset = ((given & 0xf00) >> 4) | (given & 0xf);
if ((given & 0x00800000) == 0) if ((given & 0x00800000) == 0)
offset = -offset; offset = -offset;
func (stream, "[pc, #%d]\t; ", offset); func (stream, "[pc, #%d]\t; ", offset);
(*info->print_address_func) (*info->print_address_func)
(offset + pc + 8, info); (offset + pc + 8, info);
} }
@ -829,7 +829,7 @@ print_insn_arm1 (pc, info, given)
} }
} }
break; break;
case 'b': case 'b':
(*info->print_address_func) (*info->print_address_func)
(BDISP (given) * 4 + pc + 8, info); (BDISP (given) * 4 + pc + 8, info);
@ -911,7 +911,7 @@ print_insn_arm1 (pc, info, given)
{ {
bfd_vma address; bfd_vma address;
bfd_vma offset = 0; bfd_vma offset = 0;
if (given & 0x00800000) if (given & 0x00800000)
/* Is signed, hi bits should be ones. */ /* Is signed, hi bits should be ones. */
offset = (-1) ^ 0x00ffffff; offset = (-1) ^ 0x00ffffff;
@ -920,7 +920,7 @@ print_insn_arm1 (pc, info, given)
offset += given & 0x00ffffff; offset += given & 0x00ffffff;
offset <<= 2; offset <<= 2;
address = offset + pc + 8; address = offset + pc + 8;
if (given & 0x01000000) if (given & 0x01000000)
/* H bit allows addressing to 2-byte boundaries. */ /* H bit allows addressing to 2-byte boundaries. */
address += 2; address += 2;
@ -976,7 +976,7 @@ print_insn_arm1 (pc, info, given)
func (stream, "3"); func (stream, "3");
} }
break; break;
case 'P': case 'P':
switch (given & 0x00080080) switch (given & 0x00080080)
{ {
@ -1040,44 +1040,44 @@ print_insn_arm1 (pc, info, given)
{ {
case '-': case '-':
c++; c++;
while (*c >= '0' && *c <= '9') while (*c >= '0' && *c <= '9')
bitend = (bitend * 10) + *c++ - '0'; bitend = (bitend * 10) + *c++ - '0';
if (!bitend) if (!bitend)
abort (); abort ();
switch (*c) switch (*c)
{ {
case 'r': case 'r':
{ {
long reg; long reg;
reg = given >> bitstart; reg = given >> bitstart;
reg &= (2 << (bitend - bitstart)) - 1; reg &= (2 << (bitend - bitstart)) - 1;
func (stream, "%s", arm_regnames[reg]); func (stream, "%s", arm_regnames[reg]);
} }
break; break;
case 'd': case 'd':
{ {
long reg; long reg;
reg = given >> bitstart; reg = given >> bitstart;
reg &= (2 << (bitend - bitstart)) - 1; reg &= (2 << (bitend - bitstart)) - 1;
func (stream, "%d", reg); func (stream, "%d", reg);
} }
break; break;
case 'x': case 'x':
{ {
long reg; long reg;
reg = given >> bitstart; reg = given >> bitstart;
reg &= (2 << (bitend - bitstart)) - 1; reg &= (2 << (bitend - bitstart)) - 1;
func (stream, "0x%08x", reg); func (stream, "0x%08x", reg);
/* Some SWI instructions have special /* Some SWI instructions have special
meanings. */ meanings. */
if ((given & 0x0fffffff) == 0x0FF00000) if ((given & 0x0fffffff) == 0x0FF00000)
@ -1089,20 +1089,20 @@ print_insn_arm1 (pc, info, given)
case 'X': case 'X':
{ {
long reg; long reg;
reg = given >> bitstart; reg = given >> bitstart;
reg &= (2 << (bitend - bitstart)) - 1; reg &= (2 << (bitend - bitstart)) - 1;
func (stream, "%01x", reg & 0xf); func (stream, "%01x", reg & 0xf);
} }
break; break;
case 'f': case 'f':
{ {
long reg; long reg;
reg = given >> bitstart; reg = given >> bitstart;
reg &= (2 << (bitend - bitstart)) - 1; reg &= (2 << (bitend - bitstart)) - 1;
if (reg > 7) if (reg > 7)
func (stream, "#%s", func (stream, "#%s",
arm_fp_const[reg & 7]); arm_fp_const[reg & 7]);
@ -1163,7 +1163,7 @@ print_insn_arm1 (pc, info, given)
} }
break; break;
default: default:
abort (); abort ();
} }
@ -1252,7 +1252,7 @@ print_insn_thumb (pc, info, given)
if (!*c) /* Check for empty (not NULL) assembler string. */ if (!*c) /* Check for empty (not NULL) assembler string. */
{ {
long offset; long offset;
info->bytes_per_chunk = 4; info->bytes_per_chunk = 4;
info->bytes_per_line = 4; info->bytes_per_line = 4;
@ -1274,16 +1274,16 @@ print_insn_thumb (pc, info, given)
{ {
info->bytes_per_chunk = 2; info->bytes_per_chunk = 2;
info->bytes_per_line = 4; info->bytes_per_line = 4;
given &= 0xffff; given &= 0xffff;
for (; *c; c++) for (; *c; c++)
{ {
if (*c == '%') if (*c == '%')
{ {
int domaskpc = 0; int domaskpc = 0;
int domasklr = 0; int domasklr = 0;
switch (*++c) switch (*++c)
{ {
case '%': case '%':
@ -1293,11 +1293,11 @@ print_insn_thumb (pc, info, given)
case 'S': case 'S':
{ {
long reg; long reg;
reg = (given >> 3) & 0x7; reg = (given >> 3) & 0x7;
if (given & (1 << 6)) if (given & (1 << 6))
reg += 8; reg += 8;
func (stream, "%s", arm_regnames[reg]); func (stream, "%s", arm_regnames[reg]);
} }
break; break;
@ -1305,11 +1305,11 @@ print_insn_thumb (pc, info, given)
case 'D': case 'D':
{ {
long reg; long reg;
reg = given & 0x7; reg = given & 0x7;
if (given & (1 << 7)) if (given & (1 << 7))
reg += 8; reg += 8;
func (stream, "%s", arm_regnames[reg]); func (stream, "%s", arm_regnames[reg]);
} }
break; break;
@ -1331,9 +1331,9 @@ print_insn_thumb (pc, info, given)
{ {
int started = 0; int started = 0;
int reg; int reg;
func (stream, "{"); func (stream, "{");
/* It would be nice if we could spot /* It would be nice if we could spot
ranges, and generate the rS-rE format: */ ranges, and generate the rS-rE format: */
for (reg = 0; (reg < 8); reg++) for (reg = 0; (reg < 8); reg++)
@ -1370,7 +1370,7 @@ print_insn_thumb (pc, info, given)
{ {
int bitstart = *c++ - '0'; int bitstart = *c++ - '0';
int bitend = 0; int bitend = 0;
while (*c >= '0' && *c <= '9') while (*c >= '0' && *c <= '9')
bitstart = (bitstart * 10) + *c++ - '0'; bitstart = (bitstart * 10) + *c++ - '0';
@ -1379,7 +1379,7 @@ print_insn_thumb (pc, info, given)
case '-': case '-':
{ {
long reg; long reg;
c++; c++;
while (*c >= '0' && *c <= '9') while (*c >= '0' && *c <= '9')
bitend = (bitend * 10) + *c++ - '0'; bitend = (bitend * 10) + *c++ - '0';
@ -1478,7 +1478,7 @@ parse_arm_disassembler_option (option)
{ {
if (option == NULL) if (option == NULL)
return; return;
if (strneq (option, "reg-names-", 10)) if (strneq (option, "reg-names-", 10))
{ {
int i; int i;
@ -1491,7 +1491,7 @@ parse_arm_disassembler_option (option)
regname_selected = i; regname_selected = i;
break; break;
} }
if (i < 0) if (i < 0)
fprintf (stderr, _("Unrecognised register name set: %s\n"), option); fprintf (stderr, _("Unrecognised register name set: %s\n"), option);
} }
@ -1501,7 +1501,7 @@ parse_arm_disassembler_option (option)
force_thumb = 0; force_thumb = 0;
else else
fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option); fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option);
return; return;
} }
@ -1512,7 +1512,7 @@ parse_disassembler_options (options)
char * options; char * options;
{ {
char * space; char * space;
if (options == NULL) if (options == NULL)
return; return;
@ -1550,25 +1550,25 @@ print_insn_arm (pc, info)
if (info->disassembler_options) if (info->disassembler_options)
{ {
parse_disassembler_options (info->disassembler_options); parse_disassembler_options (info->disassembler_options);
/* To avoid repeated parsing of these options, we remove them here. */ /* To avoid repeated parsing of these options, we remove them here. */
info->disassembler_options = NULL; info->disassembler_options = NULL;
} }
is_thumb = force_thumb; is_thumb = force_thumb;
if (pc & 1) if (pc & 1)
{ {
is_thumb = 1; is_thumb = 1;
pc &= ~(bfd_vma) 1; pc &= ~(bfd_vma) 1;
} }
#if 0 #if 0
if (!is_thumb && info->symbols != NULL) if (!is_thumb && info->symbols != NULL)
{ {
if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour) if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
{ {
coff_symbol_type * cs; coff_symbol_type * cs;
cs = coffsymbol (*info->symbols); cs = coffsymbol (*info->symbols);
is_thumb = ( cs->native->u.syment.n_sclass == C_THUMBEXT is_thumb = ( cs->native->u.syment.n_sclass == C_THUMBEXT
|| cs->native->u.syment.n_sclass == C_THUMBSTAT || cs->native->u.syment.n_sclass == C_THUMBSTAT
@ -1580,15 +1580,15 @@ print_insn_arm (pc, info)
{ {
elf_symbol_type * es; elf_symbol_type * es;
unsigned int type; unsigned int type;
es = *(elf_symbol_type **)(info->symbols); es = *(elf_symbol_type **)(info->symbols);
type = ELF_ST_TYPE (es->internal_elf_sym.st_info); type = ELF_ST_TYPE (es->internal_elf_sym.st_info);
is_thumb = (type == STT_ARM_TFUNC) || (type == STT_ARM_16BIT); is_thumb = (type == STT_ARM_TFUNC) || (type == STT_ARM_16BIT);
} }
} }
#endif #endif
little = (info->endian == BFD_ENDIAN_LITTLE); little = (info->endian == BFD_ENDIAN_LITTLE);
info->bytes_per_chunk = 4; info->bytes_per_chunk = 4;
info->display_endian = little ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG; info->display_endian = little ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
@ -1599,17 +1599,17 @@ print_insn_arm (pc, info)
if (status != 0 && is_thumb) if (status != 0 && is_thumb)
{ {
info->bytes_per_chunk = 2; info->bytes_per_chunk = 2;
status = info->read_memory_func (pc, (bfd_byte *) b, 2, info); status = info->read_memory_func (pc, (bfd_byte *) b, 2, info);
b[3] = b[2] = 0; b[3] = b[2] = 0;
} }
if (status != 0) if (status != 0)
{ {
info->memory_error_func (status, pc, info); info->memory_error_func (status, pc, info);
return -1; return -1;
} }
given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24); given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24);
} }
else else
@ -1621,13 +1621,13 @@ print_insn_arm (pc, info)
info->memory_error_func (status, pc, info); info->memory_error_func (status, pc, info);
return -1; return -1;
} }
if (is_thumb) if (is_thumb)
{ {
if (pc & 0x2) if (pc & 0x2)
{ {
given = (b[2] << 8) | b[3]; given = (b[2] << 8) | b[3];
status = info->read_memory_func status = info->read_memory_func
((pc + 4) & ~ 0x3, (bfd_byte *) b, 4, info); ((pc + 4) & ~ 0x3, (bfd_byte *) b, 4, info);
if (status != 0) if (status != 0)
@ -1635,7 +1635,7 @@ print_insn_arm (pc, info)
info->memory_error_func (status, pc + 4, info); info->memory_error_func (status, pc + 4, info);
return -1; return -1;
} }
given |= (b[0] << 24) | (b[1] << 16); given |= (b[0] << 24) | (b[1] << 16);
} }
else else
@ -1644,7 +1644,7 @@ print_insn_arm (pc, info)
else else
given = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]); given = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
} }
if (info->flags & INSN_HAS_RELOC) if (info->flags & INSN_HAS_RELOC)
/* If the instruction has a reloc associated with it, then /* If the instruction has a reloc associated with it, then
the offset field in the instruction will actually be the the offset field in the instruction will actually be the
@ -1668,7 +1668,7 @@ print_arm_disassembler_options (FILE * stream)
fprintf (stream, _("\n\ fprintf (stream, _("\n\
The following ARM specific disassembler options are supported for use with\n\ The following ARM specific disassembler options are supported for use with\n\
the -M switch:\n")); the -M switch:\n"));
for (i = NUM_ARM_REGNAMES; i--;) for (i = NUM_ARM_REGNAMES; i--;)
fprintf (stream, " reg-names-%s %*c%s\n", fprintf (stream, " reg-names-%s %*c%s\n",
regnames[i].name, regnames[i].name,

View File

@ -401,7 +401,7 @@ uint32_t do_arm_semihosting(CPUState *env)
} }
ts->heap_limit = limit; ts->heap_limit = limit;
} }
ptr = lock_user(ARG(0), 16, 0); ptr = lock_user(ARG(0), 16, 0);
ptr[0] = tswap32(ts->heap_base); ptr[0] = tswap32(ts->heap_base);
ptr[1] = tswap32(ts->heap_limit); ptr[1] = tswap32(ts->heap_limit);

View File

@ -44,7 +44,7 @@ struct bochs_header_v1 {
char subtype[16]; // "Undoable" / "Volatile" / "Growing" char subtype[16]; // "Undoable" / "Volatile" / "Growing"
uint32_t version; uint32_t version;
uint32_t header; // size of header uint32_t header; // size of header
union { union {
struct { struct {
uint32_t catalog; // num of entries uint32_t catalog; // num of entries
@ -64,7 +64,7 @@ struct bochs_header {
char subtype[16]; // "Undoable" / "Volatile" / "Growing" char subtype[16]; // "Undoable" / "Volatile" / "Growing"
uint32_t version; uint32_t version;
uint32_t header; // size of header uint32_t header; // size of header
union { union {
struct { struct {
uint32_t catalog; // num of entries uint32_t catalog; // num of entries
@ -83,9 +83,9 @@ typedef struct BDRVBochsState {
uint32_t *catalog_bitmap; uint32_t *catalog_bitmap;
int catalog_size; int catalog_size;
int data_offset; int data_offset;
int bitmap_blocks; int bitmap_blocks;
int extent_blocks; int extent_blocks;
int extent_size; int extent_size;
@ -94,7 +94,7 @@ typedef struct BDRVBochsState {
static int bochs_probe(const uint8_t *buf, int buf_size, const char *filename) static int bochs_probe(const uint8_t *buf, int buf_size, const char *filename)
{ {
const struct bochs_header *bochs = (const void *)buf; const struct bochs_header *bochs = (const void *)buf;
if (buf_size < HEADER_SIZE) if (buf_size < HEADER_SIZE)
return 0; return 0;
@ -121,9 +121,9 @@ static int bochs_open(BlockDriverState *bs, const char *filename, int flags)
if (fd < 0) if (fd < 0)
return -1; return -1;
} }
bs->read_only = 1; // no write support yet bs->read_only = 1; // no write support yet
s->fd = fd; s->fd = fd;
if (read(fd, &bochs, sizeof(bochs)) != sizeof(bochs)) { if (read(fd, &bochs, sizeof(bochs)) != sizeof(bochs)) {
@ -161,7 +161,7 @@ static int bochs_open(BlockDriverState *bs, const char *filename, int flags)
s->bitmap_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.bitmap) - 1) / 512; s->bitmap_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.bitmap) - 1) / 512;
s->extent_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.extent) - 1) / 512; s->extent_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.extent) - 1) / 512;
s->extent_size = le32_to_cpu(bochs.extra.redolog.extent); s->extent_size = le32_to_cpu(bochs.extra.redolog.extent);
return 0; return 0;
@ -180,7 +180,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
// seek to sector // seek to sector
extent_index = offset / s->extent_size; extent_index = offset / s->extent_size;
extent_offset = (offset % s->extent_size) / 512; extent_offset = (offset % s->extent_size) / 512;
if (s->catalog_bitmap[extent_index] == 0xffffffff) if (s->catalog_bitmap[extent_index] == 0xffffffff)
{ {
// fprintf(stderr, "page not allocated [%x - %x:%x]\n", // 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)
bitmap_offset = s->data_offset + (512 * s->catalog_bitmap[extent_index] * bitmap_offset = s->data_offset + (512 * s->catalog_bitmap[extent_index] *
(s->extent_blocks + s->bitmap_blocks)); (s->extent_blocks + s->bitmap_blocks));
block_offset = bitmap_offset + (512 * (s->bitmap_blocks + extent_offset)); block_offset = bitmap_offset + (512 * (s->bitmap_blocks + extent_offset));
// fprintf(stderr, "sect: %x [ext i: %x o: %x] -> %x bitmap: %x block: %x\n", // fprintf(stderr, "sect: %x [ext i: %x o: %x] -> %x bitmap: %x block: %x\n",
// sector_num, extent_index, extent_offset, // sector_num, extent_index, extent_offset,
// le32_to_cpu(s->catalog_bitmap[extent_index]), // le32_to_cpu(s->catalog_bitmap[extent_index]),
// bitmap_offset, block_offset); // bitmap_offset, block_offset);
// read in bitmap for current extent // read in bitmap for current extent
lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET); lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET);
read(s->fd, &bitmap_entry, 1); read(s->fd, &bitmap_entry, 1);
if (!((bitmap_entry >> (extent_offset % 8)) & 1)) if (!((bitmap_entry >> (extent_offset % 8)) & 1))
{ {
// fprintf(stderr, "sector (%x) in bitmap not allocated\n", // 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)
} }
lseek(s->fd, block_offset, SEEK_SET); lseek(s->fd, block_offset, SEEK_SET);
return 0; return 0;
} }

View File

@ -96,7 +96,7 @@ cloop_close:
if(inflateInit(&s->zstream) != Z_OK) if(inflateInit(&s->zstream) != Z_OK)
goto cloop_close; goto cloop_close;
s->current_block=s->n_blocks; s->current_block=s->n_blocks;
s->sectors_per_block = s->block_size/512; s->sectors_per_block = s->block_size/512;
bs->total_sectors = s->n_blocks*s->sectors_per_block; bs->total_sectors = s->n_blocks*s->sectors_per_block;
return 0; return 0;
@ -107,7 +107,7 @@ static inline int cloop_read_block(BDRVCloopState *s,int block_num)
if(s->current_block != block_num) { if(s->current_block != block_num) {
int ret; int ret;
uint32_t bytes = s->offsets[block_num+1]-s->offsets[block_num]; uint32_t bytes = s->offsets[block_num+1]-s->offsets[block_num];
lseek(s->fd, s->offsets[block_num], SEEK_SET); lseek(s->fd, s->offsets[block_num], SEEK_SET);
ret = read(s->fd, s->compressed_block, bytes); ret = read(s->fd, s->compressed_block, bytes);
if (ret != bytes) if (ret != bytes)

View File

@ -85,14 +85,14 @@ static int cow_open(BlockDriverState *bs, const char *filename, int flags)
be32_to_cpu(cow_header.version) != COW_VERSION) { be32_to_cpu(cow_header.version) != COW_VERSION) {
goto fail; goto fail;
} }
/* cow image found */ /* cow image found */
size = be64_to_cpu(cow_header.size); size = be64_to_cpu(cow_header.size);
bs->total_sectors = size / 512; bs->total_sectors = size / 512;
pstrcpy(bs->backing_file, sizeof(bs->backing_file), pstrcpy(bs->backing_file, sizeof(bs->backing_file),
cow_header.backing_file); cow_header.backing_file);
/* mmap the bitmap */ /* mmap the bitmap */
s->cow_bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header); s->cow_bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header);
s->cow_bitmap_addr = mmap(get_mmap_addr(s->cow_bitmap_size), 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,
{ {
BDRVCowState *s = bs->opaque; BDRVCowState *s = bs->opaque;
int ret, n; int ret, n;
while (nb_sectors > 0) { while (nb_sectors > 0) {
if (is_changed(s->cow_bitmap, sector_num, nb_sectors, &n)) { if (is_changed(s->cow_bitmap, sector_num, nb_sectors, &n)) {
lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET); 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,
{ {
BDRVCowState *s = bs->opaque; BDRVCowState *s = bs->opaque;
int ret, i; int ret, i;
lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET); lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET);
ret = write(s->fd, buf, nb_sectors * 512); ret = write(s->fd, buf, nb_sectors * 512);
if (ret != nb_sectors * 512) if (ret != nb_sectors * 512)

View File

@ -28,7 +28,7 @@
typedef struct BDRVDMGState { typedef struct BDRVDMGState {
int fd; int fd;
/* each chunk contains a certain number of sectors, /* each chunk contains a certain number of sectors,
* offsets[i] is the offset in the .dmg file, * offsets[i] is the offset in the .dmg file,
* lengths[i] is the length of the compressed chunk, * lengths[i] is the length of the compressed chunk,
@ -86,7 +86,7 @@ static int dmg_open(BlockDriverState *bs, const char *filename, int flags)
bs->read_only = 1; bs->read_only = 1;
s->n_chunks = 0; s->n_chunks = 0;
s->offsets = s->lengths = s->sectors = s->sectorcounts = 0; s->offsets = s->lengths = s->sectors = s->sectorcounts = 0;
/* read offset of info blocks */ /* read offset of info blocks */
if(lseek(s->fd,-0x1d8,SEEK_END)<0) { if(lseek(s->fd,-0x1d8,SEEK_END)<0) {
dmg_close: dmg_close:
@ -167,7 +167,7 @@ dmg_close:
goto dmg_close; goto dmg_close;
s->current_chunk = s->n_chunks; s->current_chunk = s->n_chunks;
return 0; return 0;
} }

View File

@ -80,7 +80,7 @@ static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset);
static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename) static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename)
{ {
const QCowHeader *cow_header = (const void *)buf; const QCowHeader *cow_header = (const void *)buf;
if (buf_size >= sizeof(QCowHeader) && if (buf_size >= sizeof(QCowHeader) &&
be32_to_cpu(cow_header->magic) == QCOW_MAGIC && be32_to_cpu(cow_header->magic) == QCOW_MAGIC &&
be32_to_cpu(cow_header->version) == QCOW_VERSION) be32_to_cpu(cow_header->version) == QCOW_VERSION)
@ -108,7 +108,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
be64_to_cpus(&header.size); be64_to_cpus(&header.size);
be32_to_cpus(&header.crypt_method); be32_to_cpus(&header.crypt_method);
be64_to_cpus(&header.l1_table_offset); be64_to_cpus(&header.l1_table_offset);
if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION) if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION)
goto fail; goto fail;
if (header.size <= 1 || header.cluster_bits < 9) if (header.size <= 1 || header.cluster_bits < 9)
@ -151,7 +151,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
if (!s->cluster_data) if (!s->cluster_data)
goto fail; goto fail;
s->cluster_cache_offset = -1; s->cluster_cache_offset = -1;
/* read the backing file name */ /* read the backing file name */
if (header.backing_file_offset != 0) { if (header.backing_file_offset != 0) {
len = header.backing_file_size; len = header.backing_file_size;
@ -177,7 +177,7 @@ static int qcow_set_key(BlockDriverState *bs, const char *key)
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
uint8_t keybuf[16]; uint8_t keybuf[16];
int len, i; int len, i;
memset(keybuf, 0, 16); memset(keybuf, 0, 16);
len = strlen(key); len = strlen(key);
if (len > 16) if (len > 16)
@ -262,7 +262,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
uint64_t l2_offset, *l2_table, cluster_offset, tmp; uint64_t l2_offset, *l2_table, cluster_offset, tmp;
uint32_t min_count; uint32_t min_count;
int new_l2_table; int new_l2_table;
l1_index = offset >> (s->l2_bits + s->cluster_bits); l1_index = offset >> (s->l2_bits + s->cluster_bits);
l2_offset = s->l1_table[l1_index]; l2_offset = s->l1_table[l1_index];
new_l2_table = 0; new_l2_table = 0;
@ -420,7 +420,7 @@ static int decompress_buffer(uint8_t *out_buf, int out_buf_size,
inflateEnd(strm); inflateEnd(strm);
return 0; return 0;
} }
static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset) static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset)
{ {
int ret, csize; int ret, csize;
@ -450,7 +450,7 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num,
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
int ret, index_in_cluster, n; int ret, index_in_cluster, n;
uint64_t cluster_offset; uint64_t cluster_offset;
while (nb_sectors > 0) { while (nb_sectors > 0) {
cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0); cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0);
index_in_cluster = sector_num & (s->cluster_sectors - 1); index_in_cluster = sector_num & (s->cluster_sectors - 1);
@ -493,7 +493,7 @@ static int qcow_write(BlockDriverState *bs, int64_t sector_num,
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
int ret, index_in_cluster, n; int ret, index_in_cluster, n;
uint64_t cluster_offset; uint64_t cluster_offset;
while (nb_sectors > 0) { while (nb_sectors > 0) {
index_in_cluster = sector_num & (s->cluster_sectors - 1); index_in_cluster = sector_num & (s->cluster_sectors - 1);
n = s->cluster_sectors - index_in_cluster; n = s->cluster_sectors - index_in_cluster;
@ -572,7 +572,7 @@ static void qcow_aio_read_cb(void *opaque, int ret)
qemu_aio_release(acb); qemu_aio_release(acb);
return; return;
} }
/* prepare next AIO request */ /* prepare next AIO request */
acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9,
0, 0, 0, 0); 0, 0, 0, 0);
@ -627,7 +627,7 @@ static BlockDriverAIOCB *qcow_aio_read(BlockDriverState *bs,
acb->buf = buf; acb->buf = buf;
acb->nb_sectors = nb_sectors; acb->nb_sectors = nb_sectors;
acb->n = 0; acb->n = 0;
acb->cluster_offset = 0; acb->cluster_offset = 0;
qcow_aio_read_cb(acb, 0); qcow_aio_read_cb(acb, 0);
return &acb->common; return &acb->common;
@ -661,7 +661,7 @@ static void qcow_aio_write_cb(void *opaque, int ret)
qemu_aio_release(acb); qemu_aio_release(acb);
return; return;
} }
index_in_cluster = acb->sector_num & (s->cluster_sectors - 1); index_in_cluster = acb->sector_num & (s->cluster_sectors - 1);
acb->n = s->cluster_sectors - index_in_cluster; acb->n = s->cluster_sectors - index_in_cluster;
if (acb->n > acb->nb_sectors) if (acb->n > acb->nb_sectors)
@ -701,7 +701,7 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs,
{ {
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
QCowAIOCB *acb; QCowAIOCB *acb;
s->cluster_cache_offset = -1; /* disable compressed cache */ s->cluster_cache_offset = -1; /* disable compressed cache */
acb = qemu_aio_get(bs, cb, opaque); acb = qemu_aio_get(bs, cb, opaque);
@ -712,7 +712,7 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs,
acb->buf = (uint8_t *)buf; acb->buf = (uint8_t *)buf;
acb->nb_sectors = nb_sectors; acb->nb_sectors = nb_sectors;
acb->n = 0; acb->n = 0;
qcow_aio_write_cb(acb, 0); qcow_aio_write_cb(acb, 0);
return &acb->common; return &acb->common;
} }
@ -774,7 +774,7 @@ static int qcow_create(const char *filename, int64_t total_size,
} else { } else {
header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE); header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE);
} }
/* write all the data */ /* write all the data */
write(fd, &header, sizeof(header)); write(fd, &header, sizeof(header));
if (backing_file) { if (backing_file) {
@ -864,7 +864,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
return -1; return -1;
} }
} }
qemu_free(out_buf); qemu_free(out_buf);
return 0; return 0;
} }

View File

@ -37,7 +37,7 @@
- Size of compressed clusters is stored in sectors to reduce bit usage - Size of compressed clusters is stored in sectors to reduce bit usage
in the cluster offsets. in the cluster offsets.
- Support for storing additional data (such as the VM state) in the - Support for storing additional data (such as the VM state) in the
snapshots. snapshots.
- If a backing store is used, the cluster size is not constrained - If a backing store is used, the cluster size is not constrained
(could be backported to QCOW). (could be backported to QCOW).
- L2 tables have always a size of one cluster. - L2 tables have always a size of one cluster.
@ -176,7 +176,7 @@ static void check_refcounts(BlockDriverState *bs);
static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename) static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename)
{ {
const QCowHeader *cow_header = (const void *)buf; const QCowHeader *cow_header = (const void *)buf;
if (buf_size >= sizeof(QCowHeader) && if (buf_size >= sizeof(QCowHeader) &&
be32_to_cpu(cow_header->magic) == QCOW_MAGIC && be32_to_cpu(cow_header->magic) == QCOW_MAGIC &&
be32_to_cpu(cow_header->version) == QCOW_VERSION) be32_to_cpu(cow_header->version) == QCOW_VERSION)
@ -209,7 +209,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
be32_to_cpus(&header.refcount_table_clusters); be32_to_cpus(&header.refcount_table_clusters);
be64_to_cpus(&header.snapshots_offset); be64_to_cpus(&header.snapshots_offset);
be32_to_cpus(&header.nb_snapshots); be32_to_cpus(&header.nb_snapshots);
if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION) if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION)
goto fail; goto fail;
if (header.size <= 1 || if (header.size <= 1 ||
@ -267,7 +267,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
if (!s->cluster_data) if (!s->cluster_data)
goto fail; goto fail;
s->cluster_cache_offset = -1; s->cluster_cache_offset = -1;
if (refcount_init(bs) < 0) if (refcount_init(bs) < 0)
goto fail; goto fail;
@ -304,7 +304,7 @@ static int qcow_set_key(BlockDriverState *bs, const char *key)
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
uint8_t keybuf[16]; uint8_t keybuf[16];
int len, i; int len, i;
memset(keybuf, 0, 16); memset(keybuf, 0, 16);
len = strlen(key); len = strlen(key);
if (len > 16) if (len > 16)
@ -451,7 +451,7 @@ static int grow_l1_table(BlockDriverState *bs, int min_size)
/* write new table (align to cluster) */ /* write new table (align to cluster) */
new_l1_table_offset = alloc_clusters(bs, new_l1_size2); new_l1_table_offset = alloc_clusters(bs, new_l1_size2);
for(i = 0; i < s->l1_size; i++) for(i = 0; i < s->l1_size; i++)
new_l1_table[i] = cpu_to_be64(new_l1_table[i]); new_l1_table[i] = cpu_to_be64(new_l1_table[i]);
ret = bdrv_pwrite(s->hd, new_l1_table_offset, new_l1_table, new_l1_size2); 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)
goto fail; goto fail;
for(i = 0; i < s->l1_size; i++) for(i = 0; i < s->l1_size; i++)
new_l1_table[i] = be64_to_cpu(new_l1_table[i]); new_l1_table[i] = be64_to_cpu(new_l1_table[i]);
/* set new table */ /* set new table */
data64 = cpu_to_be64(new_l1_table_offset); data64 = cpu_to_be64(new_l1_table_offset);
if (bdrv_pwrite(s->hd, offsetof(QCowHeader, l1_table_offset), if (bdrv_pwrite(s->hd, offsetof(QCowHeader, l1_table_offset),
@ -501,7 +501,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
int min_index, i, j, l1_index, l2_index, ret; int min_index, i, j, l1_index, l2_index, ret;
uint64_t l2_offset, *l2_table, cluster_offset, tmp, old_l2_offset; uint64_t l2_offset, *l2_table, cluster_offset, tmp, old_l2_offset;
l1_index = offset >> (s->l2_bits + s->cluster_bits); l1_index = offset >> (s->l2_bits + s->cluster_bits);
if (l1_index >= s->l1_size) { if (l1_index >= s->l1_size) {
/* outside l1 table is allowed: we grow the table if needed */ /* outside l1 table is allowed: we grow the table if needed */
@ -600,7 +600,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
written */ written */
if ((n_end - n_start) < s->cluster_sectors) { if ((n_end - n_start) < s->cluster_sectors) {
uint64_t start_sect; uint64_t start_sect;
start_sect = (offset & ~(s->cluster_size - 1)) >> 9; start_sect = (offset & ~(s->cluster_size - 1)) >> 9;
ret = copy_sectors(bs, start_sect, ret = copy_sectors(bs, start_sect,
cluster_offset, 0, n_start); cluster_offset, 0, n_start);
@ -672,7 +672,7 @@ static int decompress_buffer(uint8_t *out_buf, int out_buf_size,
inflateEnd(strm); inflateEnd(strm);
return 0; return 0;
} }
static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset) static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset)
{ {
int ret, csize, nb_csectors, sector_offset; int ret, csize, nb_csectors, sector_offset;
@ -717,7 +717,7 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num,
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
int ret, index_in_cluster, n, n1; int ret, index_in_cluster, n, n1;
uint64_t cluster_offset; uint64_t cluster_offset;
while (nb_sectors > 0) { while (nb_sectors > 0) {
cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0); cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0);
index_in_cluster = sector_num & (s->cluster_sectors - 1); index_in_cluster = sector_num & (s->cluster_sectors - 1);
@ -762,7 +762,7 @@ static int qcow_write(BlockDriverState *bs, int64_t sector_num,
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
int ret, index_in_cluster, n; int ret, index_in_cluster, n;
uint64_t cluster_offset; uint64_t cluster_offset;
while (nb_sectors > 0) { while (nb_sectors > 0) {
index_in_cluster = sector_num & (s->cluster_sectors - 1); index_in_cluster = sector_num & (s->cluster_sectors - 1);
n = s->cluster_sectors - index_in_cluster; n = s->cluster_sectors - index_in_cluster;
@ -841,7 +841,7 @@ static void qcow_aio_read_cb(void *opaque, int ret)
qemu_aio_release(acb); qemu_aio_release(acb);
return; return;
} }
/* prepare next AIO request */ /* prepare next AIO request */
acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9,
0, 0, 0, 0); 0, 0, 0, 0);
@ -948,7 +948,7 @@ static void qcow_aio_write_cb(void *opaque, int ret)
qemu_aio_release(acb); qemu_aio_release(acb);
return; return;
} }
index_in_cluster = acb->sector_num & (s->cluster_sectors - 1); index_in_cluster = acb->sector_num & (s->cluster_sectors - 1);
acb->n = s->cluster_sectors - index_in_cluster; acb->n = s->cluster_sectors - index_in_cluster;
if (acb->n > acb->nb_sectors) if (acb->n > acb->nb_sectors)
@ -988,13 +988,13 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs,
{ {
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
QCowAIOCB *acb; QCowAIOCB *acb;
s->cluster_cache_offset = -1; /* disable compressed cache */ s->cluster_cache_offset = -1; /* disable compressed cache */
acb = qcow_aio_setup(bs, sector_num, (uint8_t*)buf, nb_sectors, cb, opaque); acb = qcow_aio_setup(bs, sector_num, (uint8_t*)buf, nb_sectors, cb, opaque);
if (!acb) if (!acb)
return NULL; return NULL;
qcow_aio_write_cb(acb, 0); qcow_aio_write_cb(acb, 0);
return &acb->common; return &acb->common;
} }
@ -1054,7 +1054,7 @@ static int qcow_create(const char *filename, int64_t total_size,
QCowHeader header; QCowHeader header;
uint64_t tmp, offset; uint64_t tmp, offset;
QCowCreateState s1, *s = &s1; QCowCreateState s1, *s = &s1;
memset(s, 0, sizeof(*s)); memset(s, 0, sizeof(*s));
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); 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,
s->refcount_block = qemu_mallocz(s->cluster_size); s->refcount_block = qemu_mallocz(s->cluster_size);
if (!s->refcount_block) if (!s->refcount_block)
goto fail; goto fail;
s->refcount_table_offset = offset; s->refcount_table_offset = offset;
header.refcount_table_offset = cpu_to_be64(offset); header.refcount_table_offset = cpu_to_be64(offset);
header.refcount_table_clusters = cpu_to_be32(1); header.refcount_table_clusters = cpu_to_be32(1);
@ -1111,7 +1111,7 @@ static int qcow_create(const char *filename, int64_t total_size,
create_refcount_update(s, s->l1_table_offset, l1_size * sizeof(uint64_t)); create_refcount_update(s, s->l1_table_offset, l1_size * sizeof(uint64_t));
create_refcount_update(s, s->refcount_table_offset, s->cluster_size); create_refcount_update(s, s->refcount_table_offset, s->cluster_size);
create_refcount_update(s, s->refcount_block_offset, s->cluster_size); create_refcount_update(s, s->refcount_block_offset, s->cluster_size);
/* write all the data */ /* write all the data */
write(fd, &header, sizeof(header)); write(fd, &header, sizeof(header));
if (backing_file) { if (backing_file) {
@ -1124,7 +1124,7 @@ static int qcow_create(const char *filename, int64_t total_size,
} }
lseek(fd, s->refcount_table_offset, SEEK_SET); lseek(fd, s->refcount_table_offset, SEEK_SET);
write(fd, s->refcount_table, s->cluster_size); write(fd, s->refcount_table, s->cluster_size);
lseek(fd, s->refcount_block_offset, SEEK_SET); lseek(fd, s->refcount_block_offset, SEEK_SET);
write(fd, s->refcount_block, s->cluster_size); write(fd, s->refcount_block, s->cluster_size);
@ -1153,7 +1153,7 @@ static int qcow_make_empty(BlockDriverState *bs)
ret = bdrv_truncate(s->hd, s->l1_table_offset + l1_length); ret = bdrv_truncate(s->hd, s->l1_table_offset + l1_length);
if (ret < 0) if (ret < 0)
return ret; return ret;
l2_cache_reset(bs); l2_cache_reset(bs);
#endif #endif
return 0; return 0;
@ -1223,7 +1223,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
return -1; return -1;
} }
} }
qemu_free(out_buf); qemu_free(out_buf);
return 0; return 0;
} }
@ -1256,7 +1256,7 @@ static int update_snapshot_refcount(BlockDriverState *bs,
uint64_t *l1_table, *l2_table, l2_offset, offset, l1_size2, l1_allocated; uint64_t *l1_table, *l2_table, l2_offset, offset, l1_size2, l1_allocated;
int64_t old_offset, old_l2_offset; int64_t old_offset, old_l2_offset;
int l2_size, i, j, l1_modified, l2_modified, nb_csectors, refcount; int l2_size, i, j, l1_modified, l2_modified, nb_csectors, refcount;
l2_cache_reset(bs); l2_cache_reset(bs);
l2_table = NULL; l2_table = NULL;
@ -1278,7 +1278,7 @@ static int update_snapshot_refcount(BlockDriverState *bs,
l1_table = s->l1_table; l1_table = s->l1_table;
l1_allocated = 0; l1_allocated = 0;
} }
l2_size = s->l2_size * sizeof(uint64_t); l2_size = s->l2_size * sizeof(uint64_t);
l2_table = qemu_malloc(l2_size); l2_table = qemu_malloc(l2_size);
if (!l2_table) if (!l2_table)
@ -1455,7 +1455,7 @@ static int qcow_write_snapshots(BlockDriverState *bs)
snapshots_offset = alloc_clusters(bs, snapshots_size); snapshots_offset = alloc_clusters(bs, snapshots_size);
offset = snapshots_offset; offset = snapshots_offset;
for(i = 0; i < s->nb_snapshots; i++) { for(i = 0; i < s->nb_snapshots; i++) {
sn = s->snapshots + i; sn = s->snapshots + i;
memset(&h, 0, sizeof(h)); memset(&h, 0, sizeof(h));
@ -1465,7 +1465,7 @@ static int qcow_write_snapshots(BlockDriverState *bs)
h.date_sec = cpu_to_be32(sn->date_sec); h.date_sec = cpu_to_be32(sn->date_sec);
h.date_nsec = cpu_to_be32(sn->date_nsec); h.date_nsec = cpu_to_be32(sn->date_nsec);
h.vm_clock_nsec = cpu_to_be64(sn->vm_clock_nsec); h.vm_clock_nsec = cpu_to_be64(sn->vm_clock_nsec);
id_str_size = strlen(sn->id_str); id_str_size = strlen(sn->id_str);
name_size = strlen(sn->name); name_size = strlen(sn->name);
h.id_str_size = cpu_to_be16(id_str_size); 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)
{ {
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
int i, ret; int i, ret;
ret = find_snapshot_by_id(bs, name); ret = find_snapshot_by_id(bs, name);
if (ret >= 0) if (ret >= 0)
return ret; return ret;
@ -1552,7 +1552,7 @@ static int qcow_snapshot_create(BlockDriverState *bs,
QCowSnapshot *snapshots1, sn1, *sn = &sn1; QCowSnapshot *snapshots1, sn1, *sn = &sn1;
int i, ret; int i, ret;
uint64_t *l1_table = NULL; uint64_t *l1_table = NULL;
memset(sn, 0, sizeof(*sn)); memset(sn, 0, sizeof(*sn));
if (sn_info->id_str[0] == '\0') { if (sn_info->id_str[0] == '\0') {
@ -1663,7 +1663,7 @@ static int qcow_snapshot_delete(BlockDriverState *bs, const char *snapshot_id)
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
QCowSnapshot *sn; QCowSnapshot *sn;
int snapshot_index, ret; int snapshot_index, ret;
snapshot_index = find_snapshot_by_id_or_name(bs, snapshot_id); snapshot_index = find_snapshot_by_id_or_name(bs, snapshot_id);
if (snapshot_index < 0) if (snapshot_index < 0)
return -ENOENT; return -ENOENT;
@ -1731,7 +1731,7 @@ static int refcount_init(BlockDriverState *bs)
{ {
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
int ret, refcount_table_size2, i; int ret, refcount_table_size2, i;
s->refcount_block_cache = qemu_malloc(s->cluster_size); s->refcount_block_cache = qemu_malloc(s->cluster_size);
if (!s->refcount_block_cache) if (!s->refcount_block_cache)
goto fail; goto fail;
@ -1839,7 +1839,7 @@ static int64_t alloc_bytes(BlockDriverState *bs, int size)
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
int64_t offset, cluster_offset; int64_t offset, cluster_offset;
int free_in_cluster; int free_in_cluster;
assert(size > 0 && size <= s->cluster_size); assert(size > 0 && size <= s->cluster_size);
if (s->free_byte_offset == 0) { if (s->free_byte_offset == 0) {
s->free_byte_offset = alloc_clusters(bs, s->cluster_size); s->free_byte_offset = alloc_clusters(bs, s->cluster_size);
@ -2043,7 +2043,7 @@ static void inc_refcounts(BlockDriverState *bs,
BDRVQcowState *s = bs->opaque; BDRVQcowState *s = bs->opaque;
int64_t start, last, cluster_offset; int64_t start, last, cluster_offset;
int k; int k;
if (size <= 0) if (size <= 0)
return; return;
@ -2086,7 +2086,7 @@ static int check_refcounts_l1(BlockDriverState *bs,
goto fail; goto fail;
for(i = 0;i < l1_size; i++) for(i = 0;i < l1_size; i++)
be64_to_cpus(&l1_table[i]); be64_to_cpus(&l1_table[i]);
l2_size = s->l2_size * sizeof(uint64_t); l2_size = s->l2_size * sizeof(uint64_t);
l2_table = qemu_malloc(l2_size); l2_table = qemu_malloc(l2_size);
if (!l2_table) if (!l2_table)
@ -2165,7 +2165,7 @@ static void check_refcounts(BlockDriverState *bs)
/* header */ /* header */
inc_refcounts(bs, refcount_table, nb_clusters, inc_refcounts(bs, refcount_table, nb_clusters,
0, s->cluster_size); 0, s->cluster_size);
check_refcounts_l1(bs, refcount_table, nb_clusters, check_refcounts_l1(bs, refcount_table, nb_clusters,
s->l1_table_offset, s->l1_size, 1); s->l1_table_offset, s->l1_size, 1);

View File

@ -142,7 +142,7 @@ static int raw_pread(BlockDriverState *bs, int64_t offset,
{ {
BDRVRawState *s = bs->opaque; BDRVRawState *s = bs->opaque;
int ret; int ret;
ret = fd_open(bs); ret = fd_open(bs);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -194,7 +194,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset,
{ {
BDRVRawState *s = bs->opaque; BDRVRawState *s = bs->opaque;
int ret; int ret;
ret = fd_open(bs); ret = fd_open(bs);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -259,7 +259,7 @@ void qemu_aio_init(void)
struct sigaction act; struct sigaction act;
aio_initialized = 1; aio_initialized = 1;
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ act.sa_flags = 0; /* do not restart syscalls to interrupt select() */
act.sa_handler = aio_signal_handler; act.sa_handler = aio_signal_handler;
@ -547,7 +547,7 @@ BlockDriver bdrv_raw = {
raw_close, raw_close,
raw_create, raw_create,
raw_flush, raw_flush,
.bdrv_aio_read = raw_aio_read, .bdrv_aio_read = raw_aio_read,
.bdrv_aio_write = raw_aio_write, .bdrv_aio_write = raw_aio_write,
.bdrv_aio_cancel = raw_aio_cancel, .bdrv_aio_cancel = raw_aio_cancel,
@ -576,7 +576,7 @@ kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator )
if ( KERN_SUCCESS != kernResult ) { if ( KERN_SUCCESS != kernResult ) {
printf( "IOMasterPort returned %d\n", kernResult ); printf( "IOMasterPort returned %d\n", kernResult );
} }
classesToMatch = IOServiceMatching( kIOCDMediaClass ); classesToMatch = IOServiceMatching( kIOCDMediaClass );
if ( classesToMatch == NULL ) { if ( classesToMatch == NULL ) {
printf( "IOServiceMatching returned a NULL dictionary.\n" ); printf( "IOServiceMatching returned a NULL dictionary.\n" );
@ -588,7 +588,7 @@ kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator )
{ {
printf( "IOServiceGetMatchingServices returned %d\n", kernResult ); printf( "IOServiceGetMatchingServices returned %d\n", kernResult );
} }
return kernResult; return kernResult;
} }
@ -614,7 +614,7 @@ kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFIndex ma
} }
IOObjectRelease( nextMedia ); IOObjectRelease( nextMedia );
} }
return kernResult; return kernResult;
} }
@ -634,7 +634,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
kernResult = FindEjectableCDMedia( &mediaIterator ); kernResult = FindEjectableCDMedia( &mediaIterator );
kernResult = GetBSDPath( mediaIterator, bsdPath, sizeof( bsdPath ) ); kernResult = GetBSDPath( mediaIterator, bsdPath, sizeof( bsdPath ) );
if ( bsdPath[ 0 ] != '\0' ) { if ( bsdPath[ 0 ] != '\0' ) {
strcat(bsdPath,"s0"); strcat(bsdPath,"s0");
/* some CDs don't have a partition 0 */ /* some CDs don't have a partition 0 */
@ -646,7 +646,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
} }
filename = bsdPath; filename = bsdPath;
} }
if ( mediaIterator ) if ( mediaIterator )
IOObjectRelease( mediaIterator ); IOObjectRelease( mediaIterator );
} }
@ -883,7 +883,7 @@ BlockDriver bdrv_host_device = {
raw_close, raw_close,
NULL, NULL,
raw_flush, raw_flush,
.bdrv_aio_read = raw_aio_read, .bdrv_aio_read = raw_aio_read,
.bdrv_aio_write = raw_aio_write, .bdrv_aio_write = raw_aio_write,
.bdrv_aio_cancel = raw_aio_cancel, .bdrv_aio_cancel = raw_aio_cancel,
@ -999,7 +999,7 @@ static int raw_pread(BlockDriverState *bs, int64_t offset,
OVERLAPPED ov; OVERLAPPED ov;
DWORD ret_count; DWORD ret_count;
int ret; int ret;
memset(&ov, 0, sizeof(ov)); memset(&ov, 0, sizeof(ov));
ov.Offset = offset; ov.Offset = offset;
ov.OffsetHigh = offset >> 32; ov.OffsetHigh = offset >> 32;
@ -1021,7 +1021,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset,
OVERLAPPED ov; OVERLAPPED ov;
DWORD ret_count; DWORD ret_count;
int ret; int ret;
memset(&ov, 0, sizeof(ov)); memset(&ov, 0, sizeof(ov));
ov.Offset = offset; ov.Offset = offset;
ov.OffsetHigh = offset >> 32; ov.OffsetHigh = offset >> 32;
@ -1256,7 +1256,7 @@ BlockDriver bdrv_raw = {
raw_close, raw_close,
raw_create, raw_create,
raw_flush, raw_flush,
#if 0 #if 0
.bdrv_aio_read = raw_aio_read, .bdrv_aio_read = raw_aio_read,
.bdrv_aio_write = raw_aio_write, .bdrv_aio_write = raw_aio_write,
@ -1335,7 +1335,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
} }
} }
s->type = find_device_type(bs, filename); s->type = find_device_type(bs, filename);
if ((flags & BDRV_O_ACCESS) == O_RDWR) { if ((flags & BDRV_O_ACCESS) == O_RDWR) {
access_flags = GENERIC_READ | GENERIC_WRITE; access_flags = GENERIC_READ | GENERIC_WRITE;
} else { } else {
@ -1406,7 +1406,7 @@ BlockDriver bdrv_host_device = {
raw_close, raw_close,
NULL, NULL,
raw_flush, raw_flush,
#if 0 #if 0
.bdrv_aio_read = raw_aio_read, .bdrv_aio_read = raw_aio_read,
.bdrv_aio_write = raw_aio_write, .bdrv_aio_write = raw_aio_write,

View File

@ -110,7 +110,7 @@ static int vmdk_probe(const uint8_t *buf, int buf_size, const char *filename)
#define CHECK_CID 1 #define CHECK_CID 1
#define SECTOR_SIZE 512 #define SECTOR_SIZE 512
#define DESC_SIZE 20*SECTOR_SIZE // 20 sectors of 512 bytes each #define DESC_SIZE 20*SECTOR_SIZE // 20 sectors of 512 bytes each
#define HEADER_SIZE 512 // first sector of 512 bytes #define HEADER_SIZE 512 // first sector of 512 bytes
@ -308,7 +308,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file)
fail_gd: fail_gd:
qemu_free(gd_buf); qemu_free(gd_buf);
fail_rgd: fail_rgd:
qemu_free(rgd_buf); qemu_free(rgd_buf);
fail: fail:
close(p_fd); close(p_fd);
@ -341,7 +341,7 @@ static int vmdk_parent_open(BlockDriverState *bs, const char * filename)
p_name += sizeof("parentFileNameHint") + 1; p_name += sizeof("parentFileNameHint") + 1;
if ((end_name = strchr(p_name,'\"')) == 0) if ((end_name = strchr(p_name,'\"')) == 0)
return -1; return -1;
strncpy(s->hd->backing_file, p_name, end_name - p_name); strncpy(s->hd->backing_file, p_name, end_name - p_name);
if (stat(s->hd->backing_file, &file_buf) != 0) { if (stat(s->hd->backing_file, &file_buf) != 0) {
path_combine(parent_img_name, sizeof(parent_img_name), path_combine(parent_img_name, sizeof(parent_img_name),
@ -761,8 +761,8 @@ static int vmdk_create(const char *filename, int64_t total_size,
header.check_bytes[1] = 0x20; header.check_bytes[1] = 0x20;
header.check_bytes[2] = 0xd; header.check_bytes[2] = 0xd;
header.check_bytes[3] = 0xa; header.check_bytes[3] = 0xa;
/* write all the data */ /* write all the data */
write(fd, &magic, sizeof(magic)); write(fd, &magic, sizeof(magic));
write(fd, &header, sizeof(header)); write(fd, &header, sizeof(header));
@ -773,7 +773,7 @@ static int vmdk_create(const char *filename, int64_t total_size,
for (i = 0, tmp = header.rgd_offset + gd_size; for (i = 0, tmp = header.rgd_offset + gd_size;
i < gt_count; i++, tmp += gt_size) i < gt_count; i++, tmp += gt_size)
write(fd, &tmp, sizeof(tmp)); write(fd, &tmp, sizeof(tmp));
/* write backup grain directory */ /* write backup grain directory */
lseek(fd, le64_to_cpu(header.gd_offset) << 9, SEEK_SET); lseek(fd, le64_to_cpu(header.gd_offset) << 9, SEEK_SET);
for (i = 0, tmp = header.gd_offset + gd_size; for (i = 0, tmp = header.gd_offset + gd_size;

View File

@ -65,7 +65,7 @@ struct vpc_subheader {
typedef struct BDRVVPCState { typedef struct BDRVVPCState {
int fd; int fd;
int pagetable_entries; int pagetable_entries;
uint32_t *pagetable; uint32_t *pagetable;
@ -74,7 +74,7 @@ typedef struct BDRVVPCState {
uint8_t *pageentry_u8; uint8_t *pageentry_u8;
uint32_t *pageentry_u32; uint32_t *pageentry_u32;
uint16_t *pageentry_u16; uint16_t *pageentry_u16;
uint64_t last_bitmap; uint64_t last_bitmap;
#endif #endif
} BDRVVPCState; } BDRVVPCState;
@ -97,7 +97,7 @@ static int vpc_open(BlockDriverState *bs, const char *filename, int flags)
return -1; return -1;
bs->read_only = 1; // no write support yet bs->read_only = 1; // no write support yet
s->fd = fd; s->fd = fd;
if (read(fd, &header, HEADER_SIZE) != HEADER_SIZE) if (read(fd, &header, HEADER_SIZE) != HEADER_SIZE)
@ -153,13 +153,13 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
pagetable_index = offset / s->pageentry_size; pagetable_index = offset / s->pageentry_size;
pageentry_index = (offset % s->pageentry_size) / 512; pageentry_index = (offset % s->pageentry_size) / 512;
if (pagetable_index > s->pagetable_entries || s->pagetable[pagetable_index] == 0xffffffff) if (pagetable_index > s->pagetable_entries || s->pagetable[pagetable_index] == 0xffffffff)
return -1; // not allocated return -1; // not allocated
bitmap_offset = 512 * s->pagetable[pagetable_index]; bitmap_offset = 512 * s->pagetable[pagetable_index];
block_offset = bitmap_offset + 512 + (512 * pageentry_index); block_offset = bitmap_offset + 512 + (512 * pageentry_index);
// printf("sector: %" PRIx64 ", index: %x, offset: %x, bioff: %" PRIx64 ", bloff: %" PRIx64 "\n", // printf("sector: %" PRIx64 ", index: %x, offset: %x, bioff: %" PRIx64 ", bloff: %" PRIx64 "\n",
// sector_num, pagetable_index, pageentry_index, // sector_num, pagetable_index, pageentry_index,
// bitmap_offset, block_offset); // bitmap_offset, block_offset);

View File

@ -153,7 +153,7 @@ static inline int array_roll(array_t* array,int index_to,int index_from,int coun
index_to<0 || index_to>=array->next || index_to<0 || index_to>=array->next ||
index_from<0 || index_from>=array->next) index_from<0 || index_from>=array->next)
return -1; return -1;
if(index_to==index_from) if(index_to==index_from)
return 0; return 0;
@ -167,7 +167,7 @@ static inline int array_roll(array_t* array,int index_to,int index_from,int coun
memmove(to+is*count,to,from-to); memmove(to+is*count,to,from-to);
else else
memmove(from,from+is*count,to-from); memmove(from,from+is*count,to-from);
memcpy(to,buf,is*count); memcpy(to,buf,is*count);
free(buf); free(buf);
@ -319,10 +319,10 @@ typedef struct BDRVVVFATState {
BlockDriverState* bs; /* pointer to parent */ BlockDriverState* bs; /* pointer to parent */
unsigned int first_sectors_number; /* 1 for a single partition, 0x40 for a disk with partition table */ unsigned int first_sectors_number; /* 1 for a single partition, 0x40 for a disk with partition table */
unsigned char first_sectors[0x40*0x200]; unsigned char first_sectors[0x40*0x200];
int fat_type; /* 16 or 32 */ int fat_type; /* 16 or 32 */
array_t fat,directory,mapping; array_t fat,directory,mapping;
unsigned int cluster_size; unsigned int cluster_size;
unsigned int sectors_per_cluster; unsigned int sectors_per_cluster;
unsigned int sectors_per_fat; unsigned int sectors_per_fat;
@ -332,7 +332,7 @@ typedef struct BDRVVVFATState {
uint32_t sector_count; /* total number of sectors of the partition */ uint32_t sector_count; /* total number of sectors of the partition */
uint32_t cluster_count; /* total number of clusters of this partition */ uint32_t cluster_count; /* total number of clusters of this partition */
uint32_t max_fat_value; uint32_t max_fat_value;
int current_fd; int current_fd;
mapping_t* current_mapping; mapping_t* current_mapping;
unsigned char* cluster; /* points to current cluster */ unsigned char* cluster; /* points to current cluster */
@ -358,7 +358,7 @@ static void init_mbr(BDRVVVFATState* s)
partition_t* partition=&(real_mbr->partition[0]); partition_t* partition=&(real_mbr->partition[0]);
memset(s->first_sectors,0,512); memset(s->first_sectors,0,512);
partition->attributes=0x80; /* bootable */ partition->attributes=0x80; /* bootable */
partition->start_head=1; partition->start_head=1;
partition->start_sector=1; partition->start_sector=1;
@ -478,7 +478,7 @@ static inline uint8_t fat_chksum(const direntry_t* entry)
for(i=0;i<11;i++) for(i=0;i<11;i++)
chksum=(((chksum&0xfe)>>1)|((chksum&0x01)?0x80:0)) chksum=(((chksum&0xfe)>>1)|((chksum&0x01)?0x80:0))
+(unsigned char)entry->name[i]; +(unsigned char)entry->name[i];
return chksum; return chksum;
} }
@ -554,7 +554,7 @@ static inline void init_fat(BDRVVVFATState* s)
s->sectors_per_fat * 0x200 / s->fat.item_size - 1); s->sectors_per_fat * 0x200 / s->fat.item_size - 1);
} }
memset(s->fat.pointer,0,s->fat.size); memset(s->fat.pointer,0,s->fat.size);
switch(s->fat_type) { switch(s->fat_type) {
case 12: s->max_fat_value=0xfff; break; case 12: s->max_fat_value=0xfff; break;
case 16: s->max_fat_value=0xffff; break; case 16: s->max_fat_value=0xffff; break;
@ -579,9 +579,9 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s,
memcpy(entry->name,filename,strlen(filename)); memcpy(entry->name,filename,strlen(filename));
return entry; return entry;
} }
entry_long=create_long_filename(s,filename); entry_long=create_long_filename(s,filename);
i = strlen(filename); i = strlen(filename);
for(j = i - 1; j>0 && filename[j]!='.';j--); for(j = i - 1; j>0 && filename[j]!='.';j--);
if (j > 0) if (j > 0)
@ -592,7 +592,7 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s,
entry=array_get_next(&(s->directory)); entry=array_get_next(&(s->directory));
memset(entry->name,0x20,11); memset(entry->name,0x20,11);
strncpy(entry->name,filename,i); strncpy(entry->name,filename,i);
if(j > 0) if(j > 0)
for (i = 0; i < 3 && filename[j+1+i]; i++) for (i = 0; i < 3 && filename[j+1+i]; i++)
entry->extension[i] = filename[j+1+i]; entry->extension[i] = filename[j+1+i];
@ -675,7 +675,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index)
mapping->end = mapping->begin; mapping->end = mapping->begin;
return -1; return -1;
} }
i = mapping->info.dir.first_dir_index = i = mapping->info.dir.first_dir_index =
first_cluster == 0 ? 0 : s->directory.next; first_cluster == 0 ? 0 : s->directory.next;
@ -774,7 +774,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index)
direntry = (direntry_t*)array_get(&(s->directory), mapping->dir_index); direntry = (direntry_t*)array_get(&(s->directory), mapping->dir_index);
set_begin_of_direntry(direntry, mapping->begin); set_begin_of_direntry(direntry, mapping->begin);
return 0; return 0;
} }
@ -825,7 +825,7 @@ static int init_directories(BDRVVVFATState* s,
*/ */
i = 1+s->sectors_per_cluster*0x200*8/s->fat_type; i = 1+s->sectors_per_cluster*0x200*8/s->fat_type;
s->sectors_per_fat=(s->sector_count+i)/i; /* round up */ s->sectors_per_fat=(s->sector_count+i)/i; /* round up */
array_init(&(s->mapping),sizeof(mapping_t)); array_init(&(s->mapping),sizeof(mapping_t));
array_init(&(s->directory),sizeof(direntry_t)); array_init(&(s->directory),sizeof(direntry_t));
@ -987,7 +987,7 @@ DLOG(if (stderr == NULL) {
s->qcow_filename = NULL; s->qcow_filename = NULL;
s->fat2 = NULL; s->fat2 = NULL;
s->downcase_short_names = 1; s->downcase_short_names = 1;
if (!strstart(dirname, "fat:", NULL)) if (!strstart(dirname, "fat:", NULL))
return -1; return -1;
@ -1709,7 +1709,7 @@ static int check_directory_consistency(BDRVVVFATState *s,
} else } else
/* new directory */ /* new directory */
schedule_mkdir(s, cluster_num, strdup(path)); schedule_mkdir(s, cluster_num, strdup(path));
lfn_init(&lfn); lfn_init(&lfn);
do { do {
int i; int i;
@ -2069,7 +2069,7 @@ static int commit_mappings(BDRVVVFATState* s,
mapping = next_mapping; mapping = next_mapping;
} }
cluster = c1; cluster = c1;
} }

22
block.c
View File

@ -180,7 +180,7 @@ int bdrv_create(BlockDriver *drv,
void get_tmp_filename(char *filename, int size) void get_tmp_filename(char *filename, int size)
{ {
char temp_dir[MAX_PATH]; char temp_dir[MAX_PATH];
GetTempPath(MAX_PATH, temp_dir); GetTempPath(MAX_PATH, temp_dir);
GetTempFileName(temp_dir, "qem", 0, filename); GetTempFileName(temp_dir, "qem", 0, filename);
} }
@ -202,7 +202,7 @@ static int is_windows_drive_prefix(const char *filename)
(filename[0] >= 'A' && filename[0] <= 'Z')) && (filename[0] >= 'A' && filename[0] <= 'Z')) &&
filename[1] == ':'); filename[1] == ':');
} }
static int is_windows_drive(const char *filename) static int is_windows_drive(const char *filename)
{ {
if (is_windows_drive_prefix(filename) && if (is_windows_drive_prefix(filename) &&
@ -251,7 +251,7 @@ static BlockDriver *find_image_format(const char *filename)
BlockDriver *drv1, *drv; BlockDriver *drv1, *drv;
uint8_t buf[2048]; uint8_t buf[2048];
BlockDriverState *bs; BlockDriverState *bs;
/* detect host devices. By convention, /dev/cdrom[N] is always /* detect host devices. By convention, /dev/cdrom[N] is always
recognized as a host CDROM */ recognized as a host CDROM */
if (strstart(filename, "/dev/cdrom", NULL)) if (strstart(filename, "/dev/cdrom", NULL))
@ -268,7 +268,7 @@ static BlockDriver *find_image_format(const char *filename)
} }
} }
#endif #endif
drv = find_protocol(filename); drv = find_protocol(filename);
/* no need to test disk image formats for vvfat */ /* no need to test disk image formats for vvfat */
if (drv == &bdrv_vvfat) if (drv == &bdrv_vvfat)
@ -324,7 +324,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
int ret, open_flags; int ret, open_flags;
char tmp_filename[PATH_MAX]; char tmp_filename[PATH_MAX];
char backing_filename[PATH_MAX]; char backing_filename[PATH_MAX];
bs->read_only = 0; bs->read_only = 0;
bs->is_temporary = 0; bs->is_temporary = 0;
bs->encrypted = 0; bs->encrypted = 0;
@ -332,7 +332,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
if (flags & BDRV_O_SNAPSHOT) { if (flags & BDRV_O_SNAPSHOT) {
BlockDriverState *bs1; BlockDriverState *bs1;
int64_t total_size; int64_t total_size;
/* if snapshot, we create a temporary backing file and open it /* if snapshot, we create a temporary backing file and open it
instead of opening 'filename' directly */ instead of opening 'filename' directly */
@ -347,7 +347,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
} }
total_size = bdrv_getlength(bs1) >> SECTOR_BITS; total_size = bdrv_getlength(bs1) >> SECTOR_BITS;
bdrv_delete(bs1); bdrv_delete(bs1);
get_tmp_filename(tmp_filename, sizeof(tmp_filename)); get_tmp_filename(tmp_filename, sizeof(tmp_filename));
realpath(filename, backing_filename); realpath(filename, backing_filename);
if (bdrv_create(&bdrv_qcow2, tmp_filename, if (bdrv_create(&bdrv_qcow2, tmp_filename,
@ -540,7 +540,7 @@ int bdrv_write(BlockDriverState *bs, int64_t sector_num,
if (bs->read_only) if (bs->read_only)
return -EACCES; return -EACCES;
if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
memcpy(bs->boot_sector_data, buf, 512); memcpy(bs->boot_sector_data, buf, 512);
} }
if (drv->bdrv_pwrite) { if (drv->bdrv_pwrite) {
int ret, len; int ret, len;
@ -919,7 +919,7 @@ int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,
return -ENOTSUP; return -ENOTSUP;
return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors); return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors);
} }
int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
{ {
BlockDriver *drv = bs->drv; BlockDriver *drv = bs->drv;
@ -1062,7 +1062,7 @@ BlockDriverAIOCB *bdrv_aio_read(BlockDriverState *bs, int64_t sector_num,
if (!drv) if (!drv)
return NULL; return NULL;
/* XXX: we assume that nb_sectors == 0 is suppored by the async read */ /* XXX: we assume that nb_sectors == 0 is suppored by the async read */
if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
memcpy(buf, bs->boot_sector_data, 512); memcpy(buf, bs->boot_sector_data, 512);
@ -1085,7 +1085,7 @@ BlockDriverAIOCB *bdrv_aio_write(BlockDriverState *bs, int64_t sector_num,
if (bs->read_only) if (bs->read_only)
return NULL; return NULL;
if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
memcpy(bs->boot_sector_data, buf, 512); memcpy(bs->boot_sector_data, buf, 512);
} }
return drv->bdrv_aio_write(bs, sector_num, buf, nb_sectors, cb, opaque); return drv->bdrv_aio_write(bs, sector_num, buf, nb_sectors, cb, opaque);

View File

@ -79,7 +79,7 @@ struct BlockDriver {
int (*bdrv_media_changed)(BlockDriverState *bs); int (*bdrv_media_changed)(BlockDriverState *bs);
int (*bdrv_eject)(BlockDriverState *bs, int eject_flag); int (*bdrv_eject)(BlockDriverState *bs, int eject_flag);
int (*bdrv_set_locked)(BlockDriverState *bs, int locked); int (*bdrv_set_locked)(BlockDriverState *bs, int locked);
BlockDriverAIOCB *free_aiocb; BlockDriverAIOCB *free_aiocb;
struct BlockDriver *next; struct BlockDriver *next;
}; };
@ -111,7 +111,7 @@ struct BlockDriverState {
/* async read/write emulation */ /* async read/write emulation */
void *sync_aiocb; void *sync_aiocb;
/* NOTE: the following infos are only hints for real hardware /* NOTE: the following infos are only hints for real hardware
drivers. They are not used by the block driver */ drivers. They are not used by the block driver */
int cyls, heads, secs, translation; int cyls, heads, secs, translation;

190
cocoa.m
View File

@ -84,7 +84,7 @@ static void cocoa_update(DisplayState *ds, int x, int y, int w, int h)
MacSetRectRgn (temp, x, y, MacSetRectRgn (temp, x, y,
x + w, y + h); x + w, y + h);
MacUnionRgn (dirty, temp, dirty); MacUnionRgn (dirty, temp, dirty);
/* Flush the dirty region */ /* Flush the dirty region */
QDFlushPortBuffer ( [ qd_view qdPort ], dirty ); QDFlushPortBuffer ( [ qd_view qdPort ], dirty );
DisposeRgn (dirty); DisposeRgn (dirty);
@ -102,9 +102,9 @@ static void cocoa_resize(DisplayState *ds, int w, int h)
static void *screen_pixels; static void *screen_pixels;
static int screen_pitch; static int screen_pitch;
NSRect contentRect; NSRect contentRect;
//printf("resizing to %d %d\n", w, h); //printf("resizing to %d %d\n", w, h);
contentRect = NSMakeRect (0, 0, w, h); contentRect = NSMakeRect (0, 0, w, h);
if(window) if(window)
{ {
@ -119,33 +119,33 @@ static void cocoa_resize(DisplayState *ds, int w, int h)
fprintf(stderr, "(cocoa) can't create window\n"); fprintf(stderr, "(cocoa) can't create window\n");
exit(1); exit(1);
} }
if(qd_view) if(qd_view)
[qd_view release]; [qd_view release];
qd_view = [ [ NSQuickDrawView alloc ] initWithFrame:contentRect ]; qd_view = [ [ NSQuickDrawView alloc ] initWithFrame:contentRect ];
if(!qd_view) if(!qd_view)
{ {
fprintf(stderr, "(cocoa) can't create qd_view\n"); fprintf(stderr, "(cocoa) can't create qd_view\n");
exit(1); exit(1);
} }
[ window setAcceptsMouseMovedEvents:YES ]; [ window setAcceptsMouseMovedEvents:YES ];
[ window setTitle:@"Qemu" ]; [ window setTitle:@"Qemu" ];
[ window setReleasedWhenClosed:NO ]; [ window setReleasedWhenClosed:NO ];
/* Set screen to black */ /* Set screen to black */
[ window setBackgroundColor: [NSColor blackColor] ]; [ window setBackgroundColor: [NSColor blackColor] ];
/* set window position */ /* set window position */
[ window center ]; [ window center ];
[ qd_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable ]; [ qd_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable ];
[ [ window contentView ] addSubview:qd_view ]; [ [ window contentView ] addSubview:qd_view ];
[ qd_view release ]; [ qd_view release ];
[ window makeKeyAndOrderFront:nil ]; [ window makeKeyAndOrderFront:nil ];
/* Careful here, the window seems to have to be onscreen to do that */ /* Careful here, the window seems to have to be onscreen to do that */
LockPortBits ( [ qd_view qdPort ] ); LockPortBits ( [ qd_view qdPort ] );
screen_pixels = GetPixBaseAddr ( GetPortPixMap ( [ qd_view qdPort ] ) ); screen_pixels = GetPixBaseAddr ( GetPortPixMap ( [ qd_view qdPort ] ) );
@ -154,9 +154,9 @@ static void cocoa_resize(DisplayState *ds, int w, int h)
{ {
int vOffset = [ window frame ].size.height - int vOffset = [ window frame ].size.height -
[ qd_view frame ].size.height - [ qd_view frame ].origin.y; [ qd_view frame ].size.height - [ qd_view frame ].origin.y;
int hOffset = [ qd_view frame ].origin.x; int hOffset = [ qd_view frame ].origin.x;
screen_pixels += (vOffset * screen_pitch) + hOffset * (device_bpp/8); screen_pixels += (vOffset * screen_pitch) + hOffset * (device_bpp/8);
} }
ds->data = screen_pixels; ds->data = screen_pixels;
@ -310,38 +310,38 @@ int keymap[] =
208,// 125 0x7D 0xd0 E0,50 D ARROW QZ_DOWN 208,// 125 0x7D 0xd0 E0,50 D ARROW QZ_DOWN
200,// 126 0x7E 0xc8 E0,48 U ARROW QZ_UP 200,// 126 0x7E 0xc8 E0,48 U ARROW QZ_UP
/* 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 */ /* 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 */
/* Aditional 104 Key XP-Keyboard Scancodes from http://www.computer-engineering.org/ps2keyboard/scancodes1.html */ /* Aditional 104 Key XP-Keyboard Scancodes from http://www.computer-engineering.org/ps2keyboard/scancodes1.html */
/* /*
219 // 0xdb e0,5b L GUI 219 // 0xdb e0,5b L GUI
220 // 0xdc e0,5c R GUI 220 // 0xdc e0,5c R GUI
221 // 0xdd e0,5d APPS 221 // 0xdd e0,5d APPS
// E0,2A,E0,37 PRNT SCRN // E0,2A,E0,37 PRNT SCRN
// E1,1D,45,E1,9D,C5 PAUSE // E1,1D,45,E1,9D,C5 PAUSE
83 // 0x53 0x53 KP . 83 // 0x53 0x53 KP .
// ACPI Scan Codes // ACPI Scan Codes
222 // 0xde E0, 5E Power 222 // 0xde E0, 5E Power
223 // 0xdf E0, 5F Sleep 223 // 0xdf E0, 5F Sleep
227 // 0xe3 E0, 63 Wake 227 // 0xe3 E0, 63 Wake
// Windows Multimedia Scan Codes // Windows Multimedia Scan Codes
153 // 0x99 E0, 19 Next Track 153 // 0x99 E0, 19 Next Track
144 // 0x90 E0, 10 Previous Track 144 // 0x90 E0, 10 Previous Track
164 // 0xa4 E0, 24 Stop 164 // 0xa4 E0, 24 Stop
162 // 0xa2 E0, 22 Play/Pause 162 // 0xa2 E0, 22 Play/Pause
160 // 0xa0 E0, 20 Mute 160 // 0xa0 E0, 20 Mute
176 // 0xb0 E0, 30 Volume Up 176 // 0xb0 E0, 30 Volume Up
174 // 0xae E0, 2E Volume Down 174 // 0xae E0, 2E Volume Down
237 // 0xed E0, 6D Media Select 237 // 0xed E0, 6D Media Select
236 // 0xec E0, 6C E-Mail 236 // 0xec E0, 6C E-Mail
161 // 0xa1 E0, 21 Calculator 161 // 0xa1 E0, 21 Calculator
235 // 0xeb E0, 6B My Computer 235 // 0xeb E0, 6B My Computer
229 // 0xe5 E0, 65 WWW Search 229 // 0xe5 E0, 65 WWW Search
178 // 0xb2 E0, 32 WWW Home 178 // 0xb2 E0, 32 WWW Home
234 // 0xea E0, 6A WWW Back 234 // 0xea E0, 6A WWW Back
233 // 0xe9 E0, 69 WWW Forward 233 // 0xe9 E0, 69 WWW Forward
232 // 0xe8 E0, 68 WWW Stop 232 // 0xe8 E0, 68 WWW Stop
231 // 0xe7 E0, 67 WWW Refresh 231 // 0xe7 E0, 67 WWW Refresh
230 // 0xe6 E0, 66 WWW Favorites 230 // 0xe6 E0, 66 WWW Favorites
*/ */
}; };
@ -366,10 +366,10 @@ static void cocoa_refresh(DisplayState *ds)
NSDate *distantPast; NSDate *distantPast;
NSEvent *event; NSEvent *event;
NSAutoreleasePool *pool; NSAutoreleasePool *pool;
pool = [ [ NSAutoreleasePool alloc ] init ]; pool = [ [ NSAutoreleasePool alloc ] init ];
distantPast = [ NSDate distantPast ]; distantPast = [ NSDate distantPast ];
vga_hw_update(); vga_hw_update();
do { do {
@ -415,8 +415,8 @@ static void cocoa_refresh(DisplayState *ds)
case NSKeyDown: case NSKeyDown:
{ {
int keycode = cocoa_keycode_to_qemu([event keyCode]); int keycode = cocoa_keycode_to_qemu([event keyCode]);
/* handle command Key Combos */ /* handle command Key Combos */
if ([event modifierFlags] & NSCommandKeyMask) { if ([event modifierFlags] & NSCommandKeyMask) {
switch ([event keyCode]) { switch ([event keyCode]) {
@ -427,7 +427,7 @@ static void cocoa_refresh(DisplayState *ds)
return; return;
} }
} }
/* handle control + alt Key Combos */ /* handle control + alt Key Combos */
if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) { if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) {
switch (keycode) { switch (keycode) {
@ -482,10 +482,10 @@ static void cocoa_refresh(DisplayState *ds)
} }
} }
break; break;
case NSKeyUp: case NSKeyUp:
{ {
int keycode = cocoa_keycode_to_qemu([event keyCode]); int keycode = cocoa_keycode_to_qemu([event keyCode]);
if (is_graphic_console()) { if (is_graphic_console()) {
if (keycode & 0x80) if (keycode & 0x80)
kbd_put_keycode(0xe0); kbd_put_keycode(0xe0);
@ -493,7 +493,7 @@ static void cocoa_refresh(DisplayState *ds)
} }
} }
break; break;
case NSMouseMoved: case NSMouseMoved:
if (grab) { if (grab) {
int dx = [event deltaX]; int dx = [event deltaX];
@ -503,11 +503,11 @@ static void cocoa_refresh(DisplayState *ds)
kbd_mouse_event(dx, dy, dz, buttons); kbd_mouse_event(dx, dy, dz, buttons);
} }
break; break;
case NSLeftMouseDown: case NSLeftMouseDown:
if (grab) { if (grab) {
int buttons = 0; int buttons = 0;
/* leftclick+command simulates rightclick */ /* leftclick+command simulates rightclick */
if ([event modifierFlags] & NSCommandKeyMask) { if ([event modifierFlags] & NSCommandKeyMask) {
buttons |= MOUSE_EVENT_RBUTTON; buttons |= MOUSE_EVENT_RBUTTON;
@ -519,7 +519,7 @@ static void cocoa_refresh(DisplayState *ds)
[NSApp sendEvent: event]; [NSApp sendEvent: event];
} }
break; break;
case NSLeftMouseDragged: case NSLeftMouseDragged:
if (grab) { if (grab) {
int dx = [event deltaX]; int dx = [event deltaX];
@ -534,7 +534,7 @@ static void cocoa_refresh(DisplayState *ds)
kbd_mouse_event(dx, dy, dz, buttons); kbd_mouse_event(dx, dy, dz, buttons);
} }
break; break;
case NSLeftMouseUp: case NSLeftMouseUp:
if (grab) { if (grab) {
kbd_mouse_event(0, 0, 0, 0); kbd_mouse_event(0, 0, 0, 0);
@ -546,18 +546,18 @@ static void cocoa_refresh(DisplayState *ds)
//[NSApp sendEvent: event]; //[NSApp sendEvent: event];
} }
break; break;
case NSRightMouseDown: case NSRightMouseDown:
if (grab) { if (grab) {
int buttons = 0; int buttons = 0;
buttons |= MOUSE_EVENT_RBUTTON; buttons |= MOUSE_EVENT_RBUTTON;
kbd_mouse_event(0, 0, 0, buttons); kbd_mouse_event(0, 0, 0, buttons);
} else { } else {
[NSApp sendEvent: event]; [NSApp sendEvent: event];
} }
break; break;
case NSRightMouseDragged: case NSRightMouseDragged:
if (grab) { if (grab) {
int dx = [event deltaX]; int dx = [event deltaX];
@ -568,7 +568,7 @@ static void cocoa_refresh(DisplayState *ds)
kbd_mouse_event(dx, dy, dz, buttons); kbd_mouse_event(dx, dy, dz, buttons);
} }
break; break;
case NSRightMouseUp: case NSRightMouseUp:
if (grab) { if (grab) {
kbd_mouse_event(0, 0, 0, 0); kbd_mouse_event(0, 0, 0, 0);
@ -576,7 +576,7 @@ static void cocoa_refresh(DisplayState *ds)
[NSApp sendEvent: event]; [NSApp sendEvent: event];
} }
break; break;
case NSOtherMouseDragged: case NSOtherMouseDragged:
if (grab) { if (grab) {
int dx = [event deltaX]; int dx = [event deltaX];
@ -587,7 +587,7 @@ static void cocoa_refresh(DisplayState *ds)
kbd_mouse_event(dx, dy, dz, buttons); kbd_mouse_event(dx, dy, dz, buttons);
} }
break; break;
case NSOtherMouseDown: case NSOtherMouseDown:
if (grab) { if (grab) {
int buttons = 0; int buttons = 0;
@ -597,7 +597,7 @@ static void cocoa_refresh(DisplayState *ds)
[NSApp sendEvent:event]; [NSApp sendEvent:event];
} }
break; break;
case NSOtherMouseUp: case NSOtherMouseUp:
if (grab) { if (grab) {
kbd_mouse_event(0, 0, 0, 0); kbd_mouse_event(0, 0, 0, 0);
@ -605,14 +605,14 @@ static void cocoa_refresh(DisplayState *ds)
[NSApp sendEvent: event]; [NSApp sendEvent: event];
} }
break; break;
case NSScrollWheel: case NSScrollWheel:
if (grab) { if (grab) {
int dz = [event deltaY]; int dz = [event deltaY];
kbd_mouse_event(0, 0, -dz, 0); kbd_mouse_event(0, 0, -dz, 0);
} }
break; break;
default: [NSApp sendEvent:event]; default: [NSApp sendEvent:event];
} }
} }
@ -641,9 +641,9 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
ds->dpy_update = cocoa_update; ds->dpy_update = cocoa_update;
ds->dpy_resize = cocoa_resize; ds->dpy_resize = cocoa_resize;
ds->dpy_refresh = cocoa_refresh; ds->dpy_refresh = cocoa_refresh;
cocoa_resize(ds, 640, 400); cocoa_resize(ds, 640, 400);
atexit(cocoa_cleanup); atexit(cocoa_cleanup);
} }
@ -661,17 +661,17 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
------------------------------------------------------ ------------------------------------------------------
*/ */
static void QZ_SetPortAlphaOpaque () static void QZ_SetPortAlphaOpaque ()
{ {
/* Assume 32 bit if( bpp == 32 )*/ /* Assume 32 bit if( bpp == 32 )*/
if ( 1 ) { if ( 1 ) {
uint32_t *pixels = (uint32_t*) current_ds.data; uint32_t *pixels = (uint32_t*) current_ds.data;
uint32_t rowPixels = current_ds.linesize / 4; uint32_t rowPixels = current_ds.linesize / 4;
uint32_t i, j; uint32_t i, j;
for (i = 0; i < current_ds.height; i++) for (i = 0; i < current_ds.height; i++)
for (j = 0; j < current_ds.width; j++) { for (j = 0; j < current_ds.width; j++) {
pixels[ (i * rowPixels) + j ] |= 0xFF000000; pixels[ (i * rowPixels) + j ] |= 0xFF000000;
} }
} }
@ -680,32 +680,32 @@ static void QZ_SetPortAlphaOpaque ()
@implementation QemuWindow @implementation QemuWindow
- (void)miniaturize:(id)sender - (void)miniaturize:(id)sender
{ {
/* make the alpha channel opaque so anim won't have holes in it */ /* make the alpha channel opaque so anim won't have holes in it */
QZ_SetPortAlphaOpaque (); QZ_SetPortAlphaOpaque ();
[ super miniaturize:sender ]; [ super miniaturize:sender ];
} }
- (void)display - (void)display
{ {
/* /*
This method fires just before the window deminaturizes from the Dock. This method fires just before the window deminaturizes from the Dock.
We'll save the current visible surface, let the window manager redraw any We'll save the current visible surface, let the window manager redraw any
UI elements, and restore the SDL surface. This way, no expose event UI elements, and restore the SDL surface. This way, no expose event
is required, and the deminiaturize works perfectly. is required, and the deminiaturize works perfectly.
*/ */
/* make sure pixels are fully opaque */ /* make sure pixels are fully opaque */
QZ_SetPortAlphaOpaque (); QZ_SetPortAlphaOpaque ();
/* save current visible SDL surface */ /* save current visible SDL surface */
[ self cacheImageInRect:[ qd_view frame ] ]; [ self cacheImageInRect:[ qd_view frame ] ];
/* let the window manager redraw controls, border, etc */ /* let the window manager redraw controls, border, etc */
[ super display ]; [ super display ];
/* restore visible SDL surface */ /* restore visible SDL surface */
[ self restoreCachedImage ]; [ self restoreCachedImage ];
} }
@ -742,13 +742,13 @@ static void QZ_SetPortAlphaOpaque ()
if( gArgc <= 1 || strncmp (gArgv[1], "-psn", 4) == 0) if( gArgc <= 1 || strncmp (gArgv[1], "-psn", 4) == 0)
{ {
NSOpenPanel *op = [[NSOpenPanel alloc] init]; NSOpenPanel *op = [[NSOpenPanel alloc] init];
cocoa_resize(&current_ds, 640, 400); cocoa_resize(&current_ds, 640, 400);
[op setPrompt:@"Boot image"]; [op setPrompt:@"Boot image"];
[op setMessage:@"Select the disk image you want to boot.\n\nHit the \"Cancel\" button to quit"]; [op setMessage:@"Select the disk image you want to boot.\n\nHit the \"Cancel\" button to quit"];
[op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cow",@"cloop",@"vmdk",nil] [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cow",@"cloop",@"vmdk",nil]
modalForWindow:window modalDelegate:self modalForWindow:window modalDelegate:self
didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
@ -774,20 +774,20 @@ static void QZ_SetPortAlphaOpaque ()
{ {
exit(0); exit(0);
} }
if(returnCode == NSOKButton) if(returnCode == NSOKButton)
{ {
char *bin = "qemu"; char *bin = "qemu";
char *img = (char*)[ [ sheet filename ] cString]; char *img = (char*)[ [ sheet filename ] cString];
char **argv = (char**)malloc( sizeof(char*)*3 ); char **argv = (char**)malloc( sizeof(char*)*3 );
asprintf(&argv[0], "%s", bin); asprintf(&argv[0], "%s", bin);
asprintf(&argv[1], "-hda"); asprintf(&argv[1], "-hda");
asprintf(&argv[2], "%s", img); asprintf(&argv[2], "%s", img);
printf("Using argc %d argv %s -hda %s\n", 3, bin, img); printf("Using argc %d argv %s -hda %s\n", 3, bin, img);
[self startEmulationWithArgc:3 argv:(char**)argv]; [self startEmulationWithArgc:3 argv:(char**)argv];
} }
} }
@ -827,10 +827,10 @@ static void setApplicationMenu(void)
NSMenuItem *menuItem; NSMenuItem *menuItem;
NSString *title; NSString *title;
NSString *appName; NSString *appName;
appName = @"Qemu"; appName = @"Qemu";
appleMenu = [[NSMenu alloc] initWithTitle:@""]; appleMenu = [[NSMenu alloc] initWithTitle:@""];
/* Add menu items */ /* Add menu items */
title = [@"About " stringByAppendingString:appName]; title = [@"About " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
@ -850,7 +850,7 @@ static void setApplicationMenu(void)
title = [@"Quit " stringByAppendingString:appName]; title = [@"Quit " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
/* Put menu into the menubar */ /* Put menu into the menubar */
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
[menuItem setSubmenu:appleMenu]; [menuItem setSubmenu:appleMenu];
@ -872,17 +872,17 @@ static void setupWindowMenu(void)
NSMenuItem *menuItem; NSMenuItem *menuItem;
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
/* "Minimize" item */ /* "Minimize" item */
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
[windowMenu addItem:menuItem]; [windowMenu addItem:menuItem];
[menuItem release]; [menuItem release];
/* Put menu into the menubar */ /* Put menu into the menubar */
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
[windowMenuItem setSubmenu:windowMenu]; [windowMenuItem setSubmenu:windowMenu];
[[NSApp mainMenu] addItem:windowMenuItem]; [[NSApp mainMenu] addItem:windowMenuItem];
/* Tell the application object that this is now the window menu */ /* Tell the application object that this is now the window menu */
[NSApp setWindowsMenu:windowMenu]; [NSApp setWindowsMenu:windowMenu];
@ -896,14 +896,14 @@ static void CustomApplicationMain(void)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
QemuCocoaGUIController *gui_controller; QemuCocoaGUIController *gui_controller;
CPSProcessSerNum PSN; CPSProcessSerNum PSN;
[NSApplication sharedApplication]; [NSApplication sharedApplication];
if (!CPSGetCurrentProcess(&PSN)) if (!CPSGetCurrentProcess(&PSN))
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
if (!CPSSetFrontProcess(&PSN)) if (!CPSSetFrontProcess(&PSN))
[NSApplication sharedApplication]; [NSApplication sharedApplication];
/* Set up the menubar */ /* Set up the menubar */
[NSApp setMainMenu:[[NSMenu alloc] init]]; [NSApp setMainMenu:[[NSMenu alloc] init]];
setApplicationMenu(); setApplicationMenu();
@ -912,10 +912,10 @@ static void CustomApplicationMain(void)
/* Create SDLMain and make it the app delegate */ /* Create SDLMain and make it the app delegate */
gui_controller = [[QemuCocoaGUIController alloc] init]; gui_controller = [[QemuCocoaGUIController alloc] init];
[NSApp setDelegate:gui_controller]; [NSApp setDelegate:gui_controller];
/* Start the main event loop */ /* Start the main event loop */
[NSApp run]; [NSApp run];
[gui_controller release]; [gui_controller release];
[pool release]; [pool release];
} }

View File

@ -210,7 +210,7 @@ static void vga_fill_rect (DisplayState *ds,
{ {
uint8_t *d, *d1; uint8_t *d, *d1;
int x, y, bpp; int x, y, bpp;
bpp = (ds->depth + 7) >> 3; bpp = (ds->depth + 7) >> 3;
d1 = ds->data + d1 = ds->data +
ds->linesize * posy + bpp * posx; ds->linesize * posy + bpp * posx;
@ -591,7 +591,7 @@ static void console_scroll(int ydelta)
{ {
TextConsole *s; TextConsole *s;
int i, y1; int i, y1;
s = active_console; s = active_console;
if (!s || (s->console_type == GRAPHIC_CONSOLE)) if (!s || (s->console_type == GRAPHIC_CONSOLE))
return; return;
@ -1047,7 +1047,7 @@ static void kbd_send_chars(void *opaque)
TextConsole *s = opaque; TextConsole *s = opaque;
int len; int len;
uint8_t buf[16]; uint8_t buf[16];
len = qemu_chr_can_read(s->chr); len = qemu_chr_can_read(s->chr);
if (len > s->out_fifo.count) if (len > s->out_fifo.count)
len = s->out_fifo.count; len = s->out_fifo.count;
@ -1192,7 +1192,7 @@ CharDriverState *text_console_init(DisplayState *ds, const char *p)
s->out_fifo.buf = s->out_fifo_buf; s->out_fifo.buf = s->out_fifo_buf;
s->out_fifo.buf_size = sizeof(s->out_fifo_buf); s->out_fifo.buf_size = sizeof(s->out_fifo_buf);
s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s); s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s);
if (!color_inited) { if (!color_inited) {
color_inited = 1; color_inited = 1;
for(j = 0; j < 2; j++) { for(j = 0; j < 2; j++) {

View File

@ -84,13 +84,13 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
unsigned int h; unsigned int h;
target_ulong phys_pc, phys_page1, phys_page2, virt_page2; target_ulong phys_pc, phys_page1, phys_page2, virt_page2;
uint8_t *tc_ptr; uint8_t *tc_ptr;
spin_lock(&tb_lock); spin_lock(&tb_lock);
tb_invalidated_flag = 0; tb_invalidated_flag = 0;
regs_to_env(); /* XXX: do it just before cpu_gen_code() */ regs_to_env(); /* XXX: do it just before cpu_gen_code() */
/* find translated block using physical mappings */ /* find translated block using physical mappings */
phys_pc = get_phys_addr_code(env, pc); phys_pc = get_phys_addr_code(env, pc);
phys_page1 = phys_pc & TARGET_PAGE_MASK; phys_page1 = phys_pc & TARGET_PAGE_MASK;
@ -135,7 +135,7 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
tb->flags = flags; tb->flags = flags;
cpu_gen_code(env, tb, CODE_GEN_MAX_SIZE, &code_gen_size); cpu_gen_code(env, tb, CODE_GEN_MAX_SIZE, &code_gen_size);
code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1)); code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1));
/* check next page if needed */ /* check next page if needed */
virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;
phys_page2 = -1; phys_page2 = -1;
@ -143,7 +143,7 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
phys_page2 = get_phys_addr_code(env, virt_page2); phys_page2 = get_phys_addr_code(env, virt_page2);
} }
tb_link_phys(tb, phys_pc, phys_page2); tb_link_phys(tb, phys_pc, phys_page2);
found: found:
/* we add the TB in the virtual pc hash table */ /* we add the TB in the virtual pc hash table */
env->tb_jmp_cache[tb_jmp_cache_hash_func(pc)] = tb; env->tb_jmp_cache[tb_jmp_cache_hash_func(pc)] = tb;
@ -371,7 +371,7 @@ int cpu_exec(CPUState *env1)
#if defined(__sparc__) && !defined(HOST_SOLARIS) #if defined(__sparc__) && !defined(HOST_SOLARIS)
/* g1 can be modified by some libc? functions */ /* g1 can be modified by some libc? functions */
tmp_T0 = T0; tmp_T0 = T0;
#endif #endif
interrupt_request = env->interrupt_request; interrupt_request = env->interrupt_request;
if (__builtin_expect(interrupt_request, 0)) { if (__builtin_expect(interrupt_request, 0)) {
if (interrupt_request & CPU_INTERRUPT_DEBUG) { if (interrupt_request & CPU_INTERRUPT_DEBUG) {
@ -565,7 +565,7 @@ int cpu_exec(CPUState *env1)
#endif #endif
#if defined(__sparc__) && !defined(HOST_SOLARIS) #if defined(__sparc__) && !defined(HOST_SOLARIS)
T0 = tmp_T0; T0 = tmp_T0;
#endif #endif
/* see if we can patch the calling TB. When the TB /* see if we can patch the calling TB. When the TB
spans two pages, we cannot safely do a direct spans two pages, we cannot safely do a direct
jump. */ jump. */
@ -796,7 +796,7 @@ void cpu_x86_fsave(CPUX86State *s, uint8_t *ptr, int data32)
saved_env = env; saved_env = env;
env = s; env = s;
helper_fsave((target_ulong)ptr, data32); helper_fsave((target_ulong)ptr, data32);
env = saved_env; env = saved_env;
@ -808,7 +808,7 @@ void cpu_x86_frstor(CPUX86State *s, uint8_t *ptr, int data32)
saved_env = env; saved_env = env;
env = s; env = s;
helper_frstor((target_ulong)ptr, data32); helper_frstor((target_ulong)ptr, data32);
env = saved_env; env = saved_env;
@ -953,7 +953,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
{ {
TranslationBlock *tb; TranslationBlock *tb;
int ret; int ret;
if (cpu_single_env) if (cpu_single_env)
env = cpu_single_env; /* XXX: find a correct solution for multithread */ env = cpu_single_env; /* XXX: find a correct solution for multithread */
#if defined(DEBUG_SIGNAL) #if defined(DEBUG_SIGNAL)
@ -1042,7 +1042,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
{ {
TranslationBlock *tb; TranslationBlock *tb;
int ret; int ret;
if (cpu_single_env) if (cpu_single_env)
env = cpu_single_env; /* XXX: find a correct solution for multithread */ env = cpu_single_env; /* XXX: find a correct solution for multithread */
#if defined(DEBUG_SIGNAL) #if defined(DEBUG_SIGNAL)
@ -1092,7 +1092,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
{ {
TranslationBlock *tb; TranslationBlock *tb;
int ret; int ret;
if (cpu_single_env) if (cpu_single_env)
env = cpu_single_env; /* XXX: find a correct solution for multithread */ env = cpu_single_env; /* XXX: find a correct solution for multithread */
#if defined(DEBUG_SIGNAL) #if defined(DEBUG_SIGNAL)
@ -1137,7 +1137,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
{ {
TranslationBlock *tb; TranslationBlock *tb;
int ret; int ret;
if (cpu_single_env) if (cpu_single_env)
env = cpu_single_env; /* XXX: find a correct solution for multithread */ env = cpu_single_env; /* XXX: find a correct solution for multithread */
#if defined(DEBUG_SIGNAL) #if defined(DEBUG_SIGNAL)
@ -1371,7 +1371,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
unsigned long pc; unsigned long pc;
int is_write; int is_write;
uint32_t insn; uint32_t insn;
/* XXX: is there a standard glibc define ? */ /* XXX: is there a standard glibc define ? */
pc = regs[1]; pc = regs[1];
/* XXX: need kernel patch to get write flag faster */ /* XXX: need kernel patch to get write flag faster */
@ -1403,7 +1403,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
struct ucontext *uc = puc; struct ucontext *uc = puc;
unsigned long pc; unsigned long pc;
int is_write; int is_write;
pc = uc->uc_mcontext.gregs[R15]; pc = uc->uc_mcontext.gregs[R15];
/* XXX: compute is_write */ /* XXX: compute is_write */
is_write = 0; is_write = 0;
@ -1421,7 +1421,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
struct ucontext *uc = puc; struct ucontext *uc = puc;
unsigned long pc; unsigned long pc;
int is_write; int is_write;
pc = uc->uc_mcontext.gregs[16]; pc = uc->uc_mcontext.gregs[16];
/* XXX: compute is_write */ /* XXX: compute is_write */
is_write = 0; is_write = 0;
@ -1473,7 +1473,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
struct ucontext *uc = puc; struct ucontext *uc = puc;
unsigned long pc; unsigned long pc;
int is_write; int is_write;
pc = uc->uc_mcontext.psw.addr; pc = uc->uc_mcontext.psw.addr;
/* XXX: compute is_write */ /* XXX: compute is_write */
is_write = 0; is_write = 0;
@ -1490,7 +1490,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
struct ucontext *uc = puc; struct ucontext *uc = puc;
greg_t pc = uc->uc_mcontext.pc; greg_t pc = uc->uc_mcontext.pc;
int is_write; int is_write;
/* XXX: compute is_write */ /* XXX: compute is_write */
is_write = 0; is_write = 0;
return handle_cpu_signal(pc, (unsigned long)info->si_addr, return handle_cpu_signal(pc, (unsigned long)info->si_addr,

View File

@ -1336,7 +1336,7 @@ static inline long bswap_syctl(int * mib, int count, void *buf, int size)
if(!(sysctl = sysctl->childs)) if(!(sysctl = sysctl->childs))
break; break;
} }
if(ret->childs) if(ret->childs)
qerror("we shouldn't have a directory element\n"); qerror("we shouldn't have a directory element\n");
@ -1375,7 +1375,7 @@ long do___sysctl(int * name, uint32_t namelen, void * oldp, size_t * oldlenp, vo
//bswap_syctl(name, namelen, newp, newlen); //bswap_syctl(name, namelen, newp, newlen);
tswap32s((uint32_t*)oldlenp); tswap32s((uint32_t*)oldlenp);
} }
if(name) /* Sometimes sysctl is called with no arg1, ignore */ if(name) /* Sometimes sysctl is called with no arg1, ignore */
ret = get_errno(sysctl(name, namelen, oldp, oldlenp, newp, newlen)); ret = get_errno(sysctl(name, namelen, oldp, oldlenp, newp, newlen));

View File

@ -67,7 +67,7 @@ enum bfd_architecture
#define bfd_mach_mcf5249 16 #define bfd_mach_mcf5249 16
#define bfd_mach_mcf547x 17 #define bfd_mach_mcf547x 17
#define bfd_mach_mcf548x 18 #define bfd_mach_mcf548x 18
bfd_arch_vax, /* DEC Vax */ bfd_arch_vax, /* DEC Vax */
bfd_arch_i960, /* Intel 960 */ bfd_arch_i960, /* Intel 960 */
/* The order of the following is important. /* The order of the following is important.
lower number indicates a machine type that lower number indicates a machine type that

View File

@ -176,7 +176,7 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)
print_insn = print_insn_sparc; print_insn = print_insn_sparc;
#ifdef TARGET_SPARC64 #ifdef TARGET_SPARC64
disasm_info.mach = bfd_mach_sparc_v9b; disasm_info.mach = bfd_mach_sparc_v9b;
#endif #endif
#elif defined(TARGET_PPC) #elif defined(TARGET_PPC)
if (flags) if (flags)
disasm_info.endian = BFD_ENDIAN_LITTLE; disasm_info.endian = BFD_ENDIAN_LITTLE;
@ -298,7 +298,7 @@ const char *lookup_symbol(target_ulong orig_addr)
Elf32_Sym *sym; Elf32_Sym *sym;
struct syminfo *s; struct syminfo *s;
target_ulong addr; target_ulong addr;
for (s = syminfos; s; s = s->next) { for (s = syminfos; s; s = s->next) {
sym = s->disas_symtab; sym = s->disas_symtab;
for (i = 0; i < s->disas_num_syms; i++) { for (i = 0; i < s->disas_num_syms; i++) {

View File

@ -375,7 +375,7 @@ int elf_must_swap(struct elfhdr *h)
return (h->e_ident[EI_DATA] == ELFDATA2MSB) != return (h->e_ident[EI_DATA] == ELFDATA2MSB) !=
(swaptest.b[0] == 0); (swaptest.b[0] == 0);
} }
void elf_swap_ehdr(struct elfhdr *h) void elf_swap_ehdr(struct elfhdr *h)
{ {
swab16s(&h->e_type); /* Object file type */ swab16s(&h->e_type); /* Object file type */
@ -483,11 +483,11 @@ int load_object(const char *filename)
ElfW(Sym) *sym; ElfW(Sym) *sym;
char *shstr; char *shstr;
ELF_RELOC *rel; ELF_RELOC *rel;
fd = open(filename, O_RDONLY); fd = open(filename, O_RDONLY);
if (fd < 0) if (fd < 0)
error("can't open file '%s'", filename); error("can't open file '%s'", filename);
/* Read ELF header. */ /* Read ELF header. */
if (read(fd, &ehdr, sizeof (ehdr)) != sizeof (ehdr)) if (read(fd, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
error("unable to read file header"); error("unable to read file header");
@ -524,7 +524,7 @@ int load_object(const char *filename)
/* read all section data */ /* read all section data */
sdata = malloc(sizeof(void *) * ehdr.e_shnum); sdata = malloc(sizeof(void *) * ehdr.e_shnum);
memset(sdata, 0, sizeof(void *) * ehdr.e_shnum); memset(sdata, 0, sizeof(void *) * ehdr.e_shnum);
for(i = 0;i < ehdr.e_shnum; i++) { for(i = 0;i < ehdr.e_shnum; i++) {
sec = &shdr[i]; sec = &shdr[i];
if (sec->sh_type != SHT_NOBITS) if (sec->sh_type != SHT_NOBITS)
@ -569,7 +569,7 @@ int load_object(const char *filename)
symtab = (ElfW(Sym) *)sdata[symtab_sec - shdr]; symtab = (ElfW(Sym) *)sdata[symtab_sec - shdr];
strtab = (char *)sdata[symtab_sec->sh_link]; strtab = (char *)sdata[symtab_sec->sh_link];
nb_syms = symtab_sec->sh_size / sizeof(ElfW(Sym)); nb_syms = symtab_sec->sh_size / sizeof(ElfW(Sym));
if (do_swap) { if (do_swap) {
for(i = 0, sym = symtab; i < nb_syms; i++, sym++) { 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)
{ {
char *q; char *q;
int c, i, len; int c, i, len;
if (ext_sym->e.e.e_zeroes != 0) { if (ext_sym->e.e.e_zeroes != 0) {
q = sym->st_name; q = sym->st_name;
for(i = 0; i < 8; i++) { for(i = 0; i < 8; i++) {
@ -643,7 +643,7 @@ char *name_for_dotdata(struct coff_rel *rel)
if (sym->st_syment->e_scnum == data_shndx && if (sym->st_syment->e_scnum == data_shndx &&
text_data >= sym->st_value && text_data >= sym->st_value &&
text_data < sym->st_value + sym->st_size) { text_data < sym->st_value + sym->st_size) {
return sym->st_name; return sym->st_name;
} }
@ -709,7 +709,7 @@ int load_object(const char *filename)
); );
if (fd < 0) if (fd < 0)
error("can't open file '%s'", filename); error("can't open file '%s'", filename);
/* Read COFF header. */ /* Read COFF header. */
if (read(fd, &fhdr, sizeof (fhdr)) != sizeof (fhdr)) if (read(fd, &fhdr, sizeof (fhdr)) != sizeof (fhdr))
error("unable to read file header"); error("unable to read file header");
@ -726,7 +726,7 @@ int load_object(const char *filename)
/* read all section data */ /* read all section data */
sdata = malloc(sizeof(void *) * fhdr.f_nscns); sdata = malloc(sizeof(void *) * fhdr.f_nscns);
memset(sdata, 0, sizeof(void *) * fhdr.f_nscns); memset(sdata, 0, sizeof(void *) * fhdr.f_nscns);
const char *p; const char *p;
for(i = 0;i < fhdr.f_nscns; i++) { for(i = 0;i < fhdr.f_nscns; i++) {
sec = &shdr[i]; sec = &shdr[i];
@ -747,7 +747,7 @@ int load_object(const char *filename)
if (!data_sec) if (!data_sec)
error("could not find .data section"); error("could not find .data section");
coff_data_shndx = data_sec - shdr; coff_data_shndx = data_sec - shdr;
coff_symtab = load_data(fd, fhdr.f_symptr, fhdr.f_nsyms*SYMESZ); coff_symtab = load_data(fd, fhdr.f_symptr, fhdr.f_nsyms*SYMESZ);
for (i = 0, ext_sym = coff_symtab; i < nb_syms; i++, ext_sym++) { for (i = 0, ext_sym = coff_symtab; i < nb_syms; i++, ext_sym++) {
for(i=0;i<8;i++) for(i=0;i<8;i++)
@ -758,7 +758,7 @@ int load_object(const char *filename)
n_strtab = load_data(fd, (fhdr.f_symptr + fhdr.f_nsyms*SYMESZ), STRTAB_SIZE); n_strtab = load_data(fd, (fhdr.f_symptr + fhdr.f_nsyms*SYMESZ), STRTAB_SIZE);
strtab = load_data(fd, (fhdr.f_symptr + fhdr.f_nsyms*SYMESZ), *n_strtab); strtab = load_data(fd, (fhdr.f_symptr + fhdr.f_nsyms*SYMESZ), *n_strtab);
nb_syms = fhdr.f_nsyms; nb_syms = fhdr.f_nsyms;
for (i = 0, ext_sym = coff_symtab; i < nb_syms; i++, ext_sym++) { for (i = 0, ext_sym = coff_symtab; i < nb_syms; i++, ext_sym++) {
@ -805,12 +805,12 @@ int load_object(const char *filename)
} else { } else {
sym->st_size = 0; sym->st_size = 0;
} }
sym->st_type = ext_sym->e_type; sym->st_type = ext_sym->e_type;
sym->st_shndx = ext_sym->e_scnum; sym->st_shndx = ext_sym->e_scnum;
} }
/* find text relocations, if any */ /* find text relocations, if any */
sec = &shdr[coff_text_shndx]; sec = &shdr[coff_text_shndx];
coff_relocs = load_data(fd, sec->s_relptr, sec->s_nreloc*RELSZ); coff_relocs = load_data(fd, sec->s_relptr, sec->s_nreloc*RELSZ);
@ -870,7 +870,7 @@ static char *get_sym_name(EXE_SYM *sym)
if ( sym->n_type & N_STAB ) /* Debug symbols are ignored */ if ( sym->n_type & N_STAB ) /* Debug symbols are ignored */
return "debug"; return "debug";
if(!name) if(!name)
return name; return name;
if(name[0]=='_') if(name[0]=='_')
@ -953,23 +953,23 @@ static const char * find_reloc_name_in_sec_ptr(int address, struct section * sec
{ {
unsigned int tocindex, symindex, size; unsigned int tocindex, symindex, size;
const char *name = 0; const char *name = 0;
/* Sanity check */ /* Sanity check */
if(!( address >= sec_hdr->addr && address < (sec_hdr->addr + sec_hdr->size) ) ) if(!( address >= sec_hdr->addr && address < (sec_hdr->addr + sec_hdr->size) ) )
return (char*)0; return (char*)0;
if( sec_hdr->flags & S_SYMBOL_STUBS ){ if( sec_hdr->flags & S_SYMBOL_STUBS ){
size = sec_hdr->reserved2; size = sec_hdr->reserved2;
if(size == 0) if(size == 0)
error("size = 0"); error("size = 0");
} }
else if( sec_hdr->flags & S_LAZY_SYMBOL_POINTERS || else if( sec_hdr->flags & S_LAZY_SYMBOL_POINTERS ||
sec_hdr->flags & S_NON_LAZY_SYMBOL_POINTERS) sec_hdr->flags & S_NON_LAZY_SYMBOL_POINTERS)
size = sizeof(unsigned long); size = sizeof(unsigned long);
else else
return 0; return 0;
/* Compute our index in toc */ /* Compute our index in toc */
tocindex = (address - sec_hdr->addr)/size; tocindex = (address - sec_hdr->addr)/size;
symindex = tocdylib[sec_hdr->reserved1 + tocindex]; symindex = tocdylib[sec_hdr->reserved1 + tocindex];
@ -1015,7 +1015,7 @@ static const char * get_reloc_name(EXE_RELOC * rel, int * sslide)
/* Intruction contains an offset to the symbols pointed to, in the rel->r_symbolnum section */ /* Intruction contains an offset to the symbols pointed to, in the rel->r_symbolnum section */
sectoffset = *(uint32_t *)(text + rel->r_address) & 0xffff; sectoffset = *(uint32_t *)(text + rel->r_address) & 0xffff;
if(sectnum==0xffffff) if(sectnum==0xffffff)
return 0; return 0;
@ -1041,7 +1041,7 @@ static const char * get_reloc_name(EXE_RELOC * rel, int * sslide)
if(rel->r_pcrel) if(rel->r_pcrel)
sectoffset += rel->r_address; sectoffset += rel->r_address;
if (rel->r_type == PPC_RELOC_BR24) if (rel->r_type == PPC_RELOC_BR24)
name = (char *)find_reloc_name_in_sec_ptr((int)sectoffset, &section_hdr[sectnum-1]); name = (char *)find_reloc_name_in_sec_ptr((int)sectoffset, &section_hdr[sectnum-1]);
@ -1080,11 +1080,11 @@ int load_object(const char *filename)
unsigned int i, j; unsigned int i, j;
EXE_SYM *sym; EXE_SYM *sym;
struct nlist *syment; struct nlist *syment;
fd = open(filename, O_RDONLY); fd = open(filename, O_RDONLY);
if (fd < 0) if (fd < 0)
error("can't open file '%s'", filename); error("can't open file '%s'", filename);
/* Read Mach header. */ /* Read Mach header. */
if (read(fd, &mach_hdr, sizeof (mach_hdr)) != sizeof (mach_hdr)) if (read(fd, &mach_hdr, sizeof (mach_hdr)) != sizeof (mach_hdr))
error("unable to read file header"); error("unable to read file header");
@ -1093,13 +1093,13 @@ int load_object(const char *filename)
if (!check_mach_header(mach_hdr)) { if (!check_mach_header(mach_hdr)) {
error("bad Mach header"); error("bad Mach header");
} }
if (mach_hdr.cputype != CPU_TYPE_POWERPC) if (mach_hdr.cputype != CPU_TYPE_POWERPC)
error("Unsupported CPU"); error("Unsupported CPU");
if (mach_hdr.filetype != MH_OBJECT) if (mach_hdr.filetype != MH_OBJECT)
error("Unsupported Mach Object"); error("Unsupported Mach Object");
/* read segment headers */ /* read segment headers */
for(i=0, j=sizeof(mach_hdr); i<mach_hdr.ncmds ; i++) for(i=0, j=sizeof(mach_hdr); i<mach_hdr.ncmds ; i++)
{ {
@ -1143,7 +1143,7 @@ int load_object(const char *filename)
/* read all section data */ /* read all section data */
sdata = (uint8_t **)malloc(sizeof(void *) * segment->nsects); sdata = (uint8_t **)malloc(sizeof(void *) * segment->nsects);
memset(sdata, 0, sizeof(void *) * segment->nsects); memset(sdata, 0, sizeof(void *) * segment->nsects);
/* Load the data in section data */ /* Load the data in section data */
for(i = 0; i < segment->nsects; i++) { for(i = 0; i < segment->nsects; i++) {
sdata[i] = load_data(fd, section_hdr[i].offset, section_hdr[i].size); sdata[i] = load_data(fd, section_hdr[i].offset, section_hdr[i].size);
@ -1159,10 +1159,10 @@ int load_object(const char *filename)
/* Make sure dysym was loaded */ /* Make sure dysym was loaded */
if(!(int)dysymtabcmd) if(!(int)dysymtabcmd)
error("could not find __DYSYMTAB segment"); error("could not find __DYSYMTAB segment");
/* read the table of content of the indirect sym */ /* read the table of content of the indirect sym */
tocdylib = load_data( fd, dysymtabcmd->indirectsymoff, dysymtabcmd->nindirectsyms * sizeof(uint32_t) ); tocdylib = load_data( fd, dysymtabcmd->indirectsymoff, dysymtabcmd->nindirectsyms * sizeof(uint32_t) );
/* Make sure symtab was loaded */ /* Make sure symtab was loaded */
if(!(int)symtabcmd) if(!(int)symtabcmd)
error("could not find __SYMTAB segment"); error("could not find __SYMTAB segment");
@ -1178,12 +1178,12 @@ int load_object(const char *filename)
struct nlist *sym_follow, *sym_next = 0; struct nlist *sym_follow, *sym_next = 0;
unsigned int j; unsigned int j;
memset(sym, 0, sizeof(*sym)); memset(sym, 0, sizeof(*sym));
if ( syment->n_type & N_STAB ) /* Debug symbols are skipped */ if ( syment->n_type & N_STAB ) /* Debug symbols are skipped */
continue; continue;
memcpy(sym, syment, sizeof(*syment)); memcpy(sym, syment, sizeof(*syment));
/* Find the following symbol in order to get the current symbol size */ /* Find the following symbol in order to get the current symbol size */
for(j = 0, sym_follow = symtab_std; j < nb_syms; j++, sym_follow++) { for(j = 0, sym_follow = symtab_std; j < nb_syms; j++, sym_follow++) {
if ( sym_follow->n_sect != 1 || sym_follow->n_type & N_STAB || !(sym_follow->n_value > sym->st_value)) 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,
uint8_t data_allocated[1024]; uint8_t data_allocated[1024];
unsigned int data_index; unsigned int data_index;
int type; int type;
memset(data_allocated, 0, sizeof(data_allocated)); memset(data_allocated, 0, sizeof(data_allocated));
p = p_start; p = p_start;
min_offset = p_end - p_start; min_offset = p_end - p_start;
spare = 0x7fffffff; spare = 0x7fffffff;
@ -1478,7 +1478,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
} }
copy_size = len; copy_size = len;
} }
#endif #endif
#elif defined(HOST_PPC) #elif defined(HOST_PPC)
{ {
uint8_t *p; uint8_t *p;
@ -1510,7 +1510,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
#endif #endif
if (get32((uint32_t *)p) != 0x6bfa8001) if (get32((uint32_t *)p) != 0x6bfa8001)
error("ret expected at the end of %s", name); error("ret expected at the end of %s", name);
copy_size = p - p_start; copy_size = p - p_start;
} }
#elif defined(HOST_IA64) #elif defined(HOST_IA64)
{ {
@ -1611,14 +1611,14 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
} else { } else {
error("No save at the beginning of %s", name); error("No save at the beginning of %s", name);
} }
/* Skip a preceeding nop, if present. */ /* Skip a preceeding nop, if present. */
if (p > p_start) { if (p > p_start) {
skip_insn = get32((uint32_t *)(p - 0x4)); skip_insn = get32((uint32_t *)(p - 0x4));
if (skip_insn == 0x01000000) if (skip_insn == 0x01000000)
p -= 4; p -= 4;
} }
copy_size = p - p_start; copy_size = p - p_start;
} }
#elif defined(HOST_ARM) #elif defined(HOST_ARM)
@ -1700,7 +1700,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
} }
} }
} }
nb_args = 0; nb_args = 0;
while (nb_args < MAX_ARGS && args_present[nb_args]) while (nb_args < MAX_ARGS && args_present[nb_args])
nb_args++; nb_args++;
@ -1784,7 +1784,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
if (strstart(sym_name, "__op_label", &p)) { if (strstart(sym_name, "__op_label", &p)) {
uint8_t *ptr; uint8_t *ptr;
unsigned long offset; unsigned long offset;
/* test if the variable refers to a label inside /* test if the variable refers to a label inside
the code we are generating */ the code we are generating */
#ifdef CONFIG_FORMAT_COFF #ifdef CONFIG_FORMAT_COFF
@ -1828,7 +1828,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
} }
} }
} }
#endif #endif
if (val >= start_offset && val <= start_offset + copy_size) { if (val >= start_offset && val <= start_offset + copy_size) {
n = strtol(p, NULL, 10); n = strtol(p, NULL, 10);
fprintf(outfile, " label_offsets[%d] = %ld + (gen_code_ptr - gen_code_buf);\n", n, (long)(val - start_offset)); 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,
n, reloc_offset); n, reloc_offset);
continue; continue;
} }
get_reloc_expr(relname, sizeof(relname), sym_name); get_reloc_expr(relname, sizeof(relname), sym_name);
type = ELF32_R_TYPE(rel->r_info); type = ELF32_R_TYPE(rel->r_info);
addend = rel->r_addend; addend = rel->r_addend;
@ -2652,7 +2652,7 @@ int gen_file(FILE *outfile, int out_type)
gen_code(name, sym->st_value, sym->st_size, outfile, 0); gen_code(name, sym->st_value, sym->st_size, outfile, 0);
} }
} }
} else { } else {
/* generate big code generation switch */ /* generate big code generation switch */
@ -2695,7 +2695,7 @@ fprintf(outfile,
eliminating the neeed to jump around the pool. eliminating the neeed to jump around the pool.
We currently generate: We currently generate:
[ For this example we assume merging would move op1_pool out of range. [ For this example we assume merging would move op1_pool out of range.
In practice we should be able to combine many ops before the offset In practice we should be able to combine many ops before the offset
limits are reached. ] limits are reached. ]

View File

@ -51,7 +51,7 @@ static void inline flush_icache_range(unsigned long start, unsigned long stop)
start &= ~(MIN_CACHE_LINE_SIZE - 1); start &= ~(MIN_CACHE_LINE_SIZE - 1);
stop = (stop + MIN_CACHE_LINE_SIZE - 1) & ~(MIN_CACHE_LINE_SIZE - 1); stop = (stop + MIN_CACHE_LINE_SIZE - 1) & ~(MIN_CACHE_LINE_SIZE - 1);
for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) { for (p = start; p < stop; p += MIN_CACHE_LINE_SIZE) {
asm volatile ("dcbst 0,%0" : : "r"(p) : "memory"); asm volatile ("dcbst 0,%0" : : "r"(p) : "memory");
} }
@ -169,12 +169,12 @@ static uint8_t *arm_flush_ldr(uint8_t *gen_code_ptr,
arm_reloc_pc24((uint32_t *)gen_code_ptr, 0xeafffffe, target); arm_reloc_pc24((uint32_t *)gen_code_ptr, 0xeafffffe, target);
gen_code_ptr += 4; gen_code_ptr += 4;
} }
/* copy the data */ /* copy the data */
data_ptr = gen_code_ptr; data_ptr = gen_code_ptr;
memcpy(gen_code_ptr, data_start, data_size); memcpy(gen_code_ptr, data_start, data_size);
gen_code_ptr += data_size; gen_code_ptr += data_size;
/* patch the ldr to point to the data */ /* patch the ldr to point to the data */
for(le = ldr_start; le < ldr_end; le++) { for(le = ldr_start; le < ldr_end; le++) {
ptr = (uint32_t *)le->ptr; ptr = (uint32_t *)le->ptr;

View File

@ -75,13 +75,13 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab)
sizeof(struct elf_shdr) * ehdr->e_shnum); sizeof(struct elf_shdr) * ehdr->e_shnum);
if (!shdr_table) if (!shdr_table)
return -1; return -1;
if (must_swab) { if (must_swab) {
for (i = 0; i < ehdr->e_shnum; i++) { for (i = 0; i < ehdr->e_shnum; i++) {
glue(bswap_shdr, SZ)(shdr_table + i); glue(bswap_shdr, SZ)(shdr_table + i);
} }
} }
symtab = glue(find_section, SZ)(shdr_table, ehdr->e_shnum, SHT_SYMTAB); symtab = glue(find_section, SZ)(shdr_table, ehdr->e_shnum, SHT_SYMTAB);
if (!symtab) if (!symtab)
goto fail; goto fail;
@ -176,7 +176,7 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend,
glue(bswap_phdr, SZ)(ph); glue(bswap_phdr, SZ)(ph);
} }
} }
total_size = 0; total_size = 0;
for(i = 0; i < ehdr.e_phnum; i++) { for(i = 0; i < ehdr.e_phnum; i++) {
ph = &phdr[i]; ph = &phdr[i];

View File

@ -68,7 +68,7 @@ typedef void (GenOpFunc)(void);
typedef void (GenOpFunc1)(long); typedef void (GenOpFunc1)(long);
typedef void (GenOpFunc2)(long, long); typedef void (GenOpFunc2)(long, long);
typedef void (GenOpFunc3)(long, long, long); typedef void (GenOpFunc3)(long, long, long);
#if defined(TARGET_I386) #if defined(TARGET_I386)
void optimize_flags_init(void); void optimize_flags_init(void);
@ -287,7 +287,7 @@ static inline void tb_add_jump(TranslationBlock *tb, int n,
if (!tb->jmp_next[n]) { if (!tb->jmp_next[n]) {
/* patch the native jump address */ /* patch the native jump address */
tb_set_jmp_target(tb, n, (unsigned long)tb_next->tc_ptr); tb_set_jmp_target(tb, n, (unsigned long)tb_next->tc_ptr);
/* add in TB jmp circular list */ /* add in TB jmp circular list */
tb->jmp_next[n] = tb_next->jmp_first; tb->jmp_next[n] = tb_next->jmp_first;
tb_next->jmp_first = (TranslationBlock *)((long)(tb) | (n)); tb_next->jmp_first = (TranslationBlock *)((long)(tb) | (n));
@ -398,7 +398,7 @@ static inline int testandset (int *p)
static inline int testandset (int *p) static inline int testandset (int *p)
{ {
long int readval = 0; long int readval = 0;
__asm__ __volatile__ ("lock; cmpxchgl %2, %0" __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
: "+m" (*p), "+a" (readval) : "+m" (*p), "+a" (readval)
: "r" (1) : "r" (1)
@ -409,7 +409,7 @@ static inline int testandset (int *p)
static inline int testandset (int *p) static inline int testandset (int *p)
{ {
long int readval = 0; long int readval = 0;
__asm__ __volatile__ ("lock; cmpxchgl %2, %0" __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
: "+m" (*p), "+a" (readval) : "+m" (*p), "+a" (readval)
: "r" (1) : "r" (1)
@ -464,7 +464,7 @@ static inline int testandset (int *spinlock)
__asm__ __volatile__("swp %0, %1, [%2]" __asm__ __volatile__("swp %0, %1, [%2]"
: "=r"(ret) : "=r"(ret)
: "0"(1), "r"(spinlock)); : "0"(1), "r"(spinlock));
return ret; return ret;
} }
#elif defined(__mc68000) #elif defined(__mc68000)

56
exec.c
View File

@ -175,10 +175,10 @@ static void page_init(void)
{ {
SYSTEM_INFO system_info; SYSTEM_INFO system_info;
DWORD old_protect; DWORD old_protect;
GetSystemInfo(&system_info); GetSystemInfo(&system_info);
qemu_real_host_page_size = system_info.dwPageSize; qemu_real_host_page_size = system_info.dwPageSize;
VirtualProtect(code_gen_buffer, sizeof(code_gen_buffer), VirtualProtect(code_gen_buffer, sizeof(code_gen_buffer),
PAGE_EXECUTE_READWRITE, &old_protect); PAGE_EXECUTE_READWRITE, &old_protect);
} }
@ -189,11 +189,11 @@ static void page_init(void)
start = (unsigned long)code_gen_buffer; start = (unsigned long)code_gen_buffer;
start &= ~(qemu_real_host_page_size - 1); start &= ~(qemu_real_host_page_size - 1);
end = (unsigned long)code_gen_buffer + sizeof(code_gen_buffer); end = (unsigned long)code_gen_buffer + sizeof(code_gen_buffer);
end += qemu_real_host_page_size - 1; end += qemu_real_host_page_size - 1;
end &= ~(qemu_real_host_page_size - 1); end &= ~(qemu_real_host_page_size - 1);
mprotect((void *)start, end - start, mprotect((void *)start, end - start,
PROT_READ | PROT_WRITE | PROT_EXEC); PROT_READ | PROT_WRITE | PROT_EXEC);
} }
@ -345,7 +345,7 @@ void tb_flush(CPUState *env1)
nb_tbs > 0 ? (code_gen_ptr - code_gen_buffer) / nb_tbs : 0); nb_tbs > 0 ? (code_gen_ptr - code_gen_buffer) / nb_tbs : 0);
#endif #endif
nb_tbs = 0; nb_tbs = 0;
for(env = first_cpu; env != NULL; env = env->next_cpu) { for(env = first_cpu; env != NULL; env = env->next_cpu) {
memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *)); memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *));
} }
@ -382,7 +382,7 @@ static void tb_page_check(void)
{ {
TranslationBlock *tb; TranslationBlock *tb;
int i, flags1, flags2; int i, flags1, flags2;
for(i = 0;i < CODE_GEN_PHYS_HASH_SIZE; i++) { for(i = 0;i < CODE_GEN_PHYS_HASH_SIZE; i++) {
for(tb = tb_phys_hash[i]; tb != NULL; tb = tb->phys_hash_next) { for(tb = tb_phys_hash[i]; tb != NULL; tb = tb->phys_hash_next) {
flags1 = page_get_flags(tb->pc); flags1 = page_get_flags(tb->pc);
@ -491,7 +491,7 @@ static inline void tb_phys_invalidate(TranslationBlock *tb, unsigned int page_ad
unsigned int h, n1; unsigned int h, n1;
target_ulong phys_pc; target_ulong phys_pc;
TranslationBlock *tb1, *tb2; TranslationBlock *tb1, *tb2;
/* remove the TB from the hash list */ /* remove the TB from the hash list */
phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK); phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK);
h = tb_phys_hash_func(phys_pc); h = tb_phys_hash_func(phys_pc);
@ -571,7 +571,7 @@ static void build_page_bitmap(PageDesc *p)
{ {
int n, tb_start, tb_end; int n, tb_start, tb_end;
TranslationBlock *tb; TranslationBlock *tb;
p->code_bitmap = qemu_malloc(TARGET_PAGE_SIZE / 8); p->code_bitmap = qemu_malloc(TARGET_PAGE_SIZE / 8);
if (!p->code_bitmap) if (!p->code_bitmap)
return; return;
@ -624,7 +624,7 @@ static void tb_gen_code(CPUState *env,
tb->cflags = cflags; tb->cflags = cflags;
cpu_gen_code(env, tb, CODE_GEN_MAX_SIZE, &code_gen_size); cpu_gen_code(env, tb, CODE_GEN_MAX_SIZE, &code_gen_size);
code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1)); code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1));
/* check next page if needed */ /* check next page if needed */
virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;
phys_page2 = -1; phys_page2 = -1;
@ -634,7 +634,7 @@ static void tb_gen_code(CPUState *env,
tb_link_phys(tb, phys_pc, phys_page2); tb_link_phys(tb, phys_pc, phys_page2);
} }
#endif #endif
/* invalidate all TBs which intersect with the target physical page /* invalidate all TBs which intersect with the target physical page
starting in range [start;end[. NOTE: start and end must refer to starting in range [start;end[. NOTE: start and end must refer to
the same physical page. 'is_cpu_write_access' should be true if called 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,
that the modification is after the current PC, but it that the modification is after the current PC, but it
would require a specialized function to partially would require a specialized function to partially
restore the CPU state */ restore the CPU state */
current_tb_modified = 1; current_tb_modified = 1;
cpu_restore_state(current_tb, env, cpu_restore_state(current_tb, env,
env->mem_write_pc, NULL); env->mem_write_pc, NULL);
@ -819,7 +819,7 @@ static void tb_invalidate_phys_page(target_ulong addr,
that the modification is after the current PC, but it that the modification is after the current PC, but it
would require a specialized function to partially would require a specialized function to partially
restore the CPU state */ restore the CPU state */
current_tb_modified = 1; current_tb_modified = 1;
cpu_restore_state(current_tb, env, pc, puc); cpu_restore_state(current_tb, env, pc, puc);
#if defined(TARGET_I386) #if defined(TARGET_I386)
@ -1024,7 +1024,7 @@ static inline void tb_reset_jump_recursive2(TranslationBlock *tb, int n)
} }
*ptb = tb->jmp_next[n]; *ptb = tb->jmp_next[n];
tb->jmp_next[n] = NULL; tb->jmp_next[n] = NULL;
/* suppress the jump to next tb in generated code */ /* suppress the jump to next tb in generated code */
tb_reset_jump(tb, n); tb_reset_jump(tb, n);
@ -1103,7 +1103,7 @@ int cpu_breakpoint_insert(CPUState *env, target_ulong pc)
{ {
#if defined(TARGET_HAS_ICE) #if defined(TARGET_HAS_ICE)
int i; int i;
for(i = 0; i < env->nb_breakpoints; i++) { for(i = 0; i < env->nb_breakpoints; i++) {
if (env->breakpoints[i] == pc) if (env->breakpoints[i] == pc)
return 0; return 0;
@ -1112,7 +1112,7 @@ int cpu_breakpoint_insert(CPUState *env, target_ulong pc)
if (env->nb_breakpoints >= MAX_BREAKPOINTS) if (env->nb_breakpoints >= MAX_BREAKPOINTS)
return -1; return -1;
env->breakpoints[env->nb_breakpoints++] = pc; env->breakpoints[env->nb_breakpoints++] = pc;
breakpoint_invalidate(env, pc); breakpoint_invalidate(env, pc);
return 0; return 0;
#else #else
@ -1249,7 +1249,7 @@ static int cmp1(const char *s1, int n, const char *s2)
return 0; return 0;
return memcmp(s1, s2, n) == 0; return memcmp(s1, s2, n) == 0;
} }
/* takes a comma separated list of log masks. Return 0 if error. */ /* takes a comma separated list of log masks. Return 0 if error. */
int cpu_str_to_log_mask(const char *str) int cpu_str_to_log_mask(const char *str)
{ {
@ -1703,7 +1703,7 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr,
/* if code is present, we only map as read only and save the /* if code is present, we only map as read only and save the
original mapping */ original mapping */
VirtPageDesc *vp; VirtPageDesc *vp;
vp = virt_page_find_alloc(vaddr >> TARGET_PAGE_BITS, 1); vp = virt_page_find_alloc(vaddr >> TARGET_PAGE_BITS, 1);
vp->phys_addr = pd; vp->phys_addr = pd;
vp->prot = prot; vp->prot = prot;
@ -2008,7 +2008,7 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr,
} }
} }
} }
/* since each CPU stores ram addresses in its TLB cache, we must /* since each CPU stores ram addresses in its TLB cache, we must
reset the modified entries */ reset the modified entries */
/* XXX: slow ! */ /* XXX: slow ! */
@ -2492,7 +2492,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
target_phys_addr_t page; target_phys_addr_t page;
unsigned long pd; unsigned long pd;
PhysPageDesc *p; PhysPageDesc *p;
while (len > 0) { while (len > 0) {
page = addr & TARGET_PAGE_MASK; page = addr & TARGET_PAGE_MASK;
l = (page + TARGET_PAGE_SIZE) - addr; l = (page + TARGET_PAGE_SIZE) - addr;
@ -2504,7 +2504,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
} else { } else {
pd = p->phys_offset; pd = p->phys_offset;
} }
if (is_write) { if (is_write) {
if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); 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,
target_phys_addr_t page; target_phys_addr_t page;
unsigned long pd; unsigned long pd;
PhysPageDesc *p; PhysPageDesc *p;
while (len > 0) { while (len > 0) {
page = addr & TARGET_PAGE_MASK; page = addr & TARGET_PAGE_MASK;
l = (page + TARGET_PAGE_SIZE) - addr; l = (page + TARGET_PAGE_SIZE) - addr;
@ -2595,7 +2595,7 @@ void cpu_physical_memory_write_rom(target_phys_addr_t addr,
} else { } else {
pd = p->phys_offset; pd = p->phys_offset;
} }
if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM && if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM &&
(pd & ~TARGET_PAGE_MASK) != IO_MEM_ROM && (pd & ~TARGET_PAGE_MASK) != IO_MEM_ROM &&
!(pd & IO_MEM_ROMD)) { !(pd & IO_MEM_ROMD)) {
@ -2629,7 +2629,7 @@ uint32_t ldl_phys(target_phys_addr_t addr)
} else { } else {
pd = p->phys_offset; pd = p->phys_offset;
} }
if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM &&
!(pd & IO_MEM_ROMD)) { !(pd & IO_MEM_ROMD)) {
/* I/O case */ /* I/O case */
@ -2659,7 +2659,7 @@ uint64_t ldq_phys(target_phys_addr_t addr)
} else { } else {
pd = p->phys_offset; pd = p->phys_offset;
} }
if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM &&
!(pd & IO_MEM_ROMD)) { !(pd & IO_MEM_ROMD)) {
/* I/O case */ /* I/O case */
@ -2712,7 +2712,7 @@ void stl_phys_notdirty(target_phys_addr_t addr, uint32_t val)
} else { } else {
pd = p->phys_offset; pd = p->phys_offset;
} }
if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val); 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)
} else { } else {
pd = p->phys_offset; pd = p->phys_offset;
} }
if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
#ifdef TARGET_WORDS_BIGENDIAN #ifdef TARGET_WORDS_BIGENDIAN
@ -2767,7 +2767,7 @@ void stl_phys(target_phys_addr_t addr, uint32_t val)
} else { } else {
pd = p->phys_offset; pd = p->phys_offset;
} }
if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) { if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val); io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val);
@ -2842,7 +2842,7 @@ void dump_exec_info(FILE *f,
int i, target_code_size, max_target_code_size; int i, target_code_size, max_target_code_size;
int direct_jmp_count, direct_jmp2_count, cross_page; int direct_jmp_count, direct_jmp2_count, cross_page;
TranslationBlock *tb; TranslationBlock *tb;
target_code_size = 0; target_code_size = 0;
max_target_code_size = 0; max_target_code_size = 0;
cross_page = 0; cross_page = 0;

View File

@ -252,7 +252,7 @@ static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf)
registers[41] = 0; /* foseg */ registers[41] = 0; /* foseg */
registers[42] = 0; /* fooff */ registers[42] = 0; /* fooff */
registers[43] = 0; /* fop */ registers[43] = 0; /* fop */
for(i = 0; i < 16; i++) for(i = 0; i < 16; i++)
tswapls(&registers[i]); tswapls(&registers[i]);
for(i = 36; i < 44; i++) for(i = 36; i < 44; i++)
@ -748,7 +748,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
uint8_t mem_buf[2000]; uint8_t mem_buf[2000];
uint32_t *registers; uint32_t *registers;
target_ulong addr, len; target_ulong addr, len;
#ifdef DEBUG_GDB #ifdef DEBUG_GDB
printf("command='%s'\n", line_buf); printf("command='%s'\n", line_buf);
#endif #endif
@ -1201,7 +1201,7 @@ static void gdb_accept(void *opaque)
/* set short latency */ /* set short latency */
val = 1; val = 1;
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val));
s = &gdbserver_state; s = &gdbserver_state;
memset (s, 0, sizeof (GDBState)); memset (s, 0, sizeof (GDBState));
s->env = first_cpu; /* XXX: allow to change CPU */ s->env = first_cpu; /* XXX: allow to change CPU */

View File

@ -87,7 +87,7 @@ static void pm_update_sci(PIIX4PMState *s)
{ {
int sci_level, pmsts; int sci_level, pmsts;
int64_t expire_time; int64_t expire_time;
pmsts = get_pmsts(s); pmsts = get_pmsts(s);
sci_level = (((pmsts & s->pmen) & sci_level = (((pmsts & s->pmen) &
(RTC_EN | PWRBTN_EN | GBL_EN | TMROF_EN)) != 0); (RTC_EN | PWRBTN_EN | GBL_EN | TMROF_EN)) != 0);
@ -239,7 +239,7 @@ static uint32_t pm_smi_readb(void *opaque, uint32_t addr)
{ {
PIIX4PMState *s = opaque; PIIX4PMState *s = opaque;
uint32_t val; uint32_t val;
addr &= 1; addr &= 1;
if (addr == 0) { if (addr == 0) {
val = s->apmc; val = s->apmc;
@ -480,9 +480,9 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base)
pci_conf[0x0b] = 0x06; // bridge device pci_conf[0x0b] = 0x06; // bridge device
pci_conf[0x0e] = 0x00; // header_type pci_conf[0x0e] = 0x00; // header_type
pci_conf[0x3d] = 0x01; // interrupt pin 1 pci_conf[0x3d] = 0x01; // interrupt pin 1
pci_conf[0x40] = 0x01; /* PM io base read only bit */ pci_conf[0x40] = 0x01; /* PM io base read only bit */
register_ioport_write(0xb2, 2, 1, pm_smi_writeb, s); register_ioport_write(0xb2, 2, 1, pm_smi_writeb, s);
register_ioport_read(0xb2, 2, 1, pm_smi_readb, s); register_ioport_read(0xb2, 2, 1, pm_smi_readb, s);

View File

@ -299,31 +299,31 @@ static int adb_mouse_poll(ADBDevice *d, uint8_t *obuf)
if (s->last_buttons_state == s->buttons_state && if (s->last_buttons_state == s->buttons_state &&
s->dx == 0 && s->dy == 0) s->dx == 0 && s->dy == 0)
return 0; return 0;
dx = s->dx; dx = s->dx;
if (dx < -63) if (dx < -63)
dx = -63; dx = -63;
else if (dx > 63) else if (dx > 63)
dx = 63; dx = 63;
dy = s->dy; dy = s->dy;
if (dy < -63) if (dy < -63)
dy = -63; dy = -63;
else if (dy > 63) else if (dy > 63)
dy = 63; dy = 63;
s->dx -= dx; s->dx -= dx;
s->dy -= dy; s->dy -= dy;
s->last_buttons_state = s->buttons_state; s->last_buttons_state = s->buttons_state;
dx &= 0x7f; dx &= 0x7f;
dy &= 0x7f; dy &= 0x7f;
if (!(s->buttons_state & MOUSE_EVENT_LBUTTON)) if (!(s->buttons_state & MOUSE_EVENT_LBUTTON))
dy |= 0x80; dy |= 0x80;
if (!(s->buttons_state & MOUSE_EVENT_RBUTTON)) if (!(s->buttons_state & MOUSE_EVENT_RBUTTON))
dx |= 0x80; dx |= 0x80;
obuf[0] = dy; obuf[0] = dy;
obuf[1] = dx; obuf[1] = dx;
return 2; return 2;
@ -334,7 +334,7 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *obuf,
{ {
MouseState *s = d->opaque; MouseState *s = d->opaque;
int cmd, reg, olen; int cmd, reg, olen;
if ((buf[0] & 0x0f) == ADB_FLUSH) { if ((buf[0] & 0x0f) == ADB_FLUSH) {
/* flush mouse fifo */ /* flush mouse fifo */
s->buttons_state = s->last_buttons_state; s->buttons_state = s->last_buttons_state;

View File

@ -937,7 +937,7 @@ static int paddr_from_pte (uint64_t *paddr, int *zbitsp, int *prot,
} }
} }
*paddr = (pfn << page_bits) | (vaddr & page_mask); *paddr = (pfn << page_bits) | (vaddr & page_mask);
return 0; return 0;
} }

View File

@ -222,7 +222,7 @@ static void apic_bus_deliver(const uint32_t *deliver_bitmask,
foreach_apic(apic_iter, deliver_bitmask, foreach_apic(apic_iter, deliver_bitmask,
apic_init_ipi(apic_iter) ); apic_init_ipi(apic_iter) );
return; return;
case APIC_DM_EXTINT: case APIC_DM_EXTINT:
/* handled in I/O APIC code */ /* handled in I/O APIC code */
break; break;
@ -471,7 +471,7 @@ int apic_get_interrupt(CPUState *env)
return -1; return -1;
if (!(s->spurious_vec & APIC_SV_ENABLE)) if (!(s->spurious_vec & APIC_SV_ENABLE))
return -1; return -1;
/* XXX: spurious IRQ handling */ /* XXX: spurious IRQ handling */
intno = get_highest_priority_int(s->irr); intno = get_highest_priority_int(s->irr);
if (intno < 0) if (intno < 0)
@ -505,7 +505,7 @@ static uint32_t apic_get_current_count(APICState *s)
static void apic_timer_update(APICState *s, int64_t current_time) static void apic_timer_update(APICState *s, int64_t current_time)
{ {
int64_t next_time, d; int64_t next_time, d;
if (!(s->lvt[APIC_LVT_TIMER] & APIC_LVT_MASKED)) { if (!(s->lvt[APIC_LVT_TIMER] & APIC_LVT_MASKED)) {
d = (current_time - s->initial_count_load_time) >> d = (current_time - s->initial_count_load_time) >>
s->count_shift; s->count_shift;
@ -834,7 +834,7 @@ int apic_init(CPUState *env)
register_savevm("apic", s->id, 2, apic_save, apic_load, s); register_savevm("apic", s->id, 2, apic_save, apic_load, s);
qemu_register_reset(apic_reset, s); qemu_register_reset(apic_reset, s);
local_apics[s->id] = s; local_apics[s->id] = s;
return 0; return 0;
} }
@ -868,7 +868,7 @@ static void ioapic_service(IOAPICState *s)
vector = pic_read_irq(isa_pic); vector = pic_read_irq(isa_pic);
else else
vector = entry & 0xff; vector = entry & 0xff;
apic_get_delivery_bitmask(deliver_bitmask, dest, dest_mode); apic_get_delivery_bitmask(deliver_bitmask, dest, dest_mode);
apic_bus_deliver(deliver_bitmask, delivery_mode, apic_bus_deliver(deliver_bitmask, delivery_mode,
vector, polarity, trig_mode); vector, polarity, trig_mode);
@ -1042,6 +1042,6 @@ IOAPICState *ioapic_init(void)
register_savevm("ioapic", 0, 1, ioapic_save, ioapic_load, s); register_savevm("ioapic", 0, 1, ioapic_save, ioapic_load, s);
qemu_register_reset(ioapic_reset, s); qemu_register_reset(ioapic_reset, s);
return s; return s;
} }

View File

@ -41,7 +41,7 @@ int cdrom_read_toc(int nb_sectors, uint8_t *buf, int msf, int start_track)
{ {
uint8_t *q; uint8_t *q;
int len; int len;
if (start_track > 1 && start_track != 0xaa) if (start_track > 1 && start_track != 0xaa)
return -1; return -1;
q = buf + 2; q = buf + 2;
@ -85,7 +85,7 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num)
{ {
uint8_t *q; uint8_t *q;
int len; int len;
q = buf + 2; q = buf + 2;
*q++ = 1; /* first session */ *q++ = 1; /* first session */
*q++ = 1; /* last session */ *q++ = 1; /* last session */
@ -101,7 +101,7 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num)
*q++ = 1; /* first track */ *q++ = 1; /* first track */
*q++ = 0x00; /* disk type */ *q++ = 0x00; /* disk type */
*q++ = 0x00; *q++ = 0x00;
*q++ = 1; /* session number */ *q++ = 1; /* session number */
*q++ = 0x14; /* data track */ *q++ = 0x14; /* data track */
*q++ = 0; /* track number */ *q++ = 0; /* track number */
@ -113,7 +113,7 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num)
*q++ = 1; /* last track */ *q++ = 1; /* last track */
*q++ = 0x00; *q++ = 0x00;
*q++ = 0x00; *q++ = 0x00;
*q++ = 1; /* session number */ *q++ = 1; /* session number */
*q++ = 0x14; /* data track */ *q++ = 0x14; /* data track */
*q++ = 0; /* track number */ *q++ = 0; /* track number */

View File

@ -275,7 +275,7 @@ typedef struct PCICirrusVGAState {
} PCICirrusVGAState; } PCICirrusVGAState;
static uint8_t rop_to_index[256]; static uint8_t rop_to_index[256];
/*************************************** /***************************************
* *
* prototypes. * prototypes.
@ -788,7 +788,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s)
{ {
int copy_count; int copy_count;
uint8_t *end_ptr; uint8_t *end_ptr;
if (s->cirrus_srccounter > 0) { if (s->cirrus_srccounter > 0) {
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) { if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) {
cirrus_bitblt_common_patterncopy(s, s->cirrus_bltbuf); cirrus_bitblt_common_patterncopy(s, s->cirrus_bltbuf);
@ -1148,7 +1148,7 @@ static int cirrus_get_bpp(VGAState *s1)
static void cirrus_get_resolution(VGAState *s, int *pwidth, int *pheight) static void cirrus_get_resolution(VGAState *s, int *pwidth, int *pheight)
{ {
int width, height; int width, height;
width = (s->cr[0x01] + 1) * 8; width = (s->cr[0x01] + 1) * 8;
height = s->cr[0x12] | height = s->cr[0x12] |
((s->cr[0x07] & 0x02) << 7) | ((s->cr[0x07] & 0x02) << 7) |
@ -2223,7 +2223,7 @@ static void cirrus_cursor_invalidate(VGAState *s1)
s->last_hw_cursor_y != s->hw_cursor_y) { s->last_hw_cursor_y != s->hw_cursor_y) {
invalidate_cursor1(s); invalidate_cursor1(s);
s->last_hw_cursor_size = size; s->last_hw_cursor_size = size;
s->last_hw_cursor_x = s->hw_cursor_x; s->last_hw_cursor_x = s->hw_cursor_x;
s->last_hw_cursor_y = s->hw_cursor_y; 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)
unsigned int color0, color1; unsigned int color0, color1;
const uint8_t *palette, *src; const uint8_t *palette, *src;
uint32_t content; uint32_t content;
if (!(s->sr[0x12] & CIRRUS_CURSOR_SHOW)) if (!(s->sr[0x12] & CIRRUS_CURSOR_SHOW))
return; return;
/* fast test to see if the cursor intersects with the scan line */ /* 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)
if (scr_y < s->hw_cursor_y || if (scr_y < s->hw_cursor_y ||
scr_y >= (s->hw_cursor_y + h)) scr_y >= (s->hw_cursor_y + h))
return; return;
src = s->vram_ptr + s->real_vram_size - 16 * 1024; src = s->vram_ptr + s->real_vram_size - 16 * 1024;
if (s->sr[0x12] & CIRRUS_CURSOR_LARGE) { if (s->sr[0x12] & CIRRUS_CURSOR_LARGE) {
src += (s->sr[0x13] & 0x3c) * 256; src += (s->sr[0x13] & 0x3c) * 256;
@ -2379,7 +2379,7 @@ static void cirrus_linear_writeb(void *opaque, target_phys_addr_t addr,
unsigned mode; unsigned mode;
addr &= s->cirrus_addr_mask; addr &= s->cirrus_addr_mask;
if (((s->sr[0x17] & 0x44) == 0x44) && if (((s->sr[0x17] & 0x44) == 0x44) &&
((addr & s->linear_mmio_mask) == s->linear_mmio_mask)) { ((addr & s->linear_mmio_mask) == s->linear_mmio_mask)) {
/* memory-mapped I/O */ /* memory-mapped I/O */
@ -2600,7 +2600,7 @@ static void cirrus_update_memory_access(CirrusVGAState *s)
} else if (s->gr[0x0B] & 0x02) { } else if (s->gr[0x0B] & 0x02) {
goto generic_io; goto generic_io;
} }
mode = s->gr[0x05] & 0x7; mode = s->gr[0x05] & 0x7;
if (mode < 4 || mode > 5 || ((s->gr[0x0B] & 0x4) == 0)) { if (mode < 4 || mode > 5 || ((s->gr[0x0B] & 0x4) == 0)) {
s->cirrus_linear_write[0] = cirrus_linear_mem_writeb; 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,
CirrusVGAState *s; CirrusVGAState *s;
s = qemu_mallocz(sizeof(CirrusVGAState)); s = qemu_mallocz(sizeof(CirrusVGAState));
vga_common_init((VGAState *)s, vga_common_init((VGAState *)s,
ds, vga_ram_base, vga_ram_offset, vga_ram_size); ds, vga_ram_base, vga_ram_offset, vga_ram_size);
cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0); 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,
uint8_t *pci_conf; uint8_t *pci_conf;
CirrusVGAState *s; CirrusVGAState *s;
int device_id; int device_id;
device_id = CIRRUS_ID_CLGD5446; device_id = CIRRUS_ID_CLGD5446;
/* setup PCI configuration registers */ /* setup PCI configuration registers */

View File

@ -34,7 +34,7 @@
#define PUTPIXEL() ROP_OP(((uint32_t *)d)[0], col) #define PUTPIXEL() ROP_OP(((uint32_t *)d)[0], col)
#else #else
#error unsupported DEPTH #error unsupported DEPTH
#endif #endif
static void static void
glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH) glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)

View File

@ -116,10 +116,10 @@ typedef struct CUDAState {
uint8_t anh; /* A-side data, no handshake */ uint8_t anh; /* A-side data, no handshake */
CUDATimer timers[2]; CUDATimer timers[2];
uint8_t last_b; /* last value of B register */ uint8_t last_b; /* last value of B register */
uint8_t last_acr; /* last value of B register */ uint8_t last_acr; /* last value of B register */
int data_in_size; int data_in_size;
int data_in_index; int data_in_index;
int data_out_index; int data_out_index;
@ -196,7 +196,7 @@ static int64_t get_next_irq_time(CUDATimer *s, int64_t current_time)
counter = (d - (s->counter_value + 1)) % (s->latch + 2); counter = (d - (s->counter_value + 1)) % (s->latch + 2);
counter = (s->latch - counter) & 0xffff; counter = (s->latch - counter) & 0xffff;
} }
/* Note: we consider the irq is raised on 0 */ /* Note: we consider the irq is raised on 0 */
if (counter == 0xffff) { if (counter == 0xffff) {
next_time = d + s->latch + 1; next_time = d + s->latch + 1;
@ -317,7 +317,7 @@ static uint32_t cuda_readb(void *opaque, target_phys_addr_t addr)
static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
{ {
CUDAState *s = opaque; CUDAState *s = opaque;
addr = (addr >> 9) & 0xf; addr = (addr >> 9) & 0xf;
#ifdef DEBUG_CUDA #ifdef DEBUG_CUDA
printf("cuda: write: reg=0x%x val=%02x\n", addr, val); printf("cuda: write: reg=0x%x val=%02x\n", addr, val);

View File

@ -531,7 +531,7 @@ static void esp_save(QEMUFile *f, void *opaque)
static int esp_load(QEMUFile *f, void *opaque, int version_id) static int esp_load(QEMUFile *f, void *opaque, int version_id)
{ {
ESPState *s = opaque; ESPState *s = opaque;
if (version_id != 3) if (version_id != 3)
return -EINVAL; // Cannot emulate 2 return -EINVAL; // Cannot emulate 2

View File

@ -118,12 +118,12 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic)
d->config[0x1a] = 0x00; // subordinate_bus d->config[0x1a] = 0x00; // subordinate_bus
d->config[0x1c] = 0x00; d->config[0x1c] = 0x00;
d->config[0x1d] = 0x00; d->config[0x1d] = 0x00;
d->config[0x20] = 0x00; // memory_base d->config[0x20] = 0x00; // memory_base
d->config[0x21] = 0x00; d->config[0x21] = 0x00;
d->config[0x22] = 0x01; // memory_limit d->config[0x22] = 0x01; // memory_limit
d->config[0x23] = 0x00; d->config[0x23] = 0x00;
d->config[0x24] = 0x00; // prefetchable_memory_base d->config[0x24] = 0x00; // prefetchable_memory_base
d->config[0x25] = 0x00; d->config[0x25] = 0x00;
d->config[0x26] = 0x00; // prefetchable_memory_limit d->config[0x26] = 0x00; // prefetchable_memory_limit
@ -145,12 +145,12 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic)
d->config[0x1a] = 0x1; // subordinate_bus d->config[0x1a] = 0x1; // subordinate_bus
d->config[0x1c] = 0x10; // io_base d->config[0x1c] = 0x10; // io_base
d->config[0x1d] = 0x20; // io_limit d->config[0x1d] = 0x20; // io_limit
d->config[0x20] = 0x80; // memory_base d->config[0x20] = 0x80; // memory_base
d->config[0x21] = 0x80; d->config[0x21] = 0x80;
d->config[0x22] = 0x90; // memory_limit d->config[0x22] = 0x90; // memory_limit
d->config[0x23] = 0x80; d->config[0x23] = 0x80;
d->config[0x24] = 0x00; // prefetchable_memory_base d->config[0x24] = 0x00; // prefetchable_memory_base
d->config[0x25] = 0x84; d->config[0x25] = 0x84;
d->config[0x26] = 0x00; // prefetchable_memory_limit d->config[0x26] = 0x00; // prefetchable_memory_limit

View File

@ -287,10 +287,10 @@ static void gt64120_pci_mapping(GT64120State *s)
/* Update IO mapping */ /* Update IO mapping */
if ((s->regs[GT_PCI0IOLD] & 0x7f) <= s->regs[GT_PCI0IOHD]) if ((s->regs[GT_PCI0IOLD] & 0x7f) <= s->regs[GT_PCI0IOHD])
{ {
/* Unmap old IO address */ /* Unmap old IO address */
if (s->PCI0IO_length) if (s->PCI0IO_length)
{ {
cpu_register_physical_memory(s->PCI0IO_start, s->PCI0IO_length, IO_MEM_UNASSIGNED); cpu_register_physical_memory(s->PCI0IO_start, s->PCI0IO_length, IO_MEM_UNASSIGNED);
} }
/* Map new IO address */ /* Map new IO address */
s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21; s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21;

View File

@ -88,7 +88,7 @@ static uint32_t pic_readl (void *opaque, target_phys_addr_t addr)
HeathrowPIC *pic; HeathrowPIC *pic;
unsigned int n; unsigned int n;
uint32_t value; uint32_t value;
n = ((addr & 0xfff) - 0x10) >> 4; n = ((addr & 0xfff) - 0x10) >> 4;
if (n >= 2) { if (n >= 2) {
value = 0; value = 0;
@ -159,7 +159,7 @@ static void heathrow_pic_set_irq(void *opaque, int num, int level)
qemu_irq *heathrow_pic_init(int *pmem_index) qemu_irq *heathrow_pic_init(int *pmem_index)
{ {
HeathrowPICS *s; HeathrowPICS *s;
s = qemu_mallocz(sizeof(HeathrowPICS)); s = qemu_mallocz(sizeof(HeathrowPICS));
s->pics[0].level_triggered = 0; s->pics[0].level_triggered = 0;
s->pics[1].level_triggered = 0x1ff00000; s->pics[1].level_triggered = 0x1ff00000;

View File

@ -309,7 +309,7 @@ static uint32_t pit_ioport_read(void *opaque, uint32_t addr)
PITState *pit = opaque; PITState *pit = opaque;
int ret, count; int ret, count;
PITChannelState *s; PITChannelState *s;
addr &= 3; addr &= 3;
s = &pit->channels[addr]; s = &pit->channels[addr];
if (s->status_latched) { if (s->status_latched) {
@ -391,7 +391,7 @@ static void pit_save(QEMUFile *f, void *opaque)
PITState *pit = opaque; PITState *pit = opaque;
PITChannelState *s; PITChannelState *s;
int i; int i;
for(i = 0; i < 3; i++) { for(i = 0; i < 3; i++) {
s = &pit->channels[i]; s = &pit->channels[i];
qemu_put_be32s(f, &s->count); qemu_put_be32s(f, &s->count);
@ -419,7 +419,7 @@ static int pit_load(QEMUFile *f, void *opaque, int version_id)
PITState *pit = opaque; PITState *pit = opaque;
PITChannelState *s; PITChannelState *s;
int i; int i;
if (version_id != 1) if (version_id != 1)
return -EINVAL; return -EINVAL;

View File

@ -155,7 +155,7 @@ void pic_update_irq(PicState2 *s)
printf("pic%d: imr=%x irr=%x padd=%d\n", printf("pic%d: imr=%x irr=%x padd=%d\n",
i, s->pics[i].imr, s->pics[i].irr, i, s->pics[i].imr, s->pics[i].irr,
s->pics[i].priority_add); s->pics[i].priority_add);
} }
} }
printf("pic: cpu_interrupt\n"); printf("pic: cpu_interrupt\n");
@ -243,7 +243,7 @@ int pic_read_irq(PicState2 *s)
intno = s->pics[0].irq_base + irq; intno = s->pics[0].irq_base + irq;
} }
pic_update_irq(s); pic_update_irq(s);
#ifdef DEBUG_IRQ_LATENCY #ifdef DEBUG_IRQ_LATENCY
printf("IRQ%d latency=%0.3fus\n", printf("IRQ%d latency=%0.3fus\n",
irq, irq,
@ -429,7 +429,7 @@ uint32_t pic_intack_read(PicState2 *s)
ret = pic_poll_read(&s->pics[1], 0x80) + 8; ret = pic_poll_read(&s->pics[1], 0x80) + 8;
/* Prepare for ISR read */ /* Prepare for ISR read */
s->pics[0].read_reg_select = 1; s->pics[0].read_reg_select = 1;
return ret; return ret;
} }
@ -448,7 +448,7 @@ static uint32_t elcr_ioport_read(void *opaque, uint32_t addr1)
static void pic_save(QEMUFile *f, void *opaque) static void pic_save(QEMUFile *f, void *opaque)
{ {
PicState *s = opaque; PicState *s = opaque;
qemu_put_8s(f, &s->last_irr); qemu_put_8s(f, &s->last_irr);
qemu_put_8s(f, &s->irr); qemu_put_8s(f, &s->irr);
qemu_put_8s(f, &s->imr); qemu_put_8s(f, &s->imr);
@ -470,7 +470,7 @@ static void pic_save(QEMUFile *f, void *opaque)
static int pic_load(QEMUFile *f, void *opaque, int version_id) static int pic_load(QEMUFile *f, void *opaque, int version_id)
{ {
PicState *s = opaque; PicState *s = opaque;
if (version_id != 1) if (version_id != 1)
return -EINVAL; return -EINVAL;
@ -510,7 +510,7 @@ void pic_info(void)
{ {
int i; int i;
PicState *s; PicState *s;
if (!isa_pic) if (!isa_pic)
return; return;

View File

@ -392,7 +392,7 @@ typedef struct BMDMAState {
uint8_t cmd; uint8_t cmd;
uint8_t status; uint8_t status;
uint32_t addr; uint32_t addr;
struct PCIIDEState *pci_dev; struct PCIIDEState *pci_dev;
/* current transfer state */ /* current transfer state */
uint32_t cur_addr; uint32_t cur_addr;
@ -469,7 +469,7 @@ static void ide_identify(IDEState *s)
put_le16(p + 22, 4); /* ecc bytes */ put_le16(p + 22, 4); /* ecc bytes */
padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */ padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */
padstr((uint8_t *)(p + 27), "QEMU HARDDISK", 40); /* model */ padstr((uint8_t *)(p + 27), "QEMU HARDDISK", 40); /* model */
#if MAX_MULT_SECTORS > 1 #if MAX_MULT_SECTORS > 1
put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS); put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS);
#endif #endif
put_le16(p + 48, 1); /* dword I/O */ put_le16(p + 48, 1); /* dword I/O */
@ -923,7 +923,7 @@ static void ide_sector_write(IDEState *s)
ide_transfer_start(s, s->io_buffer, 512 * n1, ide_sector_write); ide_transfer_start(s, s->io_buffer, 512 * n1, ide_sector_write);
} }
ide_set_sector(s, sector_num + n); ide_set_sector(s, sector_num + n);
bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n, bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n,
ide_sector_write_aio_cb, bm); ide_sector_write_aio_cb, bm);
} }
@ -1246,7 +1246,7 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret)
bm->aiocb = NULL; bm->aiocb = NULL;
return; return;
} }
s->io_buffer_index = 0; s->io_buffer_index = 0;
if (s->cd_sector_size == 2352) { if (s->cd_sector_size == 2352) {
n = 1; n = 1;
@ -1375,7 +1375,7 @@ static void ide_atapi_cmd(IDEState *s)
buf[9] = 0x12; buf[9] = 0x12;
buf[10] = 0x08; buf[10] = 0x08;
buf[11] = 0x00; buf[11] = 0x00;
buf[12] = 0x70; buf[12] = 0x70;
buf[13] = 3 << 5; buf[13] = 3 << 5;
buf[14] = (1 << 0) | (1 << 3) | (1 << 5); buf[14] = (1 << 0) | (1 << 3) | (1 << 5);
@ -1501,7 +1501,7 @@ static void ide_atapi_cmd(IDEState *s)
int start, eject; int start, eject;
start = packet[4] & 1; start = packet[4] & 1;
eject = (packet[4] >> 1) & 1; eject = (packet[4] >> 1) & 1;
if (eject && !start) { if (eject && !start) {
/* eject the disk */ /* eject the disk */
bdrv_eject(s->bs, 1); bdrv_eject(s->bs, 1);
@ -2330,7 +2330,7 @@ static uint32_t ide_data_readl(void *opaque, uint32_t addr)
IDEState *s = ((IDEState *)opaque)->cur_drive; IDEState *s = ((IDEState *)opaque)->cur_drive;
uint8_t *p; uint8_t *p;
int ret; int ret;
p = s->data_ptr; p = s->data_ptr;
ret = cpu_to_le32(*(uint32_t *)p); ret = cpu_to_le32(*(uint32_t *)p);
p += 4; p += 4;
@ -2509,7 +2509,7 @@ static void ide_init_ioport(IDEState *ide_state, int iobase, int iobase2)
register_ioport_read(iobase2, 1, 1, ide_status_read, ide_state); register_ioport_read(iobase2, 1, 1, ide_status_read, ide_state);
register_ioport_write(iobase2, 1, 1, ide_cmd_write, ide_state); register_ioport_write(iobase2, 1, 1, ide_cmd_write, ide_state);
} }
/* data ports */ /* data ports */
register_ioport_write(iobase, 2, 2, ide_data_writew, ide_state); register_ioport_write(iobase, 2, 2, ide_data_writew, ide_state);
register_ioport_read(iobase, 2, 2, ide_data_readw, ide_state); 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,
ide_state = qemu_mallocz(sizeof(IDEState) * 2); ide_state = qemu_mallocz(sizeof(IDEState) * 2);
if (!ide_state) if (!ide_state)
return; return;
ide_init2(ide_state, hd0, hd1, irq); ide_init2(ide_state, hd0, hd1, irq);
ide_init_ioport(ide_state, iobase, iobase2); ide_init_ioport(ide_state, iobase, iobase2);
} }
@ -2671,7 +2671,7 @@ static uint32_t bmdma_readb(void *opaque, uint32_t addr)
BMDMAState *bm = opaque; BMDMAState *bm = opaque;
PCIIDEState *pci_dev; PCIIDEState *pci_dev;
uint32_t val; uint32_t val;
switch(addr & 3) { switch(addr & 3) {
case 0: case 0:
val = bm->cmd; val = bm->cmd;
@ -2835,7 +2835,7 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table,
pci_conf[0x0a] = 0x01; // class_sub = PCI_IDE pci_conf[0x0a] = 0x01; // class_sub = PCI_IDE
pci_conf[0x0b] = 0x01; // class_base = PCI_mass_storage pci_conf[0x0b] = 0x01; // class_base = PCI_mass_storage
pci_conf[0x0e] = 0x00; // header_type pci_conf[0x0e] = 0x00; // header_type
if (secondary_ide_enabled) { if (secondary_ide_enabled) {
/* XXX: if not enabled, really disable the seconday IDE controller */ /* XXX: if not enabled, really disable the seconday IDE controller */
pci_conf[0x51] = 0x80; /* enable IDE1 */ pci_conf[0x51] = 0x80; /* enable IDE1 */
@ -2853,7 +2853,7 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table,
PCI_ADDRESS_SPACE_IO, bmdma_map); PCI_ADDRESS_SPACE_IO, bmdma_map);
pci_conf[0x3d] = 0x01; // interrupt on pin 1 pci_conf[0x3d] = 0x01; // interrupt on pin 1
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)
d->ide_if[i].pci_dev = (PCIDevice *)d; d->ide_if[i].pci_dev = (PCIDevice *)d;
@ -2945,7 +2945,7 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
{ {
PCIIDEState *d; PCIIDEState *d;
uint8_t *pci_conf; uint8_t *pci_conf;
/* register a function 1 of PIIX3 */ /* register a function 1 of PIIX3 */
d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE", d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE",
sizeof(PCIIDEState), sizeof(PCIIDEState),
@ -3133,7 +3133,7 @@ int pmac_ide_init (BlockDriverState **hd_table, qemu_irq irq)
ide_if = qemu_mallocz(sizeof(IDEState) * 2); ide_if = qemu_mallocz(sizeof(IDEState) * 2);
ide_init2(&ide_if[0], hd_table[0], hd_table[1], irq); ide_init2(&ide_if[0], hd_table[0], hd_table[1], irq);
pmac_ide_memory = cpu_register_io_memory(0, pmac_ide_read, pmac_ide_memory = cpu_register_io_memory(0, pmac_ide_read,
pmac_ide_write, &ide_if[0]); pmac_ide_write, &ide_if[0]);
return pmac_ide_memory; return pmac_ide_memory;

View File

@ -279,7 +279,7 @@ static void iommu_save(QEMUFile *f, void *opaque)
{ {
IOMMUState *s = opaque; IOMMUState *s = opaque;
int i; int i;
for (i = 0; i < IOMMU_NREGS; i++) for (i = 0; i < IOMMU_NREGS; i++)
qemu_put_be32s(f, &s->regs[i]); qemu_put_be32s(f, &s->regs[i]);
qemu_put_be64s(f, &s->iostart); qemu_put_be64s(f, &s->iostart);
@ -289,7 +289,7 @@ static int iommu_load(QEMUFile *f, void *opaque, int version_id)
{ {
IOMMUState *s = opaque; IOMMUState *s = opaque;
int i; int i;
if (version_id != 2) if (version_id != 2)
return -EINVAL; return -EINVAL;
@ -322,7 +322,7 @@ void *iommu_init(target_phys_addr_t addr)
iommu_io_memory = cpu_register_io_memory(0, iommu_mem_read, iommu_mem_write, s); iommu_io_memory = cpu_register_io_memory(0, iommu_mem_read, iommu_mem_write, s);
cpu_register_physical_memory(addr, IOMMU_NREGS * 4, iommu_io_memory); cpu_register_physical_memory(addr, IOMMU_NREGS * 4, iommu_io_memory);
register_savevm("iommu", addr, 2, iommu_save, iommu_load, s); register_savevm("iommu", addr, 2, iommu_save, iommu_load, s);
qemu_register_reset(iommu_reset, s); qemu_register_reset(iommu_reset, s);
return s; return s;

View File

@ -90,7 +90,7 @@ static void get_time (m48t59_t *NVRAM, struct tm *tm)
static void set_time (m48t59_t *NVRAM, struct tm *tm) static void set_time (m48t59_t *NVRAM, struct tm *tm)
{ {
time_t now, new_time; time_t now, new_time;
new_time = mktime(tm); new_time = mktime(tm);
now = time(NULL); now = time(NULL);
NVRAM->time_offset = new_time - now; NVRAM->time_offset = new_time - now;
@ -510,7 +510,7 @@ static uint32_t NVRAM_readb (void *opaque, uint32_t addr)
static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value) static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value)
{ {
m48t59_t *NVRAM = opaque; m48t59_t *NVRAM = opaque;
addr -= NVRAM->mem_base; addr -= NVRAM->mem_base;
m48t59_write(NVRAM, addr, value & 0xff); m48t59_write(NVRAM, addr, value & 0xff);
} }
@ -518,7 +518,7 @@ static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value)
static void nvram_writew (void *opaque, target_phys_addr_t addr, uint32_t value) static void nvram_writew (void *opaque, target_phys_addr_t addr, uint32_t value)
{ {
m48t59_t *NVRAM = opaque; m48t59_t *NVRAM = opaque;
addr -= NVRAM->mem_base; addr -= NVRAM->mem_base;
m48t59_write(NVRAM, addr, (value >> 8) & 0xff); m48t59_write(NVRAM, addr, (value >> 8) & 0xff);
m48t59_write(NVRAM, addr + 1, value & 0xff); 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)
static void nvram_writel (void *opaque, target_phys_addr_t addr, uint32_t value) static void nvram_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
{ {
m48t59_t *NVRAM = opaque; m48t59_t *NVRAM = opaque;
addr -= NVRAM->mem_base; addr -= NVRAM->mem_base;
m48t59_write(NVRAM, addr, (value >> 24) & 0xff); m48t59_write(NVRAM, addr, (value >> 24) & 0xff);
m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff); m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff);
@ -539,7 +539,7 @@ static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr)
{ {
m48t59_t *NVRAM = opaque; m48t59_t *NVRAM = opaque;
uint32_t retval; uint32_t retval;
addr -= NVRAM->mem_base; addr -= NVRAM->mem_base;
retval = m48t59_read(NVRAM, addr); retval = m48t59_read(NVRAM, addr);
return retval; return retval;
@ -549,7 +549,7 @@ static uint32_t nvram_readw (void *opaque, target_phys_addr_t addr)
{ {
m48t59_t *NVRAM = opaque; m48t59_t *NVRAM = opaque;
uint32_t retval; uint32_t retval;
addr -= NVRAM->mem_base; addr -= NVRAM->mem_base;
retval = m48t59_read(NVRAM, addr) << 8; retval = m48t59_read(NVRAM, addr) << 8;
retval |= m48t59_read(NVRAM, addr + 1); retval |= m48t59_read(NVRAM, addr + 1);

View File

@ -110,7 +110,7 @@ static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data)
#ifdef DEBUG_CMOS #ifdef DEBUG_CMOS
printf("cmos: write index=0x%02x val=0x%02x\n", printf("cmos: write index=0x%02x val=0x%02x\n",
s->cmos_index, data); s->cmos_index, data);
#endif #endif
switch(s->cmos_index) { switch(s->cmos_index) {
case RTC_SECONDS_ALARM: case RTC_SECONDS_ALARM:
case RTC_MINUTES_ALARM: case RTC_MINUTES_ALARM:
@ -283,7 +283,7 @@ static void rtc_update_second(void *opaque)
qemu_mod_timer(s->second_timer, s->next_second_time); qemu_mod_timer(s->second_timer, s->next_second_time);
} else { } else {
rtc_next_second(&s->current_tm); rtc_next_second(&s->current_tm);
if (!(s->cmos_data[RTC_REG_B] & REG_B_SET)) { if (!(s->cmos_data[RTC_REG_B] & REG_B_SET)) {
/* update in progress bit */ /* update in progress bit */
s->cmos_data[RTC_REG_A] |= REG_A_UIP; s->cmos_data[RTC_REG_A] |= REG_A_UIP;
@ -411,7 +411,7 @@ static void rtc_save(QEMUFile *f, void *opaque)
qemu_put_buffer(f, s->cmos_data, 128); qemu_put_buffer(f, s->cmos_data, 128);
qemu_put_8s(f, &s->cmos_index); qemu_put_8s(f, &s->cmos_index);
qemu_put_be32s(f, &s->current_tm.tm_sec); qemu_put_be32s(f, &s->current_tm.tm_sec);
qemu_put_be32s(f, &s->current_tm.tm_min); qemu_put_be32s(f, &s->current_tm.tm_min);
qemu_put_be32s(f, &s->current_tm.tm_hour); qemu_put_be32s(f, &s->current_tm.tm_hour);

View File

@ -510,9 +510,9 @@ static void write_bootloader (CPUState *env, unsigned long bios_offset, int64_t
stl_raw(p++, 0x00000000); /* nop */ stl_raw(p++, 0x00000000); /* nop */
/* YAMON service vector */ /* YAMON service vector */
stl_raw(phys_ram_base + bios_offset + 0x500, 0xbfc00580); /* start: */ stl_raw(phys_ram_base + bios_offset + 0x500, 0xbfc00580); /* start: */
stl_raw(phys_ram_base + bios_offset + 0x504, 0xbfc0083c); /* print_count: */ stl_raw(phys_ram_base + bios_offset + 0x504, 0xbfc0083c); /* print_count: */
stl_raw(phys_ram_base + bios_offset + 0x520, 0xbfc00580); /* start: */ stl_raw(phys_ram_base + bios_offset + 0x520, 0xbfc00580); /* start: */
stl_raw(phys_ram_base + bios_offset + 0x52c, 0xbfc00800); /* flush_cache: */ stl_raw(phys_ram_base + bios_offset + 0x52c, 0xbfc00800); /* flush_cache: */
stl_raw(phys_ram_base + bios_offset + 0x534, 0xbfc00808); /* print: */ stl_raw(phys_ram_base + bios_offset + 0x534, 0xbfc00808); /* print: */
stl_raw(phys_ram_base + bios_offset + 0x538, 0xbfc00800); /* reg_cpu_isr: */ stl_raw(phys_ram_base + bios_offset + 0x538, 0xbfc00800); /* reg_cpu_isr: */

View File

@ -212,7 +212,7 @@ static int ne2000_buffer_full(NE2000State *s)
static int ne2000_can_receive(void *opaque) static int ne2000_can_receive(void *opaque)
{ {
NE2000State *s = opaque; NE2000State *s = opaque;
if (s->cmd & E8390_STOP) if (s->cmd & E8390_STOP)
return 1; return 1;
return !ne2000_buffer_full(s); return !ne2000_buffer_full(s);
@ -228,14 +228,14 @@ static void ne2000_receive(void *opaque, const uint8_t *buf, int size)
uint8_t buf1[60]; uint8_t buf1[60];
static const uint8_t broadcast_macaddr[6] = static const uint8_t broadcast_macaddr[6] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
#if defined(DEBUG_NE2000) #if defined(DEBUG_NE2000)
printf("NE2000: received len=%d\n", size); printf("NE2000: received len=%d\n", size);
#endif #endif
if (s->cmd & E8390_STOP || ne2000_buffer_full(s)) if (s->cmd & E8390_STOP || ne2000_buffer_full(s))
return; return;
/* XXX: check this */ /* XXX: check this */
if (s->rxcr & 0x10) { if (s->rxcr & 0x10) {
/* promiscuous: receive all */ /* promiscuous: receive all */
@ -252,10 +252,10 @@ static void ne2000_receive(void *opaque, const uint8_t *buf, int size)
if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))))
return; return;
} else if (s->mem[0] == buf[0] && } else if (s->mem[0] == buf[0] &&
s->mem[2] == buf[1] && s->mem[2] == buf[1] &&
s->mem[4] == buf[2] && s->mem[4] == buf[2] &&
s->mem[6] == buf[3] && s->mem[6] == buf[3] &&
s->mem[8] == buf[4] && s->mem[8] == buf[4] &&
s->mem[10] == buf[5]) { s->mem[10] == buf[5]) {
/* match */ /* match */
} else { } else {
@ -718,11 +718,11 @@ static int ne2000_load(QEMUFile* f,void* opaque,int version_id)
void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd) void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd)
{ {
NE2000State *s; NE2000State *s;
s = qemu_mallocz(sizeof(NE2000State)); s = qemu_mallocz(sizeof(NE2000State));
if (!s) if (!s)
return; return;
register_ioport_write(base, 16, 1, ne2000_ioport_write, s); register_ioport_write(base, 16, 1, ne2000_ioport_write, s);
register_ioport_read(base, 16, 1, ne2000_ioport_read, s); register_ioport_read(base, 16, 1, ne2000_ioport_read, s);
@ -749,7 +749,7 @@ void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd)
s->macaddr[3], s->macaddr[3],
s->macaddr[4], s->macaddr[4],
s->macaddr[5]); s->macaddr[5]);
register_savevm("ne2000", 0, 2, ne2000_save, ne2000_load, s); register_savevm("ne2000", 0, 2, ne2000_save, ne2000_load, s);
} }
@ -786,7 +786,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn)
PCINE2000State *d; PCINE2000State *d;
NE2000State *s; NE2000State *s;
uint8_t *pci_conf; uint8_t *pci_conf;
d = (PCINE2000State *)pci_register_device(bus, d = (PCINE2000State *)pci_register_device(bus,
"NE2000", sizeof(PCINE2000State), "NE2000", sizeof(PCINE2000State),
devfn, devfn,
@ -800,7 +800,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn)
pci_conf[0x0b] = 0x02; pci_conf[0x0b] = 0x02;
pci_conf[0x0e] = 0x00; // header_type pci_conf[0x0e] = 0x00; // header_type
pci_conf[0x3d] = 1; // interrupt pin 0 pci_conf[0x3d] = 1; // interrupt pin 0
pci_register_io_region(&d->dev, 0, 0x100, pci_register_io_region(&d->dev, 0, 0x100,
PCI_ADDRESS_SPACE_IO, ne2000_map); PCI_ADDRESS_SPACE_IO, ne2000_map);
s = &d->ne2000; s = &d->ne2000;
@ -819,7 +819,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn)
s->macaddr[3], s->macaddr[3],
s->macaddr[4], s->macaddr[4],
s->macaddr[5]); s->macaddr[5]);
/* XXX: instance number ? */ /* XXX: instance number ? */
register_savevm("ne2000", 0, 3, ne2000_save, ne2000_load, s); register_savevm("ne2000", 0, 3, ne2000_save, ne2000_load, s);
} }

View File

@ -475,7 +475,7 @@ static uint32_t read_doorbell_register (openpic_t *opp,
return retval; return retval;
} }
static void write_doorbell_register (penpic_t *opp, int n_dbl, static void write_doorbell_register (penpic_t *opp, int n_dbl,
uint32_t offset, uint32_t value) uint32_t offset, uint32_t value)
{ {
@ -831,7 +831,7 @@ static uint32_t openpic_cpu_read (void *opaque, uint32_t addr)
IRQ_dst_t *dst; IRQ_dst_t *dst;
uint32_t retval; uint32_t retval;
int idx, n_IRQ; int idx, n_IRQ;
DPRINTF("%s: addr %08x\n", __func__, addr); DPRINTF("%s: addr %08x\n", __func__, addr);
retval = 0xFFFFFFFF; retval = 0xFFFFFFFF;
if (addr & 0xF) if (addr & 0xF)
@ -1005,7 +1005,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus,
openpic_t *opp; openpic_t *opp;
uint8_t *pci_conf; uint8_t *pci_conf;
int i, m; int i, m;
/* XXX: for now, only one CPU is supported */ /* XXX: for now, only one CPU is supported */
if (nb_cpus != 1) if (nb_cpus != 1)
return NULL; return NULL;
@ -1023,7 +1023,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus,
pci_conf[0x0b] = 0x08; pci_conf[0x0b] = 0x08;
pci_conf[0x0e] = 0x00; // header_type pci_conf[0x0e] = 0x00; // header_type
pci_conf[0x3d] = 0x00; // no interrupt pin pci_conf[0x3d] = 0x00; // no interrupt pin
/* Register I/O spaces */ /* Register I/O spaces */
pci_register_io_region((PCIDevice *)opp, 0, 0x40000, pci_register_io_region((PCIDevice *)opp, 0, 0x40000,
PCI_ADDRESS_SPACE_MEM, &openpic_map); PCI_ADDRESS_SPACE_MEM, &openpic_map);
@ -1032,7 +1032,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus,
} }
opp->mem_index = cpu_register_io_memory(0, openpic_read, opp->mem_index = cpu_register_io_memory(0, openpic_read,
openpic_write, opp); openpic_write, opp);
// isu_base &= 0xFFFC0000; // isu_base &= 0xFFFC0000;
opp->nb_cpus = nb_cpus; opp->nb_cpus = nb_cpus;
/* Set IRQ types */ /* Set IRQ types */

View File

@ -88,7 +88,7 @@ static void
parallel_ioport_write_sw(void *opaque, uint32_t addr, uint32_t val) parallel_ioport_write_sw(void *opaque, uint32_t addr, uint32_t val)
{ {
ParallelState *s = opaque; ParallelState *s = opaque;
pdebug("write addr=0x%02x val=0x%02x\n", addr, val); pdebug("write addr=0x%02x val=0x%02x\n", addr, val);
addr &= 7; addr &= 7;

10
hw/pc.c
View File

@ -182,7 +182,7 @@ static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table
val = 65535; val = 65535;
rtc_set_memory(s, 0x34, val); rtc_set_memory(s, 0x34, val);
rtc_set_memory(s, 0x35, val >> 8); rtc_set_memory(s, 0x35, val >> 8);
switch(boot_device) { switch(boot_device) {
case 'a': case 'a':
case 'b': case 'b':
@ -209,7 +209,7 @@ static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table
val = (cmos_get_fd_drive_type(fd0) << 4) | cmos_get_fd_drive_type(fd1); val = (cmos_get_fd_drive_type(fd0) << 4) | cmos_get_fd_drive_type(fd1);
rtc_set_memory(s, 0x10, val); rtc_set_memory(s, 0x10, val);
val = 0; val = 0;
nb = 0; nb = 0;
if (fd0 < 3) if (fd0 < 3)
@ -294,7 +294,7 @@ void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val)
{ {
static const char shutdown_str[8] = "Shutdown"; static const char shutdown_str[8] = "Shutdown";
static int shutdown_index = 0; static int shutdown_index = 0;
switch(addr) { switch(addr) {
/* Bochs BIOS messages */ /* Bochs BIOS messages */
case 0x400: case 0x400:
@ -783,7 +783,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
/* map all the bios at the top of memory */ /* map all the bios at the top of memory */
cpu_register_physical_memory((uint32_t)(-bios_size), cpu_register_physical_memory((uint32_t)(-bios_size),
bios_size, bios_offset | IO_MEM_ROM); bios_size, bios_offset | IO_MEM_ROM);
bochs_bios_init(); bochs_bios_init();
if (linux_boot) if (linux_boot)
@ -914,7 +914,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
smbus_eeprom_device_init(smbus, 0x50 + i, eeprom_buf + (i * 256)); smbus_eeprom_device_init(smbus, 0x50 + i, eeprom_buf + (i * 256));
} }
} }
if (i440fx_state) { if (i440fx_state) {
i440fx_init_memory_mappings(i440fx_state); i440fx_init_memory_mappings(i440fx_state);
} }

View File

@ -105,7 +105,7 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
if (pci_irq_index >= PCI_DEVICES_MAX) if (pci_irq_index >= PCI_DEVICES_MAX)
return NULL; return NULL;
if (devfn < 0) { if (devfn < 0) {
for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) { for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) {
if (!bus->devices[devfn]) if (!bus->devices[devfn])
@ -166,7 +166,7 @@ static void pci_update_mappings(PCIDevice *d)
PCIIORegion *r; PCIIORegion *r;
int cmd, i; int cmd, i;
uint32_t last_addr, new_addr, config_ofs; uint32_t last_addr, new_addr, config_ofs;
cmd = le16_to_cpu(*(uint16_t *)(d->config + PCI_COMMAND)); cmd = le16_to_cpu(*(uint16_t *)(d->config + PCI_COMMAND));
for(i = 0; i < PCI_NUM_REGIONS; i++) { for(i = 0; i < PCI_NUM_REGIONS; i++) {
r = &d->io_regions[i]; r = &d->io_regions[i];
@ -367,7 +367,7 @@ void pci_data_write(void *opaque, uint32_t addr, uint32_t val, int len)
PCIBus *s = opaque; PCIBus *s = opaque;
PCIDevice *pci_dev; PCIDevice *pci_dev;
int config_addr, bus_num; int config_addr, bus_num;
#if defined(DEBUG_PCI) && 0 #if defined(DEBUG_PCI) && 0
printf("pci_data_write: addr=%08x val=%08x len=%d\n", printf("pci_data_write: addr=%08x val=%08x len=%d\n",
addr, val, len); addr, val, len);
@ -440,7 +440,7 @@ static void pci_set_irq(void *opaque, int irq_num, int level)
PCIDevice *pci_dev = (PCIDevice *)opaque; PCIDevice *pci_dev = (PCIDevice *)opaque;
PCIBus *bus; PCIBus *bus;
int change; int change;
change = level - pci_dev->irq_state[irq_num]; change = level - pci_dev->irq_state[irq_num];
if (!change) if (!change)
return; return;
@ -556,7 +556,7 @@ void pci_for_each_device(int bus_num, void (*fn)(PCIDevice *d))
PCIBus *bus = first_bus; PCIBus *bus = first_bus;
PCIDevice *d; PCIDevice *d;
int devfn; int devfn;
while (bus && bus->bus_num != bus_num) while (bus && bus->bus_num != bus_num)
bus = bus->next; bus = bus->next;
if (bus) { if (bus) {

View File

@ -338,7 +338,7 @@ static void kbd_reset(void *opaque)
static void kbd_save(QEMUFile* f, void* opaque) static void kbd_save(QEMUFile* f, void* opaque)
{ {
KBDState *s = (KBDState*)opaque; KBDState *s = (KBDState*)opaque;
qemu_put_8s(f, &s->write_cmd); qemu_put_8s(f, &s->write_cmd);
qemu_put_8s(f, &s->status); qemu_put_8s(f, &s->status);
qemu_put_8s(f, &s->mode); qemu_put_8s(f, &s->mode);
@ -348,7 +348,7 @@ static void kbd_save(QEMUFile* f, void* opaque)
static int kbd_load(QEMUFile* f, void* opaque, int version_id) static int kbd_load(QEMUFile* f, void* opaque, int version_id)
{ {
KBDState *s = (KBDState*)opaque; KBDState *s = (KBDState*)opaque;
if (version_id != 3) if (version_id != 3)
return -EINVAL; return -EINVAL;
qemu_get_8s(f, &s->write_cmd); qemu_get_8s(f, &s->write_cmd);

View File

@ -731,7 +731,7 @@ static void pcnet_s_reset(PCNetState *s)
s->rdra = 0; s->rdra = 0;
s->tdra = 0; s->tdra = 0;
s->rap = 0; s->rap = 0;
s->bcr[BCR_BSBC] &= ~0x0080; s->bcr[BCR_BSBC] &= ~0x0080;
s->csr[0] = 0x0004; s->csr[0] = 0x0004;
@ -770,7 +770,7 @@ static void pcnet_update_irq(PCNetState *s)
{ {
int isr = 0; int isr = 0;
s->csr[0] &= ~0x0080; s->csr[0] &= ~0x0080;
#if 1 #if 1
if (((s->csr[0] & ~s->csr[3]) & 0x5f00) || if (((s->csr[0] & ~s->csr[3]) & 0x5f00) ||
(((s->csr[4]>>1) & ~s->csr[4]) & 0x0115) || (((s->csr[4]>>1) & ~s->csr[4]) & 0x0115) ||
@ -790,11 +790,11 @@ static void pcnet_update_irq(PCNetState *s)
(!!(s->csr[5] & 0x0008) && !!(s->csr[5] & 0x0010)) /* MPINT */) (!!(s->csr[5] & 0x0008) && !!(s->csr[5] & 0x0010)) /* MPINT */)
#endif #endif
{ {
isr = CSR_INEA(s); isr = CSR_INEA(s);
s->csr[0] |= 0x0080; s->csr[0] |= 0x0080;
} }
if (!!(s->csr[4] & 0x0080) && CSR_INEA(s)) { /* UINT */ if (!!(s->csr[4] & 0x0080) && CSR_INEA(s)) { /* UINT */
s->csr[4] &= ~0x0080; s->csr[4] &= ~0x0080;
s->csr[4] |= 0x0040; s->csr[4] |= 0x0040;
@ -834,7 +834,7 @@ static void pcnet_init(PCNetState *s)
#ifdef PCNET_DEBUG #ifdef PCNET_DEBUG
printf("pcnet_init init_addr=0x%08x\n", PHYSADDR(s,CSR_IADR(s))); printf("pcnet_init init_addr=0x%08x\n", PHYSADDR(s,CSR_IADR(s)));
#endif #endif
if (BCR_SSIZE32(s)) { if (BCR_SSIZE32(s)) {
struct pcnet_initblk32 initblk; struct pcnet_initblk32 initblk;
s->phys_mem_read(s->dma_opaque, PHYSADDR(s,CSR_IADR(s)), s->phys_mem_read(s->dma_opaque, PHYSADDR(s,CSR_IADR(s)),
@ -898,7 +898,7 @@ static void pcnet_init(PCNetState *s)
s->rdra, CSR_RCVRL(s), s->tdra, CSR_XMTRL(s)); s->rdra, CSR_RCVRL(s), s->tdra, CSR_XMTRL(s));
#endif #endif
s->csr[0] |= 0x0101; s->csr[0] |= 0x0101;
s->csr[0] &= ~0x0004; /* clear STOP bit */ s->csr[0] &= ~0x0004; /* clear STOP bit */
} }
@ -910,7 +910,7 @@ static void pcnet_start(PCNetState *s)
if (!CSR_DTX(s)) if (!CSR_DTX(s))
s->csr[0] |= 0x0010; /* set TXON */ s->csr[0] |= 0x0010; /* set TXON */
if (!CSR_DRX(s)) if (!CSR_DRX(s))
s->csr[0] |= 0x0020; /* set RXON */ s->csr[0] |= 0x0020; /* set RXON */
@ -976,7 +976,7 @@ static void pcnet_rdte_poll(PCNetState *s)
#endif #endif
} }
} }
if (CSR_CRDA(s)) { if (CSR_CRDA(s)) {
struct pcnet_RMD rmd; struct pcnet_RMD rmd;
RMDLOAD(&rmd, PHYSADDR(s,CSR_CRDA(s))); RMDLOAD(&rmd, PHYSADDR(s,CSR_CRDA(s)));
@ -991,7 +991,7 @@ static void pcnet_rdte_poll(PCNetState *s)
} else { } else {
CSR_CRBC(s) = CSR_CRST(s) = 0; CSR_CRBC(s) = CSR_CRST(s) = 0;
} }
if (CSR_NRDA(s)) { if (CSR_NRDA(s)) {
struct pcnet_RMD rmd; struct pcnet_RMD rmd;
RMDLOAD(&rmd, PHYSADDR(s,CSR_NRDA(s))); RMDLOAD(&rmd, PHYSADDR(s,CSR_NRDA(s)));
@ -1030,14 +1030,14 @@ static int pcnet_tdte_poll(PCNetState *s)
if (CSR_CXDA(s)) { if (CSR_CXDA(s)) {
struct pcnet_TMD tmd; struct pcnet_TMD tmd;
TMDLOAD(&tmd, PHYSADDR(s,CSR_CXDA(s))); TMDLOAD(&tmd, PHYSADDR(s,CSR_CXDA(s)));
CSR_CXBC(s) = GET_FIELD(tmd.length, TMDL, BCNT); CSR_CXBC(s) = GET_FIELD(tmd.length, TMDL, BCNT);
CSR_CXST(s) = tmd.status; CSR_CXST(s) = tmd.status;
} else { } else {
CSR_CXBC(s) = CSR_CXST(s) = 0; CSR_CXBC(s) = CSR_CXST(s) = 0;
} }
return !!(CSR_CXST(s) & 0x8000); return !!(CSR_CXST(s) & 0x8000);
} }
@ -1046,7 +1046,7 @@ static int pcnet_can_receive(void *opaque)
PCNetState *s = opaque; PCNetState *s = opaque;
if (CSR_STOP(s) || CSR_SPND(s)) if (CSR_STOP(s) || CSR_SPND(s))
return 0; return 0;
if (s->recv_pos > 0) if (s->recv_pos > 0)
return 0; return 0;
@ -1093,7 +1093,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
nrda = s->rdra + nrda = s->rdra +
(CSR_RCVRL(s) - rcvrc) * (CSR_RCVRL(s) - rcvrc) *
(BCR_SWSTYLE(s) ? 16 : 8 ); (BCR_SWSTYLE(s) ? 16 : 8 );
RMDLOAD(&rmd, PHYSADDR(s,nrda)); RMDLOAD(&rmd, PHYSADDR(s,nrda));
if (GET_FIELD(rmd.status, RMDS, OWN)) { if (GET_FIELD(rmd.status, RMDS, OWN)) {
#ifdef PCNET_DEBUG_RMD #ifdef PCNET_DEBUG_RMD
printf("pcnet - scan buffer: RCVRC=%d PREV_RCVRC=%d\n", 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)
int pktcount = 0; int pktcount = 0;
memcpy(src, buf, size); memcpy(src, buf, size);
#if 1 #if 1
/* no need to compute the CRC */ /* no need to compute the CRC */
src[size] = 0; src[size] = 0;
@ -1136,7 +1136,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
while (size < 46) { while (size < 46) {
src[size++] = 0; src[size++] = 0;
} }
while (p != &src[size]) { while (p != &src[size]) {
CRC(fcs, *p++); CRC(fcs, *p++);
} }
@ -1178,7 +1178,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
PCNET_RECV_STORE(); PCNET_RECV_STORE();
} }
} }
} }
} }
#undef PCNET_RECV_STORE #undef PCNET_RECV_STORE
@ -1203,22 +1203,22 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
#endif #endif
#ifdef PCNET_DEBUG_RMD #ifdef PCNET_DEBUG_RMD
PRINT_RMD(&rmd); PRINT_RMD(&rmd);
#endif #endif
while (pktcount--) { while (pktcount--) {
if (CSR_RCVRC(s) <= 1) if (CSR_RCVRC(s) <= 1)
CSR_RCVRC(s) = CSR_RCVRL(s); CSR_RCVRC(s) = CSR_RCVRL(s);
else else
CSR_RCVRC(s)--; CSR_RCVRC(s)--;
} }
pcnet_rdte_poll(s); pcnet_rdte_poll(s);
} }
} }
pcnet_poll(s); pcnet_poll(s);
pcnet_update_irq(s); pcnet_update_irq(s);
} }
static void pcnet_transmit(PCNetState *s) static void pcnet_transmit(PCNetState *s)
@ -1226,7 +1226,7 @@ static void pcnet_transmit(PCNetState *s)
target_phys_addr_t xmit_cxda = 0; target_phys_addr_t xmit_cxda = 0;
int count = CSR_XMTRL(s)-1; int count = CSR_XMTRL(s)-1;
s->xmit_pos = -1; s->xmit_pos = -1;
if (!CSR_TXON(s)) { if (!CSR_TXON(s)) {
s->csr[0] &= ~0x0008; s->csr[0] &= ~0x0008;
return; return;
@ -1332,7 +1332,7 @@ static void pcnet_poll_timer(void *opaque)
pcnet_transmit(s); pcnet_transmit(s);
} }
pcnet_update_irq(s); pcnet_update_irq(s);
if (!CSR_STOP(s) && !CSR_SPND(s) && !CSR_DPOLL(s)) { if (!CSR_STOP(s) && !CSR_SPND(s) && !CSR_DPOLL(s)) {
uint64_t now = qemu_get_clock(vm_clock) * 33; 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)
PCNetState *s = opaque; PCNetState *s = opaque;
#ifdef PCNET_DEBUG #ifdef PCNET_DEBUG
printf("pcnet_aprom_writeb addr=0x%08x val=0x%02x\n", addr, val); printf("pcnet_aprom_writeb addr=0x%08x val=0x%02x\n", addr, val);
#endif #endif
/* Check APROMWE bit to enable write access */ /* Check APROMWE bit to enable write access */
if (pcnet_bcr_readw(s,2) & 0x80) if (pcnet_bcr_readw(s,2) & 0x80)
s->prom[addr & 15] = val; s->prom[addr & 15] = val;
} }
static uint32_t pcnet_aprom_readb(void *opaque, uint32_t addr) static uint32_t pcnet_aprom_readb(void *opaque, uint32_t addr)
{ {
@ -1685,7 +1685,7 @@ static void pcnet_ioport_writel(void *opaque, uint32_t addr, uint32_t val)
pcnet_bcr_writew(s, BCR_BSBC, pcnet_bcr_readw(s, BCR_BSBC) | 0x0080); pcnet_bcr_writew(s, BCR_BSBC, pcnet_bcr_readw(s, BCR_BSBC) | 0x0080);
#ifdef PCNET_DEBUG_IO #ifdef PCNET_DEBUG_IO
printf("device switched into dword i/o mode\n"); printf("device switched into dword i/o mode\n");
#endif #endif
} }
pcnet_update_irq(s); pcnet_update_irq(s);
} }
@ -1695,7 +1695,7 @@ static uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr)
PCNetState *s = opaque; PCNetState *s = opaque;
uint32_t val = -1; uint32_t val = -1;
pcnet_poll_timer(s); pcnet_poll_timer(s);
if (BCR_DWIO(s)) { if (BCR_DWIO(s)) {
switch (addr & 0x0f) { switch (addr & 0x0f) {
case 0x00: /* RDP */ case 0x00: /* RDP */
val = pcnet_csr_readw(s, s->rap); val = pcnet_csr_readw(s, s->rap);
@ -1730,7 +1730,7 @@ static void pcnet_ioport_map(PCIDevice *pci_dev, int region_num,
register_ioport_write(addr, 16, 1, pcnet_aprom_writeb, d); register_ioport_write(addr, 16, 1, pcnet_aprom_writeb, d);
register_ioport_read(addr, 16, 1, pcnet_aprom_readb, d); register_ioport_read(addr, 16, 1, pcnet_aprom_readb, d);
register_ioport_write(addr + 0x10, 0x10, 2, pcnet_ioport_writew, d); register_ioport_write(addr + 0x10, 0x10, 2, pcnet_ioport_writew, d);
register_ioport_read(addr + 0x10, 0x10, 2, pcnet_ioport_readw, d); register_ioport_read(addr + 0x10, 0x10, 2, pcnet_ioport_readw, d);
register_ioport_write(addr + 0x10, 0x10, 4, pcnet_ioport_writel, d); 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)
d = (PCNetState *)pci_register_device(bus, "PCNet", sizeof(PCNetState), d = (PCNetState *)pci_register_device(bus, "PCNet", sizeof(PCNetState),
devfn, NULL, NULL); devfn, NULL, NULL);
pci_conf = d->dev.config; pci_conf = d->dev.config;
*(uint16_t *)&pci_conf[0x00] = cpu_to_le16(0x1022); *(uint16_t *)&pci_conf[0x00] = cpu_to_le16(0x1022);
*(uint16_t *)&pci_conf[0x02] = cpu_to_le16(0x2000); *(uint16_t *)&pci_conf[0x02] = cpu_to_le16(0x2000);
*(uint16_t *)&pci_conf[0x04] = cpu_to_le16(0x0007); *(uint16_t *)&pci_conf[0x04] = cpu_to_le16(0x0007);
*(uint16_t *)&pci_conf[0x06] = cpu_to_le16(0x0280); *(uint16_t *)&pci_conf[0x06] = cpu_to_le16(0x0280);
pci_conf[0x08] = 0x10; pci_conf[0x08] = 0x10;
@ -1979,10 +1979,10 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn)
pci_conf[0x0a] = 0x00; // ethernet network controller pci_conf[0x0a] = 0x00; // ethernet network controller
pci_conf[0x0b] = 0x02; pci_conf[0x0b] = 0x02;
pci_conf[0x0e] = 0x00; // header_type pci_conf[0x0e] = 0x00; // header_type
*(uint32_t *)&pci_conf[0x10] = cpu_to_le32(0x00000001); *(uint32_t *)&pci_conf[0x10] = cpu_to_le32(0x00000001);
*(uint32_t *)&pci_conf[0x14] = cpu_to_le32(0x00000000); *(uint32_t *)&pci_conf[0x14] = cpu_to_le32(0x00000000);
pci_conf[0x3d] = 1; // interrupt pin 0 pci_conf[0x3d] = 1; // interrupt pin 0
pci_conf[0x3e] = 0x06; pci_conf[0x3e] = 0x06;
pci_conf[0x3f] = 0xff; pci_conf[0x3f] = 0xff;
@ -1993,10 +1993,10 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn)
pci_register_io_region((PCIDevice *)d, 0, PCNET_IOPORT_SIZE, pci_register_io_region((PCIDevice *)d, 0, PCNET_IOPORT_SIZE,
PCI_ADDRESS_SPACE_IO, pcnet_ioport_map); PCI_ADDRESS_SPACE_IO, pcnet_ioport_map);
pci_register_io_region((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE, pci_register_io_region((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE,
PCI_ADDRESS_SPACE_MEM, pcnet_mmio_map); PCI_ADDRESS_SPACE_MEM, pcnet_mmio_map);
d->irq = d->dev.irq[0]; d->irq = d->dev.irq[0];
d->phys_mem_read = pci_physical_memory_read; d->phys_mem_read = pci_physical_memory_read;
d->phys_mem_write = pci_physical_memory_write; d->phys_mem_write = pci_physical_memory_write;

View File

@ -222,7 +222,7 @@ static void pflash_write (pflash_t *pfl, uint32_t offset, uint32_t value,
offset -= (uint32_t)(long)pfl->storage; offset -= (uint32_t)(long)pfl->storage;
else else
offset -= pfl->base; offset -= pfl->base;
DPRINTF("%s: offset " TARGET_FMT_lx " %08x %d\n", __func__, DPRINTF("%s: offset " TARGET_FMT_lx " %08x %d\n", __func__,
offset, value, width); offset, value, width);
/* Set the device in I/O access mode */ /* Set the device in I/O access mode */

View File

@ -44,7 +44,7 @@ static const unsigned char pl011_id[] =
static void pl011_update(pl011_state *s) static void pl011_update(pl011_state *s)
{ {
uint32_t flags; uint32_t flags;
flags = s->int_level & s->int_enabled; flags = s->int_level & s->int_enabled;
qemu_set_irq(s->irq, flags != 0); qemu_set_irq(s->irq, flags != 0);
} }

View File

@ -117,7 +117,7 @@ static void pl110_update_display(void *opaque)
if (!pl110_enabled(s)) if (!pl110_enabled(s))
return; return;
switch (s->ds->depth) { switch (s->ds->depth) {
case 0: case 0:
return; return;
@ -151,7 +151,7 @@ static void pl110_update_display(void *opaque)
fn = fntable[s->bpp + 12]; fn = fntable[s->bpp + 12];
else else
fn = fntable[s->bpp]; fn = fntable[s->bpp];
src_width = s->cols; src_width = s->cols;
switch (s->bpp) { switch (s->bpp) {
case BPP_1: case BPP_1:

View File

@ -177,7 +177,7 @@ error:
/* Transfer data between the card and the FIFO. This is complicated by /* Transfer data between the card and the FIFO. This is complicated by
the FIFO holding 32-bit words and the card taking data in single byte the FIFO holding 32-bit words and the card taking data in single byte
chunks. FIFO bytes are transferred in little-endian order. */ chunks. FIFO bytes are transferred in little-endian order. */
static void pl181_fifo_run(pl181_state *s) static void pl181_fifo_run(pl181_state *s)
{ {
uint32_t bits; uint32_t bits;

View File

@ -623,7 +623,7 @@ struct ppcemb_timer_t {
uint64_t wdt_next; /* Tick for next WDT interrupt */ uint64_t wdt_next; /* Tick for next WDT interrupt */
struct QEMUTimer *wdt_timer; struct QEMUTimer *wdt_timer;
}; };
/* Fixed interval timer */ /* Fixed interval timer */
static void cpu_4xx_fit_cb (void *opaque) static void cpu_4xx_fit_cb (void *opaque)
{ {

View File

@ -511,7 +511,7 @@ static void taihu_405ep_init(int ram_size, int vga_ram_size, int boot_device,
target_ulong kernel_base, kernel_size, initrd_base, initrd_size; target_ulong kernel_base, kernel_size, initrd_base, initrd_size;
int linux_boot; int linux_boot;
int fl_idx, fl_sectors; int fl_idx, fl_sectors;
/* RAM is soldered to the board so the size cannot be changed */ /* RAM is soldered to the board so the size cannot be changed */
ram_bases[0] = 0x00000000; ram_bases[0] = 0x00000000;
ram_sizes[0] = 0x04000000; ram_sizes[0] = 0x04000000;

View File

@ -2212,7 +2212,7 @@ static void ppc4xx_gpt_set_outputs (ppc4xx_gpt_t *gpt)
} }
mask = mask >> 1; mask = mask >> 1;
} }
} }
static void ppc4xx_gpt_set_irqs (ppc4xx_gpt_t *gpt) static void ppc4xx_gpt_set_irqs (ppc4xx_gpt_t *gpt)
@ -2228,7 +2228,7 @@ static void ppc4xx_gpt_set_irqs (ppc4xx_gpt_t *gpt)
qemu_irq_lower(gpt->irqs[i]); qemu_irq_lower(gpt->irqs[i]);
mask = mask >> 1; mask = mask >> 1;
} }
} }
static void ppc4xx_gpt_compute_timer (ppc4xx_gpt_t *gpt) static void ppc4xx_gpt_compute_timer (ppc4xx_gpt_t *gpt)

View File

@ -173,7 +173,7 @@ static void macio_init(PCIBus *bus, int device_id)
d->config[0x0e] = 0x00; // header_type d->config[0x0e] = 0x00; // header_type
d->config[0x3d] = 0x01; // interrupt on pin 1 d->config[0x3d] = 0x01; // interrupt on pin 1
dbdma_mem_index = cpu_register_io_memory(0, dbdma_read, dbdma_write, NULL); dbdma_mem_index = cpu_register_io_memory(0, dbdma_read, dbdma_write, NULL);
pci_register_io_region(d, 0, 0x80000, pci_register_io_region(d, 0, 0x80000,
@ -208,7 +208,7 @@ static int vga_osi_call(CPUState *env)
{ {
static int vga_vbl_enabled; static int vga_vbl_enabled;
int linesize; int linesize;
// printf("osi_call R5=%d\n", env->gpr[5]); // printf("osi_call R5=%d\n", env->gpr[5]);
/* same handler as PearPC, coming from the original MOL video /* 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)
void pmac_format_nvram_partition(uint8_t *buf, int len) void pmac_format_nvram_partition(uint8_t *buf, int len)
{ {
char partition_name[12] = "wwwwwwwwwwww"; char partition_name[12] = "wwwwwwwwwwww";
buf[0] = 0x7f; /* free partition magic */ buf[0] = 0x7f; /* free partition magic */
buf[1] = 0; /* checksum */ buf[1] = 0; /* checksum */
buf[2] = len >> 8; buf[2] = len >> 8;
buf[3] = len; buf[3] = len;
memcpy(buf + 4, partition_name, 12); memcpy(buf + 4, partition_name, 12);
buf[1] = nvram_chksum(buf, 16); buf[1] = nvram_chksum(buf, 16);
} }
/* PowerPC CHRP hardware initialisation */ /* PowerPC CHRP hardware initialisation */
static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, 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,
bios_size = (bios_size + 0xfff) & ~0xfff; bios_size = (bios_size + 0xfff) & ~0xfff;
cpu_register_physical_memory((uint32_t)(-bios_size), cpu_register_physical_memory((uint32_t)(-bios_size),
bios_size, bios_offset | IO_MEM_ROM); bios_size, bios_offset | IO_MEM_ROM);
/* allocate and load VGA BIOS */ /* allocate and load VGA BIOS */
vga_bios_offset = bios_offset + bios_size; vga_bios_offset = bios_offset + bios_size;
snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); 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,
vga_bios_size += 8; vga_bios_size += 8;
} }
vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff; vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff;
if (linux_boot) { if (linux_boot) {
kernel_base = KERNEL_LOAD_ADDR; kernel_base = KERNEL_LOAD_ADDR;
/* now we can load the kernel */ /* 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,
/* XXX: suppress that */ /* XXX: suppress that */
dummy_irq = i8259_init(NULL); dummy_irq = i8259_init(NULL);
/* XXX: use Mac Serial port */ /* XXX: use Mac Serial port */
serial_init(0x3f8, dummy_irq[4], serial_hds[0]); serial_init(0x3f8, dummy_irq[4], serial_hds[0]);
for(i = 0; i < nb_nics; i++) { for(i = 0; i < nb_nics; i++) {
if (!nd_table[i].model) if (!nd_table[i].model)
nd_table[i].model = "ne2k_pci"; nd_table[i].model = "ne2k_pci";
pci_nic_init(pci_bus, &nd_table[i], -1); pci_nic_init(pci_bus, &nd_table[i], -1);
} }
pci_cmd646_ide_init(pci_bus, &bs_table[0], 0); pci_cmd646_ide_init(pci_bus, &bs_table[0], 0);
/* cuda also initialize ADB */ /* cuda also initialize ADB */
cuda_mem_index = cuda_init(pic[0x12]); cuda_mem_index = cuda_init(pic[0x12]);
adb_kbd_init(&adb_bus); adb_kbd_init(&adb_bus);
adb_mouse_init(&adb_bus); adb_mouse_init(&adb_bus);
{ {
MacIONVRAMState *nvr; MacIONVRAMState *nvr;
nvr = macio_nvram_init(); nvr = macio_nvram_init();
@ -534,14 +534,14 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device,
#endif #endif
/* cuda also initialize ADB */ /* cuda also initialize ADB */
cuda_mem_index = cuda_init(pic[0x19]); cuda_mem_index = cuda_init(pic[0x19]);
adb_kbd_init(&adb_bus); adb_kbd_init(&adb_bus);
adb_mouse_init(&adb_bus); adb_mouse_init(&adb_bus);
macio_init(pci_bus, 0x0022); macio_init(pci_bus, 0x0022);
nvram = m48t59_init(dummy_irq[8], 0xFFF04000, 0x0074, NVRAM_SIZE, 59); nvram = m48t59_init(dummy_irq[8], 0xFFF04000, 0x0074, NVRAM_SIZE, 59);
arch_name = "MAC99"; arch_name = "MAC99";
} }
@ -578,7 +578,7 @@ static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device,
kernel_filename, kernel_cmdline, kernel_filename, kernel_cmdline,
initrd_filename, cpu_model, 0); initrd_filename, cpu_model, 0);
} }
static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device, static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device,
DisplayState *ds, const char **fd_filename, DisplayState *ds, const char **fd_filename,
int snapshot, int snapshot,

View File

@ -146,7 +146,7 @@ uint32_t ps2_read_data(void *opaque)
PS2State *s = (PS2State *)opaque; PS2State *s = (PS2State *)opaque;
PS2Queue *q; PS2Queue *q;
int val, index; int val, index;
q = &s->queue; q = &s->queue;
if (q->count == 0) { if (q->count == 0) {
/* NOTE: if no data left, we return the last keyboard one /* NOTE: if no data left, we return the last keyboard one
@ -311,7 +311,7 @@ static void ps2_mouse_event(void *opaque,
s->mouse_buttons == buttons_state) s->mouse_buttons == buttons_state)
return; return;
s->mouse_buttons = buttons_state; s->mouse_buttons = buttons_state;
if (!(s->mouse_status & MOUSE_STATUS_REMOTE) && if (!(s->mouse_status & MOUSE_STATUS_REMOTE) &&
(s->common.queue.count < (PS2_QUEUE_SIZE - 16))) { (s->common.queue.count < (PS2_QUEUE_SIZE - 16))) {
for(;;) { for(;;) {

View File

@ -890,10 +890,10 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
++s->tally_counters.RxOkMul; ++s->tally_counters.RxOkMul;
} else if (s->phys[0] == buf[0] && } else if (s->phys[0] == buf[0] &&
s->phys[1] == buf[1] && s->phys[1] == buf[1] &&
s->phys[2] == buf[2] && s->phys[2] == buf[2] &&
s->phys[3] == buf[3] && s->phys[3] == buf[3] &&
s->phys[4] == buf[4] && s->phys[4] == buf[4] &&
s->phys[5] == buf[5]) { s->phys[5] == buf[5]) {
/* match */ /* match */
if (!(s->RxConfig & AcceptMyPhys)) if (!(s->RxConfig & AcceptMyPhys))
@ -2420,17 +2420,17 @@ static uint16_t rtl8139_TSAD_read(RTL8139State *s)
|((s->TxStatus[2] & TxUnderrun)?TSAD_TUN2:0) |((s->TxStatus[2] & TxUnderrun)?TSAD_TUN2:0)
|((s->TxStatus[1] & TxUnderrun)?TSAD_TUN1:0) |((s->TxStatus[1] & TxUnderrun)?TSAD_TUN1:0)
|((s->TxStatus[0] & TxUnderrun)?TSAD_TUN0:0) |((s->TxStatus[0] & TxUnderrun)?TSAD_TUN0:0)
|((s->TxStatus[3] & TxAborted )?TSAD_TABT3:0) |((s->TxStatus[3] & TxAborted )?TSAD_TABT3:0)
|((s->TxStatus[2] & TxAborted )?TSAD_TABT2:0) |((s->TxStatus[2] & TxAborted )?TSAD_TABT2:0)
|((s->TxStatus[1] & TxAborted )?TSAD_TABT1:0) |((s->TxStatus[1] & TxAborted )?TSAD_TABT1:0)
|((s->TxStatus[0] & TxAborted )?TSAD_TABT0:0) |((s->TxStatus[0] & TxAborted )?TSAD_TABT0:0)
|((s->TxStatus[3] & TxHostOwns )?TSAD_OWN3:0) |((s->TxStatus[3] & TxHostOwns )?TSAD_OWN3:0)
|((s->TxStatus[2] & TxHostOwns )?TSAD_OWN2:0) |((s->TxStatus[2] & TxHostOwns )?TSAD_OWN2:0)
|((s->TxStatus[1] & TxHostOwns )?TSAD_OWN1:0) |((s->TxStatus[1] & TxHostOwns )?TSAD_OWN1:0)
|((s->TxStatus[0] & TxHostOwns )?TSAD_OWN0:0) ; |((s->TxStatus[0] & TxHostOwns )?TSAD_OWN0:0) ;
DEBUG_PRINT(("RTL8139: TSAD read val=0x%04x\n", ret)); DEBUG_PRINT(("RTL8139: TSAD read val=0x%04x\n", ret));
@ -3410,7 +3410,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn)
PCIRTL8139State *d; PCIRTL8139State *d;
RTL8139State *s; RTL8139State *s;
uint8_t *pci_conf; uint8_t *pci_conf;
d = (PCIRTL8139State *)pci_register_device(bus, d = (PCIRTL8139State *)pci_register_device(bus,
"RTL8139", sizeof(PCIRTL8139State), "RTL8139", sizeof(PCIRTL8139State),
devfn, devfn,
@ -3458,7 +3458,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn)
s->cplus_txbuffer = NULL; s->cplus_txbuffer = NULL;
s->cplus_txbuffer_len = 0; s->cplus_txbuffer_len = 0;
s->cplus_txbuffer_offset = 0; s->cplus_txbuffer_offset = 0;
/* XXX: instance number ? */ /* XXX: instance number ? */
register_savevm("rtl8139", 0, 3, rtl8139_save, rtl8139_load, s); register_savevm("rtl8139", 0, 3, rtl8139_save, rtl8139_load, s);

View File

@ -142,7 +142,7 @@ static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val)
{ {
SerialState *s = opaque; SerialState *s = opaque;
unsigned char ch; unsigned char ch;
addr &= 7; addr &= 7;
#ifdef DEBUG_SERIAL #ifdef DEBUG_SERIAL
printf("serial: write addr=0x%02x val=0x%02x\n", addr, val); printf("serial: write addr=0x%02x val=0x%02x\n", addr, val);

View File

@ -308,7 +308,7 @@ static void slavio_intctl_save(QEMUFile *f, void *opaque)
{ {
SLAVIO_INTCTLState *s = opaque; SLAVIO_INTCTLState *s = opaque;
int i; int i;
for (i = 0; i < MAX_CPUS; i++) { for (i = 0; i < MAX_CPUS; i++) {
qemu_put_be32s(f, &s->intreg_pending[i]); qemu_put_be32s(f, &s->intreg_pending[i]);
} }

View File

@ -136,7 +136,7 @@ static uint32_t get_queue(void *opaque)
ChannelState *s = opaque; ChannelState *s = opaque;
SERIOQueue *q = &s->queue; SERIOQueue *q = &s->queue;
int val; int val;
if (q->count == 0) { if (q->count == 0) {
return 0; return 0;
} else { } else {

View File

@ -210,7 +210,7 @@ static int slavio_timer_load(QEMUFile *f, void *opaque, int version_id)
{ {
SLAVIO_TIMERState *s = opaque; SLAVIO_TIMERState *s = opaque;
uint32_t tmp; uint32_t tmp;
if (version_id != 2) if (version_id != 2)
return -EINVAL; return -EINVAL;

View File

@ -94,7 +94,7 @@ static uint8_t eeprom_read_data(SMBusDevice *dev, uint8_t cmd, int n)
void smbus_eeprom_device_init(i2c_bus *bus, uint8_t addr, uint8_t *buf) void smbus_eeprom_device_init(i2c_bus *bus, uint8_t addr, uint8_t *buf)
{ {
SMBusEEPROMDevice *eeprom; SMBusEEPROMDevice *eeprom;
eeprom = (SMBusEEPROMDevice *)smbus_device_init(bus, addr, eeprom = (SMBusEEPROMDevice *)smbus_device_init(bus, addr,
sizeof(SMBusEEPROMDevice)); sizeof(SMBusEEPROMDevice));

View File

@ -649,7 +649,7 @@ static void smc91c111_receive(void *opaque, const uint8_t *buf, int size)
/* Pad short packets. */ /* Pad short packets. */
if (size < 64) { if (size < 64) {
int pad; int pad;
if (size & 1) if (size & 1)
*(p++) = buf[size - 1]; *(p++) = buf[size - 1];
pad = 64 - size; pad = 64 - size;

View File

@ -208,7 +208,7 @@ static void tcx_update_display(void *opaque)
case 0: case 0:
return; return;
} }
for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE) { for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE) {
if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) { if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) {
if (y_start < 0) if (y_start < 0)
@ -353,7 +353,7 @@ static void tcx24_invalidate_display(void *opaque)
static void tcx_save(QEMUFile *f, void *opaque) static void tcx_save(QEMUFile *f, void *opaque)
{ {
TCXState *s = opaque; TCXState *s = opaque;
qemu_put_be16s(f, (uint16_t *)&s->height); qemu_put_be16s(f, (uint16_t *)&s->height);
qemu_put_be16s(f, (uint16_t *)&s->width); qemu_put_be16s(f, (uint16_t *)&s->width);
qemu_put_be16s(f, (uint16_t *)&s->depth); qemu_put_be16s(f, (uint16_t *)&s->depth);

View File

@ -102,7 +102,7 @@ static const uint8_t qemu_mouse_config_descriptor[] = {
5: Remote wakeup, 5: Remote wakeup,
4..0: resvd */ 4..0: resvd */
50, /* u8 MaxPower; */ 50, /* u8 MaxPower; */
/* USB 1.1: /* USB 1.1:
* USB 2.0, single TT organization (mandatory): * USB 2.0, single TT organization (mandatory):
* one interface, protocol 0 * one interface, protocol 0
@ -124,7 +124,7 @@ static const uint8_t qemu_mouse_config_descriptor[] = {
0x01, /* u8 if_bInterfaceSubClass; */ 0x01, /* u8 if_bInterfaceSubClass; */
0x02, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ 0x02, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */
0x07, /* u8 if_iInterface; */ 0x07, /* u8 if_iInterface; */
/* HID descriptor */ /* HID descriptor */
0x09, /* u8 bLength; */ 0x09, /* u8 bLength; */
0x21, /* u8 bDescriptorType; */ 0x21, /* u8 bDescriptorType; */
@ -157,7 +157,7 @@ static const uint8_t qemu_tablet_config_descriptor[] = {
5: Remote wakeup, 5: Remote wakeup,
4..0: resvd */ 4..0: resvd */
50, /* u8 MaxPower; */ 50, /* u8 MaxPower; */
/* USB 1.1: /* USB 1.1:
* USB 2.0, single TT organization (mandatory): * USB 2.0, single TT organization (mandatory):
* one interface, protocol 0 * one interface, protocol 0
@ -474,7 +474,7 @@ static int usb_mouse_poll(USBHIDState *hs, uint8_t *buf, int len)
0, "QEMU USB Mouse"); 0, "QEMU USB Mouse");
s->mouse_grabbed = 1; s->mouse_grabbed = 1;
} }
dx = int_clamp(s->dx, -128, 127); dx = int_clamp(s->dx, -128, 127);
dy = int_clamp(s->dy, -128, 127); dy = int_clamp(s->dy, -128, 127);
dz = int_clamp(s->dz, -128, 127); dz = int_clamp(s->dz, -128, 127);
@ -482,7 +482,7 @@ static int usb_mouse_poll(USBHIDState *hs, uint8_t *buf, int len)
s->dx -= dx; s->dx -= dx;
s->dy -= dy; s->dy -= dy;
s->dz -= dz; s->dz -= dz;
b = 0; b = 0;
if (s->buttons_state & MOUSE_EVENT_LBUTTON) if (s->buttons_state & MOUSE_EVENT_LBUTTON)
b |= 0x01; b |= 0x01;
@ -490,7 +490,7 @@ static int usb_mouse_poll(USBHIDState *hs, uint8_t *buf, int len)
b |= 0x02; b |= 0x02;
if (s->buttons_state & MOUSE_EVENT_MBUTTON) if (s->buttons_state & MOUSE_EVENT_MBUTTON)
b |= 0x04; b |= 0x04;
buf[0] = b; buf[0] = b;
buf[1] = dx; buf[1] = dx;
buf[2] = dy; buf[2] = dy;
@ -512,7 +512,7 @@ static int usb_tablet_poll(USBHIDState *hs, uint8_t *buf, int len)
1, "QEMU USB Tablet"); 1, "QEMU USB Tablet");
s->mouse_grabbed = 1; s->mouse_grabbed = 1;
} }
dz = int_clamp(s->dz, -128, 127); dz = int_clamp(s->dz, -128, 127);
s->dz -= dz; s->dz -= dz;

View File

@ -118,7 +118,7 @@ static const uint8_t qemu_hub_config_descriptor[] = {
5: Remote wakeup, 5: Remote wakeup,
4..0: resvd */ 4..0: resvd */
0x00, /* u8 MaxPower; */ 0x00, /* u8 MaxPower; */
/* USB 1.1: /* USB 1.1:
* USB 2.0, single TT organization (mandatory): * USB 2.0, single TT organization (mandatory):
* one interface, protocol 0 * one interface, protocol 0
@ -140,7 +140,7 @@ static const uint8_t qemu_hub_config_descriptor[] = {
0x00, /* u8 if_bInterfaceSubClass; */ 0x00, /* u8 if_bInterfaceSubClass; */
0x00, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ 0x00, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */
0x00, /* u8 if_iInterface; */ 0x00, /* u8 if_iInterface; */
/* one endpoint (status change endpoint) */ /* one endpoint (status change endpoint) */
0x07, /* u8 ep_bLength; */ 0x07, /* u8 ep_bLength; */
0x05, /* u8 ep_bDescriptorType; Endpoint */ 0x05, /* u8 ep_bDescriptorType; Endpoint */
@ -167,11 +167,11 @@ static void usb_hub_attach(USBPort *port1, USBDevice *dev)
{ {
USBHubState *s = port1->opaque; USBHubState *s = port1->opaque;
USBHubPort *port = &s->ports[port1->index]; USBHubPort *port = &s->ports[port1->index];
if (dev) { if (dev) {
if (port->port.dev) if (port->port.dev)
usb_attach(port1, NULL); usb_attach(port1, NULL);
port->wPortStatus |= PORT_STAT_CONNECTION; port->wPortStatus |= PORT_STAT_CONNECTION;
port->wPortChange |= PORT_STAT_C_CONNECTION; port->wPortChange |= PORT_STAT_C_CONNECTION;
if (dev->speed == USB_SPEED_LOW) if (dev->speed == USB_SPEED_LOW)

View File

@ -99,7 +99,7 @@ static const uint8_t qemu_msd_config_descriptor[] = {
5: Remote wakeup, 5: Remote wakeup,
4..0: resvd */ 4..0: resvd */
0x00, /* u8 MaxPower; */ 0x00, /* u8 MaxPower; */
/* one interface */ /* one interface */
0x09, /* u8 if_bLength; */ 0x09, /* u8 if_bLength; */
0x04, /* u8 if_bDescriptorType; Interface */ 0x04, /* u8 if_bDescriptorType; Interface */
@ -110,7 +110,7 @@ static const uint8_t qemu_msd_config_descriptor[] = {
0x06, /* u8 if_bInterfaceSubClass; SCSI */ 0x06, /* u8 if_bInterfaceSubClass; SCSI */
0x50, /* u8 if_bInterfaceProtocol; Bulk Only */ 0x50, /* u8 if_bInterfaceProtocol; Bulk Only */
0x00, /* u8 if_iInterface; */ 0x00, /* u8 if_iInterface; */
/* Bulk-In endpoint */ /* Bulk-In endpoint */
0x07, /* u8 ep_bLength; */ 0x07, /* u8 ep_bLength; */
0x05, /* u8 ep_bDescriptorType; Endpoint */ 0x05, /* u8 ep_bDescriptorType; Endpoint */

View File

@ -149,7 +149,7 @@ static void uhci_reset(UHCIState *s)
static void uhci_ioport_writeb(void *opaque, uint32_t addr, uint32_t val) static void uhci_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
{ {
UHCIState *s = opaque; UHCIState *s = opaque;
addr &= 0x1f; addr &= 0x1f;
switch(addr) { switch(addr) {
case 0x0c: case 0x0c:
@ -178,7 +178,7 @@ static uint32_t uhci_ioport_readb(void *opaque, uint32_t addr)
static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val) static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
{ {
UHCIState *s = opaque; UHCIState *s = opaque;
addr &= 0x1f; addr &= 0x1f;
#ifdef DEBUG #ifdef DEBUG
printf("uhci writew port=0x%04x val=0x%04x\n", addr, val); 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)
if (td->ctrl & TD_CTRL_IOC) { if (td->ctrl & TD_CTRL_IOC) {
*int_mask |= 0x01; *int_mask |= 0x01;
} }
if (!(td->ctrl & TD_CTRL_ACTIVE)) if (!(td->ctrl & TD_CTRL_ACTIVE))
return 1; return 1;
@ -807,7 +807,7 @@ void usb_uhci_piix3_init(PCIBus *bus, int devfn)
pci_conf[0x0e] = 0x00; // header_type pci_conf[0x0e] = 0x00; // header_type
pci_conf[0x3d] = 4; // interrupt pin 3 pci_conf[0x3d] = 4; // interrupt pin 3
pci_conf[0x60] = 0x10; // release number pci_conf[0x60] = 0x10; // release number
for(i = 0; i < NB_PORTS; i++) { for(i = 0; i < NB_PORTS; i++) {
qemu_register_usb_port(&s->ports[i].port, s, i, uhci_attach); qemu_register_usb_port(&s->ports[i].port, s, i, uhci_attach);
} }

View File

@ -119,7 +119,7 @@ struct USBDevice {
void (*handle_destroy)(USBDevice *dev); void (*handle_destroy)(USBDevice *dev);
int speed; int speed;
/* The following fields are used by the generic USB device /* The following fields are used by the generic USB device
layer. They are here just to avoid creating a new structure for layer. They are here just to avoid creating a new structure for
them. */ them. */
@ -129,7 +129,7 @@ struct USBDevice {
int (*handle_data)(USBDevice *dev, USBPacket *p); int (*handle_data)(USBDevice *dev, USBPacket *p);
uint8_t addr; uint8_t addr;
char devname[32]; char devname[32];
int state; int state;
uint8_t setup_buf[8]; uint8_t setup_buf[8];
uint8_t data_buf[1024]; uint8_t data_buf[1024];

View File

@ -467,7 +467,7 @@ static void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)
s->vbe_regs[VBE_DISPI_INDEX_YRES]; s->vbe_regs[VBE_DISPI_INDEX_YRES];
s->vbe_regs[VBE_DISPI_INDEX_X_OFFSET] = 0; s->vbe_regs[VBE_DISPI_INDEX_X_OFFSET] = 0;
s->vbe_regs[VBE_DISPI_INDEX_Y_OFFSET] = 0; s->vbe_regs[VBE_DISPI_INDEX_Y_OFFSET] = 0;
if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4)
s->vbe_line_offset = s->vbe_regs[VBE_DISPI_INDEX_XRES] >> 1; s->vbe_line_offset = s->vbe_regs[VBE_DISPI_INDEX_XRES] >> 1;
else else
@ -480,7 +480,7 @@ static void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)
memset(s->vram_ptr, 0, memset(s->vram_ptr, 0,
s->vbe_regs[VBE_DISPI_INDEX_YRES] * s->vbe_line_offset); s->vbe_regs[VBE_DISPI_INDEX_YRES] * s->vbe_line_offset);
} }
/* we initialize the VGA graphic mode (should be done /* we initialize the VGA graphic mode (should be done
in BIOS) */ in BIOS) */
s->gr[0x06] = (s->gr[0x06] & ~0x0c) | 0x05; /* graphic mode + memory map 1 */ s->gr[0x06] = (s->gr[0x06] & ~0x0c) | 0x05; /* graphic mode + memory map 1 */
@ -497,7 +497,7 @@ static void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)
s->cr[0x18] = 0xff; s->cr[0x18] = 0xff;
s->cr[0x07] |= 0x10; s->cr[0x07] |= 0x10;
s->cr[0x09] |= 0x40; s->cr[0x09] |= 0x40;
if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) { if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) {
shift_control = 0; shift_control = 0;
s->sr[0x01] &= ~8; /* no double line */ s->sr[0x01] &= ~8; /* no double line */
@ -562,7 +562,7 @@ uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr)
VGAState *s = opaque; VGAState *s = opaque;
int memory_map_mode, plane; int memory_map_mode, plane;
uint32_t ret; uint32_t ret;
/* convert to VGA memory offset */ /* convert to VGA memory offset */
memory_map_mode = (s->gr[6] >> 2) & 3; memory_map_mode = (s->gr[6] >> 2) & 3;
addr &= 0x1ffff; addr &= 0x1ffff;
@ -586,7 +586,7 @@ uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr)
return 0xff; return 0xff;
break; break;
} }
if (s->sr[4] & 0x08) { if (s->sr[4] & 0x08) {
/* chain 4 mode : simplest access */ /* chain 4 mode : simplest access */
ret = s->vram_ptr[addr]; ret = s->vram_ptr[addr];
@ -676,7 +676,7 @@ void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
return; return;
break; break;
} }
if (s->sr[4] & 0x08) { if (s->sr[4] & 0x08) {
/* chain 4 mode : simplest access */ /* chain 4 mode : simplest access */
plane = addr & 3; plane = addr & 3;
@ -961,7 +961,7 @@ static void vga_get_offsets(VGAState *s,
line_compare = 65535; line_compare = 65535;
} else } else
#endif #endif
{ {
/* compute line_offset in bytes */ /* compute line_offset in bytes */
line_offset = s->cr[0x13]; line_offset = s->cr[0x13];
line_offset <<= 3; line_offset <<= 3;
@ -984,7 +984,7 @@ static int update_basic_params(VGAState *s)
{ {
int full_update; int full_update;
uint32_t start_addr, line_offset, line_compare; uint32_t start_addr, line_offset, line_compare;
full_update = 0; full_update = 0;
s->get_offsets(s, &line_offset, &start_addr, &line_compare); s->get_offsets(s, &line_offset, &start_addr, &line_compare);
@ -1055,7 +1055,7 @@ static vga_draw_glyph9_func *vga_draw_glyph9_table[NB_DEPTHS] = {
vga_draw_glyph9_16, vga_draw_glyph9_16,
vga_draw_glyph9_16, vga_draw_glyph9_16,
}; };
static const uint8_t cursor_glyph[32 * 4] = { static const uint8_t cursor_glyph[32 * 4] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@ -1073,7 +1073,7 @@ static const uint8_t cursor_glyph[32 * 4] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
}; };
/* /*
* Text mode update * Text mode update
@ -1098,7 +1098,7 @@ static void vga_draw_text(VGAState *s, int full_update)
full_update |= update_palette16(s); full_update |= update_palette16(s);
palette = s->last_palette; palette = s->last_palette;
/* compute font data address (in plane 2) */ /* compute font data address (in plane 2) */
v = s->sr[3]; v = s->sr[3];
offset = (((v >> 4) & 1) | ((v << 1) & 6)) * 8192 * 4 + 2; offset = (((v >> 4) & 1) | ((v << 1) & 6)) * 8192 * 4 + 2;
@ -1174,14 +1174,14 @@ static void vga_draw_text(VGAState *s, int full_update)
s->cursor_end = s->cr[0xb]; s->cursor_end = s->cr[0xb];
} }
cursor_ptr = s->vram_ptr + (s->start_addr + cursor_offset) * 4; cursor_ptr = s->vram_ptr + (s->start_addr + cursor_offset) * 4;
depth_index = get_depth_index(s->ds); depth_index = get_depth_index(s->ds);
if (cw == 16) if (cw == 16)
vga_draw_glyph8 = vga_draw_glyph16_table[depth_index]; vga_draw_glyph8 = vga_draw_glyph16_table[depth_index];
else else
vga_draw_glyph8 = vga_draw_glyph8_table[depth_index]; vga_draw_glyph8 = vga_draw_glyph8_table[depth_index];
vga_draw_glyph9 = vga_draw_glyph9_table[depth_index]; vga_draw_glyph9 = vga_draw_glyph9_table[depth_index];
dest = s->ds->data; dest = s->ds->data;
linesize = s->ds->linesize; linesize = s->ds->linesize;
ch_attr_ptr = s->last_ch_attr; ch_attr_ptr = s->last_ch_attr;
@ -1379,7 +1379,7 @@ static int vga_get_bpp(VGAState *s)
static void vga_get_resolution(VGAState *s, int *pwidth, int *pheight) static void vga_get_resolution(VGAState *s, int *pwidth, int *pheight)
{ {
int width, height; int width, height;
#ifdef CONFIG_BOCHS_VBE #ifdef CONFIG_BOCHS_VBE
if (s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) { if (s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) {
width = s->vbe_regs[VBE_DISPI_INDEX_XRES]; width = s->vbe_regs[VBE_DISPI_INDEX_XRES];
@ -1420,7 +1420,7 @@ static void vga_draw_graphic(VGAState *s, int full_update)
uint8_t *d; uint8_t *d;
uint32_t v, addr1, addr; uint32_t v, addr1, addr;
vga_draw_line_func *vga_draw_line; vga_draw_line_func *vga_draw_line;
full_update |= update_basic_params(s); full_update |= update_basic_params(s);
s->get_resolution(s, &width, &height); s->get_resolution(s, &width, &height);
@ -1442,7 +1442,7 @@ static void vga_draw_graphic(VGAState *s, int full_update)
s->shift_control = shift_control; s->shift_control = shift_control;
s->double_scan = double_scan; s->double_scan = double_scan;
} }
if (shift_control == 0) { if (shift_control == 0) {
full_update |= update_palette16(s); full_update |= update_palette16(s);
if (s->sr[0x01] & 8) { if (s->sr[0x01] & 8) {
@ -1497,7 +1497,7 @@ static void vga_draw_graphic(VGAState *s, int full_update)
} }
if (s->cursor_invalidate) if (s->cursor_invalidate)
s->cursor_invalidate(s); s->cursor_invalidate(s);
line_offset = s->line_offset; line_offset = s->line_offset;
#if 0 #if 0
printf("w=%d h=%d v=%d line_offset=%d cr[0x09]=0x%02x cr[0x17]=0x%02x linecmp=%d sr[0x01]=0x%02x\n", printf("w=%d h=%d v=%d line_offset=%d cr[0x09]=0x%02x cr[0x17]=0x%02x linecmp=%d sr[0x01]=0x%02x\n",
@ -1616,7 +1616,7 @@ static void vga_update_display(void *opaque)
} else { } else {
s->rgb_to_pixel = s->rgb_to_pixel =
rgb_to_pixel_dup_table[get_depth_index(s->ds)]; rgb_to_pixel_dup_table[get_depth_index(s->ds)];
full_update = 0; full_update = 0;
if (!(s->ar_index & 0x20)) { if (!(s->ar_index & 0x20)) {
graphic_mode = GMODE_BLANK; graphic_mode = GMODE_BLANK;
@ -1646,7 +1646,7 @@ static void vga_update_display(void *opaque)
static void vga_invalidate_display(void *opaque) static void vga_invalidate_display(void *opaque)
{ {
VGAState *s = (VGAState *)opaque; VGAState *s = (VGAState *)opaque;
s->last_width = -1; s->last_width = -1;
s->last_height = -1; s->last_height = -1;
} }
@ -2009,21 +2009,21 @@ int pci_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
PCIVGAState *d; PCIVGAState *d;
VGAState *s; VGAState *s;
uint8_t *pci_conf; uint8_t *pci_conf;
d = (PCIVGAState *)pci_register_device(bus, "VGA", d = (PCIVGAState *)pci_register_device(bus, "VGA",
sizeof(PCIVGAState), sizeof(PCIVGAState),
-1, NULL, NULL); -1, NULL, NULL);
if (!d) if (!d)
return -1; return -1;
s = &d->vga_state; s = &d->vga_state;
vga_common_init(s, ds, vga_ram_base, vga_ram_offset, vga_ram_size); vga_common_init(s, ds, vga_ram_base, vga_ram_offset, vga_ram_size);
vga_init(s); vga_init(s);
graphic_console_init(s->ds, s->update, s->invalidate, s->screen_dump, s); graphic_console_init(s->ds, s->update, s->invalidate, s->screen_dump, s);
s->pci_dev = &d->dev; s->pci_dev = &d->dev;
pci_conf = d->dev.config; pci_conf = d->dev.config;
pci_conf[0x00] = 0x34; // dummy VGA (same as Bochs ID) pci_conf[0x00] = 0x34; // dummy VGA (same as Bochs ID)
pci_conf[0x01] = 0x12; pci_conf[0x01] = 0x12;
@ -2032,7 +2032,7 @@ int pci_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
pci_conf[0x0a] = 0x00; // VGA controller pci_conf[0x0a] = 0x00; // VGA controller
pci_conf[0x0b] = 0x03; pci_conf[0x0b] = 0x03;
pci_conf[0x0e] = 0x00; // header_type pci_conf[0x0e] = 0x00; // header_type
/* XXX: vga_ram_size must be a power of two */ /* XXX: vga_ram_size must be a power of two */
pci_register_io_region(&d->dev, 0, vga_ram_size, pci_register_io_region(&d->dev, 0, vga_ram_size,
PCI_ADDRESS_SPACE_MEM_PREFETCH, vga_map); PCI_ADDRESS_SPACE_MEM_PREFETCH, vga_map);
@ -2107,7 +2107,7 @@ static void vga_screen_dump(void *opaque, const char *filename)
{ {
VGAState *s = (VGAState *)opaque; VGAState *s = (VGAState *)opaque;
DisplayState *saved_ds, ds1, *ds = &ds1; DisplayState *saved_ds, ds1, *ds = &ds1;
/* XXX: this is a little hackish */ /* XXX: this is a little hackish */
vga_invalidate_display(s); vga_invalidate_display(s);
saved_ds = s->ds; saved_ds = s->ds;
@ -2121,7 +2121,7 @@ static void vga_screen_dump(void *opaque, const char *filename)
s->ds = ds; s->ds = ds;
s->graphic_mode = -1; s->graphic_mode = -1;
vga_update_display(s); vga_update_display(s);
if (ds->data) { if (ds->data) {
ppm_save(filename, ds->data, vga_save_w, vga_save_h, ppm_save(filename, ds->data, vga_save_w, vga_save_h,
s->ds->linesize); s->ds->linesize);

View File

@ -45,20 +45,20 @@
#define VBE_DISPI_INDEX_X_OFFSET 0x8 #define VBE_DISPI_INDEX_X_OFFSET 0x8
#define VBE_DISPI_INDEX_Y_OFFSET 0x9 #define VBE_DISPI_INDEX_Y_OFFSET 0x9
#define VBE_DISPI_INDEX_NB 0xa #define VBE_DISPI_INDEX_NB 0xa
#define VBE_DISPI_ID0 0xB0C0 #define VBE_DISPI_ID0 0xB0C0
#define VBE_DISPI_ID1 0xB0C1 #define VBE_DISPI_ID1 0xB0C1
#define VBE_DISPI_ID2 0xB0C2 #define VBE_DISPI_ID2 0xB0C2
#define VBE_DISPI_ID3 0xB0C3 #define VBE_DISPI_ID3 0xB0C3
#define VBE_DISPI_ID4 0xB0C4 #define VBE_DISPI_ID4 0xB0C4
#define VBE_DISPI_DISABLED 0x00 #define VBE_DISPI_DISABLED 0x00
#define VBE_DISPI_ENABLED 0x01 #define VBE_DISPI_ENABLED 0x01
#define VBE_DISPI_GETCAPS 0x02 #define VBE_DISPI_GETCAPS 0x02
#define VBE_DISPI_8BIT_DAC 0x20 #define VBE_DISPI_8BIT_DAC 0x20
#define VBE_DISPI_LFB_ENABLED 0x40 #define VBE_DISPI_LFB_ENABLED 0x40
#define VBE_DISPI_NOCLEARMEM 0x80 #define VBE_DISPI_NOCLEARMEM 0x80
#define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000 #define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
#ifdef CONFIG_BOCHS_VBE #ifdef CONFIG_BOCHS_VBE

View File

@ -73,7 +73,7 @@ static void glue(vga_draw_glyph8_, DEPTH)(uint8_t *d, int linesize,
uint32_t fgcol, uint32_t bgcol) uint32_t fgcol, uint32_t bgcol)
{ {
uint32_t font_data, xorcol; uint32_t font_data, xorcol;
xorcol = bgcol ^ fgcol; xorcol = bgcol ^ fgcol;
do { do {
font_data = font_ptr[0]; font_data = font_ptr[0];
@ -88,7 +88,7 @@ static void glue(vga_draw_glyph16_, DEPTH)(uint8_t *d, int linesize,
uint32_t fgcol, uint32_t bgcol) uint32_t fgcol, uint32_t bgcol)
{ {
uint32_t font_data, xorcol; uint32_t font_data, xorcol;
xorcol = bgcol ^ fgcol; xorcol = bgcol ^ fgcol;
do { do {
font_data = font_ptr[0]; font_data = font_ptr[0];
@ -108,7 +108,7 @@ static void glue(vga_draw_glyph9_, DEPTH)(uint8_t *d, int linesize,
uint32_t fgcol, uint32_t bgcol, int dup9) uint32_t fgcol, uint32_t bgcol, int dup9)
{ {
uint32_t font_data, xorcol, v; uint32_t font_data, xorcol, v;
xorcol = bgcol ^ fgcol; xorcol = bgcol ^ fgcol;
do { do {
font_data = font_ptr[0]; font_data = font_ptr[0];
@ -120,7 +120,7 @@ static void glue(vga_draw_glyph9_, DEPTH)(uint8_t *d, int linesize,
((uint8_t *)d)[8] = v >> (24 * (1 - BIG)); ((uint8_t *)d)[8] = v >> (24 * (1 - BIG));
else else
((uint8_t *)d)[8] = bgcol; ((uint8_t *)d)[8] = bgcol;
#elif BPP == 2 #elif BPP == 2
cpu_to_32wu(((uint32_t *)d)+0, (dmask4[(font_data >> 6)] & xorcol) ^ bgcol); cpu_to_32wu(((uint32_t *)d)+0, (dmask4[(font_data >> 6)] & xorcol) ^ bgcol);
cpu_to_32wu(((uint32_t *)d)+1, (dmask4[(font_data >> 4) & 3] & xorcol) ^ bgcol); cpu_to_32wu(((uint32_t *)d)+1, (dmask4[(font_data >> 4) & 3] & xorcol) ^ bgcol);
@ -433,7 +433,7 @@ static void glue(vga_draw_line15_, PIXEL_NAME)(VGAState *s1, uint8_t *d,
s += 2; s += 2;
d += BPP; d += BPP;
} while (--w != 0); } while (--w != 0);
#endif #endif
} }
/* /*
@ -458,7 +458,7 @@ static void glue(vga_draw_line16_, PIXEL_NAME)(VGAState *s1, uint8_t *d,
s += 2; s += 2;
d += BPP; d += BPP;
} while (--w != 0); } while (--w != 0);
#endif #endif
} }
/* /*

14
kqemu.c
View File

@ -286,7 +286,7 @@ static void kqemu_reset_modified_ram_pages(void)
{ {
int i; int i;
unsigned long page_index; unsigned long page_index;
for(i = 0; i < nb_modified_ram_pages; i++) { for(i = 0; i < nb_modified_ram_pages; i++) {
page_index = modified_ram_pages[i] >> TARGET_PAGE_BITS; page_index = modified_ram_pages[i] >> TARGET_PAGE_BITS;
modified_ram_pages_table[page_index] = 0; modified_ram_pages_table[page_index] = 0;
@ -364,7 +364,7 @@ static void restore_native_fp_frstor(CPUState *env)
{ {
int fptag, i, j; int fptag, i, j;
struct fpstate fp1, *fp = &fp1; struct fpstate fp1, *fp = &fp1;
fp->fpuc = env->fpuc; fp->fpuc = env->fpuc;
fp->fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11; fp->fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11;
fptag = 0; fptag = 0;
@ -470,7 +470,7 @@ static int do_syscall(CPUState *env,
struct kqemu_cpu_state *kenv) struct kqemu_cpu_state *kenv)
{ {
int selector; int selector;
selector = (env->star >> 32) & 0xffff; selector = (env->star >> 32) & 0xffff;
#ifdef __x86_64__ #ifdef __x86_64__
if (env->hflags & HF_LMA_MASK) { if (env->hflags & HF_LMA_MASK) {
@ -501,7 +501,7 @@ static int do_syscall(CPUState *env,
#endif #endif
{ {
env->regs[R_ECX] = (uint32_t)kenv->next_eip; env->regs[R_ECX] = (uint32_t)kenv->next_eip;
cpu_x86_set_cpl(env, 0); cpu_x86_set_cpl(env, 0);
cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc, cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc,
0, 0xffffffff, 0, 0xffffffff,
@ -605,7 +605,7 @@ void kqemu_record_dump(void)
} }
} }
qsort(pr, nb_pc_records, sizeof(PCRecord *), pc_rec_cmp); qsort(pr, nb_pc_records, sizeof(PCRecord *), pc_rec_cmp);
f = fopen("/tmp/kqemu.stats", "w"); f = fopen("/tmp/kqemu.stats", "w");
if (!f) { if (!f) {
perror("/tmp/kqemu.stats"); perror("/tmp/kqemu.stats");
@ -697,7 +697,7 @@ int kqemu_cpu_exec(CPUState *env)
kenv->nb_ram_pages_to_update = nb_ram_pages_to_update; kenv->nb_ram_pages_to_update = nb_ram_pages_to_update;
#endif #endif
nb_ram_pages_to_update = 0; nb_ram_pages_to_update = 0;
#if KQEMU_VERSION >= 0x010300 #if KQEMU_VERSION >= 0x010300
kenv->nb_modified_ram_pages = nb_modified_ram_pages; kenv->nb_modified_ram_pages = nb_modified_ram_pages;
#endif #endif
@ -828,7 +828,7 @@ int kqemu_cpu_exec(CPUState *env)
env->hflags |= HF_OSFXSR_MASK; env->hflags |= HF_OSFXSR_MASK;
else else
env->hflags &= ~HF_OSFXSR_MASK; env->hflags &= ~HF_OSFXSR_MASK;
#ifdef DEBUG #ifdef DEBUG
if (loglevel & CPU_LOG_INT) { if (loglevel & CPU_LOG_INT) {
fprintf(logfile, "kqemu: kqemu_cpu_exec: ret=0x%x\n", ret); fprintf(logfile, "kqemu: kqemu_cpu_exec: ret=0x%x\n", ret);

View File

@ -329,7 +329,7 @@
#define TARGET_NR_lremovexattr 392 #define TARGET_NR_lremovexattr 392
#define TARGET_NR_fremovexattr 393 #define TARGET_NR_fremovexattr 393
#define TARGET_NR_futex 394 #define TARGET_NR_futex 394
#define TARGET_NR_sched_setaffinity 395 #define TARGET_NR_sched_setaffinity 395
#define TARGET_NR_sched_getaffinity 396 #define TARGET_NR_sched_getaffinity 396
#define TARGET_NR_tuxcall 397 #define TARGET_NR_tuxcall 397
#define TARGET_NR_io_setup 398 #define TARGET_NR_io_setup 398

View File

@ -695,7 +695,7 @@ static unsigned long create_elf_tables(target_ulong p, int argc, int envc,
size *= n; size *= n;
if (size & 15) if (size & 15)
sp -= 16 - (size & 15); sp -= 16 - (size & 15);
#define NEW_AUX_ENT(id, val) do { \ #define NEW_AUX_ENT(id, val) do { \
sp -= n; tputl(sp, val); \ sp -= n; tputl(sp, val); \
sp -= n; tputl(sp, id); \ sp -= n; tputl(sp, id); \
@ -833,7 +833,7 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex,
elf_type, elf_type,
interpreter_fd, interpreter_fd,
eppnt->p_offset - TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr)); eppnt->p_offset - TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr));
if (error == -1) { if (error == -1) {
/* Real error */ /* Real error */
close(interpreter_fd); close(interpreter_fd);
@ -1199,10 +1199,10 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
int elf_prot = 0; int elf_prot = 0;
int elf_flags = 0; int elf_flags = 0;
unsigned long error; unsigned long error;
if (elf_ppnt->p_type != PT_LOAD) if (elf_ppnt->p_type != PT_LOAD)
continue; continue;
if (elf_ppnt->p_flags & PF_R) elf_prot |= PROT_READ; if (elf_ppnt->p_flags & PF_R) elf_prot |= PROT_READ;
if (elf_ppnt->p_flags & PF_W) elf_prot |= PROT_WRITE; if (elf_ppnt->p_flags & PF_W) elf_prot |= PROT_WRITE;
if (elf_ppnt->p_flags & PF_X) elf_prot |= PROT_EXEC; if (elf_ppnt->p_flags & PF_X) elf_prot |= PROT_EXEC;
@ -1224,7 +1224,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
} }
load_bias = TARGET_ELF_PAGESTART(error - elf_ppnt->p_vaddr); load_bias = TARGET_ELF_PAGESTART(error - elf_ppnt->p_vaddr);
} }
error = target_mmap(TARGET_ELF_PAGESTART(load_bias + elf_ppnt->p_vaddr), error = target_mmap(TARGET_ELF_PAGESTART(load_bias + elf_ppnt->p_vaddr),
(elf_ppnt->p_filesz + (elf_ppnt->p_filesz +
TARGET_ELF_PAGEOFFSET(elf_ppnt->p_vaddr)), TARGET_ELF_PAGEOFFSET(elf_ppnt->p_vaddr)),
@ -1242,7 +1242,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
if (TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr) < elf_stack) if (TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr) < elf_stack)
elf_stack = TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr); elf_stack = TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr);
#endif #endif
if (!load_addr_set) { if (!load_addr_set) {
load_addr_set = 1; load_addr_set = 1;
load_addr = elf_ppnt->p_vaddr - elf_ppnt->p_offset; load_addr = elf_ppnt->p_vaddr - elf_ppnt->p_offset;

View File

@ -38,7 +38,7 @@ struct flat_hdr {
target_ulong reloc_start; /* Offset of relocation records from target_ulong reloc_start; /* Offset of relocation records from
beginning of file */ beginning of file */
target_ulong reloc_count; /* Number of relocation records */ target_ulong reloc_count; /* Number of relocation records */
target_ulong flags; target_ulong flags;
target_ulong build_date; /* When the program/library was built */ target_ulong build_date; /* When the program/library was built */
target_ulong filler[5]; /* Reservered, set to zero */ target_ulong filler[5]; /* Reservered, set to zero */
}; };

View File

@ -376,7 +376,7 @@ void old_reloc(struct lib_info *libinfo, uint32_t rl)
break; break;
} }
DBG_FLT("Relocation became %x\n", (int)*ptr); DBG_FLT("Relocation became %x\n", (int)*ptr);
} }
/****************************************************************************/ /****************************************************************************/
@ -416,7 +416,7 @@ static int load_flat_file(struct linux_binprm * bprm,
rev, (int) FLAT_VERSION); rev, (int) FLAT_VERSION);
return -ENOEXEC; return -ENOEXEC;
} }
/* Don't allow old format executables to use shared libraries */ /* Don't allow old format executables to use shared libraries */
if (rev == OLD_FLAT_VERSION && id != 0) { if (rev == OLD_FLAT_VERSION && id != 0) {
fprintf(stderr, "BINFMT_FLAT: shared libraries are not available\n"); fprintf(stderr, "BINFMT_FLAT: shared libraries are not available\n");
@ -581,7 +581,7 @@ static int load_flat_file(struct linux_binprm * bprm,
libinfo[id].loaded = 1; libinfo[id].loaded = 1;
libinfo[id].entry = (0x00ffffff & ntohl(hdr->entry)) + textpos; libinfo[id].entry = (0x00ffffff & ntohl(hdr->entry)) + textpos;
libinfo[id].build_date = ntohl(hdr->build_date); libinfo[id].build_date = ntohl(hdr->build_date);
/* /*
* We just load the allocations into some temporary memory to * We just load the allocations into some temporary memory to
* help simplify all this mumbo jumbo * help simplify all this mumbo jumbo
@ -662,7 +662,7 @@ static int load_flat_file(struct linux_binprm * bprm,
old_reloc(&libinfo[0], relval); old_reloc(&libinfo[0], relval);
} }
} }
/* zero the BSS. */ /* zero the BSS. */
memset((void*)(datapos + data_len), 0, bss_len); memset((void*)(datapos + data_len), 0, bss_len);
@ -732,11 +732,11 @@ int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
stack_len += (bprm->argc + 1) * 4; /* the argv array */ stack_len += (bprm->argc + 1) * 4; /* the argv array */
stack_len += (bprm->envc + 1) * 4; /* the envp array */ stack_len += (bprm->envc + 1) * 4; /* the envp array */
res = load_flat_file(bprm, libinfo, 0, &stack_len); res = load_flat_file(bprm, libinfo, 0, &stack_len);
if (res > (unsigned long)-4096) if (res > (unsigned long)-4096)
return res; return res;
/* Update data segment pointers for all libraries */ /* Update data segment pointers for all libraries */
for (i=0; i<MAX_SHARED_LIBS; i++) { for (i=0; i<MAX_SHARED_LIBS; i++) {
if (libinfo[i].loaded) { if (libinfo[i].loaded) {
@ -767,7 +767,7 @@ int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
if ((sp + stack_len) & 15) if ((sp + stack_len) & 15)
sp -= 16 - ((sp + stack_len) & 15); sp -= 16 - ((sp + stack_len) & 15);
sp = loader_build_argptr(bprm->envc, bprm->argc, sp, p, 1); sp = loader_build_argptr(bprm->envc, bprm->argc, sp, p, 1);
/* Fake some return addresses to ensure the call chain will /* Fake some return addresses to ensure the call chain will
* initialise library in order for us. We are required to call * initialise library in order for us. We are required to call
* lib 1 first, then 2, ... and finally the main program (id 0). * lib 1 first, then 2, ... and finally the main program (id 0).
@ -784,7 +784,7 @@ int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
} }
} }
#endif #endif
/* Stash our initial stack pointer into the mm structure */ /* Stash our initial stack pointer into the mm structure */
info->start_code = libinfo[0].start_code; info->start_code = libinfo[0].start_code;
info->end_code = libinfo[0].start_code = libinfo[0].text_len; info->end_code = libinfo[0].start_code = libinfo[0].text_len;
@ -798,6 +798,6 @@ int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
DBG_FLT("start_thread(entry=0x%x, start_stack=0x%x)\n", DBG_FLT("start_thread(entry=0x%x, start_stack=0x%x)\n",
(int)info->entry, (int)info->start_stack); (int)info->entry, (int)info->start_stack);
return 0; return 0;
} }

View File

@ -182,7 +182,7 @@ int loader_exec(const char * filename, char ** argv, char ** envp,
return -1; return -1;
} }
} }
if(retval>=0) { if(retval>=0) {
/* success. Initialize important registers */ /* success. Initialize important registers */
do_init_thread(regs, infop); do_init_thread(regs, infop);

View File

@ -331,7 +331,7 @@ void cpu_loop(CPUARMState *env)
unsigned int n, insn; unsigned int n, insn;
target_siginfo_t info; target_siginfo_t info;
uint32_t addr; uint32_t addr;
for(;;) { for(;;) {
trapnr = cpu_arm_exec(env); trapnr = cpu_arm_exec(env);
switch(trapnr) { switch(trapnr) {
@ -343,7 +343,7 @@ void cpu_loop(CPUARMState *env)
/* we handle the FPU emulation here, as Linux */ /* we handle the FPU emulation here, as Linux */
/* we get the opcode */ /* we get the opcode */
opcode = tget32(env->regs[15]); opcode = tget32(env->regs[15]);
if (EmulateAll(opcode, &ts->fpa, env) == 0) { if (EmulateAll(opcode, &ts->fpa, env) == 0) {
info.si_signo = SIGILL; info.si_signo = SIGILL;
info.si_errno = 0; info.si_errno = 0;
@ -475,7 +475,7 @@ static inline void save_window_offset(CPUSPARCState *env, int cwp1)
{ {
unsigned int i; unsigned int i;
target_ulong sp_ptr; target_ulong sp_ptr;
sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)]; sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)];
#if defined(DEBUG_WIN) #if defined(DEBUG_WIN)
printf("win_overflow: sp_ptr=0x%x save_cwp=%d\n", printf("win_overflow: sp_ptr=0x%x save_cwp=%d\n",
@ -506,10 +506,10 @@ static void restore_window(CPUSPARCState *env)
{ {
unsigned int new_wim, i, cwp1; unsigned int new_wim, i, cwp1;
target_ulong sp_ptr; target_ulong sp_ptr;
new_wim = ((env->wim << 1) | (env->wim >> (NWINDOWS - 1))) & new_wim = ((env->wim << 1) | (env->wim >> (NWINDOWS - 1))) &
((1LL << NWINDOWS) - 1); ((1LL << NWINDOWS) - 1);
/* restore the invalid window */ /* restore the invalid window */
cwp1 = (env->cwp + 1) & (NWINDOWS - 1); cwp1 = (env->cwp + 1) & (NWINDOWS - 1);
sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)]; sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)];
@ -555,10 +555,10 @@ void cpu_loop (CPUSPARCState *env)
{ {
int trapnr, ret; int trapnr, ret;
target_siginfo_t info; target_siginfo_t info;
while (1) { while (1) {
trapnr = cpu_sparc_exec (env); trapnr = cpu_sparc_exec (env);
switch (trapnr) { switch (trapnr) {
#ifndef TARGET_SPARC64 #ifndef TARGET_SPARC64
case 0x88: case 0x88:
@ -670,17 +670,17 @@ static inline uint64_t cpu_ppc_get_tb (CPUState *env)
/* TO FIX */ /* TO FIX */
return 0; return 0;
} }
uint32_t cpu_ppc_load_tbl (CPUState *env) uint32_t cpu_ppc_load_tbl (CPUState *env)
{ {
return cpu_ppc_get_tb(env) & 0xFFFFFFFF; return cpu_ppc_get_tb(env) & 0xFFFFFFFF;
} }
uint32_t cpu_ppc_load_tbu (CPUState *env) uint32_t cpu_ppc_load_tbu (CPUState *env)
{ {
return cpu_ppc_get_tb(env) >> 32; return cpu_ppc_get_tb(env) >> 32;
} }
static void cpu_ppc_store_tb (CPUState *env, uint64_t value) static void cpu_ppc_store_tb (CPUState *env, uint64_t value)
{ {
/* TO FIX */ /* TO FIX */
@ -717,7 +717,7 @@ void cpu_loop(CPUPPCState *env)
target_siginfo_t info; target_siginfo_t info;
int trapnr; int trapnr;
uint32_t ret; uint32_t ret;
for(;;) { for(;;) {
trapnr = cpu_ppc_exec(env); trapnr = cpu_ppc_exec(env);
if (trapnr != EXCP_SYSCALL_USER && trapnr != EXCP_BRANCH && if (trapnr != EXCP_SYSCALL_USER && trapnr != EXCP_BRANCH &&
@ -1452,10 +1452,10 @@ void cpu_loop (CPUState *env)
{ {
int trapnr, ret; int trapnr, ret;
target_siginfo_t info; target_siginfo_t info;
while (1) { while (1) {
trapnr = cpu_sh4_exec (env); trapnr = cpu_sh4_exec (env);
switch (trapnr) { switch (trapnr) {
case 0x160: case 0x160:
ret = do_syscall(env, ret = do_syscall(env,
@ -1501,7 +1501,7 @@ void cpu_loop(CPUM68KState *env)
unsigned int n; unsigned int n;
target_siginfo_t info; target_siginfo_t info;
TaskState *ts = env->opaque; TaskState *ts = env->opaque;
for(;;) { for(;;) {
trapnr = cpu_m68k_exec(env); trapnr = cpu_m68k_exec(env);
switch(trapnr) { switch(trapnr) {
@ -1590,10 +1590,10 @@ void cpu_loop (CPUState *env)
{ {
int trapnr; int trapnr;
target_siginfo_t info; target_siginfo_t info;
while (1) { while (1) {
trapnr = cpu_alpha_exec (env); trapnr = cpu_alpha_exec (env);
switch (trapnr) { switch (trapnr) {
case EXCP_RESET: case EXCP_RESET:
fprintf(stderr, "Reset requested. Exit\n"); fprintf(stderr, "Reset requested. Exit\n");
@ -1745,7 +1745,7 @@ int main(int argc, char **argv)
if (optind >= argc) if (optind >= argc)
break; break;
r = argv[optind++]; r = argv[optind++];
mask = cpu_str_to_log_mask(r); mask = cpu_str_to_log_mask(r);
if (!mask) { if (!mask) {
@ -1821,7 +1821,7 @@ int main(int argc, char **argv)
qemu_host_page_size */ qemu_host_page_size */
env = cpu_init(); env = cpu_init();
global_env = env; global_env = env;
wrk = environ; wrk = environ;
while (*(wrk++)) while (*(wrk++))
environ_count++; environ_count++;
@ -1844,12 +1844,12 @@ int main(int argc, char **argv)
for (wrk = target_environ; *wrk; wrk++) { for (wrk = target_environ; *wrk; wrk++) {
free(*wrk); free(*wrk);
} }
free(target_environ); free(target_environ);
if (loglevel) { if (loglevel) {
page_dump(logfile); page_dump(logfile);
fprintf(logfile, "start_brk 0x%08lx\n" , info->start_brk); fprintf(logfile, "start_brk 0x%08lx\n" , info->start_brk);
fprintf(logfile, "end_code 0x%08lx\n" , info->end_code); fprintf(logfile, "end_code 0x%08lx\n" , info->end_code);
fprintf(logfile, "start_code 0x%08lx\n" , info->start_code); fprintf(logfile, "start_code 0x%08lx\n" , info->start_code);
@ -1870,7 +1870,7 @@ int main(int argc, char **argv)
ts->used = 1; ts->used = 1;
ts->info = info; ts->info = info;
env->user_mode_only = 1; env->user_mode_only = 1;
#if defined(TARGET_I386) #if defined(TARGET_I386)
cpu_x86_set_cpl(env, 3); cpu_x86_set_cpl(env, 3);
@ -1883,7 +1883,7 @@ int main(int argc, char **argv)
/* flags setup : we activate the IRQs by default as in user mode */ /* flags setup : we activate the IRQs by default as in user mode */
env->eflags |= IF_MASK; env->eflags |= IF_MASK;
/* linux register setup */ /* linux register setup */
#if defined(TARGET_X86_64) #if defined(TARGET_X86_64)
env->regs[R_EAX] = regs->rax; env->regs[R_EAX] = regs->rax;

View File

@ -52,7 +52,7 @@ int target_mprotect(target_ulong start, target_ulong len, int prot)
return -EINVAL; return -EINVAL;
if (len == 0) if (len == 0)
return 0; return 0;
host_start = start & qemu_host_page_mask; host_start = start & qemu_host_page_mask;
host_end = HOST_PAGE_ALIGN(end); host_end = HOST_PAGE_ALIGN(end);
if (start > host_start) { if (start > host_start) {
@ -83,7 +83,7 @@ int target_mprotect(target_ulong start, target_ulong len, int prot)
return ret; return ret;
host_end -= qemu_host_page_size; host_end -= qemu_host_page_size;
} }
/* handle the pages in the middle */ /* handle the pages in the middle */
if (host_start < host_end) { if (host_start < host_end) {
ret = mprotect(g2h(host_start), host_end - host_start, prot); ret = mprotect(g2h(host_start), host_end - host_start, prot);
@ -112,7 +112,7 @@ static int mmap_frag(target_ulong real_start,
if (addr < start || addr >= end) if (addr < start || addr >= end)
prot1 |= page_get_flags(addr); prot1 |= page_get_flags(addr);
} }
if (prot1 == 0) { if (prot1 == 0) {
/* no page was there, so we allocate one */ /* no page was there, so we allocate one */
ret = (long)mmap(host_start, qemu_host_page_size, prot, ret = (long)mmap(host_start, qemu_host_page_size, prot,
@ -134,10 +134,10 @@ static int mmap_frag(target_ulong real_start,
/* adjust protection to be able to read */ /* adjust protection to be able to read */
if (!(prot1 & PROT_WRITE)) if (!(prot1 & PROT_WRITE))
mprotect(host_start, qemu_host_page_size, prot1 | PROT_WRITE); mprotect(host_start, qemu_host_page_size, prot1 | PROT_WRITE);
/* read the corresponding file data */ /* read the corresponding file data */
pread(fd, g2h(start), end - start, offset); pread(fd, g2h(start), end - start, offset);
/* put final protection */ /* put final protection */
if (prot_new != (prot1 | PROT_WRITE)) if (prot_new != (prot1 | PROT_WRITE))
mprotect(host_start, qemu_host_page_size, prot_new); mprotect(host_start, qemu_host_page_size, prot_new);
@ -244,7 +244,7 @@ abort();
goto the_end1; goto the_end1;
} }
} }
if (start & ~TARGET_PAGE_MASK) { if (start & ~TARGET_PAGE_MASK) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
@ -303,7 +303,7 @@ abort();
return ret; return ret;
real_end -= qemu_host_page_size; real_end -= qemu_host_page_size;
} }
/* map the middle (easier) */ /* map the middle (easier) */
if (real_start < real_end) { if (real_start < real_end) {
unsigned long offset1; unsigned long offset1;
@ -367,7 +367,7 @@ int target_munmap(target_ulong start, target_ulong len)
if (prot != 0) if (prot != 0)
real_end -= qemu_host_page_size; real_end -= qemu_host_page_size;
} }
/* unmap what we can */ /* unmap what we can */
if (real_start < real_end) { if (real_start < real_end) {
ret = munmap((void *)real_start, real_end - real_start); ret = munmap((void *)real_start, real_end - real_start);
@ -410,7 +410,7 @@ int target_msync(target_ulong start, target_ulong len, int flags)
return -EINVAL; return -EINVAL;
if (end == start) if (end == start)
return 0; return 0;
start &= qemu_host_page_mask; start &= qemu_host_page_mask;
return msync(g2h(start), end - start, flags); return msync(g2h(start), end - start, flags);
} }

View File

@ -108,7 +108,7 @@ static void host_to_target_sigset_internal(target_sigset_t *d,
int i; int i;
unsigned long sigmask; unsigned long sigmask;
uint32_t target_sigmask; uint32_t target_sigmask;
sigmask = ((unsigned long *)s)[0]; sigmask = ((unsigned long *)s)[0];
target_sigmask = 0; target_sigmask = 0;
for(i = 0; i < 32; i++) { for(i = 0; i < 32; i++) {
@ -171,7 +171,7 @@ void target_to_host_sigset(sigset_t *d, const target_sigset_t *s)
s1.sig[i] = tswapl(s->sig[i]); s1.sig[i] = tswapl(s->sig[i]);
target_to_host_sigset_internal(d, &s1); target_to_host_sigset_internal(d, &s1);
} }
void host_to_target_old_sigset(target_ulong *old_sigset, void host_to_target_old_sigset(target_ulong *old_sigset,
const sigset_t *sigset) const sigset_t *sigset)
{ {
@ -274,7 +274,7 @@ void signal_init(void)
j = host_to_target_signal_table[i]; j = host_to_target_signal_table[i];
target_to_host_signal_table[j] = i; target_to_host_signal_table[j] = i;
} }
/* set all host signal handlers. ALL signals are blocked during /* set all host signal handlers. ALL signals are blocked during
the handlers to serialize them. */ the handlers to serialize them. */
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
@ -283,7 +283,7 @@ void signal_init(void)
for(i = 1; i < NSIG; i++) { for(i = 1; i < NSIG; i++) {
sigaction(i, &act, NULL); sigaction(i, &act, NULL);
} }
memset(sigact_table, 0, sizeof(sigact_table)); memset(sigact_table, 0, sizeof(sigact_table));
first_free = &sigqueue_table[0]; first_free = &sigqueue_table[0];
@ -865,7 +865,7 @@ long do_sigreturn(CPUX86State *env)
target_to_host_sigset_internal(&set, &target_set); target_to_host_sigset_internal(&set, &target_set);
sigprocmask(SIG_SETMASK, &set, NULL); sigprocmask(SIG_SETMASK, &set, NULL);
/* restore registers */ /* restore registers */
if (restore_sigcontext(env, &frame->sc, &eax)) if (restore_sigcontext(env, &frame->sc, &eax))
goto badframe; goto badframe;
@ -1933,7 +1933,7 @@ long do_sigreturn(CPUState *regs)
:"r" (&regs)); :"r" (&regs));
/* Unreached */ /* Unreached */
#endif #endif
regs->PC[regs->current_tc] = regs->CP0_EPC; regs->PC[regs->current_tc] = regs->CP0_EPC;
/* I am not sure this is right, but it seems to work /* I am not sure this is right, but it seems to work
* maybe a problem with nested signals ? */ * maybe a problem with nested signals ? */
@ -1995,7 +1995,7 @@ void process_pending_signals(void *cpu_env)
target_sigset_t target_old_set; target_sigset_t target_old_set;
struct emulated_sigaction *k; struct emulated_sigaction *k;
struct sigqueue *q; struct sigqueue *q;
if (!signal_pending) if (!signal_pending)
return; return;
@ -2018,7 +2018,7 @@ void process_pending_signals(void *cpu_env)
k->first = q->next; k->first = q->next;
if (!k->first) if (!k->first)
k->pending = 0; k->pending = 0;
sig = gdb_handlesig (cpu_env, sig); sig = gdb_handlesig (cpu_env, sig);
if (!sig) { if (!sig) {
fprintf (stderr, "Lost signal\n"); fprintf (stderr, "Lost signal\n");
@ -2044,7 +2044,7 @@ void process_pending_signals(void *cpu_env)
blocked during the handler */ blocked during the handler */
if (!(k->sa.sa_flags & TARGET_SA_NODEFER)) if (!(k->sa.sa_flags & TARGET_SA_NODEFER))
sigaddset(&set, target_to_host_signal(sig)); sigaddset(&set, target_to_host_signal(sig));
/* block signals in the handler using Linux */ /* block signals in the handler using Linux */
sigprocmask(SIG_BLOCK, &set, &old_set); sigprocmask(SIG_BLOCK, &set, &old_set);
/* save the previous blocked signal state to restore it at the /* save the previous blocked signal state to restore it at the

View File

@ -341,7 +341,7 @@ long do_brk(target_ulong new_brk)
return target_brk; return target_brk;
if (new_brk < target_original_brk) if (new_brk < target_original_brk)
return -ENOMEM; return -ENOMEM;
brk_page = HOST_PAGE_ALIGN(target_brk); brk_page = HOST_PAGE_ALIGN(target_brk);
/* If the new brk is less than this, set it and we're done... */ /* If the new brk is less than this, set it and we're done... */
@ -506,7 +506,7 @@ static long do_select(long n,
target_efds = NULL; target_efds = NULL;
efds_ptr = NULL; efds_ptr = NULL;
} }
if (target_tv) { if (target_tv) {
target_to_host_timeval(&tv, target_tv); target_to_host_timeval(&tv, target_tv);
tv_ptr = &tv; tv_ptr = &tv;
@ -652,13 +652,13 @@ static long do_setsockopt(int sockfd, int level, int optname,
target_ulong optval, socklen_t optlen) target_ulong optval, socklen_t optlen)
{ {
int val, ret; int val, ret;
switch(level) { switch(level) {
case SOL_TCP: case SOL_TCP:
/* TCP options all take an 'int' value. */ /* TCP options all take an 'int' value. */
if (optlen < sizeof(uint32_t)) if (optlen < sizeof(uint32_t))
return -EINVAL; return -EINVAL;
val = tget32(optval); val = tget32(optval);
ret = get_errno(setsockopt(sockfd, level, optname, &val, sizeof(val))); ret = get_errno(setsockopt(sockfd, level, optname, &val, sizeof(val)));
break; break;
@ -918,7 +918,7 @@ static long do_bind(int sockfd, target_ulong target_addr,
socklen_t addrlen) socklen_t addrlen)
{ {
void *addr = alloca(addrlen); void *addr = alloca(addrlen);
target_to_host_sockaddr(addr, target_addr, addrlen); target_to_host_sockaddr(addr, target_addr, addrlen);
return get_errno(bind(sockfd, addr, addrlen)); return get_errno(bind(sockfd, addr, addrlen));
} }
@ -927,7 +927,7 @@ static long do_connect(int sockfd, target_ulong target_addr,
socklen_t addrlen) socklen_t addrlen)
{ {
void *addr = alloca(addrlen); void *addr = alloca(addrlen);
target_to_host_sockaddr(addr, target_addr, addrlen); target_to_host_sockaddr(addr, target_addr, addrlen);
return get_errno(connect(sockfd, addr, addrlen)); return get_errno(connect(sockfd, addr, addrlen));
} }
@ -955,14 +955,14 @@ static long do_sendrecvmsg(int fd, target_ulong target_msg,
msg.msg_controllen = 2 * tswapl(msgp->msg_controllen); msg.msg_controllen = 2 * tswapl(msgp->msg_controllen);
msg.msg_control = alloca(msg.msg_controllen); msg.msg_control = alloca(msg.msg_controllen);
msg.msg_flags = tswap32(msgp->msg_flags); msg.msg_flags = tswap32(msgp->msg_flags);
count = tswapl(msgp->msg_iovlen); count = tswapl(msgp->msg_iovlen);
vec = alloca(count * sizeof(struct iovec)); vec = alloca(count * sizeof(struct iovec));
target_vec = tswapl(msgp->msg_iov); target_vec = tswapl(msgp->msg_iov);
lock_iovec(vec, target_vec, count, send); lock_iovec(vec, target_vec, count, send);
msg.msg_iovlen = count; msg.msg_iovlen = count;
msg.msg_iov = vec; msg.msg_iov = vec;
if (send) { if (send) {
target_to_host_cmsg(&msg, msgp); target_to_host_cmsg(&msg, msgp);
ret = get_errno(sendmsg(fd, &msg, flags)); ret = get_errno(sendmsg(fd, &msg, flags));
@ -1636,7 +1636,7 @@ static long do_ipc(long call, long first, long second, long third,
break; break;
raddr = ret; raddr = ret;
/* find out the length of the shared memory segment */ /* find out the length of the shared memory segment */
ret = get_errno(shmctl(first, IPC_STAT, &shm_info)); ret = get_errno(shmctl(first, IPC_STAT, &shm_info));
if (is_error(ret)) { if (is_error(ret)) {
/* can't get length, bail out */ /* can't get length, bail out */
@ -1910,7 +1910,7 @@ static void target_to_host_termios (void *dst, const void *src)
{ {
struct host_termios *host = dst; struct host_termios *host = dst;
const struct target_termios *target = src; const struct target_termios *target = src;
host->c_iflag = host->c_iflag =
target_to_host_bitmask(tswap32(target->c_iflag), iflag_tbl); target_to_host_bitmask(tswap32(target->c_iflag), iflag_tbl);
host->c_oflag = host->c_oflag =
@ -1920,26 +1920,26 @@ static void target_to_host_termios (void *dst, const void *src)
host->c_lflag = host->c_lflag =
target_to_host_bitmask(tswap32(target->c_lflag), lflag_tbl); target_to_host_bitmask(tswap32(target->c_lflag), lflag_tbl);
host->c_line = target->c_line; host->c_line = target->c_line;
host->c_cc[VINTR] = target->c_cc[TARGET_VINTR]; host->c_cc[VINTR] = target->c_cc[TARGET_VINTR];
host->c_cc[VQUIT] = target->c_cc[TARGET_VQUIT]; host->c_cc[VQUIT] = target->c_cc[TARGET_VQUIT];
host->c_cc[VERASE] = target->c_cc[TARGET_VERASE]; host->c_cc[VERASE] = target->c_cc[TARGET_VERASE];
host->c_cc[VKILL] = target->c_cc[TARGET_VKILL]; host->c_cc[VKILL] = target->c_cc[TARGET_VKILL];
host->c_cc[VEOF] = target->c_cc[TARGET_VEOF]; host->c_cc[VEOF] = target->c_cc[TARGET_VEOF];
host->c_cc[VTIME] = target->c_cc[TARGET_VTIME]; host->c_cc[VTIME] = target->c_cc[TARGET_VTIME];
host->c_cc[VMIN] = target->c_cc[TARGET_VMIN]; host->c_cc[VMIN] = target->c_cc[TARGET_VMIN];
host->c_cc[VSWTC] = target->c_cc[TARGET_VSWTC]; host->c_cc[VSWTC] = target->c_cc[TARGET_VSWTC];
host->c_cc[VSTART] = target->c_cc[TARGET_VSTART]; host->c_cc[VSTART] = target->c_cc[TARGET_VSTART];
host->c_cc[VSTOP] = target->c_cc[TARGET_VSTOP]; host->c_cc[VSTOP] = target->c_cc[TARGET_VSTOP];
host->c_cc[VSUSP] = target->c_cc[TARGET_VSUSP]; host->c_cc[VSUSP] = target->c_cc[TARGET_VSUSP];
host->c_cc[VEOL] = target->c_cc[TARGET_VEOL]; host->c_cc[VEOL] = target->c_cc[TARGET_VEOL];
host->c_cc[VREPRINT] = target->c_cc[TARGET_VREPRINT]; host->c_cc[VREPRINT] = target->c_cc[TARGET_VREPRINT];
host->c_cc[VDISCARD] = target->c_cc[TARGET_VDISCARD]; host->c_cc[VDISCARD] = target->c_cc[TARGET_VDISCARD];
host->c_cc[VWERASE] = target->c_cc[TARGET_VWERASE]; host->c_cc[VWERASE] = target->c_cc[TARGET_VWERASE];
host->c_cc[VLNEXT] = target->c_cc[TARGET_VLNEXT]; host->c_cc[VLNEXT] = target->c_cc[TARGET_VLNEXT];
host->c_cc[VEOL2] = target->c_cc[TARGET_VEOL2]; host->c_cc[VEOL2] = target->c_cc[TARGET_VEOL2];
} }
static void host_to_target_termios (void *dst, const void *src) static void host_to_target_termios (void *dst, const void *src)
{ {
struct target_termios *target = dst; struct target_termios *target = dst;
@ -1954,7 +1954,7 @@ static void host_to_target_termios (void *dst, const void *src)
target->c_lflag = target->c_lflag =
tswap32(host_to_target_bitmask(host->c_lflag, lflag_tbl)); tswap32(host_to_target_bitmask(host->c_lflag, lflag_tbl));
target->c_line = host->c_line; target->c_line = host->c_line;
target->c_cc[TARGET_VINTR] = host->c_cc[VINTR]; target->c_cc[TARGET_VINTR] = host->c_cc[VINTR];
target->c_cc[TARGET_VQUIT] = host->c_cc[VQUIT]; target->c_cc[TARGET_VQUIT] = host->c_cc[VQUIT];
target->c_cc[TARGET_VERASE] = host->c_cc[VERASE]; target->c_cc[TARGET_VERASE] = host->c_cc[VERASE];
@ -2052,7 +2052,7 @@ static int write_ldt(CPUX86State *env,
ldt_info.limit = tswap32(target_ldt_info->limit); ldt_info.limit = tswap32(target_ldt_info->limit);
ldt_info.flags = tswap32(target_ldt_info->flags); ldt_info.flags = tswap32(target_ldt_info->flags);
unlock_user_struct(target_ldt_info, ptr, 0); unlock_user_struct(target_ldt_info, ptr, 0);
if (ldt_info.entry_number >= TARGET_LDT_ENTRIES) if (ldt_info.entry_number >= TARGET_LDT_ENTRIES)
return -EINVAL; return -EINVAL;
seg_32bit = ldt_info.flags & 1; seg_32bit = ldt_info.flags & 1;
@ -2093,7 +2093,7 @@ static int write_ldt(CPUX86State *env,
goto install; goto install;
} }
} }
entry_1 = ((ldt_info.base_addr & 0x0000ffff) << 16) | entry_1 = ((ldt_info.base_addr & 0x0000ffff) << 16) |
(ldt_info.limit & 0x0ffff); (ldt_info.limit & 0x0ffff);
entry_2 = (ldt_info.base_addr & 0xff000000) | entry_2 = (ldt_info.base_addr & 0xff000000) |
@ -2120,7 +2120,7 @@ install:
int do_modify_ldt(CPUX86State *env, int func, target_ulong ptr, unsigned long bytecount) int do_modify_ldt(CPUX86State *env, int func, target_ulong ptr, unsigned long bytecount)
{ {
int ret = -ENOSYS; int ret = -ENOSYS;
switch (func) { switch (func) {
case 0: case 0:
ret = read_ldt(ptr, bytecount); ret = read_ldt(ptr, bytecount);
@ -2155,7 +2155,7 @@ int do_fork(CPUState *env, unsigned int flags, unsigned long newsp)
TaskState *ts; TaskState *ts;
uint8_t *new_stack; uint8_t *new_stack;
CPUState *new_env; CPUState *new_env;
if (flags & CLONE_VM) { if (flags & CLONE_VM) {
ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE); ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE);
memset(ts, 0, sizeof(TaskState)); memset(ts, 0, sizeof(TaskState));
@ -2263,7 +2263,7 @@ static long do_fcntl(int fd, int cmd, target_ulong arg)
unlock_user_struct(target_fl, arg, 1); unlock_user_struct(target_fl, arg, 1);
} }
break; break;
case TARGET_F_SETLK: case TARGET_F_SETLK:
case TARGET_F_SETLKW: case TARGET_F_SETLKW:
lock_user_struct(target_fl, arg, 1); lock_user_struct(target_fl, arg, 1);
@ -2275,7 +2275,7 @@ static long do_fcntl(int fd, int cmd, target_ulong arg)
unlock_user_struct(target_fl, arg, 0); unlock_user_struct(target_fl, arg, 0);
ret = fcntl(fd, cmd, &fl); ret = fcntl(fd, cmd, &fl);
break; break;
case TARGET_F_GETLK64: case TARGET_F_GETLK64:
lock_user_struct(target_fl64, arg, 1); lock_user_struct(target_fl64, arg, 1);
fl64.l_type = tswap16(target_fl64->l_type) >> 1; fl64.l_type = tswap16(target_fl64->l_type) >> 1;
@ -2468,7 +2468,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
struct stat st; struct stat st;
struct statfs stfs; struct statfs stfs;
void *p; void *p;
#ifdef DEBUG #ifdef DEBUG
gemu_log("syscall %d", num); gemu_log("syscall %d", num);
#endif #endif
@ -2980,7 +2980,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
{ {
int how = arg1; int how = arg1;
sigset_t set, oldset, *set_ptr; sigset_t set, oldset, *set_ptr;
if (arg2) { if (arg2) {
switch(how) { switch(how) {
case TARGET_SIG_BLOCK: case TARGET_SIG_BLOCK:
@ -3017,7 +3017,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
{ {
int how = arg1; int how = arg1;
sigset_t set, oldset, *set_ptr; sigset_t set, oldset, *set_ptr;
if (arg2) { if (arg2) {
switch(how) { switch(how) {
case TARGET_SIG_BLOCK: case TARGET_SIG_BLOCK:
@ -3098,7 +3098,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
sigset_t set; sigset_t set;
struct timespec uts, *puts; struct timespec uts, *puts;
siginfo_t uinfo; siginfo_t uinfo;
p = lock_user(arg1, sizeof(target_sigset_t), 1); p = lock_user(arg1, sizeof(target_sigset_t), 1);
target_to_host_sigset(&set, p); target_to_host_sigset(&set, p);
unlock_user(p, arg1, 0); unlock_user(p, arg1, 0);
@ -3159,7 +3159,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
int resource = arg1; int resource = arg1;
struct target_rlimit *target_rlim; struct target_rlimit *target_rlim;
struct rlimit rlim; struct rlimit rlim;
ret = get_errno(getrlimit(resource, &rlim)); ret = get_errno(getrlimit(resource, &rlim));
if (!is_error(ret)) { if (!is_error(ret)) {
lock_user_struct(target_rlim, arg2, 0); lock_user_struct(target_rlim, arg2, 0);
@ -3357,7 +3357,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
convert_statfs: convert_statfs:
if (!is_error(ret)) { if (!is_error(ret)) {
struct target_statfs *target_stfs; struct target_statfs *target_stfs;
lock_user_struct(target_stfs, arg2, 0); lock_user_struct(target_stfs, arg2, 0);
/* ??? put_user is probably wrong. */ /* ??? put_user is probably wrong. */
put_user(stfs.f_type, &target_stfs->f_type); put_user(stfs.f_type, &target_stfs->f_type);
@ -3384,7 +3384,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
convert_statfs64: convert_statfs64:
if (!is_error(ret)) { if (!is_error(ret)) {
struct target_statfs64 *target_stfs; struct target_statfs64 *target_stfs;
lock_user_struct(target_stfs, arg3, 0); lock_user_struct(target_stfs, arg3, 0);
/* ??? put_user is probably wrong. */ /* ??? put_user is probably wrong. */
put_user(stfs.f_type, &target_stfs->f_type); put_user(stfs.f_type, &target_stfs->f_type);
@ -3530,7 +3530,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
case TARGET_NR_getitimer: case TARGET_NR_getitimer:
{ {
struct itimerval value; struct itimerval value;
ret = get_errno(getitimer(arg1, &value)); ret = get_errno(getitimer(arg1, &value));
if (!is_error(ret) && arg2) { if (!is_error(ret) && arg2) {
host_to_target_timeval(arg2, host_to_target_timeval(arg2,
@ -3699,7 +3699,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
/* no need to transcode because we use the linux syscall */ /* no need to transcode because we use the linux syscall */
{ {
struct new_utsname * buf; struct new_utsname * buf;
lock_user_struct(buf, arg1, 0); lock_user_struct(buf, arg1, 0);
ret = get_errno(sys_uname(buf)); ret = get_errno(sys_uname(buf));
if (!is_error(ret)) { if (!is_error(ret)) {
@ -3786,7 +3786,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
dirp = malloc(count); dirp = malloc(count);
if (!dirp) if (!dirp)
return -ENOMEM; return -ENOMEM;
ret = get_errno(sys_getdents(arg1, dirp, count)); ret = get_errno(sys_getdents(arg1, dirp, count));
if (!is_error(ret)) { if (!is_error(ret)) {
struct dirent *de; struct dirent *de;
@ -4354,7 +4354,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
uint32_t *target_grouplist; uint32_t *target_grouplist;
gid_t *grouplist; gid_t *grouplist;
int i; int i;
grouplist = alloca(gidsetsize * sizeof(gid_t)); grouplist = alloca(gidsetsize * sizeof(gid_t));
target_grouplist = lock_user(arg2, gidsetsize * 4, 1); target_grouplist = lock_user(arg2, gidsetsize * 4, 1);
for(i = 0;i < gidsetsize; i++) for(i = 0;i < gidsetsize; i++)

View File

@ -748,9 +748,9 @@ struct target_pollfd {
*/ */
#define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */
#define TARGET_CDROMSEEK 0x5316 /* seek msf address */ #define TARGET_CDROMSEEK 0x5316 /* seek msf address */
/* /*
* This ioctl is only used by the scsi-cd driver. * This ioctl is only used by the scsi-cd driver.
It is for playing audio in logical block addressing mode. It is for playing audio in logical block addressing mode.
*/ */
#define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */

View File

@ -28,7 +28,7 @@ STRUCT(ifmap,
STRUCT(sockaddr_ifreq, STRUCT(sockaddr_ifreq,
MK_ARRAY(TYPE_CHAR, IFNAMSIZ), MK_STRUCT(STRUCT_sockaddr)) MK_ARRAY(TYPE_CHAR, IFNAMSIZ), MK_STRUCT(STRUCT_sockaddr))
STRUCT(short_ifreq, STRUCT(short_ifreq,
MK_ARRAY(TYPE_CHAR, IFNAMSIZ), TYPE_SHORT) MK_ARRAY(TYPE_CHAR, IFNAMSIZ), TYPE_SHORT)

View File

@ -123,7 +123,7 @@ static inline void return_to_32bit(CPUX86State *env, int retval)
static inline int set_IF(CPUX86State *env) static inline int set_IF(CPUX86State *env)
{ {
TaskState *ts = env->opaque; TaskState *ts = env->opaque;
ts->v86flags |= VIF_MASK; ts->v86flags |= VIF_MASK;
if (ts->v86flags & VIP_MASK) { if (ts->v86flags & VIP_MASK) {
return_to_32bit(env, TARGET_VM86_STI); return_to_32bit(env, TARGET_VM86_STI);
@ -264,7 +264,7 @@ void handle_vm86_fault(CPUX86State *env)
csp = (uint8_t *)(env->segs[R_CS].selector << 4); csp = (uint8_t *)(env->segs[R_CS].selector << 4);
ip = env->eip & 0xffff; ip = env->eip & 0xffff;
pc = csp + ip; pc = csp + ip;
ssp = (uint8_t *)(env->segs[R_SS].selector << 4); ssp = (uint8_t *)(env->segs[R_SS].selector << 4);
sp = env->regs[R_ESP] & 0xffff; sp = env->regs[R_ESP] & 0xffff;
@ -362,12 +362,12 @@ void handle_vm86_fault(CPUX86State *env)
return; return;
} }
VM86_FAULT_RETURN; VM86_FAULT_RETURN;
case 0xfa: /* cli */ case 0xfa: /* cli */
env->eip = ip; env->eip = ip;
clear_IF(env); clear_IF(env);
VM86_FAULT_RETURN; VM86_FAULT_RETURN;
case 0xfb: /* sti */ case 0xfb: /* sti */
env->eip = ip; env->eip = ip;
if (set_IF(env)) if (set_IF(env))
@ -386,7 +386,7 @@ int do_vm86(CPUX86State *env, long subfunction, target_ulong vm86_addr)
TaskState *ts = env->opaque; TaskState *ts = env->opaque;
struct target_vm86plus_struct * target_v86; struct target_vm86plus_struct * target_v86;
int ret; int ret;
switch (subfunction) { switch (subfunction) {
case TARGET_VM86_REQUEST_IRQ: case TARGET_VM86_REQUEST_IRQ:
case TARGET_VM86_FREE_IRQ: case TARGET_VM86_FREE_IRQ:
@ -470,7 +470,7 @@ int do_vm86(CPUX86State *env, long subfunction, target_ulong vm86_addr)
memcpy(&ts->vm86plus.vm86plus.vm86dbg_intxxtab, memcpy(&ts->vm86plus.vm86plus.vm86dbg_intxxtab,
target_v86->vm86plus.vm86dbg_intxxtab, 32); target_v86->vm86plus.vm86dbg_intxxtab, 32);
unlock_user_struct(target_v86, vm86_addr, 0); unlock_user_struct(target_v86, vm86_addr, 0);
#ifdef DEBUG_VM86 #ifdef DEBUG_VM86
fprintf(logfile, "do_vm86: cs:ip=%04x:%04x\n", fprintf(logfile, "do_vm86: cs:ip=%04x:%04x\n",
env->segs[R_CS].selector, env->eip); env->segs[R_CS].selector, env->eip);

View File

@ -261,7 +261,7 @@ static void bswap_uboot_header(uboot_image_header_t *hdr)
/* Load a U-Boot image. */ /* Load a U-Boot image. */
int load_uboot(const char *filename, target_ulong *ep, int *is_linux) int load_uboot(const char *filename, target_ulong *ep, int *is_linux)
{ {
int fd; int fd;
int size; int size;
uboot_image_header_t h; uboot_image_header_t h;

View File

@ -2378,7 +2378,7 @@ const struct m68k_opcode m68k_opcodes[] =
{"eor", 4, one(0005174), one(0177777), "#wSs", m68000up }, {"eor", 4, one(0005174), one(0177777), "#wSs", m68000up },
{"eor", 4, one(0005100), one(0177700), "#w$s", m68000up }, {"eor", 4, one(0005100), one(0177700), "#w$s", m68000up },
{"eor", 2, one(0130500), one(0170700), "Dd$s", m68000up }, {"eor", 2, one(0130500), one(0170700), "Dd$s", m68000up },
{"exg", 2, one(0140500), one(0170770), "DdDs", m68000up }, {"exg", 2, one(0140500), one(0170770), "DdDs", m68000up },
{"exg", 2, one(0140510), one(0170770), "AdAs", m68000up }, {"exg", 2, one(0140510), one(0170770), "AdAs", m68000up },
{"exg", 2, one(0140610), one(0170770), "DdAs", m68000up }, {"exg", 2, one(0140610), one(0170770), "DdAs", m68000up },
@ -4011,13 +4011,13 @@ const struct m68k_opcode m68k_opcodes[] =
{"roxrl", 2, one(0160260), one(0170770), "DdDs", m68000up }, {"roxrl", 2, one(0160260), one(0170770), "DdDs", m68000up },
{"rtd", 4, one(0047164), one(0177777), "#w", m68010up }, {"rtd", 4, one(0047164), one(0177777), "#w", m68010up },
{"rte", 2, one(0047163), one(0177777), "", m68000up | mcfisa_a }, {"rte", 2, one(0047163), one(0177777), "", m68000up | mcfisa_a },
{"rtm", 2, one(0003300), one(0177760), "Rs", m68020 }, {"rtm", 2, one(0003300), one(0177760), "Rs", m68020 },
{"rtr", 2, one(0047167), one(0177777), "", m68000up }, {"rtr", 2, one(0047167), one(0177777), "", m68000up },
{"rts", 2, one(0047165), one(0177777), "", m68000up | mcfisa_a }, {"rts", 2, one(0047165), one(0177777), "", m68000up | mcfisa_a },
{"satsl", 2, one(0046200), one(0177770), "Ds", mcfisa_b }, {"satsl", 2, one(0046200), one(0177770), "Ds", mcfisa_b },
@ -4561,12 +4561,12 @@ floatformat_i387_ext_is_valid (const struct floatformat *fmt, const char *from)
zero can it be zero, and then it must be zero. */ zero can it be zero, and then it must be zero. */
unsigned long exponent, int_bit; unsigned long exponent, int_bit;
const unsigned char *ufrom = (const unsigned char *) from; const unsigned char *ufrom = (const unsigned char *) from;
exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize, exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
fmt->exp_start, fmt->exp_len); fmt->exp_start, fmt->exp_len);
int_bit = get_field (ufrom, fmt->byteorder, fmt->totalsize, int_bit = get_field (ufrom, fmt->byteorder, fmt->totalsize,
fmt->man_start, 1); fmt->man_start, 1);
if ((exponent == 0) != (int_bit == 0)) if ((exponent == 0) != (int_bit == 0))
return 0; return 0;
else else
@ -4699,7 +4699,7 @@ get_field (const unsigned char *data, enum floatformat_byteorders order,
} }
return result; return result;
} }
#ifndef min #ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b))
#endif #endif

View File

@ -392,7 +392,7 @@ struct mips_opcode
"l" 32 bit floating point constant in .lit4 "l" 32 bit floating point constant in .lit4
MDMX instruction operands (note that while these use the FP register MDMX instruction operands (note that while these use the FP register
fields, they accept both $fN and $vN names for the registers): fields, they accept both $fN and $vN names for the registers):
"O" MDMX alignment offset (OP_*_ALN) "O" MDMX alignment offset (OP_*_ALN)
"Q" MDMX vector/scalar/immediate source (OP_*_VSEL and OP_*_FT) "Q" MDMX vector/scalar/immediate source (OP_*_VSEL and OP_*_FT)
"X" MDMX destination register (OP_*_FD) "X" MDMX destination register (OP_*_FD)

View File

@ -333,7 +333,7 @@ static void do_info_history (void)
{ {
int i; int i;
const char *str; const char *str;
i = 0; i = 0;
for(;;) { for(;;) {
str = readline_get_history(i); str = readline_get_history(i);
@ -442,7 +442,7 @@ static void do_logfile(const char *filename)
static void do_log(const char *items) static void do_log(const char *items)
{ {
int mask; int mask;
if (!strcmp(items, "none")) { if (!strcmp(items, "none")) {
mask = 0; mask = 0;
} else { } else {
@ -744,7 +744,7 @@ typedef struct {
static const KeyDef key_defs[] = { static const KeyDef key_defs[] = {
{ 0x2a, "shift" }, { 0x2a, "shift" },
{ 0x36, "shift_r" }, { 0x36, "shift_r" },
{ 0x38, "alt" }, { 0x38, "alt" },
{ 0xb8, "alt_r" }, { 0xb8, "alt_r" },
{ 0x1d, "ctrl" }, { 0x1d, "ctrl" },
@ -799,7 +799,7 @@ static const KeyDef key_defs[] = {
{ 0x30, "b" }, { 0x30, "b" },
{ 0x31, "n" }, { 0x31, "n" },
{ 0x32, "m" }, { 0x32, "m" },
{ 0x39, "spc" }, { 0x39, "spc" },
{ 0x3a, "caps_lock" }, { 0x3a, "caps_lock" },
{ 0x3b, "f1" }, { 0x3b, "f1" },
@ -832,7 +832,7 @@ static const KeyDef key_defs[] = {
{ 0x47, "kp_7" }, { 0x47, "kp_7" },
{ 0x48, "kp_8" }, { 0x48, "kp_8" },
{ 0x49, "kp_9" }, { 0x49, "kp_9" },
{ 0x56, "<" }, { 0x56, "<" },
{ 0x57, "f11" }, { 0x57, "f11" },
@ -879,7 +879,7 @@ static void do_send_key(const char *string)
uint8_t keycodes[16]; uint8_t keycodes[16];
const char *p; const char *p;
int nb_keycodes, keycode, i; int nb_keycodes, keycode, i;
nb_keycodes = 0; nb_keycodes = 0;
p = string; p = string;
while (*p != '\0') { while (*p != '\0') {
@ -1769,7 +1769,7 @@ static target_long expr_unary(void)
case '$': case '$':
{ {
char buf[128], *q; char buf[128], *q;
pch++; pch++;
q = buf; q = buf;
while ((*pch >= 'a' && *pch <= 'z') || while ((*pch >= 'a' && *pch <= 'z') ||
@ -1816,7 +1816,7 @@ static target_long expr_prod(void)
{ {
target_long val, val2; target_long val, val2;
int op; int op;
val = expr_unary(); val = expr_unary();
for(;;) { for(;;) {
op = *pch; op = *pch;
@ -1989,7 +1989,7 @@ static void monitor_handle_command(const char *cmdline)
#ifdef DEBUG #ifdef DEBUG
term_printf("command='%s'\n", cmdline); term_printf("command='%s'\n", cmdline);
#endif #endif
/* extract the command name */ /* extract the command name */
p = cmdline; p = cmdline;
q = cmdname; q = cmdname;
@ -2005,7 +2005,7 @@ static void monitor_handle_command(const char *cmdline)
len = sizeof(cmdname) - 1; len = sizeof(cmdname) - 1;
memcpy(cmdname, pstart, len); memcpy(cmdname, pstart, len);
cmdname[len] = '\0'; cmdname[len] = '\0';
/* find the command */ /* find the command */
for(cmd = term_cmds; cmd->name != NULL; cmd++) { for(cmd = term_cmds; cmd->name != NULL; cmd++) {
if (compare_cmd(cmdname, cmd->name)) if (compare_cmd(cmdname, cmd->name))
@ -2017,7 +2017,7 @@ static void monitor_handle_command(const char *cmdline)
for(i = 0; i < MAX_ARGS; i++) for(i = 0; i < MAX_ARGS; i++)
str_allocated[i] = NULL; str_allocated[i] = NULL;
/* parse the parameters */ /* parse the parameters */
typestr = cmd->args_type; typestr = cmd->args_type;
nb_args = 0; nb_args = 0;
@ -2033,7 +2033,7 @@ static void monitor_handle_command(const char *cmdline)
{ {
int ret; int ret;
char *str; char *str;
while (isspace(*p)) while (isspace(*p))
p++; p++;
if (*typestr == '?') { if (*typestr == '?') {
@ -2074,7 +2074,7 @@ static void monitor_handle_command(const char *cmdline)
case '/': case '/':
{ {
int count, format, size; int count, format, size;
while (isspace(*p)) while (isspace(*p))
p++; p++;
if (*p == '/') { if (*p == '/') {
@ -2207,7 +2207,7 @@ static void monitor_handle_command(const char *cmdline)
{ {
int has_option; int has_option;
/* option */ /* option */
c = *typestr++; c = *typestr++;
if (c == '\0') if (c == '\0')
goto bad_type; goto bad_type;

View File

@ -757,7 +757,7 @@ Change gdb connection port. @var{port} can be either a decimal number
to specify a TCP port, or a host device (same devices as the serial port). to specify a TCP port, or a host device (same devices as the serial port).
@item -S @item -S
Do not start CPU at startup (you must type 'c' in the monitor). Do not start CPU at startup (you must type 'c' in the monitor).
@item -d @item -d
Output log in /tmp/qemu.log Output log in /tmp/qemu.log
@item -hdachs c,h,s,[,t] @item -hdachs c,h,s,[,t]
Force hard disk 0 physical geometry (1 <= @var{c} <= 16383, 1 <= Force hard disk 0 physical geometry (1 <= @var{c} <= 16383, 1 <=
@ -832,9 +832,9 @@ During emulation, if you are using the @option{-nographic} option, use
@table @key @table @key
@item Ctrl-a h @item Ctrl-a h
Print this help Print this help
@item Ctrl-a x @item Ctrl-a x
Exit emulator Exit emulator
@item Ctrl-a s @item Ctrl-a s
Save disk data back to file (if -snapshot) Save disk data back to file (if -snapshot)
@item Ctrl-a t @item Ctrl-a t
toggle console timestamps toggle console timestamps
@ -889,7 +889,7 @@ The following commands are available:
@item help or ? [cmd] @item help or ? [cmd]
Show the help for all commands or just for command @var{cmd}. Show the help for all commands or just for command @var{cmd}.
@item commit @item commit
Commit changes to the disk images (if -snapshot is used) Commit changes to the disk images (if -snapshot is used)
@item info subcommand @item info subcommand
@ -1363,7 +1363,7 @@ network). The virtual network configuration is the following:
| (10.0.2.2) | (10.0.2.2)
| |
----> DNS server (10.0.2.3) ----> DNS server (10.0.2.3)
| |
----> SMB server (10.0.2.4) ----> SMB server (10.0.2.4)
@end example @end example
@ -1925,7 +1925,7 @@ The following options are specific to the PowerPC emulation:
@table @option @table @option
@item -g WxH[xDEPTH] @item -g WxH[xDEPTH]
Set the initial VGA graphic mode. The default is 800x600x15. Set the initial VGA graphic mode. The default is 800x600x15.
@ -2339,7 +2339,7 @@ usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
@table @option @table @option
@item -h @item -h
Print the help Print the help
@item -L path @item -L path
Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386) Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
@item -s size @item -s size
Set the x86 stack size in bytes (default=524288) Set the x86 stack size in bytes (default=524288)
@ -2437,7 +2437,7 @@ usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
@table @option @table @option
@item -h @item -h
Print the help Print the help
@item -L path @item -L path
Set the library root path (default=/) Set the library root path (default=/)
@item -s size @item -s size
Set the stack size in bytes (default=524288) Set the stack size in bytes (default=524288)

View File

@ -168,7 +168,7 @@ static void term_init(void)
tty.c_cflag |= CS8; tty.c_cflag |= CS8;
tty.c_cc[VMIN] = 1; tty.c_cc[VMIN] = 1;
tty.c_cc[VTIME] = 0; tty.c_cc[VTIME] = 0;
tcsetattr (0, TCSANOW, &tty); tcsetattr (0, TCSANOW, &tty);
atexit(term_exit); atexit(term_exit);
@ -250,7 +250,7 @@ static int img_create(int argc, char **argv)
int64_t size; int64_t size;
const char *p; const char *p;
BlockDriver *drv; BlockDriver *drv;
flags = 0; flags = 0;
for(;;) { for(;;) {
c = getopt(argc, argv, "b:f:he6"); c = getopt(argc, argv, "b:f:he6");
@ -461,7 +461,7 @@ static int img_convert(int argc, char **argv)
if (optind >= argc) if (optind >= argc)
help(); help();
out_filename = argv[optind++]; out_filename = argv[optind++];
bs = bdrv_new_open(filename, fmt); bs = bdrv_new_open(filename, fmt);
drv = bdrv_find_format(out_fmt); drv = bdrv_find_format(out_fmt);
@ -484,7 +484,7 @@ static int img_convert(int argc, char **argv)
error("Error while formatting '%s'", out_filename); error("Error while formatting '%s'", out_filename);
} }
} }
out_bs = bdrv_new_open(out_filename, out_fmt); out_bs = bdrv_new_open(out_filename, out_fmt);
if (flags && BLOCK_FLAG_COMPRESS) { if (flags && BLOCK_FLAG_COMPRESS) {

View File

@ -304,7 +304,7 @@ static void term_completion(void)
char *cmdline; char *cmdline;
nb_completions = 0; nb_completions = 0;
cmdline = qemu_malloc(term_cmd_buf_index + 1); cmdline = qemu_malloc(term_cmd_buf_index + 1);
if (!cmdline) if (!cmdline)
return; return;

View File

@ -569,7 +569,7 @@ const struct s390_operand s390_operands[] =
quite close. quite close.
For example the instruction "mvo" is defined in the PoP as follows: For example the instruction "mvo" is defined in the PoP as follows:
MVO D1(L1,B1),D2(L2,B2) [SS] MVO D1(L1,B1),D2(L2,B2) [SS]
-------------------------------------- --------------------------------------

Some files were not shown because too many files have changed in this diff Show More