mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
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:
parent
ef18c8839e
commit
3b46e62427
10
Changelog
10
Changelog
@ -86,7 +86,7 @@ version 0.8.0:
|
||||
(Johannes Schindelin)
|
||||
|
||||
version 0.7.2:
|
||||
|
||||
|
||||
- x86_64 fixes (Win2000 and Linux 2.6 boot in 32 bit)
|
||||
- merge self modifying code handling in dirty ram page mecanism.
|
||||
- MIPS fixes (Ralf Baechle)
|
||||
@ -201,7 +201,7 @@ version 0.5.5:
|
||||
- FDC fixes for Win98
|
||||
|
||||
version 0.5.4:
|
||||
|
||||
|
||||
- qemu-fast fixes
|
||||
- BIOS area protection fix (aka EMM386.EXE fix) (Mike Nordell)
|
||||
- keyboard/mouse fix (Mike Nordell)
|
||||
@ -266,7 +266,7 @@ version 0.5.2:
|
||||
- eflags optimisation fix for string operations
|
||||
|
||||
version 0.5.1:
|
||||
|
||||
|
||||
- float access fixes when using soft mmu
|
||||
- PC emulation support on PowerPC
|
||||
- A20 support
|
||||
@ -281,7 +281,7 @@ version 0.5.1:
|
||||
- Major SPARC target fixes (dynamically linked programs begin to work)
|
||||
|
||||
version 0.5.0:
|
||||
|
||||
|
||||
- full hardware level VGA emulation
|
||||
- graphical display with SDL
|
||||
- added PS/2 mouse and keyboard emulation
|
||||
@ -319,7 +319,7 @@ version 0.4.2:
|
||||
- SMP kernels can at least be booted
|
||||
|
||||
version 0.4.1:
|
||||
|
||||
|
||||
- more accurate timer support in vl.
|
||||
- more reliable NE2000 probe in vl.
|
||||
- added 2.5.66 kernel in vl-test.
|
||||
|
4
aes.c
4
aes.c
@ -1294,7 +1294,7 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
AES_encrypt(tmp, tmp, key);
|
||||
memcpy(out, tmp, AES_BLOCK_SIZE);
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (len >= 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)
|
||||
out[n] = tmp[n] ^ ivec[n];
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
128
arm-dis.c
128
arm-dis.c
@ -34,7 +34,7 @@ struct thumb_opcode
|
||||
};
|
||||
|
||||
/* format of the assembler string :
|
||||
|
||||
|
||||
%% %
|
||||
%<bitfield>d print the bitfield in decimal
|
||||
%<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"},
|
||||
{0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"},
|
||||
{0xf450f000, 0xfc70f000, "pld\t%a"},
|
||||
|
||||
|
||||
/* V5 Instructions. */
|
||||
{0xe1200070, 0xfff000f0, "bkpt\t0x%16-19X%12-15X%8-11X%0-3X"},
|
||||
{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}"},
|
||||
{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"},
|
||||
{0x000000f0, 0x0e1000f0, "str%cd\t%12-15r, %s"},
|
||||
{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;
|
||||
{
|
||||
func (stream, "%s", arm_regnames[given & 0xf]);
|
||||
|
||||
|
||||
if ((given & 0xff0) != 0)
|
||||
{
|
||||
if ((given & 0x10) == 0)
|
||||
{
|
||||
int amount = (given & 0xf80) >> 7;
|
||||
int shift = (given & 0x60) >> 5;
|
||||
|
||||
|
||||
if (amount == 0)
|
||||
{
|
||||
if (shift == 3)
|
||||
@ -636,10 +636,10 @@ arm_decode_shift (given, func, stream)
|
||||
func (stream, ", rrx");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
amount = 32;
|
||||
}
|
||||
|
||||
|
||||
func (stream, ", %s #%d", arm_shift[shift], amount);
|
||||
}
|
||||
else
|
||||
@ -666,7 +666,7 @@ print_insn_arm1 (pc, info, given)
|
||||
if ((given & insn->mask) == insn->value)
|
||||
{
|
||||
char * c;
|
||||
|
||||
|
||||
for (c = insn->assembler; *c; c++)
|
||||
{
|
||||
if (*c == '%')
|
||||
@ -682,14 +682,14 @@ print_insn_arm1 (pc, info, given)
|
||||
&& ((given & 0x02000000) == 0))
|
||||
{
|
||||
int offset = given & 0xfff;
|
||||
|
||||
|
||||
func (stream, "[pc");
|
||||
|
||||
if (given & 0x01000000)
|
||||
{
|
||||
if ((given & 0x00800000) == 0)
|
||||
offset = - offset;
|
||||
|
||||
|
||||
/* Pre-indexed. */
|
||||
func (stream, ", #%d]", offset);
|
||||
|
||||
@ -710,7 +710,7 @@ print_insn_arm1 (pc, info, given)
|
||||
/* ie ignore the offset. */
|
||||
offset = pc + 8;
|
||||
}
|
||||
|
||||
|
||||
func (stream, "\t; ");
|
||||
info->print_address_func (offset, info);
|
||||
}
|
||||
@ -767,12 +767,12 @@ print_insn_arm1 (pc, info, given)
|
||||
{
|
||||
/* PC relative with immediate offset. */
|
||||
int offset = ((given & 0xf00) >> 4) | (given & 0xf);
|
||||
|
||||
|
||||
if ((given & 0x00800000) == 0)
|
||||
offset = -offset;
|
||||
|
||||
|
||||
func (stream, "[pc, #%d]\t; ", offset);
|
||||
|
||||
|
||||
(*info->print_address_func)
|
||||
(offset + pc + 8, info);
|
||||
}
|
||||
@ -829,7 +829,7 @@ print_insn_arm1 (pc, info, given)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'b':
|
||||
(*info->print_address_func)
|
||||
(BDISP (given) * 4 + pc + 8, info);
|
||||
@ -911,7 +911,7 @@ print_insn_arm1 (pc, info, given)
|
||||
{
|
||||
bfd_vma address;
|
||||
bfd_vma offset = 0;
|
||||
|
||||
|
||||
if (given & 0x00800000)
|
||||
/* Is signed, hi bits should be ones. */
|
||||
offset = (-1) ^ 0x00ffffff;
|
||||
@ -920,7 +920,7 @@ print_insn_arm1 (pc, info, given)
|
||||
offset += given & 0x00ffffff;
|
||||
offset <<= 2;
|
||||
address = offset + pc + 8;
|
||||
|
||||
|
||||
if (given & 0x01000000)
|
||||
/* H bit allows addressing to 2-byte boundaries. */
|
||||
address += 2;
|
||||
@ -976,7 +976,7 @@ print_insn_arm1 (pc, info, given)
|
||||
func (stream, "3");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'P':
|
||||
switch (given & 0x00080080)
|
||||
{
|
||||
@ -1040,44 +1040,44 @@ print_insn_arm1 (pc, info, given)
|
||||
{
|
||||
case '-':
|
||||
c++;
|
||||
|
||||
|
||||
while (*c >= '0' && *c <= '9')
|
||||
bitend = (bitend * 10) + *c++ - '0';
|
||||
|
||||
|
||||
if (!bitend)
|
||||
abort ();
|
||||
|
||||
|
||||
switch (*c)
|
||||
{
|
||||
case 'r':
|
||||
{
|
||||
long reg;
|
||||
|
||||
|
||||
reg = given >> bitstart;
|
||||
reg &= (2 << (bitend - bitstart)) - 1;
|
||||
|
||||
|
||||
func (stream, "%s", arm_regnames[reg]);
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
{
|
||||
long reg;
|
||||
|
||||
|
||||
reg = given >> bitstart;
|
||||
reg &= (2 << (bitend - bitstart)) - 1;
|
||||
|
||||
|
||||
func (stream, "%d", reg);
|
||||
}
|
||||
break;
|
||||
case 'x':
|
||||
{
|
||||
long reg;
|
||||
|
||||
|
||||
reg = given >> bitstart;
|
||||
reg &= (2 << (bitend - bitstart)) - 1;
|
||||
|
||||
|
||||
func (stream, "0x%08x", reg);
|
||||
|
||||
|
||||
/* Some SWI instructions have special
|
||||
meanings. */
|
||||
if ((given & 0x0fffffff) == 0x0FF00000)
|
||||
@ -1089,20 +1089,20 @@ print_insn_arm1 (pc, info, given)
|
||||
case 'X':
|
||||
{
|
||||
long reg;
|
||||
|
||||
|
||||
reg = given >> bitstart;
|
||||
reg &= (2 << (bitend - bitstart)) - 1;
|
||||
|
||||
|
||||
func (stream, "%01x", reg & 0xf);
|
||||
}
|
||||
break;
|
||||
case 'f':
|
||||
{
|
||||
long reg;
|
||||
|
||||
|
||||
reg = given >> bitstart;
|
||||
reg &= (2 << (bitend - bitstart)) - 1;
|
||||
|
||||
|
||||
if (reg > 7)
|
||||
func (stream, "#%s",
|
||||
arm_fp_const[reg & 7]);
|
||||
@ -1163,7 +1163,7 @@ print_insn_arm1 (pc, info, given)
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
@ -1252,7 +1252,7 @@ print_insn_thumb (pc, info, given)
|
||||
if (!*c) /* Check for empty (not NULL) assembler string. */
|
||||
{
|
||||
long offset;
|
||||
|
||||
|
||||
info->bytes_per_chunk = 4;
|
||||
info->bytes_per_line = 4;
|
||||
|
||||
@ -1274,16 +1274,16 @@ print_insn_thumb (pc, info, given)
|
||||
{
|
||||
info->bytes_per_chunk = 2;
|
||||
info->bytes_per_line = 4;
|
||||
|
||||
|
||||
given &= 0xffff;
|
||||
|
||||
|
||||
for (; *c; c++)
|
||||
{
|
||||
if (*c == '%')
|
||||
{
|
||||
int domaskpc = 0;
|
||||
int domasklr = 0;
|
||||
|
||||
|
||||
switch (*++c)
|
||||
{
|
||||
case '%':
|
||||
@ -1293,11 +1293,11 @@ print_insn_thumb (pc, info, given)
|
||||
case 'S':
|
||||
{
|
||||
long reg;
|
||||
|
||||
|
||||
reg = (given >> 3) & 0x7;
|
||||
if (given & (1 << 6))
|
||||
reg += 8;
|
||||
|
||||
|
||||
func (stream, "%s", arm_regnames[reg]);
|
||||
}
|
||||
break;
|
||||
@ -1305,11 +1305,11 @@ print_insn_thumb (pc, info, given)
|
||||
case 'D':
|
||||
{
|
||||
long reg;
|
||||
|
||||
|
||||
reg = given & 0x7;
|
||||
if (given & (1 << 7))
|
||||
reg += 8;
|
||||
|
||||
|
||||
func (stream, "%s", arm_regnames[reg]);
|
||||
}
|
||||
break;
|
||||
@ -1331,9 +1331,9 @@ print_insn_thumb (pc, info, given)
|
||||
{
|
||||
int started = 0;
|
||||
int reg;
|
||||
|
||||
|
||||
func (stream, "{");
|
||||
|
||||
|
||||
/* It would be nice if we could spot
|
||||
ranges, and generate the rS-rE format: */
|
||||
for (reg = 0; (reg < 8); reg++)
|
||||
@ -1370,7 +1370,7 @@ print_insn_thumb (pc, info, given)
|
||||
{
|
||||
int bitstart = *c++ - '0';
|
||||
int bitend = 0;
|
||||
|
||||
|
||||
while (*c >= '0' && *c <= '9')
|
||||
bitstart = (bitstart * 10) + *c++ - '0';
|
||||
|
||||
@ -1379,7 +1379,7 @@ print_insn_thumb (pc, info, given)
|
||||
case '-':
|
||||
{
|
||||
long reg;
|
||||
|
||||
|
||||
c++;
|
||||
while (*c >= '0' && *c <= '9')
|
||||
bitend = (bitend * 10) + *c++ - '0';
|
||||
@ -1478,7 +1478,7 @@ parse_arm_disassembler_option (option)
|
||||
{
|
||||
if (option == NULL)
|
||||
return;
|
||||
|
||||
|
||||
if (strneq (option, "reg-names-", 10))
|
||||
{
|
||||
int i;
|
||||
@ -1491,7 +1491,7 @@ parse_arm_disassembler_option (option)
|
||||
regname_selected = i;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (i < 0)
|
||||
fprintf (stderr, _("Unrecognised register name set: %s\n"), option);
|
||||
}
|
||||
@ -1501,7 +1501,7 @@ parse_arm_disassembler_option (option)
|
||||
force_thumb = 0;
|
||||
else
|
||||
fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1512,7 +1512,7 @@ parse_disassembler_options (options)
|
||||
char * options;
|
||||
{
|
||||
char * space;
|
||||
|
||||
|
||||
if (options == NULL)
|
||||
return;
|
||||
|
||||
@ -1550,25 +1550,25 @@ print_insn_arm (pc, info)
|
||||
if (info->disassembler_options)
|
||||
{
|
||||
parse_disassembler_options (info->disassembler_options);
|
||||
|
||||
|
||||
/* To avoid repeated parsing of these options, we remove them here. */
|
||||
info->disassembler_options = NULL;
|
||||
}
|
||||
|
||||
|
||||
is_thumb = force_thumb;
|
||||
if (pc & 1)
|
||||
{
|
||||
is_thumb = 1;
|
||||
pc &= ~(bfd_vma) 1;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
if (!is_thumb && info->symbols != NULL)
|
||||
{
|
||||
if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
|
||||
{
|
||||
coff_symbol_type * cs;
|
||||
|
||||
|
||||
cs = coffsymbol (*info->symbols);
|
||||
is_thumb = ( cs->native->u.syment.n_sclass == C_THUMBEXT
|
||||
|| cs->native->u.syment.n_sclass == C_THUMBSTAT
|
||||
@ -1580,15 +1580,15 @@ print_insn_arm (pc, info)
|
||||
{
|
||||
elf_symbol_type * es;
|
||||
unsigned int type;
|
||||
|
||||
|
||||
es = *(elf_symbol_type **)(info->symbols);
|
||||
type = ELF_ST_TYPE (es->internal_elf_sym.st_info);
|
||||
|
||||
|
||||
is_thumb = (type == STT_ARM_TFUNC) || (type == STT_ARM_16BIT);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
little = (info->endian == BFD_ENDIAN_LITTLE);
|
||||
info->bytes_per_chunk = 4;
|
||||
info->display_endian = little ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
|
||||
@ -1599,17 +1599,17 @@ print_insn_arm (pc, info)
|
||||
if (status != 0 && is_thumb)
|
||||
{
|
||||
info->bytes_per_chunk = 2;
|
||||
|
||||
|
||||
status = info->read_memory_func (pc, (bfd_byte *) b, 2, info);
|
||||
b[3] = b[2] = 0;
|
||||
}
|
||||
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
info->memory_error_func (status, pc, info);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24);
|
||||
}
|
||||
else
|
||||
@ -1621,13 +1621,13 @@ print_insn_arm (pc, info)
|
||||
info->memory_error_func (status, pc, info);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (is_thumb)
|
||||
{
|
||||
if (pc & 0x2)
|
||||
{
|
||||
given = (b[2] << 8) | b[3];
|
||||
|
||||
|
||||
status = info->read_memory_func
|
||||
((pc + 4) & ~ 0x3, (bfd_byte *) b, 4, info);
|
||||
if (status != 0)
|
||||
@ -1635,7 +1635,7 @@ print_insn_arm (pc, info)
|
||||
info->memory_error_func (status, pc + 4, info);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
given |= (b[0] << 24) | (b[1] << 16);
|
||||
}
|
||||
else
|
||||
@ -1644,7 +1644,7 @@ print_insn_arm (pc, info)
|
||||
else
|
||||
given = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
|
||||
}
|
||||
|
||||
|
||||
if (info->flags & INSN_HAS_RELOC)
|
||||
/* If the instruction has a reloc associated with it, then
|
||||
the offset field in the instruction will actually be the
|
||||
@ -1668,7 +1668,7 @@ print_arm_disassembler_options (FILE * stream)
|
||||
fprintf (stream, _("\n\
|
||||
The following ARM specific disassembler options are supported for use with\n\
|
||||
the -M switch:\n"));
|
||||
|
||||
|
||||
for (i = NUM_ARM_REGNAMES; i--;)
|
||||
fprintf (stream, " reg-names-%s %*c%s\n",
|
||||
regnames[i].name,
|
||||
|
@ -401,7 +401,7 @@ uint32_t do_arm_semihosting(CPUState *env)
|
||||
}
|
||||
ts->heap_limit = limit;
|
||||
}
|
||||
|
||||
|
||||
ptr = lock_user(ARG(0), 16, 0);
|
||||
ptr[0] = tswap32(ts->heap_base);
|
||||
ptr[1] = tswap32(ts->heap_limit);
|
||||
|
@ -44,7 +44,7 @@ struct bochs_header_v1 {
|
||||
char subtype[16]; // "Undoable" / "Volatile" / "Growing"
|
||||
uint32_t version;
|
||||
uint32_t header; // size of header
|
||||
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint32_t catalog; // num of entries
|
||||
@ -64,7 +64,7 @@ struct bochs_header {
|
||||
char subtype[16]; // "Undoable" / "Volatile" / "Growing"
|
||||
uint32_t version;
|
||||
uint32_t header; // size of header
|
||||
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint32_t catalog; // num of entries
|
||||
@ -83,9 +83,9 @@ typedef struct BDRVBochsState {
|
||||
|
||||
uint32_t *catalog_bitmap;
|
||||
int catalog_size;
|
||||
|
||||
|
||||
int data_offset;
|
||||
|
||||
|
||||
int bitmap_blocks;
|
||||
int extent_blocks;
|
||||
int extent_size;
|
||||
@ -94,7 +94,7 @@ typedef struct BDRVBochsState {
|
||||
static int bochs_probe(const uint8_t *buf, int buf_size, const char *filename)
|
||||
{
|
||||
const struct bochs_header *bochs = (const void *)buf;
|
||||
|
||||
|
||||
if (buf_size < HEADER_SIZE)
|
||||
return 0;
|
||||
|
||||
@ -121,9 +121,9 @@ static int bochs_open(BlockDriverState *bs, const char *filename, int flags)
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bs->read_only = 1; // no write support yet
|
||||
|
||||
|
||||
s->fd = fd;
|
||||
|
||||
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->extent_blocks = 1 + (le32_to_cpu(bochs.extra.redolog.extent) - 1) / 512;
|
||||
|
||||
|
||||
s->extent_size = le32_to_cpu(bochs.extra.redolog.extent);
|
||||
|
||||
return 0;
|
||||
@ -180,7 +180,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
|
||||
// seek to sector
|
||||
extent_index = offset / s->extent_size;
|
||||
extent_offset = (offset % s->extent_size) / 512;
|
||||
|
||||
|
||||
if (s->catalog_bitmap[extent_index] == 0xffffffff)
|
||||
{
|
||||
// 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] *
|
||||
(s->extent_blocks + s->bitmap_blocks));
|
||||
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",
|
||||
// sector_num, extent_index, extent_offset,
|
||||
// le32_to_cpu(s->catalog_bitmap[extent_index]),
|
||||
// bitmap_offset, block_offset);
|
||||
|
||||
|
||||
// read in bitmap for current extent
|
||||
lseek(s->fd, bitmap_offset + (extent_offset / 8), SEEK_SET);
|
||||
|
||||
|
||||
read(s->fd, &bitmap_entry, 1);
|
||||
|
||||
|
||||
if (!((bitmap_entry >> (extent_offset % 8)) & 1))
|
||||
{
|
||||
// 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);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ cloop_close:
|
||||
if(inflateInit(&s->zstream) != Z_OK)
|
||||
goto cloop_close;
|
||||
s->current_block=s->n_blocks;
|
||||
|
||||
|
||||
s->sectors_per_block = s->block_size/512;
|
||||
bs->total_sectors = s->n_blocks*s->sectors_per_block;
|
||||
return 0;
|
||||
@ -107,7 +107,7 @@ static inline int cloop_read_block(BDRVCloopState *s,int block_num)
|
||||
if(s->current_block != block_num) {
|
||||
int ret;
|
||||
uint32_t bytes = s->offsets[block_num+1]-s->offsets[block_num];
|
||||
|
||||
|
||||
lseek(s->fd, s->offsets[block_num], SEEK_SET);
|
||||
ret = read(s->fd, s->compressed_block, bytes);
|
||||
if (ret != bytes)
|
||||
|
@ -85,14 +85,14 @@ static int cow_open(BlockDriverState *bs, const char *filename, int flags)
|
||||
be32_to_cpu(cow_header.version) != COW_VERSION) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
/* cow image found */
|
||||
size = be64_to_cpu(cow_header.size);
|
||||
bs->total_sectors = size / 512;
|
||||
|
||||
pstrcpy(bs->backing_file, sizeof(bs->backing_file),
|
||||
cow_header.backing_file);
|
||||
|
||||
|
||||
/* mmap the bitmap */
|
||||
s->cow_bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header);
|
||||
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;
|
||||
int ret, n;
|
||||
|
||||
|
||||
while (nb_sectors > 0) {
|
||||
if (is_changed(s->cow_bitmap, sector_num, nb_sectors, &n)) {
|
||||
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;
|
||||
int ret, i;
|
||||
|
||||
|
||||
lseek(s->fd, s->cow_sectors_offset + sector_num * 512, SEEK_SET);
|
||||
ret = write(s->fd, buf, nb_sectors * 512);
|
||||
if (ret != nb_sectors * 512)
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
typedef struct BDRVDMGState {
|
||||
int fd;
|
||||
|
||||
|
||||
/* each chunk contains a certain number of sectors,
|
||||
* offsets[i] is the offset in the .dmg file,
|
||||
* 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;
|
||||
s->n_chunks = 0;
|
||||
s->offsets = s->lengths = s->sectors = s->sectorcounts = 0;
|
||||
|
||||
|
||||
/* read offset of info blocks */
|
||||
if(lseek(s->fd,-0x1d8,SEEK_END)<0) {
|
||||
dmg_close:
|
||||
@ -167,7 +167,7 @@ dmg_close:
|
||||
goto dmg_close;
|
||||
|
||||
s->current_chunk = s->n_chunks;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
30
block-qcow.c
30
block-qcow.c
@ -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)
|
||||
{
|
||||
const QCowHeader *cow_header = (const void *)buf;
|
||||
|
||||
|
||||
if (buf_size >= sizeof(QCowHeader) &&
|
||||
be32_to_cpu(cow_header->magic) == QCOW_MAGIC &&
|
||||
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);
|
||||
be32_to_cpus(&header.crypt_method);
|
||||
be64_to_cpus(&header.l1_table_offset);
|
||||
|
||||
|
||||
if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION)
|
||||
goto fail;
|
||||
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)
|
||||
goto fail;
|
||||
s->cluster_cache_offset = -1;
|
||||
|
||||
|
||||
/* read the backing file name */
|
||||
if (header.backing_file_offset != 0) {
|
||||
len = header.backing_file_size;
|
||||
@ -177,7 +177,7 @@ static int qcow_set_key(BlockDriverState *bs, const char *key)
|
||||
BDRVQcowState *s = bs->opaque;
|
||||
uint8_t keybuf[16];
|
||||
int len, i;
|
||||
|
||||
|
||||
memset(keybuf, 0, 16);
|
||||
len = strlen(key);
|
||||
if (len > 16)
|
||||
@ -262,7 +262,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
|
||||
uint64_t l2_offset, *l2_table, cluster_offset, tmp;
|
||||
uint32_t min_count;
|
||||
int new_l2_table;
|
||||
|
||||
|
||||
l1_index = offset >> (s->l2_bits + s->cluster_bits);
|
||||
l2_offset = s->l1_table[l1_index];
|
||||
new_l2_table = 0;
|
||||
@ -420,7 +420,7 @@ static int decompress_buffer(uint8_t *out_buf, int out_buf_size,
|
||||
inflateEnd(strm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset)
|
||||
{
|
||||
int ret, csize;
|
||||
@ -450,7 +450,7 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num,
|
||||
BDRVQcowState *s = bs->opaque;
|
||||
int ret, index_in_cluster, n;
|
||||
uint64_t cluster_offset;
|
||||
|
||||
|
||||
while (nb_sectors > 0) {
|
||||
cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0);
|
||||
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;
|
||||
int ret, index_in_cluster, n;
|
||||
uint64_t cluster_offset;
|
||||
|
||||
|
||||
while (nb_sectors > 0) {
|
||||
index_in_cluster = sector_num & (s->cluster_sectors - 1);
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* prepare next AIO request */
|
||||
acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9,
|
||||
0, 0, 0, 0);
|
||||
@ -627,7 +627,7 @@ static BlockDriverAIOCB *qcow_aio_read(BlockDriverState *bs,
|
||||
acb->buf = buf;
|
||||
acb->nb_sectors = nb_sectors;
|
||||
acb->n = 0;
|
||||
acb->cluster_offset = 0;
|
||||
acb->cluster_offset = 0;
|
||||
|
||||
qcow_aio_read_cb(acb, 0);
|
||||
return &acb->common;
|
||||
@ -661,7 +661,7 @@ static void qcow_aio_write_cb(void *opaque, int ret)
|
||||
qemu_aio_release(acb);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
index_in_cluster = acb->sector_num & (s->cluster_sectors - 1);
|
||||
acb->n = s->cluster_sectors - index_in_cluster;
|
||||
if (acb->n > acb->nb_sectors)
|
||||
@ -701,7 +701,7 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs,
|
||||
{
|
||||
BDRVQcowState *s = bs->opaque;
|
||||
QCowAIOCB *acb;
|
||||
|
||||
|
||||
s->cluster_cache_offset = -1; /* disable compressed cache */
|
||||
|
||||
acb = qemu_aio_get(bs, cb, opaque);
|
||||
@ -712,7 +712,7 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs,
|
||||
acb->buf = (uint8_t *)buf;
|
||||
acb->nb_sectors = nb_sectors;
|
||||
acb->n = 0;
|
||||
|
||||
|
||||
qcow_aio_write_cb(acb, 0);
|
||||
return &acb->common;
|
||||
}
|
||||
@ -774,7 +774,7 @@ static int qcow_create(const char *filename, int64_t total_size,
|
||||
} else {
|
||||
header.crypt_method = cpu_to_be32(QCOW_CRYPT_NONE);
|
||||
}
|
||||
|
||||
|
||||
/* write all the data */
|
||||
write(fd, &header, sizeof(header));
|
||||
if (backing_file) {
|
||||
@ -864,7 +864,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
qemu_free(out_buf);
|
||||
return 0;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
- Size of compressed clusters is stored in sectors to reduce bit usage
|
||||
in the cluster offsets.
|
||||
- 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
|
||||
(could be backported to QCOW).
|
||||
- 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)
|
||||
{
|
||||
const QCowHeader *cow_header = (const void *)buf;
|
||||
|
||||
|
||||
if (buf_size >= sizeof(QCowHeader) &&
|
||||
be32_to_cpu(cow_header->magic) == QCOW_MAGIC &&
|
||||
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);
|
||||
be64_to_cpus(&header.snapshots_offset);
|
||||
be32_to_cpus(&header.nb_snapshots);
|
||||
|
||||
|
||||
if (header.magic != QCOW_MAGIC || header.version != QCOW_VERSION)
|
||||
goto fail;
|
||||
if (header.size <= 1 ||
|
||||
@ -267,7 +267,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
|
||||
if (!s->cluster_data)
|
||||
goto fail;
|
||||
s->cluster_cache_offset = -1;
|
||||
|
||||
|
||||
if (refcount_init(bs) < 0)
|
||||
goto fail;
|
||||
|
||||
@ -304,7 +304,7 @@ static int qcow_set_key(BlockDriverState *bs, const char *key)
|
||||
BDRVQcowState *s = bs->opaque;
|
||||
uint8_t keybuf[16];
|
||||
int len, i;
|
||||
|
||||
|
||||
memset(keybuf, 0, 16);
|
||||
len = strlen(key);
|
||||
if (len > 16)
|
||||
@ -451,7 +451,7 @@ static int grow_l1_table(BlockDriverState *bs, int min_size)
|
||||
|
||||
/* write new table (align to cluster) */
|
||||
new_l1_table_offset = alloc_clusters(bs, new_l1_size2);
|
||||
|
||||
|
||||
for(i = 0; i < s->l1_size; 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);
|
||||
@ -459,7 +459,7 @@ static int grow_l1_table(BlockDriverState *bs, int min_size)
|
||||
goto fail;
|
||||
for(i = 0; i < s->l1_size; i++)
|
||||
new_l1_table[i] = be64_to_cpu(new_l1_table[i]);
|
||||
|
||||
|
||||
/* set new table */
|
||||
data64 = cpu_to_be64(new_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;
|
||||
int min_index, i, j, l1_index, l2_index, ret;
|
||||
uint64_t l2_offset, *l2_table, cluster_offset, tmp, old_l2_offset;
|
||||
|
||||
|
||||
l1_index = offset >> (s->l2_bits + s->cluster_bits);
|
||||
if (l1_index >= s->l1_size) {
|
||||
/* outside l1 table is allowed: we grow the table if needed */
|
||||
@ -600,7 +600,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
|
||||
written */
|
||||
if ((n_end - n_start) < s->cluster_sectors) {
|
||||
uint64_t start_sect;
|
||||
|
||||
|
||||
start_sect = (offset & ~(s->cluster_size - 1)) >> 9;
|
||||
ret = copy_sectors(bs, start_sect,
|
||||
cluster_offset, 0, n_start);
|
||||
@ -672,7 +672,7 @@ static int decompress_buffer(uint8_t *out_buf, int out_buf_size,
|
||||
inflateEnd(strm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_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;
|
||||
int ret, index_in_cluster, n, n1;
|
||||
uint64_t cluster_offset;
|
||||
|
||||
|
||||
while (nb_sectors > 0) {
|
||||
cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0);
|
||||
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;
|
||||
int ret, index_in_cluster, n;
|
||||
uint64_t cluster_offset;
|
||||
|
||||
|
||||
while (nb_sectors > 0) {
|
||||
index_in_cluster = sector_num & (s->cluster_sectors - 1);
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* prepare next AIO request */
|
||||
acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9,
|
||||
0, 0, 0, 0);
|
||||
@ -948,7 +948,7 @@ static void qcow_aio_write_cb(void *opaque, int ret)
|
||||
qemu_aio_release(acb);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
index_in_cluster = acb->sector_num & (s->cluster_sectors - 1);
|
||||
acb->n = s->cluster_sectors - index_in_cluster;
|
||||
if (acb->n > acb->nb_sectors)
|
||||
@ -988,13 +988,13 @@ static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs,
|
||||
{
|
||||
BDRVQcowState *s = bs->opaque;
|
||||
QCowAIOCB *acb;
|
||||
|
||||
|
||||
s->cluster_cache_offset = -1; /* disable compressed cache */
|
||||
|
||||
acb = qcow_aio_setup(bs, sector_num, (uint8_t*)buf, nb_sectors, cb, opaque);
|
||||
if (!acb)
|
||||
return NULL;
|
||||
|
||||
|
||||
qcow_aio_write_cb(acb, 0);
|
||||
return &acb->common;
|
||||
}
|
||||
@ -1054,7 +1054,7 @@ static int qcow_create(const char *filename, int64_t total_size,
|
||||
QCowHeader header;
|
||||
uint64_t tmp, offset;
|
||||
QCowCreateState s1, *s = &s1;
|
||||
|
||||
|
||||
memset(s, 0, sizeof(*s));
|
||||
|
||||
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);
|
||||
if (!s->refcount_block)
|
||||
goto fail;
|
||||
|
||||
|
||||
s->refcount_table_offset = offset;
|
||||
header.refcount_table_offset = cpu_to_be64(offset);
|
||||
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->refcount_table_offset, s->cluster_size);
|
||||
create_refcount_update(s, s->refcount_block_offset, s->cluster_size);
|
||||
|
||||
|
||||
/* write all the data */
|
||||
write(fd, &header, sizeof(header));
|
||||
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);
|
||||
write(fd, s->refcount_table, s->cluster_size);
|
||||
|
||||
|
||||
lseek(fd, s->refcount_block_offset, SEEK_SET);
|
||||
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);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
l2_cache_reset(bs);
|
||||
#endif
|
||||
return 0;
|
||||
@ -1223,7 +1223,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
qemu_free(out_buf);
|
||||
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;
|
||||
int64_t old_offset, old_l2_offset;
|
||||
int l2_size, i, j, l1_modified, l2_modified, nb_csectors, refcount;
|
||||
|
||||
|
||||
l2_cache_reset(bs);
|
||||
|
||||
l2_table = NULL;
|
||||
@ -1278,7 +1278,7 @@ static int update_snapshot_refcount(BlockDriverState *bs,
|
||||
l1_table = s->l1_table;
|
||||
l1_allocated = 0;
|
||||
}
|
||||
|
||||
|
||||
l2_size = s->l2_size * sizeof(uint64_t);
|
||||
l2_table = qemu_malloc(l2_size);
|
||||
if (!l2_table)
|
||||
@ -1455,7 +1455,7 @@ static int qcow_write_snapshots(BlockDriverState *bs)
|
||||
|
||||
snapshots_offset = alloc_clusters(bs, snapshots_size);
|
||||
offset = snapshots_offset;
|
||||
|
||||
|
||||
for(i = 0; i < s->nb_snapshots; i++) {
|
||||
sn = s->snapshots + i;
|
||||
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_nsec = cpu_to_be32(sn->date_nsec);
|
||||
h.vm_clock_nsec = cpu_to_be64(sn->vm_clock_nsec);
|
||||
|
||||
|
||||
id_str_size = strlen(sn->id_str);
|
||||
name_size = strlen(sn->name);
|
||||
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;
|
||||
int i, ret;
|
||||
|
||||
|
||||
ret = find_snapshot_by_id(bs, name);
|
||||
if (ret >= 0)
|
||||
return ret;
|
||||
@ -1552,7 +1552,7 @@ static int qcow_snapshot_create(BlockDriverState *bs,
|
||||
QCowSnapshot *snapshots1, sn1, *sn = &sn1;
|
||||
int i, ret;
|
||||
uint64_t *l1_table = NULL;
|
||||
|
||||
|
||||
memset(sn, 0, sizeof(*sn));
|
||||
|
||||
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;
|
||||
QCowSnapshot *sn;
|
||||
int snapshot_index, ret;
|
||||
|
||||
|
||||
snapshot_index = find_snapshot_by_id_or_name(bs, snapshot_id);
|
||||
if (snapshot_index < 0)
|
||||
return -ENOENT;
|
||||
@ -1731,7 +1731,7 @@ static int refcount_init(BlockDriverState *bs)
|
||||
{
|
||||
BDRVQcowState *s = bs->opaque;
|
||||
int ret, refcount_table_size2, i;
|
||||
|
||||
|
||||
s->refcount_block_cache = qemu_malloc(s->cluster_size);
|
||||
if (!s->refcount_block_cache)
|
||||
goto fail;
|
||||
@ -1839,7 +1839,7 @@ static int64_t alloc_bytes(BlockDriverState *bs, int size)
|
||||
BDRVQcowState *s = bs->opaque;
|
||||
int64_t offset, cluster_offset;
|
||||
int free_in_cluster;
|
||||
|
||||
|
||||
assert(size > 0 && size <= s->cluster_size);
|
||||
if (s->free_byte_offset == 0) {
|
||||
s->free_byte_offset = alloc_clusters(bs, s->cluster_size);
|
||||
@ -2043,7 +2043,7 @@ static void inc_refcounts(BlockDriverState *bs,
|
||||
BDRVQcowState *s = bs->opaque;
|
||||
int64_t start, last, cluster_offset;
|
||||
int k;
|
||||
|
||||
|
||||
if (size <= 0)
|
||||
return;
|
||||
|
||||
@ -2086,7 +2086,7 @@ static int check_refcounts_l1(BlockDriverState *bs,
|
||||
goto fail;
|
||||
for(i = 0;i < l1_size; i++)
|
||||
be64_to_cpus(&l1_table[i]);
|
||||
|
||||
|
||||
l2_size = s->l2_size * sizeof(uint64_t);
|
||||
l2_table = qemu_malloc(l2_size);
|
||||
if (!l2_table)
|
||||
@ -2165,7 +2165,7 @@ static void check_refcounts(BlockDriverState *bs)
|
||||
/* header */
|
||||
inc_refcounts(bs, refcount_table, nb_clusters,
|
||||
0, s->cluster_size);
|
||||
|
||||
|
||||
check_refcounts_l1(bs, refcount_table, nb_clusters,
|
||||
s->l1_table_offset, s->l1_size, 1);
|
||||
|
||||
|
30
block-raw.c
30
block-raw.c
@ -142,7 +142,7 @@ static int raw_pread(BlockDriverState *bs, int64_t offset,
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
int ret;
|
||||
|
||||
|
||||
ret = fd_open(bs);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -194,7 +194,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset,
|
||||
{
|
||||
BDRVRawState *s = bs->opaque;
|
||||
int ret;
|
||||
|
||||
|
||||
ret = fd_open(bs);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@ -259,7 +259,7 @@ void qemu_aio_init(void)
|
||||
struct sigaction act;
|
||||
|
||||
aio_initialized = 1;
|
||||
|
||||
|
||||
sigfillset(&act.sa_mask);
|
||||
act.sa_flags = 0; /* do not restart syscalls to interrupt select() */
|
||||
act.sa_handler = aio_signal_handler;
|
||||
@ -547,7 +547,7 @@ BlockDriver bdrv_raw = {
|
||||
raw_close,
|
||||
raw_create,
|
||||
raw_flush,
|
||||
|
||||
|
||||
.bdrv_aio_read = raw_aio_read,
|
||||
.bdrv_aio_write = raw_aio_write,
|
||||
.bdrv_aio_cancel = raw_aio_cancel,
|
||||
@ -576,7 +576,7 @@ kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator )
|
||||
if ( KERN_SUCCESS != kernResult ) {
|
||||
printf( "IOMasterPort returned %d\n", kernResult );
|
||||
}
|
||||
|
||||
|
||||
classesToMatch = IOServiceMatching( kIOCDMediaClass );
|
||||
if ( classesToMatch == NULL ) {
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
return kernResult;
|
||||
}
|
||||
|
||||
@ -614,7 +614,7 @@ kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFIndex ma
|
||||
}
|
||||
IOObjectRelease( nextMedia );
|
||||
}
|
||||
|
||||
|
||||
return kernResult;
|
||||
}
|
||||
|
||||
@ -634,7 +634,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
|
||||
|
||||
kernResult = FindEjectableCDMedia( &mediaIterator );
|
||||
kernResult = GetBSDPath( mediaIterator, bsdPath, sizeof( bsdPath ) );
|
||||
|
||||
|
||||
if ( bsdPath[ 0 ] != '\0' ) {
|
||||
strcat(bsdPath,"s0");
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
if ( mediaIterator )
|
||||
IOObjectRelease( mediaIterator );
|
||||
}
|
||||
@ -883,7 +883,7 @@ BlockDriver bdrv_host_device = {
|
||||
raw_close,
|
||||
NULL,
|
||||
raw_flush,
|
||||
|
||||
|
||||
.bdrv_aio_read = raw_aio_read,
|
||||
.bdrv_aio_write = raw_aio_write,
|
||||
.bdrv_aio_cancel = raw_aio_cancel,
|
||||
@ -999,7 +999,7 @@ static int raw_pread(BlockDriverState *bs, int64_t offset,
|
||||
OVERLAPPED ov;
|
||||
DWORD ret_count;
|
||||
int ret;
|
||||
|
||||
|
||||
memset(&ov, 0, sizeof(ov));
|
||||
ov.Offset = offset;
|
||||
ov.OffsetHigh = offset >> 32;
|
||||
@ -1021,7 +1021,7 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset,
|
||||
OVERLAPPED ov;
|
||||
DWORD ret_count;
|
||||
int ret;
|
||||
|
||||
|
||||
memset(&ov, 0, sizeof(ov));
|
||||
ov.Offset = offset;
|
||||
ov.OffsetHigh = offset >> 32;
|
||||
@ -1256,7 +1256,7 @@ BlockDriver bdrv_raw = {
|
||||
raw_close,
|
||||
raw_create,
|
||||
raw_flush,
|
||||
|
||||
|
||||
#if 0
|
||||
.bdrv_aio_read = raw_aio_read,
|
||||
.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);
|
||||
|
||||
|
||||
if ((flags & BDRV_O_ACCESS) == O_RDWR) {
|
||||
access_flags = GENERIC_READ | GENERIC_WRITE;
|
||||
} else {
|
||||
@ -1406,7 +1406,7 @@ BlockDriver bdrv_host_device = {
|
||||
raw_close,
|
||||
NULL,
|
||||
raw_flush,
|
||||
|
||||
|
||||
#if 0
|
||||
.bdrv_aio_read = raw_aio_read,
|
||||
.bdrv_aio_write = raw_aio_write,
|
||||
|
12
block-vmdk.c
12
block-vmdk.c
@ -110,7 +110,7 @@ static int vmdk_probe(const uint8_t *buf, int buf_size, const char *filename)
|
||||
|
||||
#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 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:
|
||||
qemu_free(gd_buf);
|
||||
fail_rgd:
|
||||
fail_rgd:
|
||||
qemu_free(rgd_buf);
|
||||
fail:
|
||||
close(p_fd);
|
||||
@ -341,7 +341,7 @@ static int vmdk_parent_open(BlockDriverState *bs, const char * filename)
|
||||
p_name += sizeof("parentFileNameHint") + 1;
|
||||
if ((end_name = strchr(p_name,'\"')) == 0)
|
||||
return -1;
|
||||
|
||||
|
||||
strncpy(s->hd->backing_file, p_name, end_name - p_name);
|
||||
if (stat(s->hd->backing_file, &file_buf) != 0) {
|
||||
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[2] = 0xd;
|
||||
header.check_bytes[3] = 0xa;
|
||||
|
||||
/* write all the data */
|
||||
|
||||
/* write all the data */
|
||||
write(fd, &magic, sizeof(magic));
|
||||
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;
|
||||
i < gt_count; i++, tmp += gt_size)
|
||||
write(fd, &tmp, sizeof(tmp));
|
||||
|
||||
|
||||
/* write backup grain directory */
|
||||
lseek(fd, le64_to_cpu(header.gd_offset) << 9, SEEK_SET);
|
||||
for (i = 0, tmp = header.gd_offset + gd_size;
|
||||
|
10
block-vpc.c
10
block-vpc.c
@ -65,7 +65,7 @@ struct vpc_subheader {
|
||||
|
||||
typedef struct BDRVVPCState {
|
||||
int fd;
|
||||
|
||||
|
||||
int pagetable_entries;
|
||||
uint32_t *pagetable;
|
||||
|
||||
@ -74,7 +74,7 @@ typedef struct BDRVVPCState {
|
||||
uint8_t *pageentry_u8;
|
||||
uint32_t *pageentry_u32;
|
||||
uint16_t *pageentry_u16;
|
||||
|
||||
|
||||
uint64_t last_bitmap;
|
||||
#endif
|
||||
} BDRVVPCState;
|
||||
@ -97,7 +97,7 @@ static int vpc_open(BlockDriverState *bs, const char *filename, int flags)
|
||||
return -1;
|
||||
|
||||
bs->read_only = 1; // no write support yet
|
||||
|
||||
|
||||
s->fd = fd;
|
||||
|
||||
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;
|
||||
pageentry_index = (offset % s->pageentry_size) / 512;
|
||||
|
||||
|
||||
if (pagetable_index > s->pagetable_entries || s->pagetable[pagetable_index] == 0xffffffff)
|
||||
return -1; // not allocated
|
||||
|
||||
bitmap_offset = 512 * s->pagetable[pagetable_index];
|
||||
block_offset = bitmap_offset + 512 + (512 * pageentry_index);
|
||||
|
||||
|
||||
// printf("sector: %" PRIx64 ", index: %x, offset: %x, bioff: %" PRIx64 ", bloff: %" PRIx64 "\n",
|
||||
// sector_num, pagetable_index, pageentry_index,
|
||||
// bitmap_offset, block_offset);
|
||||
|
@ -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_from<0 || index_from>=array->next)
|
||||
return -1;
|
||||
|
||||
|
||||
if(index_to==index_from)
|
||||
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);
|
||||
else
|
||||
memmove(from,from+is*count,to-from);
|
||||
|
||||
|
||||
memcpy(to,buf,is*count);
|
||||
|
||||
free(buf);
|
||||
@ -319,10 +319,10 @@ typedef struct BDRVVVFATState {
|
||||
BlockDriverState* bs; /* pointer to parent */
|
||||
unsigned int first_sectors_number; /* 1 for a single partition, 0x40 for a disk with partition table */
|
||||
unsigned char first_sectors[0x40*0x200];
|
||||
|
||||
|
||||
int fat_type; /* 16 or 32 */
|
||||
array_t fat,directory,mapping;
|
||||
|
||||
|
||||
unsigned int cluster_size;
|
||||
unsigned int sectors_per_cluster;
|
||||
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 cluster_count; /* total number of clusters of this partition */
|
||||
uint32_t max_fat_value;
|
||||
|
||||
|
||||
int current_fd;
|
||||
mapping_t* current_mapping;
|
||||
unsigned char* cluster; /* points to current cluster */
|
||||
@ -358,7 +358,7 @@ static void init_mbr(BDRVVVFATState* s)
|
||||
partition_t* partition=&(real_mbr->partition[0]);
|
||||
|
||||
memset(s->first_sectors,0,512);
|
||||
|
||||
|
||||
partition->attributes=0x80; /* bootable */
|
||||
partition->start_head=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++)
|
||||
chksum=(((chksum&0xfe)>>1)|((chksum&0x01)?0x80:0))
|
||||
+(unsigned char)entry->name[i];
|
||||
|
||||
|
||||
return chksum;
|
||||
}
|
||||
|
||||
@ -554,7 +554,7 @@ static inline void init_fat(BDRVVVFATState* s)
|
||||
s->sectors_per_fat * 0x200 / s->fat.item_size - 1);
|
||||
}
|
||||
memset(s->fat.pointer,0,s->fat.size);
|
||||
|
||||
|
||||
switch(s->fat_type) {
|
||||
case 12: s->max_fat_value=0xfff; 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));
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
entry_long=create_long_filename(s,filename);
|
||||
|
||||
|
||||
i = strlen(filename);
|
||||
for(j = i - 1; j>0 && filename[j]!='.';j--);
|
||||
if (j > 0)
|
||||
@ -592,7 +592,7 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s,
|
||||
entry=array_get_next(&(s->directory));
|
||||
memset(entry->name,0x20,11);
|
||||
strncpy(entry->name,filename,i);
|
||||
|
||||
|
||||
if(j > 0)
|
||||
for (i = 0; i < 3 && filename[j+1+i]; 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;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
i = mapping->info.dir.first_dir_index =
|
||||
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);
|
||||
set_begin_of_direntry(direntry, mapping->begin);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -825,7 +825,7 @@ static int init_directories(BDRVVVFATState* s,
|
||||
*/
|
||||
i = 1+s->sectors_per_cluster*0x200*8/s->fat_type;
|
||||
s->sectors_per_fat=(s->sector_count+i)/i; /* round up */
|
||||
|
||||
|
||||
array_init(&(s->mapping),sizeof(mapping_t));
|
||||
array_init(&(s->directory),sizeof(direntry_t));
|
||||
|
||||
@ -987,7 +987,7 @@ DLOG(if (stderr == NULL) {
|
||||
s->qcow_filename = NULL;
|
||||
s->fat2 = NULL;
|
||||
s->downcase_short_names = 1;
|
||||
|
||||
|
||||
if (!strstart(dirname, "fat:", NULL))
|
||||
return -1;
|
||||
|
||||
@ -1709,7 +1709,7 @@ static int check_directory_consistency(BDRVVVFATState *s,
|
||||
} else
|
||||
/* new directory */
|
||||
schedule_mkdir(s, cluster_num, strdup(path));
|
||||
|
||||
|
||||
lfn_init(&lfn);
|
||||
do {
|
||||
int i;
|
||||
@ -2069,7 +2069,7 @@ static int commit_mappings(BDRVVVFATState* s,
|
||||
|
||||
mapping = next_mapping;
|
||||
}
|
||||
|
||||
|
||||
cluster = c1;
|
||||
}
|
||||
|
||||
|
22
block.c
22
block.c
@ -180,7 +180,7 @@ int bdrv_create(BlockDriver *drv,
|
||||
void get_tmp_filename(char *filename, int size)
|
||||
{
|
||||
char temp_dir[MAX_PATH];
|
||||
|
||||
|
||||
GetTempPath(MAX_PATH, temp_dir);
|
||||
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[1] == ':');
|
||||
}
|
||||
|
||||
|
||||
static int is_windows_drive(const char *filename)
|
||||
{
|
||||
if (is_windows_drive_prefix(filename) &&
|
||||
@ -251,7 +251,7 @@ static BlockDriver *find_image_format(const char *filename)
|
||||
BlockDriver *drv1, *drv;
|
||||
uint8_t buf[2048];
|
||||
BlockDriverState *bs;
|
||||
|
||||
|
||||
/* detect host devices. By convention, /dev/cdrom[N] is always
|
||||
recognized as a host CDROM */
|
||||
if (strstart(filename, "/dev/cdrom", NULL))
|
||||
@ -268,7 +268,7 @@ static BlockDriver *find_image_format(const char *filename)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
drv = find_protocol(filename);
|
||||
/* no need to test disk image formats for vvfat */
|
||||
if (drv == &bdrv_vvfat)
|
||||
@ -324,7 +324,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
|
||||
int ret, open_flags;
|
||||
char tmp_filename[PATH_MAX];
|
||||
char backing_filename[PATH_MAX];
|
||||
|
||||
|
||||
bs->read_only = 0;
|
||||
bs->is_temporary = 0;
|
||||
bs->encrypted = 0;
|
||||
@ -332,7 +332,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
|
||||
if (flags & BDRV_O_SNAPSHOT) {
|
||||
BlockDriverState *bs1;
|
||||
int64_t total_size;
|
||||
|
||||
|
||||
/* if snapshot, we create a temporary backing file and open it
|
||||
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;
|
||||
bdrv_delete(bs1);
|
||||
|
||||
|
||||
get_tmp_filename(tmp_filename, sizeof(tmp_filename));
|
||||
realpath(filename, backing_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)
|
||||
return -EACCES;
|
||||
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) {
|
||||
int ret, len;
|
||||
@ -919,7 +919,7 @@ int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,
|
||||
return -ENOTSUP;
|
||||
return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors);
|
||||
}
|
||||
|
||||
|
||||
int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
|
||||
{
|
||||
BlockDriver *drv = bs->drv;
|
||||
@ -1062,7 +1062,7 @@ BlockDriverAIOCB *bdrv_aio_read(BlockDriverState *bs, int64_t sector_num,
|
||||
|
||||
if (!drv)
|
||||
return NULL;
|
||||
|
||||
|
||||
/* XXX: we assume that nb_sectors == 0 is suppored by the async read */
|
||||
if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
|
||||
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)
|
||||
return NULL;
|
||||
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);
|
||||
|
@ -79,7 +79,7 @@ struct BlockDriver {
|
||||
int (*bdrv_media_changed)(BlockDriverState *bs);
|
||||
int (*bdrv_eject)(BlockDriverState *bs, int eject_flag);
|
||||
int (*bdrv_set_locked)(BlockDriverState *bs, int locked);
|
||||
|
||||
|
||||
BlockDriverAIOCB *free_aiocb;
|
||||
struct BlockDriver *next;
|
||||
};
|
||||
@ -111,7 +111,7 @@ struct BlockDriverState {
|
||||
/* async read/write emulation */
|
||||
|
||||
void *sync_aiocb;
|
||||
|
||||
|
||||
/* NOTE: the following infos are only hints for real hardware
|
||||
drivers. They are not used by the block driver */
|
||||
int cyls, heads, secs, translation;
|
||||
|
190
cocoa.m
190
cocoa.m
@ -84,7 +84,7 @@ static void cocoa_update(DisplayState *ds, int x, int y, int w, int h)
|
||||
MacSetRectRgn (temp, x, y,
|
||||
x + w, y + h);
|
||||
MacUnionRgn (dirty, temp, dirty);
|
||||
|
||||
|
||||
/* Flush the dirty region */
|
||||
QDFlushPortBuffer ( [ qd_view qdPort ], dirty );
|
||||
DisposeRgn (dirty);
|
||||
@ -102,9 +102,9 @@ static void cocoa_resize(DisplayState *ds, int w, int h)
|
||||
static void *screen_pixels;
|
||||
static int screen_pitch;
|
||||
NSRect contentRect;
|
||||
|
||||
|
||||
//printf("resizing to %d %d\n", w, h);
|
||||
|
||||
|
||||
contentRect = NSMakeRect (0, 0, w, h);
|
||||
if(window)
|
||||
{
|
||||
@ -119,33 +119,33 @@ static void cocoa_resize(DisplayState *ds, int w, int h)
|
||||
fprintf(stderr, "(cocoa) can't create window\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if(qd_view)
|
||||
[qd_view release];
|
||||
|
||||
|
||||
qd_view = [ [ NSQuickDrawView alloc ] initWithFrame:contentRect ];
|
||||
|
||||
|
||||
if(!qd_view)
|
||||
{
|
||||
fprintf(stderr, "(cocoa) can't create qd_view\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
[ window setAcceptsMouseMovedEvents:YES ];
|
||||
[ window setTitle:@"Qemu" ];
|
||||
[ window setReleasedWhenClosed:NO ];
|
||||
|
||||
|
||||
/* Set screen to black */
|
||||
[ window setBackgroundColor: [NSColor blackColor] ];
|
||||
|
||||
|
||||
/* set window position */
|
||||
[ window center ];
|
||||
|
||||
|
||||
[ qd_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable ];
|
||||
[ [ window contentView ] addSubview:qd_view ];
|
||||
[ qd_view release ];
|
||||
[ window makeKeyAndOrderFront:nil ];
|
||||
|
||||
|
||||
/* Careful here, the window seems to have to be onscreen to do that */
|
||||
LockPortBits ( [ 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 -
|
||||
[ qd_view frame ].size.height - [ qd_view frame ].origin.y;
|
||||
|
||||
|
||||
int hOffset = [ qd_view frame ].origin.x;
|
||||
|
||||
|
||||
screen_pixels += (vOffset * screen_pitch) + hOffset * (device_bpp/8);
|
||||
}
|
||||
ds->data = screen_pixels;
|
||||
@ -310,38 +310,38 @@ int keymap[] =
|
||||
208,// 125 0x7D 0xd0 E0,50 D ARROW QZ_DOWN
|
||||
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 */
|
||||
|
||||
|
||||
/* Aditional 104 Key XP-Keyboard Scancodes from http://www.computer-engineering.org/ps2keyboard/scancodes1.html */
|
||||
/*
|
||||
219 // 0xdb e0,5b L GUI
|
||||
220 // 0xdc e0,5c R GUI
|
||||
221 // 0xdd e0,5d APPS
|
||||
// E0,2A,E0,37 PRNT SCRN
|
||||
// E1,1D,45,E1,9D,C5 PAUSE
|
||||
83 // 0x53 0x53 KP .
|
||||
// ACPI Scan Codes
|
||||
222 // 0xde E0, 5E Power
|
||||
223 // 0xdf E0, 5F Sleep
|
||||
227 // 0xe3 E0, 63 Wake
|
||||
// Windows Multimedia Scan Codes
|
||||
153 // 0x99 E0, 19 Next Track
|
||||
144 // 0x90 E0, 10 Previous Track
|
||||
164 // 0xa4 E0, 24 Stop
|
||||
162 // 0xa2 E0, 22 Play/Pause
|
||||
160 // 0xa0 E0, 20 Mute
|
||||
176 // 0xb0 E0, 30 Volume Up
|
||||
219 // 0xdb e0,5b L GUI
|
||||
220 // 0xdc e0,5c R GUI
|
||||
221 // 0xdd e0,5d APPS
|
||||
// E0,2A,E0,37 PRNT SCRN
|
||||
// E1,1D,45,E1,9D,C5 PAUSE
|
||||
83 // 0x53 0x53 KP .
|
||||
// ACPI Scan Codes
|
||||
222 // 0xde E0, 5E Power
|
||||
223 // 0xdf E0, 5F Sleep
|
||||
227 // 0xe3 E0, 63 Wake
|
||||
// Windows Multimedia Scan Codes
|
||||
153 // 0x99 E0, 19 Next Track
|
||||
144 // 0x90 E0, 10 Previous Track
|
||||
164 // 0xa4 E0, 24 Stop
|
||||
162 // 0xa2 E0, 22 Play/Pause
|
||||
160 // 0xa0 E0, 20 Mute
|
||||
176 // 0xb0 E0, 30 Volume Up
|
||||
174 // 0xae E0, 2E Volume Down
|
||||
237 // 0xed E0, 6D Media Select
|
||||
236 // 0xec E0, 6C E-Mail
|
||||
161 // 0xa1 E0, 21 Calculator
|
||||
237 // 0xed E0, 6D Media Select
|
||||
236 // 0xec E0, 6C E-Mail
|
||||
161 // 0xa1 E0, 21 Calculator
|
||||
235 // 0xeb E0, 6B My Computer
|
||||
229 // 0xe5 E0, 65 WWW Search
|
||||
178 // 0xb2 E0, 32 WWW Home
|
||||
234 // 0xea E0, 6A WWW Back
|
||||
229 // 0xe5 E0, 65 WWW Search
|
||||
178 // 0xb2 E0, 32 WWW Home
|
||||
234 // 0xea E0, 6A WWW Back
|
||||
233 // 0xe9 E0, 69 WWW Forward
|
||||
232 // 0xe8 E0, 68 WWW Stop
|
||||
232 // 0xe8 E0, 68 WWW Stop
|
||||
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;
|
||||
NSEvent *event;
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
|
||||
pool = [ [ NSAutoreleasePool alloc ] init ];
|
||||
distantPast = [ NSDate distantPast ];
|
||||
|
||||
|
||||
vga_hw_update();
|
||||
|
||||
do {
|
||||
@ -415,8 +415,8 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
|
||||
case NSKeyDown:
|
||||
{
|
||||
int keycode = cocoa_keycode_to_qemu([event keyCode]);
|
||||
|
||||
int keycode = cocoa_keycode_to_qemu([event keyCode]);
|
||||
|
||||
/* handle command Key Combos */
|
||||
if ([event modifierFlags] & NSCommandKeyMask) {
|
||||
switch ([event keyCode]) {
|
||||
@ -427,7 +427,7 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* handle control + alt Key Combos */
|
||||
if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) {
|
||||
switch (keycode) {
|
||||
@ -482,10 +482,10 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSKeyUp:
|
||||
{
|
||||
int keycode = cocoa_keycode_to_qemu([event keyCode]);
|
||||
int keycode = cocoa_keycode_to_qemu([event keyCode]);
|
||||
if (is_graphic_console()) {
|
||||
if (keycode & 0x80)
|
||||
kbd_put_keycode(0xe0);
|
||||
@ -493,7 +493,7 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSMouseMoved:
|
||||
if (grab) {
|
||||
int dx = [event deltaX];
|
||||
@ -503,11 +503,11 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
kbd_mouse_event(dx, dy, dz, buttons);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSLeftMouseDown:
|
||||
if (grab) {
|
||||
int buttons = 0;
|
||||
|
||||
|
||||
/* leftclick+command simulates rightclick */
|
||||
if ([event modifierFlags] & NSCommandKeyMask) {
|
||||
buttons |= MOUSE_EVENT_RBUTTON;
|
||||
@ -519,7 +519,7 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
[NSApp sendEvent: event];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSLeftMouseDragged:
|
||||
if (grab) {
|
||||
int dx = [event deltaX];
|
||||
@ -534,7 +534,7 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
kbd_mouse_event(dx, dy, dz, buttons);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSLeftMouseUp:
|
||||
if (grab) {
|
||||
kbd_mouse_event(0, 0, 0, 0);
|
||||
@ -546,18 +546,18 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
//[NSApp sendEvent: event];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSRightMouseDown:
|
||||
if (grab) {
|
||||
int buttons = 0;
|
||||
|
||||
|
||||
buttons |= MOUSE_EVENT_RBUTTON;
|
||||
kbd_mouse_event(0, 0, 0, buttons);
|
||||
} else {
|
||||
[NSApp sendEvent: event];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSRightMouseDragged:
|
||||
if (grab) {
|
||||
int dx = [event deltaX];
|
||||
@ -568,7 +568,7 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
kbd_mouse_event(dx, dy, dz, buttons);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSRightMouseUp:
|
||||
if (grab) {
|
||||
kbd_mouse_event(0, 0, 0, 0);
|
||||
@ -576,7 +576,7 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
[NSApp sendEvent: event];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSOtherMouseDragged:
|
||||
if (grab) {
|
||||
int dx = [event deltaX];
|
||||
@ -587,7 +587,7 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
kbd_mouse_event(dx, dy, dz, buttons);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSOtherMouseDown:
|
||||
if (grab) {
|
||||
int buttons = 0;
|
||||
@ -597,7 +597,7 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
[NSApp sendEvent:event];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSOtherMouseUp:
|
||||
if (grab) {
|
||||
kbd_mouse_event(0, 0, 0, 0);
|
||||
@ -605,14 +605,14 @@ static void cocoa_refresh(DisplayState *ds)
|
||||
[NSApp sendEvent: event];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NSScrollWheel:
|
||||
if (grab) {
|
||||
int dz = [event deltaY];
|
||||
kbd_mouse_event(0, 0, -dz, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default: [NSApp sendEvent:event];
|
||||
}
|
||||
}
|
||||
@ -641,9 +641,9 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
|
||||
ds->dpy_update = cocoa_update;
|
||||
ds->dpy_resize = cocoa_resize;
|
||||
ds->dpy_refresh = cocoa_refresh;
|
||||
|
||||
|
||||
cocoa_resize(ds, 640, 400);
|
||||
|
||||
|
||||
atexit(cocoa_cleanup);
|
||||
}
|
||||
|
||||
@ -661,17 +661,17 @@ void cocoa_display_init(DisplayState *ds, int full_screen)
|
||||
------------------------------------------------------
|
||||
*/
|
||||
static void QZ_SetPortAlphaOpaque ()
|
||||
{
|
||||
{
|
||||
/* Assume 32 bit if( bpp == 32 )*/
|
||||
if ( 1 ) {
|
||||
|
||||
|
||||
uint32_t *pixels = (uint32_t*) current_ds.data;
|
||||
uint32_t rowPixels = current_ds.linesize / 4;
|
||||
uint32_t i, j;
|
||||
|
||||
|
||||
for (i = 0; i < current_ds.height; i++)
|
||||
for (j = 0; j < current_ds.width; j++) {
|
||||
|
||||
|
||||
pixels[ (i * rowPixels) + j ] |= 0xFF000000;
|
||||
}
|
||||
}
|
||||
@ -680,32 +680,32 @@ static void QZ_SetPortAlphaOpaque ()
|
||||
@implementation QemuWindow
|
||||
- (void)miniaturize:(id)sender
|
||||
{
|
||||
|
||||
|
||||
/* make the alpha channel opaque so anim won't have holes in it */
|
||||
QZ_SetPortAlphaOpaque ();
|
||||
|
||||
|
||||
[ super miniaturize:sender ];
|
||||
|
||||
|
||||
}
|
||||
- (void)display
|
||||
{
|
||||
{
|
||||
/*
|
||||
This method fires just before the window deminaturizes from the Dock.
|
||||
|
||||
|
||||
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
|
||||
is required, and the deminiaturize works perfectly.
|
||||
*/
|
||||
|
||||
|
||||
/* make sure pixels are fully opaque */
|
||||
QZ_SetPortAlphaOpaque ();
|
||||
|
||||
|
||||
/* save current visible SDL surface */
|
||||
[ self cacheImageInRect:[ qd_view frame ] ];
|
||||
|
||||
|
||||
/* let the window manager redraw controls, border, etc */
|
||||
[ super display ];
|
||||
|
||||
|
||||
/* restore visible SDL surface */
|
||||
[ self restoreCachedImage ];
|
||||
}
|
||||
@ -742,13 +742,13 @@ static void QZ_SetPortAlphaOpaque ()
|
||||
if( gArgc <= 1 || strncmp (gArgv[1], "-psn", 4) == 0)
|
||||
{
|
||||
NSOpenPanel *op = [[NSOpenPanel alloc] init];
|
||||
|
||||
|
||||
cocoa_resize(¤t_ds, 640, 400);
|
||||
|
||||
|
||||
[op setPrompt:@"Boot image"];
|
||||
|
||||
|
||||
[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]
|
||||
modalForWindow:window modalDelegate:self
|
||||
didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
|
||||
@ -774,20 +774,20 @@ static void QZ_SetPortAlphaOpaque ()
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
if(returnCode == NSOKButton)
|
||||
{
|
||||
char *bin = "qemu";
|
||||
char *img = (char*)[ [ sheet filename ] cString];
|
||||
|
||||
|
||||
char **argv = (char**)malloc( sizeof(char*)*3 );
|
||||
|
||||
|
||||
asprintf(&argv[0], "%s", bin);
|
||||
asprintf(&argv[1], "-hda");
|
||||
asprintf(&argv[2], "%s", img);
|
||||
|
||||
|
||||
printf("Using argc %d argv %s -hda %s\n", 3, bin, img);
|
||||
|
||||
|
||||
[self startEmulationWithArgc:3 argv:(char**)argv];
|
||||
}
|
||||
}
|
||||
@ -827,10 +827,10 @@ static void setApplicationMenu(void)
|
||||
NSMenuItem *menuItem;
|
||||
NSString *title;
|
||||
NSString *appName;
|
||||
|
||||
|
||||
appName = @"Qemu";
|
||||
appleMenu = [[NSMenu alloc] initWithTitle:@""];
|
||||
|
||||
|
||||
/* Add menu items */
|
||||
title = [@"About " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
|
||||
@ -850,7 +850,7 @@ static void setApplicationMenu(void)
|
||||
title = [@"Quit " stringByAppendingString:appName];
|
||||
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
|
||||
|
||||
|
||||
|
||||
/* Put menu into the menubar */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
[menuItem setSubmenu:appleMenu];
|
||||
@ -872,17 +872,17 @@ static void setupWindowMenu(void)
|
||||
NSMenuItem *menuItem;
|
||||
|
||||
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
|
||||
|
||||
|
||||
/* "Minimize" item */
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
|
||||
[windowMenu addItem:menuItem];
|
||||
[menuItem release];
|
||||
|
||||
|
||||
/* Put menu into the menubar */
|
||||
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
|
||||
[windowMenuItem setSubmenu:windowMenu];
|
||||
[[NSApp mainMenu] addItem:windowMenuItem];
|
||||
|
||||
|
||||
/* Tell the application object that this is now the window menu */
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
|
||||
@ -896,14 +896,14 @@ static void CustomApplicationMain(void)
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
QemuCocoaGUIController *gui_controller;
|
||||
CPSProcessSerNum PSN;
|
||||
|
||||
|
||||
[NSApplication sharedApplication];
|
||||
|
||||
|
||||
if (!CPSGetCurrentProcess(&PSN))
|
||||
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
|
||||
if (!CPSSetFrontProcess(&PSN))
|
||||
[NSApplication sharedApplication];
|
||||
|
||||
|
||||
/* Set up the menubar */
|
||||
[NSApp setMainMenu:[[NSMenu alloc] init]];
|
||||
setApplicationMenu();
|
||||
@ -912,10 +912,10 @@ static void CustomApplicationMain(void)
|
||||
/* Create SDLMain and make it the app delegate */
|
||||
gui_controller = [[QemuCocoaGUIController alloc] init];
|
||||
[NSApp setDelegate:gui_controller];
|
||||
|
||||
|
||||
/* Start the main event loop */
|
||||
[NSApp run];
|
||||
|
||||
|
||||
[gui_controller release];
|
||||
[pool release];
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ static void vga_fill_rect (DisplayState *ds,
|
||||
{
|
||||
uint8_t *d, *d1;
|
||||
int x, y, bpp;
|
||||
|
||||
|
||||
bpp = (ds->depth + 7) >> 3;
|
||||
d1 = ds->data +
|
||||
ds->linesize * posy + bpp * posx;
|
||||
@ -591,7 +591,7 @@ static void console_scroll(int ydelta)
|
||||
{
|
||||
TextConsole *s;
|
||||
int i, y1;
|
||||
|
||||
|
||||
s = active_console;
|
||||
if (!s || (s->console_type == GRAPHIC_CONSOLE))
|
||||
return;
|
||||
@ -1047,7 +1047,7 @@ static void kbd_send_chars(void *opaque)
|
||||
TextConsole *s = opaque;
|
||||
int len;
|
||||
uint8_t buf[16];
|
||||
|
||||
|
||||
len = qemu_chr_can_read(s->chr);
|
||||
if (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_size = sizeof(s->out_fifo_buf);
|
||||
s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s);
|
||||
|
||||
|
||||
if (!color_inited) {
|
||||
color_inited = 1;
|
||||
for(j = 0; j < 2; j++) {
|
||||
|
36
cpu-exec.c
36
cpu-exec.c
@ -84,13 +84,13 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
|
||||
unsigned int h;
|
||||
target_ulong phys_pc, phys_page1, phys_page2, virt_page2;
|
||||
uint8_t *tc_ptr;
|
||||
|
||||
|
||||
spin_lock(&tb_lock);
|
||||
|
||||
tb_invalidated_flag = 0;
|
||||
|
||||
|
||||
regs_to_env(); /* XXX: do it just before cpu_gen_code() */
|
||||
|
||||
|
||||
/* find translated block using physical mappings */
|
||||
phys_pc = get_phys_addr_code(env, pc);
|
||||
phys_page1 = phys_pc & TARGET_PAGE_MASK;
|
||||
@ -135,7 +135,7 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
|
||||
tb->flags = flags;
|
||||
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));
|
||||
|
||||
|
||||
/* check next page if needed */
|
||||
virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;
|
||||
phys_page2 = -1;
|
||||
@ -143,7 +143,7 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
|
||||
phys_page2 = get_phys_addr_code(env, virt_page2);
|
||||
}
|
||||
tb_link_phys(tb, phys_pc, phys_page2);
|
||||
|
||||
|
||||
found:
|
||||
/* we add the TB in the virtual pc hash table */
|
||||
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)
|
||||
/* g1 can be modified by some libc? functions */
|
||||
tmp_T0 = T0;
|
||||
#endif
|
||||
#endif
|
||||
interrupt_request = env->interrupt_request;
|
||||
if (__builtin_expect(interrupt_request, 0)) {
|
||||
if (interrupt_request & CPU_INTERRUPT_DEBUG) {
|
||||
@ -565,7 +565,7 @@ int cpu_exec(CPUState *env1)
|
||||
#endif
|
||||
#if defined(__sparc__) && !defined(HOST_SOLARIS)
|
||||
T0 = tmp_T0;
|
||||
#endif
|
||||
#endif
|
||||
/* see if we can patch the calling TB. When the TB
|
||||
spans two pages, we cannot safely do a direct
|
||||
jump. */
|
||||
@ -796,7 +796,7 @@ void cpu_x86_fsave(CPUX86State *s, uint8_t *ptr, int data32)
|
||||
|
||||
saved_env = env;
|
||||
env = s;
|
||||
|
||||
|
||||
helper_fsave((target_ulong)ptr, data32);
|
||||
|
||||
env = saved_env;
|
||||
@ -808,7 +808,7 @@ void cpu_x86_frstor(CPUX86State *s, uint8_t *ptr, int data32)
|
||||
|
||||
saved_env = env;
|
||||
env = s;
|
||||
|
||||
|
||||
helper_frstor((target_ulong)ptr, data32);
|
||||
|
||||
env = saved_env;
|
||||
@ -953,7 +953,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
|
||||
{
|
||||
TranslationBlock *tb;
|
||||
int ret;
|
||||
|
||||
|
||||
if (cpu_single_env)
|
||||
env = cpu_single_env; /* XXX: find a correct solution for multithread */
|
||||
#if defined(DEBUG_SIGNAL)
|
||||
@ -1042,7 +1042,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
|
||||
{
|
||||
TranslationBlock *tb;
|
||||
int ret;
|
||||
|
||||
|
||||
if (cpu_single_env)
|
||||
env = cpu_single_env; /* XXX: find a correct solution for multithread */
|
||||
#if defined(DEBUG_SIGNAL)
|
||||
@ -1092,7 +1092,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
|
||||
{
|
||||
TranslationBlock *tb;
|
||||
int ret;
|
||||
|
||||
|
||||
if (cpu_single_env)
|
||||
env = cpu_single_env; /* XXX: find a correct solution for multithread */
|
||||
#if defined(DEBUG_SIGNAL)
|
||||
@ -1137,7 +1137,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
|
||||
{
|
||||
TranslationBlock *tb;
|
||||
int ret;
|
||||
|
||||
|
||||
if (cpu_single_env)
|
||||
env = cpu_single_env; /* XXX: find a correct solution for multithread */
|
||||
#if defined(DEBUG_SIGNAL)
|
||||
@ -1371,7 +1371,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||
unsigned long pc;
|
||||
int is_write;
|
||||
uint32_t insn;
|
||||
|
||||
|
||||
/* XXX: is there a standard glibc define ? */
|
||||
pc = regs[1];
|
||||
/* 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;
|
||||
unsigned long pc;
|
||||
int is_write;
|
||||
|
||||
|
||||
pc = uc->uc_mcontext.gregs[R15];
|
||||
/* XXX: compute is_write */
|
||||
is_write = 0;
|
||||
@ -1421,7 +1421,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||
struct ucontext *uc = puc;
|
||||
unsigned long pc;
|
||||
int is_write;
|
||||
|
||||
|
||||
pc = uc->uc_mcontext.gregs[16];
|
||||
/* XXX: compute is_write */
|
||||
is_write = 0;
|
||||
@ -1473,7 +1473,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||
struct ucontext *uc = puc;
|
||||
unsigned long pc;
|
||||
int is_write;
|
||||
|
||||
|
||||
pc = uc->uc_mcontext.psw.addr;
|
||||
/* XXX: compute is_write */
|
||||
is_write = 0;
|
||||
@ -1490,7 +1490,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||
struct ucontext *uc = puc;
|
||||
greg_t pc = uc->uc_mcontext.pc;
|
||||
int is_write;
|
||||
|
||||
|
||||
/* XXX: compute is_write */
|
||||
is_write = 0;
|
||||
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
|
||||
|
@ -1336,7 +1336,7 @@ static inline long bswap_syctl(int * mib, int count, void *buf, int size)
|
||||
if(!(sysctl = sysctl->childs))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(ret->childs)
|
||||
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);
|
||||
tswap32s((uint32_t*)oldlenp);
|
||||
}
|
||||
|
||||
|
||||
if(name) /* Sometimes sysctl is called with no arg1, ignore */
|
||||
ret = get_errno(sysctl(name, namelen, oldp, oldlenp, newp, newlen));
|
||||
|
||||
|
@ -67,7 +67,7 @@ enum bfd_architecture
|
||||
#define bfd_mach_mcf5249 16
|
||||
#define bfd_mach_mcf547x 17
|
||||
#define bfd_mach_mcf548x 18
|
||||
bfd_arch_vax, /* DEC Vax */
|
||||
bfd_arch_vax, /* DEC Vax */
|
||||
bfd_arch_i960, /* Intel 960 */
|
||||
/* The order of the following is important.
|
||||
lower number indicates a machine type that
|
||||
|
4
disas.c
4
disas.c
@ -176,7 +176,7 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)
|
||||
print_insn = print_insn_sparc;
|
||||
#ifdef TARGET_SPARC64
|
||||
disasm_info.mach = bfd_mach_sparc_v9b;
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(TARGET_PPC)
|
||||
if (flags)
|
||||
disasm_info.endian = BFD_ENDIAN_LITTLE;
|
||||
@ -298,7 +298,7 @@ const char *lookup_symbol(target_ulong orig_addr)
|
||||
Elf32_Sym *sym;
|
||||
struct syminfo *s;
|
||||
target_ulong addr;
|
||||
|
||||
|
||||
for (s = syminfos; s; s = s->next) {
|
||||
sym = s->disas_symtab;
|
||||
for (i = 0; i < s->disas_num_syms; i++) {
|
||||
|
86
dyngen.c
86
dyngen.c
@ -375,7 +375,7 @@ int elf_must_swap(struct elfhdr *h)
|
||||
return (h->e_ident[EI_DATA] == ELFDATA2MSB) !=
|
||||
(swaptest.b[0] == 0);
|
||||
}
|
||||
|
||||
|
||||
void elf_swap_ehdr(struct elfhdr *h)
|
||||
{
|
||||
swab16s(&h->e_type); /* Object file type */
|
||||
@ -483,11 +483,11 @@ int load_object(const char *filename)
|
||||
ElfW(Sym) *sym;
|
||||
char *shstr;
|
||||
ELF_RELOC *rel;
|
||||
|
||||
|
||||
fd = open(filename, O_RDONLY);
|
||||
if (fd < 0)
|
||||
error("can't open file '%s'", filename);
|
||||
|
||||
|
||||
/* Read ELF header. */
|
||||
if (read(fd, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
error("unable to read file header");
|
||||
@ -524,7 +524,7 @@ int load_object(const char *filename)
|
||||
/* read all section data */
|
||||
sdata = malloc(sizeof(void *) * ehdr.e_shnum);
|
||||
memset(sdata, 0, sizeof(void *) * ehdr.e_shnum);
|
||||
|
||||
|
||||
for(i = 0;i < ehdr.e_shnum; i++) {
|
||||
sec = &shdr[i];
|
||||
if (sec->sh_type != SHT_NOBITS)
|
||||
@ -569,7 +569,7 @@ int load_object(const char *filename)
|
||||
|
||||
symtab = (ElfW(Sym) *)sdata[symtab_sec - shdr];
|
||||
strtab = (char *)sdata[symtab_sec->sh_link];
|
||||
|
||||
|
||||
nb_syms = symtab_sec->sh_size / sizeof(ElfW(Sym));
|
||||
if (do_swap) {
|
||||
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;
|
||||
int c, i, len;
|
||||
|
||||
|
||||
if (ext_sym->e.e.e_zeroes != 0) {
|
||||
q = sym->st_name;
|
||||
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 &&
|
||||
text_data >= sym->st_value &&
|
||||
text_data < sym->st_value + sym->st_size) {
|
||||
|
||||
|
||||
return sym->st_name;
|
||||
|
||||
}
|
||||
@ -709,7 +709,7 @@ int load_object(const char *filename)
|
||||
);
|
||||
if (fd < 0)
|
||||
error("can't open file '%s'", filename);
|
||||
|
||||
|
||||
/* Read COFF header. */
|
||||
if (read(fd, &fhdr, sizeof (fhdr)) != sizeof (fhdr))
|
||||
error("unable to read file header");
|
||||
@ -726,7 +726,7 @@ int load_object(const char *filename)
|
||||
/* read all section data */
|
||||
sdata = malloc(sizeof(void *) * fhdr.f_nscns);
|
||||
memset(sdata, 0, sizeof(void *) * fhdr.f_nscns);
|
||||
|
||||
|
||||
const char *p;
|
||||
for(i = 0;i < fhdr.f_nscns; i++) {
|
||||
sec = &shdr[i];
|
||||
@ -747,7 +747,7 @@ int load_object(const char *filename)
|
||||
if (!data_sec)
|
||||
error("could not find .data section");
|
||||
coff_data_shndx = data_sec - shdr;
|
||||
|
||||
|
||||
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;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);
|
||||
strtab = load_data(fd, (fhdr.f_symptr + fhdr.f_nsyms*SYMESZ), *n_strtab);
|
||||
|
||||
|
||||
nb_syms = fhdr.f_nsyms;
|
||||
|
||||
for (i = 0, ext_sym = coff_symtab; i < nb_syms; i++, ext_sym++) {
|
||||
@ -805,12 +805,12 @@ int load_object(const char *filename)
|
||||
} else {
|
||||
sym->st_size = 0;
|
||||
}
|
||||
|
||||
|
||||
sym->st_type = ext_sym->e_type;
|
||||
sym->st_shndx = ext_sym->e_scnum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* find text relocations, if any */
|
||||
sec = &shdr[coff_text_shndx];
|
||||
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 */
|
||||
return "debug";
|
||||
|
||||
|
||||
if(!name)
|
||||
return name;
|
||||
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;
|
||||
const char *name = 0;
|
||||
|
||||
|
||||
/* Sanity check */
|
||||
if(!( address >= sec_hdr->addr && address < (sec_hdr->addr + sec_hdr->size) ) )
|
||||
return (char*)0;
|
||||
|
||||
|
||||
if( sec_hdr->flags & S_SYMBOL_STUBS ){
|
||||
size = sec_hdr->reserved2;
|
||||
if(size == 0)
|
||||
error("size = 0");
|
||||
|
||||
|
||||
}
|
||||
else if( sec_hdr->flags & S_LAZY_SYMBOL_POINTERS ||
|
||||
sec_hdr->flags & S_NON_LAZY_SYMBOL_POINTERS)
|
||||
size = sizeof(unsigned long);
|
||||
else
|
||||
return 0;
|
||||
|
||||
|
||||
/* Compute our index in toc */
|
||||
tocindex = (address - sec_hdr->addr)/size;
|
||||
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 */
|
||||
sectoffset = *(uint32_t *)(text + rel->r_address) & 0xffff;
|
||||
|
||||
|
||||
if(sectnum==0xffffff)
|
||||
return 0;
|
||||
|
||||
@ -1041,7 +1041,7 @@ static const char * get_reloc_name(EXE_RELOC * rel, int * sslide)
|
||||
|
||||
if(rel->r_pcrel)
|
||||
sectoffset += rel->r_address;
|
||||
|
||||
|
||||
if (rel->r_type == PPC_RELOC_BR24)
|
||||
name = (char *)find_reloc_name_in_sec_ptr((int)sectoffset, §ion_hdr[sectnum-1]);
|
||||
|
||||
@ -1080,11 +1080,11 @@ int load_object(const char *filename)
|
||||
unsigned int i, j;
|
||||
EXE_SYM *sym;
|
||||
struct nlist *syment;
|
||||
|
||||
|
||||
fd = open(filename, O_RDONLY);
|
||||
if (fd < 0)
|
||||
error("can't open file '%s'", filename);
|
||||
|
||||
|
||||
/* Read Mach header. */
|
||||
if (read(fd, &mach_hdr, sizeof (mach_hdr)) != sizeof (mach_hdr))
|
||||
error("unable to read file header");
|
||||
@ -1093,13 +1093,13 @@ int load_object(const char *filename)
|
||||
if (!check_mach_header(mach_hdr)) {
|
||||
error("bad Mach header");
|
||||
}
|
||||
|
||||
|
||||
if (mach_hdr.cputype != CPU_TYPE_POWERPC)
|
||||
error("Unsupported CPU");
|
||||
|
||||
|
||||
if (mach_hdr.filetype != MH_OBJECT)
|
||||
error("Unsupported Mach Object");
|
||||
|
||||
|
||||
/* read segment headers */
|
||||
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 */
|
||||
sdata = (uint8_t **)malloc(sizeof(void *) * segment->nsects);
|
||||
memset(sdata, 0, sizeof(void *) * segment->nsects);
|
||||
|
||||
|
||||
/* Load the data in section data */
|
||||
for(i = 0; i < segment->nsects; i++) {
|
||||
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 */
|
||||
if(!(int)dysymtabcmd)
|
||||
error("could not find __DYSYMTAB segment");
|
||||
|
||||
|
||||
/* read the table of content of the indirect sym */
|
||||
tocdylib = load_data( fd, dysymtabcmd->indirectsymoff, dysymtabcmd->nindirectsyms * sizeof(uint32_t) );
|
||||
|
||||
|
||||
/* Make sure symtab was loaded */
|
||||
if(!(int)symtabcmd)
|
||||
error("could not find __SYMTAB segment");
|
||||
@ -1178,12 +1178,12 @@ int load_object(const char *filename)
|
||||
struct nlist *sym_follow, *sym_next = 0;
|
||||
unsigned int j;
|
||||
memset(sym, 0, sizeof(*sym));
|
||||
|
||||
|
||||
if ( syment->n_type & N_STAB ) /* Debug symbols are skipped */
|
||||
continue;
|
||||
|
||||
|
||||
memcpy(sym, syment, sizeof(*syment));
|
||||
|
||||
|
||||
/* 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++) {
|
||||
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];
|
||||
unsigned int data_index;
|
||||
int type;
|
||||
|
||||
|
||||
memset(data_allocated, 0, sizeof(data_allocated));
|
||||
|
||||
|
||||
p = p_start;
|
||||
min_offset = p_end - p_start;
|
||||
spare = 0x7fffffff;
|
||||
@ -1478,7 +1478,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
|
||||
}
|
||||
copy_size = len;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(HOST_PPC)
|
||||
{
|
||||
uint8_t *p;
|
||||
@ -1510,7 +1510,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
|
||||
#endif
|
||||
if (get32((uint32_t *)p) != 0x6bfa8001)
|
||||
error("ret expected at the end of %s", name);
|
||||
copy_size = p - p_start;
|
||||
copy_size = p - p_start;
|
||||
}
|
||||
#elif defined(HOST_IA64)
|
||||
{
|
||||
@ -1611,14 +1611,14 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
|
||||
} else {
|
||||
error("No save at the beginning of %s", name);
|
||||
}
|
||||
|
||||
|
||||
/* Skip a preceeding nop, if present. */
|
||||
if (p > p_start) {
|
||||
skip_insn = get32((uint32_t *)(p - 0x4));
|
||||
if (skip_insn == 0x01000000)
|
||||
p -= 4;
|
||||
}
|
||||
|
||||
|
||||
copy_size = p - p_start;
|
||||
}
|
||||
#elif defined(HOST_ARM)
|
||||
@ -1700,7 +1700,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nb_args = 0;
|
||||
while (nb_args < MAX_ARGS && args_present[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)) {
|
||||
uint8_t *ptr;
|
||||
unsigned long offset;
|
||||
|
||||
|
||||
/* test if the variable refers to a label inside
|
||||
the code we are generating */
|
||||
#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) {
|
||||
n = strtol(p, NULL, 10);
|
||||
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);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
get_reloc_expr(relname, sizeof(relname), sym_name);
|
||||
type = ELF32_R_TYPE(rel->r_info);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
/* generate big code generation switch */
|
||||
|
||||
@ -2695,7 +2695,7 @@ fprintf(outfile,
|
||||
eliminating the neeed to jump around the pool.
|
||||
|
||||
We currently generate:
|
||||
|
||||
|
||||
[ 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
|
||||
limits are reached. ]
|
||||
|
6
dyngen.h
6
dyngen.h
@ -51,7 +51,7 @@ static void inline flush_icache_range(unsigned long start, unsigned long stop)
|
||||
|
||||
start &= ~(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) {
|
||||
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);
|
||||
gen_code_ptr += 4;
|
||||
}
|
||||
|
||||
|
||||
/* copy the data */
|
||||
data_ptr = gen_code_ptr;
|
||||
memcpy(gen_code_ptr, data_start, data_size);
|
||||
gen_code_ptr += data_size;
|
||||
|
||||
|
||||
/* patch the ldr to point to the data */
|
||||
for(le = ldr_start; le < ldr_end; le++) {
|
||||
ptr = (uint32_t *)le->ptr;
|
||||
|
@ -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);
|
||||
if (!shdr_table)
|
||||
return -1;
|
||||
|
||||
|
||||
if (must_swab) {
|
||||
for (i = 0; i < ehdr->e_shnum; i++) {
|
||||
glue(bswap_shdr, SZ)(shdr_table + i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
symtab = glue(find_section, SZ)(shdr_table, ehdr->e_shnum, SHT_SYMTAB);
|
||||
if (!symtab)
|
||||
goto fail;
|
||||
@ -176,7 +176,7 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend,
|
||||
glue(bswap_phdr, SZ)(ph);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
total_size = 0;
|
||||
for(i = 0; i < ehdr.e_phnum; i++) {
|
||||
ph = &phdr[i];
|
||||
|
10
exec-all.h
10
exec-all.h
@ -68,7 +68,7 @@ typedef void (GenOpFunc)(void);
|
||||
typedef void (GenOpFunc1)(long);
|
||||
typedef void (GenOpFunc2)(long, long);
|
||||
typedef void (GenOpFunc3)(long, long, long);
|
||||
|
||||
|
||||
#if defined(TARGET_I386)
|
||||
|
||||
void optimize_flags_init(void);
|
||||
@ -287,7 +287,7 @@ static inline void tb_add_jump(TranslationBlock *tb, int n,
|
||||
if (!tb->jmp_next[n]) {
|
||||
/* patch the native jump address */
|
||||
tb_set_jmp_target(tb, n, (unsigned long)tb_next->tc_ptr);
|
||||
|
||||
|
||||
/* add in TB jmp circular list */
|
||||
tb->jmp_next[n] = tb_next->jmp_first;
|
||||
tb_next->jmp_first = (TranslationBlock *)((long)(tb) | (n));
|
||||
@ -398,7 +398,7 @@ static inline int testandset (int *p)
|
||||
static inline int testandset (int *p)
|
||||
{
|
||||
long int readval = 0;
|
||||
|
||||
|
||||
__asm__ __volatile__ ("lock; cmpxchgl %2, %0"
|
||||
: "+m" (*p), "+a" (readval)
|
||||
: "r" (1)
|
||||
@ -409,7 +409,7 @@ static inline int testandset (int *p)
|
||||
static inline int testandset (int *p)
|
||||
{
|
||||
long int readval = 0;
|
||||
|
||||
|
||||
__asm__ __volatile__ ("lock; cmpxchgl %2, %0"
|
||||
: "+m" (*p), "+a" (readval)
|
||||
: "r" (1)
|
||||
@ -464,7 +464,7 @@ static inline int testandset (int *spinlock)
|
||||
__asm__ __volatile__("swp %0, %1, [%2]"
|
||||
: "=r"(ret)
|
||||
: "0"(1), "r"(spinlock));
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
#elif defined(__mc68000)
|
||||
|
56
exec.c
56
exec.c
@ -175,10 +175,10 @@ static void page_init(void)
|
||||
{
|
||||
SYSTEM_INFO system_info;
|
||||
DWORD old_protect;
|
||||
|
||||
|
||||
GetSystemInfo(&system_info);
|
||||
qemu_real_host_page_size = system_info.dwPageSize;
|
||||
|
||||
|
||||
VirtualProtect(code_gen_buffer, sizeof(code_gen_buffer),
|
||||
PAGE_EXECUTE_READWRITE, &old_protect);
|
||||
}
|
||||
@ -189,11 +189,11 @@ static void page_init(void)
|
||||
|
||||
start = (unsigned long)code_gen_buffer;
|
||||
start &= ~(qemu_real_host_page_size - 1);
|
||||
|
||||
|
||||
end = (unsigned long)code_gen_buffer + sizeof(code_gen_buffer);
|
||||
end += qemu_real_host_page_size - 1;
|
||||
end &= ~(qemu_real_host_page_size - 1);
|
||||
|
||||
|
||||
mprotect((void *)start, end - start,
|
||||
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);
|
||||
#endif
|
||||
nb_tbs = 0;
|
||||
|
||||
|
||||
for(env = first_cpu; env != NULL; env = env->next_cpu) {
|
||||
memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *));
|
||||
}
|
||||
@ -382,7 +382,7 @@ static void tb_page_check(void)
|
||||
{
|
||||
TranslationBlock *tb;
|
||||
int i, flags1, flags2;
|
||||
|
||||
|
||||
for(i = 0;i < CODE_GEN_PHYS_HASH_SIZE; i++) {
|
||||
for(tb = tb_phys_hash[i]; tb != NULL; tb = tb->phys_hash_next) {
|
||||
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;
|
||||
target_ulong phys_pc;
|
||||
TranslationBlock *tb1, *tb2;
|
||||
|
||||
|
||||
/* remove the TB from the hash list */
|
||||
phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK);
|
||||
h = tb_phys_hash_func(phys_pc);
|
||||
@ -571,7 +571,7 @@ static void build_page_bitmap(PageDesc *p)
|
||||
{
|
||||
int n, tb_start, tb_end;
|
||||
TranslationBlock *tb;
|
||||
|
||||
|
||||
p->code_bitmap = qemu_malloc(TARGET_PAGE_SIZE / 8);
|
||||
if (!p->code_bitmap)
|
||||
return;
|
||||
@ -624,7 +624,7 @@ static void tb_gen_code(CPUState *env,
|
||||
tb->cflags = cflags;
|
||||
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));
|
||||
|
||||
|
||||
/* check next page if needed */
|
||||
virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;
|
||||
phys_page2 = -1;
|
||||
@ -634,7 +634,7 @@ static void tb_gen_code(CPUState *env,
|
||||
tb_link_phys(tb, phys_pc, phys_page2);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* invalidate all TBs which intersect with the target physical page
|
||||
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
|
||||
@ -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
|
||||
would require a specialized function to partially
|
||||
restore the CPU state */
|
||||
|
||||
|
||||
current_tb_modified = 1;
|
||||
cpu_restore_state(current_tb, env,
|
||||
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
|
||||
would require a specialized function to partially
|
||||
restore the CPU state */
|
||||
|
||||
|
||||
current_tb_modified = 1;
|
||||
cpu_restore_state(current_tb, env, pc, puc);
|
||||
#if defined(TARGET_I386)
|
||||
@ -1024,7 +1024,7 @@ static inline void tb_reset_jump_recursive2(TranslationBlock *tb, int n)
|
||||
}
|
||||
*ptb = tb->jmp_next[n];
|
||||
tb->jmp_next[n] = NULL;
|
||||
|
||||
|
||||
/* suppress the jump to next tb in generated code */
|
||||
tb_reset_jump(tb, n);
|
||||
|
||||
@ -1103,7 +1103,7 @@ int cpu_breakpoint_insert(CPUState *env, target_ulong pc)
|
||||
{
|
||||
#if defined(TARGET_HAS_ICE)
|
||||
int i;
|
||||
|
||||
|
||||
for(i = 0; i < env->nb_breakpoints; i++) {
|
||||
if (env->breakpoints[i] == pc)
|
||||
return 0;
|
||||
@ -1112,7 +1112,7 @@ int cpu_breakpoint_insert(CPUState *env, target_ulong pc)
|
||||
if (env->nb_breakpoints >= MAX_BREAKPOINTS)
|
||||
return -1;
|
||||
env->breakpoints[env->nb_breakpoints++] = pc;
|
||||
|
||||
|
||||
breakpoint_invalidate(env, pc);
|
||||
return 0;
|
||||
#else
|
||||
@ -1249,7 +1249,7 @@ static int cmp1(const char *s1, int n, const char *s2)
|
||||
return 0;
|
||||
return memcmp(s1, s2, n) == 0;
|
||||
}
|
||||
|
||||
|
||||
/* takes a comma separated list of log masks. Return 0 if error. */
|
||||
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
|
||||
original mapping */
|
||||
VirtPageDesc *vp;
|
||||
|
||||
|
||||
vp = virt_page_find_alloc(vaddr >> TARGET_PAGE_BITS, 1);
|
||||
vp->phys_addr = pd;
|
||||
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
|
||||
reset the modified entries */
|
||||
/* XXX: slow ! */
|
||||
@ -2492,7 +2492,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
|
||||
target_phys_addr_t page;
|
||||
unsigned long pd;
|
||||
PhysPageDesc *p;
|
||||
|
||||
|
||||
while (len > 0) {
|
||||
page = addr & TARGET_PAGE_MASK;
|
||||
l = (page + TARGET_PAGE_SIZE) - addr;
|
||||
@ -2504,7 +2504,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
|
||||
} else {
|
||||
pd = p->phys_offset;
|
||||
}
|
||||
|
||||
|
||||
if (is_write) {
|
||||
if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
|
||||
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;
|
||||
unsigned long pd;
|
||||
PhysPageDesc *p;
|
||||
|
||||
|
||||
while (len > 0) {
|
||||
page = addr & TARGET_PAGE_MASK;
|
||||
l = (page + TARGET_PAGE_SIZE) - addr;
|
||||
@ -2595,7 +2595,7 @@ void cpu_physical_memory_write_rom(target_phys_addr_t addr,
|
||||
} else {
|
||||
pd = p->phys_offset;
|
||||
}
|
||||
|
||||
|
||||
if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM &&
|
||||
(pd & ~TARGET_PAGE_MASK) != IO_MEM_ROM &&
|
||||
!(pd & IO_MEM_ROMD)) {
|
||||
@ -2629,7 +2629,7 @@ uint32_t ldl_phys(target_phys_addr_t addr)
|
||||
} else {
|
||||
pd = p->phys_offset;
|
||||
}
|
||||
|
||||
|
||||
if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM &&
|
||||
!(pd & IO_MEM_ROMD)) {
|
||||
/* I/O case */
|
||||
@ -2659,7 +2659,7 @@ uint64_t ldq_phys(target_phys_addr_t addr)
|
||||
} else {
|
||||
pd = p->phys_offset;
|
||||
}
|
||||
|
||||
|
||||
if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM &&
|
||||
!(pd & IO_MEM_ROMD)) {
|
||||
/* I/O case */
|
||||
@ -2712,7 +2712,7 @@ void stl_phys_notdirty(target_phys_addr_t addr, uint32_t val)
|
||||
} else {
|
||||
pd = p->phys_offset;
|
||||
}
|
||||
|
||||
|
||||
if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
|
||||
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
|
||||
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 {
|
||||
pd = p->phys_offset;
|
||||
}
|
||||
|
||||
|
||||
if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
|
||||
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
|
||||
#ifdef TARGET_WORDS_BIGENDIAN
|
||||
@ -2767,7 +2767,7 @@ void stl_phys(target_phys_addr_t addr, uint32_t val)
|
||||
} else {
|
||||
pd = p->phys_offset;
|
||||
}
|
||||
|
||||
|
||||
if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
|
||||
io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
|
||||
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 direct_jmp_count, direct_jmp2_count, cross_page;
|
||||
TranslationBlock *tb;
|
||||
|
||||
|
||||
target_code_size = 0;
|
||||
max_target_code_size = 0;
|
||||
cross_page = 0;
|
||||
|
@ -252,7 +252,7 @@ static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf)
|
||||
registers[41] = 0; /* foseg */
|
||||
registers[42] = 0; /* fooff */
|
||||
registers[43] = 0; /* fop */
|
||||
|
||||
|
||||
for(i = 0; i < 16; i++)
|
||||
tswapls(®isters[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];
|
||||
uint32_t *registers;
|
||||
target_ulong addr, len;
|
||||
|
||||
|
||||
#ifdef DEBUG_GDB
|
||||
printf("command='%s'\n", line_buf);
|
||||
#endif
|
||||
@ -1201,7 +1201,7 @@ static void gdb_accept(void *opaque)
|
||||
/* set short latency */
|
||||
val = 1;
|
||||
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val));
|
||||
|
||||
|
||||
s = &gdbserver_state;
|
||||
memset (s, 0, sizeof (GDBState));
|
||||
s->env = first_cpu; /* XXX: allow to change CPU */
|
||||
|
@ -87,7 +87,7 @@ static void pm_update_sci(PIIX4PMState *s)
|
||||
{
|
||||
int sci_level, pmsts;
|
||||
int64_t expire_time;
|
||||
|
||||
|
||||
pmsts = get_pmsts(s);
|
||||
sci_level = (((pmsts & s->pmen) &
|
||||
(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;
|
||||
uint32_t val;
|
||||
|
||||
|
||||
addr &= 1;
|
||||
if (addr == 0) {
|
||||
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[0x0e] = 0x00; // header_type
|
||||
pci_conf[0x3d] = 0x01; // interrupt pin 1
|
||||
|
||||
|
||||
pci_conf[0x40] = 0x01; /* PM io base read only bit */
|
||||
|
||||
|
||||
register_ioport_write(0xb2, 2, 1, pm_smi_writeb, s);
|
||||
register_ioport_read(0xb2, 2, 1, pm_smi_readb, s);
|
||||
|
||||
|
14
hw/adb.c
14
hw/adb.c
@ -299,31 +299,31 @@ static int adb_mouse_poll(ADBDevice *d, uint8_t *obuf)
|
||||
if (s->last_buttons_state == s->buttons_state &&
|
||||
s->dx == 0 && s->dy == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
dx = s->dx;
|
||||
if (dx < -63)
|
||||
dx = -63;
|
||||
else if (dx > 63)
|
||||
dx = 63;
|
||||
|
||||
|
||||
dy = s->dy;
|
||||
if (dy < -63)
|
||||
dy = -63;
|
||||
else if (dy > 63)
|
||||
dy = 63;
|
||||
|
||||
|
||||
s->dx -= dx;
|
||||
s->dy -= dy;
|
||||
s->last_buttons_state = s->buttons_state;
|
||||
|
||||
|
||||
dx &= 0x7f;
|
||||
dy &= 0x7f;
|
||||
|
||||
|
||||
if (!(s->buttons_state & MOUSE_EVENT_LBUTTON))
|
||||
dy |= 0x80;
|
||||
if (!(s->buttons_state & MOUSE_EVENT_RBUTTON))
|
||||
dx |= 0x80;
|
||||
|
||||
|
||||
obuf[0] = dy;
|
||||
obuf[1] = dx;
|
||||
return 2;
|
||||
@ -334,7 +334,7 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *obuf,
|
||||
{
|
||||
MouseState *s = d->opaque;
|
||||
int cmd, reg, olen;
|
||||
|
||||
|
||||
if ((buf[0] & 0x0f) == ADB_FLUSH) {
|
||||
/* flush mouse fifo */
|
||||
s->buttons_state = s->last_buttons_state;
|
||||
|
@ -937,7 +937,7 @@ static int paddr_from_pte (uint64_t *paddr, int *zbitsp, int *prot,
|
||||
}
|
||||
}
|
||||
*paddr = (pfn << page_bits) | (vaddr & page_mask);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
12
hw/apic.c
12
hw/apic.c
@ -222,7 +222,7 @@ static void apic_bus_deliver(const uint32_t *deliver_bitmask,
|
||||
foreach_apic(apic_iter, deliver_bitmask,
|
||||
apic_init_ipi(apic_iter) );
|
||||
return;
|
||||
|
||||
|
||||
case APIC_DM_EXTINT:
|
||||
/* handled in I/O APIC code */
|
||||
break;
|
||||
@ -471,7 +471,7 @@ int apic_get_interrupt(CPUState *env)
|
||||
return -1;
|
||||
if (!(s->spurious_vec & APIC_SV_ENABLE))
|
||||
return -1;
|
||||
|
||||
|
||||
/* XXX: spurious IRQ handling */
|
||||
intno = get_highest_priority_int(s->irr);
|
||||
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)
|
||||
{
|
||||
int64_t next_time, d;
|
||||
|
||||
|
||||
if (!(s->lvt[APIC_LVT_TIMER] & APIC_LVT_MASKED)) {
|
||||
d = (current_time - s->initial_count_load_time) >>
|
||||
s->count_shift;
|
||||
@ -834,7 +834,7 @@ int apic_init(CPUState *env)
|
||||
|
||||
register_savevm("apic", s->id, 2, apic_save, apic_load, s);
|
||||
qemu_register_reset(apic_reset, s);
|
||||
|
||||
|
||||
local_apics[s->id] = s;
|
||||
return 0;
|
||||
}
|
||||
@ -868,7 +868,7 @@ static void ioapic_service(IOAPICState *s)
|
||||
vector = pic_read_irq(isa_pic);
|
||||
else
|
||||
vector = entry & 0xff;
|
||||
|
||||
|
||||
apic_get_delivery_bitmask(deliver_bitmask, dest, dest_mode);
|
||||
apic_bus_deliver(deliver_bitmask, delivery_mode,
|
||||
vector, polarity, trig_mode);
|
||||
@ -1042,6 +1042,6 @@ IOAPICState *ioapic_init(void)
|
||||
|
||||
register_savevm("ioapic", 0, 1, ioapic_save, ioapic_load, s);
|
||||
qemu_register_reset(ioapic_reset, s);
|
||||
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ int cdrom_read_toc(int nb_sectors, uint8_t *buf, int msf, int start_track)
|
||||
{
|
||||
uint8_t *q;
|
||||
int len;
|
||||
|
||||
|
||||
if (start_track > 1 && start_track != 0xaa)
|
||||
return -1;
|
||||
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;
|
||||
int len;
|
||||
|
||||
|
||||
q = buf + 2;
|
||||
*q++ = 1; /* first 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++ = 0x00; /* disk type */
|
||||
*q++ = 0x00;
|
||||
|
||||
|
||||
*q++ = 1; /* session number */
|
||||
*q++ = 0x14; /* data track */
|
||||
*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++ = 0x00;
|
||||
*q++ = 0x00;
|
||||
|
||||
|
||||
*q++ = 1; /* session number */
|
||||
*q++ = 0x14; /* data track */
|
||||
*q++ = 0; /* track number */
|
||||
|
@ -275,7 +275,7 @@ typedef struct PCICirrusVGAState {
|
||||
} PCICirrusVGAState;
|
||||
|
||||
static uint8_t rop_to_index[256];
|
||||
|
||||
|
||||
/***************************************
|
||||
*
|
||||
* prototypes.
|
||||
@ -788,7 +788,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s)
|
||||
{
|
||||
int copy_count;
|
||||
uint8_t *end_ptr;
|
||||
|
||||
|
||||
if (s->cirrus_srccounter > 0) {
|
||||
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) {
|
||||
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)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
|
||||
width = (s->cr[0x01] + 1) * 8;
|
||||
height = s->cr[0x12] |
|
||||
((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) {
|
||||
|
||||
invalidate_cursor1(s);
|
||||
|
||||
|
||||
s->last_hw_cursor_size = size;
|
||||
s->last_hw_cursor_x = s->hw_cursor_x;
|
||||
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;
|
||||
const uint8_t *palette, *src;
|
||||
uint32_t content;
|
||||
|
||||
|
||||
if (!(s->sr[0x12] & CIRRUS_CURSOR_SHOW))
|
||||
return;
|
||||
/* 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 ||
|
||||
scr_y >= (s->hw_cursor_y + h))
|
||||
return;
|
||||
|
||||
|
||||
src = s->vram_ptr + s->real_vram_size - 16 * 1024;
|
||||
if (s->sr[0x12] & CIRRUS_CURSOR_LARGE) {
|
||||
src += (s->sr[0x13] & 0x3c) * 256;
|
||||
@ -2379,7 +2379,7 @@ static void cirrus_linear_writeb(void *opaque, target_phys_addr_t addr,
|
||||
unsigned mode;
|
||||
|
||||
addr &= s->cirrus_addr_mask;
|
||||
|
||||
|
||||
if (((s->sr[0x17] & 0x44) == 0x44) &&
|
||||
((addr & s->linear_mmio_mask) == s->linear_mmio_mask)) {
|
||||
/* memory-mapped I/O */
|
||||
@ -2600,7 +2600,7 @@ static void cirrus_update_memory_access(CirrusVGAState *s)
|
||||
} else if (s->gr[0x0B] & 0x02) {
|
||||
goto generic_io;
|
||||
}
|
||||
|
||||
|
||||
mode = s->gr[0x05] & 0x7;
|
||||
if (mode < 4 || mode > 5 || ((s->gr[0x0B] & 0x4) == 0)) {
|
||||
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;
|
||||
|
||||
s = qemu_mallocz(sizeof(CirrusVGAState));
|
||||
|
||||
|
||||
vga_common_init((VGAState *)s,
|
||||
ds, vga_ram_base, vga_ram_offset, vga_ram_size);
|
||||
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;
|
||||
CirrusVGAState *s;
|
||||
int device_id;
|
||||
|
||||
|
||||
device_id = CIRRUS_ID_CLGD5446;
|
||||
|
||||
/* setup PCI configuration registers */
|
||||
|
@ -34,7 +34,7 @@
|
||||
#define PUTPIXEL() ROP_OP(((uint32_t *)d)[0], col)
|
||||
#else
|
||||
#error unsupported DEPTH
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void
|
||||
glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
|
||||
|
@ -116,10 +116,10 @@ typedef struct CUDAState {
|
||||
uint8_t anh; /* A-side data, no handshake */
|
||||
|
||||
CUDATimer timers[2];
|
||||
|
||||
|
||||
uint8_t last_b; /* last value of B register */
|
||||
uint8_t last_acr; /* last value of B register */
|
||||
|
||||
|
||||
int data_in_size;
|
||||
int data_in_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 = (s->latch - counter) & 0xffff;
|
||||
}
|
||||
|
||||
|
||||
/* Note: we consider the irq is raised on 0 */
|
||||
if (counter == 0xffff) {
|
||||
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)
|
||||
{
|
||||
CUDAState *s = opaque;
|
||||
|
||||
|
||||
addr = (addr >> 9) & 0xf;
|
||||
#ifdef DEBUG_CUDA
|
||||
printf("cuda: write: reg=0x%x val=%02x\n", addr, val);
|
||||
|
2
hw/esp.c
2
hw/esp.c
@ -531,7 +531,7 @@ static void esp_save(QEMUFile *f, void *opaque)
|
||||
static int esp_load(QEMUFile *f, void *opaque, int version_id)
|
||||
{
|
||||
ESPState *s = opaque;
|
||||
|
||||
|
||||
if (version_id != 3)
|
||||
return -EINVAL; // Cannot emulate 2
|
||||
|
||||
|
@ -118,12 +118,12 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic)
|
||||
d->config[0x1a] = 0x00; // subordinate_bus
|
||||
d->config[0x1c] = 0x00;
|
||||
d->config[0x1d] = 0x00;
|
||||
|
||||
|
||||
d->config[0x20] = 0x00; // memory_base
|
||||
d->config[0x21] = 0x00;
|
||||
d->config[0x22] = 0x01; // memory_limit
|
||||
d->config[0x23] = 0x00;
|
||||
|
||||
|
||||
d->config[0x24] = 0x00; // prefetchable_memory_base
|
||||
d->config[0x25] = 0x00;
|
||||
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[0x1c] = 0x10; // io_base
|
||||
d->config[0x1d] = 0x20; // io_limit
|
||||
|
||||
|
||||
d->config[0x20] = 0x80; // memory_base
|
||||
d->config[0x21] = 0x80;
|
||||
d->config[0x22] = 0x90; // memory_limit
|
||||
d->config[0x23] = 0x80;
|
||||
|
||||
|
||||
d->config[0x24] = 0x00; // prefetchable_memory_base
|
||||
d->config[0x25] = 0x84;
|
||||
d->config[0x26] = 0x00; // prefetchable_memory_limit
|
||||
|
@ -287,10 +287,10 @@ static void gt64120_pci_mapping(GT64120State *s)
|
||||
/* Update IO mapping */
|
||||
if ((s->regs[GT_PCI0IOLD] & 0x7f) <= s->regs[GT_PCI0IOHD])
|
||||
{
|
||||
/* Unmap old IO address */
|
||||
/* Unmap old IO address */
|
||||
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 */
|
||||
s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21;
|
||||
|
@ -88,7 +88,7 @@ static uint32_t pic_readl (void *opaque, target_phys_addr_t addr)
|
||||
HeathrowPIC *pic;
|
||||
unsigned int n;
|
||||
uint32_t value;
|
||||
|
||||
|
||||
n = ((addr & 0xfff) - 0x10) >> 4;
|
||||
if (n >= 2) {
|
||||
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)
|
||||
{
|
||||
HeathrowPICS *s;
|
||||
|
||||
|
||||
s = qemu_mallocz(sizeof(HeathrowPICS));
|
||||
s->pics[0].level_triggered = 0;
|
||||
s->pics[1].level_triggered = 0x1ff00000;
|
||||
|
@ -309,7 +309,7 @@ static uint32_t pit_ioport_read(void *opaque, uint32_t addr)
|
||||
PITState *pit = opaque;
|
||||
int ret, count;
|
||||
PITChannelState *s;
|
||||
|
||||
|
||||
addr &= 3;
|
||||
s = &pit->channels[addr];
|
||||
if (s->status_latched) {
|
||||
@ -391,7 +391,7 @@ static void pit_save(QEMUFile *f, void *opaque)
|
||||
PITState *pit = opaque;
|
||||
PITChannelState *s;
|
||||
int i;
|
||||
|
||||
|
||||
for(i = 0; i < 3; i++) {
|
||||
s = &pit->channels[i];
|
||||
qemu_put_be32s(f, &s->count);
|
||||
@ -419,7 +419,7 @@ static int pit_load(QEMUFile *f, void *opaque, int version_id)
|
||||
PITState *pit = opaque;
|
||||
PITChannelState *s;
|
||||
int i;
|
||||
|
||||
|
||||
if (version_id != 1)
|
||||
return -EINVAL;
|
||||
|
||||
|
12
hw/i8259.c
12
hw/i8259.c
@ -155,7 +155,7 @@ void pic_update_irq(PicState2 *s)
|
||||
printf("pic%d: imr=%x irr=%x padd=%d\n",
|
||||
i, s->pics[i].imr, s->pics[i].irr,
|
||||
s->pics[i].priority_add);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
printf("pic: cpu_interrupt\n");
|
||||
@ -243,7 +243,7 @@ int pic_read_irq(PicState2 *s)
|
||||
intno = s->pics[0].irq_base + irq;
|
||||
}
|
||||
pic_update_irq(s);
|
||||
|
||||
|
||||
#ifdef DEBUG_IRQ_LATENCY
|
||||
printf("IRQ%d latency=%0.3fus\n",
|
||||
irq,
|
||||
@ -429,7 +429,7 @@ uint32_t pic_intack_read(PicState2 *s)
|
||||
ret = pic_poll_read(&s->pics[1], 0x80) + 8;
|
||||
/* Prepare for ISR read */
|
||||
s->pics[0].read_reg_select = 1;
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
PicState *s = opaque;
|
||||
|
||||
|
||||
qemu_put_8s(f, &s->last_irr);
|
||||
qemu_put_8s(f, &s->irr);
|
||||
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)
|
||||
{
|
||||
PicState *s = opaque;
|
||||
|
||||
|
||||
if (version_id != 1)
|
||||
return -EINVAL;
|
||||
|
||||
@ -510,7 +510,7 @@ void pic_info(void)
|
||||
{
|
||||
int i;
|
||||
PicState *s;
|
||||
|
||||
|
||||
if (!isa_pic)
|
||||
return;
|
||||
|
||||
|
28
hw/ide.c
28
hw/ide.c
@ -392,7 +392,7 @@ typedef struct BMDMAState {
|
||||
uint8_t cmd;
|
||||
uint8_t status;
|
||||
uint32_t addr;
|
||||
|
||||
|
||||
struct PCIIDEState *pci_dev;
|
||||
/* current transfer state */
|
||||
uint32_t cur_addr;
|
||||
@ -469,7 +469,7 @@ static void ide_identify(IDEState *s)
|
||||
put_le16(p + 22, 4); /* ecc bytes */
|
||||
padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */
|
||||
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);
|
||||
#endif
|
||||
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_set_sector(s, sector_num + n);
|
||||
|
||||
|
||||
bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n,
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
s->io_buffer_index = 0;
|
||||
if (s->cd_sector_size == 2352) {
|
||||
n = 1;
|
||||
@ -1375,7 +1375,7 @@ static void ide_atapi_cmd(IDEState *s)
|
||||
buf[9] = 0x12;
|
||||
buf[10] = 0x08;
|
||||
buf[11] = 0x00;
|
||||
|
||||
|
||||
buf[12] = 0x70;
|
||||
buf[13] = 3 << 5;
|
||||
buf[14] = (1 << 0) | (1 << 3) | (1 << 5);
|
||||
@ -1501,7 +1501,7 @@ static void ide_atapi_cmd(IDEState *s)
|
||||
int start, eject;
|
||||
start = packet[4] & 1;
|
||||
eject = (packet[4] >> 1) & 1;
|
||||
|
||||
|
||||
if (eject && !start) {
|
||||
/* eject the disk */
|
||||
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;
|
||||
uint8_t *p;
|
||||
int ret;
|
||||
|
||||
|
||||
p = s->data_ptr;
|
||||
ret = cpu_to_le32(*(uint32_t *)p);
|
||||
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_write(iobase2, 1, 1, ide_cmd_write, ide_state);
|
||||
}
|
||||
|
||||
|
||||
/* data ports */
|
||||
register_ioport_write(iobase, 2, 2, ide_data_writew, 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);
|
||||
if (!ide_state)
|
||||
return;
|
||||
|
||||
|
||||
ide_init2(ide_state, hd0, hd1, irq);
|
||||
ide_init_ioport(ide_state, iobase, iobase2);
|
||||
}
|
||||
@ -2671,7 +2671,7 @@ static uint32_t bmdma_readb(void *opaque, uint32_t addr)
|
||||
BMDMAState *bm = opaque;
|
||||
PCIIDEState *pci_dev;
|
||||
uint32_t val;
|
||||
|
||||
|
||||
switch(addr & 3) {
|
||||
case 0:
|
||||
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[0x0b] = 0x01; // class_base = PCI_mass_storage
|
||||
pci_conf[0x0e] = 0x00; // header_type
|
||||
|
||||
|
||||
if (secondary_ide_enabled) {
|
||||
/* XXX: if not enabled, really disable the seconday IDE controller */
|
||||
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_conf[0x3d] = 0x01; // interrupt on pin 1
|
||||
|
||||
|
||||
for(i = 0; i < 4; i++)
|
||||
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;
|
||||
uint8_t *pci_conf;
|
||||
|
||||
|
||||
/* register a function 1 of PIIX3 */
|
||||
d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE",
|
||||
sizeof(PCIIDEState),
|
||||
@ -3133,7 +3133,7 @@ int pmac_ide_init (BlockDriverState **hd_table, qemu_irq irq)
|
||||
|
||||
ide_if = qemu_mallocz(sizeof(IDEState) * 2);
|
||||
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_write, &ide_if[0]);
|
||||
return pmac_ide_memory;
|
||||
|
@ -279,7 +279,7 @@ static void iommu_save(QEMUFile *f, void *opaque)
|
||||
{
|
||||
IOMMUState *s = opaque;
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < IOMMU_NREGS; i++)
|
||||
qemu_put_be32s(f, &s->regs[i]);
|
||||
qemu_put_be64s(f, &s->iostart);
|
||||
@ -289,7 +289,7 @@ static int iommu_load(QEMUFile *f, void *opaque, int version_id)
|
||||
{
|
||||
IOMMUState *s = opaque;
|
||||
int i;
|
||||
|
||||
|
||||
if (version_id != 2)
|
||||
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);
|
||||
cpu_register_physical_memory(addr, IOMMU_NREGS * 4, iommu_io_memory);
|
||||
|
||||
|
||||
register_savevm("iommu", addr, 2, iommu_save, iommu_load, s);
|
||||
qemu_register_reset(iommu_reset, s);
|
||||
return s;
|
||||
|
12
hw/m48t59.c
12
hw/m48t59.c
@ -90,7 +90,7 @@ static void get_time (m48t59_t *NVRAM, struct tm *tm)
|
||||
static void set_time (m48t59_t *NVRAM, struct tm *tm)
|
||||
{
|
||||
time_t now, new_time;
|
||||
|
||||
|
||||
new_time = mktime(tm);
|
||||
now = time(NULL);
|
||||
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)
|
||||
{
|
||||
m48t59_t *NVRAM = opaque;
|
||||
|
||||
|
||||
addr -= NVRAM->mem_base;
|
||||
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)
|
||||
{
|
||||
m48t59_t *NVRAM = opaque;
|
||||
|
||||
|
||||
addr -= NVRAM->mem_base;
|
||||
m48t59_write(NVRAM, addr, (value >> 8) & 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)
|
||||
{
|
||||
m48t59_t *NVRAM = opaque;
|
||||
|
||||
|
||||
addr -= NVRAM->mem_base;
|
||||
m48t59_write(NVRAM, addr, (value >> 24) & 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;
|
||||
uint32_t retval;
|
||||
|
||||
|
||||
addr -= NVRAM->mem_base;
|
||||
retval = m48t59_read(NVRAM, addr);
|
||||
return retval;
|
||||
@ -549,7 +549,7 @@ static uint32_t nvram_readw (void *opaque, target_phys_addr_t addr)
|
||||
{
|
||||
m48t59_t *NVRAM = opaque;
|
||||
uint32_t retval;
|
||||
|
||||
|
||||
addr -= NVRAM->mem_base;
|
||||
retval = m48t59_read(NVRAM, addr) << 8;
|
||||
retval |= m48t59_read(NVRAM, addr + 1);
|
||||
|
@ -110,7 +110,7 @@ static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data)
|
||||
#ifdef DEBUG_CMOS
|
||||
printf("cmos: write index=0x%02x val=0x%02x\n",
|
||||
s->cmos_index, data);
|
||||
#endif
|
||||
#endif
|
||||
switch(s->cmos_index) {
|
||||
case RTC_SECONDS_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);
|
||||
} else {
|
||||
rtc_next_second(&s->current_tm);
|
||||
|
||||
|
||||
if (!(s->cmos_data[RTC_REG_B] & REG_B_SET)) {
|
||||
/* update in progress bit */
|
||||
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_8s(f, &s->cmos_index);
|
||||
|
||||
|
||||
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_hour);
|
||||
|
@ -510,9 +510,9 @@ static void write_bootloader (CPUState *env, unsigned long bios_offset, int64_t
|
||||
stl_raw(p++, 0x00000000); /* nop */
|
||||
|
||||
/* 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 + 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 + 0x534, 0xbfc00808); /* print: */
|
||||
stl_raw(phys_ram_base + bios_offset + 0x538, 0xbfc00800); /* reg_cpu_isr: */
|
||||
|
26
hw/ne2000.c
26
hw/ne2000.c
@ -212,7 +212,7 @@ static int ne2000_buffer_full(NE2000State *s)
|
||||
static int ne2000_can_receive(void *opaque)
|
||||
{
|
||||
NE2000State *s = opaque;
|
||||
|
||||
|
||||
if (s->cmd & E8390_STOP)
|
||||
return 1;
|
||||
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];
|
||||
static const uint8_t broadcast_macaddr[6] =
|
||||
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
|
||||
#if defined(DEBUG_NE2000)
|
||||
printf("NE2000: received len=%d\n", size);
|
||||
#endif
|
||||
|
||||
if (s->cmd & E8390_STOP || ne2000_buffer_full(s))
|
||||
return;
|
||||
|
||||
|
||||
/* XXX: check this */
|
||||
if (s->rxcr & 0x10) {
|
||||
/* 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))))
|
||||
return;
|
||||
} else if (s->mem[0] == buf[0] &&
|
||||
s->mem[2] == buf[1] &&
|
||||
s->mem[4] == buf[2] &&
|
||||
s->mem[6] == buf[3] &&
|
||||
s->mem[8] == buf[4] &&
|
||||
s->mem[2] == buf[1] &&
|
||||
s->mem[4] == buf[2] &&
|
||||
s->mem[6] == buf[3] &&
|
||||
s->mem[8] == buf[4] &&
|
||||
s->mem[10] == buf[5]) {
|
||||
/* match */
|
||||
} 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)
|
||||
{
|
||||
NE2000State *s;
|
||||
|
||||
|
||||
s = qemu_mallocz(sizeof(NE2000State));
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
|
||||
register_ioport_write(base, 16, 1, ne2000_ioport_write, 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[4],
|
||||
s->macaddr[5]);
|
||||
|
||||
|
||||
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;
|
||||
NE2000State *s;
|
||||
uint8_t *pci_conf;
|
||||
|
||||
|
||||
d = (PCINE2000State *)pci_register_device(bus,
|
||||
"NE2000", sizeof(PCINE2000State),
|
||||
devfn,
|
||||
@ -800,7 +800,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn)
|
||||
pci_conf[0x0b] = 0x02;
|
||||
pci_conf[0x0e] = 0x00; // header_type
|
||||
pci_conf[0x3d] = 1; // interrupt pin 0
|
||||
|
||||
|
||||
pci_register_io_region(&d->dev, 0, 0x100,
|
||||
PCI_ADDRESS_SPACE_IO, ne2000_map);
|
||||
s = &d->ne2000;
|
||||
@ -819,7 +819,7 @@ void pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn)
|
||||
s->macaddr[3],
|
||||
s->macaddr[4],
|
||||
s->macaddr[5]);
|
||||
|
||||
|
||||
/* XXX: instance number ? */
|
||||
register_savevm("ne2000", 0, 3, ne2000_save, ne2000_load, s);
|
||||
}
|
||||
|
10
hw/openpic.c
10
hw/openpic.c
@ -475,7 +475,7 @@ static uint32_t read_doorbell_register (openpic_t *opp,
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
static void write_doorbell_register (penpic_t *opp, int n_dbl,
|
||||
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;
|
||||
uint32_t retval;
|
||||
int idx, n_IRQ;
|
||||
|
||||
|
||||
DPRINTF("%s: addr %08x\n", __func__, addr);
|
||||
retval = 0xFFFFFFFF;
|
||||
if (addr & 0xF)
|
||||
@ -1005,7 +1005,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus,
|
||||
openpic_t *opp;
|
||||
uint8_t *pci_conf;
|
||||
int i, m;
|
||||
|
||||
|
||||
/* XXX: for now, only one CPU is supported */
|
||||
if (nb_cpus != 1)
|
||||
return NULL;
|
||||
@ -1023,7 +1023,7 @@ qemu_irq *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus,
|
||||
pci_conf[0x0b] = 0x08;
|
||||
pci_conf[0x0e] = 0x00; // header_type
|
||||
pci_conf[0x3d] = 0x00; // no interrupt pin
|
||||
|
||||
|
||||
/* Register I/O spaces */
|
||||
pci_register_io_region((PCIDevice *)opp, 0, 0x40000,
|
||||
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,
|
||||
openpic_write, opp);
|
||||
|
||||
|
||||
// isu_base &= 0xFFFC0000;
|
||||
opp->nb_cpus = nb_cpus;
|
||||
/* Set IRQ types */
|
||||
|
@ -88,7 +88,7 @@ static void
|
||||
parallel_ioport_write_sw(void *opaque, uint32_t addr, uint32_t val)
|
||||
{
|
||||
ParallelState *s = opaque;
|
||||
|
||||
|
||||
pdebug("write addr=0x%02x val=0x%02x\n", addr, val);
|
||||
|
||||
addr &= 7;
|
||||
|
10
hw/pc.c
10
hw/pc.c
@ -182,7 +182,7 @@ static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table
|
||||
val = 65535;
|
||||
rtc_set_memory(s, 0x34, val);
|
||||
rtc_set_memory(s, 0x35, val >> 8);
|
||||
|
||||
|
||||
switch(boot_device) {
|
||||
case 'a':
|
||||
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);
|
||||
rtc_set_memory(s, 0x10, val);
|
||||
|
||||
|
||||
val = 0;
|
||||
nb = 0;
|
||||
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 int shutdown_index = 0;
|
||||
|
||||
|
||||
switch(addr) {
|
||||
/* Bochs BIOS messages */
|
||||
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 */
|
||||
cpu_register_physical_memory((uint32_t)(-bios_size),
|
||||
bios_size, bios_offset | IO_MEM_ROM);
|
||||
|
||||
|
||||
bochs_bios_init();
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (i440fx_state) {
|
||||
i440fx_init_memory_mappings(i440fx_state);
|
||||
}
|
||||
|
10
hw/pci.c
10
hw/pci.c
@ -105,7 +105,7 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
|
||||
|
||||
if (pci_irq_index >= PCI_DEVICES_MAX)
|
||||
return NULL;
|
||||
|
||||
|
||||
if (devfn < 0) {
|
||||
for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) {
|
||||
if (!bus->devices[devfn])
|
||||
@ -166,7 +166,7 @@ static void pci_update_mappings(PCIDevice *d)
|
||||
PCIIORegion *r;
|
||||
int cmd, i;
|
||||
uint32_t last_addr, new_addr, config_ofs;
|
||||
|
||||
|
||||
cmd = le16_to_cpu(*(uint16_t *)(d->config + PCI_COMMAND));
|
||||
for(i = 0; i < PCI_NUM_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;
|
||||
PCIDevice *pci_dev;
|
||||
int config_addr, bus_num;
|
||||
|
||||
|
||||
#if defined(DEBUG_PCI) && 0
|
||||
printf("pci_data_write: addr=%08x val=%08x len=%d\n",
|
||||
addr, val, len);
|
||||
@ -440,7 +440,7 @@ static void pci_set_irq(void *opaque, int irq_num, int level)
|
||||
PCIDevice *pci_dev = (PCIDevice *)opaque;
|
||||
PCIBus *bus;
|
||||
int change;
|
||||
|
||||
|
||||
change = level - pci_dev->irq_state[irq_num];
|
||||
if (!change)
|
||||
return;
|
||||
@ -556,7 +556,7 @@ void pci_for_each_device(int bus_num, void (*fn)(PCIDevice *d))
|
||||
PCIBus *bus = first_bus;
|
||||
PCIDevice *d;
|
||||
int devfn;
|
||||
|
||||
|
||||
while (bus && bus->bus_num != bus_num)
|
||||
bus = bus->next;
|
||||
if (bus) {
|
||||
|
@ -338,7 +338,7 @@ static void kbd_reset(void *opaque)
|
||||
static void kbd_save(QEMUFile* f, void* opaque)
|
||||
{
|
||||
KBDState *s = (KBDState*)opaque;
|
||||
|
||||
|
||||
qemu_put_8s(f, &s->write_cmd);
|
||||
qemu_put_8s(f, &s->status);
|
||||
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)
|
||||
{
|
||||
KBDState *s = (KBDState*)opaque;
|
||||
|
||||
|
||||
if (version_id != 3)
|
||||
return -EINVAL;
|
||||
qemu_get_8s(f, &s->write_cmd);
|
||||
|
70
hw/pcnet.c
70
hw/pcnet.c
@ -731,7 +731,7 @@ static void pcnet_s_reset(PCNetState *s)
|
||||
s->rdra = 0;
|
||||
s->tdra = 0;
|
||||
s->rap = 0;
|
||||
|
||||
|
||||
s->bcr[BCR_BSBC] &= ~0x0080;
|
||||
|
||||
s->csr[0] = 0x0004;
|
||||
@ -770,7 +770,7 @@ static void pcnet_update_irq(PCNetState *s)
|
||||
{
|
||||
int isr = 0;
|
||||
s->csr[0] &= ~0x0080;
|
||||
|
||||
|
||||
#if 1
|
||||
if (((s->csr[0] & ~s->csr[3]) & 0x5f00) ||
|
||||
(((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 */)
|
||||
#endif
|
||||
{
|
||||
|
||||
|
||||
isr = CSR_INEA(s);
|
||||
s->csr[0] |= 0x0080;
|
||||
}
|
||||
|
||||
|
||||
if (!!(s->csr[4] & 0x0080) && CSR_INEA(s)) { /* UINT */
|
||||
s->csr[4] &= ~0x0080;
|
||||
s->csr[4] |= 0x0040;
|
||||
@ -834,7 +834,7 @@ static void pcnet_init(PCNetState *s)
|
||||
#ifdef PCNET_DEBUG
|
||||
printf("pcnet_init init_addr=0x%08x\n", PHYSADDR(s,CSR_IADR(s)));
|
||||
#endif
|
||||
|
||||
|
||||
if (BCR_SSIZE32(s)) {
|
||||
struct pcnet_initblk32 initblk;
|
||||
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));
|
||||
#endif
|
||||
|
||||
s->csr[0] |= 0x0101;
|
||||
s->csr[0] |= 0x0101;
|
||||
s->csr[0] &= ~0x0004; /* clear STOP bit */
|
||||
}
|
||||
|
||||
@ -910,7 +910,7 @@ static void pcnet_start(PCNetState *s)
|
||||
|
||||
if (!CSR_DTX(s))
|
||||
s->csr[0] |= 0x0010; /* set TXON */
|
||||
|
||||
|
||||
if (!CSR_DRX(s))
|
||||
s->csr[0] |= 0x0020; /* set RXON */
|
||||
|
||||
@ -976,7 +976,7 @@ static void pcnet_rdte_poll(PCNetState *s)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (CSR_CRDA(s)) {
|
||||
struct pcnet_RMD rmd;
|
||||
RMDLOAD(&rmd, PHYSADDR(s,CSR_CRDA(s)));
|
||||
@ -991,7 +991,7 @@ static void pcnet_rdte_poll(PCNetState *s)
|
||||
} else {
|
||||
CSR_CRBC(s) = CSR_CRST(s) = 0;
|
||||
}
|
||||
|
||||
|
||||
if (CSR_NRDA(s)) {
|
||||
struct pcnet_RMD rmd;
|
||||
RMDLOAD(&rmd, PHYSADDR(s,CSR_NRDA(s)));
|
||||
@ -1030,14 +1030,14 @@ static int pcnet_tdte_poll(PCNetState *s)
|
||||
if (CSR_CXDA(s)) {
|
||||
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_CXST(s) = tmd.status;
|
||||
} else {
|
||||
CSR_CXBC(s) = CSR_CXST(s) = 0;
|
||||
}
|
||||
|
||||
|
||||
return !!(CSR_CXST(s) & 0x8000);
|
||||
}
|
||||
|
||||
@ -1046,7 +1046,7 @@ static int pcnet_can_receive(void *opaque)
|
||||
PCNetState *s = opaque;
|
||||
if (CSR_STOP(s) || CSR_SPND(s))
|
||||
return 0;
|
||||
|
||||
|
||||
if (s->recv_pos > 0)
|
||||
return 0;
|
||||
|
||||
@ -1093,7 +1093,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
|
||||
nrda = s->rdra +
|
||||
(CSR_RCVRL(s) - rcvrc) *
|
||||
(BCR_SWSTYLE(s) ? 16 : 8 );
|
||||
RMDLOAD(&rmd, PHYSADDR(s,nrda));
|
||||
RMDLOAD(&rmd, PHYSADDR(s,nrda));
|
||||
if (GET_FIELD(rmd.status, RMDS, OWN)) {
|
||||
#ifdef PCNET_DEBUG_RMD
|
||||
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;
|
||||
|
||||
memcpy(src, buf, size);
|
||||
|
||||
|
||||
#if 1
|
||||
/* no need to compute the CRC */
|
||||
src[size] = 0;
|
||||
@ -1136,7 +1136,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
|
||||
while (size < 46) {
|
||||
src[size++] = 0;
|
||||
}
|
||||
|
||||
|
||||
while (p != &src[size]) {
|
||||
CRC(fcs, *p++);
|
||||
}
|
||||
@ -1178,7 +1178,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
|
||||
PCNET_RECV_STORE();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef PCNET_RECV_STORE
|
||||
@ -1203,22 +1203,22 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
|
||||
#endif
|
||||
#ifdef PCNET_DEBUG_RMD
|
||||
PRINT_RMD(&rmd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
while (pktcount--) {
|
||||
if (CSR_RCVRC(s) <= 1)
|
||||
CSR_RCVRC(s) = CSR_RCVRL(s);
|
||||
else
|
||||
CSR_RCVRC(s)--;
|
||||
CSR_RCVRC(s)--;
|
||||
}
|
||||
|
||||
|
||||
pcnet_rdte_poll(s);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pcnet_poll(s);
|
||||
pcnet_update_irq(s);
|
||||
pcnet_update_irq(s);
|
||||
}
|
||||
|
||||
static void pcnet_transmit(PCNetState *s)
|
||||
@ -1226,7 +1226,7 @@ static void pcnet_transmit(PCNetState *s)
|
||||
target_phys_addr_t xmit_cxda = 0;
|
||||
int count = CSR_XMTRL(s)-1;
|
||||
s->xmit_pos = -1;
|
||||
|
||||
|
||||
if (!CSR_TXON(s)) {
|
||||
s->csr[0] &= ~0x0008;
|
||||
return;
|
||||
@ -1332,7 +1332,7 @@ static void pcnet_poll_timer(void *opaque)
|
||||
pcnet_transmit(s);
|
||||
}
|
||||
|
||||
pcnet_update_irq(s);
|
||||
pcnet_update_irq(s);
|
||||
|
||||
if (!CSR_STOP(s) && !CSR_SPND(s) && !CSR_DPOLL(s)) {
|
||||
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;
|
||||
#ifdef PCNET_DEBUG
|
||||
printf("pcnet_aprom_writeb addr=0x%08x val=0x%02x\n", addr, val);
|
||||
#endif
|
||||
#endif
|
||||
/* Check APROMWE bit to enable write access */
|
||||
if (pcnet_bcr_readw(s,2) & 0x80)
|
||||
s->prom[addr & 15] = val;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
#ifdef PCNET_DEBUG_IO
|
||||
printf("device switched into dword i/o mode\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
pcnet_update_irq(s);
|
||||
}
|
||||
@ -1695,7 +1695,7 @@ static uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr)
|
||||
PCNetState *s = opaque;
|
||||
uint32_t val = -1;
|
||||
pcnet_poll_timer(s);
|
||||
if (BCR_DWIO(s)) {
|
||||
if (BCR_DWIO(s)) {
|
||||
switch (addr & 0x0f) {
|
||||
case 0x00: /* RDP */
|
||||
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_read(addr, 16, 1, pcnet_aprom_readb, 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_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),
|
||||
devfn, NULL, NULL);
|
||||
|
||||
|
||||
pci_conf = d->dev.config;
|
||||
|
||||
|
||||
*(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[0x06] = cpu_to_le16(0x0280);
|
||||
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[0x0b] = 0x02;
|
||||
pci_conf[0x0e] = 0x00; // header_type
|
||||
|
||||
|
||||
*(uint32_t *)&pci_conf[0x10] = cpu_to_le32(0x00000001);
|
||||
*(uint32_t *)&pci_conf[0x14] = cpu_to_le32(0x00000000);
|
||||
|
||||
|
||||
pci_conf[0x3d] = 1; // interrupt pin 0
|
||||
pci_conf[0x3e] = 0x06;
|
||||
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_ADDRESS_SPACE_IO, pcnet_ioport_map);
|
||||
|
||||
|
||||
pci_register_io_region((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE,
|
||||
PCI_ADDRESS_SPACE_MEM, pcnet_mmio_map);
|
||||
|
||||
|
||||
d->irq = d->dev.irq[0];
|
||||
d->phys_mem_read = pci_physical_memory_read;
|
||||
d->phys_mem_write = pci_physical_memory_write;
|
||||
|
@ -222,7 +222,7 @@ static void pflash_write (pflash_t *pfl, uint32_t offset, uint32_t value,
|
||||
offset -= (uint32_t)(long)pfl->storage;
|
||||
else
|
||||
offset -= pfl->base;
|
||||
|
||||
|
||||
DPRINTF("%s: offset " TARGET_FMT_lx " %08x %d\n", __func__,
|
||||
offset, value, width);
|
||||
/* Set the device in I/O access mode */
|
||||
|
@ -44,7 +44,7 @@ static const unsigned char pl011_id[] =
|
||||
static void pl011_update(pl011_state *s)
|
||||
{
|
||||
uint32_t flags;
|
||||
|
||||
|
||||
flags = s->int_level & s->int_enabled;
|
||||
qemu_set_irq(s->irq, flags != 0);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ static void pl110_update_display(void *opaque)
|
||||
|
||||
if (!pl110_enabled(s))
|
||||
return;
|
||||
|
||||
|
||||
switch (s->ds->depth) {
|
||||
case 0:
|
||||
return;
|
||||
@ -151,7 +151,7 @@ static void pl110_update_display(void *opaque)
|
||||
fn = fntable[s->bpp + 12];
|
||||
else
|
||||
fn = fntable[s->bpp];
|
||||
|
||||
|
||||
src_width = s->cols;
|
||||
switch (s->bpp) {
|
||||
case BPP_1:
|
||||
|
@ -177,7 +177,7 @@ error:
|
||||
/* 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
|
||||
chunks. FIFO bytes are transferred in little-endian order. */
|
||||
|
||||
|
||||
static void pl181_fifo_run(pl181_state *s)
|
||||
{
|
||||
uint32_t bits;
|
||||
|
2
hw/ppc.c
2
hw/ppc.c
@ -623,7 +623,7 @@ struct ppcemb_timer_t {
|
||||
uint64_t wdt_next; /* Tick for next WDT interrupt */
|
||||
struct QEMUTimer *wdt_timer;
|
||||
};
|
||||
|
||||
|
||||
/* Fixed interval timer */
|
||||
static void cpu_4xx_fit_cb (void *opaque)
|
||||
{
|
||||
|
@ -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;
|
||||
int linux_boot;
|
||||
int fl_idx, fl_sectors;
|
||||
|
||||
|
||||
/* RAM is soldered to the board so the size cannot be changed */
|
||||
ram_bases[0] = 0x00000000;
|
||||
ram_sizes[0] = 0x04000000;
|
||||
|
@ -2212,7 +2212,7 @@ static void ppc4xx_gpt_set_outputs (ppc4xx_gpt_t *gpt)
|
||||
}
|
||||
mask = mask >> 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
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]);
|
||||
mask = mask >> 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void ppc4xx_gpt_compute_timer (ppc4xx_gpt_t *gpt)
|
||||
|
@ -173,7 +173,7 @@ static void macio_init(PCIBus *bus, int device_id)
|
||||
d->config[0x0e] = 0x00; // header_type
|
||||
|
||||
d->config[0x3d] = 0x01; // interrupt on pin 1
|
||||
|
||||
|
||||
dbdma_mem_index = cpu_register_io_memory(0, dbdma_read, dbdma_write, NULL);
|
||||
|
||||
pci_register_io_region(d, 0, 0x80000,
|
||||
@ -208,7 +208,7 @@ static int vga_osi_call(CPUState *env)
|
||||
{
|
||||
static int vga_vbl_enabled;
|
||||
int linesize;
|
||||
|
||||
|
||||
// printf("osi_call R5=%d\n", env->gpr[5]);
|
||||
|
||||
/* 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)
|
||||
{
|
||||
char partition_name[12] = "wwwwwwwwwwww";
|
||||
|
||||
|
||||
buf[0] = 0x7f; /* free partition magic */
|
||||
buf[1] = 0; /* checksum */
|
||||
buf[2] = len >> 8;
|
||||
buf[3] = len;
|
||||
memcpy(buf + 4, partition_name, 12);
|
||||
buf[1] = nvram_chksum(buf, 16);
|
||||
}
|
||||
}
|
||||
|
||||
/* PowerPC CHRP hardware initialisation */
|
||||
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;
|
||||
cpu_register_physical_memory((uint32_t)(-bios_size),
|
||||
bios_size, bios_offset | IO_MEM_ROM);
|
||||
|
||||
|
||||
/* allocate and load VGA BIOS */
|
||||
vga_bios_offset = bios_offset + bios_size;
|
||||
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 = (vga_bios_size + 0xfff) & ~0xfff;
|
||||
|
||||
|
||||
if (linux_boot) {
|
||||
kernel_base = KERNEL_LOAD_ADDR;
|
||||
/* 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 */
|
||||
dummy_irq = i8259_init(NULL);
|
||||
|
||||
|
||||
/* XXX: use Mac Serial port */
|
||||
serial_init(0x3f8, dummy_irq[4], serial_hds[0]);
|
||||
|
||||
|
||||
for(i = 0; i < nb_nics; i++) {
|
||||
if (!nd_table[i].model)
|
||||
nd_table[i].model = "ne2k_pci";
|
||||
pci_nic_init(pci_bus, &nd_table[i], -1);
|
||||
}
|
||||
|
||||
|
||||
pci_cmd646_ide_init(pci_bus, &bs_table[0], 0);
|
||||
|
||||
/* cuda also initialize ADB */
|
||||
cuda_mem_index = cuda_init(pic[0x12]);
|
||||
|
||||
|
||||
adb_kbd_init(&adb_bus);
|
||||
adb_mouse_init(&adb_bus);
|
||||
|
||||
|
||||
{
|
||||
MacIONVRAMState *nvr;
|
||||
nvr = macio_nvram_init();
|
||||
@ -534,14 +534,14 @@ static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device,
|
||||
#endif
|
||||
/* cuda also initialize ADB */
|
||||
cuda_mem_index = cuda_init(pic[0x19]);
|
||||
|
||||
|
||||
adb_kbd_init(&adb_bus);
|
||||
adb_mouse_init(&adb_bus);
|
||||
|
||||
|
||||
macio_init(pci_bus, 0x0022);
|
||||
|
||||
|
||||
nvram = m48t59_init(dummy_irq[8], 0xFFF04000, 0x0074, NVRAM_SIZE, 59);
|
||||
|
||||
|
||||
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,
|
||||
initrd_filename, cpu_model, 0);
|
||||
}
|
||||
|
||||
|
||||
static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device,
|
||||
DisplayState *ds, const char **fd_filename,
|
||||
int snapshot,
|
||||
|
4
hw/ps2.c
4
hw/ps2.c
@ -146,7 +146,7 @@ uint32_t ps2_read_data(void *opaque)
|
||||
PS2State *s = (PS2State *)opaque;
|
||||
PS2Queue *q;
|
||||
int val, index;
|
||||
|
||||
|
||||
q = &s->queue;
|
||||
if (q->count == 0) {
|
||||
/* 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)
|
||||
return;
|
||||
s->mouse_buttons = buttons_state;
|
||||
|
||||
|
||||
if (!(s->mouse_status & MOUSE_STATUS_REMOTE) &&
|
||||
(s->common.queue.count < (PS2_QUEUE_SIZE - 16))) {
|
||||
for(;;) {
|
||||
|
18
hw/rtl8139.c
18
hw/rtl8139.c
@ -890,10 +890,10 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
|
||||
++s->tally_counters.RxOkMul;
|
||||
|
||||
} else if (s->phys[0] == buf[0] &&
|
||||
s->phys[1] == buf[1] &&
|
||||
s->phys[2] == buf[2] &&
|
||||
s->phys[3] == buf[3] &&
|
||||
s->phys[4] == buf[4] &&
|
||||
s->phys[1] == buf[1] &&
|
||||
s->phys[2] == buf[2] &&
|
||||
s->phys[3] == buf[3] &&
|
||||
s->phys[4] == buf[4] &&
|
||||
s->phys[5] == buf[5]) {
|
||||
/* match */
|
||||
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[1] & TxUnderrun)?TSAD_TUN1:0)
|
||||
|((s->TxStatus[0] & TxUnderrun)?TSAD_TUN0:0)
|
||||
|
||||
|
||||
|((s->TxStatus[3] & TxAborted )?TSAD_TABT3:0)
|
||||
|((s->TxStatus[2] & TxAborted )?TSAD_TABT2:0)
|
||||
|((s->TxStatus[1] & TxAborted )?TSAD_TABT1:0)
|
||||
|((s->TxStatus[0] & TxAborted )?TSAD_TABT0:0)
|
||||
|
||||
|
||||
|((s->TxStatus[3] & TxHostOwns )?TSAD_OWN3:0)
|
||||
|((s->TxStatus[2] & TxHostOwns )?TSAD_OWN2:0)
|
||||
|((s->TxStatus[1] & TxHostOwns )?TSAD_OWN1:0)
|
||||
|((s->TxStatus[0] & TxHostOwns )?TSAD_OWN0:0) ;
|
||||
|
||||
|
||||
|
||||
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;
|
||||
RTL8139State *s;
|
||||
uint8_t *pci_conf;
|
||||
|
||||
|
||||
d = (PCIRTL8139State *)pci_register_device(bus,
|
||||
"RTL8139", sizeof(PCIRTL8139State),
|
||||
devfn,
|
||||
@ -3458,7 +3458,7 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn)
|
||||
s->cplus_txbuffer = NULL;
|
||||
s->cplus_txbuffer_len = 0;
|
||||
s->cplus_txbuffer_offset = 0;
|
||||
|
||||
|
||||
/* XXX: instance number ? */
|
||||
register_savevm("rtl8139", 0, 3, rtl8139_save, rtl8139_load, s);
|
||||
|
||||
|
@ -142,7 +142,7 @@ static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val)
|
||||
{
|
||||
SerialState *s = opaque;
|
||||
unsigned char ch;
|
||||
|
||||
|
||||
addr &= 7;
|
||||
#ifdef DEBUG_SERIAL
|
||||
printf("serial: write addr=0x%02x val=0x%02x\n", addr, val);
|
||||
|
@ -308,7 +308,7 @@ static void slavio_intctl_save(QEMUFile *f, void *opaque)
|
||||
{
|
||||
SLAVIO_INTCTLState *s = opaque;
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < MAX_CPUS; i++) {
|
||||
qemu_put_be32s(f, &s->intreg_pending[i]);
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ static uint32_t get_queue(void *opaque)
|
||||
ChannelState *s = opaque;
|
||||
SERIOQueue *q = &s->queue;
|
||||
int val;
|
||||
|
||||
|
||||
if (q->count == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -210,7 +210,7 @@ static int slavio_timer_load(QEMUFile *f, void *opaque, int version_id)
|
||||
{
|
||||
SLAVIO_TIMERState *s = opaque;
|
||||
uint32_t tmp;
|
||||
|
||||
|
||||
if (version_id != 2)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
SMBusEEPROMDevice *eeprom;
|
||||
|
||||
|
||||
eeprom = (SMBusEEPROMDevice *)smbus_device_init(bus, addr,
|
||||
sizeof(SMBusEEPROMDevice));
|
||||
|
||||
|
@ -649,7 +649,7 @@ static void smc91c111_receive(void *opaque, const uint8_t *buf, int size)
|
||||
/* Pad short packets. */
|
||||
if (size < 64) {
|
||||
int pad;
|
||||
|
||||
|
||||
if (size & 1)
|
||||
*(p++) = buf[size - 1];
|
||||
pad = 64 - size;
|
||||
|
4
hw/tcx.c
4
hw/tcx.c
@ -208,7 +208,7 @@ static void tcx_update_display(void *opaque)
|
||||
case 0:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE) {
|
||||
if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) {
|
||||
if (y_start < 0)
|
||||
@ -353,7 +353,7 @@ static void tcx24_invalidate_display(void *opaque)
|
||||
static void tcx_save(QEMUFile *f, void *opaque)
|
||||
{
|
||||
TCXState *s = opaque;
|
||||
|
||||
|
||||
qemu_put_be16s(f, (uint16_t *)&s->height);
|
||||
qemu_put_be16s(f, (uint16_t *)&s->width);
|
||||
qemu_put_be16s(f, (uint16_t *)&s->depth);
|
||||
|
14
hw/usb-hid.c
14
hw/usb-hid.c
@ -102,7 +102,7 @@ static const uint8_t qemu_mouse_config_descriptor[] = {
|
||||
5: Remote wakeup,
|
||||
4..0: resvd */
|
||||
50, /* u8 MaxPower; */
|
||||
|
||||
|
||||
/* USB 1.1:
|
||||
* USB 2.0, single TT organization (mandatory):
|
||||
* one interface, protocol 0
|
||||
@ -124,7 +124,7 @@ static const uint8_t qemu_mouse_config_descriptor[] = {
|
||||
0x01, /* u8 if_bInterfaceSubClass; */
|
||||
0x02, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */
|
||||
0x07, /* u8 if_iInterface; */
|
||||
|
||||
|
||||
/* HID descriptor */
|
||||
0x09, /* u8 bLength; */
|
||||
0x21, /* u8 bDescriptorType; */
|
||||
@ -157,7 +157,7 @@ static const uint8_t qemu_tablet_config_descriptor[] = {
|
||||
5: Remote wakeup,
|
||||
4..0: resvd */
|
||||
50, /* u8 MaxPower; */
|
||||
|
||||
|
||||
/* USB 1.1:
|
||||
* USB 2.0, single TT organization (mandatory):
|
||||
* one interface, protocol 0
|
||||
@ -474,7 +474,7 @@ static int usb_mouse_poll(USBHIDState *hs, uint8_t *buf, int len)
|
||||
0, "QEMU USB Mouse");
|
||||
s->mouse_grabbed = 1;
|
||||
}
|
||||
|
||||
|
||||
dx = int_clamp(s->dx, -128, 127);
|
||||
dy = int_clamp(s->dy, -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->dy -= dy;
|
||||
s->dz -= dz;
|
||||
|
||||
|
||||
b = 0;
|
||||
if (s->buttons_state & MOUSE_EVENT_LBUTTON)
|
||||
b |= 0x01;
|
||||
@ -490,7 +490,7 @@ static int usb_mouse_poll(USBHIDState *hs, uint8_t *buf, int len)
|
||||
b |= 0x02;
|
||||
if (s->buttons_state & MOUSE_EVENT_MBUTTON)
|
||||
b |= 0x04;
|
||||
|
||||
|
||||
buf[0] = b;
|
||||
buf[1] = dx;
|
||||
buf[2] = dy;
|
||||
@ -512,7 +512,7 @@ static int usb_tablet_poll(USBHIDState *hs, uint8_t *buf, int len)
|
||||
1, "QEMU USB Tablet");
|
||||
s->mouse_grabbed = 1;
|
||||
}
|
||||
|
||||
|
||||
dz = int_clamp(s->dz, -128, 127);
|
||||
s->dz -= dz;
|
||||
|
||||
|
@ -118,7 +118,7 @@ static const uint8_t qemu_hub_config_descriptor[] = {
|
||||
5: Remote wakeup,
|
||||
4..0: resvd */
|
||||
0x00, /* u8 MaxPower; */
|
||||
|
||||
|
||||
/* USB 1.1:
|
||||
* USB 2.0, single TT organization (mandatory):
|
||||
* one interface, protocol 0
|
||||
@ -140,7 +140,7 @@ static const uint8_t qemu_hub_config_descriptor[] = {
|
||||
0x00, /* u8 if_bInterfaceSubClass; */
|
||||
0x00, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */
|
||||
0x00, /* u8 if_iInterface; */
|
||||
|
||||
|
||||
/* one endpoint (status change endpoint) */
|
||||
0x07, /* u8 ep_bLength; */
|
||||
0x05, /* u8 ep_bDescriptorType; Endpoint */
|
||||
@ -167,11 +167,11 @@ static void usb_hub_attach(USBPort *port1, USBDevice *dev)
|
||||
{
|
||||
USBHubState *s = port1->opaque;
|
||||
USBHubPort *port = &s->ports[port1->index];
|
||||
|
||||
|
||||
if (dev) {
|
||||
if (port->port.dev)
|
||||
usb_attach(port1, NULL);
|
||||
|
||||
|
||||
port->wPortStatus |= PORT_STAT_CONNECTION;
|
||||
port->wPortChange |= PORT_STAT_C_CONNECTION;
|
||||
if (dev->speed == USB_SPEED_LOW)
|
||||
|
@ -99,7 +99,7 @@ static const uint8_t qemu_msd_config_descriptor[] = {
|
||||
5: Remote wakeup,
|
||||
4..0: resvd */
|
||||
0x00, /* u8 MaxPower; */
|
||||
|
||||
|
||||
/* one interface */
|
||||
0x09, /* u8 if_bLength; */
|
||||
0x04, /* u8 if_bDescriptorType; Interface */
|
||||
@ -110,7 +110,7 @@ static const uint8_t qemu_msd_config_descriptor[] = {
|
||||
0x06, /* u8 if_bInterfaceSubClass; SCSI */
|
||||
0x50, /* u8 if_bInterfaceProtocol; Bulk Only */
|
||||
0x00, /* u8 if_iInterface; */
|
||||
|
||||
|
||||
/* Bulk-In endpoint */
|
||||
0x07, /* u8 ep_bLength; */
|
||||
0x05, /* u8 ep_bDescriptorType; Endpoint */
|
||||
|
@ -149,7 +149,7 @@ static void uhci_reset(UHCIState *s)
|
||||
static void uhci_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
|
||||
{
|
||||
UHCIState *s = opaque;
|
||||
|
||||
|
||||
addr &= 0x1f;
|
||||
switch(addr) {
|
||||
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)
|
||||
{
|
||||
UHCIState *s = opaque;
|
||||
|
||||
|
||||
addr &= 0x1f;
|
||||
#ifdef DEBUG
|
||||
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) {
|
||||
*int_mask |= 0x01;
|
||||
}
|
||||
|
||||
|
||||
if (!(td->ctrl & TD_CTRL_ACTIVE))
|
||||
return 1;
|
||||
|
||||
@ -807,7 +807,7 @@ void usb_uhci_piix3_init(PCIBus *bus, int devfn)
|
||||
pci_conf[0x0e] = 0x00; // header_type
|
||||
pci_conf[0x3d] = 4; // interrupt pin 3
|
||||
pci_conf[0x60] = 0x10; // release number
|
||||
|
||||
|
||||
for(i = 0; i < NB_PORTS; i++) {
|
||||
qemu_register_usb_port(&s->ports[i].port, s, i, uhci_attach);
|
||||
}
|
||||
|
4
hw/usb.h
4
hw/usb.h
@ -119,7 +119,7 @@ struct USBDevice {
|
||||
void (*handle_destroy)(USBDevice *dev);
|
||||
|
||||
int speed;
|
||||
|
||||
|
||||
/* The following fields are used by the generic USB device
|
||||
layer. They are here just to avoid creating a new structure for
|
||||
them. */
|
||||
@ -129,7 +129,7 @@ struct USBDevice {
|
||||
int (*handle_data)(USBDevice *dev, USBPacket *p);
|
||||
uint8_t addr;
|
||||
char devname[32];
|
||||
|
||||
|
||||
int state;
|
||||
uint8_t setup_buf[8];
|
||||
uint8_t data_buf[1024];
|
||||
|
50
hw/vga.c
50
hw/vga.c
@ -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_X_OFFSET] = 0;
|
||||
s->vbe_regs[VBE_DISPI_INDEX_Y_OFFSET] = 0;
|
||||
|
||||
|
||||
if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4)
|
||||
s->vbe_line_offset = s->vbe_regs[VBE_DISPI_INDEX_XRES] >> 1;
|
||||
else
|
||||
@ -480,7 +480,7 @@ static void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)
|
||||
memset(s->vram_ptr, 0,
|
||||
s->vbe_regs[VBE_DISPI_INDEX_YRES] * s->vbe_line_offset);
|
||||
}
|
||||
|
||||
|
||||
/* we initialize the VGA graphic mode (should be done
|
||||
in BIOS) */
|
||||
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[0x07] |= 0x10;
|
||||
s->cr[0x09] |= 0x40;
|
||||
|
||||
|
||||
if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) {
|
||||
shift_control = 0;
|
||||
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;
|
||||
int memory_map_mode, plane;
|
||||
uint32_t ret;
|
||||
|
||||
|
||||
/* convert to VGA memory offset */
|
||||
memory_map_mode = (s->gr[6] >> 2) & 3;
|
||||
addr &= 0x1ffff;
|
||||
@ -586,7 +586,7 @@ uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr)
|
||||
return 0xff;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (s->sr[4] & 0x08) {
|
||||
/* chain 4 mode : simplest access */
|
||||
ret = s->vram_ptr[addr];
|
||||
@ -676,7 +676,7 @@ void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (s->sr[4] & 0x08) {
|
||||
/* chain 4 mode : simplest access */
|
||||
plane = addr & 3;
|
||||
@ -961,7 +961,7 @@ static void vga_get_offsets(VGAState *s,
|
||||
line_compare = 65535;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
{
|
||||
/* compute line_offset in bytes */
|
||||
line_offset = s->cr[0x13];
|
||||
line_offset <<= 3;
|
||||
@ -984,7 +984,7 @@ static int update_basic_params(VGAState *s)
|
||||
{
|
||||
int full_update;
|
||||
uint32_t start_addr, line_offset, line_compare;
|
||||
|
||||
|
||||
full_update = 0;
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
|
||||
static const uint8_t cursor_glyph[32 * 4] = {
|
||||
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,
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Text mode update
|
||||
@ -1098,7 +1098,7 @@ static void vga_draw_text(VGAState *s, int full_update)
|
||||
|
||||
full_update |= update_palette16(s);
|
||||
palette = s->last_palette;
|
||||
|
||||
|
||||
/* compute font data address (in plane 2) */
|
||||
v = s->sr[3];
|
||||
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];
|
||||
}
|
||||
cursor_ptr = s->vram_ptr + (s->start_addr + cursor_offset) * 4;
|
||||
|
||||
|
||||
depth_index = get_depth_index(s->ds);
|
||||
if (cw == 16)
|
||||
vga_draw_glyph8 = vga_draw_glyph16_table[depth_index];
|
||||
else
|
||||
vga_draw_glyph8 = vga_draw_glyph8_table[depth_index];
|
||||
vga_draw_glyph9 = vga_draw_glyph9_table[depth_index];
|
||||
|
||||
|
||||
dest = s->ds->data;
|
||||
linesize = s->ds->linesize;
|
||||
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)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
|
||||
#ifdef CONFIG_BOCHS_VBE
|
||||
if (s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) {
|
||||
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;
|
||||
uint32_t v, addr1, addr;
|
||||
vga_draw_line_func *vga_draw_line;
|
||||
|
||||
|
||||
full_update |= update_basic_params(s);
|
||||
|
||||
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->double_scan = double_scan;
|
||||
}
|
||||
|
||||
|
||||
if (shift_control == 0) {
|
||||
full_update |= update_palette16(s);
|
||||
if (s->sr[0x01] & 8) {
|
||||
@ -1497,7 +1497,7 @@ static void vga_draw_graphic(VGAState *s, int full_update)
|
||||
}
|
||||
if (s->cursor_invalidate)
|
||||
s->cursor_invalidate(s);
|
||||
|
||||
|
||||
line_offset = s->line_offset;
|
||||
#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",
|
||||
@ -1616,7 +1616,7 @@ static void vga_update_display(void *opaque)
|
||||
} else {
|
||||
s->rgb_to_pixel =
|
||||
rgb_to_pixel_dup_table[get_depth_index(s->ds)];
|
||||
|
||||
|
||||
full_update = 0;
|
||||
if (!(s->ar_index & 0x20)) {
|
||||
graphic_mode = GMODE_BLANK;
|
||||
@ -1646,7 +1646,7 @@ static void vga_update_display(void *opaque)
|
||||
static void vga_invalidate_display(void *opaque)
|
||||
{
|
||||
VGAState *s = (VGAState *)opaque;
|
||||
|
||||
|
||||
s->last_width = -1;
|
||||
s->last_height = -1;
|
||||
}
|
||||
@ -2009,21 +2009,21 @@ int pci_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
|
||||
PCIVGAState *d;
|
||||
VGAState *s;
|
||||
uint8_t *pci_conf;
|
||||
|
||||
|
||||
d = (PCIVGAState *)pci_register_device(bus, "VGA",
|
||||
sizeof(PCIVGAState),
|
||||
-1, NULL, NULL);
|
||||
if (!d)
|
||||
return -1;
|
||||
s = &d->vga_state;
|
||||
|
||||
|
||||
vga_common_init(s, ds, vga_ram_base, vga_ram_offset, vga_ram_size);
|
||||
vga_init(s);
|
||||
|
||||
graphic_console_init(s->ds, s->update, s->invalidate, s->screen_dump, s);
|
||||
|
||||
s->pci_dev = &d->dev;
|
||||
|
||||
|
||||
pci_conf = d->dev.config;
|
||||
pci_conf[0x00] = 0x34; // dummy VGA (same as Bochs ID)
|
||||
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[0x0b] = 0x03;
|
||||
pci_conf[0x0e] = 0x00; // header_type
|
||||
|
||||
|
||||
/* XXX: vga_ram_size must be a power of two */
|
||||
pci_register_io_region(&d->dev, 0, vga_ram_size,
|
||||
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;
|
||||
DisplayState *saved_ds, ds1, *ds = &ds1;
|
||||
|
||||
|
||||
/* XXX: this is a little hackish */
|
||||
vga_invalidate_display(s);
|
||||
saved_ds = s->ds;
|
||||
@ -2121,7 +2121,7 @@ static void vga_screen_dump(void *opaque, const char *filename)
|
||||
s->ds = ds;
|
||||
s->graphic_mode = -1;
|
||||
vga_update_display(s);
|
||||
|
||||
|
||||
if (ds->data) {
|
||||
ppm_save(filename, ds->data, vga_save_w, vga_save_h,
|
||||
s->ds->linesize);
|
||||
|
@ -45,20 +45,20 @@
|
||||
#define VBE_DISPI_INDEX_X_OFFSET 0x8
|
||||
#define VBE_DISPI_INDEX_Y_OFFSET 0x9
|
||||
#define VBE_DISPI_INDEX_NB 0xa
|
||||
|
||||
|
||||
#define VBE_DISPI_ID0 0xB0C0
|
||||
#define VBE_DISPI_ID1 0xB0C1
|
||||
#define VBE_DISPI_ID2 0xB0C2
|
||||
#define VBE_DISPI_ID3 0xB0C3
|
||||
#define VBE_DISPI_ID4 0xB0C4
|
||||
|
||||
|
||||
#define VBE_DISPI_DISABLED 0x00
|
||||
#define VBE_DISPI_ENABLED 0x01
|
||||
#define VBE_DISPI_GETCAPS 0x02
|
||||
#define VBE_DISPI_8BIT_DAC 0x20
|
||||
#define VBE_DISPI_LFB_ENABLED 0x40
|
||||
#define VBE_DISPI_NOCLEARMEM 0x80
|
||||
|
||||
|
||||
#define VBE_DISPI_LFB_PHYSICAL_ADDRESS 0xE0000000
|
||||
|
||||
#ifdef CONFIG_BOCHS_VBE
|
||||
|
@ -73,7 +73,7 @@ static void glue(vga_draw_glyph8_, DEPTH)(uint8_t *d, int linesize,
|
||||
uint32_t fgcol, uint32_t bgcol)
|
||||
{
|
||||
uint32_t font_data, xorcol;
|
||||
|
||||
|
||||
xorcol = bgcol ^ fgcol;
|
||||
do {
|
||||
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 font_data, xorcol;
|
||||
|
||||
|
||||
xorcol = bgcol ^ fgcol;
|
||||
do {
|
||||
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 font_data, xorcol, v;
|
||||
|
||||
|
||||
xorcol = bgcol ^ fgcol;
|
||||
do {
|
||||
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));
|
||||
else
|
||||
((uint8_t *)d)[8] = bgcol;
|
||||
|
||||
|
||||
#elif BPP == 2
|
||||
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);
|
||||
@ -433,7 +433,7 @@ static void glue(vga_draw_line15_, PIXEL_NAME)(VGAState *s1, uint8_t *d,
|
||||
s += 2;
|
||||
d += BPP;
|
||||
} while (--w != 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -458,7 +458,7 @@ static void glue(vga_draw_line16_, PIXEL_NAME)(VGAState *s1, uint8_t *d,
|
||||
s += 2;
|
||||
d += BPP;
|
||||
} while (--w != 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
14
kqemu.c
14
kqemu.c
@ -286,7 +286,7 @@ static void kqemu_reset_modified_ram_pages(void)
|
||||
{
|
||||
int i;
|
||||
unsigned long page_index;
|
||||
|
||||
|
||||
for(i = 0; i < nb_modified_ram_pages; i++) {
|
||||
page_index = modified_ram_pages[i] >> TARGET_PAGE_BITS;
|
||||
modified_ram_pages_table[page_index] = 0;
|
||||
@ -364,7 +364,7 @@ static void restore_native_fp_frstor(CPUState *env)
|
||||
{
|
||||
int fptag, i, j;
|
||||
struct fpstate fp1, *fp = &fp1;
|
||||
|
||||
|
||||
fp->fpuc = env->fpuc;
|
||||
fp->fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11;
|
||||
fptag = 0;
|
||||
@ -470,7 +470,7 @@ static int do_syscall(CPUState *env,
|
||||
struct kqemu_cpu_state *kenv)
|
||||
{
|
||||
int selector;
|
||||
|
||||
|
||||
selector = (env->star >> 32) & 0xffff;
|
||||
#ifdef __x86_64__
|
||||
if (env->hflags & HF_LMA_MASK) {
|
||||
@ -501,7 +501,7 @@ static int do_syscall(CPUState *env,
|
||||
#endif
|
||||
{
|
||||
env->regs[R_ECX] = (uint32_t)kenv->next_eip;
|
||||
|
||||
|
||||
cpu_x86_set_cpl(env, 0);
|
||||
cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc,
|
||||
0, 0xffffffff,
|
||||
@ -605,7 +605,7 @@ void kqemu_record_dump(void)
|
||||
}
|
||||
}
|
||||
qsort(pr, nb_pc_records, sizeof(PCRecord *), pc_rec_cmp);
|
||||
|
||||
|
||||
f = fopen("/tmp/kqemu.stats", "w");
|
||||
if (!f) {
|
||||
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;
|
||||
#endif
|
||||
nb_ram_pages_to_update = 0;
|
||||
|
||||
|
||||
#if KQEMU_VERSION >= 0x010300
|
||||
kenv->nb_modified_ram_pages = nb_modified_ram_pages;
|
||||
#endif
|
||||
@ -828,7 +828,7 @@ int kqemu_cpu_exec(CPUState *env)
|
||||
env->hflags |= HF_OSFXSR_MASK;
|
||||
else
|
||||
env->hflags &= ~HF_OSFXSR_MASK;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
if (loglevel & CPU_LOG_INT) {
|
||||
fprintf(logfile, "kqemu: kqemu_cpu_exec: ret=0x%x\n", ret);
|
||||
|
@ -329,7 +329,7 @@
|
||||
#define TARGET_NR_lremovexattr 392
|
||||
#define TARGET_NR_fremovexattr 393
|
||||
#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_tuxcall 397
|
||||
#define TARGET_NR_io_setup 398
|
||||
|
@ -695,7 +695,7 @@ static unsigned long create_elf_tables(target_ulong p, int argc, int envc,
|
||||
size *= n;
|
||||
if (size & 15)
|
||||
sp -= 16 - (size & 15);
|
||||
|
||||
|
||||
#define NEW_AUX_ENT(id, val) do { \
|
||||
sp -= n; tputl(sp, val); \
|
||||
sp -= n; tputl(sp, id); \
|
||||
@ -833,7 +833,7 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex,
|
||||
elf_type,
|
||||
interpreter_fd,
|
||||
eppnt->p_offset - TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr));
|
||||
|
||||
|
||||
if (error == -1) {
|
||||
/* Real error */
|
||||
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_flags = 0;
|
||||
unsigned long error;
|
||||
|
||||
|
||||
if (elf_ppnt->p_type != PT_LOAD)
|
||||
continue;
|
||||
|
||||
|
||||
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_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);
|
||||
}
|
||||
|
||||
|
||||
error = target_mmap(TARGET_ELF_PAGESTART(load_bias + elf_ppnt->p_vaddr),
|
||||
(elf_ppnt->p_filesz +
|
||||
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)
|
||||
elf_stack = TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr);
|
||||
#endif
|
||||
|
||||
|
||||
if (!load_addr_set) {
|
||||
load_addr_set = 1;
|
||||
load_addr = elf_ppnt->p_vaddr - elf_ppnt->p_offset;
|
||||
|
@ -38,7 +38,7 @@ struct flat_hdr {
|
||||
target_ulong reloc_start; /* Offset of relocation records from
|
||||
beginning of file */
|
||||
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 filler[5]; /* Reservered, set to zero */
|
||||
};
|
||||
|
@ -376,7 +376,7 @@ void old_reloc(struct lib_info *libinfo, uint32_t rl)
|
||||
break;
|
||||
}
|
||||
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);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
||||
/* Don't allow old format executables to use shared libraries */
|
||||
if (rev == OLD_FLAT_VERSION && id != 0) {
|
||||
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].entry = (0x00ffffff & ntohl(hdr->entry)) + textpos;
|
||||
libinfo[id].build_date = ntohl(hdr->build_date);
|
||||
|
||||
|
||||
/*
|
||||
* We just load the allocations into some temporary memory to
|
||||
* help simplify all this mumbo jumbo
|
||||
@ -662,7 +662,7 @@ static int load_flat_file(struct linux_binprm * bprm,
|
||||
old_reloc(&libinfo[0], relval);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* zero the BSS. */
|
||||
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->envc + 1) * 4; /* the envp array */
|
||||
|
||||
|
||||
|
||||
res = load_flat_file(bprm, libinfo, 0, &stack_len);
|
||||
if (res > (unsigned long)-4096)
|
||||
return res;
|
||||
|
||||
|
||||
/* Update data segment pointers for all libraries */
|
||||
for (i=0; i<MAX_SHARED_LIBS; i++) {
|
||||
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)
|
||||
sp -= 16 - ((sp + stack_len) & 15);
|
||||
sp = loader_build_argptr(bprm->envc, bprm->argc, sp, p, 1);
|
||||
|
||||
|
||||
/* Fake some return addresses to ensure the call chain will
|
||||
* initialise library in order for us. We are required to call
|
||||
* 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
|
||||
|
||||
|
||||
/* Stash our initial stack pointer into the mm structure */
|
||||
info->start_code = libinfo[0].start_code;
|
||||
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",
|
||||
(int)info->entry, (int)info->start_stack);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ int loader_exec(const char * filename, char ** argv, char ** envp,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(retval>=0) {
|
||||
/* success. Initialize important registers */
|
||||
do_init_thread(regs, infop);
|
||||
|
@ -331,7 +331,7 @@ void cpu_loop(CPUARMState *env)
|
||||
unsigned int n, insn;
|
||||
target_siginfo_t info;
|
||||
uint32_t addr;
|
||||
|
||||
|
||||
for(;;) {
|
||||
trapnr = cpu_arm_exec(env);
|
||||
switch(trapnr) {
|
||||
@ -343,7 +343,7 @@ void cpu_loop(CPUARMState *env)
|
||||
/* we handle the FPU emulation here, as Linux */
|
||||
/* we get the opcode */
|
||||
opcode = tget32(env->regs[15]);
|
||||
|
||||
|
||||
if (EmulateAll(opcode, &ts->fpa, env) == 0) {
|
||||
info.si_signo = SIGILL;
|
||||
info.si_errno = 0;
|
||||
@ -475,7 +475,7 @@ static inline void save_window_offset(CPUSPARCState *env, int cwp1)
|
||||
{
|
||||
unsigned int i;
|
||||
target_ulong sp_ptr;
|
||||
|
||||
|
||||
sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)];
|
||||
#if defined(DEBUG_WIN)
|
||||
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;
|
||||
target_ulong sp_ptr;
|
||||
|
||||
|
||||
new_wim = ((env->wim << 1) | (env->wim >> (NWINDOWS - 1))) &
|
||||
((1LL << NWINDOWS) - 1);
|
||||
|
||||
|
||||
/* restore the invalid window */
|
||||
cwp1 = (env->cwp + 1) & (NWINDOWS - 1);
|
||||
sp_ptr = env->regbase[get_reg_index(env, cwp1, 6)];
|
||||
@ -555,10 +555,10 @@ void cpu_loop (CPUSPARCState *env)
|
||||
{
|
||||
int trapnr, ret;
|
||||
target_siginfo_t info;
|
||||
|
||||
|
||||
while (1) {
|
||||
trapnr = cpu_sparc_exec (env);
|
||||
|
||||
|
||||
switch (trapnr) {
|
||||
#ifndef TARGET_SPARC64
|
||||
case 0x88:
|
||||
@ -670,17 +670,17 @@ static inline uint64_t cpu_ppc_get_tb (CPUState *env)
|
||||
/* TO FIX */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint32_t cpu_ppc_load_tbl (CPUState *env)
|
||||
{
|
||||
return cpu_ppc_get_tb(env) & 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
|
||||
uint32_t cpu_ppc_load_tbu (CPUState *env)
|
||||
{
|
||||
return cpu_ppc_get_tb(env) >> 32;
|
||||
}
|
||||
|
||||
|
||||
static void cpu_ppc_store_tb (CPUState *env, uint64_t value)
|
||||
{
|
||||
/* TO FIX */
|
||||
@ -717,7 +717,7 @@ void cpu_loop(CPUPPCState *env)
|
||||
target_siginfo_t info;
|
||||
int trapnr;
|
||||
uint32_t ret;
|
||||
|
||||
|
||||
for(;;) {
|
||||
trapnr = cpu_ppc_exec(env);
|
||||
if (trapnr != EXCP_SYSCALL_USER && trapnr != EXCP_BRANCH &&
|
||||
@ -1452,10 +1452,10 @@ void cpu_loop (CPUState *env)
|
||||
{
|
||||
int trapnr, ret;
|
||||
target_siginfo_t info;
|
||||
|
||||
|
||||
while (1) {
|
||||
trapnr = cpu_sh4_exec (env);
|
||||
|
||||
|
||||
switch (trapnr) {
|
||||
case 0x160:
|
||||
ret = do_syscall(env,
|
||||
@ -1501,7 +1501,7 @@ void cpu_loop(CPUM68KState *env)
|
||||
unsigned int n;
|
||||
target_siginfo_t info;
|
||||
TaskState *ts = env->opaque;
|
||||
|
||||
|
||||
for(;;) {
|
||||
trapnr = cpu_m68k_exec(env);
|
||||
switch(trapnr) {
|
||||
@ -1590,10 +1590,10 @@ void cpu_loop (CPUState *env)
|
||||
{
|
||||
int trapnr;
|
||||
target_siginfo_t info;
|
||||
|
||||
|
||||
while (1) {
|
||||
trapnr = cpu_alpha_exec (env);
|
||||
|
||||
|
||||
switch (trapnr) {
|
||||
case EXCP_RESET:
|
||||
fprintf(stderr, "Reset requested. Exit\n");
|
||||
@ -1745,7 +1745,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (optind >= argc)
|
||||
break;
|
||||
|
||||
|
||||
r = argv[optind++];
|
||||
mask = cpu_str_to_log_mask(r);
|
||||
if (!mask) {
|
||||
@ -1821,7 +1821,7 @@ int main(int argc, char **argv)
|
||||
qemu_host_page_size */
|
||||
env = cpu_init();
|
||||
global_env = env;
|
||||
|
||||
|
||||
wrk = environ;
|
||||
while (*(wrk++))
|
||||
environ_count++;
|
||||
@ -1844,12 +1844,12 @@ int main(int argc, char **argv)
|
||||
for (wrk = target_environ; *wrk; wrk++) {
|
||||
free(*wrk);
|
||||
}
|
||||
|
||||
|
||||
free(target_environ);
|
||||
|
||||
if (loglevel) {
|
||||
page_dump(logfile);
|
||||
|
||||
|
||||
fprintf(logfile, "start_brk 0x%08lx\n" , info->start_brk);
|
||||
fprintf(logfile, "end_code 0x%08lx\n" , info->end_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->info = info;
|
||||
env->user_mode_only = 1;
|
||||
|
||||
|
||||
#if defined(TARGET_I386)
|
||||
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 */
|
||||
env->eflags |= IF_MASK;
|
||||
|
||||
|
||||
/* linux register setup */
|
||||
#if defined(TARGET_X86_64)
|
||||
env->regs[R_EAX] = regs->rax;
|
||||
|
@ -52,7 +52,7 @@ int target_mprotect(target_ulong start, target_ulong len, int prot)
|
||||
return -EINVAL;
|
||||
if (len == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
host_start = start & qemu_host_page_mask;
|
||||
host_end = HOST_PAGE_ALIGN(end);
|
||||
if (start > host_start) {
|
||||
@ -83,7 +83,7 @@ int target_mprotect(target_ulong start, target_ulong len, int prot)
|
||||
return ret;
|
||||
host_end -= qemu_host_page_size;
|
||||
}
|
||||
|
||||
|
||||
/* handle the pages in the middle */
|
||||
if (host_start < host_end) {
|
||||
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)
|
||||
prot1 |= page_get_flags(addr);
|
||||
}
|
||||
|
||||
|
||||
if (prot1 == 0) {
|
||||
/* no page was there, so we allocate one */
|
||||
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 */
|
||||
if (!(prot1 & PROT_WRITE))
|
||||
mprotect(host_start, qemu_host_page_size, prot1 | PROT_WRITE);
|
||||
|
||||
|
||||
/* read the corresponding file data */
|
||||
pread(fd, g2h(start), end - start, offset);
|
||||
|
||||
|
||||
/* put final protection */
|
||||
if (prot_new != (prot1 | PROT_WRITE))
|
||||
mprotect(host_start, qemu_host_page_size, prot_new);
|
||||
@ -244,7 +244,7 @@ abort();
|
||||
goto the_end1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (start & ~TARGET_PAGE_MASK) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
@ -303,7 +303,7 @@ abort();
|
||||
return ret;
|
||||
real_end -= qemu_host_page_size;
|
||||
}
|
||||
|
||||
|
||||
/* map the middle (easier) */
|
||||
if (real_start < real_end) {
|
||||
unsigned long offset1;
|
||||
@ -367,7 +367,7 @@ int target_munmap(target_ulong start, target_ulong len)
|
||||
if (prot != 0)
|
||||
real_end -= qemu_host_page_size;
|
||||
}
|
||||
|
||||
|
||||
/* unmap what we can */
|
||||
if (real_start < real_end) {
|
||||
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;
|
||||
if (end == start)
|
||||
return 0;
|
||||
|
||||
|
||||
start &= qemu_host_page_mask;
|
||||
return msync(g2h(start), end - start, flags);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ static void host_to_target_sigset_internal(target_sigset_t *d,
|
||||
int i;
|
||||
unsigned long sigmask;
|
||||
uint32_t target_sigmask;
|
||||
|
||||
|
||||
sigmask = ((unsigned long *)s)[0];
|
||||
target_sigmask = 0;
|
||||
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]);
|
||||
target_to_host_sigset_internal(d, &s1);
|
||||
}
|
||||
|
||||
|
||||
void host_to_target_old_sigset(target_ulong *old_sigset,
|
||||
const sigset_t *sigset)
|
||||
{
|
||||
@ -274,7 +274,7 @@ void signal_init(void)
|
||||
j = host_to_target_signal_table[i];
|
||||
target_to_host_signal_table[j] = i;
|
||||
}
|
||||
|
||||
|
||||
/* set all host signal handlers. ALL signals are blocked during
|
||||
the handlers to serialize them. */
|
||||
sigfillset(&act.sa_mask);
|
||||
@ -283,7 +283,7 @@ void signal_init(void)
|
||||
for(i = 1; i < NSIG; i++) {
|
||||
sigaction(i, &act, NULL);
|
||||
}
|
||||
|
||||
|
||||
memset(sigact_table, 0, sizeof(sigact_table));
|
||||
|
||||
first_free = &sigqueue_table[0];
|
||||
@ -865,7 +865,7 @@ long do_sigreturn(CPUX86State *env)
|
||||
|
||||
target_to_host_sigset_internal(&set, &target_set);
|
||||
sigprocmask(SIG_SETMASK, &set, NULL);
|
||||
|
||||
|
||||
/* restore registers */
|
||||
if (restore_sigcontext(env, &frame->sc, &eax))
|
||||
goto badframe;
|
||||
@ -1933,7 +1933,7 @@ long do_sigreturn(CPUState *regs)
|
||||
:"r" (®s));
|
||||
/* Unreached */
|
||||
#endif
|
||||
|
||||
|
||||
regs->PC[regs->current_tc] = regs->CP0_EPC;
|
||||
/* I am not sure this is right, but it seems to work
|
||||
* maybe a problem with nested signals ? */
|
||||
@ -1995,7 +1995,7 @@ void process_pending_signals(void *cpu_env)
|
||||
target_sigset_t target_old_set;
|
||||
struct emulated_sigaction *k;
|
||||
struct sigqueue *q;
|
||||
|
||||
|
||||
if (!signal_pending)
|
||||
return;
|
||||
|
||||
@ -2018,7 +2018,7 @@ void process_pending_signals(void *cpu_env)
|
||||
k->first = q->next;
|
||||
if (!k->first)
|
||||
k->pending = 0;
|
||||
|
||||
|
||||
sig = gdb_handlesig (cpu_env, sig);
|
||||
if (!sig) {
|
||||
fprintf (stderr, "Lost signal\n");
|
||||
@ -2044,7 +2044,7 @@ void process_pending_signals(void *cpu_env)
|
||||
blocked during the handler */
|
||||
if (!(k->sa.sa_flags & TARGET_SA_NODEFER))
|
||||
sigaddset(&set, target_to_host_signal(sig));
|
||||
|
||||
|
||||
/* block signals in the handler using Linux */
|
||||
sigprocmask(SIG_BLOCK, &set, &old_set);
|
||||
/* save the previous blocked signal state to restore it at the
|
||||
|
@ -341,7 +341,7 @@ long do_brk(target_ulong new_brk)
|
||||
return target_brk;
|
||||
if (new_brk < target_original_brk)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
brk_page = HOST_PAGE_ALIGN(target_brk);
|
||||
|
||||
/* 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;
|
||||
efds_ptr = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (target_tv) {
|
||||
target_to_host_timeval(&tv, target_tv);
|
||||
tv_ptr = &tv;
|
||||
@ -652,13 +652,13 @@ static long do_setsockopt(int sockfd, int level, int optname,
|
||||
target_ulong optval, socklen_t optlen)
|
||||
{
|
||||
int val, ret;
|
||||
|
||||
|
||||
switch(level) {
|
||||
case SOL_TCP:
|
||||
/* TCP options all take an 'int' value. */
|
||||
if (optlen < sizeof(uint32_t))
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
val = tget32(optval);
|
||||
ret = get_errno(setsockopt(sockfd, level, optname, &val, sizeof(val)));
|
||||
break;
|
||||
@ -918,7 +918,7 @@ static long do_bind(int sockfd, target_ulong target_addr,
|
||||
socklen_t addrlen)
|
||||
{
|
||||
void *addr = alloca(addrlen);
|
||||
|
||||
|
||||
target_to_host_sockaddr(addr, target_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)
|
||||
{
|
||||
void *addr = alloca(addrlen);
|
||||
|
||||
|
||||
target_to_host_sockaddr(addr, target_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_control = alloca(msg.msg_controllen);
|
||||
msg.msg_flags = tswap32(msgp->msg_flags);
|
||||
|
||||
|
||||
count = tswapl(msgp->msg_iovlen);
|
||||
vec = alloca(count * sizeof(struct iovec));
|
||||
target_vec = tswapl(msgp->msg_iov);
|
||||
lock_iovec(vec, target_vec, count, send);
|
||||
msg.msg_iovlen = count;
|
||||
msg.msg_iov = vec;
|
||||
|
||||
|
||||
if (send) {
|
||||
target_to_host_cmsg(&msg, msgp);
|
||||
ret = get_errno(sendmsg(fd, &msg, flags));
|
||||
@ -1636,7 +1636,7 @@ static long do_ipc(long call, long first, long second, long third,
|
||||
break;
|
||||
raddr = ret;
|
||||
/* find out the length of the shared memory segment */
|
||||
|
||||
|
||||
ret = get_errno(shmctl(first, IPC_STAT, &shm_info));
|
||||
if (is_error(ret)) {
|
||||
/* 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;
|
||||
const struct target_termios *target = src;
|
||||
|
||||
|
||||
host->c_iflag =
|
||||
target_to_host_bitmask(tswap32(target->c_iflag), iflag_tbl);
|
||||
host->c_oflag =
|
||||
@ -1920,26 +1920,26 @@ static void target_to_host_termios (void *dst, const void *src)
|
||||
host->c_lflag =
|
||||
target_to_host_bitmask(tswap32(target->c_lflag), lflag_tbl);
|
||||
host->c_line = target->c_line;
|
||||
|
||||
|
||||
host->c_cc[VINTR] = target->c_cc[TARGET_VINTR];
|
||||
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[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[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[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[VSUSP] = target->c_cc[TARGET_VSUSP];
|
||||
host->c_cc[VEOL] = target->c_cc[TARGET_VEOL];
|
||||
host->c_cc[VREPRINT] = target->c_cc[TARGET_VREPRINT];
|
||||
host->c_cc[VDISCARD] = target->c_cc[TARGET_VDISCARD];
|
||||
host->c_cc[VWERASE] = target->c_cc[TARGET_VWERASE];
|
||||
host->c_cc[VLNEXT] = target->c_cc[TARGET_VLNEXT];
|
||||
host->c_cc[VEOL] = target->c_cc[TARGET_VEOL];
|
||||
host->c_cc[VREPRINT] = target->c_cc[TARGET_VREPRINT];
|
||||
host->c_cc[VDISCARD] = target->c_cc[TARGET_VDISCARD];
|
||||
host->c_cc[VWERASE] = target->c_cc[TARGET_VWERASE];
|
||||
host->c_cc[VLNEXT] = target->c_cc[TARGET_VLNEXT];
|
||||
host->c_cc[VEOL2] = target->c_cc[TARGET_VEOL2];
|
||||
}
|
||||
|
||||
|
||||
static void host_to_target_termios (void *dst, const void *src)
|
||||
{
|
||||
struct target_termios *target = dst;
|
||||
@ -1954,7 +1954,7 @@ static void host_to_target_termios (void *dst, const void *src)
|
||||
target->c_lflag =
|
||||
tswap32(host_to_target_bitmask(host->c_lflag, lflag_tbl));
|
||||
target->c_line = host->c_line;
|
||||
|
||||
|
||||
target->c_cc[TARGET_VINTR] = host->c_cc[VINTR];
|
||||
target->c_cc[TARGET_VQUIT] = host->c_cc[VQUIT];
|
||||
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.flags = tswap32(target_ldt_info->flags);
|
||||
unlock_user_struct(target_ldt_info, ptr, 0);
|
||||
|
||||
|
||||
if (ldt_info.entry_number >= TARGET_LDT_ENTRIES)
|
||||
return -EINVAL;
|
||||
seg_32bit = ldt_info.flags & 1;
|
||||
@ -2093,7 +2093,7 @@ static int write_ldt(CPUX86State *env,
|
||||
goto install;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
entry_1 = ((ldt_info.base_addr & 0x0000ffff) << 16) |
|
||||
(ldt_info.limit & 0x0ffff);
|
||||
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 ret = -ENOSYS;
|
||||
|
||||
|
||||
switch (func) {
|
||||
case 0:
|
||||
ret = read_ldt(ptr, bytecount);
|
||||
@ -2155,7 +2155,7 @@ int do_fork(CPUState *env, unsigned int flags, unsigned long newsp)
|
||||
TaskState *ts;
|
||||
uint8_t *new_stack;
|
||||
CPUState *new_env;
|
||||
|
||||
|
||||
if (flags & CLONE_VM) {
|
||||
ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE);
|
||||
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);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case TARGET_F_SETLK:
|
||||
case TARGET_F_SETLKW:
|
||||
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);
|
||||
ret = fcntl(fd, cmd, &fl);
|
||||
break;
|
||||
|
||||
|
||||
case TARGET_F_GETLK64:
|
||||
lock_user_struct(target_fl64, arg, 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 statfs stfs;
|
||||
void *p;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
gemu_log("syscall %d", num);
|
||||
#endif
|
||||
@ -2980,7 +2980,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
|
||||
{
|
||||
int how = arg1;
|
||||
sigset_t set, oldset, *set_ptr;
|
||||
|
||||
|
||||
if (arg2) {
|
||||
switch(how) {
|
||||
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;
|
||||
sigset_t set, oldset, *set_ptr;
|
||||
|
||||
|
||||
if (arg2) {
|
||||
switch(how) {
|
||||
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;
|
||||
struct timespec uts, *puts;
|
||||
siginfo_t uinfo;
|
||||
|
||||
|
||||
p = lock_user(arg1, sizeof(target_sigset_t), 1);
|
||||
target_to_host_sigset(&set, p);
|
||||
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;
|
||||
struct target_rlimit *target_rlim;
|
||||
struct rlimit rlim;
|
||||
|
||||
|
||||
ret = get_errno(getrlimit(resource, &rlim));
|
||||
if (!is_error(ret)) {
|
||||
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:
|
||||
if (!is_error(ret)) {
|
||||
struct target_statfs *target_stfs;
|
||||
|
||||
|
||||
lock_user_struct(target_stfs, arg2, 0);
|
||||
/* ??? put_user is probably wrong. */
|
||||
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:
|
||||
if (!is_error(ret)) {
|
||||
struct target_statfs64 *target_stfs;
|
||||
|
||||
|
||||
lock_user_struct(target_stfs, arg3, 0);
|
||||
/* ??? put_user is probably wrong. */
|
||||
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:
|
||||
{
|
||||
struct itimerval value;
|
||||
|
||||
|
||||
ret = get_errno(getitimer(arg1, &value));
|
||||
if (!is_error(ret) && 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 */
|
||||
{
|
||||
struct new_utsname * buf;
|
||||
|
||||
|
||||
lock_user_struct(buf, arg1, 0);
|
||||
ret = get_errno(sys_uname(buf));
|
||||
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);
|
||||
if (!dirp)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
ret = get_errno(sys_getdents(arg1, dirp, count));
|
||||
if (!is_error(ret)) {
|
||||
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;
|
||||
gid_t *grouplist;
|
||||
int i;
|
||||
|
||||
|
||||
grouplist = alloca(gidsetsize * sizeof(gid_t));
|
||||
target_grouplist = lock_user(arg2, gidsetsize * 4, 1);
|
||||
for(i = 0;i < gidsetsize; i++)
|
||||
|
@ -748,9 +748,9 @@ struct target_pollfd {
|
||||
*/
|
||||
#define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */
|
||||
#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.
|
||||
*/
|
||||
#define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
|
||||
|
@ -28,7 +28,7 @@ STRUCT(ifmap,
|
||||
|
||||
STRUCT(sockaddr_ifreq,
|
||||
MK_ARRAY(TYPE_CHAR, IFNAMSIZ), MK_STRUCT(STRUCT_sockaddr))
|
||||
|
||||
|
||||
STRUCT(short_ifreq,
|
||||
MK_ARRAY(TYPE_CHAR, IFNAMSIZ), TYPE_SHORT)
|
||||
|
||||
|
@ -123,7 +123,7 @@ static inline void return_to_32bit(CPUX86State *env, int retval)
|
||||
static inline int set_IF(CPUX86State *env)
|
||||
{
|
||||
TaskState *ts = env->opaque;
|
||||
|
||||
|
||||
ts->v86flags |= VIF_MASK;
|
||||
if (ts->v86flags & VIP_MASK) {
|
||||
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);
|
||||
ip = env->eip & 0xffff;
|
||||
pc = csp + ip;
|
||||
|
||||
|
||||
ssp = (uint8_t *)(env->segs[R_SS].selector << 4);
|
||||
sp = env->regs[R_ESP] & 0xffff;
|
||||
|
||||
@ -362,12 +362,12 @@ void handle_vm86_fault(CPUX86State *env)
|
||||
return;
|
||||
}
|
||||
VM86_FAULT_RETURN;
|
||||
|
||||
|
||||
case 0xfa: /* cli */
|
||||
env->eip = ip;
|
||||
clear_IF(env);
|
||||
VM86_FAULT_RETURN;
|
||||
|
||||
|
||||
case 0xfb: /* sti */
|
||||
env->eip = ip;
|
||||
if (set_IF(env))
|
||||
@ -386,7 +386,7 @@ int do_vm86(CPUX86State *env, long subfunction, target_ulong vm86_addr)
|
||||
TaskState *ts = env->opaque;
|
||||
struct target_vm86plus_struct * target_v86;
|
||||
int ret;
|
||||
|
||||
|
||||
switch (subfunction) {
|
||||
case TARGET_VM86_REQUEST_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,
|
||||
target_v86->vm86plus.vm86dbg_intxxtab, 32);
|
||||
unlock_user_struct(target_v86, vm86_addr, 0);
|
||||
|
||||
|
||||
#ifdef DEBUG_VM86
|
||||
fprintf(logfile, "do_vm86: cs:ip=%04x:%04x\n",
|
||||
env->segs[R_CS].selector, env->eip);
|
||||
|
2
loader.c
2
loader.c
@ -261,7 +261,7 @@ static void bswap_uboot_header(uboot_image_header_t *hdr)
|
||||
/* Load a U-Boot image. */
|
||||
int load_uboot(const char *filename, target_ulong *ep, int *is_linux)
|
||||
{
|
||||
|
||||
|
||||
int fd;
|
||||
int size;
|
||||
uboot_image_header_t h;
|
||||
|
16
m68k-dis.c
16
m68k-dis.c
@ -2378,7 +2378,7 @@ const struct m68k_opcode m68k_opcodes[] =
|
||||
{"eor", 4, one(0005174), one(0177777), "#wSs", m68000up },
|
||||
{"eor", 4, one(0005100), one(0177700), "#w$s", m68000up },
|
||||
{"eor", 2, one(0130500), one(0170700), "Dd$s", m68000up },
|
||||
|
||||
|
||||
{"exg", 2, one(0140500), one(0170770), "DdDs", m68000up },
|
||||
{"exg", 2, one(0140510), one(0170770), "AdAs", 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 },
|
||||
|
||||
{"rtd", 4, one(0047164), one(0177777), "#w", m68010up },
|
||||
|
||||
|
||||
{"rte", 2, one(0047163), one(0177777), "", m68000up | mcfisa_a },
|
||||
|
||||
|
||||
{"rtm", 2, one(0003300), one(0177760), "Rs", m68020 },
|
||||
|
||||
|
||||
{"rtr", 2, one(0047167), one(0177777), "", m68000up },
|
||||
|
||||
|
||||
{"rts", 2, one(0047165), one(0177777), "", m68000up | mcfisa_a },
|
||||
|
||||
{"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. */
|
||||
unsigned long exponent, int_bit;
|
||||
const unsigned char *ufrom = (const unsigned char *) from;
|
||||
|
||||
|
||||
exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
|
||||
fmt->exp_start, fmt->exp_len);
|
||||
int_bit = get_field (ufrom, fmt->byteorder, fmt->totalsize,
|
||||
fmt->man_start, 1);
|
||||
|
||||
|
||||
if ((exponent == 0) != (int_bit == 0))
|
||||
return 0;
|
||||
else
|
||||
@ -4699,7 +4699,7 @@ get_field (const unsigned char *data, enum floatformat_byteorders order,
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
@ -392,7 +392,7 @@ struct mips_opcode
|
||||
"l" 32 bit floating point constant in .lit4
|
||||
|
||||
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)
|
||||
"Q" MDMX vector/scalar/immediate source (OP_*_VSEL and OP_*_FT)
|
||||
"X" MDMX destination register (OP_*_FD)
|
||||
|
28
monitor.c
28
monitor.c
@ -333,7 +333,7 @@ static void do_info_history (void)
|
||||
{
|
||||
int i;
|
||||
const char *str;
|
||||
|
||||
|
||||
i = 0;
|
||||
for(;;) {
|
||||
str = readline_get_history(i);
|
||||
@ -442,7 +442,7 @@ static void do_logfile(const char *filename)
|
||||
static void do_log(const char *items)
|
||||
{
|
||||
int mask;
|
||||
|
||||
|
||||
if (!strcmp(items, "none")) {
|
||||
mask = 0;
|
||||
} else {
|
||||
@ -744,7 +744,7 @@ typedef struct {
|
||||
static const KeyDef key_defs[] = {
|
||||
{ 0x2a, "shift" },
|
||||
{ 0x36, "shift_r" },
|
||||
|
||||
|
||||
{ 0x38, "alt" },
|
||||
{ 0xb8, "alt_r" },
|
||||
{ 0x1d, "ctrl" },
|
||||
@ -799,7 +799,7 @@ static const KeyDef key_defs[] = {
|
||||
{ 0x30, "b" },
|
||||
{ 0x31, "n" },
|
||||
{ 0x32, "m" },
|
||||
|
||||
|
||||
{ 0x39, "spc" },
|
||||
{ 0x3a, "caps_lock" },
|
||||
{ 0x3b, "f1" },
|
||||
@ -832,7 +832,7 @@ static const KeyDef key_defs[] = {
|
||||
{ 0x47, "kp_7" },
|
||||
{ 0x48, "kp_8" },
|
||||
{ 0x49, "kp_9" },
|
||||
|
||||
|
||||
{ 0x56, "<" },
|
||||
|
||||
{ 0x57, "f11" },
|
||||
@ -879,7 +879,7 @@ static void do_send_key(const char *string)
|
||||
uint8_t keycodes[16];
|
||||
const char *p;
|
||||
int nb_keycodes, keycode, i;
|
||||
|
||||
|
||||
nb_keycodes = 0;
|
||||
p = string;
|
||||
while (*p != '\0') {
|
||||
@ -1769,7 +1769,7 @@ static target_long expr_unary(void)
|
||||
case '$':
|
||||
{
|
||||
char buf[128], *q;
|
||||
|
||||
|
||||
pch++;
|
||||
q = buf;
|
||||
while ((*pch >= 'a' && *pch <= 'z') ||
|
||||
@ -1816,7 +1816,7 @@ static target_long expr_prod(void)
|
||||
{
|
||||
target_long val, val2;
|
||||
int op;
|
||||
|
||||
|
||||
val = expr_unary();
|
||||
for(;;) {
|
||||
op = *pch;
|
||||
@ -1989,7 +1989,7 @@ static void monitor_handle_command(const char *cmdline)
|
||||
#ifdef DEBUG
|
||||
term_printf("command='%s'\n", cmdline);
|
||||
#endif
|
||||
|
||||
|
||||
/* extract the command name */
|
||||
p = cmdline;
|
||||
q = cmdname;
|
||||
@ -2005,7 +2005,7 @@ static void monitor_handle_command(const char *cmdline)
|
||||
len = sizeof(cmdname) - 1;
|
||||
memcpy(cmdname, pstart, len);
|
||||
cmdname[len] = '\0';
|
||||
|
||||
|
||||
/* find the command */
|
||||
for(cmd = term_cmds; cmd->name != NULL; cmd++) {
|
||||
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++)
|
||||
str_allocated[i] = NULL;
|
||||
|
||||
|
||||
/* parse the parameters */
|
||||
typestr = cmd->args_type;
|
||||
nb_args = 0;
|
||||
@ -2033,7 +2033,7 @@ static void monitor_handle_command(const char *cmdline)
|
||||
{
|
||||
int ret;
|
||||
char *str;
|
||||
|
||||
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
if (*typestr == '?') {
|
||||
@ -2074,7 +2074,7 @@ static void monitor_handle_command(const char *cmdline)
|
||||
case '/':
|
||||
{
|
||||
int count, format, size;
|
||||
|
||||
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
if (*p == '/') {
|
||||
@ -2207,7 +2207,7 @@ static void monitor_handle_command(const char *cmdline)
|
||||
{
|
||||
int has_option;
|
||||
/* option */
|
||||
|
||||
|
||||
c = *typestr++;
|
||||
if (c == '\0')
|
||||
goto bad_type;
|
||||
|
@ -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).
|
||||
@item -S
|
||||
Do not start CPU at startup (you must type 'c' in the monitor).
|
||||
@item -d
|
||||
@item -d
|
||||
Output log in /tmp/qemu.log
|
||||
@item -hdachs c,h,s,[,t]
|
||||
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
|
||||
@item Ctrl-a h
|
||||
Print this help
|
||||
@item Ctrl-a x
|
||||
@item Ctrl-a x
|
||||
Exit emulator
|
||||
@item Ctrl-a s
|
||||
@item Ctrl-a s
|
||||
Save disk data back to file (if -snapshot)
|
||||
@item Ctrl-a t
|
||||
toggle console timestamps
|
||||
@ -889,7 +889,7 @@ The following commands are available:
|
||||
@item help or ? [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)
|
||||
|
||||
@item info subcommand
|
||||
@ -1363,7 +1363,7 @@ network). The virtual network configuration is the following:
|
||||
| (10.0.2.2)
|
||||
|
|
||||
----> DNS server (10.0.2.3)
|
||||
|
|
||||
|
|
||||
----> SMB server (10.0.2.4)
|
||||
@end example
|
||||
|
||||
@ -1925,7 +1925,7 @@ The following options are specific to the PowerPC emulation:
|
||||
|
||||
@table @option
|
||||
|
||||
@item -g WxH[xDEPTH]
|
||||
@item -g WxH[xDEPTH]
|
||||
|
||||
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
|
||||
@item -h
|
||||
Print the help
|
||||
@item -L path
|
||||
@item -L path
|
||||
Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
|
||||
@item -s size
|
||||
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
|
||||
@item -h
|
||||
Print the help
|
||||
@item -L path
|
||||
@item -L path
|
||||
Set the library root path (default=/)
|
||||
@item -s size
|
||||
Set the stack size in bytes (default=524288)
|
||||
|
@ -168,7 +168,7 @@ static void term_init(void)
|
||||
tty.c_cflag |= CS8;
|
||||
tty.c_cc[VMIN] = 1;
|
||||
tty.c_cc[VTIME] = 0;
|
||||
|
||||
|
||||
tcsetattr (0, TCSANOW, &tty);
|
||||
|
||||
atexit(term_exit);
|
||||
@ -250,7 +250,7 @@ static int img_create(int argc, char **argv)
|
||||
int64_t size;
|
||||
const char *p;
|
||||
BlockDriver *drv;
|
||||
|
||||
|
||||
flags = 0;
|
||||
for(;;) {
|
||||
c = getopt(argc, argv, "b:f:he6");
|
||||
@ -461,7 +461,7 @@ static int img_convert(int argc, char **argv)
|
||||
if (optind >= argc)
|
||||
help();
|
||||
out_filename = argv[optind++];
|
||||
|
||||
|
||||
bs = bdrv_new_open(filename, 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
out_bs = bdrv_new_open(out_filename, out_fmt);
|
||||
|
||||
if (flags && BLOCK_FLAG_COMPRESS) {
|
||||
|
@ -304,7 +304,7 @@ static void term_completion(void)
|
||||
char *cmdline;
|
||||
|
||||
nb_completions = 0;
|
||||
|
||||
|
||||
cmdline = qemu_malloc(term_cmd_buf_index + 1);
|
||||
if (!cmdline)
|
||||
return;
|
||||
|
@ -569,7 +569,7 @@ const struct s390_operand s390_operands[] =
|
||||
quite close.
|
||||
|
||||
For example the instruction "mvo" is defined in the PoP as follows:
|
||||
|
||||
|
||||
MVO D1(L1,B1),D2(L2,B2) [SS]
|
||||
|
||||
--------------------------------------
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user