mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07: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:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+14
-14
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
+4
-4
@@ -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)
|
||||
|
||||
+3
-3
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+15
-15
@@ -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;
|
||||
}
|
||||
|
||||
+34
-34
@@ -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);
|
||||
|
||||
|
||||
+15
-15
@@ -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,
|
||||
|
||||
+6
-6
@@ -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;
|
||||
|
||||
+5
-5
@@ -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);
|
||||
|
||||
+17
-17
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
+18
-18
@@ -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));
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user