]> xenbits.xensource.com Git - qemu-xen-4.3-testing.git/commitdiff
find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in the regex.
authorIan Jackson <iwj@mariner.uk.xensource.com>
Fri, 23 May 2008 16:45:18 +0000 (17:45 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 23 May 2008 16:45:18 +0000 (17:45 +0100)
(Nominally cherry-picked from 3b46e6242767a2c770c0aba0a6595e9511623c92
 by ths but actually manually redone.)

294 files changed:
COPYING.LIB
Changelog
Makefile
Makefile.target
TODO
aes.c
alpha-dis.c
arm-dis.c
arm-semi.c
audio/wavcapture.c
block-bochs.c
block-cloop.c
block-cow.c
block-dmg.c
block-qcow.c
block-qcow2.c
block-raw.c
block-vmdk.c
block-vpc.c
block-vvfat.c
block.c
block_int.h
bswap.h
cocoa.m
configure
console.c
cpu-all.h
cpu-defs.h
cpu-exec.c
cutils.c
darwin-user/syscall.c
dis-asm.h
disas.c
dyngen-exec.h
dyngen.c
dyngen.h
elf.h
elf_ops.h
exec-all.h
exec.c
fpu/softfloat-native.c
gdbstub.c
hw/acpi.c
hw/adb.c
hw/apb_pci.c
hw/apic.c
hw/arm_boot.c
hw/arm_gic.c
hw/arm_pic.c
hw/arm_pic.h
hw/arm_sysctl.c
hw/arm_timer.c
hw/cdrom.c
hw/cirrus_vga.c
hw/cirrus_vga_rop.h
hw/cirrus_vga_rop2.h
hw/cuda.c
hw/esp.c
hw/fdc.c
hw/grackle_pci.c
hw/gt64xxx.c
hw/heathrow_pic.c
hw/i8254.c
hw/i8259.c
hw/ide.c
hw/integratorcp.c
hw/iommu.c
hw/isa_mmio.c
hw/lsi53c895a.c
hw/m48t59.c
hw/mc146818rtc.c
hw/mips_int.c
hw/mips_r4k.c
hw/ne2000.c
hw/openpic.c
hw/parallel.c
hw/pc.c
hw/pci.c
hw/pci_host.h
hw/pckbd.c
hw/pcnet.c
hw/pflash_cfi02.c
hw/piix_pci.c
hw/pl011.c
hw/pl050.c
hw/pl080.c
hw/pl110.c
hw/pl110_template.h
hw/pl190.c
hw/ppc.c
hw/ppc_chrp.c
hw/ppc_prep.c
hw/prep_pci.c
hw/ps2.c
hw/realview.c
hw/rtl8139.c
hw/serial.c
hw/sh7750.c
hw/sh7750_regs.h
hw/shix.c
hw/slavio_intctl.c
hw/slavio_misc.c
hw/slavio_serial.c
hw/slavio_timer.c
hw/smbus.h
hw/smbus_eeprom.c
hw/smc91c111.c
hw/sparc32_dma.c
hw/sun4m.c
hw/sun4u.c
hw/tcx.c
hw/unin_pci.c
hw/usb-hid.c
hw/usb-hub.c
hw/usb-msd.c
hw/usb-uhci.c
hw/usb.c
hw/usb.h
hw/versatile_pci.c
hw/versatilepb.c
hw/vga.c
hw/vga_int.h
hw/vga_template.h
keymaps.c
keymaps/common
keymaps/de-ch
keymaps/et
keymaps/fr
keymaps/is
keymaps/modifiers
keymaps/nl
keymaps/sv
kqemu.c
kqemu.h
linux-user/elfload.c
linux-user/flat.h
linux-user/flatload.c
linux-user/i386/syscall.h
linux-user/linuxload.c
linux-user/m68k-semi.c
linux-user/m68k-sim.c
linux-user/main.c
linux-user/mmap.c
linux-user/ppc/syscall.h
linux-user/qemu.h
linux-user/sh4/termbits.h
linux-user/signal.c
linux-user/sparc/termbits.h
linux-user/sparc64/termbits.h
linux-user/syscall.c
linux-user/syscall_defs.h
linux-user/syscall_types.h
linux-user/vm86.c
loader.c
m68k-dis.c
mips-dis.c
monitor.c
osdep.c
pc-bios/bios.bin
pc-bios/bios.diff
pc-bios/linux_boot.S
pc-bios/ohw.diff
pc-bios/openbios-sparc32
pc-bios/ppc_rom.bin
pc-bios/pxe-ne2k_pci.bin
pc-bios/vgabios-cirrus.bin
pc-bios/vgabios.bin
pc-bios/vgabios.diff
ppc-dis.c
qemu-doc.texi
qemu-img.c
qemu-img.texi
qemu-tech.texi
readline.c
sdl.c
sh4-dis.c
slirp/COPYRIGHT
slirp/bootp.c
slirp/cksum.c
slirp/debug.c
slirp/debug.h
slirp/if.c
slirp/if.h
slirp/ip_icmp.c
slirp/ip_input.c
slirp/ip_output.c
slirp/libslirp.h
slirp/main.h
slirp/mbuf.c
slirp/mbuf.h
slirp/misc.c
slirp/misc.h
slirp/sbuf.c
slirp/sbuf.h
slirp/slirp.c
slirp/socket.c
slirp/socket.h
slirp/tcp_input.c
slirp/tcp_output.c
slirp/tcp_subr.c
slirp/tcp_timer.c
slirp/tftp.c
slirp/tftp.h
slirp/udp.c
slirp/udp.h
softmmu_header.h
softmmu_template.h
sparc-dis.c
tap-win32.c
target-arm/cpu.h
target-arm/exec.h
target-arm/helper.c
target-arm/nwfpe/double_cpdo.c
target-arm/nwfpe/extended_cpdo.c
target-arm/nwfpe/fpa11.c
target-arm/nwfpe/fpa11.h
target-arm/nwfpe/fpa11_cpdo.c
target-arm/nwfpe/fpa11_cpdt.c
target-arm/nwfpe/fpa11_cprt.c
target-arm/nwfpe/fpopcode.c
target-arm/nwfpe/fpopcode.h
target-arm/nwfpe/fpsr.h
target-arm/nwfpe/single_cpdo.c
target-arm/op.c
target-arm/op_helper.c
target-arm/op_template.h
target-arm/translate.c
target-i386/cpu.h
target-i386/exec.h
target-i386/helper.c
target-i386/helper2.c
target-i386/op.c
target-i386/opreg_template.h
target-i386/ops_sse.h
target-i386/ops_template.h
target-i386/ops_template_mem.h
target-i386/translate-copy.c
target-i386/translate.c
target-m68k/cpu.h
target-m68k/exec.h
target-m68k/helper.c
target-m68k/op.c
target-m68k/translate.c
target-mips/cpu.h
target-mips/exec.h
target-mips/fop_template.c
target-mips/helper.c
target-mips/op.c
target-mips/op_helper.c
target-mips/op_mem.c
target-mips/op_template.c
target-mips/translate.c
target-ppc/cpu.h
target-ppc/exec.h
target-ppc/helper.c
target-ppc/op.c
target-ppc/op_helper.c
target-ppc/op_template.h
target-ppc/translate.c
target-ppc/translate_init.c
target-sh4/README.sh4
target-sh4/cpu.h
target-sh4/exec.h
target-sh4/helper.c
target-sh4/op.c
target-sh4/op_helper.c
target-sh4/op_mem.c
target-sh4/translate.c
target-sparc/cpu.h
target-sparc/fop_template.h
target-sparc/helper.c
target-sparc/op.c
target-sparc/op_helper.c
target-sparc/op_template.h
target-sparc/translate.c
tests/hello-arm.c
tests/linux-test.c
tests/qruncom.c
tests/runcom.c
tests/test-i386-code16.S
tests/test-i386-muldiv.h
tests/test-i386-vm86.S
tests/test-i386.c
tests/test_path.c
texi2pod.pl
thunk.c
thunk.h
translate-all.c
translate-op.c
usb-linux.c
vl.c
vl.h
vnc.c
vnchextile.h

index 223ede7de3ec74eb86253f9ce9ed7ba3c5aa9130..7c8d84f67b2591184987cf33537fcf622a542f7c 100644 (file)
@@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
 on the Library (independent of the use of the Library in a tool for
 writing it).  Whether that is true depends on what the Library does
 and what the program that uses the Library does.
-  
+
   1. You may copy and distribute verbatim copies of the Library's
 complete source code as you receive it, in any medium, provided that
 you conspicuously and appropriately publish on each copy an
index ea9ea7492f880a2566bc91f2f656f587d4780bbd..f421b910dcc327f36ad7223279b5a2b3062c5bdb 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -72,7 +72,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)
@@ -121,7 +121,7 @@ version 0.6.1:
   - Mac OS X port (Pierre d'Herbemont)
   - Virtual console support
   - Better monitor line edition
-  - New block device layer 
+  - New block device layer
   - New 'qcow' growable disk image support with AES encryption and
     transparent decompression
   - VMware 3 and 4 read-only disk image support (untested)
@@ -187,7 +187,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)
@@ -214,7 +214,7 @@ version 0.5.3:
   - added accurate CR0.MP/ME/TS emulation
   - fixed DMA memory write access (Win95 boot floppy fix)
   - graphical x86 linux loader
-  - command line monitor 
+  - command line monitor
   - generic removable device support
   - support of CD-ROM change
   - multiple network interface support
@@ -252,7 +252,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
@@ -267,7 +267,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
@@ -305,7 +305,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.
@@ -391,7 +391,7 @@ version 0.1.3:
  - added bound, cmpxchg8b, cpuid instructions
  - added 16 bit addressing support/override for string operations
  - poll() fix
+
 version 0.1.2:
 
  - compile fixes
index db76c89d95b5f845b9039051ef6cbf21132e7068..febd400155e93ce9e3e1786017f8dcc0429301ca 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -47,7 +47,7 @@ dyngen$(EXESUF): dyngen.c
 
 clean:
 # avoid old build problems by removing potentially incorrect old files
-       rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h 
+       rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
        rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
        $(MAKE) -C tests clean
        for d in $(TARGET_DIRS); do \
@@ -96,7 +96,7 @@ endif
 test speed test2: all
        $(MAKE) -C tests $@
 
-TAGS: 
+TAGS:
        etags *.[ch] tests/*.[ch]
 
 cscope:
index dc9a965753d82a28e22b63c7cf025ecacd01c140..31d01da49d00f8286742a1e20df861223edf5f7c 100644 (file)
@@ -228,7 +228,7 @@ OBJS+= libqemu.a
 
 # cpu emulator library
 LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
-        translate.o op.o 
+        translate.o op.o
 ifdef CONFIG_SOFTFLOAT
 LIBOBJS+=fpu/softfloat.o
 else
@@ -272,7 +272,7 @@ LIBOBJS+= helper.o
 endif
 
 # NOTE: the disassembler code is only needed for debugging
-LIBOBJS+=disas.o 
+LIBOBJS+=disas.o
 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
 USE_I386_DIS=y
 endif
@@ -408,7 +408,7 @@ ifeq ($(TARGET_BASE_ARCH), sh4)
 VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o
 endif
 ifdef CONFIG_GDBSTUB
-VL_OBJS+=gdbstub.o 
+VL_OBJS+=gdbstub.o
 endif
 ifdef CONFIG_SDL
 VL_OBJS+=sdl.o x_keymap.o
@@ -435,7 +435,7 @@ ifdef CONFIG_STATIC
 VL_LDFLAGS+=-static
 endif
 ifndef CONFIG_SOFTMMU
-VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld 
+VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
 endif
 ifndef CONFIG_DARWIN
 ifndef CONFIG_WIN32
@@ -483,7 +483,7 @@ depend: $(SRCS)
 vldepend: $(VL_OBJS:.o=.c)
        $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
 
-# libqemu 
+# libqemu
 
 libqemu.a: $(LIBOBJS)
        rm -f $@
@@ -574,7 +574,7 @@ $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
 clean:
        rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
 
-install: all 
+install: all
 ifneq ($(PROGS),)
        $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
 endif
diff --git a/TODO b/TODO
index 516ea87bf454b706aca761afb21fd0bfb966a915..178a071bfa9d45beeecf927ee4a4c3fd43d2c399 100644 (file)
--- a/TODO
+++ b/TODO
@@ -16,7 +16,7 @@ short term:
 - do not resize vga if invalid size.
 - avoid looping if only exceptions
 - TLB code protection support for PPC
-- see openMosix Doc 
+- see openMosix Doc
 - disable SMC handling for ARM/SPARC/PPC (not finished)
 - see undefined flags for BTx insn
 - user/kernel PUSHL/POPL in helper.c
diff --git a/aes.c b/aes.c
index cd4484ff9b4ec7f4e8cd09b75d8e90f14b16349a..40ed109d3b9e9dbf5dcdbaa9d4e6babb6f8dcc1a 100644 (file)
--- a/aes.c
+++ b/aes.c
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  * aes.c - integrated in QEMU by Fabrice Bellard from the OpenSSL project.
  */
 /*
@@ -1267,7 +1267,7 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
 
 void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
                     const unsigned long length, const AES_KEY *key,
-                    unsigned char *ivec, const int enc) 
+                    unsigned char *ivec, const int enc)
 {
 
        unsigned long n;
@@ -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);
-               }                       
+               }
        }
 }
index 81a55e9c0fc138ba1e62fa68d83b4419196c5d8f..c6af1aa75d2b17da0e0af71af067d98c27a9d4f1 100644 (file)
@@ -374,7 +374,7 @@ const struct alpha_operand alpha_operands[] =
 
   /* The signed "23-bit" aligned displacement of Branch format insns */
 #define BDISP          (MDISP + 1)
-  { 21, 0, BFD_RELOC_23_PCREL_S2, 
+  { 21, 0, BFD_RELOC_23_PCREL_S2,
     AXP_OPERAND_RELATIVE, insert_bdisp, extract_bdisp },
 
   /* The 26-bit PALcode function */
index 1e027efc7081397a1de4bd6135eee62adc50da9c..11f580b2f38651512361bf9d0c8304f1ec03e863 100644 (file)
--- a/arm-dis.c
+++ b/arm-dis.c
@@ -4,17 +4,17 @@
    Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
    Modification by James G. Smith (jsmith@cygnus.co.uk)
 
-This file is part of libopcodes. 
+This file is part of libopcodes.
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
 Software Foundation; either version 2 of the License, or (at your option)
-any later version. 
+any later version.
 
 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details. 
+more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
@@ -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"},
@@ -303,7 +303,7 @@ static struct arm_opcode arm_opcodes[] =
     {0x0d100400, 0x0f500f00, "cfldrs%c\tmvf%12-15d, %A"},
     {0x0c100400, 0x0f500f00, "cfldrs%c\tmvf%12-15d, %A"},
     {0x0d500400, 0x0f500f00, "cfldrd%c\tmvd%12-15d, %A"},
-    {0x0c500400, 0x0f500f00, "cfldrd%c\tmvd%12-15d, %A"}, 
+    {0x0c500400, 0x0f500f00, "cfldrd%c\tmvd%12-15d, %A"},
     {0x0d100500, 0x0f500f00, "cfldr32%c\tmvfx%12-15d, %A"},
     {0x0c100500, 0x0f500f00, "cfldr32%c\tmvfx%12-15d, %A"},
     {0x0d500500, 0x0f500f00, "cfldr64%c\tmvdx%12-15d, %A"},
@@ -571,7 +571,7 @@ static boolean force_thumb = false;
 static char * arm_fp_const[] =
 {"0.0", "1.0", "2.0", "3.0", "4.0", "5.0", "0.5", "10.0"};
 
-static char * arm_shift[] = 
+static char * arm_shift[] =
 {"lsl", "lsr", "asr", "ror"};
 \f
 /* Forward declarations.  */
@@ -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,13 +710,13 @@ print_insn_arm1 (pc, info, given)
                              /* ie ignore the offset.  */
                              offset = pc + 8;
                            }
-                         
+
                          func (stream, "\t; ");
                          info->print_address_func (offset, info);
                        }
                      else
                        {
-                         func (stream, "[%s", 
+                         func (stream, "[%s",
                                arm_regnames[(given >> 16) & 0xf]);
                          if ((given & 0x01000000) != 0)
                            {
@@ -736,7 +736,7 @@ print_insn_arm1 (pc, info, given)
                                  arm_decode_shift (given, func, stream);
                                }
 
-                             func (stream, "]%s", 
+                             func (stream, "]%s",
                                    ((given & 0x00200000) != 0) ? "!" : "");
                            }
                          else
@@ -748,13 +748,13 @@ print_insn_arm1 (pc, info, given)
                                    func (stream, "], %s#%d",
                                          (((given & 0x00800000) == 0)
                                           ? "-" : ""), offset);
-                                 else 
+                                 else
                                    func (stream, "]");
                                }
                              else
                                {
                                  func (stream, "], %s",
-                                       (((given & 0x00800000) == 0) 
+                                       (((given & 0x00800000) == 0)
                                         ? "-" : ""));
                                  arm_decode_shift (given, func, stream);
                                }
@@ -767,18 +767,18 @@ 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);
                        }
                      else
                        {
-                         func (stream, "[%s", 
+                         func (stream, "[%s",
                                arm_regnames[(given >> 16) & 0xf]);
                          if ((given & 0x01000000) != 0)
                            {
@@ -801,7 +801,7 @@ print_insn_arm1 (pc, info, given)
                                         arm_regnames[given & 0xf]);
                                }
 
-                             func (stream, "]%s", 
+                             func (stream, "]%s",
                                    ((given & 0x00200000) != 0) ? "!" : "");
                            }
                          else
@@ -815,7 +815,7 @@ print_insn_arm1 (pc, info, given)
                                    func (stream, "], %s#%d",
                                          (((given & 0x00800000) == 0)
                                           ? "-" : ""), offset);
-                                 else 
+                                 else
                                    func (stream, "]");
                                }
                              else
@@ -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)
                        {
@@ -1028,7 +1028,7 @@ print_insn_arm1 (pc, info, given)
                        }
                      break;
 
-                   case '0': case '1': case '2': case '3': case '4': 
+                   case '0': case '1': case '2': case '3': case '4':
                    case '5': case '6': case '7': case '8': case '9':
                      {
                        int bitstart = *c++ - '0';
@@ -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++)
@@ -1365,12 +1365,12 @@ print_insn_thumb (pc, info, given)
                           break;
 
 
-                        case '0': case '1': case '2': case '3': case '4': 
+                        case '0': case '1': case '2': case '3': case '4':
                         case '5': case '6': case '7': case '8': case '9':
                           {
                             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,11 +1478,11 @@ parse_arm_disassembler_option (option)
 {
   if (option == NULL)
     return;
-      
+
   if (strneq (option, "reg-names-", 10))
     {
       int i;
-       
+
       option += 10;
 
       for (i = NUM_ARM_REGNAMES; 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,
index 4ddbc73c2aebe9e486a7fd320b0f06b67f569eea..b4fdba8ca946869e1364f83f744215d4e4c3a68e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Arm "Angel" semihosting syscalls
- * 
+ *
  *  Copyright (c) 2005, 2007 CodeSourcery.
  *  Written by Paul Brook.
  *
@@ -429,7 +429,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);
index d915fa02bf69a9845ccb8ab91c7aa2b723c05a08..4810fa30ddeebbf0db837ce393247bf335bcc23e 100644 (file)
@@ -37,15 +37,15 @@ static void wav_destroy (void *opaque)
     if (wav->f) {
         le_store (rlen, rifflen, 4);
         le_store (dlen, datalen, 4);
-        
+
         qemu_fseek (wav->f, 4, SEEK_SET);
         qemu_put_buffer (wav->f, rlen, 4);
-        
+
         qemu_fseek (wav->f, 32, SEEK_CUR);
         qemu_put_buffer (wav->f, dlen, 4);
         qemu_fclose (wav->f);
     }
-    
+
     qemu_free (wav->path);
 }
 
index 35e2a6cf011235bbc416943b51d58253cb90e844..9baea9b6f1711162582f87f51d40f89caadfadc2 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * Block driver for the various disk image formats used by Bochs
  * Currently only for "growing" type in read-only mode
- * 
+ *
  * Copyright (c) 2005 Alex Beregszaszi
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -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,11 +210,11 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
     }
 
     lseek(s->fd, block_offset, SEEK_SET);
-    
+
     return 0;
 }
 
-static int bochs_read(BlockDriverState *bs, int64_t sector_num, 
+static int bochs_read(BlockDriverState *bs, int64_t sector_num,
                     uint8_t *buf, int nb_sectors)
 {
     BDRVBochsState *s = bs->opaque;
index f51c32d1bddbbbadf6bb4ad8d31c680c64e41352..0c9ddb381451d0170301d0d1240dc7738dd96c8b 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU Block driver for CLOOP images
- * 
+ *
  * Copyright (c) 2004 Johannes E. Schindelin
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -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,12 +107,12 @@ 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) 
+        if (ret != bytes)
             return -1;
-       
+
        s->zstream.next_in = s->compressed_block;
        s->zstream.avail_in = bytes;
        s->zstream.next_out = s->uncompressed_block;
@@ -123,13 +123,13 @@ static inline int cloop_read_block(BDRVCloopState *s,int block_num)
        ret = inflate(&s->zstream, Z_FINISH);
        if(ret != Z_STREAM_END || s->zstream.total_out != s->block_size)
            return -1;
-       
+
        s->current_block = block_num;
     }
     return 0;
 }
 
-static int cloop_read(BlockDriverState *bs, int64_t sector_num, 
+static int cloop_read(BlockDriverState *bs, int64_t sector_num,
                     uint8_t *buf, int nb_sectors)
 {
     BDRVCloopState *s = bs->opaque;
index 07c8a7bf167a704b835ad44ae2a82b37cc70da6d..47a91e5ac97fef0dbce3d947bd5a74938bede87e 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Block driver for the COW format
- * 
+ *
  * Copyright (c) 2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -56,7 +56,7 @@ static int cow_probe(const uint8_t *buf, int buf_size, const char *filename)
 
     if (buf_size >= sizeof(struct cow_header_v2) &&
         be32_to_cpu(cow_header->magic) == COW_MAGIC &&
-        be32_to_cpu(cow_header->version) == COW_VERSION) 
+        be32_to_cpu(cow_header->version) == COW_VERSION)
         return 100;
     else
         return 0;
@@ -85,18 +85,18 @@ 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), 
+    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), 
-                              s->cow_bitmap_size, 
+    s->cow_bitmap_addr = mmap(get_mmap_addr(s->cow_bitmap_size),
+                              s->cow_bitmap_size,
                               PROT_READ | PROT_WRITE,
                               MAP_SHARED, s->fd, 0);
     if (s->cow_bitmap_addr == MAP_FAILED)
@@ -143,24 +143,24 @@ static inline int is_changed(uint8_t *bitmap,
     return changed;
 }
 
-static int cow_is_allocated(BlockDriverState *bs, int64_t sector_num, 
+static int cow_is_allocated(BlockDriverState *bs, int64_t sector_num,
                             int nb_sectors, int *pnum)
 {
     BDRVCowState *s = bs->opaque;
     return is_changed(s->cow_bitmap, sector_num, nb_sectors, pnum);
 }
 
-static int cow_read(BlockDriverState *bs, int64_t sector_num, 
+static int cow_read(BlockDriverState *bs, int64_t sector_num,
                     uint8_t *buf, int nb_sectors)
 {
     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);
             ret = read(s->fd, buf, n * 512);
-            if (ret != n * 512) 
+            if (ret != n * 512)
                 return -1;
         } else {
             if (bs->backing_hd) {
@@ -179,15 +179,15 @@ static int cow_read(BlockDriverState *bs, int64_t sector_num,
     return 0;
 }
 
-static int cow_write(BlockDriverState *bs, int64_t sector_num, 
+static int cow_write(BlockDriverState *bs, int64_t sector_num,
                      const uint8_t *buf, int nb_sectors)
 {
     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) 
+    if (ret != nb_sectors * 512)
         return -1;
     for (i = 0; i < nb_sectors; i++)
         cow_set_bit(s->cow_bitmap, sector_num + i);
@@ -211,7 +211,7 @@ static int cow_create(const char *filename, int64_t image_sectors,
     if (flags)
         return -ENOTSUP;
 
-    cow_fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 
+    cow_fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
               0644);
     if (cow_fd < 0)
         return -1;
index a883a23f8e132155217ca6480ae8dea6707eeea1..681f4dc7177808dc9024907c8512b668e295f40e 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU Block driver for DMG images
- * 
+ *
  * Copyright (c) 2004 Johannes E. Schindelin
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -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;
 }
 
@@ -227,7 +227,7 @@ static inline int dmg_read_chunk(BDRVDMGState *s,int sector_num)
 
            if (ret != s->lengths[chunk])
                return -1;
-       
+
            s->zstream.next_in = s->compressed_chunk;
            s->zstream.avail_in = s->lengths[chunk];
            s->zstream.next_out = s->uncompressed_chunk;
@@ -253,7 +253,7 @@ static inline int dmg_read_chunk(BDRVDMGState *s,int sector_num)
     return 0;
 }
 
-static int dmg_read(BlockDriverState *bs, int64_t sector_num, 
+static int dmg_read(BlockDriverState *bs, int64_t sector_num,
                     uint8_t *buf, int nb_sectors)
 {
     BDRVDMGState *s = bs->opaque;
index d5333b379d7327b1bd414d2ed6ffcc652305a792..549b57c72e123ea96fd875287bf58ec80e64abb5 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Block driver for the QCOW format
- * 
+ *
  * Copyright (c) 2004-2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -80,10 +80,10 @@ 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) 
+        be32_to_cpu(cow_header->version) == QCOW_VERSION)
         return 100;
     else
         return 0;
@@ -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)
@@ -134,7 +134,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
     s->l1_table = qemu_malloc(s->l1_size * sizeof(uint64_t));
     if (!s->l1_table)
         goto fail;
-    if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)) != 
+    if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)) !=
         s->l1_size * sizeof(uint64_t))
         goto fail;
     for(i = 0;i < s->l1_size; i++) {
@@ -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)
@@ -231,7 +231,7 @@ static void encrypt_sectors(BDRVQcowState *s, int64_t sector_num,
     for(i = 0; i < nb_sectors; i++) {
         ivec.ll[0] = cpu_to_le64(sector_num);
         ivec.ll[1] = 0;
-        AES_cbc_encrypt(in_buf, out_buf, 512, key, 
+        AES_cbc_encrypt(in_buf, out_buf, 512, key,
                         ivec.b, enc);
         sector_num++;
         in_buf += 512;
@@ -248,7 +248,7 @@ static void encrypt_sectors(BDRVQcowState *s, int64_t sector_num,
  *
  * 2 to allocate a compressed cluster of size
  * 'compressed_size'. 'compressed_size' must be > 0 and <
- * cluster_size 
+ * cluster_size
  *
  * return 0 if not allocated.
  */
@@ -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;
@@ -276,7 +276,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
         /* update the L1 entry */
         s->l1_table[l1_index] = l2_offset;
         tmp = cpu_to_be64(l2_offset);
-        if (bdrv_pwrite(s->hd, s->l1_table_offset + l1_index * sizeof(tmp), 
+        if (bdrv_pwrite(s->hd, s->l1_table_offset + l1_index * sizeof(tmp),
                         &tmp, sizeof(tmp)) != sizeof(tmp))
             return 0;
         new_l2_table = 1;
@@ -309,7 +309,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
             s->l2_size * sizeof(uint64_t))
             return 0;
     } else {
-        if (bdrv_pread(s->hd, l2_offset, l2_table, s->l2_size * sizeof(uint64_t)) != 
+        if (bdrv_pread(s->hd, l2_offset, l2_table, s->l2_size * sizeof(uint64_t)) !=
             s->l2_size * sizeof(uint64_t))
             return 0;
     }
@@ -318,7 +318,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
  found:
     l2_index = (offset >> s->cluster_bits) & (s->l2_size - 1);
     cluster_offset = be64_to_cpu(l2_table[l2_index]);
-    if (!cluster_offset || 
+    if (!cluster_offset ||
         ((cluster_offset & QCOW_OFLAG_COMPRESSED) && allocate == 1)) {
         if (!allocate)
             return 0;
@@ -331,54 +331,54 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
             if (decompress_cluster(s, cluster_offset) < 0)
                 return 0;
             cluster_offset = bdrv_getlength(s->hd);
-            cluster_offset = (cluster_offset + s->cluster_size - 1) & 
+            cluster_offset = (cluster_offset + s->cluster_size - 1) &
                 ~(s->cluster_size - 1);
             /* write the cluster content */
-            if (bdrv_pwrite(s->hd, cluster_offset, s->cluster_cache, s->cluster_size) != 
+            if (bdrv_pwrite(s->hd, cluster_offset, s->cluster_cache, s->cluster_size) !=
                 s->cluster_size)
                 return -1;
         } else {
             cluster_offset = bdrv_getlength(s->hd);
             if (allocate == 1) {
                 /* round to cluster size */
-                cluster_offset = (cluster_offset + s->cluster_size - 1) & 
+                cluster_offset = (cluster_offset + s->cluster_size - 1) &
                     ~(s->cluster_size - 1);
                 bdrv_truncate(s->hd, cluster_offset + s->cluster_size);
                 /* if encrypted, we must initialize the cluster
                    content which won't be written */
-                if (s->crypt_method && 
+                if (s->crypt_method &&
                     (n_end - n_start) < s->cluster_sectors) {
                     uint64_t start_sect;
                     start_sect = (offset & ~(s->cluster_size - 1)) >> 9;
                     memset(s->cluster_data + 512, 0x00, 512);
                     for(i = 0; i < s->cluster_sectors; i++) {
                         if (i < n_start || i >= n_end) {
-                            encrypt_sectors(s, start_sect + i, 
-                                            s->cluster_data, 
+                            encrypt_sectors(s, start_sect + i,
+                                            s->cluster_data,
                                             s->cluster_data + 512, 1, 1,
                                             &s->aes_encrypt_key);
-                            if (bdrv_pwrite(s->hd, cluster_offset + i * 512, 
+                            if (bdrv_pwrite(s->hd, cluster_offset + i * 512,
                                             s->cluster_data, 512) != 512)
                                 return -1;
                         }
                     }
                 }
             } else {
-                cluster_offset |= QCOW_OFLAG_COMPRESSED | 
+                cluster_offset |= QCOW_OFLAG_COMPRESSED |
                     (uint64_t)compressed_size << (63 - s->cluster_bits);
             }
         }
         /* update L2 table */
         tmp = cpu_to_be64(cluster_offset);
         l2_table[l2_index] = tmp;
-        if (bdrv_pwrite(s->hd, 
+        if (bdrv_pwrite(s->hd,
                         l2_offset + l2_index * sizeof(tmp), &tmp, sizeof(tmp)) != sizeof(tmp))
             return 0;
     }
     return cluster_offset;
 }
 
-static int qcow_is_allocated(BlockDriverState *bs, int64_t sector_num, 
+static int qcow_is_allocated(BlockDriverState *bs, int64_t sector_num,
                              int nb_sectors, int *pnum)
 {
     BDRVQcowState *s = bs->opaque;
@@ -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;
@@ -431,7 +431,7 @@ static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset)
         csize = cluster_offset >> (63 - s->cluster_bits);
         csize &= (s->cluster_size - 1);
         ret = bdrv_pread(s->hd, coffset, s->cluster_data, csize);
-        if (ret != csize) 
+        if (ret != csize)
             return -1;
         if (decompress_buffer(s->cluster_cache, s->cluster_size,
                               s->cluster_data, csize) < 0) {
@@ -444,13 +444,13 @@ static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset)
 
 #if 0
 
-static int qcow_read(BlockDriverState *bs, int64_t sector_num, 
+static int qcow_read(BlockDriverState *bs, int64_t sector_num,
                      uint8_t *buf, int nb_sectors)
 {
     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);
@@ -472,10 +472,10 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num,
             memcpy(buf, s->cluster_cache + index_in_cluster * 512, 512 * n);
         } else {
             ret = bdrv_pread(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512);
-            if (ret != n * 512) 
+            if (ret != n * 512)
                 return -1;
             if (s->crypt_method) {
-                encrypt_sectors(s, sector_num, buf, buf, n, 0, 
+                encrypt_sectors(s, sector_num, buf, buf, n, 0,
                                 &s->aes_decrypt_key);
             }
         }
@@ -487,32 +487,32 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num,
 }
 #endif
 
-static int qcow_write(BlockDriverState *bs, int64_t sector_num, 
+static int qcow_write(BlockDriverState *bs, int64_t sector_num,
                      const uint8_t *buf, int nb_sectors)
 {
     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;
         if (n > nb_sectors)
             n = nb_sectors;
-        cluster_offset = get_cluster_offset(bs, sector_num << 9, 1, 0, 
-                                            index_in_cluster, 
+        cluster_offset = get_cluster_offset(bs, sector_num << 9, 1, 0,
+                                            index_in_cluster,
                                             index_in_cluster + n);
         if (!cluster_offset)
             return -1;
         if (s->crypt_method) {
             encrypt_sectors(s, sector_num, s->cluster_data, buf, n, 1,
                             &s->aes_encrypt_key);
-            ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, 
+            ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512,
                               s->cluster_data, n * 512);
         } else {
             ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512);
         }
-        if (ret != n * 512) 
+        if (ret != n * 512)
             return -1;
         nb_sectors -= n;
         sector_num += n;
@@ -529,7 +529,7 @@ typedef struct QCowAIOCB {
     int nb_sectors;
     int n;
     uint64_t cluster_offset;
-    uint8_t *cluster_data; 
+    uint8_t *cluster_data;
     BlockDriverAIOCB *hd_aiocb;
 } QCowAIOCB;
 
@@ -556,8 +556,8 @@ static void qcow_aio_read_cb(void *opaque, int ret)
         /* nothing to do */
     } else {
         if (s->crypt_method) {
-            encrypt_sectors(s, acb->sector_num, acb->buf, acb->buf, 
-                            acb->n, 0, 
+            encrypt_sectors(s, acb->sector_num, acb->buf, acb->buf,
+                            acb->n, 0,
                             &s->aes_decrypt_key);
         }
     }
@@ -572,9 +572,9 @@ 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, 
+    acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9,
                                              0, 0, 0, 0);
     index_in_cluster = acb->sector_num & (s->cluster_sectors - 1);
     acb->n = s->cluster_sectors - index_in_cluster;
@@ -597,7 +597,7 @@ static void qcow_aio_read_cb(void *opaque, int ret)
         /* add AIO support for compressed blocks ? */
         if (decompress_cluster(s, acb->cluster_offset) < 0)
             goto fail;
-        memcpy(acb->buf, 
+        memcpy(acb->buf,
                s->cluster_cache + index_in_cluster * 512, 512 * acb->n);
         goto redo;
     } else {
@@ -606,7 +606,7 @@ static void qcow_aio_read_cb(void *opaque, int ret)
             goto fail;
         }
         acb->hd_aiocb = bdrv_aio_read(s->hd,
-                            (acb->cluster_offset >> 9) + index_in_cluster, 
+                            (acb->cluster_offset >> 9) + index_in_cluster,
                             acb->buf, acb->n, qcow_aio_read_cb, acb);
         if (acb->hd_aiocb == NULL)
             goto fail;
@@ -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,13 +661,13 @@ 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)
         acb->n = acb->nb_sectors;
-    cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, 1, 0, 
-                                        index_in_cluster, 
+    cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, 1, 0,
+                                        index_in_cluster,
                                         index_in_cluster + acb->n);
     if (!cluster_offset || (cluster_offset & 511) != 0) {
         ret = -EIO;
@@ -681,15 +681,15 @@ static void qcow_aio_write_cb(void *opaque, int ret)
                 goto fail;
             }
         }
-        encrypt_sectors(s, acb->sector_num, acb->cluster_data, acb->buf, 
+        encrypt_sectors(s, acb->sector_num, acb->cluster_data, acb->buf,
                         acb->n, 1, &s->aes_encrypt_key);
         src_buf = acb->cluster_data;
     } else {
         src_buf = acb->buf;
     }
     acb->hd_aiocb = bdrv_aio_write(s->hd,
-                                   (cluster_offset >> 9) + index_in_cluster, 
-                                   src_buf, acb->n, 
+                                   (cluster_offset >> 9) + index_in_cluster,
+                                   src_buf, acb->n,
                                    qcow_aio_write_cb, acb);
     if (acb->hd_aiocb == NULL)
         goto fail;
@@ -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) {
@@ -811,7 +811,7 @@ static int qcow_make_empty(BlockDriverState *bs)
 
 /* XXX: put compressed sectors first, then all the cluster aligned
    tables to avoid losing bytes in alignment */
-static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num, 
+static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
                                  const uint8_t *buf, int nb_sectors)
 {
     BDRVQcowState *s = bs->opaque;
@@ -830,7 +830,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
     /* best compression, small window, no zlib header */
     memset(&strm, 0, sizeof(strm));
     ret = deflateInit2(&strm, Z_DEFAULT_COMPRESSION,
-                       Z_DEFLATED, -12, 
+                       Z_DEFLATED, -12,
                        9, Z_DEFAULT_STRATEGY);
     if (ret != 0) {
         qemu_free(out_buf);
@@ -856,7 +856,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
         /* could not compress: write normal cluster */
         qcow_write(bs, sector_num, buf, s->cluster_sectors);
     } else {
-        cluster_offset = get_cluster_offset(bs, sector_num << 9, 2, 
+        cluster_offset = get_cluster_offset(bs, sector_num << 9, 2,
                                             out_len, 0, 0);
         cluster_offset &= s->cluster_offset_mask;
         if (bdrv_pwrite(s->hd, cluster_offset, out_buf, out_len) != out_len) {
@@ -864,7 +864,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
             return -1;
         }
     }
-    
+
     qemu_free(out_buf);
     return 0;
 }
index a876ea2e2dc2a759eca574d4ea55200308c4fe69..ac981fd98a45a32f502cc6f877161667685cd6a6 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Block driver for the QCOW version 2 format
- * 
+ *
  * Copyright (c) 2004-2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
   - Memory management by reference counts.
   - Clusters which have a reference count of one have the bit
     QCOW_OFLAG_COPIED to optimize write performance.
-  - Size of compressed clusters is stored in sectors to reduce bit usage 
+  - Size of compressed clusters is stored in sectors to reduce bit usage
     in the cluster offsets.
   - 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.
@@ -45,7 +45,7 @@
 
 //#define DEBUG_ALLOC
 //#define DEBUG_ALLOC2
+
 #define QCOW_MAGIC (('Q' << 24) | ('F' << 16) | ('I' << 8) | 0xfb)
 #define QCOW_VERSION 2
 
@@ -152,22 +152,22 @@ typedef struct BDRVQcowState {
 } BDRVQcowState;
 
 static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset);
-static int qcow_read(BlockDriverState *bs, int64_t sector_num, 
+static int qcow_read(BlockDriverState *bs, int64_t sector_num,
                      uint8_t *buf, int nb_sectors);
 static int qcow_read_snapshots(BlockDriverState *bs);
 static void qcow_free_snapshots(BlockDriverState *bs);
 static int refcount_init(BlockDriverState *bs);
 static void refcount_close(BlockDriverState *bs);
 static int get_refcount(BlockDriverState *bs, int64_t cluster_index);
-static int update_cluster_refcount(BlockDriverState *bs, 
+static int update_cluster_refcount(BlockDriverState *bs,
                                    int64_t cluster_index,
                                    int addend);
-static void update_refcount(BlockDriverState *bs, 
-                            int64_t offset, int64_t length, 
+static void update_refcount(BlockDriverState *bs,
+                            int64_t offset, int64_t length,
                             int addend);
 static int64_t alloc_clusters(BlockDriverState *bs, int64_t size);
 static int64_t alloc_bytes(BlockDriverState *bs, int size);
-static void free_clusters(BlockDriverState *bs, 
+static void free_clusters(BlockDriverState *bs,
                           int64_t offset, int64_t size);
 #ifdef DEBUG_ALLOC
 static void check_refcounts(BlockDriverState *bs);
@@ -176,10 +176,10 @@ 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) 
+        be32_to_cpu(cow_header->version) == QCOW_VERSION)
         return 100;
     else
         return 0;
@@ -209,11 +209,11 @@ 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 || 
-        header.cluster_bits < 9 || 
+    if (header.size <= 1 ||
+        header.cluster_bits < 9 ||
         header.cluster_bits > 16)
         goto fail;
     if (header.crypt_method > QCOW_CRYPT_AES)
@@ -231,7 +231,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
     s->csize_mask = (1 << (s->cluster_bits - 8)) - 1;
     s->cluster_offset_mask = (1LL << s->csize_shift) - 1;
     s->refcount_table_offset = header.refcount_table_offset;
-    s->refcount_table_size = 
+    s->refcount_table_size =
         header.refcount_table_clusters << (s->cluster_bits - 3);
 
     s->snapshots_offset = header.snapshots_offset;
@@ -249,7 +249,7 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags)
     s->l1_table = qemu_malloc(s->l1_size * sizeof(uint64_t));
     if (!s->l1_table)
         goto fail;
-    if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)) != 
+    if (bdrv_pread(s->hd, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)) !=
         s->l1_size * sizeof(uint64_t))
         goto fail;
     for(i = 0;i < s->l1_size; i++) {
@@ -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)
@@ -358,7 +358,7 @@ static void encrypt_sectors(BDRVQcowState *s, int64_t sector_num,
     for(i = 0; i < nb_sectors; i++) {
         ivec.ll[0] = cpu_to_le64(sector_num);
         ivec.ll[1] = 0;
-        AES_cbc_encrypt(in_buf, out_buf, 512, key, 
+        AES_cbc_encrypt(in_buf, out_buf, 512, key,
                         ivec.b, enc);
         sector_num++;
         in_buf += 512;
@@ -379,12 +379,12 @@ static int copy_sectors(BlockDriverState *bs, uint64_t start_sect,
     if (ret < 0)
         return ret;
     if (s->crypt_method) {
-        encrypt_sectors(s, start_sect + n_start, 
-                        s->cluster_data, 
+        encrypt_sectors(s, start_sect + n_start,
+                        s->cluster_data,
                         s->cluster_data, n, 1,
                         &s->aes_encrypt_key);
     }
-    ret = bdrv_write(s->hd, (cluster_offset >> 9) + n_start, 
+    ret = bdrv_write(s->hd, (cluster_offset >> 9) + n_start,
                      s->cluster_data, n);
     if (ret < 0)
         return ret;
@@ -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),
@@ -489,7 +489,7 @@ static int grow_l1_table(BlockDriverState *bs, int min_size)
  *
  * 2 to allocate a compressed cluster of size
  * 'compressed_size'. 'compressed_size' must be > 0 and <
- * cluster_size 
+ * cluster_size
  *
  * return 0 if not allocated.
  */
@@ -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 */
@@ -521,7 +521,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
         /* update the L1 entry */
         s->l1_table[l1_index] = l2_offset | QCOW_OFLAG_COPIED;
         tmp = cpu_to_be64(l2_offset | QCOW_OFLAG_COPIED);
-        if (bdrv_pwrite(s->hd, s->l1_table_offset + l1_index * sizeof(tmp), 
+        if (bdrv_pwrite(s->hd, s->l1_table_offset + l1_index * sizeof(tmp),
                         &tmp, sizeof(tmp)) != sizeof(tmp))
             return 0;
         min_index = l2_cache_new_entry(bs);
@@ -530,12 +530,12 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
         if (old_l2_offset == 0) {
             memset(l2_table, 0, s->l2_size * sizeof(uint64_t));
         } else {
-            if (bdrv_pread(s->hd, old_l2_offset, 
+            if (bdrv_pread(s->hd, old_l2_offset,
                            l2_table, s->l2_size * sizeof(uint64_t)) !=
                 s->l2_size * sizeof(uint64_t))
                 return 0;
         }
-        if (bdrv_pwrite(s->hd, l2_offset, 
+        if (bdrv_pwrite(s->hd, l2_offset,
                         l2_table, s->l2_size * sizeof(uint64_t)) !=
             s->l2_size * sizeof(uint64_t))
             return 0;
@@ -563,7 +563,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
         /* not found: load a new entry in the least used one */
         min_index = l2_cache_new_entry(bs);
         l2_table = s->l2_cache + (min_index << s->l2_bits);
-        if (bdrv_pread(s->hd, l2_offset, l2_table, s->l2_size * sizeof(uint64_t)) != 
+        if (bdrv_pread(s->hd, l2_offset, l2_table, s->l2_size * sizeof(uint64_t)) !=
             s->l2_size * sizeof(uint64_t))
             return 0;
     }
@@ -581,7 +581,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
         /* free the cluster */
         if (cluster_offset & QCOW_OFLAG_COMPRESSED) {
             int nb_csectors;
-            nb_csectors = ((cluster_offset >> s->csize_shift) & 
+            nb_csectors = ((cluster_offset >> s->csize_shift) &
                            s->csize_mask) + 1;
             free_clusters(bs, (cluster_offset & s->cluster_offset_mask) & ~511,
                           nb_csectors * 512);
@@ -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);
@@ -615,22 +615,22 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
     } else {
         int nb_csectors;
         cluster_offset = alloc_bytes(bs, compressed_size);
-        nb_csectors = ((cluster_offset + compressed_size - 1) >> 9) - 
+        nb_csectors = ((cluster_offset + compressed_size - 1) >> 9) -
             (cluster_offset >> 9);
-        cluster_offset |= QCOW_OFLAG_COMPRESSED | 
+        cluster_offset |= QCOW_OFLAG_COMPRESSED |
             ((uint64_t)nb_csectors << s->csize_shift);
         /* compressed clusters never have the copied flag */
         tmp = cpu_to_be64(cluster_offset);
     }
     /* update L2 table */
     l2_table[l2_index] = tmp;
-    if (bdrv_pwrite(s->hd, 
+    if (bdrv_pwrite(s->hd,
                     l2_offset + l2_index * sizeof(tmp), &tmp, sizeof(tmp)) != sizeof(tmp))
         return 0;
     return cluster_offset;
 }
 
-static int qcow_is_allocated(BlockDriverState *bs, int64_t sector_num, 
+static int qcow_is_allocated(BlockDriverState *bs, int64_t sector_num,
                              int nb_sectors, int *pnum)
 {
     BDRVQcowState *s = bs->opaque;
@@ -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;
@@ -697,7 +697,7 @@ static int decompress_cluster(BDRVQcowState *s, uint64_t cluster_offset)
 }
 
 /* handle reading after the end of the backing file */
-static int backing_read1(BlockDriverState *bs, 
+static int backing_read1(BlockDriverState *bs,
                          int64_t sector_num, uint8_t *buf, int nb_sectors)
 {
     int n1;
@@ -711,13 +711,13 @@ static int backing_read1(BlockDriverState *bs,
     return n1;
 }
 
-static int qcow_read(BlockDriverState *bs, int64_t sector_num, 
+static int qcow_read(BlockDriverState *bs, int64_t sector_num,
                      uint8_t *buf, int nb_sectors)
 {
     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);
@@ -742,10 +742,10 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num,
             memcpy(buf, s->cluster_cache + index_in_cluster * 512, 512 * n);
         } else {
             ret = bdrv_pread(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512);
-            if (ret != n * 512) 
+            if (ret != n * 512)
                 return -1;
             if (s->crypt_method) {
-                encrypt_sectors(s, sector_num, buf, buf, n, 0, 
+                encrypt_sectors(s, sector_num, buf, buf, n, 0,
                                 &s->aes_decrypt_key);
             }
         }
@@ -756,32 +756,32 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num,
     return 0;
 }
 
-static int qcow_write(BlockDriverState *bs, int64_t sector_num, 
+static int qcow_write(BlockDriverState *bs, int64_t sector_num,
                      const uint8_t *buf, int nb_sectors)
 {
     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;
         if (n > nb_sectors)
             n = nb_sectors;
-        cluster_offset = get_cluster_offset(bs, sector_num << 9, 1, 0, 
-                                            index_in_cluster, 
+        cluster_offset = get_cluster_offset(bs, sector_num << 9, 1, 0,
+                                            index_in_cluster,
                                             index_in_cluster + n);
         if (!cluster_offset)
             return -1;
         if (s->crypt_method) {
             encrypt_sectors(s, sector_num, s->cluster_data, buf, n, 1,
                             &s->aes_encrypt_key);
-            ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, 
+            ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512,
                               s->cluster_data, n * 512);
         } else {
             ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512);
         }
-        if (ret != n * 512) 
+        if (ret != n * 512)
             return -1;
         nb_sectors -= n;
         sector_num += n;
@@ -798,7 +798,7 @@ typedef struct QCowAIOCB {
     int nb_sectors;
     int n;
     uint64_t cluster_offset;
-    uint8_t *cluster_data; 
+    uint8_t *cluster_data;
     BlockDriverAIOCB *hd_aiocb;
 } QCowAIOCB;
 
@@ -825,8 +825,8 @@ static void qcow_aio_read_cb(void *opaque, int ret)
         /* nothing to do */
     } else {
         if (s->crypt_method) {
-            encrypt_sectors(s, acb->sector_num, acb->buf, acb->buf, 
-                            acb->n, 0, 
+            encrypt_sectors(s, acb->sector_num, acb->buf, acb->buf,
+                            acb->n, 0,
                             &s->aes_decrypt_key);
         }
     }
@@ -841,9 +841,9 @@ 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, 
+    acb->cluster_offset = get_cluster_offset(bs, acb->sector_num << 9,
                                              0, 0, 0, 0);
     index_in_cluster = acb->sector_num & (s->cluster_sectors - 1);
     acb->n = s->cluster_sectors - index_in_cluster;
@@ -853,10 +853,10 @@ static void qcow_aio_read_cb(void *opaque, int ret)
     if (!acb->cluster_offset) {
         if (bs->backing_hd) {
             /* read from the base image */
-            n1 = backing_read1(bs->backing_hd, acb->sector_num, 
+            n1 = backing_read1(bs->backing_hd, acb->sector_num,
                                acb->buf, acb->n);
             if (n1 > 0) {
-                acb->hd_aiocb = bdrv_aio_read(bs->backing_hd, acb->sector_num, 
+                acb->hd_aiocb = bdrv_aio_read(bs->backing_hd, acb->sector_num,
                                     acb->buf, acb->n, qcow_aio_read_cb, acb);
                 if (acb->hd_aiocb == NULL)
                     goto fail;
@@ -872,7 +872,7 @@ static void qcow_aio_read_cb(void *opaque, int ret)
         /* add AIO support for compressed blocks ? */
         if (decompress_cluster(s, acb->cluster_offset) < 0)
             goto fail;
-        memcpy(acb->buf, 
+        memcpy(acb->buf,
                s->cluster_cache + index_in_cluster * 512, 512 * acb->n);
         goto redo;
     } else {
@@ -881,7 +881,7 @@ static void qcow_aio_read_cb(void *opaque, int ret)
             goto fail;
         }
         acb->hd_aiocb = bdrv_aio_read(s->hd,
-                            (acb->cluster_offset >> 9) + index_in_cluster, 
+                            (acb->cluster_offset >> 9) + index_in_cluster,
                             acb->buf, acb->n, qcow_aio_read_cb, acb);
         if (acb->hd_aiocb == NULL)
             goto fail;
@@ -948,13 +948,13 @@ 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)
         acb->n = acb->nb_sectors;
-    cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, 1, 0, 
-                                        index_in_cluster, 
+    cluster_offset = get_cluster_offset(bs, acb->sector_num << 9, 1, 0,
+                                        index_in_cluster,
                                         index_in_cluster + acb->n);
     if (!cluster_offset || (cluster_offset & 511) != 0) {
         ret = -EIO;
@@ -968,15 +968,15 @@ static void qcow_aio_write_cb(void *opaque, int ret)
                 goto fail;
             }
         }
-        encrypt_sectors(s, acb->sector_num, acb->cluster_data, acb->buf, 
+        encrypt_sectors(s, acb->sector_num, acb->cluster_data, acb->buf,
                         acb->n, 1, &s->aes_encrypt_key);
         src_buf = acb->cluster_data;
     } else {
         src_buf = acb->buf;
     }
     acb->hd_aiocb = bdrv_aio_write(s->hd,
-                                   (cluster_offset >> 9) + index_in_cluster, 
-                                   src_buf, acb->n, 
+                                   (cluster_offset >> 9) + index_in_cluster,
+                                   src_buf, acb->n,
                                    qcow_aio_write_cb, acb);
     if (acb->hd_aiocb == NULL)
         goto fail;
@@ -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;
 }
@@ -1038,7 +1038,7 @@ static void create_refcount_update(QCowCreateState *s,
 
     start = offset & ~(s->cluster_size - 1);
     last = (offset + size - 1)  & ~(s->cluster_size - 1);
-    for(cluster_offset = start; cluster_offset <= last; 
+    for(cluster_offset = start; cluster_offset <= last;
         cluster_offset += s->cluster_size) {
         p = &s->refcount_block[cluster_offset >> s->cluster_bits];
         refcount = be16_to_cpu(*p);
@@ -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;
@@ -1161,7 +1161,7 @@ static int qcow_make_empty(BlockDriverState *bs)
 
 /* XXX: put compressed sectors first, then all the cluster aligned
    tables to avoid losing bytes in alignment */
-static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num, 
+static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
                                  const uint8_t *buf, int nb_sectors)
 {
     BDRVQcowState *s = bs->opaque;
@@ -1189,7 +1189,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
     /* best compression, small window, no zlib header */
     memset(&strm, 0, sizeof(strm));
     ret = deflateInit2(&strm, Z_DEFAULT_COMPRESSION,
-                       Z_DEFLATED, -12, 
+                       Z_DEFLATED, -12,
                        9, Z_DEFAULT_STRATEGY);
     if (ret != 0) {
         qemu_free(out_buf);
@@ -1215,7 +1215,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
         /* could not compress: write normal cluster */
         qcow_write(bs, sector_num, buf, s->cluster_sectors);
     } else {
-        cluster_offset = get_cluster_offset(bs, sector_num << 9, 2, 
+        cluster_offset = get_cluster_offset(bs, sector_num << 9, 2,
                                             out_len, 0, 0);
         cluster_offset &= s->cluster_offset_mask;
         if (bdrv_pwrite(s->hd, cluster_offset, out_buf, out_len) != out_len) {
@@ -1223,7 +1223,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num,
             return -1;
         }
     }
-    
+
     qemu_free(out_buf);
     return 0;
 }
@@ -1238,7 +1238,7 @@ static int qcow_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
 {
     BDRVQcowState *s = bs->opaque;
     bdi->cluster_size = s->cluster_size;
-    bdi->vm_state_offset = (int64_t)s->l1_vm_state_index << 
+    bdi->vm_state_offset = (int64_t)s->l1_vm_state_index <<
         (s->cluster_bits + s->l2_bits);
     return 0;
 }
@@ -1247,7 +1247,7 @@ static int qcow_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
 /* snapshot support */
 
 /* update the refcounts of snapshots and the copied flag */
-static int update_snapshot_refcount(BlockDriverState *bs, 
+static int update_snapshot_refcount(BlockDriverState *bs,
                                     int64_t l1_table_offset,
                                     int l1_size,
                                     int addend)
@@ -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;
@@ -1268,7 +1268,7 @@ static int update_snapshot_refcount(BlockDriverState *bs,
         if (!l1_table)
             goto fail;
         l1_allocated = 1;
-        if (bdrv_pread(s->hd, l1_table_offset, 
+        if (bdrv_pread(s->hd, l1_table_offset,
                        l1_table, l1_size2) != l1_size2)
             goto fail;
         for(i = 0;i < l1_size; i++)
@@ -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)
@@ -1298,13 +1298,13 @@ static int update_snapshot_refcount(BlockDriverState *bs,
                     old_offset = offset;
                     offset &= ~QCOW_OFLAG_COPIED;
                     if (offset & QCOW_OFLAG_COMPRESSED) {
-                        nb_csectors = ((offset >> s->csize_shift) & 
+                        nb_csectors = ((offset >> s->csize_shift) &
                                        s->csize_mask) + 1;
                         if (addend != 0)
                             update_refcount(bs, (offset & s->cluster_offset_mask) & ~511,
                                             nb_csectors * 512, addend);
                         /* compressed clusters are never modified */
-                        refcount = 2; 
+                        refcount = 2;
                     } else {
                         if (addend != 0) {
                             refcount = update_cluster_refcount(bs, offset >> s->cluster_bits, addend);
@@ -1323,7 +1323,7 @@ static int update_snapshot_refcount(BlockDriverState *bs,
                 }
             }
             if (l2_modified) {
-                if (bdrv_pwrite(s->hd, 
+                if (bdrv_pwrite(s->hd,
                                 l2_offset, l2_table, l2_size) != l2_size)
                     goto fail;
             }
@@ -1345,7 +1345,7 @@ static int update_snapshot_refcount(BlockDriverState *bs,
     if (l1_modified) {
         for(i = 0; i < l1_size; i++)
             cpu_to_be64s(&l1_table[i]);
-        if (bdrv_pwrite(s->hd, l1_table_offset, l1_table, 
+        if (bdrv_pwrite(s->hd, l1_table_offset, l1_table,
                         l1_size2) != l1_size2)
             goto fail;
         for(i = 0; i < l1_size; i++)
@@ -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;
@@ -1545,14 +1545,14 @@ static int find_snapshot_by_id_or_name(BlockDriverState *bs, const char *name)
 }
 
 /* if no id is provided, a new one is constructed */
-static int qcow_snapshot_create(BlockDriverState *bs, 
+static int qcow_snapshot_create(BlockDriverState *bs,
                                 QEMUSnapshotInfo *sn_info)
 {
     BDRVQcowState *s = bs->opaque;
     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') {
@@ -1590,7 +1590,7 @@ static int qcow_snapshot_create(BlockDriverState *bs,
         l1_table[i] = cpu_to_be64(s->l1_table[i]);
     }
     if (bdrv_pwrite(s->hd, sn->l1_table_offset,
-                    l1_table, s->l1_size * sizeof(uint64_t)) != 
+                    l1_table, s->l1_size * sizeof(uint64_t)) !=
         (s->l1_size * sizeof(uint64_t)))
         goto fail;
     qemu_free(l1_table);
@@ -1616,7 +1616,7 @@ static int qcow_snapshot_create(BlockDriverState *bs,
 }
 
 /* copy the snapshot 'snapshot_name' into the current disk image */
-static int qcow_snapshot_goto(BlockDriverState *bs, 
+static int qcow_snapshot_goto(BlockDriverState *bs,
                               const char *snapshot_id)
 {
     BDRVQcowState *s = bs->opaque;
@@ -1637,7 +1637,7 @@ static int qcow_snapshot_goto(BlockDriverState *bs,
     s->l1_size = sn->l1_size;
     l1_size2 = s->l1_size * sizeof(uint64_t);
     /* copy the snapshot l1 table to the current l1 table */
-    if (bdrv_pread(s->hd, sn->l1_table_offset, 
+    if (bdrv_pread(s->hd, sn->l1_table_offset,
                    s->l1_table, l1_size2) != l1_size2)
         goto fail;
     if (bdrv_pwrite(s->hd, s->l1_table_offset,
@@ -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;
@@ -1693,7 +1693,7 @@ static int qcow_snapshot_delete(BlockDriverState *bs, const char *snapshot_id)
     return 0;
 }
 
-static int qcow_snapshot_list(BlockDriverState *bs, 
+static int qcow_snapshot_list(BlockDriverState *bs,
                               QEMUSnapshotInfo **psn_tab)
 {
     BDRVQcowState *s = bs->opaque;
@@ -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;
@@ -1760,12 +1760,12 @@ static void refcount_close(BlockDriverState *bs)
 }
 
 
-static int load_refcount_block(BlockDriverState *bs, 
+static int load_refcount_block(BlockDriverState *bs,
                                int64_t refcount_block_offset)
 {
     BDRVQcowState *s = bs->opaque;
     int ret;
-    ret = bdrv_pread(s->hd, refcount_block_offset, s->refcount_block_cache, 
+    ret = bdrv_pread(s->hd, refcount_block_offset, s->refcount_block_cache,
                      s->cluster_size);
     if (ret != s->cluster_size)
         return -EIO;
@@ -1790,7 +1790,7 @@ static int get_refcount(BlockDriverState *bs, int64_t cluster_index)
         if (load_refcount_block(bs, refcount_block_offset) < 0)
             return 1;
     }
-    block_index = cluster_index & 
+    block_index = cluster_index &
         ((1 << (s->cluster_bits - REFCOUNT_SHIFT)) - 1);
     return be16_to_cpu(s->refcount_block_cache[block_index]);
 }
@@ -1812,7 +1812,7 @@ static int64_t alloc_clusters_noref(BlockDriverState *bs, int64_t size)
             }
 #ifdef DEBUG_ALLOC2
             printf("alloc_clusters: size=%lld -> %lld\n",
-                   size, 
+                   size,
                    (s->free_cluster_index - nb_clusters) << s->cluster_bits);
 #endif
             return (s->free_cluster_index - nb_clusters) << s->cluster_bits;
@@ -1839,13 +1839,13 @@ 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);
     }
  redo:
-    free_in_cluster = s->cluster_size - 
+    free_in_cluster = s->cluster_size -
         (s->free_byte_offset & (s->cluster_size - 1));
     if (size <= free_in_cluster) {
         /* enough space in current cluster */
@@ -1872,7 +1872,7 @@ static int64_t alloc_bytes(BlockDriverState *bs, int size)
     return offset;
 }
 
-static void free_clusters(BlockDriverState *bs, 
+static void free_clusters(BlockDriverState *bs,
                           int64_t offset, int64_t size)
 {
     update_refcount(bs, offset, size, -1);
@@ -1910,14 +1910,14 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size)
     new_table = qemu_mallocz(new_table_size2);
     if (!new_table)
         return -ENOMEM;
-    memcpy(new_table, s->refcount_table, 
+    memcpy(new_table, s->refcount_table,
            s->refcount_table_size * sizeof(uint64_t));
     for(i = 0; i < s->refcount_table_size; i++)
         cpu_to_be64s(&new_table[i]);
     /* Note: we cannot update the refcount now to avoid recursion */
     table_offset = alloc_clusters_noref(bs, new_table_size2);
     ret = bdrv_pwrite(s->hd, table_offset, new_table, new_table_size2);
-    if (ret != new_table_size2) 
+    if (ret != new_table_size2)
         goto fail;
     for(i = 0; i < s->refcount_table_size; i++)
         be64_to_cpus(&new_table[i]);
@@ -1944,7 +1944,7 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size)
 
 /* addend must be 1 or -1 */
 /* XXX: cache several refcount block clusters ? */
-static int update_cluster_refcount(BlockDriverState *bs, 
+static int update_cluster_refcount(BlockDriverState *bs,
                                    int64_t cluster_index,
                                    int addend)
 {
@@ -1974,8 +1974,8 @@ static int update_cluster_refcount(BlockDriverState *bs,
             return -EINVAL;
         s->refcount_table[refcount_table_index] = offset;
         data64 = cpu_to_be64(offset);
-        ret = bdrv_pwrite(s->hd, s->refcount_table_offset + 
-                          refcount_table_index * sizeof(uint64_t), 
+        ret = bdrv_pwrite(s->hd, s->refcount_table_offset +
+                          refcount_table_index * sizeof(uint64_t),
                           &data64, sizeof(data64));
         if (ret != sizeof(data64))
             return -EINVAL;
@@ -1990,7 +1990,7 @@ static int update_cluster_refcount(BlockDriverState *bs,
         }
     }
     /* we can update the count and save it */
-    block_index = cluster_index & 
+    block_index = cluster_index &
         ((1 << (s->cluster_bits - REFCOUNT_SHIFT)) - 1);
     refcount = be16_to_cpu(s->refcount_block_cache[block_index]);
     refcount += addend;
@@ -2000,50 +2000,50 @@ static int update_cluster_refcount(BlockDriverState *bs,
         s->free_cluster_index = cluster_index;
     }
     s->refcount_block_cache[block_index] = cpu_to_be16(refcount);
-    if (bdrv_pwrite(s->hd, 
-                    refcount_block_offset + (block_index << REFCOUNT_SHIFT), 
+    if (bdrv_pwrite(s->hd,
+                    refcount_block_offset + (block_index << REFCOUNT_SHIFT),
                     &s->refcount_block_cache[block_index], 2) != 2)
         return -EIO;
     return refcount;
 }
 
-static void update_refcount(BlockDriverState *bs, 
-                            int64_t offset, int64_t length, 
+static void update_refcount(BlockDriverState *bs,
+                            int64_t offset, int64_t length,
                             int addend)
 {
     BDRVQcowState *s = bs->opaque;
     int64_t start, last, cluster_offset;
 
 #ifdef DEBUG_ALLOC2
-    printf("update_refcount: offset=%lld size=%lld addend=%d\n", 
+    printf("update_refcount: offset=%lld size=%lld addend=%d\n",
            offset, length, addend);
 #endif
     if (length <= 0)
         return;
     start = offset & ~(s->cluster_size - 1);
     last = (offset + length - 1) & ~(s->cluster_size - 1);
-    for(cluster_offset = start; cluster_offset <= last; 
+    for(cluster_offset = start; cluster_offset <= last;
         cluster_offset += s->cluster_size) {
         update_cluster_refcount(bs, cluster_offset >> s->cluster_bits, addend);
     }
 }
 
 #ifdef DEBUG_ALLOC
-static void inc_refcounts(BlockDriverState *bs, 
-                          uint16_t *refcount_table, 
+static void inc_refcounts(BlockDriverState *bs,
+                          uint16_t *refcount_table,
                           int refcount_table_size,
                           int64_t offset, int64_t size)
 {
     BDRVQcowState *s = bs->opaque;
     int64_t start, last, cluster_offset;
     int k;
-    
+
     if (size <= 0)
         return;
 
     start = offset & ~(s->cluster_size - 1);
     last = (offset + size - 1) & ~(s->cluster_size - 1);
-    for(cluster_offset = start; cluster_offset <= last; 
+    for(cluster_offset = start; cluster_offset <= last;
         cluster_offset += s->cluster_size) {
         k = cluster_offset >> s->cluster_bits;
         if (k < 0 || k >= refcount_table_size) {
@@ -2056,8 +2056,8 @@ static void inc_refcounts(BlockDriverState *bs,
     }
 }
 
-static int check_refcounts_l1(BlockDriverState *bs, 
-                              uint16_t *refcount_table, 
+static int check_refcounts_l1(BlockDriverState *bs,
+                              uint16_t *refcount_table,
                               int refcount_table_size,
                               int64_t l1_table_offset, int l1_size,
                               int check_copied)
@@ -2075,12 +2075,12 @@ static int check_refcounts_l1(BlockDriverState *bs,
     l1_table = qemu_malloc(l1_size2);
     if (!l1_table)
         goto fail;
-    if (bdrv_pread(s->hd, l1_table_offset, 
+    if (bdrv_pread(s->hd, l1_table_offset,
                    l1_table, l1_size2) != l1_size2)
         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)
@@ -2107,10 +2107,10 @@ static int check_refcounts_l1(BlockDriverState *bs,
                                    offset >> s->cluster_bits);
                             offset &= ~QCOW_OFLAG_COPIED;
                         }
-                        nb_csectors = ((offset >> s->csize_shift) & 
+                        nb_csectors = ((offset >> s->csize_shift) &
                                        s->csize_mask) + 1;
                         offset &= s->cluster_offset_mask;
-                        inc_refcounts(bs, refcount_table, 
+                        inc_refcounts(bs, refcount_table,
                                       refcount_table_size,
                                       offset & ~511, nb_csectors * 512);
                     } else {
@@ -2122,13 +2122,13 @@ static int check_refcounts_l1(BlockDriverState *bs,
                             }
                         }
                         offset &= ~QCOW_OFLAG_COPIED;
-                        inc_refcounts(bs, refcount_table, 
+                        inc_refcounts(bs, refcount_table,
                                       refcount_table_size,
                                       offset, s->cluster_size);
                     }
                 }
             }
-            inc_refcounts(bs, refcount_table, 
+            inc_refcounts(bs, refcount_table,
                           refcount_table_size,
                           l2_offset,
                           s->cluster_size);
@@ -2159,7 +2159,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);
 
@@ -2174,7 +2174,7 @@ static void check_refcounts(BlockDriverState *bs)
 
     /* refcount data */
     inc_refcounts(bs, refcount_table, nb_clusters,
-                  s->refcount_table_offset, 
+                  s->refcount_table_offset,
                   s->refcount_table_size * sizeof(uint64_t));
     for(i = 0; i < s->refcount_table_size; i++) {
         int64_t offset;
index 29882e1f70da3f5a32a207cf97a884864f1598f2..42484495663b41f67706b28e491b8ce90a167669 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Block driver for RAW files
- * 
+ *
  * Copyright (c) 2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -127,12 +127,12 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
 #endif
 */
 
-static int raw_pread(BlockDriverState *bs, int64_t offset, 
+static int raw_pread(BlockDriverState *bs, int64_t offset,
                      uint8_t *buf, int count)
 {
     BDRVRawState *s = bs->opaque;
     int ret;
-    
+
     ret = fd_open(bs);
     if (ret < 0)
         return ret;
@@ -142,12 +142,12 @@ static int raw_pread(BlockDriverState *bs, int64_t offset,
     return ret;
 }
 
-static int raw_pwrite(BlockDriverState *bs, int64_t offset, 
+static int raw_pwrite(BlockDriverState *bs, int64_t offset,
                       const uint8_t *buf, int count)
 {
     BDRVRawState *s = bs->opaque;
     int ret;
-    
+
     ret = fd_open(bs);
     if (ret < 0)
         return ret;
@@ -191,7 +191,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;
@@ -333,7 +333,7 @@ static BlockDriverAIOCB *raw_aio_read(BlockDriverState *bs,
     if (aio_read(&acb->aiocb) < 0) {
         qemu_aio_release(acb);
         return NULL;
-    } 
+    }
     return &acb->common;
 }
 
@@ -349,7 +349,7 @@ static BlockDriverAIOCB *raw_aio_write(BlockDriverState *bs,
     if (aio_write(&acb->aiocb) < 0) {
         qemu_aio_release(acb);
         return NULL;
-    } 
+    }
     return &acb->common;
 }
 
@@ -454,7 +454,7 @@ static int raw_create(const char *filename, int64_t total_size,
     if (flags || backing_file)
         return -ENOTSUP;
 
-    fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 
+    fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
               0644);
     if (fd < 0)
         return -EIO;
@@ -479,7 +479,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,
@@ -500,7 +500,7 @@ static kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFI
 
 kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator )
 {
-    kern_return_t       kernResult; 
+    kern_return_t       kernResult;
     mach_port_t     masterPort;
     CFMutableDictionaryRef  classesToMatch;
 
@@ -508,8 +508,8 @@ kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator )
     if ( KERN_SUCCESS != kernResult ) {
         printf( "IOMasterPort returned %d\n", kernResult );
     }
-    
-    classesToMatch = IOServiceMatching( kIOCDMediaClass ); 
+
+    classesToMatch = IOServiceMatching( kIOCDMediaClass );
     if ( classesToMatch == NULL ) {
         printf( "IOServiceMatching returned a NULL dictionary.\n" );
     } else {
@@ -520,7 +520,7 @@ kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator )
     {
         printf( "IOServiceGetMatchingServices returned %d\n", kernResult );
     }
-    
+
     return kernResult;
 }
 
@@ -546,7 +546,7 @@ kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFIndex ma
         }
         IOObjectRelease( nextMedia );
     }
-    
+
     return kernResult;
 }
 
@@ -563,10 +563,10 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
         io_iterator_t mediaIterator;
         char bsdPath[ MAXPATHLEN ];
         int fd;
+
         kernResult = FindEjectableCDMedia( &mediaIterator );
         kernResult = GetBSDPath( mediaIterator, bsdPath, sizeof( bsdPath ) );
-    
+
         if ( bsdPath[ 0 ] != '\0' ) {
             strcat(bsdPath,"s0");
             /* some CDs don't have a partition 0 */
@@ -578,7 +578,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
             }
             filename = bsdPath;
         }
-        
+
         if ( mediaIterator )
             IOObjectRelease( mediaIterator );
     }
@@ -636,7 +636,7 @@ static int fd_open(BlockDriverState *bs)
     if (s->type != FTYPE_FD)
         return 0;
     last_media_present = (s->fd >= 0);
-    if (s->fd >= 0 && 
+    if (s->fd >= 0 &&
         (qemu_get_clock(rt_clock) - s->fd_open_time) >= FD_OPEN_TIMEOUT) {
         close(s->fd);
         s->fd = -1;
@@ -645,7 +645,7 @@ static int fd_open(BlockDriverState *bs)
 #endif
     }
     if (s->fd < 0) {
-        if (s->fd_got_error && 
+        if (s->fd_got_error &&
             (qemu_get_clock(rt_clock) - s->fd_error_time) < FD_OPEN_TIMEOUT) {
 #ifdef DEBUG_FLOPPY
             printf("No floppy (open delayed)\n");
@@ -815,7 +815,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,
@@ -911,7 +911,7 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
 #else
     overlapped = FILE_FLAG_OVERLAPPED;
 #endif
-    s->hfile = CreateFile(filename, access_flags, 
+    s->hfile = CreateFile(filename, access_flags,
                           FILE_SHARE_READ, NULL,
                           create_flags, overlapped, NULL);
     if (s->hfile == INVALID_HANDLE_VALUE) {
@@ -924,14 +924,14 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
     return 0;
 }
 
-static int raw_pread(BlockDriverState *bs, int64_t offset, 
+static int raw_pread(BlockDriverState *bs, int64_t offset,
                      uint8_t *buf, int count)
 {
     BDRVRawState *s = bs->opaque;
     OVERLAPPED ov;
     DWORD ret_count;
     int ret;
-    
+
     memset(&ov, 0, sizeof(ov));
     ov.Offset = offset;
     ov.OffsetHigh = offset >> 32;
@@ -946,14 +946,14 @@ static int raw_pread(BlockDriverState *bs, int64_t offset,
     return ret_count;
 }
 
-static int raw_pwrite(BlockDriverState *bs, int64_t offset, 
+static int raw_pwrite(BlockDriverState *bs, int64_t offset,
                       const uint8_t *buf, int count)
 {
     BDRVRawState *s = bs->opaque;
     OVERLAPPED ov;
     DWORD ret_count;
     int ret;
-    
+
     memset(&ov, 0, sizeof(ov));
     ov.Offset = offset;
     ov.OffsetHigh = offset >> 32;
@@ -1103,7 +1103,7 @@ static int64_t raw_getlength(BlockDriverState *bs)
 {
     BDRVRawState *s = bs->opaque;
     LARGE_INTEGER l;
-    ULARGE_INTEGER available, total, total_free; 
+    ULARGE_INTEGER available, total, total_free;
     DISK_GEOMETRY dg;
     DWORD count;
     BOOL status;
@@ -1141,7 +1141,7 @@ static int raw_create(const char *filename, int64_t total_size,
     if (flags || backing_file)
         return -ENOTSUP;
 
-    fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 
+    fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
               0644);
     if (fd < 0)
         return -EIO;
@@ -1188,7 +1188,7 @@ BlockDriver bdrv_raw = {
     raw_close,
     raw_create,
     raw_flush,
-    
+
 #if 0
     .bdrv_aio_read = raw_aio_read,
     .bdrv_aio_write = raw_aio_write,
@@ -1267,7 +1267,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 {
@@ -1280,7 +1280,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
 #else
     overlapped = FILE_FLAG_OVERLAPPED;
 #endif
-    s->hfile = CreateFile(filename, access_flags, 
+    s->hfile = CreateFile(filename, access_flags,
                           FILE_SHARE_READ, NULL,
                           create_flags, overlapped, NULL);
     if (s->hfile == INVALID_HANDLE_VALUE) {
@@ -1314,10 +1314,10 @@ static int raw_eject(BlockDriverState *bs, int eject_flag)
     if (s->type == FTYPE_FILE)
         return -ENOTSUP;
     if (eject_flag) {
-        DeviceIoControl(s->hfile, IOCTL_STORAGE_EJECT_MEDIA, 
+        DeviceIoControl(s->hfile, IOCTL_STORAGE_EJECT_MEDIA,
                         NULL, 0, NULL, 0, &lpBytesReturned, NULL);
     } else {
-        DeviceIoControl(s->hfile, IOCTL_STORAGE_LOAD_MEDIA, 
+        DeviceIoControl(s->hfile, IOCTL_STORAGE_LOAD_MEDIA,
                         NULL, 0, NULL, 0, &lpBytesReturned, NULL);
     }
 }
@@ -1338,7 +1338,7 @@ BlockDriver bdrv_host_device = {
     raw_close,
     NULL,
     raw_flush,
-    
+
 #if 0
     .bdrv_aio_read = raw_aio_read,
     .bdrv_aio_write = raw_aio_write,
index 28df8ae466400c4cf0e6b6f0bf25e3a8cdd0266b..3b4945a800f4c30f3e66c592e45cb131544d62f8 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * Block driver for the VMDK format
- * 
+ *
  * Copyright (c) 2004 Fabrice Bellard
  * Copyright (c) 2005 Filip Navara
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -93,16 +93,16 @@ 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 
+#define HEADER_SIZE 512                        // first sector of 512 bytes
 
 static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
 {
     BDRVVmdkState *s = bs->opaque;
     char desc[DESC_SIZE];
     uint32_t cid;
-    char *p_name, *cid_str; 
+    char *p_name, *cid_str;
     size_t cid_str_size;
 
     /* the descriptor offset = 0x200 */
@@ -170,7 +170,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file)
 {
     int snp_fd, p_fd;
     uint32_t p_cid;
-    char *p_name, *gd_buf, *rgd_buf; 
+    char *p_name, *gd_buf, *rgd_buf;
     const char *real_filename, *temp_str;
     VMDK4Header header;
     uint32_t gde_entries, gd_size;
@@ -254,7 +254,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file)
     gt_size = (int64_t)header.num_gtes_per_gte * header.granularity * SECTOR_SIZE;
     if (!gt_size)
         goto fail;
-    gde_entries = (uint32_t)(capacity / gt_size);  // number of gde/rgde 
+    gde_entries = (uint32_t)(capacity / gt_size);  // number of gde/rgde
     gd_size = gde_entries * sizeof(uint32_t);
 
     /* write RGD */
@@ -291,7 +291,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);
@@ -309,7 +309,7 @@ static void vmdk_parent_close(BlockDriverState *bs)
 static int vmdk_parent_open(BlockDriverState *bs, const char * filename)
 {
     BDRVVmdkState *s = bs->opaque;
-    char *p_name; 
+    char *p_name;
     char desc[DESC_SIZE];
     char parent_img_name[1024];
 
@@ -324,7 +324,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),
@@ -382,7 +382,7 @@ static int vmdk_open(BlockDriverState *bs, const char *filename, int flags)
         s->l1_entry_sectors = s->l2_size * s->cluster_sectors;
         if (s->l1_entry_sectors <= 0)
             goto fail;
-        s->l1_size = (bs->total_sectors + s->l1_entry_sectors - 1) 
+        s->l1_size = (bs->total_sectors + s->l1_entry_sectors - 1)
             / s->l1_entry_sectors;
         s->l1_table_offset = le64_to_cpu(header.rgd_offset) << 9;
         s->l1_backup_table_offset = le64_to_cpu(header.gd_offset) << 9;
@@ -447,11 +447,11 @@ static int get_whole_cluster(BlockDriverState *bs, uint64_t cluster_offset,
         if (!vmdk_is_cid_valid(bs))
             return -1;
         parent_cluster_offset = get_cluster_offset(s->hd->backing_hd, offset, allocate);
-        if (bdrv_pread(ps->hd, parent_cluster_offset, whole_grain, ps->cluster_sectors*512) != 
+        if (bdrv_pread(ps->hd, parent_cluster_offset, whole_grain, ps->cluster_sectors*512) !=
                                                                             ps->cluster_sectors*512)
             return -1;
 
-        if (bdrv_pwrite(s->hd, cluster_offset << 9, whole_grain, sizeof(whole_grain)) != 
+        if (bdrv_pwrite(s->hd, cluster_offset << 9, whole_grain, sizeof(whole_grain)) !=
                                                                             sizeof(whole_grain))
             return -1;
     }
@@ -466,7 +466,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
     int min_index, i, j;
     uint32_t min_count, *l2_table, tmp;
     uint64_t cluster_offset;
-    
+
     l1_index = (offset >> 9) / s->l1_entry_sectors;
     if (l1_index >= s->l1_size)
         return 0;
@@ -495,7 +495,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
         }
     }
     l2_table = s->l2_cache + (min_index * s->l2_size);
-    if (bdrv_pread(s->hd, (int64_t)l2_offset * 512, l2_table, s->l2_size * sizeof(uint32_t)) != 
+    if (bdrv_pread(s->hd, (int64_t)l2_offset * 512, l2_table, s->l2_size * sizeof(uint32_t)) !=
                                                                         s->l2_size * sizeof(uint32_t))
         return 0;
 
@@ -517,13 +517,13 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
         /* update L2 table */
         tmp = cpu_to_le32(cluster_offset);
         l2_table[l2_index] = tmp;
-        if (bdrv_pwrite(s->hd, ((int64_t)l2_offset * 512) + (l2_index * sizeof(tmp)), 
+        if (bdrv_pwrite(s->hd, ((int64_t)l2_offset * 512) + (l2_index * sizeof(tmp)),
                         &tmp, sizeof(tmp)) != sizeof(tmp))
             return 0;
         /* update backup L2 table */
         if (s->l1_backup_table_offset != 0) {
             l2_offset = s->l1_backup_table[l1_index];
-            if (bdrv_pwrite(s->hd, ((int64_t)l2_offset * 512) + (l2_index * sizeof(tmp)), 
+            if (bdrv_pwrite(s->hd, ((int64_t)l2_offset * 512) + (l2_index * sizeof(tmp)),
                             &tmp, sizeof(tmp)) != sizeof(tmp))
                 return 0;
         }
@@ -535,7 +535,7 @@ static uint64_t get_cluster_offset(BlockDriverState *bs,
     return cluster_offset;
 }
 
-static int vmdk_is_allocated(BlockDriverState *bs, int64_t sector_num, 
+static int vmdk_is_allocated(BlockDriverState *bs, int64_t sector_num,
                              int nb_sectors, int *pnum)
 {
     BDRVVmdkState *s = bs->opaque;
@@ -551,7 +551,7 @@ static int vmdk_is_allocated(BlockDriverState *bs, int64_t sector_num,
     return (cluster_offset != 0);
 }
 
-static int vmdk_read(BlockDriverState *bs, int64_t sector_num, 
+static int vmdk_read(BlockDriverState *bs, int64_t sector_num,
                     uint8_t *buf, int nb_sectors)
 {
     BDRVVmdkState *s = bs->opaque;
@@ -586,7 +586,7 @@ static int vmdk_read(BlockDriverState *bs, int64_t sector_num,
     return 0;
 }
 
-static int vmdk_write(BlockDriverState *bs, int64_t sector_num, 
+static int vmdk_write(BlockDriverState *bs, int64_t sector_num,
                      const uint8_t *buf, int nb_sectors)
 {
     BDRVVmdkState *s = bs->opaque;
@@ -685,8 +685,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));
 
@@ -697,7 +697,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;
index 4d228c5b628385253123b40d5e9a21d52051792b..be74c290d12a14d73cf19bcd3946a9afb5ae7c2b 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Block driver for Conectix/Microsoft Virtual PC images
- * 
+ *
  * Copyright (c) 2005 Alex Beregszaszi
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -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);
@@ -172,7 +172,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
        lseek(s->fd, bitmap_offset, SEEK_SET);
 
        s->last_bitmap = bitmap_offset;
-       
+
        // Scary! Bitmap is stored as big endian 32bit entries,
        // while we used to look it up byte by byte
        read(s->fd, s->pageentry_u8, 512);
@@ -184,7 +184,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
        return -1;
 #else
     lseek(s->fd, bitmap_offset + (pageentry_index / 8), SEEK_SET);
-       
+
     read(s->fd, &bitmap_entry, 1);
 
     if ((bitmap_entry >> (pageentry_index % 8)) & 1)
@@ -196,7 +196,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
     return 0;
 }
 
-static int vpc_read(BlockDriverState *bs, int64_t sector_num, 
+static int vpc_read(BlockDriverState *bs, int64_t sector_num,
                     uint8_t *buf, int nb_sectors)
 {
     BDRVVPCState *s = bs->opaque;
index 48a52e3116cfcd06b5b3bac04dbd059d46e05d5b..b2aa52c284207f072a60bd120beb99f28d25a538 100644 (file)
@@ -1,9 +1,9 @@
 /* vim:set shiftwidth=4 ts=8: */
 /*
  * QEMU Block driver for virtual VFAT (shadows a local directory)
- * 
+ *
  * Copyright (c) 2004,2005 Johannes E. Schindelin
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -38,7 +38,7 @@
 /* TODO: add ":bootsector=blabla.img:" */
 /* LATER TODO: add automatic boot sector generation from
     BOOTEASY.ASM and Ranish Partition Manager
-    Note that DOS assumes the system files to be the first files in the 
+    Note that DOS assumes the system files to be the first files in the
     file system (test if the boot sector still relies on that fact)! */
 /* MAYBE TODO: write block-visofs.c */
 /* TODO: call try_commit() only after a timeout */
@@ -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,10 +579,10 @@ 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); 
+
+    i = strlen(filename);
     for(j = i - 1; j>0  && filename[j]!='.';j--);
     if (j > 0)
        i = (j > 8 ? 8 : j);
@@ -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];
@@ -618,7 +618,7 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s,
        if(entry1==entry) /* no dupe found */
            break;
 
-       /* use all 8 characters of name */      
+       /* use all 8 characters of name */
        if(entry->name[7]==' ') {
            int j;
            for(j=6;j>0 && entry->name[j]==' ';j--)
@@ -675,11 +675,11 @@ 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;
 
-    /* actually read the directory, and allocate the mappings */ 
+    /* actually read the directory, and allocate the mappings */
     while((entry=readdir(dir))) {
        unsigned int length=strlen(dirname)+2+strlen(entry->d_name);
         char* buffer;
@@ -690,7 +690,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index)
 
        if(first_cluster == 0 && (is_dotdot || is_dot))
            continue;
-       
+
        buffer=(char*)malloc(length);
        assert(buffer);
        snprintf(buffer,length,"%s/%s",dirname,entry->d_name);
@@ -765,7 +765,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index)
        memset(array_get(&(s->directory), cur), 0,
                (ROOT_ENTRIES - cur) * sizeof(direntry_t));
     }
-       
+
      /* reget the mapping, since s->mapping was possibly realloc()ed */
     mapping = (mapping_t*)array_get(&(s->mapping), mapping_index);
     first_cluster += (s->directory.next - mapping->info.dir.first_dir_index)
@@ -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));
 
@@ -857,7 +857,7 @@ static int init_directories(BDRVVVFATState* s,
 
     for (i = 0, cluster = 0; i < s->mapping.next; i++) {
        int j;
-       /* MS-DOS expects the FAT to be 0 for the root directory 
+       /* MS-DOS expects the FAT to be 0 for the root directory
         * (except for the media byte). */
        /* LATER TODO: still true for FAT32? */
        int fix_fat = (i != 0);
@@ -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;
 
@@ -1076,7 +1076,7 @@ static inline int find_mapping_for_cluster_aux(BDRVVVFATState* s,int cluster_num
        assert(index1<=index2);
        DLOG(mapping=array_get(&(s->mapping),index1);
        assert(mapping->begin<=cluster_num);
-       assert(index2 >= s->mapping.next || 
+       assert(index2 >= s->mapping.next ||
                ((mapping = array_get(&(s->mapping),index2)) &&
                mapping->end>cluster_num)));
     }
@@ -1239,7 +1239,7 @@ static void print_mapping(const mapping_t* mapping)
 }
 #endif
 
-static int vvfat_read(BlockDriverState *bs, int64_t sector_num, 
+static int vvfat_read(BlockDriverState *bs, int64_t sector_num,
                     uint8_t *buf, int nb_sectors)
 {
     BDRVVVFATState *s = bs->opaque;
@@ -1674,7 +1674,7 @@ static uint32_t get_cluster_count_for_direntry(BDRVVVFATState* s,
 }
 
 /*
- * This function looks at the modified data (qcow). 
+ * This function looks at the modified data (qcow).
  * It returns 0 upon inconsistency or error, and the number of clusters
  * used by the directory, its subdirectories and their files.
  */
@@ -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;
@@ -2049,7 +2049,7 @@ static int commit_mappings(BDRVVVFATState* s,
            }
 
            next_mapping->dir_index = mapping->dir_index;
-           next_mapping->first_mapping_index = 
+           next_mapping->first_mapping_index =
                mapping->first_mapping_index < 0 ?
                array_index(&(s->mapping), mapping) :
                mapping->first_mapping_index;
@@ -2069,7 +2069,7 @@ static int commit_mappings(BDRVVVFATState* s,
 
            mapping = next_mapping;
        }
-               
+
        cluster = c1;
     }
 
@@ -2555,7 +2555,7 @@ static int do_commit(BDRVVVFATState* s)
        return ret;
     }
 
-    /* copy FAT (with bdrv_read) */ 
+    /* copy FAT (with bdrv_read) */
     memcpy(s->fat.pointer, s->fat2, 0x200 * s->sectors_per_fat);
 
     /* recurse direntries from root (using bs->bdrv_read) */
@@ -2597,10 +2597,10 @@ DLOG(checkpoint());
     return do_commit(s);
 }
 
-static int vvfat_write(BlockDriverState *bs, int64_t sector_num, 
+static int vvfat_write(BlockDriverState *bs, int64_t sector_num,
                     const uint8_t *buf, int nb_sectors)
 {
-    BDRVVVFATState *s = bs->opaque; 
+    BDRVVVFATState *s = bs->opaque;
     int i, ret;
 
 DLOG(checkpoint());
@@ -2639,7 +2639,7 @@ DLOG(checkpoint());
                    begin = sector_num;
                if (end > sector_num + nb_sectors)
                    end = sector_num + nb_sectors;
-               dir_index  = mapping->dir_index + 
+               dir_index  = mapping->dir_index +
                    0x10 * (begin - mapping->begin * s->sectors_per_cluster);
                direntries = (direntry_t*)(buf + 0x200 * (begin - sector_num));
 
@@ -2698,7 +2698,7 @@ static int vvfat_is_allocated(BlockDriverState *bs,
        *n = nb_sectors;
     else if (*n < 0)
        return 0;
-    return 1;  
+    return 1;
 }
 
 static int write_target_commit(BlockDriverState *bs, int64_t sector_num,
diff --git a/block.c b/block.c
index 9264e42a6323ea4c7952b0e9b7aa103d8f4ce415..bebe353b16b43cc97e96cc8b153ae16d67d62980 100644 (file)
--- a/block.c
+++ b/block.c
@@ -1,8 +1,8 @@
 /*
  * QEMU System Emulator block driver
- * 
+ *
  * Copyright (c) 2003 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -48,7 +48,7 @@ static BlockDriverAIOCB *bdrv_aio_write_em(BlockDriverState *bs,
         int64_t sector_num, const uint8_t *buf, int nb_sectors,
         BlockDriverCompletionFunc *cb, void *opaque);
 static void bdrv_aio_cancel_em(BlockDriverAIOCB *acb);
-static int bdrv_read_em(BlockDriverState *bs, int64_t sector_num, 
+static int bdrv_read_em(BlockDriverState *bs, int64_t sector_num,
                         uint8_t *buf, int nb_sectors);
 static int bdrv_write_em(BlockDriverState *bs, int64_t sector_num,
                          const uint8_t *buf, int nb_sectors);
@@ -167,7 +167,7 @@ BlockDriver *bdrv_find_format(const char *format_name)
     return NULL;
 }
 
-int bdrv_create(BlockDriver *drv, 
+int bdrv_create(BlockDriver *drv,
                 const char *filename, int64_t size_in_sectors,
                 const char *backing_file, int flags)
 {
@@ -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,10 +202,10 @@ 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) && 
+    if (is_windows_drive_prefix(filename) &&
         filename[2] == '\0')
         return 1;
     if (strstart(filename, "\\\\.\\", NULL) ||
@@ -236,7 +236,7 @@ static BlockDriver *find_protocol(const char *filename)
     memcpy(protocol, filename, len);
     protocol[len] = '\0';
     for(drv1 = first_drv; drv1 != NULL; drv1 = drv1->next) {
-        if (drv1->protocol_name && 
+        if (drv1->protocol_name &&
             !strcmp(drv1->protocol_name, protocol))
             return drv1;
     }
@@ -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))
@@ -262,13 +262,13 @@ static BlockDriver *find_image_format(const char *filename)
 #else
     {
         struct stat st;
-        if (stat(filename, &st) >= 0 && 
+        if (stat(filename, &st) >= 0 &&
             (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))) {
             return &bdrv_host_device;
         }
     }
 #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[1024];
     char backing_filename[1024];
-    
+
     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,10 +347,10 @@ 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, 
+        if (bdrv_create(&bdrv_qcow2, tmp_filename,
                         total_size, backing_filename, 0) < 0) {
             return -1;
         }
@@ -494,7 +494,7 @@ int bdrv_commit(BlockDriverState *bs)
 }
 
 /* return < 0 if error. See bdrv_write() for the return codes */
-int bdrv_read(BlockDriverState *bs, int64_t sector_num, 
+int bdrv_read(BlockDriverState *bs, int64_t sector_num,
               uint8_t *buf, int nb_sectors)
 {
     BlockDriver *drv = bs->drv;
@@ -525,13 +525,13 @@ int bdrv_read(BlockDriverState *bs, int64_t sector_num,
     }
 }
 
-/* Return < 0 if error. Important errors are: 
+/* Return < 0 if error. Important errors are:
   -EIO         generic I/O error (may happen for all errors)
   -ENOMEDIUM   No media inserted.
   -EINVAL      Invalid sector number or nb_sectors
   -EACCES      Trying to write a read-only device
 */
-int bdrv_write(BlockDriverState *bs, int64_t sector_num, 
+int bdrv_write(BlockDriverState *bs, int64_t sector_num,
                const uint8_t *buf, int nb_sectors)
 {
     BlockDriver *drv = bs->drv;
@@ -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;
@@ -557,7 +557,7 @@ int bdrv_write(BlockDriverState *bs, int64_t sector_num,
     }
 }
 
-static int bdrv_pread_em(BlockDriverState *bs, int64_t offset, 
+static int bdrv_pread_em(BlockDriverState *bs, int64_t offset,
                          uint8_t *buf, int count1)
 {
     uint8_t tmp_buf[SECTOR_SIZE];
@@ -601,7 +601,7 @@ static int bdrv_pread_em(BlockDriverState *bs, int64_t offset,
     return count1;
 }
 
-static int bdrv_pwrite_em(BlockDriverState *bs, int64_t offset, 
+static int bdrv_pwrite_em(BlockDriverState *bs, int64_t offset,
                           const uint8_t *buf, int count1)
 {
     uint8_t tmp_buf[SECTOR_SIZE];
@@ -650,9 +650,9 @@ static int bdrv_pwrite_em(BlockDriverState *bs, int64_t offset,
 }
 
 /**
- * Read with byte offsets (needed only for file protocols) 
+ * Read with byte offsets (needed only for file protocols)
  */
-int bdrv_pread(BlockDriverState *bs, int64_t offset, 
+int bdrv_pread(BlockDriverState *bs, int64_t offset,
                void *buf1, int count1)
 {
     BlockDriver *drv = bs->drv;
@@ -664,10 +664,10 @@ int bdrv_pread(BlockDriverState *bs, int64_t offset,
     return drv->bdrv_pread(bs, offset, buf1, count1);
 }
 
-/** 
- * Write with byte offsets (needed only for file protocols) 
+/**
+ * Write with byte offsets (needed only for file protocols)
  */
-int bdrv_pwrite(BlockDriverState *bs, int64_t offset, 
+int bdrv_pwrite(BlockDriverState *bs, int64_t offset,
                 const void *buf1, int count1)
 {
     BlockDriver *drv = bs->drv;
@@ -729,7 +729,7 @@ void bdrv_set_boot_sector(BlockDriverState *bs, const uint8_t *data, int size)
     memset(bs->boot_sector_data + size, 0, 512 - size);
 }
 
-void bdrv_set_geometry_hint(BlockDriverState *bs, 
+void bdrv_set_geometry_hint(BlockDriverState *bs,
                             int cyls, int heads, int secs)
 {
     bs->cyls = cyls;
@@ -749,7 +749,7 @@ void bdrv_set_translation_hint(BlockDriverState *bs, int translation)
     bs->translation = translation;
 }
 
-void bdrv_get_geometry_hint(BlockDriverState *bs, 
+void bdrv_get_geometry_hint(BlockDriverState *bs,
                             int *pcyls, int *pheads, int *psecs)
 {
     *pcyls = bs->cyls;
@@ -778,7 +778,7 @@ int bdrv_is_read_only(BlockDriverState *bs)
 }
 
 /* XXX: no longer used */
-void bdrv_set_change_cb(BlockDriverState *bs, 
+void bdrv_set_change_cb(BlockDriverState *bs,
                         void (*change_cb)(void *opaque), void *opaque)
 {
     bs->change_cb = change_cb;
@@ -816,7 +816,7 @@ void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size)
     }
 }
 
-void bdrv_iterate_format(void (*it)(void *opaque, const char *name), 
+void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
                          void *opaque)
 {
     BlockDriver *drv;
@@ -899,7 +899,7 @@ void bdrv_info(void)
     }
 }
 
-void bdrv_get_backing_filename(BlockDriverState *bs, 
+void bdrv_get_backing_filename(BlockDriverState *bs,
                                char *filename, int filename_size)
 {
     if (!bs->backing_hd) {
@@ -909,7 +909,7 @@ void bdrv_get_backing_filename(BlockDriverState *bs,
     }
 }
 
-int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, 
+int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,
                           const uint8_t *buf, int nb_sectors)
 {
     BlockDriver *drv = bs->drv;
@@ -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;
@@ -934,7 +934,7 @@ int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
 /**************************************************************/
 /* handling of snapshots */
 
-int bdrv_snapshot_create(BlockDriverState *bs, 
+int bdrv_snapshot_create(BlockDriverState *bs,
                          QEMUSnapshotInfo *sn_info)
 {
     BlockDriver *drv = bs->drv;
@@ -945,7 +945,7 @@ int bdrv_snapshot_create(BlockDriverState *bs,
     return drv->bdrv_snapshot_create(bs, sn_info);
 }
 
-int bdrv_snapshot_goto(BlockDriverState *bs, 
+int bdrv_snapshot_goto(BlockDriverState *bs,
                        const char *snapshot_id)
 {
     BlockDriver *drv = bs->drv;
@@ -966,7 +966,7 @@ int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id)
     return drv->bdrv_snapshot_delete(bs, snapshot_id);
 }
 
-int bdrv_snapshot_list(BlockDriverState *bs, 
+int bdrv_snapshot_list(BlockDriverState *bs,
                        QEMUSnapshotInfo **psn_info)
 {
     BlockDriver *drv = bs->drv;
@@ -991,12 +991,12 @@ char *get_human_readable_size(char *buf, int buf_size, int64_t size)
         base = 1024;
         for(i = 0; i < NB_SUFFIXES; i++) {
             if (size < (10 * base)) {
-                snprintf(buf, buf_size, "%0.1f%c", 
+                snprintf(buf, buf_size, "%0.1f%c",
                          (double)size / base,
                          suffixes[i]);
                 break;
             } else if (size < (1000 * base) || i == (NB_SUFFIXES - 1)) {
-                snprintf(buf, buf_size, "%" PRId64 "%c", 
+                snprintf(buf, buf_size, "%" PRId64 "%c",
                          ((size + (base >> 1)) / base),
                          suffixes[i]);
                 break;
@@ -1019,8 +1019,8 @@ char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn)
     int64_t secs;
 
     if (!sn) {
-        snprintf(buf, buf_size, 
-                 "%-10s%-20s%7s%20s%15s", 
+        snprintf(buf, buf_size,
+                 "%-10s%-20s%7s%20s%15s",
                  "ID", "TAG", "VM SIZE", "DATE", "VM CLOCK");
     } else {
         ti = sn->date_sec;
@@ -1038,10 +1038,10 @@ char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn)
                  "%02d:%02d:%02d.%03d",
                  (int)(secs / 3600),
                  (int)((secs / 60) % 60),
-                 (int)(secs % 60), 
+                 (int)(secs % 60),
                  (int)((sn->vm_clock_nsec / 1000000) % 1000));
         snprintf(buf, buf_size,
-                 "%-10s%-20s%7s%20s%15s", 
+                 "%-10s%-20s%7s%20s%15s",
                  sn->id_str, sn->name,
                  get_human_readable_size(buf1, sizeof(buf1), sn->vm_state_size),
                  date_buf,
@@ -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);
@@ -1184,7 +1184,7 @@ static void bdrv_rw_em_cb(void *opaque, int ret)
 
 #define NOT_DONE 0x7fffffff
 
-static int bdrv_read_em(BlockDriverState *bs, int64_t sector_num, 
+static int bdrv_read_em(BlockDriverState *bs, int64_t sector_num,
                         uint8_t *buf, int nb_sectors)
 {
     int async_ret;
@@ -1192,7 +1192,7 @@ static int bdrv_read_em(BlockDriverState *bs, int64_t sector_num,
 
     async_ret = NOT_DONE;
     qemu_aio_wait_start();
-    acb = bdrv_aio_read(bs, sector_num, buf, nb_sectors, 
+    acb = bdrv_aio_read(bs, sector_num, buf, nb_sectors,
                         bdrv_rw_em_cb, &async_ret);
     if (acb == NULL) {
         qemu_aio_wait_end();
@@ -1213,7 +1213,7 @@ static int bdrv_write_em(BlockDriverState *bs, int64_t sector_num,
 
     async_ret = NOT_DONE;
     qemu_aio_wait_start();
-    acb = bdrv_aio_write(bs, sector_num, buf, nb_sectors, 
+    acb = bdrv_aio_write(bs, sector_num, buf, nb_sectors,
                          bdrv_rw_em_cb, &async_ret);
     if (acb == NULL) {
         qemu_aio_wait_end();
@@ -1292,7 +1292,7 @@ int bdrv_is_inserted(BlockDriverState *bs)
 
 /**
  * Return TRUE if the media changed since the last call to this
- * function. It is currently only used for floppy disks 
+ * function. It is currently only used for floppy disks
  */
 int bdrv_media_changed(BlockDriverState *bs)
 {
index 25f6717b5c53a882413fe6c1ca79b0eefd0ebef2..d79dab82a1b8164e5783a4730f15dbfb965f713b 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU System Emulator block driver
- * 
+ *
  * Copyright (c) 2003 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -29,12 +29,12 @@ struct BlockDriver {
     int instance_size;
     int (*bdrv_probe)(const uint8_t *buf, int buf_size, const char *filename);
     int (*bdrv_open)(BlockDriverState *bs, const char *filename, int flags);
-    int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num, 
+    int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num,
                      uint8_t *buf, int nb_sectors);
-    int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num, 
+    int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num,
                       const uint8_t *buf, int nb_sectors);
     void (*bdrv_close)(BlockDriverState *bs);
-    int (*bdrv_create)(const char *filename, int64_t total_sectors, 
+    int (*bdrv_create)(const char *filename, int64_t total_sectors,
                        const char *backing_file, int flags);
     void (*bdrv_flush)(BlockDriverState *bs);
     int (*bdrv_is_allocated)(BlockDriverState *bs, int64_t sector_num,
@@ -52,21 +52,21 @@ struct BlockDriver {
     int aiocb_size;
 
     const char *protocol_name;
-    int (*bdrv_pread)(BlockDriverState *bs, int64_t offset, 
+    int (*bdrv_pread)(BlockDriverState *bs, int64_t offset,
                       uint8_t *buf, int count);
-    int (*bdrv_pwrite)(BlockDriverState *bs, int64_t offset, 
+    int (*bdrv_pwrite)(BlockDriverState *bs, int64_t offset,
                        const uint8_t *buf, int count);
     int (*bdrv_truncate)(BlockDriverState *bs, int64_t offset);
     int64_t (*bdrv_getlength)(BlockDriverState *bs);
-    int (*bdrv_write_compressed)(BlockDriverState *bs, int64_t sector_num, 
+    int (*bdrv_write_compressed)(BlockDriverState *bs, int64_t sector_num,
                                  const uint8_t *buf, int nb_sectors);
 
-    int (*bdrv_snapshot_create)(BlockDriverState *bs, 
+    int (*bdrv_snapshot_create)(BlockDriverState *bs,
                                 QEMUSnapshotInfo *sn_info);
-    int (*bdrv_snapshot_goto)(BlockDriverState *bs, 
+    int (*bdrv_snapshot_goto)(BlockDriverState *bs,
                               const char *snapshot_id);
     int (*bdrv_snapshot_delete)(BlockDriverState *bs, const char *snapshot_id);
-    int (*bdrv_snapshot_list)(BlockDriverState *bs, 
+    int (*bdrv_snapshot_list)(BlockDriverState *bs,
                               QEMUSnapshotInfo **psn_info);
     int (*bdrv_get_info)(BlockDriverState *bs, BlockDriverInfo *bdi);
 
@@ -75,7 +75,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;
 };
@@ -107,7 +107,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;
diff --git a/bswap.h b/bswap.h
index 37fb04ed9777d1fc372023021e52da38bc433be4..970c1bbe349b16cbfbb63a200da0fbfa7be66eb3 100644 (file)
--- a/bswap.h
+++ b/bswap.h
@@ -48,12 +48,12 @@ static inline uint16_t bswap16(uint16_t x)
     return bswap_16(x);
 }
 
-static inline uint32_t bswap32(uint32_t x) 
+static inline uint32_t bswap32(uint32_t x)
 {
     return bswap_32(x);
 }
 
-static inline uint64_t bswap64(uint64_t x) 
+static inline uint64_t bswap64(uint64_t x)
 {
     return bswap_64(x);
 }
diff --git a/cocoa.m b/cocoa.m
index 9551affa340259491ab630e4189ae4d3164edce2..7a509986e63d5430d81f34d14dbd2bb76fe131f2 100644 (file)
--- a/cocoa.m
+++ b/cocoa.m
@@ -1,9 +1,9 @@
 /*
  * QEMU Cocoa display driver
- * 
+ *
  * Copyright (c) 2005 Pierre d'Herbemont
  *                    many code/inspiration from SDL 1.2 code (LGPL)
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -23,7 +23,7 @@
  * THE SOFTWARE.
  */
 /*
-    Todo :    x  miniaturize window 
+    Todo :    x  miniaturize window
               x  center the window
               -  save window position
               -  handle keyboard event
@@ -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,44 +119,44 @@ 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 ] ) );
     screen_pitch  = GetPixRowBytes ( GetPortPixMap ( [ qd_view qdPort ] ) );
     UnlockPortBits ( [ qd_view qdPort ] );
-    { 
-            int vOffset = [ window frame ].size.height - 
+    {
+            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;
@@ -164,7 +164,7 @@ static void cocoa_resize(DisplayState *ds, int w, int h)
     ds->depth = device_bpp;
     ds->width = w;
     ds->height = h;
-    
+
     current_ds = *ds;
 }
 
@@ -305,38 +305,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   
-    174 //          0xae            E0, 2E  Volume Down 
-    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    
-    233 //          0xe9            E0, 69  WWW Forward 
-    232 //          0xe8            E0, 68  WWW Stop    
-    231 //          0xe7            E0, 67  WWW Refresh 
-    230 //          0xe6            E0, 66  WWW Favorites   
+    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
+    235 //          0xeb            E0, 6B  My Computer
+    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
+    231 //          0xe7            E0, 67  WWW Refresh
+    230 //          0xe6            E0, 66  WWW Favorites
 */
 };
 
@@ -361,10 +361,10 @@ static void cocoa_refresh(DisplayState *ds)
     NSDate *distantPast;
     NSEvent *event;
     NSAutoreleasePool *pool;
-    
+
     pool = [ [ NSAutoreleasePool alloc ] init ];
     distantPast = [ NSDate distantPast ];
-    
+
     vga_hw_update();
 
     do {
@@ -410,8 +410,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]) {
@@ -422,7 +422,7 @@ static void cocoa_refresh(DisplayState *ds)
                                     return;
                             }
                         }
-                        
+
                         /* handle control + alt Key Combos */
                         if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) {
                             switch (keycode) {
@@ -477,10 +477,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);
@@ -488,7 +488,7 @@ static void cocoa_refresh(DisplayState *ds)
                         }
                     }
                     break;
-                    
+
                 case NSMouseMoved:
                     if (grab) {
                         int dx = [event deltaX];
@@ -498,11 +498,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;
@@ -514,7 +514,7 @@ static void cocoa_refresh(DisplayState *ds)
                         [NSApp sendEvent: event];
                     }
                     break;
-                        
+
                 case NSLeftMouseDragged:
                     if (grab) {
                         int dx = [event deltaX];
@@ -529,7 +529,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);
@@ -541,18 +541,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];
@@ -563,7 +563,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);
@@ -571,7 +571,7 @@ static void cocoa_refresh(DisplayState *ds)
                         [NSApp sendEvent: event];
                     }
                     break;
-                        
+
                 case NSOtherMouseDragged:
                     if (grab) {
                         int dx = [event deltaX];
@@ -582,7 +582,7 @@ static void cocoa_refresh(DisplayState *ds)
                         kbd_mouse_event(dx, dy, dz, buttons);
                     }
                     break;
-                    
+
                 case NSOtherMouseDown:
                     if (grab) {
                         int buttons = 0;
@@ -592,7 +592,7 @@ static void cocoa_refresh(DisplayState *ds)
                         [NSApp sendEvent:event];
                     }
                     break;
-                        
+
                 case NSOtherMouseUp:
                     if (grab) {
                         kbd_mouse_event(0, 0, 0, 0);
@@ -600,14 +600,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];
             }
         }
@@ -620,7 +620,7 @@ static void cocoa_refresh(DisplayState *ds)
  ------------------------------------------------------
 */
 
-static void cocoa_cleanup(void) 
+static void cocoa_cleanup(void)
 {
 
 }
@@ -636,9 +636,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);
 }
 
@@ -656,17 +656,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;
             }
     }
@@ -675,32 +675,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 
+        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 ];
 }
@@ -737,13 +737,13 @@ static void QZ_SetPortAlphaOpaque ()
     if( gArgc <= 1 || strncmp (gArgv[1], "-psn", 4) == 0)
     {
         NSOpenPanel *op = [[NSOpenPanel alloc] init];
-        
+
         cocoa_resize(&current_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];
@@ -769,20 +769,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];
     }
 }
@@ -822,10 +822,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:@""];
@@ -845,7 +845,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];
@@ -867,17 +867,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];
 
@@ -891,14 +891,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();
@@ -907,10 +907,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];
 }
index bcff13e977f8972d9fbc2566ff4e0b2ccbed44e8..57aaad3aa5764034971df23ba0cd2b6aa6373f93 100755 (executable)
--- a/configure
+++ b/configure
@@ -332,7 +332,7 @@ if test "$mingw32" = "yes" ; then
     fi
 fi
 
-# Check for gcc4, error if pre-gcc4 
+# Check for gcc4, error if pre-gcc4
 if test "$check_gcc" = "yes" ; then
     cat > $TMPC <<EOF
 #if __GNUC__ < 4
@@ -378,7 +378,7 @@ if test "$solaris" = "yes" ; then
   #
   # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
   # override the check with --disable-gcc-check
-  # 
+  #
   if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
     solgcc=`which $cc`
     if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
@@ -409,7 +409,7 @@ if test "$solaris" = "yes" ; then
     fi
     exit 1
   fi
-fi 
+fi
 
 
 if test -z "$target_list" ; then
index dc904f6574ad0316872f08212a336c993d8b41d9..d7d1f1b5cfd6cfa5567002d677df07617c1c5a84 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1,8 +1,8 @@
 /*
  * QEMU graphical console
- * 
+ *
  * Copyright (c) 2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -195,14 +195,14 @@ static unsigned int vga_get_color(DisplayState *ds, unsigned int rgba)
     return color;
 }
 
-static void vga_fill_rect (DisplayState *ds, 
+static void vga_fill_rect (DisplayState *ds,
                            int posx, int posy, int width, int height, uint32_t color)
 {
     uint8_t *d, *d1;
     int x, y, bpp;
-    
+
     bpp = (ds->depth + 7) >> 3;
-    d1 = ds->data + 
+    d1 = ds->data +
         ds->linesize * posy + bpp * posx;
     for (y = 0; y < height; y++) {
         d = d1;
@@ -240,9 +240,9 @@ static void vga_bitblt(DisplayState *ds, int xs, int ys, int xd, int yd, int w,
     bpp = (ds->depth + 7) >> 3;
     wb = w * bpp;
     if (yd <= ys) {
-        s = ds->data + 
+        s = ds->data +
             ds->linesize * ys + bpp * xs;
-        d = ds->data + 
+        d = ds->data +
             ds->linesize * yd + bpp * xd;
         for (y = 0; y < h; y++) {
             memmove(d, s, wb);
@@ -250,9 +250,9 @@ static void vga_bitblt(DisplayState *ds, int xs, int ys, int xd, int yd, int w,
             s += ds->linesize;
         }
     } else {
-        s = ds->data + 
+        s = ds->data +
             ds->linesize * (ys + h - 1) + bpp * xs;
-        d = ds->data + 
+        d = ds->data +
             ds->linesize * (yd + h - 1) + bpp * xd;
        for (y = 0; y < h; y++) {
             memmove(d, s, wb);
@@ -395,7 +395,7 @@ static void console_print_text_attributes(TextAttributes *t_attrib, char ch)
 }
 #endif
 
-static void vga_putcharxy(DisplayState *ds, int x, int y, int ch, 
+static void vga_putcharxy(DisplayState *ds, int x, int y, int ch,
                           TextAttributes *t_attrib)
 {
     uint8_t *d;
@@ -418,7 +418,7 @@ static void vga_putcharxy(DisplayState *ds, int x, int y, int ch,
     }
 
     bpp = (ds->depth + 7) >> 3;
-    d = ds->data + 
+    d = ds->data +
         ds->linesize * y * FONT_HEIGHT + bpp * x * FONT_WIDTH;
     linesize = ds->linesize;
     font_ptr = vgafont16 + FONT_HEIGHT * ch;
@@ -515,9 +515,9 @@ static void update_xy(TextConsole *s, int x, int y)
             y2 += s->total_height;
         if (y2 < s->height) {
             c = &s->cells[y1 * s->width + x];
-            vga_putcharxy(s->ds, x, y2, c->ch, 
+            vga_putcharxy(s->ds, x, y2, c->ch,
                           &(c->t_attrib));
-            dpy_update(s->ds, x * FONT_WIDTH, y2 * FONT_HEIGHT, 
+            dpy_update(s->ds, x * FONT_WIDTH, y2 * FONT_HEIGHT,
                        FONT_WIDTH, FONT_HEIGHT);
         }
     }
@@ -540,10 +540,10 @@ static void console_show_cursor(TextConsole *s, int show)
                 t_attrib.invers = !(t_attrib.invers); /* invert fg and bg */
                 vga_putcharxy(s->ds, s->x, y, c->ch, &t_attrib);
             } else {
-                vga_putcharxy(s->ds, s->x, y, c->ch, 
+                vga_putcharxy(s->ds, s->x, y, c->ch,
                               &(c->t_attrib));
             }
-            dpy_update(s->ds, s->x * FONT_WIDTH, y * FONT_HEIGHT, 
+            dpy_update(s->ds, s->x * FONT_WIDTH, y * FONT_HEIGHT,
                        FONT_WIDTH, FONT_HEIGHT);
         }
     }
@@ -554,7 +554,7 @@ static void console_refresh(TextConsole *s)
     TextCell *c;
     int x, y, y1;
 
-    if (s != active_console) 
+    if (s != active_console)
         return;
 
     vga_fill_rect(s->ds, 0, 0, s->ds->width, s->ds->height,
@@ -563,7 +563,7 @@ static void console_refresh(TextConsole *s)
     for(y = 0; y < s->height; y++) {
         c = s->cells + y1 * s->width;
         for(x = 0; x < s->width; x++) {
-            vga_putcharxy(s->ds, x, y, c->ch, 
+            vga_putcharxy(s->ds, x, y, c->ch,
                           &(c->t_attrib));
             c++;
         }
@@ -578,7 +578,7 @@ static void console_scroll(int ydelta)
 {
     TextConsole *s;
     int i, y1;
-    
+
     s = active_console;
     if (!s || !s->text_console)
         return;
@@ -633,13 +633,13 @@ static void console_put_lf(TextConsole *s)
             c++;
         }
         if (s == active_console && s->y_displayed == s->y_base) {
-            vga_bitblt(s->ds, 0, FONT_HEIGHT, 0, 0, 
-                       s->width * FONT_WIDTH, 
+            vga_bitblt(s->ds, 0, FONT_HEIGHT, 0, 0,
+                       s->width * FONT_WIDTH,
                        (s->height - 1) * FONT_HEIGHT);
             vga_fill_rect(s->ds, 0, (s->height - 1) * FONT_HEIGHT,
-                          s->width * FONT_WIDTH, FONT_HEIGHT, 
+                          s->width * FONT_WIDTH, FONT_HEIGHT,
                           color_table[0][s->t_attrib_default.bgcol]);
-            dpy_update(s->ds, 0, 0, 
+            dpy_update(s->ds, 0, 0,
                        s->width * FONT_WIDTH, s->height * FONT_HEIGHT);
         }
     }
@@ -768,7 +768,7 @@ static void console_putchar(TextConsole *s, int ch)
             console_put_lf(s);
             break;
         case '\b':  /* backspace */
-            if (s->x > 0) 
+            if (s->x > 0)
                 s->x--;
             break;
         case '\t':  /* tabspace */
@@ -823,7 +823,7 @@ static void console_putchar(TextConsole *s, int ch)
     case TTY_STATE_CSI: /* handle escape sequence parameters */
         if (ch >= '0' && ch <= '9') {
             if (s->nb_esc_params < MAX_ESC_PARAMS) {
-                s->esc_params[s->nb_esc_params] = 
+                s->esc_params[s->nb_esc_params] =
                     s->esc_params[s->nb_esc_params] * 10 + ch - '0';
             }
         } else {
@@ -1034,7 +1034,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;
@@ -1152,7 +1152,7 @@ int is_graphic_console(void)
     return !active_console->text_console;
 }
 
-void set_color_table(DisplayState *ds) 
+void set_color_table(DisplayState *ds)
 {
     int i, j;
     for(j = 0; j < 2; j++) {
@@ -1185,7 +1185,7 @@ CharDriverState *text_console_init(DisplayState *ds)
     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;
         set_color_table(ds);
index ed5355319aff90498bf1c8dafef3669ceeba6298..ad00839a43187e7f975639d4ce13a65d793d2f60 100644 (file)
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -1,6 +1,6 @@
 /*
  * defines common to all virtual CPUs
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
 #define WORDS_ALIGNED
 #endif
 
-/* some important defines: 
- * 
+/* some important defines:
+ *
  * WORDS_ALIGNED : if defined, the host cpu can only make word aligned
  * memory accesses.
- * 
+ *
  * WORDS_BIGENDIAN : if defined, the host cpu is big endian and
  * otherwise little endian.
- * 
+ *
  * (TARGET_WORDS_ALIGNED : same for target cpu (not supported yet))
- * 
+ *
  * TARGET_WORDS_BIGENDIAN : same for target cpu
  */
 
@@ -147,7 +147,7 @@ typedef union {
  * type is:
  * (empty): integer access
  *   f    : float access
- * 
+ *
  * sign is:
  * (empty): for floats or 32 bit size
  *   u    : unsigned
@@ -158,7 +158,7 @@ typedef union {
  *   w: 16 bits
  *   l: 32 bits
  *   q: 64 bits
- * 
+ *
  * endian is:
  * (empty): target cpu endianness or 8 bit access
  *   r    : reversed target cpu endianness (not implemented yet)
@@ -621,7 +621,7 @@ static inline void stfq_be_p(void *ptr, float64 v)
 #define stfq_raw(p, v) stfq_p(saddr((p)), v)
 
 
-#if defined(CONFIG_USER_ONLY) 
+#if defined(CONFIG_USER_ONLY)
 
 /* if user mode, no other memory access functions */
 #define ldub(p) ldub_raw(p)
@@ -683,7 +683,7 @@ extern unsigned long qemu_host_page_mask;
 #define PAGE_VALID     0x0008
 /* original state of the write flag (used when tracking self-modifying
    code */
-#define PAGE_WRITE_ORG 0x0010 
+#define PAGE_WRITE_ORG 0x0010
 
 void page_dump(FILE *f);
 int page_get_flags(target_ulong address);
@@ -754,7 +754,7 @@ void page_unprotect_range(target_ulong data, target_ulong data_size);
 
 #endif /* SINGLE_CPU_DEFINES */
 
-void cpu_dump_state(CPUState *env, FILE *f, 
+void cpu_dump_state(CPUState *env, FILE *f,
                     int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
                     int flags);
 
@@ -784,7 +784,7 @@ void cpu_reset(CPUState *s);
    if no page found. */
 target_ulong cpu_get_phys_page_debug(CPUState *env, target_ulong addr);
 
-#define CPU_LOG_TB_OUT_ASM (1 << 0) 
+#define CPU_LOG_TB_OUT_ASM (1 << 0)
 #define CPU_LOG_TB_IN_ASM  (1 << 1)
 #define CPU_LOG_TB_OP      (1 << 2)
 #define CPU_LOG_TB_OP_OPT  (1 << 3)
@@ -844,7 +844,7 @@ extern uint8_t *phys_ram_dirty;
 typedef void CPUWriteMemoryFunc(void *opaque, target_phys_addr_t addr, uint32_t value);
 typedef uint32_t CPUReadMemoryFunc(void *opaque, target_phys_addr_t addr);
 
-void cpu_register_physical_memory(target_phys_addr_t start_addr, 
+void cpu_register_physical_memory(target_phys_addr_t start_addr,
                                   unsigned long size,
                                   unsigned long phys_offset);
 uint32_t cpu_get_physical_page_desc(target_phys_addr_t addr);
@@ -857,12 +857,12 @@ CPUReadMemoryFunc **cpu_get_io_memory_read(int io_index);
 
 void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
                             int len, int is_write);
-static inline void cpu_physical_memory_read(target_phys_addr_t addr, 
+static inline void cpu_physical_memory_read(target_phys_addr_t addr,
                                             uint8_t *buf, int len)
 {
     cpu_physical_memory_rw(addr, buf, len, 0);
 }
-static inline void cpu_physical_memory_write(target_phys_addr_t addr, 
+static inline void cpu_physical_memory_write(target_phys_addr_t addr,
                                              const uint8_t *buf, int len)
 {
     cpu_physical_memory_rw(addr, (uint8_t *)buf, len, 1);
@@ -877,9 +877,9 @@ void stw_phys(target_phys_addr_t addr, uint32_t val);
 void stl_phys(target_phys_addr_t addr, uint32_t val);
 void stq_phys(target_phys_addr_t addr, uint64_t val);
 
-void cpu_physical_memory_write_rom(target_phys_addr_t addr, 
+void cpu_physical_memory_write_rom(target_phys_addr_t addr,
                                    const uint8_t *buf, int len);
-int cpu_memory_rw_debug(CPUState *env, target_ulong addr, 
+int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
                         uint8_t *buf, int len, int is_write);
 
 #define VGA_DIRTY_FLAG  0x01
@@ -891,7 +891,7 @@ static inline int cpu_physical_memory_is_dirty(ram_addr_t addr)
     return phys_ram_dirty[addr >> TARGET_PAGE_BITS] == 0xff;
 }
 
-static inline int cpu_physical_memory_get_dirty(ram_addr_t addr, 
+static inline int cpu_physical_memory_get_dirty(ram_addr_t addr,
                                                 int dirty_flags)
 {
     return phys_ram_dirty[addr >> TARGET_PAGE_BITS] & dirty_flags;
@@ -914,14 +914,14 @@ void dump_exec_info(FILE *f,
 
 #if defined(__powerpc__)
 
-static inline uint32_t get_tbl(void) 
+static inline uint32_t get_tbl(void)
 {
     uint32_t tbl;
     asm volatile("mftb %0" : "=r" (tbl));
     return tbl;
 }
 
-static inline uint32_t get_tbu(void) 
+static inline uint32_t get_tbu(void)
 {
        uint32_t tbl;
        asm volatile("mftbu %0" : "=r" (tbl));
index 0b49c89913ef93f90a8f25c7385483af85f5bd6d..c6f0e2093173c09db2a1fb3997f1200a2baadc29 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * common defines for all CPUs
- * 
+ *
  * Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -29,7 +29,7 @@
 #error TARGET_LONG_BITS must be defined before including this header
 #endif
 
-#ifndef TARGET_PHYS_ADDR_BITS 
+#ifndef TARGET_PHYS_ADDR_BITS
 #if TARGET_LONG_BITS >= HOST_LONG_BITS
 #define TARGET_PHYS_ADDR_BITS TARGET_LONG_BITS
 #else
@@ -92,17 +92,17 @@ typedef unsigned long ram_addr_t;
 #define CPU_TLB_SIZE (1 << CPU_TLB_BITS)
 
 typedef struct CPUTLBEntry {
-    /* bit 31 to TARGET_PAGE_BITS : virtual address 
+    /* bit 31 to TARGET_PAGE_BITS : virtual address
        bit TARGET_PAGE_BITS-1..IO_MEM_SHIFT : if non zero, memory io
                                               zone number
        bit 3                      : indicates that the entry is invalid
        bit 2..0                   : zero
     */
-    target_ulong addr_read; 
-    target_ulong addr_write; 
-    target_ulong addr_code; 
+    target_ulong addr_read;
+    target_ulong addr_write;
+    target_ulong addr_code;
     /* addend to virtual address to get physical address */
-    target_phys_addr_t addend; 
+    target_phys_addr_t addend;
 } CPUTLBEntry;
 
 #define CPU_COMMON                                                      \
index 058688fc77650ce68f3b2c5e39a66c1515f4ab95..c95dac8a712e8b939886c102885f43bdbe2eab30 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  i386 emulator main execution loop
- * 
+ *
  *  Copyright (c) 2003-2005 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -54,7 +54,7 @@ void cpu_loop_exit(void)
 /* exit the current TB from a signal handler. The host registers are
    restored in a state compatible with the CPU emulator
  */
-void cpu_resume_from_signal(CPUState *env1, void *puc) 
+void cpu_resume_from_signal(CPUState *env1, void *puc)
 {
 #if !defined(CONFIG_SOFTMMU)
     struct ucontext *uc = puc;
@@ -83,13 +83,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;
@@ -100,13 +100,13 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
         tb = *ptb1;
         if (!tb)
             goto not_found;
-        if (tb->pc == pc && 
+        if (tb->pc == pc &&
             tb->page_addr[0] == phys_page1 &&
-            tb->cs_base == cs_base && 
+            tb->cs_base == cs_base &&
             tb->flags == flags) {
             /* check next page if needed */
             if (tb->page_addr[1] != -1) {
-                virt_page2 = (pc & TARGET_PAGE_MASK) + 
+                virt_page2 = (pc & TARGET_PAGE_MASK) +
                     TARGET_PAGE_SIZE;
                 phys_page2 = get_phys_addr_code(env, virt_page2);
                 if (tb->page_addr[1] == phys_page2)
@@ -134,7 +134,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;
@@ -142,7 +142,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;
@@ -255,8 +255,8 @@ int cpu_exec(CPUState *env1)
     }
 #elif defined(TARGET_PPC)
     if (env1->halted) {
-        if (env1->msr[MSR_EE] && 
-            (env1->interrupt_request & 
+        if (env1->msr[MSR_EE] &&
+            (env1->interrupt_request &
              (CPU_INTERRUPT_HARD | CPU_INTERRUPT_TIMER))) {
             env1->halted = 0;
         } else {
@@ -294,7 +294,7 @@ int cpu_exec(CPUState *env1)
     }
 #endif
 
-    cpu_single_env = env1; 
+    cpu_single_env = env1;
 
     /* first we save global registers */
 #define SAVE_HOST_REGS 1
@@ -345,9 +345,9 @@ int cpu_exec(CPUState *env1)
                        which will be handled outside the cpu execution
                        loop */
 #if defined(TARGET_I386)
-                    do_interrupt_user(env->exception_index, 
-                                      env->exception_is_int, 
-                                      env->error_code, 
+                    do_interrupt_user(env->exception_index,
+                                      env->exception_is_int,
+                                      env->error_code,
                                       env->exception_next_eip);
 #endif
                     ret = env->exception_index;
@@ -357,9 +357,9 @@ int cpu_exec(CPUState *env1)
                     /* simulate a real cpu exception. On i386, it can
                        trigger new exceptions, but we do not handle
                        double or triple faults yet. */
-                    do_interrupt(env->exception_index, 
-                                 env->exception_is_int, 
-                                 env->error_code, 
+                    do_interrupt(env->exception_index,
+                                 env->exception_is_int,
+                                 env->error_code,
                                  env->exception_next_eip, 0);
 #elif defined(TARGET_PPC)
                     do_interrupt(env);
@@ -374,7 +374,7 @@ int cpu_exec(CPUState *env1)
 #endif
                 }
                 env->exception_index = -1;
-            } 
+            }
 #ifdef USE_KQEMU
             if (kqemu_is_ok(env) && env->interrupt_request == 0) {
                 int ret;
@@ -404,9 +404,9 @@ int cpu_exec(CPUState *env1)
             T0 = 0; /* force lookup of first TB */
             for(;;) {
 #if defined(__sparc__) && !defined(HOST_SOLARIS)
-                /* g1 can be modified by some libc? functions */ 
+                /* g1 can be modified by some libc? functions */
                 tmp_T0 = T0;
-#endif     
+#endif
                 interrupt_request = env->interrupt_request;
                 if (__builtin_expect(interrupt_request, 0)) {
 #if defined(TARGET_I386)
@@ -420,7 +420,7 @@ int cpu_exec(CPUState *env1)
                         T0 = 0;
 #endif
                     } else if ((interrupt_request & CPU_INTERRUPT_HARD) &&
-                        (env->eflags & IF_MASK) && 
+                        (env->eflags & IF_MASK) &&
                         !(env->hflags & HF_INHIBIT_IRQ_MASK)) {
                         int intno;
                         env->interrupt_request &= ~CPU_INTERRUPT_HARD;
@@ -594,7 +594,7 @@ int cpu_exec(CPUState *env1)
 #elif defined(TARGET_SH4)
                    cpu_dump_state(env, logfile, fprintf, 0);
 #else
-#error unsupported target CPU 
+#error unsupported target CPU
 #endif
                 }
 #endif
@@ -608,7 +608,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. */
@@ -619,7 +619,7 @@ int cpu_exec(CPUState *env1)
 #endif
                         tb->page_addr[1] == -1
 #if defined(TARGET_I386) && defined(USE_CODE_COPY)
-                    && (tb->cflags & CF_CODE_COPY) == 
+                    && (tb->cflags & CF_CODE_COPY) ==
                     (((TranslationBlock *)(T0 & ~3))->cflags & CF_CODE_COPY)
 #endif
                     ) {
@@ -627,7 +627,7 @@ int cpu_exec(CPUState *env1)
                     tb_add_jump((TranslationBlock *)(long)(T0 & ~3), T0 & 3, tb);
 #if defined(USE_CODE_COPY)
                     /* propagates the FP use info */
-                    ((TranslationBlock *)(T0 & ~3))->cflags |= 
+                    ((TranslationBlock *)(T0 & ~3))->cflags |=
                         (tb->cflags & CF_FP_USED);
 #endif
                     spin_unlock(&tb_lock);
@@ -641,7 +641,7 @@ int cpu_exec(CPUState *env1)
                 __asm__ __volatile__("call     %0\n\t"
                                      "mov      %%o7,%%i0"
                                      : /* no outputs */
-                                     : "r" (gen_func) 
+                                     : "r" (gen_func)
                                      : "i0", "i1", "i2", "i3", "i4", "i5",
                                        "l0", "l1", "l2", "l3", "l4", "l5",
                                        "l6", "l7");
@@ -796,7 +796,7 @@ int cpu_exec(CPUState *env1)
 #include "hostregs_helper.h"
 
     /* fail safe : never use cpu_single_env outside cpu_exec() */
-    cpu_single_env = NULL; 
+    cpu_single_env = NULL;
     return ret;
 }
 
@@ -823,7 +823,7 @@ void cpu_x86_load_seg(CPUX86State *s, int seg_reg, int selector)
     env = s;
     if (!(env->cr[0] & CR0_PE_MASK) || (env->eflags & VM_MASK)) {
         selector &= 0xffff;
-        cpu_x86_load_seg_cache(env, seg_reg, selector, 
+        cpu_x86_load_seg_cache(env, seg_reg, selector,
                                (selector << 4), 0xffff, 0);
     } else {
         load_seg(seg_reg, selector);
@@ -837,7 +837,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;
@@ -849,7 +849,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;
@@ -866,7 +866,7 @@ void cpu_x86_frstor(CPUX86State *s, uint8_t *ptr, int data32)
    write caused the exception and otherwise 0'. 'old_set' is the
    signal set which should be restored */
 static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
-                                    int is_write, sigset_t *old_set, 
+                                    int is_write, sigset_t *old_set,
                                     void *puc)
 {
     TranslationBlock *tb;
@@ -875,7 +875,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
     if (cpu_single_env)
         env = cpu_single_env; /* XXX: find a correct solution for multithread */
 #if defined(DEBUG_SIGNAL)
-    qemu_printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", 
+    qemu_printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
                 pc, address, is_write, *(unsigned long *)old_set);
 #endif
     /* XXX: locking issue */
@@ -884,7 +884,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
     }
 
     /* see if it is an MMU fault */
-    ret = cpu_x86_handle_mmu_fault(env, address, is_write, 
+    ret = cpu_x86_handle_mmu_fault(env, address, is_write,
                                    ((env->hflags & HF_CPL_MASK) == 3), 0);
     if (ret < 0)
         return 0; /* not an MMU fault */
@@ -899,7 +899,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
     }
     if (ret == 1) {
 #if 0
-        printf("PF exception: EIP=0x%08x CR2=0x%08x error=0x%x\n", 
+        printf("PF exception: EIP=0x%08x CR2=0x%08x error=0x%x\n",
                env->eip, env->cr[2], env->error_code);
 #endif
         /* we restore the process signal mask as the sigreturn should
@@ -926,7 +926,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
     if (cpu_single_env)
         env = cpu_single_env; /* XXX: find a correct solution for multithread */
 #if defined(DEBUG_SIGNAL)
-    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", 
+    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
            pc, address, is_write, *(unsigned long *)old_set);
 #endif
     /* XXX: locking issue */
@@ -962,7 +962,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
     if (cpu_single_env)
         env = cpu_single_env; /* XXX: find a correct solution for multithread */
 #if defined(DEBUG_SIGNAL)
-    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", 
+    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
            pc, address, is_write, *(unsigned long *)old_set);
 #endif
     /* XXX: locking issue */
@@ -994,11 +994,11 @@ 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)
-    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", 
+    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
            pc, address, is_write, *(unsigned long *)old_set);
 #endif
     /* XXX: locking issue */
@@ -1022,7 +1022,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
     }
     if (ret == 1) {
 #if 0
-        printf("PF exception: NIP=0x%08x error=0x%x %p\n", 
+        printf("PF exception: NIP=0x%08x error=0x%x %p\n",
                env->nip, env->error_code, tb);
 #endif
     /* we restore the process signal mask as the sigreturn should
@@ -1048,7 +1048,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
     if (cpu_single_env)
         env = cpu_single_env; /* XXX: find a correct solution for multithread */
 #if defined(DEBUG_SIGNAL)
-    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", 
+    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
            pc, address, is_write, *(unsigned long *)old_set);
 #endif
     /* XXX: locking issue */
@@ -1083,11 +1083,11 @@ 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)
-    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", 
+    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
            pc, address, is_write, *(unsigned long *)old_set);
 #endif
     /* XXX: locking issue */
@@ -1111,7 +1111,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
     }
     if (ret == 1) {
 #if 0
-        printf("PF exception: NIP=0x%08x error=0x%x %p\n", 
+        printf("PF exception: NIP=0x%08x error=0x%x %p\n",
                env->nip, env->error_code, tb);
 #endif
     /* we restore the process signal mask as the sigreturn should
@@ -1133,11 +1133,11 @@ 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)
-    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n", 
+    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
            pc, address, is_write, *(unsigned long *)old_set);
 #endif
     /* XXX: locking issue */
@@ -1160,7 +1160,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
         cpu_restore_state(tb, env, pc, puc);
     }
 #if 0
-        printf("PF exception: NIP=0x%08x error=0x%x %p\n", 
+        printf("PF exception: NIP=0x%08x error=0x%x %p\n",
                env->nip, env->error_code, tb);
 #endif
     /* we restore the process signal mask as the sigreturn should
@@ -1189,7 +1189,7 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
 #endif
 
 #if defined(USE_CODE_COPY)
-static void cpu_send_trap(unsigned long pc, int trap, 
+static void cpu_send_trap(unsigned long pc, int trap,
                           struct ucontext *uc)
 {
     TranslationBlock *tb;
@@ -1208,7 +1208,7 @@ static void cpu_send_trap(unsigned long pc, int trap,
 }
 #endif
 
-int cpu_signal_handler(int host_signum, void *pinfo, 
+int cpu_signal_handler(int host_signum, void *pinfo,
                        void *puc)
 {
     siginfo_t *info = pinfo;
@@ -1231,8 +1231,8 @@ int cpu_signal_handler(int host_signum, void *pinfo,
         return 1;
     } else
 #endif
-        return handle_cpu_signal(pc, (unsigned long)info->si_addr, 
-                                 trapno == 0xe ? 
+        return handle_cpu_signal(pc, (unsigned long)info->si_addr,
+                                 trapno == 0xe ?
                                  (ERROR_sig(uc) >> 1) & 1 : 0,
                                  &uc->uc_sigmask, puc);
 }
@@ -1247,8 +1247,8 @@ int cpu_signal_handler(int host_signum, void *pinfo,
     unsigned long pc;
 
     pc = uc->uc_mcontext.gregs[REG_RIP];
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr, 
-                             uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe ? 
+    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
+                             uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe ?
                              (uc->uc_mcontext.gregs[REG_ERR] >> 1) & 1 : 0,
                              &uc->uc_sigmask, puc);
 }
@@ -1304,7 +1304,7 @@ typedef struct ucontext SIGCONTEXT;
 # define TRAP_sig(context)                     EXCEPREG_sig(exception, context) /* number of powerpc exception taken */
 #endif /* __APPLE__ */
 
-int cpu_signal_handler(int host_signum, void *pinfo, 
+int cpu_signal_handler(int host_signum, void *pinfo,
                        void *puc)
 {
     siginfo_t *info = pinfo;
@@ -1322,13 +1322,13 @@ int cpu_signal_handler(int host_signum, void *pinfo,
     if (TRAP_sig(uc) != 0x400 && (DSISR_sig(uc) & 0x02000000))
         is_write = 1;
 #endif
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr, 
+    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
                              is_write, &uc->uc_sigmask, puc);
 }
 
 #elif defined(__alpha__)
 
-int cpu_signal_handler(int host_signum, void *pinfo, 
+int cpu_signal_handler(int host_signum, void *pinfo,
                            void *puc)
 {
     siginfo_t *info = pinfo;
@@ -1353,12 +1353,12 @@ int cpu_signal_handler(int host_signum, void *pinfo,
        is_write = 1;
     }
 
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr, 
+    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
                              is_write, &uc->uc_sigmask, puc);
 }
 #elif defined(__sparc__)
 
-int cpu_signal_handler(int host_signum, void *pinfo, 
+int cpu_signal_handler(int host_signum, void *pinfo,
                        void *puc)
 {
     siginfo_t *info = pinfo;
@@ -1367,7 +1367,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 */
@@ -1386,42 +1386,42 @@ int cpu_signal_handler(int host_signum, void *pinfo,
        break;
       }
     }
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr, 
+    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
                              is_write, sigmask, NULL);
 }
 
 #elif defined(__arm__)
 
-int cpu_signal_handler(int host_signum, void *pinfo, 
+int cpu_signal_handler(int host_signum, void *pinfo,
                        void *puc)
 {
     siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
     unsigned long pc;
     int is_write;
-    
+
     pc = uc->uc_mcontext.gregs[R15];
     /* XXX: compute is_write */
     is_write = 0;
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr, 
+    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
                              is_write,
                              &uc->uc_sigmask, puc);
 }
 
 #elif defined(__mc68000)
 
-int cpu_signal_handler(int host_signum, void *pinfo, 
+int cpu_signal_handler(int host_signum, void *pinfo,
                        void *puc)
 {
     siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
     unsigned long pc;
     int is_write;
-    
+
     pc = uc->uc_mcontext.gregs[16];
     /* XXX: compute is_write */
     is_write = 0;
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr, 
+    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
                              is_write,
                              &uc->uc_sigmask, puc);
 }
@@ -1462,18 +1462,18 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
 
 #elif defined(__s390__)
 
-int cpu_signal_handler(int host_signum, void *pinfo, 
+int cpu_signal_handler(int host_signum, void *pinfo,
                        void *puc)
 {
     siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
     unsigned long pc;
     int is_write;
-    
+
     pc = uc->uc_mcontext.psw.addr;
     /* XXX: compute is_write */
     is_write = 0;
-    return handle_cpu_signal(pc, (unsigned long)info->si_addr, 
+    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
                              is_write,
                              &uc->uc_sigmask, puc);
 }
index 352c47e2118f4e3f53bf59914ba2a92ca8193132..074b5acd47139a5d9c54e4327c26f2f0f55c1614 100644 (file)
--- a/cutils.c
+++ b/cutils.c
@@ -1,6 +1,6 @@
 /*
  * Simple C functions to supplement the C library
- * 
+ *
  * Copyright (c) 2006 Fabrice Bellard
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -45,7 +45,7 @@ char *pstrcat(char *buf, int buf_size, const char *s)
 {
     int len;
     len = strlen(buf);
-    if (len < buf_size) 
+    if (len < buf_size)
         pstrcpy(buf + len, buf_size - len, s);
     return buf;
 }
index f2543aa44dfd389a981ac6e2801dced068e8f30a..f93874d63223ebcd32f50725bbcd2ea60717d248 100644 (file)
@@ -1299,7 +1299,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");
 
@@ -1338,7 +1338,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));
 
index 73b4380b788c301c3e097ea529ccfd69b0f8a478..1562cf26be7099415d34ba7d99204f286f4f9c4c 100644 (file)
--- a/dis-asm.h
+++ b/dis-asm.h
@@ -44,7 +44,7 @@ enum bfd_flavour {
 
 enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
 
-enum bfd_architecture 
+enum bfd_architecture
 {
   bfd_arch_unknown,    /* File arch not known */
   bfd_arch_obscure,    /* Arch known, not one of these */
@@ -67,14 +67,14 @@ 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 
+       lower number indicates a machine type that
        only accepts a subset of the instructions
        available to machines with higher numbers.
        The exception is the "ca", which is
-       incompatible with all other machines except 
+       incompatible with all other machines except
        "core". */
 
 #define bfd_mach_i960_core      1
@@ -225,7 +225,7 @@ enum dis_insn_type {
   dis_dref2                    /* Two data references in instruction */
 };
 
-/* This struct is passed into the instruction decoding routine, 
+/* This struct is passed into the instruction decoding routine,
    and is passed back out into each callback.  The various fields are used
    for conveying information from your main routine into your callbacks,
    for passing information into the instruction decoders (such as the
diff --git a/disas.c b/disas.c
index 162f52e0c381b5c728cb4ae550cd6990121f2d31..f3e448b13283dbd27bf1a3ea3dbce0d68e4efb48 100644 (file)
--- a/disas.c
+++ b/disas.c
@@ -137,7 +137,7 @@ print_insn_thumb1(bfd_vma pc, disassemble_info *info)
 /* Disassemble this for me please... (debugging). 'flags' has the following
    values:
     i386 - nonzero means 16 bit code
-    arm  - nonzero means thumb code 
+    arm  - nonzero means thumb code
     ppc  - nonzero means little endian
     other targets - unused
  */
@@ -162,7 +162,7 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)
 #if defined(TARGET_I386)
     if (flags == 2)
         disasm_info.mach = bfd_mach_x86_64;
-    else if (flags == 1) 
+    else if (flags == 1)
         disasm_info.mach = bfd_mach_i386_i8086;
     else
         disasm_info.mach = bfd_mach_i386_i386;
@@ -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;
@@ -255,7 +255,7 @@ void disas(FILE *out, void *code, unsigned long size)
     print_insn = print_insn_alpha;
 #elif defined(__sparc__)
     print_insn = print_insn_sparc;
-#elif defined(__arm__) 
+#elif defined(__arm__)
     print_insn = print_insn_arm;
 #elif defined(__MIPSEB__)
     print_insn = print_insn_big_mips;
@@ -290,7 +290,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++) {
@@ -369,7 +369,7 @@ void monitor_disas(CPUState *env,
 #if defined(TARGET_I386)
     if (flags == 2)
         disasm_info.mach = bfd_mach_x86_64;
-    else if (flags == 1) 
+    else if (flags == 1)
         disasm_info.mach = bfd_mach_i386_i8086;
     else
         disasm_info.mach = bfd_mach_i386_i386;
index 7b313d62c72acdf3dc01202ae8f3db06e8b3e214..77e68f710aa026c989c1c3b5ff17af400eedf9aa 100644 (file)
@@ -206,7 +206,7 @@ extern int printf(const char *, ...);
 /* the symbols are considered non exported so a br immediate is generated */
 #define __hidden __attribute__((visibility("hidden")))
 #else
-#define __hidden 
+#define __hidden
 #endif
 
 #if defined(__alpha__)
index bcfb86ea0dded612d51562e23cef3fe90041980a..049e9ec9c0a5aa2a5f3d58ff6228d3021d7a75f8 100644 (file)
--- a/dyngen.c
+++ b/dyngen.c
@@ -1,6 +1,6 @@
 /*
  *  Generic Dynamic compiler generator
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  *  The COFF object format support was extracted from Kazu's QEMU port
@@ -189,11 +189,11 @@ typedef uint32_t host_ulong;
 struct nlist_extended
 {
    union {
-   char *n_name; 
-   long  n_strx; 
+   char *n_name;
+   long  n_strx;
    } n_un;
-   unsigned char n_type; 
-   unsigned char n_sect; 
+   unsigned char n_type;
+   unsigned char n_sect;
    short st_desc;
    unsigned long st_value;
    unsigned long st_size;
@@ -357,10 +357,10 @@ int elf_must_swap(struct elfhdr *h)
   } swaptest;
 
   swaptest.i = 1;
-  return (h->e_ident[EI_DATA] == ELFDATA2MSB) != 
+  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 */
@@ -413,7 +413,7 @@ void elf_swap_rel(ELF_RELOC *rel)
 #endif
 }
 
-struct elf_shdr *find_elf_section(struct elf_shdr *shdr, int shnum, const char *shstr, 
+struct elf_shdr *find_elf_section(struct elf_shdr *shdr, int shnum, const char *shstr,
                                   const char *name)
 {
     int i;
@@ -438,7 +438,7 @@ int find_reloc(int sh_index)
 
     for(i = 0; i < ehdr.e_shnum; i++) {
         sec = &shdr[i];
-        if (sec->sh_type == SHT_RELOC && sec->sh_info == sh_index) 
+        if (sec->sh_type == SHT_RELOC && sec->sh_info == sh_index)
             return i;
     }
     return 0;
@@ -468,11 +468,11 @@ int load_object(const char *filename)
     ElfW(Sym) *sym;
     char *shstr;
     ELF_RELOC *rel;
-    
+
     fd = open(filename, O_RDONLY);
-    if (fd < 0) 
+    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");
@@ -509,7 +509,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)
@@ -554,7 +554,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++) {
@@ -594,7 +594,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++) {
@@ -628,7 +628,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;
 
                }
@@ -686,15 +686,15 @@ int load_object(const char *filename)
     uint32_t *n_strtab;
     EXE_SYM *sym;
     EXE_RELOC *rel;
-       
-    fd = open(filename, O_RDONLY 
+
+    fd = open(filename, O_RDONLY
 #ifdef _WIN32
               | O_BINARY
 #endif
               );
-    if (fd < 0) 
+    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");
@@ -707,11 +707,11 @@ int load_object(const char *filename)
 
     /* read section headers */
     shdr = load_data(fd, sizeof(struct external_filehdr) + fhdr.f_opthdr, fhdr.f_nscns * sizeof(struct external_scnhdr));
-       
+
     /* 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];
@@ -732,7 +732,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++)
@@ -742,8 +742,8 @@ 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); 
-    
+    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++) {
@@ -790,12 +790,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);
@@ -803,7 +803,7 @@ int load_object(const char *filename)
 
     /* set coff relocation */
     relocs = malloc(sizeof(struct coff_rel) * nb_relocs);
-    for (i = 0, ext_rel = coff_relocs, rel = relocs; i < nb_relocs; 
+    for (i = 0, ext_rel = coff_relocs, rel = relocs; i < nb_relocs;
          i++, ext_rel++, rel++) {
         memset(rel, 0, sizeof(*rel));
         rel->r_reloc = ext_rel;
@@ -832,7 +832,7 @@ uint8_t     **sdata;
 
 /* relocs */
 struct relocation_info *relocs;
-       
+
 /* symbols */
 EXE_SYM                        *symtab;
 struct nlist   *symtab_std;
@@ -852,10 +852,10 @@ static inline char *find_str_by_index(int index)
 static char *get_sym_name(EXE_SYM *sym)
 {
        char *name = find_str_by_index(sym->n_un.n_strx);
-       
+
        if ( sym->n_type & N_STAB ) /* Debug symbols are ignored */
                return "debug";
-                       
+
        if(!name)
                return name;
        if(name[0]=='_')
@@ -865,7 +865,7 @@ static char *get_sym_name(EXE_SYM *sym)
 }
 
 /* find a section index given its segname, sectname */
-static int find_mach_sec_index(struct section *section_hdr, int shnum, const char *segname, 
+static int find_mach_sec_index(struct section *section_hdr, int shnum, const char *segname,
                                   const char *sectname)
 {
     int i;
@@ -881,7 +881,7 @@ static int find_mach_sec_index(struct section *section_hdr, int shnum, const cha
 }
 
 /* find a section header given its segname, sectname */
-struct section *find_mach_sec_hdr(struct section *section_hdr, int shnum, const char *segname, 
+struct section *find_mach_sec_hdr(struct section *section_hdr, int shnum, const char *segname,
                                   const char *sectname)
 {
     int index = find_mach_sec_index(section_hdr, shnum, segname, sectname);
@@ -894,7 +894,7 @@ struct section *find_mach_sec_hdr(struct section *section_hdr, int shnum, const
 static inline void fetch_next_pair_value(struct relocation_info * rel, unsigned int *value)
 {
     struct scattered_relocation_info * scarel;
-       
+
     if(R_SCATTERED & rel->r_address) {
         scarel = (struct scattered_relocation_info*)rel;
         if(scarel->r_type != PPC_RELOC_PAIR)
@@ -911,7 +911,7 @@ static inline void fetch_next_pair_value(struct relocation_info * rel, unsigned
 static const char * find_sym_with_value_and_sec_number( int value, int sectnum, int * offset )
 {
        int i, ret = -1;
-       
+
        for( i = 0 ; i < nb_syms; i++ )
        {
            if( !(symtab[i].n_type & N_STAB) && (symtab[i].n_type & N_SECT) &&
@@ -930,35 +930,35 @@ static const char * find_sym_with_value_and_sec_number( int value, int sectnum,
        }
 }
 
-/* 
- *  Find symbol name given a (virtual) address, and a section which is of type 
+/*
+ *  Find symbol name given a (virtual) address, and a section which is of type
  *  S_NON_LAZY_SYMBOL_POINTERS or S_LAZY_SYMBOL_POINTERS or S_SYMBOL_STUBS
  */
 static const char * find_reloc_name_in_sec_ptr(int address, struct section * sec_hdr)
 {
     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];
-       
+
        name = get_sym_name(&symtab[symindex]);
 
     return name;
@@ -983,24 +983,24 @@ static const char * get_reloc_name(EXE_RELOC * rel, int * sslide)
        int sectnum = rel->r_symbolnum;
        int sectoffset;
        int other_half=0;
-       
+
        /* init the slide value */
        *sslide = 0;
-       
+
        if(R_SCATTERED & rel->r_address)
                return (char *)find_reloc_name_given_its_address(sca_rel->r_value);
 
        if(rel->r_extern)
        {
                /* ignore debug sym */
-               if ( symtab[rel->r_symbolnum].n_type & N_STAB ) 
+               if ( symtab[rel->r_symbolnum].n_type & N_STAB )
                        return 0;
                return get_sym_name(&symtab[rel->r_symbolnum]);
        }
 
        /* 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;
 
@@ -1026,14 +1026,14 @@ 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, &section_hdr[sectnum-1]);
 
        /* search it in the full symbol list, if not found */
        if(!name)
                name = (char *)find_sym_with_value_and_sec_number(sectoffset, sectnum, sslide);
-       
+
        return name;
 }
 
@@ -1065,11 +1065,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) 
+    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");
@@ -1078,13 +1078,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++)
     {
@@ -1128,26 +1128,26 @@ 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);
     }
-       
+
     /* text section */
        text_sec_hdr = find_mach_sec_hdr(section_hdr, segment->nsects, SEG_TEXT, SECT_TEXT);
        i = find_mach_sec_index(section_hdr, segment->nsects, SEG_TEXT, SECT_TEXT);
        if (i == -1 || !text_sec_hdr)
         error("could not find __TEXT,__text section");
     text = sdata[i];
-       
+
     /* 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");
@@ -1155,20 +1155,20 @@ int load_object(const char *filename)
 
     symtab_std = load_data(fd, symtabcmd->symoff, symtabcmd->nsyms * sizeof(struct nlist));
     strtab = load_data(fd, symtabcmd->stroff, symtabcmd->strsize);
-       
+
        symtab = malloc(sizeof(EXE_SYM) * nb_syms);
-       
+
        /* Now transform the symtab, to an extended version, with the sym size, and the C name */
        for(i = 0, sym = symtab, syment = symtab_std; i < nb_syms; i++, sym++, syment++) {
         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))
@@ -1186,7 +1186,7 @@ int load_object(const char *filename)
                else
             sym->st_size = text_sec_hdr->size - sym->st_value;
        }
-       
+
     /* Find Reloc */
     relocs = load_data(fd, text_sec_hdr->reloff, text_sec_hdr->nreloc * sizeof(struct relocation_info));
     nb_relocs = text_sec_hdr->nreloc;
@@ -1271,9 +1271,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;
@@ -1316,25 +1316,25 @@ int arm_emit_ldr_info(const char *name, unsigned long start_offset,
             if (spare > max_pool - offset)
                 spare = max_pool - offset;
             if ((offset & 3) !=0)
-                error("%s:%04x: pc offset must be 32 bit aligned", 
+                error("%s:%04x: pc offset must be 32 bit aligned",
                       name, start_offset + p - p_start);
             if (offset < 0)
                 error("%s:%04x: Embedded literal value",
                       name, start_offset + p - p_start);
             pc_offset = p - p_start + offset + 8;
-            if (pc_offset <= (p - p_start) || 
+            if (pc_offset <= (p - p_start) ||
                 pc_offset >= (p_end - p_start))
-                error("%s:%04x: pc offset must point inside the function code", 
+                error("%s:%04x: pc offset must point inside the function code",
                       name, start_offset + p - p_start);
             if (pc_offset < min_offset)
                 min_offset = pc_offset;
             if (outfile) {
                 /* The intruction position */
-                fprintf(outfile, "    arm_ldr_ptr->ptr = gen_code_ptr + %d;\n", 
+                fprintf(outfile, "    arm_ldr_ptr->ptr = gen_code_ptr + %d;\n",
                         p - p_start);
                 /* The position of the constant pool data.  */
                 data_index = ((p_end - p_start) - pc_offset) >> 2;
-                fprintf(outfile, "    arm_ldr_ptr->data_ptr = arm_data_ptr - %d;\n", 
+                fprintf(outfile, "    arm_ldr_ptr->data_ptr = arm_data_ptr - %d;\n",
                         data_index);
                 fprintf(outfile, "    arm_ldr_ptr->type = %d;\n", type);
                 fprintf(outfile, "    arm_ldr_ptr++;\n");
@@ -1417,7 +1417,7 @@ int arm_emit_ldr_info(const char *name, unsigned long start_offset,
 #define MAX_ARGS 3
 
 /* generate op code */
-void gen_code(const char *name, host_ulong offset, host_ulong size, 
+void gen_code(const char *name, host_ulong offset, host_ulong size,
               FILE *outfile, int gen_switch)
 {
     int copy_size = 0;
@@ -1463,7 +1463,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;
@@ -1495,7 +1495,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)
     {
@@ -1596,14 +1596,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)
@@ -1624,7 +1624,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
             p_start -= 4;
             start_offset -= 4;
         }
-        copy_size = arm_emit_ldr_info(name, start_offset, NULL, p_start, p_end, 
+        copy_size = arm_emit_ldr_info(name, start_offset, NULL, p_start, p_end,
                                       relocs, nb_relocs);
     }
 #elif defined(HOST_M68K)
@@ -1635,7 +1635,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
             error("empty code for %s", name);
         // remove NOP's, probably added for alignment
         while ((get16((uint16_t *)p) == 0x4e71) &&
-               (p>p_start)) 
+               (p>p_start))
             p -= 2;
         if (get16((uint16_t *)p) != 0x4e75)
             error("rts expected at the end of %s", name);
@@ -1665,7 +1665,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++;
@@ -1702,7 +1702,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                 sym_name = get_rel_sym_name(rel);
                 if(!sym_name)
                     continue;
-                if (*sym_name && 
+                if (*sym_name &&
                     !strstart(sym_name, "__op_param", NULL) &&
                     !strstart(sym_name, "__op_jmp", NULL) &&
                     !strstart(sym_name, "__op_gen_label", NULL)) {
@@ -1748,7 +1748,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
@@ -1780,7 +1780,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                         /* try to find a matching relocation */
                         reloc_shndx = find_reloc(sym->st_shndx);
                         if (reloc_shndx) {
-                            nb_relocs1 = shdr[reloc_shndx].sh_size / 
+                            nb_relocs1 = shdr[reloc_shndx].sh_size /
                                 shdr[reloc_shndx].sh_entsize;
                             rel = (ELF_RELOC *)sdata[reloc_shndx];
                             for(j = 0; j < nb_relocs1; j++) {
@@ -1792,7 +1792,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));
@@ -1838,11 +1838,11 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                     type = ELF32_R_TYPE(rel->r_info);
                     switch(type) {
                     case R_386_32:
-                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
+                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n",
                                 reloc_offset, name, addend);
                         break;
                     case R_386_PC32:
-                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %d) + %d;\n", 
+                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %d) + %d;\n",
                                 reloc_offset, name, reloc_offset, addend);
                         break;
                     default:
@@ -1865,11 +1865,11 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                     type = rel->r_type;
                     switch(type) {
                     case DIR32:
-                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
+                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n",
                                 reloc_offset, name, addend);
                         break;
                     case DISP32:
-                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %d) + %d -4;\n", 
+                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %d) + %d -4;\n",
                                 reloc_offset, name, reloc_offset, addend);
                         break;
                     default:
@@ -1897,15 +1897,15 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                     reloc_offset = rel->r_offset - start_offset;
                     switch(type) {
                     case R_X86_64_32:
-                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (uint32_t)%s + %d;\n", 
+                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (uint32_t)%s + %d;\n",
                                 reloc_offset, name, addend);
                         break;
                     case R_X86_64_32S:
-                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (int32_t)%s + %d;\n", 
+                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (int32_t)%s + %d;\n",
                                 reloc_offset, name, addend);
                         break;
                     case R_X86_64_PC32:
-                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %d) + %d;\n", 
+                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %d) + %d;\n",
                                 reloc_offset, name, reloc_offset, addend);
                         break;
                     default:
@@ -1937,30 +1937,30 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                                     n, reloc_offset);
                             continue;
                         }
-                        
+
                         get_reloc_expr(name, sizeof(name), sym_name);
                         type = ELF32_R_TYPE(rel->r_info);
                         addend = rel->r_addend;
                         switch(type) {
                         case R_PPC_ADDR32:
-                            fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
+                            fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n",
                                     reloc_offset, name, addend);
                             break;
                         case R_PPC_ADDR16_LO:
-                            fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = (%s + %d);\n", 
+                            fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = (%s + %d);\n",
                                     reloc_offset, name, addend);
                             break;
                         case R_PPC_ADDR16_HI:
-                            fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = (%s + %d) >> 16;\n", 
+                            fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = (%s + %d) >> 16;\n",
                                     reloc_offset, name, addend);
                             break;
                         case R_PPC_ADDR16_HA:
-                            fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = (%s + %d + 0x8000) >> 16;\n", 
+                            fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = (%s + %d + 0x8000) >> 16;\n",
                                     reloc_offset, name, addend);
                             break;
                         case R_PPC_REL24:
                             /* warning: must be at 32 MB distancy */
-                            fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | ((%s - (long)(gen_code_ptr + %d) + %d) & 0x03fffffc);\n", 
+                            fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | ((%s - (long)(gen_code_ptr + %d) + %d) & 0x03fffffc);\n",
                                     reloc_offset, reloc_offset, name, reloc_offset, addend);
                             break;
                         default:
@@ -1976,12 +1976,12 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                                const char *p;
                                int slide, sslide;
                                int i;
-       
+
                                for(i = 0, rel = relocs; i < nb_relocs; i++, rel++) {
                                        unsigned int offset, length, value = 0;
                                        unsigned int type, pcrel, isym = 0;
                                        unsigned int usesym = 0;
-                               
+
                                        if(R_SCATTERED & rel->r_address) {
                                                scarel = (struct scattered_relocation_info*)rel;
                                                offset = (unsigned int)scarel->r_address;
@@ -1997,17 +1997,17 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                                                pcrel = rel->r_pcrel;
                                                type = rel->r_type;
                                        }
-                               
+
                                        slide = offset - start_offset;
-               
-                                       if (!(offset >= start_offset && offset < start_offset + size)) 
+
+                                       if (!(offset >= start_offset && offset < start_offset + size))
                                                continue;  /* not in our range */
 
                                        sym_name = get_reloc_name(rel, &sslide);
-                                       
+
                                        if(usesym && symtab[isym].n_type & N_STAB)
                                                continue; /* don't handle STAB (debug sym) */
-                                       
+
                                        if (sym_name && strstart(sym_name, "__op_jmp", &p)) {
                                                int n;
                                                n = strtol(p, NULL, 10);
@@ -2015,22 +2015,22 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                                                        n, slide);
                                                continue; /* Nothing more to do */
                                        }
-                                       
+
                                        if(!sym_name)
                                        {
                                                fprintf(outfile, "/* #warning relocation not handled in %s (value 0x%x, %s, offset 0x%x, length 0x%x, %s, type 0x%x) */\n",
                                                           name, value, usesym ? "use sym" : "don't use sym", offset, length, pcrel ? "pcrel":"", type);
                                                continue; /* dunno how to handle without final_sym_name */
                                        }
-                                                                                                          
-                                        get_reloc_expr(final_sym_name, sizeof(final_sym_name), 
+
+                                        get_reloc_expr(final_sym_name, sizeof(final_sym_name),
                                                        sym_name);
                                        switch(type) {
                                        case PPC_RELOC_BR24:
                                            if (!strstart(sym_name,"__op_gen_label",&p)) {
                                                fprintf(outfile, "{\n");
                                                fprintf(outfile, "    uint32_t imm = *(uint32_t *)(gen_code_ptr + %d) & 0x3fffffc;\n", slide);
-                                               fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | ((imm + ((long)%s - (long)gen_code_ptr) + %d) & 0x03fffffc);\n", 
+                                               fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = (*(uint32_t *)(gen_code_ptr + %d) & ~0x03fffffc) | ((imm + ((long)%s - (long)gen_code_ptr) + %d) & 0x03fffffc);\n",
                                                                                        slide, slide, name, sslide );
                                                fprintf(outfile, "}\n");
                                        } else {
@@ -2039,15 +2039,15 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                                        }
                                                break;
                                        case PPC_RELOC_HI16:
-                                               fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d) >> 16;\n", 
+                                               fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d) >> 16;\n",
                                                        slide, final_sym_name, sslide);
                                                break;
                                        case PPC_RELOC_LO16:
-                                               fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d);\n", 
+                                               fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d);\n",
                                        slide, final_sym_name, sslide);
                             break;
                                        case PPC_RELOC_HA16:
-                                               fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d + 0x8000) >> 16;\n", 
+                                               fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d + 2) = (%s + %d + 0x8000) >> 16;\n",
                                                        slide, final_sym_name, sslide);
                                                break;
                                default:
@@ -2074,15 +2074,15 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                         reloc_offset = rel->r_offset - start_offset;
                         switch(type) {
                         case R_390_32:
-                            fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
+                            fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n",
                                     reloc_offset, name, addend);
                             break;
                         case R_390_16:
-                            fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = %s + %d;\n", 
+                            fprintf(outfile, "    *(uint16_t *)(gen_code_ptr + %d) = %s + %d;\n",
                                     reloc_offset, name, addend);
                             break;
                         case R_390_8:
-                            fprintf(outfile, "    *(uint8_t *)(gen_code_ptr + %d) = %s + %d;\n", 
+                            fprintf(outfile, "    *(uint8_t *)(gen_code_ptr + %d) = %s + %d;\n",
                                     reloc_offset, name, addend);
                             break;
                         default:
@@ -2238,7 +2238,7 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                         reloc_offset = rel->r_offset - start_offset;
                         switch(type) {
                         case R_SPARC_32:
-                            fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
+                            fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n",
                                     reloc_offset, name, addend);
                            break;
                        case R_SPARC_HI22:
@@ -2408,13 +2408,13 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                     reloc_offset = rel->r_offset - start_offset;
                     switch(type) {
                     case R_ARM_ABS32:
-                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n", 
+                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %d;\n",
                                 reloc_offset, name, addend);
                         break;
                     case R_ARM_PC24:
                     case R_ARM_JUMP24:
                     case R_ARM_CALL:
-                        fprintf(outfile, "    arm_reloc_pc24((uint32_t *)(gen_code_ptr + %d), 0x%x, %s);\n", 
+                        fprintf(outfile, "    arm_reloc_pc24((uint32_t *)(gen_code_ptr + %d), 0x%x, %s);\n",
                                 reloc_offset, addend, name);
                         break;
                     default:
@@ -2442,12 +2442,12 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
                     switch(type) {
                     case R_68K_32:
                        fprintf(outfile, "    /* R_68K_32 RELOC, offset %x */\n", rel->r_offset) ;
-                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %#x;\n", 
+                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s + %#x;\n",
                                 reloc_offset, name, addend );
                         break;
                     case R_68K_PC32:
                        fprintf(outfile, "    /* R_68K_PC32 RELOC, offset %x */\n", rel->r_offset);
-                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %#x) + %#x;\n", 
+                        fprintf(outfile, "    *(uint32_t *)(gen_code_ptr + %d) = %s - (long)(gen_code_ptr + %#x) + %#x;\n",
                                 reloc_offset, name, reloc_offset, /*sym->st_value+*/ addend);
                         break;
                     default:
@@ -2515,7 +2515,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 */
 
@@ -2558,7 +2558,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. ]
@@ -2645,7 +2645,7 @@ fprintf(outfile,
 "    opc_ptr = opc_buf;\n"
 "    opparam_ptr = opparam_buf;\n");
 
-       /* Generate prologue, if needed. */ 
+       /* Generate prologue, if needed. */
 
 fprintf(outfile,
 "    for(;;) {\n");
@@ -2671,7 +2671,7 @@ fprintf(outfile,
             name = get_sym_name(sym);
             if (strstart(name, OP_PREFIX, NULL)) {
 #if 0
-                printf("%4d: %s pos=0x%08x len=%d\n", 
+                printf("%4d: %s pos=0x%08x len=%d\n",
                        i, name, sym->st_value, sym->st_size);
 #endif
 #if defined(CONFIG_FORMAT_ELF) || defined(CONFIG_FORMAT_COFF)
@@ -2713,7 +2713,7 @@ fprintf(outfile,
            "plt_target, plt_offset);\n    }\n");
 #endif
 
-/* generate some code patching */ 
+/* generate some code patching */
 #ifdef HOST_ARM
 fprintf(outfile,
 "if (arm_data_ptr != arm_data_table + ARM_LDR_TABLE_SIZE)\n"
index 2a87c448fd3f22f89c6681f6bff1f0c956736380..c7939578893477ecbf425cb50cf67d6d08246a5b 100644 (file)
--- a/dyngen.h
+++ b/dyngen.h
@@ -1,6 +1,6 @@
 /*
  * dyngen helpers
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -67,7 +67,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");
     }
@@ -164,8 +164,8 @@ static inline void arm_reloc_pc24(uint32_t *ptr, uint32_t insn, int val)
 }
 
 static uint8_t *arm_flush_ldr(uint8_t *gen_code_ptr,
-                              LDREntry *ldr_start, LDREntry *ldr_end, 
-                              uint32_t *data_start, uint32_t *data_end, 
+                              LDREntry *ldr_start, LDREntry *ldr_end,
+                              uint32_t *data_start, uint32_t *data_end,
                               int gen_jmp)
 {
     LDREntry *le;
@@ -174,7 +174,7 @@ static uint8_t *arm_flush_ldr(uint8_t *gen_code_ptr,
     uint8_t *data_ptr;
     uint32_t insn;
     uint32_t mask;
+
     data_size = (data_end - data_start) << 2;
 
     if (gen_jmp) {
@@ -185,17 +185,17 @@ 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;
-        offset = ((unsigned long)(le->data_ptr) - (unsigned long)data_start) + 
-            (unsigned long)data_ptr - 
+        offset = ((unsigned long)(le->data_ptr) - (unsigned long)data_start) +
+            (unsigned long)data_ptr -
             (unsigned long)ptr - 8;
         if (offset < 0) {
             fprintf(stderr, "Negative constant pool offset\n");
diff --git a/elf.h b/elf.h
index 1825d50e82a20cef8bad0511ae3fb355c884832e..5c49599bb37017d045cfc68522752350ea28393e 100644 (file)
--- a/elf.h
+++ b/elf.h
@@ -1042,7 +1042,7 @@ typedef struct elf64_phdr {
 #define SHN_COMMON     0xfff2
 #define SHN_HIRESERVE  0xffff
 #define SHN_MIPS_ACCOMON       0xff00
+
 typedef struct elf32_shdr {
   Elf32_Word   sh_name;
   Elf32_Word   sh_type;
index abcce093ef868fb93c4220ac922e510f58dedd52..d8ff2185bc1e7ebc4f4a43f0bd01d038972df0fc 100644 (file)
--- a/elf_ops.h
+++ b/elf_ops.h
@@ -49,7 +49,7 @@ static void glue(bswap_sym, SZ)(struct elf_sym *sym)
     bswap16s(&sym->st_shndx);
 }
 
-static struct elf_shdr *glue(find_section, SZ)(struct elf_shdr *shdr_table, 
+static struct elf_shdr *glue(find_section, SZ)(struct elf_shdr *shdr_table,
                                                int n, int type)
 {
     int i;
@@ -71,17 +71,17 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab)
     int nsyms, i;
     char *str = NULL;
 
-    shdr_table = load_at(fd, ehdr->e_shoff, 
+    shdr_table = load_at(fd, ehdr->e_shoff,
                          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;
@@ -174,7 +174,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];
index 82ef3acdca33a25035181e22b82a8ab6312d55e1..ce957c04dce894a298c262f4d8306e851438451a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * internal execution defines for qemu
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -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);
@@ -83,27 +83,27 @@ int gen_intermediate_code_pc(CPUState *env, struct TranslationBlock *tb);
 void dump_ops(const uint16_t *opc_buf, const uint32_t *opparam_buf);
 int cpu_gen_code(CPUState *env, struct TranslationBlock *tb,
                  int max_code_size, int *gen_code_size_ptr);
-int cpu_restore_state(struct TranslationBlock *tb, 
+int cpu_restore_state(struct TranslationBlock *tb,
                       CPUState *env, unsigned long searched_pc,
                       void *puc);
 int cpu_gen_code_copy(CPUState *env, struct TranslationBlock *tb,
                       int max_code_size, int *gen_code_size_ptr);
-int cpu_restore_state_copy(struct TranslationBlock *tb, 
+int cpu_restore_state_copy(struct TranslationBlock *tb,
                            CPUState *env, unsigned long searched_pc,
                            void *puc);
 void cpu_resume_from_signal(CPUState *env1, void *puc);
 void cpu_exec_init(CPUState *env);
 int page_unprotect(target_ulong address, unsigned long pc, void *puc);
-void tb_invalidate_phys_page_range(target_ulong start, target_ulong end, 
+void tb_invalidate_phys_page_range(target_ulong start, target_ulong end,
                                    int is_cpu_write_access);
 void tb_invalidate_page_range(target_ulong start, target_ulong end);
 void tlb_flush_page(CPUState *env, target_ulong addr);
 void tlb_flush(CPUState *env, int flush_global);
-int tlb_set_page_exec(CPUState *env, target_ulong vaddr, 
-                      target_phys_addr_t paddr, int prot, 
+int tlb_set_page_exec(CPUState *env, target_ulong vaddr,
+                      target_phys_addr_t paddr, int prot,
                       int is_user, int is_softmmu);
-static inline int tlb_set_page(CPUState *env, target_ulong vaddr, 
-                               target_phys_addr_t paddr, int prot, 
+static inline int tlb_set_page(CPUState *env, target_ulong vaddr,
+                               target_phys_addr_t paddr, int prot,
                                int is_user, int is_softmmu)
 {
     if (prot & PAGE_READ)
@@ -153,7 +153,7 @@ static inline int tlb_set_page(CPUState *env, target_ulong vaddr,
 
 #define CODE_GEN_MAX_BLOCKS    (CODE_GEN_BUFFER_SIZE / CODE_GEN_AVG_BLOCK_SIZE)
 
-#if defined(__powerpc__) 
+#if defined(__powerpc__)
 #define USE_DIRECT_JUMP
 #endif
 #if defined(__i386__) && !defined(_WIN32)
@@ -174,11 +174,11 @@ typedef struct TranslationBlock {
 
     uint8_t *tc_ptr;    /* pointer to the translated code */
     /* next matching tb for physical address. */
-    struct TranslationBlock *phys_hash_next; 
+    struct TranslationBlock *phys_hash_next;
     /* first and second physical page containing code. The lower bit
        of the pointer tells the index in page_next[] */
-    struct TranslationBlock *page_next[2]; 
-    target_ulong page_addr[2]; 
+    struct TranslationBlock *page_next[2];
+    target_ulong page_addr[2];
 
     /* the following data are used to directly call another TB from
        the code of this one. */
@@ -192,7 +192,7 @@ typedef struct TranslationBlock {
        the two least significant bits of the pointers to tell what is
        the next pointer: 0 = jmp_next[0], 1 = jmp_next[1], 2 =
        jmp_first */
-    struct TranslationBlock *jmp_next[2]; 
+    struct TranslationBlock *jmp_next[2];
     struct TranslationBlock *jmp_first;
 } TranslationBlock;
 
@@ -218,7 +218,7 @@ static inline unsigned int tb_phys_hash_func(unsigned long pc)
 
 TranslationBlock *tb_alloc(target_ulong pc);
 void tb_flush(CPUState *env);
-void tb_link_phys(TranslationBlock *tb, 
+void tb_link_phys(TranslationBlock *tb,
                   target_ulong phys_pc, target_ulong phys_page2);
 
 extern TranslationBlock *tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE];
@@ -254,7 +254,7 @@ static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr
 }
 #endif
 
-static inline void tb_set_jmp_target(TranslationBlock *tb, 
+static inline void tb_set_jmp_target(TranslationBlock *tb,
                                      int n, unsigned long addr)
 {
     unsigned long offset;
@@ -269,7 +269,7 @@ static inline void tb_set_jmp_target(TranslationBlock *tb,
 #else
 
 /* set the jump target */
-static inline void tb_set_jmp_target(TranslationBlock *tb, 
+static inline void tb_set_jmp_target(TranslationBlock *tb,
                                      int n, unsigned long addr)
 {
     tb->tb_next[n] = addr;
@@ -277,14 +277,14 @@ static inline void tb_set_jmp_target(TranslationBlock *tb,
 
 #endif
 
-static inline void tb_add_jump(TranslationBlock *tb, int n, 
+static inline void tb_add_jump(TranslationBlock *tb, int n,
                                TranslationBlock *tb_next)
 {
     /* NOTE: this test is only needed for thread safety */
     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));
@@ -379,7 +379,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)
@@ -392,7 +392,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)
     __asm__ __volatile__ ("0: cs    %0,%1,0(%2)\n"
                          "   jl    0b"
                          : "=&d" (ret)
-                         : "r" (1), "a" (p), "0" (*p) 
+                         : "r" (1), "a" (p), "0" (*p)
                          : "cc", "memory" );
     return ret;
 }
@@ -455,7 +455,7 @@ static inline int testandset (int *spinlock)
     __asm__ __volatile__("swp %0, %1, [%2]"
                          : "=r"(ret)
                          : "0"(1), "r"(spinlock));
-    
+
     return ret;
 }
 #endif
@@ -521,7 +521,7 @@ extern int tb_invalidated_flag;
 
 #if !defined(CONFIG_USER_ONLY)
 
-void tlb_fill(target_ulong addr, int is_write, int is_user, 
+void tlb_fill(target_ulong addr, int is_write, int is_user,
               void *retaddr);
 
 #define ACCESS_TYPE 3
@@ -575,7 +575,7 @@ static inline target_ulong get_phys_addr_code(CPUState *env, target_ulong addr)
 #else
 #error unimplemented CPU
 #endif
-    if (__builtin_expect(env->tlb_table[is_user][index].addr_code != 
+    if (__builtin_expect(env->tlb_table[is_user][index].addr_code !=
                          (addr & TARGET_PAGE_MASK), 0)) {
         ldub_code(addr);
     }
@@ -603,11 +603,11 @@ void kqemu_record_dump(void);
 static inline int kqemu_is_ok(CPUState *env)
 {
     return(env->kqemu_enabled &&
-           (env->cr[0] & CR0_PE_MASK) && 
+           (env->cr[0] & CR0_PE_MASK) &&
            !(env->hflags & HF_INHIBIT_IRQ_MASK) &&
            (env->eflags & IF_MASK) &&
            !(env->eflags & VM_MASK) &&
-           (env->kqemu_enabled == 2 || 
+           (env->kqemu_enabled == 2 ||
             ((env->hflags & HF_CPL_MASK) == 3 &&
              (env->eflags & IOPL_MASK) != IOPL_MASK)));
 }
diff --git a/exec.c b/exec.c
index 9133b8be5bb8352b7544748927b2b68a42b1ec64..ab9bae4f963861b8b0ce8334380adf3afb40cf51 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1,6 +1,6 @@
 /*
  *  virtual page mapping and translated block handling
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -44,8 +44,8 @@
 //#define DEBUG_UNASSIGNED
 
 /* make various TB consistency checks */
-//#define DEBUG_TB_CHECK 
-//#define DEBUG_TLB_CHECK 
+//#define DEBUG_TB_CHECK
+//#define DEBUG_TLB_CHECK
 
 #if !defined(CONFIG_USER_ONLY)
 /* TB consistency checks only implemented for usermode emulation.  */
@@ -86,7 +86,7 @@ uint8_t *phys_ram_dirty;
 CPUState *first_cpu;
 /* current CPU in the current thread. It is only valid inside
    cpu_exec() */
-CPUState *cpu_single_env; 
+CPUState *cpu_single_env;
 
 typedef struct PageDesc {
     /* list of TBs intersecting this ram page */
@@ -146,10 +146,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);
     }
@@ -160,12 +160,12 @@ 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, 
+
+        mprotect((void *)start, end - start,
                  PROT_READ | PROT_WRITE | PROT_EXEC);
     }
 #endif
@@ -251,7 +251,7 @@ static inline PhysPageDesc *phys_page_find(target_phys_addr_t index)
 
 #if !defined(CONFIG_USER_ONLY)
 static void tlb_protect_code(ram_addr_t ram_addr);
-static void tlb_unprotect_code_phys(CPUState *env, ram_addr_t ram_addr, 
+static void tlb_unprotect_code_phys(CPUState *env, ram_addr_t ram_addr,
                                     target_ulong vaddr);
 #endif
 
@@ -309,13 +309,13 @@ void tb_flush(CPUState *env1)
 {
     CPUState *env;
 #if defined(DEBUG_FLUSH)
-    printf("qemu: flush code_size=%d nb_tbs=%d avg_tb_size=%d\n", 
-           code_gen_ptr - code_gen_buffer, 
-           nb_tbs, 
+    printf("qemu: flush code_size=%d nb_tbs=%d avg_tb_size=%d\n",
+           code_gen_ptr - code_gen_buffer,
+           nb_tbs,
            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 *));
     }
@@ -352,7 +352,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);
@@ -461,11 +461,11 @@ 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);
-    tb_remove(&tb_phys_hash[h], tb, 
+    tb_remove(&tb_phys_hash[h], tb,
               offsetof(TranslationBlock, phys_hash_next));
 
     /* remove the TB from the page list */
@@ -541,7 +541,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;
@@ -570,7 +570,7 @@ static void build_page_bitmap(PageDesc *p)
 
 #ifdef TARGET_HAS_PRECISE_SMC
 
-static void tb_gen_code(CPUState *env, 
+static void tb_gen_code(CPUState *env,
                         target_ulong pc, target_ulong cs_base, int flags,
                         int cflags)
 {
@@ -594,7 +594,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;
@@ -604,13 +604,13 @@ 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
    from a real cpu write access: the virtual CPU will exit the current
    TB if code is modified inside this TB. */
-void tb_invalidate_phys_page_range(target_ulong start, target_ulong end, 
+void tb_invalidate_phys_page_range(target_ulong start, target_ulong end,
                                    int is_cpu_write_access)
 {
     int n, current_tb_modified, current_tb_not_found, current_flags;
@@ -621,9 +621,9 @@ void tb_invalidate_phys_page_range(target_ulong start, target_ulong end,
     target_ulong current_pc, current_cs_base;
 
     p = page_find(start >> TARGET_PAGE_BITS);
-    if (!p) 
+    if (!p)
         return;
-    if (!p->code_bitmap && 
+    if (!p->code_bitmap &&
         ++p->code_write_count >= SMC_BITMAP_USE_THRESHOLD &&
         is_cpu_write_access) {
         /* build code bitmap */
@@ -670,9 +670,9 @@ 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, 
+                cpu_restore_state(current_tb, env,
                                   env->mem_write_pc, NULL);
 #if defined(TARGET_I386)
                 current_flags = env->hflags;
@@ -715,7 +715,7 @@ void tb_invalidate_phys_page_range(target_ulong start, target_ulong end,
            modifying the memory. It will ensure that it cannot modify
            itself */
         env->current_tb = NULL;
-        tb_gen_code(env, current_pc, current_cs_base, current_flags, 
+        tb_gen_code(env, current_pc, current_cs_base, current_flags,
                     CF_SINGLE_INSN);
         cpu_resume_from_signal(env, NULL);
     }
@@ -730,15 +730,15 @@ static inline void tb_invalidate_phys_page_fast(target_ulong start, int len)
 #if 0
     if (1) {
         if (loglevel) {
-            fprintf(logfile, "modifying code at 0x%x size=%d EIP=%x PC=%08x\n", 
-                   cpu_single_env->mem_write_vaddr, len, 
-                   cpu_single_env->eip, 
+            fprintf(logfile, "modifying code at 0x%x size=%d EIP=%x PC=%08x\n",
+                   cpu_single_env->mem_write_vaddr, len,
+                   cpu_single_env->eip,
                    cpu_single_env->eip + (long)cpu_single_env->segs[R_CS].base);
         }
     }
 #endif
     p = page_find(start >> TARGET_PAGE_BITS);
-    if (!p) 
+    if (!p)
         return;
     if (p->code_bitmap) {
         offset = start & ~TARGET_PAGE_MASK;
@@ -752,7 +752,7 @@ static inline void tb_invalidate_phys_page_fast(target_ulong start, int len)
 }
 
 #if !defined(CONFIG_SOFTMMU)
-static void tb_invalidate_phys_page(target_ulong addr, 
+static void tb_invalidate_phys_page(target_ulong addr,
                                     unsigned long pc, void *puc)
 {
     int n, current_flags, current_tb_modified;
@@ -765,7 +765,7 @@ static void tb_invalidate_phys_page(target_ulong addr,
 
     addr &= TARGET_PAGE_MASK;
     p = page_find(addr >> TARGET_PAGE_BITS);
-    if (!p) 
+    if (!p)
         return;
     tb = p->first_tb;
     current_tb_modified = 0;
@@ -789,7 +789,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)
@@ -812,7 +812,7 @@ static void tb_invalidate_phys_page(target_ulong addr,
            modifying the memory. It will ensure that it cannot modify
            itself */
         env->current_tb = NULL;
-        tb_gen_code(env, current_pc, current_cs_base, current_flags, 
+        tb_gen_code(env, current_pc, current_cs_base, current_flags,
                     CF_SINGLE_INSN);
         cpu_resume_from_signal(env, puc);
     }
@@ -821,7 +821,7 @@ static void tb_invalidate_phys_page(target_ulong addr,
 #endif
 
 /* add the tb in the target page and protect it if necessary */
-static inline void tb_alloc_page(TranslationBlock *tb, 
+static inline void tb_alloc_page(TranslationBlock *tb,
                                  unsigned int n, target_ulong page_addr)
 {
     PageDesc *p;
@@ -856,10 +856,10 @@ static inline void tb_alloc_page(TranslationBlock *tb,
             p2->flags &= ~PAGE_WRITE;
             page_get_flags(addr);
           }
-        mprotect(g2h(page_addr), qemu_host_page_size, 
+        mprotect(g2h(page_addr), qemu_host_page_size,
                  (prot & PAGE_BITS) & ~PAGE_WRITE);
 #ifdef DEBUG_TB_INVALIDATE
-        printf("protecting code page: 0x%08lx\n", 
+        printf("protecting code page: 0x%08lx\n",
                page_addr);
 #endif
     }
@@ -881,7 +881,7 @@ TranslationBlock *tb_alloc(target_ulong pc)
 {
     TranslationBlock *tb;
 
-    if (nb_tbs >= CODE_GEN_MAX_BLOCKS || 
+    if (nb_tbs >= CODE_GEN_MAX_BLOCKS ||
         (code_gen_ptr - code_gen_buffer) >= CODE_GEN_BUFFER_MAX_SIZE)
         return NULL;
     tb = &tbs[nb_tbs++];
@@ -892,7 +892,7 @@ TranslationBlock *tb_alloc(target_ulong pc)
 
 /* add a new TB and link it to the physical page tables. phys_page2 is
    (-1) to indicate that only one page contains the TB. */
-void tb_link_phys(TranslationBlock *tb, 
+void tb_link_phys(TranslationBlock *tb,
                   target_ulong phys_pc, target_ulong phys_page2)
 {
     unsigned int h;
@@ -958,7 +958,7 @@ TranslationBlock *tb_find_pc(unsigned long tc_ptr)
         } else {
             m_min = m + 1;
         }
-    } 
+    }
     return &tbs[m_max];
 }
 
@@ -994,7 +994,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);
 
@@ -1034,7 +1034,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;
@@ -1043,7 +1043,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
@@ -1137,11 +1137,11 @@ void cpu_reset_interrupt(CPUState *env, int mask)
 }
 
 CPULogItem cpu_log_items[] = {
-    { CPU_LOG_TB_OUT_ASM, "out_asm", 
+    { CPU_LOG_TB_OUT_ASM, "out_asm",
       "show generated host assembly code for each compiled TB" },
     { CPU_LOG_TB_IN_ASM, "in_asm",
       "show target assembly code for each compiled TB" },
-    { CPU_LOG_TB_OP, "op", 
+    { CPU_LOG_TB_OP, "op",
       "show micro ops for each compiled TB (only usable if 'in_asm' used)" },
 #ifdef TARGET_I386
     { CPU_LOG_TB_OP_OPT, "op_opt",
@@ -1170,7 +1170,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)
 {
@@ -1260,11 +1260,11 @@ void tlb_flush(CPUState *env, int flush_global)
 
 static inline void tlb_flush_entry(CPUTLBEntry *tlb_entry, target_ulong addr)
 {
-    if (addr == (tlb_entry->addr_read & 
+    if (addr == (tlb_entry->addr_read &
                  (TARGET_PAGE_MASK | TLB_INVALID_MASK)) ||
-        addr == (tlb_entry->addr_write & 
+        addr == (tlb_entry->addr_write &
                  (TARGET_PAGE_MASK | TLB_INVALID_MASK)) ||
-        addr == (tlb_entry->addr_code & 
+        addr == (tlb_entry->addr_code &
                  (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
         tlb_entry->addr_read = -1;
         tlb_entry->addr_write = -1;
@@ -1312,20 +1312,20 @@ void tlb_flush_page(CPUState *env, target_ulong addr)
    can be detected */
 static void tlb_protect_code(ram_addr_t ram_addr)
 {
-    cpu_physical_memory_reset_dirty(ram_addr, 
+    cpu_physical_memory_reset_dirty(ram_addr,
                                     ram_addr + TARGET_PAGE_SIZE,
                                     CODE_DIRTY_FLAG);
 }
 
 /* update the TLB so that writes in physical page 'phys_addr' are no longer
    tested for self modifying code */
-static void tlb_unprotect_code_phys(CPUState *env, ram_addr_t ram_addr, 
+static void tlb_unprotect_code_phys(CPUState *env, ram_addr_t ram_addr,
                                     target_ulong vaddr)
 {
     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] |= CODE_DIRTY_FLAG;
 }
 
-static inline void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, 
+static inline void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry,
                                          unsigned long start, unsigned long length)
 {
     unsigned long addr;
@@ -1395,7 +1395,7 @@ void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end,
                         p->phys_addr >= start && p->phys_addr < end &&
                         (p->prot & PROT_WRITE)) {
                         if (addr < MMAP_AREA_END) {
-                            mprotect((void *)addr, TARGET_PAGE_SIZE, 
+                            mprotect((void *)addr, TARGET_PAGE_SIZE,
                                      p->prot & ~PROT_WRITE);
                         }
                     }
@@ -1413,7 +1413,7 @@ static inline void tlb_update_dirty(CPUTLBEntry *tlb_entry)
     ram_addr_t ram_addr;
 
     if ((tlb_entry->addr_write & ~TARGET_PAGE_MASK) == IO_MEM_RAM) {
-        ram_addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) + 
+        ram_addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) +
             tlb_entry->addend - (unsigned long)phys_ram_base;
         if (!cpu_physical_memory_is_dirty(ram_addr)) {
             tlb_entry->addr_write |= IO_MEM_NOTDIRTY;
@@ -1431,7 +1431,7 @@ void cpu_tlb_update_dirty(CPUState *env)
         tlb_update_dirty(&env->tlb_table[1][i]);
 }
 
-static inline void tlb_set_dirty1(CPUTLBEntry *tlb_entry, 
+static inline void tlb_set_dirty1(CPUTLBEntry *tlb_entry,
                                   unsigned long start)
 {
     unsigned long addr;
@@ -1460,8 +1460,8 @@ static inline void tlb_set_dirty(CPUState *env,
    is permitted. Return 0 if OK or 2 if the page could not be mapped
    (can only happen in non SOFTMMU mode for I/O pages or pages
    conflicting with the host address space). */
-int tlb_set_page_exec(CPUState *env, target_ulong vaddr, 
-                      target_phys_addr_t paddr, int prot, 
+int tlb_set_page_exec(CPUState *env, target_ulong vaddr,
+                      target_phys_addr_t paddr, int prot,
                       int is_user, int is_softmmu)
 {
     PhysPageDesc *p;
@@ -1485,7 +1485,7 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr,
 
     ret = 0;
 #if !defined(CONFIG_SOFTMMU)
-    if (is_softmmu) 
+    if (is_softmmu)
 #endif
     {
         if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && !(pd & IO_MEM_ROMD)) {
@@ -1497,7 +1497,7 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr,
             address = vaddr;
             addend = (unsigned long)phys_ram_base + (pd & TARGET_PAGE_MASK);
         }
-        
+
         index = (vaddr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
         addend -= vaddr;
         te = &env->tlb_table[is_user][index];
@@ -1513,12 +1513,12 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr,
             te->addr_code = -1;
         }
         if (prot & PAGE_WRITE) {
-            if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_ROM || 
+            if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_ROM ||
                 (pd & IO_MEM_ROMD)) {
                 /* write access calls the I/O callback */
-                te->addr_write = vaddr | 
+                te->addr_write = vaddr |
                     (pd & ~(TARGET_PAGE_MASK | IO_MEM_ROMD));
-            } else if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_RAM && 
+            } else if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_RAM &&
                        !cpu_physical_memory_is_dirty(pd)) {
                 te->addr_write = vaddr | IO_MEM_NOTDIRTY;
             } else {
@@ -1542,17 +1542,17 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr,
                 ret = 2;
             } else {
                 if (prot & PROT_WRITE) {
-                    if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_ROM || 
+                    if ((pd & ~TARGET_PAGE_MASK) == IO_MEM_ROM ||
 #if defined(TARGET_HAS_SMC) || 1
                         first_tb ||
 #endif
-                        ((pd & ~TARGET_PAGE_MASK) == IO_MEM_RAM && 
+                        ((pd & ~TARGET_PAGE_MASK) == IO_MEM_RAM &&
                          !cpu_physical_memory_is_dirty(pd))) {
                         /* ROM: we do as if code was inside */
                         /* 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;
@@ -1560,7 +1560,7 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr,
                         prot &= ~PAGE_WRITE;
                     }
                 }
-                map_addr = mmap((void *)vaddr, TARGET_PAGE_SIZE, prot, 
+                map_addr = mmap((void *)vaddr, TARGET_PAGE_SIZE, prot,
                                 MAP_SHARED | MAP_FIXED, phys_ram_fd, (pd & TARGET_PAGE_MASK));
                 if (map_addr == MAP_FAILED) {
                     cpu_abort(env, "mmap failed when mapped physical address 0x%08x to virtual address 0x%08x\n",
@@ -1598,7 +1598,7 @@ int page_unprotect(target_ulong addr, unsigned long pc, void *puc)
     if (!(vp->prot & PAGE_WRITE))
         return 0;
 #if defined(DEBUG_TLB)
-    printf("page_unprotect: addr=0x%08x phys_addr=0x%08x prot=%x\n", 
+    printf("page_unprotect: addr=0x%08x phys_addr=0x%08x prot=%x\n",
            addr, vp->phys_addr, vp->prot);
 #endif
     if (mprotect((void *)addr, TARGET_PAGE_SIZE, vp->prot) < 0)
@@ -1624,8 +1624,8 @@ void tlb_flush_page(CPUState *env, target_ulong addr)
 {
 }
 
-int tlb_set_page_exec(CPUState *env, target_ulong vaddr, 
-                      target_phys_addr_t paddr, int prot, 
+int tlb_set_page_exec(CPUState *env, target_ulong vaddr,
+                      target_phys_addr_t paddr, int prot,
                       int is_user, int is_softmmu)
 {
     return 0;
@@ -1657,7 +1657,7 @@ void page_dump(FILE *f)
                 end = (i << (32 - L1_BITS)) | (j << TARGET_PAGE_BITS);
                 if (start != -1) {
                     fprintf(f, "%08lx-%08lx %08lx %c%c%c\n",
-                            start, end, end - start, 
+                            start, end, end - start,
                             prot & PAGE_READ ? 'r' : '-',
                             prot & PAGE_WRITE ? 'w' : '-',
                             prot & PAGE_EXEC ? 'x' : '-');
@@ -1701,7 +1701,7 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
         p = page_find_alloc(addr >> TARGET_PAGE_BITS);
         /* if the write protection is set, then we invalidate the code
            inside */
-        if (!(p->flags & PAGE_WRITE) && 
+        if (!(p->flags & PAGE_WRITE) &&
             (flags & PAGE_WRITE) &&
             p->first_tb) {
             tb_invalidate_phys_page(addr, 0, NULL);
@@ -1736,7 +1736,7 @@ int page_unprotect(target_ulong address, unsigned long pc, void *puc)
     if (prot & PAGE_WRITE_ORG) {
         pindex = (address - host_start) >> TARGET_PAGE_BITS;
         if (!(p1[pindex].flags & PAGE_WRITE)) {
-            mprotect((void *)g2h(host_start), qemu_host_page_size, 
+            mprotect((void *)g2h(host_start), qemu_host_page_size,
                      (prot & PAGE_BITS) | PAGE_WRITE);
             p1[pindex].flags |= PAGE_WRITE;
             /* and since the content will be modified, we must invalidate
@@ -1775,7 +1775,7 @@ static inline void tlb_set_dirty(CPUState *env,
 /* register physical memory. 'size' must be a multiple of the target
    page size. If (phys_offset & ~TARGET_PAGE_MASK) != 0, then it is an
    io memory page */
-void cpu_register_physical_memory(target_phys_addr_t start_addr, 
+void cpu_register_physical_memory(target_phys_addr_t start_addr,
                                   unsigned long size,
                                   unsigned long phys_offset)
 {
@@ -1792,7 +1792,7 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr,
             (phys_offset & IO_MEM_ROMD))
             phys_offset += TARGET_PAGE_SIZE;
     }
-    
+
     /* since each CPU stores ram addresses in its TLB cache, we must
        reset the modified entries */
     /* XXX: slow ! */
@@ -1983,7 +1983,7 @@ CPUReadMemoryFunc **cpu_get_io_memory_read(int io_index)
 
 /* physical memory access (slow version, mainly for debug) */
 #if defined(CONFIG_USER_ONLY)
-void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, 
+void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
                             int len, int is_write)
 {
     int l, flags;
@@ -2018,7 +2018,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
 }
 
 #else
-void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, 
+void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
                             int len, int is_write)
 {
     int l, io_index;
@@ -2027,7 +2027,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;
@@ -2039,7 +2039,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);
@@ -2071,12 +2071,12 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
                     /* invalidate code */
                     tb_invalidate_phys_page_range(addr1, addr1 + l, 0);
                     /* set dirty bit */
-                    phys_ram_dirty[addr1 >> TARGET_PAGE_BITS] |= 
+                    phys_ram_dirty[addr1 >> TARGET_PAGE_BITS] |=
                         (0xff & ~CODE_DIRTY_FLAG);
                 }
             }
         } else {
-            if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && 
+            if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM &&
                 !(pd & IO_MEM_ROMD)) {
                 /* I/O case */
                 io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
@@ -2098,7 +2098,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
                 }
             } else {
                 /* RAM case */
-                ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 
+                ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) +
                     (addr & ~TARGET_PAGE_MASK);
                 memcpy(buf, ptr, l);
             }
@@ -2110,7 +2110,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
 }
 
 /* used for ROM loading : can write in RAM and ROM */
-void cpu_physical_memory_write_rom(target_phys_addr_t addr, 
+void cpu_physical_memory_write_rom(target_phys_addr_t addr,
                                    const uint8_t *buf, int len)
 {
     int l;
@@ -2118,7 +2118,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;
@@ -2130,7 +2130,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)) {
@@ -2164,15 +2164,15 @@ uint32_t ldl_phys(target_phys_addr_t addr)
     } else {
         pd = p->phys_offset;
     }
-        
-    if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && 
+
+    if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM &&
         !(pd & IO_MEM_ROMD)) {
         /* I/O case */
         io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
         val = io_mem_read[io_index][2](io_mem_opaque[io_index], addr);
     } else {
         /* RAM case */
-        ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 
+        ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) +
             (addr & ~TARGET_PAGE_MASK);
         val = ldl_p(ptr);
     }
@@ -2194,7 +2194,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 */
@@ -2208,7 +2208,7 @@ uint64_t ldq_phys(target_phys_addr_t addr)
 #endif
     } else {
         /* RAM case */
-        ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 
+        ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) +
             (addr & ~TARGET_PAGE_MASK);
         val = ldq_p(ptr);
     }
@@ -2247,12 +2247,12 @@ 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);
     } else {
-        ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) + 
+        ptr = phys_ram_base + (pd & TARGET_PAGE_MASK) +
             (addr & ~TARGET_PAGE_MASK);
         stl_p(ptr, val);
     }
@@ -2272,7 +2272,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);
@@ -2316,7 +2316,7 @@ void stq_phys(target_phys_addr_t addr, uint64_t val)
 #endif
 
 /* virtual memory access for debug */
-int cpu_memory_rw_debug(CPUState *env, target_ulong addr, 
+int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
                         uint8_t *buf, int len, int is_write)
 {
     int l;
@@ -2331,7 +2331,7 @@ int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
         l = (page + TARGET_PAGE_SIZE) - addr;
         if (l > len)
             l = len;
-        cpu_physical_memory_rw(phys_addr + (addr & ~TARGET_PAGE_MASK), 
+        cpu_physical_memory_rw(phys_addr + (addr & ~TARGET_PAGE_MASK),
                                buf, l, is_write);
         len -= l;
         buf += l;
@@ -2346,7 +2346,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;
@@ -2368,17 +2368,17 @@ void dump_exec_info(FILE *f,
     }
     /* XXX: avoid using doubles ? */
     cpu_fprintf(f, "TB count            %d\n", nb_tbs);
-    cpu_fprintf(f, "TB avg target size  %d max=%d bytes\n", 
+    cpu_fprintf(f, "TB avg target size  %d max=%d bytes\n",
                 nb_tbs ? target_code_size / nb_tbs : 0,
                 max_target_code_size);
-    cpu_fprintf(f, "TB avg host size    %d bytes (expansion ratio: %0.1f)\n", 
+    cpu_fprintf(f, "TB avg host size    %d bytes (expansion ratio: %0.1f)\n",
                 nb_tbs ? (code_gen_ptr - code_gen_buffer) / nb_tbs : 0,
                 target_code_size ? (double) (code_gen_ptr - code_gen_buffer) / target_code_size : 0);
-    cpu_fprintf(f, "cross page TB count %d (%d%%)\n", 
-            cross_page, 
+    cpu_fprintf(f, "cross page TB count %d (%d%%)\n",
+            cross_page,
             nb_tbs ? (cross_page * 100) / nb_tbs : 0);
     cpu_fprintf(f, "direct jump count   %d (%d%%) (2 jumps=%d %d%%)\n",
-                direct_jmp_count, 
+                direct_jmp_count,
                 nb_tbs ? (direct_jmp_count * 100) / nb_tbs : 0,
                 direct_jmp2_count,
                 nb_tbs ? (direct_jmp2_count * 100) / nb_tbs : 0);
@@ -2387,7 +2387,7 @@ void dump_exec_info(FILE *f,
     cpu_fprintf(f, "TLB flush count     %d\n", tlb_flush_count);
 }
 
-#if !defined(CONFIG_USER_ONLY) 
+#if !defined(CONFIG_USER_ONLY)
 
 #define MMUSUFFIX _cmmu
 #define GETPC() NULL
index f20d5c45f67e18e74fcdbba21b957a0855415135..2596976be6aa72e477d55dd7a6d6e956bdbafbb4 100644 (file)
@@ -40,7 +40,7 @@ double qemu_rint(double x)
     double y = 4503599627370496.0;
     if (fabs(x) >= y)
         return x;
-    if (x < 0) 
+    if (x < 0)
         y = -y;
     y = (x + y) - y;
     if (y == 0.0)
@@ -94,7 +94,7 @@ static inline int long_to_int32(long a)
 #else
 static inline int long_to_int32(long a)
 {
-    if (a != (int32_t)a) 
+    if (a != (int32_t)a)
         a = 0x80000000;
     return a;
 }
index aeddc34745419ff3c482abbcf0443a7c94ab9ad3..aaf5ce582ec0d3ee791eb5b32dcd42c3783c5eac 100644 (file)
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1,6 +1,6 @@
 /*
  * gdb server stub
- * 
+ *
  * Copyright (c) 2003-2005 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -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(&registers[i]);
     for(i = 36; i < 44; i++)
@@ -530,7 +530,7 @@ static void cpu_gdb_write_registers(CPUState *env, uint8_t *mem_buf, int size)
     /* F0-F7.  The 68881/68040 have 12-bit extended precision registers.
        ColdFire has 8-bit double precision registers.  */
     for (i = 0; i < 8; i++) {
-        u.l.upper = tswap32(*(uint32_t *)ptr); 
+        u.l.upper = tswap32(*(uint32_t *)ptr);
         u.l.lower = tswap32(*(uint32_t *)ptr);
         env->fregs[i] = u.d;
     }
@@ -720,7 +720,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
@@ -1009,7 +1009,7 @@ static void gdb_read_byte(GDBState *s, int ch)
         /* when the CPU is running, we cannot do anything except stop
            it when receiving a char */
         vm_stop(EXCP_INTERRUPT);
-    } else 
+    } else
 #endif
     {
         switch(s->state) {
@@ -1137,7 +1137,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 */
@@ -1243,7 +1243,7 @@ int gdbserver_start_port(int port)
     snprintf(gdbstub_port_name, sizeof(gdbstub_port_name),
              "tcp::%d,nowait,nodelay,server", port);
     chr = qemu_chr_open(gdbstub_port_name);
-    if (!chr) 
+    if (!chr)
         return -EIO;
     return gdbserver_start(chr);
 }
index 78c4feabbf7fcf6472d3463fff590a3afe3d54f2..2a2662236d8c4efae33f0948326a62d9163f6b8a 100644 (file)
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -1,8 +1,8 @@
 /*
  * ACPI implementation
- * 
+ *
  * Copyright (c) 2006 Fabrice Bellard
- * 
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License version 2 as published by the Free Software Foundation.
@@ -88,9 +88,9 @@ static void pm_update_sci(PIIX4PMState *s)
 {
     int sci_level, pmsts;
     int64_t expire_time;
-    
+
     pmsts = get_pmsts(s);
-    sci_level = (((pmsts & s->pmen) & 
+    sci_level = (((pmsts & s->pmen) &
                   (RTC_EN | PWRBTN_EN | GBL_EN | TMROF_EN)) != 0);
     pci_set_irq(&s->dev, 0, sci_level);
     /* schedule a timer interruption if needed */
@@ -232,7 +232,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;
@@ -421,7 +421,7 @@ static void pm_io_space_update(PIIX4PMState *s)
     }
 }
 
-static void pm_write_config(PCIDevice *d, 
+static void pm_write_config(PCIDevice *d,
                             uint32_t address, uint32_t val, int len)
 {
     pci_default_write_config(d, address, val, len);
@@ -489,9 +489,9 @@ void piix4_pm_init(PCIBus *bus, int devfn)
     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);
 
index 3f664a9c5e1a10c5560ef5363d622c5c9cbc9c04..1e43792b5a3ed718e47333b46459d712be032a0d 100644 (file)
--- a/hw/adb.c
+++ b/hw/adb.c
@@ -1,8 +1,8 @@
 /*
  * QEMU ADB support
- * 
+ *
  * Copyright (c) 2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -96,9 +96,9 @@ int adb_poll(ADBBusState *s, uint8_t *obuf)
     return olen;
 }
 
-ADBDevice *adb_register_device(ADBBusState *s, int devaddr, 
-                               ADBDeviceRequest *devreq, 
-                               ADBDeviceReset *devreset, 
+ADBDevice *adb_register_device(ADBBusState *s, int devaddr,
+                               ADBDeviceRequest *devreq,
+                               ADBDeviceReset *devreset,
                                void *opaque)
 {
     ADBDevice *d;
@@ -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;
index a5fe9b989e6badd9704b52b5efc5f11905d69183..afbcde05df4902639e924213677a6382b435c42b 100644 (file)
@@ -2,7 +2,7 @@
  * QEMU Ultrasparc APB PCI host
  *
  * Copyright (c) 2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -233,7 +233,7 @@ PCIBus *pci_apb_init(target_ulong special_base, target_ulong mem_base,
     cpu_register_physical_memory(special_base + 0x2000000ULL, 0x10000, pci_ioport);
     cpu_register_physical_memory(mem_base, 0x10000000, pci_mem_data); // XXX size should be 4G-prom
 
-    d = pci_register_device(s->bus, "Advanced PCI Bus", sizeof(PCIDevice), 
+    d = pci_register_device(s->bus, "Advanced PCI Bus", sizeof(PCIDevice),
                             0, NULL, NULL);
     d->config[0x00] = 0x8e; // vendor_id : Sun
     d->config[0x01] = 0x10;
index 8c9776195e4ce4c98cf72c5bd3d1af3542b84e06..5d51e901cf3910378662073d4dabbe65fa055f68 100644 (file)
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -1,6 +1,6 @@
 /*
  *  APIC support
- * 
+ *
  *  Copyright (c) 2004-2005 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -182,7 +182,7 @@ static inline void reset_bit(uint32_t *tab, int index)
     }\
 }
 
-static void apic_bus_deliver(const uint32_t *deliver_bitmask, 
+static void apic_bus_deliver(const uint32_t *deliver_bitmask,
                              uint8_t delivery_mode,
                              uint8_t vector_num, uint8_t polarity,
                              uint8_t trigger_mode)
@@ -219,10 +219,10 @@ static void apic_bus_deliver(const uint32_t *deliver_bitmask,
 
         case APIC_DM_INIT:
             /* normal INIT IPI sent to processors */
-            foreach_apic(apic_iter, 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;
@@ -231,7 +231,7 @@ static void apic_bus_deliver(const uint32_t *deliver_bitmask,
             return;
     }
 
-    foreach_apic(apic_iter, deliver_bitmask, 
+    foreach_apic(apic_iter, deliver_bitmask,
                  apic_set_irq(apic_iter, vector_num, trigger_mode) );
 }
 
@@ -241,7 +241,7 @@ void cpu_set_apic_base(CPUState *env, uint64_t val)
 #ifdef DEBUG_APIC
     printf("cpu_set_apic_base: %016" PRIx64 "\n", val);
 #endif
-    s->apicbase = (val & 0xfffff000) | 
+    s->apicbase = (val & 0xfffff000) |
         (s->apicbase & (MSR_IA32_APICBASE_BSP | MSR_IA32_APICBASE_ENABLE));
     /* if disabled, cannot be enabled again */
     if (!(val & MSR_IA32_APICBASE_ENABLE)) {
@@ -407,7 +407,7 @@ static void apic_startup(APICState *s, int vector_num)
     if (!(env->hflags & HF_HALTED_MASK))
         return;
     env->eip = 0;
-    cpu_x86_load_seg_cache(env, R_CS, vector_num << 8, vector_num << 12, 
+    cpu_x86_load_seg_cache(env, R_CS, vector_num << 8, vector_num << 12,
                            0xffff, 0);
     env->hflags &= ~HF_HALTED_MASK;
 }
@@ -443,7 +443,7 @@ static void apic_deliver(APICState *s, uint8_t dest, uint8_t dest_mode,
                 int trig_mode = (s->icr[0] >> 15) & 1;
                 int level = (s->icr[0] >> 14) & 1;
                 if (level == 0 && trig_mode == 1) {
-                    foreach_apic(apic_iter, deliver_bitmask, 
+                    foreach_apic(apic_iter, deliver_bitmask,
                                  apic_iter->arb_id = apic_iter->id );
                     return;
                 }
@@ -451,7 +451,7 @@ static void apic_deliver(APICState *s, uint8_t dest, uint8_t dest_mode,
             break;
 
         case APIC_DM_SIPI:
-            foreach_apic(apic_iter, deliver_bitmask, 
+            foreach_apic(apic_iter, deliver_bitmask,
                          apic_startup(apic_iter, vector_num) );
             return;
     }
@@ -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)
@@ -488,7 +488,7 @@ static uint32_t apic_get_current_count(APICState *s)
 {
     int64_t d;
     uint32_t val;
-    d = (qemu_get_clock(vm_clock) - s->initial_count_load_time) >> 
+    d = (qemu_get_clock(vm_clock) - s->initial_count_load_time) >>
         s->count_shift;
     if (s->lvt[APIC_LVT_TIMER] & APIC_LVT_TIMER_PERIODIC) {
         /* periodic */
@@ -505,9 +505,9 @@ 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) >> 
+        d = (current_time - s->initial_count_load_time) >>
             s->count_shift;
         if (s->lvt[APIC_LVT_TIMER] & APIC_LVT_TIMER_PERIODIC) {
             d = ((d / ((uint64_t)s->initial_count + 1)) + 1) * ((uint64_t)s->initial_count + 1);
@@ -817,14 +817,14 @@ int apic_init(CPUState *env)
     apic_init_ipi(s);
     s->id = last_apic_id++;
     s->cpu_env = env;
-    s->apicbase = 0xfee00000 | 
+    s->apicbase = 0xfee00000 |
         (s->id ? 0 : MSR_IA32_APICBASE_BSP) | MSR_IA32_APICBASE_ENABLE;
 
     /* XXX: mapping more APICs at the same memory location */
     if (apic_io_memory == 0) {
         /* NOTE: the APIC is directly connected to the CPU - it is not
            on the global memory bus. */
-        apic_io_memory = cpu_register_io_memory(0, apic_mem_read, 
+        apic_io_memory = cpu_register_io_memory(0, apic_mem_read,
                                                 apic_mem_write, NULL);
         cpu_register_physical_memory(s->apicbase & ~0xfff, 0x1000,
                                      apic_io_memory);
@@ -833,7 +833,7 @@ int apic_init(CPUState *env)
 
     register_savevm("apic", 0, 2, apic_save, apic_load, s);
     qemu_register_reset(apic_reset, s);
-    
+
     local_apics[s->id] = s;
     return 0;
 }
@@ -867,9 +867,9 @@ 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, 
+                apic_bus_deliver(deliver_bitmask, delivery_mode,
                                  vector, polarity, trig_mode);
             }
         }
@@ -1035,12 +1035,12 @@ IOAPICState *ioapic_init(void)
     ioapic_reset(s);
     s->id = last_apic_id++;
 
-    io_memory = cpu_register_io_memory(0, ioapic_mem_read, 
+    io_memory = cpu_register_io_memory(0, ioapic_mem_read,
                                        ioapic_mem_write, s);
     cpu_register_physical_memory(0xfec00000, 0x1000, io_memory);
 
     register_savevm("ioapic", 0, 1, ioapic_save, ioapic_load, s);
     qemu_register_reset(ioapic_reset, s);
-    
+
     return s;
 }
index 28f6a92622e1d159b785d9528d6e5ece50717fca..ed0736379ab0e6154d86c4baf76994abdd70bfb3 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * ARM kernel loader.
  *
  * Copyright (c) 2006 CodeSourcery.
index 2901f3466e7bae898cb7ba9a774e227fe5552a72..969612ad7c02b579ccf2c9c5bf341dd5a9d00e5a 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * ARM AMBA Generic/Distributed Interrupt Controller
  *
  * Copyright (c) 2006 CodeSourcery.
@@ -117,7 +117,7 @@ static void gic_set_irq(void *opaque, int irq, int level)
     gic_state *s = (gic_state *)opaque;
     /* The first external input line is internal interrupt 32.  */
     irq += 32;
-    if (level == GIC_TEST_LEVEL(irq)) 
+    if (level == GIC_TEST_LEVEL(irq))
         return;
 
     if (level) {
index fbc2d67d0a08ab1defb716679570bdc826cf5de5..89e3ba634a83a078b221767a5ee8ca74b5a30931 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Generic ARM Programmable Interrupt Controller support.
  *
  * Copyright (c) 2006 CodeSourcery.
@@ -65,7 +65,7 @@ static void arm_pic_cpu_handler(void *opaque, int irq, int level)
 void *arm_pic_init_cpu(CPUState *env)
 {
     arm_pic_cpu_state *s;
-    
+
     s = (arm_pic_cpu_state *)malloc(sizeof(arm_pic_cpu_state));
     s->handler = arm_pic_cpu_handler;
     s->cpu_env = env;
index b29914985af56f759a0e6d577ad94b2400a78d7d..17842af38877ae6a775cca90920a389257855f86 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Generic ARM Programmable Interrupt Controller support.
  *
  * Copyright (c) 2006 CodeSourcery.
index e9de998a2a73a397d96c1029ba6bf42249727644..7a7eb2f98d1725001084431534bfdd34db3b3dc6 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Status and system control registers for ARM RealView/Versatile boards.
  *
  * Copyright (c) 2006 CodeSourcery.
index c8864f13ce5f1d64925ce743814c9bfce57ac527..ae60470defec9833760542f8140b1ce9d0359c85 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * ARM PrimeCell Timer modules.
  *
  * Copyright (c) 2005-2006 CodeSourcery.
index a43b4179020b395b4b9c3f127d7c9a2a5a90004f..4f1fce18f391f9a8adf4e94e89409ae38d8efb76 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU ATAPI CD-ROM Emulator
- * 
+ *
  * Copyright (c) 2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -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 */
@@ -138,14 +138,14 @@ int cdrom_read_toc_raw(int nb_sectors, uint8_t *buf, int msf, int session_num)
     *q++ = 0; /* sec */
     *q++ = 0; /* frame */
     if (msf) {
-        *q++ = 0; 
+        *q++ = 0;
         lba_to_msf(q, 0);
         q += 3;
     } else {
-        *q++ = 0; 
-        *q++ = 0; 
-        *q++ = 0; 
-        *q++ = 0; 
+        *q++ = 0;
+        *q++ = 0;
+        *q++ = 0;
+        *q++ = 0;
     }
 
     len = q - buf;
index e568533d40e0fe3508322558d34707bef7b9a65d..bfb7a8c7a39b12892f4c115c30f0997af422cbf8 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * QEMU Cirrus CLGD 54xx VGA Emulator.
- * 
+ *
  * Copyright (c) 2004 Fabrice Bellard
  * Copyright (c) 2004 Makoto Suzuki (suzu)
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -280,7 +280,7 @@ typedef struct PCICirrusVGAState {
 } PCICirrusVGAState;
 
 static uint8_t rop_to_index[256];
-    
+
 void *shared_vram;
 
 /***************************************
@@ -598,7 +598,7 @@ static inline void cirrus_bitblt_fgcol(CirrusVGAState *s)
         s->cirrus_blt_fgcol = le16_to_cpu(color);
         break;
     case 3:
-        s->cirrus_blt_fgcol = s->cirrus_shadow_gr1 | 
+        s->cirrus_blt_fgcol = s->cirrus_shadow_gr1 |
             (s->gr[0x11] << 8) | (s->gr[0x13] << 16);
         break;
     default:
@@ -622,7 +622,7 @@ static inline void cirrus_bitblt_bgcol(CirrusVGAState *s)
         s->cirrus_blt_bgcol = le16_to_cpu(color);
         break;
     case 3:
-        s->cirrus_blt_bgcol = s->cirrus_shadow_gr0 | 
+        s->cirrus_blt_bgcol = s->cirrus_shadow_gr0 |
             (s->gr[0x10] << 8) | (s->gr[0x12] << 16);
         break;
     default:
@@ -662,7 +662,7 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState * s,
 
     dst = s->vram_ptr + s->cirrus_blt_dstaddr;
     (*s->cirrus_rop) (s, dst, src,
-                      s->cirrus_blt_dstpitch, 0, 
+                      s->cirrus_blt_dstpitch, 0,
                       s->cirrus_blt_width, s->cirrus_blt_height);
     cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,
                              s->cirrus_blt_dstpitch, s->cirrus_blt_width,
@@ -677,7 +677,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
     cirrus_fill_t rop_func;
 
     rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1];
-    rop_func(s, s->vram_ptr + s->cirrus_blt_dstaddr, 
+    rop_func(s, s->vram_ptr + s->cirrus_blt_dstaddr,
              s->cirrus_blt_dstpitch,
              s->cirrus_blt_width, s->cirrus_blt_height);
     cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,
@@ -696,7 +696,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
 static int cirrus_bitblt_videotovideo_patterncopy(CirrusVGAState * s)
 {
     return cirrus_bitblt_common_patterncopy(s,
-                                           s->vram_ptr + 
+                                           s->vram_ptr +
                                             (s->cirrus_blt_srcaddr & ~7));
 }
 
@@ -797,7 +797,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);
@@ -863,7 +863,7 @@ static int cirrus_bitblt_cputovideo(CirrusVGAState * s)
     } else {
        if (s->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) {
             w = s->cirrus_blt_width / s->cirrus_blt_pixelwidth;
-            if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY) 
+            if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY)
                 s->cirrus_blt_srcpitch = ((w + 31) >> 5);
             else
                 s->cirrus_blt_srcpitch = ((w + 7) >> 3);
@@ -922,7 +922,7 @@ static void cirrus_bitblt_start(CirrusVGAState * s)
 
 #ifdef DEBUG_BITBLT
     printf("rop=0x%02x mode=0x%02x modeext=0x%02x w=%d h=%d dpitch=%d spitch=%d daddr=0x%08x saddr=0x%08x writemask=0x%02x\n",
-           blt_rop, 
+           blt_rop,
            s->cirrus_blt_mode,
            s->cirrus_blt_modeext,
            s->cirrus_blt_width,
@@ -966,16 +966,16 @@ static void cirrus_bitblt_start(CirrusVGAState * s)
     }
 
     if ((s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_SOLIDFILL) &&
-        (s->cirrus_blt_mode & (CIRRUS_BLTMODE_MEMSYSDEST | 
+        (s->cirrus_blt_mode & (CIRRUS_BLTMODE_MEMSYSDEST |
                                CIRRUS_BLTMODE_TRANSPARENTCOMP |
-                               CIRRUS_BLTMODE_PATTERNCOPY | 
-                               CIRRUS_BLTMODE_COLOREXPAND)) == 
+                               CIRRUS_BLTMODE_PATTERNCOPY |
+                               CIRRUS_BLTMODE_COLOREXPAND)) ==
          (CIRRUS_BLTMODE_PATTERNCOPY | CIRRUS_BLTMODE_COLOREXPAND)) {
         cirrus_bitblt_fgcol(s);
         cirrus_bitblt_solidfill(s, blt_rop);
     } else {
-        if ((s->cirrus_blt_mode & (CIRRUS_BLTMODE_COLOREXPAND | 
-                                   CIRRUS_BLTMODE_PATTERNCOPY)) == 
+        if ((s->cirrus_blt_mode & (CIRRUS_BLTMODE_COLOREXPAND |
+                                   CIRRUS_BLTMODE_PATTERNCOPY)) ==
             CIRRUS_BLTMODE_COLOREXPAND) {
 
             if (s->cirrus_blt_mode & CIRRUS_BLTMODE_TRANSPARENTCOMP) {
@@ -1068,7 +1068,7 @@ static void cirrus_write_bitblt(CirrusVGAState * s, unsigned reg_value)
  *
  ***************************************/
 
-static void cirrus_get_offsets(VGAState *s1, 
+static void cirrus_get_offsets(VGAState *s1,
                                uint32_t *pline_offset,
                                uint32_t *pstart_addr,
                                uint32_t *pline_compare)
@@ -1088,7 +1088,7 @@ static void cirrus_get_offsets(VGAState *s1,
        | ((s->cr[0x1d] & 0x80) << 12);
     *pstart_addr = start_addr;
 
-    line_compare = s->cr[0x18] | 
+    line_compare = s->cr[0x18] |
         ((s->cr[0x07] & 0x10) << 4) |
         ((s->cr[0x09] & 0x40) << 3);
     *pline_compare = line_compare;
@@ -1157,10 +1157,10 @@ 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) | 
+    height = s->cr[0x12] |
+        ((s->cr[0x07] & 0x02) << 7) |
         ((s->cr[0x07] & 0x40) << 3);
     height = (height + 1);
     /* interlace support */
@@ -2056,7 +2056,7 @@ static uint32_t cirrus_vga_mem_readl(void *opaque, target_phys_addr_t addr)
     return v;
 }
 
-static void cirrus_vga_mem_writeb(void *opaque, target_phys_addr_t addr, 
+static void cirrus_vga_mem_writeb(void *opaque, target_phys_addr_t addr,
                                   uint32_t mem_value)
 {
     CirrusVGAState *s = opaque;
@@ -2167,7 +2167,7 @@ static CPUWriteMemoryFunc *cirrus_vga_mem_write[3] = {
 static inline void invalidate_cursor1(CirrusVGAState *s)
 {
     if (s->last_hw_cursor_size) {
-        vga_invalidate_scanlines((VGAState *)s, 
+        vga_invalidate_scanlines((VGAState *)s,
                                  s->last_hw_cursor_y + s->last_hw_cursor_y_start,
                                  s->last_hw_cursor_y + s->last_hw_cursor_y_end);
     }
@@ -2243,7 +2243,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;
@@ -2260,8 +2260,8 @@ 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)) 
+
+    if (!(s->sr[0x12] & CIRRUS_CURSOR_SHOW))
         return;
     /* fast test to see if the cursor intersects with the scan line */
     if (s->sr[0x12] & CIRRUS_CURSOR_LARGE) {
@@ -2272,7 +2272,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;
@@ -2302,11 +2302,11 @@ static void cirrus_cursor_draw_line(VGAState *s1, uint8_t *d1, int scr_y)
         x2 = s->last_scr_width;
     w = x2 - x1;
     palette = s->cirrus_hidden_palette;
-    color0 = s->rgb_to_pixel(c6_to_8(palette[0x0 * 3]), 
-                             c6_to_8(palette[0x0 * 3 + 1]), 
+    color0 = s->rgb_to_pixel(c6_to_8(palette[0x0 * 3]),
+                             c6_to_8(palette[0x0 * 3 + 1]),
                              c6_to_8(palette[0x0 * 3 + 2]));
-    color1 = s->rgb_to_pixel(c6_to_8(palette[0xf * 3]), 
-                             c6_to_8(palette[0xf * 3 + 1]), 
+    color1 = s->rgb_to_pixel(c6_to_8(palette[0xf * 3]),
+                             c6_to_8(palette[0xf * 3 + 1]),
                              c6_to_8(palette[0xf * 3 + 2]));
     bpp = ((s->ds->depth + 7) >> 3);
     d1 += x1 * bpp;
@@ -2341,7 +2341,7 @@ static uint32_t cirrus_linear_readb(void *opaque, target_phys_addr_t addr)
 
     addr &= s->cirrus_addr_mask;
 
-    if (((s->sr[0x17] & 0x44) == 0x44) && 
+    if (((s->sr[0x17] & 0x44) == 0x44) &&
         ((addr & s->linear_mmio_mask) == s->linear_mmio_mask)) {
        /* memory-mapped I/O */
        ret = cirrus_mmio_blt_read(s, addr & 0xff);
@@ -2399,8 +2399,8 @@ 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) && 
+
+    if (((s->sr[0x17] & 0x44) == 0x44) &&
         ((addr & s->linear_mmio_mask) ==  s->linear_mmio_mask)) {
        /* memory-mapped I/O */
        cirrus_mmio_blt_write(s, addr & 0xff, val);
@@ -2662,7 +2662,7 @@ static void *set_vram_mapping(unsigned long begin, unsigned long end)
     return vram_pointer;
 }
 
-static int unset_vram_mapping(unsigned long begin, unsigned long end, 
+static int unset_vram_mapping(unsigned long begin, unsigned long end,
                               void *mapping)
 {
     xen_pfn_t *extent_start = NULL;
@@ -2712,7 +2712,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)) {
             if (s->lfb_addr && s->lfb_end && !s->map_addr) {
@@ -2741,7 +2741,7 @@ static void cirrus_update_memory_access(CirrusVGAState *s)
                 old_vram = vga_update_vram((VGAState *)s, NULL, VGA_RAM_SIZE);
 
                 unset_vram_mapping(s->lfb_addr,
-                                   s->lfb_end, 
+                                   s->lfb_end,
                                    old_vram);
 
                 s->map_addr = s->map_end = 0;
@@ -3180,7 +3180,7 @@ static void cirrus_vga_save(QEMUFile *f, void *opaque)
     qemu_put_8s(f, &vga_acc);
     qemu_put_be64s(f, (uint64_t*)&s->lfb_addr);
     qemu_put_be64s(f, (uint64_t*)&s->lfb_end);
-    qemu_put_buffer(f, s->vram_ptr, VGA_RAM_SIZE); 
+    qemu_put_buffer(f, s->vram_ptr, VGA_RAM_SIZE);
 }
 
 static int cirrus_vga_load(QEMUFile *f, void *opaque, int version_id)
@@ -3235,7 +3235,7 @@ static int cirrus_vga_load(QEMUFile *f, void *opaque, int version_id)
     qemu_get_8s(f, &vga_acc);
     qemu_get_be64s(f, (uint64_t*)&s->lfb_addr);
     qemu_get_be64s(f, (uint64_t*)&s->lfb_end);
-    qemu_get_buffer(f, s->vram_ptr, VGA_RAM_SIZE); 
+    qemu_get_buffer(f, s->vram_ptr, VGA_RAM_SIZE);
     if (vga_acc){
         cirrus_restart_acc(s);
     }
@@ -3294,9 +3294,9 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci)
     register_ioport_read(0x3ba, 1, 1, vga_ioport_read, s);
     register_ioport_read(0x3da, 1, 1, vga_ioport_read, s);
 
-    vga_io_memory = cpu_register_io_memory(0, cirrus_vga_mem_read, 
+    vga_io_memory = cpu_register_io_memory(0, cirrus_vga_mem_read,
                                            cirrus_vga_mem_write, s);
-    cpu_register_physical_memory(isa_mem_base + 0x000a0000, 0x20000, 
+    cpu_register_physical_memory(isa_mem_base + 0x000a0000, 0x20000,
                                  vga_io_memory);
 
     s->sr[0x06] = 0x0f;
@@ -3318,7 +3318,7 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci)
     } else {
         s->sr[0x1F] = 0x22;            // MemClock
         s->sr[0x0F] = CIRRUS_MEMSIZE_2M;
-        if (is_pci) 
+        if (is_pci)
             s->sr[0x17] = CIRRUS_BUSTYPE_PCI;
         else
             s->sr[0x17] = CIRRUS_BUSTYPE_ISA;
@@ -3368,14 +3368,14 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci)
  *
  ***************************************/
 
-void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base, 
+void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
                          unsigned long vga_ram_offset, int vga_ram_size)
 {
     CirrusVGAState *s;
 
     s = qemu_mallocz(sizeof(CirrusVGAState));
-    
-    vga_common_init((VGAState *)s, 
+
+    vga_common_init((VGAState *)s,
                     ds, vga_ram_base, vga_ram_offset, vga_ram_size);
     cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0);
     /* XXX ISA-LFB support */
@@ -3415,19 +3415,19 @@ static void cirrus_pci_mmio_map(PCIDevice *d, int region_num,
                                 s->cirrus_mmio_io_addr);
 }
 
-void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, 
+void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
                          unsigned long vga_ram_offset, int vga_ram_size)
 {
     PCICirrusVGAState *d;
     uint8_t *pci_conf;
     CirrusVGAState *s;
     int device_id;
-    
+
     device_id = CIRRUS_ID_CLGD5446;
 
     /* setup PCI configuration registers */
-    d = (PCICirrusVGAState *)pci_register_device(bus, "Cirrus VGA", 
-                                                 sizeof(PCICirrusVGAState), 
+    d = (PCICirrusVGAState *)pci_register_device(bus, "Cirrus VGA",
+                                                 sizeof(PCICirrusVGAState),
                                                  -1, NULL, NULL);
     pci_conf = d->dev.config;
     pci_conf[0x00] = (uint8_t) (PCI_VENDOR_CIRRUS & 0xff);
@@ -3445,7 +3445,7 @@ void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
 
     /* setup VGA */
     s = &d->cirrus_vga;
-    vga_common_init((VGAState *)s, 
+    vga_common_init((VGAState *)s,
                     ds, vga_ram_base, vga_ram_offset, vga_ram_size);
     cirrus_init_common(s, device_id, 1);
     s->pci_dev = (PCIDevice *)d;
index d6d88b12d7c6dfa44be3bfefa3cb76cbeec61575..bcc3427b0b112b444a8aef71201f815b3b798f5e 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU Cirrus CLGD 54xx VGA Emulator.
- * 
+ *
  * Copyright (c) 2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
index 7775c683e8c048970024313ecb3c57bfa3096eb0..47bbf70c0d8c724ac84a26e92feb0ccf90749af6 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU Cirrus CLGD 54xx VGA Emulator.
- * 
+ *
  * Copyright (c) 2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
 #define PUTPIXEL()    ROP_OP(((uint32_t *)(dst_base + m(d)))[0], col)
 #else
 #error unsupported DEPTH
-#endif                
+#endif
 
 static void
 glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
      (CirrusVGAState * s, uint8_t * dst_,
-      const uint8_t * src_, 
-      int dstpitch, int srcpitch, 
+      const uint8_t * src_,
+      int dstpitch, int srcpitch,
       int bltwidth, int bltheight)
 {
     uint8_t *dst_base, *src_base;
@@ -100,8 +100,8 @@ glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
 static void
 glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
      (CirrusVGAState * s, uint8_t * dst_,
-      const uint8_t * src_, 
-      int dstpitch, int srcpitch, 
+      const uint8_t * src_,
+      int dstpitch, int srcpitch,
       int bltwidth, int bltheight)
 {
     uint8_t *dst_base, *src_base;
@@ -155,8 +155,8 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
 static void
 glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH)
      (CirrusVGAState * s, uint8_t * dst_,
-      const uint8_t * src_, 
-      int dstpitch, int srcpitch, 
+      const uint8_t * src_,
+      int dstpitch, int srcpitch,
       int bltwidth, int bltheight)
 {
     uint8_t *dst_base, *src_base;
@@ -197,8 +197,8 @@ glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH)
 static void
 glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH)
      (CirrusVGAState * s, uint8_t * dst_,
-      const uint8_t * src_, 
-      int dstpitch, int srcpitch, 
+      const uint8_t * src_,
+      int dstpitch, int srcpitch,
       int bltwidth, int bltheight)
 {
     uint8_t *dst_base, *src_base;
@@ -247,8 +247,8 @@ glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH)
 static void
 glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH)
      (CirrusVGAState * s, uint8_t * dst_,
-      const uint8_t * src_, 
-      int dstpitch, int srcpitch, 
+      const uint8_t * src_,
+      int dstpitch, int srcpitch,
       int bltwidth, int bltheight)
 {
     uint8_t *dst_base, *src_base;
@@ -284,10 +284,10 @@ glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH)
     }
 }
 
-static void 
+static void
 glue(glue(glue(cirrus_fill_, ROP_NAME), _),DEPTH)
      (CirrusVGAState *s,
-      uint8_t *dst_, int dst_pitch, 
+      uint8_t *dst_, int dst_pitch,
       int width, int height)
 {
     uint8_t *dst_base;
index 14b69340a4273815282cf624ed46483e18ae1639..3720b3110da8f93eaeaf7576561fe4050d00fd29 100644 (file)
--- a/hw/cuda.c
+++ b/hw/cuda.c
@@ -1,8 +1,8 @@
 /*
  * QEMU CUDA support
- * 
+ *
  * Copyright (c) 2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -94,7 +94,7 @@
 #define RTC_OFFSET                      2082844800
 
 typedef struct CUDATimer {
-    int index; 
+    int index;
     uint16_t latch;
     uint16_t counter_value; /* counter value at load time */
     int64_t load_time;
@@ -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;
@@ -137,9 +137,9 @@ static CUDAState cuda_state;
 ADBBusState adb_bus;
 
 static void cuda_update(CUDAState *s);
-static void cuda_receive_packet_from_host(CUDAState *s, 
+static void cuda_receive_packet_from_host(CUDAState *s,
                                           const uint8_t *data, int len);
-static void cuda_timer_update(CUDAState *s, CUDATimer *ti, 
+static void cuda_timer_update(CUDAState *s, CUDATimer *ti,
                               int64_t current_time);
 
 static void cuda_update_irq(CUDAState *s)
@@ -156,7 +156,7 @@ static unsigned int get_counter(CUDATimer *s)
     int64_t d;
     unsigned int counter;
 
-    d = muldiv64(qemu_get_clock(vm_clock) - s->load_time, 
+    d = muldiv64(qemu_get_clock(vm_clock) - s->load_time,
                  CUDA_TIMER_FREQ, ticks_per_sec);
     if (s->index == 0) {
         /* the timer goes down from latch to -1 (period of latch + 2) */
@@ -164,7 +164,7 @@ static unsigned int get_counter(CUDATimer *s)
             counter = (s->counter_value - d) & 0xffff;
         } else {
             counter = (d - (s->counter_value + 1)) % (s->latch + 2);
-            counter = (s->latch - counter) & 0xffff; 
+            counter = (s->latch - counter) & 0xffff;
         }
     } else {
         counter = (s->counter_value - d) & 0xffff;
@@ -189,16 +189,16 @@ static int64_t get_next_irq_time(CUDATimer *s, int64_t current_time)
     unsigned int counter;
 
     /* current counter value */
-    d = muldiv64(current_time - s->load_time, 
+    d = muldiv64(current_time - s->load_time,
                  CUDA_TIMER_FREQ, ticks_per_sec);
     /* the timer goes down from latch to -1 (period of latch + 2) */
     if (d <= (s->counter_value + 1)) {
         counter = (s->counter_value - d) & 0xffff;
     } else {
         counter = (d - (s->counter_value + 1)) % (s->latch + 2);
-        counter = (s->latch - counter) & 0xffff; 
+        counter = (s->latch - counter) & 0xffff;
     }
-    
+
     /* Note: we consider the irq is raised on 0 */
     if (counter == 0xffff) {
         next_time = d + s->latch + 1;
@@ -209,18 +209,18 @@ static int64_t get_next_irq_time(CUDATimer *s, int64_t current_time)
     }
 #if 0
 #ifdef DEBUG_CUDA
-    printf("latch=%d counter=%" PRId64 " delta_next=%" PRId64 "\n", 
+    printf("latch=%d counter=%" PRId64 " delta_next=%" PRId64 "\n",
            s->latch, d, next_time - d);
 #endif
 #endif
-    next_time = muldiv64(next_time, ticks_per_sec, CUDA_TIMER_FREQ) + 
+    next_time = muldiv64(next_time, ticks_per_sec, CUDA_TIMER_FREQ) +
         s->load_time;
     if (next_time <= current_time)
         next_time = current_time + 1;
     return next_time;
 }
 
-static void cuda_timer_update(CUDAState *s, CUDATimer *ti, 
+static void cuda_timer_update(CUDAState *s, CUDATimer *ti,
                               int64_t current_time)
 {
     if (!ti->timer)
@@ -298,7 +298,7 @@ static uint32_t cuda_readb(void *opaque, target_phys_addr_t addr)
         break;
     case 13:
         val = s->ifr;
-        if (s->ifr & s->ier) 
+        if (s->ifr & s->ier)
             val |= 0x80;
         break;
     case 14:
@@ -319,7 +319,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);
@@ -472,7 +472,7 @@ static void cuda_update(CUDAState *s)
     }
 }
 
-static void cuda_send_packet_to_host(CUDAState *s, 
+static void cuda_send_packet_to_host(CUDAState *s,
                                      const uint8_t *data, int len)
 {
 #ifdef DEBUG_CUDA_PACKET
@@ -504,12 +504,12 @@ static void cuda_adb_poll(void *opaque)
         obuf[1] = 0x40; /* polled data */
         cuda_send_packet_to_host(s, obuf, olen + 2);
     }
-    qemu_mod_timer(s->adb_poll_timer, 
-                   qemu_get_clock(vm_clock) + 
+    qemu_mod_timer(s->adb_poll_timer,
+                   qemu_get_clock(vm_clock) +
                    (ticks_per_sec / CUDA_ADB_POLL_FREQ));
 }
 
-static void cuda_receive_packet(CUDAState *s, 
+static void cuda_receive_packet(CUDAState *s,
                                 const uint8_t *data, int len)
 {
     uint8_t obuf[16];
@@ -521,8 +521,8 @@ static void cuda_receive_packet(CUDAState *s,
         if (autopoll != s->autopoll) {
             s->autopoll = autopoll;
             if (autopoll) {
-                qemu_mod_timer(s->adb_poll_timer, 
-                               qemu_get_clock(vm_clock) + 
+                qemu_mod_timer(s->adb_poll_timer,
+                               qemu_get_clock(vm_clock) +
                                (ticks_per_sec / CUDA_ADB_POLL_FREQ));
             } else {
                 qemu_del_timer(s->adb_poll_timer);
@@ -564,7 +564,7 @@ static void cuda_receive_packet(CUDAState *s,
     }
 }
 
-static void cuda_receive_packet_from_host(CUDAState *s, 
+static void cuda_receive_packet_from_host(CUDAState *s,
                                           const uint8_t *data, int len)
 {
 #ifdef DEBUG_CUDA_PACKET
index fea08d87836c7133de955acc003aa107b3371290..d2d303e62d8263ffdd51f0c641e3318e31da1141 100644 (file)
--- a/hw/esp.c
+++ b/hw/esp.c
@@ -1,8 +1,8 @@
 /*
  * QEMU ESP/NCR53C9x emulation
- * 
+ *
  * Copyright (c) 2005-2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -513,7 +513,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 != 2)
         return -EINVAL; // Cannot emulate 1
 
index 0012834f44e49d7d6c6770571dc48d8b182fd09c..ddf81fe0a0c14d3a104c1b9daabbfe2d08c602a3 100644 (file)
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1,8 +1,8 @@
 /*
  * QEMU Floppy disk emulator (Intel 82078)
- * 
+ *
  * Copyright (c) 2003 Jocelyn Mayer
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -217,7 +217,7 @@ static fd_format_t fd_formats[] = {
     { FDRIVE_DRV_120, FDRIVE_DISK_288,  9, 40, 0,  "180 kB 5\"1/4", },
     { FDRIVE_DRV_120, FDRIVE_DISK_288, 10, 41, 1,  "410 kB 5\"1/4", },
     { FDRIVE_DRV_120, FDRIVE_DISK_288, 10, 42, 1,  "420 kB 5\"1/4", },
-    /* 320 kB 5"1/4 floppy disks */ 
+    /* 320 kB 5"1/4 floppy disks */
     { FDRIVE_DRV_120, FDRIVE_DISK_288,  8, 40, 1,  "320 kB 5\"1/4", },
     { FDRIVE_DRV_120, FDRIVE_DISK_288,  8, 40, 0,  "160 kB 5\"1/4", },
     /* 360 kB must match 5"1/4 better than 3"1/2... */
@@ -467,7 +467,7 @@ static uint32_t fdctrl_read_mem (void *opaque, target_phys_addr_t reg)
     return fdctrl_read(opaque, reg);
 }
 
-static void fdctrl_write_mem (void *opaque, 
+static void fdctrl_write_mem (void *opaque,
                               target_phys_addr_t reg, uint32_t value)
 {
     fdctrl_write(opaque, reg, value);
@@ -485,7 +485,7 @@ static CPUWriteMemoryFunc *fdctrl_mem_write[3] = {
     fdctrl_write_mem,
 };
 
-fdctrl_t *fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped, 
+fdctrl_t *fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped,
                        uint32_t io_base,
                        BlockDriverState **fds)
 {
@@ -497,7 +497,7 @@ fdctrl_t *fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped,
     fdctrl = qemu_mallocz(sizeof(fdctrl_t));
     if (!fdctrl)
         return NULL;
-    fdctrl->result_timer = qemu_new_timer(vm_clock, 
+    fdctrl->result_timer = qemu_new_timer(vm_clock,
                                           fdctrl_result_timer, fdctrl);
 
     fdctrl->version = 0x90; /* Intel 82078 controller */
@@ -743,7 +743,7 @@ static void fdctrl_write_rate (fdctrl_t *fdctrl, uint32_t value)
 static int fdctrl_media_changed(fdrive_t *drv)
 {
     int ret;
-    if (!drv->bs) 
+    if (!drv->bs)
         return 0;
     ret = bdrv_media_changed(drv->bs);
     if (ret) {
@@ -1042,7 +1042,7 @@ static int fdctrl_transfer_handler (void *opaque, int nchan,
                cur_drv->sect = 1;
                if (FD_MULTI_TRACK(fdctrl->data_state)) {
                    if (cur_drv->head == 0 &&
-                       (cur_drv->flags & FDISK_DBL_SIDES) != 0) {      
+                       (cur_drv->flags & FDISK_DBL_SIDES) != 0) {
                         cur_drv->head = 1;
                     } else {
                         cur_drv->head = 0;
@@ -1633,7 +1633,7 @@ enqueue:
             FLOPPY_DPRINTF("treat READ_ID command\n");
             /* XXX: should set main status register to busy */
             cur_drv->head = (fdctrl->fifo[1] >> 2) & 1;
-            qemu_mod_timer(fdctrl->result_timer, 
+            qemu_mod_timer(fdctrl->result_timer,
                            qemu_get_clock(vm_clock) + (ticks_per_sec / 50));
             break;
         case 0x4C:
index 4004f9942fdb54b1842b42a72525783ed4d28b12..dc4d4d925d7216f36af9f271a63f141391eafca7 100644 (file)
@@ -2,7 +2,7 @@
  * QEMU Grackle (heathrow PPC) PCI host
  *
  * Copyright (c) 2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -95,13 +95,13 @@ PCIBus *pci_grackle_init(uint32_t base, void *pic)
     s->bus = pci_register_bus(pci_grackle_set_irq, pci_grackle_map_irq,
                               pic, 0, 0);
 
-    pci_mem_config = cpu_register_io_memory(0, pci_grackle_config_read, 
+    pci_mem_config = cpu_register_io_memory(0, pci_grackle_config_read,
                                             pci_grackle_config_write, s);
     pci_mem_data = cpu_register_io_memory(0, pci_grackle_read,
                                           pci_grackle_write, s);
     cpu_register_physical_memory(base, 0x1000, pci_mem_config);
     cpu_register_physical_memory(base + 0x00200000, 0x1000, pci_mem_data);
-    d = pci_register_device(s->bus, "Grackle host bridge", sizeof(PCIDevice), 
+    d = pci_register_device(s->bus, "Grackle host bridge", sizeof(PCIDevice),
                             0, NULL, NULL);
     d->config[0x00] = 0x57; // vendor_id
     d->config[0x01] = 0x10;
@@ -118,12 +118,12 @@ PCIBus *pci_grackle_init(uint32_t base, void *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, void *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
index ccb6a7c1a2b0fd2fc35c418fcdefbd36ff861c0c..1ce48019bc31d0e88ce20f26d9a7f0ceebac9fa5 100644 (file)
@@ -2,7 +2,7 @@
  * QEMU GT64120 PCI host
  *
  * Copyright (c) 2006,2007 Aurelien Jarno
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -226,7 +226,7 @@ typedef struct GT64120State {
 
 static void gt64120_pci_mapping(GT64120State *s)
 {
-    target_phys_addr_t start, length;             
+    target_phys_addr_t start, length;
 
     /* Update IO mapping */
     if ((s->regs[GT_PCI0IOLD] & 0x7f) <= s->regs[GT_PCI0IOHD])
@@ -388,7 +388,7 @@ static uint32_t gt64120_readl (void *opaque,
     case GT_CPUERR_DATAHI:
     case GT_CPUERR_PARITY:
         /* Emulated memory has no error, always return the initial
-           values */ 
+           values */
         val = s->regs[saddr];
         break;
 
@@ -398,7 +398,7 @@ static uint32_t gt64120_readl (void *opaque,
         /* Reading those register should empty all FIFO on the PCI
            bus, which are not emulated. The return value should be
            a random value that should be ignored. */
-        val = 0xc000ffee; 
+        val = 0xc000ffee;
         break;
 
     /* ECC */
@@ -408,7 +408,7 @@ static uint32_t gt64120_readl (void *opaque,
     case GT_ECC_CALC:
     case GT_ECC_ERRADDR:
         /* Emulated memory has no error, always return the initial
-           values */ 
+           values */
         val = s->regs[saddr];
         break;
 
@@ -436,7 +436,7 @@ static uint32_t gt64120_readl (void *opaque,
         val = s->regs[saddr];
         break;
     case GT_PCI0_IACK:
-        /* Read the IRQ number */ 
+        /* Read the IRQ number */
         val = pic_read_irq(isa_pic);
         break;
 
@@ -582,10 +582,10 @@ void gt64120_reset(void *opaque)
     s->regs[GT_ECC_ERRADDR]   = 0x00000000;
 
     /* SDRAM Parameters */
-    s->regs[GT_SDRAM_B0]      = 0x00000005;    
-    s->regs[GT_SDRAM_B1]      = 0x00000005;    
-    s->regs[GT_SDRAM_B2]      = 0x00000005;    
-    s->regs[GT_SDRAM_B3]      = 0x00000005;    
+    s->regs[GT_SDRAM_B0]      = 0x00000005;
+    s->regs[GT_SDRAM_B1]      = 0x00000005;
+    s->regs[GT_SDRAM_B2]      = 0x00000005;
+    s->regs[GT_SDRAM_B3]      = 0x00000005;
 
     /* PCI Internal FIXME: not complete*/
 #ifdef TARGET_WORDS_BIGENDIAN
index 4980cef46706e4136b68dde054dc4c1875bc7f5f..55a9e557ecff731b6687552a56328fefe006cf3b 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Heathrow PIC support (standard PowerMac PIC)
- * 
+ *
  * Copyright (c) 2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -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 @@ void heathrow_pic_set_irq(void *opaque, int num, int level)
 HeathrowPICS *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;
index a4097632eb283b208aa4445779d3f57db37c3d2b..977790ee6eb72a4d4130759bc2e19dd714e8e773 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU 8253/8254 interval timer emulation
- * 
+ *
  * Copyright (c) 2003-2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -121,7 +121,7 @@ int pit_get_out(PITState *pit, int channel, int64_t current_time)
 }
 
 /* return -1 if no transition will occur.  */
-static int64_t pit_get_next_transition_time(PITChannelState *s, 
+static int64_t pit_get_next_transition_time(PITChannelState *s,
                                             int64_t current_time)
 {
     uint64_t d, next_time, base;
@@ -147,7 +147,7 @@ static int64_t pit_get_next_transition_time(PITChannelState *s,
     case 3:
         base = (d / s->count) * s->count;
         period2 = ((s->count + 1) >> 1);
-        if ((d - base) < period2) 
+        if ((d - base) < period2)
             next_time = base + period2;
         else
             next_time = base + s->count;
@@ -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) {
@@ -369,7 +369,7 @@ static void pit_irq_timer_update(PITChannelState *s, int64_t current_time)
     pic_set_irq(s->irq, irq_level);
 #ifdef DEBUG_PIT
     printf("irq_level=%d next_delay=%f\n",
-           irq_level, 
+           irq_level,
            (double)(expire_time - current_time) / ticks_per_sec);
 #endif
     s->next_transition_time = expire_time;
@@ -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;
 
index f8b5a984b54c2641d1abff8b854e0770e404fc96..bdc248bc01ed4231e032e5d428cac29755183610 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU 8259 interrupt controller emulation
- * 
+ *
  * Copyright (c) 2003-2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -151,10 +151,10 @@ void pic_update_irq(PicState2 *s)
         {
             int i;
             for(i = 0; i < 2; i++) {
-                printf("pic%d: imr=%x irr=%x padd=%d\n", 
-                       i, s->pics[i].imr, s->pics[i].irr, 
+                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");
@@ -248,10 +248,10 @@ 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, 
+    printf("IRQ%d latency=%0.3fus\n",
+           irq,
            (double)(qemu_get_clock(vm_clock) - irq_time[irq]) * 1000000.0 / ticks_per_sec);
 #endif
 #if defined(DEBUG_PIC)
@@ -434,7 +434,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;
 }
 
@@ -453,7 +453,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);
@@ -474,7 +474,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;
 
@@ -513,15 +513,15 @@ void pic_info(void)
 {
     int i;
     PicState *s;
-    
+
     if (!isa_pic)
         return;
 
     for(i=0;i<2;i++) {
         s = &isa_pic->pics[i];
         term_printf("pic%d: irr=%02x imr=%02x isr=%02x hprio=%d irq_base=%02x rr_sel=%d elcr=%02x fnm=%d\n",
-                    i, s->irr, s->imr, s->isr, s->priority_add, 
-                    s->irq_base, s->read_reg_select, s->elcr, 
+                    i, s->irr, s->imr, s->isr, s->priority_add,
+                    s->irq_base, s->read_reg_select, s->elcr,
                     s->special_fully_nested_mode);
     }
 }
index 190f07493e7d3bb79db7ad0dbc79b1a5eb0c3a9c..cef34fcd84b6c26bf70ad6a08dfdee4be03a04bc 100644 (file)
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -1,8 +1,8 @@
 /*
  * QEMU IDE disk and CD-ROM Emulator
- * 
+ *
  * Copyright (c) 2003 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
 #define WIN_WRITEDMA_ONCE              0xCB /* 28-Bit - without retries */
 #define WIN_WRITEDMA_QUEUED            0xCC /* write sectors using Queued DMA transfers */
 #define CFA_WRITE_MULTI_WO_ERASE       0xCD /* CFA Write multiple without erase */
-#define WIN_GETMEDIASTATUS             0xDA    
+#define WIN_GETMEDIASTATUS             0xDA
 #define WIN_ACKMEDIACHANGE             0xDB /* ATA-1, ATA-2 vendor */
 #define WIN_POSTBOOT                   0xDC
 #define WIN_PREBOOT                    0xDD
 #define GPCMD_VERIFY_10                            0x2f
 #define GPCMD_WRITE_10                     0x2a
 #define GPCMD_WRITE_AND_VERIFY_10          0x2e
-/* This is listed as optional in ATAPI 2.6, but is (curiously) 
+/* This is listed as optional in ATAPI 2.6, but is (curiously)
  * missing from Mt. Fuji, Table 57.  It _is_ mentioned in Mt. Fuji
  * Table 377 as an MMC command for SCSi devices though...  Most ATAPI
  * drives support it. */
 #define GPCMD_SET_SPEED                            0xbb
-/* This seems to be a SCSI specific CD-ROM opcode 
+/* This seems to be a SCSI specific CD-ROM opcode
  * to play data at track/index */
 #define GPCMD_PLAYAUDIO_TI                 0x48
 /*
@@ -328,7 +328,7 @@ typedef struct IDEState {
     /* set for lba48 access */
     uint8_t lba48;
     /* depends on bit 4 in select, only meaningful for drive 0 */
-    struct IDEState *cur_drive; 
+    struct IDEState *cur_drive;
     BlockDriverState *bs;
     /* ATAPI specific */
     uint8_t sense_key;
@@ -374,7 +374,7 @@ typedef struct BMDMAState {
     uint8_t cmd;
     uint8_t status;
     uint32_t addr;
-    
+
     struct PCIIDEState *pci_dev;
     /* current transfer state */
     uint32_t cur_addr;
@@ -439,11 +439,11 @@ static void ide_identify(IDEState *s)
     memset(s->io_buffer, 0, 512);
     p = (uint16_t *)s->io_buffer;
     put_le16(p + 0, 0x0040);
-    put_le16(p + 1, s->cylinders); 
+    put_le16(p + 1, s->cylinders);
     put_le16(p + 3, s->heads);
     put_le16(p + 4, 512 * s->sectors); /* XXX: retired, remove ? */
     put_le16(p + 5, 512); /* XXX: retired, remove ? */
-    put_le16(p + 6, s->sectors); 
+    put_le16(p + 6, s->sectors);
     snprintf(buf, sizeof(buf), "QM%05d", s->drive_serial);
     padstr((uint8_t *)(p + 10), buf, 20); /* serial number */
     put_le16(p + 20, 3); /* XXX: retired, remove ? */
@@ -451,7 +451,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 */
@@ -580,7 +580,7 @@ static inline void ide_set_irq(IDEState *s)
 }
 
 /* prepare data transfer and tell what to do after */
-static void ide_transfer_start(IDEState *s, uint8_t *buf, int size, 
+static void ide_transfer_start(IDEState *s, uint8_t *buf, int size,
                                EndTransferFunc *end_transfer_func)
 {
     s->end_transfer_func = end_transfer_func;
@@ -684,7 +684,7 @@ static int dma_buf_rw(BMDMAState *bm, int is_write)
 
     for(;;) {
         l = s->io_buffer_size - s->io_buffer_index;
-        if (l <= 0) 
+        if (l <= 0)
             break;
         if (bm->cur_prd_len == 0) {
             /* end of table (with a fail safe of one page) */
@@ -706,10 +706,10 @@ static int dma_buf_rw(BMDMAState *bm, int is_write)
             l = bm->cur_prd_len;
         if (l > 0) {
             if (is_write) {
-                cpu_physical_memory_write(bm->cur_prd_addr, 
+                cpu_physical_memory_write(bm->cur_prd_addr,
                                           s->io_buffer + s->io_buffer_index, l);
             } else {
-                cpu_physical_memory_read(bm->cur_prd_addr, 
+                cpu_physical_memory_read(bm->cur_prd_addr,
                                           s->io_buffer + s->io_buffer_index, l);
             }
             bm->cur_prd_addr += l;
@@ -760,7 +760,7 @@ static void ide_read_dma_cb(void *opaque, int ret)
 #ifdef DEBUG_AIO
     printf("aio_read: sector_num=%lld n=%d\n", sector_num, n);
 #endif
-    bm->aiocb = bdrv_aio_read(s->bs, sector_num, s->io_buffer, n, 
+    bm->aiocb = bdrv_aio_read(s->bs, sector_num, s->io_buffer, n,
                               ide_read_dma_cb, bm);
 }
 
@@ -803,7 +803,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);
-    
+
 #ifdef TARGET_I386
     if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
         /* It seems there is a bug in the Windows 2000 installer HDD
@@ -812,9 +812,9 @@ static void ide_sector_write(IDEState *s)
            that at the expense of slower write performances. Use this
            option _only_ to install Windows 2000. You must disable it
            for normal use. */
-        qemu_mod_timer(s->sector_write_timer, 
+        qemu_mod_timer(s->sector_write_timer,
                        qemu_get_clock(vm_clock) + (ticks_per_sec / 1000));
-    } else 
+    } else
 #endif
     {
         ide_set_irq(s);
@@ -862,7 +862,7 @@ static void ide_write_dma_cb(void *opaque, int ret)
 #ifdef DEBUG_AIO
     printf("aio_write: sector_num=%lld n=%d\n", sector_num, n);
 #endif
-    bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n, 
+    bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n,
                                ide_write_dma_cb, bm);
 }
 
@@ -944,7 +944,7 @@ static void cd_data_to_raw(uint8_t *buf, int lba)
     memset(buf, 0, 288);
 }
 
-static int cd_read_sector(BlockDriverState *bs, int lba, uint8_t *buf, 
+static int cd_read_sector(BlockDriverState *bs, int lba, uint8_t *buf,
                            int sector_size)
 {
     int ret;
@@ -970,10 +970,10 @@ static void ide_atapi_io_error(IDEState *s, int ret)
 {
     /* XXX: handle more errors */
     if (ret == -ENOMEDIUM) {
-        ide_atapi_cmd_error(s, SENSE_NOT_READY, 
+        ide_atapi_cmd_error(s, SENSE_NOT_READY,
                             ASC_MEDIUM_NOT_PRESENT);
     } else {
-        ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, 
+        ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
                             ASC_LOGICAL_BLOCK_OOR);
     }
 }
@@ -983,7 +983,7 @@ static void ide_atapi_cmd_reply_end(IDEState *s)
 {
     int byte_count_limit, size, ret;
 #ifdef DEBUG_IDE_ATAPI
-    printf("reply: tx_size=%d elem_tx_size=%d index=%d\n", 
+    printf("reply: tx_size=%d elem_tx_size=%d index=%d\n",
            s->packet_transfer_size,
            s->elementary_transfer_size,
            s->io_buffer_index);
@@ -1015,7 +1015,7 @@ static void ide_atapi_cmd_reply_end(IDEState *s)
             size = s->cd_sector_size - s->io_buffer_index;
             if (size > s->elementary_transfer_size)
                 size = s->elementary_transfer_size;
-            ide_transfer_start(s, s->io_buffer + s->io_buffer_index, 
+            ide_transfer_start(s, s->io_buffer + s->io_buffer_index,
                                size, ide_atapi_cmd_reply_end);
             s->packet_transfer_size -= size;
             s->elementary_transfer_size -= size;
@@ -1044,7 +1044,7 @@ static void ide_atapi_cmd_reply_end(IDEState *s)
                 if (size > (s->cd_sector_size - s->io_buffer_index))
                     size = (s->cd_sector_size - s->io_buffer_index);
             }
-            ide_transfer_start(s, s->io_buffer + s->io_buffer_index, 
+            ide_transfer_start(s, s->io_buffer + s->io_buffer_index,
                                size, ide_atapi_cmd_reply_end);
             s->packet_transfer_size -= size;
             s->elementary_transfer_size -= size;
@@ -1139,7 +1139,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;
@@ -1155,12 +1155,12 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret)
 #ifdef DEBUG_AIO
     printf("aio_read_cd: lba=%u n=%d\n", s->lba, n);
 #endif
-    bm->aiocb = bdrv_aio_read(s->bs, (int64_t)s->lba << 2, 
-                              s->io_buffer + data_offset, n * 4, 
+    bm->aiocb = bdrv_aio_read(s->bs, (int64_t)s->lba << 2,
+                              s->io_buffer + data_offset, n * 4,
                               ide_atapi_cmd_read_dma_cb, bm);
     if (!bm->aiocb) {
         /* Note: media not present is the most likely case */
-        ide_atapi_cmd_error(s, SENSE_NOT_READY, 
+        ide_atapi_cmd_error(s, SENSE_NOT_READY,
                             ASC_MEDIUM_NOT_PRESENT);
         goto eot;
     }
@@ -1182,7 +1182,7 @@ static void ide_atapi_cmd_read_dma(IDEState *s, int lba, int nb_sectors,
     ide_dma_start(s, ide_atapi_cmd_read_dma_cb);
 }
 
-static void ide_atapi_cmd_read(IDEState *s, int lba, int nb_sectors, 
+static void ide_atapi_cmd_read(IDEState *s, int lba, int nb_sectors,
                                int sector_size)
 {
 #ifdef DEBUG_IDE_ATAPI
@@ -1219,7 +1219,7 @@ static void ide_atapi_cmd(IDEState *s)
         if (bdrv_is_inserted(s->bs)) {
             ide_atapi_cmd_ok(s);
         } else {
-            ide_atapi_cmd_error(s, SENSE_NOT_READY, 
+            ide_atapi_cmd_error(s, SENSE_NOT_READY,
                                 ASC_MEDIUM_NOT_PRESENT);
         }
         break;
@@ -1264,7 +1264,7 @@ static void ide_atapi_cmd(IDEState *s)
                     buf[9] = 0x12;
                     buf[10] = 0x00;
                     buf[11] = 0x00;
-                    
+
                     buf[12] = 0x70;
                     buf[13] = 3 << 5;
                     buf[14] = (1 << 0) | (1 << 3) | (1 << 5);
@@ -1292,7 +1292,7 @@ static void ide_atapi_cmd(IDEState *s)
                 goto error_cmd;
             default:
             case 3: /* saved values */
-                ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, 
+                ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
                                     ASC_SAVING_PARAMETERS_NOT_SUPPORTED);
                 break;
             }
@@ -1312,7 +1312,7 @@ static void ide_atapi_cmd(IDEState *s)
             bdrv_set_locked(s->bs, packet[4] & 1);
             ide_atapi_cmd_ok(s);
         } else {
-            ide_atapi_cmd_error(s, SENSE_NOT_READY, 
+            ide_atapi_cmd_error(s, SENSE_NOT_READY,
                                 ASC_MEDIUM_NOT_PRESENT);
         }
         break;
@@ -1358,7 +1358,7 @@ static void ide_atapi_cmd(IDEState *s)
                 ide_atapi_cmd_read(s, lba, nb_sectors, 2352);
                 break;
             default:
-                ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, 
+                ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
                                     ASC_INV_FIELD_IN_CMD_PACKET);
                 break;
             }
@@ -1372,13 +1372,13 @@ static void ide_atapi_cmd(IDEState *s)
             bdrv_get_geometry(s->bs, &total_sectors);
             total_sectors >>= 2;
             if (total_sectors <= 0) {
-                ide_atapi_cmd_error(s, SENSE_NOT_READY, 
+                ide_atapi_cmd_error(s, SENSE_NOT_READY,
                                     ASC_MEDIUM_NOT_PRESENT);
                 break;
             }
             lba = ube32_to_cpu(packet + 2);
             if (lba >= total_sectors) {
-                ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, 
+                ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
                                     ASC_LOGICAL_BLOCK_OOR);
                 break;
             }
@@ -1390,7 +1390,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);
@@ -1422,7 +1422,7 @@ static void ide_atapi_cmd(IDEState *s)
             bdrv_get_geometry(s->bs, &total_sectors);
             total_sectors >>= 2;
             if (total_sectors <= 0) {
-                ide_atapi_cmd_error(s, SENSE_NOT_READY, 
+                ide_atapi_cmd_error(s, SENSE_NOT_READY,
                                     ASC_MEDIUM_NOT_PRESENT);
                 break;
             }
@@ -1453,7 +1453,7 @@ static void ide_atapi_cmd(IDEState *s)
                 break;
             default:
             error_cmd:
-                ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, 
+                ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
                                     ASC_INV_FIELD_IN_CMD_PACKET);
                 break;
             }
@@ -1466,7 +1466,7 @@ static void ide_atapi_cmd(IDEState *s)
             bdrv_get_geometry(s->bs, &total_sectors);
             total_sectors >>= 2;
             if (total_sectors <= 0) {
-                ide_atapi_cmd_error(s, SENSE_NOT_READY, 
+                ide_atapi_cmd_error(s, SENSE_NOT_READY,
                                     ASC_MEDIUM_NOT_PRESENT);
                 break;
             }
@@ -1492,7 +1492,7 @@ static void ide_atapi_cmd(IDEState *s)
         ide_atapi_cmd_reply(s, 36, max_len);
         break;
     default:
-        ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, 
+        ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
                             ASC_ILLEGAL_OPCODE);
         break;
     }
@@ -1607,7 +1607,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
 #endif
         s = ide_if->cur_drive;
         /* ignore commands to non existant slave */
-        if (s != ide_if && !s->bs) 
+        if (s != ide_if && !s->bs)
             break;
 
         switch(val) {
@@ -1631,7 +1631,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
             ide_set_irq(s);
             break;
         case WIN_SETMULT:
-            if (s->nsector > MAX_MULT_SECTORS || 
+            if (s->nsector > MAX_MULT_SECTORS ||
                 s->nsector == 0 ||
                 (s->nsector & (s->nsector - 1)) != 0) {
                 ide_abort_command(s);
@@ -1654,7 +1654,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
            lba48 = 1;
         case WIN_READ:
         case WIN_READ_ONCE:
-            if (!s->bs) 
+            if (!s->bs)
                 goto abort_cmd;
            ide_cmd_lba48_transform(s, lba48);
             s->req_nb_sectors = 1;
@@ -1697,7 +1697,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
            lba48 = 1;
         case WIN_READDMA:
         case WIN_READDMA_ONCE:
-            if (!s->bs) 
+            if (!s->bs)
                 goto abort_cmd;
            ide_cmd_lba48_transform(s, lba48);
             ide_sector_read_dma(s);
@@ -1706,7 +1706,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
            lba48 = 1;
         case WIN_WRITEDMA:
         case WIN_WRITEDMA_ONCE:
-            if (!s->bs) 
+            if (!s->bs)
                 goto abort_cmd;
            ide_cmd_lba48_transform(s, lba48);
             ide_sector_write_dma(s);
@@ -1807,7 +1807,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
                 goto abort_cmd;
             s->atapi_dma = s->feature & 1;
             s->nsector = 1;
-            ide_transfer_start(s, s->io_buffer, ATAPI_PACKET_SIZE, 
+            ide_transfer_start(s, s->io_buffer, ATAPI_PACKET_SIZE,
                                ide_atapi_cmd);
             break;
         default:
@@ -1993,7 +1993,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;
@@ -2040,7 +2040,7 @@ struct partition {
 } __attribute__((packed));
 
 /* try to guess the disk logical geometry from the MSDOS partition table. Return 0 if OK, -1 if could not guess */
-static int guess_disk_lchs(IDEState *s, 
+static int guess_disk_lchs(IDEState *s,
                            int *pcylinders, int *pheads, int *psectors)
 {
     uint8_t buf[512];
@@ -2071,7 +2071,7 @@ static int guess_disk_lchs(IDEState *s,
             *psectors = sectors;
             *pcylinders = cylinders;
 #if 0
-            printf("guessed geometry: LCHS=%d %d %d\n", 
+            printf("guessed geometry: LCHS=%d %d %d\n",
                    cylinders, heads, sectors);
 #endif
             return 0;
@@ -2156,7 +2156,7 @@ static void ide_init2(IDEState *ide_state,
         s->set_irq = set_irq;
         s->irq_opaque = irq_opaque;
         s->irq = irq;
-        s->sector_write_timer = qemu_new_timer(vm_clock, 
+        s->sector_write_timer = qemu_new_timer(vm_clock,
                                                ide_sector_write_timer_cb, s);
         ide_reset(s);
     }
@@ -2170,7 +2170,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);
@@ -2189,7 +2189,7 @@ void isa_ide_init(int iobase, int iobase2, int irq,
     ide_state = qemu_mallocz(sizeof(IDEState) * 2);
     if (!ide_state)
         return;
-    
+
     ide_init2(ide_state, hd0, hd1, pic_set_irq_new, isa_pic, irq);
     ide_init_ioport(ide_state, iobase, iobase2);
 }
@@ -2199,7 +2199,7 @@ void isa_ide_init(int iobase, int iobase2, int irq,
 
 static void cmd646_update_irq(PCIIDEState *d);
 
-static void ide_map(PCIDevice *pci_dev, int region_num, 
+static void ide_map(PCIDevice *pci_dev, int region_num,
                     uint32_t addr, uint32_t size, int type)
 {
     PCIIDEState *d = (PCIIDEState *)pci_dev;
@@ -2276,9 +2276,9 @@ static uint32_t bmdma_readb(void *opaque, uint32_t addr)
     BMDMAState *bm = opaque;
     PCIIDEState *pci_dev;
     uint32_t val;
-    
+
     switch(addr & 3) {
-    case 0: 
+    case 0:
         val = bm->cmd;
         break;
     case 1:
@@ -2324,7 +2324,7 @@ static void bmdma_writeb(void *opaque, uint32_t addr, uint32_t val)
     case 1:
         pci_dev = bm->pci_dev;
         if (pci_dev->type == IDE_TYPE_CMD646) {
-            pci_dev->dev.config[MRDMODE] = 
+            pci_dev->dev.config[MRDMODE] =
                 (pci_dev->dev.config[MRDMODE] & ~0x30) | (val & 0x30);
             cmd646_update_irq(pci_dev);
         }
@@ -2365,7 +2365,7 @@ static void bmdma_addr_writel(void *opaque, uint32_t addr, uint32_t val)
     bm->cur_addr = bm->addr;
 }
 
-static void bmdma_map(PCIDevice *pci_dev, int region_num, 
+static void bmdma_map(PCIDevice *pci_dev, int region_num,
                     uint32_t addr, uint32_t size, int type)
 {
     PCIIDEState *d = (PCIIDEState *)pci_dev;
@@ -2422,9 +2422,9 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table,
     uint8_t *pci_conf;
     int i;
 
-    d = (PCIIDEState *)pci_register_device(bus, "CMD646 IDE", 
+    d = (PCIIDEState *)pci_register_device(bus, "CMD646 IDE",
                                            sizeof(PCIIDEState),
-                                           -1, 
+                                           -1,
                                            NULL, NULL);
     d->type = IDE_TYPE_CMD646;
     pci_conf = d->dev.config;
@@ -2434,30 +2434,30 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table,
     pci_conf[0x03] = 0x06;
 
     pci_conf[0x08] = 0x07; // IDE controller revision
-    pci_conf[0x09] = 0x8f; 
+    pci_conf[0x09] = 0x8f;
 
     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 */
     }
 
-    pci_register_io_region((PCIDevice *)d, 0, 0x8, 
+    pci_register_io_region((PCIDevice *)d, 0, 0x8,
                            PCI_ADDRESS_SPACE_IO, ide_map);
-    pci_register_io_region((PCIDevice *)d, 1, 0x4, 
+    pci_register_io_region((PCIDevice *)d, 1, 0x4,
                            PCI_ADDRESS_SPACE_IO, ide_map);
-    pci_register_io_region((PCIDevice *)d, 2, 0x8, 
+    pci_register_io_region((PCIDevice *)d, 2, 0x8,
                            PCI_ADDRESS_SPACE_IO, ide_map);
-    pci_register_io_region((PCIDevice *)d, 3, 0x4, 
+    pci_register_io_region((PCIDevice *)d, 3, 0x4,
                            PCI_ADDRESS_SPACE_IO, ide_map);
-    pci_register_io_region((PCIDevice *)d, 4, 0x10, 
+    pci_register_io_region((PCIDevice *)d, 4, 0x10,
                            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;
     ide_init2(&d->ide_if[0], hd_table[0], hd_table[1],
@@ -2592,9 +2592,9 @@ void pci_piix_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn)
 {
     PCIIDEState *d;
     uint8_t *pci_conf;
-    
+
     /* register a function 1 of PIIX */
-    d = (PCIIDEState *)pci_register_device(bus, "PIIX IDE", 
+    d = (PCIIDEState *)pci_register_device(bus, "PIIX IDE",
                                            sizeof(PCIIDEState),
                                            devfn,
                                            NULL, NULL);
@@ -2613,7 +2613,7 @@ void pci_piix_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn)
 
     piix3_reset(d);
 
-    pci_register_io_region((PCIDevice *)d, 4, 0x10, 
+    pci_register_io_region((PCIDevice *)d, 4, 0x10,
                            PCI_ADDRESS_SPACE_IO, bmdma_map);
 
     ide_init2(&d->ide_if[0], hd_table[0], hd_table[1],
@@ -2632,9 +2632,9 @@ 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", 
+    d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE",
                                            sizeof(PCIIDEState),
                                            devfn,
                                            NULL, NULL);
@@ -2652,7 +2652,7 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn)
 
     piix3_reset(d);
 
-    pci_register_io_region((PCIDevice *)d, 4, 0x10, 
+    pci_register_io_region((PCIDevice *)d, 4, 0x10,
                            PCI_ADDRESS_SPACE_IO, bmdma_map);
 
     ide_init2(&d->ide_if[0], hd_table[0], hd_table[1],
@@ -2672,7 +2672,7 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn)
 static void pmac_ide_writeb (void *opaque,
                              target_phys_addr_t addr, uint32_t val)
 {
-    addr = (addr & 0xFFF) >> 4; 
+    addr = (addr & 0xFFF) >> 4;
     switch (addr) {
     case 1 ... 7:
         ide_ioport_write(opaque, addr, val);
@@ -2709,7 +2709,7 @@ static uint32_t pmac_ide_readb (void *opaque,target_phys_addr_t addr)
 static void pmac_ide_writew (void *opaque,
                              target_phys_addr_t addr, uint32_t val)
 {
-    addr = (addr & 0xFFF) >> 4; 
+    addr = (addr & 0xFFF) >> 4;
 #ifdef TARGET_WORDS_BIGENDIAN
     val = bswap16(val);
 #endif
@@ -2722,7 +2722,7 @@ static uint32_t pmac_ide_readw (void *opaque,target_phys_addr_t addr)
 {
     uint16_t retval;
 
-    addr = (addr & 0xFFF) >> 4; 
+    addr = (addr & 0xFFF) >> 4;
     if (addr == 0) {
         retval = ide_data_readw(opaque, 0);
     } else {
@@ -2737,7 +2737,7 @@ static uint32_t pmac_ide_readw (void *opaque,target_phys_addr_t addr)
 static void pmac_ide_writel (void *opaque,
                              target_phys_addr_t addr, uint32_t val)
 {
-    addr = (addr & 0xFFF) >> 4; 
+    addr = (addr & 0xFFF) >> 4;
 #ifdef TARGET_WORDS_BIGENDIAN
     val = bswap32(val);
 #endif
@@ -2750,7 +2750,7 @@ static uint32_t pmac_ide_readl (void *opaque,target_phys_addr_t addr)
 {
     uint32_t retval;
 
-    addr = (addr & 0xFFF) >> 4; 
+    addr = (addr & 0xFFF) >> 4;
     if (addr == 0) {
         retval = ide_data_readl(opaque, 0);
     } else {
@@ -2786,7 +2786,7 @@ int pmac_ide_init (BlockDriverState **hd_table,
     ide_if = qemu_mallocz(sizeof(IDEState) * 2);
     ide_init2(&ide_if[0], hd_table[0], hd_table[1],
               set_irq, irq_opaque, irq);
-    
+
     pmac_ide_memory = cpu_register_io_memory(0, pmac_ide_read,
                                              pmac_ide_write, &ide_if[0]);
     return pmac_ide_memory;
index 4e5f4ac9f722729b1f871f726c63b40f5f3016d1..fa4b962337515ac8b50235b7c0745df5c6371023 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * ARM Integrator CP System emulation.
  *
  * Copyright (c) 2005-2006 CodeSourcery.
index 5c2768cee318b69bc35534f5c7228e063f4d52e1..09dff83993200cdc1aa01cff5281aab7534652d6 100644 (file)
@@ -2,7 +2,7 @@
  * QEMU SPARC iommu emulation
  *
  * Copyright (c) 2003-2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -238,7 +238,7 @@ static void iommu_save(QEMUFile *f, void *opaque)
 {
     IOMMUState *s = opaque;
     int i;
-    
+
     qemu_put_be32s(f, &s->addr);
     for (i = 0; i < IOMMU_NREGS; i++)
        qemu_put_be32s(f, &s->regs[i]);
@@ -249,7 +249,7 @@ static int iommu_load(QEMUFile *f, void *opaque, int version_id)
 {
     IOMMUState *s = opaque;
     int i;
-    
+
     if (version_id != 1)
         return -EINVAL;
 
@@ -283,7 +283,7 @@ void *iommu_init(uint32_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, 1, iommu_save, iommu_load, s);
     qemu_register_reset(iommu_reset, s);
     return s;
index 070f6f587a0be614e67cc05824178b8898b2d912..4e7914e6b0a0316c230b530c1ed03e4d4d97b638 100644 (file)
@@ -2,7 +2,7 @@
  * Memory mapped access to ISA IO space.
  *
  * Copyright (c) 2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
index 41c1ff22d2194628a72741775e20080a41fcb394..5d9a4f37d51e96b7493c3209dcf7a8c686cb44a5 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * QEMU LSI53C895A SCSI Host Bus Adapter emulation
  *
  * Copyright (c) 2006 CodeSourcery.
@@ -1768,7 +1768,7 @@ static void lsi_io_writel(void *opaque, uint32_t addr, uint32_t val)
     lsi_reg_writeb(s, addr + 2, (val >> 24) & 0xff);
 }
 
-static void lsi_io_mapfunc(PCIDevice *pci_dev, int region_num, 
+static void lsi_io_mapfunc(PCIDevice *pci_dev, int region_num,
                            uint32_t addr, uint32_t size, int type)
 {
     LSIState *s = (LSIState *)pci_dev;
@@ -1783,7 +1783,7 @@ static void lsi_io_mapfunc(PCIDevice *pci_dev, int region_num,
     register_ioport_read(addr, 256, 4, lsi_io_readl, s);
 }
 
-static void lsi_ram_mapfunc(PCIDevice *pci_dev, int region_num, 
+static void lsi_ram_mapfunc(PCIDevice *pci_dev, int region_num,
                             uint32_t addr, uint32_t size, int type)
 {
     LSIState *s = (LSIState *)pci_dev;
@@ -1793,7 +1793,7 @@ static void lsi_ram_mapfunc(PCIDevice *pci_dev, int region_num,
     cpu_register_physical_memory(addr + 0, 0x2000, s->ram_io_addr);
 }
 
-static void lsi_mmio_mapfunc(PCIDevice *pci_dev, int region_num, 
+static void lsi_mmio_mapfunc(PCIDevice *pci_dev, int region_num,
                              uint32_t addr, uint32_t size, int type)
 {
     LSIState *s = (LSIState *)pci_dev;
index daa1c524db6fb7f5bc37905be9dd35c86a2320c1..89e3750c8317380b0df4399523dfd8822e737b1f 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU M48T59 and M48T08 NVRAM emulation for PPC PREP and Sparc platforms
- * 
+ *
  * Copyright (c) 2003-2005 Jocelyn Mayer
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -87,7 +87,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;
@@ -101,7 +101,7 @@ static void alarm_cb (void *opaque)
     m48t59_t *NVRAM = opaque;
 
     pic_set_irq(NVRAM->IRQ, 1);
-    if ((NVRAM->buffer[0x1FF5] & 0x80) == 0 && 
+    if ((NVRAM->buffer[0x1FF5] & 0x80) == 0 &&
        (NVRAM->buffer[0x1FF4] & 0x80) == 0 &&
        (NVRAM->buffer[0x1FF3] & 0x80) == 0 &&
        (NVRAM->buffer[0x1FF2] & 0x80) == 0) {
@@ -202,7 +202,7 @@ void m48t59_write (m48t59_t *NVRAM, uint32_t addr, uint32_t val)
 
     if (addr > 0x1FF8 && addr < 0x2000)
        NVRAM_PRINTF("%s: 0x%08x => 0x%08x\n", __func__, addr, val);
-    if (NVRAM->type == 8 && 
+    if (NVRAM->type == 8 &&
         (addr >= 0x1ff0 && addr <= 0x1ff7))
         goto do_write;
     switch (addr) {
@@ -358,7 +358,7 @@ uint32_t m48t59_read (m48t59_t *NVRAM, uint32_t addr)
     struct tm tm;
     uint32_t retval = 0xFF;
 
-    if (NVRAM->type == 8 && 
+    if (NVRAM->type == 8 &&
         (addr >= 0x1ff0 && addr <= 0x1ff7))
         goto do_read;
     switch (addr) {
@@ -424,7 +424,7 @@ uint32_t m48t59_read (m48t59_t *NVRAM, uint32_t addr)
     case 0x1FFF:
         /* year */
         get_time(NVRAM, &tm);
-        if (NVRAM->type == 8) 
+        if (NVRAM->type == 8)
             retval = toBCD(tm.tm_year - 68); // Base year is 1968
         else
             retval = toBCD(tm.tm_year);
@@ -504,7 +504,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);
 }
@@ -512,7 +512,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);
@@ -521,7 +521,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);
@@ -533,7 +533,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;
@@ -543,7 +543,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);
index bad4cbd86481b3088168ba233a33c992ec6086dc..aac2622bdb1d5e93675b9fd20873798eb4610e07 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU MC146818 RTC emulation
- * 
+ *
  * Copyright (c) 2003-2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -73,7 +73,7 @@ static void rtc_timer_update(RTCState *s, int64_t current_time)
     int64_t cur_clock, next_irq_clock;
 
     period_code = s->cmos_data[RTC_REG_A] & 0x0f;
-    if (period_code != 0 && 
+    if (period_code != 0 &&
         (s->cmos_data[RTC_REG_B] & REG_B_PIE)) {
         if (period_code <= 2)
             period_code += 7;
@@ -108,7 +108,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:
@@ -219,8 +219,8 @@ static void rtc_copy_date(RTCState *s)
 /* month is between 0 and 11. */
 static int get_days_in_month(int month, int year)
 {
-    static const int days_tab[12] = { 
-        31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 
+    static const int days_tab[12] = {
+        31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
     };
     int d;
     if ((unsigned )month >= 12)
@@ -251,7 +251,7 @@ static void rtc_next_second(struct tm *tm)
                 tm->tm_wday++;
                 if ((unsigned)tm->tm_wday >= 7)
                     tm->tm_wday = 0;
-                days_in_month = get_days_in_month(tm->tm_mon, 
+                days_in_month = get_days_in_month(tm->tm_mon,
                                                   tm->tm_year + 1900);
                 tm->tm_mday++;
                 if (tm->tm_mday < 1) {
@@ -281,7 +281,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;
@@ -291,7 +291,7 @@ static void rtc_update_second(void *opaque)
         delay = (ticks_per_sec * 1) / 100;
         if (delay < 1)
             delay = 1;
-        qemu_mod_timer(s->second_timer2, 
+        qemu_mod_timer(s->second_timer2,
                        s->next_second_time + delay);
     }
 }
@@ -313,14 +313,14 @@ static void rtc_update_second2(void *opaque)
             ((s->cmos_data[RTC_HOURS_ALARM] & 0xc0) == 0xc0 ||
              s->cmos_data[RTC_HOURS_ALARM] == s->current_tm.tm_hour)) {
 
-            s->cmos_data[RTC_REG_C] |= 0xa0; 
+            s->cmos_data[RTC_REG_C] |= 0xa0;
             pic_set_irq(s->irq, 1);
         }
     }
 
     /* update ended interrupt */
     if (s->cmos_data[RTC_REG_B] & REG_B_UIE) {
-        s->cmos_data[RTC_REG_C] |= 0x90; 
+        s->cmos_data[RTC_REG_C] |= 0x90;
         pic_set_irq(s->irq, 1);
     }
 
@@ -354,7 +354,7 @@ static uint32_t cmos_ioport_read(void *opaque, uint32_t addr)
         case RTC_REG_C:
             ret = s->cmos_data[s->cmos_index];
             pic_set_irq(s->irq, 0);
-            s->cmos_data[RTC_REG_C] = 0x00; 
+            s->cmos_data[RTC_REG_C] = 0x00;
             break;
         default:
             ret = s->cmos_data[s->cmos_index];
@@ -409,7 +409,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);
@@ -469,11 +469,11 @@ RTCState *rtc_init(int base, int irq)
 
     rtc_set_date_from_host(s);
 
-    s->periodic_timer = qemu_new_timer(vm_clock, 
+    s->periodic_timer = qemu_new_timer(vm_clock,
                                        rtc_periodic_timer, s);
-    s->second_timer = qemu_new_timer(vm_clock, 
+    s->second_timer = qemu_new_timer(vm_clock,
                                      rtc_update_second, s);
-    s->second_timer2 = qemu_new_timer(vm_clock, 
+    s->second_timer2 = qemu_new_timer(vm_clock,
                                       rtc_update_second2, s);
 
     s->next_second_time = qemu_get_clock(vm_clock) + (ticks_per_sec * 99) / 100;
index 93d599fc6022602cbb34f5e2f044eccf02ce0d73..7e857ab7e7da73ab8b179309c91e7d430533d534 100644 (file)
@@ -21,7 +21,7 @@ void cpu_mips_update_irq(CPUState *env)
 void cpu_mips_irq_request(void *opaque, int irq, int level)
 {
     CPUState *env = first_cpu;
-   
+
     uint32_t mask;
 
     if (irq >= 16)
index 8d1cac93929ee7a0b087e4082634fb12920f656a..d9d98e8a6599607a7e0ed6ac94656f829921658c 100644 (file)
@@ -196,7 +196,7 @@ void mips_r4k_init (int ram_size, int vga_ram_size, int boot_device,
         }
     }
 
-    isa_vga_init(ds, phys_ram_base + ram_size, ram_size, 
+    isa_vga_init(ds, phys_ram_base + ram_size, ram_size,
                  vga_ram_size);
 
     if (nd_table[0].vlan) {
index d27cd741a1e02f63652d91c886f8adda3b21b00b..43f19443436d1a562526b58421df8677434d3c86 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU NE2000 emulation
- * 
+ *
  * Copyright (c) 2003-2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -218,7 +218,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);
@@ -232,16 +232,16 @@ static void ne2000_receive(void *opaque, const uint8_t *buf, int size)
     uint8_t *p;
     int total_len, next, avail, len, index, mcast_idx;
     uint8_t buf1[60];
-    static const uint8_t broadcast_macaddr[6] = 
+    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 */
@@ -258,10 +258,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 {
@@ -339,7 +339,7 @@ static void ne2000_ioport_write(void *opaque, uint32_t addr, uint32_t val)
             }
             if (val & E8390_TRANS) {
                 index = (s->tpsr << 8);
-                /* XXX: next 2 lines are a hack to make netware 3.11 work */ 
+                /* XXX: next 2 lines are a hack to make netware 3.11 work */
                 if (index >= NE2000_PMEM_END)
                     index -= NE2000_PMEM_SIZE;
                 /* fail safe: check range on the transmitted length  */
@@ -349,7 +349,7 @@ static void ne2000_ioport_write(void *opaque, uint32_t addr, uint32_t val)
                 /* signal end of transfer */
                 s->tsr = ENTSR_PTX;
                 s->isr |= ENISR_TX;
-                s->cmd &= ~E8390_TRANS; 
+                s->cmd &= ~E8390_TRANS;
                 ne2000_update_irq(s);
             }
         }
@@ -485,30 +485,30 @@ static uint32_t ne2000_ioport_read(void *opaque, uint32_t addr)
     return ret;
 }
 
-static inline void ne2000_mem_writeb(NE2000State *s, uint32_t addr, 
+static inline void ne2000_mem_writeb(NE2000State *s, uint32_t addr,
                                      uint32_t val)
 {
-    if (addr < 32 || 
+    if (addr < 32 ||
         (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
         s->mem[addr] = val;
     }
 }
 
-static inline void ne2000_mem_writew(NE2000State *s, uint32_t addr, 
+static inline void ne2000_mem_writew(NE2000State *s, uint32_t addr,
                                      uint32_t val)
 {
     addr &= ~1; /* XXX: check exact behaviour if not even */
-    if (addr < 32 || 
+    if (addr < 32 ||
         (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
         *(uint16_t *)(s->mem + addr) = cpu_to_le16(val);
     }
 }
 
-static inline void ne2000_mem_writel(NE2000State *s, uint32_t addr, 
+static inline void ne2000_mem_writel(NE2000State *s, uint32_t addr,
                                      uint32_t val)
 {
     addr &= ~1; /* XXX: check exact behaviour if not even */
-    if (addr < 32 || 
+    if (addr < 32 ||
         (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
         cpu_to_le32wu((uint32_t *)(s->mem + addr), val);
     }
@@ -516,7 +516,7 @@ static inline void ne2000_mem_writel(NE2000State *s, uint32_t addr,
 
 static inline uint32_t ne2000_mem_readb(NE2000State *s, uint32_t addr)
 {
-    if (addr < 32 || 
+    if (addr < 32 ||
         (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
         return s->mem[addr];
     } else {
@@ -527,7 +527,7 @@ static inline uint32_t ne2000_mem_readb(NE2000State *s, uint32_t addr)
 static inline uint32_t ne2000_mem_readw(NE2000State *s, uint32_t addr)
 {
     addr &= ~1; /* XXX: check exact behaviour if not even */
-    if (addr < 32 || 
+    if (addr < 32 ||
         (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
         return le16_to_cpu(*(uint16_t *)(s->mem + addr));
     } else {
@@ -538,7 +538,7 @@ static inline uint32_t ne2000_mem_readw(NE2000State *s, uint32_t addr)
 static inline uint32_t ne2000_mem_readl(NE2000State *s, uint32_t addr)
 {
     addr &= ~1; /* XXX: check exact behaviour if not even */
-    if (addr < 32 || 
+    if (addr < 32 ||
         (addr >= NE2000_PMEM_START && addr < NE2000_MEM_SIZE)) {
         return le32_to_cpupu((uint32_t *)(s->mem + addr));
     } else {
@@ -718,11 +718,11 @@ static int ne2000_load(QEMUFile* f,void* opaque,int version_id)
 void isa_ne2000_init(int base, int 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, int irq, NICInfo *nd)
              s->macaddr[3],
              s->macaddr[4],
              s->macaddr[5]);
-             
+
     register_savevm("ne2000", 0, 2, ne2000_save, ne2000_load, s);
 }
 
@@ -761,7 +761,7 @@ typedef struct PCINE2000State {
     NE2000State ne2000;
 } PCINE2000State;
 
-static void ne2000_map(PCIDevice *pci_dev, int region_num, 
+static void ne2000_map(PCIDevice *pci_dev, int region_num,
                        uint32_t addr, uint32_t size, int type)
 {
     PCINE2000State *d = (PCINE2000State *)pci_dev;
@@ -786,22 +786,22 @@ 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, 
+                                              devfn,
                                               NULL, NULL);
     pci_conf = d->dev.config;
     pci_conf[0x00] = 0xec; // Realtek 8029
     pci_conf[0x01] = 0x10;
     pci_conf[0x02] = 0x29;
     pci_conf[0x03] = 0x80;
-    pci_conf[0x0a] = 0x00; // ethernet network controller 
+    pci_conf[0x0a] = 0x00; // ethernet network controller
     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_register_io_region(&d->dev, 0, 0x100,
                            PCI_ADDRESS_SPACE_IO, ne2000_map);
     s = &d->ne2000;
     s->irq = 16; // PCI interrupt
@@ -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);
 }
index 31773373acbac66009c0f886320f1bb1abbdd1b7..f1421c5e3cfc5e28274d3f6ee09bddf1a0f69a29 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * OpenPIC emulation
- * 
+ *
  * Copyright (c) 2004 Jocelyn Mayer
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -30,7 +30,7 @@
  * - Motorola Harrier programmer manuel
  *
  * Serial interrupts, as implemented in Raven chipset are not supported yet.
- * 
+ *
  */
 #include "vl.h"
 
@@ -221,7 +221,7 @@ static void IRQ_check (openpic_t *opp, IRQ_queue_t *q)
     priority = -1;
     for (i = 0; i < MAX_IRQ; i++) {
        if (IRQ_testbit(q, i)) {
-            DPRINTF("IRQ_check: irq %d set ipvp_pr=%d pr=%d\n", 
+            DPRINTF("IRQ_check: irq %d set ipvp_pr=%d pr=%d\n",
                     i, IPVP_PRIORITY(opp->src[i].ipvp), priority);
            if (IPVP_PRIORITY(opp->src[i].ipvp) > priority) {
                next = i;
@@ -326,7 +326,7 @@ void openpic_set_irq(void *opaque, int n_IRQ, int level)
     IRQ_src_t *src;
 
     src = &opp->src[n_IRQ];
-    DPRINTF("openpic: set irq %d = %d ipvp=%08x\n", 
+    DPRINTF("openpic: set irq %d = %d ipvp=%08x\n",
             n_IRQ, level, src->ipvp);
     if (test_bit(&src->ipvp, IPVP_SENSE)) {
         /* level-sensitive irq */
@@ -413,11 +413,11 @@ static inline void write_IRQreg (openpic_t *opp, int n_IRQ,
         /* NOTE: not fully accurate for special IRQs, but simple and
            sufficient */
         /* ACTIVITY bit is read-only */
-       opp->src[n_IRQ].ipvp = 
+       opp->src[n_IRQ].ipvp =
             (opp->src[n_IRQ].ipvp & 0x40000000) |
             (val & 0x800F00FF);
         openpic_update_irq(opp, n_IRQ);
-        DPRINTF("Set IPVP %d to 0x%08x -> 0x%08x\n", 
+        DPRINTF("Set IPVP %d to 0x%08x -> 0x%08x\n",
                 n_IRQ, val, opp->src[n_IRQ].ipvp);
        break;
     case IRQ_IDE:
@@ -450,7 +450,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)
 {
@@ -797,7 +797,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)
@@ -935,7 +935,7 @@ static CPUReadMemoryFunc *openpic_read[] = {
     &openpic_readl,
 };
 
-static void openpic_map(PCIDevice *pci_dev, int region_num, 
+static void openpic_map(PCIDevice *pci_dev, int region_num,
                         uint32_t addr, uint32_t size, int type)
 {
     openpic_t *opp;
@@ -969,7 +969,7 @@ openpic_t *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;
@@ -987,7 +987,7 @@ openpic_t *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);
@@ -997,7 +997,7 @@ openpic_t *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 */
index cba95610efcb64a4505997fb7f7c92d437c197af..efaeb2907c74b1c1072b1a758548a736992fabfb 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU Parallel PORT emulation
- * 
+ *
  * Copyright (c) 2003-2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -64,7 +64,7 @@ static void parallel_update_irq(ParallelState *s)
 static void parallel_ioport_write(void *opaque, uint32_t addr, uint32_t val)
 {
     ParallelState *s = opaque;
-    
+
     addr &= 7;
 #ifdef DEBUG_PARALLEL
     printf("parallel: write addr=0x%02x val=0x%02x\n", addr, val);
@@ -118,13 +118,13 @@ static uint32_t parallel_ioport_read(void *opaque, uint32_t addr)
     case 0:
         if (s->hw_driver) {
             qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_READ_DATA, &s->data);
-        } 
-        ret = s->data; 
+        }
+        ret = s->data;
         break;
     case 1:
         if (s->hw_driver) {
             qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_READ_STATUS, &s->status);
-            ret = s->status; 
+            ret = s->status;
         } else {
             ret = s->status;
             s->irq_pending = 0;
diff --git a/hw/pc.c b/hw/pc.c
index 05802bca97ce802a521de0fac7a9b58462dc9226..d50b993e9644c17fad79e97edad141191c47a897 100644 (file)
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1,8 +1,8 @@
 /*
  * QEMU PC System Emulator
- * 
+ *
  * Copyright (c) 2003-2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -67,7 +67,7 @@ uint64_t cpu_get_tsc(CPUX86State *env)
 #if USE_KQEMU
     if (env->kqemu_enabled) {
         return cpu_get_real_ticks();
-    } else 
+    } else
 #endif
     {
         return cpu_get_ticks();
@@ -91,7 +91,7 @@ int cpu_get_pic_interrupt(CPUState *env)
     if (intno >= 0) {
         /* set irq request if a PIC irq is still pending */
         /* XXX: improve that */
-        pic_update_irq(isa_pic); 
+        pic_update_irq(isa_pic);
         return intno;
     }
     /* read the irq from the PIC */
@@ -136,7 +136,7 @@ static int cmos_get_fd_drive_type(int fd0)
     return val;
 }
 
-static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd) 
+static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd)
 {
     RTCState *s = rtc_state;
     int cylinders, heads, sectors;
@@ -184,7 +184,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':
@@ -208,7 +208,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)
@@ -234,7 +234,7 @@ static void cmos_init(int ram_size, int boot_device, BlockDriverState **hd_table
     rtc_set_memory(s, 0x12, (hd_table[0] ? 0xf0 : 0) | (hd_table[1] ? 0x0f : 0));
     if (hd_table[0])
         cmos_init_hd(0x19, 0x1b, hd_table[0]);
-    if (hd_table[1]) 
+    if (hd_table[1])
         cmos_init_hd(0x1a, 0x24, hd_table[1]);
 
     val = 0;
@@ -293,7 +293,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:
@@ -348,7 +348,7 @@ void bochs_bios_init(void)
 }
 
 
-int load_kernel(const char *filename, uint8_t *addr, 
+int load_kernel(const char *filename, uint8_t *addr,
                 uint8_t *real_addr)
 {
     int fd, size;
@@ -364,10 +364,10 @@ int load_kernel(const char *filename, uint8_t *addr,
     setup_sects = real_addr[0x1F1];
     if (!setup_sects)
         setup_sects = 4;
-    if (read(fd, real_addr + 512, setup_sects * 512) != 
+    if (read(fd, real_addr + 512, setup_sects * 512) !=
         setup_sects * 512)
         goto fail;
-    
+
     /* load 32 bit code */
     size = read(fd, addr, 16 * 1024 * 1024);
     if (size < 0)
@@ -485,7 +485,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
 
     snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME);
     bios_size = get_image_size(buf);
-    if (bios_size <= 0 || 
+    if (bios_size <= 0 ||
         (bios_size % 65536) != 0 ||
         bios_size > (256 * 1024)) {
         goto bios_error;
@@ -504,19 +504,19 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
         snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
     }
     ret = load_image(buf, phys_ram_base + vga_bios_offset);
-    
+
     /* setup basic memory access */
-    cpu_register_physical_memory(0xc0000, 0x10000, 
+    cpu_register_physical_memory(0xc0000, 0x10000,
                                  vga_bios_offset | IO_MEM_ROM);
 
     /* map the last 128KB of the BIOS in ISA space */
     isa_bios_size = bios_size;
     if (isa_bios_size > (128 * 1024))
         isa_bios_size = 128 * 1024;
-    cpu_register_physical_memory(0xd0000, (192 * 1024) - isa_bios_size, 
+    cpu_register_physical_memory(0xd0000, (192 * 1024) - isa_bios_size,
                                  IO_MEM_UNASSIGNED);
-    cpu_register_physical_memory(0x100000 - isa_bios_size, 
-                                 isa_bios_size, 
+    cpu_register_physical_memory(0x100000 - isa_bios_size,
+                                 isa_bios_size,
                                  (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM);
 
     option_rom_offset = 0;
@@ -536,9 +536,9 @@ 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), 
+    cpu_register_physical_memory((uint32_t)(-bios_size),
                                  bios_size, bios_offset | IO_MEM_ROM);
-    
+
     bochs_bios_init();
 
     if (linux_boot) {
@@ -565,21 +565,21 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
         bdrv_set_boot_sector(bs_table[0], bootsect, sizeof(bootsect));
 
         /* now we can load the kernel */
-        ret = load_kernel(kernel_filename, 
+        ret = load_kernel(kernel_filename,
                           phys_ram_base + KERNEL_LOAD_ADDR,
                           phys_ram_base + KERNEL_PARAMS_ADDR);
         if (ret < 0) {
-            fprintf(stderr, "qemu: could not load kernel '%s'\n", 
+            fprintf(stderr, "qemu: could not load kernel '%s'\n",
                     kernel_filename);
             exit(1);
         }
-        
+
         /* load initrd */
         initrd_size = 0;
         if (initrd_filename) {
             initrd_size = load_image(initrd_filename, phys_ram_base + INITRD_LOAD_ADDR);
             if (initrd_size < 0) {
-                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", 
+                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
                         initrd_filename);
                 exit(1);
             }
@@ -611,19 +611,19 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
 
     if (cirrus_vga_enabled) {
         if (pci_enabled) {
-            pci_cirrus_vga_init(pci_bus, 
-                                ds, phys_ram_base + ram_size, ram_size, 
+            pci_cirrus_vga_init(pci_bus,
+                                ds, phys_ram_base + ram_size, ram_size,
                                 vga_ram_size);
         } else {
-            isa_cirrus_vga_init(ds, phys_ram_base + ram_size, ram_size, 
+            isa_cirrus_vga_init(ds, phys_ram_base + ram_size, ram_size,
                                 vga_ram_size);
         }
     } else {
         if (pci_enabled) {
-            pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, ram_size, 
+            pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, ram_size,
                          vga_ram_size, 0, 0);
         } else {
-            isa_vga_init(ds, phys_ram_base + ram_size, ram_size, 
+            isa_vga_init(ds, phys_ram_base + ram_size, ram_size,
                          vga_ram_size);
         }
     }
@@ -707,7 +707,7 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
             piix4_smbus_register_device(eeprom, 0x50 + i);
         }
     }
-    
+
     if (i440fx_state) {
         i440fx_init_memory_mappings(i440fx_state);
     }
@@ -731,9 +731,9 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
 }
 
 static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,
-                        DisplayState *ds, const char **fd_filename, 
-                        int snapshot, 
-                        const char *kernel_filename, 
+                        DisplayState *ds, const char **fd_filename,
+                        int snapshot,
+                        const char *kernel_filename,
                         const char *kernel_cmdline,
                         const char *initrd_filename)
 {
@@ -744,9 +744,9 @@ static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device,
 }
 
 static void pc_init_isa(int ram_size, int vga_ram_size, int boot_device,
-                        DisplayState *ds, const char **fd_filename, 
-                        int snapshot, 
-                        const char *kernel_filename, 
+                        DisplayState *ds, const char **fd_filename,
+                        int snapshot,
+                        const char *kernel_filename,
                         const char *kernel_cmdline,
                         const char *initrd_filename)
 {
index b895f98a094873eed21de2b79e6efffb339f84d1..7ed7daeffa7bdd7b49851edf11ae843c91d6c7d7 100644 (file)
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -2,7 +2,7 @@
  * QEMU PCI bus manager
  *
  * Copyright (c) 2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -95,16 +95,16 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)
 }
 
 /* -1 for devfn means auto assign */
-PCIDevice *pci_register_device(PCIBus *bus, const char *name, 
+PCIDevice *pci_register_device(PCIBus *bus, const char *name,
                                int instance_size, int devfn,
-                               PCIConfigReadFunc *config_read, 
+                               PCIConfigReadFunc *config_read,
                                PCIConfigWriteFunc *config_write)
 {
     PCIDevice *pci_dev;
 
     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])
@@ -132,8 +132,8 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
     return pci_dev;
 }
 
-void pci_register_io_region(PCIDevice *pci_dev, int region_num, 
-                            uint32_t size, int type, 
+void pci_register_io_region(PCIDevice *pci_dev, int region_num,
+                            uint32_t size, int type,
                             PCIMapIORegionFunc *map_func)
 {
     PCIIORegion *r;
@@ -164,7 +164,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];
@@ -176,7 +176,7 @@ static void pci_update_mappings(PCIDevice *d)
         if (r->size != 0) {
             if (r->type & PCI_ADDRESS_SPACE_IO) {
                 if (cmd & PCI_COMMAND_IO) {
-                    new_addr = le32_to_cpu(*(uint32_t *)(d->config + 
+                    new_addr = le32_to_cpu(*(uint32_t *)(d->config +
                                                          config_ofs));
                     new_addr = new_addr & ~(r->size - 1);
                     last_addr = new_addr + r->size - 1;
@@ -190,7 +190,7 @@ static void pci_update_mappings(PCIDevice *d)
                 }
             } else {
                 if (cmd & PCI_COMMAND_MEMORY) {
-                    new_addr = le32_to_cpu(*(uint32_t *)(d->config + 
+                    new_addr = le32_to_cpu(*(uint32_t *)(d->config +
                                                          config_ofs));
                     /* the ROM slot has a specific enable bit */
                     if (i == PCI_ROM_SLOT && !(new_addr & 1))
@@ -225,7 +225,7 @@ static void pci_update_mappings(PCIDevice *d)
                         }
                     } else {
                         cpu_register_physical_memory(pci_to_cpu_addr(r->addr),
-                                                     r->size, 
+                                                     r->size,
                                                      IO_MEM_UNASSIGNED);
                     }
                 }
@@ -238,7 +238,7 @@ static void pci_update_mappings(PCIDevice *d)
     }
 }
 
-uint32_t pci_default_read_config(PCIDevice *d, 
+uint32_t pci_default_read_config(PCIDevice *d,
                                  uint32_t address, int len)
 {
     uint32_t val;
@@ -264,13 +264,13 @@ uint32_t pci_default_read_config(PCIDevice *d,
     return val;
 }
 
-void pci_default_write_config(PCIDevice *d, 
+void pci_default_write_config(PCIDevice *d,
                               uint32_t address, uint32_t val, int len)
 {
     int can_write, i;
     uint32_t end, addr;
 
-    if (len == 4 && ((address >= 0x10 && address < 0x10 + 4 * 6) || 
+    if (len == 4 && ((address >= 0x10 && address < 0x10 + 4 * 6) ||
                      (address >= 0x30 && address < 0x34))) {
         PCIIORegion *r;
         int reg;
@@ -365,7 +365,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);
@@ -437,7 +437,7 @@ void pci_set_irq(PCIDevice *pci_dev, int irq_num, int level)
 {
     PCIBus *bus;
     int change;
-    
+
     change = level - pci_dev->irq_state[irq_num];
     if (!change)
         return;
@@ -462,7 +462,7 @@ typedef struct {
     const char *desc;
 } pci_class_desc;
 
-static pci_class_desc pci_class_descriptions[] = 
+static pci_class_desc pci_class_descriptions[] =
 {
     { 0x0100, "SCSI controller"},
     { 0x0101, "IDE controller"},
@@ -508,10 +508,10 @@ static void pci_info_device(PCIDevice *d)
         if (r->size != 0) {
             term_printf("      BAR%d: ", i);
             if (r->type & PCI_ADDRESS_SPACE_IO) {
-                term_printf("I/O at 0x%04x [0x%04x].\n", 
+                term_printf("I/O at 0x%04x [0x%04x].\n",
                        r->addr, r->addr + r->size - 1);
             } else {
-                term_printf("32 bit memory at 0x%08x [0x%08x].\n", 
+                term_printf("32 bit memory at 0x%08x [0x%08x].\n",
                        r->addr, r->addr + r->size - 1);
             }
         }
@@ -526,7 +526,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) {
@@ -563,7 +563,7 @@ typedef struct {
     PCIBus *bus;
 } PCIBridge;
 
-void pci_bridge_write_config(PCIDevice *d, 
+void pci_bridge_write_config(PCIDevice *d,
                              uint32_t address, uint32_t val, int len)
 {
     PCIBridge *s = (PCIBridge *)d;
@@ -584,7 +584,7 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint32_t id,
                         pci_map_irq_fn map_irq, const char *name)
 {
     PCIBridge *s;
-    s = (PCIBridge *)pci_register_device(bus, name, sizeof(PCIBridge), 
+    s = (PCIBridge *)pci_register_device(bus, name, sizeof(PCIBridge),
                                          devfn, NULL, pci_bridge_write_config);
     s->dev.config[0x00] = id >> 16;
     s->dev.config[0x01] = id > 24;
index 708dae25e26b620a7679cc27ef7826f3dd96c5ad..49a0c59d534b95957587590f32ae27b01d1ce13b 100644 (file)
@@ -2,7 +2,7 @@
  * QEMU Common PCI Host bridge configuration data space access routines.
  *
  * Copyright (c) 2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
index 3c41e5f60250194bdd1238efec536ed26c848465..587b6769a20399a256da05a4c7e446c32b0b728d 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU PC keyboard emulation
- * 
+ *
  * Copyright (c) 2003 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -132,8 +132,8 @@ static void kbd_update_irq(KBDState *s)
 {
     int irq12_level, irq1_level;
 
-    irq1_level = 0;    
-    irq12_level = 0;    
+    irq1_level = 0;
+    irq12_level = 0;
     s->status &= ~(KBD_STAT_OBF | KBD_STAT_MOUSE_OBF);
     if (s->pending) {
         s->status |= KBD_STAT_OBF;
@@ -143,7 +143,7 @@ static void kbd_update_irq(KBDState *s)
             if (s->mode & KBD_MODE_MOUSE_INT)
                 irq12_level = 1;
         } else {
-            if ((s->mode & KBD_MODE_KBD_INT) && 
+            if ((s->mode & KBD_MODE_KBD_INT) &&
                 !(s->mode & KBD_MODE_DISABLE_KBD))
                 irq1_level = 1;
         }
@@ -333,7 +333,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);
@@ -343,7 +343,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);
@@ -356,7 +356,7 @@ static int kbd_load(QEMUFile* f, void* opaque, int version_id)
 void kbd_init(void)
 {
     KBDState *s = &kbd_state;
-    
+
     kbd_reset(s);
     register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s);
     register_ioport_read(0x60, 1, 1, kbd_read_data, s);
index 3bdddeb38a10abce497631259fb0497f5d9684a9..30c7e5686ab4733018362caa3c3d7839cf78a6af 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU AMD PC-Net II (Am79C970A) emulation
- * 
+ *
  * Copyright (c) 2004 Antony T Curtis
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+
 /* This software was written to be compatible with the specification:
  * AMD Am79C970A PCnet-PCI II Ethernet Controller Data-Sheet
  * AMD Publication# 19436  Rev:E  Amendment/0  Issue Date: June 2000
  */
+
 /*
  * On Sparc32, this is the Lance (Am7990) part of chip STP2000 (Master I/O), also
  * produced as NCR89C100. See
@@ -36,7 +36,7 @@
  */
 
 /* TODO: remove little endian host assumptions */
+
 #include "vl.h"
 
 //#define PCNET_DEBUG
@@ -198,7 +198,7 @@ struct pcnet_TMD {
     } tmd2;
     struct {
         unsigned res:32;
-    } tmd3;    
+    } tmd3;
 };
 
 struct pcnet_RMD {
@@ -214,10 +214,10 @@ struct pcnet_RMD {
     struct {
         unsigned PACKED_FIELD(mcnt:12), PACKED_FIELD(zeros:4);
         unsigned PACKED_FIELD(rpc:8), PACKED_FIELD(rcc:8);
-    } rmd2;    
+    } rmd2;
     struct {
         unsigned res:32;
-    } rmd3;    
+    } rmd3;
 };
 
 
@@ -253,7 +253,7 @@ struct pcnet_RMD {
         (R)->rmd2.rcc, (R)->rmd2.rpc, (R)->rmd2.mcnt,   \
         (R)->rmd2.zeros)
 
-static inline void pcnet_tmd_load(PCNetState *s, struct pcnet_TMD *tmd1, 
+static inline void pcnet_tmd_load(PCNetState *s, struct pcnet_TMD *tmd1,
                                   target_phys_addr_t addr)
 {
     uint32_t *tmd = (uint32_t *)tmd1;
@@ -335,7 +335,7 @@ static inline void pcnet_rmd_load(PCNetState *s, struct pcnet_RMD *rmd1,
 
     if (!BCR_SWSTYLE(s)) {
         uint16_t rda[4];
-        s->phys_mem_read(s->dma_opaque, addr, 
+        s->phys_mem_read(s->dma_opaque, addr,
                          (void *)&rda[0], sizeof(rda), 0);
         le16_to_cpus(&rda[0]);
         le16_to_cpus(&rda[1]);
@@ -349,7 +349,7 @@ static inline void pcnet_rmd_load(PCNetState *s, struct pcnet_RMD *rmd1,
         rmd[3] = 0;
     } else {
         uint32_t rda[4];
-        s->phys_mem_read(s->dma_opaque, addr, 
+        s->phys_mem_read(s->dma_opaque, addr,
                          (void *)&rda[0], sizeof(rda), 0);
         le32_to_cpus(&rda[0]);
         le32_to_cpus(&rda[1]);
@@ -366,7 +366,7 @@ static inline void pcnet_rmd_load(PCNetState *s, struct pcnet_RMD *rmd1,
     }
 }
 
-static inline void pcnet_rmd_store(PCNetState *s, struct pcnet_RMD *rmd1, 
+static inline void pcnet_rmd_store(PCNetState *s, struct pcnet_RMD *rmd1,
                                    target_phys_addr_t addr)
 {
     const uint32_t *rmd = (const uint32_t *)rmd1;
@@ -594,10 +594,10 @@ static const uint32_t crctab[256] = {
 static inline int padr_match(PCNetState *s, const uint8_t *buf, int size)
 {
     struct qemu_ether_header *hdr = (void *)buf;
-    uint8_t padr[6] = { 
+    uint8_t padr[6] = {
         s->csr[12] & 0xff, s->csr[12] >> 8,
         s->csr[13] & 0xff, s->csr[13] >> 8,
-        s->csr[14] & 0xff, s->csr[14] >> 8 
+        s->csr[14] & 0xff, s->csr[14] >> 8
     };
     int result = (!CSR_DRCVPA(s)) && !memcmp(hdr->ether_dhost, padr, 6);
 #ifdef PCNET_DEBUG_MATCH
@@ -625,13 +625,13 @@ static inline int padr_bcast(PCNetState *s, const uint8_t *buf, int size)
 static inline int ladr_match(PCNetState *s, const uint8_t *buf, int size)
 {
     struct qemu_ether_header *hdr = (void *)buf;
-    if ((*(hdr->ether_dhost)&0x01) && 
+    if ((*(hdr->ether_dhost)&0x01) &&
         ((uint64_t *)&s->csr[8])[0] != 0LL) {
-        uint8_t ladr[8] = { 
+        uint8_t ladr[8] = {
             s->csr[8] & 0xff, s->csr[8] >> 8,
             s->csr[9] & 0xff, s->csr[9] >> 8,
-            s->csr[10] & 0xff, s->csr[10] >> 8, 
-            s->csr[11] & 0xff, s->csr[11] >> 8 
+            s->csr[10] & 0xff, s->csr[10] >> 8,
+            s->csr[11] & 0xff, s->csr[11] >> 8
         };
         int index = lnc_mchash(hdr->ether_dhost) >> 26;
         return !!(ladr[index >> 3] & (1 << (index & 7)));
@@ -639,7 +639,7 @@ static inline int ladr_match(PCNetState *s, const uint8_t *buf, int size)
     return 0;
 }
 
-static inline target_phys_addr_t pcnet_rdra_addr(PCNetState *s, int idx) 
+static inline target_phys_addr_t pcnet_rdra_addr(PCNetState *s, int idx)
 {
     while (idx < 1) idx += CSR_RCVRL(s);
     return s->rdra + ((CSR_RCVRL(s) - idx) * (BCR_SWSTYLE(s) ? 16 : 8));
@@ -647,8 +647,8 @@ static inline target_phys_addr_t pcnet_rdra_addr(PCNetState *s, int idx)
 
 static inline int64_t pcnet_get_next_poll_time(PCNetState *s, int64_t current_time)
 {
-    int64_t next_time = current_time + 
-        muldiv64(65536 - (CSR_SPND(s) ? 0 : CSR_POLL(s)), 
+    int64_t next_time = current_time +
+        muldiv64(65536 - (CSR_SPND(s) ? 0 : CSR_POLL(s)),
                  ticks_per_sec, 33000000L);
     if (next_time <= current_time)
         next_time = current_time + 1;
@@ -673,7 +673,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;
@@ -712,7 +712,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) ||
@@ -732,11 +732,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;
@@ -748,7 +748,7 @@ static void pcnet_update_irq(PCNetState *s)
     }
 
 #if 1
-    if (((s->csr[5]>>1) & s->csr[5]) & 0x0500) 
+    if (((s->csr[5]>>1) & s->csr[5]) & 0x0500)
 #else
     if ((!!(s->csr[5] & 0x0400) && !!(s->csr[5] & 0x0800)) /* SINT */ ||
         (!!(s->csr[5] & 0x0100) && !!(s->csr[5] & 0x0200)) /* SLPINT */ )
@@ -776,7 +776,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)),
@@ -804,7 +804,7 @@ static void pcnet_init(PCNetState *s)
         rdra &= 0x00ffffff;
         tdra &= 0x00ffffff;
     }
-    
+
 #if defined(PCNET_DEBUG)
     printf("rlen=%d tlen=%d\n",
            rlen, tlen);
@@ -827,12 +827,12 @@ static void pcnet_init(PCNetState *s)
     CSR_XMTRC(s) = CSR_XMTRL(s);
 
 #ifdef PCNET_DEBUG
-    printf("pcnet ss32=%d rdra=0x%08x[%d] tdra=0x%08x[%d]\n", 
+    printf("pcnet ss32=%d rdra=0x%08x[%d] tdra=0x%08x[%d]\n",
         BCR_SSIZE32(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 */
 }
 
@@ -844,7 +844,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 */
 
@@ -874,15 +874,15 @@ static void pcnet_rdte_poll(PCNetState *s)
         target_phys_addr_t nrda = pcnet_rdra_addr(s, -1 + CSR_RCVRC(s));
         target_phys_addr_t nnrd = pcnet_rdra_addr(s, -2 + CSR_RCVRC(s));
 #else
-        target_phys_addr_t crda = s->rdra + 
+        target_phys_addr_t crda = s->rdra +
             (CSR_RCVRL(s) - CSR_RCVRC(s)) *
             (BCR_SWSTYLE(s) ? 16 : 8 );
         int nrdc = CSR_RCVRC(s)<=1 ? CSR_RCVRL(s) : CSR_RCVRC(s)-1;
-        target_phys_addr_t nrda = s->rdra + 
+        target_phys_addr_t nrda = s->rdra +
             (CSR_RCVRL(s) - nrdc) *
             (BCR_SWSTYLE(s) ? 16 : 8 );
         int nnrc = nrdc<=1 ? CSR_RCVRL(s) : nrdc-1;
-        target_phys_addr_t nnrd = s->rdra + 
+        target_phys_addr_t nnrd = s->rdra +
             (CSR_RCVRL(s) - nnrc) *
             (BCR_SWSTYLE(s) ? 16 : 8 );
 #endif
@@ -910,7 +910,7 @@ static void pcnet_rdte_poll(PCNetState *s)
 #endif
         }
     }
-    
+
     if (CSR_CRDA(s)) {
         struct pcnet_RMD rmd;
         RMDLOAD(&rmd, PHYSADDR(s,CSR_CRDA(s)));
@@ -925,7 +925,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)));
@@ -941,7 +941,7 @@ static int pcnet_tdte_poll(PCNetState *s)
 {
     s->csr[34] = s->csr[35] = 0;
     if (s->tdra) {
-        target_phys_addr_t cxda = s->tdra + 
+        target_phys_addr_t cxda = s->tdra +
             (CSR_XMTRL(s) - CSR_XMTRC(s)) *
             (BCR_SWSTYLE(s) ? 16 : 8 );
         int bad = 0;
@@ -965,14 +965,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) = tmd.tmd1.bcnt;
         CSR_CXST(s) = ((uint32_t *)&tmd)[1] >> 16;
     } else {
         CSR_CXBC(s) = CSR_CXST(s) = 0;
     }
-    
+
     return !!(CSR_CXST(s) & 0x8000);
 }
 
@@ -981,7 +981,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;
 
@@ -1011,8 +1011,8 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
         size = MIN_BUF_SIZE;
     }
 
-    if (CSR_PROM(s) 
-        || (is_padr=padr_match(s, buf, size)) 
+    if (CSR_PROM(s)
+        || (is_padr=padr_match(s, buf, size))
         || (is_bcast=padr_bcast(s, buf, size))
         || (is_ladr=ladr_match(s, buf, size))) {
 
@@ -1028,10 +1028,10 @@ 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));                  
-                if (rmd.rmd1.own) {                
+                RMDLOAD(&rmd, PHYSADDR(s,nrda));
+                if (rmd.rmd1.own) {
 #ifdef PCNET_DEBUG_RMD
-                    printf("pcnet - scan buffer: RCVRC=%d PREV_RCVRC=%d\n", 
+                    printf("pcnet - scan buffer: RCVRC=%d PREV_RCVRC=%d\n",
                                 rcvrc, CSR_RCVRC(s));
 #endif
                     CSR_RCVRC(s) = rcvrc;
@@ -1054,7 +1054,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;
@@ -1071,7 +1071,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++);
                 }
@@ -1112,7 +1112,7 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
                             PCNET_RECV_STORE();
                         }
                     }
-                }                
+                }
             }
 
 #undef PCNET_RECV_STORE
@@ -1132,27 +1132,27 @@ static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
             s->csr[0] |= 0x0400;
 
 #ifdef PCNET_DEBUG
-            printf("RCVRC=%d CRDA=0x%08x BLKS=%d\n", 
+            printf("RCVRC=%d CRDA=0x%08x BLKS=%d\n",
                 CSR_RCVRC(s), PHYSADDR(s,CSR_CRDA(s)), pktcount);
 #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)
@@ -1160,7 +1160,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;
@@ -1172,30 +1172,30 @@ static void pcnet_transmit(PCNetState *s)
     if (pcnet_tdte_poll(s)) {
         struct pcnet_TMD tmd;
 
-        TMDLOAD(&tmd, PHYSADDR(s,CSR_CXDA(s)));                
+        TMDLOAD(&tmd, PHYSADDR(s,CSR_CXDA(s)));
 
 #ifdef PCNET_DEBUG_TMD
         printf("  TMDLOAD 0x%08x\n", PHYSADDR(s,CSR_CXDA(s)));
         PRINT_TMD(&tmd);
 #endif
         if (tmd.tmd1.stp) {
-            s->xmit_pos = 0;                
+            s->xmit_pos = 0;
             if (!tmd.tmd1.enp) {
                 s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tmd0.tbadr),
-                                 s->buffer, 4096 - tmd.tmd1.bcnt, 
+                                 s->buffer, 4096 - tmd.tmd1.bcnt,
                                  CSR_BSWP(s));
                 s->xmit_pos += 4096 - tmd.tmd1.bcnt;
-            } 
+            }
             xmit_cxda = PHYSADDR(s,CSR_CXDA(s));
         }
         if (tmd.tmd1.enp && (s->xmit_pos >= 0)) {
             s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tmd0.tbadr),
-                             s->buffer + s->xmit_pos, 4096 - tmd.tmd1.bcnt, 
+                             s->buffer + s->xmit_pos, 4096 - tmd.tmd1.bcnt,
                              CSR_BSWP(s));
             s->xmit_pos += 4096 - tmd.tmd1.bcnt;
 #ifdef PCNET_DEBUG
             printf("pcnet_transmit size=%d\n", s->xmit_pos);
-#endif            
+#endif
             if (CSR_LOOP(s))
                 pcnet_receive(s, s->buffer, s->xmit_pos);
             else
@@ -1218,10 +1218,10 @@ static void pcnet_transmit(PCNetState *s)
         if (count--)
             goto txagain;
 
-    } else 
+    } else
     if (s->xmit_pos >= 0) {
         struct pcnet_TMD tmd;
-        TMDLOAD(&tmd, PHYSADDR(s,xmit_cxda));                
+        TMDLOAD(&tmd, PHYSADDR(s,xmit_cxda));
         tmd.tmd2.buff = tmd.tmd2.uflo = tmd.tmd1.err = 1;
         tmd.tmd1.own = 0;
         TMDSTORE(&tmd, PHYSADDR(s,xmit_cxda));
@@ -1242,7 +1242,7 @@ static void pcnet_poll(PCNetState *s)
         pcnet_rdte_poll(s);
     }
 
-    if (CSR_TDMD(s) || 
+    if (CSR_TDMD(s) ||
         (CSR_TXON(s) && !CSR_DPOLL(s) && pcnet_tdte_poll(s)))
     {
         /* prevent recursion */
@@ -1263,7 +1263,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;
@@ -1277,7 +1277,7 @@ static void pcnet_poll_timer(void *opaque)
             } else
                 CSR_POLL(s) = t;
         }
-        qemu_mod_timer(s->poll_timer, 
+        qemu_mod_timer(s->poll_timer,
             pcnet_get_next_poll_time(s,qemu_get_clock(vm_clock)));
     }
 }
@@ -1310,7 +1310,7 @@ static void pcnet_csr_writew(PCNetState *s, uint32_t rap, uint32_t new_value)
         if (!CSR_STRT(s) && (val & 2))
             pcnet_start(s);
 
-        if (CSR_TDMD(s)) 
+        if (CSR_TDMD(s))
             pcnet_transmit(s);
 
         return;
@@ -1365,11 +1365,11 @@ static void pcnet_csr_writew(PCNetState *s, uint32_t rap, uint32_t new_value)
     case 3:
         break;
     case 4:
-        s->csr[4] &= ~(val & 0x026a); 
+        s->csr[4] &= ~(val & 0x026a);
         val &= ~0x026a; val |= s->csr[4] & 0x026a;
         break;
     case 5:
-        s->csr[5] &= ~(val & 0x0a90); 
+        s->csr[5] &= ~(val & 0x0a90);
         val &= ~0x0a90; val |= s->csr[5] & 0x0a90;
         break;
     case 16:
@@ -1522,11 +1522,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)
 {
@@ -1615,7 +1615,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);
 }
@@ -1625,7 +1625,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);
@@ -1649,7 +1649,7 @@ static uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr)
     return val;
 }
 
-static void pcnet_ioport_map(PCIDevice *pci_dev, int region_num, 
+static void pcnet_ioport_map(PCIDevice *pci_dev, int region_num,
                              uint32_t addr, uint32_t size, int type)
 {
     PCNetState *d = (PCNetState *)pci_dev;
@@ -1660,7 +1660,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);
@@ -1677,7 +1677,7 @@ static void pcnet_mmio_writeb(void *opaque, target_phys_addr_t addr, uint32_t va
         pcnet_aprom_writeb(d, addr & 0x0f, val);
 }
 
-static uint32_t pcnet_mmio_readb(void *opaque, target_phys_addr_t addr) 
+static uint32_t pcnet_mmio_readb(void *opaque, target_phys_addr_t addr)
 {
     PCNetState *d = opaque;
     uint32_t val = -1;
@@ -1704,7 +1704,7 @@ static void pcnet_mmio_writew(void *opaque, target_phys_addr_t addr, uint32_t va
     }
 }
 
-static uint32_t pcnet_mmio_readw(void *opaque, target_phys_addr_t addr) 
+static uint32_t pcnet_mmio_readw(void *opaque, target_phys_addr_t addr)
 {
     PCNetState *d = opaque;
     uint32_t val = -1;
@@ -1739,7 +1739,7 @@ static void pcnet_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t va
     }
 }
 
-static uint32_t pcnet_mmio_readl(void *opaque, target_phys_addr_t addr) 
+static uint32_t pcnet_mmio_readl(void *opaque, target_phys_addr_t addr)
 {
     PCNetState *d = opaque;
     uint32_t val;
@@ -1828,9 +1828,9 @@ static void pcnet_common_init(PCNetState *d, NICInfo *nd, const char *info_str)
 
     d->nd = nd;
 
-    d->vc = qemu_new_vlan_client(nd->vlan, pcnet_receive, 
+    d->vc = qemu_new_vlan_client(nd->vlan, pcnet_receive,
                                  pcnet_can_receive, d);
-    
+
     snprintf(d->vc->info_str, sizeof(d->vc->info_str),
              "pcnet macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
              d->nd->macaddr[0],
@@ -1858,7 +1858,7 @@ static CPUReadMemoryFunc *pcnet_mmio_read[] = {
     (CPUReadMemoryFunc *)&pcnet_mmio_readl
 };
 
-static void pcnet_mmio_map(PCIDevice *pci_dev, int region_num, 
+static void pcnet_mmio_map(PCIDevice *pci_dev, int region_num,
                             uint32_t addr, uint32_t size, int type)
 {
     PCNetState *d = (PCNetState *)pci_dev;
@@ -1895,28 +1895,28 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn)
     uint8_t *pci_conf;
 
 #if 0
-    printf("sizeof(RMD)=%d, sizeof(TMD)=%d\n", 
+    printf("sizeof(RMD)=%d, sizeof(TMD)=%d\n",
         sizeof(struct pcnet_RMD), sizeof(struct pcnet_TMD));
 #endif
 
     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[0x04] = cpu_to_le16(0x0007); 
+    *(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;
     pci_conf[0x09] = 0x00;
-    pci_conf[0x0a] = 0x00; // ethernet network controller 
+    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;
@@ -1925,12 +1925,12 @@ void pci_pcnet_init(PCIBus *bus, NICInfo *nd, int devfn)
     d->mmio_index =
       cpu_register_io_memory(0, pcnet_mmio_read, pcnet_mmio_write, d);
 
-    pci_register_io_region((PCIDevice *)d, 0, PCNET_IOPORT_SIZE, 
+    pci_register_io_region((PCIDevice *)d, 0, PCNET_IOPORT_SIZE,
                            PCI_ADDRESS_SPACE_IO, pcnet_ioport_map);
-                           
-    pci_register_io_region((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE, 
+
+    pci_register_io_region((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE,
                            PCI_ADDRESS_SPACE_MEM, pcnet_mmio_map);
-                           
+
     d->set_irq_cb = pcnet_pci_set_irq_cb;
     d->phys_mem_read = pci_physical_memory_read;
     d->phys_mem_write = pci_physical_memory_write;
index 0db8b564543473707a1034c3be5532affa5e9b2a..ac9e4c1a2dc5847cb05a15878aa7158f21669bdc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  CFI parallel flash with AMD command set emulation
- * 
+ *
  *  Copyright (c) 2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
@@ -185,7 +185,7 @@ static uint32_t pflash_read (pflash_t *pfl, target_ulong offset, int width)
 }
 
 /* update flash content on disk */
-static void pflash_update(pflash_t *pfl, int offset, 
+static void pflash_update(pflash_t *pfl, int offset,
                           int size)
 {
     int offset_end;
@@ -194,7 +194,7 @@ static void pflash_update(pflash_t *pfl, int offset,
         /* round to sectors */
         offset = offset >> 9;
         offset_end = (offset_end + 511) >> 9;
-        bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9), 
+        bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9),
                    offset_end - offset);
     }
 }
@@ -212,7 +212,7 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value,
         offset -= (target_ulong)(long)pfl->storage;
     else
         offset -= pfl->base;
-        
+
     cmd = value;
     DPRINTF("%s: offset %08x %08x %d\n", __func__, offset, value, width);
     if (pfl->cmd != 0xA0 && cmd == 0xF0) {
@@ -362,7 +362,7 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value,
             pfl->status = 0x00;
             pflash_update(pfl, 0, pfl->total_len);
             /* Let's wait 5 seconds before chip erase is done */
-            qemu_mod_timer(pfl->timer, 
+            qemu_mod_timer(pfl->timer,
                            qemu_get_clock(vm_clock) + (ticks_per_sec * 5));
             break;
         case 0x30:
@@ -374,7 +374,7 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value,
             pflash_update(pfl, offset, pfl->sector_len);
             pfl->status = 0x00;
             /* Let's wait 1/2 second before sector erase is done */
-            qemu_mod_timer(pfl->timer, 
+            qemu_mod_timer(pfl->timer,
                            qemu_get_clock(vm_clock) + (ticks_per_sec / 2));
             break;
         default:
@@ -518,7 +518,7 @@ static int ctz32 (uint32_t n)
 pflash_t *pflash_register (target_ulong base, ram_addr_t off,
                            BlockDriverState *bs,
                            target_ulong sector_len, int nb_blocs, int width,
-                           uint16_t id0, uint16_t id1, 
+                           uint16_t id0, uint16_t id1,
                            uint16_t id2, uint16_t id3)
 {
     pflash_t *pfl;
index 1b16652bc0d9ad2eaa3b3a7920fb3ef1b3d570a0..629b86fc541df95c3f9f8472bd4c7607f46dfbec 100644 (file)
@@ -2,7 +2,7 @@
  * QEMU i440FX/PIIX3 PCI Bridge Emulation
  *
  * Copyright (c) 2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -63,19 +63,19 @@ static void update_pam(PCIDevice *d, uint32_t start, uint32_t end, int r)
     switch(r) {
     case 3:
         /* RAM */
-        cpu_register_physical_memory(start, end - start, 
+        cpu_register_physical_memory(start, end - start,
                                      start);
         break;
     case 1:
         /* ROM (XXX: not quite correct) */
-        cpu_register_physical_memory(start, end - start, 
+        cpu_register_physical_memory(start, end - start,
                                      start | IO_MEM_ROM);
         break;
     case 2:
     case 0:
         /* XXX: should distinguish read/write cases */
         for(addr = start; addr < end; addr += 4096) {
-            cpu_register_physical_memory(addr, 4096, 
+            cpu_register_physical_memory(addr, 4096,
                                          isa_page_descs[(addr - 0xa0000) >> 12]);
         }
         break;
@@ -97,7 +97,7 @@ static void i440fx_update_memory_mappings(PCIDevice *d)
         cpu_register_physical_memory(0xa0000, 0x20000, 0xa0000);
     } else {
         for(addr = 0xa0000; addr < 0xc0000; addr += 4096) {
-            cpu_register_physical_memory(addr, 4096, 
+            cpu_register_physical_memory(addr, 4096,
                                          isa_page_descs[(addr - 0xa0000) >> 12]);
         }
     }
@@ -124,7 +124,7 @@ void i440fx_init_memory_mappings(PCIDevice *d)
     }
 }
 
-static void i440fx_write_config(PCIDevice *d, 
+static void i440fx_write_config(PCIDevice *d,
                                 uint32_t address, uint32_t val, int len)
 {
     /* XXX: implement SMRAM.D_LOCK */
@@ -175,7 +175,7 @@ PCIBus *i440fx_init(PCIDevice **pi440fx_state)
     register_ioport_read(0xcfc, 4, 2, pci_host_data_readw, s);
     register_ioport_read(0xcfc, 4, 4, pci_host_data_readl, s);
 
-    d = pci_register_device(b, "i440FX", sizeof(PCIDevice), 0, 
+    d = pci_register_device(b, "i440FX", sizeof(PCIDevice), 0,
                             NULL, i440fx_write_config);
 
     d->config[0x00] = 0x86; // vendor_id
index fb7ab7b53d8d6aa87b4883eb3b734508f7d51ffe..31cd5d5199e29caaf0bde0c8b611c7ac64b50ae8 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Arm PrimeCell PL011 UART
  *
  * Copyright (c) 2006 CodeSourcery.
@@ -45,7 +45,7 @@ static const unsigned char pl011_id[] =
 static void pl011_update(pl011_state *s)
 {
     uint32_t flags;
-    
+
     flags = s->int_level & s->int_enabled;
     pic_set_irq_new(s->pic, s->irq, flags != 0);
 }
@@ -242,7 +242,7 @@ void pl011_init(uint32_t base, void *pic, int irq,
     s->ifl = 0x12;
     s->cr = 0x300;
     s->flags = 0x90;
-    if (chr){ 
+    if (chr){
         qemu_chr_add_handlers(chr, pl011_can_recieve, pl011_recieve,
                               pl011_event, s);
     }
index 20451e532ec4fd7996fca2a617429e265566af33..40d8df3731aa1c8ad9c7d0dae5b522db1ecb30a1 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Arm PrimeCell PL050 Keyboard / Mouse Interface
  *
  * Copyright (c) 2006 CodeSourcery.
index 549b3bfd1066ce673fcea05c8e9cc3795b630b8a..819344b3ac14fda4eada53a51968cf65adcbde0c 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Arm PrimeCell PL080/PL081 DMA controller
  *
  * Copyright (c) 2006 CodeSourcery.
@@ -112,7 +112,7 @@ again:
                 continue;
             flow = (ch->conf >> 11) & 7;
             if (flow >= 4) {
-                cpu_abort(cpu_single_env, 
+                cpu_abort(cpu_single_env,
                     "pl080_run: Peripheral flow control not implemented\n");
             }
             src_id = (ch->conf >> 1) & 0x1f;
index 16de16c0dd7e78f3f6f5202bcecd46f6d1123a05..25ddc666a4e325834734df97e6b95682f021cd14 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Arm PrimeCell PL110 Color LCD Controller
  *
  * Copyright (c) 2005-2006 CodeSourcery.
@@ -118,7 +118,7 @@ static void pl110_update_display(void *opaque)
 
     if (!pl110_enabled(s))
         return;
-    
+
     switch (s->ds->depth) {
     case 0:
         return;
@@ -152,7 +152,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:
index ed533aca1905100b82fe6ed9f0a123ec0d0dff61..f7cb1f49523cc67034cfb25cb0ce914ebf1874f2 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Arm PrimeCell PL110 Color LCD Controller
  *
  * Copyright (c) 2005 CodeSourcery, LLC.
@@ -15,7 +15,7 @@
 #define COPY_PIXEL(to, from) *(to++) = from
 #elif BITS == 15 || BITS == 16
 #define COPY_PIXEL(to, from) *(uint16_t *)to = from; to += 2;
-#elif BITS == 24 
+#elif BITS == 24
 #define COPY_PIXEL(to, from) \
   *(to++) = from; *(to++) = (from) >> 8; *(to++) = (from) >> 16
 #elif BITS == 32
index 55c7180f5ad2d4c2e6a33048db3420835c7ba3f6..6a13b334e5c1be9f0d24381219d4ca41f90c7de6 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Arm PrimeCell PL190 Vector Interrupt Controller
  *
  * Copyright (c) 2006 CodeSourcery.
index b0865c1646fb144fcdc4b259941417ec60cccd71..76c8a13fe42e7ba936715e8953faf420f263155d 100644 (file)
--- a/hw/ppc.c
+++ b/hw/ppc.c
@@ -1,8 +1,8 @@
 /*
  * QEMU generic PPC hardware System Emulator
- * 
+ *
  * Copyright (c) 2003-2004 Jocelyn Mayer
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
index 1e0fd2e9da73f5ef2e31a61b6df73cbdd95f0fa8..81b02b1555d34c1f0a4b7872a361d122d00854a1 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU PPC CHRP/PMAC hardware System Emulator
- * 
+ *
  * Copyright (c) 2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -126,16 +126,16 @@ static MacIONVRAMState *macio_nvram_init(void)
     s = qemu_mallocz(sizeof(MacIONVRAMState));
     if (!s)
         return NULL;
-    macio_nvram_mem_index = cpu_register_io_memory(0, macio_nvram_read, 
+    macio_nvram_mem_index = cpu_register_io_memory(0, macio_nvram_read,
                                                    macio_nvram_write, s);
     return s;
 }
 
-static void macio_map(PCIDevice *pci_dev, int region_num, 
+static void macio_map(PCIDevice *pci_dev, int region_num,
                       uint32_t addr, uint32_t size, int type)
 {
     if (heathrow_pic_mem_index >= 0) {
-        cpu_register_physical_memory(addr + 0x00000, 0x1000, 
+        cpu_register_physical_memory(addr + 0x00000, 0x1000,
                                      heathrow_pic_mem_index);
     }
     cpu_register_physical_memory(addr + 0x08000, 0x1000, dbdma_mem_index);
@@ -145,7 +145,7 @@ static void macio_map(PCIDevice *pci_dev, int region_num,
     if (ide1_mem_index >= 0)
         cpu_register_physical_memory(addr + 0x20000, 0x1000, ide1_mem_index);
     if (openpic_mem_index >= 0) {
-        cpu_register_physical_memory(addr + 0x40000, 0x40000, 
+        cpu_register_physical_memory(addr + 0x40000, 0x40000,
                                      openpic_mem_index);
     }
     if (macio_nvram_mem_index >= 0)
@@ -170,10 +170,10 @@ 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, 
+    pci_register_io_region(d, 0, 0x80000,
                            PCI_ADDRESS_SPACE_MEM, macio_map);
 }
 
@@ -205,7 +205,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
@@ -226,7 +226,7 @@ static int vga_osi_call(CPUState *env)
                 break;
             }
         }
-        env->gpr[3] = 0; 
+        env->gpr[3] = 0;
         env->gpr[4] = (1 << 16) | 1; /* num_vmodes, cur_vmode */
         env->gpr[5] = (1 << 16) | 0; /* num_depths, cur_depth_mode */
         env->gpr[6] = (graphic_width << 16) | graphic_height; /* w, h */
@@ -252,7 +252,7 @@ static int vga_osi_call(CPUState *env)
         break;
     case 64: /* get color */
         /* R6 = index */
-        env->gpr[3] = 0; 
+        env->gpr[3] = 0;
         break;
     case 116: /* set hwcursor */
         /* R6 = x, R7 = y, R8 = visible, R9 = data */
@@ -282,20 +282,20 @@ 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,
-                          DisplayState *ds, const char **fd_filename, 
+                          DisplayState *ds, const char **fd_filename,
                           int snapshot,
-                          const char *kernel_filename, 
+                          const char *kernel_filename,
                           const char *kernel_cmdline,
                           const char *initrd_filename,
                           int is_heathrow)
@@ -343,7 +343,7 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
 
     /* Set time-base frequency to 100 Mhz */
     cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
-    
+
     env->osi_call = vga_osi_call;
 
     /* allocate RAM */
@@ -358,9 +358,9 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
         exit(1);
     }
     bios_size = (bios_size + 0xfff) & ~0xfff;
-    cpu_register_physical_memory((uint32_t)(-bios_size), 
+    cpu_register_physical_memory((uint32_t)(-bios_size),
                                  bios_size, bios_offset | IO_MEM_ROM);
-    
+
     /* allocate and load VGA BIOS */
     vga_bios_offset = bios_offset + bios_size;
     snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
@@ -376,18 +376,18 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
         phys_ram_base[vga_bios_offset + 1] = 'D';
         phys_ram_base[vga_bios_offset + 2] = 'R';
         phys_ram_base[vga_bios_offset + 3] = 'V';
-        cpu_to_be32w((uint32_t *)(phys_ram_base + vga_bios_offset + 4), 
+        cpu_to_be32w((uint32_t *)(phys_ram_base + vga_bios_offset + 4),
                      vga_bios_size);
         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 */
         kernel_size = load_image(kernel_filename, phys_ram_base + kernel_base);
         if (kernel_size < 0) {
-            fprintf(stderr, "qemu: could not load kernel '%s'\n", 
+            fprintf(stderr, "qemu: could not load kernel '%s'\n",
                     kernel_filename);
             exit(1);
         }
@@ -397,7 +397,7 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
             initrd_size = load_image(initrd_filename,
                                      phys_ram_base + initrd_base);
             if (initrd_size < 0) {
-                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", 
+                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
                         initrd_filename);
                 exit(1);
             }
@@ -415,7 +415,7 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
 
     if (is_heathrow) {
         isa_mem_base = 0x80000000;
-        
+
         /* Register 2 MB of ISA IO space */
         isa_mmio_init(0xfe000000, 0x00200000);
 
@@ -423,30 +423,30 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
         pic = heathrow_pic_init(&heathrow_pic_mem_index);
         set_irq = heathrow_pic_set_irq;
         pci_bus = pci_grackle_init(0xfec00000, pic);
-        pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, 
+        pci_vga_init(pci_bus, ds, phys_ram_base + ram_size,
                      ram_size, vga_ram_size,
                      vga_bios_offset, vga_bios_size);
 
         /* XXX: suppress that */
         isa_pic = pic_init(pic_irq_request, NULL);
-        
+
         /* XXX: use Mac Serial port */
         serial_init(&pic_set_irq_new, isa_pic, 0x3f8, 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(set_irq, pic, 0x12);
-        
+
         adb_kbd_init(&adb_bus);
         adb_mouse_init(&adb_bus);
-        
+
         {
             MacIONVRAMState *nvr;
             nvr = macio_nvram_init();
@@ -454,16 +454,16 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
         }
 
         macio_init(pci_bus, 0x0017);
-        
+
         nvram = m48t59_init(8, 0xFFF04000, 0x0074, NVRAM_SIZE, 59);
-        
+
         arch_name = "HEATHROW";
     } else {
         isa_mem_base = 0x80000000;
-        
+
         /* Register 8 MB of ISA IO space */
         isa_mmio_init(0xf2000000, 0x00800000);
-        
+
         /* UniN init */
         unin_memory = cpu_register_io_memory(0, unin_read, unin_write, NULL);
         cpu_register_physical_memory(0xf8000000, 0x00001000, unin_memory);
@@ -478,14 +478,14 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
 
         /* XXX: suppress that */
         isa_pic = pic_init(pic_irq_request, NULL);
-        
+
         /* XXX: use Mac Serial port */
         serial_init(&pic_set_irq_new, isa_pic, 0x3f8, 4, serial_hds[0]);
-        
+
         for(i = 0; i < nb_nics; i++) {
             pci_ne2000_init(pci_bus, &nd_table[i], -1);
         }
-        
+
 #if 1
         ide0_mem_index = pmac_ide_init(&bs_table[0], set_irq, pic, 0x13);
         ide1_mem_index = pmac_ide_init(&bs_table[2], set_irq, pic, 0x14);
@@ -494,14 +494,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(set_irq, pic, 0x19);
-        
+
         adb_kbd_init(&adb_bus);
         adb_mouse_init(&adb_bus);
-        
+
         macio_init(pci_bus, 0x0022);
-        
+
         nvram = m48t59_init(8, 0xFFF04000, 0x0074, NVRAM_SIZE, 59);
-        
+
         arch_name = "MAC99";
     }
 
@@ -526,9 +526,9 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
 }
 
 static void ppc_core99_init(int ram_size, int vga_ram_size, int boot_device,
-                            DisplayState *ds, const char **fd_filename, 
+                            DisplayState *ds, const char **fd_filename,
                             int snapshot,
-                            const char *kernel_filename, 
+                            const char *kernel_filename,
                             const char *kernel_cmdline,
                             const char *initrd_filename)
 {
@@ -537,11 +537,11 @@ static void ppc_core99_init(int ram_size, int vga_ram_size, int boot_device,
                   kernel_filename, kernel_cmdline,
                   initrd_filename, 0);
 }
-    
+
 static void ppc_heathrow_init(int ram_size, int vga_ram_size, int boot_device,
-                              DisplayState *ds, const char **fd_filename, 
+                              DisplayState *ds, const char **fd_filename,
                               int snapshot,
-                              const char *kernel_filename, 
+                              const char *kernel_filename,
                               const char *kernel_cmdline,
                               const char *initrd_filename)
 {
index c4b7ff5baa3af127d1b1b3b87b1146cc1da682c6..209901d84057d3279fd9cfd203120b92da7849a3 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU PPC PREP hardware System Emulator
- * 
+ *
  * Copyright (c) 2003-2004 Jocelyn Mayer
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -538,12 +538,12 @@ static void ppc_prep_init(int ram_size, int vga_ram_size, int boot_device,
        return;
 
     linux_boot = (kernel_filename != NULL);
-    
+
     /* init CPUs */
 
     env = cpu_init();
     register_savevm("cpu", 0, 3, cpu_save, cpu_load, env);
-    
+
     /* Register CPU as a 604 */
     /* XXX: CPU model (or PVR) should be provided on command line */
     //    ppc_find_by_name("604r", &def);
@@ -568,7 +568,7 @@ static void ppc_prep_init(int ram_size, int vga_ram_size, int boot_device,
         exit(1);
     }
     bios_size = (bios_size + 0xfff) & ~0xfff;
-    cpu_register_physical_memory((uint32_t)(-bios_size), 
+    cpu_register_physical_memory((uint32_t)(-bios_size),
                                  bios_size, bios_offset | IO_MEM_ROM);
 
     if (linux_boot) {
@@ -576,7 +576,7 @@ static void ppc_prep_init(int ram_size, int vga_ram_size, int boot_device,
         /* now we can load the kernel */
         kernel_size = load_image(kernel_filename, phys_ram_base + kernel_base);
         if (kernel_size < 0) {
-            fprintf(stderr, "qemu: could not load kernel '%s'\n", 
+            fprintf(stderr, "qemu: could not load kernel '%s'\n",
                     kernel_filename);
             exit(1);
         }
@@ -586,7 +586,7 @@ static void ppc_prep_init(int ram_size, int vga_ram_size, int boot_device,
             initrd_size = load_image(initrd_filename,
                                      phys_ram_base + initrd_base);
             if (initrd_size < 0) {
-                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", 
+                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
                         initrd_filename);
                 exit(1);
             }
@@ -611,7 +611,7 @@ static void ppc_prep_init(int ram_size, int vga_ram_size, int boot_device,
     cpu_register_physical_memory(0x80000000, 0x00800000, PPC_io_memory);
 
     /* init basic PC hardware */
-    pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, ram_size, 
+    pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, ram_size,
                  vga_ram_size, 0, 0);
     rtc_init(0x70, 8);
     //    openpic = openpic_init(0x00000000, 0xF0000000, 1);
index 3d93c065ff3dd2a3d0bfa2fd365db7b4857f2322..83737e2912cde7ad16f4bf3cde247d2b61012f6b 100644 (file)
@@ -2,7 +2,7 @@
  * QEMU PREP PCI host
  *
  * Copyright (c) 2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -147,12 +147,12 @@ PCIBus *pci_prep_init(void)
     register_ioport_read(0xcfc, 4, 2, pci_host_data_readw, s);
     register_ioport_read(0xcfc, 4, 4, pci_host_data_readl, s);
 
-    PPC_io_memory = cpu_register_io_memory(0, PPC_PCIIO_read, 
+    PPC_io_memory = cpu_register_io_memory(0, PPC_PCIIO_read,
                                            PPC_PCIIO_write, s);
     cpu_register_physical_memory(0x80800000, 0x00400000, PPC_io_memory);
 
-    /* PCI host bridge */ 
-    d = pci_register_device(s->bus, "PREP Host Bridge - Motorola Raven", 
+    /* PCI host bridge */
+    d = pci_register_device(s->bus, "PREP Host Bridge - Motorola Raven",
                             sizeof(PCIDevice), 0, NULL, NULL);
     d->config[0x00] = 0x57; // vendor_id : Motorola
     d->config[0x01] = 0x10;
index 3794c603662b2f49c9c9e723ff671b3d6d137030..f008083e99b867d8f961e379f988db2bbad43739 100644 (file)
--- a/hw/ps2.c
+++ b/hw/ps2.c
@@ -1,8 +1,8 @@
 /*
  * QEMU PS/2 keyboard/mouse emulation
- * 
+ *
  * Copyright (c) 2003 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -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
@@ -294,7 +294,7 @@ static void ps2_mouse_send_packet(PS2MouseState *s)
     s->mouse_dz -= dz1;
 }
 
-static void ps2_mouse_event(void *opaque, 
+static void ps2_mouse_event(void *opaque,
                             int dx, int dy, int dz, int buttons_state)
 {
     PS2MouseState *s = opaque;
@@ -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(;;) {
@@ -429,12 +429,12 @@ void ps2_write_mouse(void *opaque, int val)
                 s->mouse_detect_state = 0;
             break;
         case 2:
-            if (val == 80) 
+            if (val == 80)
                 s->mouse_type = 3; /* IMPS/2 */
             s->mouse_detect_state = 0;
             break;
         case 3:
-            if (val == 80) 
+            if (val == 80)
                 s->mouse_type = 4; /* IMEX */
             s->mouse_detect_state = 0;
             break;
index ea42705adb4433e69d291d1ea76bc6f393aa969f..c247f9a47558e335f3e32d167bd822d060b13391 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * ARM RealView Baseboard System emulation.
  *
  * Copyright (c) 2006 CodeSourcery.
index 94fc2fca3b13a774e4e93751d97b11f622060366..93d3ac5baaa1832439ddf435de80b6444fccaa1c 100644 (file)
@@ -1,8 +1,8 @@
 /**
  * QEMU RTL8139 emulation
- * 
+ *
  * Copyright (c) 2006 Igor Kovalenko
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
+
  * Modifications:
  *  2006-Jan-28  Mark Malakanov :   TSAD and CSCR implementation (for Windows driver)
- * 
+ *
  *  2006-Apr-28  Juergen Lock   :   EEPROM emulation changes for FreeBSD driver
  *                                  HW revision ID changes for FreeBSD driver
- * 
+ *
  *  2006-Jul-01  Igor Kovalenko :   Implemented loopback mode for FreeBSD driver
  *                                  Corrected packet transfer reassembly routine for 8139C+ mode
  *                                  Rearranged debugging print statements
@@ -306,11 +306,11 @@ enum CSCRBits {
     CSCR_LinkDownCmd = 0x0f3c0,
 */
 enum CSCRBits {
-    CSCR_Testfun = 1<<15, /* 1 = Auto-neg speeds up internal timer, WO, def 0 */ 
+    CSCR_Testfun = 1<<15, /* 1 = Auto-neg speeds up internal timer, WO, def 0 */
     CSCR_LD  = 1<<9,  /* Active low TPI link disable signal. When low, TPI still transmits link pulses and TPI stays in good link state. def 1*/
     CSCR_HEART_BIT = 1<<8,  /* 1 = HEART BEAT enable, 0 = HEART BEAT disable. HEART BEAT function is only valid in 10Mbps mode. def 1*/
     CSCR_JBEN = 1<<7,  /* 1 = enable jabber function. 0 = disable jabber function, def 1*/
-    CSCR_F_LINK_100 = 1<<6, /* Used to login force good link in 100Mbps for diagnostic purposes. 1 = DISABLE, 0 = ENABLE. def 1*/ 
+    CSCR_F_LINK_100 = 1<<6, /* Used to login force good link in 100Mbps for diagnostic purposes. 1 = DISABLE, 0 = ENABLE. def 1*/
     CSCR_F_Connect  = 1<<5,  /* Assertion of this bit forces the disconnect function to be bypassed. def 0*/
     CSCR_Con_status = 1<<3, /* This bit indicates the status of the connection. 1 = valid connected link detected; 0 = disconnected link detected. RO def 0*/
     CSCR_Con_status_En = 1<<2, /* Assertion of this bit configures LED1 pin to indicate connection status. def 0*/
@@ -821,7 +821,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
     uint32_t packet_header = 0;
 
     uint8_t buf1[60];
-    static const uint8_t broadcast_macaddr[6] = 
+    static const uint8_t broadcast_macaddr[6] =
         { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
     DEBUG_PRINT((">>> RTL8139: received len=%d\n", size));
@@ -898,10 +898,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))
@@ -1230,7 +1230,7 @@ static void rtl8139_reset(RTL8139State *s)
     s->Config3 = 0x1; /* fast back-to-back compatible */
     s->Config5 = 0x0;
 
-    s->CSCR = CSCR_F_LINK_100 | CSCR_HEART_BIT | CSCR_LD; 
+    s->CSCR = CSCR_F_LINK_100 | CSCR_HEART_BIT | CSCR_LD;
 
     s->CpCmd   = 0x0; /* reset C+ mode */
 
@@ -2425,17 +2425,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));
 
@@ -3319,7 +3319,7 @@ typedef struct PCIRTL8139State {
     RTL8139State rtl8139;
 } PCIRTL8139State;
 
-static void rtl8139_mmio_map(PCIDevice *pci_dev, int region_num, 
+static void rtl8139_mmio_map(PCIDevice *pci_dev, int region_num,
                        uint32_t addr, uint32_t size, int type)
 {
     PCIRTL8139State *d = (PCIRTL8139State *)pci_dev;
@@ -3328,7 +3328,7 @@ static void rtl8139_mmio_map(PCIDevice *pci_dev, int region_num,
     cpu_register_physical_memory(addr + 0, 0x100, s->rtl8139_mmio_io_addr);
 }
 
-static void rtl8139_ioport_map(PCIDevice *pci_dev, int region_num, 
+static void rtl8139_ioport_map(PCIDevice *pci_dev, int region_num,
                        uint32_t addr, uint32_t size, int type)
 {
     PCIRTL8139State *d = (PCIRTL8139State *)pci_dev;
@@ -3358,7 +3358,7 @@ static CPUWriteMemoryFunc *rtl8139_mmio_write[3] = {
 
 static inline int64_t rtl8139_get_next_tctr_time(RTL8139State *s, int64_t current_time)
 {
-    int64_t next_time = current_time + 
+    int64_t next_time = current_time +
         muldiv64(1, ticks_per_sec, PCI_FREQUENCY);
     if (next_time <= current_time)
         next_time = current_time + 1;
@@ -3404,7 +3404,7 @@ static void rtl8139_timer(void *opaque)
         rtl8139_update_irq(s);
     }
 
-    qemu_mod_timer(s->timer, 
+    qemu_mod_timer(s->timer,
         rtl8139_get_next_tctr_time(s,curr_time));
 }
 #endif /* RTL8139_ONBOARD_TIMER */
@@ -3414,10 +3414,10 @@ 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, 
+                                              devfn,
                                               NULL, NULL);
     pci_conf = d->dev.config;
     pci_conf[0x00] = 0xec; /* Realtek 8139 */
@@ -3438,10 +3438,10 @@ void pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn)
     s->rtl8139_mmio_io_addr =
     cpu_register_io_memory(0, rtl8139_mmio_read, rtl8139_mmio_write, s);
 
-    pci_register_io_region(&d->dev, 0, 0x100, 
+    pci_register_io_region(&d->dev, 0, 0x100,
                            PCI_ADDRESS_SPACE_IO,  rtl8139_ioport_map);
 
-    pci_register_io_region(&d->dev, 1, 0x100, 
+    pci_register_io_region(&d->dev, 1, 0x100,
                            PCI_ADDRESS_SPACE_MEM, rtl8139_mmio_map);
 
     s->irq = 16; /* PCI interrupt */
@@ -3463,14 +3463,14 @@ 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);
 
 #if RTL8139_ONBOARD_TIMER
     s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s);
 
-    qemu_mod_timer(s->timer, 
+    qemu_mod_timer(s->timer,
         rtl8139_get_next_tctr_time(s,qemu_get_clock(vm_clock)));
 #endif /* RTL8139_ONBOARD_TIMER */
 }
index a88aec17d15d6352cb536434a489e0f1930a9152..a7836cc61c9e8e9e9b1b7c69fec55b3387e2b2b7 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU 16450 UART emulation
- * 
+ *
  * Copyright (c) 2003-2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -121,7 +121,7 @@ static void serial_update_parameters(SerialState *s)
     } else {
             parity = 'N';
     }
-    if (s->lcr & 0x04) 
+    if (s->lcr & 0x04)
         stop_bits = 2;
     else
         stop_bits = 1;
@@ -135,7 +135,7 @@ static void serial_update_parameters(SerialState *s)
     ssp.stop_bits = stop_bits;
     qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
 #if 0
-    printf("speed=%d parity=%c data=%d stop=%d\n", 
+    printf("speed=%d parity=%c data=%d stop=%d\n",
            speed, parity, data_bits, stop_bits);
 #endif
 }
@@ -144,7 +144,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);
@@ -189,7 +189,7 @@ static void serial_ioport_write(void *opaque, uint32_t addr, uint32_t val)
             break_enable = (val >> 6) & 1;
             if (break_enable != s->last_break_enable) {
                 s->last_break_enable = break_enable;
-                qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK, 
+                qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK,
                                &break_enable);
             }
         }
@@ -217,7 +217,7 @@ static uint32_t serial_ioport_read(void *opaque, uint32_t addr)
     default:
     case 0:
         if (s->lcr & UART_LCR_DLAB) {
-            ret = s->divider & 0xff; 
+            ret = s->divider & 0xff;
         } else {
             ret = s->rbr;
             s->lsr &= ~(UART_LSR_DR | UART_LSR_BI);
index 164ce716236e720a1bde599535a6e2c4bdc373a8..dcba14e1af3b42f85c78dda55b537066501d16d8 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * SH7750 device
- * 
+ *
  * Copyright (c) 2005 Samuel Tardieu
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
index 44ae95be2bd80c4f7591f60e01177d6de63e26c7..6b18ad2e1596968c24f9080a4453b9a23e0e8fc6 100644 (file)
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
  *  http://www.rtems.com/license/LICENSE.
- * 
+ *
  * @(#) sh7750_regs.h,v 1.2.4.1 2003/09/04 18:46:00 joel Exp
  */
 
 #ifndef __SH7750_REGS_H__
 #define __SH7750_REGS_H__
 
-/* 
- * All register has 2 addresses: in 0xff000000 - 0xffffffff (P4 address)  and 
+/*
+ * All register has 2 addresses: in 0xff000000 - 0xffffffff (P4 address)  and
  * in 0x1f000000 - 0x1fffffff (area 7 address)
  */
-#define SH7750_P4_BASE       0xff000000        /* Accessable only in 
+#define SH7750_P4_BASE       0xff000000        /* Accessable only in
                                           priveleged mode */
 #define SH7750_A7_BASE       0x1f000000        /* Accessable only using TLB */
 
 #define SH7750_P4_REG32(ofs) (SH7750_P4_BASE + (ofs))
 #define SH7750_A7_REG32(ofs) (SH7750_A7_BASE + (ofs))
 
-/* 
- * MMU Registers 
+/*
+ * MMU Registers
  */
 
 /* Page Table Entry High register - PTEH */
@@ -61,9 +61,9 @@
 #define SH7750_PTEL_PR_RWPO   0x00000020       /*   read-write in priv mode */
 #define SH7750_PTEL_PR_ROPU   0x00000040       /*   read-only in priv or user mode */
 #define SH7750_PTEL_PR_RWPU   0x00000060       /*   read-write in priv or user mode */
-#define SH7750_PTEL_C         0x00000008       /* Cacheability 
+#define SH7750_PTEL_C         0x00000008       /* Cacheability
                                                   (0 - page not cacheable) */
-#define SH7750_PTEL_D         0x00000004       /* Dirty bit (1 - write has been 
+#define SH7750_PTEL_D         0x00000004       /* Dirty bit (1 - write has been
                                                   performed to a page) */
 #define SH7750_PTEL_SH        0x00000002       /* Share Status bit (1 - page are
                                                   shared by processes) */
 #define SH7750_CCR_A7         SH7750_A7_REG32(SH7750_CCR_REGOFS)
 
 #define SH7750_CCR_IIX      0x00008000 /* IC index enable bit */
-#define SH7750_CCR_ICI      0x00000800 /* IC invalidation bit: 
+#define SH7750_CCR_ICI      0x00000800 /* IC invalidation bit:
                                           set it to clear IC */
 #define SH7750_CCR_ICE      0x00000100 /* IC enable bit */
 #define SH7750_CCR_OIX      0x00000080 /* OC index enable bit */
-#define SH7750_CCR_ORA      0x00000020 /* OC RAM enable bit 
-                                          if you set OCE = 0, 
+#define SH7750_CCR_ORA      0x00000020 /* OC RAM enable bit
+                                          if you set OCE = 0,
                                           you should set ORA = 0 */
 #define SH7750_CCR_OCI      0x00000008 /* OC invalidation bit */
 #define SH7750_CCR_CB       0x00000004 /* Copy-back bit for P1 area */
 
 /* Peripheral Module Interrupts - Memory Refresh Unit (REF) */
 #define SH7750_EVT_REF_RCMI            0x580   /* Compare-match Interrupt */
-#define SH7750_EVT_REF_ROVI            0x5A0   /* Refresh Counter Overflow 
+#define SH7750_EVT_REF_ROVI            0x5A0   /* Refresh Counter Overflow
                                                   interrupt */
 
 /* Peripheral Module Interrupts - Hitachi User Debug Interface (H-UDI) */
 #define SH7750_FRQCR          SH7750_P4_REG32(SH7750_FRQCR_REGOFS)
 #define SH7750_FRQCR_A7       SH7750_A7_REG32(SH7750_FRQCR_REGOFS)
 
-#define SH7750_FRQCR_CKOEN    0x0800   /* Clock Output Enable 
+#define SH7750_FRQCR_CKOEN    0x0800   /* Clock Output Enable
                                           0 - CKIO pin goes to HiZ/pullup
                                           1 - Clock is output from CKIO */
 #define SH7750_FRQCR_PLL1EN   0x0400   /* PLL circuit 1 enable */
 #define SH7750_BCR1_BREQEN    0x00080000       /* BREQ Enable:
                                                   0 - External requests are  not
                                                   accepted
-                                                  1 - External requests are 
+                                                  1 - External requests are
                                                   accepted */
 #define SH7750_BCR1_PSHR      0x00040000       /* Partial Sharing Bit:
                                                   0 - Master Mode
 #define SH7750_MCR_TCAS_1     0x00000000       /*    1 */
 #define SH7750_MCR_TCAS_2     0x00800000       /*    2 */
 
-#define SH7750_MCR_TPC        0x00380000       /* DRAM: RAS Precharge Period 
+#define SH7750_MCR_TPC        0x00380000       /* DRAM: RAS Precharge Period
                                                   SDRAM: minimum number of cycles
                                                   until the next bank active cmd
                                                   is output after precharging */
 #define SH7750_CHCR_DSA_AMEM16  0x0E000000     /* 16-bit attribute memory space */
 
 #define SH7750_CHCR_DTC       0x01000000       /* Destination Address Wait Control
-                                                  Select, specifies CS5 or CS6 
+                                                  Select, specifies CS5 or CS6
                                                   space wait control for PCMCIA
                                                   access */
 
                                                   Address Mode (External Addr
                                                   Space -> External Device) */
 #define SH7750_CHCR_RS_ER_SA_ED_TO_EA   0x300  /* External Request, Single
-                                                  Address Mode, (External 
-                                                  Device -> External Addr 
+                                                  Address Mode, (External
+                                                  Device -> External Addr
                                                   Space) */
 #define SH7750_CHCR_RS_AR_EA_TO_EA      0x400  /* Auto-Request (External Addr
                                                   Space -> External Addr Space) */
 #define SH7750_CHCR_RS_AR_EA_TO_OCP     0x500  /* Auto-Request (External Addr
                                                   Space -> On-chip Peripheral
                                                   Module) */
-#define SH7750_CHCR_RS_AR_OCP_TO_EA     0x600  /* Auto-Request (On-chip 
+#define SH7750_CHCR_RS_AR_OCP_TO_EA     0x600  /* Auto-Request (On-chip
                                                   Peripheral Module ->
                                                   External Addr Space */
 #define SH7750_CHCR_RS_SCITX_EA_TO_SC   0x800  /* SCI Transmit-Data-Empty intr
 #define SH7750_IPRC_HUDI_S    0
 
 
-/* 
+/*
  * User Break Controller registers
  */
 #define SH7750_BARA           0x200000 /* Break address regiser A */
index 9577c092c28d7208cb1757a6375d37318f7a23d6..8fd909054172d32c180283f145e0e874366cb2d3 100644 (file)
--- a/hw/shix.c
+++ b/hw/shix.c
@@ -1,8 +1,8 @@
 /*
  * SHIX 2.0 board description
- * 
+ *
  * Copyright (c) 2005 Samuel Tardieu
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -21,7 +21,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-/* 
+/*
    Shix 2.0 board by Alexis Polti, described at
    http://perso.enst.fr/~polti/realisations/shix20/
 
index 288fb50f0ab0f48b5df1c0afe5b97a75bc989b85..e27a9bfeb46d524418ebd9c3a6f01a8b9a718a35 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU Sparc SLAVIO interrupt controller emulation
- * 
+ *
  * Copyright (c) 2003-2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -40,7 +40,7 @@ do { printf("IRQ: " fmt , ##args); } while (0)
  * http://www.ibiblio.org/pub/historic-linux/early-ports/Sparc/NCR/NCR89C105.txt
  *
  * There is a system master controller and one for each cpu.
- * 
+ *
  */
 
 #define MAX_CPUS 16
@@ -250,7 +250,7 @@ static void slavio_check_interrupts(void *opaque)
     }
     else
        DPRINTF("Not triggered (pending %x), disabled %x\n", pending, s->intregm_disabled);
-    
+
     for (i = 0; i < MAX_CPUS; i++) {
         max = 0;
         env = s->cpu_envs[i];
@@ -330,7 +330,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]);
     }
index a48a7af5c01ee80af083dfae9cb1014cd92bfc2b..cf1a874514ce366a7d59c0bf90d08f9ee90f1057 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU Sparc SLAVIO aux io port emulation
- * 
+ *
  * Copyright (c) 2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
index e72bb70e05b00faa1334905e62ca5b094d46ffd8..0ee744416b53c2a92dcfebd8037f4a355bb0eecb 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU Sparc SLAVIO serial port emulation
- * 
+ *
  * Copyright (c) 2003-2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -35,7 +35,7 @@
  * This is the serial port, mouse and keyboard part of chip STP2001
  * (Slave I/O), also produced as NCR89C105. See
  * http://www.ibiblio.org/pub/historic-linux/early-ports/Sparc/NCR/NCR89C105.txt
- * 
+ *
  * The serial ports implement full AMD AM8530 or Zilog Z8530 chips,
  * mouse and keyboard ports don't implement all functions and they are
  * only asynchronous. There is no DMA.
@@ -130,7 +130,7 @@ static uint32_t get_queue(void *opaque)
     ChannelState *s = opaque;
     SERIOQueue *q = &s->queue;
     int val;
-    
+
     if (q->count == 0) {
        return 0;
     } else {
@@ -615,7 +615,7 @@ static void handle_kbd_command(ChannelState *s, int val)
     }
 }
 
-static void sunmouse_event(void *opaque, 
+static void sunmouse_event(void *opaque,
                                int dx, int dy, int dz, int buttons_state)
 {
     ChannelState *s = opaque;
index 976f0d4db4cd71f695b6d2b5b9035ecec8de414c..38625e0ee97c36874dd8663bf23c245277ab3994 100644 (file)
@@ -2,7 +2,7 @@
  * QEMU Sparc SLAVIO timer controller emulation
  *
  * Copyright (c) 2003-2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -38,7 +38,7 @@ do { printf("TIMER: " fmt , ##args); } while (0)
  * This is the timer/counter part of chip STP2001 (Slave I/O), also
  * produced as NCR89C105. See
  * http://www.ibiblio.org/pub/historic-linux/early-ports/Sparc/NCR/NCR89C105.txt
- * 
+ *
  * The 31-bit counter is incremented every 500ns by bit 9. Bits 8..0
  * are zero. Bit 31 is 1 when count has been reached.
  *
@@ -233,7 +233,7 @@ static void slavio_timer_save(QEMUFile *f, void *opaque)
 static int slavio_timer_load(QEMUFile *f, void *opaque, int version_id)
 {
     SLAVIO_TIMERState *s = opaque;
-    
+
     if (version_id != 1)
         return -EINVAL;
 
index 76fc3c8395af71725a5a67da34527031a5620976..57ffed7f781e7c2e45703e5d41d1a05775cc60ea 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU SMBus API
- * 
+ *
  * Copyright (c) 2007 Arastra, Inc.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
index d401b17565db1f5cf042478cfc4c081cad253ed7..f7bf3ed4cd8cdbbf9f1f8f1fe228f4aa731ef495 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU SMBus EEPROM device
- * 
+ *
  * Copyright (c) 2007 Arastra, Inc.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
index 0249cfe98b2953d842b57181ad594093e9ae274d..667db5de622678ff4da1b2a96c1c37ac830f578b 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * SMSC 91C111 Ethernet interface emulation
  *
  * Copyright (c) 2005 CodeSourcery, LLC.
@@ -650,7 +650,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;
index b17a12b9e7d884fb011e336fa5b92e4bc4f70fde..76e97685d9be3108a6876175550b97cee1916fe8 100644 (file)
@@ -70,7 +70,7 @@ void ledma_set_irq(void *opaque, int isr)
 }
 
 /* Note: on sparc, the lance 16 bit bus is swapped */
-void ledma_memory_read(void *opaque, target_phys_addr_t addr, 
+void ledma_memory_read(void *opaque, target_phys_addr_t addr,
                        uint8_t *buf, int len, int do_bswap)
 {
     DMAState *s = opaque;
@@ -91,7 +91,7 @@ void ledma_memory_read(void *opaque, target_phys_addr_t addr,
     }
 }
 
-void ledma_memory_write(void *opaque, target_phys_addr_t addr, 
+void ledma_memory_write(void *opaque, target_phys_addr_t addr,
                         uint8_t *buf, int len, int do_bswap)
 {
     DMAState *s = opaque;
index 9b6aae53c8e373ec889ae9cdc7129f70dd2d37f7..dc155cda1f9917f5f09b75648af9d4566f8a175a 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU Sun4m System Emulator
- * 
+ *
  * Copyright (c) 2003-2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -274,14 +274,14 @@ static void sun4m_init(int ram_size, int vga_ram_size, int boot_device,
     sparc32_dma_set_reset_data(dma, main_esp, main_lance);
 
     prom_offset = ram_size + vram_size;
-    cpu_register_physical_memory(PROM_ADDR, 
-                                 (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK, 
+    cpu_register_physical_memory(PROM_ADDR,
+                                 (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK,
                                  prom_offset | IO_MEM_ROM);
 
     snprintf(buf, sizeof(buf), "%s/%s", bios_dir, PROM_FILENAME);
     ret = load_elf(buf, 0, NULL);
     if (ret < 0) {
-       fprintf(stderr, "qemu: could not load prom '%s'\n", 
+       fprintf(stderr, "qemu: could not load prom '%s'\n",
                buf);
        exit(1);
     }
@@ -294,7 +294,7 @@ static void sun4m_init(int ram_size, int vga_ram_size, int boot_device,
        if (kernel_size < 0)
            kernel_size = load_image(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR);
         if (kernel_size < 0) {
-            fprintf(stderr, "qemu: could not load kernel '%s'\n", 
+            fprintf(stderr, "qemu: could not load kernel '%s'\n",
                     kernel_filename);
            exit(1);
         }
@@ -304,7 +304,7 @@ static void sun4m_init(int ram_size, int vga_ram_size, int boot_device,
         if (initrd_filename) {
             initrd_size = load_image(initrd_filename, phys_ram_base + INITRD_LOAD_ADDR);
             if (initrd_size < 0) {
-                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", 
+                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
                         initrd_filename);
                 exit(1);
             }
index 61069a6529c2ded351256c9c9524f5d5a3b4aa2b..113fc9825bc44c3bebfb3a9f89b38138ca2967d1 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU Sun4u System Emulator
- * 
+ *
  * Copyright (c) 2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -277,14 +277,14 @@ static void sun4u_init(int ram_size, int vga_ram_size, int boot_device,
     cpu_register_physical_memory(0, ram_size, 0);
 
     prom_offset = ram_size + vga_ram_size;
-    cpu_register_physical_memory(PROM_ADDR, 
-                                 (PROM_SIZE_MAX + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK, 
+    cpu_register_physical_memory(PROM_ADDR,
+                                 (PROM_SIZE_MAX + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK,
                                  prom_offset | IO_MEM_ROM);
 
     snprintf(buf, sizeof(buf), "%s/%s", bios_dir, PROM_FILENAME);
     ret = load_elf(buf, 0, NULL);
     if (ret < 0) {
-       fprintf(stderr, "qemu: could not load prom '%s'\n", 
+       fprintf(stderr, "qemu: could not load prom '%s'\n",
                buf);
        exit(1);
     }
@@ -299,7 +299,7 @@ static void sun4u_init(int ram_size, int vga_ram_size, int boot_device,
        if (kernel_size < 0)
            kernel_size = load_image(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR);
         if (kernel_size < 0) {
-            fprintf(stderr, "qemu: could not load kernel '%s'\n", 
+            fprintf(stderr, "qemu: could not load kernel '%s'\n",
                     kernel_filename);
            exit(1);
         }
@@ -308,7 +308,7 @@ static void sun4u_init(int ram_size, int vga_ram_size, int boot_device,
         if (initrd_filename) {
             initrd_size = load_image(initrd_filename, phys_ram_base + INITRD_LOAD_ADDR);
             if (initrd_size < 0) {
-                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", 
+                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
                         initrd_filename);
                 exit(1);
             }
index a1a6b68559d73730fca0c0922c889b15df250718..10b6261a8f42a602c55abb7ea1ce643d36c8f188 100644 (file)
--- a/hw/tcx.c
+++ b/hw/tcx.c
@@ -1,8 +1,8 @@
 /*
  * QEMU TCX Frame buffer
- * 
+ *
  * Copyright (c) 2003-2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -83,7 +83,7 @@ static void update_palette_entries(TCXState *s, int start, int end)
     }
 }
 
-static void tcx_draw_line32(TCXState *s1, uint8_t *d, 
+static void tcx_draw_line32(TCXState *s1, uint8_t *d,
                            const uint8_t *s, int width)
 {
     int x;
@@ -96,7 +96,7 @@ static void tcx_draw_line32(TCXState *s1, uint8_t *d,
     }
 }
 
-static void tcx_draw_line16(TCXState *s1, uint8_t *d, 
+static void tcx_draw_line16(TCXState *s1, uint8_t *d,
                            const uint8_t *s, int width)
 {
     int x;
@@ -109,7 +109,7 @@ static void tcx_draw_line16(TCXState *s1, uint8_t *d,
     }
 }
 
-static void tcx_draw_line8(TCXState *s1, uint8_t *d, 
+static void tcx_draw_line8(TCXState *s1, uint8_t *d,
                           const uint8_t *s, int width)
 {
     int x;
@@ -157,7 +157,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)
@@ -181,7 +181,7 @@ static void tcx_update_display(void *opaque)
        } else {
             if (y_start >= 0) {
                 /* flush to display */
-                dpy_update(ts->ds, 0, y_start, 
+                dpy_update(ts->ds, 0, y_start,
                            ts->width, y - y_start);
                 y_start = -1;
             }
@@ -191,7 +191,7 @@ static void tcx_update_display(void *opaque)
     }
     if (y_start >= 0) {
        /* flush to display */
-       dpy_update(ts->ds, 0, y_start, 
+       dpy_update(ts->ds, 0, y_start,
                   ts->width, y - y_start);
     }
     /* reset modified pages */
@@ -214,7 +214,7 @@ static void tcx_invalidate_display(void *opaque)
 static void tcx_save(QEMUFile *f, void *opaque)
 {
     TCXState *s = opaque;
-    
+
     qemu_put_be32s(f, (uint32_t *)&s->addr);
     qemu_put_be32s(f, (uint32_t *)&s->vram);
     qemu_put_be16s(f, (uint16_t *)&s->height);
@@ -229,7 +229,7 @@ static void tcx_save(QEMUFile *f, void *opaque)
 static int tcx_load(QEMUFile *f, void *opaque, int version_id)
 {
     TCXState *s = opaque;
-    
+
     if (version_id != 1)
         return -EINVAL;
 
index 6448a6f25086fc4174ad7fc57fd2cc64dbd9c9e3..5a5400bce8100d47ddf30338519b6049b03eb6d0 100644 (file)
@@ -2,7 +2,7 @@
  * QEMU Uninorth PCI host (for all Mac99 and newer machines)
  *
  * Copyright (c) 2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -163,13 +163,13 @@ PCIBus *pci_pmac_init(void *pic)
     s->bus = pci_register_bus(pci_unin_set_irq, pci_unin_map_irq,
                               pic, 11 << 3, 4);
 
-    pci_mem_config = cpu_register_io_memory(0, pci_unin_main_config_read, 
+    pci_mem_config = cpu_register_io_memory(0, pci_unin_main_config_read,
                                             pci_unin_main_config_write, s);
     pci_mem_data = cpu_register_io_memory(0, pci_unin_main_read,
                                           pci_unin_main_write, s);
     cpu_register_physical_memory(0xf2800000, 0x1000, pci_mem_config);
     cpu_register_physical_memory(0xf2c00000, 0x1000, pci_mem_data);
-    d = pci_register_device(s->bus, "Uni-north main", sizeof(PCIDevice), 
+    d = pci_register_device(s->bus, "Uni-north main", sizeof(PCIDevice),
                             11 << 3, NULL, NULL);
     d->config[0x00] = 0x6b; // vendor_id : Apple
     d->config[0x01] = 0x10;
@@ -217,7 +217,7 @@ PCIBus *pci_pmac_init(void *pic)
 #if 0 // XXX: not needed for now
     /* Uninorth AGP bus */
     s = &pci_bridge[1];
-    pci_mem_config = cpu_register_io_memory(0, pci_unin_config_read, 
+    pci_mem_config = cpu_register_io_memory(0, pci_unin_config_read,
                                             pci_unin_config_write, s);
     pci_mem_data = cpu_register_io_memory(0, pci_unin_read,
                                           pci_unin_write, s);
@@ -242,7 +242,7 @@ PCIBus *pci_pmac_init(void *pic)
 #if 0 // XXX: not needed for now
     /* Uninorth internal bus */
     s = &pci_bridge[2];
-    pci_mem_config = cpu_register_io_memory(0, pci_unin_config_read, 
+    pci_mem_config = cpu_register_io_memory(0, pci_unin_config_read,
                                             pci_unin_config_write, s);
     pci_mem_data = cpu_register_io_memory(0, pci_unin_read,
                                           pci_unin_write, s);
index bde3a7c67ceba7cee940f02f14f6f32463897487..14787d952e6eeda9feadb28f398b7601a9d87e82 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU USB HID devices
- * 
+ *
  * Copyright (c) 2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -71,13 +71,13 @@ static const uint8_t qemu_mouse_config_descriptor[] = {
        0x01,       /*  u8  bNumInterfaces; (1) */
        0x01,       /*  u8  bConfigurationValue; */
        0x04,       /*  u8  iConfiguration; */
-       0xa0,       /*  u8  bmAttributes; 
+       0xa0,       /*  u8  bmAttributes;
                                 Bit 7: must be set,
                                     6: Self-powered,
                                     5: Remote wakeup,
                                     4..0: resvd */
        50,         /*  u8  MaxPower; */
-      
+
        /* USB 1.1:
         * USB 2.0, single TT organization (mandatory):
         *      one interface, protocol 0
@@ -99,7 +99,7 @@ static const uint8_t qemu_mouse_config_descriptor[] = {
        0x01,       /*  u8  if_bInterfaceSubClass; */
        0x02,       /*  u8  if_bInterfaceProtocol; [usb1.1 or single tt] */
        0x05,       /*  u8  if_iInterface; */
-     
+
         /* HID descriptor */
         0x09,        /*  u8  bLength; */
         0x21,        /*  u8 bDescriptorType; */
@@ -126,13 +126,13 @@ static const uint8_t qemu_tablet_config_descriptor[] = {
        0x01,       /*  u8  bNumInterfaces; (1) */
        0x01,       /*  u8  bConfigurationValue; */
        0x04,       /*  u8  iConfiguration; */
-       0xa0,       /*  u8  bmAttributes; 
+       0xa0,       /*  u8  bmAttributes;
                                 Bit 7: must be set,
                                     6: Self-powered,
                                     5: Remote wakeup,
                                     4..0: resvd */
        50,         /*  u8  MaxPower; */
-      
+
        /* USB 1.1:
         * USB 2.0, single TT organization (mandatory):
         *      one interface, protocol 0
@@ -174,11 +174,11 @@ static const uint8_t qemu_tablet_config_descriptor[] = {
 };
 
 static const uint8_t qemu_mouse_hid_report_descriptor[] = {
-    0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x09, 0x01, 
+    0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x09, 0x01,
     0xA1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03,
-    0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 
+    0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01,
     0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01,
-    0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x15, 0x81, 
+    0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x15, 0x81,
     0x25, 0x7F, 0x75, 0x08, 0x95, 0x02, 0x81, 0x06,
     0xC0, 0xC0,
 };
@@ -264,7 +264,7 @@ static int usb_mouse_poll(USBMouseState *s, 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);
@@ -272,7 +272,7 @@ static int usb_mouse_poll(USBMouseState *s, 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;
@@ -280,7 +280,7 @@ static int usb_mouse_poll(USBMouseState *s, 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;
@@ -301,7 +301,7 @@ static int usb_tablet_poll(USBMouseState *s, uint8_t *buf, int len)
                                                   1, "QEMU USB Tablet");
        s->mouse_grabbed = 1;
     }
-    
+
     dz = int_clamp(s->dz, -128, 127);
     s->dz -= dz;
 
@@ -374,20 +374,20 @@ static int usb_mouse_handle_control(USBDevice *dev, int request, int value,
     case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
         switch(value >> 8) {
         case USB_DT_DEVICE:
-            memcpy(data, qemu_mouse_dev_descriptor, 
+            memcpy(data, qemu_mouse_dev_descriptor,
                    sizeof(qemu_mouse_dev_descriptor));
             ret = sizeof(qemu_mouse_dev_descriptor);
             break;
         case USB_DT_CONFIG:
            if (s->kind == USB_MOUSE) {
-               memcpy(data, qemu_mouse_config_descriptor, 
+               memcpy(data, qemu_mouse_config_descriptor,
                       sizeof(qemu_mouse_config_descriptor));
                ret = sizeof(qemu_mouse_config_descriptor);
            } else if (s->kind == USB_TABLET) {
-               memcpy(data, qemu_tablet_config_descriptor, 
+               memcpy(data, qemu_tablet_config_descriptor,
                       sizeof(qemu_tablet_config_descriptor));
                ret = sizeof(qemu_tablet_config_descriptor);
-           }           
+           }
             break;
         case USB_DT_STRING:
             switch(value & 0xff) {
@@ -447,11 +447,11 @@ static int usb_mouse_handle_control(USBDevice *dev, int request, int value,
         switch(value >> 8) {
         case 0x22:
            if (s->kind == USB_MOUSE) {
-               memcpy(data, qemu_mouse_hid_report_descriptor, 
+               memcpy(data, qemu_mouse_hid_report_descriptor,
                       sizeof(qemu_mouse_hid_report_descriptor));
                ret = sizeof(qemu_mouse_hid_report_descriptor);
            } else if (s->kind == USB_TABLET) {
-               memcpy(data, qemu_tablet_hid_report_descriptor, 
+               memcpy(data, qemu_tablet_hid_report_descriptor,
                       sizeof(qemu_tablet_hid_report_descriptor));
                ret = sizeof(qemu_tablet_hid_report_descriptor);
            }
index 651dac21091feaddd6c37798a5168d3431cf66e2..1dcac3ca6f48092273507cae5a56da41bb610b2b 100644 (file)
@@ -2,7 +2,7 @@
  * QEMU USB HUB emulation
  *
  * Copyright (c) 2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -112,13 +112,13 @@ static const uint8_t qemu_hub_config_descriptor[] = {
        0x01,       /*  u8  bNumInterfaces; (1) */
        0x01,       /*  u8  bConfigurationValue; */
        0x00,       /*  u8  iConfiguration; */
-       0xc0,       /*  u8  bmAttributes; 
+       0xc0,       /*  u8  bmAttributes;
                                 Bit 7: must be set,
                                     6: Self-powered,
                                     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)
@@ -244,12 +244,12 @@ static int usb_hub_handle_control(USBDevice *dev, int request, int value,
     case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
         switch(value >> 8) {
         case USB_DT_DEVICE:
-            memcpy(data, qemu_hub_dev_descriptor, 
+            memcpy(data, qemu_hub_dev_descriptor,
                    sizeof(qemu_hub_dev_descriptor));
             ret = sizeof(qemu_hub_dev_descriptor);
             break;
         case USB_DT_CONFIG:
-            memcpy(data, qemu_hub_config_descriptor, 
+            memcpy(data, qemu_hub_config_descriptor,
                    sizeof(qemu_hub_config_descriptor));
 
             /* status change endpoint size based on number
@@ -401,7 +401,7 @@ static int usb_hub_handle_control(USBDevice *dev, int request, int value,
     case GetHubDescriptor:
         {
             unsigned int n, limit, var_hub_size = 0;
-            memcpy(data, qemu_hub_hub_descriptor, 
+            memcpy(data, qemu_hub_hub_descriptor,
                    sizeof(qemu_hub_hub_descriptor));
             data[2] = s->nb_ports;
 
@@ -504,8 +504,8 @@ static int usb_hub_handle_packet(USBDevice *dev, USBPacket *p)
     if (dev->state == USB_STATE_DEFAULT &&
         dev->addr != 0 &&
         p->devaddr != dev->addr &&
-        (p->pid == USB_TOKEN_SETUP || 
-         p->pid == USB_TOKEN_OUT || 
+        (p->pid == USB_TOKEN_SETUP ||
+         p->pid == USB_TOKEN_OUT ||
          p->pid == USB_TOKEN_IN)) {
         /* broadcast the packet to the devices */
         return usb_hub_broadcast_packet(s, p);
index 4530a1ceaaf8e236ac03d44a9bc350a6fa57309a..c558dfddc56ae722b78bd0a28f058204bd9acbda 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * USB Mass Storage Device emulation
  *
  * Copyright (c) 2006 CodeSourcery.
@@ -93,13 +93,13 @@ static const uint8_t qemu_msd_config_descriptor[] = {
        0x01,       /*  u8  bNumInterfaces; (1) */
        0x01,       /*  u8  bConfigurationValue; */
        0x00,       /*  u8  iConfiguration; */
-       0xc0,       /*  u8  bmAttributes; 
+       0xc0,       /*  u8  bmAttributes;
                                 Bit 7: must be set,
                                     6: Self-powered,
                                     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 */
@@ -259,12 +259,12 @@ static int usb_msd_handle_control(USBDevice *dev, int request, int value,
     case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
         switch(value >> 8) {
         case USB_DT_DEVICE:
-            memcpy(data, qemu_msd_dev_descriptor, 
+            memcpy(data, qemu_msd_dev_descriptor,
                    sizeof(qemu_msd_dev_descriptor));
             ret = sizeof(qemu_msd_dev_descriptor);
             break;
         case USB_DT_CONFIG:
-            memcpy(data, qemu_msd_config_descriptor, 
+            memcpy(data, qemu_msd_config_descriptor,
                    sizeof(qemu_msd_config_descriptor));
             ret = sizeof(qemu_msd_config_descriptor);
             break;
index f0b1e2e4456e4275c222d9ab58473930e23bdf22..93c39f7520d15fe7ca26b6f00ecd06c7e2c58360 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * USB UHCI controller emulation
- * 
+ *
  * Copyright (c) 2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -82,7 +82,7 @@ typedef struct UHCIState {
     /* For simplicity of implementation we only allow a single pending USB
        request.  This means all usb traffic on this controller is effectively
        suspended until that transfer completes.  When the transfer completes
-       the next transfer from that queue will be processed.  However 
+       the next transfer from that queue will be processed.  However
        other queues will not be processed until the next frame.  The solution
        is to allow multiple pending requests.  */
     uint32_t async_qh;
@@ -147,7 +147,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:
@@ -176,7 +176,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);
@@ -241,7 +241,7 @@ static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
             dev = port->port.dev;
             if (dev) {
                 /* port reset */
-                if ( (val & UHCI_PORT_RESET) && 
+                if ( (val & UHCI_PORT_RESET) &&
                      !(port->ctrl & UHCI_PORT_RESET) ) {
                     usb_send_msg(dev, USB_MSG_RESET);
                 }
@@ -278,7 +278,7 @@ static uint32_t uhci_ioport_readw(void *opaque, uint32_t addr)
             UHCIPort *port;
             int n;
             n = (addr >> 1) & 7;
-            if (n >= NB_PORTS) 
+            if (n >= NB_PORTS)
                 goto read_default;
             port = &s->ports[n];
             val = port->ctrl;
@@ -435,7 +435,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;
 
@@ -504,7 +504,7 @@ static int uhci_handle_td(UHCIState *s, UHCI_TD *td, int *int_mask)
     if (ret >= 0) {
         td->ctrl = (td->ctrl & ~0x7ff) | ((len - 1) & 0x7ff);
         td->ctrl &= ~TD_CTRL_ACTIVE;
-        if (pid == USB_TOKEN_IN && 
+        if (pid == USB_TOKEN_IN &&
             (td->ctrl & TD_CTRL_SPD) &&
             len < max_len) {
             *int_mask |= 0x02;
@@ -529,7 +529,7 @@ static int uhci_handle_td(UHCIState *s, UHCI_TD *td, int *int_mask)
                     uhci_update_irq(s);
                 }
             }
-            td->ctrl = (td->ctrl & ~(3 << TD_CTRL_ERROR_SHIFT)) | 
+            td->ctrl = (td->ctrl & ~(3 << TD_CTRL_ERROR_SHIFT)) |
                 (err << TD_CTRL_ERROR_SHIFT);
             return 1;
         case USB_RET_NAK:
@@ -571,7 +571,7 @@ static void uhci_async_complete_packet(USBPacket * packet, void *opaque)
     le32_to_cpus(&qh.el_link);
     /* Re-process the queue containing the async packet.  */
     while (1) {
-        cpu_physical_memory_read(qh.el_link & ~0xf, 
+        cpu_physical_memory_read(qh.el_link & ~0xf,
                                  (uint8_t *)&td, sizeof(td));
         le32_to_cpus(&td.link);
         le32_to_cpus(&td.ctrl);
@@ -582,8 +582,8 @@ static void uhci_async_complete_packet(USBPacket * packet, void *opaque)
         /* update the status bits of the TD */
         if (old_td_ctrl != td.ctrl) {
             val = cpu_to_le32(td.ctrl);
-            cpu_physical_memory_write((qh.el_link & ~0xf) + 4, 
-                                      (const uint8_t *)&val, 
+            cpu_physical_memory_write((qh.el_link & ~0xf) + 4,
+                                      (const uint8_t *)&val,
                                       sizeof(val));
         }
         if (ret < 0)
@@ -595,8 +595,8 @@ static void uhci_async_complete_packet(USBPacket * packet, void *opaque)
             /* update qh element link */
             qh.el_link = td.link;
             val = cpu_to_le32(qh.el_link);
-            cpu_physical_memory_write((link & ~0xf) + 4, 
-                                      (const uint8_t *)&val, 
+            cpu_physical_memory_write((link & ~0xf) + 4,
+                                      (const uint8_t *)&val,
                                       sizeof(val));
             if (!(qh.el_link & 4))
                 break;
@@ -664,7 +664,7 @@ static void uhci_frame_timer(void *opaque)
                 /* TD */
                 if (--cnt == 0)
                     break;
-                cpu_physical_memory_read(qh.el_link & ~0xf, 
+                cpu_physical_memory_read(qh.el_link & ~0xf,
                                          (uint8_t *)&td, sizeof(td));
                 le32_to_cpus(&td.link);
                 le32_to_cpus(&td.ctrl);
@@ -675,8 +675,8 @@ static void uhci_frame_timer(void *opaque)
                 /* update the status bits of the TD */
                 if (old_td_ctrl != td.ctrl) {
                     val = cpu_to_le32(td.ctrl);
-                    cpu_physical_memory_write((qh.el_link & ~0xf) + 4, 
-                                              (const uint8_t *)&val, 
+                    cpu_physical_memory_write((qh.el_link & ~0xf) + 4,
+                                              (const uint8_t *)&val,
                                               sizeof(val));
                 }
                 if (ret < 0)
@@ -687,8 +687,8 @@ static void uhci_frame_timer(void *opaque)
                     /* update qh element link */
                     qh.el_link = td.link;
                     val = cpu_to_le32(qh.el_link);
-                    cpu_physical_memory_write((link & ~0xf) + 4, 
-                                              (const uint8_t *)&val, 
+                    cpu_physical_memory_write((link & ~0xf) + 4,
+                                              (const uint8_t *)&val,
                                               sizeof(val));
                     if (qh.el_link & 4) {
                         /* depth first */
@@ -714,8 +714,8 @@ static void uhci_frame_timer(void *opaque)
                 /* update the status bits of the TD */
                 if (old_td_ctrl != td.ctrl) {
                     val = cpu_to_le32(td.ctrl);
-                    cpu_physical_memory_write((link & ~0xf) + 4, 
-                                              (const uint8_t *)&val, 
+                    cpu_physical_memory_write((link & ~0xf) + 4,
+                                              (const uint8_t *)&val,
                                               sizeof(val));
                 }
                 if (ret < 0)
@@ -742,12 +742,12 @@ static void uhci_frame_timer(void *opaque)
         s->async_qh = 0;
     }
     /* prepare the timer for the next frame */
-    expire_time = qemu_get_clock(vm_clock) + 
+    expire_time = qemu_get_clock(vm_clock) +
         (ticks_per_sec / FRAME_TIMER_FREQ);
     qemu_mod_timer(s->frame_timer, expire_time);
 }
 
-static void uhci_map(PCIDevice *pci_dev, int region_num, 
+static void uhci_map(PCIDevice *pci_dev, int region_num,
                     uint32_t addr, uint32_t size, int type)
 {
     UHCIState *s = (UHCIState *)pci_dev;
@@ -781,7 +781,7 @@ void usb_uhci_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);
     }
@@ -791,6 +791,6 @@ void usb_uhci_init(PCIBus *bus, int devfn)
 
     /* Use region 4 for consistency with real hardware.  BSD guests seem
        to rely on this.  */
-    pci_register_io_region(&s->dev, 4, 0x20, 
+    pci_register_io_region(&s->dev, 4, 0x20,
                            PCI_ADDRESS_SPACE_IO, uhci_map);
 }
index efbc6dbe9864c2c376e6a49c0d72917648c9beac..804451f546fedc8361f800ec3a8616e988996313 100644 (file)
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -2,7 +2,7 @@
  * QEMU USB emulation
  *
  * Copyright (c) 2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -31,7 +31,7 @@ void usb_attach(USBPort *port, USBDevice *dev)
 /**********************/
 /* generic USB device helpers (you are not forced to use them when
    writing your USB device driver, but they help handling the
-   protocol) 
+   protocol)
 */
 
 #define SETUP_STATE_IDLE 0
@@ -66,7 +66,7 @@ int usb_generic_handle_packet(USBDevice *s, USBPacket *p)
         s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
         s->setup_index = 0;
         if (s->setup_buf[0] & USB_DIR_IN) {
-            ret = s->handle_control(s, 
+            ret = s->handle_control(s,
                                     (s->setup_buf[0] << 8) | s->setup_buf[1],
                                     (s->setup_buf[3] << 8) | s->setup_buf[2],
                                     (s->setup_buf[5] << 8) | s->setup_buf[4],
@@ -93,7 +93,7 @@ int usb_generic_handle_packet(USBDevice *s, USBPacket *p)
             case SETUP_STATE_ACK:
                 if (!(s->setup_buf[0] & USB_DIR_IN)) {
                     s->setup_state = SETUP_STATE_IDLE;
-                    ret = s->handle_control(s, 
+                    ret = s->handle_control(s,
                                       (s->setup_buf[0] << 8) | s->setup_buf[1],
                                       (s->setup_buf[3] << 8) | s->setup_buf[2],
                                       (s->setup_buf[5] << 8) | s->setup_buf[4],
index ed8890e39ad13c250991bc6d4c59f5415b09da58..bb42bc665ed01bbfb75c7ecdaa70c0ba4db08eea 100644 (file)
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -1,8 +1,8 @@
 /*
  * QEMU USB API
- * 
+ *
  * Copyright (c) 2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -30,7 +30,7 @@
 #define USB_MSG_DETACH   0x101
 #define USB_MSG_RESET    0x102
 
-#define USB_RET_NODEV  (-1) 
+#define USB_RET_NODEV  (-1)
 #define USB_RET_NAK    (-2)
 #define USB_RET_STALL  (-3)
 #define USB_RET_BABBLE (-4)
@@ -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];
index 32854c2f9414f8eec214c870c8e0421d772645f3..501655be5157ff71022e9cd1fa5986c98aa3d5b6 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * ARM Versatile/PB PCI host controller
  *
  * Copyright (c) 2006 CodeSourcery.
index bc42472ade3bc3674040a8617cf023d6371b031a..92700015dc5a7a520ac27a0c46d5861f637a0f83 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * ARM Versatile Platform/Application Baseboard System emulation.
  *
  * Copyright (c) 2005-2006 CodeSourcery.
index 2d2e6758eeca58e96e1011041d19a57a9aace73b..6f4a40c7356ab49d2b90376c7feb144b5ff48a9c 100644 (file)
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1,8 +1,8 @@
 /*
  * QEMU VGA Emulator.
- * 
+ *
  * Copyright (c) 2003 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -165,7 +165,7 @@ static uint32_t vga_ioport_read(void *opaque, uint32_t addr)
             break;
         case 0x3c1:
             index = s->ar_index & 0x1f;
-            if (index < 21) 
+            if (index < 21)
                 val = s->ar[index];
             else
                 val = 0;
@@ -389,11 +389,11 @@ static uint32_t vbe_ioport_read_data(void *opaque, uint32_t addr)
                 val = VBE_DISPI_MAX_BPP;
                 break;
             default:
-                val = s->vbe_regs[s->vbe_index]; 
+                val = s->vbe_regs[s->vbe_index];
                 break;
             }
         } else {
-            val = s->vbe_regs[s->vbe_index]; 
+            val = s->vbe_regs[s->vbe_index];
         }
     } else {
         val = 0;
@@ -441,7 +441,7 @@ static void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)
         case VBE_DISPI_INDEX_BPP:
             if (val == 0)
                 val = 8;
-            if (val == 4 || val == 8 || val == 15 || 
+            if (val == 4 || val == 8 || val == 15 ||
                 val == 16 || val == 24 || val == 32) {
                 s->vbe_regs[s->vbe_index] = val;
             }
@@ -460,26 +460,26 @@ static void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)
                 !(s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED)) {
                 int h, shift_control;
 
-                s->vbe_regs[VBE_DISPI_INDEX_VIRT_WIDTH] = 
+                s->vbe_regs[VBE_DISPI_INDEX_VIRT_WIDTH] =
                     s->vbe_regs[VBE_DISPI_INDEX_XRES];
-                s->vbe_regs[VBE_DISPI_INDEX_VIRT_HEIGHT] = 
+                s->vbe_regs[VBE_DISPI_INDEX_VIRT_HEIGHT] =
                     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
-                    s->vbe_line_offset = s->vbe_regs[VBE_DISPI_INDEX_XRES] * 
+                    s->vbe_line_offset = s->vbe_regs[VBE_DISPI_INDEX_XRES] *
                         ((s->vbe_regs[VBE_DISPI_INDEX_BPP] + 7) >> 3);
                 s->vbe_start_addr = 0;
 
                 /* clear the screen (should be done in BIOS) */
                 if (!(val & VBE_DISPI_NOCLEARMEM)) {
-                    memset(s->vram_ptr, 0, 
+                    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 */
@@ -490,13 +490,13 @@ static void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)
                 /* height (only meaningful if < 1024) */
                 h = s->vbe_regs[VBE_DISPI_INDEX_YRES] - 1;
                 s->cr[0x12] = h;
-                s->cr[0x07] = (s->cr[0x07] & ~0x42) | 
+                s->cr[0x07] = (s->cr[0x07] & ~0x42) |
                     ((h >> 7) & 0x02) | ((h >> 3) & 0x40);
                 /* line compare to 1023 */
                 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 */
@@ -561,7 +561,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;
@@ -585,7 +585,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];
@@ -675,7 +675,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;
@@ -766,11 +766,11 @@ void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
         mask = s->sr[2];
         s->plane_updated |= mask; /* only used to detect font change */
         write_mask = mask16[mask];
-        ((uint32_t *)s->vram_ptr)[addr] = 
-            (((uint32_t *)s->vram_ptr)[addr] & ~write_mask) | 
+        ((uint32_t *)s->vram_ptr)[addr] =
+            (((uint32_t *)s->vram_ptr)[addr] & ~write_mask) |
             (val & write_mask);
 #ifdef DEBUG_VGA_MEM
-            printf("vga: latch: [0x%x] mask=0x%08x val=0x%08x\n", 
+            printf("vga: latch: [0x%x] mask=0x%08x val=0x%08x\n",
                    addr * 4, write_mask, val);
 #endif
             cpu_physical_memory_set_dirty(s->vram_offset + (addr << 2));
@@ -807,9 +807,9 @@ typedef void vga_draw_glyph8_func(uint8_t *d, int linesize,
                              const uint8_t *font_ptr, int h,
                              uint32_t fgcol, uint32_t bgcol);
 typedef void vga_draw_glyph9_func(uint8_t *d, int linesize,
-                                  const uint8_t *font_ptr, int h, 
+                                  const uint8_t *font_ptr, int h,
                                   uint32_t fgcol, uint32_t bgcol, int dup9);
-typedef void vga_draw_line_func(VGAState *s1, uint8_t *d, 
+typedef void vga_draw_line_func(VGAState *s1, uint8_t *d,
                                 const uint8_t *s, int width);
 
 static inline unsigned int rgb_to_pixel8(unsigned int r, unsigned int g, unsigned b)
@@ -907,8 +907,8 @@ static int update_palette16(VGAState *s)
         else
             v = ((s->ar[0x14] & 0xc) << 4) | (v & 0x3f);
         v = v * 3;
-        col = s->rgb_to_pixel(c6_to_8(s->palette[v]), 
-                              c6_to_8(s->palette[v + 1]), 
+        col = s->rgb_to_pixel(c6_to_8(s->palette[v]),
+                              c6_to_8(s->palette[v + 1]),
                               c6_to_8(s->palette[v + 2]));
         if (col != palette[i]) {
             full_update = 1;
@@ -929,12 +929,12 @@ static int update_palette256(VGAState *s)
     v = 0;
     for(i = 0; i < 256; i++) {
         if (s->dac_8bit) {
-          col = s->rgb_to_pixel(s->palette[v], 
-                                s->palette[v + 1], 
+          col = s->rgb_to_pixel(s->palette[v],
+                                s->palette[v + 1],
                                 s->palette[v + 2]);
         } else {
-          col = s->rgb_to_pixel(c6_to_8(s->palette[v]), 
-                                c6_to_8(s->palette[v + 1]), 
+          col = s->rgb_to_pixel(c6_to_8(s->palette[v]),
+                                c6_to_8(s->palette[v + 1]),
                                 c6_to_8(s->palette[v + 2]));
         }
         if (col != palette[i]) {
@@ -946,8 +946,8 @@ static int update_palette256(VGAState *s)
     return full_update;
 }
 
-static void vga_get_offsets(VGAState *s, 
-                            uint32_t *pline_offset, 
+static void vga_get_offsets(VGAState *s,
+                            uint32_t *pline_offset,
                             uint32_t *pstart_addr,
                             uint32_t *pline_compare)
 {
@@ -959,7 +959,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;
@@ -968,7 +968,7 @@ static void vga_get_offsets(VGAState *s,
         start_addr = s->cr[0x0d] | (s->cr[0x0c] << 8);
 
         /* line compare */
-        line_compare = s->cr[0x18] | 
+        line_compare = s->cr[0x18] |
             ((s->cr[0x07] & 0x10) << 4) |
             ((s->cr[0x09] & 0x40) << 3);
     }
@@ -982,7 +982,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);
@@ -1041,7 +1041,7 @@ static vga_draw_glyph9_func *vga_draw_glyph9_table[NB_DEPTHS] = {
     vga_draw_glyph9_32,
     vga_draw_glyph9_32,
 };
-    
+
 static const uint8_t cursor_glyph[32 * 4] = {
     0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
     0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@@ -1059,17 +1059,17 @@ 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,
-};    
+};
 
 typedef unsigned int rgb_to_pixel_dup_func(unsigned int r, unsigned int g, unsigned b);
 
 static rgb_to_pixel_dup_func *rgb_to_pixel_dup_table[NB_DEPTHS];
 
-/* 
- * Text mode update 
+/*
+ * Text mode update
  * Missing:
  * - double scan
- * - double width 
+ * - double width
  * - underline
  * - flashing
  */
@@ -1091,12 +1091,12 @@ static void vga_draw_text(VGAState *s, int full_update)
 
     if (s->ds->dpy_colourdepth != NULL && s->ds->depth != 0)
         s->ds->dpy_colourdepth(s->ds, 0);
-    s->rgb_to_pixel = 
+    s->rgb_to_pixel =
         rgb_to_pixel_dup_table[get_depth_index(s->ds)];
 
     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;
@@ -1136,8 +1136,8 @@ static void vga_draw_text(VGAState *s, int full_update)
         /* ugly hack for CGA 160x100x16 - explain me the logic */
         height = 100;
     } else {
-        height = s->cr[0x12] | 
-            ((s->cr[0x07] & 0x02) << 7) | 
+        height = s->cr[0x12] |
+            ((s->cr[0x07] & 0x02) << 7) |
             ((s->cr[0x07] & 0x40) << 3);
         height = (height + 1) / cheight;
     }
@@ -1172,14 +1172,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;
@@ -1208,13 +1208,13 @@ static void vga_draw_text(VGAState *s, int full_update)
                 bgcol = palette[cattr >> 4];
                 fgcol = palette[cattr & 0x0f];
                 if (cw != 9) {
-                    vga_draw_glyph8(d1, linesize, 
+                    vga_draw_glyph8(d1, linesize,
                                     font_ptr, cheight, fgcol, bgcol);
                 } else {
                     dup9 = 0;
                     if (ch >= 0xb0 && ch <= 0xdf && (s->ar[0x10] & 0x04))
                         dup9 = 1;
-                    vga_draw_glyph9(d1, linesize, 
+                    vga_draw_glyph9(d1, linesize,
                                     font_ptr, cheight, fgcol, bgcol, dup9);
                 }
                 if (src == cursor_ptr &&
@@ -1230,10 +1230,10 @@ static void vga_draw_text(VGAState *s, int full_update)
                         h = line_last - line_start + 1;
                         d = d1 + linesize * line_start;
                         if (cw != 9) {
-                            vga_draw_glyph8(d, linesize, 
+                            vga_draw_glyph8(d, linesize,
                                             cursor_glyph, h, fgcol, bgcol);
                         } else {
-                            vga_draw_glyph9(d, linesize, 
+                            vga_draw_glyph9(d, linesize,
                                             cursor_glyph, h, fgcol, bgcol, 1);
                         }
                     }
@@ -1244,7 +1244,7 @@ static void vga_draw_text(VGAState *s, int full_update)
             ch_attr_ptr++;
         }
         if (cx_max != -1) {
-            dpy_update(s->ds, cx_min * cw, cy * cheight, 
+            dpy_update(s->ds, cx_min * cw, cy * cheight,
                        (cx_max - cx_min + 1) * cw, cheight);
         }
         dest += linesize * cheight;
@@ -1342,7 +1342,7 @@ static int vga_get_bpp(VGAState *s)
 #ifdef CONFIG_BOCHS_VBE
     if (s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED) {
         ret = s->vbe_regs[VBE_DISPI_INDEX_BPP];
-    } else 
+    } else
 #endif
     {
         ret = 0;
@@ -1353,17 +1353,17 @@ 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];
         height = s->vbe_regs[VBE_DISPI_INDEX_YRES];
-    } else 
+    } else
 #endif
     {
         width = (s->cr[0x01] + 1) * 8;
-        height = s->cr[0x12] | 
-            ((s->cr[0x07] & 0x02) << 7) | 
+        height = s->cr[0x12] |
+            ((s->cr[0x07] & 0x02) << 7) |
             ((s->cr[0x07] & 0x40) << 3);
         height = (height + 1);
     }
@@ -1482,7 +1482,7 @@ void check_sse2(void)
 }
 #endif /* !USE_SSE2 */
 
-/* 
+/*
  * graphic modes
  */
 static void vga_draw_graphic(VGAState *s, int full_update)
@@ -1503,12 +1503,12 @@ static void vga_draw_graphic(VGAState *s, int full_update)
 
     ds_depth = s->ds->depth;
     depth = s->get_bpp(s);
-    if (s->ds->dpy_colourdepth != NULL && 
+    if (s->ds->dpy_colourdepth != NULL &&
             (ds_depth != depth || !s->ds->shared_buf))
         s->ds->dpy_colourdepth(s->ds, depth);
     if (ds_depth != s->ds->depth) full_update = 1;
 
-    s->rgb_to_pixel = 
+    s->rgb_to_pixel =
         rgb_to_pixel_dup_table[get_depth_index(s->ds)];
 
     shift_control = (s->gr[0x05] >> 5) & 3;
@@ -1527,7 +1527,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) {
@@ -1579,7 +1579,7 @@ static void vga_draw_graphic(VGAState *s, int full_update)
     }
 
     vga_draw_line = vga_draw_line_table[v * NB_DEPTHS + get_depth_index(s->ds)];
-    if (s->line_offset != s->last_line_offset || 
+    if (s->line_offset != s->last_line_offset ||
         disp_width != s->last_width ||
         height != s->last_height) {
         dpy_resize(s->ds, disp_width, height, s->line_offset);
@@ -1587,14 +1587,14 @@ static void vga_draw_graphic(VGAState *s, int full_update)
         s->last_scr_height = height;
         s->last_width = disp_width;
         s->last_height = height;
-        s->last_line_offset = s->line_offset; 
+        s->last_line_offset = s->line_offset;
         full_update = 1;
     }
     if (s->ds->shared_buf && (full_update || s->ds->data != s->vram_ptr + (s->start_addr * 4)))
         s->ds->dpy_setdata(s->ds, s->vram_ptr + (s->start_addr * 4));
     if (!s->ds->shared_buf && 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",
@@ -1686,12 +1686,12 @@ static void vga_draw_graphic(VGAState *s, int full_update)
         }
         page0 = s->vram_offset + (addr & TARGET_PAGE_MASK);
         page1 = s->vram_offset + ((addr + bwidth - 1) & TARGET_PAGE_MASK);
-        update = full_update | 
+        update = full_update |
             cpu_physical_memory_get_dirty(page0, VGA_DIRTY_FLAG) |
             cpu_physical_memory_get_dirty(page1, VGA_DIRTY_FLAG);
         if ((page1 - page0) > TARGET_PAGE_SIZE) {
             /* if wide line, can use another page */
-            update |= cpu_physical_memory_get_dirty(page0 + TARGET_PAGE_SIZE, 
+            update |= cpu_physical_memory_get_dirty(page0 + TARGET_PAGE_SIZE,
                                                     VGA_DIRTY_FLAG);
         }
         /* explicit invalidation for the hardware cursor */
@@ -1711,7 +1711,7 @@ static void vga_draw_graphic(VGAState *s, int full_update)
         } else {
             if (y_start >= 0) {
                 /* flush to display */
-                dpy_update(s->ds, 0, y_start, 
+                dpy_update(s->ds, 0, y_start,
                            disp_width, y - y_start);
                 y_start = -1;
             }
@@ -1732,7 +1732,7 @@ static void vga_draw_graphic(VGAState *s, int full_update)
     }
     if (y_start >= 0) {
         /* flush to display */
-        dpy_update(s->ds, 0, y_start, 
+        dpy_update(s->ds, 0, y_start,
                    disp_width, y - y_start);
     }
     /* reset modified pages */
@@ -1756,9 +1756,9 @@ static void vga_draw_blank(VGAState *s, int full_update)
     /* Disable dirty bit tracking */
     xc_hvm_track_dirty_vram(xc_handle, domid, 0, 0, NULL);
 
-    s->rgb_to_pixel = 
+    s->rgb_to_pixel =
         rgb_to_pixel_dup_table[get_depth_index(s->ds)];
-    if (s->ds->depth == 8) 
+    if (s->ds->depth == 8)
         val = s->rgb_to_pixel(0, 0, 0);
     else
         val = 0;
@@ -1768,13 +1768,13 @@ static void vga_draw_blank(VGAState *s, int full_update)
         memset(d, val, w);
         d += s->ds->linesize;
     }
-    dpy_update(s->ds, 0, 0, 
+    dpy_update(s->ds, 0, 0,
                s->last_scr_width, s->last_scr_height);
 }
 
 #define GMODE_TEXT     0
 #define GMODE_GRAPH    1
-#define GMODE_BLANK 2 
+#define GMODE_BLANK 2
 
 static void vga_update_display(void *opaque)
 {
@@ -1813,7 +1813,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;
 }
@@ -1882,8 +1882,8 @@ static void vga_save(QEMUFile *f, void *opaque)
     qemu_put_byte(f, 0);
 #endif
     vram_size = s->vram_size;
-    qemu_put_be32s(f, &vram_size); 
-    qemu_put_buffer(f, s->vram_ptr, s->vram_size); 
+    qemu_put_be32s(f, &vram_size);
+    qemu_put_buffer(f, s->vram_ptr, s->vram_size);
 }
 
 static int vga_load(QEMUFile *f, void *opaque, int version_id)
@@ -1946,7 +1946,7 @@ static int vga_load(QEMUFile *f, void *opaque, int version_id)
        qemu_get_be32s(f, &vram_size);
        if (vram_size != s->vram_size)
            return -EINVAL;
-       qemu_get_buffer(f, s->vram_ptr, s->vram_size); 
+       qemu_get_buffer(f, s->vram_ptr, s->vram_size);
     }
 
     /* force refresh */
@@ -1959,7 +1959,7 @@ typedef struct PCIVGAState {
     VGAState vga_state;
 } PCIVGAState;
 
-static void vga_map(PCIDevice *pci_dev, int region_num, 
+static void vga_map(PCIDevice *pci_dev, int region_num,
                     uint32_t addr, uint32_t size, int type)
 {
     PCIVGAState *d = (PCIVGAState *)pci_dev;
@@ -1979,12 +1979,12 @@ void vga_bios_init(VGAState *s)
        0,   0, 170, 170, 170,   0,   0, 170,
         0, 170, 170,  85,   0, 170, 170, 170,
        85,  85,  85,  85,  85, 255,  85, 255,
-       85,  85, 255, 255, 255,  85,  85, 255, 
+       85,  85, 255, 255, 255,  85,  85, 255,
        85, 255, 255, 255,  85, 255, 255, 255,
         0,  21,   0,   0,  21,  42,   0,  63,
         0,   0,  63,  42,  42,  21,   0,  42,
        21,  42,  42,  63,   0,  42,  63,  42,
-        0,  21,  21,   0,  21,  63,   0,  63, 
+        0,  21,  21,   0,  21,  63,   0,  63,
        21,   0,  63,  63,  42,  21,  21,  42,
        21,  63,  42,  63,  21,  42,  63,  63,
        21,   0,   0,  21,   0,  42,  21,  42,
@@ -2001,9 +2001,9 @@ void vga_bios_init(VGAState *s)
        21,  63,  63,  63,  21,  63,  63,  63
     };
 
-    s->latch = 0; 
+    s->latch = 0;
 
-    s->sr_index = 3; 
+    s->sr_index = 3;
     s->sr[0] = 3;
     s->sr[1] = 0;
     s->sr[2] = 3;
@@ -2013,7 +2013,7 @@ void vga_bios_init(VGAState *s)
     s->sr[6] = 0;
     s->sr[7] = 0;
 
-    s->gr_index = 5; 
+    s->gr_index = 5;
     s->gr[0] = 0;
     s->gr[1] = 0;
     s->gr[2] = 0;
@@ -2048,9 +2048,9 @@ void vga_bios_init(VGAState *s)
     s->ar[19] = 8;
     s->ar[20] = 0;
 
-    s->ar_flip_flop = 1; 
+    s->ar_flip_flop = 1;
 
-    s->cr_index = 15; 
+    s->cr_index = 15;
     s->cr[0] = 95;
     s->cr[1] = 79;
     s->cr[2] = 80;
@@ -2077,17 +2077,17 @@ void vga_bios_init(VGAState *s)
     s->cr[23] = 163;
     s->cr[24] = 255;
 
-    s->msr = 103; 
-    s->fcr = 0; 
-    s->st00 = 0; 
-    s->st01 = 0; 
+    s->msr = 103;
+    s->fcr = 0;
+    s->st00 = 0;
+    s->st01 = 0;
 
     /* dac_* & palette will be initialized by os through out 0x03c8 &
      * out 0c03c9(1:3) */
-    s->dac_state = 0; 
-    s->dac_sub_index = 0; 
-    s->dac_read_index = 0; 
-    s->dac_write_index = 16; 
+    s->dac_state = 0;
+    s->dac_sub_index = 0;
+    s->dac_read_index = 0;
+    s->dac_write_index = 16;
     s->dac_cache[0] = 255;
     s->dac_cache[1] = 255;
     s->dac_cache[2] = 255;
@@ -2102,7 +2102,7 @@ void vga_bios_init(VGAState *s)
 }
 
 /* when used on xen environment, the vga_ram_base is not used */
-void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, 
+void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
                      unsigned long vga_ram_offset, int vga_ram_size)
 {
     int i, j, v, b;
@@ -2194,7 +2194,7 @@ static void vga_init(VGAState *s)
     register_ioport_read(0xff81, 1, 2, vbe_ioport_read_data, s);
 
     register_ioport_write(0xff80, 1, 2, vbe_ioport_write_index, s);
-    register_ioport_write(0xff81, 1, 2, vbe_ioport_write_data, s); 
+    register_ioport_write(0xff81, 1, 2, vbe_ioport_write_data, s);
 #else
     register_ioport_read(0x1ce, 1, 2, vbe_ioport_read_index, s);
     register_ioport_read(0x1d0, 1, 2, vbe_ioport_read_data, s);
@@ -2205,11 +2205,11 @@ static void vga_init(VGAState *s)
 #endif /* CONFIG_BOCHS_VBE */
 
     vga_io_memory = cpu_register_io_memory(0, vga_mem_read, vga_mem_write, s);
-    cpu_register_physical_memory(isa_mem_base + 0x000a0000, 0x20000, 
+    cpu_register_physical_memory(isa_mem_base + 0x000a0000, 0x20000,
                                  vga_io_memory);
 }
 
-int isa_vga_init(DisplayState *ds, uint8_t *vga_ram_base, 
+int isa_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
                  unsigned long vga_ram_offset, int vga_ram_size)
 {
     VGAState *s;
@@ -2223,42 +2223,42 @@ int isa_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
 
 #ifdef CONFIG_BOCHS_VBE
     /* XXX: use optimized standard vga accesses */
-    cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS, 
+    cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS,
                                  vga_ram_size, vga_ram_offset);
 #endif
     return 0;
 }
 
-int pci_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, 
+int pci_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
                  unsigned long vga_ram_offset, int vga_ram_size,
                  unsigned long vga_bios_offset, int vga_bios_size)
 {
     PCIVGAState *d;
     VGAState *s;
     uint8_t *pci_conf;
-    
-    d = (PCIVGAState *)pci_register_device(bus, "VGA", 
+
+    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);
     s->pci_dev = &d->dev;
-    
+
     pci_conf = d->dev.config;
     pci_conf[0x00] = 0x34; // dummy VGA (same as Bochs ID)
     pci_conf[0x01] = 0x12;
     pci_conf[0x02] = 0x11;
     pci_conf[0x03] = 0x11;
-    pci_conf[0x0a] = 0x00; // VGA controller 
+    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_register_io_region(&d->dev, 0, vga_ram_size,
                            PCI_ADDRESS_SPACE_MEM_PREFETCH, vga_map);
     if (vga_bios_size != 0) {
         unsigned int bios_total_size;
@@ -2268,7 +2268,7 @@ int pci_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
         bios_total_size = 1;
         while (bios_total_size < vga_bios_size)
             bios_total_size <<= 1;
-        pci_register_io_region(&d->dev, PCI_ROM_SLOT, bios_total_size, 
+        pci_register_io_region(&d->dev, PCI_ROM_SLOT, bios_total_size,
                                PCI_ADDRESS_SPACE_MEM_PREFETCH, vga_map);
     }
     return 0;
@@ -2306,7 +2306,7 @@ void *vga_update_vram(VGAState *s, void *vga_ram_base, int vga_ram_size)
 
 static int vga_save_w, vga_save_h;
 
-static void vga_save_dpy_update(DisplayState *s, 
+static void vga_save_dpy_update(DisplayState *s,
                                 int x, int y, int w, int h)
 {
 }
@@ -2323,7 +2323,7 @@ static void vga_save_dpy_refresh(DisplayState *s)
 {
 }
 
-static int ppm_save(const char *filename, uint8_t *data, 
+static int ppm_save(const char *filename, uint8_t *data,
                     int w, int h, int linesize)
 {
     FILE *f;
@@ -2358,7 +2358,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;
@@ -2372,9 +2372,9 @@ 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, 
+        ppm_save(filename, ds->data, vga_save_w, vga_save_h,
                  s->ds->linesize);
         qemu_free(ds->data);
     }
index f5f7ffd6855ce55da889ddc9bfac267e03d1e42c..67309a66c9c0fd8bd90fc19f6c24a18e6c1117b2 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU internal VGA defines.
- * 
+ *
  * Copyright (c) 2003-2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
 #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
@@ -160,22 +160,22 @@ static inline int c6_to_8(int v)
     return (v << 2) | (b << 1) | b;
 }
 
-void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, 
+void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
                      unsigned long vga_ram_offset, int vga_ram_size);
 uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr);
 void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val);
 void vga_invalidate_scanlines(VGAState *s, int y1, int y2);
 
-void vga_draw_cursor_line_8(uint8_t *d1, const uint8_t *src1, 
-                            int poffset, int w, 
+void vga_draw_cursor_line_8(uint8_t *d1, const uint8_t *src1,
+                            int poffset, int w,
                             unsigned int color0, unsigned int color1,
                             unsigned int color_xor);
-void vga_draw_cursor_line_16(uint8_t *d1, const uint8_t *src1, 
-                             int poffset, int w, 
+void vga_draw_cursor_line_16(uint8_t *d1, const uint8_t *src1,
+                             int poffset, int w,
                              unsigned int color0, unsigned int color1,
                              unsigned int color_xor);
-void vga_draw_cursor_line_32(uint8_t *d1, const uint8_t *src1, 
-                             int poffset, int w, 
+void vga_draw_cursor_line_32(uint8_t *d1, const uint8_t *src1,
+                             int poffset, int w,
                              unsigned int color0, unsigned int color1,
                              unsigned int color_xor);
 
index e7e8cb853e6a512e4a805af6bef54438ee91fc22..0bc2e8020c11b69f5766523e4bf0ed370389870d 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU VGA Emulator templates
- * 
+ *
  * Copyright (c) 2003 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
 
 #if DEPTH == 8
 #define BPP 1
-#define PIXEL_TYPE uint8_t 
+#define PIXEL_TYPE uint8_t
 #elif DEPTH == 15 || DEPTH == 16
 #define BPP 2
-#define PIXEL_TYPE uint16_t 
+#define PIXEL_TYPE uint16_t
 #elif DEPTH == 32
 #define BPP 4
-#define PIXEL_TYPE uint32_t 
+#define PIXEL_TYPE uint32_t
 #else
 #error unsupport depth
 #endif
@@ -43,9 +43,9 @@
 
 #if DEPTH != 15 && !defined(BGR_FORMAT)
 
-static inline void glue(vga_draw_glyph_line_, DEPTH)(uint8_t *d, 
+static inline void glue(vga_draw_glyph_line_, DEPTH)(uint8_t *d,
                                                      uint32_t font_data,
-                                                     uint32_t xorcol, 
+                                                     uint32_t xorcol,
                                                      uint32_t bgcol)
 {
 #if BPP == 1
@@ -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,15 +88,15 @@ 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];
-        glue(vga_draw_glyph_line_, DEPTH)(d, 
-                                          expand4to8[font_data >> 4], 
+        glue(vga_draw_glyph_line_, DEPTH)(d,
+                                          expand4to8[font_data >> 4],
                                           xorcol, bgcol);
-        glue(vga_draw_glyph_line_, DEPTH)(d + 8 * BPP, 
-                                          expand4to8[font_data & 0x0f], 
+        glue(vga_draw_glyph_line_, DEPTH)(d + 8 * BPP,
+                                          expand4to8[font_data & 0x0f],
                                           xorcol, bgcol);
         font_ptr += 4;
         d += linesize;
@@ -104,11 +104,11 @@ static void glue(vga_draw_glyph16_, DEPTH)(uint8_t *d, int linesize,
 }
 
 static void glue(vga_draw_glyph9_, DEPTH)(uint8_t *d, int linesize,
-                                          const uint8_t *font_ptr, int h, 
+                                          const uint8_t *font_ptr, int h,
                                           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);
@@ -151,10 +151,10 @@ static void glue(vga_draw_glyph9_, DEPTH)(uint8_t *d, int linesize,
     } while (--h);
 }
 
-/* 
+/*
  * 4 color mode
  */
-static void glue(vga_draw_line2_, DEPTH)(VGAState *s1, uint8_t *d, 
+static void glue(vga_draw_line2_, DEPTH)(VGAState *s1, uint8_t *d,
                                          const uint8_t *s, int width)
 {
     uint32_t plane_mask, *palette, data, v;
@@ -193,10 +193,10 @@ static void glue(vga_draw_line2_, DEPTH)(VGAState *s1, uint8_t *d,
 ((uint32_t *)d)[2*(n)] = ((uint32_t *)d)[2*(n)+1] = (v)
 #endif
 
-/* 
+/*
  * 4 color mode, dup2 horizontal
  */
-static void glue(vga_draw_line2d2_, DEPTH)(VGAState *s1, uint8_t *d, 
+static void glue(vga_draw_line2d2_, DEPTH)(VGAState *s1, uint8_t *d,
                                            const uint8_t *s, int width)
 {
     uint32_t plane_mask, *palette, data, v;
@@ -226,10 +226,10 @@ static void glue(vga_draw_line2d2_, DEPTH)(VGAState *s1, uint8_t *d,
     }
 }
 
-/* 
+/*
  * 16 color mode
  */
-static void glue(vga_draw_line4_, DEPTH)(VGAState *s1, uint8_t *d, 
+static void glue(vga_draw_line4_, DEPTH)(VGAState *s1, uint8_t *d,
                                          const uint8_t *s, int width)
 {
     uint32_t plane_mask, data, v, *palette;
@@ -258,10 +258,10 @@ static void glue(vga_draw_line4_, DEPTH)(VGAState *s1, uint8_t *d,
     }
 }
 
-/* 
+/*
  * 16 color mode, dup2 horizontal
  */
-static void glue(vga_draw_line4d2_, DEPTH)(VGAState *s1, uint8_t *d, 
+static void glue(vga_draw_line4d2_, DEPTH)(VGAState *s1, uint8_t *d,
                                            const uint8_t *s, int width)
 {
     uint32_t plane_mask, data, v, *palette;
@@ -290,12 +290,12 @@ static void glue(vga_draw_line4d2_, DEPTH)(VGAState *s1, uint8_t *d,
     }
 }
 
-/* 
+/*
  * 256 color mode, double pixels
  *
  * XXX: add plane_mask support (never used in standard VGA modes)
  */
-static void glue(vga_draw_line8d2_, DEPTH)(VGAState *s1, uint8_t *d, 
+static void glue(vga_draw_line8d2_, DEPTH)(VGAState *s1, uint8_t *d,
                                            const uint8_t *s, int width)
 {
     uint32_t *palette;
@@ -313,12 +313,12 @@ static void glue(vga_draw_line8d2_, DEPTH)(VGAState *s1, uint8_t *d,
     }
 }
 
-/* 
+/*
  * standard 256 color mode
  *
  * XXX: add plane_mask support (never used in standard VGA modes)
  */
-static void glue(vga_draw_line8_, DEPTH)(VGAState *s1, uint8_t *d, 
+static void glue(vga_draw_line8_, DEPTH)(VGAState *s1, uint8_t *d,
                                          const uint8_t *s, int width)
 {
     uint32_t *palette;
@@ -340,10 +340,10 @@ static void glue(vga_draw_line8_, DEPTH)(VGAState *s1, uint8_t *d,
     }
 }
 
-void glue(vga_draw_cursor_line_, DEPTH)(uint8_t *d1, 
-                                        const uint8_t *src1, 
+void glue(vga_draw_cursor_line_, DEPTH)(uint8_t *d1,
+                                        const uint8_t *src1,
                                         int poffset, int w,
-                                        unsigned int color0, 
+                                        unsigned int color0,
                                         unsigned int color1,
                                         unsigned int color_xor)
 {
@@ -411,10 +411,10 @@ void glue(vga_draw_cursor_line_, DEPTH)(uint8_t *d1,
 
 /* XXX: optimize */
 
-/* 
+/*
  * 15 bit color
  */
-static void glue(vga_draw_line15_, PIXEL_NAME)(VGAState *s1, uint8_t *d, 
+static void glue(vga_draw_line15_, PIXEL_NAME)(VGAState *s1, uint8_t *d,
                                           const uint8_t *s, int width)
 {
 #if DEPTH == 15 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
@@ -433,13 +433,13 @@ static void glue(vga_draw_line15_, PIXEL_NAME)(VGAState *s1, uint8_t *d,
         s += 2;
         d += BPP;
     } while (--w != 0);
-#endif    
+#endif
 }
 
-/* 
+/*
  * 16 bit color
  */
-static void glue(vga_draw_line16_, PIXEL_NAME)(VGAState *s1, uint8_t *d, 
+static void glue(vga_draw_line16_, PIXEL_NAME)(VGAState *s1, uint8_t *d,
                                           const uint8_t *s, int width)
 {
 #if DEPTH == 16 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
@@ -458,13 +458,13 @@ static void glue(vga_draw_line16_, PIXEL_NAME)(VGAState *s1, uint8_t *d,
         s += 2;
         d += BPP;
     } while (--w != 0);
-#endif    
+#endif
 }
 
-/* 
+/*
  * 24 bit color
  */
-static void glue(vga_draw_line24_, PIXEL_NAME)(VGAState *s1, uint8_t *d, 
+static void glue(vga_draw_line24_, PIXEL_NAME)(VGAState *s1, uint8_t *d,
                                           const uint8_t *s, int width)
 {
     int w;
@@ -487,10 +487,10 @@ static void glue(vga_draw_line24_, PIXEL_NAME)(VGAState *s1, uint8_t *d,
     } while (--w != 0);
 }
 
-/* 
+/*
  * 32 bit color
  */
-static void glue(vga_draw_line32_, PIXEL_NAME)(VGAState *s1, uint8_t *d, 
+static void glue(vga_draw_line32_, PIXEL_NAME)(VGAState *s1, uint8_t *d,
                                           const uint8_t *s, int width)
 {
 #if DEPTH == 32 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) && !defined(BGR_FORMAT)
index bd893288aa0cc5e6936aaa7e5b09ff6d48a78b81..f0f8c103d07161de441b04918eb775377fea42c4 100644 (file)
--- a/keymaps.c
+++ b/keymaps.c
@@ -1,8 +1,8 @@
 /*
  * QEMU keysym to keycode conversion using rdesktop keymaps
- * 
+ *
  * Copyright (c) 2004 Johannes Schindelin
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
index 0b53f1c254bb578af46919efc9647f0dc9b7a4eb..adc56c77d24ca2e7f813daebd124878efc1527ed 100644 (file)
@@ -82,7 +82,7 @@ F12 0x58 localstate
 
 # Printscreen, Scrollock and Pause
 # Printscreen really requires four scancodes (0xe0, 0x2a, 0xe0, 0x37),
-# but (0xe0, 0x37) seems to work. 
+# but (0xe0, 0x37) seems to work.
 Print 0xb7 localstate
 Sys_Req 0xb7 localstate
 Execute 0xb7 localstate
index f83837b44481305ec2b2393c969efa65e865f7db..852f8b8dbb8e74106d8e82093a2cd2320b5382c7 100644 (file)
@@ -1,5 +1,5 @@
-# rdesktop Swiss-German (de-ch) keymap file 
-# 2003-06-03 by noldi@tristar.ch 
+# rdesktop Swiss-German (de-ch) keymap file
+# 2003-06-03 by noldi@tristar.ch
 #
 include common
 map 0x00000807
@@ -40,7 +40,7 @@ bar 0x08 altgr
 # Scan Code 9
 parenleft 0x09 shift
 cent 0x09 altgr
-# 
+#
 # Scan Code 10
 parenright 0x0a shift
 #
@@ -49,7 +49,7 @@ equal 0x0b shift
 braceright 0x0b altgr inhibit
 #
 # Scan Code 12
-apostrophe 0x0c 
+apostrophe 0x0c
 question 0x0c shift
 dead_acute 0x0c altgr
 #
@@ -68,10 +68,10 @@ z 0x15 addupper
 udiaeresis 0x1a
 egrave 0x1a shift
 bracketleft 0x1a altgr
-# 
+#
 # Scan Code 28
 dead_diaeresis 0x1b
-exclam 0x1b shift 
+exclam 0x1b shift
 bracketright 0x1b altgr
 #
 # Scan Code 40
@@ -93,17 +93,17 @@ backslash 0x56 altgr
 #
 # Scan Code 46
 y 0x2c addupper
-# 
+#
 # Scan Code 53
 comma 0x33
 semicolon 0x33 shift
-# 
+#
 # Scan Code 54
 period 0x34
 colon 0x34 shift
 #
 # Scan Code 55
-minus 0x35 
+minus 0x35
 underscore 0x35 shift
 #
 # Suppress Windows unsupported AltGr keys
index b5a73fef708d84b735e70c39dd4a58df96e35c61..3252e31c37b0fac5639aba7d8c71792b7cbf2e84 100644 (file)
@@ -50,9 +50,9 @@ dead_grave 0xd shift
 # QWERTY first row
 #
 EuroSign 0x12 altgr
-udiaeresis 0x1a 
+udiaeresis 0x1a
 Udiaeresis 0x1a shift
-otilde 0x1b 
+otilde 0x1b
 Otilde 0x1b shift
 section 0x1b altgr
 
@@ -61,9 +61,9 @@ section 0x1b altgr
 #
 scaron 0x1f altgr
 Scaron 0x1f altgr shift
-odiaeresis 0x27 
+odiaeresis 0x27
 Odiaeresis 0x27 shift
-adiaeresis 0x28 
+adiaeresis 0x28
 Adiaeresis 0x28 shift
 asciicircum 0x28 altgr
 apostrophe 0x2b
@@ -72,7 +72,7 @@ onehalf 0x2b altgr
 #
 # QWERTY third row
 #
-less 0x56 
+less 0x56
 greater 0x56 shift
 bar 0x56 altgr
 zcaron 0x2c altgr
index cbb45910f4dd3b0178f3d3147087866ba5a7f2a9..ba5a176c31741067a123e554efbc3744a8fde5b8 100644 (file)
@@ -97,7 +97,7 @@ Ooblique 0x18 shift altgr
 thorn 0x19 altgr
 THORN 0x19 shift altgr
 
-dead_circumflex 0x1a 
+dead_circumflex 0x1a
 dead_diaeresis 0x1a shift
 dead_abovering 0x1a shift altgr
 
index 8fde40f19acb5048983c7b52278374f5b389390a..d512cf666d56317640038c794758d23980f3ab42 100644 (file)
@@ -1,6 +1,6 @@
-# 2004-03-16 Halldór Guðmundsson and Morten Lange 
+# 2004-03-16 Halldór Guðmundsson and Morten Lange
 # Keyboard definition file for the Icelandic keyboard
-# to be used in rdesktop 1.3.x ( See rdesktop.org) 
+# to be used in rdesktop 1.3.x ( See rdesktop.org)
 # generated from XKB map de, and changed manually
 # Location for example /usr/local/share/rdesktop/keymaps/is
 include common
@@ -71,8 +71,8 @@ Ooblique 0x18 shift altgr
 #Udiaeresis 0x1a shift
 #dead_diaeresis 0x1a altgr
 #dead_abovering 0x1a shift altgr
-eth 0x1a 
-ETH 0x1a shift 
+eth 0x1a
+ETH 0x1a shift
 apostrophe 0x1b
 question 0x1b shift
 #plus 0x1b
@@ -84,9 +84,9 @@ asciitilde 0x1b altgr
 #ae 0x1e altgr
 #AE 0x1e shift altgr
 #eth 0x20 altgr
-#eth 0x20 
+#eth 0x20
 #ETH 0x20 shift altgr
-#ETH 0x20 shift 
+#ETH 0x20 shift
 dstroke 0x21 altgr
 ordfeminine 0x21 shift altgr
 eng 0x22 altgr
@@ -96,8 +96,8 @@ Hstroke 0x23 shift altgr
 kra 0x25 altgr
 #adiaeresis 0x27
 #Adiaeresis 0x27 shift
-ae 0x27 
-AE 0x27 shift 
+ae 0x27
+AE 0x27 shift
 dead_doubleacute 0x27 altgr
 #adiaeresis 0x28
 #Adiaeresis 0x28 shift
@@ -133,8 +133,8 @@ periodcentered 0x34 altgr
 division 0x34 shift altgr
 #minus 0x35
 #underscore 0x35 shift
-thorn 0x35 
-THORN 0x35 shift 
+thorn 0x35
+THORN 0x35 shift
 dead_belowdot 0x35 altgr
 dead_abovedot 0x35 shift altgr
 
index d8b019f04004bf50a9ea7bf6fe8ba1f2157fc598..84a04d651edc3cb2c276b167f381944967c0d1f1 100644 (file)
@@ -8,10 +8,10 @@ Alt_L 0x38
 Control_R 0x9d
 Control_L 0x1d
 
-# Translate Super to Windows keys. 
-# This is hardcoded. See documentation for details. 
+# Translate Super to Windows keys.
+# This is hardcoded. See documentation for details.
 Super_R 0xdb
 Super_L 0xdc
 
-# Translate Menu to the Windows Application key. 
+# Translate Menu to the Windows Application key.
 Menu 0xdd
index bc823bd2f7e1622b9a23f197bc8787bb801daac1..4f0fe3df77cd78547dfcae3b6b6dcefc83f60e33 100644 (file)
@@ -45,7 +45,7 @@ less 0x2b
 greater 0x2b shift
 guillemotleft 0x2c altgr
 guillemotright 0x2d altgr
-copyright 0x2e altgr 
+copyright 0x2e altgr
 mu 0x32 altgr
 comma 0x33
 semicolon 0x33 shift
index 736d637b3f3df27f74e8fa0a84dfe803d80064e4..9905a48dbb17f19b780e6df00617a3cd767acb82 100644 (file)
@@ -50,18 +50,18 @@ dead_grave 0xd shift
 # QWERTY first row
 #
 EuroSign 0x12 altgr
-aring 0x1a 
+aring 0x1a
 Aring 0x1a shift
-dead_diaeresis 0x1b 
+dead_diaeresis 0x1b
 dead_circumflex 0x1b shift
 dead_tilde 0x1b altgr
 
 #
 # QWERTY second row
 #
-odiaeresis 0x27 
+odiaeresis 0x27
 Odiaeresis 0x27 shift
-adiaeresis 0x28 
+adiaeresis 0x28
 Adiaeresis 0x28 shift
 apostrophe 0x2b
 asterisk 0x2b shift
diff --git a/kqemu.c b/kqemu.c
index 96ca5826c291f649a37cae269f3f1be0d4368a4b..b6632878eec3d9d6d2b4b2641d06cea4d06758e4 100644 (file)
--- a/kqemu.c
+++ b/kqemu.c
@@ -1,6 +1,6 @@
 /*
  *  KQEMU support
- * 
+ *
  *  Copyright (c) 2005 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -129,9 +129,9 @@ static void kqemu_update_cpuid(CPUState *env)
        target cpus because they are important for user code. Strictly
        speaking, only SSE really matters because the OS must support
        it if the user code uses it. */
-    critical_features_mask = 
-        CPUID_CMOV | CPUID_CX8 | 
-        CPUID_FXSR | CPUID_MMX | CPUID_SSE | 
+    critical_features_mask =
+        CPUID_CMOV | CPUID_CX8 |
+        CPUID_FXSR | CPUID_MMX | CPUID_SSE |
         CPUID_SSE2 | CPUID_SEP;
     ext_features_mask = CPUID_EXT_SSE3 | CPUID_EXT_MONITOR;
     if (!is_cpuid_supported()) {
@@ -193,17 +193,17 @@ int kqemu_init(CPUState *env)
         goto fail;
     }
 
-    pages_to_flush = qemu_vmalloc(KQEMU_MAX_PAGES_TO_FLUSH * 
+    pages_to_flush = qemu_vmalloc(KQEMU_MAX_PAGES_TO_FLUSH *
                                   sizeof(unsigned long));
     if (!pages_to_flush)
         goto fail;
 
-    ram_pages_to_update = qemu_vmalloc(KQEMU_MAX_RAM_PAGES_TO_UPDATE * 
+    ram_pages_to_update = qemu_vmalloc(KQEMU_MAX_RAM_PAGES_TO_UPDATE *
                                        sizeof(unsigned long));
     if (!ram_pages_to_update)
         goto fail;
 
-    modified_ram_pages = qemu_vmalloc(KQEMU_MAX_MODIFIED_RAM_PAGES * 
+    modified_ram_pages = qemu_vmalloc(KQEMU_MAX_MODIFIED_RAM_PAGES *
                                       sizeof(unsigned long));
     if (!modified_ram_pages)
         goto fail;
@@ -285,7 +285,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;
@@ -311,12 +311,12 @@ void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr)
         if (nb_modified_ram_pages >= KQEMU_MAX_MODIFIED_RAM_PAGES) {
             /* flush */
 #ifdef _WIN32
-            ret = DeviceIoControl(kqemu_fd, KQEMU_MODIFY_RAM_PAGES, 
-                                  &nb_modified_ram_pages, 
+            ret = DeviceIoControl(kqemu_fd, KQEMU_MODIFY_RAM_PAGES,
+                                  &nb_modified_ram_pages,
                                   sizeof(nb_modified_ram_pages),
                                   NULL, 0, &temp, NULL);
 #else
-            ret = ioctl(kqemu_fd, KQEMU_MODIFY_RAM_PAGES, 
+            ret = ioctl(kqemu_fd, KQEMU_MODIFY_RAM_PAGES,
                         &nb_modified_ram_pages);
 #endif
             kqemu_reset_modified_ram_pages();
@@ -363,7 +363,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;
@@ -383,7 +383,7 @@ static void restore_native_fp_frstor(CPUState *env)
     }
     asm volatile ("frstor %0" : "=m" (*fp));
 }
+
 static void save_native_fp_fsave(CPUState *env)
 {
     int fptag, i, j;
@@ -469,7 +469,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) {
@@ -481,12 +481,12 @@ static int do_syscall(CPUState *env,
         code64 = env->hflags & HF_CS64_MASK;
 
         cpu_x86_set_cpl(env, 0);
-        cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc, 
-                               0, 0xffffffff, 
+        cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc,
+                               0, 0xffffffff,
                                DESC_G_MASK | DESC_P_MASK |
                                DESC_S_MASK |
                                DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK);
-        cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc, 
+        cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc,
                                0, 0xffffffff,
                                DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                                DESC_S_MASK |
@@ -496,18 +496,18 @@ static int do_syscall(CPUState *env,
             env->eip = env->lstar;
         else
             env->eip = env->cstar;
-    } else 
+    } else
 #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, 
+        cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc,
+                           0, 0xffffffff,
                                DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                                DESC_S_MASK |
                                DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
-        cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc, 
+        cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc,
                                0, 0xffffffff,
                                DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                                DESC_S_MASK |
@@ -604,7 +604,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");
@@ -615,9 +615,9 @@ void kqemu_record_dump(void)
     for(i = 0; i < nb_pc_records; i++) {
         r = pr[i];
         sum += r->count;
-        fprintf(f, "%08lx: %" PRId64 " %0.2f%% %0.2f%%\n", 
-                r->pc, 
-                r->count, 
+        fprintf(f, "%08lx: %" PRId64 " %0.2f%% %0.2f%%\n",
+                r->pc,
+                r->count,
                 (double)r->count / (double)total * 100.0,
                 (double)sum / (double)total * 100.0);
     }
@@ -696,7 +696,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
@@ -788,7 +788,7 @@ int kqemu_cpu_exec(CPUState *env)
     {
         unsigned int new_hflags;
 #ifdef TARGET_X86_64
-        if ((env->hflags & HF_LMA_MASK) && 
+        if ((env->hflags & HF_LMA_MASK) &&
             (env->segs[R_CS].flags & DESC_L_MASK)) {
             /* long mode */
             new_hflags = HF_CS32_MASK | HF_SS32_MASK | HF_CS64_MASK;
@@ -800,7 +800,7 @@ int kqemu_cpu_exec(CPUState *env)
                 >> (DESC_B_SHIFT - HF_CS32_SHIFT);
             new_hflags |= (env->segs[R_SS].flags & DESC_B_MASK)
                 >> (DESC_B_SHIFT - HF_SS32_SHIFT);
-            if (!(env->cr[0] & CR0_PE_MASK) || 
+            if (!(env->cr[0] & CR0_PE_MASK) ||
                    (env->eflags & VM_MASK) ||
                    !(env->hflags & HF_CS32_MASK)) {
                 /* XXX: try to avoid this test. The problem comes from the
@@ -810,13 +810,13 @@ int kqemu_cpu_exec(CPUState *env)
                    translate-i386.c. */
                 new_hflags |= HF_ADDSEG_MASK;
             } else {
-                new_hflags |= ((env->segs[R_DS].base | 
+                new_hflags |= ((env->segs[R_DS].base |
                                 env->segs[R_ES].base |
-                                env->segs[R_SS].base) != 0) << 
+                                env->segs[R_SS].base) != 0) <<
                     HF_ADDSEG_SHIFT;
             }
         }
-        env->hflags = (env->hflags & 
+        env->hflags = (env->hflags &
            ~(HF_CS32_MASK | HF_SS32_MASK | HF_CS64_MASK | HF_ADDSEG_MASK)) |
             new_hflags;
     }
@@ -827,7 +827,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);
@@ -836,7 +836,7 @@ int kqemu_cpu_exec(CPUState *env)
     if (ret == KQEMU_RET_SYSCALL) {
         /* syscall instruction */
         return do_syscall(env, kenv);
-    } else 
+    } else
     if ((ret & 0xff00) == KQEMU_RET_INT) {
         env->exception_index = ret & 0xff;
         env->error_code = 0;
@@ -847,7 +847,7 @@ int kqemu_cpu_exec(CPUState *env)
 #endif
 #ifdef DEBUG
         if (loglevel & CPU_LOG_INT) {
-            fprintf(logfile, "kqemu: interrupt v=%02x:\n", 
+            fprintf(logfile, "kqemu: interrupt v=%02x:\n",
                     env->exception_index);
             cpu_dump_state(env, logfile, fprintf, 0);
         }
@@ -879,7 +879,7 @@ int kqemu_cpu_exec(CPUState *env)
         }
 #endif
         return 0;
-    } else if (ret == KQEMU_RET_SOFTMMU) { 
+    } else if (ret == KQEMU_RET_SOFTMMU) {
 #ifdef CONFIG_PROFILER
         {
             unsigned long pc = env->eip + env->segs[R_CS].base;
@@ -903,7 +903,7 @@ int kqemu_cpu_exec(CPUState *env)
 void kqemu_cpu_interrupt(CPUState *env)
 {
 #if defined(_WIN32) && KQEMU_VERSION >= 0x010101
-    /* cancelling the I/O request causes KQEMU to finish executing the 
+    /* cancelling the I/O request causes KQEMU to finish executing the
        current block and successfully returning. */
     CancelIo(kqemu_fd);
 #endif
diff --git a/kqemu.h b/kqemu.h
index 892e335935d090e6efc6edee57c91c6510d1b51b..7b43057e34429ae1bf16656cfca43090b025aee0 100644 (file)
--- a/kqemu.h
+++ b/kqemu.h
@@ -1,8 +1,8 @@
 /*
  * KQEMU header
- * 
+ *
  * Copyright (c) 2004-2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -91,7 +91,7 @@ struct kqemu_cpu_state {
     long retval;
 
     /* number of ram_dirty entries to update */
-    unsigned int nb_ram_pages_to_update; 
+    unsigned int nb_ram_pages_to_update;
 #define KQEMU_MAX_RAM_PAGES_TO_UPDATE 512
 #define KQEMU_RAM_PAGES_UPDATE_ALL (KQEMU_MAX_RAM_PAGES_TO_UPDATE + 1)
 
index f7b2fed64125ed73563fa56191babd8f05371dee..5546d7c3b26d665b5801e83d6d4fedd722bc19e9 100644 (file)
@@ -507,7 +507,7 @@ unsigned long setup_arg_pages(target_ulong p, struct linux_binprm * bprm,
     size = x86_stack_size;
     if (size < MAX_ARG_PAGES*TARGET_PAGE_SIZE)
         size = MAX_ARG_PAGES*TARGET_PAGE_SIZE;
-    error = target_mmap(0, 
+    error = target_mmap(0,
                         size + qemu_host_page_size,
                         PROT_READ | PROT_WRITE,
                         MAP_PRIVATE | MAP_ANONYMOUS,
@@ -567,7 +567,7 @@ static void padzero(unsigned long elf_bss, unsigned long last_bss)
            size must be known */
         if (qemu_real_host_page_size < qemu_host_page_size) {
             unsigned long end_addr, end_addr1;
-            end_addr1 = (elf_bss + qemu_real_host_page_size - 1) & 
+            end_addr1 = (elf_bss + qemu_real_host_page_size - 1) &
                 ~(qemu_real_host_page_size - 1);
             end_addr = HOST_PAGE_ALIGN(elf_bss);
             if (end_addr1 < end_addr) {
@@ -625,7 +625,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); \
@@ -648,7 +648,7 @@ static unsigned long create_elf_tables(target_ulong p, int argc, int envc,
         if (k_platform)
             NEW_AUX_ENT(AT_PLATFORM, u_platform);
 #ifdef ARCH_DLINFO
-       /* 
+       /*
         * ARCH_DLINFO must come last so platform specific code can enforce
         * special alignment requirements on the AUXV if necessary (eg. PPC).
         */
@@ -673,7 +673,7 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex,
        unsigned long last_bss, elf_bss;
        unsigned long error;
        int i;
-       
+
        elf_bss = 0;
        last_bss = 0;
        error = 0;
@@ -682,24 +682,24 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex,
         bswap_ehdr(interp_elf_ex);
 #endif
        /* First of all, some simple consistency checks */
-       if ((interp_elf_ex->e_type != ET_EXEC && 
-             interp_elf_ex->e_type != ET_DYN) || 
+       if ((interp_elf_ex->e_type != ET_EXEC &&
+             interp_elf_ex->e_type != ET_DYN) ||
           !elf_check_arch(interp_elf_ex->e_machine)) {
                return ~0UL;
        }
-       
+
 
        /* Now read in all of the header information */
-       
+
        if (sizeof(struct elf_phdr) * interp_elf_ex->e_phnum > TARGET_PAGE_SIZE)
            return ~0UL;
-       
-       elf_phdata =  (struct elf_phdr *) 
+
+       elf_phdata =  (struct elf_phdr *)
                malloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum);
 
        if (!elf_phdata)
          return ~0UL;
-       
+
        /*
         * If the size of this structure has changed, then punt, since
         * we will be doing the wrong thing.
@@ -732,7 +732,7 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex,
             /* in order to avoid hardcoding the interpreter load
                address in qemu, we allocate a big enough memory zone */
             error = target_mmap(0, INTERP_MAP_SIZE,
-                                PROT_NONE, MAP_PRIVATE | MAP_ANON, 
+                                PROT_NONE, MAP_PRIVATE | MAP_ANON,
                                 -1, 0);
             if (error == -1) {
                 perror("mmap");
@@ -763,7 +763,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);
@@ -790,7 +790,7 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex,
            k = load_addr + eppnt->p_memsz + eppnt->p_vaddr;
            if (k > last_bss) last_bss = k;
          }
-       
+
        /* Now use mmap to map the library into memory. */
 
        close(interpreter_fd);
@@ -853,7 +853,7 @@ static void load_symbols(struct elfhdr *hdr, int fd)
     s->disas_strtab = strings = malloc(strtab.sh_size);
     if (!s->disas_symtab || !s->disas_strtab)
        return;
-       
+
     lseek(fd, symtab.sh_offset, SEEK_SET);
     if (read(fd, s->disas_symtab, symtab.sh_size) != symtab.sh_size)
        return;
@@ -925,7 +925,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
 
     retval = lseek(bprm->fd, elf_ex.e_phoff, SEEK_SET);
     if(retval > 0) {
-       retval = read(bprm->fd, (char *) elf_phdata, 
+       retval = read(bprm->fd, (char *) elf_phdata,
                                elf_ex.e_phentsize * elf_ex.e_phnum);
     }
 
@@ -984,7 +984,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
            if(retval < 0) {
                perror("load_elf_binary2");
                exit(-1);
-           }   
+           }
 
            /* If the program interpreter is one of these two,
               then assume an iBCS2 image. Otherwise assume
@@ -1105,10 +1105,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;
@@ -1122,7 +1122,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
             /* NOTE: for qemu, we do a big mmap to get enough space
                without hardcoding any address */
             error = target_mmap(0, ET_DYN_MAP_SIZE,
-                                PROT_NONE, MAP_PRIVATE | MAP_ANON, 
+                                PROT_NONE, MAP_PRIVATE | MAP_ANON,
                                 -1, 0);
             if (error == -1) {
                 perror("mmap");
@@ -1130,14 +1130,14 @@ 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)),
                             elf_prot,
                             (MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE),
                             bprm->fd,
-                            (elf_ppnt->p_offset - 
+                            (elf_ppnt->p_offset -
                              TARGET_ELF_PAGEOFFSET(elf_ppnt->p_vaddr)));
         if (error == -1) {
             perror("mmap");
@@ -1148,7 +1148,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;
@@ -1159,14 +1159,14 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
             }
         }
         k = elf_ppnt->p_vaddr;
-        if (k < start_code) 
+        if (k < start_code)
             start_code = k;
         k = elf_ppnt->p_vaddr + elf_ppnt->p_filesz;
-        if (k > elf_bss) 
+        if (k > elf_bss)
             elf_bss = k;
         if ((elf_ppnt->p_flags & PF_X) && end_code <  k)
             end_code = k;
-        if (end_data < k) 
+        if (end_data < k)
             end_data = k;
         k = elf_ppnt->p_vaddr + elf_ppnt->p_memsz;
         if (k > elf_brk) elf_brk = k;
index 6d52b1ffe9e9da36f24fe695b3c8d1b7112fec7b..9b84c7292275cdfa3f96b3af8b8c2c4f2bb9b061 100644 (file)
@@ -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 */
 };
index 7e3296e5aa341589b8c2dc5f47ba6d85e1b7c3d2..1ee5ae9ebfc2f21cac8e7ef82c9aa0f9adbe029d 100644 (file)
@@ -359,7 +359,7 @@ void old_reloc(struct lib_info *libinfo, uint32_t rl)
                "(address %p, currently %x) into segment %s\n",
                offset, ptr, (int)*ptr, segment[reloc_type]);
 #endif
-       
+
        switch (reloc_type) {
        case OLD_FLAT_RELOC_TYPE_TEXT:
                *ptr += libinfo->start_code;
@@ -376,7 +376,7 @@ void old_reloc(struct lib_info *libinfo, uint32_t rl)
                break;
        }
        DBG_FLT("Relocation became %x\n", (int)*ptr);
-}              
+}
 
 /****************************************************************************/
 
@@ -415,7 +415,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");
@@ -457,7 +457,7 @@ static int load_flat_file(struct linux_binprm * bprm,
 
         textpos = target_mmap(0, text_len, PROT_READ|PROT_EXEC,
                               MAP_PRIVATE, bprm->fd, 0);
-        if (textpos == -1) { 
+        if (textpos == -1) {
             fprintf(stderr, "Unable to mmap process text\n");
             return -1;
         }
@@ -479,7 +479,7 @@ static int load_flat_file(struct linux_binprm * bprm,
         fpos = ntohl(hdr->data_start);
 #ifdef CONFIG_BINFMT_ZFLAT
         if (flags & FLAT_FLAG_GZDATA) {
-            result = decompress_exec(bprm, fpos, (char *) datapos, 
+            result = decompress_exec(bprm, fpos, (char *) datapos,
                                      data_len + (relocs * sizeof(target_ulong)))
         } else
 #endif
@@ -578,7 +578,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
@@ -659,7 +659,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);
 
@@ -729,11 +729,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) {
@@ -757,7 +757,7 @@ int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
     /* Align stack.  */
     sp = p & ~(target_ulong)(sizeof(target_ulong) - 1);
     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).
@@ -774,7 +774,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;
@@ -788,6 +788,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;
 }
index cc0942b81181742d52283449997e6ea35b503364..5548e928e937c7f8f7523e1b4a4fc4e2f218244d 100644 (file)
@@ -146,8 +146,8 @@ struct target_vm86plus_struct {
 
 #define TARGET_SEMOP           1
 #define TARGET_SEMGET          2
-#define TARGET_SEMCTL          3 
-#define TARGET_MSGSND          11 
+#define TARGET_SEMCTL          3
+#define TARGET_MSGSND          11
 #define TARGET_MSGRCV          12
 #define TARGET_MSGGET          13
 #define TARGET_MSGCTL          14
@@ -164,7 +164,7 @@ struct target_msgbuf {
 struct target_ipc_kludge {
        unsigned int    msgp;   /* Really (struct msgbuf *) */
        int msgtyp;
-};     
+};
 
 struct target_ipc_perm {
        int     key;
index 2d20c000db320bf70ca617eac2120eb52ea1072c..28f00aa5bd45bf854b5d84432840716a7da3031c 100644 (file)
@@ -140,7 +140,7 @@ target_ulong loader_build_argptr(int envc, int argc, target_ulong sp,
     return sp;
 }
 
-int loader_exec(const char * filename, char ** argv, char ** envp, 
+int loader_exec(const char * filename, char ** argv, char ** envp,
              struct target_pt_regs * regs, struct image_info *infop)
 {
     struct linux_binprm bprm;
@@ -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);
index 7f6dddaee48aeb0c93cdc66e4e016de62a71aca0..73fc283d9afa12c3be11f3feda60e66aa5ecd4c0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  m68k/ColdFire Semihosting ssycall interface
- * 
+ *
  *  Copyright (c) 2005 CodeSourcery, LLC. Written by Paul Brook.
  *
  *  This program is free software; you can redistribute it and/or modify
index 667808e8c8dc010f4eafc35c229674dfee0090d3..aab82dd7ec54fda6383df3c7e81485217246d85a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  m68k simulator syscall interface
- * 
+ *
  *  Copyright (c) 2005 CodeSourcery, LLC. Written by Paul Brook.
  *
  *  This program is free software; you can redistribute it and/or modify
index 7199372b30b360a086d4adade68314c5688f3b0e..a14e08f2cda6f8ae9157123e430ca98e804c6d0a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  qemu user main
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -131,7 +131,7 @@ uint64_t cpu_get_tsc(CPUX86State *env)
     return cpu_get_real_ticks();
 }
 
-static void write_dt(void *ptr, unsigned long addr, unsigned long limit, 
+static void write_dt(void *ptr, unsigned long addr, unsigned long limit,
                      int flags)
 {
     unsigned int e1, e2;
@@ -144,7 +144,7 @@ static void write_dt(void *ptr, unsigned long addr, unsigned long limit,
     p[1] = tswapl(e2);
 }
 
-static void set_gate(void *ptr, unsigned int type, unsigned int dpl, 
+static void set_gate(void *ptr, unsigned int type, unsigned int dpl,
                      unsigned long addr, unsigned int sel)
 {
     unsigned int e1, e2;
@@ -176,8 +176,8 @@ void cpu_loop(CPUX86State *env)
         switch(trapnr) {
         case 0x80:
             /* linux syscall */
-            env->regs[R_EAX] = do_syscall(env, 
-                                          env->regs[R_EAX], 
+            env->regs[R_EAX] = do_syscall(env,
+                                          env->regs[R_EAX],
                                           env->regs[R_EBX],
                                           env->regs[R_ECX],
                                           env->regs[R_EDX],
@@ -281,7 +281,7 @@ void cpu_loop(CPUX86State *env)
             break;
         default:
             pc = env->segs[R_CS].base + env->eip;
-            fprintf(stderr, "qemu: 0x%08lx: unhandled CPU exception 0x%x - aborting\n", 
+            fprintf(stderr, "qemu: 0x%08lx: unhandled CPU exception 0x%x - aborting\n",
                     (long)pc, trapnr);
             abort();
         }
@@ -319,7 +319,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) {
@@ -331,7 +331,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;
@@ -383,8 +383,8 @@ void cpu_loop(CPUARMState *env)
                         n -= ARM_SYSCALL_BASE;
                         env->eabi = 0;
                     }
-                    env->regs[0] = do_syscall(env, 
-                                              n, 
+                    env->regs[0] = do_syscall(env,
+                                              n,
                                               env->regs[0],
                                               env->regs[1],
                                               env->regs[2],
@@ -431,7 +431,7 @@ void cpu_loop(CPUARMState *env)
             break;
         default:
         error:
-            fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", 
+            fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
                     trapnr);
             cpu_dump_state(env, stderr, fprintf, 0);
             abort();
@@ -463,10 +463,10 @@ 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", 
+    printf("win_overflow: sp_ptr=0x%x save_cwp=%d\n",
            (int)sp_ptr, cwp1);
 #endif
     for(i = 0; i < 16; i++) {
@@ -494,15 +494,15 @@ 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)];
 #if defined(DEBUG_WIN)
-    printf("win_underflow: sp_ptr=0x%x load_cwp=%d\n", 
+    printf("win_underflow: sp_ptr=0x%x load_cwp=%d\n",
            (int)sp_ptr, cwp1);
 #endif
     for(i = 0; i < 16; i++) {
@@ -543,20 +543,20 @@ 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: 
+        case 0x88:
         case 0x90:
 #else
         case 0x16d:
 #endif
             ret = do_syscall (env, env->gregs[1],
-                              env->regwptr[0], env->regwptr[1], 
-                              env->regwptr[2], env->regwptr[3], 
+                              env->regwptr[0], env->regwptr[1],
+                              env->regwptr[2], env->regwptr[3],
                               env->regwptr[4], env->regwptr[5]);
             if ((unsigned int)ret >= (unsigned int)(-515)) {
 #ifdef TARGET_SPARC64
@@ -645,17 +645,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 */
@@ -665,29 +665,29 @@ void cpu_ppc_store_tbu (CPUState *env, uint32_t value)
 {
     cpu_ppc_store_tb(env, ((uint64_t)value << 32) | cpu_ppc_load_tbl(env));
 }
+
 void cpu_ppc_store_tbl (CPUState *env, uint32_t value)
 {
     cpu_ppc_store_tb(env, ((uint64_t)cpu_ppc_load_tbl(env) << 32) | value);
 }
-  
+
 uint32_t cpu_ppc_load_decr (CPUState *env)
 {
     /* TO FIX */
     return -1;
 }
+
 void cpu_ppc_store_decr (CPUState *env, uint32_t value)
 {
     /* TO FIX */
 }
+
 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 &&
@@ -996,7 +996,7 @@ void cpu_loop(CPUPPCState *env)
             }
             break;
         default:
-            fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", 
+            fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
                     trapnr);
             if (loglevel) {
                 fprintf(logfile, "qemu: unhandled CPU exception 0x%02x - "
@@ -1332,13 +1332,13 @@ void cpu_loop(CPUMIPSState *env)
                         arg5 = 0;
                         arg6 = 0;
                     }
-                    ret = do_syscall(env, 
-                                     env->gpr[2], 
+                    ret = do_syscall(env,
+                                     env->gpr[2],
                                      env->gpr[4],
                                      env->gpr[5],
                                      env->gpr[6],
                                      env->gpr[7],
-                                     arg5, 
+                                     arg5,
                                      arg6);
                 }
                 if ((unsigned int)ret >= (unsigned int)(-1133)) {
@@ -1380,7 +1380,7 @@ void cpu_loop(CPUMIPSState *env)
             break;
         default:
             //        error:
-            fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", 
+            fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
                     trapnr);
             cpu_dump_state(env, stderr, fprintf, 0);
             abort();
@@ -1395,19 +1395,19 @@ 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, 
-                             env->gregs[3], 
-                             env->gregs[4], 
-                             env->gregs[5], 
-                             env->gregs[6], 
-                             env->gregs[7], 
-                             env->gregs[0], 
+            ret = do_syscall(env,
+                             env->gregs[3],
+                             env->gregs[4],
+                             env->gregs[5],
+                             env->gregs[6],
+                             env->gregs[7],
+                             env->gregs[0],
                              0);
             env->gregs[0] = ret;
             env->pc += 2;
@@ -1444,7 +1444,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) {
@@ -1480,8 +1480,8 @@ void cpu_loop(CPUM68KState *env)
                 ts->sim_syscalls = 0;
                 n = env->dregs[0];
                 env->pc += 2;
-                env->dregs[0] = do_syscall(env, 
-                                          n, 
+                env->dregs[0] = do_syscall(env,
+                                          n,
                                           env->dregs[1],
                                           env->dregs[2],
                                           env->dregs[3],
@@ -1518,7 +1518,7 @@ void cpu_loop(CPUM68KState *env)
             }
             break;
         default:
-            fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", 
+            fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
                     trapnr);
             cpu_dump_state(env, stderr, fprintf, 0);
             abort();
@@ -1546,7 +1546,7 @@ void usage(void)
            "-d options   activate log (logfile=%s)\n"
            "-p pagesize  set the host page size to 'pagesize'\n",
            TARGET_ARCH,
-           interp_prefix, 
+           interp_prefix,
            x86_stack_size,
            DEBUG_LOGFILE);
     _exit(1);
@@ -1568,7 +1568,7 @@ int main(int argc, char **argv)
     int optind;
     const char *r;
     int gdbstub_port = 0;
-    
+
     if (argc <= 1)
         usage();
 
@@ -1592,7 +1592,7 @@ int main(int argc, char **argv)
 
            if (optind >= argc)
                break;
-            
+
            r = argv[optind++];
             mask = cpu_str_to_log_mask(r);
             if (!mask) {
@@ -1625,11 +1625,11 @@ int main(int argc, char **argv)
             gdbstub_port = atoi(argv[optind++]);
        } else if (!strcmp(r, "r")) {
            qemu_uname_release = argv[optind++];
-        } else 
+        } else
 #ifdef USE_CODE_COPY
         if (!strcmp(r, "no-code-copy")) {
             code_copy_enabled = 0;
-        } else 
+        } else
 #endif
         {
             usage();
@@ -1652,15 +1652,15 @@ int main(int argc, char **argv)
        qemu_host_page_size */
     env = cpu_init();
     global_env = env;
-    
+
     if (loader_exec(filename, argv+optind, environ, regs, info) != 0) {
        printf("Error loading %s\n", filename);
        _exit(1);
     }
-    
+
     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);
@@ -1681,7 +1681,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);
 
@@ -1694,7 +1694,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 */
     env->regs[R_EAX] = regs->eax;
     env->regs[R_EBX] = regs->ebx;
@@ -1735,10 +1735,10 @@ int main(int argc, char **argv)
     env->gdt.base = h2g(gdt_table);
     env->gdt.limit = sizeof(gdt_table) - 1;
     write_dt(&gdt_table[__USER_CS >> 3], 0, 0xfffff,
-             DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | 
+             DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK |
              (3 << DESC_DPL_SHIFT) | (0xa << DESC_TYPE_SHIFT));
     write_dt(&gdt_table[__USER_DS >> 3], 0, 0xfffff,
-             DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | 
+             DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK |
              (3 << DESC_DPL_SHIFT) | (0x2 << DESC_TYPE_SHIFT));
     cpu_x86_load_seg(env, R_CS, __USER_CS);
     cpu_x86_load_seg(env, R_DS, __USER_DS);
index cbaa7ce2c00f78148412fdb9e354bdbc9ad78f5c..fc626a73006044454bd712a45a40f3d103a5d6d3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  mmap support for qemu
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -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) {
@@ -77,13 +77,13 @@ int target_mprotect(target_ulong start, target_ulong len, int prot)
         for(addr = end; addr < host_end; addr += TARGET_PAGE_SIZE) {
             prot1 |= page_get_flags(addr);
         }
-        ret = mprotect(g2h(host_end - qemu_host_page_size), qemu_host_page_size, 
+        ret = mprotect(g2h(host_end - qemu_host_page_size), qemu_host_page_size,
                        prot1 & PAGE_BITS);
         if (ret != 0)
             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);
@@ -95,8 +95,8 @@ int target_mprotect(target_ulong start, target_ulong len, int prot)
 }
 
 /* map an incomplete host page */
-static int mmap_frag(target_ulong real_start, 
-                     target_ulong start, target_ulong end, 
+static int mmap_frag(target_ulong real_start,
+                     target_ulong start, target_ulong end,
                      int prot, int flags, int fd, target_ulong offset)
 {
     target_ulong real_end, ret, addr;
@@ -112,10 +112,10 @@ 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, 
+        ret = (long)mmap(host_start, qemu_host_page_size, prot,
                          flags | MAP_ANONYMOUS, -1, 0);
         if (ret == -1)
             return ret;
@@ -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);
@@ -151,7 +151,7 @@ static int mmap_frag(target_ulong real_start,
 }
 
 /* NOTE: all the constants are the HOST ones */
-long target_mmap(target_ulong start, target_ulong len, int prot, 
+long target_mmap(target_ulong start, target_ulong len, int prot,
                  int flags, int fd, target_ulong offset)
 {
     target_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len;
@@ -167,7 +167,7 @@ long target_mmap(target_ulong start, target_ulong len, int prot,
 #ifdef DEBUG_MMAP
     {
         printf("mmap: start=0x%lx len=0x%lx prot=%c%c%c flags=",
-               start, len, 
+               start, len,
                prot & PROT_READ ? 'r' : '-',
                prot & PROT_WRITE ? 'w' : '-',
                prot & PROT_EXEC ? 'x' : '-');
@@ -216,7 +216,7 @@ long target_mmap(target_ulong start, target_ulong len, int prot,
             /* ??? This needs fixing for remapping.  */
 abort();
             host_len = HOST_PAGE_ALIGN(len) + qemu_host_page_size - TARGET_PAGE_SIZE;
-            real_start = (long)mmap(g2h(real_start), host_len, PROT_NONE, 
+            real_start = (long)mmap(g2h(real_start), host_len, PROT_NONE,
                                     MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
             if (real_start == -1)
                 return real_start;
@@ -238,13 +238,13 @@ abort();
             if (host_start == -1)
                 return host_start;
             /* update start so that it points to the file position at 'offset' */
-            if (!(flags & MAP_ANONYMOUS)) 
+            if (!(flags & MAP_ANONYMOUS))
                 host_start += offset - host_offset;
             start = h2g(host_start);
             goto the_end1;
         }
     }
-    
+
     if (start & ~TARGET_PAGE_MASK) {
         errno = EINVAL;
         return -1;
@@ -263,8 +263,8 @@ abort();
             errno = EINVAL;
             return -1;
         }
-        retaddr = target_mmap(start, len, prot | PROT_WRITE, 
-                              MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, 
+        retaddr = target_mmap(start, len, prot | PROT_WRITE,
+                              MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS,
                               -1, 0);
         if (retaddr == -1)
             return retaddr;
@@ -295,15 +295,15 @@ abort();
     }
     /* handle the end of the mapping */
     if (end < real_end) {
-        ret = mmap_frag(real_end - qemu_host_page_size, 
+        ret = mmap_frag(real_end - qemu_host_page_size,
                         real_end - qemu_host_page_size, real_end,
-                        prot, flags, fd, 
+                        prot, flags, fd,
                         offset + real_end - qemu_host_page_size - start);
         if (ret == -1)
             return ret;
         real_end -= qemu_host_page_size;
     }
-    
+
     /* map the middle (easier) */
     if (real_start < real_end) {
         unsigned long offset1;
@@ -311,7 +311,7 @@ abort();
          offset1 = 0;
        else
          offset1 = offset + real_start - start;
-        ret = (long)mmap(g2h(real_start), real_end - real_start, 
+        ret = (long)mmap(g2h(real_start), real_end - real_start,
                          prot, flags, fd, offset1);
         if (ret == -1)
             return ret;
@@ -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);
@@ -381,7 +381,7 @@ int target_munmap(target_ulong start, target_ulong len)
 
 /* XXX: currently, we only handle MAP_ANONYMOUS and not MAP_FIXED
    blocks which have been allocated starting on a host page */
-long target_mremap(target_ulong old_addr, target_ulong old_size, 
+long target_mremap(target_ulong old_addr, target_ulong old_size,
                    target_ulong new_size, unsigned long flags,
                    target_ulong new_addr)
 {
@@ -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);
 }
index eea8a7c9ab1de5105d948ac1c53b8999e181b4f4..69206164109df0bb12b85a63ee341752d817bf89 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  PPC emulation for qemu: syscall definitions.
- * 
+ *
  *  Copyright (c) 2003 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
@@ -55,8 +55,8 @@ struct target_revectored_struct {
 
 #define TARGET_SEMOP           1
 #define TARGET_SEMGET          2
-#define TARGET_SEMCTL          3 
-#define TARGET_MSGSND          11 
+#define TARGET_SEMCTL          3
+#define TARGET_MSGSND          11
 #define TARGET_MSGRCV          12
 #define TARGET_MSGGET          13
 #define TARGET_MSGCTL          14
@@ -73,7 +73,7 @@ struct target_msgbuf {
 struct target_ipc_kludge {
        unsigned int    msgp;   /* Really (struct msgbuf *) */
        int msgtyp;
-};     
+};
 
 struct target_ipc_perm {
        int     key;
index f894dde08406e21476d13f36e9e04a54af8299d7..bf106f22f4c8a36589392aed65549a4ff1984b92 100644 (file)
@@ -95,7 +95,7 @@ extern const char *qemu_uname_release;
 #define MAX_ARG_PAGES 32
 
 /*
- * This structure is used to hold the arguments that are 
+ * This structure is used to hold the arguments that are
  * used when loading binaries.
  */
 struct linux_binprm {
@@ -113,7 +113,7 @@ struct linux_binprm {
 void do_init_thread(struct target_pt_regs *regs, struct image_info *infop);
 target_ulong loader_build_argptr(int envc, int argc, target_ulong sp,
                                  target_ulong stringp, int push_ptr);
-int loader_exec(const char * filename, char ** argv, char ** envp, 
+int loader_exec(const char * filename, char ** argv, char ** envp,
              struct target_pt_regs * regs, struct image_info *infop);
 
 int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
@@ -126,7 +126,7 @@ void memcpy_to_target(target_ulong dest, const void *src,
 void target_set_brk(target_ulong new_brk);
 long do_brk(target_ulong new_brk);
 void syscall_init(void);
-long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, 
+long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
                 long arg4, long arg5, long arg6);
 void gemu_log(const char *fmt, ...) __attribute__((format(printf,1,2)));
 extern CPUState *global_env;
@@ -156,10 +156,10 @@ int do_vm86(CPUX86State *env, long subfunction, target_ulong v86_addr);
 
 /* mmap.c */
 int target_mprotect(target_ulong start, target_ulong len, int prot);
-long target_mmap(target_ulong start, target_ulong len, int prot, 
+long target_mmap(target_ulong start, target_ulong len, int prot,
                  int flags, int fd, target_ulong offset);
 int target_munmap(target_ulong start, target_ulong len);
-long target_mremap(target_ulong old_addr, target_ulong old_size, 
+long target_mremap(target_ulong old_addr, target_ulong old_size,
                    target_ulong new_size, unsigned long flags,
                    target_ulong new_addr);
 int target_msync(target_ulong start, target_ulong len, int flags);
index 6dd5845bc9b396561157e883cab3778f7a9a0651..2ff774f6ba19f3cad71aefbff3c554a7b88e23f4 100644 (file)
@@ -245,7 +245,7 @@ struct target_termios {
 ndbreak() */
 #define TARGET_TIOCSBRK        TARGET_IO('T', 39) /* 0x5427 */ /* BSD compatibility */
 #define TARGET_TIOCCBRK        TARGET_IO('T', 40) /* 0x5428 */ /* BSD compatibility */
-#define TARGET_TIOCGSID        TARGET_IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session 
+#define TARGET_TIOCGSID        TARGET_IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session
 ID of FD */
 #define TARGET_TIOCGPTN        TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-m
 ux device) */
@@ -263,12 +263,12 @@ ebugging only */
 tus register */
   /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
 # define TIOCSER_TEMT    0x01   /* Transmitter physically empty */
-#define TARGET_TIOCSERGETMULTI TARGET_IOR('T', 90, int) /* 0x545A 
+#define TARGET_TIOCSERGETMULTI TARGET_IOR('T', 90, int) /* 0x545A
 */ /* Get multiport config  */
-#define TARGET_TIOCSERSETMULTI TARGET_IOW('T', 91, int) /* 0x545B 
+#define TARGET_TIOCSERSETMULTI TARGET_IOW('T', 91, int) /* 0x545B
 */ /* Set multiport config */
 
-#define TARGET_TIOCMIWAIT      TARGET_IO('T', 92) /* 0x545C */       /* wait for a change on 
+#define TARGET_TIOCMIWAIT      TARGET_IO('T', 92) /* 0x545C */       /* wait for a change on
 serial input line(s) */
-#define TARGET_TIOCGICOUNT     TARGET_IOR('T', 93, int) /* 0x545D */ /* read 
+#define TARGET_TIOCGICOUNT     TARGET_IOR('T', 93, int) /* 0x545D */ /* read
 serial port inline interrupt counts */
index 8ee5c4b2fdbc406b71c0e5eb642218686708749b..daca7c7e78eafbfea8369acb7b4d3cc7d0366ba6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Emulation of Linux signals
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -50,7 +50,7 @@ static struct sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE]; /* siginfo queue */
 static struct sigqueue *first_free; /* first free siginfo queue entry */
 static int signal_pending; /* non zero if a signal may be pending */
 
-static void host_signal_handler(int host_signum, siginfo_t *info, 
+static void host_signal_handler(int host_signum, siginfo_t *info,
                                 void *puc);
 
 static uint8_t host_to_target_signal_table[65] = {
@@ -102,17 +102,17 @@ static inline int target_to_host_signal(int sig)
     return target_to_host_signal_table[sig];
 }
 
-static void host_to_target_sigset_internal(target_sigset_t *d, 
+static void host_to_target_sigset_internal(target_sigset_t *d,
                                            const sigset_t *s)
 {
     int i;
     unsigned long sigmask;
     uint32_t target_sigmask;
-    
+
     sigmask = ((unsigned long *)s)[0];
     target_sigmask = 0;
     for(i = 0; i < 32; i++) {
-        if (sigmask & (1 << i)) 
+        if (sigmask & (1 << i))
             target_sigmask |= 1 << (host_to_target_signal(i + 1) - 1);
     }
 #if TARGET_LONG_BITS == 32 && HOST_LONG_BITS == 32
@@ -147,7 +147,7 @@ void target_to_host_sigset_internal(sigset_t *d, const target_sigset_t *s)
     target_sigmask = s->sig[0];
     sigmask = 0;
     for(i = 0; i < 32; i++) {
-        if (target_sigmask & (1 << i)) 
+        if (target_sigmask & (1 << i))
             sigmask |= 1 << (target_to_host_signal(i + 1) - 1);
     }
 #if TARGET_LONG_BITS == 32 && HOST_LONG_BITS == 32
@@ -171,8 +171,8 @@ 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, 
+
+void host_to_target_old_sigset(target_ulong *old_sigset,
                                const sigset_t *sigset)
 {
     target_sigset_t d;
@@ -180,7 +180,7 @@ void host_to_target_old_sigset(target_ulong *old_sigset,
     *old_sigset = d.sig[0];
 }
 
-void target_to_host_old_sigset(sigset_t *sigset, 
+void target_to_host_old_sigset(sigset_t *sigset,
                                const target_ulong *old_sigset)
 {
     target_sigset_t d;
@@ -194,7 +194,7 @@ void target_to_host_old_sigset(sigset_t *sigset,
 
 /* siginfo conversion */
 
-static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo, 
+static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
                                                  const siginfo_t *info)
 {
     int sig;
@@ -202,7 +202,7 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
     tinfo->si_signo = sig;
     tinfo->si_errno = 0;
     tinfo->si_code = 0;
-    if (sig == SIGILL || sig == SIGFPE || sig == SIGSEGV || 
+    if (sig == SIGILL || sig == SIGFPE || sig == SIGSEGV ||
         sig == SIGBUS || sig == SIGTRAP) {
         /* should never come here, but who knows. The information for
            the target is irrelevant */
@@ -211,12 +211,12 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
         tinfo->_sifields._rt._pid = info->si_pid;
         tinfo->_sifields._rt._uid = info->si_uid;
         /* XXX: potential problem if 64 bit */
-        tinfo->_sifields._rt._sigval.sival_ptr = 
+        tinfo->_sifields._rt._sigval.sival_ptr =
             (target_ulong)info->si_value.sival_ptr;
     }
 }
 
-static void tswap_siginfo(target_siginfo_t *tinfo, 
+static void tswap_siginfo(target_siginfo_t *tinfo,
                           const target_siginfo_t *info)
 {
     int sig;
@@ -224,14 +224,14 @@ static void tswap_siginfo(target_siginfo_t *tinfo,
     tinfo->si_signo = tswap32(sig);
     tinfo->si_errno = tswap32(info->si_errno);
     tinfo->si_code = tswap32(info->si_code);
-    if (sig == SIGILL || sig == SIGFPE || sig == SIGSEGV || 
+    if (sig == SIGILL || sig == SIGFPE || sig == SIGSEGV ||
         sig == SIGBUS || sig == SIGTRAP) {
-        tinfo->_sifields._sigfault._addr = 
+        tinfo->_sifields._sigfault._addr =
             tswapl(info->_sifields._sigfault._addr);
     } else if (sig >= TARGET_SIGRTMIN) {
         tinfo->_sifields._rt._pid = tswap32(info->_sifields._rt._pid);
         tinfo->_sifields._rt._uid = tswap32(info->_sifields._rt._uid);
-        tinfo->_sifields._rt._sigval.sival_ptr = 
+        tinfo->_sifields._rt._sigval.sival_ptr =
             tswapl(info->_sifields._rt._sigval.sival_ptr);
     }
 }
@@ -252,7 +252,7 @@ void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo)
     info->si_code = tswap32(tinfo->si_code);
     info->si_pid = tswap32(tinfo->_sifields._rt._pid);
     info->si_uid = tswap32(tinfo->_sifields._rt._uid);
-    info->si_value.sival_ptr = 
+    info->si_value.sival_ptr =
         (void *)tswapl(tinfo->_sifields._rt._sigval.sival_ptr);
 }
 
@@ -270,7 +270,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);
@@ -279,11 +279,11 @@ 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];
-    for(i = 0; i < MAX_SIGQUEUE_SIZE - 1; i++) 
+    for(i = 0; i < MAX_SIGQUEUE_SIZE - 1; i++)
         sigqueue_table[i].next = &sigqueue_table[i + 1];
     sigqueue_table[MAX_SIGQUEUE_SIZE - 1].next = NULL;
 }
@@ -310,7 +310,7 @@ void __attribute((noreturn)) force_sig(int sig)
 {
     int host_sig;
     host_sig = target_to_host_signal(sig);
-    fprintf(stderr, "qemu: uncaught target signal %d (%s) - exiting\n", 
+    fprintf(stderr, "qemu: uncaught target signal %d (%s) - exiting\n",
             sig, strsignal(host_sig));
 #if 1
     _exit(-host_sig);
@@ -335,15 +335,15 @@ int queue_signal(int sig, target_siginfo_t *info)
     target_ulong handler;
 
 #if defined(DEBUG_SIGNAL)
-    fprintf(stderr, "queue_signal: sig=%d\n", 
+    fprintf(stderr, "queue_signal: sig=%d\n",
             sig);
 #endif
     k = &sigact_table[sig - 1];
     handler = k->sa._sa_handler;
     if (handler == TARGET_SIG_DFL) {
         /* default handler : ignore some signal. The other are fatal */
-        if (sig != TARGET_SIGCHLD && 
-            sig != TARGET_SIGURG && 
+        if (sig != TARGET_SIGCHLD &&
+            sig != TARGET_SIGURG &&
             sig != TARGET_SIGWINCH) {
             force_sig(sig);
         } else {
@@ -384,7 +384,7 @@ int queue_signal(int sig, target_siginfo_t *info)
     }
 }
 
-static void host_signal_handler(int host_signum, siginfo_t *info, 
+static void host_signal_handler(int host_signum, siginfo_t *info,
                                 void *puc)
 {
     int sig;
@@ -392,7 +392,7 @@ static void host_signal_handler(int host_signum, siginfo_t *info,
 
     /* the CPU emulator uses some host signals to detect exceptions,
        we we forward to it some signals */
-    if (host_signum == SIGSEGV || host_signum == SIGBUS 
+    if (host_signum == SIGSEGV || host_signum == SIGBUS
 #if defined(TARGET_I386) && defined(USE_CODE_COPY)
         || host_signum == SIGFPE
 #endif
@@ -426,7 +426,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,
         return -EINVAL;
     k = &sigact_table[sig - 1];
 #if defined(DEBUG_SIGNAL)
-    fprintf(stderr, "sigaction sig=%d act=0x%08x, oact=0x%08x\n", 
+    fprintf(stderr, "sigaction sig=%d act=0x%08x, oact=0x%08x\n",
             sig, (int)act, (int)oact);
 #endif
     if (oact) {
@@ -472,7 +472,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,
 #define offsetof(type, field) ((size_t) &((type *)0)->field)
 #endif
 
-static inline int copy_siginfo_to_user(target_siginfo_t *tinfo, 
+static inline int copy_siginfo_to_user(target_siginfo_t *tinfo,
                                        const target_siginfo_t *info)
 {
     tswap_siginfo(tinfo, info);
@@ -644,7 +644,7 @@ get_sigframe(struct emulated_sigaction *ka, CPUX86State *env, size_t frame_size)
        }
 
        /* This is the legacy signal stack switching. */
-       else 
+       else
 #endif
         if ((env->segs[R_SS].selector & 0xffff) != __USER_DS &&
             !(ka->sa.sa_flags & TARGET_SA_RESTORER) &&
@@ -715,7 +715,7 @@ give_sigsegv:
        force_sig(TARGET_SIGSEGV /* , current */);
 }
 
-static void setup_rt_frame(int sig, struct emulated_sigaction *ka, 
+static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
                            target_siginfo_t *info,
                           target_sigset_t *set, CPUX86State *env)
 {
@@ -809,7 +809,7 @@ restore_sigcontext(CPUX86State *env, struct target_sigcontext *sc, int *peax)
 
         cpu_x86_load_seg(env, R_CS, lduw(&sc->cs) | 3);
         cpu_x86_load_seg(env, R_SS, lduw(&sc->ss) | 3);
-       
+
        {
                unsigned int tmpflags;
                 tmpflags = ldl(&sc->eflags);
@@ -857,7 +857,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;
@@ -881,7 +881,7 @@ long do_rt_sigreturn(CPUX86State *env)
 #endif
         target_to_host_sigset(&set, &frame->uc.tuc_sigmask);
         sigprocmask(SIG_SETMASK, &set, NULL);
-       
+
        if (restore_sigcontext(env, &frame->uc.tuc_mcontext, &eax))
                goto badframe;
 
@@ -1119,7 +1119,7 @@ static void setup_frame(int usig, struct emulated_sigaction *ka,
         //     return err;
 }
 
-static void setup_rt_frame(int usig, struct emulated_sigaction *ka, 
+static void setup_rt_frame(int usig, struct emulated_sigaction *ka,
                            target_siginfo_t *info,
                           target_sigset_t *set, CPUState *env)
 {
@@ -1539,7 +1539,7 @@ restore_fpu_state(CPUState *env, qemu_siginfo_fpu_t *fpu)
 }
 
 
-static void setup_rt_frame(int sig, struct emulated_sigaction *ka, 
+static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
                            target_siginfo_t *info,
                           target_sigset_t *set, CPUState *env)
 {
@@ -1846,7 +1846,7 @@ get_sigframe(struct emulated_sigaction *ka, CPUState *regs, size_t frame_size)
     return g2h((sp - frame_size) & ~7);
 }
 
-static void setup_frame(int sig, struct emulated_sigaction * ka, 
+static void setup_frame(int sig, struct emulated_sigaction * ka,
                target_sigset_t *set, CPUState *regs)
 {
     struct sigframe *frame;
@@ -1889,7 +1889,7 @@ static void setup_frame(int sig, struct emulated_sigaction * ka,
 
 give_sigsegv:
     force_sig(TARGET_SIGSEGV/*, current*/);
-    return;    
+    return;
 }
 
 long do_sigreturn(CPUState *regs)
@@ -1909,7 +1909,7 @@ long do_sigreturn(CPUState *regs)
    for(i = 0; i < TARGET_NSIG_WORDS; i++) {
        if(__get_user(target_set.sig[i], &frame->sf_mask.sig[i]))
            goto badframe;
-   }           
+   }
 
    target_to_host_sigset_internal(&blocked, &target_set);
    sigprocmask(SIG_SETMASK, &blocked, NULL);
@@ -1928,7 +1928,7 @@ long do_sigreturn(CPUState *regs)
        :"r" (&regs));
    /* Unreached */
 #endif
-    
+
     regs->PC = regs->CP0_EPC;
    /* I am not sure this is right, but it seems to work
     * maybe a problem with nested signals ? */
@@ -1937,11 +1937,11 @@ long do_sigreturn(CPUState *regs)
 
 badframe:
    force_sig(TARGET_SIGSEGV/*, current*/);
-   return 0;   
+   return 0;
 
 }
 
-static void setup_rt_frame(int sig, struct emulated_sigaction *ka, 
+static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
                            target_siginfo_t *info,
                           target_sigset_t *set, CPUState *env)
 {
@@ -1962,7 +1962,7 @@ static void setup_frame(int sig, struct emulated_sigaction *ka,
     fprintf(stderr, "setup_frame: not implemented\n");
 }
 
-static void setup_rt_frame(int sig, struct emulated_sigaction *ka, 
+static void setup_rt_frame(int sig, struct emulated_sigaction *ka,
                            target_siginfo_t *info,
                           target_sigset_t *set, CPUState *env)
 {
@@ -1991,7 +1991,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;
 
@@ -2014,7 +2014,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");
@@ -2024,8 +2024,8 @@ void process_pending_signals(void *cpu_env)
     handler = k->sa._sa_handler;
     if (handler == TARGET_SIG_DFL) {
         /* default handler : ignore some signal. The other are fatal */
-        if (sig != TARGET_SIGCHLD && 
-            sig != TARGET_SIGURG && 
+        if (sig != TARGET_SIGCHLD &&
+            sig != TARGET_SIGURG &&
             sig != TARGET_SIGWINCH) {
             force_sig(sig);
         }
@@ -2040,7 +2040,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
index cad45b292587a17d7902ee064e16b59674124f46..3ec8e97c79cadf3e018dfbf3d4190c63ce87e063 100644 (file)
@@ -182,7 +182,7 @@ struct target_termios {
 #define TARGET_TCSETSW         TARGET_IOW('T', 10, struct target_termios)
 #define TARGET_TCSETSF         TARGET_IOW('T', 11, struct target_termios)
 
-/* Note that all the ioctls that are not available in Linux have a 
+/* Note that all the ioctls that are not available in Linux have a
  * double underscore on the front to: a) avoid some programs to
  * thing we support some ioctls under Linux (autoconfiguration stuff)
  */
index cad45b292587a17d7902ee064e16b59674124f46..3ec8e97c79cadf3e018dfbf3d4190c63ce87e063 100644 (file)
@@ -182,7 +182,7 @@ struct target_termios {
 #define TARGET_TCSETSW         TARGET_IOW('T', 10, struct target_termios)
 #define TARGET_TCSETSF         TARGET_IOW('T', 11, struct target_termios)
 
-/* Note that all the ioctls that are not available in Linux have a 
+/* Note that all the ioctls that are not available in Linux have a
  * double underscore on the front to: a) avoid some programs to
  * thing we support some ioctls under Linux (autoconfiguration stuff)
  */
index 45c8f2939765c701086481bbee53381cf2264677..b453df2680184082e0bcbe2f8ea472c05e15b0ff 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Linux syscalls
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -204,7 +204,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... */
@@ -215,7 +215,7 @@ long do_brk(target_ulong new_brk)
 
     /* We need to allocate more memory after the brk... */
     new_alloc_size = HOST_PAGE_ALIGN(new_brk - brk_page + 1);
-    mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size, 
+    mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size,
                                         PROT_READ|PROT_WRITE,
                                         MAP_ANON|MAP_FIXED|MAP_PRIVATE, 0, 0));
     if (is_error(mapped_addr)) {
@@ -226,7 +226,7 @@ long do_brk(target_ulong new_brk)
     }
 }
 
-static inline fd_set *target_to_host_fds(fd_set *fds, 
+static inline fd_set *target_to_host_fds(fd_set *fds,
                                          target_long *target_fds, int n)
 {
 #if !defined(BSWAP_NEEDED) && !defined(WORDS_BIGENDIAN)
@@ -248,7 +248,7 @@ static inline fd_set *target_to_host_fds(fd_set *fds,
 #endif
 }
 
-static inline void host_to_target_fds(target_long *target_fds, 
+static inline void host_to_target_fds(target_long *target_fds,
                                       fd_set *fds, int n)
 {
 #if !defined(BSWAP_NEEDED) && !defined(WORDS_BIGENDIAN)
@@ -337,8 +337,8 @@ static inline void host_to_target_timeval(target_ulong target_addr,
 }
 
 
-static long do_select(long n, 
-                      target_ulong rfd_p, target_ulong wfd_p, 
+static long do_select(long n,
+                      target_ulong rfd_p, target_ulong wfd_p,
                       target_ulong efd_p, target_ulong target_tv)
 {
     fd_set rfds, wfds, efds;
@@ -369,7 +369,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;
@@ -434,7 +434,7 @@ static inline void target_to_host_cmsg(struct msghdr *msgh,
         void *data = CMSG_DATA(cmsg);
         void *target_data = TARGET_CMSG_DATA(target_cmsg);
 
-        int len = tswapl(target_cmsg->cmsg_len) 
+        int len = tswapl(target_cmsg->cmsg_len)
                   - TARGET_CMSG_ALIGN(sizeof (struct target_cmsghdr));
 
         space += CMSG_SPACE(len);
@@ -511,17 +511,17 @@ static inline void host_to_target_cmsg(struct target_msghdr *target_msgh,
     msgh->msg_controllen = tswapl(space);
 }
 
-static long do_setsockopt(int sockfd, int level, int optname, 
+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;
@@ -631,7 +631,7 @@ static long do_setsockopt(int sockfd, int level, int optname,
     return ret;
 }
 
-static long do_getsockopt(int sockfd, int level, int optname, 
+static long do_getsockopt(int sockfd, int level, int optname,
                           target_ulong optval, target_ulong optlen)
 {
     int len, lv, val, ret;
@@ -781,7 +781,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));
 }
@@ -790,7 +790,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));
 }
@@ -818,14 +818,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));
@@ -1074,7 +1074,7 @@ static long do_socketcall(int num, target_ulong vptr)
             target_msg = tgetl(vptr + n);
             flags = tgetl(vptr + 2 * n);
 
-            ret = do_sendrecvmsg(fd, target_msg, flags, 
+            ret = do_sendrecvmsg(fd, target_msg, flags,
                                  (num == SOCKOP_sendmsg));
         }
         break;
@@ -1188,7 +1188,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 */
@@ -1462,51 +1462,51 @@ 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 = 
+
+    host->c_iflag =
         target_to_host_bitmask(tswap32(target->c_iflag), iflag_tbl);
-    host->c_oflag = 
+    host->c_oflag =
         target_to_host_bitmask(tswap32(target->c_oflag), oflag_tbl);
-    host->c_cflag = 
+    host->c_cflag =
         target_to_host_bitmask(tswap32(target->c_cflag), cflag_tbl);
-    host->c_lflag = 
+    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[VKILL] = target->c_cc[TARGET_VKILL]; 
-    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[VSWTC] = target->c_cc[TARGET_VSWTC]; 
-    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[VEOL2] = target->c_cc[TARGET_VEOL2]; 
+
+    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[VKILL] = target->c_cc[TARGET_VKILL];
+    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[VSWTC] = target->c_cc[TARGET_VSWTC];
+    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[VEOL2] = target->c_cc[TARGET_VEOL2];
 }
-  
+
 static void host_to_target_termios (void *dst, const void *src)
 {
     struct target_termios *target = dst;
     const struct host_termios *host = src;
 
-    target->c_iflag = 
+    target->c_iflag =
         tswap32(host_to_target_bitmask(host->c_iflag, iflag_tbl));
-    target->c_oflag = 
+    target->c_oflag =
         tswap32(host_to_target_bitmask(host->c_oflag, oflag_tbl));
-    target->c_cflag = 
+    target->c_cflag =
         tswap32(host_to_target_bitmask(host->c_cflag, cflag_tbl));
-    target->c_lflag = 
+    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];
@@ -1587,7 +1587,7 @@ static int read_ldt(target_ulong ptr, unsigned long bytecount)
 }
 
 /* XXX: add locking support */
-static int write_ldt(CPUX86State *env, 
+static int write_ldt(CPUX86State *env,
                      target_ulong ptr, unsigned long bytecount, int oldmode)
 {
     struct target_modify_ldt_ldt_s ldt_info;
@@ -1604,7 +1604,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;
@@ -1645,7 +1645,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) |
@@ -1672,7 +1672,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);
@@ -1707,7 +1707,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));
@@ -1748,7 +1748,7 @@ int do_fork(CPUState *env, unsigned int flags, unsigned long newsp)
         if (!newsp)
             newsp = env->gpr[1];
         new_env->gpr[1] = newsp;
-        { 
+        {
             int i;
             for (i = 7; i < 32; i++)
                 new_env->gpr[i] = 0;
@@ -1797,7 +1797,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);
@@ -1809,7 +1809,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:
         ret = fcntl(fd, cmd >> 1, &fl64);
         if (ret == 0) {
@@ -1892,8 +1892,8 @@ void syscall_init(void)
     const argtype *arg_type;
     int size;
 
-#define STRUCT(name, list...) thunk_register_struct(STRUCT_ ## name, #name, struct_ ## name ## _def); 
-#define STRUCT_SPECIAL(name) thunk_register_struct_direct(STRUCT_ ## name, #name, &struct_ ## name ## _def); 
+#define STRUCT(name, list...) thunk_register_struct(STRUCT_ ## name, #name, struct_ ## name ## _def);
+#define STRUCT_SPECIAL(name) thunk_register_struct_direct(STRUCT_ ## name, #name, &struct_ ## name ## _def);
 #include "syscall_types.h"
 #undef STRUCT
 #undef STRUCT_SPECIAL
@@ -1906,20 +1906,20 @@ void syscall_init(void)
             TARGET_IOC_SIZEMASK) {
             arg_type = ie->arg_type;
             if (arg_type[0] != TYPE_PTR) {
-                fprintf(stderr, "cannot patch size for ioctl 0x%x\n", 
+                fprintf(stderr, "cannot patch size for ioctl 0x%x\n",
                         ie->target_cmd);
                 exit(1);
             }
             arg_type++;
             size = thunk_type_size(arg_type, 0);
-            ie->target_cmd = (ie->target_cmd & 
+            ie->target_cmd = (ie->target_cmd &
                               ~(TARGET_IOC_SIZEMASK << TARGET_IOC_SIZESHIFT)) |
                 (size << TARGET_IOC_SIZESHIFT);
         }
         /* automatic consistency check if same arch */
 #if defined(__i386__) && defined(TARGET_I386)
         if (ie->target_cmd != ie->host_cmd) {
-            fprintf(stderr, "ERROR: ioctl: target=0x%x host=0x%x\n", 
+            fprintf(stderr, "ERROR: ioctl: target=0x%x host=0x%x\n",
                     ie->target_cmd, ie->host_cmd);
         }
 #endif
@@ -1988,14 +1988,14 @@ static inline void host_to_target_timespec(target_ulong target_addr,
     unlock_user_struct(target_ts, target_addr, 1);
 }
 
-long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, 
+long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
                 long arg4, long arg5, long arg6)
 {
     long ret;
     struct stat st;
     struct statfs stfs;
     void *p;
-    
+
 #ifdef DEBUG
     gemu_log("syscall %d", num);
 #endif
@@ -2459,7 +2459,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:
@@ -2495,7 +2495,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:
@@ -2572,7 +2572,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);
@@ -2631,7 +2631,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);
@@ -2732,13 +2732,13 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
             v5 = tswapl(v[4]);
             v6 = tswapl(v[5]);
             unlock_user(v, arg1, 0);
-            ret = get_errno(target_mmap(v1, v2, v3, 
+            ret = get_errno(target_mmap(v1, v2, v3,
                                         target_to_host_bitmask(v4, mmap_flags_tbl),
                                         v5, v6));
         }
 #else
-        ret = get_errno(target_mmap(arg1, arg2, arg3, 
-                                    target_to_host_bitmask(arg4, mmap_flags_tbl), 
+        ret = get_errno(target_mmap(arg1, arg2, arg3,
+                                    target_to_host_bitmask(arg4, mmap_flags_tbl),
                                     arg5,
                                     arg6));
 #endif
@@ -2750,8 +2750,8 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
 #else
 #define MMAP_SHIFT TARGET_PAGE_BITS
 #endif
-        ret = get_errno(target_mmap(arg1, arg2, arg3, 
-                                    target_to_host_bitmask(arg4, mmap_flags_tbl), 
+        ret = get_errno(target_mmap(arg1, arg2, arg3,
+                                    target_to_host_bitmask(arg4, mmap_flags_tbl),
                                     arg5,
                                     arg6 << MMAP_SHIFT));
         break;
@@ -2809,7 +2809,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);
@@ -2835,7 +2835,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);
@@ -2947,7 +2947,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
         ret = do_setsockopt(arg1, arg2, arg3, arg4, (socklen_t) arg5);
         break;
 #endif
-        
+
     case TARGET_NR_syslog:
         goto unimplemented;
     case TARGET_NR_setitimer:
@@ -2956,9 +2956,9 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
 
             if (arg2) {
                 pvalue = &value;
-                target_to_host_timeval(&pvalue->it_interval, 
+                target_to_host_timeval(&pvalue->it_interval,
                                        arg2);
-                target_to_host_timeval(&pvalue->it_value, 
+                target_to_host_timeval(&pvalue->it_value,
                                        arg2 + sizeof(struct target_timeval));
             } else {
                 pvalue = NULL;
@@ -2975,7 +2975,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,
@@ -3001,7 +3001,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
         do_stat:
             if (!is_error(ret)) {
                 struct target_stat *target_st;
-                
+
                 lock_user_struct(target_st, arg2, 0);
                 target_st->st_dev = tswap16(st.st_dev);
                 target_st->st_ino = tswapl(st.st_ino);
@@ -3123,7 +3123,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)) {
@@ -3196,7 +3196,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;
@@ -3620,8 +3620,8 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
         break;
 #ifdef TARGET_NR_setresuid
     case TARGET_NR_setresuid:
-        ret = get_errno(setresuid(low2highuid(arg1), 
-                                  low2highuid(arg2), 
+        ret = get_errno(setresuid(low2highuid(arg1),
+                                  low2highuid(arg2),
                                   low2highuid(arg3)));
         break;
 #endif
@@ -3640,8 +3640,8 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
 #endif
 #ifdef TARGET_NR_getresgid
     case TARGET_NR_setresgid:
-        ret = get_errno(setresgid(low2highgid(arg1), 
-                                  low2highgid(arg2), 
+        ret = get_errno(setresgid(low2highgid(arg1),
+                                  low2highgid(arg2),
                                   low2highgid(arg3)));
         break;
 #endif
@@ -3740,7 +3740,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++)
index e33c12bebeb66089f869d6cb908108e74bf5b7ca..a1615be48c7934a8068fc93b6d6b19a584f83ab3 100644 (file)
@@ -185,7 +185,7 @@ __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cms
   if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) tswapl(__mhdr->msg_control)
                                         + tswapl(__mhdr->msg_controllen))
       || ((unsigned char *) __cmsg + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len))
-          > ((unsigned char *) tswapl(__mhdr->msg_control) 
+          > ((unsigned char *) tswapl(__mhdr->msg_control)
              + tswapl(__mhdr->msg_controllen))))
     /* No more entries.  */
     return 0;
@@ -286,9 +286,9 @@ static inline void target_siginitset(target_sigset_t *d, target_ulong set)
 
 void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
 void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
-void host_to_target_old_sigset(target_ulong *old_sigset, 
+void host_to_target_old_sigset(target_ulong *old_sigset,
                                const sigset_t *sigset);
-void target_to_host_old_sigset(sigset_t *sigset, 
+void target_to_host_old_sigset(sigset_t *sigset,
                                const target_ulong *old_sigset);
 struct target_sigaction;
 int do_sigaction(int sig, const struct target_sigaction *act,
@@ -714,59 +714,59 @@ struct target_pollfd {
 #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
 
 /* cdrom commands */
-#define TARGET_CDROMPAUSE              0x5301 /* Pause Audio Operation */ 
+#define TARGET_CDROMPAUSE              0x5301 /* Pause Audio Operation */
 #define TARGET_CDROMRESUME             0x5302 /* Resume paused Audio Operation */
 #define TARGET_CDROMPLAYMSF            0x5303 /* Play Audio MSF (struct cdrom_msf) */
-#define TARGET_CDROMPLAYTRKIND         0x5304 /* Play Audio Track/index 
+#define TARGET_CDROMPLAYTRKIND         0x5304 /* Play Audio Track/index
                                            (struct cdrom_ti) */
-#define TARGET_CDROMREADTOCHDR         0x5305 /* Read TOC header 
+#define TARGET_CDROMREADTOCHDR         0x5305 /* Read TOC header
                                            (struct cdrom_tochdr) */
-#define TARGET_CDROMREADTOCENTRY       0x5306 /* Read TOC entry 
+#define TARGET_CDROMREADTOCENTRY       0x5306 /* Read TOC entry
                                            (struct cdrom_tocentry) */
 #define TARGET_CDROMSTOP               0x5307 /* Stop the cdrom drive */
 #define TARGET_CDROMSTART              0x5308 /* Start the cdrom drive */
 #define TARGET_CDROMEJECT              0x5309 /* Ejects the cdrom media */
-#define TARGET_CDROMVOLCTRL            0x530a /* Control output volume 
+#define TARGET_CDROMVOLCTRL            0x530a /* Control output volume
                                            (struct cdrom_volctrl) */
-#define TARGET_CDROMSUBCHNL            0x530b /* Read subchannel data 
+#define TARGET_CDROMSUBCHNL            0x530b /* Read subchannel data
                                            (struct cdrom_subchnl) */
-#define TARGET_CDROMREADMODE2          0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 
+#define TARGET_CDROMREADMODE2          0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
                                            (struct cdrom_read) */
 #define TARGET_CDROMREADMODE1          0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
                                            (struct cdrom_read) */
 #define TARGET_CDROMREADAUDIO          0x530e /* (struct cdrom_read_audio) */
 #define TARGET_CDROMEJECT_SW           0x530f /* enable(1)/disable(0) auto-ejecting */
-#define TARGET_CDROMMULTISESSION       0x5310 /* Obtain the start-of-last-session 
-                                           address of multi session disks 
+#define TARGET_CDROMMULTISESSION       0x5310 /* Obtain the start-of-last-session
+                                           address of multi session disks
                                            (struct cdrom_multisession) */
-#define TARGET_CDROM_GET_MCN           0x5311 /* Obtain the "Universal Product Code" 
+#define TARGET_CDROM_GET_MCN           0x5311 /* Obtain the "Universal Product Code"
                                            if available (struct cdrom_mcn) */
-#define TARGET_CDROM_GET_UPC           TARGET_CDROM_GET_MCN  /* This one is depricated, 
+#define TARGET_CDROM_GET_UPC           TARGET_CDROM_GET_MCN  /* This one is depricated,
                                           but here anyway for compatability */
 #define TARGET_CDROMRESET              0x5312 /* hard-reset the drive */
-#define TARGET_CDROMVOLREAD            0x5313 /* Get the drive's volume setting 
+#define TARGET_CDROMVOLREAD            0x5313 /* Get the drive's volume setting
                                           (struct cdrom_volctrl) */
 #define TARGET_CDROMREADRAW            0x5314  /* read data in raw mode (2352 Bytes)
                                            (struct cdrom_read) */
-/* 
+/*
  * These ioctls are used only used in aztcd.c and optcd.c
  */
 #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) */
 
-/* 
+/*
  * These ioctls are only used in optcd.c
  */
 #define TARGET_CDROMREADALL            0x5318  /* read all 2646 bytes */
 
-/* 
- * These ioctls are (now) only in ide-cd.c for controlling 
+/*
+ * These ioctls are (now) only in ide-cd.c for controlling
  * drive spindown time.  They should be implemented in the
  * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
  * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
@@ -775,7 +775,7 @@ struct target_pollfd {
 #define TARGET_CDROMGETSPINDOWN        0x531d
 #define TARGET_CDROMSETSPINDOWN        0x531e
 
-/* 
+/*
  * These ioctls are implemented through the uniform CD-ROM driver
  * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
  * drivers are eventually ported to the uniform CD-ROM driver interface.
index 308da485738ce92d059d8d20b29a810434177f0e..f73aabc1d8a238065371282d6a661d1cf8600275 100644 (file)
@@ -5,7 +5,7 @@ STRUCT(winsize,
 
 STRUCT(serial_multiport_struct,
        TYPE_INT, TYPE_INT, TYPE_CHAR, TYPE_CHAR, TYPE_INT, TYPE_CHAR, TYPE_CHAR,
-       TYPE_INT, TYPE_CHAR, TYPE_CHAR, TYPE_INT, TYPE_CHAR, TYPE_CHAR, TYPE_INT, 
+       TYPE_INT, TYPE_CHAR, TYPE_CHAR, TYPE_INT, TYPE_CHAR, TYPE_CHAR, TYPE_INT,
        MK_ARRAY(TYPE_INT, 32))
 
 STRUCT(serial_icounter_struct,
@@ -15,12 +15,12 @@ STRUCT(sockaddr,
        TYPE_SHORT, MK_ARRAY(TYPE_CHAR, 14))
 
 STRUCT(rtentry,
-       TYPE_ULONG, MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), 
-       TYPE_SHORT, TYPE_SHORT, TYPE_ULONG, TYPE_PTRVOID, TYPE_SHORT, TYPE_PTRVOID, 
+       TYPE_ULONG, MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr),
+       TYPE_SHORT, TYPE_SHORT, TYPE_ULONG, TYPE_PTRVOID, TYPE_SHORT, TYPE_PTRVOID,
        TYPE_ULONG, TYPE_ULONG, TYPE_SHORT)
 
 STRUCT(ifmap,
-       TYPE_ULONG, TYPE_ULONG, TYPE_SHORT, TYPE_CHAR, TYPE_CHAR, TYPE_CHAR, 
+       TYPE_ULONG, TYPE_ULONG, TYPE_SHORT, TYPE_CHAR, TYPE_CHAR, TYPE_CHAR,
        /* Spare 3 bytes */
        TYPE_CHAR, TYPE_CHAR, TYPE_CHAR)
 
@@ -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)
 
@@ -49,7 +49,7 @@ STRUCT(ifconf,
        TYPE_INT, TYPE_PTRVOID)
 
 STRUCT(arpreq,
-       MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), TYPE_INT, MK_STRUCT(STRUCT_sockaddr), 
+       MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), TYPE_INT, MK_STRUCT(STRUCT_sockaddr),
        MK_ARRAY(TYPE_CHAR, 16))
 
 STRUCT(arpreq_old,
index b28eea60d49d47dcd98368aa68859b592a3f7e0c..9639114fc7f3294952a6218104fdc032908f2656 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  vm86 linux syscall support
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -85,7 +85,7 @@ void save_v86_state(CPUX86State *env)
     target_v86->regs.eflags = tswap32(env->eflags);
     unlock_user_struct(target_v86, ts->target_v86, 1);
 #ifdef DEBUG_VM86
-    fprintf(logfile, "save_v86_state: eflags=%08x cs:ip=%04x:%04x\n", 
+    fprintf(logfile, "save_v86_state: eflags=%08x cs:ip=%04x:%04x\n",
             env->eflags, env->segs[R_CS].selector, env->eip);
 #endif
 
@@ -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);
@@ -202,7 +202,7 @@ static void do_int(CPUX86State *env, int intno)
         goto cannot_handle;
     if (is_revectored(intno, &ts->vm86plus.int_revectored))
         goto cannot_handle;
-    if (intno == 0x21 && is_revectored((env->regs[R_EAX] >> 8) & 0xff, 
+    if (intno == 0x21 && is_revectored((env->regs[R_EAX] >> 8) & 0xff,
                                        &ts->vm86plus.int21_revectored))
         goto cannot_handle;
     int_ptr = (uint32_t *)(intno << 2);
@@ -210,7 +210,7 @@ static void do_int(CPUX86State *env, int intno)
     if ((segoffs >> 16) == TARGET_BIOSSEG)
         goto cannot_handle;
 #if defined(DEBUG_VM86)
-    fprintf(logfile, "VM86: emulating int 0x%x. CS:IP=%04x:%04x\n", 
+    fprintf(logfile, "VM86: emulating int 0x%x. CS:IP=%04x:%04x\n",
             intno, segoffs >> 16, segoffs & 0xffff);
 #endif
     /* save old state */
@@ -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;
 
@@ -330,7 +330,7 @@ void handle_vm86_fault(CPUX86State *env)
         ADD16(ip, 1);
         env->eip = ip;
         if (ts->vm86plus.vm86plus.flags & TARGET_vm86dbg_active) {
-            if ( (ts->vm86plus.vm86plus.vm86dbg_intxxtab[intno >> 3] >> 
+            if ( (ts->vm86plus.vm86plus.vm86dbg_intxxtab[intno >> 3] >>
                   (intno &7)) & 1) {
                 return_to_32bit(env, TARGET_VM86_INTx + (intno << 8));
                 return;
@@ -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:
@@ -427,7 +427,7 @@ int do_vm86(CPUX86State *env, long subfunction, target_ulong vm86_addr)
     lock_user_struct(target_v86, vm86_addr, 1);
     /* build vm86 CPU state */
     ts->v86flags = tswap32(target_v86->regs.eflags);
-    env->eflags = (env->eflags & ~SAFE_MASK) | 
+    env->eflags = (env->eflags & ~SAFE_MASK) |
         (tswap32(target_v86->regs.eflags) & SAFE_MASK) | VM_MASK;
 
     ts->vm86plus.cpu_type = tswapl(target_v86->cpu_type);
@@ -462,17 +462,17 @@ int do_vm86(CPUX86State *env, long subfunction, target_ulong vm86_addr)
     cpu_x86_load_seg(env, R_GS, tswap16(target_v86->regs.gs));
     ret = tswap32(target_v86->regs.eax); /* eax will be restored at
                                             the end of the syscall */
-    memcpy(&ts->vm86plus.int_revectored, 
+    memcpy(&ts->vm86plus.int_revectored,
            &target_v86->int_revectored, 32);
-    memcpy(&ts->vm86plus.int21_revectored, 
+    memcpy(&ts->vm86plus.int21_revectored,
            &target_v86->int21_revectored, 32);
     ts->vm86plus.vm86plus.flags = tswapl(target_v86->vm86plus.flags);
-    memcpy(&ts->vm86plus.vm86plus.vm86dbg_intxxtab, 
+    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", 
+    fprintf(logfile, "do_vm86: cs:ip=%04x:%04x\n",
             env->segs[R_CS].selector, env->eip);
 #endif
     /* now the virtual CPU is ready for vm86 execution ! */
index 7823add91786f42998f74c64dac924e858b5480a..4b2d04d68cbcb46a94e3794baa57343c2279ad6f 100644 (file)
--- a/loader.c
+++ b/loader.c
@@ -1,8 +1,8 @@
 /*
  * QEMU Executable loader
- * 
+ *
  * Copyright (c) 2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
index dd195582e6da9ca1dcd2125690b9a0c6339c9c69..d162d406fecce1f05d1f8e3d38ae5422776a1132 100644 (file)
@@ -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
index 2e7dc85d1d8275764b97268b91fa9d986710c84d..22021311f0588c98332ae95be5ecd0840f1d3c2d 100644 (file)
@@ -329,10 +329,10 @@ 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) 
+   "X" MDMX destination register (OP_*_FD)
    "Y" MDMX source register (OP_*_FS)
    "Z" MDMX source register (OP_*_FT)
 
@@ -451,7 +451,7 @@ struct mips_opcode
 #define INSN_MIPS16               0x00002000
 /* MIPS-3D ASE */
 #define INSN_MIPS3D               0x00004000
-/* MDMX ASE */ 
+/* MDMX ASE */
 #define INSN_MDMX                 0x00008000
 
 /* Chip specific instructions.  These are bitmasks.  */
@@ -1060,7 +1060,7 @@ extern const int bfd_mips16_num_opcodes;
 
    Because of the lookup algorithm used, entries with the same opcode
    name must be contiguous.
+
    Many instructions are short hand for other instructions (i.e., The
    jal <register> instruction is short for jalr <register>).  */
 
@@ -2873,7 +2873,7 @@ print_insn_args (d, l, pc, info)
              lsb = (l >> OP_SH_SHAMT) & OP_MASK_SHAMT;
              (*info->fprintf_func) (info->stream, "0x%x", lsb);
              break;
-       
+
            case 'B':
              msb = (l >> OP_SH_INSMSB) & OP_MASK_INSMSB;
              (*info->fprintf_func) (info->stream, "0x%x", msb - lsb + 1);
@@ -2911,7 +2911,7 @@ print_insn_args (d, l, pc, info)
              lsb = ((l >> OP_SH_SHAMT) & OP_MASK_SHAMT) + 32;
              (*info->fprintf_func) (info->stream, "0x%x", lsb);
              break;
-       
+
            case 'F':
              msb = ((l >> OP_SH_INSMSB) & OP_MASK_INSMSB) + 32;
              (*info->fprintf_func) (info->stream, "0x%x", msb - lsb + 1);
index 1e9b904bf5b2b35fa285f80da8c7fe982dd201c6..e7e3fc2340e9e0809e16f3736a58273c95481ff1 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -1,8 +1,8 @@
 /*
  * QEMU monitor
- * 
+ *
  * Copyright (c) 2003-2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -34,7 +34,7 @@
 
 /*
  * Supported types:
- * 
+ *
  * 'F'          filename
  * 'B'          block device name
  * 's'          string (accept optional quote)
@@ -198,11 +198,11 @@ static void do_help(const char *name)
 static void do_commit(const char *device)
 {
     int i, all_devices;
-    
+
     all_devices = !strcmp(device, "all");
     for (i = 0; i < MAX_DISKS; i++) {
         if (bs_table[i]) {
-            if (all_devices || 
+            if (all_devices ||
                 !strcmp(bdrv_get_device_name(bs_table[i]), device))
                 bdrv_commit(bs_table[i]);
         }
@@ -216,7 +216,7 @@ static void do_info(const char *item)
     if (!item)
         goto help;
     for(cmd = info_cmds; cmd->name != NULL; cmd++) {
-        if (compare_cmd(item, cmd->name)) 
+        if (compare_cmd(item, cmd->name))
             goto found;
     }
  help:
@@ -268,7 +268,7 @@ static void do_info_registers(void)
     cpu_dump_state(env, NULL, monitor_fprintf,
                    X86_DUMP_FPU);
 #else
-    cpu_dump_state(env, NULL, monitor_fprintf, 
+    cpu_dump_state(env, NULL, monitor_fprintf,
                    0);
 #endif
 }
@@ -281,7 +281,7 @@ static void do_info_cpus(void)
     mon_get_cpu();
 
     for(env = first_cpu; env != NULL; env = env->next_cpu) {
-        term_printf("%c CPU #%d:", 
+        term_printf("%c CPU #%d:",
                     (env == mon_cpu) ? '*' : ' ',
                     env->cpu_index);
 #if defined(TARGET_I386)
@@ -316,7 +316,7 @@ static void do_info_history (void)
 {
     int i;
     const char *str;
-    
+
     i = 0;
     for(;;) {
         str = readline_get_history(i);
@@ -395,7 +395,7 @@ static void do_screen_dump(const char *filename)
 static void do_log(const char *items)
 {
     int mask;
-    
+
     if (!strcmp(items, "none")) {
         mask = 0;
     } else {
@@ -458,7 +458,7 @@ static void term_printc(int c)
     term_printf("'");
 }
 
-static void memory_dump(int count, int format, int wsize, 
+static void memory_dump(int count, int format, int wsize,
                         target_ulong addr, int is_physical)
 {
     CPUState *env;
@@ -482,7 +482,7 @@ static void memory_dump(int count, int format, int wsize,
             flags = 0;
             if (env) {
 #ifdef TARGET_X86_64
-                if ((env->efer & MSR_EFER_LMA) && 
+                if ((env->efer & MSR_EFER_LMA) &&
                     (env->segs[R_CS].flags & DESC_L_MASK))
                     flags = 2;
                 else
@@ -534,7 +534,7 @@ static void memory_dump(int count, int format, int wsize,
                 break;
             cpu_memory_rw_debug(env, addr, buf, l, 0);
         }
-        i = 0; 
+        i = 0;
         while (i < l) {
             switch(wsize) {
             default:
@@ -583,7 +583,7 @@ static void memory_dump(int count, int format, int wsize,
 #define GET_TLONG(h, l) (l)
 #endif
 
-static void do_memory_dump(int count, int format, int size, 
+static void do_memory_dump(int count, int format, int size,
                            uint32_t addrh, uint32_t addrl)
 {
     target_long addr = GET_TLONG(addrh, addrl);
@@ -643,7 +643,7 @@ static void do_print(int count, int format, int size, unsigned int valh, unsigne
     term_printf("\n");
 }
 
-static void do_memory_save(unsigned int valh, unsigned int vall, 
+static void do_memory_save(unsigned int valh, unsigned int vall,
                            uint32_t size, const char *filename)
 {
     FILE *f;
@@ -697,7 +697,7 @@ typedef struct {
 static const KeyDef key_defs[] = {
     { 0x2a, "shift" },
     { 0x36, "shift_r" },
-    
+
     { 0x38, "alt" },
     { 0xb8, "alt_r" },
     { 0x1d, "ctrl" },
@@ -752,7 +752,7 @@ static const KeyDef key_defs[] = {
     { 0x30, "b" },
     { 0x31, "n" },
     { 0x32, "m" },
-    
+
     { 0x39, "spc" },
     { 0x3a, "caps_lock" },
     { 0x3b, "f1" },
@@ -785,7 +785,7 @@ static const KeyDef key_defs[] = {
     { 0x47, "kp_7" },
     { 0x48, "kp_8" },
     { 0x49, "kp_9" },
-    
+
     { 0x56, "<" },
 
     { 0x57, "f11" },
@@ -832,7 +832,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') {
@@ -872,14 +872,14 @@ static void do_send_key(const char *string)
 
 static int mouse_button_state;
 
-static void do_mouse_move(const char *dx_str, const char *dy_str, 
+static void do_mouse_move(const char *dx_str, const char *dy_str,
                           const char *dz_str)
 {
     int dx, dy, dz;
     dx = strtol(dx_str, NULL, 0);
     dy = strtol(dy_str, NULL, 0);
     dz = 0;
-    if (dz_str) 
+    if (dz_str)
         dz = strtol(dz_str, NULL, 0);
     kbd_mouse_event(dx, dy, dz, mouse_button_state);
 }
@@ -933,7 +933,7 @@ static void do_system_powerdown(void)
 #if defined(TARGET_I386)
 static void print_pte(uint32_t addr, uint32_t pte, uint32_t mask)
 {
-    term_printf("%08x: %08x %c%c%c%c%c%c%c%c\n", 
+    term_printf("%08x: %08x %c%c%c%c%c%c%c%c\n",
                 addr,
                 pte & mask,
                 pte & PG_GLOBAL_MASK ? 'G' : '-',
@@ -969,12 +969,12 @@ static void tlb_info(void)
                 print_pte((l1 << 22), pde, ~((1 << 20) - 1));
             } else {
                 for(l2 = 0; l2 < 1024; l2++) {
-                    cpu_physical_memory_read((pde & ~0xfff) + l2 * 4, 
+                    cpu_physical_memory_read((pde & ~0xfff) + l2 * 4,
                                              (uint8_t *)&pte, 4);
                     pte = le32_to_cpu(pte);
                     if (pte & PG_PRESENT_MASK) {
-                        print_pte((l1 << 22) + (l2 << 12), 
-                                  pte & ~PG_PSE_MASK, 
+                        print_pte((l1 << 22) + (l2 << 12),
+                                  pte & ~PG_PSE_MASK,
                                   ~0xfff);
                     }
                 }
@@ -983,7 +983,7 @@ static void tlb_info(void)
     }
 }
 
-static void mem_print(uint32_t *pstart, int *plast_prot, 
+static void mem_print(uint32_t *pstart, int *plast_prot,
                       uint32_t end, int prot)
 {
     int prot1;
@@ -991,7 +991,7 @@ static void mem_print(uint32_t *pstart, int *plast_prot,
     if (prot != prot1) {
         if (*pstart != -1) {
             term_printf("%08x-%08x %08x %c%c%c\n",
-                        *pstart, end, end - *pstart, 
+                        *pstart, end, end - *pstart,
                         prot1 & PG_USER_MASK ? 'u' : '-',
                         'r',
                         prot1 & PG_RW_MASK ? 'w' : '-');
@@ -1031,7 +1031,7 @@ static void mem_info(void)
                 mem_print(&start, &last_prot, end, prot);
             } else {
                 for(l2 = 0; l2 < 1024; l2++) {
-                    cpu_physical_memory_read((pde & ~0xfff) + l2 * 4, 
+                    cpu_physical_memory_read((pde & ~0xfff) + l2 * 4,
                                              (uint8_t *)&pte, 4);
                     pte = le32_to_cpu(pte);
                     end = (l1 << 22) + (l2 << 12);
@@ -1079,7 +1079,7 @@ static void do_info_kqemu(void)
 #else
     term_printf("kqemu support: not compiled\n");
 #endif
-} 
+}
 
 #ifdef CONFIG_PROFILER
 
@@ -1185,9 +1185,9 @@ static void do_wav_capture (const char *path,
 #endif
 
 static term_cmd_t term_cmds[] = {
-    { "help|?", "s?", do_help, 
+    { "help|?", "s?", do_help,
       "[cmd]", "show the help" },
-    { "commit", "s", do_commit, 
+    { "commit", "s", do_commit,
       "device|all", "commit changes to the disk images (if -snapshot is used) or backing files" },
     { "info", "s?", do_info,
       "subcommand", "show various information about the system state" },
@@ -1197,50 +1197,50 @@ static term_cmd_t term_cmds[] = {
       "[-f] device", "eject a removable media (use -f to force it)" },
     { "change", "BF", do_change,
       "device filename", "change a removable media" },
-    { "screendump", "F", do_screen_dump, 
+    { "screendump", "F", do_screen_dump,
       "filename", "save screen into PPM image 'filename'" },
     { "log", "s", do_log,
-      "item1[,...]", "activate logging of the specified items to '/tmp/qemu.log'" }, 
+      "item1[,...]", "activate logging of the specified items to '/tmp/qemu.log'" },
     { "savevm", "s?", do_savevm,
-      "tag|id", "save a VM snapshot. If no tag or id are provided, a new snapshot is created" }, 
+      "tag|id", "save a VM snapshot. If no tag or id are provided, a new snapshot is created" },
     { "loadvm", "s", do_loadvm,
-      "tag|id", "restore a VM snapshot from its tag or id" }, 
+      "tag|id", "restore a VM snapshot from its tag or id" },
     { "delvm", "s", do_delvm,
-      "tag|id", "delete a VM snapshot from its tag or id" }, 
-    { "stop", "", do_stop, 
+      "tag|id", "delete a VM snapshot from its tag or id" },
+    { "stop", "", do_stop,
       "", "stop emulation", },
-    { "c|cont", "", do_cont, 
+    { "c|cont", "", do_cont,
       "", "resume emulation", },
 #ifdef CONFIG_GDBSTUB
-    { "gdbserver", "i?", do_gdbserver, 
+    { "gdbserver", "i?", do_gdbserver,
       "[port]", "start gdbserver session (default port=1234)", },
 #endif
-    { "x", "/l", do_memory_dump, 
+    { "x", "/l", do_memory_dump,
       "/fmt addr", "virtual memory dump starting at 'addr'", },
-    { "xp", "/l", do_physical_memory_dump, 
+    { "xp", "/l", do_physical_memory_dump,
       "/fmt addr", "physical memory dump starting at 'addr'", },
-    { "p|print", "/l", do_print, 
+    { "p|print", "/l", do_print,
       "/fmt expr", "print expression value (use $reg for CPU register access)", },
-    { "i", "/ii.", do_ioport_read, 
+    { "i", "/ii.", do_ioport_read,
       "/fmt addr", "I/O port read" },
 
-    { "sendkey", "s", do_send_key, 
+    { "sendkey", "s", do_send_key,
       "keys", "send keys to the VM (e.g. 'sendkey ctrl-alt-f1')" },
-    { "system_reset", "", do_system_reset, 
+    { "system_reset", "", do_system_reset,
       "", "reset the system" },
-    { "system_powerdown", "", do_system_powerdown, 
+    { "system_powerdown", "", do_system_powerdown,
       "", "send system power down event" },
-    { "sum", "ii", do_sum, 
+    { "sum", "ii", do_sum,
       "addr size", "compute the checksum of a memory region" },
     { "usb_add", "s", do_usb_add,
       "device", "add USB device (e.g. 'host:bus.addr' or 'host:vendor_id:product_id')" },
     { "usb_del", "s", do_usb_del,
       "device", "remove USB device 'bus.addr'" },
-    { "cpu", "i", do_cpu_set, 
+    { "cpu", "i", do_cpu_set,
       "index", "set the default CPU" },
-    { "mouse_move", "sss?", do_mouse_move, 
+    { "mouse_move", "sss?", do_mouse_move,
       "dx dy [dz]", "send mouse move events" },
-    { "mouse_button", "i", do_mouse_button, 
+    { "mouse_button", "i", do_mouse_button,
       "state", "change mouse button state (1=L, 2=M, 4=R)" },
     { "mouse_set", "i", do_mouse_set,
       "index", "set which mouse device receives events" },
@@ -1251,9 +1251,9 @@ static term_cmd_t term_cmds[] = {
 #endif
      { "stopcapture", "i", do_stop_capture,
        "capture index", "stop capture" },
-    { "memsave", "lis", do_memory_save, 
+    { "memsave", "lis", do_memory_save,
       "addr size file", "save to disk virtual memory dump starting at 'addr' of size 'size'", },
-    { NULL, NULL, }, 
+    { NULL, NULL, },
 };
 
 static term_cmd_t info_cmds[] = {
@@ -1621,7 +1621,7 @@ static MonitorDef monitor_defs[] = {
     { NULL },
 };
 
-static void expr_error(const char *fmt) 
+static void expr_error(const char *fmt)
 {
     term_printf(fmt);
     term_printf("\n");
@@ -1712,7 +1712,7 @@ static target_long expr_unary(void)
     case '$':
         {
             char buf[128], *q;
-            
+
             pch++;
             q = buf;
             while ((*pch >= 'a' && *pch <= 'z') ||
@@ -1729,7 +1729,7 @@ static target_long expr_unary(void)
             ret = get_monitor_def(&n, buf);
             if (ret == -1)
                 expr_error("unknown register");
-            else if (ret == -2) 
+            else if (ret == -2)
                 expr_error("no cpu defined");
         }
         break;
@@ -1759,7 +1759,7 @@ static target_long expr_prod(void)
 {
     target_long val, val2;
     int op;
-    
+
     val = expr_unary();
     for(;;) {
         op = *pch;
@@ -1774,7 +1774,7 @@ static target_long expr_prod(void)
             break;
         case '/':
         case '%':
-            if (val2 == 0) 
+            if (val2 == 0)
                 expr_error("division by zero");
             if (op == '/')
                 val /= val2;
@@ -1932,7 +1932,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;
@@ -1948,10 +1948,10 @@ 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)) 
+        if (compare_cmd(cmdname, cmd->name))
             goto found;
     }
     term_printf("unknown command: '%s'\n", cmdname);
@@ -1960,7 +1960,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;
@@ -1976,8 +1976,8 @@ static void monitor_handle_command(const char *cmdline)
             {
                 int ret;
                 char *str;
-                
-                while (isspace(*p)) 
+
+                while (isspace(*p))
                     p++;
                 if (*typestr == '?') {
                     typestr++;
@@ -2017,7 +2017,7 @@ static void monitor_handle_command(const char *cmdline)
         case '/':
             {
                 int count, format, size;
-                
+
                 while (isspace(*p))
                     p++;
                 if (*p == '/') {
@@ -2098,7 +2098,7 @@ static void monitor_handle_command(const char *cmdline)
         case 'l':
             {
                 target_long val;
-                while (isspace(*p)) 
+                while (isspace(*p))
                     p++;
                 if (*typestr == '?' || *typestr == '.') {
                     if (*typestr == '?') {
@@ -2109,7 +2109,7 @@ static void monitor_handle_command(const char *cmdline)
                     } else {
                         if (*p == '.') {
                             p++;
-                            while (isspace(*p)) 
+                            while (isspace(*p))
                                 p++;
                             has_arg = 1;
                         } else {
@@ -2150,17 +2150,17 @@ static void monitor_handle_command(const char *cmdline)
             {
                 int has_option;
                 /* option */
-                
+
                 c = *typestr++;
                 if (c == '\0')
                     goto bad_type;
-                while (isspace(*p)) 
+                while (isspace(*p))
                     p++;
                 has_option = 0;
                 if (*p == '-') {
                     p++;
                     if (*p != c) {
-                        term_printf("%s: unsupported option -%c\n", 
+                        term_printf("%s: unsupported option -%c\n",
                                     cmdname, *p);
                         goto fail;
                     }
@@ -2182,7 +2182,7 @@ static void monitor_handle_command(const char *cmdline)
     while (isspace(*p))
         p++;
     if (*p != '\0') {
-        term_printf("%s: extraneous characters at the end of line\n", 
+        term_printf("%s: extraneous characters at the end of line\n",
                     cmdname);
         goto fail;
     }
@@ -2257,7 +2257,7 @@ static void file_completion(const char *input)
     int input_path_len;
     const char *p;
 
-    p = strrchr(input, '/'); 
+    p = strrchr(input, '/');
     if (!p) {
         input_path_len = 0;
         pstrcpy(file_prefix, sizeof(file_prefix), input);
diff --git a/osdep.c b/osdep.c
index d1eff8deb5cb0c2a529971c8a4b052d425c88554..b4d04f6cea65b96c46bc82a3ad1a61937e39dc78 100644 (file)
--- a/osdep.c
+++ b/osdep.c
@@ -1,8 +1,8 @@
 /*
  * QEMU low level functions
- * 
+ *
  * Copyright (c) 2003 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -113,7 +113,7 @@ void *kqemu_vmalloc(size_t size)
             free_space = (int64_t)stfs.f_bavail * stfs.f_bsize;
             if ((ram_size + 8192 * 1024) >= free_space) {
                 ram_mb = (ram_size / (1024 * 1024));
-                fprintf(stderr, 
+                fprintf(stderr,
                         "You do not have enough space in '%s' for the %d MB of QEMU virtual RAM.\n",
                         tmpdir, ram_mb);
                 if (strcmp(tmpdir, "/dev/shm") == 0) {
@@ -122,7 +122,7 @@ void *kqemu_vmalloc(size_t size)
                             "mount -t tmpfs -o size=%dm none /dev/shm\n",
                             ram_mb + 16);
                 } else {
-                    fprintf(stderr, 
+                    fprintf(stderr,
                             "Use the '-m' option of QEMU to diminish the amount of virtual RAM or use the\n"
                             "QEMU_TMPDIR environment variable to set another directory where the QEMU\n"
                             "temporary RAM file will be opened.\n");
@@ -131,20 +131,20 @@ void *kqemu_vmalloc(size_t size)
                 exit(1);
             }
         }
-        snprintf(phys_ram_file, sizeof(phys_ram_file), "%s/qemuXXXXXX", 
+        snprintf(phys_ram_file, sizeof(phys_ram_file), "%s/qemuXXXXXX",
                  tmpdir);
         phys_ram_fd = mkstemp(phys_ram_file);
         if (phys_ram_fd < 0) {
-            fprintf(stderr, 
+            fprintf(stderr,
                     "warning: could not create temporary file in '%s'.\n"
                     "Use QEMU_TMPDIR to select a directory in a tmpfs filesystem.\n"
                     "Using '/tmp' as fallback.\n",
                     tmpdir);
-            snprintf(phys_ram_file, sizeof(phys_ram_file), "%s/qemuXXXXXX", 
+            snprintf(phys_ram_file, sizeof(phys_ram_file), "%s/qemuXXXXXX",
                      "/tmp");
             phys_ram_fd = mkstemp(phys_ram_file);
             if (phys_ram_fd < 0) {
-                fprintf(stderr, "Could not create temporary memory file '%s'\n", 
+                fprintf(stderr, "Could not create temporary memory file '%s'\n",
                         phys_ram_file);
                 exit(1);
             }
@@ -153,9 +153,9 @@ void *kqemu_vmalloc(size_t size)
     }
     size = (size + 4095) & ~4095;
     ftruncate(phys_ram_fd, phys_ram_size + size);
-    ptr = mmap(NULL, 
-               size, 
-               PROT_WRITE | PROT_READ, MAP_SHARED, 
+    ptr = mmap(NULL,
+               size,
+               PROT_WRITE | PROT_READ, MAP_SHARED,
                phys_ram_fd, phys_ram_size);
     if (ptr == MAP_FAILED) {
         fprintf(stderr, "Could not map physical memory\n");
index 14ea6a60662bcf306ebc4b058f80455178b673ec..d4d1e7924b0a3a45b44cb39b2098526d685062de 100644 (file)
Binary files a/pc-bios/bios.bin and b/pc-bios/bios.bin differ
index 86c36c11d179e544f50be365ec17f1ffa506324e..6583c1491edd2dc87714d24b2e9836bec90f2f68 100644 (file)
@@ -7,11 +7,11 @@ diff -u -w -r1.3 rombios.h
 +++ rombios.h  1 Nov 2006 19:16:34 -0000
 @@ -19,7 +19,7 @@
  //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+
  /* define it to include QEMU specific code */
 -//#define BX_QEMU
 +#define BX_QEMU
+
  #ifndef LEGACY
  #  define BX_ROMBIOS32     1
 Index: rombios32.c
@@ -24,7 +24,7 @@ diff -u -w -r1.8 rombios32.c
 @@ -852,6 +852,11 @@
      int ioapic_id, i, len;
      int mp_config_table_size;
+
 +#ifdef BX_QEMU
 +    if (smp_cpus <= 1)
 +        return;
index 22fcd4be808a5386dee395549717c4e75c55fe54..01742d413e716687fe0bc382c05bbb0bf71b143f 100644 (file)
@@ -4,8 +4,8 @@
  */
 
 #define LOAD_SEG 0x9000
-        
-.code16        
+
+.code16
 .text
        .globl  _start
 
@@ -21,7 +21,7 @@ _start:
         mov $0x8ffe, %sp
         ljmp $LOAD_SEG + 0x20, $0
 
-1:              
+1:
         .fill 510 - (1b - _start), 1, 0
 
         /* boot sector signature */
index 4fb542274df95674bb62780cd3641839a5b74cc3..ced38a95379b0a88cb887bc270326f9f7b31387a 100644 (file)
@@ -7,7 +7,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
      ARCH_POP,
 +    ARCH_HEATHROW,
  };
+
  /* Hardware definition(s) */
 @@ -174,6 +175,7 @@
  int bd_ioctl (bloc_device_t *bd, int func, void *args);
@@ -24,14 +24,14 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 -void bd_set_boot_part (bloc_device_t *bd, part_t *partition);
 +void bd_set_boot_part (bloc_device_t *bd, part_t *partition, int partnum);
  part_t **_bd_parts (bloc_device_t *bd);
+
  void ide_pci_pc_register (uint32_t io_base0, uint32_t io_base1,
                            uint32_t io_base2, uint32_t io_base3,
 -                          void *OF_private);
 +                          void *OF_private0, void *OF_private1);
  void ide_pci_pmac_register (uint32_t io_base0, uint32_t io_base1,
                              void *OF_private);
+
 @@ -399,17 +401,23 @@
                                uint16_t min_grant, uint16_t max_latency);
  void OF_finalize_pci_host (void *dev, int first_bus, int nb_busses);
@@ -41,7 +41,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +                             int irq_line);
  void OF_finalize_pci_macio (void *dev, uint32_t base_address, uint32_t size,
                              void *private_data);
-+void OF_finalize_pci_ide (void *dev, 
++void OF_finalize_pci_ide (void *dev,
 +                          uint32_t io_base0, uint32_t io_base1,
 +                          uint32_t io_base2, uint32_t io_base3);
  int OF_register_bus (const unsigned char *name, uint32_t address,
@@ -54,7 +54,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 -                      int width, int height, int depth);
 +void OF_vga_register (const unsigned char *name, unused uint32_t address,
 +                      int width, int height, int depth,
-+                      unsigned long vga_bios_addr, 
++                      unsigned long vga_bios_addr,
 +                      unsigned long vga_bios_size);
  void *OF_blockdev_register (void *parent, void *private,
                              const unsigned char *type,
@@ -71,17 +71,17 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
      bloc_device_t *next;
  };
 @@ -66,6 +67,7 @@
+
  static int ide_initialize (bloc_device_t *bd, int device);
  static int ide_read_sector (bloc_device_t *bd, void *buffer, int secnum);
 +static int ide_reset (bloc_device_t *bd);
+
  static int mem_initialize (bloc_device_t *bd, int device);
  static int mem_read_sector (bloc_device_t *bd, void *buffer, int secnum);
 @@ -212,6 +214,17 @@
  {
  }
+
 +void bd_reset_all(void)
 +{
 +    bloc_device_t *bd;
@@ -98,7 +98,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
      return bd->seclen;
 @@ -223,10 +236,12 @@
  }
+
  /* XXX: to be suppressed */
 -void bd_set_boot_part (bloc_device_t *bd, part_t *partition)
 +void bd_set_boot_part (bloc_device_t *bd, part_t *partition, int partnum)
@@ -109,11 +109,11 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +        bd->bpartnum = partnum;
      }
  }
+
 @@ -240,6 +255,13 @@
      return &bd->bparts;
  }
+
 +void bd_set_boot_device (bloc_device_t *bd)
 +{
 +#if defined (USE_OPENFIRMWARE)
@@ -134,7 +134,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +            bd_set_boot_device(bd);
          }
      }
+
 @@ -717,34 +737,29 @@
  /* IDE PCI access for pc */
  static uint8_t ide_pci_port_read (bloc_device_t *bd, int port)
@@ -146,14 +146,14 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +    value = inb(bd->io_base + port);
 +    return value;
  }
+
  static void ide_pci_port_write (bloc_device_t *bd, int port, uint8_t value)
  {
 -    *(uint8_t *)(bd->io_base + port) = value;
 -    eieio();
 +    outb(bd->io_base + port, value);
  }
+
  static uint32_t ide_pci_data_readl (bloc_device_t *bd)
  {
 -    eieio();
@@ -161,24 +161,24 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 -    return *((uint32_t *)bd->io_base);
 +    return inl(bd->io_base);
  }
+
  static void ide_pci_data_writel (bloc_device_t *bd, uint32_t val)
  {
 -    *(uint32_t *)(bd->io_base) = val;
 -    eieio();
 +    outl(bd->io_base, val);
  }
+
  static void ide_pci_control_write (bloc_device_t *bd, uint32_t val)
  {
 -    *((uint8_t *)bd->tmp) = val;
 -    eieio();
 +    outb(bd->tmp + 2, val);
  }
+
  static ide_ops_t ide_pci_pc_ops = {
 @@ -761,7 +776,7 @@
+
  void ide_pci_pc_register (uint32_t io_base0, uint32_t io_base1,
                            uint32_t io_base2, uint32_t io_base3,
 -                          unused void *OF_private)
@@ -214,12 +214,12 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
  }
 @@ -935,6 +950,8 @@
  }
+
  static void atapi_pad_req (void *buffer, int len);
 +static void atapi_make_req (bloc_device_t *bd, uint32_t *buffer,
 +                            int maxlen);
  static int atapi_read_sector (bloc_device_t *bd, void *buffer, int secnum);
+
  static int ide_initialize (bloc_device_t *bd, int device)
 @@ -1035,9 +1052,7 @@
          DPRINTF("INQUIRY\n");
@@ -246,7 +246,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 @@ -1105,6 +1118,22 @@
      memset(p + len, 0, 12 - len);
  }
+
 +static void atapi_make_req (bloc_device_t *bd, uint32_t *buffer,
 +                            int maxlen)
 +{
@@ -269,7 +269,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 @@ -1112,16 +1141,9 @@
      uint32_t status, value;
      int i, len;
+
 -    /* select drive */
 -    if (bd->drv == 0)
 -        ide_port_write(bd, 0x06, 0x40);
@@ -372,13 +372,13 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +++ OpenHackWare-release-0.4/src/libpart/core.c        2005-07-03 16:17:41.000000000 +0200
 @@ -126,7 +126,7 @@
  }
+
  int part_register (bloc_device_t *bd, part_t *partition,
 -                   const unsigned char *name)
 +                   const unsigned char *name, int partnum)
  {
      part_t **cur;
+
 @@ -134,6 +134,7 @@
      partition->bd = bd;
      partition->next = NULL;
@@ -390,7 +390,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 @@ -141,29 +142,15 @@
      return 0;
  }
+
 -static inline int set_boot_part (bloc_device_t *bd, int partnum)
 -{
 -    part_t *cur;
@@ -407,18 +407,18 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
  {
      part_t **listp, *cur;
 -    int i;
+
      listp = _bd_parts(bd);
 -    cur = *listp;
 -    for (i = 0; i != partnum; i++) {
 -        if (cur == NULL)
-+    
++
 +    for (cur = *listp; cur != NULL; cur = cur->next) {
 +        if (cur->partnum == partnum)
              break;
 -        cur = cur->next;
      }
-     
+
      return cur;
 @@ -192,17 +179,20 @@
      part_set_blocsize(bd, part, 512);
@@ -426,10 +426,10 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
      part->flags = PART_TYPE_RAW | PART_FLAG_BOOT;
 -    part_register(bd, part, "Raw");
 +    part_register(bd, part, "Raw", 0);
+
      return part;
  }
+
 +bloc_device_t *part_get_bd (part_t *part)
 +{
 +    return part->bd;
@@ -439,7 +439,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
  {
 -    part_t *part0, *boot_part, **cur;
 +    part_t *part0 = NULL, *boot_part, **cur;
+
 -    /* Register the 0 partition: raw partition containing the whole disk */
 -    part0 = part_get_raw(bd);
      /* Try to find a valid boot partition */
@@ -493,14 +493,14 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 -    DPRINTF("Boot partition: %p %p %p %p\n", boot_part, boot_part->fs,
 +    dprintf("Boot partition: %p %p %p %p\n", boot_part, boot_part->fs,
              part_fs(boot_part), part0);
+
      return boot_part;
 @@ -279,6 +277,7 @@
      part->boot_size.offset = 0;
      part->boot_load = 0;
      part->boot_entry = 0;
 +    part->flags |= PART_FLAG_BOOT;
+
      return 0;
  }
 diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --exclude mkdiff OpenHackWare-release-0.4.org/src/libpart/isofs.c OpenHackWare-release-0.4/src/libpart/isofs.c
@@ -519,7 +519,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 --- OpenHackWare-release-0.4.org/src/libpart/libpart.h 2005-03-31 09:23:33.000000000 +0200
 +++ OpenHackWare-release-0.4/src/libpart/libpart.h     2005-07-03 16:17:41.000000000 +0200
 @@ -30,6 +30,7 @@
+
  struct part_t {
      bloc_device_t *bd;
 +    int partnum;
@@ -528,7 +528,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
      uint32_t spb;
 @@ -54,7 +55,7 @@
  };
+
  int part_register (bloc_device_t *bd, part_t *partition,
 -                   const unsigned char *name);
 +                   const unsigned char *name, int partnum);
@@ -561,7 +561,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +        0xFE000000, /* Grackle (Heathrow) */
 +        0xF2000000, /* UniNorth (Mac99)  */
 +    };
+
      /* Retrieve NVRAM configuration */
 - nvram_retry:
 +    for(i = 0; i < 3; i++) {
@@ -594,7 +594,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 @@ -433,9 +437,12 @@
      vga_puts(copyright);
      vga_puts("\n");
+
 +#if 0
      /* QEMU is quite incoherent: d is cdrom, not second drive */
 +    /* XXX: should probe CD-ROM position */
@@ -646,7 +646,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 @@ -1017,6 +1017,33 @@
                             string, strlen(string) + 1);
  }
+
 +/* convert '\1' char to '\0' */
 +static OF_prop_t *OF_prop_string_new1 (OF_env_t *env, OF_node_t *node,
 +                                       const unsigned char *name,
@@ -773,7 +773,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +    if (arch == ARCH_MAC99) {
 +        OF_node_t *unin;
 +        OF_regprop_t regs;
+
 +        unin = OF_node_new(OF_env, OF_node_root,
 +                           "uni-n", 0xf8000000);
 +        if (unin == NULL) {
@@ -791,11 +791,11 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +        OF_prop_int_new(OF_env, unin, "device-rev", 3);
 +        OF_node_put(OF_env, unin);
 +    }
-     
+
  #if 1 /* This is mandatory for claim to work
         * but I don't know where it should really be (in cpu ?)
 @@ -1693,7 +1747,9 @@
+
      /* "/options/boot-args" node */
      {
 -        const unsigned char *args = "-v rootdev cdrom";
@@ -826,7 +826,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 -        OF_prop_int_new(OF_env, node, "#size-cells", dev->acells);
 +        OF_prop_int_new(OF_env, node, "#interrupt-cells", dev->icells);
      dprintf("Done %p %p\n", parent, node);
-     
+
      return node;
 @@ -2040,8 +2096,9 @@
      OF_env_t *OF_env;
@@ -836,14 +836,14 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +    OF_node_t *pci_host, *als;
      int nranges;
 +    unsigned char buffer[OF_NAMELEN_MAX];
+
      OF_env = OF_env_main;
      dprintf("register PCI host '%s' '%s' '%s' '%s'\n",
 @@ -2052,6 +2109,17 @@
          ERROR("Cannot create pci host\n");
          return NULL;
      }
-+    
++
 +    als = OF_node_get(OF_env, "aliases");
 +    if (als == NULL) {
 +        ERROR("Cannot get 'aliases'\n");
@@ -852,7 +852,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +    sprintf(buffer, "/%s", dev->name);
 +    OF_prop_string_set(OF_env, als, "pci", buffer);
 +    OF_node_put(OF_env, als);
-+    
++
 +
      regs[0].address = cfg_base;
      regs[0].size = cfg_len;
@@ -860,7 +860,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 @@ -2136,6 +2204,11 @@
      return pci_dev;
  }
+
 +/* XXX: suppress that, used for interrupt map init */
 +OF_node_t *pci_host_node;
 +uint32_t pci_host_interrupt_map[7 * 32];
@@ -875,7 +875,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
      OF_property_new(OF_env, dev, "bus-range", regs, sizeof(OF_regprop_t));
 +    pci_host_node = dev;
  }
+
  void OF_finalize_pci_device (void *dev, uint8_t bus, uint8_t devfn,
 -                             uint32_t *regions, uint32_t *sizes)
 +                             uint32_t *regions, uint32_t *sizes,
@@ -885,7 +885,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
      pci_reg_prop_t pregs[6], rregs[6];
 @@ -2156,6 +2231,7 @@
      int i, j, k;
+
      OF_env = OF_env_main;
 +    /* XXX: only useful for VGA card in fact */
      if (regions[0] != 0x00000000)
@@ -914,13 +914,13 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +#if 1
      {
          OF_prop_t *prop_name = ((OF_node_t *)dev)->prop_name;
+
 @@ -2390,6 +2481,54 @@
      return 0;
  }
+
 +static void keylargo_ata(OF_node_t *mio, uint32_t base_address,
-+                         uint32_t base, int irq1, int irq2, 
++                         uint32_t base, int irq1, int irq2,
 +                         uint16_t pic_phandle)
 +{
 +    OF_env_t *OF_env = OF_env_main;
@@ -976,7 +976,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
      uint16_t pic_phandle;
 +    int rec_len;
 +    OF_prop_t *mio_reg;
+
      OF_DPRINTF("mac-io: %p\n", dev);
      OF_env = OF_env_main;
 @@ -2416,10 +2557,14 @@
@@ -1054,14 +1054,14 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +        }
 +        dprintf("\n");
 +#endif
-+        OF_property_new(OF_env, pci_host_node, "interrupt-map", 
-+                        pci_host_interrupt_map, 
++        OF_property_new(OF_env, pci_host_node, "interrupt-map",
++                        pci_host_interrupt_map,
 +                        pci_host_interrupt_map_len * sizeof(uint32_t));
 +        tab[0] = 0xf800;
 +        tab[1] = 0;
 +        tab[2] = 0;
 +        tab[3] = 0;
-+        OF_property_new(OF_env, pci_host_node, "interrupt-map-mask", 
++        OF_property_new(OF_env, pci_host_node, "interrupt-map-mask",
 +                        tab, 4 * sizeof(uint32_t));
 +    }
 +#if 0
@@ -1222,7 +1222,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +        }
 +        {
 +            OF_node_t *rtc;
-         
+
          rtc = OF_node_new(OF_env, via, "rtc", OF_ADDRESS_NONE);
          if (rtc == NULL) {
 @@ -2813,14 +2963,68 @@
@@ -1260,8 +1260,8 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
      OF_node_put(OF_env, chs);
      OF_node_put(OF_env, als);
  }
-+void OF_finalize_pci_ide (void *dev, 
+
++void OF_finalize_pci_ide (void *dev,
 +                          uint32_t io_base0, uint32_t io_base1,
 +                          uint32_t io_base2, uint32_t io_base3)
 +{
@@ -1322,7 +1322,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
      OF_method_new(OF_env, dsk, "read", &OF_blockdev_read);
 @@ -3432,7 +3636,8 @@
  }
+
  void OF_vga_register (const unsigned char *name, unused uint32_t address,
 -                      int width, int height, int depth)
 +                      int width, int height, int depth,
@@ -1342,7 +1342,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +        p = (const uint8_t *)vga_bios_addr;
 +        if (p[0] == 'N' && p[1] == 'D' && p[2] == 'R' && p[3] == 'V') {
 +            size = *(uint32_t *)(p + 4);
-+            OF_property_new(OF_env, disp, "driver,AAPL,MacOS,PowerPC", 
++            OF_property_new(OF_env, disp, "driver,AAPL,MacOS,PowerPC",
 +                            p + 8, size);
 +        }
 +    }
@@ -1418,19 +1418,19 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +    uint32_t sizes[7];
      pci_device_t *next;
  };
+
 @@ -158,6 +158,7 @@
+
  /* IRQ numbers assigned to PCI IRQs */
  static uint8_t prep_pci_irqs[4] = { 9, 11, 9, 11 };
 +static uint8_t heathrow_pci_irqs[4] = { 0x15, 0x16, 0x17, 0x18 };
  static uint8_t pmac_pci_irqs[4] = { 8, 9, 10, 11 };
+
  /* PREP PCI host */
 @@ -399,6 +400,79 @@
      &uninorth_config_readl, &uninorth_config_writel,
  };
+
 +/* Grackle PCI host */
 +
 +static uint32_t grackle_cfg_address (pci_bridge_t *bridge,
@@ -1510,7 +1510,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 @@ -466,12 +540,22 @@
      },
  };
+
 +static int ide_config_cb2 (pci_device_t *device)
 +{
 +    OF_finalize_pci_ide(device->common.OF_private,
@@ -1536,7 +1536,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 @@ -481,7 +565,9 @@
      },
  };
+
 -static int ide_config_cb (pci_device_t *device)
 +#if 0
 +/* should base it on PCI ID, not on arch */
@@ -1558,7 +1558,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 -
      return 0;
  }
+
 @@ -512,16 +592,12 @@
                                device->common.OF_private);
          break;
@@ -1570,11 +1570,11 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 -                            device->common.OF_private);
          break;
      }
+
      return 0;
  }
 +#endif
+
  static pci_subclass_t mass_subclass[] = {
      {
 @@ -530,7 +606,7 @@
@@ -1605,11 +1605,11 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 +                        device->sizes[6]);
      }
      vga_console_register();
+
 @@ -750,6 +828,13 @@
      NULL, &PREP_pci_ops,
  };
+
 +pci_dev_t grackle_fake_bridge = {
 +    0xFFFF, 0xFFFF,
 +    "pci", "pci-bridge", "DEC,21154", "DEC,21154.pci-bridge",
@@ -1626,7 +1626,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
      {
 -        0x106B, 0x001F,
 -        NULL, "pci", "AAPL,UniNorth", "uni-north",
-+        0x106B, 0x001F, NULL, 
++        0x106B, 0x001F, NULL,
 +        "pci", "AAPL,UniNorth", "uni-north",
          3, 2, 1,
          NULL, &uninorth_fake_bridge,
@@ -1647,18 +1647,18 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
          0x1057, 0x4801, NULL,
 @@ -1443,7 +1528,14 @@
  }
+
  static const pci_dev_t misc_pci[] = {
 -    /* Apple Mac-io controller */
 +    /* Paddington Mac I/O */
-+    { 
++    {
 +        0x106B, 0x0017,
 +        "mac-io", "mac-io", "AAPL,343S1211", "paddington\1heathrow",
 +        1, 1, 1,
 +        &macio_config_cb, NULL,
 +    },
 +    /* KeyLargo Mac I/O */
-     { 
+     {
          0x106B, 0x0022,
          "mac-io", "mac-io", "AAPL,Keylargo", "Keylargo",
 @@ -1599,7 +1691,7 @@
@@ -1668,7 +1668,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
 -    uint32_t cmd;
 +    uint32_t cmd, addr;
      int i;
+
      device->min_grant = min_grant;
 @@ -1611,22 +1703,28 @@
          printf("MAP PCI device %d:%d to IRQ %d\n",
@@ -1682,7 +1682,7 @@ diff -wruN --exclude '*~' --exclude '*.o' --exclude '*.bin' --exclude '*.out' --
                     device->bus, device->devfn, i,
                     device->regions[i], device->sizes[i],
 -                   device->regions[i] & 0x00000001 ? "I/O" : "memory");
-+                   (device->regions[i] & 0x00000001) && i != 6 ? "I/O" : 
++                   (device->regions[i] & 0x00000001) && i != 6 ? "I/O" :
 +                    "memory");
 +            if (i != 6) {
              cmd = pci_config_readl(bridge, device->bus, device->devfn, 0x04);
index b3f2c5238c7f00cb7c502c54a10572eb7a66d0fc..e414a13322ea37033036f4056f74095fef988b75 100644 (file)
Binary files a/pc-bios/openbios-sparc32 and b/pc-bios/openbios-sparc32 differ
index f7cd8a82e926031297c3a5f5eb33d1fc55ca2550..17262cf4f826a000b1649aa934cec6e3918121d7 100644 (file)
Binary files a/pc-bios/ppc_rom.bin and b/pc-bios/ppc_rom.bin differ
index 8d8fc02af3f2ceb9a9b28b179cbb70ece139e3f2..f32910e8aa8426d39792c2b015a2b34b886d0517 100644 (file)
Binary files a/pc-bios/pxe-ne2k_pci.bin and b/pc-bios/pxe-ne2k_pci.bin differ
index 34f9a9ff7ce38e4b582c81067454b89bf8d55ac7..c38d0a1ec526afec169f4808244b873d422ea35e 100644 (file)
Binary files a/pc-bios/vgabios-cirrus.bin and b/pc-bios/vgabios-cirrus.bin differ
index 17cb63f6ad879a589142c09e836821e35b63f706..50fb74e4b10f72247f19881dda9447ef0ea49e55 100644 (file)
Binary files a/pc-bios/vgabios.bin and b/pc-bios/vgabios.bin differ
index 661c032e46c55ae1113a0fe286682de9aa35967b..247bb6f3651dcbe74f0bf486e607657995a12929 100644 (file)
@@ -7,15 +7,15 @@ diff -u -w -r1.17 Makefile
 +++ Makefile   14 Jun 2006 00:51:06 -0000
 @@ -22,7 +22,7 @@
  cirrus-bios: vgabios-cirrus.bin vgabios-cirrus.debug.bin
+
  clean:
 -      /bin/rm -f  biossums *.o *.s *.ld86 \
 +      /bin/rm -f  biossums vbetables-gen vbetables.h *.o *.s *.ld86 \
            temp.awk.* vgabios*.orig _vgabios_* _vgabios-debug_* core vgabios*.bin vgabios*.txt $(RELEASE).bin *.bak
+
  dist-clean: clean
 @@ -79,3 +79,9 @@
+
  biossums: biossums.c
        $(CC) -o biossums biossums.c
 +
@@ -43,7 +43,7 @@ diff -u -w -r1.10 clext.c
 +  pop ax
 +cirrus_set_video_mode_extended_1:
    and al, #0x7f
+
    push ds
 @@ -1011,6 +1018,13 @@
    jnz cirrus_vesa_02h_3
@@ -62,7 +62,7 @@ diff -u -w -r1.10 clext.c
 @@ -1479,6 +1493,38 @@
    pop  bx
    ret
+
 +cirrus_clear_vram:
 +  pusha
 +  push es
@@ -84,7 +84,7 @@ diff -u -w -r1.10 clext.c
 +  mov ax, si
 +  mov cx, #8192
 +  cld
-+  rep 
++  rep
 +      stosw
 +  pop ax
 +  inc ah
@@ -108,7 +108,7 @@ diff -u -w -r1.48 vbe.c
 @@ -118,21 +118,114 @@
  .word VBE_VESA_MODE_END_OF_LIST
  #endif
+
 +  .align 2
  vesa_pm_start:
    dw vesa_pm_set_window - vesa_pm_start
@@ -124,7 +124,7 @@ diff -u -w -r1.48 vbe.c
 +  dw VBE_DISPI_IOPORT_DATA + 1
 +  dw 0xffff
 +  dw 0xffff
+
    USE32
  vesa_pm_set_window:
 -  mov ax, #0x4f05
@@ -146,7 +146,7 @@ diff -u -w -r1.48 vbe.c
 +  pop  dx
 +  mov  ax, #0x004f
    ret
+
  vesa_pm_set_display_start:
 -  mov ax, #0x4f07
 -  int #0x10
@@ -157,7 +157,7 @@ diff -u -w -r1.48 vbe.c
 +  mov  ax, #0x0100
 +  ret
 +vesa_pm_set_display_start1:
-+; convert offset to (X, Y) coordinate 
++; convert offset to (X, Y) coordinate
 +; (would be simpler to change Bochs VBE API...)
 +  push eax
 +  push ecx
@@ -224,12 +224,12 @@ diff -u -w -r1.48 vbe.c
 +  pop eax
 +  mov  ax, #0x004f
    ret
+
  vesa_pm_unimplemented:
 @@ -835,6 +928,64 @@
  ASM_END
+
+
 +Bit16u vbe_biosfn_read_video_state_size()
 +{
 +    return 9 * 2;
@@ -244,7 +244,7 @@ diff -u -w -r1.48 vbe.c
 +    enable = inw(VBE_DISPI_IOPORT_DATA);
 +    write_word(ES, BX, enable);
 +    BX += 2;
-+    if (!(enable & VBE_DISPI_ENABLED)) 
++    if (!(enable & VBE_DISPI_ENABLED))
 +        return;
 +    for(i = VBE_DISPI_INDEX_XRES; i <= VBE_DISPI_INDEX_Y_OFFSET; i++) {
 +        if (i != VBE_DISPI_INDEX_ENABLE) {
@@ -263,7 +263,7 @@ diff -u -w -r1.48 vbe.c
 +
 +    enable = read_word(ES, BX);
 +    BX += 2;
-+    
++
 +    if (!(enable & VBE_DISPI_ENABLED)) {
 +        outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE);
 +        outw(VBE_DISPI_IOPORT_DATA, enable);
@@ -289,11 +289,11 @@ diff -u -w -r1.48 vbe.c
 +}
 +
  /** Function 04h - Save/Restore State
-  * 
+  *
   * Input:
 @@ -849,10 +1000,48 @@
   *              BX      = Number of 64-byte blocks to hold the state buffer (if DL=00h)
-  * 
+  *
   */
 -void vbe_biosfn_save_restore_state(AX, DL, CX, ES, BX)
 +void vbe_biosfn_save_restore_state(AX, CX, DX, ES, BX)
@@ -302,7 +302,7 @@ diff -u -w -r1.48 vbe.c
 -}
 +    Bit16u ss=get_SS();
 +    Bit16u result, val;
+
 +    result = 0x4f;
 +    switch(GET_DL()) {
 +    case 0x00:
@@ -339,9 +339,9 @@ diff -u -w -r1.48 vbe.c
 +    }
 +    write_word(ss, AX, result);
 +}
+
  /** Function 05h - Display Window Control
-  * 
+  *
 @@ -1090,7 +1279,7 @@
   */
  ASM_START
@@ -362,15 +362,15 @@ diff -u -w -r1.24 vbe.h
  void vbe_biosfn_return_controller_information(AX, ES, DI);
  void vbe_biosfn_return_mode_information(AX, CX, ES, DI);
  void vbe_biosfn_set_mode(AX, BX, ES, DI);
--void vbe_biosfn_save_restore_state(AX, DL, CX, ES, BX); 
+-void vbe_biosfn_save_restore_state(AX, DL, CX, ES, BX);
 +void vbe_biosfn_save_restore_state(AX, CX, DX, ES, BX);
  void vbe_biosfn_set_get_palette_data(AX);
  void vbe_biosfn_return_protected_mode_interface(AX);
+
 @@ -151,6 +151,12 @@
     Bit8u  Reserved[189];
  } ModeInfoBlock;
+
 +typedef struct ModeInfoListItem
 +{
 +        Bit16u                  mode;
@@ -388,7 +388,7 @@ diff -u -w -r1.24 vbe.h
 +#define VBE_VESA_MODE_1600X1200X1555                     0x11D
 +#define VBE_VESA_MODE_1600X1200X565                      0x11E
 +#define VBE_VESA_MODE_1600X1200X888                      0x11F
+
  // BOCHS/PLEX86 'own' mode numbers
  #define VBE_OWN_MODE_320X200X8888                        0x140
 @@ -202,6 +212,12 @@
@@ -401,16 +401,16 @@ diff -u -w -r1.24 vbe.h
 +#define VBE_OWN_MODE_1152X864X565                        0x14a
 +#define VBE_OWN_MODE_1152X864X888                        0x14b
 +#define VBE_OWN_MODE_1152X864X8888                       0x14c
+
  #define VBE_VESA_MODE_END_OF_LIST                        0xFFFF
+
 @@ -259,7 +275,7 @@
  //        like 0xE0000000
+
+
 -  #define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 4
 +  #define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 8
+
    #define VBE_DISPI_BANK_ADDRESS          0xA0000
    #define VBE_DISPI_BANK_SIZE_KB          64
 Index: vgabios.c
@@ -429,7 +429,7 @@ diff -u -w -r1.64 vgabios.c
 +static Bit16u biosfn_save_video_state();
 +static Bit16u biosfn_restore_video_state();
  extern Bit8u video_save_pointer_table[];
+
  // This is for compiling with gcc2 and gcc3
 @@ -748,12 +748,7 @@
            vbe_biosfn_set_mode(&AX,BX,ES,DI);
@@ -447,11 +447,11 @@ diff -u -w -r1.64 vgabios.c
            //FIXME
 @@ -3138,23 +3133,215 @@
  }
+
  // --------------------------------------------------------------------------------------------
 -static void biosfn_read_video_state_size (CX,ES,BX) Bit16u CX;Bit16u ES;Bit16u BX;
 +// --------------------------------------------------------------------------------------------
-+static Bit16u biosfn_read_video_state_size2 (CX) 
++static Bit16u biosfn_read_video_state_size2 (CX)
 +     Bit16u CX;
  {
 -#ifdef DEBUG
@@ -472,7 +472,7 @@ diff -u -w -r1.64 vgabios.c
 +    return size;
 +}
 +
-+static void biosfn_read_video_state_size (CX, BX) 
++static void biosfn_read_video_state_size (CX, BX)
 +     Bit16u CX; Bit16u *BX;
  {
 -#ifdef DEBUG
@@ -483,7 +483,7 @@ diff -u -w -r1.64 vgabios.c
  }
 -static void biosfn_restore_video_state (CX,ES,BX) Bit16u CX;Bit16u ES;Bit16u BX;
 +
-+static Bit16u biosfn_save_video_state (CX,ES,BX) 
++static Bit16u biosfn_save_video_state (CX,ES,BX)
 +     Bit16u CX;Bit16u ES;Bit16u BX;
  {
 -#ifdef DEBUG
@@ -571,7 +571,7 @@ diff -u -w -r1.64 vgabios.c
 +    return BX;
 +}
 +
-+static Bit16u biosfn_restore_video_state (CX,ES,BX) 
++static Bit16u biosfn_restore_video_state (CX,ES,BX)
 +     Bit16u CX;Bit16u ES;Bit16u BX;
 +{
 +    Bit16u i, crtc_addr, v, addr1, ar_index;
@@ -583,7 +583,7 @@ diff -u -w -r1.64 vgabios.c
 +        crtc_addr = read_word(ES, BX + 0x40);
 +        addr1 = BX;
 +        BX += 5;
-+        
++
 +        for(i=1;i<=4;i++){
 +            outb(VGAREG_SEQU_ADDRESS, i);
 +            outb(VGAREG_SEQU_DATA, read_byte(ES, BX)); BX++;
@@ -610,7 +610,7 @@ diff -u -w -r1.64 vgabios.c
 +        // enable write protection if needed
 +        outb(crtc_addr, 0x11);
 +        outb(crtc_addr+1, read_byte(ES, BX - 0x18 + 0x11));
-+        
++
 +        // Set Attribute Ctl
 +        ar_index = read_byte(ES, addr1 + 0x03);
 +        inb(VGAREG_ACTL_RESET);
@@ -620,14 +620,14 @@ diff -u -w -r1.64 vgabios.c
 +        }
 +        outb(VGAREG_ACTL_ADDRESS, ar_index);
 +        inb(VGAREG_ACTL_RESET);
-+        
++
 +        for(i=0;i<=8;i++) {
 +            outb(VGAREG_GRDC_ADDRESS,i);
 +            outb(VGAREG_GRDC_DATA, read_byte(ES, BX)); BX++;
 +        }
 +        BX += 2; /* crtc_addr */
 +        BX += 4; /* plane latches */
-+        
++
 +        outb(VGAREG_SEQU_ADDRESS, read_byte(ES, addr1)); addr1++;
 +        outb(crtc_addr, read_byte(ES, addr1)); addr1++;
 +        outb(VGAREG_GRDC_ADDRESS, read_byte(ES, addr1)); addr1++;
@@ -671,7 +671,7 @@ diff -u -w -r1.64 vgabios.c
 +    }
 +    return BX;
  }
+
  // ============================================================================================
 diff -u -w vbetables-gen.c
 --- vbetables-gen.c    1970-01-01 01:00:00.000000000 +0100
@@ -745,32 +745,32 @@ diff -u -w vbetables-gen.c
 +    printf("static ModeInfoListItem mode_info_list[]=\n");
 +    printf("{\n");
 +    for(pm = modes; pm->mode != 0; pm++) {
-+        printf("{ 0x%04x, /* %dx%dx%d */\n", 
++        printf("{ 0x%04x, /* %dx%dx%d */\n",
 +               pm->mode, pm->width, pm->height, pm->depth);
-+        printf("{ /*Bit16u ModeAttributes*/ %s,\n", 
++        printf("{ /*Bit16u ModeAttributes*/ %s,\n",
 +               "VBE_MODE_ATTRIBUTE_SUPPORTED | "
 +               "VBE_MODE_ATTRIBUTE_EXTENDED_INFORMATION_AVAILABLE | "
 +               "VBE_MODE_ATTRIBUTE_COLOR_MODE | "
 +               "VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE | "
 +               "VBE_MODE_ATTRIBUTE_GRAPHICS_MODE");
-+           
++
 +        printf("/*Bit8u  WinAAttributes*/ %s,\n",
 +               "VBE_WINDOW_ATTRIBUTE_RELOCATABLE | "
 +               "VBE_WINDOW_ATTRIBUTE_READABLE | "
 +               "VBE_WINDOW_ATTRIBUTE_WRITEABLE");
-+        
++
 +        printf("/*Bit8u  WinBAttributes*/ %d,\n", 0);
-+        
++
 +        printf("/*Bit16u WinGranularity*/ %s,\n", "VBE_DISPI_BANK_SIZE_KB");
-+        
++
 +        printf("/*Bit16u WinSize*/ %s,\n", "VBE_DISPI_BANK_SIZE_KB");
-+        
++
 +        printf("/*Bit16u WinASegment*/ %s,\n", "VGAMEM_GRAPH");
-+        
++
 +        printf("/*Bit16u WinBSegment*/ 0x%04x,\n", 0);
-+        
++
 +        printf("/*Bit32u WinFuncPtr*/ %d,\n", 0);
-+        
++
 +        if (pm->depth == 4)
 +            pitch = (pm->width + 7) / 8;
 +        else
@@ -789,7 +789,7 @@ diff -u -w vbetables-gen.c
 +            printf("/*Bit8u  NumberOfPlanes*/ %d,\n", 1);
 +            printf("/*Bit8u  BitsPerPixel*/ %d,\n", pm->depth);
 +        }
-+        printf("/*Bit8u  NumberOfBanks*/ %d,\n", 
++        printf("/*Bit8u  NumberOfBanks*/ %d,\n",
 +               (pm->height * pitch + 65535) / 65536);
 +
 +        if (pm->depth == 4)
@@ -858,18 +858,18 @@ diff -u -w vbetables-gen.c
 +            break;
 +        }
 +
-+        printf("/*Bit8u  RedMaskSize*/ %d,\n", r_size);               
-+        printf("/*Bit8u  RedFieldPosition*/ %d,\n", r_pos);          
-+        printf("/*Bit8u  GreenMaskSize*/ %d,\n", g_size);             
-+        printf("/*Bit8u  GreenFieldPosition*/ %d,\n", g_pos);        
-+        printf("/*Bit8u  BlueMaskSize*/ %d,\n", b_size);              
-+        printf("/*Bit8u  BlueFieldPosition*/ %d,\n", b_pos);         
-+        printf("/*Bit8u  RsvdMaskSize*/ %d,\n", a_size);              
-+        printf("/*Bit8u  RsvdFieldPosition*/ %d,\n", a_pos);         
-+        printf("/*Bit8u  DirectColorModeInfo*/ %d,\n", 0);       
++        printf("/*Bit8u  RedMaskSize*/ %d,\n", r_size);
++        printf("/*Bit8u  RedFieldPosition*/ %d,\n", r_pos);
++        printf("/*Bit8u  GreenMaskSize*/ %d,\n", g_size);
++        printf("/*Bit8u  GreenFieldPosition*/ %d,\n", g_pos);
++        printf("/*Bit8u  BlueMaskSize*/ %d,\n", b_size);
++        printf("/*Bit8u  BlueFieldPosition*/ %d,\n", b_pos);
++        printf("/*Bit8u  RsvdMaskSize*/ %d,\n", a_size);
++        printf("/*Bit8u  RsvdFieldPosition*/ %d,\n", a_pos);
++        printf("/*Bit8u  DirectColorModeInfo*/ %d,\n", 0);
 +
 +// Mandatory information for VBE 2.0 and above
-+        printf("/*Bit32u PhysBasePtr*/ %s,\n",             
++        printf("/*Bit32u PhysBasePtr*/ %s,\n",
 +               "VBE_DISPI_LFB_PHYSICAL_ADDRESS");
 +        printf("/*Bit32u OffScreenMemOffset*/ %d,\n", 0);
 +        printf("/*Bit16u OffScreenMemSize*/ %d,\n", 0);
index f6fad8861aad1ac39616eb9ee6da9d82559cac0e..f9ae53e1d1a661aa13517dd9c10089158c7b0abb 100644 (file)
--- a/ppc-dis.c
+++ b/ppc-dis.c
@@ -646,7 +646,7 @@ const struct powerpc_operand powerpc_operands[] =
    same.  */
 
 /*ARGSUSED*/
-static unsigned long 
+static unsigned long
 insert_bat (insn, value, errmsg)
      uint32_t insn;
      int32_t value;
@@ -1122,7 +1122,7 @@ insert_ras (insn, value, errmsg)
    extraction function just checks that the fields are the same.  */
 
 /*ARGSUSED*/
-static unsigned long 
+static unsigned long
 insert_rbs (insn, value, errmsg)
      uint32_t insn;
      int32_t value;
index 834c778552d5bfcab6fc3a7e6ef7d9f454914cfe..94438b78f1a1a93aabc485a110fc14483adbbfcf 100644 (file)
@@ -50,13 +50,13 @@ QEMU has two operating modes:
 
 @itemize @minus
 
-@item 
+@item
 Full system emulation. In this mode, QEMU emulates a full system (for
 example a PC), including one or several processors and various
 peripherals. It can be used to launch different Operating Systems
 without rebooting the PC or to debug system code.
 
-@item 
+@item
 User mode emulation. In this mode, QEMU can launch
 processes compiled for one CPU on another CPU. It can be used to
 launch the Wine Windows API emulator (@url{http://www.winehq.org}) or
@@ -65,7 +65,7 @@ to ease cross-compilation and cross-debugging.
 @end itemize
 
 QEMU can run without an host kernel driver and yet gives acceptable
-performance. 
+performance.
 
 For system emulation, the following hardware targets are supported:
 @itemize
@@ -138,18 +138,18 @@ The QEMU PC System emulator simulates the
 following peripherals:
 
 @itemize @minus
-@item 
+@item
 i440FX host PCI bridge and PIIX3 PCI to ISA bridge
 @item
 Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA
 extensions (hardware level, including all non standard modes).
 @item
 PS/2 mouse and keyboard
-@item 
+@item
 2 PCI IDE interfaces with hard disk and CD-ROM support
 @item
 Floppy disk
-@item 
+@item
 NE2000 PCI network adapters
 @item
 Serial ports
@@ -397,12 +397,12 @@ qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
 @item -net socket[,vlan=n][,fd=h][,mcast=maddr:port]
 
 Create a VLAN @var{n} shared with another QEMU virtual
-machines using a UDP multicast socket, effectively making a bus for 
+machines using a UDP multicast socket, effectively making a bus for
 every QEMU with same multicast address @var{maddr} and @var{port}.
 NOTES:
 @enumerate
-@item 
-Several QEMU can be running on different hosts and share same bus (assuming 
+@item
+Several QEMU can be running on different hosts and share same bus (assuming
 correct multicast setup for these hosts).
 @item
 mcast support is compatible with User Mode Linux (argument @option{eth@var{N}=mcast}), see
@@ -502,10 +502,10 @@ for easier testing of various kernels.
 
 @table @option
 
-@item -kernel bzImage 
+@item -kernel bzImage
 Use @var{bzImage} as kernel image.
 
-@item -append cmdline 
+@item -append cmdline
 Use @var{cmdline} as kernel command line
 
 @item -initrd file
@@ -630,13 +630,13 @@ The default device is @code{vc} in graphical mode and @code{stdio} in
 non graphical mode.
 
 @item -s
-Wait gdb connection to port 1234 (@pxref{gdb_usage}). 
+Wait gdb connection to port 1234 (@pxref{gdb_usage}).
 @item -p port
 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 <=
@@ -707,9 +707,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 b
 Send break (magic sysrq in Linux)
@@ -745,7 +745,7 @@ emulator. You can use it to:
 Remove or insert removable medias images
 (such as CD-ROM or floppies)
 
-@item 
+@item
 Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
 from a disk file.
 
@@ -762,10 +762,10 @@ 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 
+@item info subcommand
 show various information about the system state
 
 @table @option
@@ -869,7 +869,7 @@ Physical memory dump starting at @var{addr}.
 data. Its syntax is: @option{/@{count@}@{format@}@{size@}}
 
 @table @var
-@item count 
+@item count
 is the number of items to be dumped.
 
 @item format
@@ -883,11 +883,11 @@ respectively select 16 or 32 bit code instruction size.
 
 @end table
 
-Examples: 
+Examples:
 @itemize
 @item
 Dump 10 instructions at the current instruction pointer:
-@example 
+@example
 (qemu) x/10i $eip
 0x90107063:  ret
 0x90107064:  sti
@@ -903,7 +903,7 @@ Dump 10 instructions at the current instruction pointer:
 
 @item
 Dump 80 16 bit values at the start of the video memory.
-@smallexample 
+@smallexample
 (qemu) xp/80hx 0xb8000
 0x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42
 0x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41
@@ -1040,10 +1040,10 @@ but they are deleted as soon as you exit QEMU.
 
 VM snapshots currently have the following known limitations:
 @itemize
-@item 
+@item
 They cannot cope with removable devices if they are removed or
 inserted after a snapshot is done.
-@item 
+@item
 A few device drivers still have incomplete snapshot support so their
 state is not saved or restored properly (in particular USB).
 @end itemize
@@ -1109,7 +1109,7 @@ modifications are written in a temporary file).
 
 @subsubsection Mac OS X
 
-@file{/dev/cdrom} is an alias to the first CDROM. 
+@file{/dev/cdrom} is an alias to the first CDROM.
 
 Currently there is no specific code to handle removable medias, so it
 is better to use the @code{change} or @code{eject} monitor commands to
@@ -1121,7 +1121,7 @@ change or eject media.
 QEMU can automatically create a virtual FAT disk image from a
 directory tree. In order to use it, just type:
 
-@example 
+@example
 qemu linux.img -hdb fat:/my_directory
 @end example
 
@@ -1131,14 +1131,14 @@ them via SAMBA or NFS. The default access is @emph{read-only}.
 
 Floppies can be emulated with the @code{:floppy:} option:
 
-@example 
+@example
 qemu linux.img -fda fat:floppy:/my_directory
 @end example
 
 A read/write support is available for testing (beta stage) with the
 @code{:rw:} option:
 
-@example 
+@example
 qemu linux.img -fda fat:floppy:rw:/my_directory
 @end example
 
@@ -1206,7 +1206,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
 
@@ -1310,7 +1310,7 @@ using it. USB devices requiring real time streaming (i.e. USB Video
 Cameras) are not supported yet.
 
 @enumerate
-@item If you use an early Linux 2.4 kernel, verify that no Linux driver 
+@item If you use an early Linux 2.4 kernel, verify that no Linux driver
 is actually using the USB device. A simple way to do that is simply to
 disable the corresponding kernel module by renaming it from @file{mydriver.o}
 to @file{mydriver.o.disabled}.
@@ -1327,7 +1327,7 @@ chown -R myuid /proc/bus/usb
 @end example
 
 @item Launch QEMU and do in the monitor:
-@example 
+@example
 info usbhost
   Device 1.2, speed 480 Mb/s
     Class 00: USB device 1234:5678, USB DISK
@@ -1336,7 +1336,7 @@ You should see the list of the devices you can use (Never try to use
 hubs, it won't work).
 
 @item Add the device in QEMU by using:
-@example 
+@example
 usb_add host:1234:5678
 @end example
 
@@ -1456,7 +1456,7 @@ Bartlett): go to the Control Panel => Add/Remove Hardware & Next =>
 Add/Troubleshoot a device => Add a new device & Next => No, select the
 hardware from a list & Next => NT Apm/Legacy Support & Next => Next
 (again) a few times. Now the driver is installed and Windows 2000 now
-correctly instructs QEMU to shutdown at the appropriate moment. 
+correctly instructs QEMU to shutdown at the appropriate moment.
 
 @subsubsection Share a directory between Unix and Windows
 
@@ -1510,13 +1510,13 @@ or PowerMac PowerPC system.
 QEMU emulates the following PowerMac peripherals:
 
 @itemize @minus
-@item 
-UniNorth PCI Bridge 
+@item
+UniNorth PCI Bridge
 @item
 PCI VGA compatible card with VESA Bochs Extensions
-@item 
+@item
 2 PMAC IDE interfaces with hard disk and CD-ROM support
-@item 
+@item
 NE2000 PCI adapters
 @item
 Non Volatile RAM
@@ -1527,15 +1527,15 @@ VIA-CUDA with ADB keyboard and mouse.
 QEMU emulates the following PREP peripherals:
 
 @itemize @minus
-@item 
+@item
 PCI Bridge
 @item
 PCI VGA compatible card with VESA Bochs Extensions
-@item 
+@item
 2 IDE interfaces with hard disk and CD-ROM support
 @item
 Floppy disk
-@item 
+@item
 NE2000 network adapters
 @item
 Serial port
@@ -1554,13 +1554,13 @@ 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.
 
 @end table
 
-@c man end 
+@c man end
 
 
 More information is available at
@@ -1579,7 +1579,7 @@ QEMU emulates the following sun4m peripherals:
 IOMMU
 @item
 TCX Frame buffer
-@item 
+@item
 Lance (Am7990) Ethernet
 @item
 Non Volatile RAM M48T08
@@ -1615,7 +1615,7 @@ Set the initial TCX graphic mode. The default is 1024x768.
 
 @end table
 
-@c man end 
+@c man end
 
 @node Sparc64 System emulator invocation
 @section Sparc64 System emulator invocation
@@ -1627,7 +1627,7 @@ QEMU emulates the following sun4u peripherals:
 
 @itemize @minus
 @item
-UltraSparc IIi APB PCI Bridge 
+UltraSparc IIi APB PCI Bridge
 @item
 PCI VGA compatible card with VESA Bochs Extensions
 @item
@@ -1644,7 +1644,7 @@ The emulator is able to boot a Linux kernel and to run a Linux Debian
 installation from NFS. The following devices are emulated:
 
 @itemize @minus
-@item 
+@item
 MIPS R4K CPU
 @item
 PC style serial port
@@ -1666,7 +1666,7 @@ devices:
 ARM926E or ARM1026E CPU
 @item
 Two PL011 UARTs
-@item 
+@item
 SMC 91c111 Ethernet adapter
 @item
 PL110 LCD controller
@@ -1683,7 +1683,7 @@ ARM926E CPU
 PL190 Vectored Interrupt Controller
 @item
 Four PL011 UARTs
-@item 
+@item
 SMC 91c111 Ethernet adapter
 @item
 PL110 LCD controller
@@ -1704,8 +1704,8 @@ LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices.
 A Linux 2.6 test image is available on the QEMU web site. More
 information is available in the QEMU mailing-list archive.
 
-@node QEMU User space emulator 
-@chapter QEMU User space emulator 
+@node QEMU User space emulator
+@chapter QEMU User space emulator
 
 @menu
 * Supported Operating Systems ::
@@ -1739,14 +1739,14 @@ Mac OS X/Darwin (refered as qemu-darwin-user)
 @subsection Quick Start
 
 In order to launch a Linux process, QEMU needs the process executable
-itself and all the target (x86) dynamic libraries used by it. 
+itself and all the target (x86) dynamic libraries used by it.
 
 @itemize
 
 @item On x86, you can just try to launch any process by using the native
 libraries:
 
-@example 
+@example
 qemu-i386 -L / /bin/ls
 @end example
 
@@ -1755,7 +1755,7 @@ qemu-i386 -L / /bin/ls
 
 @item Since QEMU is also a linux process, you can launch qemu with qemu (NOTE: you can only do that if you compiled QEMU from the sources):
 
-@example 
+@example
 qemu-i386 -L / qemu-i386 -L / /bin/ls
 @end example
 
@@ -1764,7 +1764,7 @@ qemu-i386 -L / qemu-i386 -L / /bin/ls
 @code{LD_LIBRARY_PATH} is not set:
 
 @example
-unset LD_LIBRARY_PATH 
+unset LD_LIBRARY_PATH
 @end example
 
 Then you can launch the precompiled @file{ls} x86 executable:
@@ -1799,7 +1799,7 @@ qemu-i386 /usr/local/qemu-i386/bin/ls-i386
 @end example
 
 @item Download the binary x86 Wine install
-(@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page). 
+(@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page).
 
 @item Configure Wine on your account. Look at the provided script
 @file{/usr/local/qemu-i386/@/bin/wine-conf.sh}. Your previous
@@ -1824,7 +1824,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)
@@ -1890,20 +1890,20 @@ CD or compile them by hand.
 @item On x86, you can just try to launch any process by using the native
 libraries:
 
-@example 
+@example
 qemu-darwin-i386 /bin/ls
 @end example
 
 or to run the ppc version of the executable:
 
-@example 
+@example
 qemu-darwin-ppc /bin/ls
 @end example
 
 @item On ppc, you'll have to tell qemu where your x86 libraries (and dynamic linker)
 are installed:
 
-@example 
+@example
 qemu-darwin-i386 -L /opt/x86_root/ /bin/ls
 @end example
 
@@ -1922,7 +1922,7 @@ usage: qemu-darwin-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)
@@ -1989,7 +1989,7 @@ these older versions so that usally you don't have to do anything.
 @url{http://www.mingw.org/}. You can find detailed installation
 instructions in the download section and the FAQ.
 
-@item Download 
+@item Download
 the MinGW development library of SDL 1.2.x
 (@file{SDL-devel-1.2.x-@/mingw32.tar.gz}) from
 @url{http://www.libsdl.org}. Unpack it in a temporary place, and
@@ -1998,14 +1998,14 @@ directory. Edit the @file{sdl-config} script so that it gives the
 correct SDL directory when invoked.
 
 @item Extract the current version of QEMU.
+
 @item Start the MSYS shell (file @file{msys.bat}).
 
-@item Change to the QEMU directory. Launch @file{./configure} and 
+@item Change to the QEMU directory. Launch @file{./configure} and
 @file{make}.  If you have problems using SDL, verify that
 @file{sdl-config} can be launched from the MSYS command line.
 
-@item You can install QEMU in @file{Program Files/Qemu} by typing 
+@item You can install QEMU in @file{Program Files/Qemu} by typing
 @file{make install}. Don't forget to copy @file{SDL.dll} in
 @file{Program Files/Qemu}.
 
@@ -2019,13 +2019,13 @@ correct SDL directory when invoked.
 Install the MinGW cross compilation tools available at
 @url{http://www.mingw.org/}.
 
-@item 
+@item
 Install the Win32 version of SDL (@url{http://www.libsdl.org}) by
 unpacking @file{i386-mingw32msvc.tar.gz}. Set up the PATH environment
 variable so that @file{i386-mingw32msvc-sdl-config} can be launched by
 the QEMU configuration script.
 
-@item 
+@item
 Configure QEMU for Windows cross compilation:
 @example
 ./configure --enable-mingw32
@@ -2034,9 +2034,9 @@ If necessary, you can change the cross-prefix according to the prefix
 choosen for the MinGW tools with --cross-prefix. You can also use
 --prefix to set the Win32 install path.
 
-@item You can install QEMU in the installation directory by typing 
+@item You can install QEMU in the installation directory by typing
 @file{make install}. Don't forget to copy @file{SDL.dll} in the
-installation directory. 
+installation directory.
 
 @end itemize
 
index a25954649b106ef795bee8dc0d4707f7da9bcb26..c14bc31e5210d8344cb60716a8e8de151b371516 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU disk image utility
- * 
+ *
  * Copyright (c) 2003-2007 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -75,7 +75,7 @@ void term_print_filename(const char *filename)
     term_printf(filename);
 }
 
-void __attribute__((noreturn)) error(const char *fmt, ...) 
+void __attribute__((noreturn)) error(const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
@@ -166,7 +166,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);
@@ -248,7 +248,7 @@ static int img_create(int argc, char **argv)
     int64_t size;
     const char *p;
     BlockDriver *drv;
-    
+
     encrypted = 0;
     for(;;) {
         c = getopt(argc, argv, "b:f:he");
@@ -269,7 +269,7 @@ static int img_create(int argc, char **argv)
             break;
         }
     }
-    if (optind >= argc) 
+    if (optind >= argc)
         help();
     filename = argv[optind++];
     size = 0;
@@ -338,7 +338,7 @@ static int img_commit(int argc, char **argv)
             break;
         }
     }
-    if (optind >= argc) 
+    if (optind >= argc)
         help();
     filename = argv[optind++];
 
@@ -446,13 +446,13 @@ static int img_convert(int argc, char **argv)
             break;
         }
     }
-    if (optind >= argc) 
+    if (optind >= argc)
         help();
     filename = argv[optind++];
-    if (optind >= argc) 
+    if (optind >= argc)
         help();
     out_filename = argv[optind++];
-    
+
     bs = bdrv_new_open(filename, fmt);
 
     drv = bdrv_find_format(out_fmt);
@@ -473,7 +473,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 (compress) {
@@ -492,12 +492,12 @@ static int img_convert(int argc, char **argv)
                 n = cluster_sectors;
             else
                 n = nb_sectors;
-            if (bdrv_read(bs, sector_num, buf, n) < 0) 
+            if (bdrv_read(bs, sector_num, buf, n) < 0)
                 error("error while reading");
             if (n < cluster_sectors)
                 memset(buf + n * 512, 0, cluster_size - n * 512);
             if (is_not_zero(buf, cluster_size)) {
-                if (bdrv_write_compressed(out_bs, sector_num, buf, 
+                if (bdrv_write_compressed(out_bs, sector_num, buf,
                                           cluster_sectors) != 0)
                     error("error while compressing sector %" PRId64,
                           sector_num);
@@ -516,7 +516,7 @@ static int img_convert(int argc, char **argv)
                 n = (IO_BUF_SIZE / 512);
             else
                 n = nb_sectors;
-            if (bdrv_read(bs, sector_num, buf, n) < 0) 
+            if (bdrv_read(bs, sector_num, buf, n) < 0)
                 error("error while reading");
             /* NOTE: at the same time we convert, we do not write zero
                sectors to have a chance to compress the image. Ideally, we
@@ -524,7 +524,7 @@ static int img_convert(int argc, char **argv)
             buf1 = buf;
             while (n > 0) {
                 if (is_allocated_sectors(buf1, n, &n1)) {
-                    if (bdrv_write(out_bs, sector_num, buf1, n1) < 0) 
+                    if (bdrv_write(out_bs, sector_num, buf1, n1) < 0)
                         error("error while writing");
                 }
                 sector_num += n1;
@@ -554,7 +554,7 @@ static int64_t get_allocated_file_size(const char *filename)
            return (((int64_t) high) << 32) + low;
     }
 
-    if (_stati64(filename, &st) < 0) 
+    if (_stati64(filename, &st) < 0)
         return -1;
     return st.st_size;
 }
@@ -562,7 +562,7 @@ static int64_t get_allocated_file_size(const char *filename)
 static int64_t get_allocated_file_size(const char *filename)
 {
     struct stat st;
-    if (stat(filename, &st) < 0) 
+    if (stat(filename, &st) < 0)
         return -1;
     return (int64_t)st.st_blocks * 512;
 }
@@ -612,7 +612,7 @@ static int img_info(int argc, char **argv)
             break;
         }
     }
-    if (optind >= argc) 
+    if (optind >= argc)
         help();
     filename = argv[optind++];
 
@@ -636,26 +636,26 @@ static int img_info(int argc, char **argv)
     if (allocated_size < 0)
        sprintf(dsize_buf, "unavailable");
     else
-        get_human_readable_size(dsize_buf, sizeof(dsize_buf), 
+        get_human_readable_size(dsize_buf, sizeof(dsize_buf),
                                 allocated_size);
     printf("image: %s\n"
            "file format: %s\n"
            "virtual size: %s (%" PRId64 " bytes)\n"
            "disk size: %s\n",
-           filename, fmt_name, size_buf, 
+           filename, fmt_name, size_buf,
            (total_sectors * 512),
            dsize_buf);
     if (bdrv_is_encrypted(bs))
         printf("encrypted: yes\n");
     if (bdrv_get_info(bs, &bdi) >= 0) {
-        if (bdi.cluster_size != 0) 
+        if (bdi.cluster_size != 0)
             printf("cluster_size: %d\n", bdi.cluster_size);
     }
     bdrv_get_backing_filename(bs, backing_filename, sizeof(backing_filename));
     if (backing_filename[0] != '\0') {
         path_combine(backing_filename2, sizeof(backing_filename2),
                      filename, backing_filename);
-        printf("backing file: %s (actual path: %s)\n", 
+        printf("backing file: %s (actual path: %s)\n",
                backing_filename,
                backing_filename2);
     }
index 1f01dce16263f41a78a0ae96922d8f75d9500b4c..f5d4633f063f555a8a3a7bcce234c0496e80ee40 100644 (file)
@@ -18,11 +18,11 @@ Command parameters:
 @table @var
 @item filename
  is a disk image filename
-@item base_image 
+@item base_image
 is the read-only disk image which is used as base for a copy on
     write image; the copy on write image only stores the modified data
 
-@item fmt 
+@item fmt
 is the disk image format. It is guessed automatically in most cases. The following formats are supported:
 
 @table @code
@@ -53,19 +53,19 @@ Linux Compressed Loop image, useful only to reuse directly compressed
 CD-ROM images present for example in the Knoppix CD-ROMs.
 @end table
 
-@item size 
+@item size
 is the disk image size in kilobytes. Optional suffixes @code{M}
-(megabyte) and @code{G} (gigabyte) are supported 
+(megabyte) and @code{G} (gigabyte) are supported
 
 @item output_filename
-is the destination disk image filename 
+is the destination disk image filename
 
 @item output_fmt
  is the destination format
 
 @item -c
 indicates that target image must be compressed (qcow format only)
-@item -e 
+@item -e
 indicates that the target image must be encrypted (qcow format only)
 @end table
 
@@ -75,7 +75,7 @@ Command description:
 @item create [-e] [-b @var{base_image}] [-f @var{fmt}] @var{filename} [@var{size}]
 
 Create the new disk image @var{filename} of size @var{size} and format
-@var{fmt}. 
+@var{fmt}.
 
 If @var{base_image} is specified, then the image will record only the
 differences from @var{base_image}. No size needs to be specified in
index 77bda8637e29964390369fb3ccb812600ffc3769..ae4558bb1a29250760bb85300c7079416f684882 100644 (file)
@@ -49,13 +49,13 @@ QEMU has two operating modes:
 
 @itemize @minus
 
-@item 
+@item
 Full system emulation. In this mode, QEMU emulates a full system
 (usually a PC), including a processor and various peripherals. It can
 be used to launch an different Operating System without rebooting the
 PC or to debug system code.
 
-@item 
+@item
 User mode emulation (Linux host only). In this mode, QEMU can launch
 Linux processes compiled for one CPU on another CPU. It can be used to
 launch the Wine Windows API emulator (@url{http://www.winehq.org}) or
@@ -68,7 +68,7 @@ easy to use.
 
 QEMU generic features:
 
-@itemize 
+@itemize
 
 @item User space only or full system emulation.
 
@@ -80,23 +80,23 @@ QEMU generic features:
 
 @item Precise exceptions support.
 
-@item The virtual CPU is a library (@code{libqemu}) which can be used 
+@item The virtual CPU is a library (@code{libqemu}) which can be used
 in other projects (look at @file{qemu/tests/qruncom.c} to have an
 example of user mode @code{libqemu} usage).
 
 @end itemize
 
 QEMU user mode emulation features:
-@itemize 
+@itemize
 @item Generic Linux system call converter, including most ioctls.
 
 @item clone() emulation using native CPU clone() to use Linux scheduler for threads.
 
-@item Accurate signal handling by remapping host signals to target signals. 
+@item Accurate signal handling by remapping host signals to target signals.
 @end itemize
 
 QEMU full system emulation features:
-@itemize 
+@itemize
 @item QEMU can either use a full software MMU for maximum portability or use the host system call mmap() to simulate the target MMU.
 @end itemize
 
@@ -105,23 +105,23 @@ QEMU full system emulation features:
 
 QEMU x86 target features:
 
-@itemize 
+@itemize
 
-@item The virtual x86 CPU supports 16 bit and 32 bit addressing with segmentation. 
+@item The virtual x86 CPU supports 16 bit and 32 bit addressing with segmentation.
 LDT/GDT and IDT are emulated. VM86 mode is also supported to run DOSEMU.
 
 @item Support of host page sizes bigger than 4KB in user mode emulation.
 
 @item QEMU can emulate itself on x86.
 
-@item An extensive Linux x86 CPU test program is included @file{tests/test-i386}. 
+@item An extensive Linux x86 CPU test program is included @file{tests/test-i386}.
 It can be used to test other x86 virtual CPUs.
 
 @end itemize
 
 Current QEMU limitations:
 
-@itemize 
+@itemize
 
 @item No SSE/MMX support (yet).
 
@@ -129,11 +129,11 @@ Current QEMU limitations:
 
 @item IPC syscalls are missing.
 
-@item The x86 segment limits and access rights are not tested at every 
+@item The x86 segment limits and access rights are not tested at every
 memory access (yet). Hopefully, very few OSes seem to rely on that for
 normal use.
 
-@item On non x86 host CPUs, @code{double}s are used instead of the non standard 
+@item On non x86 host CPUs, @code{double}s are used instead of the non standard
 10 byte @code{long double}s of x86 for floating point emulation to get
 maximum performances.
 
@@ -157,7 +157,7 @@ maximum performances.
 
 @itemize
 
-@item Full PowerPC 32 bit emulation, including privileged instructions, 
+@item Full PowerPC 32 bit emulation, including privileged instructions,
 FPU and MMU.
 
 @item Can run most PowerPC Linux binaries.
@@ -179,7 +179,7 @@ instructions, FPU and I/D MMU, but misses VIS instructions.
 
 Current QEMU limitations:
 
-@itemize 
+@itemize
 
 @item Tagged add/subtract instructions are not supported, but they are
 probably not used.
@@ -281,7 +281,7 @@ to generate a dynamic code generator which concatenates the simple
 instructions to build a function (see @file{op.h:dyngen_code()}).
 
 In essence, the process is similar to [1], but more work is done at
-compile time. 
+compile time.
 
 A key idea to get optimal performances is that constant parameters can
 be passed to the simple operations. For that purpose, dummy ELF
@@ -373,7 +373,7 @@ translated code in the page and enables write accesses to the page.
 
 Correct translated code invalidation is done efficiently by maintaining
 a linked list of every translated block contained in a given page. Other
-linked lists are also maintained to undo direct block chaining. 
+linked lists are also maintained to undo direct block chaining.
 
 Although the overhead of doing @code{mprotect()} calls is important,
 most MSDOS programs can be emulated at reasonnable speed with QEMU and
@@ -393,7 +393,7 @@ only data is modified in the page.
 @section Exception support
 
 longjmp() is used when an exception such as division by zero is
-encountered. 
+encountered.
 
 The host SIGSEGV and SIGBUS signal handlers are used to get invalid
 memory accesses. The exact CPU state can be retrieved because all the
@@ -421,7 +421,7 @@ speed up the translation.
 
 In order to avoid flushing the translated code each time the MMU
 mappings change, QEMU uses a physically indexed translation cache. It
-means that each basic block is indexed with its physical address. 
+means that each basic block is indexed with its physical address.
 
 When MMU mappings change, only the chaining of the basic blocks is
 reset (i.e. a basic block can no longer jump directly to another one).
@@ -500,7 +500,7 @@ relocated at load time.
 
 @table @asis
 
-@item [1] 
+@item [1]
 @url{http://citeseer.nj.nec.com/piumarta98optimizing.html}, Optimizing
 direct threaded code by selective inlining (1998) by Ian Piumarta, Fabio
 Riccardi.
@@ -527,23 +527,23 @@ Chernoff and Ray Hookway.
 Willows Software.
 
 @item [7]
-@url{http://user-mode-linux.sourceforge.net/}, 
+@url{http://user-mode-linux.sourceforge.net/},
 The User-mode Linux Kernel.
 
 @item [8]
-@url{http://www.plex86.org/}, 
+@url{http://www.plex86.org/},
 The new Plex86 project.
 
 @item [9]
-@url{http://www.vmware.com/}, 
+@url{http://www.vmware.com/},
 The VMWare PC virtualizer.
 
 @item [10]
-@url{http://www.microsoft.com/windowsxp/virtualpc/}, 
+@url{http://www.microsoft.com/windowsxp/virtualpc/},
 The VirtualPC PC virtualizer.
 
 @item [11]
-@url{http://www.twoostwo.org/}, 
+@url{http://www.twoostwo.org/},
 The TwoOStwo PC virtualizer.
 
 @end table
index cbe33dbdd872cf247bd3b8c5ef6df33efe1a2f69..2a4daa1ea6c50521ebcd733e09e6e602dea6e8eb 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU readline utility
- * 
+ *
  * Copyright (c) 2003-2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -182,7 +182,7 @@ static void term_up_char(void)
     }
     term_hist_entry--;
     if (term_hist_entry >= 0) {
-       pstrcpy(term_cmd_buf, sizeof(term_cmd_buf), 
+       pstrcpy(term_cmd_buf, sizeof(term_cmd_buf),
                 term_history[term_hist_entry]);
        term_cmd_buf_index = term_cmd_buf_size = strlen(term_cmd_buf);
     }
@@ -265,7 +265,7 @@ static void term_completion(void)
     char *cmdline;
 
     nb_completions = 0;
-    
+
     cmdline = qemu_malloc(term_cmd_buf_index + 1);
     if (!cmdline)
         return;
diff --git a/sdl.c b/sdl.c
index 279b35e124193ead6e6035c49149df24fc878cbd..c52a278dec1e783f041121d079acf142d8ed139d 100644 (file)
--- a/sdl.c
+++ b/sdl.c
@@ -1,8 +1,8 @@
 /*
  * QEMU SDL display driver
- * 
+ *
  * Copyright (c) 2003 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -310,7 +310,7 @@ static void sdl_refresh(DisplayState *ds)
 {
     SDL_Event ev1, *ev = &ev1;
     int mod_state;
-                     
+
     if (last_vm_running != vm_running) {
         last_vm_running = vm_running;
         sdl_update_caption();
@@ -337,7 +337,7 @@ static void sdl_refresh(DisplayState *ds)
                         toggle_full_screen(ds);
                         gui_keysym = 1;
                         break;
-                    case 0x02 ... 0x0a: /* '1' to '9' keys */ 
+                    case 0x02 ... 0x0a: /* '1' to '9' keys */
                         /* Reset the modifiers sent to the current console */
                         reset_keys();
                         console_select(keycode - 0x02);
@@ -415,7 +415,7 @@ static void sdl_refresh(DisplayState *ds)
                     }
                 }
             }
-            if (is_graphic_console() && !gui_keysym) 
+            if (is_graphic_console() && !gui_keysym)
                 sdl_process_key(&ev->key);
             break;
         case SDL_QUIT:
@@ -448,7 +448,7 @@ static void sdl_refresh(DisplayState *ds)
                     } else if (bev->button == SDL_BUTTON_WHEELDOWN && ev->type == SDL_MOUSEBUTTONDOWN) {
                         dz = 1;
                     }
-#endif               
+#endif
                     sdl_send_mouse_event(dz);
                 }
             }
@@ -465,7 +465,7 @@ static void sdl_refresh(DisplayState *ds)
     }
 }
 
-static void sdl_cleanup(void) 
+static void sdl_cleanup(void)
 {
     SDL_Quit();
 }
index 5f45e5ed258798554005662fd5a92f4ca9047ac4..a1d56c59c6e4b1367def8cfdf8369dd00f00f83f 100644 (file)
--- a/sh4-dis.c
+++ b/sh4-dis.c
@@ -483,7 +483,7 @@ const sh_opcode_info sh_table[] =
 /* 0100nnnn10111010 lds <REG_N>,Y1     */{"lds",{A_REG_N,A_Y1},{HEX_4,REG_N,HEX_B,HEX_A}, arch_sh_dsp_up},
 
 /* 0100nnnn01011010 lds <REG_N>,FPUL    */{"lds",{A_REG_M,FPUL_N},{HEX_4,REG_M,HEX_5,HEX_A}, arch_sh2e_up},
-  
+
 /* 0100nnnn01101010 lds <REG_M>,FPSCR   */{"lds",{A_REG_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_A}, arch_sh2e_up},
 
 /* 0100nnnn00000110 lds.l @<REG_N>+,MACH*/{"lds.l",{A_INC_N,A_MACH},{HEX_4,REG_N,HEX_0,HEX_6}, arch_sh1_up},
@@ -505,7 +505,7 @@ const sh_opcode_info sh_table[] =
 /* 0100nnnn10110110 lds.l @<REG_N>+,Y1 */{"lds.l",{A_INC_N,A_Y1},{HEX_4,REG_N,HEX_B,HEX_6}, arch_sh_dsp_up},
 
 /* 0100nnnn01010110 lds.l @<REG_M>+,FPUL*/{"lds.l",{A_INC_M,FPUL_N},{HEX_4,REG_M,HEX_5,HEX_6}, arch_sh2e_up},
-  
+
 /* 0100nnnn01100110 lds.l @<REG_M>+,FPSCR*/{"lds.l",{A_INC_M,FPSCR_N},{HEX_4,REG_M,HEX_6,HEX_6}, arch_sh2e_up},
 
 /* 0000000000111000 ldtlb               */{"ldtlb",{0},{HEX_0,HEX_0,HEX_3,HEX_8}, arch_sh3_up},
@@ -758,7 +758,7 @@ const sh_opcode_info sh_table[] =
 /* 0000nnnn10111010 sts Y1,<REG_N>     */{"sts",{A_Y1,A_REG_N},{HEX_0,REG_N,HEX_B,HEX_A}, arch_sh_dsp_up},
 
 /* 0000nnnn01011010 sts FPUL,<REG_N>    */{"sts",{FPUL_M,A_REG_N},{HEX_0,REG_N,HEX_5,HEX_A}, arch_sh2e_up},
-  
+
 /* 0000nnnn01101010 sts FPSCR,<REG_N>   */{"sts",{FPSCR_M,A_REG_N},{HEX_0,REG_N,HEX_6,HEX_A}, arch_sh2e_up},
 
 /* 0100nnnn00000010 sts.l MACH,@-<REG_N>*/{"sts.l",{A_MACH,A_DEC_N},{HEX_4,REG_N,HEX_0,HEX_2}, arch_sh1_up},
@@ -780,7 +780,7 @@ const sh_opcode_info sh_table[] =
 /* 0100nnnn10110110 sts.l Y1,@-<REG_N> */{"sts.l",{A_Y1,A_DEC_N},{HEX_4,REG_N,HEX_B,HEX_2}, arch_sh_dsp_up},
 
 /* 0100nnnn01010010 sts.l FPUL,@-<REG_N>*/{"sts.l",{FPUL_M,A_DEC_N},{HEX_4,REG_N,HEX_5,HEX_2}, arch_sh2e_up},
-  
+
 /* 0100nnnn01100010 sts.l FPSCR,@-<REG_N>*/{"sts.l",{FPSCR_M,A_DEC_N},{HEX_4,REG_N,HEX_6,HEX_2}, arch_sh2e_up},
 
 /* 0011nnnnmmmm1000 sub <REG_M>,<REG_N> */{"sub",{ A_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_8}, arch_sh1_up},
@@ -1155,7 +1155,7 @@ const sh_opcode_info sh_table[] =
 /* 0011nnnnmmmm0001 1001dddddddddddd movu.w @(<DISP12>,<REG_M>),<REG_N> */
 {"movu.w",{A_DISP_REG_M,A_REG_N},{HEX_3,REG_N,REG_M,HEX_1,HEX_9,DISP0_12BY2}, arch_sh2a_nofpu_up | arch_op32},
 
-{ 0, {0}, {0}, 0 } 
+{ 0, {0}, {0}, 0 }
 };
 
 #endif
@@ -1293,7 +1293,7 @@ print_insn_ddt (insn, info)
        while (op->nibbles[2] != (unsigned) ((insn >> 4) & 3)
               || op->nibbles[3] != (unsigned) (insn & 0xf))
          op++;
-       
+
        print_movxy (op,
                     (4 * ((insn & (is_movy ? 0x200 : 0x100)) == 0)
                      + 2 * is_movy
index 2e868624fbc4821884c448eda51e1cddc0f2b2a4..3f331ee07d11a2fa2d91846497b641b7c3ac6d2e 100644 (file)
@@ -16,7 +16,7 @@ The copyright terms and conditions:
 ---BEGIN---
 
  Copyright (c) 1995,1996 Danny Gasparovski.  All rights reserved.
+
  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions
  are met:
index 62cbcfd8f3396f0b6bcd7c4e1b690bb9dbb89547..310e5c860c6c8510f5808590c22aeff0e59d0661 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * QEMU BOOTP/DHCP server
- * 
+ *
  * Copyright (c) 2004 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -87,7 +87,7 @@ static void dhcp_decode(const uint8_t *buf, int size,
     const uint8_t *p, *p_end;
     int len, tag;
 
-    *pmsg_type = 0;    
+    *pmsg_type = 0;
 
     p = buf;
     p_end = buf + size;
@@ -99,7 +99,7 @@ static void dhcp_decode(const uint8_t *buf, int size,
     while (p < p_end) {
         tag = p[0];
         if (tag == RFC1533_PAD) {
-            p++; 
+            p++;
         } else if (tag == RFC1533_END) {
             break;
         } else {
@@ -135,16 +135,16 @@ static void bootp_reply(struct bootp_t *bp)
     /* extract exact DHCP msg type */
     dhcp_decode(bp->bp_vend, DHCP_OPT_LEN, &dhcp_msg_type);
     dprintf("bootp packet op=%d msgtype=%d\n", bp->bp_op, dhcp_msg_type);
-    
+
     if (dhcp_msg_type == 0)
         dhcp_msg_type = DHCPREQUEST; /* Force reply for old BOOTP clients */
-        
-    if (dhcp_msg_type != DHCPDISCOVER && 
+
+    if (dhcp_msg_type != DHCPDISCOVER &&
         dhcp_msg_type != DHCPREQUEST)
         return;
     /* XXX: this is a hack to get the client mac address */
     memcpy(client_ethaddr, bp->bp_hwaddr, 6);
-    
+
     if ((m = m_get()) == NULL)
         return;
     m->m_data += if_maxlinkhdr;
@@ -197,7 +197,7 @@ static void bootp_reply(struct bootp_t *bp)
         *q++ = 1;
         *q++ = DHCPACK;
     }
-        
+
     if (dhcp_msg_type == DHCPDISCOVER ||
         dhcp_msg_type == DHCPREQUEST) {
         *q++ = RFC2132_SRV_ID;
@@ -211,12 +211,12 @@ static void bootp_reply(struct bootp_t *bp)
         *q++ = 0xff;
         *q++ = 0xff;
         *q++ = 0x00;
-        
+
         *q++ = RFC1533_GATEWAY;
         *q++ = 4;
         memcpy(q, &saddr.sin_addr, 4);
         q += 4;
-        
+
         *q++ = RFC1533_DNS;
         *q++ = 4;
         dns_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_DNS);
@@ -238,8 +238,8 @@ static void bootp_reply(struct bootp_t *bp)
         }
     }
     *q++ = RFC1533_END;
-    
-    m->m_len = sizeof(struct bootp_t) - 
+
+    m->m_len = sizeof(struct bootp_t) -
         sizeof(struct ip) - sizeof(struct udphdr);
     udp_output2(NULL, m, &saddr, &daddr, IPTOS_LOWDELAY);
 }
index f8f7512b6b286636b84fd9fb3466ab4d0e5286e1..b98373b51f94686eebb01832520c0bd987f21f9c 100644 (file)
@@ -41,7 +41,7 @@
  *
  * This routine is very heavily used in the network
  * code and should be modified for each CPU to be as fast as possible.
- * 
+ *
  * XXX Since we will never span more than 1 mbuf, we can optimise this
  */
 
@@ -63,13 +63,13 @@ int cksum(struct mbuf *m, int len)
                u_int16_t s[2];
                u_int32_t l;
        } l_util;
-       
+
        if (m->m_len == 0)
           goto cont;
        w = mtod(m, u_int16_t *);
-       
+
        mlen = m->m_len;
-       
+
        if (len < mlen)
           mlen = len;
        len -= mlen;
@@ -107,7 +107,7 @@ int cksum(struct mbuf *m, int len)
        while ((mlen -= 2) >= 0) {
                sum += *w++;
        }
-       
+
        if (byte_swapped) {
                REDUCE;
                sum <<= 8;
@@ -117,11 +117,11 @@ int cksum(struct mbuf *m, int len)
                        sum += s_util.s;
                        mlen = 0;
                } else
-                  
+
                   mlen = -1;
        } else if (mlen == -1)
           s_util.c[0] = *(u_int8_t *)w;
-       
+
 cont:
 #ifdef DEBUG
        if (len) {
index d3d8c5796bc5539f2aac400845b0536f90d8b7ef..e312445505ce4a689bfb88b02f65540eb1310143 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  * Portions copyright (c) 2000 Kelly Price.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
@@ -18,7 +18,7 @@ int slirp_debug = 0;
 
 extern char *strerror _P((int));
 
-/* Carry over one item from main.c so that the tty's restored. 
+/* Carry over one item from main.c so that the tty's restored.
  * Only done when the tty being used is /dev/tty --RedWolf */
 extern struct termios slirp_tty_settings;
 extern int slirp_tty_restore;
@@ -32,7 +32,7 @@ debug_init(file, dbg)
        /* Close the old debugging file */
        if (dfd)
           fclose(dfd);
-       
+
        dfd = fopen(file,"w");
        if (dfd != NULL) {
 #if 0
@@ -58,7 +58,7 @@ dump_packet(dat, n)
 {
        u_char *pptr = (u_char *)dat;
        int j,k;
-       
+
        n /= 16;
        n++;
        DEBUG_MISC((dfd, "PACKET DUMPED: \n"));
@@ -74,7 +74,7 @@ dump_packet(dat, n)
 #if 0
 /*
  * Statistic routines
- * 
+ *
  * These will print statistics to the screen, the debug file (dfd), or
  * a buffer, depending on "type", so that the stats can be sent over
  * the link as well.
@@ -86,9 +86,9 @@ ttystats(ttyp)
 {
        struct slirp_ifstats *is = &ttyp->ifstats;
        char buff[512];
-       
+
        lprint(" \r\n");
-       
+
        if (if_comp & IF_COMPRESS)
           strcpy(buff, "on");
        else if (if_comp & IF_NOCOMPRESS)
@@ -123,7 +123,7 @@ void
 allttystats()
 {
        struct ttys *ttyp;
-       
+
        for (ttyp = ttys; ttyp; ttyp = ttyp->next)
           ttystats(ttyp);
 }
@@ -132,7 +132,7 @@ allttystats()
 void
 ipstats()
 {
-       lprint(" \r\n");        
+       lprint(" \r\n");
 
        lprint("IP stats:\r\n");
        lprint("  %6d total packets received (%d were unaligned)\r\n",
@@ -158,9 +158,9 @@ void
 vjstats()
 {
        lprint(" \r\n");
-       
+
        lprint("VJ compression stats:\r\n");
-       
+
        lprint("  %6d outbound packets (%d compressed)\r\n",
               comp_s.sls_packets, comp_s.sls_compressed);
        lprint("  %6d searches for connection stats (%d misses)\r\n",
@@ -178,7 +178,7 @@ tcpstats()
        lprint(" \r\n");
 
        lprint("TCP stats:\r\n");
-       
+
        lprint("  %6d packets sent\r\n", tcpstat.tcps_sndtotal);
        lprint("          %6d data packets (%d bytes)\r\n",
                        tcpstat.tcps_sndpack, tcpstat.tcps_sndbyte);
@@ -191,8 +191,8 @@ tcpstats()
        lprint("          %6d window update packets\r\n", tcpstat.tcps_sndwinup);
        lprint("          %6d control (SYN/FIN/RST) packets\r\n", tcpstat.tcps_sndctrl);
        lprint("          %6d times tcp_output did nothing\r\n", tcpstat.tcps_didnuttin);
-       
-       lprint("  %6d packets received\r\n", tcpstat.tcps_rcvtotal);       
+
+       lprint("  %6d packets received\r\n", tcpstat.tcps_rcvtotal);
        lprint("          %6d acks (for %d bytes)\r\n",
                        tcpstat.tcps_rcvackpack, tcpstat.tcps_rcvackbyte);
        lprint("          %6d duplicate acks\r\n", tcpstat.tcps_rcvdupack);
@@ -201,7 +201,7 @@ tcpstats()
                        tcpstat.tcps_rcvpack, tcpstat.tcps_rcvbyte);
         lprint("          %6d completely duplicate packets (%d bytes)\r\n",
                        tcpstat.tcps_rcvduppack, tcpstat.tcps_rcvdupbyte);
-       
+
        lprint("          %6d packets with some duplicate data (%d bytes duped)\r\n",
                        tcpstat.tcps_rcvpartduppack, tcpstat.tcps_rcvpartdupbyte);
        lprint("          %6d out-of-order packets (%d bytes)\r\n",
@@ -214,7 +214,7 @@ tcpstats()
        lprint("          %6d discarded for bad checksums\r\n", tcpstat.tcps_rcvbadsum);
        lprint("          %6d discarded for bad header offset fields\r\n",
                        tcpstat.tcps_rcvbadoff);
-       
+
        lprint("  %6d connection requests\r\n", tcpstat.tcps_connattempt);
        lprint("  %6d connection accepts\r\n", tcpstat.tcps_accepts);
        lprint("  %6d connections established (including accepts)\r\n", tcpstat.tcps_connects);
@@ -233,8 +233,8 @@ tcpstats()
        lprint("  %6d correct ACK header predictions\r\n", tcpstat.tcps_predack);
        lprint("  %6d correct data packet header predictions\n", tcpstat.tcps_preddat);
        lprint("  %6d TCP cache misses\r\n", tcpstat.tcps_socachemiss);
-       
-       
+
+
 /*     lprint("    Packets received too short:         %d\r\n", tcpstat.tcps_rcvshort); */
 /*     lprint("    Segments dropped due to PAWS:       %d\r\n", tcpstat.tcps_pawsdrop); */
 
@@ -272,18 +272,18 @@ mbufstats()
 {
        struct mbuf *m;
        int i;
-       
+
         lprint(" \r\n");
-       
+
        lprint("Mbuf stats:\r\n");
 
        lprint("  %6d mbufs allocated (%d max)\r\n", mbuf_alloced, mbuf_max);
-       
+
        i = 0;
        for (m = m_freelist.m_next; m != &m_freelist; m = m->m_next)
                i++;
        lprint("  %6d mbufs on free list\r\n",  i);
-       
+
        i = 0;
        for (m = m_usedlist.m_next; m != &m_usedlist; m = m->m_next)
                i++;
@@ -299,12 +299,12 @@ sockstats()
        struct socket *so;
 
         lprint(" \r\n");
-       
+
        lprint(
           "Proto[state]     Sock     Local Address, Port  Remote Address, Port RecvQ SendQ\r\n");
-                       
+
        for (so = tcb.so_next; so != &tcb; so = so->so_next) {
-               
+
                n = sprintf(buff, "tcp[%s]", so->so_tcpcb?tcpstates[so->so_tcpcb->t_state]:"NONE");
                while (n < 17)
                   buff[n++] = ' ';
@@ -316,9 +316,9 @@ sockstats()
                                inet_ntoa(so->so_faddr), ntohs(so->so_fport),
                                so->so_rcv.sb_cc, so->so_snd.sb_cc);
        }
-                  
+
        for (so = udb.so_next; so != &udb; so = so->so_next) {
-               
+
                n = sprintf(buff, "udp[%d sec]", (so->so_expire - curtime) / 1000);
                while (n < 17)
                   buff[n++] = ' ';
@@ -338,7 +338,7 @@ slirp_exit(exit_status)
        int exit_status;
 {
        struct ttys *ttyp;
-       
+
        DEBUG_CALL("slirp_exit");
        DEBUG_ARG("exit_status = %d", exit_status);
 
@@ -347,7 +347,7 @@ slirp_exit(exit_status)
                if (!dfd)
                   debug_init("slirp_stats", 0xf);
                lprint_arg = (char **)&dfd;
-               
+
                ipstats();
                tcpstats();
                udpstats();
@@ -357,17 +357,17 @@ slirp_exit(exit_status)
                allttystats();
                vjstats();
        }
-       
+
        for (ttyp = ttys; ttyp; ttyp = ttyp->next)
           tty_detached(ttyp, 1);
-       
+
        if (slirp_forked) {
                /* Menendez time */
                if (kill(getppid(), SIGQUIT) < 0)
                        lprint("Couldn't kill parent process %ld!\n",
                            (long) getppid());
        }
-       
+
        /* Restore the terminal if we gotta */
        if(slirp_tty_restore)
          tcsetattr(0,TCSANOW, &slirp_tty_settings);  /* NOW DAMMIT! */
index 6e8444dabbe4edc823b2c6de48309eed5a533f13..fa62cb9fe93953408154e9c0a1799cf036aabbef 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
index 94132ca888b8e97254aa3c2d3bc632fecead549b..6d72fa72f3be0d823b5b201cbd6e8df5242e4aad 100644 (file)
@@ -77,12 +77,12 @@ writen(fd, bptr, n)
 {
        int ret;
        int total;
-       
+
        /* This should succeed most of the time */
        ret = send(fd, bptr, n,0);
        if (ret == n || ret <= 0)
           return ret;
-       
+
        /* Didn't write everything, go into the loop */
        total = ret;
        while (n > total) {
@@ -97,7 +97,7 @@ writen(fd, bptr, n)
 /*
  * if_input - read() the tty, do "top level" processing (ie: check for any escapes),
  * and pass onto (*ttyp->if_input)
- * 
+ *
  * XXXXX Any zeros arriving by themselves are NOT placed into the arriving packet.
  */
 #define INBUFF_SIZE 2048 /* XXX */
@@ -107,14 +107,14 @@ if_input(ttyp)
 {
        u_char if_inbuff[INBUFF_SIZE];
        int if_n;
-       
+
        DEBUG_CALL("if_input");
        DEBUG_ARG("ttyp = %lx", (long)ttyp);
-       
+
        if_n = recv(ttyp->fd, (char *)if_inbuff, INBUFF_SIZE,0);
-       
+
        DEBUG_MISC((dfd, " read %d bytes\n", if_n));
-       
+
        if (if_n <= 0) {
                if (if_n == 0 || (errno != EINTR && errno != EAGAIN)) {
                        if (ttyp->up)
@@ -138,19 +138,19 @@ if_input(ttyp)
                }
        }
        ttyp->ones = ttyp->zeros = 0;
-       
+
        (*ttyp->if_input)(ttyp, if_inbuff, if_n);
 }
-#endif 
-       
+#endif
+
 /*
  * if_output: Queue packet into an output queue.
- * There are 2 output queue's, if_fastq and if_batchq. 
+ * There are 2 output queue's, if_fastq and if_batchq.
  * Each output queue is a doubly linked list of double linked lists
  * of mbufs, each list belonging to one "session" (socket).  This
  * way, we can output packets fairly by sending one packet from each
  * session, instead of all the packets from one session, then all packets
- * from the next session, etc.  Packets on the if_fastq get absolute 
+ * from the next session, etc.  Packets on the if_fastq get absolute
  * priority, but if one session hogs the link, it gets "downgraded"
  * to the batchq until it runs out of packets, then it'll return
  * to the fastq (eg. if the user does an ls -alR in a telnet session,
@@ -163,11 +163,11 @@ if_output(so, ifm)
 {
        struct mbuf *ifq;
        int on_fastq = 1;
-       
+
        DEBUG_CALL("if_output");
        DEBUG_ARG("so = %lx", (long)so);
        DEBUG_ARG("ifm = %lx", (long)ifm);
-       
+
        /*
         * First remove the mbuf from m_usedlist,
         * since we're gonna use m_next and m_prev ourselves
@@ -177,9 +177,9 @@ if_output(so, ifm)
                remque(ifm);
                ifm->m_flags &= ~M_USEDLIST;
        }
-       
+
        /*
-        * See if there's already a batchq list for this session.  
+        * See if there's already a batchq list for this session.
         * This can include an interactive session, which should go on fastq,
         * but gets too greedy... hence it'll be downgraded from fastq to batchq.
         * We mustn't put this packet back on the fastq (or we'll send it out of order)
@@ -193,7 +193,7 @@ if_output(so, ifm)
                        goto diddit;
                }
        }
-       
+
        /* No match, check which queue to put it on */
        if (so && (so->so_iptos & IPTOS_LOWDELAY)) {
                ifq = if_fastq.ifq_prev;
@@ -209,15 +209,15 @@ if_output(so, ifm)
                }
        } else
                ifq = if_batchq.ifq_prev;
-       
+
        /* Create a new doubly linked list for this session */
        ifm->ifq_so = so;
        ifs_init(ifm);
        insque(ifm, ifq);
-       
+
 diddit:
        ++if_queued;
-       
+
        if (so) {
                /* Update *_queued */
                so->so_queued++;
@@ -229,12 +229,12 @@ diddit:
                 * have been sent over the link
                 * (XXX These are arbitrary numbers, probably not optimal..)
                 */
-               if (on_fastq && ((so->so_nqueued >= 6) && 
+               if (on_fastq && ((so->so_nqueued >= 6) &&
                                 (so->so_nqueued - so->so_queued) >= 3)) {
-                       
+
                        /* Remove from current queue... */
                        remque(ifm->ifs_next);
-                       
+
                        /* ...And insert in the new.  That'll teach ya! */
                        insque(ifm->ifs_next, &if_batchq);
                }
@@ -267,12 +267,12 @@ void
 if_start(void)
 {
        struct mbuf *ifm, *ifqt;
-       
+
        DEBUG_CALL("if_start");
-       
+
        if (if_queued == 0)
           return; /* Nothing to do */
-       
+
  again:
         /* check if we can really output */
         if (!slirp_can_output())
@@ -290,7 +290,7 @@ if_start(void)
                   ifm = next_m;
                else
                   ifm = if_batchq.ifq_next;
-               
+
                /* Set which packet to send on next iteration */
                next_m = ifm->ifq_next;
        }
@@ -298,20 +298,20 @@ if_start(void)
        ifqt = ifm->ifq_prev;
        remque(ifm);
        --if_queued;
-       
+
        /* If there are more packets for this session, re-queue them */
        if (ifm->ifs_next != /* ifm->ifs_prev != */ ifm) {
                insque(ifm->ifs_next, ifqt);
                ifs_remque(ifm);
        }
-       
+
        /* Update so_queued */
        if (ifm->ifq_so) {
                if (--ifm->ifq_so->so_queued == 0)
                   /* If there's no more queued, reset nqueued */
                   ifm->ifq_so->so_nqueued = 0;
        }
-       
+
        /* Encapsulate the packet for sending */
         if_encap(ifm->m_data, ifm->m_len);
 
index 5d96a90340a0f8824bb7552a3a7ca789e2cac9a6..bf24174a6989599f8f2d27c8101d957df6ab9c15 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
@@ -39,11 +39,11 @@ struct slirp_ifstats {
        u_int in_bytes;         /* Input bytes */
        u_int in_errpkts;               /* Input Error Packets */
        u_int in_errbytes;      /* Input Error Bytes */
-       
+
        u_int bytes_saved;      /* Number of bytes that compression "saved" */
                                /* ie: number of bytes that didn't need to be sent over the link
                                 * because of compression */
-       
+
        u_int in_mbad;          /* Bad incoming packets */
 };
 
index b67a37359f9a2912812c42d44f897d83c2e6e525..ae5a3211852ff64e9c9c51e98e3b10a72e68db58 100644 (file)
@@ -63,7 +63,7 @@ static int icmp_flush[19] = {
 /* INFO (15) */          0,
 /* INFO REPLY (16) */    0,
 /* ADDR MASK (17) */     0,
-/* ADDR MASK REPLY (18) */ 0 
+/* ADDR MASK REPLY (18) */ 0
 };
 
 /*
@@ -78,13 +78,13 @@ icmp_input(m, hlen)
   register struct ip *ip=mtod(m, struct ip *);
   int icmplen=ip->ip_len;
   /* int code; */
-       
+
   DEBUG_CALL("icmp_input");
   DEBUG_ARG("m = %lx", (long )m);
   DEBUG_ARG("m_len = %d", m->m_len);
 
   icmpstat.icps_received++;
-       
+
   /*
    * Locate icmp structure in mbuf, and check
    * that its not corrupted and of at least minimum length.
@@ -105,7 +105,7 @@ icmp_input(m, hlen)
   }
   m->m_len += hlen;
   m->m_data -= hlen;
-  
+
   /*   icmpstat.icps_inhist[icp->icmp_type]++; */
   /* code = icp->icmp_code; */
 
@@ -121,7 +121,7 @@ icmp_input(m, hlen)
       struct sockaddr_in addr;
       if ((so = socreate()) == NULL) goto freeit;
       if(udp_attach(so) == -1) {
-       DEBUG_MISC((dfd,"icmp_input udp_attach errno = %d-%s\n", 
+       DEBUG_MISC((dfd,"icmp_input udp_attach errno = %d-%s\n",
                    errno,strerror(errno)));
        sofree(so);
        m_free(m);
@@ -135,7 +135,7 @@ icmp_input(m, hlen)
       so->so_iptos = ip->ip_tos;
       so->so_type = IPPROTO_ICMP;
       so->so_state = SS_ISFCONNECTED;
-      
+
       /* Send the packet */
       addr.sin_family = AF_INET;
       if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) {
@@ -157,7 +157,7 @@ icmp_input(m, hlen)
                (struct sockaddr *)&addr, sizeof(addr)) == -1) {
        DEBUG_MISC((dfd,"icmp_input udp sendto tx errno = %d-%s\n",
                    errno,strerror(errno)));
-       icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno)); 
+       icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno));
        udp_detach(so);
       }
     } /* if ip->ip_dst.s_addr == alias_addr.s_addr */
@@ -173,7 +173,7 @@ icmp_input(m, hlen)
     icmpstat.icps_notsupp++;
     m_freem(m);
     break;
-    
+
   default:
     icmpstat.icps_badtype++;
     m_freem(m);
@@ -199,7 +199,7 @@ end_error:
  * mbuf *msrc is used as a template, but is NOT m_free()'d.
  * It is reported as the bad ip packet.  The header should
  * be fully correct and in host byte order.
- * ICMP fragmentation is illegal.  All machines must accept 576 bytes in one 
+ * ICMP fragmentation is illegal.  All machines must accept 576 bytes in one
  * packet.  The maximum payload is 576-20(ip hdr)-8(icmp hdr)=548
  */
 
@@ -226,7 +226,7 @@ icmp_error(msrc, type, code, minsize, message)
   /* check msrc */
   if(!msrc) goto end_error;
   ip = mtod(msrc, struct ip *);
-#if DEBUG  
+#if DEBUG
   { char bufa[20], bufb[20];
     strcpy(bufa, inet_ntoa(ip->ip_src));
     strcpy(bufb, inet_ntoa(ip->ip_dst));
@@ -258,9 +258,9 @@ icmp_error(msrc, type, code, minsize, message)
   /* make the header of the reply packet */
   ip  = mtod(m, struct ip *);
   hlen= sizeof(struct ip );     /* no options in reply */
-  
+
   /* fill in icmp */
-  m->m_data += hlen;                  
+  m->m_data += hlen;
   m->m_len -= hlen;
 
   icp = mtod(m, struct icmp *);
@@ -269,7 +269,7 @@ icmp_error(msrc, type, code, minsize, message)
   else if(s_ip_len>ICMP_MAXDATALEN)         /* maximum size */
     s_ip_len=ICMP_MAXDATALEN;
 
-  m->m_len=ICMP_MINLEN+s_ip_len;        /* 8 bytes ICMP header */  
+  m->m_len=ICMP_MINLEN+s_ip_len;        /* 8 bytes ICMP header */
 
   /* min. size = 8+sizeof(struct ip)+8 */
 
@@ -304,7 +304,7 @@ icmp_error(msrc, type, code, minsize, message)
   /* fill in ip */
   ip->ip_hl = hlen >> 2;
   ip->ip_len = m->m_len;
-  
+
   ip->ip_tos=((ip->ip_tos & 0x1E) | 0xC0);  /* high priority for errors */
 
   ip->ip_ttl = MAXTTL;
@@ -313,7 +313,7 @@ icmp_error(msrc, type, code, minsize, message)
   ip->ip_src = alias_addr;
 
   (void ) ip_output((struct socket *)NULL, m);
-  
+
   icmpstat.icps_reflect++;
 
 end_error:
index 4f5bfd9a564373b7f23717cefbf0a619daa01d25..a7d6e318185b0f380012fbfe748fea687b5d6e28 100644 (file)
@@ -37,7 +37,7 @@
 /*
  * Changes and additions relating to SLiRP are
  * Copyright (c) 1995 Danny Gasparovski.
- * 
+ *
  * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
@@ -73,20 +73,20 @@ ip_input(m)
 {
        register struct ip *ip;
        int hlen;
-       
+
        DEBUG_CALL("ip_input");
        DEBUG_ARG("m = %lx", (long)m);
        DEBUG_ARG("m_len = %d", m->m_len);
 
        ipstat.ips_total++;
-       
+
        if (m->m_len < sizeof (struct ip)) {
                ipstat.ips_toosmall++;
                return;
        }
-       
+
        ip = mtod(m, struct ip *);
-       
+
        if (ip->ip_v != IPVERSION) {
                ipstat.ips_badvers++;
                goto bad;
@@ -99,8 +99,8 @@ ip_input(m)
        }
 
         /* keep ip header intact for ICMP reply
-        * ip->ip_sum = cksum(m, hlen); 
-        * if (ip->ip_sum) { 
+        * ip->ip_sum = cksum(m, hlen);
+        * if (ip->ip_sum) {
         */
        if(cksum(m,hlen)) {
          ipstat.ips_badsum++;
@@ -154,7 +154,7 @@ ip_input(m)
         * (We could look in the reassembly queue to see
         * if the packet was previously fragmented,
         * but it's not worth the time; just let them time out.)
-        * 
+        *
         * XXX This should fail, don't fragment yet
         */
        if (ip->ip_off &~ IP_DF) {
@@ -181,7 +181,7 @@ ip_input(m)
                ip->ip_len -= hlen;
                if (ip->ip_off & IP_MF)
                  ((struct ipasfrag *)ip)->ipf_mff |= 1;
-               else 
+               else
                  ((struct ipasfrag *)ip)->ipf_mff &= ~1;
 
                ip->ip_off <<= 3;
@@ -244,7 +244,7 @@ ip_reass(ip, fp)
        register struct ipasfrag *q;
        int hlen = ip->ip_hl << 2;
        int i, next;
-       
+
        DEBUG_CALL("ip_reass");
        DEBUG_ARG("ip = %lx", (long)ip);
        DEBUG_ARG("fp = %lx", (long)fp);
@@ -275,7 +275,7 @@ ip_reass(ip, fp)
          q = (struct ipasfrag *)fp;
          goto insert;
        }
-       
+
        /*
         * Find a segment which begins after this one does.
         */
@@ -369,7 +369,7 @@ insert:
          ip = (struct ipasfrag *)(m->m_ext + delta);
        }
 
-       /* DEBUG_ARG("ip = %lx", (long)ip); 
+       /* DEBUG_ARG("ip = %lx", (long)ip);
         * ip=(struct ipasfrag *)m->m_data; */
 
        ip->ip_len = next;
@@ -446,9 +446,9 @@ void
 ip_slowtimo()
 {
        register struct ipq *fp;
-       
+
        DEBUG_CALL("ip_slowtimo");
-       
+
        fp = (struct ipq *) ipq.next;
        if (fp == 0)
           return;
@@ -692,6 +692,6 @@ ip_stripoptions(m, mopt)
        i = m->m_len - (sizeof (struct ip) + olen);
        memcpy(opts, opts  + olen, (unsigned)i);
        m->m_len -= olen;
-       
+
        ip->ip_hl = sizeof(struct ip) >> 2;
 }
index f3dc9b70ecc92426cd77781baf483865c0542a9f..b1a84840267628b6c7630defa10a3de218521657 100644 (file)
@@ -65,7 +65,7 @@ ip_output(so, m0)
        DEBUG_CALL("ip_output");
        DEBUG_ARG("so = %lx", (long)so);
        DEBUG_ARG("m0 = %lx", (long)m0);
-       
+
        /* We do no options */
 /*     if (opt) {
  *             m = ip_insertoptions(m, opt, &len);
@@ -92,7 +92,7 @@ ip_output(so, m0)
  *             goto bad;
  *     }
  */
-       
+
        /*
         * If small enough for interface, can just send directly.
         */
@@ -115,7 +115,7 @@ ip_output(so, m0)
                ipstat.ips_cantfrag++;
                goto bad;
        }
-       
+
        len = (if_mtu - hlen) &~ 7;       /* ip databytes per packet */
        if (len < 8) {
                error = -1;
@@ -143,7 +143,7 @@ ip_output(so, m0)
          m->m_data += if_maxlinkhdr;
          mhip = mtod(m, struct ip *);
          *mhip = *ip;
-               
+
                /* No options */
 /*             if (hlen > sizeof (struct ip)) {
  *                     mhlen = ip_optcopy(ip, mhip) + sizeof (struct ip);
@@ -156,15 +156,15 @@ ip_output(so, m0)
            mhip->ip_off |= IP_MF;
          if (off + len >= (u_int16_t)ip->ip_len)
            len = (u_int16_t)ip->ip_len - off;
-         else 
+         else
            mhip->ip_off |= IP_MF;
          mhip->ip_len = htons((u_int16_t)(len + mhlen));
-         
+
          if (m_copy(m, m0, off, len) < 0) {
            error = -1;
            goto sendorfree;
          }
-         
+
          mhip->ip_off = htons((u_int16_t)mhip->ip_off);
          mhip->ip_sum = 0;
          mhip->ip_sum = cksum(m, mhlen);
index a9260afeb3cc7adbfbf0928341f07b693bcc0cbe..6398342dacb4fa1e99014efca75196a126734cdd 100644 (file)
@@ -15,7 +15,7 @@ extern "C" {
 
 void slirp_init(void);
 
-void slirp_select_fill(int *pnfds, 
+void slirp_select_fill(int *pnfds,
                        fd_set *readfds, fd_set *writefds, fd_set *xfds);
 
 void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds);
@@ -26,9 +26,9 @@ void slirp_input(const uint8_t *pkt, int pkt_len);
 int slirp_can_output(void);
 void slirp_output(const uint8_t *pkt, int pkt_len);
 
-int slirp_redir(int is_udp, int host_port, 
+int slirp_redir(int is_udp, int host_port,
                 struct in_addr guest_addr, int guest_port);
-int slirp_add_exec(int do_pty, const char *args, int addr_low_byte, 
+int slirp_add_exec(int do_pty, const char *args, int addr_low_byte,
                    int guest_port);
 
 extern const char *tftp_prefix;
index 181b6ae88d56b62c954e0fcb4ce9f2ad30c849ee..9cd87584e6bb373dd653196cd594fca7f70bada4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
index 3769bafd297124ce3e9fded93524ec2af48e9e53..392aea826b8f06469041835a734bb2b2bcfd812d 100644 (file)
@@ -40,14 +40,14 @@ msize_init()
         * Find a nice value for msize
         * XXX if_maxlinkhdr already in mtu
         */
-       msize = (if_mtu>if_mru?if_mtu:if_mru) + 
+       msize = (if_mtu>if_mru?if_mtu:if_mru) +
                        if_maxlinkhdr + sizeof(struct m_hdr ) + 6;
 }
 
 /*
  * Get an mbuf from the free list, if there are none
  * malloc one
- * 
+ *
  * Because fragmentation can occur if we alloc new mbufs and
  * free old mbufs, we mark all mbufs above mbuf_thresh as M_DOFREE,
  * which tells m_free to actually free() it
@@ -57,9 +57,9 @@ m_get()
 {
        register struct mbuf *m;
        int flags = 0;
-       
+
        DEBUG_CALL("m_get");
-       
+
        if (m_freelist.m_next == &m_freelist) {
                m = (struct mbuf *)malloc(msize);
                if (m == NULL) goto end_error;
@@ -72,11 +72,11 @@ m_get()
                m = m_freelist.m_next;
                remque(m);
        }
-       
+
        /* Insert it in the used list */
        insque(m,&m_usedlist);
        m->m_flags = (flags | M_USEDLIST);
-       
+
        /* Initialise it */
        m->m_size = msize - sizeof(struct m_hdr);
        m->m_data = m->m_dat;
@@ -92,15 +92,15 @@ void
 m_free(m)
        struct mbuf *m;
 {
-       
+
   DEBUG_CALL("m_free");
   DEBUG_ARG("m = %lx", (long )m);
-       
+
   if(m) {
        /* Remove from m_usedlist */
        if (m->m_flags & M_USEDLIST)
           remque(m);
-       
+
        /* If it's M_EXT, free() it */
        if (m->m_flags & M_EXT)
           free(m->m_ext);
@@ -132,7 +132,7 @@ m_cat(m, n)
         */
        if (M_FREEROOM(m) < n->m_len)
                m_inc(m,m->m_size+MINCSIZE);
-       
+
        memcpy(m->m_data+m->m_len, n->m_data, n->m_len);
        m->m_len += n->m_len;
 
@@ -156,7 +156,7 @@ m_inc(m, size)
          m->m_ext = (char *)realloc(m->m_ext,size);
 /*             if (m->m_ext == NULL)
  *                     return (struct mbuf *)NULL;
- */            
+ */
          m->m_data = m->m_ext + datasize;
         } else {
          char *dat;
@@ -166,12 +166,12 @@ m_inc(m, size)
  *                     return (struct mbuf *)NULL;
  */
          memcpy(dat, m->m_dat, m->m_size);
-         
+
          m->m_ext = dat;
          m->m_data = m->m_ext + datasize;
          m->m_flags |= M_EXT;
         }
+
         m->m_size = size;
 
 }
@@ -224,7 +224,7 @@ dtom(dat)
        void *dat;
 {
        struct mbuf *m;
-       
+
        DEBUG_CALL("dtom");
        DEBUG_ARG("dat = %lx", (long )dat);
 
@@ -238,9 +238,9 @@ dtom(dat)
              return m;
          }
        }
-       
+
        DEBUG_ERROR((dfd, "dtom failed"));
-       
+
        return (struct mbuf *)0;
 }
 
index 8cc292bbfb3b3ec97b0acdd5d1c7ea6ae00ba1da..1e8f7a8e487c713545f1303d500af1b5be64d56b 100644 (file)
@@ -69,12 +69,12 @@ struct m_hdr {
 
        int     mh_size;                /* Size of data */
        struct  socket *mh_so;
-       
+
        caddr_t mh_data;                /* Location of data */
        int     mh_len;                 /* Amount of data in this mbuf */
 };
 
-/* 
+/*
  * How much room is in the mbuf, from m_data to the end of the mbuf
  */
 #define M_ROOM(m) ((m->m_flags & M_EXT)? \
@@ -126,7 +126,7 @@ struct mbuf {
 
 struct mbstat {
        int mbs_alloced;                /* Number of mbufs allocated */
-       
+
 };
 
 extern struct  mbstat mbstat;
index 2c42fd15b083ded7d0f984fc887741b636a0c14e..a41dd769b218a356788ef46d8227564dbc9c189a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- * 
+ *
  * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
@@ -31,7 +31,7 @@ show_x(buff, inso)
                if (x_display)
                   lprint("X Redir: Redirecting to display %d\r\n", x_display);
        }
-       
+
        return CFG_OK;
 }
 
@@ -47,7 +47,7 @@ redir_x(inaddr, start_port, display, screen)
        int screen;
 {
        int i;
-       
+
        if (x_port >= 0) {
                lprint("X Redir: X already being redirected.\r\n");
                show_x(0, 0);
@@ -89,7 +89,7 @@ getouraddr()
 {
        char buff[256];
        struct hostent *he = NULL;
-       
+
        if (gethostname(buff,256) == 0)
             he = gethostbyname(buff);
         if (he)
@@ -172,13 +172,13 @@ add_exec(ex_ptr, do_pty, exec, addr, port)
        int port;
 {
        struct ex_list *tmp_ptr;
-       
+
        /* First, check if the port is "bound" */
        for (tmp_ptr = *ex_ptr; tmp_ptr; tmp_ptr = tmp_ptr->ex_next) {
                if (port == tmp_ptr->ex_fport && addr == tmp_ptr->ex_addr)
                   return -1;
        }
-       
+
        tmp_ptr = *ex_ptr;
        *ex_ptr = (struct ex_list *)malloc(sizeof(struct ex_list));
        (*ex_ptr)->ex_fport = port;
@@ -233,7 +233,7 @@ slirp_openpty(amaster, aslave)
 
 #ifdef HAVE_GRANTPT
        char *ptr;
-       
+
        if ((master = open("/dev/ptmx", O_RDWR)) < 0 ||
            grantpt(master) < 0 ||
            unlockpt(master) < 0 ||
@@ -241,7 +241,7 @@ slirp_openpty(amaster, aslave)
                close(master);
                return -1;
        }
-       
+
        if ((slave = open(ptr, O_RDWR)) < 0 ||
            ioctl(slave, I_PUSH, "ptem") < 0 ||
            ioctl(slave, I_PUSH, "ldterm") < 0 ||
@@ -250,16 +250,16 @@ slirp_openpty(amaster, aslave)
                close(slave);
                return -1;
        }
-       
+
        *amaster = master;
        *aslave = slave;
        return 0;
-       
+
 #else
-       
+
        static char line[] = "/dev/ptyXX";
        register const char *cp1, *cp2;
-       
+
        for (cp1 = "pqrsPQRS"; *cp1; cp1++) {
                line[8] = *cp1;
                for (cp2 = "0123456789abcdefghijklmnopqrstuv"; *cp2; cp2++) {
@@ -296,7 +296,7 @@ slirp_openpty(amaster, aslave)
  * process, which connects to this socket, after which we
  * exec the wanted program.  If something (strange) happens,
  * the accept() call could block us forever.
- * 
+ *
  * do_pty = 0   Fork/exec inetd style
  * do_pty = 1   Fork/exec using slirp.telnetd
  * do_ptr = 2   Fork/exec using pty
@@ -320,12 +320,12 @@ fork_exec(so, ex, do_pty)
        char *bptr;
        char *curarg;
        int c, i, ret;
-       
+
        DEBUG_CALL("fork_exec");
        DEBUG_ARG("so = %lx", (long)so);
        DEBUG_ARG("ex = %lx", (long)ex);
        DEBUG_ARG("do_pty = %lx", (long)do_pty);
-       
+
        if (do_pty == 2) {
                if (slirp_openpty(&master, &s) == -1) {
                        lprint("Error: openpty failed: %s\n", strerror(errno));
@@ -335,17 +335,17 @@ fork_exec(so, ex, do_pty)
                addr.sin_family = AF_INET;
                addr.sin_port = 0;
                addr.sin_addr.s_addr = INADDR_ANY;
-               
+
                if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0 ||
                    bind(s, (struct sockaddr *)&addr, addrlen) < 0 ||
                    listen(s, 1) < 0) {
                        lprint("Error: inet socket: %s\n", strerror(errno));
                        closesocket(s);
-                       
+
                        return 0;
                }
        }
-       
+
        switch(fork()) {
         case -1:
                lprint("Error: fork failed: %s\n", strerror(errno));
@@ -353,7 +353,7 @@ fork_exec(so, ex, do_pty)
                if (do_pty == 2)
                   close(master);
                return 0;
-               
+
         case 0:
                /* Set the DISPLAY */
                if (do_pty == 2) {
@@ -375,7 +375,7 @@ fork_exec(so, ex, do_pty)
                             ret = connect(s, (struct sockaddr *)&addr, addrlen);
                         } while (ret < 0 && errno == EINTR);
                }
-               
+
 #if 0
                if (x_port >= 0) {
 #ifdef HAVE_SETENV
@@ -386,13 +386,13 @@ fork_exec(so, ex, do_pty)
                        putenv(buff);
 #endif
                }
-#endif 
+#endif
                dup2(s, 0);
                dup2(s, 1);
                dup2(s, 2);
                for (s = 3; s <= 255; s++)
                   close(s);
-               
+
                i = 0;
                bptr = strdup(ex); /* No need to free() this */
                if (do_pty == 1) {
@@ -410,21 +410,21 @@ fork_exec(so, ex, do_pty)
                        *bptr++ = (char)0;
                        argv[i++] = strdup(curarg);
                   } while (c);
-               
+
                argv[i] = 0;
                execvp(argv[0], argv);
-               
+
                /* Ooops, failed, let's tell the user why */
                  {
                          char buff[256];
-                         
-                         sprintf(buff, "Error: execvp of %s failed: %s\n", 
+
+                         sprintf(buff, "Error: execvp of %s failed: %s\n",
                                  argv[0], strerror(errno));
                          write(2, buff, strlen(buff)+1);
                  }
                close(0); close(1); close(2); /* XXX */
                exit(1);
-               
+
         default:
                if (do_pty == 2) {
                        close(s);
@@ -447,13 +447,13 @@ fork_exec(so, ex, do_pty)
                        setsockopt(so->s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));
                }
                fd_nonblock(so->s);
-               
+
                /* Append the telnet options now */
                if (so->so_m != 0 && do_pty == 1)  {
                        sbappend(so, so->so_m);
                        so->so_m = 0;
                }
-               
+
                return 1;
        }
 }
@@ -465,10 +465,10 @@ strdup(str)
        const char *str;
 {
        char *bptr;
-       
+
        bptr = (char *)malloc(strlen(str)+1);
        strcpy(bptr, str);
-       
+
        return bptr;
 }
 #endif
@@ -484,7 +484,7 @@ snooze_hup(num)
 #endif
        struct sockaddr_in sock_in;
        char buff[256];
-       
+
        ret = -1;
        if (slirp_socket_passwd) {
                s = socket(AF_INET, SOCK_STREAM, 0);
@@ -514,29 +514,29 @@ snooze_hup(num)
 #endif
        slirp_exit(0);
 }
-       
-       
+
+
 void
 snooze()
 {
        sigset_t s;
        int i;
-       
+
        /* Don't need our data anymore */
        /* XXX This makes SunOS barf */
 /*     brk(0); */
-       
+
        /* Close all fd's */
        for (i = 255; i >= 0; i--)
           close(i);
-       
+
        signal(SIGQUIT, slirp_exit);
        signal(SIGHUP, snooze_hup);
        sigemptyset(&s);
-       
+
        /* Wait for any signal */
        sigsuspend(&s);
-       
+
        /* Just in case ... */
        exit(255);
 }
@@ -549,16 +549,16 @@ relay(s)
        int n;
        fd_set readfds;
        struct ttys *ttyp;
-       
+
        /* Don't need our data anymore */
        /* XXX This makes SunOS barf */
 /*     brk(0); */
-       
+
        signal(SIGQUIT, slirp_exit);
        signal(SIGHUP, slirp_exit);
         signal(SIGINT, slirp_exit);
        signal(SIGTERM, slirp_exit);
-       
+
        /* Fudge to get term_raw and term_restore to work */
        if (NULL == (ttyp = tty_attach (0, slirp_tty))) {
          lprint ("Error: tty_attach failed in misc.c:relay()\r\n");
@@ -567,18 +567,18 @@ relay(s)
        ttyp->fd = 0;
        ttyp->flags |= TTY_CTTY;
        term_raw(ttyp);
-       
+
        while (1) {
                FD_ZERO(&readfds);
-               
+
                FD_SET(0, &readfds);
                FD_SET(s, &readfds);
-               
+
                n = select(s+1, &readfds, (fd_set *)0, (fd_set *)0, (struct timeval *)0);
-               
+
                if (n <= 0)
                   slirp_exit(0);
-               
+
                if (FD_ISSET(0, &readfds)) {
                        n = read(0, buf, 8192);
                        if (n <= 0)
@@ -587,7 +587,7 @@ relay(s)
                        if (n <= 0)
                           slirp_exit(0);
                }
-               
+
                if (FD_ISSET(s, &readfds)) {
                        n = read(s, buf, 8192);
                        if (n <= 0)
@@ -597,7 +597,7 @@ relay(s)
                           slirp_exit(0);
                }
        }
-       
+
        /* Just in case.... */
        exit(1);
 }
@@ -614,7 +614,7 @@ lprint(va_alist) va_dcl
 #endif
 {
        va_list args;
-        
+
 #ifdef __STDC__
         va_start(args, format);
 #else
@@ -631,33 +631,33 @@ lprint(va_alist) va_dcl
                        int deltaw = lprint_sb->sb_wptr - lprint_sb->sb_data;
                        int deltar = lprint_sb->sb_rptr - lprint_sb->sb_data;
                        int deltap = lprint_ptr -         lprint_sb->sb_data;
-                                               
+
                        lprint_sb->sb_data = (char *)realloc(lprint_sb->sb_data,
                                                             lprint_sb->sb_datalen + TCP_SNDSPACE);
-                       
+
                        /* Adjust all values */
                        lprint_sb->sb_wptr = lprint_sb->sb_data + deltaw;
                        lprint_sb->sb_rptr = lprint_sb->sb_data + deltar;
                        lprint_ptr =         lprint_sb->sb_data + deltap;
-                       
+
                        lprint_sb->sb_datalen += TCP_SNDSPACE;
                }
        }
-#endif 
+#endif
        if (lprint_print)
           lprint_ptr += (*lprint_print)(*lprint_arg, format, args);
-       
+
        /* Check if they want output to be logged to file as well */
        if (lfd) {
-               /* 
+               /*
                 * Remove \r's
                 * otherwise you'll get ^M all over the file
                 */
                int len = strlen(format);
                char *bptr1, *bptr2;
-               
+
                bptr1 = bptr2 = strdup(format);
-               
+
                while (len--) {
                        if (*bptr1 == '\r')
                           memcpy(bptr1, bptr1+1, len+1);
@@ -680,12 +680,12 @@ add_emu(buff)
        char *buff3 = buff4;
        struct emu_t *emup;
        struct socket *so;
-       
+
        if (sscanf(buff, "%256s %256s", buff2, buff1) != 2) {
                lprint("Error: Bad arguments\r\n");
                return;
        }
-       
+
        if (sscanf(buff1, "%d:%d", &lport, &fport) != 2) {
                lport = 0;
                if (sscanf(buff1, "%d", &fport) != 1) {
@@ -693,7 +693,7 @@ add_emu(buff)
                        return;
                }
        }
-       
+
        if (sscanf(buff2, "%128[^:]:%128s", buff1, buff3) != 2) {
                buff3 = 0;
                if (sscanf(buff2, "%256s", buff1) != 1) {
@@ -701,7 +701,7 @@ add_emu(buff)
                        return;
                }
        }
-       
+
        if (buff3) {
                if (strcmp(buff3, "lowdelay") == 0)
                   tos = IPTOS_LOWDELAY;
@@ -712,7 +712,7 @@ add_emu(buff)
                        return;
                }
        }
-       
+
        if (strcmp(buff1, "ftp") == 0)
           emu = EMU_FTP;
        else if (strcmp(buff1, "irc") == 0)
@@ -723,7 +723,7 @@ add_emu(buff)
                lprint("Error: Unknown service\r\n");
                return;
        }
-       
+
        /* First, check that it isn't already emulated */
        for (emup = tcpemu; emup; emup = emup->next) {
                if (emup->lport == lport && emup->fport == fport) {
@@ -731,7 +731,7 @@ add_emu(buff)
                        return;
                }
        }
-       
+
        /* link it */
        emup = (struct emu_t *)malloc(sizeof (struct emu_t));
        emup->lport = (u_int16_t)lport;
@@ -740,7 +740,7 @@ add_emu(buff)
        emup->emu = emu;
        emup->next = tcpemu;
        tcpemu = emup;
-       
+
        /* And finally, mark all current sessions, if any, as being emulated */
        for (so = tcb.so_next; so != &tcb; so = so->so_next) {
                if ((lport && lport == ntohs(so->so_lport)) ||
@@ -751,7 +751,7 @@ add_emu(buff)
                           so->so_iptos = tos;
                }
        }
-       
+
        lprint("Adding emulation for %s to port %d/%d\r\n", buff1, emup->lport, emup->fport);
 }
 
@@ -803,12 +803,12 @@ u_sleep(usec)
 {
        struct timeval t;
        fd_set fdset;
-       
+
        FD_ZERO(&fdset);
-       
+
        t.tv_sec = 0;
        t.tv_usec = usec * 1000;
-       
+
        select(0, &fdset, &fdset, &fdset, &t);
 }
 
@@ -822,11 +822,11 @@ fd_nonblock(fd)
 {
 #ifdef FIONBIO
        int opt = 1;
-       
+
        ioctlsocket(fd, FIONBIO, &opt);
 #else
        int opt;
-       
+
        opt = fcntl(fd, F_GETFL, 0);
        opt |= O_NONBLOCK;
        fcntl(fd, F_SETFL, opt);
@@ -839,11 +839,11 @@ fd_block(fd)
 {
 #ifdef FIONBIO
        int opt = 0;
-       
+
        ioctlsocket(fd, FIONBIO, &opt);
 #else
        int opt;
-       
+
        opt = fcntl(fd, F_GETFL, 0);
        opt &= ~O_NONBLOCK;
        fcntl(fd, F_SETFL, opt);
@@ -867,10 +867,10 @@ rsh_exec(so,ns, user, host, args)
        int fd0[2];
        int s;
        char buff[256];
-       
+
        DEBUG_CALL("rsh_exec");
        DEBUG_ARG("so = %lx", (long)so);
-       
+
        if (pipe(fd)<0) {
           lprint("Error: pipe failed: %s\n", strerror(errno));
           return 0;
@@ -891,7 +891,7 @@ rsh_exec(so,ns, user, host, args)
           return 0;
         }
 #endif
-       
+
        switch(fork()) {
         case -1:
            lprint("Error: fork failed: %s\n", strerror(errno));
@@ -900,11 +900,11 @@ rsh_exec(so,ns, user, host, args)
            close(fd0[0]);
            close(fd0[1]);
            return 0;
-           
+
         case 0:
            close(fd[0]);
            close(fd0[0]);
-           
+
                /* Set the DISPLAY */
            if (x_port >= 0) {
 #ifdef HAVE_SETENV
@@ -915,29 +915,29 @@ rsh_exec(so,ns, user, host, args)
              putenv(buff);
 #endif
            }
-           
+
            dup2(fd0[1], 0);
            dup2(fd0[1], 1);
            dup2(fd[1], 2);
            for (s = 3; s <= 255; s++)
              close(s);
-           
+
            execlp("rsh","rsh","-l", user, host, args, NULL);
-           
+
            /* Ooops, failed, let's tell the user why */
-           
-           sprintf(buff, "Error: execlp of %s failed: %s\n", 
+
+           sprintf(buff, "Error: execlp of %s failed: %s\n",
                    "rsh", strerror(errno));
            write(2, buff, strlen(buff)+1);
            close(0); close(1); close(2); /* XXX */
            exit(1);
-           
+
         default:
           close(fd[1]);
           close(fd0[1]);
           ns->s=fd[0];
           so->s=fd0[0];
-          
+
           return 1;
        }
 }
index 8e6a606c9762ce5c3a16923e4d754f87b18c9346..6484a8126eab707ba75eaf3c30e1bb5637b5b21d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
index d6726c94de885c7fac99fd5b8b8da97c8a02dead..209064b1aaf6822e0734d1e6ddd0ae6fb18aad46 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
@@ -9,7 +9,7 @@
 
 /* Done as a macro in socket.h */
 /* int
- * sbspace(struct sockbuff *sb) 
+ * sbspace(struct sockbuff *sb)
  * {
  *     return SB_DATALEN - sb->sb_cc;
  * }
@@ -25,11 +25,11 @@ sbfree(sb)
 void
 sbdrop(sb, num)
        struct sbuf *sb;
-       int num; 
+       int num;
 {
-       /* 
+       /*
         * We can only drop how much we have
-        * This should never succeed 
+        * This should never succeed
         */
        if(num > sb->sb_cc)
                num = sb->sb_cc;
@@ -37,7 +37,7 @@ sbdrop(sb, num)
        sb->sb_rptr += num;
        if(sb->sb_rptr >= sb->sb_data + sb->sb_datalen)
                sb->sb_rptr -= sb->sb_datalen;
-   
+
 }
 
 void
@@ -77,18 +77,18 @@ sbappend(so, m)
        struct mbuf *m;
 {
        int ret = 0;
-       
+
        DEBUG_CALL("sbappend");
        DEBUG_ARG("so = %lx", (long)so);
        DEBUG_ARG("m = %lx", (long)m);
        DEBUG_ARG("m->m_len = %d", m->m_len);
-       
+
        /* Shouldn't happen, but...  e.g. foreign host closes connection */
        if (m->m_len <= 0) {
                m_free(m);
                return;
        }
-       
+
        /*
         * If there is urgent data, call sosendoob
         * if not all was sent, sowrite will take care of the rest
@@ -100,16 +100,16 @@ sbappend(so, m)
                sosendoob(so);
                return;
        }
-       
+
        /*
         * We only write if there's nothing in the buffer,
         * ottherwise it'll arrive out of order, and hence corrupt
         */
        if (!so->so_rcv.sb_cc)
           ret = send(so->s, m->m_data, m->m_len, 0);
-       
+
        if (ret <= 0) {
-               /* 
+               /*
                 * Nothing was written
                 * It's possible that the socket has closed, but
                 * we don't need to check because if it has closed,
@@ -139,7 +139,7 @@ sbappendsb(sb, m)
         struct mbuf *m;
 {
        int len, n,  nn;
-       
+
        len = m->m_len;
 
        if (sb->sb_wptr < sb->sb_rptr) {
@@ -180,7 +180,7 @@ sbcopy(sb, off, len, to)
        char *to;
 {
        char *from;
-       
+
        from = sb->sb_rptr + off;
        if (from >= sb->sb_data + sb->sb_datalen)
                from -= sb->sb_datalen;
@@ -198,4 +198,4 @@ sbcopy(sb, off, len, to)
                   memcpy(to+off,sb->sb_data,len);
        }
 }
-               
+
index 161e0bb76dcff9d92fd930420a61cb05c7e04625..89c4eb2f1c720cbf556a2340c75344a6421e8709 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
index 6ba753e73580facef67b4ffcb2a8b19f5cb180fd..f535db12b03000d9412fa70db5f5dd7dd3055970 100644 (file)
@@ -12,7 +12,7 @@ struct in_addr special_addr;
 /* virtual address alias for host */
 struct in_addr alias_addr;
 
-const uint8_t special_ethaddr[6] = { 
+const uint8_t special_ethaddr[6] = {
     0x52, 0x54, 0x00, 0x12, 0x35, 0x00
 };
 
@@ -38,10 +38,10 @@ static int get_dns_addr(struct in_addr *pdns_addr)
     DWORD    ret;
     IP_ADDR_STRING *pIPAddr;
     struct in_addr tmp_addr;
-    
+
     FixedInfo = (FIXED_INFO *)GlobalAlloc(GPTR, sizeof(FIXED_INFO));
     BufLen = sizeof(FIXED_INFO);
-   
+
     if (ERROR_BUFFER_OVERFLOW == GetNetworkParams(FixedInfo, &BufLen)) {
         if (FixedInfo) {
             GlobalFree(FixedInfo);
@@ -49,7 +49,7 @@ static int get_dns_addr(struct in_addr *pdns_addr)
         }
         FixedInfo = GlobalAlloc(GPTR, BufLen);
     }
-       
+
     if ((ret = GetNetworkParams(FixedInfo, &BufLen)) != ERROR_SUCCESS) {
         printf("GetNetworkParams failed. ret = %08x\n", (u_int)ret );
         if (FixedInfo) {
@@ -58,14 +58,14 @@ static int get_dns_addr(struct in_addr *pdns_addr)
         }
         return -1;
     }
-     
+
     pIPAddr = &(FixedInfo->DnsServerList);
     inet_aton(pIPAddr->IpAddress.String, &tmp_addr);
     *pdns_addr = tmp_addr;
 #if 0
     printf( "DNS Servers:\n" );
     printf( "DNS Addr:%s\n", pIPAddr->IpAddress.String );
-    
+
     pIPAddr = FixedInfo -> DnsServerList.Next;
     while ( pIPAddr ) {
             printf( "DNS Addr:%s\n", pIPAddr ->IpAddress.String );
@@ -88,7 +88,7 @@ static int get_dns_addr(struct in_addr *pdns_addr)
     FILE *f;
     int found = 0;
     struct in_addr tmp_addr;
-    
+
     f = fopen("/etc/resolv.conf", "r");
     if (!f)
         return -1;
@@ -130,7 +130,7 @@ void slirp_cleanup(void)
 void slirp_init(void)
 {
     //    debug_init("/tmp/slirp.log", DEBUG_DEFAULT);
-    
+
 #ifdef _WIN32
     {
         WSADATA Data;
@@ -180,16 +180,16 @@ static void updtime(void)
 static void updtime(void)
 {
        gettimeofday(&tt, 0);
-       
+
        curtime = (u_int)tt.tv_sec * (u_int)1000;
        curtime += (u_int)tt.tv_usec / (u_int)1000;
-       
+
        if ((tt.tv_usec % 1000) >= 500)
           curtime++;
 }
 #endif
 
-void slirp_select_fill(int *pnfds, 
+void slirp_select_fill(int *pnfds,
                        fd_set *readfds, fd_set *writefds, fd_set *xfds)
 {
     struct socket *so, *so_next;
@@ -201,36 +201,36 @@ void slirp_select_fill(int *pnfds,
     global_readfds = NULL;
     global_writefds = NULL;
     global_xfds = NULL;
-    
+
     nfds = *pnfds;
        /*
         * First, TCP sockets
         */
        do_slowtimo = 0;
        if (link_up) {
-               /* 
+               /*
                 * *_slowtimo needs calling if there are IP fragments
                 * in the fragment queue, or there are TCP connections active
                 */
                do_slowtimo = ((tcb.so_next != &tcb) ||
                               ((struct ipasfrag *)&ipq != (struct ipasfrag *)ipq.next));
-               
+
                for (so = tcb.so_next; so != &tcb; so = so_next) {
                        so_next = so->so_next;
-                       
+
                        /*
                         * See if we need a tcp_fasttimo
                         */
                        if (time_fasttimo == 0 && so->so_tcpcb->t_flags & TF_DELACK)
                           time_fasttimo = curtime; /* Flag when we want a fasttimo */
-                       
+
                        /*
                         * NOFDREF can include still connecting to local-host,
                         * newly socreated() sockets etc. Don't want to select these.
                         */
                        if (so->so_state & SS_NOFDREF || so->s == -1)
                           continue;
-                       
+
                        /*
                         * Set for reading sockets which are accepting
                         */
@@ -239,7 +239,7 @@ void slirp_select_fill(int *pnfds,
                                UPD_NFDS(so->s);
                                continue;
                        }
-                       
+
                        /*
                         * Set for writing sockets which are connecting
                         */
@@ -248,7 +248,7 @@ void slirp_select_fill(int *pnfds,
                                UPD_NFDS(so->s);
                                continue;
                        }
-                       
+
                        /*
                         * Set for writing if we are connected, can send more, and
                         * we have something to send
@@ -257,7 +257,7 @@ void slirp_select_fill(int *pnfds,
                                FD_SET(so->s, writefds);
                                UPD_NFDS(so->s);
                        }
-                       
+
                        /*
                         * Set for reading (and urgent data) if we are connected, can
                         * receive more, and we have room for it XXX /2 ?
@@ -268,13 +268,13 @@ void slirp_select_fill(int *pnfds,
                                UPD_NFDS(so->s);
                        }
                }
-               
+
                /*
                 * UDP sockets
                 */
                for (so = udb.so_next; so != &udb; so = so_next) {
                        so_next = so->so_next;
-                       
+
                        /*
                         * See if it's timed out
                         */
@@ -285,7 +285,7 @@ void slirp_select_fill(int *pnfds,
                                } else
                                        do_slowtimo = 1; /* Let socket expire */
                        }
-                       
+
                        /*
                         * When UDP packets are received from over the
                         * link, they're sendto()'d straight away, so
@@ -302,12 +302,12 @@ void slirp_select_fill(int *pnfds,
                        }
                }
        }
-       
+
        /*
         * Setup timeout to use minimum CPU usage, especially when idle
         */
-       
-       /* 
+
+       /*
         * First, see the timeout needed by *timo
         */
        timeout.tv_sec = 0;
@@ -324,20 +324,20 @@ void slirp_select_fill(int *pnfds,
                   timeout.tv_usec = 0;
                else if (timeout.tv_usec > 510000)
                   timeout.tv_usec = 510000;
-               
+
                /* Can only fasttimo if we also slowtimo */
                if (time_fasttimo) {
                        tmp_time = (200 - (curtime - time_fasttimo)) * 1000;
                        if (tmp_time < 0)
                           tmp_time = 0;
-                       
+
                        /* Choose the smallest of the 2 */
                        if (tmp_time < timeout.tv_usec)
                           timeout.tv_usec = (u_int)tmp_time;
                }
        }
         *pnfds = nfds;
-}      
+}
 
 void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
 {
@@ -350,9 +350,9 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
 
        /* Update time */
        updtime();
-       
+
        /*
-        * See if anything has timed out 
+        * See if anything has timed out
         */
        if (link_up) {
                if (time_fasttimo && ((curtime - time_fasttimo) >= 2)) {
@@ -365,7 +365,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
                        last_slowtimo = curtime;
                }
        }
-       
+
        /*
         * Check sockets
         */
@@ -375,14 +375,14 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
                 */
                for (so = tcb.so_next; so != &tcb; so = so_next) {
                        so_next = so->so_next;
-                       
+
                        /*
                         * FD_ISSET is meaningless on these sockets
                         * (and they can crash the program)
                         */
                        if (so->so_state & SS_NOFDREF || so->s == -1)
                           continue;
-                       
+
                        /*
                         * Check for URG data
                         * This will soread as well, so no need to
@@ -402,12 +402,12 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
                                        continue;
                                } /* else */
                                ret = soread(so);
-                               
+
                                /* Output it if we read something */
                                if (ret > 0)
                                   tcp_output(sototcpcb(so));
                        }
-                       
+
                        /*
                         * Check sockets for writing
                         */
@@ -418,19 +418,19 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
                          if (so->so_state & SS_ISFCONNECTING) {
                            /* Connected */
                            so->so_state &= ~SS_ISFCONNECTING;
-                           
+
                            ret = send(so->s, &ret, 0, 0);
                            if (ret < 0) {
                              /* XXXXX Must fix, zero bytes is a NOP */
                              if (errno == EAGAIN || errno == EWOULDBLOCK ||
                                  errno == EINPROGRESS || errno == ENOTCONN)
                                continue;
-                             
+
                              /* else failed */
                              so->so_state = SS_NOFDREF;
                            }
                            /* else so->so_state &= ~SS_ISFCONNECTING; */
-                           
+
                            /*
                             * Continue tcp_input
                             */
@@ -439,13 +439,13 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
                          } else
                            ret = sowrite(so);
                          /*
-                          * XXXXX If we wrote something (a lot), there 
+                          * XXXXX If we wrote something (a lot), there
                           * could be a need for a window update.
                           * In the worst case, the remote will send
                           * a window probe to get things going again
                           */
                        }
-                       
+
                        /*
                         * Probe a still-connecting, non-blocking socket
                         * to check if it's still alive
@@ -453,16 +453,16 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
 #ifdef PROBE_CONN
                        if (so->so_state & SS_ISFCONNECTING) {
                          ret = recv(so->s, (char *)&ret, 0,0);
-                         
+
                          if (ret < 0) {
                            /* XXX */
                            if (errno == EAGAIN || errno == EWOULDBLOCK ||
                                errno == EINPROGRESS || errno == ENOTCONN)
                              continue; /* Still connecting, continue */
-                           
+
                            /* else failed */
                            so->so_state = SS_NOFDREF;
-                           
+
                            /* tcp_input will take care of it */
                          } else {
                            ret = send(so->s, &ret, 0,0);
@@ -475,13 +475,13 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
                              so->so_state = SS_NOFDREF;
                            } else
                              so->so_state &= ~SS_ISFCONNECTING;
-                           
+
                          }
                          tcp_input((struct mbuf *)NULL, sizeof(struct ip),so);
                        } /* SS_ISFCONNECTING */
 #endif
                }
-               
+
                /*
                 * Now UDP sockets.
                 * Incoming packets are sent straight away, they're not buffered.
@@ -489,13 +489,13 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
                 */
                for (so = udb.so_next; so != &udb; so = so_next) {
                        so_next = so->so_next;
-                       
+
                        if (so->s != -1 && FD_ISSET(so->s, readfds)) {
                             sorecvfrom(so);
                         }
                }
        }
-       
+
        /*
         * See if we can start outputting
         */
@@ -521,7 +521,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
 #define        ARPOP_REQUEST   1               /* ARP request                  */
 #define        ARPOP_REPLY     2               /* ARP reply                    */
 
-struct ethhdr 
+struct ethhdr
 {
        unsigned char   h_dest[ETH_ALEN];       /* destination eth addr */
        unsigned char   h_source[ETH_ALEN];     /* source ether addr    */
@@ -559,7 +559,7 @@ void arp_input(const uint8_t *pkt, int pkt_len)
     switch(ar_op) {
     case ARPOP_REQUEST:
         if (!memcmp(ah->ar_tip, &special_addr, 3)) {
-            if (ah->ar_tip[3] == CTL_DNS || ah->ar_tip[3] == CTL_ALIAS) 
+            if (ah->ar_tip[3] == CTL_DNS || ah->ar_tip[3] == CTL_ALIAS)
                 goto arp_ok;
             for (ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
                 if (ex_ptr->ex_addr == ah->ar_tip[3])
@@ -600,7 +600,7 @@ void slirp_input(const uint8_t *pkt, int pkt_len)
 
     if (pkt_len < ETH_HLEN)
         return;
-    
+
     proto = ntohs(*(uint16_t *)(pkt + 12));
     switch(proto) {
     case ETH_P_ARP:
@@ -642,24 +642,24 @@ void if_encap(const uint8_t *ip_data, int ip_data_len)
     slirp_output(buf, ip_data_len + ETH_HLEN);
 }
 
-int slirp_redir(int is_udp, int host_port, 
+int slirp_redir(int is_udp, int host_port,
                 struct in_addr guest_addr, int guest_port)
 {
     if (is_udp) {
-        if (!udp_listen(htons(host_port), guest_addr.s_addr, 
+        if (!udp_listen(htons(host_port), guest_addr.s_addr,
                         htons(guest_port), 0))
             return -1;
     } else {
-        if (!solisten(htons(host_port), guest_addr.s_addr, 
+        if (!solisten(htons(host_port), guest_addr.s_addr,
                       htons(guest_port), 0))
             return -1;
     }
     return 0;
 }
 
-int slirp_add_exec(int do_pty, const char *args, int addr_low_byte, 
+int slirp_add_exec(int do_pty, const char *args, int addr_low_byte,
                   int guest_port)
 {
-    return add_exec(&exec_list, do_pty, (char *)args, 
+    return add_exec(&exec_list, do_pty, (char *)args,
                     addr_low_byte, htons(guest_port));
 }
index 0ae1f870113a0a70e330a4b1ed13bb65898ba788..7e07cf894281a87a1f46f6a3f650e0c28ad551e6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
@@ -29,19 +29,19 @@ solookup(head, laddr, lport, faddr, fport)
        u_int fport;
 {
        struct socket *so;
-       
+
        for (so = head->so_next; so != head; so = so->so_next) {
-               if (so->so_lport == lport && 
+               if (so->so_lport == lport &&
                    so->so_laddr.s_addr == laddr.s_addr &&
                    so->so_faddr.s_addr == faddr.s_addr &&
                    so->so_fport == fport)
                   break;
        }
-       
+
        if (so == head)
           return (struct socket *)NULL;
        return so;
-       
+
 }
 
 /*
@@ -53,7 +53,7 @@ struct socket *
 socreate()
 {
   struct socket *so;
-       
+
   so = (struct socket *)malloc(sizeof(struct socket));
   if(so) {
     memset(so, 0, sizeof(struct socket));
@@ -78,10 +78,10 @@ sofree(so)
     tcp_last_so = &tcb;
   else if (so == udp_last_so)
     udp_last_so = &udb;
-       
+
   m_free(so->so_m);
-       
-  if(so->so_next && so->so_prev) 
+
+  if(so->so_next && so->so_prev)
     remque(so);  /* crashes if so is not in a queue */
 
   free(so);
@@ -101,17 +101,17 @@ soread(so)
        int len = sb->sb_datalen - sb->sb_cc;
        struct iovec iov[2];
        int mss = so->so_tcpcb->t_maxseg;
-       
+
        DEBUG_CALL("soread");
        DEBUG_ARG("so = %lx", (long )so);
-       
-       /* 
+
+       /*
         * No need to check if there's enough room to read.
         * soread wouldn't have been called if there weren't
         */
-       
+
        len = sb->sb_datalen - sb->sb_cc;
-       
+
        iov[0].iov_base = sb->sb_wptr;
        if (sb->sb_wptr < sb->sb_rptr) {
                iov[0].iov_len = sb->sb_rptr - sb->sb_wptr;
@@ -150,13 +150,13 @@ soread(so)
                        n = 1;
                }
        }
-       
+
 #ifdef HAVE_READV
        nn = readv(so->s, (struct iovec *)iov, n);
        DEBUG_MISC((dfd, " ... read nn = %d bytes\n", nn));
 #else
        nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
-#endif 
+#endif
        if (nn <= 0) {
                if (nn < 0 && (errno == EINTR || errno == EAGAIN))
                        return 0;
@@ -167,7 +167,7 @@ soread(so)
                        return -1;
                }
        }
-       
+
 #ifndef HAVE_READV
        /*
         * If there was no error, try and read the second time round
@@ -184,10 +184,10 @@ soread(so)
             if (ret > 0)
                 nn += ret;
         }
-       
+
        DEBUG_MISC((dfd, " ... read nn = %d bytes\n", nn));
 #endif
-       
+
        /* Update fields */
        sb->sb_cc += nn;
        sb->sb_wptr += nn;
@@ -195,10 +195,10 @@ soread(so)
                sb->sb_wptr -= sb->sb_datalen;
        return nn;
 }
-       
+
 /*
  * Get urgent data
- * 
+ *
  * When the socket is created, we set it SO_OOBINLINE,
  * so when OOB data arrives, we soread() it and everything
  * in the send buffer is sent as urgent data
@@ -211,13 +211,13 @@ sorecvoob(so)
 
        DEBUG_CALL("sorecvoob");
        DEBUG_ARG("so = %lx", (long)so);
-       
+
        /*
         * We take a guess at how much urgent data has arrived.
         * In most situations, when urgent data arrives, the next
         * read() should get all the urgent data.  This guess will
         * be wrong however if more data arrives just after the
-        * urgent data, or the read() doesn't return all the 
+        * urgent data, or the read() doesn't return all the
         * urgent data.
         */
        soread(so);
@@ -237,24 +237,24 @@ sosendoob(so)
 {
        struct sbuf *sb = &so->so_rcv;
        char buff[2048]; /* XXX Shouldn't be sending more oob data than this */
-       
+
        int n, len;
-       
+
        DEBUG_CALL("sosendoob");
        DEBUG_ARG("so = %lx", (long)so);
        DEBUG_ARG("sb->sb_cc = %d", sb->sb_cc);
-       
+
        if (so->so_urgc > 2048)
           so->so_urgc = 2048; /* XXXX */
-       
+
        if (sb->sb_rptr < sb->sb_wptr) {
                /* We can send it directly */
                n = send(so->s, sb->sb_rptr, so->so_urgc, (MSG_OOB)); /* |MSG_DONTWAIT)); */
                so->so_urgc -= n;
-               
+
                DEBUG_MISC((dfd, " --- sent %d bytes urgent data, %d urgent bytes left\n", n, so->so_urgc));
        } else {
-               /* 
+               /*
                 * Since there's no sendv or sendtov like writev,
                 * we must copy all data to a linear buffer then
                 * send it all
@@ -274,20 +274,20 @@ sosendoob(so)
 #ifdef DEBUG
                if (n != len)
                   DEBUG_ERROR((dfd, "Didn't send all data urgently XXXXX\n"));
-#endif         
+#endif
                DEBUG_MISC((dfd, " ---2 sent %d bytes urgent data, %d urgent bytes left\n", n, so->so_urgc));
        }
-       
+
        sb->sb_cc -= n;
        sb->sb_rptr += n;
        if (sb->sb_rptr >= (sb->sb_data + sb->sb_datalen))
                sb->sb_rptr -= sb->sb_datalen;
-       
+
        return n;
 }
 
 /*
- * Write data from so_rcv to so's socket, 
+ * Write data from so_rcv to so's socket,
  * updating all sbuf field as necessary
  */
 int
@@ -298,10 +298,10 @@ sowrite(so)
        struct sbuf *sb = &so->so_rcv;
        int len = sb->sb_cc;
        struct iovec iov[2];
-       
+
        DEBUG_CALL("sowrite");
        DEBUG_ARG("so = %lx", (long)so);
-       
+
        if (so->so_urgc) {
                sosendoob(so);
                if (sb->sb_cc == 0)
@@ -312,9 +312,9 @@ sowrite(so)
         * No need to check if there's something to write,
         * sowrite wouldn't have been called otherwise
         */
-       
+
         len = sb->sb_cc;
-       
+
        iov[0].iov_base = sb->sb_rptr;
        if (sb->sb_rptr < sb->sb_wptr) {
                iov[0].iov_len = sb->sb_wptr - sb->sb_rptr;
@@ -337,7 +337,7 @@ sowrite(so)
 
 #ifdef HAVE_READV
        nn = writev(so->s, (const struct iovec *)iov, n);
-       
+
        DEBUG_MISC((dfd, "  ... wrote nn = %d bytes\n", nn));
 #else
        nn = send(so->s, iov[0].iov_base, iov[0].iov_len,0);
@@ -345,7 +345,7 @@ sowrite(so)
        /* This should never happen, but people tell me it does *shrug* */
        if (nn < 0 && (errno == EAGAIN || errno == EINTR))
                return 0;
-       
+
        if (nn <= 0) {
                DEBUG_MISC((dfd, " --- sowrite disconnected, so->so_state = %x, errno = %d\n",
                        so->so_state, errno));
@@ -353,7 +353,7 @@ sowrite(so)
                tcp_sockclosed(sototcpcb(so));
                return -1;
        }
-       
+
 #ifndef HAVE_READV
        if (n == 2 && nn == iov[0].iov_len) {
             int ret;
@@ -363,20 +363,20 @@ sowrite(so)
         }
         DEBUG_MISC((dfd, "  ... wrote nn = %d bytes\n", nn));
 #endif
-       
+
        /* Update sbuf */
        sb->sb_cc -= nn;
        sb->sb_rptr += nn;
        if (sb->sb_rptr >= (sb->sb_data + sb->sb_datalen))
                sb->sb_rptr -= sb->sb_datalen;
-       
+
        /*
         * If in DRAIN mode, and there's no more data, set
         * it CANTSENDMORE
         */
        if ((so->so_state & SS_FWDRAIN) && sb->sb_cc == 0)
                sofcantsendmore(so);
-       
+
        return nn;
 }
 
@@ -389,24 +389,24 @@ sorecvfrom(so)
 {
        struct sockaddr_in addr;
        int addrlen = sizeof(struct sockaddr_in);
-       
+
        DEBUG_CALL("sorecvfrom");
        DEBUG_ARG("so = %lx", (long)so);
-       
+
        if (so->so_type == IPPROTO_ICMP) {   /* This is a "ping" reply */
          char buff[256];
          int len;
-               
-         len = recvfrom(so->s, buff, 256, 0, 
+
+         len = recvfrom(so->s, buff, 256, 0,
                         (struct sockaddr *)&addr, &addrlen);
          /* XXX Check if reply is "correct"? */
-         
+
          if(len == -1 || len == 0) {
            u_char code=ICMP_UNREACH_PORT;
 
            if(errno == EHOSTUNREACH) code=ICMP_UNREACH_HOST;
            else if(errno == ENETUNREACH) code=ICMP_UNREACH_NET;
-           
+
            DEBUG_MISC((dfd," udp icmp rx errno = %d-%s\n",
                        errno,strerror(errno)));
            icmp_error(so->so_m, ICMP_UNREACH,code, 0,strerror(errno));
@@ -422,32 +422,32 @@ sorecvfrom(so)
 
          if (!(m = m_get())) return;
          m->m_data += if_maxlinkhdr;
-               
-         /* 
+
+         /*
           * XXX Shouldn't FIONREAD packets destined for port 53,
           * but I don't know the max packet size for DNS lookups
           */
          len = M_FREEROOM(m);
          /* if (so->so_fport != htons(53)) { */
          ioctlsocket(so->s, FIONREAD, &n);
-         
+
          if (n > len) {
            n = (m->m_data - m->m_dat) + m->m_len + n + 1;
            m_inc(m, n);
            len = M_FREEROOM(m);
          }
          /* } */
-               
+
          m->m_len = recvfrom(so->s, m->m_data, len, 0,
                              (struct sockaddr *)&addr, &addrlen);
-         DEBUG_MISC((dfd, " did recvfrom %d, errno = %d-%s\n", 
+         DEBUG_MISC((dfd, " did recvfrom %d, errno = %d-%s\n",
                      m->m_len, errno,strerror(errno)));
          if(m->m_len<0) {
            u_char code=ICMP_UNREACH_PORT;
 
            if(errno == EHOSTUNREACH) code=ICMP_UNREACH_HOST;
            else if(errno == ENETUNREACH) code=ICMP_UNREACH_NET;
-           
+
            DEBUG_MISC((dfd," rx error, tx icmp ICMP_UNREACH:%i\n", code));
            icmp_error(so->so_m, ICMP_UNREACH,code, 0,strerror(errno));
            m_free(m);
@@ -470,8 +470,8 @@ sorecvfrom(so)
             *                  m->m_len = 0;
             *          }
             */
-           
-           /* 
+
+           /*
             * If this packet was destined for CTL_ADDR,
             * make it look like that's where it came from, done by udp_output
             */
@@ -494,7 +494,7 @@ sosendto(so, m)
        DEBUG_CALL("sosendto");
        DEBUG_ARG("so = %lx", (long)so);
        DEBUG_ARG("m = %lx", (long)m);
-       
+
         addr.sin_family = AF_INET;
        if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) {
          /* It's an alias */
@@ -512,13 +512,13 @@ sosendto(so, m)
        addr.sin_port = so->so_fport;
 
        DEBUG_MISC((dfd, " sendto()ing, addr.sin_port=%d, addr.sin_addr.s_addr=%.16s\n", ntohs(addr.sin_port), inet_ntoa(addr.sin_addr)));
-       
+
        /* Don't care what port we get */
        ret = sendto(so->s, m->m_data, m->m_len, 0,
                     (struct sockaddr *)&addr, sizeof (struct sockaddr));
        if (ret < 0)
                return -1;
-       
+
        /*
         * Kill the socket if there's no reply in 4 minutes,
         * but only if it's an expirable socket
@@ -548,39 +548,39 @@ solisten(port, laddr, lport, flags)
        DEBUG_ARG("laddr = %x", laddr);
        DEBUG_ARG("lport = %d", lport);
        DEBUG_ARG("flags = %x", flags);
-       
+
        if ((so = socreate()) == NULL) {
          /* free(so);      Not sofree() ??? free(NULL) == NOP */
          return NULL;
        }
-       
+
        /* Don't tcp_attach... we don't need so_snd nor so_rcv */
        if ((so->so_tcpcb = tcp_newtcpcb(so)) == NULL) {
                free(so);
                return NULL;
        }
        insque(so,&tcb);
-       
-       /* 
+
+       /*
         * SS_FACCEPTONCE sockets must time out.
         */
        if (flags & SS_FACCEPTONCE)
           so->so_tcpcb->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT*2;
-       
+
        so->so_state = (SS_FACCEPTCONN|flags);
        so->so_lport = lport; /* Kept in network format */
        so->so_laddr.s_addr = laddr; /* Ditto */
-       
+
        addr.sin_family = AF_INET;
        addr.sin_addr.s_addr = INADDR_ANY;
        addr.sin_port = port;
-       
+
        if (((s = socket(AF_INET,SOCK_STREAM,0)) < 0) ||
            (setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) ||
            (bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
            (listen(s,1) < 0)) {
                int tmperrno = errno; /* Don't clobber the real reason we failed */
-               
+
                close(s);
                sofree(so);
                /* Restore the real errno */
@@ -592,7 +592,7 @@ solisten(port, laddr, lport, flags)
                return NULL;
        }
        setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));
-       
+
        getsockname(s,(struct sockaddr *)&addr,&addrlen);
        so->so_fport = addr.sin_port;
        if (addr.sin_addr.s_addr == 0 || addr.sin_addr.s_addr == loopback_addr.s_addr)
@@ -604,7 +604,7 @@ solisten(port, laddr, lport, flags)
        return so;
 }
 
-/* 
+/*
  * Data is available in so_rcv
  * Just write() the data to the socket
  * XXX not yet...
@@ -616,7 +616,7 @@ sorwakeup(so)
 /*     sowrite(so); */
 /*     FD_CLR(so->s,&writefds); */
 }
-       
+
 /*
  * Data has been freed in so_snd
  * We have room for a read() if we want to
index d05354c8c14abaf5b18117f9f3f32a16defdf144..99cc17f32b9b945eca2443048c7d86922062724e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
@@ -33,21 +33,21 @@ struct socket {
   struct in_addr so_laddr;        /* local host table entry */
   u_int16_t so_fport;             /* foreign port */
   u_int16_t so_lport;             /* local port */
-  
+
   u_int8_t     so_iptos;       /* Type of service */
   u_int8_t     so_emu;         /* Is the socket emulated? */
-  
+
   u_char       so_type;                /* Type of socket, UDP or TCP */
   int  so_state;               /* internal state flags SS_*, below */
-  
+
   struct       tcpcb *so_tcpcb;        /* pointer to TCP protocol control block */
   u_int        so_expire;              /* When the socket will expire */
-  
+
   int  so_queued;              /* Number of packets queued from this socket */
   int  so_nqueued;             /* Number of packets queued in a row
                                 * Used to determine when to "downgrade" a session
                                         * from fastq to batchq */
-       
+
   struct sbuf so_rcv;          /* Receive buffer */
   struct sbuf so_snd;          /* Send buffer */
   void * extra;                        /* Extra pointer */
index c01516101a75db42e4eb14a90433ce45243c5cc8..04f6553127ba5e1a9f20b271d4a13f6f890d811a 100644 (file)
@@ -37,8 +37,8 @@
 /*
  * Changes and additions relating to SLiRP
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
@@ -122,7 +122,7 @@ tcp_reass(tp, ti, m)
        register struct tcpiphdr *q;
        struct socket *so = tp->t_socket;
        int flags;
-       
+
        /*
         * Call with ti==0 after become established to
         * force pre-ESTABLISHED data up to user socket.
@@ -254,15 +254,15 @@ tcp_input(m, iphlen, inso)
 /*     int ts_present = 0; */
 
        DEBUG_CALL("tcp_input");
-       DEBUG_ARGS((dfd," m = %8lx  iphlen = %2d  inso = %lx\n", 
+       DEBUG_ARGS((dfd," m = %8lx  iphlen = %2d  inso = %lx\n",
                    (long )m, iphlen, (long )inso ));
-       
+
        /*
         * If called with m == 0, then we're continuing the connect
         */
        if (m == NULL) {
                so = inso;
-               
+
                /* Re-set a few variables */
                tp = sototcpcb(so);
                m = so->so_m;
@@ -270,11 +270,11 @@ tcp_input(m, iphlen, inso)
                ti = so->so_ti;
                tiwin = ti->ti_win;
                tiflags = ti->ti_flags;
-               
+
                goto cont_conn;
        }
-       
-       
+
+
        tcpstat.tcps_rcvtotal++;
        /*
         * Get IP and TCP header together in first mbuf.
@@ -286,14 +286,14 @@ tcp_input(m, iphlen, inso)
          iphlen=sizeof(struct ip );
        }
        /* XXX Check if too short */
-       
+
 
        /*
         * Save a copy of the IP header in case we want restore it
         * for sending an ICMP error message in response.
         */
        ip=mtod(m, struct ip *);
-       save_ip = *ip; 
+       save_ip = *ip;
        save_ip.ip_len+= iphlen;
 
        /*
@@ -305,7 +305,7 @@ tcp_input(m, iphlen, inso)
        ti->ti_len = htons((u_int16_t)tlen);
        len = sizeof(struct ip ) + tlen;
        /* keep checksum for ICMP reply
-        * ti->ti_sum = cksum(m, len); 
+        * ti->ti_sum = cksum(m, len);
         * if (ti->ti_sum) { */
        if(cksum(m, len)) {
          tcpstat.tcps_rcvbadsum++;
@@ -327,7 +327,7 @@ tcp_input(m, iphlen, inso)
          optlen = off - sizeof (struct tcphdr);
          optp = mtod(m, caddr_t) + sizeof (struct tcpiphdr);
 
-               /* 
+               /*
                 * Do quick retrieval of timestamp options ("options
                 * prediction?").  If timestamp is the only option and it's
                 * formatted as recommended in RFC 1323 appendix A, we
@@ -347,7 +347,7 @@ tcp_input(m, iphlen, inso)
  */
        }
        tiflags = ti->ti_flags;
-       
+
        /*
         * Convert TCP protocol specific fields to host format.
         */
@@ -361,7 +361,7 @@ tcp_input(m, iphlen, inso)
         */
        m->m_data += sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr);
        m->m_len  -= sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr);
-       
+
        /*
         * Locate pcb for segment.
         */
@@ -385,8 +385,8 @@ findso:
         * but should either do a listen or a connect soon.
         *
         * state == CLOSED means we've done socreate() but haven't
-        * attached it to a protocol yet... 
-        * 
+        * attached it to a protocol yet...
+        *
         * XXX If a TCB does not exist, and the TH_SYN flag is
         * the only flag set, then create a session, mark it
         * as if it was LISTENING, and continue...
@@ -394,32 +394,32 @@ findso:
        if (so == 0) {
          if ((tiflags & (TH_SYN|TH_FIN|TH_RST|TH_URG|TH_ACK)) != TH_SYN)
            goto dropwithreset;
-               
+
          if ((so = socreate()) == NULL)
            goto dropwithreset;
          if (tcp_attach(so) < 0) {
            free(so); /* Not sofree (if it failed, it's not insqued) */
            goto dropwithreset;
          }
-               
+
          sbreserve(&so->so_snd, tcp_sndspace);
          sbreserve(&so->so_rcv, tcp_rcvspace);
-         
+
          /*            tcp_last_so = so; */  /* XXX ? */
          /*            tp = sototcpcb(so);    */
-               
+
          so->so_laddr = ti->ti_src;
          so->so_lport = ti->ti_sport;
          so->so_faddr = ti->ti_dst;
          so->so_fport = ti->ti_dport;
-               
+
          if ((so->so_iptos = tcp_tos(so)) == 0)
            so->so_iptos = ((struct ip *)ti)->ip_tos;
-               
+
          tp = sototcpcb(so);
          tp->t_state = TCPS_LISTEN;
        }
-           
+
         /*
          * If this is a still-connecting socket, this probably
          * a retransmit of the SYN.  Whether it's a retransmit SYN
@@ -429,13 +429,13 @@ findso:
                 goto drop;
 
        tp = sototcpcb(so);
-       
+
        /* XXX Should never fail */
        if (tp == 0)
                goto dropwithreset;
        if (tp->t_state == TCPS_CLOSED)
                goto drop;
-       
+
        /* Unscale the window into a 32-bit value. */
 /*     if ((tiflags & TH_SYN) == 0)
  *             tiwin = ti->ti_win << tp->snd_scale;
@@ -458,11 +458,11 @@ findso:
         * else do it below (after getting remote address).
         */
        if (optp && tp->t_state != TCPS_LISTEN)
-               tcp_dooptions(tp, (u_char *)optp, optlen, ti); 
+               tcp_dooptions(tp, (u_char *)optp, optlen, ti);
 /* , */
 /*                     &ts_present, &ts_val, &ts_ecr); */
 
-       /* 
+       /*
         * Header prediction: check for the two common cases
         * of a uni-directional data xfer.  If the packet has
         * no control flags, is in-sequence, the window didn't
@@ -486,7 +486,7 @@ findso:
            ti->ti_seq == tp->rcv_nxt &&
            tiwin && tiwin == tp->snd_wnd &&
            tp->snd_nxt == tp->snd_max) {
-               /* 
+               /*
                 * If last ACK falls within this segment's sequence numbers,
                 *  record the timestamp.
                 */
@@ -506,7 +506,7 @@ findso:
                                ++tcpstat.tcps_predack;
 /*                             if (ts_present)
  *                                     tcp_xmit_timer(tp, tcp_now-ts_ecr+1);
- *                             else 
+ *                             else
  */                                 if (tp->t_rtt &&
                                            SEQ_GT(ti->ti_ack, tp->t_rtseq))
                                        tcp_xmit_timer(tp, tp->t_rtt);
@@ -531,14 +531,14 @@ findso:
                                else if (tp->t_timer[TCPT_PERSIST] == 0)
                                        tp->t_timer[TCPT_REXMT] = tp->t_rxtcur;
 
-                               /* 
+                               /*
                                 * There's room in so_snd, sowwakup will read()
                                 * from the socket if we can
                                 */
 /*                             if (so->so_snd.sb_flags & SB_NOTIFY)
  *                                     sowwakeup(so);
  */
-                               /* 
+                               /*
                                 * This is called because sowwakeup might have
                                 * put data into so_snd.  Since we don't so sowwakeup,
                                 * we don't need this.. XXX???
@@ -567,22 +567,22 @@ findso:
                                if (tcp_emu(so,m)) sbappend(so, m);
                        } else
                                sbappend(so, m);
-                       
-                       /* 
+
+                       /*
                         * XXX This is called when data arrives.  Later, check
                         * if we can actually write() to the socket
                         * XXX Need to check? It's be NON_BLOCKING
                         */
 /*                     sorwakeup(so); */
-                       
+
                        /*
                         * If this is a short packet, then ACK now - with Nagel
                         *      congestion avoidance sender won't send more until
                         *      he gets an ACK.
-                        * 
+                        *
                         * It is better to not delay acks at all to maximize
                         * TCP throughput.  See RFC 2581.
-                        */ 
+                        */
                        tp->t_flags |= TF_ACKNOW;
                        tcp_output(tp);
                        return;
@@ -624,12 +624,12 @@ findso:
            goto dropwithreset;
          if ((tiflags & TH_SYN) == 0)
            goto drop;
-               
+
          /*
           * This has way too many gotos...
           * But a bit of spaghetti code never hurt anybody :)
           */
-         
+
          /*
           * If this is destined for the control address, then flag to
           * tcp_ctl once connected, otherwise connect
@@ -641,13 +641,13 @@ findso:
              if(lastbyte==CTL_CMD || lastbyte==CTL_EXEC) {
                /* Command or exec adress */
                so->so_state |= SS_CTL;
-             } else 
+             } else
 #endif
               {
                /* May be an add exec */
                struct ex_list *ex_ptr;
                for(ex_ptr = exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
-                 if(ex_ptr->ex_fport == so->so_fport && 
+                 if(ex_ptr->ex_fport == so->so_fport &&
                     lastbyte == ex_ptr->ex_addr) {
                    so->so_state |= SS_CTL;
                    break;
@@ -658,12 +658,12 @@ findso:
            }
            /* CTL_ALIAS: Do nothing, tcp_fconnect will be called on it */
          }
-         
+
          if (so->so_emu & EMU_NOCONNECT) {
            so->so_emu &= ~EMU_NOCONNECT;
            goto cont_input;
          }
-         
+
          if((tcp_fconnect(so) == -1) && (errno != EINPROGRESS) && (errno != EWOULDBLOCK)) {
            u_char code=ICMP_UNREACH_NET;
            DEBUG_MISC((dfd," tcp fconnect errno = %d-%s\n",
@@ -671,7 +671,7 @@ findso:
            if(errno == ECONNREFUSED) {
              /* ACK the SYN, send RST to refuse the connection */
              tcp_respond(tp, ti, m, ti->ti_seq+1, (tcp_seq)0,
-                         TH_RST|TH_ACK); 
+                         TH_RST|TH_ACK);
            } else {
              if(errno == EHOSTUNREACH) code=ICMP_UNREACH_HOST;
              HTONL(ti->ti_seq);             /* restore tcp header */
@@ -699,25 +699,25 @@ findso:
          }
          return;
 
-       cont_conn:     
-         /* m==NULL 
+       cont_conn:
+         /* m==NULL
           * Check if the connect succeeded
           */
          if (so->so_state & SS_NOFDREF) {
            tp = tcp_close(tp);
            goto dropwithreset;
          }
-       cont_input:             
+       cont_input:
          tcp_template(tp);
-         
+
          if (optp)
            tcp_dooptions(tp, (u_char *)optp, optlen, ti);
          /* , */
          /*                            &ts_present, &ts_val, &ts_ecr); */
-         
+
          if (iss)
            tp->iss = iss;
-         else 
+         else
            tp->iss = tcp_iss;
          tcp_iss += TCP_ISSINCR/2;
          tp->irs = ti->ti_seq;
@@ -729,7 +729,7 @@ findso:
          tcpstat.tcps_accepts++;
          goto trimthenstep6;
        } /* case TCPS_LISTEN */
-       
+
        /*
         * If the state is SYN_SENT:
         *      if seg contains an ACK, but not for our SYN, drop the input.
@@ -770,7 +770,7 @@ findso:
                        tcpstat.tcps_connects++;
                        soisfconnected(so);
                        tp->t_state = TCPS_ESTABLISHED;
-                       
+
                        /* Do window scaling on this connection? */
 /*                     if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
  *                             (TF_RCVD_SCALE|TF_REQ_SCALE)) {
@@ -811,10 +811,10 @@ trimthenstep6:
        /*
         * States other than LISTEN or SYN_SENT.
         * First check timestamp, if present.
-        * Then check that at least some bytes of segment are within 
+        * Then check that at least some bytes of segment are within
         * receive window.  If segment begins before rcv_nxt,
         * drop leading data (and SYN); if nothing left, just ack.
-        * 
+        *
         * RFC 1323 PAWS: If we have a timestamp reply on this segment
         * and it's less than ts_recent, drop it.
         */
@@ -849,7 +849,7 @@ trimthenstep6:
                if (tiflags & TH_SYN) {
                        tiflags &= ~TH_SYN;
                        ti->ti_seq++;
-                       if (ti->ti_urp > 1) 
+                       if (ti->ti_urp > 1)
                                ti->ti_urp--;
                        else
                                tiflags &= ~TH_URG;
@@ -866,7 +866,7 @@ trimthenstep6:
                         * of sequence; drop it.
                         */
                        tiflags &= ~TH_FIN;
-                       
+
                        /*
                         * Send an ACK to resynchronize and drop any data.
                         * But keep on processing for RST or ACK.
@@ -1017,12 +1017,12 @@ trimthenstep6:
                        goto dropwithreset;
                tcpstat.tcps_connects++;
                tp->t_state = TCPS_ESTABLISHED;
-               /* 
-                * The sent SYN is ack'ed with our sequence number +1 
-                * The first data byte already in the buffer will get 
+               /*
+                * The sent SYN is ack'ed with our sequence number +1
+                * The first data byte already in the buffer will get
                 * lost if no correction is made.  This is only needed for
                 * SS_CTL since the buffer is empty otherwise.
-                * tp->snd_una++; or:     
+                * tp->snd_una++; or:
                 */
                tp->snd_una=ti->ti_ack;
                if (so->so_state & SS_CTL) {
@@ -1040,7 +1040,7 @@ trimthenstep6:
                } else {
                  soisfconnected(so);
                }
-               
+
                /* Do window scaling? */
 /*             if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
  *                     (TF_RCVD_SCALE|TF_REQ_SCALE)) {
@@ -1094,7 +1094,7 @@ trimthenstep6:
                                 * the new ssthresh).
                                 *
                                 * Dup acks mean that packets have left the
-                                * network (they're now cached at the receiver) 
+                                * network (they're now cached at the receiver)
                                 * so bump cwnd by the amount in the receiver
                                 * to keep a constant cwnd packets in the
                                 * network.
@@ -1159,7 +1159,7 @@ trimthenstep6:
 /*             if (ts_present)
  *                     tcp_xmit_timer(tp, tcp_now-ts_ecr+1);
  *             else
- */                 
+ */
                     if (tp->t_rtt && SEQ_GT(ti->ti_ack, tp->t_rtseq))
                        tcp_xmit_timer(tp,tp->t_rtt);
 
@@ -1200,7 +1200,7 @@ trimthenstep6:
                }
                /*
                 * XXX sowwakup is called when data is acked and there's room for
-                * for more data... it should read() the socket 
+                * for more data... it should read() the socket
                 */
 /*             if (so->so_snd.sb_flags & SB_NOTIFY)
  *                     sowwakeup(so);
@@ -1278,7 +1278,7 @@ step6:
         * Don't look at window if no ACK: TAC's send garbage on first SYN.
         */
        if ((tiflags & TH_ACK) &&
-           (SEQ_LT(tp->snd_wl1, ti->ti_seq) || 
+           (SEQ_LT(tp->snd_wl1, ti->ti_seq) ||
            (tp->snd_wl1 == ti->ti_seq && (SEQ_LT(tp->snd_wl2, ti->ti_ack) ||
            (tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd))))) {
                /* keep track of pure window updates */
@@ -1313,14 +1313,14 @@ step6:
                 * If this segment advances the known urgent pointer,
                 * then mark the data stream.  This should not happen
                 * in CLOSE_WAIT, CLOSING, LAST_ACK or TIME_WAIT STATES since
-                * a FIN has been received from the remote side. 
+                * a FIN has been received from the remote side.
                 * In these states we ignore the URG.
                 *
                 * According to RFC961 (Assigned Protocols),
                 * the urgent pointer points to the last octet
                 * of urgent data.  We continue, however,
                 * to consider it to indicate the first octet
-                * of data past the urgent section as the original 
+                * of data past the urgent section as the original
                 * spec states (in one of two places).
                 */
                if (SEQ_GT(ti->ti_seq+ti->ti_urp, tp->rcv_up)) {
@@ -1328,7 +1328,7 @@ step6:
                        so->so_urgc =  so->so_rcv.sb_cc +
                                (tp->rcv_up - tp->rcv_nxt); /* -1; */
                        tp->rcv_up = ti->ti_seq + ti->ti_urp;
-        
+
                }
        } else
                /*
@@ -1379,7 +1379,7 @@ dodata:
                         */
 /*                     sofcantrcvmore(so); */
                        sofwdrain(so);
-                       
+
                        tp->t_flags |= TF_ACKNOW;
                        tp->rcv_nxt++;
                }
@@ -1393,7 +1393,7 @@ dodata:
                case TCPS_ESTABLISHED:
                  if(so->so_emu == EMU_CTL)        /* no shutdown on socket */
                    tp->t_state = TCPS_LAST_ACK;
-                 else 
+                 else
                    tp->t_state = TCPS_CLOSE_WAIT;
                  break;
 
@@ -1407,7 +1407,7 @@ dodata:
 
                /*
                 * In FIN_WAIT_2 state enter the TIME_WAIT state,
-                * starting the time-wait timer, turning off the other 
+                * starting the time-wait timer, turning off the other
                 * standard timers.
                 */
                case TCPS_FIN_WAIT_2:
@@ -1430,7 +1430,7 @@ dodata:
         * If this is a small packet, then ACK now - with Nagel
         *      congestion avoidance sender won't send more until
         *      he gets an ACK.
-        * 
+        *
         * See above.
         */
 /*     if (ti->ti_len && (unsigned)ti->ti_len < tp->t_maxseg) {
@@ -1547,7 +1547,7 @@ tcp_dooptions(tp, cp, cnt, ti)
  *                     memcpy((char *) ts_ecr, (char *)cp + 6, sizeof(*ts_ecr));
  *                     NTOHL(*ts_ecr);
  *
- */                    /* 
+ */                    /*
  *                      * A timestamp received in a SYN makes
  *                      * it ok to send timestamp requests and replies.
  *                      */
@@ -1578,7 +1578,7 @@ tcp_pulloutofband(so, ti, m)
        register struct mbuf *m;
 {
        int cnt = ti->ti_urp - 1;
-       
+
        while (cnt >= 0) {
                if (m->m_len > cnt) {
                        char *cp = mtod(m, caddr_t) + cnt;
@@ -1615,7 +1615,7 @@ tcp_xmit_timer(tp, rtt)
        DEBUG_CALL("tcp_xmit_timer");
        DEBUG_ARG("tp = %lx", (long)tp);
        DEBUG_ARG("rtt = %d", rtt);
-       
+
        tcpstat.tcps_rttupdated++;
        if (tp->t_srtt != 0) {
                /*
@@ -1644,7 +1644,7 @@ tcp_xmit_timer(tp, rtt)
                if ((tp->t_rttvar += delta) <= 0)
                        tp->t_rttvar = 1;
        } else {
-               /* 
+               /*
                 * No rtt measurement yet - use the unsmoothed rtt.
                 * Set the variance to half the rtt (so our first
                 * retransmit happens at 3*rtt).
@@ -1668,7 +1668,7 @@ tcp_xmit_timer(tp, rtt)
         */
        TCPT_RANGESET(tp->t_rxtcur, TCP_REXMTVAL(tp),
            (short)tp->t_rttmin, TCPTV_REXMTMAX); /* XXX */
-       
+
        /*
         * We received an ack for a packet that wasn't retransmitted;
         * it is probably safe to discard any error indications we've
@@ -1702,24 +1702,24 @@ tcp_mss(tp, offer)
 {
        struct socket *so = tp->t_socket;
        int mss;
-       
+
        DEBUG_CALL("tcp_mss");
        DEBUG_ARG("tp = %lx", (long)tp);
        DEBUG_ARG("offer = %d", offer);
-       
+
        mss = min(if_mtu, if_mru) - sizeof(struct tcpiphdr);
        if (offer)
                mss = min(mss, offer);
        mss = max(mss, 32);
        if (mss < tp->t_maxseg || offer != 0)
           tp->t_maxseg = mss;
-       
+
        tp->snd_cwnd = mss;
-       
+
        sbreserve(&so->so_snd, tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0));
        sbreserve(&so->so_rcv, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0));
-       
+
        DEBUG_MISC((dfd, " returning mss = %d\n", mss));
-       
+
        return mss;
 }
index b79bcf1279aadb86ab65322048cb64a82bb36135..3eddfd38e2b12c017001a3c0c66c77ae40012e4b 100644 (file)
@@ -37,8 +37,8 @@
 /*
  * Changes and additions relating to SLiRP
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
@@ -57,7 +57,7 @@ char *tcpstates[] = {
 
 u_char  tcp_outflags[TCP_NSTATES] = {
        TH_RST|TH_ACK, 0,      TH_SYN,        TH_SYN|TH_ACK,
-       TH_ACK,        TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, 
+       TH_ACK,        TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK,
        TH_FIN|TH_ACK, TH_ACK, TH_ACK,
 };
 
@@ -79,10 +79,10 @@ tcp_output(tp)
        u_char opt[MAX_TCPOPTLEN];
        unsigned optlen, hdrlen;
        int idle, sendalot;
-       
+
        DEBUG_CALL("tcp_output");
        DEBUG_ARG("tp = %lx", (long )tp);
-       
+
        /*
         * Determine length of data that should be transmitted,
         * and flags that will be used.
@@ -103,9 +103,9 @@ again:
        win = min(tp->snd_wnd, tp->snd_cwnd);
 
        flags = tcp_outflags[tp->t_state];
-       
+
        DEBUG_MISC((dfd, " --- tcp_output flags = 0x%x\n",flags));
-       
+
        /*
         * If in persist timeout with window of 0, send 1 byte.
         * Otherwise, if window is small but nonzero
@@ -158,7 +158,7 @@ again:
                        tp->snd_nxt = tp->snd_una;
                }
        }
-       
+
        if (len > tp->t_maxseg) {
                len = tp->t_maxseg;
                sendalot = 1;
@@ -200,7 +200,7 @@ again:
         * window, then want to send a window update to peer.
         */
        if (win > 0) {
-               /* 
+               /*
                 * "adv" is the amount we can increase the window,
                 * taking into account that we are limited by
                 * TCP_MAXWIN << tp->rcv_scale.
@@ -264,7 +264,7 @@ again:
         * No reason to send a segment, just return.
         */
        tcpstat.tcps_didnuttin++;
-       
+
        return (0);
 
 send:
@@ -302,9 +302,9 @@ send:
  */
                }
        }
+
        /*
-        * Send a timestamp and echo-reply if this is a SYN and our side 
+        * Send a timestamp and echo-reply if this is a SYN and our side
         * wants to use timestamps (TF_REQ_TSTMP is set) or both our side
         * and our peer have sent timestamps in our SYN's.
         */
@@ -322,7 +322,7 @@ send:
  *     }
  */
        hdrlen += optlen;
+
        /*
         * Adjust data length if insertion of options will
         * bump the packet length beyond the t_maxseg length.
@@ -356,8 +356,8 @@ send:
                }
                m->m_data += if_maxlinkhdr;
                m->m_len = hdrlen;
-               
-               /* 
+
+               /*
                 * This will always succeed, since we make sure our mbufs
                 * are big enough to hold one MSS packet + header + ... etc.
                 */
@@ -401,7 +401,7 @@ send:
        }
 
        ti = mtod(m, struct tcpiphdr *);
-       
+
        memcpy((caddr_t)ti, &tp->t_template, sizeof (struct tcpiphdr));
 
        /*
@@ -409,7 +409,7 @@ send:
         * window for use in delaying messages about window sizes.
         * If resending a FIN, be sure not to use a new sequence number.
         */
-       if (flags & TH_FIN && tp->t_flags & TF_SENTFIN && 
+       if (flags & TH_FIN && tp->t_flags & TF_SENTFIN &&
            tp->snd_nxt == tp->snd_max)
                tp->snd_nxt--;
        /*
@@ -446,10 +446,10 @@ send:
        if (win < (long)(tp->rcv_adv - tp->rcv_nxt))
                win = (long)(tp->rcv_adv - tp->rcv_nxt);
        ti->ti_win = htons((u_int16_t) (win>>tp->rcv_scale));
-       
+
        if (SEQ_GT(tp->snd_up, tp->snd_una)) {
                ti->ti_urp = htons((u_int16_t)(tp->snd_up - ntohl(ti->ti_seq)));
-#ifdef notdef          
+#ifdef notdef
        if (SEQ_GT(tp->snd_up, tp->snd_nxt)) {
                ti->ti_urp = htons((u_int16_t)(tp->snd_up - tp->snd_nxt));
 #endif
@@ -531,14 +531,14 @@ send:
         * the template, but need a way to checksum without them.
         */
        m->m_len = hdrlen + len; /* XXX Needed? m_len should be correct */
-       
+
     {
-           
+
        ((struct ip *)ti)->ip_len = m->m_len;
 
        ((struct ip *)ti)->ip_ttl = ip_defttl;
        ((struct ip *)ti)->ip_tos = so->so_iptos;
-           
+
 /* #if BSD >= 43 */
        /* Don't do IP options... */
 /*     error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route,
@@ -547,7 +547,7 @@ send:
        error = ip_output(so, m);
 
 /* #else
- *     error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route, 
+ *     error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route,
  *         so->so_options & SO_DONTROUTE);
  * #endif
  */
index 2526bffc602f1e74c128a665b87d09e4fe476c52..3814ec19b227bbe8fe9a5bd26b229c2d2d689d50 100644 (file)
@@ -37,8 +37,8 @@
 /*
  * Changes and additions relating to SLiRP
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
@@ -60,11 +60,11 @@ tcp_init()
 {
        tcp_iss = 1;            /* wrong */
        tcb.so_next = tcb.so_prev = &tcb;
-       
+
        /* tcp_rcvspace = our Window we advertise to the remote */
        tcp_rcvspace = TCP_RCVSPACE;
        tcp_sndspace = TCP_SNDSPACE;
-       
+
        /* Make sure tcp_sndspace is at least 2*MSS */
        if (tcp_sndspace < 2*(min(if_mtu, if_mru) - sizeof(struct tcpiphdr)))
                tcp_sndspace = 2*(min(if_mtu, if_mru) - sizeof(struct tcpiphdr));
@@ -92,7 +92,7 @@ tcp_template(tp)
        n->ti_dst = so->so_laddr;
        n->ti_sport = so->so_fport;
        n->ti_dport = so->so_lport;
-       
+
        n->ti_seq = 0;
        n->ti_ack = 0;
        n->ti_x2 = 0;
@@ -134,7 +134,7 @@ tcp_respond(tp, ti, m, ack, seq, flags)
        DEBUG_ARG("ack = %u", ack);
        DEBUG_ARG("seq = %u", seq);
        DEBUG_ARG("flags = %x", flags);
-       
+
        if (tp)
                win = sbspace(&tp->t_socket->so_rcv);
        if (m == 0) {
@@ -150,12 +150,12 @@ tcp_respond(tp, ti, m, ack, seq, flags)
                ti = mtod(m, struct tcpiphdr *);
                flags = TH_ACK;
        } else {
-               /* 
+               /*
                 * ti points into m so the next line is just making
                 * the mbuf point to ti
                 */
                m->m_data = (caddr_t)ti;
-               
+
                m->m_len = sizeof (struct tcpiphdr);
                tlen = 0;
 #define xchg(a,b,type) { type t; t=a; a=b; b=t; }
@@ -183,11 +183,11 @@ tcp_respond(tp, ti, m, ack, seq, flags)
        ti->ti_sum = cksum(m, tlen);
        ((struct ip *)ti)->ip_len = tlen;
 
-       if(flags & TH_RST) 
+       if(flags & TH_RST)
          ((struct ip *)ti)->ip_ttl = MAXTTL;
-       else 
+       else
          ((struct ip *)ti)->ip_ttl = ip_defttl;
-       
+
        (void) ip_output((struct socket *)0, m);
 }
 
@@ -201,18 +201,18 @@ tcp_newtcpcb(so)
        struct socket *so;
 {
        register struct tcpcb *tp;
-       
+
        tp = (struct tcpcb *)malloc(sizeof(*tp));
        if (tp == NULL)
                return ((struct tcpcb *)0);
-       
+
        memset((char *) tp, 0, sizeof(struct tcpcb));
        tp->seg_next = tp->seg_prev = (tcpiphdrp_32)tp;
        tp->t_maxseg = tcp_mssdflt;
-       
+
        tp->t_flags = tcp_do_rfc1323 ? (TF_REQ_SCALE|TF_REQ_TSTMP) : 0;
        tp->t_socket = so;
-       
+
        /*
         * Init srtt to TCPTV_SRTTBASE (0), so we can tell that we have no
         * rtt estimate.  Set rttvar so that srtt + 2 * rttvar gives
@@ -222,14 +222,14 @@ tcp_newtcpcb(so)
        tp->t_rttvar = tcp_rttdflt * PR_SLOWHZ << 2;
        tp->t_rttmin = TCPTV_MIN;
 
-       TCPT_RANGESET(tp->t_rxtcur, 
+       TCPT_RANGESET(tp->t_rxtcur,
            ((TCPTV_SRTTBASE >> 2) + (TCPTV_SRTTDFLT << 2)) >> 1,
            TCPTV_MIN, TCPTV_REXMTMAX);
 
        tp->snd_cwnd = TCP_MAXWIN << TCP_MAX_WINSHIFT;
        tp->snd_ssthresh = TCP_MAXWIN << TCP_MAX_WINSHIFT;
        tp->t_state = TCPS_CLOSED;
-       
+
        so->so_tcpcb = tp;
 
        return (tp);
@@ -240,7 +240,7 @@ tcp_newtcpcb(so)
  * the specified error.  If connection is synchronized,
  * then send a RST to peer.
  */
-struct tcpcb *tcp_drop(struct tcpcb *tp, int err) 
+struct tcpcb *tcp_drop(struct tcpcb *tp, int err)
 {
 /* tcp_drop(tp, errno)
        register struct tcpcb *tp;
@@ -251,7 +251,7 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, int err)
        DEBUG_CALL("tcp_drop");
        DEBUG_ARG("tp = %lx", (long)tp);
        DEBUG_ARG("errno = %d", errno);
-       
+
        if (TCPS_HAVERCVDSYN(tp->t_state)) {
                tp->t_state = TCPS_CLOSED;
                (void) tcp_output(tp);
@@ -281,7 +281,7 @@ tcp_close(tp)
 
        DEBUG_CALL("tcp_close");
        DEBUG_ARG("tp = %lx", (long )tp);
-       
+
        /* free the reassembly queue, if any */
        t = (struct tcpiphdr *) tp->seg_next;
        while (t != (struct tcpiphdr *)tp) {
@@ -356,7 +356,7 @@ tcp_sockclosed(tp)
 
        DEBUG_CALL("tcp_sockclosed");
        DEBUG_ARG("tp = %lx", (long)tp);
-       
+
        switch (tp->t_state) {
 
        case TCPS_CLOSED:
@@ -382,21 +382,21 @@ tcp_sockclosed(tp)
                tcp_output(tp);
 }
 
-/* 
+/*
  * Connect to a host on the Internet
  * Called by tcp_input
  * Only do a connect, the tcp fields will be set in tcp_input
  * return 0 if there's a result of the connect,
  * else return -1 means we're still connecting
  * The return value is almost always -1 since the socket is
- * nonblocking.  Connect returns after the SYN is sent, and does 
+ * nonblocking.  Connect returns after the SYN is sent, and does
  * not wait for ACK+SYN.
  */
 int tcp_fconnect(so)
      struct socket *so;
 {
   int ret=0;
-  
+
   DEBUG_CALL("tcp_fconnect");
   DEBUG_ARG("so = %lx", (long )so);
 
@@ -409,7 +409,7 @@ int tcp_fconnect(so)
     setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(opt ));
     opt = 1;
     setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(opt ));
-    
+
     addr.sin_family = AF_INET;
     if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) {
       /* It's an alias */
@@ -425,13 +425,13 @@ int tcp_fconnect(so)
     } else
       addr.sin_addr = so->so_faddr;
     addr.sin_port = so->so_fport;
-    
+
     DEBUG_MISC((dfd, " connect()ing, addr.sin_port=%d, "
-               "addr.sin_addr.s_addr=%.16s\n", 
+               "addr.sin_addr.s_addr=%.16s\n",
                ntohs(addr.sin_port), inet_ntoa(addr.sin_addr)));
     /* We don't care what port we get */
     ret = connect(s,(struct sockaddr *)&addr,sizeof (addr));
-    
+
     /*
      * If it's not in progress, it failed, so we just return 0,
      * without clearing SS_NOFDREF
@@ -444,16 +444,16 @@ int tcp_fconnect(so)
 
 /*
  * Accept the socket and connect to the local-host
- * 
+ *
  * We have a problem. The correct thing to do would be
  * to first connect to the local-host, and only if the
  * connection is accepted, then do an accept() here.
- * But, a) we need to know who's trying to connect 
+ * But, a) we need to know who's trying to connect
  * to the socket to be able to SYN the local-host, and
  * b) we are already connected to the foreign host by
  * the time it gets to accept(), so... We simply accept
  * here and SYN the local-host.
- */ 
+ */
 void
 tcp_connect(inso)
        struct socket *inso;
@@ -466,7 +466,7 @@ tcp_connect(inso)
 
        DEBUG_CALL("tcp_connect");
        DEBUG_ARG("inso = %lx", (long)inso);
-       
+
        /*
         * If it's an SS_ACCEPTONCE socket, no need to socreate()
         * another socket, just use the accept() socket.
@@ -487,7 +487,7 @@ tcp_connect(inso)
                so->so_laddr = inso->so_laddr;
                so->so_lport = inso->so_lport;
        }
-       
+
        (void) tcp_mss(sototcpcb(so), 0);
 
        if ((s = accept(inso->s,(struct sockaddr *)&addr,&addrlen)) < 0) {
@@ -501,13 +501,13 @@ tcp_connect(inso)
        setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));
        opt = 1;
        setsockopt(s,IPPROTO_TCP,TCP_NODELAY,(char *)&opt,sizeof(int));
-       
+
        so->so_fport = addr.sin_port;
        so->so_faddr = addr.sin_addr;
        /* Translate connections from localhost to the real hostname */
        if (so->so_faddr.s_addr == 0 || so->so_faddr.s_addr == loopback_addr.s_addr)
           so->so_faddr = alias_addr;
-       
+
        /* Close the accept() socket, set right state */
        if (inso->so_state & SS_FACCEPTONCE) {
                closesocket(so->s); /* If we only accept once, close the accept() socket */
@@ -515,12 +515,12 @@ tcp_connect(inso)
                                           /* if it's not FACCEPTONCE, it's already NOFDREF */
        }
        so->s = s;
-       
+
        so->so_iptos = tcp_tos(so);
        tp = sototcpcb(so);
 
        tcp_template(tp);
-       
+
        /* Compute window scaling to request.  */
 /*     while (tp->request_r_scale < TCP_MAX_WINSHIFT &&
  *             (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat)
@@ -529,10 +529,10 @@ tcp_connect(inso)
 
 /*     soisconnecting(so); */ /* NOFDREF used instead */
        tcpstat.tcps_connattempt++;
-       
+
        tp->t_state = TCPS_SYN_SENT;
        tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
-       tp->iss = tcp_iss; 
+       tp->iss = tcp_iss;
        tcp_iss += TCP_ISSINCR/2;
        tcp_sendseqinit(tp);
        tcp_output(tp);
@@ -547,7 +547,7 @@ tcp_attach(so)
 {
        if ((so->so_tcpcb = tcp_newtcpcb(so)) == NULL)
           return -1;
-       
+
        insque(so, &tcb);
 
        return 0;
@@ -573,7 +573,7 @@ struct tos_t tcptos[] = {
 };
 
 struct emu_t *tcpemu = 0;
-               
+
 /*
  * Return TOS according to the above table
  */
@@ -583,7 +583,7 @@ tcp_tos(so)
 {
        int i = 0;
        struct emu_t *emup;
-       
+
        while(tcptos[i].tos) {
                if ((tcptos[i].fport && (ntohs(so->so_fport) == tcptos[i].fport)) ||
                    (tcptos[i].lport && (ntohs(so->so_lport) == tcptos[i].lport))) {
@@ -592,7 +592,7 @@ tcp_tos(so)
                }
                i++;
        }
-       
+
        /* Nope, lets see if there's a user-added one */
        for (emup = tcpemu; emup; emup = emup->next) {
                if ((emup->fport && (ntohs(so->so_fport) == emup->fport)) ||
@@ -601,7 +601,7 @@ tcp_tos(so)
                        return emup->tos;
                }
        }
-       
+
        return 0;
 }
 
@@ -612,23 +612,23 @@ int do_echo = -1;
  * This includes ftp (the data connection is
  * initiated by the server) and IRC (DCC CHAT and
  * DCC SEND) for now
- * 
+ *
  * NOTE: It's possible to crash SLiRP by sending it
  * unstandard strings to emulate... if this is a problem,
  * more checks are needed here
  *
  * XXX Assumes the whole command came in one packet
- *                                         
+ *
  * XXX Some ftp clients will have their TOS set to
  * LOWDELAY and so Nagel will kick in.  Because of this,
  * we'll get the first letter, followed by the rest, so
  * we simply scan for ORT instead of PORT...
  * DCC doesn't have this problem because there's other stuff
  * in the packet before the DCC command.
- * 
- * Return 1 if the mbuf m is still valid and should be 
+ *
+ * Return 1 if the mbuf m is still valid and should be
  * sbappend()ed
- * 
+ *
  * NOTE: if you return 0 you MUST m_free() the mbuf!
  */
 int
@@ -641,25 +641,25 @@ tcp_emu(so, m)
        u_int32_t laddr;
        u_int lport;
        char *bptr;
-       
+
        DEBUG_CALL("tcp_emu");
        DEBUG_ARG("so = %lx", (long)so);
        DEBUG_ARG("m = %lx", (long)m);
-       
+
        switch(so->so_emu) {
                int x, i;
-               
+
         case EMU_IDENT:
                /*
                 * Identification protocol as per rfc-1413
                 */
-               
+
                {
                        struct socket *tmpso;
                        struct sockaddr_in addr;
                        int addrlen = sizeof(struct sockaddr_in);
                        struct sbuf *so_rcv = &so->so_rcv;
-                       
+
                        memcpy(so_rcv->sb_wptr, m->m_data, m->m_len);
                        so_rcv->sb_wptr += m->m_len;
                        so_rcv->sb_rptr += m->m_len;
@@ -688,7 +688,7 @@ tcp_emu(so, m)
                        m_free(m);
                        return 0;
                }
-               
+
 #if 0
         case EMU_RLOGIN:
                /*
@@ -703,7 +703,7 @@ tcp_emu(so, m)
                        char term[100];
                        struct sbuf *so_snd = &so->so_snd;
                        struct sbuf *so_rcv = &so->so_rcv;
-                       
+
                        /* First check if they have a priveladged port, or too much data has arrived */
                        if (ntohs(so->so_lport) > 1023 || ntohs(so->so_lport) < 512 ||
                            (m->m_len + so_rcv->sb_wptr) > (so_rcv->sb_data + so_rcv->sb_datalen)) {
@@ -714,13 +714,13 @@ tcp_emu(so, m)
                                m_free(m);
                                return 0;
                        }
-                       
+
                        /* Append the current data */
                        memcpy(so_rcv->sb_wptr, m->m_data, m->m_len);
                        so_rcv->sb_wptr += m->m_len;
                        so_rcv->sb_rptr += m->m_len;
                        m_free(m);
-                       
+
                        /*
                         * Check if we have all the initial options,
                         * and build argument list to rlogin while we're here
@@ -752,10 +752,10 @@ tcp_emu(so, m)
                                        }
                                }
                        }
-                       
+
                        if (n != 4)
                           return 0;
-                       
+
                        /* We have it, set our term variable and fork_exec() */
 #ifdef HAVE_SETENV
                        setenv("TERM", term, 1);
@@ -765,15 +765,15 @@ tcp_emu(so, m)
                        fork_exec(so, args, 2);
                        term[0] = 0;
                        so->so_emu = 0;
-                       
+
                        /* And finally, send the client a 0 character */
                        so_snd->sb_wptr[0] = 0;
                        so_snd->sb_wptr++;
                        so_snd->sb_cc++;
-                       
+
                        return 0;
                }
-               
+
         case EMU_RSH:
                /*
                 * rsh emulation
@@ -787,7 +787,7 @@ tcp_emu(so, m)
                        char *args;
                        struct sbuf *so_snd = &so->so_snd;
                        struct sbuf *so_rcv = &so->so_rcv;
-                       
+
                        /* First check if they have a priveladged port, or too much data has arrived */
                        if (ntohs(so->so_lport) > 1023 || ntohs(so->so_lport) < 512 ||
                            (m->m_len + so_rcv->sb_wptr) > (so_rcv->sb_data + so_rcv->sb_datalen)) {
@@ -798,13 +798,13 @@ tcp_emu(so, m)
                                m_free(m);
                                return 0;
                        }
-                       
+
                        /* Append the current data */
                        memcpy(so_rcv->sb_wptr, m->m_data, m->m_len);
                        so_rcv->sb_wptr += m->m_len;
                        so_rcv->sb_rptr += m->m_len;
                        m_free(m);
-                       
+
                        /*
                         * Check if we have all the initial options,
                         * and build argument list to rlogin while we're here
@@ -840,15 +840,15 @@ tcp_emu(so, m)
                                ns->so_faddr=so->so_faddr;
                                ns->so_fport=htons(IPPORT_RESERVED-1); /* Use a fake port. */
 
-                               if (ns->so_faddr.s_addr == 0 || 
+                               if (ns->so_faddr.s_addr == 0 ||
                                        ns->so_faddr.s_addr == loopback_addr.s_addr)
                   ns->so_faddr = alias_addr;
 
                                ns->so_iptos = tcp_tos(ns);
                                tp = sototcpcb(ns);
-                
+
                                tcp_template(tp);
-                
+
                                /* Compute window scaling to request.  */
                                /*      while (tp->request_r_scale < TCP_MAX_WINSHIFT &&
                                 *              (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat)
@@ -858,10 +858,10 @@ tcp_emu(so, m)
                 /*soisfconnecting(ns);*/
 
                                tcpstat.tcps_connattempt++;
-                                       
+
                                tp->t_state = TCPS_SYN_SENT;
                                tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
-                               tp->iss = tcp_iss; 
+                               tp->iss = tcp_iss;
                                tcp_iss += TCP_ISSINCR/2;
                                tcp_sendseqinit(tp);
                                tcp_output(tp);
@@ -877,19 +877,19 @@ tcp_emu(so, m)
                 }
               }
                        }
-                       
+
                        if (n != 4)
               return 0;
-                       
+
                        rsh_exec(so,so->extra, user, inet_ntoa(so->so_faddr), args);
                        so->so_emu = 0;
                        so->extra=NULL;
-                       
+
                        /* And finally, send the client a 0 character */
                        so_snd->sb_wptr[0] = 0;
                        so_snd->sb_wptr++;
                        so_snd->sb_cc++;
-                       
+
                        return 0;
                }
 
@@ -898,7 +898,7 @@ tcp_emu(so, m)
                        int num;
                        struct sbuf *so_snd = &so->so_snd;
                        struct sbuf *so_rcv = &so->so_rcv;
-                       
+
                        /*
                         * If there is binary data here, we save it in so->so_m
                         */
@@ -913,16 +913,16 @@ tcp_emu(so, m)
                            }
                          }
                        } /* if(so->so_m==NULL) */
-                       
+
                        /*
                         * Append the line
                         */
                        sbappendsb(so_rcv, m);
-                       
+
                        /* To avoid going over the edge of the buffer, we reset it */
                        if (so_snd->sb_cc == 0)
                           so_snd->sb_wptr = so_snd->sb_rptr = so_snd->sb_data;
-                       
+
                        /*
                         * A bit of a hack:
                         * If the first packet we get here is 1 byte long, then it
@@ -941,13 +941,13 @@ tcp_emu(so, m)
                          tcp_output(sototcpcb(so)); /* XXX */
                        } else
                          m_free(m);
-                       
+
                        num = 0;
                        while (num < so->so_rcv.sb_cc) {
                                if (*(so->so_rcv.sb_rptr + num) == '\n' ||
                                    *(so->so_rcv.sb_rptr + num) == '\r') {
                                        int n;
-                                       
+
                                        *(so_rcv->sb_rptr + num) = 0;
                                        if (ctl_password && !ctl_password_ok) {
                                                /* Need a password */
@@ -984,38 +984,38 @@ do_prompt:
                        }
                        return 0;
                }
-#endif         
+#endif
         case EMU_FTP: /* ftp */
                *(m->m_data+m->m_len) = 0; /* NULL terminate for strstr */
                if ((bptr = (char *)strstr(m->m_data, "ORT")) != NULL) {
                        /*
                         * Need to emulate the PORT command
-                        */                     
-                       x = sscanf(bptr, "ORT %d,%d,%d,%d,%d,%d\r\n%256[^\177]", 
+                        */
+                       x = sscanf(bptr, "ORT %d,%d,%d,%d,%d,%d\r\n%256[^\177]",
                                   &n1, &n2, &n3, &n4, &n5, &n6, buff);
                        if (x < 6)
                           return 1;
-                       
+
                        laddr = htonl((n1 << 24) | (n2 << 16) | (n3 << 8) | (n4));
                        lport = htons((n5 << 8) | (n6));
-                       
+
                        if ((so = solisten(0, laddr, lport, SS_FACCEPTONCE)) == NULL)
                           return 1;
-                       
+
                        n6 = ntohs(so->so_fport);
-                       
+
                        n5 = (n6 >> 8) & 0xff;
                        n6 &= 0xff;
-                       
+
                        laddr = ntohl(so->so_faddr.s_addr);
-                       
+
                        n1 = ((laddr >> 24) & 0xff);
                        n2 = ((laddr >> 16) & 0xff);
                        n3 = ((laddr >> 8)  & 0xff);
                        n4 =  (laddr & 0xff);
-                       
+
                        m->m_len = bptr - m->m_data; /* Adjust length */
-                       m->m_len += sprintf(bptr,"ORT %d,%d,%d,%d,%d,%d\r\n%s", 
+                       m->m_len += sprintf(bptr,"ORT %d,%d,%d,%d,%d,%d\r\n%s",
                                            n1, n2, n3, n4, n5, n6, x==7?buff:"");
                        return 1;
                } else if ((bptr = (char *)strstr(m->m_data, "27 Entering")) != NULL) {
@@ -1026,34 +1026,34 @@ do_prompt:
                                   &n1, &n2, &n3, &n4, &n5, &n6, buff);
                        if (x < 6)
                           return 1;
-                       
+
                        laddr = htonl((n1 << 24) | (n2 << 16) | (n3 << 8) | (n4));
                        lport = htons((n5 << 8) | (n6));
-                       
+
                        if ((so = solisten(0, laddr, lport, SS_FACCEPTONCE)) == NULL)
                           return 1;
-                       
+
                        n6 = ntohs(so->so_fport);
-                       
+
                        n5 = (n6 >> 8) & 0xff;
                        n6 &= 0xff;
-                       
+
                        laddr = ntohl(so->so_faddr.s_addr);
-                       
+
                        n1 = ((laddr >> 24) & 0xff);
                        n2 = ((laddr >> 16) & 0xff);
                        n3 = ((laddr >> 8)  & 0xff);
                        n4 =  (laddr & 0xff);
-                       
+
                        m->m_len = bptr - m->m_data; /* Adjust length */
                        m->m_len += sprintf(bptr,"27 Entering Passive Mode (%d,%d,%d,%d,%d,%d)\r\n%s",
                                            n1, n2, n3, n4, n5, n6, x==7?buff:"");
-                       
+
                        return 1;
                }
-               
+
                return 1;
-                                  
+
         case EMU_KSH:
                /*
                 * The kshell (Kerberos rsh) and shell services both pass
@@ -1072,7 +1072,7 @@ do_prompt:
                    (so = solisten(0, so->so_laddr.s_addr, htons(lport), SS_FACCEPTONCE)) != NULL)
                        m->m_len = sprintf(m->m_data, "%d", ntohs(so->so_fport))+1;
                return 1;
-               
+
         case EMU_IRC:
                /*
                 * Need to emulate DCC CHAT, DCC SEND and DCC MOVE
@@ -1080,12 +1080,12 @@ do_prompt:
                *(m->m_data+m->m_len) = 0; /* NULL terminate the string for strstr */
                if ((bptr = (char *)strstr(m->m_data, "DCC")) == NULL)
                         return 1;
-               
+
                /* The %256s is for the broken mIRC */
                if (sscanf(bptr, "DCC CHAT %256s %u %u", buff, &laddr, &lport) == 3) {
                        if ((so = solisten(0, htonl(laddr), htons(lport), SS_FACCEPTONCE)) == NULL)
                                return 1;
-                       
+
                        m->m_len = bptr - m->m_data; /* Adjust length */
                        m->m_len += sprintf(bptr, "DCC CHAT chat %lu %u%c\n",
                             (unsigned long)ntohl(so->so_faddr.s_addr),
@@ -1093,15 +1093,15 @@ do_prompt:
                } else if (sscanf(bptr, "DCC SEND %256s %u %u %u", buff, &laddr, &lport, &n1) == 4) {
                        if ((so = solisten(0, htonl(laddr), htons(lport), SS_FACCEPTONCE)) == NULL)
                                return 1;
-                       
+
                        m->m_len = bptr - m->m_data; /* Adjust length */
-                       m->m_len += sprintf(bptr, "DCC SEND %s %lu %u %u%c\n", 
+                       m->m_len += sprintf(bptr, "DCC SEND %s %lu %u %u%c\n",
                              buff, (unsigned long)ntohl(so->so_faddr.s_addr),
                              ntohs(so->so_fport), n1, 1);
                } else if (sscanf(bptr, "DCC MOVE %256s %u %u %u", buff, &laddr, &lport, &n1) == 4) {
                        if ((so = solisten(0, htonl(laddr), htons(lport), SS_FACCEPTONCE)) == NULL)
                                return 1;
-                       
+
                        m->m_len = bptr - m->m_data; /* Adjust length */
                        m->m_len += sprintf(bptr, "DCC MOVE %s %lu %u %u%c\n",
                              buff, (unsigned long)ntohl(so->so_faddr.s_addr),
@@ -1110,7 +1110,7 @@ do_prompt:
                return 1;
 
         case EMU_REALAUDIO:
-                /* 
+                /*
                 * RealAudio emulation - JP. We must try to parse the incoming
                 * data and try to find the two characters that contain the
                 * port number. Then we redirect an udp port and replace the
@@ -1118,45 +1118,45 @@ do_prompt:
                 *
                 * The 1.0 beta versions of the player are not supported
                 * any more.
-                * 
+                *
                 * A typical packet for player version 1.0 (release version):
-                *        
-                * 0000:50 4E 41 00 05 
+                *
+                * 0000:50 4E 41 00 05
                 * 0000:00 01 00 02 1B D7 00 00 67 E6 6C DC 63 00 12 50 .....×..gælÜc..P
                 * 0010:4E 43 4C 49 45 4E 54 20 31 30 31 20 41 4C 50 48 NCLIENT 101 ALPH
                 * 0020:41 6C 00 00 52 00 17 72 61 66 69 6C 65 73 2F 76 Al..R..rafiles/v
                 * 0030:6F 61 2F 65 6E 67 6C 69 73 68 5F 2E 72 61 79 42 oa/english_.rayB
-                *         
+                *
                 * Now the port number 0x1BD7 is found at offset 0x04 of the
                 * Now the port number 0x1BD7 is found at offset 0x04 of the
                 * second packet. This time we received five bytes first and
                 * then the rest. You never know how many bytes you get.
                 *
                 * A typical packet for player version 2.0 (beta):
-                *        
+                *
                 * 0000:50 4E 41 00 06 00 02 00 00 00 01 00 02 1B C1 00 PNA...........Á.
                 * 0010:00 67 75 78 F5 63 00 0A 57 69 6E 32 2E 30 2E 30 .guxõc..Win2.0.0
                 * 0020:2E 35 6C 00 00 52 00 1C 72 61 66 69 6C 65 73 2F .5l..R..rafiles/
                 * 0030:77 65 62 73 69 74 65 2F 32 30 72 65 6C 65 61 73 website/20releas
                 * 0040:65 2E 72 61 79 53 00 00 06 36 42                e.rayS...6B
-                *        
+                *
                 * Port number 0x1BC1 is found at offset 0x0d.
-                *      
+                *
                 * This is just a horrible switch statement. Variable ra tells
                 * us where we're going.
                 */
-               
+
                bptr = m->m_data;
                while (bptr < m->m_data + m->m_len) {
                        u_short p;
                        static int ra = 0;
-                       char ra_tbl[4]; 
-                       
+                       char ra_tbl[4];
+
                        ra_tbl[0] = 0x50;
                        ra_tbl[1] = 0x4e;
                        ra_tbl[2] = 0x41;
                        ra_tbl[3] = 0;
-                       
+
                        switch (ra) {
                         case 0:
                         case 2:
@@ -1166,7 +1166,7 @@ do_prompt:
                                        continue;
                                }
                                break;
-                               
+
                         case 1:
                                /*
                                 * We may get 0x50 several times, ignore them
@@ -1180,15 +1180,15 @@ do_prompt:
                                        continue;
                                }
                                break;
-                               
-                        case 4: 
-                               /* 
+
+                        case 4:
+                               /*
                                 * skip version number
                                 */
                                bptr++;
                                break;
-                               
-                        case 5: 
+
+                        case 5:
                                /*
                                 * The difference between versions 1.0 and
                                 * 2.0 is here. For future versions of
@@ -1198,19 +1198,19 @@ do_prompt:
                                   bptr += 8;
                                else
                                   bptr += 4;
-                               break;                          
-                               
+                               break;
+
                         case 6:
                                /* This is the field containing the port
                                 * number that RA-player is listening to.
                                 */
-                               lport = (((u_char*)bptr)[0] << 8) 
+                               lport = (((u_char*)bptr)[0] << 8)
                                + ((u_char *)bptr)[1];
-                               if (lport < 6970)      
+                               if (lport < 6970)
                                   lport += 256;   /* don't know why */
                                if (lport < 6970 || lport > 7170)
                                   return 1;       /* failed */
-                               
+
                                /* try to get udp port between 6970 - 7170 */
                                for (p = 6970; p < 7071; p++) {
                                        if (udp_listen( htons(p),
@@ -1224,17 +1224,17 @@ do_prompt:
                                   p = 0;
                                *(u_char *)bptr++ = (p >> 8) & 0xff;
                                *(u_char *)bptr++ = p & 0xff;
-                               ra = 0; 
+                               ra = 0;
                                return 1;   /* port redirected, we're done */
-                               break;  
-                               
+                               break;
+
                         default:
-                               ra = 0;                         
+                               ra = 0;
                        }
                        ra++;
                }
-               return 1;                                
-               
+               return 1;
+
         default:
                /* Ooops, not emulated, won't call tcp_emu again */
                so->so_emu = 0;
@@ -1256,10 +1256,10 @@ tcp_ctl(so)
        struct ex_list *ex_ptr;
        int do_pty;
         //     struct socket *tmpso;
-       
+
        DEBUG_CALL("tcp_ctl");
        DEBUG_ARG("so = %lx", (long )so);
-       
+
 #if 0
        /*
         * Check if they're authorised
@@ -1269,12 +1269,12 @@ tcp_ctl(so)
                sb->sb_wptr += sb->sb_cc;
                return 0;
        }
-#endif 
+#endif
        command = (ntohl(so->so_faddr.s_addr) & 0xff);
-       
+
        switch(command) {
        default: /* Check for exec's */
-               
+
                /*
                 * Check if it's pty_exec
                 */
@@ -1285,12 +1285,12 @@ tcp_ctl(so)
                                goto do_exec;
                        }
                }
-               
+
                /*
                 * Nothing bound..
                 */
                /* tcp_fconnect(so); */
-               
+
                /* FALLTHROUGH */
        case CTL_ALIAS:
          sb->sb_cc = sprintf(sb->sb_wptr,
@@ -1301,12 +1301,12 @@ tcp_ctl(so)
        do_exec:
                DEBUG_MISC((dfd, " executing %s \n",ex_ptr->ex_exec));
                return(fork_exec(so, ex_ptr->ex_exec, do_pty));
-               
+
 #if 0
        case CTL_CMD:
           for (tmpso = tcb.so_next; tmpso != &tcb; tmpso = tmpso->so_next) {
-            if (tmpso->so_emu == EMU_CTL && 
-                !(tmpso->so_tcpcb? 
+            if (tmpso->so_emu == EMU_CTL &&
+                !(tmpso->so_tcpcb?
                   (tmpso->so_tcpcb->t_state & (TCPS_TIME_WAIT|TCPS_LAST_ACK))
                   :0)) {
               /* Ooops, control connection already active */
index d3146db587b53fbff6f647f76d72496a0ec5ce0e..cc1bd50c07c7f4ba24d2be206da9f976ba92a581 100644 (file)
@@ -54,7 +54,7 @@ tcp_fasttimo()
        register struct tcpcb *tp;
 
        DEBUG_CALL("tcp_fasttimo");
-       
+
        so = tcb.so_next;
        if (so)
        for (; so != &tcb; so = so->so_next)
@@ -80,7 +80,7 @@ tcp_slowtimo()
        register int i;
 
        DEBUG_CALL("tcp_slowtimo");
-       
+
        tcp_maxidle = TCPTV_KEEPCNT * tcp_keepintvl;
        /*
         * Search through tcb's and update active timers.
@@ -139,9 +139,9 @@ tcp_timers(tp, timer)
        int timer;
 {
        register int rexmt;
-       
+
        DEBUG_CALL("tcp_timers");
-       
+
        switch (timer) {
 
        /*
@@ -164,12 +164,12 @@ tcp_timers(tp, timer)
         * to a longer retransmit interval and retransmit one segment.
         */
        case TCPT_REXMT:
-               
+
                /*
                 * XXXXX If a packet has timed out, then remove all the queued
                 * packets for that session.
                 */
-               
+
                if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) {
                        /*
                         * This is a hack to suit our terminal server here at the uni of canberra
@@ -178,14 +178,14 @@ tcp_timers(tp, timer)
                         * keep retransmitting it, it'll keep eating the zeroes, so we keep
                         * retransmitting, and eventually the connection dies...
                         * (this only happens on incoming data)
-                        * 
+                        *
                         * So, if we were gonna drop the connection from too many retransmits,
                         * don't... instead halve the t_maxseg, which might break up the NULLs and
                         * let them through
-                        * 
+                        *
                         * *sigh*
                         */
-                       
+
                        tp->t_maxseg >>= 1;
                        if (tp->t_maxseg < 32) {
                                /*
@@ -197,7 +197,7 @@ tcp_timers(tp, timer)
                                /* tp->t_softerror : ETIMEDOUT); */ /* XXX */
                                return (tp); /* XXX */
                        }
-                       
+
                        /*
                         * Set rxtshift to 6, which is still at the maximum
                         * backoff time
@@ -240,7 +240,7 @@ tcp_timers(tp, timer)
                 * size increase exponentially with time.  If the
                 * window is larger than the path can handle, this
                 * exponential growth results in dropped packet(s)
-                * almost immediately.  To get more time between 
+                * almost immediately.  To get more time between
                 * drops but still "push" the network to take advantage
                 * of improving conditions, we switch from exponential
                 * to linear window opening at some threshold size.
index c9946d6bf2111bc5c72d55e33f47a7f706e40561..c9abec80c6d1ca2a89b0a27e531aa0607377efc7 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * tftp.c - a simple, read-only tftp server for qemu
- * 
+ *
  * Copyright (c) 2004 Magnus Damm <damm@opensource.se>
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
 struct tftp_session {
     int in_use;
     unsigned char filename[TFTP_FILENAME_MAX];
-    
+
     struct in_addr client_ip;
     u_int16_t client_port;
-    
+
     int timestamp;
 };
 
@@ -120,7 +120,7 @@ static int tftp_read_data(struct tftp_session *spt, u_int16_t block_nr,
   return bytes_read;
 }
 
-static int tftp_send_error(struct tftp_session *spt, 
+static int tftp_send_error(struct tftp_session *spt,
                           u_int16_t errorcode, const char *msg,
                           struct tftp_t *recv_tp)
 {
@@ -140,7 +140,7 @@ static int tftp_send_error(struct tftp_session *spt,
   m->m_data += if_maxlinkhdr;
   tp = (void *)m->m_data;
   m->m_data += sizeof(struct udpiphdr);
-  
+
   tp->tp_op = htons(TFTP_ERROR);
   tp->x.tp_error.tp_error_code = htons(errorcode);
   strcpy(tp->x.tp_error.tp_msg, msg);
@@ -153,7 +153,7 @@ static int tftp_send_error(struct tftp_session *spt,
 
   nobytes = 2;
 
-  m->m_len = sizeof(struct tftp_t) - 514 + 3 + strlen(msg) - 
+  m->m_len = sizeof(struct tftp_t) - 514 + 3 + strlen(msg) -
         sizeof(struct ip) - sizeof(struct udphdr);
 
   udp_output2(NULL, m, &saddr, &daddr, IPTOS_LOWDELAY);
@@ -163,7 +163,7 @@ static int tftp_send_error(struct tftp_session *spt,
   return 0;
 }
 
-static int tftp_send_data(struct tftp_session *spt, 
+static int tftp_send_data(struct tftp_session *spt,
                          u_int16_t block_nr,
                          struct tftp_t *recv_tp)
 {
@@ -187,7 +187,7 @@ static int tftp_send_data(struct tftp_session *spt,
   m->m_data += if_maxlinkhdr;
   tp = (void *)m->m_data;
   m->m_data += sizeof(struct udpiphdr);
-  
+
   tp->tp_op = htons(TFTP_DATA);
   tp->x.tp_data.tp_block_nr = htons(block_nr);
 
@@ -209,7 +209,7 @@ static int tftp_send_data(struct tftp_session *spt,
     return -1;
   }
 
-  m->m_len = sizeof(struct tftp_t) - (512 - nobytes) - 
+  m->m_len = sizeof(struct tftp_t) - (512 - nobytes) -
         sizeof(struct ip) - sizeof(struct udphdr);
 
   udp_output2(NULL, m, &saddr, &daddr, IPTOS_LOWDELAY);
@@ -251,23 +251,23 @@ static void tftp_handle_rrq(struct tftp_t *tp, int pktlen)
     else {
       return;
     }
-    
+
     if (src[k] == '\0') {
       break;
     }
   }
-      
+
   if (k >= n) {
     return;
   }
-  
+
   k++;
-  
+
   /* check mode */
   if ((n - k) < 6) {
     return;
   }
-  
+
   if (memcmp(&src[k], "octet\0", 6) != 0) {
       tftp_send_error(spt, 4, "Unsupported transfer mode", tp);
       return;
@@ -291,7 +291,7 @@ static void tftp_handle_rrq(struct tftp_t *tp, int pktlen)
   }
 
   /* check if the file exists */
-  
+
   if (tftp_read_data(spt, 0, spt->filename, 0) < 0) {
       tftp_send_error(spt, 1, "File not found", tp);
       return;
@@ -310,8 +310,8 @@ static void tftp_handle_ack(struct tftp_t *tp, int pktlen)
     return;
   }
 
-  if (tftp_send_data(&tftp_sessions[s], 
-                    ntohs(tp->x.tp_data.tp_block_nr) + 1, 
+  if (tftp_send_data(&tftp_sessions[s],
+                    ntohs(tp->x.tp_data.tp_block_nr) + 1,
                     tp) < 0) {
     return;
   }
index f0560b6ab001a2c6e6c21c3f8ee52a34882ab57e..87b36ce5b12449dac11509bfcd11426ebf1e3075 100644 (file)
@@ -17,11 +17,11 @@ struct tftp_t {
   struct udphdr udp;
   u_int16_t tp_op;
   union {
-    struct { 
+    struct {
       u_int16_t tp_block_nr;
       u_int8_t tp_buf[512];
     } tp_data;
-    struct { 
+    struct {
       u_int16_t tp_error_code;
       u_int8_t tp_msg[512];
     } tp_error;
index 8cf4cbd315b2d576bbbec447df172ad85fc3eef6..44900ff1441610f0d7d10a7909d7955549986c1e 100644 (file)
@@ -37,8 +37,8 @@
 /*
  * Changes and additions relating to SLiRP
  * Copyright (c) 1995 Danny Gasparovski.
- * 
- * Please read the file COPYRIGHT for the 
+ *
+ * Please read the file COPYRIGHT for the
  * terms and conditions of the copyright.
  */
 
@@ -66,8 +66,8 @@ udp_init()
 {
        udb.so_next = udb.so_prev = &udb;
 }
-/* m->m_data  points at ip packet header 
- * m->m_len   length ip packet 
+/* m->m_data  points at ip packet header
+ * m->m_len   length ip packet
  * ip->ip_len length data (IPDU)
  */
 void
@@ -79,13 +79,13 @@ udp_input(m, iphlen)
        register struct udphdr *uh;
 /*     struct mbuf *opts = 0;*/
        int len;
-       struct ip save_ip; 
+       struct ip save_ip;
        struct socket *so;
-       
+
        DEBUG_CALL("udp_input");
        DEBUG_ARG("m = %lx", (long)m);
        DEBUG_ARG("iphlen = %d", iphlen);
-       
+
        udpstat.udps_ipackets++;
 
        /*
@@ -119,12 +119,12 @@ udp_input(m, iphlen)
                m_adj(m, len - ip->ip_len);
                ip->ip_len = len;
        }
-       
+
        /*
         * Save a copy of the IP header in case we want restore it
         * for sending an ICMP error message in response.
         */
-       save_ip = *ip; 
+       save_ip = *ip;
        save_ip.ip_len+= iphlen;         /* tcp_input subtracts this */
 
        /*
@@ -136,8 +136,8 @@ udp_input(m, iphlen)
          ((struct ipovly *)ip)->ih_x1 = 0;
          ((struct ipovly *)ip)->ih_len = uh->uh_ulen;
          /* keep uh_sum for ICMP reply
-          * uh->uh_sum = cksum(m, len + sizeof (struct ip)); 
-          * if (uh->uh_sum) { 
+          * uh->uh_sum = cksum(m, len + sizeof (struct ip));
+          * if (uh->uh_sum) {
           */
          if(cksum(m, len + sizeof(struct ip))) {
            udpstat.udps_badsum++;
@@ -168,7 +168,7 @@ udp_input(m, iphlen)
        if (so->so_lport != uh->uh_sport ||
            so->so_laddr.s_addr != ip->ip_src.s_addr) {
                struct socket *tmp;
-               
+
                for (tmp = udb.so_next; tmp != &udb; tmp = tmp->so_next) {
                        if (tmp->so_lport == uh->uh_sport &&
                            tmp->so_laddr.s_addr == ip->ip_src.s_addr) {
@@ -185,7 +185,7 @@ udp_input(m, iphlen)
                  udp_last_so = so;
                }
        }
-       
+
        if (so == NULL) {
          /*
           * If there's no socket for this packet,
@@ -193,22 +193,22 @@ udp_input(m, iphlen)
           */
          if ((so = socreate()) == NULL) goto bad;
          if(udp_attach(so) == -1) {
-           DEBUG_MISC((dfd," udp_attach errno = %d-%s\n", 
+           DEBUG_MISC((dfd," udp_attach errno = %d-%s\n",
                        errno,strerror(errno)));
            sofree(so);
            goto bad;
          }
-         
+
          /*
           * Setup fields
           */
          /* udp_last_so = so; */
          so->so_laddr = ip->ip_src;
          so->so_lport = uh->uh_sport;
-         
+
          if ((so->so_iptos = udp_tos(so)) == 0)
            so->so_iptos = ip->ip_tos;
-         
+
          /*
           * XXXXX Here, check if it's in udpexec_list,
           * and if it is, do the fork_exec() etc.
@@ -233,7 +233,7 @@ udp_input(m, iphlen)
          m->m_data -= iphlen;
          *ip=save_ip;
          DEBUG_MISC((dfd,"udp tx errno = %d-%s\n",errno,strerror(errno)));
-         icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno));  
+         icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno));
        }
 
        m_free(so->so_m);   /* used for ICMP if error on sorecvfrom */
@@ -251,7 +251,7 @@ bad:
        return;
 }
 
-int udp_output2(struct socket *so, struct mbuf *m, 
+int udp_output2(struct socket *so, struct mbuf *m,
                 struct sockaddr_in *saddr, struct sockaddr_in *daddr,
                 int iptos)
 {
@@ -269,7 +269,7 @@ int udp_output2(struct socket *so, struct mbuf *m,
         */
        m->m_data -= sizeof(struct udpiphdr);
        m->m_len += sizeof(struct udpiphdr);
-       
+
        /*
         * Fill in mbuf with extended UDP header
         * and addresses and length put into network format.
@@ -298,15 +298,15 @@ int udp_output2(struct socket *so, struct mbuf *m,
 
        ((struct ip *)ui)->ip_ttl = ip_defttl;
        ((struct ip *)ui)->ip_tos = iptos;
-       
+
        udpstat.udps_opackets++;
-       
+
        error = ip_output(so, m);
-       
+
        return (error);
 }
 
-int udp_output(struct socket *so, struct mbuf *m, 
+int udp_output(struct socket *so, struct mbuf *m,
                struct sockaddr_in *addr)
 
 {
@@ -320,7 +320,7 @@ int udp_output(struct socket *so, struct mbuf *m,
     }
     daddr.sin_addr = so->so_laddr;
     daddr.sin_port = so->so_lport;
-    
+
     return udp_output2(so, m, &saddr, &daddr, so->so_iptos);
 }
 
@@ -329,7 +329,7 @@ udp_attach(so)
      struct socket *so;
 {
   struct sockaddr_in addr;
-       
+
   if((so->s = socket(AF_INET,SOCK_DGRAM,0)) != -1) {
     /*
      * Here, we bind() the socket.  Although not really needed
@@ -380,7 +380,7 @@ udp_tos(so)
        struct socket *so;
 {
        int i = 0;
-       
+
        while(udptos[i].tos) {
                if ((udptos[i].fport && ntohs(so->so_fport) == udptos[i].fport) ||
                    (udptos[i].lport && ntohs(so->so_lport) == udptos[i].lport)) {
@@ -389,7 +389,7 @@ udp_tos(so)
                }
                i++;
        }
-       
+
        return 0;
 }
 
@@ -412,17 +412,17 @@ udp_emu(so, m)
        CTL_MSG *nmsg;
        char buff[sizeof(CTL_MSG)];
        u_char type;
-       
+
 struct talk_request {
        struct talk_request *next;
        struct socket *udp_so;
        struct socket *tcp_so;
 } *req;
-       
-       static struct talk_request *req_tbl = 0;        
-       
+
+       static struct talk_request *req_tbl = 0;
+
 #endif
-       
+
 struct cu_header {
        uint16_t        d_family;               // destination family
        uint16_t        d_port;                 // destination port
@@ -449,7 +449,7 @@ struct cu_header {
                 */
                if (getsockname(so->s, (struct sockaddr *)&addr, &addrlen) < 0)
                        return;
-               
+
 #define        IS_OLD  (so->so_emu == EMU_TALK)
 
 #define COPY_MSG(dest, src) { dest->type = src->type; \
@@ -472,7 +472,7 @@ struct cu_header {
                        OTOSIN(omsg, ctl_addr)->sin_port = addr.sin_port;
                        OTOSIN(omsg, ctl_addr)->sin_addr = our_addr;
                        strncpy(omsg->l_name, getlogin(), NAME_SIZE_OLD);
-               } else {                /* new talk */  
+               } else {                /* new talk */
                        omsg = (CTL_MSG_OLD *) buff;
                        nmsg = mtod(m, CTL_MSG *);
                        type = nmsg->type;
@@ -480,10 +480,10 @@ struct cu_header {
                        OTOSIN(nmsg, ctl_addr)->sin_addr = our_addr;
                        strncpy(nmsg->l_name, getlogin(), NAME_SIZE_OLD);
                }
-               
-               if (type == LOOK_UP) 
+
+               if (type == LOOK_UP)
                        return;         /* for LOOK_UP this is enough */
-                       
+
                if (IS_OLD) {           /* make a copy of the message */
                        COPY_MSG(nmsg, omsg);
                        nmsg->vers = 1;
@@ -502,75 +502,75 @@ struct cu_header {
                 * ports, 517 and 518. This is why we have two copies
                 * of the message, one in old talk and one in new talk
                 * format.
-                */ 
+                */
 
                if (type == ANNOUNCE) {
                        int s;
                        u_short temp_port;
-                       
+
                        for(req = req_tbl; req; req = req->next)
                                if (so == req->udp_so)
                                        break;          /* found it */
-                                       
+
                        if (!req) {     /* no entry for so, create new */
                                req = (struct talk_request *)
                                        malloc(sizeof(struct talk_request));
                                req->udp_so = so;
-                               req->tcp_so = solisten(0,               
-                                       OTOSIN(omsg, addr)->sin_addr.s_addr,    
+                               req->tcp_so = solisten(0,
+                                       OTOSIN(omsg, addr)->sin_addr.s_addr,
                                        OTOSIN(omsg, addr)->sin_port,
                                        SS_FACCEPTONCE);
                                req->next = req_tbl;
                                req_tbl = req;
-                       }                       
-                       
+                       }
+
                        /* replace port number in addr field */
                        addrlen = sizeof(addr);
-                       getsockname(req->tcp_so->s, 
+                       getsockname(req->tcp_so->s,
                                        (struct sockaddr *) &addr,
-                                       &addrlen);              
+                                       &addrlen);
                        OTOSIN(omsg, addr)->sin_port = addr.sin_port;
                        OTOSIN(omsg, addr)->sin_addr = our_addr;
                        OTOSIN(nmsg, addr)->sin_port = addr.sin_port;
-                       OTOSIN(nmsg, addr)->sin_addr = our_addr;                
-                       
+                       OTOSIN(nmsg, addr)->sin_addr = our_addr;
+
                        /* send LEAVE_INVITEs */
                        temp_port = OTOSIN(omsg, ctl_addr)->sin_port;
                        OTOSIN(omsg, ctl_addr)->sin_port = 0;
                        OTOSIN(nmsg, ctl_addr)->sin_port = 0;
-                       omsg->type = nmsg->type = LEAVE_INVITE;                 
-                       
+                       omsg->type = nmsg->type = LEAVE_INVITE;
+
                        s = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
                        addr.sin_addr = our_addr;
                        addr.sin_family = AF_INET;
                        addr.sin_port = htons(517);
-                       sendto(s, (char *)omsg, sizeof(*omsg), 0, 
+                       sendto(s, (char *)omsg, sizeof(*omsg), 0,
                                (struct sockaddr *)&addr, sizeof(addr));
                        addr.sin_port = htons(518);
                        sendto(s, (char *)nmsg, sizeof(*nmsg), 0,
                                (struct sockaddr *) &addr, sizeof(addr));
                        closesocket(s) ;
 
-                       omsg->type = nmsg->type = ANNOUNCE; 
+                       omsg->type = nmsg->type = ANNOUNCE;
                        OTOSIN(omsg, ctl_addr)->sin_port = temp_port;
                        OTOSIN(nmsg, ctl_addr)->sin_port = temp_port;
                }
-               
-               /*      
+
+               /*
                 * If it is a DELETE message, we send a copy to the
                 * local daemons. Then we delete the entry corresponding
                 * to our socket from the request table.
                 */
-               
+
                if (type == DELETE) {
                        struct talk_request *temp_req, *req_next;
                        int s;
                        u_short temp_port;
-                       
+
                        temp_port = OTOSIN(omsg, ctl_addr)->sin_port;
                        OTOSIN(omsg, ctl_addr)->sin_port = 0;
                        OTOSIN(nmsg, ctl_addr)->sin_port = 0;
-                       
+
                        s = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
                        addr.sin_addr = our_addr;
                        addr.sin_family = AF_INET;
@@ -581,7 +581,7 @@ struct cu_header {
                        sendto(s, (char *)nmsg, sizeof(*nmsg), 0,
                                (struct sockaddr *)&addr, sizeof(addr));
                        closesocket(s);
-                       
+
                        OTOSIN(omsg, ctl_addr)->sin_port = temp_port;
                        OTOSIN(nmsg, ctl_addr)->sin_port = temp_port;
 
@@ -604,18 +604,18 @@ struct cu_header {
                                }
                        }
                }
-               
-               return;         
+
+               return;
 #endif
-               
+
        case EMU_CUSEEME:
-       
+
                /*
                 * Cu-SeeMe emulation.
                 * Hopefully the packet is more that 16 bytes long. We don't
                 * do any other tests, just replace the address and port
                 * fields.
-                */ 
+                */
                if (m->m_len >= sizeof (*cu_head)) {
                        if (getsockname(so->s, (struct sockaddr *)&addr, &addrlen) < 0)
                                return;
@@ -623,7 +623,7 @@ struct cu_header {
                        cu_head->s_port = addr.sin_port;
                        cu_head->so_addr = our_addr.s_addr;
                }
-               
+
                return;
        }
 }
@@ -638,7 +638,7 @@ udp_listen(port, laddr, lport, flags)
        struct sockaddr_in addr;
        struct socket *so;
        int addrlen = sizeof(struct sockaddr_in), opt = 1;
-       
+
        if ((so = socreate()) == NULL) {
                free(so);
                return NULL;
@@ -657,20 +657,20 @@ udp_listen(port, laddr, lport, flags)
        }
        setsockopt(so->s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int));
 /*     setsockopt(so->s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int)); */
-       
+
        getsockname(so->s,(struct sockaddr *)&addr,&addrlen);
        so->so_fport = addr.sin_port;
        if (addr.sin_addr.s_addr == 0 || addr.sin_addr.s_addr == loopback_addr.s_addr)
           so->so_faddr = alias_addr;
        else
           so->so_faddr = addr.sin_addr;
-       
+
        so->so_lport = lport;
        so->so_laddr.s_addr = laddr;
        if (flags != SS_FACCEPTONCE)
           so->so_expire = 0;
-       
+
        so->so_state = SS_ISFCONNECTED;
-       
+
        return so;
 }
index 24c11bbf735f7e564679aca230402fe711463b02..67da6cd731b0219a884c338541d6f549169bd285 100644 (file)
@@ -104,7 +104,7 @@ void udp_detach _P((struct socket *));
 u_int8_t udp_tos _P((struct socket *));
 void udp_emu _P((struct socket *, struct mbuf *));
 struct socket * udp_listen _P((u_int, u_int32_t, u_int, int));
-int udp_output2(struct socket *so, struct mbuf *m, 
+int udp_output2(struct socket *so, struct mbuf *m,
                 struct sockaddr_in *saddr, struct sockaddr_in *daddr,
                 int iptos);
 #endif
index d5b3debc74ebc88964cd9dd6c84b9b263a00e868..3f5a2a71c76501c71c6ad787faee3d951385c03e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Software MMU support
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -143,9 +143,9 @@ static inline RES_TYPE glue(glue(ld, USUFFIX), MEMSUFFIX)(target_ulong ptr)
 #endif
                   "2:\n"
                   : "=r" (res)
-                  : "r" (ptr), 
-                  "i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS), 
-                  "i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS), 
+                  : "r" (ptr),
+                  "i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS),
+                  "i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS),
                   "i" (TARGET_PAGE_MASK | (DATA_SIZE - 1)),
                   "m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_read)),
                   "i" (CPU_MEM_INDEX),
@@ -190,9 +190,9 @@ static inline int glue(glue(lds, SUFFIX), MEMSUFFIX)(target_ulong ptr)
 #endif
                   "2:\n"
                   : "=r" (res)
-                  : "r" (ptr), 
-                  "i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS), 
-                  "i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS), 
+                  : "r" (ptr),
+                  "i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS),
+                  "i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS),
                   "i" (TARGET_PAGE_MASK | (DATA_SIZE - 1)),
                   "m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_read)),
                   "i" (CPU_MEM_INDEX),
@@ -238,13 +238,13 @@ static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE
 #error unsupported size
 #endif
                   "2:\n"
-                  : 
-                  : "r" (ptr), 
+                  :
+                  : "r" (ptr),
 /* NOTE: 'q' would be needed as constraint, but we could not use it
    with T1 ! */
-                  "r" (v), 
-                  "i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS), 
-                  "i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS), 
+                  "r" (v),
+                  "i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS),
+                  "i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS),
                   "i" (TARGET_PAGE_MASK | (DATA_SIZE - 1)),
                   "m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_write)),
                   "i" (CPU_MEM_INDEX),
@@ -267,7 +267,7 @@ static inline RES_TYPE glue(glue(ld, USUFFIX), MEMSUFFIX)(target_ulong ptr)
     addr = ptr;
     index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
     is_user = CPU_MEM_INDEX;
-    if (__builtin_expect(env->tlb_table[is_user][index].ADDR_READ != 
+    if (__builtin_expect(env->tlb_table[is_user][index].ADDR_READ !=
                          (addr & (TARGET_PAGE_MASK | (DATA_SIZE - 1))), 0)) {
         res = glue(glue(__ld, SUFFIX), MMUSUFFIX)(addr, is_user);
     } else {
@@ -288,7 +288,7 @@ static inline int glue(glue(lds, SUFFIX), MEMSUFFIX)(target_ulong ptr)
     addr = ptr;
     index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
     is_user = CPU_MEM_INDEX;
-    if (__builtin_expect(env->tlb_table[is_user][index].ADDR_READ != 
+    if (__builtin_expect(env->tlb_table[is_user][index].ADDR_READ !=
                          (addr & (TARGET_PAGE_MASK | (DATA_SIZE - 1))), 0)) {
         res = (DATA_STYPE)glue(glue(__ld, SUFFIX), MMUSUFFIX)(addr, is_user);
     } else {
@@ -313,7 +313,7 @@ static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE
     addr = ptr;
     index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
     is_user = CPU_MEM_INDEX;
-    if (__builtin_expect(env->tlb_table[is_user][index].addr_write != 
+    if (__builtin_expect(env->tlb_table[is_user][index].addr_write !=
                          (addr & (TARGET_PAGE_MASK | (DATA_SIZE - 1))), 0)) {
         glue(glue(__st, SUFFIX), MMUSUFFIX)(addr, v, is_user);
     } else {
index 1c12c4241134ddffb914ac5420c6aaf8279d26d1..ce6e4bd071652f52603ef1cd5fc81d31e21b4aae 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Software MMU support
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
 #define ADDR_READ addr_read
 #endif
 
-static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr, 
+static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
                                                         int is_user,
                                                         void *retaddr);
-static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr, 
+static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr,
                                               target_ulong tlb_addr)
 {
     DATA_TYPE res;
@@ -83,7 +83,7 @@ DATA_TYPE REGPARM(1) glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
     target_ulong tlb_addr;
     target_phys_addr_t physaddr;
     void *retaddr;
-    
+
     /* test if there is match for unaligned or IO access */
     /* XXX: could done more in memory macro in a non portable way */
     index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
@@ -103,7 +103,7 @@ DATA_TYPE REGPARM(1) glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
 #ifdef ALIGNED_ONLY
             do_unaligned_access(addr, READ_ACCESS_TYPE, is_user, retaddr);
 #endif
-            res = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr, 
+            res = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr,
                                                          is_user, retaddr);
         } else {
             /* unaligned/aligned access in the same page */
@@ -129,7 +129,7 @@ DATA_TYPE REGPARM(1) glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
 }
 
 /* handle all unaligned cases */
-static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr, 
+static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
                                                         int is_user,
                                                         void *retaddr)
 {
@@ -153,9 +153,9 @@ static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
             /* slow unaligned access (it spans two pages) */
             addr1 = addr & ~(DATA_SIZE - 1);
             addr2 = addr1 + DATA_SIZE;
-            res1 = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr1, 
+            res1 = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr1,
                                                           is_user, retaddr);
-            res2 = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr2, 
+            res2 = glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(addr2,
                                                           is_user, retaddr);
             shift = (addr & (DATA_SIZE - 1)) * 8;
 #ifdef TARGET_WORDS_BIGENDIAN
@@ -178,12 +178,12 @@ static DATA_TYPE glue(glue(slow_ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
 
 #ifndef SOFTMMU_CODE_ACCESS
 
-static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr, 
-                                                   DATA_TYPE val, 
+static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr,
+                                                   DATA_TYPE val,
                                                    int is_user,
                                                    void *retaddr);
 
-static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr, 
+static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr,
                                           DATA_TYPE val,
                                           target_ulong tlb_addr,
                                           void *retaddr)
@@ -209,7 +209,7 @@ static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr,
 #endif
 }
 
-void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, 
+void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
                                                     DATA_TYPE val,
                                                     int is_user)
 {
@@ -217,7 +217,7 @@ void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
     target_ulong tlb_addr;
     void *retaddr;
     int index;
-    
+
     index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
  redo:
     tlb_addr = env->tlb_table[is_user][index].addr_write;
@@ -235,7 +235,7 @@ void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
 #ifdef ALIGNED_ONLY
             do_unaligned_access(addr, 1, is_user, retaddr);
 #endif
-            glue(glue(slow_st, SUFFIX), MMUSUFFIX)(addr, val, 
+            glue(glue(slow_st, SUFFIX), MMUSUFFIX)(addr, val,
                                                    is_user, retaddr);
         } else {
             /* aligned/unaligned access in the same page */
@@ -260,7 +260,7 @@ void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr,
 }
 
 /* handles all unaligned cases */
-static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr, 
+static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr,
                                                    DATA_TYPE val,
                                                    int is_user,
                                                    void *retaddr)
@@ -284,10 +284,10 @@ static void glue(glue(slow_st, SUFFIX), MMUSUFFIX)(target_ulong addr,
             /* XXX: not efficient, but simple */
             for(i = 0;i < DATA_SIZE; i++) {
 #ifdef TARGET_WORDS_BIGENDIAN
-                glue(slow_stb, MMUSUFFIX)(addr + i, val >> (((DATA_SIZE - 1) * 8) - (i * 8)), 
+                glue(slow_stb, MMUSUFFIX)(addr + i, val >> (((DATA_SIZE - 1) * 8) - (i * 8)),
                                           is_user, retaddr);
 #else
-                glue(slow_stb, MMUSUFFIX)(addr + i, val >> (i * 8), 
+                glue(slow_stb, MMUSUFFIX)(addr + i, val >> (i * 8),
                                           is_user, retaddr);
 #endif
             }
index 2be874ac94603375f2bcc9aa7042af92ca9dfde0..22b30183ea0dff11da2971c5de368c92d466a875 100644 (file)
@@ -359,7 +359,7 @@ sparc_opcode_lookup_arch (name)
 #define FBFCC(x)       (((x)&0x3)<<20) /* v9 */
 \f
 /* The order of the opcodes in the table is significant:
-       
+
        * The assembler requires that all instances of the same mnemonic must
        be consecutive. If they aren't, the assembler will bomb at runtime.
 
@@ -2341,16 +2341,16 @@ static int compute_arch_mask PARAMS ((unsigned long));
                         >> ((8 * sizeof (int)) - bits) )
 
 static  char *reg_names[] =
-{ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",      
-  "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",      
-  "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",      
-  "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",      
-  "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",      
-  "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",        
+{ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
+  "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
+  "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
+  "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",
+  "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+  "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
   "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
   "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
-  "f32", "f33", "f34", "f35", "f36", "f37", "f38", "f39",      
-  "f40", "f41", "f42", "f43", "f44", "f45", "f46", "f47",      
+  "f32", "f33", "f34", "f35", "f36", "f37", "f38", "f39",
+  "f40", "f41", "f42", "f43", "f44", "f45", "f46", "f47",
   "f48", "f49", "f50", "f51", "f52", "f53", "f54", "f55",
   "f56", "f57", "f58", "f59", "f60", "f61", "f62", "f63",
 /* psr, wim, tbr, fpsr, cpsr are v8 only.  */
@@ -2566,7 +2566,7 @@ print_insn_sparc (memaddr, info)
          /* Nonzero means that we have found a plus sign in the args
             field of the opcode table.  */
          int found_plus = 0;
-         
+
          /* Nonzero means we have an annulled branch.  */
          int is_annulled = 0;
 
@@ -2621,7 +2621,7 @@ print_insn_sparc (memaddr, info)
                  }             /* while there are comma started args */
 
                (*info->fprintf_func) (stream, " ");
-                       
+
                switch (*s)
                  {
                  case '+':
@@ -2722,7 +2722,7 @@ print_insn_sparc (memaddr, info)
                         not before it.  */
                      if (found_plus)
                        imm_added_to_rs1 = 1;
-                     
+
                      if (imm <= 9)
                        (*info->fprintf_func) (stream, "%d", imm);
                      else
@@ -2806,7 +2806,7 @@ print_insn_sparc (memaddr, info)
                  case 'o':
                    (*info->fprintf_func) (stream, "%%asi");
                    break;
-                   
+
                  case 'W':
                    (*info->fprintf_func) (stream, "%%tick");
                    break;
@@ -2859,15 +2859,15 @@ print_insn_sparc (memaddr, info)
                        (*info->fprintf_func) (stream, "%d", X_RD (insn));
                      break;
                    }
-                   
+
                  case 'M':
                    (*info->fprintf_func) (stream, "%%asr%d", X_RS1 (insn));
                    break;
-                   
+
                  case 'm':
                    (*info->fprintf_func) (stream, "%%asr%d", X_RD (insn));
                    break;
-                   
+
                  case 'L':
                    info->target = memaddr + SEX (X_DISP30 (insn), 30) * 4;
                    (*info->print_address_func) (info->target, info);
@@ -2999,7 +2999,7 @@ print_insn_sparc (memaddr, info)
                      && X_RD (prev_insn) == X_RS1 (insn))
                    {
                      (*info->fprintf_func) (stream, "\t! ");
-                     info->target = 
+                     info->target =
                        ((unsigned) 0xFFFFFFFF
                         & ((int) X_IMM22 (prev_insn) << 10));
                      if (imm_added_to_rs1)
index d84a622d355f94bdff1519d063190254bea23d5e..c900b4b767567cbc13c0e23e60c54b63c3b0c34d 100644 (file)
@@ -110,7 +110,7 @@ typedef struct tap_win32_overlapped {
 
 static tap_win32_overlapped_t tap_overlapped;
 
-static tun_buffer_t* get_buffer_from_free_list(tap_win32_overlapped_t* const overlapped) 
+static tun_buffer_t* get_buffer_from_free_list(tap_win32_overlapped_t* const overlapped)
 {
     tun_buffer_t* buffer = NULL;
     WaitForSingleObject(overlapped->free_list_semaphore, INFINITE);
@@ -132,18 +132,18 @@ static void put_buffer_on_free_list(tap_win32_overlapped_t* const overlapped, tu
     ReleaseSemaphore(overlapped->free_list_semaphore, 1, NULL);
 }
 
-static tun_buffer_t* get_buffer_from_output_queue(tap_win32_overlapped_t* const overlapped, const int block) 
+static tun_buffer_t* get_buffer_from_output_queue(tap_win32_overlapped_t* const overlapped, const int block)
 {
     tun_buffer_t* buffer = NULL;
     DWORD result, timeout = block ? INFINITE : 0L;
 
     // Non-blocking call
-    result = WaitForSingleObject(overlapped->output_queue_semaphore, timeout); 
+    result = WaitForSingleObject(overlapped->output_queue_semaphore, timeout);
 
-    switch (result) 
-    { 
+    switch (result)
+    {
         // The semaphore object was signaled.
-        case WAIT_OBJECT_0: 
+        case WAIT_OBJECT_0:
             EnterCriticalSection(&overlapped->output_queue_cs);
 
             buffer = overlapped->output_queue_front;
@@ -154,18 +154,18 @@ static tun_buffer_t* get_buffer_from_output_queue(tap_win32_overlapped_t* const
             }
 
             LeaveCriticalSection(&overlapped->output_queue_cs);
-            break; 
+            break;
 
         // Semaphore was nonsignaled, so a time-out occurred.
-        case WAIT_TIMEOUT: 
+        case WAIT_TIMEOUT:
             // Cannot open another window.
-            break; 
+            break;
     }
 
     return buffer;
 }
 
-static tun_buffer_t* get_buffer_from_output_queue_immediate (tap_win32_overlapped_t* const overlapped) 
+static tun_buffer_t* get_buffer_from_output_queue_immediate (tap_win32_overlapped_t* const overlapped)
 {
     return get_buffer_from_output_queue(overlapped, 0);
 }
@@ -332,7 +332,7 @@ static int get_device_guid(
             return -1;
         }
 
-        snprintf(connection_string, 
+        snprintf(connection_string,
              sizeof(connection_string),
              "%s\\%s\\Connection",
              NETWORK_CONNECTIONS_KEY, enum_name);
@@ -343,7 +343,7 @@ static int get_device_guid(
             0,
             KEY_READ,
             &connection_key);
-        
+
         if (status == ERROR_SUCCESS) {
             len = sizeof (name_data);
             status = RegQueryValueEx(
@@ -416,7 +416,7 @@ static void tap_win32_overlapped_init(tap_win32_overlapped_t* const overlapped,
     InitializeCriticalSection(&overlapped->output_queue_cs);
     InitializeCriticalSection(&overlapped->free_list_cs);
 
-    overlapped->output_queue_semaphore = CreateSemaphore( 
+    overlapped->output_queue_semaphore = CreateSemaphore(
         NULL,   // default security attributes
         0,   // initial count
         TUN_MAX_BUFFER_COUNT,   // maximum count
@@ -426,7 +426,7 @@ static void tap_win32_overlapped_init(tap_win32_overlapped_t* const overlapped,
         fprintf(stderr, "error creating output queue semaphore!\n");
     }
 
-    overlapped->free_list_semaphore = CreateSemaphore( 
+    overlapped->free_list_semaphore = CreateSemaphore(
         NULL,   // default security attributes
         TUN_MAX_BUFFER_COUNT,   // initial count
         TUN_MAX_BUFFER_COUNT,   // maximum count
@@ -452,7 +452,7 @@ static void tap_win32_overlapped_init(tap_win32_overlapped_t* const overlapped,
         fprintf(stderr, "error creating tap_semaphore.\n");
 }
 
-static int tap_win32_write(tap_win32_overlapped_t *overlapped, 
+static int tap_win32_write(tap_win32_overlapped_t *overlapped,
                            const void *buffer, unsigned long size)
 {
     unsigned long write_size;
@@ -467,18 +467,18 @@ static int tap_win32_write(tap_win32_overlapped_t *overlapped,
 
     result = WriteFile(overlapped->handle, buffer, size,
                        &write_size, &overlapped->write_overlapped);
-    
-    if (!result) { 
+
+    if (!result) {
         switch (error = GetLastError())
-        { 
-        case ERROR_IO_PENDING: 
+        {
+        case ERROR_IO_PENDING:
 #ifndef TUN_ASYNCHRONOUS_WRITES
             WaitForSingleObject(overlapped->write_event, INFINITE);
 #endif
             break;
         default:
             return -1;
-        } 
+        }
     }
 
     return 0;
@@ -539,7 +539,7 @@ static DWORD WINAPI tap_win32_thread_entry(LPVOID param)
     return 0;
 }
 
-static int tap_win32_read(tap_win32_overlapped_t *overlapped, 
+static int tap_win32_read(tap_win32_overlapped_t *overlapped,
                           uint8_t **pbuf, int max_size)
 {
     int size = 0;
@@ -557,14 +557,14 @@ static int tap_win32_read(tap_win32_overlapped_t *overlapped,
     return size;
 }
 
-static void tap_win32_free_buffer(tap_win32_overlapped_t *overlapped, 
-                                  char* pbuf) 
+static void tap_win32_free_buffer(tap_win32_overlapped_t *overlapped,
+                                  char* pbuf)
 {
     tun_buffer_t* buffer = (tun_buffer_t*)pbuf;
     put_buffer_on_free_list(overlapped, buffer);
 }
 
-static int tap_win32_open(tap_win32_overlapped_t **phandle, 
+static int tap_win32_open(tap_win32_overlapped_t **phandle,
                           const char *prefered_name)
 {
     char device_path[256];
@@ -660,7 +660,7 @@ static void tap_win32_send(void *opaque)
 int tap_win32_init(VLANState *vlan, const char *ifname)
 {
     TAPState *s;
-    
+
     s = qemu_mallocz(sizeof(TAPState));
     if (!s)
         return -1;
@@ -670,7 +670,7 @@ int tap_win32_init(VLANState *vlan, const char *ifname)
     }
 
     s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s);
-    
+
     snprintf(s->vc->info_str, sizeof(s->vc->info_str),
              "tap: ifname=%s", ifname);
 
index 3208c138b58a4c9e0b0e916cb7dc4341ed851d02..e8c994a89cd1b0ead27944cd75e1a3b6becbf48c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ARM virtual CPU header
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -59,11 +59,11 @@ typedef struct CPUARMState {
     uint32_t banked_spsr[6];
     uint32_t banked_r13[6];
     uint32_t banked_r14[6];
-    
+
     /* These hold r8-r12.  */
     uint32_t usr_regs[5];
     uint32_t fiq_regs[5];
-    
+
     /* cpsr flag cache for faster execution */
     uint32_t CF; /* 0 or 1 */
     uint32_t VF; /* V is the bit 31. All other bits are undefined */
@@ -111,7 +111,7 @@ typedef struct CPUARMState {
         /* Temporary variables if we don't have spare fp regs.  */
         float32 tmp0s, tmp1s;
         float64 tmp0d, tmp1d;
-        
+
         float_status fp_status;
     } vfp;
 
@@ -133,7 +133,7 @@ void switch_mode(CPUARMState *, int);
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
-int cpu_arm_signal_handler(int host_signum, void *pinfo, 
+int cpu_arm_signal_handler(int host_signum, void *pinfo,
                            void *puc);
 
 #define CPSR_M (0x1f)
@@ -155,7 +155,7 @@ static inline uint32_t cpsr_read(CPUARMState *env)
 {
     int ZF;
     ZF = (env->NZF == 0);
-    return env->uncached_cpsr | (env->NZF & 0x80000000) | (ZF << 30) | 
+    return env->uncached_cpsr | (env->NZF & 0x80000000) | (ZF << 30) |
         (env->CF << 29) | ((env->VF & 0x80000000) >> 3) | (env->QF << 27)
         | (env->thumb << 5);
 }
index deba89304c4a395d49730049e3cfe12e825bc6f8..a8f692a366c173d12c782e5dcaa9b192cc564c58 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ARM execution defines
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
index 5b4cd13933bebf3b9817244d49f2e40131d5e204..0c728b9c86de8950b9477ee0c8615f8e166cbaf9 100644 (file)
@@ -60,7 +60,7 @@ void cpu_arm_close(CPUARMState *env)
     free(env);
 }
 
-#if defined(CONFIG_USER_ONLY) 
+#if defined(CONFIG_USER_ONLY)
 
 void do_interrupt (CPUState *env)
 {
index 944083a43113561997e793311a1b46cf61263df3..dbd496ea6769bb14ae5eb7fe780233f756889d4e 100644 (file)
@@ -42,14 +42,14 @@ unsigned int DoubleCPDO(const unsigned int opcode)
    unsigned int Fd, Fm, Fn, nRc = 1;
 
    //printk("DoubleCPDO(0x%08x)\n",opcode);
-   
+
    Fm = getFm(opcode);
    if (CONSTANT_FM(opcode))
    {
      rFm = getDoubleConstant(Fm);
    }
    else
-   {  
+   {
      switch (fpa11->fType[Fm])
      {
         case typeSingle:
@@ -85,7 +85,7 @@ unsigned int DoubleCPDO(const unsigned int opcode)
         case typeDouble:
           rFn = fpa11->fpreg[Fn].fDouble;
         break;
-        
+
         default: return 0;
       }
    }
@@ -220,7 +220,7 @@ unsigned int DoubleCPDO(const unsigned int opcode)
 
       case NRM_CODE:
       break;
-      
+
       default:
       {
         nRc = 0;
@@ -286,11 +286,11 @@ return rFm;
 
 float64 float64_pow(float64 rFn,float64 rFm)
 {
-  return float64_exp(float64_mul(rFm,float64_ln(rFn))); 
+  return float64_exp(float64_mul(rFm,float64_ln(rFn)));
 }
 
 float64 float64_pol(float64 rFn,float64 rFm)
 {
-  return float64_arctan(float64_div(rFn,rFm)); 
+  return float64_arctan(float64_div(rFn,rFm));
 }
 #endif
index f5ef6231115a469950bba2cead511b24785c60bd..05e32b0734e4410637bbcaf1167bd41230ec9967 100644 (file)
@@ -42,14 +42,14 @@ unsigned int ExtendedCPDO(const unsigned int opcode)
    unsigned int Fd, Fm, Fn, nRc = 1;
 
    //printk("ExtendedCPDO(0x%08x)\n",opcode);
-   
+
    Fm = getFm(opcode);
    if (CONSTANT_FM(opcode))
    {
      rFm = getExtendedConstant(Fm);
    }
    else
-   {  
+   {
      switch (fpa11->fType[Fm])
      {
         case typeSingle:
@@ -59,15 +59,15 @@ unsigned int ExtendedCPDO(const unsigned int opcode)
         case typeDouble:
           rFm = float64_to_floatx80(fpa11->fpreg[Fm].fDouble, &fpa11->fp_status);
         break;
-        
+
         case typeExtended:
           rFm = fpa11->fpreg[Fm].fExtended;
         break;
-        
+
         default: return 0;
      }
    }
-   
+
    if (!MONADIC_INSTRUCTION(opcode))
    {
       Fn = getFn(opcode);
@@ -80,11 +80,11 @@ unsigned int ExtendedCPDO(const unsigned int opcode)
         case typeDouble:
           rFn = float64_to_floatx80(fpa11->fpreg[Fn].fDouble, &fpa11->fp_status);
         break;
-        
+
         case typeExtended:
           rFn = fpa11->fpreg[Fn].fExtended;
         break;
-        
+
         default: return 0;
       }
    }
@@ -204,13 +204,13 @@ unsigned int ExtendedCPDO(const unsigned int opcode)
 
       case NRM_CODE:
       break;
-      
+
       default:
       {
         nRc = 0;
       }
    }
-   
+
    if (0 != nRc) fpa11->fType[Fd] = typeExtended;
    return nRc;
 }
@@ -263,11 +263,11 @@ floatx80 floatx80_arccos(floatx80 rFm)
 
 floatx80 floatx80_pow(floatx80 rFn,floatx80 rFm)
 {
-  return floatx80_exp(floatx80_mul(rFm,floatx80_ln(rFn))); 
+  return floatx80_exp(floatx80_mul(rFm,floatx80_ln(rFn)));
 }
 
 floatx80 floatx80_pol(floatx80 rFn,floatx80 rFm)
 {
-  return floatx80_arctan(floatx80_div(rFn,rFm)); 
+  return floatx80_arctan(floatx80_div(rFn,rFm));
 }
 #endif
index a8141e7e56a63c68b727b9592b6b4c6cb6cc30a3..6b435002e52e4e6bf214e72eae6e7660acaaa508 100644 (file)
@@ -43,16 +43,16 @@ void resetFPA11(void)
 {
   int i;
   FPA11 *fpa11 = GET_FPA11();
-  
+
   /* initialize the register type array */
   for (i=0;i<=7;i++)
   {
     fpa11->fType[i] = typeNone;
   }
-  
+
   /* FPSR: set system id to FP_EMULATOR, set AC, clear all other bits */
   fpa11->fpsr = FP_EMULATOR | BIT_AC;
-  
+
   /* FPCR: set SB, AB and DA bits, clear all others */
 #if MAINTAIN_FPCR
   fpa11->fpcr = MASK_RESET;
@@ -66,36 +66,36 @@ void SetRoundingMode(const unsigned int opcode)
 
 #if MAINTAIN_FPCR
    fpa11->fpcr &= ~MASK_ROUNDING_MODE;
-#endif   
+#endif
    switch (opcode & MASK_ROUNDING_MODE)
    {
       default:
       case ROUND_TO_NEAREST:
          rounding_mode = float_round_nearest_even;
-#if MAINTAIN_FPCR         
+#if MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_TO_NEAREST;
-#endif         
+#endif
       break;
-      
+
       case ROUND_TO_PLUS_INFINITY:
          rounding_mode = float_round_up;
-#if MAINTAIN_FPCR         
+#if MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_TO_PLUS_INFINITY;
-#endif         
+#endif
       break;
-      
+
       case ROUND_TO_MINUS_INFINITY:
          rounding_mode = float_round_down;
-#if MAINTAIN_FPCR         
+#if MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_TO_MINUS_INFINITY;
-#endif         
+#endif
       break;
-      
+
       case ROUND_TO_ZERO:
          rounding_mode = float_round_to_zero;
-#if MAINTAIN_FPCR         
+#if MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_TO_ZERO;
-#endif         
+#endif
       break;
   }
    set_float_rounding_mode(rounding_mode, &fpa11->fp_status);
@@ -107,30 +107,30 @@ void SetRoundingPrecision(const unsigned int opcode)
    FPA11 *fpa11 = GET_FPA11();
 #if MAINTAIN_FPCR
    fpa11->fpcr &= ~MASK_ROUNDING_PRECISION;
-#endif   
+#endif
    switch (opcode & MASK_ROUNDING_PRECISION)
    {
       case ROUND_SINGLE:
          rounding_precision = 32;
-#if MAINTAIN_FPCR         
+#if MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_SINGLE;
-#endif         
+#endif
       break;
-      
+
       case ROUND_DOUBLE:
          rounding_precision = 64;
-#if MAINTAIN_FPCR         
+#if MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_DOUBLE;
-#endif         
+#endif
       break;
-      
+
       case ROUND_EXTENDED:
          rounding_precision = 80;
-#if MAINTAIN_FPCR         
+#if MAINTAIN_FPCR
          fpa11->fpcr |= ROUND_EXTENDED;
-#endif         
+#endif
       break;
-      
+
       default: rounding_precision = 80;
   }
    set_floatx80_rounding_precision(rounding_precision, &fpa11->fp_status);
@@ -142,12 +142,12 @@ unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs)
 {
   unsigned int nRc = 0;
 //  unsigned long flags;
-  FPA11 *fpa11; 
+  FPA11 *fpa11;
 //  save_flags(flags); sti();
 
   qemufpa=qfpa;
   user_registers=qregs;
-  
+
 #if 0
   fprintf(stderr,"emulating FP insn 0x%08x, PC=0x%08x\n",
           opcode, qregs[REG_PC]);
@@ -222,14 +222,14 @@ unsigned int EmulateAll1(unsigned int opcode)
           }
       }
      break;
-     
-     case 0xe: 
+
+     case 0xe:
        if (opcode & 0x10)
          return EmulateCPDO(opcode);
        else
          return EmulateCPRT(opcode);
      break;
-  
+
      default: return 0;
   }
 }
index 8751696de964966505f3d45df5d78e4a79bc8944..4fc0b3b886fa367539d8e47e96b7afb94dada0eb 100644 (file)
@@ -1,7 +1,7 @@
 /*
     NetWinder Floating Point Emulator
     (c) Rebel.com, 1998-1999
-    
+
     Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
 
     This program is free software; you can redistribute it and/or modify
index cc8aa87c6ec77e6e6929b25ca933f171b0867310..777963728f9882070f4d799c9059fa873c825c23 100644 (file)
@@ -30,26 +30,26 @@ unsigned int EmulateCPDO(const unsigned int opcode)
 {
    FPA11 *fpa11 = GET_FPA11();
    unsigned int Fd, nType, nDest, nRc = 1;
-   
+
    //printk("EmulateCPDO(0x%08x)\n",opcode);
 
    /* Get the destination size.  If not valid let Linux perform
       an invalid instruction trap. */
    nDest = getDestinationSize(opcode);
    if (typeNone == nDest) return 0;
-   
+
    SetRoundingMode(opcode);
-     
+
    /* Compare the size of the operands in Fn and Fm.
       Choose the largest size and perform operations in that size,
-      in order to make use of all the precision of the operands. 
-      If Fm is a constant, we just grab a constant of a size 
+      in order to make use of all the precision of the operands.
+      If Fm is a constant, we just grab a constant of a size
       matching the size of the operand in Fn. */
    if (MONADIC_INSTRUCTION(opcode))
      nType = nDest;
    else
      nType = fpa11->fType[getFn(opcode)];
-   
+
    if (!CONSTANT_FM(opcode))
    {
      register unsigned int Fm = getFm(opcode);
@@ -79,39 +79,39 @@ unsigned int EmulateCPDO(const unsigned int opcode)
        case typeSingle:
        {
          if (typeDouble == nType)
-           fpa11->fpreg[Fd].fSingle = 
+           fpa11->fpreg[Fd].fSingle =
               float64_to_float32(fpa11->fpreg[Fd].fDouble, &fpa11->fp_status);
          else
-           fpa11->fpreg[Fd].fSingle = 
+           fpa11->fpreg[Fd].fSingle =
               floatx80_to_float32(fpa11->fpreg[Fd].fExtended, &fpa11->fp_status);
        }
        break;
-          
+
        case typeDouble:
        {
          if (typeSingle == nType)
-           fpa11->fpreg[Fd].fDouble = 
+           fpa11->fpreg[Fd].fDouble =
               float32_to_float64(fpa11->fpreg[Fd].fSingle, &fpa11->fp_status);
          else
-           fpa11->fpreg[Fd].fDouble = 
+           fpa11->fpreg[Fd].fDouble =
               floatx80_to_float64(fpa11->fpreg[Fd].fExtended, &fpa11->fp_status);
        }
        break;
-          
+
        case typeExtended:
        {
          if (typeSingle == nType)
-           fpa11->fpreg[Fd].fExtended = 
+           fpa11->fpreg[Fd].fExtended =
               float32_to_floatx80(fpa11->fpreg[Fd].fSingle, &fpa11->fp_status);
          else
-           fpa11->fpreg[Fd].fExtended = 
+           fpa11->fpreg[Fd].fExtended =
               float64_to_floatx80(fpa11->fpreg[Fd].fDouble, &fpa11->fp_status);
        }
        break;
      }
-     
+
      fpa11->fType[Fd] = nDest;
    }
-   
+
    return nRc;
 }
index 914a86fbc07cdbbd4bbd13d20cf001bdd5884e02..cae2922e0d75a5576984a5f8d479f7c09d99e2b1 100644 (file)
@@ -52,7 +52,7 @@ void loadDouble(const unsigned int Fn,const unsigned int *pMem)
    p[0] = tget32(addr + 4);
    p[1] = tget32(addr); /* sign & exponent */
 #endif
-}   
+}
 
 static inline
 void loadExtended(const unsigned int Fn,const unsigned int *pMem)
@@ -65,7 +65,7 @@ void loadExtended(const unsigned int Fn,const unsigned int *pMem)
    p[0] = tget32(addr);  /* sign & exponent */
    p[1] = tget32(addr + 8);  /* ls bits */
    p[2] = tget32(addr + 4);  /* ms bits */
-}   
+}
 
 static inline
 void loadMultiple(const unsigned int Fn,const unsigned int *pMem)
@@ -78,7 +78,7 @@ void loadMultiple(const unsigned int Fn,const unsigned int *pMem)
    p = (unsigned int*)&(fpa11->fpreg[Fn]);
    x = tget32(addr);
    fpa11->fType[Fn] = (x >> 14) & 0x00000003;
-   
+
    switch (fpa11->fType[Fn])
    {
       case typeSingle:
@@ -88,13 +88,13 @@ void loadMultiple(const unsigned int Fn,const unsigned int *pMem)
          p[1] = tget32(addr + 4);  /* double msw */
          p[2] = 0;        /* empty */
       }
-      break; 
-   
+      break;
+
       case typeExtended:
       {
          p[1] = tget32(addr + 8);
          p[2] = tget32(addr + 4);  /* msw */
-         p[0] = (x & 0x80003fff);      
+         p[0] = (x & 0x80003fff);
       }
       break;
    }
@@ -107,22 +107,22 @@ void storeSingle(const unsigned int Fn,unsigned int *pMem)
    FPA11 *fpa11 = GET_FPA11();
    float32 val;
    register unsigned int *p = (unsigned int*)&val;
-   
+
    switch (fpa11->fType[Fn])
    {
-      case typeDouble: 
+      case typeDouble:
          val = float64_to_float32(fpa11->fpreg[Fn].fDouble, &fpa11->fp_status);
       break;
 
-      case typeExtended: 
+      case typeExtended:
          val = floatx80_to_float32(fpa11->fpreg[Fn].fExtended, &fpa11->fp_status);
       break;
 
       default: val = fpa11->fpreg[Fn].fSingle;
    }
-  
+
    tput32(addr, p[0]);
-}   
+}
 
 static inline
 void storeDouble(const unsigned int Fn,unsigned int *pMem)
@@ -134,7 +134,7 @@ void storeDouble(const unsigned int Fn,unsigned int *pMem)
 
    switch (fpa11->fType[Fn])
    {
-      case typeSingle: 
+      case typeSingle:
          val = float32_to_float64(fpa11->fpreg[Fn].fSingle, &fpa11->fp_status);
       break;
 
@@ -151,7 +151,7 @@ void storeDouble(const unsigned int Fn,unsigned int *pMem)
    tput32(addr, p[1]); /* msw */
    tput32(addr + 4, p[0]);     /* lsw */
 #endif
-}   
+}
 
 static inline
 void storeExtended(const unsigned int Fn,unsigned int *pMem)
@@ -160,24 +160,24 @@ void storeExtended(const unsigned int Fn,unsigned int *pMem)
    FPA11 *fpa11 = GET_FPA11();
    floatx80 val;
    register unsigned int *p = (unsigned int*)&val;
-   
+
    switch (fpa11->fType[Fn])
    {
-      case typeSingle: 
+      case typeSingle:
          val = float32_to_floatx80(fpa11->fpreg[Fn].fSingle, &fpa11->fp_status);
       break;
 
-      case typeDouble: 
+      case typeDouble:
          val = float64_to_floatx80(fpa11->fpreg[Fn].fDouble, &fpa11->fp_status);
       break;
 
       default: val = fpa11->fpreg[Fn].fExtended;
    }
-   
+
    tput32(addr, p[0]); /* sign & exp */
    tput32(addr + 8, p[1]);
    tput32(addr + 4, p[2]); /* msw */
-}   
+}
 
 static inline
 void storeMultiple(const unsigned int Fn,unsigned int *pMem)
@@ -185,10 +185,10 @@ void storeMultiple(const unsigned int Fn,unsigned int *pMem)
    target_ulong addr = (target_ulong)(long)pMem;
    FPA11 *fpa11 = GET_FPA11();
    register unsigned int nType, *p;
-   
+
    p = (unsigned int*)&(fpa11->fpreg[Fn]);
    nType = fpa11->fType[Fn];
-   
+
    switch (nType)
    {
       case typeSingle:
@@ -198,8 +198,8 @@ void storeMultiple(const unsigned int Fn,unsigned int *pMem)
         tput32(addr + 4, p[1]); /* double msw */
         tput32(addr, nType << 14);
       }
-      break; 
-   
+      break;
+
       case typeExtended:
       {
         tput32(addr + 4, p[2]); /* msw */
@@ -239,7 +239,7 @@ unsigned int PerformLDF(const unsigned int opcode)
       case TRANSFER_EXTENDED: loadExtended(getFd(opcode),pAddress); break;
       default: nRc = 0;
    }
-   
+
    if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal);
    return nRc;
 }
@@ -248,10 +248,10 @@ unsigned int PerformSTF(const unsigned int opcode)
 {
    unsigned int *pBase, *pAddress, *pFinal, nRc = 1,
      write_back = WRITE_BACK(opcode);
-   
+
    //printk("PerformSTF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode));
    SetRoundingMode(ROUND_TO_NEAREST);
-   
+
    pBase = (unsigned int*)readRegister(getRn(opcode));
    if (REG_PC == getRn(opcode))
    {
@@ -274,7 +274,7 @@ unsigned int PerformSTF(const unsigned int opcode)
       case TRANSFER_EXTENDED: storeExtended(getFd(opcode),pAddress); break;
       default: nRc = 0;
    }
-   
+
    if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal);
    return nRc;
 }
@@ -315,14 +315,14 @@ unsigned int PerformSFM(const unsigned int opcode)
 {
    unsigned int i, Fd, *pBase, *pAddress, *pFinal,
      write_back = WRITE_BACK(opcode);
-   
+
    pBase = (unsigned int*)readRegister(getRn(opcode));
    if (REG_PC == getRn(opcode))
    {
      pBase += 2;
      write_back = 0;
    }
-   
+
    pFinal = pBase;
    if (BIT_UP_SET(opcode))
      pFinal += getOffset(opcode);
@@ -349,7 +349,7 @@ unsigned int EmulateCPDT(const unsigned int opcode)
   unsigned int nRc = 0;
 
   //printk("EmulateCPDT(0x%08x)\n",opcode);
-  
+
   if (LDF_OP(opcode))
   {
     nRc = PerformLDF(opcode);
@@ -361,7 +361,7 @@ unsigned int EmulateCPDT(const unsigned int opcode)
   else if (STF_OP(opcode))
   {
     nRc = PerformSTF(opcode);
-  } 
+  }
   else if (SFM_OP(opcode))
   {
     nRc = PerformSFM(opcode);
@@ -370,7 +370,7 @@ unsigned int EmulateCPDT(const unsigned int opcode)
   {
     nRc = 0;
   }
-  
+
   return nRc;
 }
 #endif
index 3be9b42a9057712460ad6b32bd63ed640bf046c1..04eae8c6fc58572c56b1c922664d893e9dad55ec 100644 (file)
@@ -55,7 +55,7 @@ unsigned int EmulateCPRT(const unsigned int opcode)
   {
     case  FLT_CODE >> 20: nRc = PerformFLT(opcode); break;
     case  FIX_CODE >> 20: nRc = PerformFIX(opcode); break;
-    
+
     case  WFS_CODE >> 20: writeFPSR(readRegister(getRd(opcode))); break;
     case  RFS_CODE >> 20: writeRegister(getRd(opcode),readFPSR()); break;
 
@@ -67,14 +67,14 @@ unsigned int EmulateCPRT(const unsigned int opcode)
 
     default: nRc = 0;
   }
-  
+
   return nRc;
 }
 
 unsigned int PerformFLT(const unsigned int opcode)
 {
    FPA11 *fpa11 = GET_FPA11();
-   
+
    unsigned int nRc = 1;
    SetRoundingMode(opcode);
 
@@ -95,7 +95,7 @@ unsigned int PerformFLT(const unsigned int opcode)
             int32_to_float64(readRegister(getRd(opcode)), &fpa11->fp_status);
       }
       break;
-        
+
       case ROUND_EXTENDED:
       {
         fpa11->fType[getFn(opcode)] = typeExtended;
@@ -103,10 +103,10 @@ unsigned int PerformFLT(const unsigned int opcode)
           int32_to_floatx80(readRegister(getRd(opcode)), &fpa11->fp_status);
       }
       break;
-      
+
       default: nRc = 0;
   }
-  
+
   return nRc;
 }
 
@@ -115,7 +115,7 @@ unsigned int PerformFIX(const unsigned int opcode)
    FPA11 *fpa11 = GET_FPA11();
    unsigned int nRc = 1;
    unsigned int Fn = getFm(opcode);
-   
+
    SetRoundingMode(opcode);
 
    switch (fpa11->fType[Fn])
@@ -134,21 +134,21 @@ unsigned int PerformFIX(const unsigned int opcode)
                       float64_to_int32(fpa11->fpreg[Fn].fDouble, &fpa11->fp_status));
       }
       break;
-                      
+
       case typeExtended:
       {
          writeRegister(getRd(opcode),
                       floatx80_to_int32(fpa11->fpreg[Fn].fExtended, &fpa11->fp_status));
       }
       break;
-      
+
       default: nRc = 0;
   }
-  
+
   return nRc;
 }
 
-   
+
 static unsigned int __inline__
 PerformComparisonOperation(floatx80 Fn, floatx80 Fm)
 {
@@ -160,7 +160,7 @@ PerformComparisonOperation(floatx80 Fn, floatx80 Fm)
    {
       flags |= CC_NEGATIVE;
    }
-  
+
    /* test for equal condition */
    if (floatx80_eq(Fn,Fm, &fpa11->fp_status))
    {
@@ -172,13 +172,13 @@ PerformComparisonOperation(floatx80 Fn, floatx80 Fm)
    {
       flags |= CC_CARRY;
    }
-   
+
    writeConditionCodes(flags);
    return 1;
 }
 
 /* This instruction sets the flags N, Z, C, V in the FPSR. */
-   
+
 static unsigned int PerformComparison(const unsigned int opcode)
 {
    FPA11 *fpa11 = GET_FPA11();
@@ -200,27 +200,27 @@ static unsigned int PerformComparison(const unsigned int opcode)
       comparison (cheaper than an 80-bit one).  */
    switch (fpa11->fType[Fn])
    {
-      case typeSingle: 
+      case typeSingle:
         //printk("single.\n");
        if (float32_is_nan(fpa11->fpreg[Fn].fSingle))
           goto unordered;
         rFn = float32_to_floatx80(fpa11->fpreg[Fn].fSingle, &fpa11->fp_status);
       break;
 
-      case typeDouble: 
+      case typeDouble:
         //printk("double.\n");
        if (float64_is_nan(fpa11->fpreg[Fn].fDouble))
           goto unordered;
         rFn = float64_to_floatx80(fpa11->fpreg[Fn].fDouble, &fpa11->fp_status);
       break;
-      
-      case typeExtended: 
+
+      case typeExtended:
         //printk("extended.\n");
        if (floatx80_is_nan(fpa11->fpreg[Fn].fExtended))
           goto unordered;
         rFn = fpa11->fpreg[Fn].fExtended;
       break;
-      
+
       default: return 0;
    }
 
@@ -236,27 +236,27 @@ static unsigned int PerformComparison(const unsigned int opcode)
      //printk("Fm = r%d which contains a ",Fm);
       switch (fpa11->fType[Fm])
       {
-         case typeSingle: 
+         case typeSingle:
            //printk("single.\n");
           if (float32_is_nan(fpa11->fpreg[Fm].fSingle))
              goto unordered;
            rFm = float32_to_floatx80(fpa11->fpreg[Fm].fSingle, &fpa11->fp_status);
          break;
 
-         case typeDouble: 
+         case typeDouble:
            //printk("double.\n");
           if (float64_is_nan(fpa11->fpreg[Fm].fDouble))
              goto unordered;
            rFm = float64_to_floatx80(fpa11->fpreg[Fm].fDouble, &fpa11->fp_status);
          break;
-      
-         case typeExtended: 
+
+         case typeExtended:
            //printk("extended.\n");
           if (floatx80_is_nan(fpa11->fpreg[Fm].fExtended))
              goto unordered;
            rFm = fpa11->fpreg[Fm].fExtended;
          break;
-      
+
          default: return 0;
       }
    }
index d29e913f4658ab8ef318eec96c58d6fcd0202a6c..a733a1d1de08a9ca7c2be8f59fe0cfab9f32f42b 100644 (file)
@@ -35,7 +35,7 @@ const floatx80 floatx80Constant[] = {
   { 0xa000000000000000ULL, 0x4001},    /* extended 5.0 */
   { 0x8000000000000000ULL, 0x3ffe},    /* extended 0.5 */
   { 0xa000000000000000ULL, 0x4002}     /* extended 10.0 */
-};  
+};
 
 const float64 float64Constant[] = {
   0x0000000000000000ULL,               /* double 0.0 */
@@ -46,7 +46,7 @@ const float64 float64Constant[] = {
   0x4014000000000000ULL,               /* double 5.0 */
   0x3fe0000000000000ULL,               /* double 0.5 */
   0x4024000000000000ULL                        /* double 10.0 */
-};  
+};
 
 const float32 float32Constant[] = {
   0x00000000,                          /* single 0.0 */
@@ -57,12 +57,12 @@ const float32 float32Constant[] = {
   0x40a00000,                          /* single 5.0 */
   0x3f000000,                          /* single 0.5 */
   0x41200000                           /* single 10.0 */
-};  
+};
 
 unsigned int getTransferLength(const unsigned int opcode)
 {
   unsigned int nRc;
-  
+
   switch (opcode & MASK_TRANSFER_LENGTH)
   {
     case 0x00000000: nRc = 1; break; /* single precision */
@@ -70,14 +70,14 @@ unsigned int getTransferLength(const unsigned int opcode)
     case 0x00400000: nRc = 3; break; /* extended precision */
     default: nRc = 0;
   }
-  
+
   return(nRc);
 }
 
 unsigned int getRegisterCount(const unsigned int opcode)
 {
   unsigned int nRc;
-  
+
   switch (opcode & MASK_REGISTER_COUNT)
   {
     case 0x00000000: nRc = 4; break;
@@ -86,14 +86,14 @@ unsigned int getRegisterCount(const unsigned int opcode)
     case 0x00408000: nRc = 3; break;
     default: nRc = 0;
   }
-  
+
   return(nRc);
 }
 
 unsigned int getRoundingPrecision(const unsigned int opcode)
 {
   unsigned int nRc;
-  
+
   switch (opcode & MASK_ROUNDING_PRECISION)
   {
     case 0x00000000: nRc = 1; break;
@@ -101,14 +101,14 @@ unsigned int getRoundingPrecision(const unsigned int opcode)
     case 0x00080000: nRc = 3; break;
     default: nRc = 0;
   }
-  
+
   return(nRc);
 }
 
 unsigned int getDestinationSize(const unsigned int opcode)
 {
   unsigned int nRc;
-  
+
   switch (opcode & MASK_DESTINATION_SIZE)
   {
     case 0x00000000: nRc = typeSingle; break;
@@ -116,7 +116,7 @@ unsigned int getDestinationSize(const unsigned int opcode)
     case 0x00080000: nRc = typeExtended; break;
     default: nRc = typeNone;
   }
-  
+
   return(nRc);
 }
 
index 13c7419262ab7197bb32a64ce92772b5927c9ec3..6c51067b6ca80bc9243f1e36775f17199d2b5201 100644 (file)
 
 /*
 ARM Floating Point Instruction Classes
-| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 
+| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
 |c o n d|1 1 0 P|U|u|W|L|   Rn  |v|  Fd |0|0|0|1|  o f f s e t  | CPDT
 |c o n d|1 1 0 P|U|w|W|L|   Rn  |x|  Fd |0|0|0|1|  o f f s e t  | CPDT
-| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 
+| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
 |c o n d|1 1 1 0|a|b|c|d|e|  Fn |j|  Fd |0|0|0|1|f|g|h|0|i|  Fm | CPDO
 |c o n d|1 1 1 0|a|b|c|L|e|  Fn |   Rd  |0|0|0|1|f|g|h|1|i|  Fm | CPRT
 |c o n d|1 1 1 0|a|b|c|1|e|  Fn |1|1|1|1|0|0|0|1|f|g|h|1|i|  Fm | comparisons
-| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 
+| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
 
 CPDT           data transfer instructions
                LDF, STF, LFM, SFM
-               
+
 CPDO           dyadic arithmetic instructions
                ADF, MUF, SUF, RSF, DVF, RDF,
                POW, RPW, RMF, FML, FDV, FRD, POL
@@ -43,7 +43,7 @@ CPDO          dyadic arithmetic instructions
 CPDO           monadic arithmetic instructions
                MVF, MNF, ABS, RND, SQT, LOG, LGN, EXP,
                SIN, COS, TAN, ASN, ACS, ATN, URD, NRM
-               
+
 CPRT           joint arithmetic/data transfer instructions
                FIX (arithmetic followed by load/store)
                FLT (load/store followed by arithmetic)
@@ -57,7 +57,7 @@ U             up/down bit: 0 = stack grows down, 1 = stack grows up
 W              write back bit: 1 = update base register (Rn)
 L              load/store bit: 0 = store, 1 = load
 Rn             base register
-Rd             destination/source register             
+Rd             destination/source register
 Fd             floating point destination register
 Fn             floating point source register
 Fm             floating point source register or floating point constant
@@ -370,19 +370,19 @@ static inline const floatx80 getExtendedConstant(const unsigned int nIndex)
 {
    extern const floatx80 floatx80Constant[];
    return floatx80Constant[nIndex];
-} 
+}
 
 static inline const float64 getDoubleConstant(const unsigned int nIndex)
 {
    extern const float64 float64Constant[];
    return float64Constant[nIndex];
-} 
+}
 
 static inline const float32 getSingleConstant(const unsigned int nIndex)
 {
    extern const float32 float32Constant[];
    return float32Constant[nIndex];
-} 
+}
 
 extern unsigned int getRegisterCount(const unsigned int opcode);
 extern unsigned int getDestinationSize(const unsigned int opcode);
index 6dafb0f5243cae5bef2b7d8077fbc3d1d24df125..0c665431ebc4750e733cd690cadfa6a23dde2047 100644 (file)
@@ -30,7 +30,7 @@ one byte.
        EXCEPTION TRAP ENABLE BYTE
        SYSTEM CONTROL BYTE
        CUMULATIVE EXCEPTION FLAGS BYTE
-       
+
 The FPCR is a 32 bit register consisting of bit flags.
 */
 
@@ -43,7 +43,7 @@ typedef unsigned int FPCR;  /* type for floating point control register */
 
 #define MASK_SYSID             0xff000000
 #define BIT_HARDWARE           0x80000000
-#define FP_EMULATOR            0x01000000      /* System ID for emulator */ 
+#define FP_EMULATOR            0x01000000      /* System ID for emulator */
 #define FP_ACCELERATOR         0x81000000      /* System ID for FPA11 */
 
 /* EXCEPTION TRAP ENABLE BYTE
index 7dd2620f21eb5046c0488bd4b903ea721360edce..1482f47120f03504aa110eb0b2f64570a53fc6be 100644 (file)
@@ -47,13 +47,13 @@ unsigned int SingleCPDO(const unsigned int opcode)
      rFm = getSingleConstant(Fm);
    }
    else
-   {  
+   {
      switch (fpa11->fType[Fm])
      {
         case typeSingle:
           rFm = fpa11->fpreg[Fm].fSingle;
         break;
-        
+
         default: return 0;
      }
    }
@@ -186,7 +186,7 @@ unsigned int SingleCPDO(const unsigned int opcode)
 
       case NRM_CODE:
       break;
-      
+
       default:
       {
         nRc = 0;
@@ -245,11 +245,11 @@ float32 float32_tan(float32 rFm)
 
 float32 float32_pow(float32 rFn,float32 rFm)
 {
-  return float32_exp(float32_mul(rFm,float32_ln(rFn))); 
+  return float32_exp(float32_mul(rFm,float32_ln(rFn)));
 }
 
 float32 float32_pol(float32 rFn,float32 rFm)
 {
-  return float32_arctan(float32_div(rFn,rFm)); 
+  return float32_arctan(float32_div(rFn,rFm));
 }
 #endif
index f17b812737cb681bc6912af5b829e501be35b74e..d681d44027bd8d97cbda87950af81cd71576fee9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ARM micro operations
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *  Copyright (c) 2005 CodeSourcery, LLC
  *
@@ -774,7 +774,7 @@ void OPPROTO op_addl_T0_T1_saturate(void)
   }
   else
     T0 = res;
-  
+
   FORCE_RET();
 }
 
@@ -792,7 +792,7 @@ void OPPROTO op_subl_T0_T1_saturate(void)
   }
   else
     T0 = res;
-  
+
   FORCE_RET();
 }
 
@@ -1127,7 +1127,7 @@ void OPPROTO op_vfp_msr(void)
 void OPPROTO op_vfp_mrrd(void)
 {
     CPU_DoubleU u;
-    
+
     u.d = FT0d;
     T0 = u.l.lower;
     T1 = u.l.upper;
@@ -1136,7 +1136,7 @@ void OPPROTO op_vfp_mrrd(void)
 void OPPROTO op_vfp_mdrr(void)
 {
     CPU_DoubleU u;
-    
+
     u.l.lower = T0;
     u.l.upper = T1;
     FT0d = u.d;
index af5c61d0b41b814dfe4584294eaa0b74b98a1b3d..c861bf7e4c391ed3b9b28b91a62ca8373f81d4a3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ARM helper routines
- * 
+ *
  *  Copyright (c) 2005 CodeSourcery, LLC
  *
  * This library is free software; you can redistribute it and/or
index fb2add15d567058671cff9103cb0b942414ac665..33d53c05a3baef50f873deb3001516a96a3d7138 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  ARM micro operations (templates for various register related
  *  operations)
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
index cd91bdce8deacf6137436cad0d1f7d695a10aacf..6a1afa6420ad74d701df32d16c6d359182455078 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ARM translation
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *  Copyright (c) 2005 CodeSourcery, LLC
  *
@@ -114,7 +114,7 @@ const uint8_t table_logic_cc[16] = {
     1, /* bic */
     1, /* mvn */
 };
-    
+
 static GenOpFunc1 *gen_shift_T1_im[4] = {
     gen_op_shll_T1_im,
     gen_op_shrl_T1_im,
@@ -387,7 +387,7 @@ static inline void gen_add_datah_offset(DisasContext *s, unsigned int insn,
                                         int extra)
 {
     int val, rm;
-    
+
     if (insn & (1 << 22)) {
         /* immediate */
         val = (insn & 0xf) | ((insn >> 4) & 0xf0);
@@ -687,7 +687,7 @@ static int disas_vfp_insn(CPUState * env, DisasContext *s, uint32_t insn)
             delta_m = 0;
             delta_d = 0;
             bank_mask = 0;
-            
+
             if (veclen > 0) {
                 if (dp)
                     bank_mask = 0xc;
@@ -1108,10 +1108,10 @@ static void gen_exception_return(DisasContext *s)
 static void disas_arm_insn(CPUState * env, DisasContext *s)
 {
     unsigned int cond, insn, val, op1, i, shift, rm, rs, rn, rd, sh;
-    
+
     insn = ldl_code(s->pc);
     s->pc += 4;
-    
+
     cond = insn >> 28;
     if (cond == 0xf){
         /* Unconditional instructions.  */
@@ -1299,7 +1299,7 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
                 (insn & 0x00000090) != 0x90) ||
                ((insn & 0x0e000000) == (1 << 25))) {
         int set_cc, logic_cc, shiftop;
-        
+
         op1 = (insn >> 21) & 0xf;
         set_cc = (insn >> 20) & 1;
         logic_cc = table_logic_cc[op1] & set_cc;
@@ -1490,14 +1490,14 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
                             gen_movl_T1_reg(s, rn);
                             gen_op_addl_T0_T1();
                         }
-                        if (insn & (1 << 20)) 
+                        if (insn & (1 << 20))
                             gen_op_logic_T0_cc();
                         gen_movl_reg_T0(s, rd);
                     } else {
                         /* 64 bit mul */
                         gen_movl_T0_reg(s, rs);
                         gen_movl_T1_reg(s, rm);
-                        if (insn & (1 << 22)) 
+                        if (insn & (1 << 22))
                             gen_op_imull_T0_T1();
                         else
                             gen_op_mull_T0_T1();
@@ -1508,7 +1508,7 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
                             gen_op_addq_lo_T0_T1(rn);
                             gen_op_addq_lo_T0_T1(rd);
                         }
-                        if (insn & (1 << 20)) 
+                        if (insn & (1 << 20))
                             gen_op_logicq_cc();
                         gen_movl_reg_T0(s, rn);
                         gen_movl_reg_T1(s, rd);
@@ -1522,7 +1522,7 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
                     } else {
                         /* SWP instruction */
                         rm = (insn) & 0xf;
-                        
+
                         gen_movl_T0_reg(s, rm);
                         gen_movl_T1_reg(s, rn);
                         if (insn & (1 << 22)) {
@@ -1679,7 +1679,7 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
                 }
                 rn = (insn >> 16) & 0xf;
                 gen_movl_T1_reg(s, rn);
-                
+
                 /* compute total size */
                 loaded_base = 0;
                 n = 0;
@@ -1777,7 +1777,7 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
         case 0xb:
             {
                 int32_t offset;
-                
+
                 /* branch (and link) */
                 val = (int32_t)s->pc;
                 if (insn & (1 << 24)) {
@@ -2362,7 +2362,7 @@ static void disas_thumb_insn(DisasContext *s)
         val = (uint32_t)s->pc + 2;
         gen_op_movl_T1_im(val | 1);
         gen_movl_reg_T1(s, 14);
-        
+
         val += offset << 1;
         if (insn & (1 << 12)) {
             /* bl */
@@ -2385,8 +2385,8 @@ undef:
 /* generate intermediate code in gen_opc_buf and gen_opparam_buf for
    basic block 'tb'. If search_pc is TRUE, also generate PC
    information for each intermediate instruction. */
-static inline int gen_intermediate_code_internal(CPUState *env, 
-                                                 TranslationBlock *tb, 
+static inline int gen_intermediate_code_internal(CPUState *env,
+                                                 TranslationBlock *tb,
                                                  int search_pc)
 {
     DisasContext dc1, *dc = &dc1;
@@ -2394,10 +2394,10 @@ static inline int gen_intermediate_code_internal(CPUState *env,
     int j, lj;
     target_ulong pc_start;
     uint32_t next_page_start;
-    
+
     /* generate intermediate code */
     pc_start = tb->pc;
-       
+
     dc->tb = tb;
 
     gen_opc_ptr = gen_opc_buf;
@@ -2532,7 +2532,7 @@ static const char *cpu_mode_names[16] = {
   "usr", "fiq", "irq", "svc", "???", "???", "???", "abt",
   "???", "???", "???", "und", "???", "???", "???", "sys"
 };
-void cpu_dump_state(CPUState *env, FILE *f, 
+void cpu_dump_state(CPUState *env, FILE *f,
                     int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
                     int flags)
 {
@@ -2558,13 +2558,13 @@ void cpu_dump_state(CPUState *env, FILE *f,
             cpu_fprintf(f, " ");
     }
     psr = cpsr_read(env);
-    cpu_fprintf(f, "PSR=%08x %c%c%c%c %c %s%d %x\n", 
-                psr, 
+    cpu_fprintf(f, "PSR=%08x %c%c%c%c %c %s%d %x\n",
+                psr,
                 psr & (1 << 31) ? 'N' : '-',
                 psr & (1 << 30) ? 'Z' : '-',
                 psr & (1 << 29) ? 'C' : '-',
                 psr & (1 << 28) ? 'V' : '-',
-                psr & CPSR_T ? 'T' : 'A', 
+                psr & CPSR_T ? 'T' : 'A',
                 cpu_mode_names[psr & 0xf], (psr & 0x10) ? 32 : 26);
 
     for (i = 0; i < 16; i++) {
index 1eb546e5667c287fad215adba9bb1c69892a058c..5dfec65192a63f9a0f5a753154726c585b8ddb00 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * i386 virtual CPU header
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
 #define NT_MASK                        0x00004000
 #define RF_MASK                        0x00010000
 #define VM_MASK                        0x00020000
-#define AC_MASK                        0x00040000 
+#define AC_MASK                        0x00040000
 #define VIF_MASK                0x00080000
 #define VIP_MASK                0x00100000
 #define ID_MASK                 0x00200000
@@ -476,7 +476,7 @@ typedef struct CPUX86State {
        int i32;
         int64_t i64;
     } fp_convert;
-    
+
     float_status sse_status;
     uint32_t mxcsr;
     XMMReg xmm_regs[CPU_NB_REGS];
@@ -504,7 +504,7 @@ typedef struct CPUX86State {
     uint32_t saved_esp;
     int native_fp_regs; /* if true, the FPU state is in the native CPU regs */
 #endif
-    
+
     /* exception/interrupt handling */
     jmp_buf jmp_env;
     int exception_index;
@@ -513,7 +513,7 @@ typedef struct CPUX86State {
     target_ulong exception_next_eip;
     target_ulong dr[8]; /* debug registers */
     uint32_t smbase;
-    int interrupt_request; 
+    int interrupt_request;
     int user_mode_only; /* user mode only simulation */
 
     CPU_COMMON
@@ -529,7 +529,7 @@ typedef struct CPUX86State {
     uint32_t cpuid_xlevel;
     uint32_t cpuid_model[12];
     uint32_t cpuid_ext2_features;
-    
+
 #ifdef USE_KQEMU
     int kqemu_enabled;
     int last_io_time;
@@ -548,15 +548,15 @@ void cpu_set_ferr(CPUX86State *s);
 
 /* this function must always be used to load data in the segment
    cache: it synchronizes the hflags with the segment cache values */
-static inline void cpu_x86_load_seg_cache(CPUX86State *env, 
+static inline void cpu_x86_load_seg_cache(CPUX86State *env,
                                           int seg_reg, unsigned int selector,
                                           target_ulong base,
-                                          unsigned int limit, 
+                                          unsigned int limit,
                                           unsigned int flags)
 {
     SegmentCache *sc;
     unsigned int new_hflags;
-    
+
     sc = &env->segs[seg_reg];
     sc->selector = selector;
     sc->base = base;
@@ -571,7 +571,7 @@ static inline void cpu_x86_load_seg_cache(CPUX86State *env,
                 /* long mode */
                 env->hflags |= HF_CS32_MASK | HF_SS32_MASK | HF_CS64_MASK;
                 env->hflags &= ~(HF_ADDSEG_MASK);
-            } else 
+            } else
 #endif
             {
                 /* legacy / compatibility case */
@@ -585,7 +585,7 @@ static inline void cpu_x86_load_seg_cache(CPUX86State *env,
             >> (DESC_B_SHIFT - HF_SS32_SHIFT);
         if (env->hflags & HF_CS64_MASK) {
             /* zero base assumed for DS, ES and SS in long mode */
-        } else if (!(env->cr[0] & CR0_PE_MASK) || 
+        } else if (!(env->cr[0] & CR0_PE_MASK) ||
                    (env->eflags & VM_MASK) ||
                    !(env->hflags & HF_CS32_MASK)) {
             /* XXX: try to avoid this test. The problem comes from the
@@ -595,12 +595,12 @@ static inline void cpu_x86_load_seg_cache(CPUX86State *env,
                translate-i386.c. */
             new_hflags |= HF_ADDSEG_MASK;
         } else {
-            new_hflags |= ((env->segs[R_DS].base | 
+            new_hflags |= ((env->segs[R_DS].base |
                             env->segs[R_ES].base |
-                            env->segs[R_SS].base) != 0) << 
+                            env->segs[R_SS].base) != 0) <<
                 HF_ADDSEG_SHIFT;
         }
-        env->hflags = (env->hflags & 
+        env->hflags = (env->hflags &
                        ~(HF_SS32_MASK | HF_ADDSEG_MASK)) | new_hflags;
     }
 }
@@ -628,7 +628,7 @@ void cpu_x86_frstor(CPUX86State *s, uint8_t *ptr, int data32);
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
-int cpu_x86_signal_handler(int host_signum, void *pinfo, 
+int cpu_x86_signal_handler(int host_signum, void *pinfo,
                            void *puc);
 void cpu_x86_set_a20(CPUX86State *env, int a20_state);
 
index 377f7bd28b953c43b03192defbfe47fe1b9d43e9..9b4a5e2861602fdabdbe256f67563ab0efadf0d3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  i386 execution defines 
+ *  i386 execution defines
  *
  *  Copyright (c) 2003 Fabrice Bellard
  *
@@ -162,17 +162,17 @@ void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0);
 void cpu_x86_update_cr3(CPUX86State *env, target_ulong new_cr3);
 void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_cr4);
 void cpu_x86_flush_tlb(CPUX86State *env, target_ulong addr);
-int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr, 
+int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                              int is_write, int is_user, int is_softmmu);
-void tlb_fill(target_ulong addr, int is_write, int is_user, 
+void tlb_fill(target_ulong addr, int is_write, int is_user,
               void *retaddr);
 void __hidden cpu_lock(void);
 void __hidden cpu_unlock(void);
-void do_interrupt(int intno, int is_int, int error_code, 
+void do_interrupt(int intno, int is_int, int error_code,
                   target_ulong next_eip, int is_hw);
-void do_interrupt_user(int intno, int is_int, int error_code, 
+void do_interrupt_user(int intno, int is_int, int error_code,
                        target_ulong next_eip);
-void raise_interrupt(int intno, int is_int, int error_code, 
+void raise_interrupt(int intno, int is_int, int error_code,
                      int next_eip_addend);
 void raise_exception_err(int exception_index, int error_code);
 void raise_exception(int exception_index);
@@ -442,7 +442,7 @@ static inline CPU86_LDouble helper_fldt(target_ulong ptr)
 static inline void helper_fstt(CPU86_LDouble f, target_ulong ptr)
 {
     CPU86_LDoubleU temp;
-    
+
     temp.d = f;
     stq(ptr, temp.l.lower);
     stw(ptr + 8, temp.l.upper);
@@ -516,7 +516,7 @@ static inline void load_eflags(int eflags, int update_mask)
 {
     CC_SRC = eflags & (CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
     DF = 1 - (2 * ((eflags >> 10) & 1));
-    env->eflags = (env->eflags & ~update_mask) | 
+    env->eflags = (env->eflags & ~update_mask) |
         (eflags & update_mask);
 }
 
index 1d62f6b2e3d43d5247c053dabb71f6fea936a5c9..3676387d6ab8884575a098df88fdec5d6496f13e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  i386 helpers
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -67,7 +67,7 @@ const uint8_t parity_table[256] = {
 
 /* modulo 17 table */
 const uint8_t rclw_table[32] = {
-    0, 1, 2, 3, 4, 5, 6, 7, 
+    0, 1, 2, 3, 4, 5, 6, 7,
     8, 9,10,11,12,13,14,15,
    16, 0, 1, 2, 3, 4, 5, 6,
     7, 8, 9,10,11,12,13,14,
@@ -75,9 +75,9 @@ const uint8_t rclw_table[32] = {
 
 /* modulo 9 table */
 const uint8_t rclb_table[32] = {
-    0, 1, 2, 3, 4, 5, 6, 7, 
+    0, 1, 2, 3, 4, 5, 6, 7,
     8, 0, 1, 2, 3, 4, 5, 6,
-    7, 8, 0, 1, 2, 3, 4, 5, 
+    7, 8, 0, 1, 2, 3, 4, 5,
     6, 7, 8, 0, 1, 2, 3, 4,
 };
 
@@ -91,7 +91,7 @@ const CPU86_LDouble f15rk[7] =
     1.44269504088896340739L,  /*l2e*/
     3.32192809488736234781L,  /*l2t*/
 };
-    
+
 /* thread support */
 
 spinlock_t global_cpu_lock = SPIN_LOCK_UNLOCKED;
@@ -134,7 +134,7 @@ static inline int load_segment(uint32_t *e1_ptr, uint32_t *e2_ptr,
     *e2_ptr = ldl_kernel(ptr + 4);
     return 0;
 }
-                                     
+
 static inline unsigned int get_seg_limit(uint32_t e1, uint32_t e2)
 {
     unsigned int limit;
@@ -160,15 +160,15 @@ static inline void load_seg_cache_raw_dt(SegmentCache *sc, uint32_t e1, uint32_t
 static inline void load_seg_vm(int seg, int selector)
 {
     selector &= 0xffff;
-    cpu_x86_load_seg_cache(env, seg, selector, 
+    cpu_x86_load_seg_cache(env, seg, selector,
                            (selector << 4), 0xffff, 0);
 }
 
-static inline void get_ss_esp_from_tss(uint32_t *ss_ptr, 
+static inline void get_ss_esp_from_tss(uint32_t *ss_ptr,
                                        uint32_t *esp_ptr, int dpl)
 {
     int type, index, shift;
-    
+
 #if 0
     {
         int i;
@@ -239,12 +239,12 @@ static void tss_load_seg(int seg_reg, int selector)
         }
         if (!(e2 & DESC_P_MASK))
             raise_exception_err(EXCP0B_NOSEG, selector & 0xfffc);
-        cpu_x86_load_seg_cache(env, seg_reg, selector, 
+        cpu_x86_load_seg_cache(env, seg_reg, selector,
                        get_seg_base(e1, e2),
                        get_seg_limit(e1, e2),
                        e2);
     } else {
-        if (seg_reg == R_SS || seg_reg == R_CS) 
+        if (seg_reg == R_SS || seg_reg == R_CS)
             raise_exception_err(EXCP0A_TSS, selector & 0xfffc);
     }
 }
@@ -254,7 +254,7 @@ static void tss_load_seg(int seg_reg, int selector)
 #define SWITCH_TSS_CALL 2
 
 /* XXX: restore CPU state in registers (PowerPC case) */
-static void switch_tss(int tss_selector, 
+static void switch_tss(int tss_selector,
                        uint32_t e1, uint32_t e2, int source,
                        uint32_t next_eip)
 {
@@ -298,7 +298,7 @@ static void switch_tss(int tss_selector,
         tss_limit_max = 43;
     tss_limit = get_seg_limit(e1, e2);
     tss_base = get_seg_base(e1, e2);
-    if ((tss_selector & 4) != 0 || 
+    if ((tss_selector & 4) != 0 ||
         tss_limit < tss_limit_max)
         raise_exception_err(EXCP0A_TSS, tss_selector & 0xfffc);
     old_type = (env->tr.flags >> DESC_TYPE_SHIFT) & 0xf;
@@ -333,7 +333,7 @@ static void switch_tss(int tss_selector,
         new_segs[R_GS] = 0;
         new_trap = 0;
     }
-    
+
     /* NOTE: we must avoid memory exceptions during the task switch,
        so we make dummy accesses before */
     /* XXX: it can still fail in some cases, so a bigger hack is
@@ -343,7 +343,7 @@ static void switch_tss(int tss_selector,
     v2 = ldub_kernel(env->tr.base + old_tss_limit_max);
     stb_kernel(env->tr.base, v1);
     stb_kernel(env->tr.base + old_tss_limit_max, v2);
-    
+
     /* clear busy bit (it is restartable) */
     if (source == SWITCH_TSS_JMP || source == SWITCH_TSS_IRET) {
         target_ulong ptr;
@@ -356,7 +356,7 @@ static void switch_tss(int tss_selector,
     old_eflags = compute_eflags();
     if (source == SWITCH_TSS_IRET)
         old_eflags &= ~NT_MASK;
-    
+
     /* save the current state in the old TSS */
     if (type & 8) {
         /* 32 bit */
@@ -387,7 +387,7 @@ static void switch_tss(int tss_selector,
         for(i = 0; i < 4; i++)
             stw_kernel(env->tr.base + (0x22 + i * 4), env->segs[i].selector);
     }
-    
+
     /* now if an exception occurs, it will occurs in the next task
        context */
 
@@ -414,15 +414,15 @@ static void switch_tss(int tss_selector,
     env->tr.base = tss_base;
     env->tr.limit = tss_limit;
     env->tr.flags = e2 & ~DESC_TSS_BUSY_MASK;
-    
+
     if ((type & 8) && (env->cr[0] & CR0_PG_MASK)) {
         cpu_x86_update_cr3(env, new_cr3);
     }
-    
+
     /* load all registers without an exception, then reload them with
        possible exception */
     env->eip = new_eip;
-    eflags_mask = TF_MASK | AC_MASK | ID_MASK | 
+    eflags_mask = TF_MASK | AC_MASK | ID_MASK |
         IF_MASK | IOPL_MASK | VM_MASK | RF_MASK | NT_MASK;
     if (!(type & 8))
         eflags_mask &= 0xffff;
@@ -437,7 +437,7 @@ static void switch_tss(int tss_selector,
     ESI = new_regs[6];
     EDI = new_regs[7];
     if (new_eflags & VM_MASK) {
-        for(i = 0; i < 6; i++) 
+        for(i = 0; i < 6; i++)
             load_seg_vm(i, new_segs[i]);
         /* in vm86, CPL is always 3 */
         cpu_x86_set_cpl(env, 3);
@@ -448,7 +448,7 @@ static void switch_tss(int tss_selector,
         for(i = 0; i < 6; i++)
             cpu_x86_load_seg_cache(env, i, new_segs[i], 0, 0, 0);
     }
-    
+
     env->ldt.selector = new_ldt & ~4;
     env->ldt.base = 0;
     env->ldt.limit = 0;
@@ -472,7 +472,7 @@ static void switch_tss(int tss_selector,
             raise_exception_err(EXCP0A_TSS, new_ldt & 0xfffc);
         load_seg_cache_raw_dt(&env->ldt, e1, e2);
     }
-    
+
     /* load the segments */
     if (!(new_eflags & VM_MASK)) {
         tss_load_seg(R_CS, new_segs[R_CS]);
@@ -482,7 +482,7 @@ static void switch_tss(int tss_selector,
         tss_load_seg(R_FS, new_segs[R_FS]);
         tss_load_seg(R_GS, new_segs[R_GS]);
     }
-    
+
     /* check that EIP is in the CS segment limits */
     if (new_eip > env->segs[R_CS].limit) {
         /* XXX: different exception if CALL ? */
@@ -494,7 +494,7 @@ static void switch_tss(int tss_selector,
 static inline void check_io(int addr, int size)
 {
     int io_offset, val, mask;
-    
+
     /* TSS must be a valid 32 bit one */
     if (!(env->tr.flags & DESC_P_MASK) ||
         ((env->tr.flags >> DESC_TYPE_SHIFT) & 0xf) != 9 ||
@@ -768,7 +768,7 @@ static void do_interrupt_protected(int intno, int is_int, int error_code,
             PUSHW(ssp, esp, sp_mask, error_code);
         }
     }
-    
+
     if (new_stack) {
         if (env->eflags & VM_MASK) {
             cpu_x86_load_seg_cache(env, R_ES, 0, 0, 0, 0);
@@ -777,13 +777,13 @@ static void do_interrupt_protected(int intno, int is_int, int error_code,
             cpu_x86_load_seg_cache(env, R_GS, 0, 0, 0, 0);
         }
         ss = (ss & ~3) | dpl;
-        cpu_x86_load_seg_cache(env, R_SS, ss, 
+        cpu_x86_load_seg_cache(env, R_SS, ss,
                                ssp, get_seg_limit(ss_e1, ss_e2), ss_e2);
     }
     SET_ESP(esp, sp_mask);
 
     selector = (selector & ~3) | dpl;
-    cpu_x86_load_seg_cache(env, R_CS, selector, 
+    cpu_x86_load_seg_cache(env, R_CS, selector,
                    get_seg_base(e1, e2),
                    get_seg_limit(e1, e2),
                    e2);
@@ -814,9 +814,9 @@ static void do_interrupt_protected(int intno, int is_int, int error_code,
 static inline target_ulong get_rsp_from_tss(int level)
 {
     int index;
-    
+
 #if 0
-    printf("TR: base=" TARGET_FMT_lx " limit=%x\n", 
+    printf("TR: base=" TARGET_FMT_lx " limit=%x\n",
            env->tr.base, env->tr.limit);
 #endif
 
@@ -934,7 +934,7 @@ static void do_interrupt64(int intno, int is_int, int error_code,
     if (has_error_code) {
         PUSHQ(esp, error_code);
     }
-    
+
     if (new_stack) {
         ss = 0 | dpl;
         cpu_x86_load_seg_cache(env, R_SS, ss, 0, 0, 0);
@@ -942,7 +942,7 @@ static void do_interrupt64(int intno, int is_int, int error_code,
     ESP = esp;
 
     selector = (selector & ~3) | dpl;
-    cpu_x86_load_seg_cache(env, R_CS, selector, 
+    cpu_x86_load_seg_cache(env, R_CS, selector,
                    get_seg_base(e1, e2),
                    get_seg_limit(e1, e2),
                    e2);
@@ -971,16 +971,16 @@ void helper_syscall(int next_eip_addend)
 
         ECX = env->eip + next_eip_addend;
         env->regs[11] = compute_eflags();
-        
+
         code64 = env->hflags & HF_CS64_MASK;
 
         cpu_x86_set_cpl(env, 0);
-        cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc, 
-                           0, 0xffffffff, 
+        cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc,
+                           0, 0xffffffff,
                                DESC_G_MASK | DESC_P_MASK |
                                DESC_S_MASK |
                                DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK);
-        cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc, 
+        cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc,
                                0, 0xffffffff,
                                DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                                DESC_S_MASK |
@@ -990,18 +990,18 @@ void helper_syscall(int next_eip_addend)
             env->eip = env->lstar;
         else
             env->eip = env->cstar;
-    } else 
+    } else
 #endif
     {
         ECX = (uint32_t)(env->eip + next_eip_addend);
-        
+
         cpu_x86_set_cpl(env, 0);
-        cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc, 
-                           0, 0xffffffff, 
+        cpu_x86_load_seg_cache(env, R_CS, selector & 0xfffc,
+                           0, 0xffffffff,
                                DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                                DESC_S_MASK |
                                DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
-        cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc, 
+        cpu_x86_load_seg_cache(env, R_SS, (selector + 8) & 0xfffc,
                                0, 0xffffffff,
                                DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                                DESC_S_MASK |
@@ -1026,39 +1026,39 @@ void helper_sysret(int dflag)
 #ifdef TARGET_X86_64
     if (env->hflags & HF_LMA_MASK) {
         if (dflag == 2) {
-            cpu_x86_load_seg_cache(env, R_CS, (selector + 16) | 3, 
-                                   0, 0xffffffff, 
+            cpu_x86_load_seg_cache(env, R_CS, (selector + 16) | 3,
+                                   0, 0xffffffff,
                                    DESC_G_MASK | DESC_P_MASK |
                                    DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
-                                   DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | 
+                                   DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK |
                                    DESC_L_MASK);
             env->eip = ECX;
         } else {
-            cpu_x86_load_seg_cache(env, R_CS, selector | 3, 
-                                   0, 0xffffffff, 
+            cpu_x86_load_seg_cache(env, R_CS, selector | 3,
+                                   0, 0xffffffff,
                                    DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                                    DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
                                    DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
             env->eip = (uint32_t)ECX;
         }
-        cpu_x86_load_seg_cache(env, R_SS, selector + 8, 
+        cpu_x86_load_seg_cache(env, R_SS, selector + 8,
                                0, 0xffffffff,
                                DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                                DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
                                DESC_W_MASK | DESC_A_MASK);
-        load_eflags((uint32_t)(env->regs[11]), TF_MASK | AC_MASK | ID_MASK | 
+        load_eflags((uint32_t)(env->regs[11]), TF_MASK | AC_MASK | ID_MASK |
                     IF_MASK | IOPL_MASK | VM_MASK | RF_MASK | NT_MASK);
         cpu_x86_set_cpl(env, 3);
-    } else 
+    } else
 #endif
     {
-        cpu_x86_load_seg_cache(env, R_CS, selector | 3, 
-                               0, 0xffffffff, 
+        cpu_x86_load_seg_cache(env, R_CS, selector | 3,
+                               0, 0xffffffff,
                                DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                                DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
                                DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
         env->eip = (uint32_t)ECX;
-        cpu_x86_load_seg_cache(env, R_SS, selector + 8, 
+        cpu_x86_load_seg_cache(env, R_SS, selector + 8,
                                0, 0xffffffff,
                                DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                                DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
@@ -1104,7 +1104,7 @@ static void do_interrupt_real(int intno, int is_int, int error_code,
     PUSHW(ssp, esp, 0xffff, compute_eflags());
     PUSHW(ssp, esp, 0xffff, old_cs);
     PUSHW(ssp, esp, 0xffff, old_eip);
-    
+
     /* update processor state */
     ESP = (ESP & ~0xffff) | (esp & 0xffff);
     env->eip = offset;
@@ -1114,7 +1114,7 @@ static void do_interrupt_real(int intno, int is_int, int error_code,
 }
 
 /* fake user mode interrupt */
-void do_interrupt_user(int intno, int is_int, int error_code, 
+void do_interrupt_user(int intno, int is_int, int error_code,
                        target_ulong next_eip)
 {
     SegmentCache *dt;
@@ -1125,7 +1125,7 @@ void do_interrupt_user(int intno, int is_int, int error_code,
     dt = &env->idt;
     ptr = dt->base + (intno * 8);
     e2 = ldl_kernel(ptr + 4);
-    
+
     dpl = (e2 >> DESC_DPL_SHIFT) & 3;
     cpl = env->hflags & HF_CPL_MASK;
     /* check privledge if software int */
@@ -1142,9 +1142,9 @@ void do_interrupt_user(int intno, int is_int, int error_code,
 /*
  * Begin execution of an interruption. is_int is TRUE if coming from
  * the int instruction. next_eip is the EIP value AFTER the interrupt
- * instruction. It is only relevant if is_int is TRUE.  
+ * instruction. It is only relevant if is_int is TRUE.
  */
-void do_interrupt(int intno, int is_int, int error_code, 
+void do_interrupt(int intno, int is_int, int error_code,
                   target_ulong next_eip, int is_hw)
 {
     if (loglevel & CPU_LOG_INT) {
@@ -1196,9 +1196,9 @@ void do_interrupt(int intno, int is_int, int error_code,
  * Signal an interruption. It is executed in the main CPU loop.
  * is_int is TRUE if coming from the int instruction. next_eip is the
  * EIP value AFTER the interrupt instruction. It is only relevant if
- * is_int is TRUE.  
+ * is_int is TRUE.
  */
-void raise_interrupt(int intno, int is_int, int error_code, 
+void raise_interrupt(int intno, int is_int, int error_code,
                      int next_eip_addend)
 {
     env->exception_index = intno;
@@ -1232,7 +1232,7 @@ void raise_exception(int exception_index)
 
 /* SMM support */
 
-#if defined(CONFIG_USER_ONLY) 
+#if defined(CONFIG_USER_ONLY)
 
 void do_smm_enter(void)
 {
@@ -1265,7 +1265,7 @@ void do_smm_enter(void)
     cpu_smm_update(env);
 
     sm_state = env->smbase + 0x8000;
-    
+
 #ifdef TARGET_X86_64
     for(i = 0; i < 6; i++) {
         dt = &env->segs[i];
@@ -1283,7 +1283,7 @@ void do_smm_enter(void)
     stq_phys(sm_state + 0x7e78, env->ldt.base);
     stl_phys(sm_state + 0x7e74, env->ldt.limit);
     stw_phys(sm_state + 0x7e72, (env->ldt.flags >> 8) & 0xf0ff);
-    
+
     stq_phys(sm_state + 0x7e88, env->idt.base);
     stl_phys(sm_state + 0x7e84, env->idt.limit);
 
@@ -1291,7 +1291,7 @@ void do_smm_enter(void)
     stq_phys(sm_state + 0x7e98, env->tr.base);
     stl_phys(sm_state + 0x7e94, env->tr.limit);
     stw_phys(sm_state + 0x7e92, (env->tr.flags >> 8) & 0xf0ff);
-    
+
     stq_phys(sm_state + 0x7ed0, env->efer);
 
     stq_phys(sm_state + 0x7ff8, EAX);
@@ -1302,7 +1302,7 @@ void do_smm_enter(void)
     stq_phys(sm_state + 0x7fd0, EBP);
     stq_phys(sm_state + 0x7fc8, ESI);
     stq_phys(sm_state + 0x7fc0, EDI);
-    for(i = 8; i < 16; i++) 
+    for(i = 8; i < 16; i++)
         stq_phys(sm_state + 0x7ff8 - i * 8, env->regs[i]);
     stq_phys(sm_state + 0x7f78, env->eip);
     stl_phys(sm_state + 0x7f70, compute_eflags());
@@ -1330,17 +1330,17 @@ void do_smm_enter(void)
     stl_phys(sm_state + 0x7fd0, EAX);
     stl_phys(sm_state + 0x7fcc, env->dr[6]);
     stl_phys(sm_state + 0x7fc8, env->dr[7]);
-    
+
     stl_phys(sm_state + 0x7fc4, env->tr.selector);
     stl_phys(sm_state + 0x7f64, env->tr.base);
     stl_phys(sm_state + 0x7f60, env->tr.limit);
     stl_phys(sm_state + 0x7f5c, (env->tr.flags >> 8) & 0xf0ff);
-    
+
     stl_phys(sm_state + 0x7fc0, env->ldt.selector);
     stl_phys(sm_state + 0x7f80, env->ldt.base);
     stl_phys(sm_state + 0x7f7c, env->ldt.limit);
     stl_phys(sm_state + 0x7f78, (env->ldt.flags >> 8) & 0xf0ff);
-    
+
     stl_phys(sm_state + 0x7f74, env->gdt.base);
     stl_phys(sm_state + 0x7f70, env->gdt.limit);
 
@@ -1378,8 +1378,8 @@ void do_smm_enter(void)
     cpu_x86_load_seg_cache(env, R_SS, 0, 0, 0xffffffff, 0);
     cpu_x86_load_seg_cache(env, R_FS, 0, 0, 0xffffffff, 0);
     cpu_x86_load_seg_cache(env, R_GS, 0, 0, 0xffffffff, 0);
-    
-    cpu_x86_update_cr0(env, 
+
+    cpu_x86_update_cr0(env,
                        env->cr[0] & ~(CR0_PE_MASK | CR0_EM_MASK | CR0_TS_MASK | CR0_PG_MASK));
     cpu_x86_update_cr4(env, 0);
     env->dr[7] = 0x00000400;
@@ -1402,7 +1402,7 @@ void helper_rsm(void)
 
     for(i = 0; i < 6; i++) {
         offset = 0x7e00 + i * 16;
-        cpu_x86_load_seg_cache(env, i, 
+        cpu_x86_load_seg_cache(env, i,
                                lduw_phys(sm_state + offset),
                                ldq_phys(sm_state + offset + 8),
                                ldl_phys(sm_state + offset + 4),
@@ -1416,7 +1416,7 @@ void helper_rsm(void)
     env->ldt.base = ldq_phys(sm_state + 0x7e78);
     env->ldt.limit = ldl_phys(sm_state + 0x7e74);
     env->ldt.flags = (lduw_phys(sm_state + 0x7e72) & 0xf0ff) << 8;
-    
+
     env->idt.base = ldq_phys(sm_state + 0x7e88);
     env->idt.limit = ldl_phys(sm_state + 0x7e84);
 
@@ -1424,7 +1424,7 @@ void helper_rsm(void)
     env->tr.base = ldq_phys(sm_state + 0x7e98);
     env->tr.limit = ldl_phys(sm_state + 0x7e94);
     env->tr.flags = (lduw_phys(sm_state + 0x7e92) & 0xf0ff) << 8;
-    
+
     EAX = ldq_phys(sm_state + 0x7ff8);
     ECX = ldq_phys(sm_state + 0x7ff0);
     EDX = ldq_phys(sm_state + 0x7fe8);
@@ -1433,10 +1433,10 @@ void helper_rsm(void)
     EBP = ldq_phys(sm_state + 0x7fd0);
     ESI = ldq_phys(sm_state + 0x7fc8);
     EDI = ldq_phys(sm_state + 0x7fc0);
-    for(i = 8; i < 16; i++) 
+    for(i = 8; i < 16; i++)
         env->regs[i] = ldq_phys(sm_state + 0x7ff8 - i * 8);
     env->eip = ldq_phys(sm_state + 0x7f78);
-    load_eflags(ldl_phys(sm_state + 0x7f70), 
+    load_eflags(ldl_phys(sm_state + 0x7f70),
                 ~(CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C | DF_MASK));
     env->dr[6] = ldl_phys(sm_state + 0x7f68);
     env->dr[7] = ldl_phys(sm_state + 0x7f60);
@@ -1452,7 +1452,7 @@ void helper_rsm(void)
 #else
     cpu_x86_update_cr0(env, ldl_phys(sm_state + 0x7ffc));
     cpu_x86_update_cr3(env, ldl_phys(sm_state + 0x7ff8));
-    load_eflags(ldl_phys(sm_state + 0x7ff4), 
+    load_eflags(ldl_phys(sm_state + 0x7ff4),
                 ~(CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C | DF_MASK));
     env->eip = ldl_phys(sm_state + 0x7ff0);
     EDI = ldl_phys(sm_state + 0x7fec);
@@ -1465,17 +1465,17 @@ void helper_rsm(void)
     EAX = ldl_phys(sm_state + 0x7fd0);
     env->dr[6] = ldl_phys(sm_state + 0x7fcc);
     env->dr[7] = ldl_phys(sm_state + 0x7fc8);
-    
+
     env->tr.selector = ldl_phys(sm_state + 0x7fc4) & 0xffff;
     env->tr.base = ldl_phys(sm_state + 0x7f64);
     env->tr.limit = ldl_phys(sm_state + 0x7f60);
     env->tr.flags = (ldl_phys(sm_state + 0x7f5c) & 0xf0ff) << 8;
-    
+
     env->ldt.selector = ldl_phys(sm_state + 0x7fc0) & 0xffff;
     env->ldt.base = ldl_phys(sm_state + 0x7f80);
     env->ldt.limit = ldl_phys(sm_state + 0x7f7c);
     env->ldt.flags = (ldl_phys(sm_state + 0x7f78) & 0xf0ff) << 8;
-    
+
     env->gdt.base = ldl_phys(sm_state + 0x7f74);
     env->gdt.limit = ldl_phys(sm_state + 0x7f70);
 
@@ -1487,7 +1487,7 @@ void helper_rsm(void)
             offset = 0x7f84 + i * 12;
         else
             offset = 0x7f2c + (i - 3) * 12;
-        cpu_x86_load_seg_cache(env, i, 
+        cpu_x86_load_seg_cache(env, i,
                                ldl_phys(sm_state + 0x7fa8 + i * 4) & 0xffff,
                                ldl_phys(sm_state + offset + 8),
                                ldl_phys(sm_state + offset + 4),
@@ -1533,7 +1533,7 @@ void helper_divl_EAX_T0(void)
 {
     unsigned int den, r;
     uint64_t num, q;
-    
+
     num = ((uint32_t)EAX) | ((uint64_t)((uint32_t)EDX) << 32);
     den = T0;
     if (den == 0) {
@@ -1555,7 +1555,7 @@ void helper_idivl_EAX_T0(void)
 {
     int den, r;
     int64_t num, q;
-    
+
     num = ((uint32_t)EAX) | ((uint64_t)((uint32_t)EDX) << 32);
     den = T0;
     if (den == 0) {
@@ -1595,16 +1595,16 @@ void helper_cpuid(void)
 {
     uint32_t index;
     index = (uint32_t)EAX;
-    
+
     /* test if maximum index reached */
     if (index & 0x80000000) {
-        if (index > env->cpuid_xlevel) 
+        if (index > env->cpuid_xlevel)
             index = env->cpuid_level;
     } else {
-        if (index > env->cpuid_level) 
+        if (index > env->cpuid_level)
             index = env->cpuid_level;
     }
-        
+
     switch(index) {
     case 0:
         EAX = env->cpuid_level;
@@ -1746,7 +1746,7 @@ void helper_lldt_T0(void)
     uint32_t e1, e2;
     int index, entry_limit;
     target_ulong ptr;
-    
+
     selector = T0 & 0xffff;
     if ((selector & 0xfffc) == 0) {
         /* XXX: NULL selector case: invalid LDT */
@@ -1761,7 +1761,7 @@ void helper_lldt_T0(void)
         if (env->hflags & HF_LMA_MASK)
             entry_limit = 15;
         else
-#endif            
+#endif
             entry_limit = 7;
         if ((index + entry_limit) > dt->limit)
             raise_exception_err(EXCP0D_GPF, selector & 0xfffc);
@@ -1794,7 +1794,7 @@ void helper_ltr_T0(void)
     uint32_t e1, e2;
     int index, type, entry_limit;
     target_ulong ptr;
-    
+
     selector = T0 & 0xffff;
     if ((selector & 0xfffc) == 0) {
         /* NULL selector case: invalid TR */
@@ -1810,7 +1810,7 @@ void helper_ltr_T0(void)
         if (env->hflags & HF_LMA_MASK)
             entry_limit = 15;
         else
-#endif            
+#endif
             entry_limit = 7;
         if ((index + entry_limit) > dt->limit)
             raise_exception_err(EXCP0D_GPF, selector & 0xfffc);
@@ -1818,7 +1818,7 @@ void helper_ltr_T0(void)
         e1 = ldl_kernel(ptr);
         e2 = ldl_kernel(ptr + 4);
         type = (e2 >> DESC_TYPE_SHIFT) & 0xf;
-        if ((e2 & DESC_S_MASK) || 
+        if ((e2 & DESC_S_MASK) ||
             (type != 1 && type != 9))
             raise_exception_err(EXCP0D_GPF, selector & 0xfffc);
         if (!(e2 & DESC_P_MASK))
@@ -1829,7 +1829,7 @@ void helper_ltr_T0(void)
             e3 = ldl_kernel(ptr + 8);
             load_seg_cache_raw_dt(&env->tr, e1, e2);
             env->tr.base |= (target_ulong)e3 << 32;
-        } else 
+        } else
 #endif
         {
             load_seg_cache_raw_dt(&env->tr, e1, e2);
@@ -1861,7 +1861,7 @@ void load_seg(int seg_reg, int selector)
             raise_exception_err(EXCP0D_GPF, 0);
         cpu_x86_load_seg_cache(env, seg_reg, selector, 0, 0, 0);
     } else {
-        
+
         if (selector & 0x4)
             dt = &env->ldt;
         else
@@ -1872,7 +1872,7 @@ void load_seg(int seg_reg, int selector)
         ptr = dt->base + index;
         e1 = ldl_kernel(ptr);
         e2 = ldl_kernel(ptr + 4);
-        
+
         if (!(e2 & DESC_S_MASK))
             raise_exception_err(EXCP0D_GPF, selector & 0xfffc);
         rpl = selector & 3;
@@ -1887,10 +1887,10 @@ void load_seg(int seg_reg, int selector)
             /* must be readable segment */
             if ((e2 & (DESC_CS_MASK | DESC_R_MASK)) == DESC_CS_MASK)
                 raise_exception_err(EXCP0D_GPF, selector & 0xfffc);
-            
+
             if (!(e2 & DESC_CS_MASK) || !(e2 & DESC_C_MASK)) {
                 /* if not conforming code, test rights */
-                if (dpl < cpl || dpl < rpl) 
+                if (dpl < cpl || dpl < rpl)
                     raise_exception_err(EXCP0D_GPF, selector & 0xfffc);
             }
         }
@@ -1908,12 +1908,12 @@ void load_seg(int seg_reg, int selector)
             stl_kernel(ptr + 4, e2);
         }
 
-        cpu_x86_load_seg_cache(env, seg_reg, selector, 
+        cpu_x86_load_seg_cache(env, seg_reg, selector,
                        get_seg_base(e1, e2),
                        get_seg_limit(e1, e2),
                        e2);
 #if 0
-        fprintf(logfile, "load_seg: sel=0x%04x base=0x%08lx limit=0x%08lx flags=%08x\n", 
+        fprintf(logfile, "load_seg: sel=0x%04x base=0x%08lx limit=0x%08lx flags=%08x\n",
                 selector, (unsigned long)sc->base, sc->limit, sc->flags);
 #endif
     }
@@ -1925,7 +1925,7 @@ void helper_ljmp_protected_T0_T1(int next_eip_addend)
     int new_cs, gate_cs, type;
     uint32_t e1, e2, cpl, dpl, rpl, limit;
     target_ulong new_eip, next_eip;
-    
+
     new_cs = T0;
     new_eip = T1;
     if ((new_cs & 0xfffc) == 0)
@@ -1952,7 +1952,7 @@ void helper_ljmp_protected_T0_T1(int next_eip_addend)
         if (!(e2 & DESC_P_MASK))
             raise_exception_err(EXCP0B_NOSEG, new_cs & 0xfffc);
         limit = get_seg_limit(e1, e2);
-        if (new_eip > limit && 
+        if (new_eip > limit &&
             !(env->hflags & HF_LMA_MASK) && !(e2 & DESC_L_MASK))
             raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);
         cpu_x86_load_seg_cache(env, R_CS, (new_cs & 0xfffc) | cpl,
@@ -1988,10 +1988,10 @@ void helper_ljmp_protected_T0_T1(int next_eip_addend)
                 raise_exception_err(EXCP0D_GPF, gate_cs & 0xfffc);
             dpl = (e2 >> DESC_DPL_SHIFT) & 3;
             /* must be code segment */
-            if (((e2 & (DESC_S_MASK | DESC_CS_MASK)) != 
+            if (((e2 & (DESC_S_MASK | DESC_CS_MASK)) !=
                  (DESC_S_MASK | DESC_CS_MASK)))
                 raise_exception_err(EXCP0D_GPF, gate_cs & 0xfffc);
-            if (((e2 & DESC_C_MASK) && (dpl > cpl)) || 
+            if (((e2 & DESC_C_MASK) && (dpl > cpl)) ||
                 (!(e2 & DESC_C_MASK) && (dpl != cpl)))
                 raise_exception_err(EXCP0D_GPF, gate_cs & 0xfffc);
             if (!(e2 & DESC_P_MASK))
@@ -2044,7 +2044,7 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip_addend)
     uint32_t ss, ss_e1, ss_e2, sp, type, ss_dpl, sp_mask;
     uint32_t val, limit, old_sp_mask;
     target_ulong ssp, old_ssp, next_eip, new_eip;
-    
+
     new_cs = T0;
     new_eip = T1;
     next_eip = env->eip + next_eip_addend;
@@ -2095,10 +2095,10 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip_addend)
             /* from this point, not restartable */
             ESP = rsp;
             cpu_x86_load_seg_cache(env, R_CS, (new_cs & 0xfffc) | cpl,
-                                   get_seg_base(e1, e2), 
+                                   get_seg_base(e1, e2),
                                    get_seg_limit(e1, e2), e2);
             EIP = new_eip;
-        } else 
+        } else
 #endif
         {
             sp = ESP;
@@ -2111,7 +2111,7 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip_addend)
                 PUSHW(ssp, sp, sp_mask, env->segs[R_CS].selector);
                 PUSHW(ssp, sp, sp_mask, next_eip);
             }
-            
+
             limit = get_seg_limit(e1, e2);
             if (new_eip > limit)
                 raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);
@@ -2170,7 +2170,7 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip_addend)
             get_ss_esp_from_tss(&ss, &sp, dpl);
 #ifdef DEBUG_PCALL
             if (loglevel & CPU_LOG_PCALL)
-                fprintf(logfile, "new ss:esp=%04x:%08x param_count=%d ESP=" TARGET_FMT_lx "\n", 
+                fprintf(logfile, "new ss:esp=%04x:%08x param_count=%d ESP=" TARGET_FMT_lx "\n",
                         ss, sp, param_count, ESP);
 #endif
             if ((ss & 0xfffc) == 0)
@@ -2188,12 +2188,12 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip_addend)
                 raise_exception_err(EXCP0A_TSS, ss & 0xfffc);
             if (!(ss_e2 & DESC_P_MASK))
                 raise_exception_err(EXCP0A_TSS, ss & 0xfffc);
-            
+
             //            push_size = ((param_count * 2) + 8) << shift;
 
             old_sp_mask = get_sp_mask(env->segs[R_SS].flags);
             old_ssp = env->segs[R_SS].base;
-            
+
             sp_mask = get_sp_mask(ss_e2);
             ssp = get_seg_base(ss_e1, ss_e2);
             if (shift) {
@@ -2233,14 +2233,14 @@ void helper_lcall_protected_T0_T1(int shift, int next_eip_addend)
 
         if (new_stack) {
             ss = (ss & ~3) | dpl;
-            cpu_x86_load_seg_cache(env, R_SS, ss, 
+            cpu_x86_load_seg_cache(env, R_SS, ss,
                                    ssp,
                                    get_seg_limit(ss_e1, ss_e2),
                                    ss_e2);
         }
 
         selector = (selector & ~3) | dpl;
-        cpu_x86_load_seg_cache(env, R_CS, selector, 
+        cpu_x86_load_seg_cache(env, R_CS, selector,
                        get_seg_base(e1, e2),
                        get_seg_limit(e1, e2),
                        e2);
@@ -2298,7 +2298,7 @@ static inline void validate_seg(int seg_reg, int cpl)
     /* XXX: on x86_64, we do not want to nullify FS and GS because
        they may still contain a valid base. I would be interested to
        know how a real x86_64 CPU behaves */
-    if ((seg_reg == R_FS || seg_reg == R_GS) && 
+    if ((seg_reg == R_FS || seg_reg == R_GS) &&
         (env->segs[seg_reg].selector & 0xfffc) == 0)
         return;
 
@@ -2320,7 +2320,7 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend)
     uint32_t e1, e2, ss_e1, ss_e2;
     int cpl, dpl, rpl, eflags_mask, iopl;
     target_ulong ssp, sp, new_eip, new_esp, sp_mask;
-    
+
 #ifdef TARGET_X86_64
     if (shift == 2)
         sp_mask = -1;
@@ -2372,7 +2372,7 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend)
         !(e2 & DESC_CS_MASK))
         raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);
     cpl = env->hflags & HF_CPL_MASK;
-    rpl = new_cs & 3; 
+    rpl = new_cs & 3;
     if (rpl < cpl)
         raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc);
     dpl = (e2 >> DESC_DPL_SHIFT) & 3;
@@ -2385,12 +2385,12 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend)
     }
     if (!(e2 & DESC_P_MASK))
         raise_exception_err(EXCP0B_NOSEG, new_cs & 0xfffc);
-    
+
     sp += addend;
-    if (rpl == cpl && (!(env->hflags & HF_CS64_MASK) || 
+    if (rpl == cpl && (!(env->hflags & HF_CS64_MASK) ||
                        ((env->hflags & HF_CS64_MASK) && !is_iret))) {
         /* return to same priledge level */
-        cpu_x86_load_seg_cache(env, R_CS, new_cs, 
+        cpu_x86_load_seg_cache(env, R_CS, new_cs,
                        get_seg_base(e1, e2),
                        get_seg_limit(e1, e2),
                        e2);
@@ -2424,13 +2424,13 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend)
             /* NULL ss is allowed in long mode if cpl != 3*/
             /* XXX: test CS64 ? */
             if ((env->hflags & HF_LMA_MASK) && rpl != 3) {
-                cpu_x86_load_seg_cache(env, R_SS, new_ss, 
+                cpu_x86_load_seg_cache(env, R_SS, new_ss,
                                        0, 0xffffffff,
                                        DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                                        DESC_S_MASK | (rpl << DESC_DPL_SHIFT) |
                                        DESC_W_MASK | DESC_A_MASK);
                 ss_e2 = DESC_B_MASK; /* XXX: should not be needed ? */
-            } else 
+            } else
 #endif
             {
                 raise_exception_err(EXCP0D_GPF, 0);
@@ -2449,13 +2449,13 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend)
                 raise_exception_err(EXCP0D_GPF, new_ss & 0xfffc);
             if (!(ss_e2 & DESC_P_MASK))
                 raise_exception_err(EXCP0B_NOSEG, new_ss & 0xfffc);
-            cpu_x86_load_seg_cache(env, R_SS, new_ss, 
+            cpu_x86_load_seg_cache(env, R_SS, new_ss,
                                    get_seg_base(ss_e1, ss_e2),
                                    get_seg_limit(ss_e1, ss_e2),
                                    ss_e2);
         }
 
-        cpu_x86_load_seg_cache(env, R_CS, new_cs, 
+        cpu_x86_load_seg_cache(env, R_CS, new_cs,
                        get_seg_base(e1, e2),
                        get_seg_limit(e1, e2),
                        e2);
@@ -2499,9 +2499,9 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend)
     POPL(ssp, sp, sp_mask, new_ds);
     POPL(ssp, sp, sp_mask, new_fs);
     POPL(ssp, sp, sp_mask, new_gs);
-    
+
     /* modify processor state */
-    load_eflags(new_eflags, TF_MASK | AC_MASK | ID_MASK | 
+    load_eflags(new_eflags, TF_MASK | AC_MASK | ID_MASK |
                 IF_MASK | IOPL_MASK | VM_MASK | NT_MASK | VIF_MASK | VIP_MASK);
     load_seg_vm(R_CS, new_cs & 0xffff);
     cpu_x86_set_cpl(env, 3);
@@ -2519,7 +2519,7 @@ void helper_iret_protected(int shift, int next_eip)
 {
     int tss_selector, type;
     uint32_t e1, e2;
-    
+
     /* specific case for TSS */
     if (env->eflags & NT_MASK) {
 #ifdef TARGET_X86_64
@@ -2566,12 +2566,12 @@ void helper_sysenter(void)
     }
     env->eflags &= ~(VM_MASK | IF_MASK | RF_MASK);
     cpu_x86_set_cpl(env, 0);
-    cpu_x86_load_seg_cache(env, R_CS, env->sysenter_cs & 0xfffc, 
-                           0, 0xffffffff, 
+    cpu_x86_load_seg_cache(env, R_CS, env->sysenter_cs & 0xfffc,
+                           0, 0xffffffff,
                            DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                            DESC_S_MASK |
                            DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
-    cpu_x86_load_seg_cache(env, R_SS, (env->sysenter_cs + 8) & 0xfffc, 
+    cpu_x86_load_seg_cache(env, R_SS, (env->sysenter_cs + 8) & 0xfffc,
                            0, 0xffffffff,
                            DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                            DESC_S_MASK |
@@ -2589,12 +2589,12 @@ void helper_sysexit(void)
         raise_exception_err(EXCP0D_GPF, 0);
     }
     cpu_x86_set_cpl(env, 3);
-    cpu_x86_load_seg_cache(env, R_CS, ((env->sysenter_cs + 16) & 0xfffc) | 3, 
-                           0, 0xffffffff, 
+    cpu_x86_load_seg_cache(env, R_CS, ((env->sysenter_cs + 16) & 0xfffc) | 3,
+                           0, 0xffffffff,
                            DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                            DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
                            DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);
-    cpu_x86_load_seg_cache(env, R_SS, ((env->sysenter_cs + 24) & 0xfffc) | 3, 
+    cpu_x86_load_seg_cache(env, R_SS, ((env->sysenter_cs + 24) & 0xfffc) | 3,
                            0, 0xffffffff,
                            DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |
                            DESC_S_MASK | (3 << DESC_DPL_SHIFT) |
@@ -2611,7 +2611,7 @@ void helper_sysexit(void)
 
 void helper_movl_crN_T0(int reg)
 {
-#if !defined(CONFIG_USER_ONLY) 
+#if !defined(CONFIG_USER_ONLY)
     switch(reg) {
     case 0:
         cpu_x86_update_cr0(env, T0);
@@ -2655,7 +2655,7 @@ void helper_rdtsc(void)
     EDX = (uint32_t)(val >> 32);
 }
 
-#if defined(CONFIG_USER_ONLY) 
+#if defined(CONFIG_USER_ONLY)
 void helper_wrmsr(void)
 {
 }
@@ -2695,7 +2695,7 @@ void helper_wrmsr(void)
                 update_mask |= MSR_EFER_FFXSR;
             if (env->cpuid_ext2_features & CPUID_EXT2_NX)
                 update_mask |= MSR_EFER_NXE;
-            env->efer = (env->efer & ~update_mask) | 
+            env->efer = (env->efer & ~update_mask) |
             (val & update_mask);
         }
         break;
@@ -2727,7 +2727,7 @@ void helper_wrmsr(void)
 #endif
     default:
         /* XXX: exception ? */
-        break; 
+        break;
     }
 }
 
@@ -2779,7 +2779,7 @@ void helper_rdmsr(void)
     default:
         /* XXX: exception ? */
         val = 0;
-        break; 
+        break;
     }
     EAX = (uint32_t)(val);
     EDX = (uint32_t)(val >> 32);
@@ -2966,7 +2966,7 @@ void fpu_set_exception(int mask)
 
 CPU86_LDouble helper_fdiv(CPU86_LDouble a, CPU86_LDouble b)
 {
-    if (b == 0.0) 
+    if (b == 0.0)
         fpu_set_exception(FPUS_ZE);
     return a / b;
 }
@@ -2975,8 +2975,8 @@ void fpu_raise_exception(void)
 {
     if (env->cr[0] & CR0_NE_MASK) {
         raise_exception(EXCP10_COPR);
-    } 
-#if !defined(CONFIG_USER_ONLY) 
+    }
+#if !defined(CONFIG_USER_ONLY)
     else {
         cpu_set_ferr(env);
     }
@@ -3040,13 +3040,13 @@ void helper_f2xm1(void)
 void helper_fyl2x(void)
 {
     CPU86_LDouble fptemp;
-    
+
     fptemp = ST0;
     if (fptemp>0.0){
         fptemp = log(fptemp)/log(2.0);  /* log2(ST) */
         ST1 *= fptemp;
         fpop();
-    } else { 
+    } else {
         env->fpus &= (~0x4700);
         env->fpus |= 0x400;
     }
@@ -3131,7 +3131,7 @@ void helper_fprem(void)
     CPU86_LDoubleU fpsrcop1, fptemp1;
     int expdif;
     int q;
-    
+
     fpsrcop = ST0;
     fptemp = ST1;
     fpsrcop1.d = fpsrcop;
@@ -3167,7 +3167,7 @@ void helper_fyl2xp1(void)
         fptemp = log(fptemp+1.0) / log(2.0); /* log2(ST+1.0) */
         ST1 *= fptemp;
         fpop();
-    } else { 
+    } else {
         env->fpus &= (~0x4700);
         env->fpus |= 0x400;
     }
@@ -3178,7 +3178,7 @@ void helper_fsqrt(void)
     CPU86_LDouble fptemp;
 
     fptemp = ST0;
-    if (fptemp<0.0) { 
+    if (fptemp<0.0) {
         env->fpus &= (~0x4700);  /* (C3,C2,C1,C0) <-- 0000 */
         env->fpus |= 0x400;
     }
@@ -3208,7 +3208,7 @@ void helper_frndint(void)
 
 void helper_fscale(void)
 {
-    ST0 = ldexp (ST0, (int)(ST1)); 
+    ST0 = ldexp (ST0, (int)(ST1));
 }
 
 void helper_fsin(void)
@@ -3407,7 +3407,7 @@ void helper_fxsave(target_ulong ptr, int data64)
         helper_fstt(tmp, addr);
         addr += 16;
     }
-    
+
     if (env->cr[4] & CR4_OSFXSR_MASK) {
         /* XXX: finish it */
         stl(ptr + 0x18, env->mxcsr); /* mxcsr */
@@ -3545,17 +3545,17 @@ static void mul64(uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b)
 
     b0 = b;
     b1 = b >> 32;
-    
+
     v = (uint64_t)a0 * (uint64_t)b0;
     *plow = v;
     *phigh = 0;
 
     v = (uint64_t)a0 * (uint64_t)b1;
     add128(plow, phigh, v << 32, v >> 32);
-    
+
     v = (uint64_t)a1 * (uint64_t)b0;
     add128(plow, phigh, v << 32, v >> 32);
-    
+
     v = (uint64_t)a1 * (uint64_t)b1;
     *phigh += v;
 #ifdef DEBUG_MULDIV
@@ -3784,7 +3784,7 @@ void update_fp_status(void)
 #endif
 }
 
-#if !defined(CONFIG_USER_ONLY) 
+#if !defined(CONFIG_USER_ONLY)
 
 #define MMUSUFFIX _mmu
 #define GETPC() (__builtin_return_address(0))
index dc6a5000ecf66e2bf036681bbca62a5bf2e60814..58a5b03ce06e17f7d3065abf8c18072ebab1c6ff 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  i386 helpers (without register variable usage)
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -75,7 +75,7 @@ CPUX86State *cpu_x86_init(void)
         ldt.seg_not_present = 0;
         ldt.useable = 1;
         modify_ldt(1, &ldt, sizeof(ldt)); /* write ldt entry */
-        
+
         asm volatile ("movl %0, %%fs" : : "r" ((1 << 3) | 7));
     }
 #endif
@@ -171,19 +171,19 @@ void cpu_reset(CPUX86State *env)
     env->ldt.flags = DESC_P_MASK;
     env->tr.limit = 0xffff;
     env->tr.flags = DESC_P_MASK;
-    
-    cpu_x86_load_seg_cache(env, R_CS, 0xf000, 0xffff0000, 0xffff, 0); 
+
+    cpu_x86_load_seg_cache(env, R_CS, 0xf000, 0xffff0000, 0xffff, 0);
     cpu_x86_load_seg_cache(env, R_DS, 0, 0, 0xffff, 0);
     cpu_x86_load_seg_cache(env, R_ES, 0, 0, 0xffff, 0);
     cpu_x86_load_seg_cache(env, R_SS, 0, 0, 0xffff, 0);
     cpu_x86_load_seg_cache(env, R_FS, 0, 0, 0xffff, 0);
     cpu_x86_load_seg_cache(env, R_GS, 0, 0, 0xffff, 0);
-    
+
     env->eip = 0xfff0;
     env->regs[R_EDX] = 0x600; /* indicate P6 processor */
-    
+
     env->eflags = 0x2;
-    
+
     /* FPU init */
     for(i = 0;i < 8; i++)
         env->fptags[i] = 1;
@@ -255,7 +255,7 @@ static const char *cc_op_str[] = {
     "SARQ",
 };
 
-void cpu_dump_state(CPUState *env, FILE *f, 
+void cpu_dump_state(CPUState *env, FILE *f,
                     int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
                     int flags)
 {
@@ -266,28 +266,28 @@ void cpu_dump_state(CPUState *env, FILE *f,
     eflags = env->eflags;
 #ifdef TARGET_X86_64
     if (env->hflags & HF_CS64_MASK) {
-        cpu_fprintf(f, 
+        cpu_fprintf(f,
                     "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"
                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"
                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"
                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"
                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",
-                    env->regs[R_EAX], 
-                    env->regs[R_EBX], 
-                    env->regs[R_ECX], 
-                    env->regs[R_EDX], 
-                    env->regs[R_ESI], 
-                    env->regs[R_EDI], 
-                    env->regs[R_EBP], 
-                    env->regs[R_ESP], 
-                    env->regs[8], 
-                    env->regs[9], 
-                    env->regs[10], 
-                    env->regs[11], 
-                    env->regs[12], 
-                    env->regs[13], 
-                    env->regs[14], 
-                    env->regs[15], 
+                    env->regs[R_EAX],
+                    env->regs[R_EBX],
+                    env->regs[R_ECX],
+                    env->regs[R_EDX],
+                    env->regs[R_ESI],
+                    env->regs[R_EDI],
+                    env->regs[R_EBP],
+                    env->regs[R_ESP],
+                    env->regs[8],
+                    env->regs[9],
+                    env->regs[10],
+                    env->regs[11],
+                    env->regs[12],
+                    env->regs[13],
+                    env->regs[14],
+                    env->regs[15],
                     env->eip, eflags,
                     eflags & DF_MASK ? 'D' : '-',
                     eflags & CC_O ? 'O' : '-',
@@ -296,25 +296,25 @@ void cpu_dump_state(CPUState *env, FILE *f,
                     eflags & CC_A ? 'A' : '-',
                     eflags & CC_P ? 'P' : '-',
                     eflags & CC_C ? 'C' : '-',
-                    env->hflags & HF_CPL_MASK, 
+                    env->hflags & HF_CPL_MASK,
                     (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
                     (env->a20_mask >> 20) & 1,
                     (env->hflags >> HF_SMM_SHIFT) & 1,
                     (env->hflags >> HF_HALTED_SHIFT) & 1);
-    } else 
+    } else
 #endif
     {
         cpu_fprintf(f, "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
                     "ESI=%08x EDI=%08x EBP=%08x ESP=%08x\n"
                     "EIP=%08x EFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",
-                    (uint32_t)env->regs[R_EAX], 
-                    (uint32_t)env->regs[R_EBX], 
-                    (uint32_t)env->regs[R_ECX], 
-                    (uint32_t)env->regs[R_EDX], 
-                    (uint32_t)env->regs[R_ESI], 
-                    (uint32_t)env->regs[R_EDI], 
-                    (uint32_t)env->regs[R_EBP], 
-                    (uint32_t)env->regs[R_ESP], 
+                    (uint32_t)env->regs[R_EAX],
+                    (uint32_t)env->regs[R_EBX],
+                    (uint32_t)env->regs[R_ECX],
+                    (uint32_t)env->regs[R_EDX],
+                    (uint32_t)env->regs[R_ESI],
+                    (uint32_t)env->regs[R_EDI],
+                    (uint32_t)env->regs[R_EBP],
+                    (uint32_t)env->regs[R_ESP],
                     (uint32_t)env->eip, eflags,
                     eflags & DF_MASK ? 'D' : '-',
                     eflags & CC_O ? 'O' : '-',
@@ -323,7 +323,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
                     eflags & CC_A ? 'A' : '-',
                     eflags & CC_P ? 'P' : '-',
                     eflags & CC_C ? 'C' : '-',
-                    env->hflags & HF_CPL_MASK, 
+                    env->hflags & HF_CPL_MASK,
                     (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
                     (env->a20_mask >> 20) & 1,
                     (env->hflags >> HF_SMM_SHIFT) & 1,
@@ -356,9 +356,9 @@ void cpu_dump_state(CPUState *env, FILE *f,
         cpu_fprintf(f, "IDT=     %016" PRIx64 " %08x\n",
                     env->idt.base, env->idt.limit);
         cpu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",
-                    (uint32_t)env->cr[0], 
-                    env->cr[2], 
-                    env->cr[3], 
+                    (uint32_t)env->cr[0],
+                    env->cr[2],
+                    env->cr[3],
                     (uint32_t)env->cr[4]);
     } else
 #endif
@@ -387,9 +387,9 @@ void cpu_dump_state(CPUState *env, FILE *f,
         cpu_fprintf(f, "IDT=     %08x %08x\n",
                     (uint32_t)env->idt.base, env->idt.limit);
         cpu_fprintf(f, "CR0=%08x CR2=%08x CR3=%08x CR4=%08x\n",
-                    (uint32_t)env->cr[0], 
-                    (uint32_t)env->cr[2], 
-                    (uint32_t)env->cr[3], 
+                    (uint32_t)env->cr[0],
+                    (uint32_t)env->cr[2],
+                    (uint32_t)env->cr[3],
                     (uint32_t)env->cr[4]);
     }
     if (flags & X86_DUMP_CCOP) {
@@ -400,13 +400,13 @@ void cpu_dump_state(CPUState *env, FILE *f,
 #ifdef TARGET_X86_64
         if (env->hflags & HF_CS64_MASK) {
             cpu_fprintf(f, "CCS=%016" PRIx64 " CCD=%016" PRIx64 " CCO=%-8s\n",
-                        env->cc_src, env->cc_dst, 
+                        env->cc_src, env->cc_dst,
                         cc_op_name);
-        } else 
+        } else
 #endif
         {
             cpu_fprintf(f, "CCS=%08x CCD=%08x CCO=%-8s\n",
-                        (uint32_t)env->cc_src, (uint32_t)env->cc_dst, 
+                        (uint32_t)env->cc_src, (uint32_t)env->cc_dst,
                         cc_op_name);
         }
     }
@@ -443,13 +443,13 @@ void cpu_dump_state(CPUState *env, FILE *f,
             else
                 cpu_fprintf(f, " ");
         }
-        if (env->hflags & HF_CS64_MASK) 
+        if (env->hflags & HF_CS64_MASK)
             nb = 16;
         else
             nb = 8;
         for(i=0;i<nb;i++) {
             cpu_fprintf(f, "XMM%02d=%08x%08x%08x%08x",
-                        i, 
+                        i,
                         env->xmm_regs[i].XMM_L(3),
                         env->xmm_regs[i].XMM_L(2),
                         env->xmm_regs[i].XMM_L(1),
@@ -514,7 +514,7 @@ void cpu_x86_update_cr0(CPUX86State *env, uint32_t new_cr0)
     }
 #endif
     env->cr[0] = new_cr0 | CR0_ET_MASK;
-    
+
     /* update PE flag in hidden flags */
     pe_state = (env->cr[0] & CR0_PE_MASK);
     env->hflags = (env->hflags & ~HF_PE_MASK) | (pe_state << HF_PE_SHIFT);
@@ -564,9 +564,9 @@ void cpu_x86_flush_tlb(CPUX86State *env, target_ulong addr)
     tlb_flush_page(env, addr);
 }
 
-#if defined(CONFIG_USER_ONLY) 
+#if defined(CONFIG_USER_ONLY)
 
-int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr, 
+int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                              int is_write, int is_user, int is_softmmu)
 {
     /* user mode only emulation */
@@ -588,12 +588,12 @@ target_ulong cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
 #define PHYS_ADDR_MASK 0xfffff000
 
 /* return value:
-   -1 = cannot handle fault 
-   0  = nothing more to do 
+   -1 = cannot handle fault
+   0  = nothing more to do
    1  = generate PF fault
    2  = soft MMU activation required for this block
 */
-int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr, 
+int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                              int is_write1, int is_user, int is_softmmu)
 {
     uint64_t ptep, pte;
@@ -601,13 +601,13 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
     int error_code, is_dirty, prot, page_size, ret, is_write;
     unsigned long paddr, page_offset;
     target_ulong vaddr, virt_addr;
-    
+
 #if defined(DEBUG_MMU)
-    printf("MMU fault: addr=" TARGET_FMT_lx " w=%d u=%d eip=" TARGET_FMT_lx "\n", 
+    printf("MMU fault: addr=" TARGET_FMT_lx " w=%d u=%d eip=" TARGET_FMT_lx "\n",
            addr, is_write1, is_user, env->eip);
 #endif
     is_write = is_write1 & 1;
-    
+
     if (!(env->cr[0] & CR0_PG_MASK)) {
         pte = addr;
         virt_addr = addr & TARGET_PAGE_MASK;
@@ -633,8 +633,8 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                 env->exception_index = EXCP0D_GPF;
                 return 1;
             }
-            
-            pml4e_addr = ((env->cr[3] & ~0xfff) + (((addr >> 39) & 0x1ff) << 3)) & 
+
+            pml4e_addr = ((env->cr[3] & ~0xfff) + (((addr >> 39) & 0x1ff) << 3)) &
                 env->a20_mask;
             pml4e = ldq_phys(pml4e_addr);
             if (!(pml4e & PG_PRESENT_MASK)) {
@@ -650,7 +650,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                 stl_phys_notdirty(pml4e_addr, pml4e);
             }
             ptep = pml4e ^ PG_NX_MASK;
-            pdpe_addr = ((pml4e & PHYS_ADDR_MASK) + (((addr >> 30) & 0x1ff) << 3)) & 
+            pdpe_addr = ((pml4e & PHYS_ADDR_MASK) + (((addr >> 30) & 0x1ff) << 3)) &
                 env->a20_mask;
             pdpe = ldq_phys(pdpe_addr);
             if (!(pdpe & PG_PRESENT_MASK)) {
@@ -670,7 +670,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
 #endif
         {
             /* XXX: load them when cr3 is loaded ? */
-            pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 30) << 3)) & 
+            pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 30) << 3)) &
                 env->a20_mask;
             pdpe = ldq_phys(pdpe_addr);
             if (!(pdpe & PG_PRESENT_MASK)) {
@@ -704,8 +704,8 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                 if (is_write && !(ptep & PG_RW_MASK))
                     goto do_fault_protect;
             } else {
-                if ((env->cr[0] & CR0_WP_MASK) && 
-                    is_write && !(ptep & PG_RW_MASK)) 
+                if ((env->cr[0] & CR0_WP_MASK) &&
+                    is_write && !(ptep & PG_RW_MASK))
                     goto do_fault_protect;
             }
             is_dirty = is_write && !(pde & PG_DIRTY_MASK);
@@ -716,7 +716,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                 stl_phys_notdirty(pde_addr, pde);
             }
             /* align to page_size */
-            pte = pde & ((PHYS_ADDR_MASK & ~(page_size - 1)) | 0xfff); 
+            pte = pde & ((PHYS_ADDR_MASK & ~(page_size - 1)) | 0xfff);
             virt_addr = addr & ~(page_size - 1);
         } else {
             /* 4 KB page */
@@ -739,7 +739,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
             ptep &= pte ^ PG_NX_MASK;
             ptep ^= PG_NX_MASK;
             if ((ptep & PG_NX_MASK) && is_write1 == 2)
-                goto do_fault_protect; 
+                goto do_fault_protect;
             if (is_user) {
                 if (!(ptep & PG_USER_MASK))
                     goto do_fault_protect;
@@ -747,7 +747,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                     goto do_fault_protect;
             } else {
                 if ((env->cr[0] & CR0_WP_MASK) &&
-                    is_write && !(ptep & PG_RW_MASK)) 
+                    is_write && !(ptep & PG_RW_MASK))
                     goto do_fault_protect;
             }
             is_dirty = is_write && !(pte & PG_DIRTY_MASK);
@@ -765,7 +765,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
         uint32_t pde;
 
         /* page directory entry */
-        pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & ~3)) & 
+        pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & ~3)) &
             env->a20_mask;
         pde = ldl_phys(pde_addr);
         if (!(pde & PG_PRESENT_MASK)) {
@@ -781,8 +781,8 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                 if (is_write && !(pde & PG_RW_MASK))
                     goto do_fault_protect;
             } else {
-                if ((env->cr[0] & CR0_WP_MASK) && 
-                    is_write && !(pde & PG_RW_MASK)) 
+                if ((env->cr[0] & CR0_WP_MASK) &&
+                    is_write && !(pde & PG_RW_MASK))
                     goto do_fault_protect;
             }
             is_dirty = is_write && !(pde & PG_DIRTY_MASK);
@@ -792,7 +792,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                     pde |= PG_DIRTY_MASK;
                 stl_phys_notdirty(pde_addr, pde);
             }
-        
+
             pte = pde & ~( (page_size - 1) & ~0xfff); /* align to page_size */
             ptep = pte;
             virt_addr = addr & ~(page_size - 1);
@@ -803,7 +803,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
             }
 
             /* page directory entry */
-            pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & 
+            pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) &
                 env->a20_mask;
             pte = ldl_phys(pte_addr);
             if (!(pte & PG_PRESENT_MASK)) {
@@ -819,7 +819,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
                     goto do_fault_protect;
             } else {
                 if ((env->cr[0] & CR0_WP_MASK) &&
-                    is_write && !(ptep & PG_RW_MASK)) 
+                    is_write && !(ptep & PG_RW_MASK))
                     goto do_fault_protect;
             }
             is_dirty = is_write && !(pte & PG_DIRTY_MASK);
@@ -857,7 +857,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
     page_offset = (addr & TARGET_PAGE_MASK) & (page_size - 1);
     paddr = (pte & TARGET_PAGE_MASK) + page_offset;
     vaddr = virt_addr + page_offset;
-    
+
     ret = tlb_set_page_exec(env, vaddr, paddr, prot, is_user, is_softmmu);
     return ret;
  do_fault_protect:
@@ -867,8 +867,8 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
     error_code |= (is_write << PG_ERROR_W_BIT);
     if (is_user)
         error_code |= PG_ERROR_U_MASK;
-    if (is_write1 == 2 && 
-        (env->efer & MSR_EFER_NXE) && 
+    if (is_write1 == 2 &&
+        (env->efer & MSR_EFER_NXE) &&
         (env->cr[4] & CR4_PAE_MASK))
         error_code |= PG_ERROR_I_D_MASK;
     env->error_code = error_code;
@@ -895,22 +895,22 @@ target_ulong cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
             sext = (int64_t)addr >> 47;
             if (sext != 0 && sext != -1)
                 return -1;
-            
-            pml4e_addr = ((env->cr[3] & ~0xfff) + (((addr >> 39) & 0x1ff) << 3)) & 
+
+            pml4e_addr = ((env->cr[3] & ~0xfff) + (((addr >> 39) & 0x1ff) << 3)) &
                 env->a20_mask;
             pml4e = ldl_phys(pml4e_addr);
             if (!(pml4e & PG_PRESENT_MASK))
                 return -1;
-            
-            pdpe_addr = ((pml4e & ~0xfff) + (((addr >> 30) & 0x1ff) << 3)) & 
+
+            pdpe_addr = ((pml4e & ~0xfff) + (((addr >> 30) & 0x1ff) << 3)) &
                 env->a20_mask;
             pdpe = ldl_phys(pdpe_addr);
             if (!(pdpe & PG_PRESENT_MASK))
                 return -1;
-        } else 
+        } else
 #endif
         {
-            pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 30) << 3)) & 
+            pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 30) << 3)) &
                 env->a20_mask;
             pdpe = ldl_phys(pdpe_addr);
             if (!(pdpe & PG_PRESENT_MASK))
@@ -942,7 +942,7 @@ target_ulong cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
             /* page directory entry */
             pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & ~3)) & env->a20_mask;
             pde = ldl_phys(pde_addr);
-            if (!(pde & PG_PRESENT_MASK)) 
+            if (!(pde & PG_PRESENT_MASK))
                 return -1;
             if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {
                 pte = pde & ~0x003ff000; /* align to 4MB */
@@ -985,7 +985,7 @@ void restore_native_fp_state(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;
@@ -1006,7 +1006,7 @@ void restore_native_fp_state(CPUState *env)
     asm volatile ("frstor %0" : "=m" (*fp));
     env->native_fp_regs = 1;
 }
+
 void save_native_fp_state(CPUState *env)
 {
     int fptag, i, j;
index a8cfce271b53869f9db104a1598a72624e5cb252..c65ab16cc1a6b6e1f06cb5716a8abc6fd4b0c33f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  i386 micro operations
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -521,7 +521,7 @@ typedef union UREG64 {
     __p.l.v1 = PARAM1;\
     __p.l.v0 = PARAM2;\
     __p.q;\
-}) 
+})
 
 void OPPROTO op_movq_T0_im64(void)
 {
@@ -1144,7 +1144,7 @@ void OPPROTO op_movl_seg_T0_vm(void)
 {
     int selector;
     SegmentCache *sc;
-    
+
     selector = T0 & 0xffff;
     /* env->segs[] access */
     sc = (SegmentCache *)((char *)env + PARAM1);
@@ -1188,14 +1188,14 @@ void OPPROTO op_arpl(void)
     }
     FORCE_RET();
 }
-            
+
 void OPPROTO op_arpl_update(void)
 {
     int eflags;
     eflags = cc_table[CC_OP].compute_all();
     CC_SRC = (eflags & ~CC_Z) | T1;
 }
-    
+
 /* T0: segment, T1:eip */
 void OPPROTO op_ljmp_protected_T0_T1(void)
 {
@@ -1243,7 +1243,7 @@ void OPPROTO op_movl_crN_T0(void)
     helper_movl_crN_T0(PARAM1);
 }
 
-#if !defined(CONFIG_USER_ONLY) 
+#if !defined(CONFIG_USER_ONLY)
 void OPPROTO op_movtl_T0_cr8(void)
 {
     T0 = cpu_get_apic_tpr(env);
@@ -1586,23 +1586,23 @@ CCTable cc_table[CC_OP_NB] = {
     [CC_OP_SUBB] = { compute_all_subb, compute_c_subb  },
     [CC_OP_SUBW] = { compute_all_subw, compute_c_subw  },
     [CC_OP_SUBL] = { compute_all_subl, compute_c_subl  },
-    
+
     [CC_OP_SBBB] = { compute_all_sbbb, compute_c_sbbb  },
     [CC_OP_SBBW] = { compute_all_sbbw, compute_c_sbbw  },
     [CC_OP_SBBL] = { compute_all_sbbl, compute_c_sbbl  },
-    
+
     [CC_OP_LOGICB] = { compute_all_logicb, compute_c_logicb },
     [CC_OP_LOGICW] = { compute_all_logicw, compute_c_logicw },
     [CC_OP_LOGICL] = { compute_all_logicl, compute_c_logicl },
-    
+
     [CC_OP_INCB] = { compute_all_incb, compute_c_incl },
     [CC_OP_INCW] = { compute_all_incw, compute_c_incl },
     [CC_OP_INCL] = { compute_all_incl, compute_c_incl },
-    
+
     [CC_OP_DECB] = { compute_all_decb, compute_c_incl },
     [CC_OP_DECW] = { compute_all_decw, compute_c_incl },
     [CC_OP_DECL] = { compute_all_decl, compute_c_incl },
-    
+
     [CC_OP_SHLB] = { compute_all_shlb, compute_c_shlb },
     [CC_OP_SHLW] = { compute_all_shlw, compute_c_shlw },
     [CC_OP_SHLL] = { compute_all_shll, compute_c_shll },
@@ -1619,11 +1619,11 @@ CCTable cc_table[CC_OP_NB] = {
     [CC_OP_ADCQ] = { compute_all_adcq, compute_c_adcq  },
 
     [CC_OP_SUBQ] = { compute_all_subq, compute_c_subq  },
-    
+
     [CC_OP_SBBQ] = { compute_all_sbbq, compute_c_sbbq  },
-    
+
     [CC_OP_LOGICQ] = { compute_all_logicq, compute_c_logicq },
-    
+
     [CC_OP_INCQ] = { compute_all_incq, compute_c_incl },
 
     [CC_OP_DECQ] = { compute_all_decq, compute_c_incl },
index 648063650b3840ae68a5d1d13cb4d9df62825e79..eae4139d10a48c14b3369b04d6d5b9b8a305cc75 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  i386 micro operations (templates for various register related
  *  operations)
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
index df1527c554c5f97ccb47f2ced36cfc97216dac4d..82d1ec0a1e770da47cb0b6c868d1cf775c93f847 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  MMX/SSE/SSE2/PNI support
- * 
+ *
  *  Copyright (c) 2005 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -1213,7 +1213,7 @@ void OPPROTO glue(op_pinsrw, SUFFIX) (void)
 {
     Reg *d = (Reg *)((char *)env + PARAM1);
     int pos = PARAM2;
-    
+
     d->W(pos) = T0;
 }
 
@@ -1221,7 +1221,7 @@ void OPPROTO glue(op_pextrw, SUFFIX) (void)
 {
     Reg *s = (Reg *)((char *)env + PARAM1);
     int pos = PARAM2;
-    
+
     T0 = s->W(pos);
 }
 
index 373b77a2451f9be73cf808b788ef697214cef222..d1df07f9d1a54e540603b70a8c115625444984aa 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  i386 micro operations (included several times to generate
  *  different operand sizes)
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -239,7 +239,7 @@ static int glue(compute_all_sar, SUFFIX)(void)
     zf = ((DATA_TYPE)CC_DST == 0) << 6;
     sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80;
     /* of is defined if shift count == 1 */
-    of = lshift(CC_SRC ^ CC_DST, 12 - DATA_BITS) & CC_O; 
+    of = lshift(CC_SRC ^ CC_DST, 12 - DATA_BITS) & CC_O;
     return cf | pf | af | zf | sf | of;
 }
 
@@ -502,7 +502,7 @@ void OPPROTO glue(glue(op_bsf, SUFFIX), _T0_cc)(void)
 {
     int count;
     target_long res;
-    
+
     res = T0 & DATA_MASK;
     if (res != 0) {
         count = 0;
index 9f72a8c9653ba520643e3a0773758117fa8be627..ae17d8e3cae5162e81cf2840dbcf1d72b077cf66 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  i386 micro operations (included several times to generate
  *  different operand sizes)
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -84,8 +84,8 @@ void OPPROTO glue(glue(op_rol, MEM_SUFFIX), _T0_T1_cc)(void)
         /* gcc 3.2 workaround. This is really a bug in gcc. */
         asm volatile("" : : "r" (T0));
 #endif
-        CC_SRC = (cc_table[CC_OP].compute_all() & ~(CC_O | CC_C)) | 
-            (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) | 
+        CC_SRC = (cc_table[CC_OP].compute_all() & ~(CC_O | CC_C)) |
+            (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) |
             (T0 & CC_C);
         CC_OP = CC_OP_EFLAGS;
     }
@@ -109,7 +109,7 @@ void OPPROTO glue(glue(op_ror, MEM_SUFFIX), _T0_T1_cc)(void)
         asm volatile("" : : "r" (T0));
 #endif
         CC_SRC = (cc_table[CC_OP].compute_all() & ~(CC_O | CC_C)) |
-            (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) | 
+            (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) |
             ((T0 >> (DATA_BITS - 1)) & CC_C);
         CC_OP = CC_OP_EFLAGS;
     }
@@ -168,7 +168,7 @@ void OPPROTO glue(glue(op_rcl, MEM_SUFFIX), _T0_T1_cc)(void)
         glue(st, MEM_SUFFIX)(A0, T0);
 #endif
         CC_SRC = (eflags & ~(CC_C | CC_O)) |
-            (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) | 
+            (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) |
             ((src >> (DATA_BITS - count)) & CC_C);
         CC_OP = CC_OP_EFLAGS;
     }
@@ -199,7 +199,7 @@ void OPPROTO glue(glue(op_rcr, MEM_SUFFIX), _T0_T1_cc)(void)
         glue(st, MEM_SUFFIX)(A0, T0);
 #endif
         CC_SRC = (eflags & ~(CC_C | CC_O)) |
-            (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) | 
+            (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) |
             ((src >> (count - 1)) & CC_C);
         CC_OP = CC_OP_EFLAGS;
     }
index cf8bd5ab3f7ba97d97cf69dc2eca8133a8c14c59..d68764360b7443984ed7c070d9e831e475a76d8b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  i386 on i386 translation
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -42,7 +42,7 @@ extern char exec_loop;
 enum {
     OT_BYTE = 0,
     OT_WORD,
-    OT_LONG, 
+    OT_LONG,
     OT_QUAD,
 };
 
@@ -63,7 +63,7 @@ typedef struct DisasContext {
     /* code output */
     uint8_t *gen_code_ptr;
     uint8_t *gen_code_start;
-    
+
     /* current block context */
     target_ulong cs_base; /* base of CS segment */
     int pe;     /* protected mode */
@@ -105,22 +105,22 @@ static inline void gjmp(DisasContext *s, long val)
     gl(s, val - (long)(s->gen_code_ptr + 4));
 }
 
-static inline void gen_movl_addr_im(DisasContext *s, 
+static inline void gen_movl_addr_im(DisasContext *s,
                                     uint32_t addr, uint32_t val)
 {
     gb(s, CPU_SEG); /* seg movl im, addr */
-    gb(s, 0xc7); 
+    gb(s, 0xc7);
     gb(s, 0x05);
     gl(s, addr);
     gl(s, val);
 }
 
-static inline void gen_movw_addr_im(DisasContext *s, 
+static inline void gen_movw_addr_im(DisasContext *s,
                                     uint32_t addr, uint32_t val)
 {
     gb(s, CPU_SEG); /* seg movl im, addr */
-    gb(s, 0x66); 
-    gb(s, 0xc7); 
+    gb(s, 0x66);
+    gb(s, 0xc7);
     gb(s, 0x05);
     gl(s, addr);
     gw(s, val);
@@ -155,7 +155,7 @@ static void gen_jcc(DisasContext *s, int op,
     gb(s, 0xe9); /* jmp */
     tb->tb_jmp_offset[1] = s->gen_code_ptr - s->gen_code_start;
     gl(s, 0);
-    
+
     tb->tb_next_offset[0] = s->gen_code_ptr - s->gen_code_start;
     gen_movl_addr_im(s, CPU_FIELD_OFFSET(eip), target_eip);
     gen_movl_addr_im(s, CPU_FIELD_OFFSET(tmp0), (uint32_t)tb);
@@ -194,7 +194,7 @@ static inline void gen_lea_modrm(DisasContext *s, int modrm)
         base = rm;
         index = 0;
         scale = 0;
-        
+
         if (base == 4) {
             havesib = 1;
             code = ldub_code(s->pc++);
@@ -222,7 +222,7 @@ static inline void gen_lea_modrm(DisasContext *s, int modrm)
             s->pc += 4;
             break;
         }
-        
+
     } else {
         switch (mod) {
         case 0:
@@ -248,7 +248,7 @@ static inline void gen_lea_modrm(DisasContext *s, int modrm)
 static inline void parse_modrm(DisasContext *s, int modrm)
 {
     if ((modrm & 0xc0) != 0xc0)
-        gen_lea_modrm(s, modrm);        
+        gen_lea_modrm(s, modrm);
 }
 
 static inline uint32_t insn_get(DisasContext *s, int ot)
@@ -351,7 +351,7 @@ static int disas_insn(DisasContext *s)
         /* extended op code */
         b = ldub_code(s->pc++) | 0x100;
         goto reswitch;
-        
+
         /**************************/
         /* arith & logic */
     case 0x00 ... 0x05:
@@ -370,7 +370,7 @@ static int disas_insn(DisasContext *s)
                 ot = OT_BYTE;
             else
                 ot = dflag ? OT_LONG : OT_WORD;
-            
+
             switch(f) {
             case 0: /* OP Ev, Gv */
                 modrm = ldub_code(s->pc++);
@@ -396,7 +396,7 @@ static int disas_insn(DisasContext *s)
                 ot = OT_BYTE;
             else
                 ot = dflag ? OT_LONG : OT_WORD;
-            
+
             modrm = ldub_code(s->pc++);
             parse_modrm(s, modrm);
 
@@ -475,8 +475,8 @@ static int disas_insn(DisasContext *s)
             break;
         case 2: /* call Ev */
             /* XXX: optimize and handle MEM exceptions specifically
-               fs movl %eax, regs[0] 
-               movl Ev, %eax 
+               fs movl %eax, regs[0]
+               movl Ev, %eax
                pushl next_eip
                fs movl %eax, eip
             */
@@ -485,8 +485,8 @@ static int disas_insn(DisasContext *s)
             goto unsupported_op;
         case 4: /* jmp Ev */
             /* XXX: optimize and handle MEM exceptions specifically
-               fs movl %eax, regs[0] 
-               movl Ev, %eax 
+               fs movl %eax, regs[0]
+               movl Ev, %eax
                fs movl %eax, eip
             */
             goto unsupported_op;
@@ -506,7 +506,7 @@ static int disas_insn(DisasContext *s)
             ot = dflag ? OT_LONG : OT_WORD;
         insn_get(s, ot);
         break;
-        
+
     case 0x98: /* CWDE/CBW */
         break;
     case 0x99: /* CDQ/CWD */
@@ -526,8 +526,8 @@ static int disas_insn(DisasContext *s)
         break;
 
     case 0x84: /* test Ev, Gv */
-    case 0x85: 
-        
+    case 0x85:
+
     case 0x1c0:
     case 0x1c1: /* xadd Ev, Gv */
 
@@ -583,7 +583,7 @@ static int disas_insn(DisasContext *s)
             goto illegal_op;
         parse_modrm(s, modrm);
         break;
-        
+
         /**************************/
         /* push/pop */
     case 0x50 ... 0x57: /* push */
@@ -654,7 +654,7 @@ static int disas_insn(DisasContext *s)
         goto unsupported_op;
         /************************/
         /* floats */
-    case 0xd8 ... 0xdf: 
+    case 0xd8 ... 0xdf:
 #if 1
         /* currently not stable enough */
         goto unsupported_op;
@@ -850,7 +850,7 @@ static int disas_insn(DisasContext *s)
             goto illegal_op;
         parse_modrm(s, modrm);
         break;
-        
+
     case 0xa0: /* mov EAX, Ov */
     case 0xa1:
     case 0xa2: /* mov Ov, EAX */
@@ -888,14 +888,14 @@ static int disas_insn(DisasContext *s)
         parse_modrm(s, modrm);
         ldub_code(s->pc++);
         break;
-        
+
         /************************/
         /* string ops */
 
     case 0xa4: /* movsS */
     case 0xa5:
         break;
-        
+
     case 0xaa: /* stosS */
     case 0xab:
         break;
@@ -955,7 +955,7 @@ static int disas_insn(DisasContext *s)
 
     case 0xc3: /* ret */
         gb(s, CPU_SEG);
-        if (!s->dflag)  
+        if (!s->dflag)
             gb(s, 0x66); /* d16 */
         gb(s, 0x8f); /* pop addr */
         gb(s, 0x05);
@@ -1011,7 +1011,7 @@ static int disas_insn(DisasContext *s)
         if (dflag) {
             val = insn_get(s, OT_LONG);
         } else {
-            val = (int16_t)insn_get(s, OT_WORD); 
+            val = (int16_t)insn_get(s, OT_WORD);
         }
     do_jcc:
         next_eip = s->pc - s->cs_base;
@@ -1071,7 +1071,7 @@ static int disas_insn(DisasContext *s)
     case 0x90: /* nop */
         break;
     case 0x9b: /* fwait */
-        if ((s->flags & (HF_MP_MASK | HF_TS_MASK)) == 
+        if ((s->flags & (HF_MP_MASK | HF_TS_MASK)) ==
             (HF_MP_MASK | HF_TS_MASK)) {
             goto unsupported_op;
         }
@@ -1171,7 +1171,7 @@ static int disas_insn(DisasContext *s)
 #define GEN_CODE_MAX_INSN_SIZE 512
 
 static inline int gen_intermediate_code_internal(CPUState *env,
-                                                 TranslationBlock *tb, 
+                                                 TranslationBlock *tb,
                                                  uint8_t *gen_code_ptr,
                                                  int *gen_code_size_ptr,
                                                  int search_pc,
@@ -1186,14 +1186,14 @@ static inline int gen_intermediate_code_internal(CPUState *env,
         env->singlestep_enabled)
         return -1;
     flags = tb->flags;
-    if (flags & (HF_TF_MASK | HF_ADDSEG_MASK | 
+    if (flags & (HF_TF_MASK | HF_ADDSEG_MASK |
                  HF_SOFTMMU_MASK | HF_INHIBIT_IRQ_MASK))
         return -1;
     if (!(flags & HF_SS32_MASK))
         return -1;
     if (tb->cflags & CF_SINGLE_INSN)
         return -1;
-    gen_code_end = gen_code_ptr + 
+    gen_code_end = gen_code_ptr +
         GEN_CODE_MAX_SIZE - GEN_CODE_MAX_INSN_SIZE;
     dc->gen_code_ptr = gen_code_ptr;
     dc->gen_code_start = gen_code_ptr;
@@ -1244,11 +1244,11 @@ static inline int gen_intermediate_code_internal(CPUState *env,
             break;
         }
     }
-    
+
 #ifdef DEBUG_DISAS
     if (loglevel & CPU_LOG_TB_IN_ASM) {
         fprintf(logfile, "----------------\n");
-        fprintf(logfile, "IN: COPY: %s fpu=%d\n", 
+        fprintf(logfile, "IN: COPY: %s fpu=%d\n",
                 lookup_symbol(pc_start),
                 tb->cflags & CF_TB_FP_USED ? 1 : 0);
        target_disas(logfile, pc_start, dc->pc - pc_start, !dc->code32);
@@ -1279,14 +1279,14 @@ int cpu_gen_code_copy(CPUState *env, TranslationBlock *tb,
     tb->tb_jmp_offset[2] = 0xffff;
     tb->tb_jmp_offset[3] = 0xffff;
 #endif
-    return gen_intermediate_code_internal(env, tb, 
+    return gen_intermediate_code_internal(env, tb,
                                           tb->tc_ptr, gen_code_size_ptr,
                                           0, NULL);
 }
 
 static uint8_t dummy_gen_code_buf[GEN_CODE_MAX_SIZE];
 
-int cpu_restore_state_copy(TranslationBlock *tb, 
+int cpu_restore_state_copy(TranslationBlock *tb,
                            CPUState *env, unsigned long searched_pc,
                            void *puc)
 {
@@ -1297,14 +1297,14 @@ int cpu_restore_state_copy(TranslationBlock *tb,
     if (searched_pc < (unsigned long)tb->tc_ptr)
         return -1;
     searched_pc = searched_pc - (long)tb->tc_ptr + (long)dummy_gen_code_buf;
-    ret = gen_intermediate_code_internal(env, tb, 
+    ret = gen_intermediate_code_internal(env, tb,
                                          dummy_gen_code_buf, NULL,
                                          1, (uint8_t *)searched_pc);
     if (ret < 0)
         return ret;
     /* restore all the CPU state from the CPU context from the
        signal. The FPU context stays in the host CPU. */
-    
+
     env->regs[R_EAX] = uc->uc_mcontext.gregs[REG_EAX];
     env->regs[R_ECX] = uc->uc_mcontext.gregs[REG_ECX];
     env->regs[R_EDX] = uc->uc_mcontext.gregs[REG_EDX];
index e147704aad429d75162cd69a82ec58ea92cea792..9f69caad53b43a7c319323a132d810a888495eaa 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  i386 translation
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -109,24 +109,24 @@ static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num);
 
 /* i386 arith/logic operations */
 enum {
-    OP_ADDL, 
-    OP_ORL, 
-    OP_ADCL, 
+    OP_ADDL,
+    OP_ORL,
+    OP_ADCL,
     OP_SBBL,
-    OP_ANDL, 
-    OP_SUBL, 
-    OP_XORL, 
+    OP_ANDL,
+    OP_SUBL,
+    OP_XORL,
     OP_CMPL,
 };
 
 /* i386 shift ops */
 enum {
-    OP_ROL, 
-    OP_ROR, 
-    OP_RCL, 
-    OP_RCR, 
-    OP_SHL, 
-    OP_SHR, 
+    OP_ROL,
+    OP_ROR,
+    OP_RCL,
+    OP_RCR,
+    OP_SHL,
+    OP_SHR,
     OP_SHL1, /* undocumented */
     OP_SAR = 7,
 };
@@ -144,7 +144,7 @@ enum {
 enum {
     OT_BYTE = 0,
     OT_WORD,
-    OT_LONG, 
+    OT_LONG,
     OT_QUAD,
 };
 
@@ -333,7 +333,7 @@ static GenOpFunc *gen_op_mov_reg_A0[NB_OP_SIZES - 1][CPU_NB_REGS] = {
 #endif
 };
 
-static GenOpFunc *gen_op_mov_TN_reg[NB_OP_SIZES][2][CPU_NB_REGS] = 
+static GenOpFunc *gen_op_mov_TN_reg[NB_OP_SIZES][2][CPU_NB_REGS] =
 {
     [OT_BYTE] = {
         {
@@ -878,7 +878,7 @@ static GenOpFunc1 *gen_op_jnz_ecx[3] = {
     gen_op_jnz_ecxl,
     X86_64_ONLY(gen_op_jnz_ecxq),
 };
-    
+
 static GenOpFunc1 *gen_op_jz_ecx[3] = {
     gen_op_jz_ecxw,
     gen_op_jz_ecxl,
@@ -966,7 +966,7 @@ static inline void gen_movs(DisasContext *s, int ot)
     if (s->aflag == 2) {
         gen_op_addq_ESI_T0();
         gen_op_addq_EDI_T0();
-    } else 
+    } else
 #endif
     if (s->aflag) {
         gen_op_addl_ESI_T0();
@@ -1009,7 +1009,7 @@ static inline void gen_stos(DisasContext *s, int ot)
 #ifdef TARGET_X86_64
     if (s->aflag == 2) {
         gen_op_addq_EDI_T0();
-    } else 
+    } else
 #endif
     if (s->aflag) {
         gen_op_addl_EDI_T0();
@@ -1027,7 +1027,7 @@ static inline void gen_lods(DisasContext *s, int ot)
 #ifdef TARGET_X86_64
     if (s->aflag == 2) {
         gen_op_addq_ESI_T0();
-    } else 
+    } else
 #endif
     if (s->aflag) {
         gen_op_addl_ESI_T0();
@@ -1046,7 +1046,7 @@ static inline void gen_scas(DisasContext *s, int ot)
 #ifdef TARGET_X86_64
     if (s->aflag == 2) {
         gen_op_addq_EDI_T0();
-    } else 
+    } else
 #endif
     if (s->aflag) {
         gen_op_addl_EDI_T0();
@@ -1067,7 +1067,7 @@ static inline void gen_cmps(DisasContext *s, int ot)
     if (s->aflag == 2) {
         gen_op_addq_ESI_T0();
         gen_op_addq_EDI_T0();
-    } else 
+    } else
 #endif
     if (s->aflag) {
         gen_op_addl_ESI_T0();
@@ -1089,7 +1089,7 @@ static inline void gen_ins(DisasContext *s, int ot)
 #ifdef TARGET_X86_64
     if (s->aflag == 2) {
         gen_op_addq_EDI_T0();
-    } else 
+    } else
 #endif
     if (s->aflag) {
         gen_op_addl_EDI_T0();
@@ -1107,7 +1107,7 @@ static inline void gen_outs(DisasContext *s, int ot)
 #ifdef TARGET_X86_64
     if (s->aflag == 2) {
         gen_op_addq_ESI_T0();
-    } else 
+    } else
 #endif
     if (s->aflag) {
         gen_op_addl_ESI_T0();
@@ -1318,7 +1318,7 @@ static GenOpFunc1 *gen_op_fp_arith_STN_ST0[8] = {
 static void gen_op(DisasContext *s1, int op, int ot, int d)
 {
     GenOpFunc *gen_update_cc;
-    
+
     if (d != OR_TMP0) {
         gen_op_mov_TN_reg[ot][0][d]();
     } else {
@@ -1408,7 +1408,7 @@ static void gen_shift(DisasContext *s1, int op, int ot, int d, int s)
     /* for zero counts, flags are not updated, so must do it dynamically */
     if (s1->cc_op != CC_OP_DYNAMIC)
         gen_op_set_cc_op(s1->cc_op);
-    
+
     if (d != OR_TMP0)
         gen_op_shift_T0_T1_cc[ot][op]();
     else
@@ -1448,7 +1448,7 @@ static void gen_lea_modrm(DisasContext *s, int modrm, int *reg_ptr, int *offset_
         base = rm;
         index = 0;
         scale = 0;
-        
+
         if (base == 4) {
             havesib = 1;
             code = ldub_code(s->pc++);
@@ -1480,7 +1480,7 @@ static void gen_lea_modrm(DisasContext *s, int modrm, int *reg_ptr, int *offset_
             s->pc += 4;
             break;
         }
-        
+
         if (base >= 0) {
             /* for correct popl handling with esp */
             if (base == 4 && s->popl_esp_hack)
@@ -1494,7 +1494,7 @@ static void gen_lea_modrm(DisasContext *s, int modrm, int *reg_ptr, int *offset_
                     else
                         gen_op_addq_A0_im64(disp >> 32, disp);
                 }
-            } else 
+            } else
 #endif
             {
                 gen_op_movl_A0_reg[base]();
@@ -1508,7 +1508,7 @@ static void gen_lea_modrm(DisasContext *s, int modrm, int *reg_ptr, int *offset_
                     gen_op_movq_A0_im(disp);
                 else
                     gen_op_movq_A0_im64(disp >> 32, disp);
-            } else 
+            } else
 #endif
             {
                 gen_op_movl_A0_im(disp);
@@ -1519,7 +1519,7 @@ static void gen_lea_modrm(DisasContext *s, int modrm, int *reg_ptr, int *offset_
 #ifdef TARGET_X86_64
             if (s->aflag == 2) {
                 gen_op_addq_A0_reg_sN[scale][index]();
-            } else 
+            } else
 #endif
             {
                 gen_op_addl_A0_reg_sN[scale][index]();
@@ -1535,7 +1535,7 @@ static void gen_lea_modrm(DisasContext *s, int modrm, int *reg_ptr, int *offset_
 #ifdef TARGET_X86_64
             if (s->aflag == 2) {
                 gen_op_addq_A0_seg(offsetof(CPUX86State,segs[override].base));
-            } else 
+            } else
 #endif
             {
                 gen_op_addl_A0_seg(offsetof(CPUX86State,segs[override].base));
@@ -1627,12 +1627,12 @@ static void gen_nop_modrm(DisasContext *s, int modrm)
     if (s->aflag) {
 
         base = rm;
-        
+
         if (base == 4) {
             code = ldub_code(s->pc++);
             base = (code & 7);
         }
-        
+
         switch (mod) {
         case 0:
             if (base == 5) {
@@ -1681,7 +1681,7 @@ static void gen_add_A0_ds_seg(DisasContext *s)
 #ifdef TARGET_X86_64
         if (CODE64(s)) {
             gen_op_addq_A0_seg(offsetof(CPUX86State,segs[override].base));
-        } else 
+        } else
 #endif
         {
             gen_op_addl_A0_seg(offsetof(CPUX86State,segs[override].base));
@@ -1776,7 +1776,7 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
     }
 }
 
-static inline void gen_jcc(DisasContext *s, int b, 
+static inline void gen_jcc(DisasContext *s, int b,
                            target_ulong val, target_ulong next_eip)
 {
     TranslationBlock *tb;
@@ -1787,7 +1787,7 @@ static inline void gen_jcc(DisasContext *s, int b,
 
     inv = b & 1;
     jcc_op = (b >> 1) & 7;
-    
+
     if (s->jmp_opt) {
         switch(s->cc_op) {
             /* we optimize the cmp/jcc case */
@@ -1797,7 +1797,7 @@ static inline void gen_jcc(DisasContext *s, int b,
         case CC_OP_SUBQ:
             func = gen_jcc_sub[s->cc_op - CC_OP_SUBB][jcc_op];
             break;
-            
+
             /* some jumps are easy to compute */
         case CC_OP_ADDB:
         case CC_OP_ADDW:
@@ -1864,7 +1864,7 @@ static inline void gen_jcc(DisasContext *s, int b,
             gen_setcc_slow[jcc_op]();
             func = gen_op_jnz_T0_label;
         }
-    
+
         if (inv) {
             tmp = val;
             val = next_eip;
@@ -1922,7 +1922,7 @@ static void gen_setcc(DisasContext *s, int b)
         if (!func)
             goto slow_jcc;
         break;
-        
+
         /* some jumps are easy to compute */
     case CC_OP_ADDB:
     case CC_OP_ADDW:
@@ -2001,7 +2001,7 @@ static inline void gen_stack_update(DisasContext *s, int addend)
     if (CODE64(s)) {
         if (addend == 8)
             gen_op_addq_ESP_8();
-        else 
+        else
             gen_op_addq_ESP_im(addend);
     } else
 #endif
@@ -2010,7 +2010,7 @@ static inline void gen_stack_update(DisasContext *s, int addend)
             gen_op_addl_ESP_2();
         else if (addend == 4)
             gen_op_addl_ESP_4();
-        else 
+        else
             gen_op_addl_ESP_im(addend);
     } else {
         if (addend == 2)
@@ -2036,7 +2036,7 @@ static void gen_push_T0(DisasContext *s)
             gen_op_st_T0_A0[OT_WORD + s->mem_index]();
         }
         gen_op_movq_ESP_A0();
-    } else 
+    } else
 #endif
     {
         gen_op_movl_A0_reg[R_ESP]();
@@ -2077,7 +2077,7 @@ static void gen_push_T1(DisasContext *s)
             gen_op_st_T0_A0[OT_WORD + s->mem_index]();
         }
         gen_op_movq_ESP_A0();
-    } else 
+    } else
 #endif
     {
         gen_op_movl_A0_reg[R_ESP]();
@@ -2094,7 +2094,7 @@ static void gen_push_T1(DisasContext *s)
             gen_op_addl_A0_SS();
         }
         gen_op_st_T1_A0[s->dflag + 1 + s->mem_index]();
-        
+
         if (s->ss32 && !s->addseg)
             gen_op_movl_ESP_A0();
         else
@@ -2109,7 +2109,7 @@ static void gen_pop_T0(DisasContext *s)
     if (CODE64(s)) {
         gen_op_movq_A0_reg[R_ESP]();
         gen_op_ld_T0_A0[(s->dflag ? OT_QUAD : OT_WORD) + s->mem_index]();
-    } else 
+    } else
 #endif
     {
         gen_op_movl_A0_reg[R_ESP]();
@@ -2196,7 +2196,7 @@ static void gen_enter(DisasContext *s, int esp_addend, int level)
     if (CODE64(s)) {
         ot = s->dflag ? OT_QUAD : OT_WORD;
         opsize = 1 << ot;
-        
+
         gen_op_movl_A0_ESP();
         gen_op_addq_A0_im(-opsize);
         gen_op_movl_T1_A0();
@@ -2210,12 +2210,12 @@ static void gen_enter(DisasContext *s, int esp_addend, int level)
         gen_op_mov_reg_T1[ot][R_EBP]();
         gen_op_addl_T1_im( -esp_addend + (-opsize * level) );
         gen_op_mov_reg_T1[OT_QUAD][R_ESP]();
-    } else 
+    } else
 #endif
     {
         ot = s->dflag + OT_WORD;
         opsize = 2 << s->dflag;
-        
+
         gen_op_movl_A0_ESP();
         gen_op_addl_A0_im(-opsize);
         if (!s->ss32)
@@ -2246,7 +2246,7 @@ static void gen_exception(DisasContext *s, int trapno, target_ulong cur_eip)
 
 /* an interrupt is different from an exception because of the
    priviledge checks */
-static void gen_interrupt(DisasContext *s, int intno, 
+static void gen_interrupt(DisasContext *s, int intno,
                           target_ulong cur_eip, target_ulong next_eip)
 {
     if (s->cc_op != CC_OP_DYNAMIC)
@@ -2309,7 +2309,7 @@ static void gen_jmp(DisasContext *s, target_ulong eip)
 
 static void gen_movtl_T0_im(target_ulong val)
 {
-#ifdef TARGET_X86_64    
+#ifdef TARGET_X86_64
     if ((int32_t)val == val) {
         gen_op_movl_T0_im(val);
     } else {
@@ -2322,7 +2322,7 @@ static void gen_movtl_T0_im(target_ulong val)
 
 static void gen_movtl_T1_im(target_ulong val)
 {
-#ifdef TARGET_X86_64    
+#ifdef TARGET_X86_64
     if ((int32_t)val == val) {
         gen_op_movl_T1_im(val);
     } else {
@@ -2410,7 +2410,7 @@ static GenOpFunc2 *sse_op_table1[256][4] = {
     [0x57] = { gen_op_pxor_xmm, gen_op_pxor_xmm }, /* xorps, xorpd */
     [0x58] = SSE_FOP(add),
     [0x59] = SSE_FOP(mul),
-    [0x5a] = { gen_op_cvtps2pd, gen_op_cvtpd2ps, 
+    [0x5a] = { gen_op_cvtps2pd, gen_op_cvtpd2ps,
                gen_op_cvtss2sd, gen_op_cvtsd2ss },
     [0x5b] = { gen_op_cvtdq2ps, gen_op_cvtps2dq, gen_op_cvttps2dq },
     [0x5c] = SSE_FOP(sub),
@@ -2438,9 +2438,9 @@ static GenOpFunc2 *sse_op_table1[256][4] = {
     [0x6d] = { NULL, gen_op_punpckhqdq_xmm },
     [0x6e] = { SSE_SPECIAL, SSE_SPECIAL }, /* movd mm, ea */
     [0x6f] = { SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* movq, movdqa, , movqdu */
-    [0x70] = { (GenOpFunc2 *)gen_op_pshufw_mmx, 
-               (GenOpFunc2 *)gen_op_pshufd_xmm, 
-               (GenOpFunc2 *)gen_op_pshufhw_xmm, 
+    [0x70] = { (GenOpFunc2 *)gen_op_pshufw_mmx,
+               (GenOpFunc2 *)gen_op_pshufd_xmm,
+               (GenOpFunc2 *)gen_op_pshufhw_xmm,
                (GenOpFunc2 *)gen_op_pshuflw_xmm },
     [0x71] = { SSE_SPECIAL, SSE_SPECIAL }, /* shiftw */
     [0x72] = { SSE_SPECIAL, SSE_SPECIAL }, /* shiftd */
@@ -2522,7 +2522,7 @@ static GenOpFunc1 *sse_op_table3[4 * 3] = {
     gen_op_cvtsi2sd,
     X86_64_ONLY(gen_op_cvtsq2ss),
     X86_64_ONLY(gen_op_cvtsq2sd),
-    
+
     gen_op_cvttss2si,
     gen_op_cvttsd2si,
     X86_64_ONLY(gen_op_cvttss2sq),
@@ -2533,7 +2533,7 @@ static GenOpFunc1 *sse_op_table3[4 * 3] = {
     X86_64_ONLY(gen_op_cvtss2sq),
     X86_64_ONLY(gen_op_cvtsd2sq),
 };
-    
+
 static GenOpFunc2 *sse_op_table4[8][4] = {
     SSE_FOP(cmpeq),
     SSE_FOP(cmplt),
@@ -2544,7 +2544,7 @@ static GenOpFunc2 *sse_op_table4[8][4] = {
     SSE_FOP(cmpnle),
     SSE_FOP(cmpord),
 };
-    
+
 static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
 {
     int b1, op1_offset, op2_offset, is_xmm, val, ot;
@@ -2553,16 +2553,16 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
     GenOpFunc3 *sse_op3;
 
     b &= 0xff;
-    if (s->prefix & PREFIX_DATA) 
+    if (s->prefix & PREFIX_DATA)
         b1 = 1;
-    else if (s->prefix & PREFIX_REPZ) 
+    else if (s->prefix & PREFIX_REPZ)
         b1 = 2;
-    else if (s->prefix & PREFIX_REPNZ) 
+    else if (s->prefix & PREFIX_REPNZ)
         b1 = 3;
     else
         b1 = 0;
     sse_op2 = sse_op_table1[b][b1];
-    if (!sse_op2) 
+    if (!sse_op2)
         goto illegal_op;
     if (b <= 0x5f || b == 0xc6 || b == 0xc2) {
         is_xmm = 1;
@@ -2606,7 +2606,7 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
         b |= (b1 << 8);
         switch(b) {
         case 0x0e7: /* movntq */
-            if (mod == 3) 
+            if (mod == 3)
                 goto illegal_op;
             gen_lea_modrm(s, modrm, &reg_addr, &offset_addr);
             gen_stq_env_A0[s->mem_index >> 2](offsetof(CPUX86State,fpregs[reg].mmx));
@@ -2625,7 +2625,7 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
             if (s->dflag == 2) {
                 gen_ldst_modrm(s, modrm, OT_QUAD, OR_TMP0, 0);
                 gen_op_movq_mm_T0_mmx(offsetof(CPUX86State,fpregs[reg].mmx));
-            } else 
+            } else
 #endif
             {
                 gen_ldst_modrm(s, modrm, OT_LONG, OR_TMP0, 0);
@@ -2637,7 +2637,7 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
             if (s->dflag == 2) {
                 gen_ldst_modrm(s, modrm, OT_QUAD, OR_TMP0, 0);
                 gen_op_movq_mm_T0_xmm(offsetof(CPUX86State,xmm_regs[reg]));
-            } else 
+            } else
 #endif
             {
                 gen_ldst_modrm(s, modrm, OT_LONG, OR_TMP0, 0);
@@ -2770,7 +2770,7 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
             if (s->dflag == 2) {
                 gen_op_movq_T0_mm_mmx(offsetof(CPUX86State,fpregs[reg].mmx));
                 gen_ldst_modrm(s, modrm, OT_QUAD, OR_TMP0, 1);
-            } else 
+            } else
 #endif
             {
                 gen_op_movl_T0_mm_mmx(offsetof(CPUX86State,fpregs[reg].mmx));
@@ -2782,7 +2782,7 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
             if (s->dflag == 2) {
                 gen_op_movq_T0_mm_xmm(offsetof(CPUX86State,xmm_regs[reg]));
                 gen_ldst_modrm(s, modrm, OT_QUAD, OR_TMP0, 1);
-            } else 
+            } else
 #endif
             {
                 gen_op_movl_T0_mm_xmm(offsetof(CPUX86State,xmm_regs[reg]));
@@ -2982,12 +2982,12 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
                 rm = (modrm & 7) | REX_B(s);
                 op2_offset = offsetof(CPUX86State,xmm_regs[rm]);
             }
-            sse_op_table3[(s->dflag == 2) * 2 + ((b >> 8) - 2) + 4 + 
+            sse_op_table3[(s->dflag == 2) * 2 + ((b >> 8) - 2) + 4 +
                           (b & 1) * 4](op2_offset);
             gen_op_mov_reg_T0[ot][reg]();
             break;
         case 0xc4: /* pinsrw */
-        case 0x1c4: 
+        case 0x1c4:
             s->rip_offset = 1;
             gen_ldst_modrm(s, modrm, OT_WORD, OR_TMP0, 0);
             val = ldub_code(s->pc++);
@@ -3000,7 +3000,7 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
             }
             break;
         case 0xc5: /* pextrw */
-        case 0x1c5: 
+        case 0x1c5:
             if (mod != 3)
                 goto illegal_op;
             val = ldub_code(s->pc++);
@@ -3062,12 +3062,12 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
         switch(b) {
         case 0xf7:
             /* maskmov : we must prepare A0 */
-            if (mod != 3) 
+            if (mod != 3)
                 goto illegal_op;
 #ifdef TARGET_X86_64
             if (s->aflag == 2) {
                 gen_op_movq_A0_reg[R_EDI]();
-            } else 
+            } else
 #endif
             {
                 gen_op_movl_A0_reg[R_EDI]();
@@ -3164,7 +3164,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
 #ifdef TARGET_X86_64
     s->rex_x = 0;
     s->rex_b = 0;
-    x86_64_hregs = 0; 
+    x86_64_hregs = 0;
 #endif
     s->rip_offset = 0; /* for relative ip address */
  next_byte:
@@ -3225,7 +3225,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         }
         if (!(prefixes & PREFIX_ADR))
             aflag = 2;
-    } else 
+    } else
 #endif
     {
         switch (b) {
@@ -3285,7 +3285,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         /* extended op code */
         b = ldub_code(s->pc++) | 0x100;
         goto reswitch;
-        
+
         /**************************/
         /* arith & logic */
     case 0x00 ... 0x05:
@@ -3305,7 +3305,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
                 ot = OT_BYTE;
             else
                 ot = dflag + OT_WORD;
-            
+
             switch(f) {
             case 0: /* OP Ev, Gv */
                 modrm = ldub_code(s->pc++);
@@ -3364,12 +3364,12 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
                 ot = OT_BYTE;
             else
                 ot = dflag + OT_WORD;
-            
+
             modrm = ldub_code(s->pc++);
             mod = (modrm >> 6) & 3;
             rm = (modrm & 7) | REX_B(s);
             op = (modrm >> 3) & 7;
-            
+
             if (mod != 3) {
                 if (b == 0x83)
                     s->rip_offset = 1;
@@ -3656,7 +3656,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         break;
 
     case 0x84: /* test Ev, Gv */
-    case 0x85: 
+    case 0x85:
         if ((b & 1) == 0)
             ot = OT_BYTE;
         else
@@ -3666,13 +3666,13 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         mod = (modrm >> 6) & 3;
         rm = (modrm & 7) | REX_B(s);
         reg = ((modrm >> 3) & 7) | rex_r;
-        
+
         gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0);
         gen_op_mov_TN_reg[ot][1][reg]();
         gen_op_testl_T0_T1_cc();
         s->cc_op = CC_OP_LOGICB + ot;
         break;
-        
+
     case 0xa8: /* test eAX, Iv */
     case 0xa9:
         if ((b & 1) == 0)
@@ -3686,7 +3686,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         gen_op_testl_T0_T1_cc();
         s->cc_op = CC_OP_LOGICB + ot;
         break;
-        
+
     case 0x98: /* CWDE/CBW */
 #ifdef TARGET_X86_64
         if (dflag == 2) {
@@ -3803,7 +3803,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         gen_op_cmpxchg8b();
         s->cc_op = CC_OP_EFLAGS;
         break;
-        
+
         /**************************/
         /* push/pop */
     case 0x50 ... 0x57: /* push */
@@ -3954,7 +3954,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             ot = dflag + OT_WORD;
         modrm = ldub_code(s->pc++);
         reg = ((modrm >> 3) & 7) | rex_r;
-        
+
         /* generate a generic store */
         gen_ldst_modrm(s, modrm, ot, reg, 1);
         break;
@@ -3985,7 +3985,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             ot = OT_WORD + dflag;
         modrm = ldub_code(s->pc++);
         reg = ((modrm >> 3) & 7) | rex_r;
-        
+
         gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0);
         gen_op_mov_reg_T0[ot][reg]();
         break;
@@ -4037,7 +4037,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             reg = ((modrm >> 3) & 7) | rex_r;
             mod = (modrm >> 6) & 3;
             rm = (modrm & 7) | REX_B(s);
-            
+
             if (mod == 3) {
                 gen_op_mov_TN_reg[ot][0][rm]();
                 switch(ot | (b & 8)) {
@@ -4083,7 +4083,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         s->addseg = val;
         gen_op_mov_reg_A0[ot - OT_WORD][reg]();
         break;
-        
+
     case 0xa0: /* mov EAX, Ov */
     case 0xa1:
     case 0xa2: /* mov Ov, EAX */
@@ -4103,7 +4103,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
                     gen_op_movq_A0_im(offset_addr);
                 else
                     gen_op_movq_A0_im64(offset_addr >> 32, offset_addr);
-            } else 
+            } else
 #endif
             {
                 if (s->aflag) {
@@ -4128,7 +4128,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         if (s->aflag == 2) {
             gen_op_movq_A0_reg[R_EBX]();
             gen_op_addq_A0_AL();
-        } else 
+        } else
 #endif
         {
             gen_op_movl_A0_reg[R_EBX]();
@@ -4155,7 +4155,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             reg = (b & 7) | REX_B(s);
             gen_movtl_T0_im(tmp);
             gen_op_mov_reg_T0[OT_QUAD][reg]();
-        } else 
+        } else
 #endif
         {
             ot = dflag ? OT_LONG : OT_WORD;
@@ -4238,7 +4238,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             gen_eob(s);
         }
         break;
-        
+
         /************************/
         /* shifts */
     case 0xc0:
@@ -4251,11 +4251,11 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
                 ot = OT_BYTE;
             else
                 ot = dflag + OT_WORD;
-            
+
             modrm = ldub_code(s->pc++);
             mod = (modrm >> 6) & 3;
             op = (modrm >> 3) & 7;
-            
+
             if (mod != 3) {
                 if (shift == 2) {
                     s->rip_offset = 1;
@@ -4309,7 +4309,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         mod = (modrm >> 6) & 3;
         rm = (modrm & 7) | REX_B(s);
         reg = ((modrm >> 3) & 7) | rex_r;
-        
+
         if (mod != 3) {
             gen_lea_modrm(s, modrm, &reg_addr, &offset_addr);
             gen_op_ld_T0_A0[ot + s->mem_index]();
@@ -4317,7 +4317,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             gen_op_mov_TN_reg[ot][0][rm]();
         }
         gen_op_mov_TN_reg[ot][1][reg]();
-        
+
         if (shift) {
             val = ldub_code(s->pc++);
             if (ot == OT_QUAD)
@@ -4350,7 +4350,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
 
         /************************/
         /* floats */
-    case 0xd8 ... 0xdf: 
+    case 0xd8 ... 0xdf:
         if (s->flags & (HF_EM_MASK | HF_TS_MASK)) {
             /* if CR0.EM or CR0.TS are set, generate an FPU exception */
             /* XXX: what to do if illegal op ? */
@@ -4388,7 +4388,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
                         gen_op_fild_FT0_A0();
                         break;
                     }
-                    
+
                     gen_op_fp_arith_ST0_FT0[op1]();
                     if (op1 == 3) {
                         /* fcomp needs pop */
@@ -4645,7 +4645,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             case 0x30: case 0x31: case 0x34 ... 0x37: /* fxxxp sti, st */
                 {
                     int op1;
-                    
+
                     op1 = op & 7;
                     if (op >= 0x20) {
                         gen_op_fp_arith_STN_ST0[op1](opreg);
@@ -4715,7 +4715,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
                 break;
             case 0x28: /* ffree sti */
                 gen_op_ffree_STN(opreg);
-                break; 
+                break;
             case 0x2a: /* fst sti */
                 gen_op_fmov_STN_ST0(opreg);
                 break;
@@ -4815,7 +4815,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             gen_movs(s, ot);
         }
         break;
-        
+
     case 0xaa: /* stosS */
     case 0xab:
         if ((b & 1) == 0)
@@ -5041,13 +5041,13 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
     case 0x9a: /* lcall im */
         {
             unsigned int selector, offset;
-            
+
             if (CODE64(s))
                 goto illegal_op;
             ot = dflag ? OT_LONG : OT_WORD;
             offset = insn_get(s, ot);
             selector = insn_get(s, OT_WORD);
-            
+
             gen_op_movl_T0_im(selector);
             gen_op_movl_T1_imu(offset);
         }
@@ -5071,7 +5071,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             ot = dflag ? OT_LONG : OT_WORD;
             offset = insn_get(s, ot);
             selector = insn_get(s, OT_WORD);
-            
+
             gen_op_movl_T0_im(selector);
             gen_op_movl_T1_imu(offset);
         }
@@ -5090,7 +5090,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         if (dflag) {
             tval = (int32_t)insn_get(s, OT_LONG);
         } else {
-            tval = (int16_t)insn_get(s, OT_WORD); 
+            tval = (int16_t)insn_get(s, OT_WORD);
         }
     do_jcc:
         next_eip = s->pc - s->cs_base;
@@ -5120,7 +5120,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         }
         gen_op_cmov_reg_T1_T0[ot - OT_WORD][reg]();
         break;
-        
+
         /************************/
         /* flags */
     case 0x9c: /* pushf */
@@ -5345,7 +5345,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             goto illegal_op;
         break;
     case 0x9b: /* fwait */
-        if ((s->flags & (HF_MP_MASK | HF_TS_MASK)) == 
+        if ((s->flags & (HF_MP_MASK | HF_TS_MASK)) ==
             (HF_MP_MASK | HF_TS_MASK)) {
             gen_exception(s, EXCP07_PREX, pc_start - s->cs_base);
         } else {
@@ -5361,7 +5361,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
     case 0xcd: /* int N */
         val = ldub_code(s->pc++);
         if (s->vm86 && s->iopl != 3) {
-            gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); 
+            gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
         } else {
             gen_interrupt(s, val, pc_start - s->cs_base, s->pc - s->cs_base);
         }
@@ -5446,7 +5446,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             gen_op_mov_TN_reg[OT_QUAD][0][reg]();
             gen_op_bswapq_T0();
             gen_op_mov_reg_T0[OT_QUAD][reg]();
-        } else 
+        } else
 #endif
         {
             gen_op_mov_TN_reg[OT_LONG][0][reg]();
@@ -5476,7 +5476,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             tval += next_eip;
             if (s->dflag == 0)
                 tval &= 0xffff;
-            
+
             l1 = gen_new_label();
             l2 = gen_new_label();
             b &= 3;
@@ -5676,7 +5676,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
                     if (s->aflag == 2) {
                         gen_op_movq_A0_reg[R_EBX]();
                         gen_op_addq_A0_AL();
-                    } else 
+                    } else
 #endif
                     {
                         gen_op_movl_A0_reg[R_EBX]();
@@ -5761,7 +5761,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
                         gen_op_movtl_T1_env(offsetof(CPUX86State,kernelgsbase));
                         gen_op_movtl_env_T1(offsetof(CPUX86State,segs[R_GS].base));
                         gen_op_movtl_env_T0(offsetof(CPUX86State,kernelgsbase));
-                    } else 
+                    } else
 #endif
                     {
                         goto illegal_op;
@@ -5797,7 +5797,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             reg = ((modrm >> 3) & 7) | rex_r;
             mod = (modrm >> 6) & 3;
             rm = (modrm & 7) | REX_B(s);
-            
+
             if (mod == 3) {
                 gen_op_mov_TN_reg[OT_LONG][0][rm]();
                 /* sign extend */
@@ -5813,7 +5813,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
                 }
                 gen_op_mov_reg_T0[d_ot][reg]();
             }
-        } else 
+        } else
 #endif
         {
             if (!s->pe || s->vm86)
@@ -5908,7 +5908,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
                     gen_jmp_im(s->pc - s->cs_base);
                     gen_eob(s);
                 } else {
-#if !defined(CONFIG_USER_ONLY) 
+#if !defined(CONFIG_USER_ONLY)
                     if (reg == 8)
                         gen_op_movtl_T0_cr8();
                     else
@@ -5979,7 +5979,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
         op = (modrm >> 3) & 7;
         switch(op) {
         case 0: /* fxsave */
-            if (mod == 3 || !(s->cpuid_features & CPUID_FXSR) || 
+            if (mod == 3 || !(s->cpuid_features & CPUID_FXSR) ||
                 (s->flags & HF_EM_MASK))
                 goto illegal_op;
             if (s->flags & HF_TS_MASK) {
@@ -5990,7 +5990,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             gen_op_fxsave_A0((s->dflag == 2));
             break;
         case 1: /* fxrstor */
-            if (mod == 3 || !(s->cpuid_features & CPUID_FXSR) || 
+            if (mod == 3 || !(s->cpuid_features & CPUID_FXSR) ||
                 (s->flags & HF_EM_MASK))
                 goto illegal_op;
             if (s->flags & HF_TS_MASK) {
@@ -6083,14 +6083,14 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
 #define CC_OSZAP (CC_O | CC_S | CC_Z | CC_A | CC_P)
 
 /* flags read by an operation */
-static uint16_t opc_read_flags[NB_OPS] = { 
+static uint16_t opc_read_flags[NB_OPS] = {
     [INDEX_op_aas] = CC_A,
     [INDEX_op_aaa] = CC_A,
     [INDEX_op_das] = CC_A | CC_C,
     [INDEX_op_daa] = CC_A | CC_C,
 
     /* subtle: due to the incl/decl implementation, C is used */
-    [INDEX_op_update_inc_cc] = CC_C, 
+    [INDEX_op_update_inc_cc] = CC_C,
 
     [INDEX_op_into] = CC_O,
 
@@ -6216,13 +6216,13 @@ static uint16_t opc_read_flags[NB_OPS] = {
 };
 
 /* flags written by an operation */
-static uint16_t opc_write_flags[NB_OPS] = { 
+static uint16_t opc_write_flags[NB_OPS] = {
     [INDEX_op_update2_cc] = CC_OSZAPC,
     [INDEX_op_update1_cc] = CC_OSZAPC,
     [INDEX_op_cmpl_T0_T1_cc] = CC_OSZAPC,
     [INDEX_op_update_neg_cc] = CC_OSZAPC,
     /* subtle: due to the incl/decl implementation, C is used */
-    [INDEX_op_update_inc_cc] = CC_OSZAPC, 
+    [INDEX_op_update_inc_cc] = CC_OSZAPC,
     [INDEX_op_testl_T0_T1_cc] = CC_OSZAPC,
 
     [INDEX_op_mulb_AL_T0] = CC_OSZAPC,
@@ -6367,7 +6367,7 @@ static uint16_t opc_write_flags[NB_OPS] = {
 };
 
 /* simpler form of an operation if no flags need to be generated */
-static uint16_t opc_simpler[NB_OPS] = { 
+static uint16_t opc_simpler[NB_OPS] = {
     [INDEX_op_update2_cc] = INDEX_op_nop,
     [INDEX_op_update1_cc] = INDEX_op_nop,
     [INDEX_op_update_neg_cc] = INDEX_op_nop,
@@ -6451,7 +6451,7 @@ static void optimize_flags(uint16_t *opc_buf, int opc_buf_len)
    basic block 'tb'. If search_pc is TRUE, also generate PC
    information for each intermediate instruction. */
 static inline int gen_intermediate_code_internal(CPUState *env,
-                                                 TranslationBlock *tb, 
+                                                 TranslationBlock *tb,
                                                  int search_pc)
 {
     DisasContext dc1, *dc = &dc1;
@@ -6460,7 +6460,7 @@ static inline int gen_intermediate_code_internal(CPUState *env,
     int flags, j, lj, cflags;
     target_ulong pc_start;
     target_ulong cs_base;
-    
+
     /* generate intermediate code */
     pc_start = tb->pc;
     cs_base = tb->cs_base;
@@ -6546,7 +6546,7 @@ static inline int gen_intermediate_code_internal(CPUState *env,
         /* if irq were inhibited with HF_INHIBIT_IRQ_MASK, we clear
            the flag and abort the translation to give the irqs a
            change to be happen */
-        if (dc->tf || dc->singlestep_enabled || 
+        if (dc->tf || dc->singlestep_enabled ||
             (flags & HF_INHIBIT_IRQ_MASK) ||
             (cflags & CF_SINGLE_INSN)) {
             gen_jmp_im(pc_ptr - dc->cs_base);
@@ -6569,7 +6569,7 @@ static inline int gen_intermediate_code_internal(CPUState *env,
         while (lj <= j)
             gen_opc_instr_start[lj++] = 0;
     }
-        
+
 #ifdef DEBUG_DISAS
     if (loglevel & CPU_LOG_TB_CPU) {
         cpu_dump_state(env, logfile, fprintf, X86_DUMP_CCOP);
index de37baf9a9580616f50768f063986996bbbb0c2c..318b1202e498c42a947dd61d65d48c56fc6de3ac 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * m68k virtual CPU header
- * 
+ *
  *  Copyright (c) 2005-2006 CodeSourcery
  *  Written by Paul Brook
  *
@@ -71,7 +71,7 @@ typedef struct CPUM68KState {
     /* Temporary storage for DIV helpers.  */
     uint32_t div1;
     uint32_t div2;
-    
+
     /* MMU status.  */
     struct {
         uint32_t ar;
@@ -97,7 +97,7 @@ void cpu_m68k_close(CPUM68KState *s);
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
-int cpu_m68k_signal_handler(int host_signum, void *pinfo, 
+int cpu_m68k_signal_handler(int host_signum, void *pinfo,
                            void *puc);
 void cpu_m68k_flush_flags(CPUM68KState *, int);
 
@@ -133,7 +133,7 @@ void cpu_m68k_register(CPUM68KState *, m68k_def_t *);
 /* Linux uses 8k pages.  */
 #define TARGET_PAGE_BITS 13
 #else
-/* Smallest TLB entry size is 1k.  */ 
+/* Smallest TLB entry size is 1k.  */
 #define TARGET_PAGE_BITS 10
 #endif
 #include "cpu-all.h"
index ef4adeb3916e596ef99ef7ec2b15f7198c4fad97..78a386772b03001f461719031adc329c88761276 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  m68k execution defines
- * 
+ *
  *  Copyright (c) 2005-2006 CodeSourcery
  *  Written by Paul Brook
  *
index 6b8f18d15d37ca8c0f50ec398ab7bd0b1ba543c8..fed3a425ee5fa0f735bbbc3bb2edabf80bfd18c1 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  m68k op helpers
- * 
+ *
  *  Copyright (c) 2006 CodeSourcery
  *  Written by Paul Brook
  *
index 8ea7589c3f1d836573890cfde398cd2f65b6cc8a..2790ba5e6e0945f64a5453c5a4623982d73d5943 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  m68k micro operations
- * 
+ *
  *  Copyright (c) 2006 CodeSourcery
  *  Written by Paul Brook
  *
@@ -403,7 +403,7 @@ OP(divu)
     uint32_t quot;
     uint32_t rem;
     uint32_t flags;
-    
+
     num = env->div1;
     den = env->div2;
     /* ??? This needs to make sure the throwing location is accurate.  */
@@ -434,7 +434,7 @@ OP(divs)
     int32_t quot;
     int32_t rem;
     int32_t flags;
-    
+
     num = env->div1;
     den = env->div2;
     if (den == 0)
index 9c34c626b21152b77eb0b20c94f63c6960616a26..77cb656021a4d4499d07366df2c7de221de0171b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  m68k translation
- * 
+ *
  *  Copyright (c) 2005-2006 CodeSourcery
  *  Written by Paul Brook
  *
@@ -96,7 +96,7 @@ static m68k_def_t m68k_cpu_defs[] = {
     {"m5206", M68K_INSN_CF_A},
     {"cfv4e", M68K_INSN_CF_A | M68K_INSN_CF_B | M68K_INSN_CF_C
             | M68K_INSN_CF_MAC | M68K_INSN_CF_EMAC | M68K_INSN_CF_FPU},
-    {NULL, 0}, 
+    {NULL, 0},
 };
 
 typedef void (*disas_proc)(DisasContext *, uint16_t);
@@ -1455,7 +1455,7 @@ DISAS_INSN(branch)
     uint32_t base;
     int op;
     int l1;
-    
+
     base = s->pc;
     op = (insn >> 8) & 0xf;
     offset = (int8_t)insn;
@@ -1912,7 +1912,7 @@ DISAS_INSN(fpu)
         }
         gen_ea(s, insn, OS_LONG, res, NULL);
         break;
-    case 6: /* fmovem */ 
+    case 6: /* fmovem */
     case 7:
         {
         int addr;
@@ -2040,7 +2040,7 @@ DISAS_INSN(fpu)
         tmp = gen_new_qreg(QMODE_F32);
         gen_op_f64_to_f32(tmp, res);
         gen_op_f32_to_f64(res, tmp);
-    } 
+    }
     gen_op_fp_result(res);
     if (dest) {
         gen_op_movf64(dest, res);
@@ -2470,7 +2470,7 @@ static void expand_op_addx_cc(qOP *qop)
     int arg0 = qop->args[0];
     int arg1 = qop->args[1];
     int l1, l2;
-    
+
     gen_op_add32 (arg0, arg0, arg1);
     l1 = gen_new_label();
     l2 = gen_new_label();
@@ -2563,7 +2563,7 @@ int gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb,
 
     /* generate intermediate code */
     pc_start = tb->pc;
-       
+
     dc->tb = tb;
 
     gen_opc_ptr = gen_opc_buf;
@@ -2714,7 +2714,7 @@ void cpu_m68k_register(CPUM68KState *env, m68k_def_t *def)
     register_m68k_insns(def);
 }
 
-void cpu_dump_state(CPUState *env, FILE *f, 
+void cpu_dump_state(CPUState *env, FILE *f,
                     int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
                     int flags)
 {
@@ -2742,7 +2742,7 @@ target_ulong cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
     return addr;
 }
 
-#if defined(CONFIG_USER_ONLY) 
+#if defined(CONFIG_USER_ONLY)
 
 int cpu_m68k_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
                                int is_user, int is_softmmu)
index fb5a3fef3d78db3770689dcb290ebfd9d0394247..14932ae20e642869e317a0790940ba079c5a2b63 100644 (file)
@@ -104,7 +104,7 @@ struct CPUMIPSState {
 #define FP_DIV0           8
 #define FP_INVALID        16
 #define FP_UNIMPLEMENTED  32
-               
+
 #endif
 #if defined(MIPS_USES_R4K_TLB)
     tlb_t tlb[MIPS_TLB_MAX];
index 1e9fa8e69111f693890690bfe12fdaf15b747cc1..b88b10db0bb2a5204374b5f3678974abcdca3fe0 100644 (file)
@@ -117,7 +117,7 @@ void do_tlbp (void);
 void do_tlbr (void);
 #ifdef MIPS_USES_FPU
 void dump_fpu(CPUState *env);
-void fpu_dump_state(CPUState *env, FILE *f, 
+void fpu_dump_state(CPUState *env, FILE *f,
                     int (*fpu_fprintf)(FILE *f, const char *fmt, ...),
                     int flags);
 #endif
@@ -166,7 +166,7 @@ void do_raise_exception_err (uint32_t exception, int error_code);
 void do_raise_exception (uint32_t exception);
 void do_raise_exception_direct (uint32_t exception);
 
-void cpu_dump_state(CPUState *env, FILE *f, 
+void cpu_dump_state(CPUState *env, FILE *f,
                     int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
                     int flags);
 void cpu_mips_irqctrl_init (void);
index 4ebb46bff526b9c0a5ad914c008969c98845801b..4b891c906c4eedc1a54689ac2828ccf6bfe40dcf 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * MIPS emulation micro-operations templates for floating point reg 
+ * MIPS emulation micro-operations templates for floating point reg
  * load & store for qemu.
- * 
+ *
  * Copyright (c) 2006 Marius Groeger
  *
  * This library is free software; you can redistribute it and/or
index d2d7a9f871297d250f1296f647af4940b8328363..1422f49290dec1b6de86686f3f1452da7368c902 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  MIPS emulation helpers for qemu.
- * 
+ *
  *  Copyright (c) 2004-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
@@ -140,7 +140,7 @@ static int get_physical_address (CPUState *env, target_ulong *physical,
     return ret;
 }
 
-#if defined(CONFIG_USER_ONLY) 
+#if defined(CONFIG_USER_ONLY)
 target_ulong cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
 {
     return addr;
@@ -230,7 +230,7 @@ int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
             /* TLB match but 'D' bit is cleared */
             exception = EXCP_LTLBL;
             break;
-                
+
         }
         /* Raise exception */
         env->CP0_BadVAddr = address;
index cd5c69ca46e100779ca8447f48edabaafd9dbff4..6c69efb013aea325b79099016736efec78c84e87 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  MIPS emulation micro-operations for qemu.
- * 
+ *
  *  Copyright (c) 2004-2005 Jocelyn Mayer
  *  Copyright (c) 2006 Marius Groeger (FPU operations)
  *
@@ -1676,7 +1676,7 @@ void op_cfc1 (void)
 }
 
 /* convert MIPS rounding mode in FCR31 to IEEE library */
-unsigned int ieee_rm[] = { 
+unsigned int ieee_rm[] = {
     float_round_nearest_even,
     float_round_to_zero,
     float_round_up,
@@ -1691,11 +1691,11 @@ void op_ctc1 (void)
     if (T1 == 0) {
         /* XXX should this throw an exception?
          * don't write to FCR0.
-         * env->fcr0 = T0; 
+         * env->fcr0 = T0;
          */
     }
     else {
-        /* store new fcr31, masking unused bits */  
+        /* store new fcr31, masking unused bits */
         env->fcr31 = T0 & 0x0183FFFF;
 
         /* set rounding mode */
@@ -1933,7 +1933,7 @@ int float64_is_unordered(float64 a, float64 b STATUS_PARAM)
     }
 }
 
-FOP_COND(d, f,   0,                                                      0) 
+FOP_COND(d, f,   0,                                                      0)
 FOP_COND(d, un,  0, float64_is_unordered(FDT1, FDT0, &env->fp_status))
 FOP_COND(d, eq,  0,                                                      float64_eq(FDT0, FDT1, &env->fp_status))
 FOP_COND(d, ueq, 0, float64_is_unordered(FDT1, FDT0, &env->fp_status) || float64_eq(FDT0, FDT1, &env->fp_status))
@@ -1968,7 +1968,7 @@ flag float32_is_unordered(float32 a, float32 b STATUS_PARAM)
 /* NOTE: the comma operator will make "cond" to eval to false,
  * but float*_is_unordered() is still called
  */
-FOP_COND(s, f,   0,                                                      0) 
+FOP_COND(s, f,   0,                                                      0)
 FOP_COND(s, un,  0, float32_is_unordered(FST1, FST0, &env->fp_status))
 FOP_COND(s, eq,  0,                                                      float32_eq(FST0, FST1, &env->fp_status))
 FOP_COND(s, ueq, 0, float32_is_unordered(FST1, FST0, &env->fp_status) || float32_eq(FST0, FST1, &env->fp_status))
index 9596d04fb60a32c08753e37c761c4a1e5c16eedc..6e1be6ff682794eea7bc43929c669a379e9da696 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  MIPS emulation helpers for qemu.
- * 
+ *
  *  Copyright (c) 2004-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
@@ -244,7 +244,7 @@ void do_ddivu (void)
 }
 #endif
 
-#if defined(CONFIG_USER_ONLY) 
+#if defined(CONFIG_USER_ONLY)
 void do_mfc0_random (void)
 {
     cpu_abort(env, "mfc0 random\n");
@@ -342,25 +342,25 @@ void fpu_handle_exception(void)
 
     enable = GET_FP_ENABLE(env->fcr31);
 
-    /* determine current flags */   
+    /* determine current flags */
     if (flags & float_flag_invalid) {
         cpuflags |= FP_INVALID;
         cause |= FP_INVALID & enable;
     }
     if (flags & float_flag_divbyzero) {
-        cpuflags |= FP_DIV0;    
+        cpuflags |= FP_DIV0;
         cause |= FP_DIV0 & enable;
     }
     if (flags & float_flag_overflow) {
-        cpuflags |= FP_OVERFLOW;    
+        cpuflags |= FP_OVERFLOW;
         cause |= FP_OVERFLOW & enable;
     }
     if (flags & float_flag_underflow) {
-        cpuflags |= FP_UNDERFLOW;   
+        cpuflags |= FP_UNDERFLOW;
         cause |= FP_UNDERFLOW & enable;
     }
     if (flags & float_flag_inexact) {
-        cpuflags |= FP_INEXACT; 
+        cpuflags |= FP_INEXACT;
         cause |= FP_INEXACT & enable;
     }
     SET_FP_FLAGS(env->fcr31, cpuflags);
@@ -538,7 +538,7 @@ void do_pmon (int function)
     }
 }
 
-#if !defined(CONFIG_USER_ONLY) 
+#if !defined(CONFIG_USER_ONLY)
 
 static void do_unaligned_access (target_ulong addr, int is_write, int is_user, void *retaddr);
 
index a3289793b0a67649d0c0471d6438c9d7dc67402a..058ae7dfc48e21b1ee795ec3542b09528f322760 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  MIPS emulation memory micro-operations for qemu.
- * 
+ *
  *  Copyright (c) 2004-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
index 8d4c4e40487c3ebaf2f6222be363faa7e6fe11b9..3cb39ad6ed541fb78d2445065e99528bce700da9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  MIPS emulation micro-operations templates for reg load & store for qemu.
- * 
+ *
  *  Copyright (c) 2004-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
index ce56bb083453052e65939bbc053c4274a53437e1..e41fd9e0bf0d6535bb5357c46ec0be10457e6cee 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  MIPS32 emulation for qemu: main translation routines.
- * 
+ *
  *  Copyright (c) 2004-2005 Jocelyn Mayer
  *  Copyright (c) 2006 Marius Groeger (FPU operations)
  *  Copyright (c) 2006 Thiemo Seufer (MIPS32R2 support)
@@ -853,7 +853,7 @@ static void gen_arith_imm (DisasContext *ctx, uint32_t opc, int rt,
     const char *opn = "unk";
 
     if (rt == 0 && opc != OPC_ADDI && opc != OPC_DADDI) {
-        /* if no destination, treat it as a NOP 
+        /* if no destination, treat it as a NOP
          * For addi, we must generate the overflow exception when needed.
          */
         MIPS_DEBUG("NOP");
@@ -986,7 +986,7 @@ static void gen_arith (DisasContext *ctx, uint32_t opc,
 
     if (rd == 0 && opc != OPC_ADD && opc != OPC_SUB
        && opc != OPC_DADD && opc != OPC_DSUB) {
-        /* if no destination, treat it as a NOP 
+        /* if no destination, treat it as a NOP
          * For add & sub, we must generate the overflow exception when needed.
          */
         MIPS_DEBUG("NOP");
@@ -4142,7 +4142,7 @@ static void gen_compute_branch1 (DisasContext *ctx, uint32_t op,
     likely:
         ctx->hflags |= MIPS_HFLAG_BL;
         break;
-    default:    
+    default:
         MIPS_INVAL("cp1 branch/jump");
         generate_exception_err (ctx, EXCP_RI, 1);
         return;
@@ -4217,7 +4217,7 @@ static void gen_cp1 (DisasContext *ctx, uint32_t opc, int rt, int fs)
  * even-odd pair of adjacent coprocessor general registers. When the FR bit
  * in the Status register equals one, both even and odd register numbers
  * are valid.
- * 
+ *
  * Multiple float registers can be checked by calling
  * CHECK_FR(ctx, freg1 | freg2 | ... | fregN);
  */
@@ -4515,7 +4515,7 @@ static void gen_farith (DisasContext *ctx, uint32_t op1, int ft, int fs, int fd)
         gen_cmp_s(func-48);
         opn = condnames[func-48];
         break;
-    default:    
+    default:
         if (loglevel & CPU_LOG_TB_IN_ASM) {
             fprintf(logfile, "Invalid FP arith function: %08x %03x %03x %03x\n",
                     ctx->opcode, ctx->opcode >> 26, ctx->opcode & 0x3F,
@@ -5147,7 +5147,7 @@ done_generating:
         fprintf(logfile, "---------------- %d %08x\n", ctx.bstate, ctx.hflags);
     }
 #endif
-    
+
     return 0;
 }
 
@@ -5163,7 +5163,7 @@ int gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb)
 
 #ifdef MIPS_USES_FPU
 
-void fpu_dump_state(CPUState *env, FILE *f, 
+void fpu_dump_state(CPUState *env, FILE *f,
                     int (*fpu_fprintf)(FILE *f, const char *fmt, ...),
                     int flags)
 {
@@ -5190,7 +5190,7 @@ void fpu_dump_state(CPUState *env, FILE *f,
 
 void dump_fpu (CPUState *env)
 {
-    if (loglevel) { 
+    if (loglevel) {
        fprintf(logfile, "pc=0x" TLSZ " HI=0x" TLSZ " LO=0x" TLSZ " ds %04x " TLSZ " %d\n",
                env->PC, env->HI, env->LO, env->hflags, env->btarget, env->bcond);
        fpu_dump_state(env, logfile, fprintf, 0);
@@ -5232,13 +5232,13 @@ void cpu_mips_check_sign_extensions (CPUState *env, FILE *f,
 }
 #endif
 
-void cpu_dump_state (CPUState *env, FILE *f, 
+void cpu_dump_state (CPUState *env, FILE *f,
                      int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
                      int flags)
 {
     uint32_t c0_status;
     int i;
-    
+
     cpu_fprintf(f, "pc=0x" TLSZ " HI=0x" TLSZ " LO=0x" TLSZ " ds %04x " TLSZ " %d\n",
                 env->PC, env->HI, env->LO, env->hflags, env->btarget, env->bcond);
     for (i = 0; i < 32; i++) {
@@ -5323,7 +5323,7 @@ void cpu_reset (CPUMIPSState *env)
     env->user_mode_only = 1;
 #endif
 #ifdef MIPS_USES_FPU
-    env->fcr0 = MIPS_FCR0;     
+    env->fcr0 = MIPS_FCR0;
 #endif
     /* XXX some guesswork here, values are CPU specific */
     env->SYNCI_Step = 16;
index b294e3146838d5a82a4a7d034a464d37bdce83fb..52e5ca86da646ea76311a2426f2e5d5fe6162051 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  PowerPC emulation cpu definitions for qemu.
- * 
+ *
  *  Copyright (c) 2003-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
@@ -575,7 +575,7 @@ void cpu_ppc_close(CPUPPCState *s);
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
-int cpu_ppc_signal_handler(int host_signum, void *pinfo, 
+int cpu_ppc_signal_handler(int host_signum, void *pinfo,
                            void *puc);
 
 void do_interrupt (CPUPPCState *env);
index 89171f9d3fd6061827cff4a7e69b7abe8a20b3a1..e472d15382f8cf9bd3088c47f7f20bb7175aaa12 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  PowerPC emulation definitions for qemu.
- * 
+ *
  *  Copyright (c) 2003-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
index 70b0a491567b2be2774728036045414148506969..223ce623711fd26a587b73362e9dead53e00c214 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  PowerPC emulation helpers for qemu.
- * 
+ *
  *  Copyright (c) 2003-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
 /*****************************************************************************/
 /* PowerPC MMU emulation */
 
-#if defined(CONFIG_USER_ONLY) 
+#if defined(CONFIG_USER_ONLY)
 int cpu_ppc_handle_mmu_fault (CPUState *env, uint32_t address, int rw,
                               int is_user, int is_softmmu)
 {
     int exception, error_code;
-    
+
     if (rw == 2) {
         exception = EXCP_ISI;
         error_code = 0;
@@ -287,7 +287,7 @@ static int get_segment (CPUState *env, uint32_t *real, int *prot,
         ((sr & 0x40000000) && msr_pr == 0)) ? 1 : 0;
     if ((sr & 0x80000000) == 0) {
 #if defined (DEBUG_MMU)
-    if (loglevel > 0) 
+    if (loglevel > 0)
            fprintf(logfile, "pte segment: key=%d n=0x%08x\n",
                    key, sr & 0x10000000);
 #endif
@@ -389,7 +389,7 @@ static int get_physical_address (CPUState *env, uint32_t *physical, int *prot,
     if (loglevel > 0) {
         fprintf(logfile, "%s\n", __func__);
     }
-#endif    
+#endif
     if ((access_type == ACCESS_CODE && msr_ir == 0) ||
         (access_type != ACCESS_CODE && msr_dr == 0)) {
         /* No address translation */
@@ -409,7 +409,7 @@ static int get_physical_address (CPUState *env, uint32_t *physical, int *prot,
         fprintf(logfile, "%s address %08x => %08x\n",
                __func__, address, *physical);
     }
-#endif    
+#endif
     return ret;
 }
 
@@ -801,7 +801,7 @@ void do_compute_hflags (CPUPPCState *env)
     /* Compute current hflags */
     env->hflags = (msr_pr << MSR_PR) | (msr_le << MSR_LE) |
         (msr_fp << MSR_FP) | (msr_fe0 << MSR_FE0) | (msr_fe1 << MSR_FE1) |
-        (msr_vr << MSR_VR) | (msr_ap << MSR_AP) | (msr_sa << MSR_SA) | 
+        (msr_vr << MSR_VR) | (msr_ap << MSR_AP) | (msr_sa << MSR_SA) |
         (msr_se << MSR_SE) | (msr_be << MSR_BE);
 }
 
index ca1dbc5eb454c349391dc01668c88c63ec13ab6e..ee07455ebaefa97ccce13d6691134d739893a57e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  PowerPC emulation micro-operations for qemu.
- * 
+ *
  *  Copyright (c) 2003-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
@@ -444,7 +444,7 @@ PPC_OP(getbit_T1)
 
 PPC_OP(setcrfbit)
 {
-    T1 = (T1 & PARAM(1)) | (T0 << PARAM(2)); 
+    T1 = (T1 & PARAM(1)) | (T0 << PARAM(2));
     RETURN();
 }
 
@@ -478,7 +478,7 @@ PPC_OP(jz_T0)
     RETURN();
 }
 
-PPC_OP(btest_T1) 
+PPC_OP(btest_T1)
 {
     if (T0) {
         regs->nip = T1 & ~3;
index e949eb42e63635ee4e154fc8f3ce3252f83c6849..caac181cee72c5dd512e1a7e4347504787ab7d5c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  PowerPC emulation helpers for qemu.
- * 
+ *
  *  Copyright (c) 2003-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
index 1be640d6dec7303e91e42d5c1a99fb69c69baa45..19bb6694beb3b4cb45b700c661dd9f10bc333aed 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  PowerPC emulation micro-operations for qemu.
- * 
+ *
  *  Copyright (c) 2003-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
index 41737d4a84b58c475bfaa663363df2a0fc6dadec..aa79777d1bc420bde566870805f611a62610f76c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  PowerPC emulation for qemu: main translation routines.
- * 
+ *
  *  Copyright (c) 2003-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
@@ -702,7 +702,7 @@ GEN_HANDLER(rlwimi, 0x14, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
 GEN_HANDLER(rlwinm, 0x15, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
 {
     uint32_t mb, me, sh;
-    
+
     sh = SH(ctx->opcode);
     mb = MB(ctx->opcode);
     me = ME(ctx->opcode);
@@ -1022,7 +1022,7 @@ GEN_HANDLER(mffs, 0x3F, 0x07, 0x12, 0x001FF800, PPC_FLOAT)
 GEN_HANDLER(mtfsb0, 0x3F, 0x06, 0x02, 0x001FF800, PPC_FLOAT)
 {
     uint8_t crb;
-    
+
     if (!ctx->fpu_enabled) {
         RET_EXCP(ctx, EXCP_NO_FP, 0);
         return;
@@ -1039,7 +1039,7 @@ GEN_HANDLER(mtfsb0, 0x3F, 0x06, 0x02, 0x001FF800, PPC_FLOAT)
 GEN_HANDLER(mtfsb1, 0x3F, 0x06, 0x01, 0x001FF800, PPC_FLOAT)
 {
     uint8_t crb;
-    
+
     if (!ctx->fpu_enabled) {
         RET_EXCP(ctx, EXCP_NO_FP, 0);
         return;
@@ -1403,7 +1403,7 @@ GEN_HANDLER(lswi, 0x1F, 0x15, 0x12, 0x00000001, PPC_INTEGER)
     }
     gen_op_set_T1(nb);
     /* NIP cannot be restored if the memory exception comes from an helper */
-    gen_op_update_nip((ctx)->nip - 4); 
+    gen_op_update_nip((ctx)->nip - 4);
     op_ldsts(lswi, start);
 }
 
@@ -1423,7 +1423,7 @@ GEN_HANDLER(lswx, 0x1F, 0x15, 0x10, 0x00000001, PPC_INTEGER)
     }
     gen_op_load_xer_bc();
     /* NIP cannot be restored if the memory exception comes from an helper */
-    gen_op_update_nip((ctx)->nip - 4); 
+    gen_op_update_nip((ctx)->nip - 4);
     op_ldstsx(lswx, rD(ctx->opcode), ra, rb);
 }
 
@@ -1441,7 +1441,7 @@ GEN_HANDLER(stswi, 0x1F, 0x15, 0x16, 0x00000001, PPC_INTEGER)
         nb = 32;
     gen_op_set_T1(nb);
     /* NIP cannot be restored if the memory exception comes from an helper */
-    gen_op_update_nip((ctx)->nip - 4); 
+    gen_op_update_nip((ctx)->nip - 4);
     op_ldsts(stsw, rS(ctx->opcode));
 }
 
@@ -1460,7 +1460,7 @@ GEN_HANDLER(stswx, 0x1F, 0x15, 0x14, 0x00000001, PPC_INTEGER)
     }
     gen_op_load_xer_bc();
     /* NIP cannot be restored if the memory exception comes from an helper */
-    gen_op_update_nip((ctx)->nip - 4); 
+    gen_op_update_nip((ctx)->nip - 4);
     op_ldsts(stsw, rS(ctx->opcode));
 }
 
@@ -1775,16 +1775,16 @@ GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000000, PPC_FLOW)
 #define BCOND_LR  1
 #define BCOND_CTR 2
 
-static inline void gen_bcond(DisasContext *ctx, int type) 
-{                                                                             
+static inline void gen_bcond(DisasContext *ctx, int type)
+{
     uint32_t target = 0;
-    uint32_t bo = BO(ctx->opcode);                                            
-    uint32_t bi = BI(ctx->opcode);                                            
-    uint32_t mask;                                                            
+    uint32_t bo = BO(ctx->opcode);
+    uint32_t bi = BI(ctx->opcode);
+    uint32_t mask;
     uint32_t li;
 
     if ((bo & 0x4) == 0)
-        gen_op_dec_ctr();                                                     
+        gen_op_dec_ctr();
     switch(type) {
     case BCOND_IM:
         li = (int32_t)((int16_t)(BD(ctx->opcode)));
@@ -1802,21 +1802,21 @@ static inline void gen_bcond(DisasContext *ctx, int type)
         gen_op_movl_T1_lr();
         break;
     }
-    if (LK(ctx->opcode)) {                                        
+    if (LK(ctx->opcode)) {
         gen_op_setlr(ctx->nip);
     }
     if (bo & 0x10) {
-        /* No CR condition */                                                 
-        switch (bo & 0x6) {                                                   
-        case 0:                                                               
+        /* No CR condition */
+        switch (bo & 0x6) {
+        case 0:
             gen_op_test_ctr();
             break;
-        case 2:                                                               
+        case 2:
             gen_op_test_ctrz();
-            break;                                                            
+            break;
         default:
-        case 4:                                                               
-        case 6:                                                               
+        case 4:
+        case 6:
             if (type == BCOND_IM) {
                 gen_goto_tb(ctx, 0, target);
             } else {
@@ -1824,39 +1824,39 @@ static inline void gen_bcond(DisasContext *ctx, int type)
             }
             goto no_test;
         }
-    } else {                                                                  
-        mask = 1 << (3 - (bi & 0x03));                                        
-        gen_op_load_crf_T0(bi >> 2);                                          
-        if (bo & 0x8) {                                                       
-            switch (bo & 0x6) {                                               
-            case 0:                                                           
+    } else {
+        mask = 1 << (3 - (bi & 0x03));
+        gen_op_load_crf_T0(bi >> 2);
+        if (bo & 0x8) {
+            switch (bo & 0x6) {
+            case 0:
                 gen_op_test_ctr_true(mask);
-                break;                                                        
-            case 2:                                                           
+                break;
+            case 2:
                 gen_op_test_ctrz_true(mask);
-                break;                                                        
-            default:                                                          
-            case 4:                                                           
-            case 6:                                                           
+                break;
+            default:
+            case 4:
+            case 6:
                 gen_op_test_true(mask);
-                break;                                                        
-            }                                                                 
-        } else {                                                              
-            switch (bo & 0x6) {                                               
-            case 0:                                                           
+                break;
+            }
+        } else {
+            switch (bo & 0x6) {
+            case 0:
                 gen_op_test_ctr_false(mask);
-                break;                                                        
-            case 2:                                                           
+                break;
+            case 2:
                 gen_op_test_ctrz_false(mask);
-                break;                                                        
+                break;
             default:
-            case 4:                                                           
-            case 6:                                                           
+            case 4:
+            case 6:
                 gen_op_test_false(mask);
-                break;                                                        
-            }                                                                 
-        }                                                                     
-    }                                                                         
+                break;
+            }
+        }
+    }
     if (type == BCOND_IM) {
         int l1 = gen_new_label();
         gen_op_jz_T0(l1);
@@ -1867,21 +1867,21 @@ static inline void gen_bcond(DisasContext *ctx, int type)
         gen_op_btest_T1(ctx->nip);
     }
  no_test:
-    ctx->exception = EXCP_BRANCH;                                             
+    ctx->exception = EXCP_BRANCH;
 }
 
 GEN_HANDLER(bc, 0x10, 0xFF, 0xFF, 0x00000000, PPC_FLOW)
-{                                                                             
+{
     gen_bcond(ctx, BCOND_IM);
 }
 
 GEN_HANDLER(bcctr, 0x13, 0x10, 0x10, 0x00000000, PPC_FLOW)
-{                                                                             
+{
     gen_bcond(ctx, BCOND_CTR);
 }
 
 GEN_HANDLER(bclr, 0x13, 0x10, 0x00, 0x00000000, PPC_FLOW)
-{                                                                             
+{
     gen_bcond(ctx, BCOND_LR);
 }
 
@@ -2439,7 +2439,7 @@ GEN_OPCODE_MARK(end);
 
 /*****************************************************************************/
 /* Misc PowerPC helpers */
-void cpu_dump_state(CPUState *env, FILE *f, 
+void cpu_dump_state(CPUState *env, FILE *f,
                     int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
                     int flags)
 {
@@ -2537,7 +2537,7 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
         if (env->nb_breakpoints > 0) {
             for(j = 0; j < env->nb_breakpoints; j++) {
                 if (env->breakpoints[j] == ctx.nip) {
-                    gen_op_update_nip(ctx.nip); 
+                    gen_op_update_nip(ctx.nip);
                     gen_op_debug();
                     break;
                 }
index ddf0c9126dabf975ed37c7d7460178ec2a134514..aeb9d0e95bc469d68bfe03dd02ec85f2d9e29fb5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  PowerPC CPU initialization for qemu.
- * 
+ *
  *  Copyright (c) 2003-2005 Jocelyn Mayer
  *
  * This library is free software; you can redistribute it and/or
@@ -934,7 +934,7 @@ static int register_ind_insn (opc_handler_t **ppc_opcodes,
     return ret;
 }
 
-static int register_dblind_insn (opc_handler_t **ppc_opcodes, 
+static int register_dblind_insn (opc_handler_t **ppc_opcodes,
                                  unsigned char idx1, unsigned char idx2,
                                   unsigned char idx3, opc_handler_t *handler)
 {
index 2edda9f0441eec273d8e459aad8e03ec6db9e780..a92b6f38c479b9b784fcdf04156e3df882953a1a 100644 (file)
@@ -141,7 +141,7 @@ if __name__ == '__main__':
     import sys
     denand (open (sys.argv[1], 'rb'),
             open (sys.argv[2], 'wb'))
-    
+
 Style isssues
 -------------
 
index e844d690e24ff41cde524686eaded789d92b99c1..fb10f0ce2bae4127cc5fd8af2cdd8df39708aee2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  SH4 emulation
- * 
+ *
  *  Copyright (c) 2005 Samuel Tardieu
  *
  * This library is free software; you can redistribute it and/or
@@ -121,7 +121,7 @@ typedef struct CPUSH4State {
 
 CPUSH4State *cpu_sh4_init(void);
 int cpu_sh4_exec(CPUSH4State * s);
-int cpu_sh4_signal_handler(int host_signum, void *pinfo, 
+int cpu_sh4_signal_handler(int host_signum, void *pinfo,
                            void *puc);
 
 #include "softfloat.h"
index 356330030770ed40b05202ef9f88e0c7db548b3a..0e0602a189026407b19fb4edc33dc19e11c70578 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  SH4 emulation
- * 
+ *
  *  Copyright (c) 2005 Samuel Tardieu
  *
  * This library is free software; you can redistribute it and/or
index 1839c96ddecb58a20dc0743d87067366d80309b3..9268f60f9f78f34b9c5c6569f30235c80c9ac4f7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  SH4 emulation
- * 
+ *
  *  Copyright (c) 2005 Samuel Tardieu
  *
  * This library is free software; you can redistribute it and/or
index d3b68bc665229fac9d8c3f08e7560ff9625e39e6..a5c258708abfb1b77a9e5dc44fdd3a59722055fc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  SH4 emulation
- * 
+ *
  *  Copyright (c) 2005 Samuel Tardieu
  *
  * This library is free software; you can redistribute it and/or
index f02fa588fc4e5d628aa712919f539de4944af3a7..6bbe413501a2b533b1e0056b9b1b143d64eb4a98 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  SH4 emulation
- * 
+ *
  *  Copyright (c) 2005 Samuel Tardieu
  *
  * This library is free software; you can redistribute it and/or
index ca39abf96a512779462db29ce6df3061cebc851e..b59871c20685035e23cfd410fb42d54ec96e8573 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  SH4 emulation
- * 
+ *
  *  Copyright (c) 2005 Samuel Tardieu
  *
  * This library is free software; you can redistribute it and/or
index 358f975e0cef2175b1c989ba227312f7e4016a87..7e5bd68b32b68388772b822b1e31919d462be45d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  SH4 translation
- * 
+ *
  *  Copyright (c) 2005 Samuel Tardieu
  *
  * This library is free software; you can redistribute it and/or
index 5c4593ac63363cbcf7eaab12430952a0e9845825..b71cce2c06029d7a2e63de57728be17aaed67066 100644 (file)
@@ -34,7 +34,7 @@
 #define TT_PRIV_INSN 0x03
 #define TT_NFPU_INSN 0x04
 #define TT_WIN_OVF  0x05
-#define TT_WIN_UNF  0x06 
+#define TT_WIN_UNF  0x06
 #define TT_FP_EXCP  0x08
 #define TT_DFAULT   0x09
 #define TT_EXTINT   0x10
index 74988f7df1a13c2b8cf0bcfdfa5be63ca59717ac..0598b3020844aa4d2dc23f9f9b8104e97c07a119 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  SPARC micro operations (templates for various register related
  *  operations)
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
index 8f12667df6eb5eced9027d7116ae9e83428a7e73..dc4762295ea539479ddb4ebe45f10e63e5ae77d7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  sparc helpers
- * 
+ *
  *  Copyright (c) 2003-2005 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -46,7 +46,7 @@ void cpu_unlock(void)
     spin_unlock(&global_cpu_lock);
 }
 
-#if defined(CONFIG_USER_ONLY) 
+#if defined(CONFIG_USER_ONLY)
 
 int cpu_sparc_handle_mmu_fault(CPUState *env, target_ulong address, int rw,
                                int is_user, int is_softmmu)
index 1ec15d28b1376f27669883f1fc36d510068c1574..311e446f27106fac69512a962ba1703675eae206 100644 (file)
@@ -287,7 +287,7 @@ typedef union UREG64 {
     __p.l.v1 = PARAM1;\
     __p.l.v0 = PARAM2;\
     __p.q;\
-}) 
+})
 
 void OPPROTO op_movq_T0_im64(void)
 {
@@ -864,7 +864,7 @@ void OPPROTO op_rett(void)
 void OPPROTO op_save(void)
 {
     uint32_t cwp;
-    cwp = (env->cwp - 1) & (NWINDOWS - 1); 
+    cwp = (env->cwp - 1) & (NWINDOWS - 1);
     if (env->wim & (1 << cwp)) {
         raise_exception(TT_WIN_OVF);
     }
@@ -875,7 +875,7 @@ void OPPROTO op_save(void)
 void OPPROTO op_restore(void)
 {
     uint32_t cwp;
-    cwp = (env->cwp + 1) & (NWINDOWS - 1); 
+    cwp = (env->cwp + 1) & (NWINDOWS - 1);
     if (env->wim & (1 << cwp)) {
         raise_exception(TT_WIN_UNF);
     }
@@ -970,9 +970,9 @@ void OPPROTO op_wrcwp(void)
 void OPPROTO op_save(void)
 {
     uint32_t cwp;
-    cwp = (env->cwp - 1) & (NWINDOWS - 1); 
+    cwp = (env->cwp - 1) & (NWINDOWS - 1);
     if (env->cansave == 0) {
-        raise_exception(TT_SPILL | (env->otherwin != 0 ? 
+        raise_exception(TT_SPILL | (env->otherwin != 0 ?
                                    (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
                                    ((env->wstate & 0x7) << 2)));
     } else {
@@ -991,9 +991,9 @@ void OPPROTO op_save(void)
 void OPPROTO op_restore(void)
 {
     uint32_t cwp;
-    cwp = (env->cwp + 1) & (NWINDOWS - 1); 
+    cwp = (env->cwp + 1) & (NWINDOWS - 1);
     if (env->canrestore == 0) {
-        raise_exception(TT_FILL | (env->otherwin != 0 ? 
+        raise_exception(TT_FILL | (env->otherwin != 0 ?
                                   (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
                                   ((env->wstate & 0x7) << 2)));
     } else {
@@ -1058,7 +1058,7 @@ void OPPROTO op_eval_be(void)
 void OPPROTO op_eval_ble(void)
 {
     target_ulong Z = FLAG_SET(PSR_ZERO), N = FLAG_SET(PSR_NEG), V = FLAG_SET(PSR_OVF);
-    
+
     T2 = Z | (N ^ V);
 }
 
@@ -1146,7 +1146,7 @@ void OPPROTO op_eval_xbe(void)
 void OPPROTO op_eval_xble(void)
 {
     target_ulong Z = XFLAG_SET(PSR_ZERO), N = XFLAG_SET(PSR_NEG), V = XFLAG_SET(PSR_OVF);
-    
+
     T2 = Z | (N ^ V);
 }
 
@@ -1512,7 +1512,7 @@ void OPPROTO op_mov_cc(void)
 void OPPROTO op_flushw(void)
 {
     if (env->cansave != NWINDOWS - 2) {
-        raise_exception(TT_SPILL | (env->otherwin != 0 ? 
+        raise_exception(TT_SPILL | (env->otherwin != 0 ?
                                    (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
                                    ((env->wstate & 0x7) << 2)));
     }
index 0b1d5669aa8cb0207936c3c3a56009c57322d6e9..45cb6949e0d6faff7e1491a913ea22b8bc633e86 100644 (file)
@@ -7,7 +7,7 @@ void raise_exception(int tt)
 {
     env->exception_index = tt;
     cpu_loop_exit();
-}   
+}
 
 #ifdef USE_INT_TO_FLOAT_HELPERS
 void do_fitos(void)
@@ -84,7 +84,7 @@ GEN_FCMP(fcmps_fcc3, float32, FT0, FT1, 26);
 GEN_FCMP(fcmpd_fcc3, float64, DT0, DT1, 26);
 #endif
 
-#if defined(CONFIG_USER_ONLY) 
+#if defined(CONFIG_USER_ONLY)
 void helper_ld_asi(int asi, int size, int sign)
 {
 }
@@ -118,7 +118,7 @@ void helper_ld_asi(int asi, int size, int sign)
     case 4: /* read MMU regs */
        {
            int reg = (T0 >> 8) & 0xf;
-           
+
            ret = env->mmuregs[reg];
            if (reg == 3) /* Fault status cleared on read */
                env->mmuregs[reg] = 0;
@@ -185,7 +185,7 @@ void helper_st_asi(int asi, int size, int sign)
        {
            int reg = (T0 >> 8) & 0xf;
            uint32_t oldreg;
-           
+
            oldreg = env->mmuregs[reg];
             switch(reg) {
             case 0:
@@ -226,7 +226,7 @@ void helper_st_asi(int asi, int size, int sign)
            // copy 32 bytes
            uint32_t src = T1, dst = T0;
            uint8_t temp[32];
-           
+
            tswap32s(&src);
 
            cpu_physical_memory_read(src, (void *) &temp, 32);
@@ -241,7 +241,7 @@ void helper_st_asi(int asi, int size, int sign)
            int i;
            uint32_t dst = T0;
            uint64_t val;
-           
+
            val = (((uint64_t)T1) << 32) | T2;
            tswap64s(&val);
 
@@ -342,7 +342,7 @@ void helper_ld_asi(int asi, int size, int sign)
     case 0x56: // I-MMU tag read
        {
            unsigned int i;
-           
+
            for (i = 0; i < 64; i++) {
                // Valid, ctx match, vaddr match
                if ((env->itlb_tte[i] & 0x8000000000000000ULL) != 0 &&
@@ -363,7 +363,7 @@ void helper_ld_asi(int asi, int size, int sign)
     case 0x5e: // D-MMU tag read
        {
            unsigned int i;
-           
+
            for (i = 0; i < 64; i++) {
                // Valid, ctx match, vaddr match
                if ((env->dtlb_tte[i] & 0x8000000000000000ULL) != 0 &&
@@ -457,7 +457,7 @@ void helper_st_asi(int asi, int size, int sign)
        {
            int reg = (T0 >> 3) & 0xf;
            uint64_t oldreg;
-           
+
            oldreg = env->immuregs[reg];
             switch(reg) {
             case 0: // RO
@@ -524,7 +524,7 @@ void helper_st_asi(int asi, int size, int sign)
        {
            int reg = (T0 >> 3) & 0xf;
            uint64_t oldreg;
-           
+
            oldreg = env->dmmuregs[reg];
             switch(reg) {
             case 0: // RO
@@ -616,7 +616,7 @@ void helper_rett()
     unsigned int cwp;
 
     env->psret = 1;
-    cwp = (env->cwp + 1) & (NWINDOWS - 1); 
+    cwp = (env->cwp + 1) & (NWINDOWS - 1);
     if (env->wim & (1 << cwp)) {
         raise_exception(TT_WIN_UNF);
     }
@@ -790,7 +790,7 @@ void do_interrupt(int intno)
        count++;
     }
 #endif
-#if !defined(CONFIG_USER_ONLY) 
+#if !defined(CONFIG_USER_ONLY)
     if (env->tl == MAXTL) {
         cpu_abort(env, "Trap 0x%04x while trap level is MAXTL, Error state", env->exception_index);
        return;
@@ -844,14 +844,14 @@ void do_interrupt(int intno)
        count++;
     }
 #endif
-#if !defined(CONFIG_USER_ONLY) 
+#if !defined(CONFIG_USER_ONLY)
     if (env->psret == 0) {
         cpu_abort(env, "Trap 0x%02x while interrupts disabled, Error state", env->exception_index);
        return;
     }
 #endif
     env->psret = 0;
-    cwp = (env->cwp - 1) & (NWINDOWS - 1); 
+    cwp = (env->cwp - 1) & (NWINDOWS - 1);
     set_cwp(cwp);
     env->regwptr[9] = env->pc;
     env->regwptr[10] = env->npc;
@@ -864,7 +864,7 @@ void do_interrupt(int intno)
 }
 #endif
 
-#if !defined(CONFIG_USER_ONLY) 
+#if !defined(CONFIG_USER_ONLY)
 
 #define MMUSUFFIX _mmu
 #define GETPC() (__builtin_return_address(0))
index ecf65fd7007771858735d227ef9b4d535cca5731..f9206153447f7a361206d121e67e3e319467f7fe 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  SPARC micro operations (templates for various register related
  *  operations)
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
index 455dd171e450501d97ae104f92efebdfaea2a64e..e9e6b8a29bb9eeba347c2680067c79fcfad0e458 100644 (file)
@@ -565,7 +565,7 @@ static inline void gen_movl_npc_im(target_ulong npc)
 #endif
 }
 
-static inline void gen_goto_tb(DisasContext *s, int tb_num, 
+static inline void gen_goto_tb(DisasContext *s, int tb_num,
                                target_ulong pc, target_ulong npc)
 {
     TranslationBlock *tb;
@@ -831,11 +831,11 @@ static void do_branch(DisasContext * dc, int32_t offset, uint32_t insn, int cc)
 {
     unsigned int cond = GET_FIELD(insn, 3, 6), a = (insn & (1 << 29));
     target_ulong target = dc->pc + offset;
-       
+
     if (cond == 0x0) {
        /* unconditional not taken */
        if (a) {
-           dc->pc = dc->npc + 4; 
+           dc->pc = dc->npc + 4;
            dc->npc = dc->pc + 4;
        } else {
            dc->pc = dc->npc;
@@ -986,7 +986,7 @@ static void disas_sparc_insn(DisasContext * dc)
                }
            case 0x3:           /* V9 BPr */
                {
-                   target = GET_FIELD_SP(insn, 0, 13) | 
+                   target = GET_FIELD_SP(insn, 0, 13) |
                         (GET_FIELD_SP(insn, 20, 21) << 14);
                    target = sign_extend(target, 16);
                    target <<= 2;
@@ -2665,7 +2665,7 @@ static inline int gen_intermediate_code_internal(TranslationBlock * tb,
 
  exit_gen_loop:
     if (!dc->is_br) {
-        if (dc->pc != DYNAMIC_PC && 
+        if (dc->pc != DYNAMIC_PC &&
             (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) {
             /* static PC and NPC: we can use direct chaining */
             gen_branch(dc, (long)tb, dc->pc, dc->npc);
@@ -2765,7 +2765,7 @@ CPUSPARCState *cpu_sparc_init(void)
 
 #define GET_FLAG(a,b) ((env->psr & a)?b:'-')
 
-void cpu_dump_state(CPUState *env, FILE *f, 
+void cpu_dump_state(CPUState *env, FILE *f,
                     int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
                     int flags)
 {
@@ -2809,7 +2809,7 @@ void cpu_dump_state(CPUState *env, FILE *f,
     cpu_fprintf(f, "psr: 0x%08x -> %c%c%c%c %c%c%c wim: 0x%08x\n", GET_PSR(env),
            GET_FLAG(PSR_ZERO, 'Z'), GET_FLAG(PSR_OVF, 'V'),
            GET_FLAG(PSR_NEG, 'N'), GET_FLAG(PSR_CARRY, 'C'),
-           env->psrs?'S':'-', env->psrps?'P':'-', 
+           env->psrs?'S':'-', env->psrps?'P':'-',
            env->psret?'E':'-', env->wim);
 #endif
     cpu_fprintf(f, "fsr: 0x%08x\n", GET_FSR32(env));
index f84e6cb3686b0b03e7c178c9605285e2e4eb4ae7..e0daa7ad981fff062ab1ba34f686060a03fb1b38 100644 (file)
@@ -83,7 +83,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) {                           \
        : "r0","r1","r2","r3","lr");                                                    \
   __syscall_return(type,__res);                                                                \
 }
-  
+
 
 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5)    \
 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) {                        \
index 6ca90296508d51aa5d8b4e59349849174af81bd7..2f82defe03ebbd392fc5892b11fb8e44a9d7890a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  linux and CPU test
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -58,7 +58,7 @@ void error1(const char *filename, int line, const char *fmt, ...)
 int __chk_error(const char *filename, int line, int ret)
 {
     if (ret < 0) {
-        error1(filename, line, "%m (ret=%d, errno=%d)", 
+        error1(filename, line, "%m (ret=%d, errno=%d)",
                ret, errno);
     }
     return ret;
@@ -93,11 +93,11 @@ void test_file(void)
 
     if (getcwd(cur_dir, sizeof(cur_dir)) == NULL)
         error("getcwd");
-    
+
     chk_error(mkdir(TESTPATH, 0755));
-    
+
     chk_error(chdir(TESTPATH));
-    
+
     /* open/read/write/close/readv/writev/lseek */
 
     fd = chk_error(open("file1", O_WRONLY | O_TRUNC | O_CREAT, 0644));
@@ -124,7 +124,7 @@ void test_file(void)
         error("read");
     if (memcmp(buf, buf2, FILE_BUF_SIZE) != 0)
         error("memcmp");
-    
+
 #define FOFFSET 16
     ret = chk_error(lseek(fd, FOFFSET, SEEK_SET));
     if (ret != 16)
@@ -138,7 +138,7 @@ void test_file(void)
         error("readv");
     if (memcmp(buf + FOFFSET, buf3, FILE_BUF_SIZE - FOFFSET) != 0)
         error("memcmp");
-    
+
     chk_error(close(fd));
 
     /* access */
@@ -171,18 +171,18 @@ void test_file(void)
     chk_error(ftruncate(fd, 50));
     chk_error(fstat(fd, &st));
     chk_error(close(fd));
-    
+
     if (st.st_size != 50)
         error("stat size");
     if (!S_ISREG(st.st_mode))
         error("stat mode");
-    
+
     /* symlink/lstat */
     chk_error(symlink("file2", "file3"));
     chk_error(lstat("file3", &st));
     if (!S_ISLNK(st.st_mode))
         error("stat mode");
-    
+
     /* getdents */
     dir = opendir(TESTPATH);
     if (!dir)
@@ -241,7 +241,7 @@ void test_time(void)
     ti = tv2.tv_sec - tv.tv_sec;
     if (ti >= 2)
         error("gettimeofday");
-    
+
     chk_error(getrusage(RUSAGE_SELF, &rusg1));
     for(i = 0;i < 10000; i++);
     chk_error(getrusage(RUSAGE_SELF, &rusg2));
@@ -272,7 +272,7 @@ char *pstrcat(char *buf, int buf_size, const char *s)
 {
     int len;
     len = strlen(buf);
-    if (len < buf_size) 
+    if (len < buf_size)
         pstrcpy(buf + len, buf_size - len, s);
     return buf;
 }
@@ -327,7 +327,7 @@ void test_socket(void)
     chk_error(getsockopt(server_fd, SOL_SOCKET, SO_TYPE, &val, &len));
     if (val != SOCK_STREAM)
         error("getsockopt");
-    
+
     pid = chk_error(fork());
     if (pid == 0) {
         client_fd = client_socket();
@@ -419,11 +419,11 @@ void test_clone(void)
     int pid1, pid2, status1, status2;
 
     stack1 = malloc(STACK_SIZE);
-    pid1 = chk_error(clone(thread1_func, stack1 + STACK_SIZE, 
+    pid1 = chk_error(clone(thread1_func, stack1 + STACK_SIZE,
                            CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello1"));
 
     stack2 = malloc(STACK_SIZE);
-    pid2 = chk_error(clone(thread2_func, stack2 + STACK_SIZE, 
+    pid2 = chk_error(clone(thread2_func, stack2 + STACK_SIZE,
                            CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello2"));
 
     while (waitpid(pid1, &status1, 0) != pid1);
@@ -465,7 +465,7 @@ void test_signal(void)
     sigemptyset(&act.sa_mask);
     act.sa_flags = 0;
     chk_error(sigaction(SIGALRM, &act, NULL));
-    
+
     it.it_interval.tv_sec = 0;
     it.it_interval.tv_usec = 10 * 1000;
     it.it_value.tv_sec = 0;
@@ -475,7 +475,7 @@ void test_signal(void)
     if (oit.it_value.tv_sec != it.it_value.tv_sec ||
         oit.it_value.tv_usec != it.it_value.tv_usec)
         error("itimer");
-    
+
     while (alarm_count < 5) {
         usleep(10 * 1000);
     }
@@ -498,7 +498,7 @@ void test_signal(void)
     if (setjmp(jmp_env) == 0) {
         *(uint8_t *)0 = 0;
     }
-    
+
     act.sa_handler = SIG_DFL;
     sigemptyset(&act.sa_mask);
     act.sa_flags = 0;
index 421e6a99f2d744f19dac84110f25f51c4c7157d4..ad0d938ee1a16a40f392a321c35fbd8c0805129b 100644 (file)
@@ -59,7 +59,7 @@ uint64_t cpu_get_tsc(CPUState *env)
     return 0;
 }
 
-static void set_gate(void *ptr, unsigned int type, unsigned int dpl, 
+static void set_gate(void *ptr, unsigned int type, unsigned int dpl,
                      unsigned long addr, unsigned int sel)
 {
     unsigned int e1, e2;
@@ -141,7 +141,7 @@ static inline void pushw(CPUState *env, int val)
     *(uint16_t *)seg_to_linear(env->segs[R_SS].selector, env->regs[R_ESP]) = val;
 }
 
-static void host_segv_handler(int host_signum, siginfo_t *info, 
+static void host_segv_handler(int host_signum, siginfo_t *info,
                               void *puc)
 {
     if (cpu_signal_handler(host_signum, info, puc)) {
@@ -160,9 +160,9 @@ int main(int argc, char **argv)
     if (argc != 2)
         usage();
     filename = argv[1];
-    
-    vm86_mem = mmap((void *)0x00000000, 0x110000, 
-                    PROT_WRITE | PROT_READ | PROT_EXEC, 
+
+    vm86_mem = mmap((void *)0x00000000, 0x110000,
+                    PROT_WRITE | PROT_READ | PROT_EXEC,
                     MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);
     if (vm86_mem == MAP_FAILED) {
         perror("mmap");
@@ -185,7 +185,7 @@ int main(int argc, char **argv)
     /* install exception handler for CPU emulator */
     {
         struct sigaction act;
-        
+
         sigfillset(&act.sa_mask);
         act.sa_flags = SA_SIGINFO;
         //        act.sa_flags |= SA_ONSTACK;
@@ -218,23 +218,23 @@ int main(int argc, char **argv)
     /* flags setup : we activate the IRQs by default as in user
        mode. We also activate the VM86 flag to run DOS code */
     env->eflags |= IF_MASK | VM_MASK;
-    
+
     /* init basic registers */
     env->eip = 0x100;
     env->regs[R_ESP] = 0xfffe;
     seg = (COM_BASE_ADDR - 0x100) >> 4;
 
-    cpu_x86_load_seg_cache(env, R_CS, seg, 
+    cpu_x86_load_seg_cache(env, R_CS, seg,
                            (seg << 4), 0xffff, 0);
-    cpu_x86_load_seg_cache(env, R_SS, seg, 
+    cpu_x86_load_seg_cache(env, R_SS, seg,
                            (seg << 4), 0xffff, 0);
-    cpu_x86_load_seg_cache(env, R_DS, seg, 
+    cpu_x86_load_seg_cache(env, R_DS, seg,
                            (seg << 4), 0xffff, 0);
-    cpu_x86_load_seg_cache(env, R_ES, seg, 
+    cpu_x86_load_seg_cache(env, R_ES, seg,
                            (seg << 4), 0xffff, 0);
-    cpu_x86_load_seg_cache(env, R_FS, seg, 
+    cpu_x86_load_seg_cache(env, R_FS, seg,
                            (seg << 4), 0xffff, 0);
-    cpu_x86_load_seg_cache(env, R_GS, seg, 
+    cpu_x86_load_seg_cache(env, R_GS, seg,
                            (seg << 4), 0xffff, 0);
 
     /* exception support */
@@ -260,7 +260,7 @@ int main(int argc, char **argv)
     set_idt(17, 0);
     set_idt(18, 0);
     set_idt(19, 0);
-        
+
     /* put return code */
     *seg_to_linear(env->segs[R_CS].selector, 0) = 0xb4; /* mov ah, $0 */
     *seg_to_linear(env->segs[R_CS].selector, 1) = 0x00;
@@ -275,7 +275,7 @@ int main(int argc, char **argv)
     env->regs[R_EDI] = 0xfffe;
 
     /* inform the emulator of the mmaped memory */
-    page_set_flags(0x00000000, 0x110000, 
+    page_set_flags(0x00000000, 0x110000,
                    PAGE_WRITE | PAGE_READ | PAGE_EXEC | PAGE_VALID);
 
     for(;;) {
index 43deeca098c4451cf2df42262926d7c95e9fd6a1..cbbaf313babe5f982494479add17d31152882012 100644 (file)
@@ -51,7 +51,7 @@ static inline void pushw(struct vm86_regs *r, int val)
 
 void dump_regs(struct vm86_regs *r)
 {
-    fprintf(stderr, 
+    fprintf(stderr,
             "EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n"
             "ESI=%08lx EDI=%08lx EBP=%08lx ESP=%08lx\n"
             "EIP=%08lx EFL=%08lx\n"
@@ -80,9 +80,9 @@ int main(int argc, char **argv)
     if (argc != 2)
         usage();
     filename = argv[1];
-    
-    vm86_mem = mmap((void *)0x00000000, 0x110000, 
-                    PROT_WRITE | PROT_READ | PROT_EXEC, 
+
+    vm86_mem = mmap((void *)0x00000000, 0x110000,
+                    PROT_WRITE | PROT_READ | PROT_EXEC,
                     MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);
     if (vm86_mem == MAP_FAILED) {
         perror("mmap");
@@ -147,7 +147,7 @@ int main(int argc, char **argv)
         case VM86_INTx:
             {
                 int int_num, ah;
-                
+
                 int_num = VM86_ARG(ret);
                 if (int_num != 0x21)
                     goto unknown_int;
index e400e73fd984ced8057dda374370904a55e16773..8f51052cecb9bbf7161d403edbaa78edfbc40b82 100644 (file)
@@ -7,7 +7,7 @@ CS_SEG = 0xf
 code16_start:
 
         .globl code16_func1
-        
+
         /* basic test */
 code16_func1 = . - code16_start
         mov $1, %eax
@@ -24,7 +24,7 @@ code16_func2 = . - code16_start
         pop %ax
         data32 lret
 
-/* test various jmp opcodes */        
+/* test various jmp opcodes */
         .globl code16_func3
 code16_func3 = . - code16_start
         jmp 1f
@@ -36,9 +36,9 @@ code16_func3 = . - code16_start
         jz 2f
         add $2, %ax
 2:
-        
+
         call myfunc
-        
+
         lcall $CS_SEG, $(myfunc2 - code16_start)
 
         ljmp $CS_SEG, $(myjmp1 - code16_start)
@@ -50,7 +50,7 @@ myjmp1_next:
 myjmp2_next:
 
         data32 lret
-        
+
 myfunc2_addr:
         .short myfunc2 - code16_start
         .short CS_SEG
index fd0d991341ea126a4cbcdcc3fee1eab0da7c36f7..015f59e157d80fa63cc551eaba3a03471bec6907 100644 (file)
@@ -1,5 +1,5 @@
 
-void glue(glue(test_, OP), b)(long op0, long op1) 
+void glue(glue(test_, OP), b)(long op0, long op1)
 {
     long res, s1, s0, flags;
     s0 = op0;
@@ -8,7 +8,7 @@ void glue(glue(test_, OP), b)(long op0, long op1)
     flags = 0;
     asm ("push %4\n\t"
          "popf\n\t"
-         stringify(OP)"b %b2\n\t" 
+         stringify(OP)"b %b2\n\t"
          "pushf\n\t"
          "pop %1\n\t"
          : "=a" (res), "=g" (flags)
@@ -17,7 +17,7 @@ void glue(glue(test_, OP), b)(long op0, long op1)
            stringify(OP) "b", s0, s1, res, flags & CC_MASK);
 }
 
-void glue(glue(test_, OP), w)(long op0h, long op0, long op1) 
+void glue(glue(test_, OP), w)(long op0h, long op0, long op1)
 {
     long res, s1, flags, resh;
     s1 = op1;
@@ -26,7 +26,7 @@ void glue(glue(test_, OP), w)(long op0h, long op0, long op1)
     flags = 0;
     asm ("push %5\n\t"
          "popf\n\t"
-         stringify(OP) "w %w3\n\t" 
+         stringify(OP) "w %w3\n\t"
          "pushf\n\t"
          "pop %1\n\t"
          : "=a" (res), "=g" (flags), "=d" (resh)
@@ -35,7 +35,7 @@ void glue(glue(test_, OP), w)(long op0h, long op0, long op1)
            stringify(OP) "w", op0h, op0, s1, resh, res, flags & CC_MASK);
 }
 
-void glue(glue(test_, OP), l)(long op0h, long op0, long op1) 
+void glue(glue(test_, OP), l)(long op0h, long op0, long op1)
 {
     long res, s1, flags, resh;
     s1 = op1;
@@ -44,7 +44,7 @@ void glue(glue(test_, OP), l)(long op0h, long op0, long op1)
     flags = 0;
     asm ("push %5\n\t"
          "popf\n\t"
-         stringify(OP) "l %k3\n\t" 
+         stringify(OP) "l %k3\n\t"
          "pushf\n\t"
          "pop %1\n\t"
          : "=a" (res), "=g" (flags), "=d" (resh)
@@ -54,7 +54,7 @@ void glue(glue(test_, OP), l)(long op0h, long op0, long op1)
 }
 
 #if defined(__x86_64__)
-void glue(glue(test_, OP), q)(long op0h, long op0, long op1) 
+void glue(glue(test_, OP), q)(long op0h, long op0, long op1)
 {
     long res, s1, flags, resh;
     s1 = op1;
@@ -63,7 +63,7 @@ void glue(glue(test_, OP), q)(long op0h, long op0, long op1)
     flags = 0;
     asm ("push %5\n\t"
          "popf\n\t"
-         stringify(OP) "q %3\n\t" 
+         stringify(OP) "q %3\n\t"
          "pushf\n\t"
          "pop %1\n\t"
          : "=a" (res), "=g" (flags), "=d" (resh)
index a972f1b81eb7d3418501468304784cbe94ae2f7d..3bb96c99277798cdc562ab22453c26f896e875c0 100644 (file)
@@ -14,7 +14,7 @@ vm86_code_start:
         movw %ax, %es
         es movw $GET_OFFSET(int90_test), 0x90 * 4
         es movw %cs, 0x90 * 4 + 2
-        
+
         /* launch int 0x90 */
 
         int $0x90
@@ -24,23 +24,23 @@ vm86_code_start:
         movb $0x09, %ah
         int $0x21
 
-        pushf 
+        pushf
         popw %dx
         movb $0xff, %ah
         int $0x21
 
         cli
-        pushf 
+        pushf
         popw %dx
         movb $0xff, %ah
         int $0x21
 
-        sti        
-        pushfl 
+        sti
+        pushfl
         popl %edx
         movb $0xff, %ah
         int $0x21
-        
+
 #if 0
         movw $GET_OFFSET(IF_msg1), %dx
         movb $0x09, %ah
@@ -54,11 +54,11 @@ vm86_code_start:
         cli
 #endif
 
-        pushf 
+        pushf
         popw %dx
         movb $0xff, %ah
         int $0x21
-        
+
         pushfl
         movw %sp, %bx
         orw $0x200, (%bx)
@@ -73,7 +73,7 @@ vm86_code_start:
         int $0x21
 
 int90_test:
-        pushf 
+        pushf
         pop %dx
         movb $0xff, %ah
         int $0x21
@@ -82,15 +82,15 @@ int90_test:
         movw 4(%bx), %dx
         movb $0xff, %ah
         int $0x21
-        
+
         movw $GET_OFFSET(int90_msg), %dx
         movb $0x09, %ah
         int $0x21
         iret
-                    
+
 int90_msg:
         .string "INT90 started\n$"
+
 hello_world:
         .string "Hello VM86 world\n$"
 
@@ -101,4 +101,3 @@ IF_msg1:
         .string "If you see a diff here, your Linux kernel is buggy, please update to 2.4.20 kernel\n$"
 
 vm86_code_end:
-        
\ No newline at end of file
index 267391575a445ae3307c0f183ce1d3f518601754..2d4b0a0df381081a5de0bc4a7264659fc4b15b81 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  x86 CPU test
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -470,7 +470,7 @@ void test_jcc(void)
 #define OP imul
 #include "test-i386-muldiv.h"
 
-void test_imulw2(long op0, long op1) 
+void test_imulw2(long op0, long op1)
 {
     long res, s1, s0, flags;
     s0 = op0;
@@ -479,7 +479,7 @@ void test_imulw2(long op0, long op1)
     flags = 0;
     asm volatile ("push %4\n\t"
          "popf\n\t"
-         "imulw %w2, %w0\n\t" 
+         "imulw %w2, %w0\n\t"
          "pushf\n\t"
          "pop %1\n\t"
          : "=q" (res), "=g" (flags)
@@ -488,7 +488,7 @@ void test_imulw2(long op0, long op1)
            "imulw", s0, s1, res, flags & CC_MASK);
 }
 
-void test_imull2(long op0, long op1) 
+void test_imull2(long op0, long op1)
 {
     long res, s1, s0, flags;
     s0 = op0;
@@ -497,7 +497,7 @@ void test_imull2(long op0, long op1)
     flags = 0;
     asm volatile ("push %4\n\t"
          "popf\n\t"
-         "imull %k2, %k0\n\t" 
+         "imull %k2, %k0\n\t"
          "pushf\n\t"
          "pop %1\n\t"
          : "=q" (res), "=g" (flags)
@@ -507,7 +507,7 @@ void test_imull2(long op0, long op1)
 }
 
 #if defined(__x86_64__)
-void test_imulq2(long op0, long op1) 
+void test_imulq2(long op0, long op1)
 {
     long res, s1, s0, flags;
     s0 = op0;
@@ -516,7 +516,7 @@ void test_imulq2(long op0, long op1)
     flags = 0;
     asm volatile ("push %4\n\t"
          "popf\n\t"
-         "imulq %2, %0\n\t" 
+         "imulq %2, %0\n\t"
          "pushf\n\t"
          "pop %1\n\t"
          : "=q" (res), "=g" (flags)
@@ -739,7 +739,7 @@ void fpu_clear_exceptions(void)
         uint32_t ignored[4];
         long double fpregs[8];
     } float_env32;
-    
+
     asm volatile ("fnstenv %0\n" : : "m" (float_env32));
     float_env32.fpus &= ~0x7f;
     asm volatile ("fldenv %0\n" : : "m" (float_env32));
@@ -758,14 +758,14 @@ void test_fcmp(double a, double b)
         "fstsw %%ax\n"
         : "=a" (fpus)
         : "t" (a), "u" (b));
-    printf("fcom(%f %f)=%04lx \n", 
+    printf("fcom(%f %f)=%04lx \n",
            a, b, fpus & (0x4500 | FPUS_EMASK));
     fpu_clear_exceptions();
     asm("fucom %2\n"
         "fstsw %%ax\n"
         : "=a" (fpus)
         : "t" (a), "u" (b));
-    printf("fucom(%f %f)=%04lx\n", 
+    printf("fucom(%f %f)=%04lx\n",
            a, b, fpus & (0x4500 | FPUS_EMASK));
     if (TEST_FCOMI) {
         /* test f(u)comi instruction */
@@ -776,7 +776,7 @@ void test_fcmp(double a, double b)
             "pop %0\n"
             : "=r" (eflags), "=a" (fpus)
             : "t" (a), "u" (b));
-        printf("fcomi(%f %f)=%04lx %02lx\n", 
+        printf("fcomi(%f %f)=%04lx %02lx\n",
                a, b, fpus & FPUS_EMASK, eflags & (CC_Z | CC_P | CC_C));
         fpu_clear_exceptions();
         asm("fucomi %3, %2\n"
@@ -785,7 +785,7 @@ void test_fcmp(double a, double b)
             "pop %0\n"
             : "=r" (eflags), "=a" (fpus)
             : "t" (a), "u" (b));
-        printf("fucomi(%f %f)=%04lx %02lx\n", 
+        printf("fucomi(%f %f)=%04lx %02lx\n",
                a, b, fpus & FPUS_EMASK, eflags & (CC_Z | CC_P | CC_C));
     }
     fpu_clear_exceptions();
@@ -813,7 +813,7 @@ void test_fcvt(double a)
     printf("(float)%f = %f\n", a, fa);
     printf("(long double)%f = %Lf\n", a, la);
     printf("a=" FMT64X "\n", *(uint64_t *)&a);
-    printf("la=" FMT64X " %04x\n", *(uint64_t *)&la, 
+    printf("la=" FMT64X " %04x\n", *(uint64_t *)&la,
            *(unsigned short *)((char *)(&la) + 8));
 
     /* test all roundings */
@@ -855,7 +855,7 @@ void test_fbcd(double a)
 
     asm("fbstp %0" : "=m" (bcd[0]) : "t" (a) : "st");
     asm("fbld %1" : "=t" (b) : "m" (bcd[0]));
-    printf("a=%f bcd=%04x%04x%04x%04x%04x b=%f\n", 
+    printf("a=%f bcd=%04x%04x%04x%04x%04x b=%f\n",
            a, bcd[4], bcd[3], bcd[2], bcd[1], bcd[0], b);
 }
 
@@ -1041,7 +1041,7 @@ void test_bcd(void)
     TEST_BCD(aaa, 0x12340306, 0, (CC_C | CC_A));
     TEST_BCD(aaa, 0x1234040a, 0, (CC_C | CC_A));
     TEST_BCD(aaa, 0x123405fa, 0, (CC_C | CC_A));
-    
+
     TEST_BCD(aas, 0x12340205, CC_A, (CC_C | CC_A));
     TEST_BCD(aas, 0x12340306, CC_A, (CC_C | CC_A));
     TEST_BCD(aas, 0x1234040a, CC_A, (CC_C | CC_A));
@@ -1157,12 +1157,12 @@ void test_xchg(void)
             else
                 op1 = op0;
             op2 = 0x6532432432434;
-            asm("cmpxchg8b %1\n" 
+            asm("cmpxchg8b %1\n"
                 "pushf\n"
                 "pop %2\n"
                 : "=A" (op0), "=m" (op1), "=g" (eflags)
                 : "0" (op0), "m" (op1), "b" ((int)op2), "c" ((int)(op2 >> 32)));
-            printf("cmpxchg8b: op0=" FMT64X " op1=" FMT64X " CC=%02lx\n", 
+            printf("cmpxchg8b: op0=" FMT64X " op1=" FMT64X " CC=%02lx\n",
                     op0, op1, eflags & CC_Z);
         }
     }
@@ -1276,9 +1276,9 @@ void test_segs(void)
 
     segoff.seg = MK_SEL(2);
     segoff.offset = 0xabcdef12;
-    asm volatile("lfs %2, %0\n\t" 
+    asm volatile("lfs %2, %0\n\t"
                  "movl %%fs, %1\n\t"
-                 : "=r" (res), "=g" (res2) 
+                 : "=r" (res), "=g" (res2)
                  : "m" (segoff));
     printf("FS:reg = %04x:%08x\n", res2, res);
 
@@ -1317,15 +1317,15 @@ void test_code16(void)
     modify_ldt(1, &ldt, sizeof(ldt)); /* write ldt entry */
 
     /* call the first function */
-    asm volatile ("lcall %1, %2" 
+    asm volatile ("lcall %1, %2"
                   : "=a" (res)
                   : "i" (MK_SEL(1)), "i" (&code16_func1): "memory", "cc");
     printf("func1() = 0x%08x\n", res);
-    asm volatile ("lcall %2, %3" 
+    asm volatile ("lcall %2, %3"
                   : "=a" (res), "=c" (res2)
                   : "i" (MK_SEL(1)), "i" (&code16_func2): "memory", "cc");
     printf("func2() = 0x%08x spdec=%d\n", res, res2);
-    asm volatile ("lcall %1, %2" 
+    asm volatile ("lcall %1, %2"
                   : "=a" (res)
                   : "i" (MK_SEL(1)), "i" (&code16_func3): "memory", "cc");
     printf("func3() = 0x%08x\n", res);
@@ -1373,7 +1373,7 @@ void test_misc(void)
         asm volatile ("mov %%cs, %0" : "=r" (cs_sel));
 
         asm volatile ("push %1\n"
-                      "call func_lret\n" 
+                      "call func_lret\n"
                       : "=a" (res)
                       : "r" (cs_sel) : "memory", "cc");
         printf("func_lret=" FMTLX "\n", res);
@@ -1381,11 +1381,11 @@ void test_misc(void)
         /* NOTE: we assume that &func_lret < 4GB */
         desc.offset = (long)&func_lret;
         desc.seg = cs_sel;
-        
+
         asm volatile ("xor %%rax, %%rax\n"
                       "rex64 lcall %1\n"
                       : "=a" (res)
-                      : "m" (desc) 
+                      : "m" (desc)
                       : "memory", "cc");
         printf("func_lret2=" FMTLX "\n", res);
 
@@ -1400,12 +1400,12 @@ void test_misc(void)
         printf("func_lret3=" FMTLX "\n", res);
     }
 #else
-    asm volatile ("push %%cs ; call %1" 
+    asm volatile ("push %%cs ; call %1"
                   : "=a" (res)
                   : "m" (func_lret): "memory", "cc");
     printf("func_lret=" FMTLX "\n", res);
 
-    asm volatile ("pushf ; push %%cs ; call %1" 
+    asm volatile ("pushf ; push %%cs ; call %1"
                   : "=a" (res)
                   : "m" (func_iret): "memory", "cc");
     printf("func_iret=" FMTLX "\n", res);
@@ -1472,7 +1472,7 @@ void test_string(void)
    TEST_STRING(stos, "");
    TEST_STRING(stos, "rep ");
    TEST_STRING(lods, ""); /* to verify stos */
-   TEST_STRING(lods, "rep "); 
+   TEST_STRING(lods, "rep ");
    TEST_STRING(movs, "");
    TEST_STRING(movs, "rep ");
    TEST_STRING(lods, ""); /* to verify stos */
@@ -1526,8 +1526,8 @@ void test_vm86(void)
     uint8_t *vm86_mem;
     int seg, ret;
 
-    vm86_mem = mmap((void *)0x00000000, 0x110000, 
-                    PROT_WRITE | PROT_READ | PROT_EXEC, 
+    vm86_mem = mmap((void *)0x00000000, 0x110000,
+                    PROT_WRITE | PROT_READ | PROT_EXEC,
                     MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);
     if (vm86_mem == MAP_FAILED) {
         printf("ERROR: could not map vm86 memory");
@@ -1550,7 +1550,7 @@ void test_vm86(void)
 
     /* move code to proper address. We use the same layout as a .com
        dos program. */
-    memcpy(vm86_mem + (VM86_CODE_CS << 4) + VM86_CODE_IP, 
+    memcpy(vm86_mem + (VM86_CODE_CS << 4) + VM86_CODE_IP,
            &vm86_code_start, &vm86_code_end - &vm86_code_start);
 
     /* mark int 0x21 as being emulated */
@@ -1562,7 +1562,7 @@ void test_vm86(void)
         case VM86_INTx:
             {
                 int int_num, ah, v;
-                
+
                 int_num = VM86_ARG(ret);
                 if (int_num != 0x21)
                     goto unknown_int;
@@ -1665,7 +1665,7 @@ void test_exceptions(void)
 {
     struct sigaction act;
     volatile int val;
-    
+
     act.sa_sigaction = sig_handler;
     sigemptyset(&act.sa_mask);
     act.sa_flags = SA_SIGINFO | SA_NODEFER;
@@ -1718,7 +1718,7 @@ void test_exceptions(void)
         ldt.seg_not_present = 1;
         ldt.useable = 1;
         modify_ldt(1, &ldt, sizeof(ldt)); /* write ldt entry */
-        
+
         if (setjmp(jmp_env) == 0) {
             /* segment not present */
             asm volatile ("movl %0, %%fs" : : "r" (MK_SEL(1)));
@@ -1743,7 +1743,7 @@ void test_exceptions(void)
         /* read from an invalid address */
         v1 = *(char *)0x1234;
     }
-    
+
     /* test illegal instruction reporting */
     printf("UD2 exception:\n");
     if (setjmp(jmp_env) == 0) {
@@ -1755,7 +1755,7 @@ void test_exceptions(void)
         /* now execute an invalid instruction */
         asm volatile("lock nop");
     }
-    
+
     printf("INT exception:\n");
     if (setjmp(jmp_env) == 0) {
         asm volatile ("int $0xfd");
@@ -1827,7 +1827,7 @@ void test_exceptions(void)
         asm volatile ("pushf\n"
                       "orl $0x00100, (%%esp)\n"
                       "popf\n"
-                      "movl $0xabcd, %0\n" 
+                      "movl $0xabcd, %0\n"
                       "movl $0x0, %0\n" : "=m" (val) : : "cc", "memory");
     }
     printf("val=0x%x\n", val);
@@ -1858,7 +1858,7 @@ void test_single_step(void)
     asm volatile ("pushf\n"
                   "orl $0x00100, (%%esp)\n"
                   "popf\n"
-                  "movl $0xabcd, %0\n" 
+                  "movl $0xabcd, %0\n"
 
                   /* jmp test */
                   "movl $3, %%ecx\n"
@@ -1884,13 +1884,13 @@ void test_single_step(void)
                   "rep cmpsb\n"
                   "movl $4, %%ecx\n"
                   "rep cmpsb\n"
-                  
+
                   /* getpid() syscall: single step should skip one
                      instruction */
                   "movl $20, %%eax\n"
                   "int $0x80\n"
                   "movl $0, %%eax\n"
-                  
+
                   /* when modifying SS, trace is not done on the next
                      instruction */
                   "movl %%ss, %%ecx\n"
@@ -1906,12 +1906,12 @@ void test_single_step(void)
                   "popl %%ss\n"
                   "addl $1, %0\n"
                   "movl $1, %%eax\n"
-                  
+
                   "pushf\n"
                   "andl $~0x00100, (%%esp)\n"
                   "popf\n"
-                  : "=m" (val) 
-                  : 
+                  : "=m" (val)
+                  :
                   : "cc", "memory", "eax", "ecx", "esi", "edi");
     printf("val=%d\n", val);
     for(i = 0; i < 4; i++)
@@ -2282,14 +2282,14 @@ void test_fxsave(void)
         " fxrstor %0\n"
         " fxsave %1\n"
         " fninit\n"
-        : "=m" (*(uint32_t *)fp2), "=m" (*(uint32_t *)fp) 
+        : "=m" (*(uint32_t *)fp2), "=m" (*(uint32_t *)fp)
         : "m" (a), "m" (b));
     printf("fpuc=%04x\n", fp->fpuc);
     printf("fpus=%04x\n", fp->fpus);
     printf("fptag=%04x\n", fp->fptag);
     for(i = 0; i < 3; i++) {
         printf("ST%d: " FMT64X " %04x\n",
-               i, 
+               i,
                *(uint64_t *)&fp->fpregs1[i * 16],
                *(uint16_t *)&fp->fpregs1[i * 16 + 8]);
     }
@@ -2301,7 +2301,7 @@ void test_fxsave(void)
 #endif
     for(i = 0; i < nb_xmm; i++) {
         printf("xmm%d: " FMT64X "" FMT64X "\n",
-               i, 
+               i,
                *(uint64_t *)&fp->xmm_regs[i * 16],
                *(uint64_t *)&fp->xmm_regs[i * 16 + 8]);
     }
@@ -2341,7 +2341,7 @@ void test_sse(void)
 
     MMX_OP2(pmulhuw);
     MMX_OP2(pmulhw);
-    
+
     MMX_OP2(psubsb);
     MMX_OP2(psubsw);
     MMX_OP2(pminsw);
@@ -2380,7 +2380,7 @@ void test_sse(void)
 
     asm volatile ("pmovmskb %1, %0" : "=r" (r.l[0]) : "y" (a.q[0]));
     printf("%-9s: r=%08x\n", "pmovmskb", r.l[0]);
-    
+
     asm volatile ("pmovmskb %1, %0" : "=r" (r.l[0]) : "x" (a.dq));
     printf("%-9s: r=%08x\n", "pmovmskb", r.l[0]);
 
@@ -2392,21 +2392,21 @@ void test_sse(void)
         a.q[1] = test_values[0][1];
         b.q[0] = test_values[1][0];
         b.q[1] = test_values[1][1];
-        asm volatile("maskmovq %1, %0" : 
+        asm volatile("maskmovq %1, %0" :
                      : "y" (a.q[0]), "y" (b.q[0]), "D" (&r)
-                     : "memory"); 
-        printf("%-9s: r=" FMT64X " a=" FMT64X " b=" FMT64X "\n", 
-               "maskmov", 
-               r.q[0], 
-               a.q[0], 
+                     : "memory");
+        printf("%-9s: r=" FMT64X " a=" FMT64X " b=" FMT64X "\n",
+               "maskmov",
+               r.q[0],
+               a.q[0],
                b.q[0]);
-        asm volatile("maskmovdqu %1, %0" : 
+        asm volatile("maskmovdqu %1, %0" :
                      : "x" (a.dq), "x" (b.dq), "D" (&r)
-                     : "memory"); 
-        printf("%-9s: r=" FMT64X "" FMT64X " a=" FMT64X "" FMT64X " b=" FMT64X "" FMT64X "\n", 
-               "maskmov", 
-               r.q[1], r.q[0], 
-               a.q[1], a.q[0], 
+                     : "memory");
+        printf("%-9s: r=" FMT64X "" FMT64X " a=" FMT64X "" FMT64X " b=" FMT64X "" FMT64X "\n",
+               "maskmov",
+               r.q[1], r.q[0],
+               a.q[1], a.q[0],
                b.q[1], b.q[0]);
     }
 
@@ -2506,8 +2506,8 @@ void test_sse(void)
         SSE_OPS(cmpnlt);
         SSE_OPS(cmpnle);
         SSE_OPS(cmpord);
-        
-        
+
+
         a.d[0] = 2.7;
         a.d[1] = -3.4;
         b.d[0] = 45.7;
index a9b52de3782519d7e42082f8ab01e513ccf43998..7d6e831767f187202527827dbb246a12fa757c17 100644 (file)
@@ -149,4 +149,4 @@ int main(int argc, char *argv[])
     }
     return 0;
 }
-       
+
index 176627e9b98cbbadb43e5519848818f2b916866f..112d44974ce3c705281286d8d531071eaa80116c 100755 (executable)
@@ -229,7 +229,7 @@ while(<$inf>) {
        $inf = gensym();
 
        # Try cwd and $ibase.
-       open($inf, "<" . $1) 
+       open($inf, "<" . $1)
            or open($inf, "<" . $ibase . "/" . $1)
                or die "cannot open $1 or $ibase/$1: $!\n";
        next;
diff --git a/thunk.c b/thunk.c
index bc9bd2881959a333ed91b9ecda58c707022cbc8a..dbeb2b1fc1c256cebbff830a6d9723f62a524766 100644 (file)
--- a/thunk.c
+++ b/thunk.c
@@ -1,6 +1,6 @@
 /*
  *  Generic thunking code to convert data between host and target CPU
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -64,7 +64,7 @@ void thunk_register_struct(int id, const char *name, const argtype *types)
     int nb_fields, offset, max_align, align, size, i, j;
 
     se = struct_entries + id;
-    
+
     /* first we count the number of fields */
     type_ptr = types;
     nb_fields = 0;
@@ -76,7 +76,7 @@ void thunk_register_struct(int id, const char *name, const argtype *types)
     se->nb_fields = nb_fields;
     se->name = name;
 #ifdef DEBUG
-    printf("struct %s: id=%d nb_fields=%d\n", 
+    printf("struct %s: id=%d nb_fields=%d\n",
            se->name, id, se->nb_fields);
 #endif
     /* now we can alloc the data */
@@ -100,7 +100,7 @@ void thunk_register_struct(int id, const char *name, const argtype *types)
         se->size[i] = offset;
         se->align[i] = max_align;
 #ifdef DEBUG
-        printf("%s: size=%d align=%d\n", 
+        printf("%s: size=%d align=%d\n",
                i == THUNK_HOST ? "host" : "target", offset, max_align);
 #endif
     }
@@ -116,7 +116,7 @@ void thunk_register_struct_direct(int id, const char *name, StructEntry *se1)
 
 
 /* now we can define the main conversion functions */
-const argtype *thunk_convert(void *dst, const void *src, 
+const argtype *thunk_convert(void *dst, const void *src,
                              const argtype *type_ptr, int to_host)
 {
     int type;
@@ -182,7 +182,7 @@ const argtype *thunk_convert(void *dst, const void *src,
             uint8_t  *d;
             const argtype *field_types;
             const int *dst_offsets, *src_offsets;
-            
+
             se = struct_entries + *type_ptr++;
             if (se->convert[0] != NULL) {
                 /* specific conversion is needed */
@@ -195,8 +195,8 @@ const argtype *thunk_convert(void *dst, const void *src,
                 d = dst;
                 s = src;
                 for(i = 0;i < se->nb_fields; i++) {
-                    field_types = thunk_convert(d + dst_offsets[i], 
-                                                s + src_offsets[i], 
+                    field_types = thunk_convert(d + dst_offsets[i],
+                                                s + src_offsets[i],
                                                 field_types, to_host);
                 }
             }
@@ -214,7 +214,7 @@ const argtype *thunk_convert(void *dst, const void *src,
 /* Utility function: Table-driven functions to translate bitmasks
  * between X86 and Alpha formats...
  */
-unsigned int target_to_host_bitmask(unsigned int x86_mask, 
+unsigned int target_to_host_bitmask(unsigned int x86_mask,
                                     bitmask_transtbl * trans_tbl)
 {
     bitmask_transtbl * btp;
@@ -228,7 +228,7 @@ unsigned int target_to_host_bitmask(unsigned int x86_mask,
     return(alpha_mask);
 }
 
-unsigned int host_to_target_bitmask(unsigned int alpha_mask, 
+unsigned int host_to_target_bitmask(unsigned int alpha_mask,
                                     bitmask_transtbl * trans_tbl)
 {
     bitmask_transtbl * btp;
diff --git a/thunk.h b/thunk.h
index 42fd96f3a39c7bb083929f6ad7515c5b3729376a..7811df39732ef1e0378e1511008b40b9c5851221 100644 (file)
--- a/thunk.h
+++ b/thunk.h
@@ -1,6 +1,6 @@
 /*
  *  Generic thunking code to convert data between host and target CPU
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -69,7 +69,7 @@ typedef struct bitmask_transtbl {
 
 void thunk_register_struct(int id, const char *name, const argtype *types);
 void thunk_register_struct_direct(int id, const char *name, StructEntry *se1);
-const argtype *thunk_convert(void *dst, const void *src, 
+const argtype *thunk_convert(void *dst, const void *src,
                              const argtype *type_ptr, int to_host);
 #ifndef NO_THUNK_TYPE_SIZE
 
@@ -150,9 +150,9 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host)
 
 #endif /* NO_THUNK_TYPE_SIZE */
 
-unsigned int target_to_host_bitmask(unsigned int x86_mask, 
+unsigned int target_to_host_bitmask(unsigned int x86_mask,
                                     bitmask_transtbl * trans_tbl);
-unsigned int host_to_target_bitmask(unsigned int alpha_mask, 
+unsigned int host_to_target_bitmask(unsigned int alpha_mask,
                                     bitmask_transtbl * trans_tbl);
 
 #endif
index 43365478bdef14fb3ff5d22b89e26fb54512f07f..e764627d04a06bbdd422e4b368d23550c27818ce 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Host code generation
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
@@ -89,7 +89,7 @@ void dump_ops(const uint16_t *opc_buf, const uint32_t *opparam_buf)
     for(;;) {
         c = *opc_ptr++;
         n = op_nb_args[c];
-        fprintf(logfile, "0x%04x: %s", 
+        fprintf(logfile, "0x%04x: %s",
                 (int)(opc_ptr - opc_buf - 1), op_str[c]);
         for(i = 0; i < n; i++) {
             fprintf(logfile, " 0x%x", opparam_ptr[i]);
@@ -110,11 +110,11 @@ static void dyngen_labels(long *gen_labels, int nb_gen_labels,
     uint8_t *gen_code_ptr;
     int c, i;
     unsigned long gen_code_addr[OPC_BUF_SIZE];
-    
+
     if (nb_gen_labels == 0)
         return;
     /* compute the address of each op code */
-    
+
     gen_code_ptr = gen_code_buf;
     i = 0;
     for(;;) {
@@ -125,7 +125,7 @@ static void dyngen_labels(long *gen_labels, int nb_gen_labels,
         gen_code_ptr += opc_copy_size[c];
         i++;
     }
-    
+
     /* compute the address of each label */
     for(i = 0; i < nb_gen_labels; i++) {
         gen_labels[i] = gen_code_addr[gen_labels[i]];
@@ -133,7 +133,7 @@ static void dyngen_labels(long *gen_labels, int nb_gen_labels,
 }
 
 /* return non zero if the very first instruction is invalid so that
-   the virtual CPU can trigger an exception. 
+   the virtual CPU can trigger an exception.
 
    '*gen_code_size_ptr' contains the size of the generated code (host
    code).
@@ -185,9 +185,9 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb,
     return 0;
 }
 
-/* The cpu state corresponding to 'searched_pc' is restored. 
+/* The cpu state corresponding to 'searched_pc' is restored.
  */
-int cpu_restore_state(TranslationBlock *tb, 
+int cpu_restore_state(TranslationBlock *tb,
                       CPUState *env, unsigned long searched_pc,
                       void *puc)
 {
@@ -202,7 +202,7 @@ int cpu_restore_state(TranslationBlock *tb,
 #endif
     if (gen_intermediate_code_pc(env, tb) < 0)
         return -1;
-    
+
     /* find opc index corresponding to search_pc */
     tc_ptr = (unsigned long)tb->tc_ptr;
     if (searched_pc < tc_ptr)
@@ -234,8 +234,8 @@ int cpu_restore_state(TranslationBlock *tb,
                     fprintf(logfile, "0x%04x: " TARGET_FMT_lx "\n", i, gen_opc_pc[i]);
                 }
             }
-            fprintf(logfile, "spc=0x%08lx j=0x%x eip=" TARGET_FMT_lx " cs_base=%x\n", 
-                    searched_pc, j, gen_opc_pc[j] - tb->cs_base, 
+            fprintf(logfile, "spc=0x%08lx j=0x%x eip=" TARGET_FMT_lx " cs_base=%x\n",
+                    searched_pc, j, gen_opc_pc[j] - tb->cs_base,
                     (uint32_t)tb->cs_base);
         }
 #endif
@@ -256,7 +256,7 @@ int cpu_restore_state(TranslationBlock *tb,
         } else if (npc == 2) {
             target_ulong t2 = (target_ulong)puc;
             /* jump PC: use T2 and the jump targets of the translation */
-            if (t2) 
+            if (t2)
                 env->npc = gen_opc_jump_pc[0];
             else
                 env->npc = gen_opc_jump_pc[1];
@@ -279,7 +279,7 @@ int cpu_restore_state(TranslationBlock *tb,
         case INDEX_op_ ## op ## _user:\
         case INDEX_op_ ## op ## _kernel
 #endif
-            
+
         CASE3(stfd):
         CASE3(stfs):
         CASE3(lfd):
index fddac70c4a3fdc6663e3822794e37949b4c30f0c..37c61e1b751fedcbaf8bc53e9c39101f0a962d95 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Host code generation
- * 
+ *
  *  Copyright (c) 2003 Fabrice Bellard
  *
  * This library is free software; you can redistribute it and/or
index 50386eaf648252a3c4ac2e1139443c92ecde45aa..3a23301629dc71bce20786031b56a794c9d06db0 100644 (file)
@@ -2,7 +2,7 @@
  * Linux host USB redirector
  *
  * Copyright (c) 2005 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -41,9 +41,9 @@ struct usb_ctrltransfer {
 };
 
 typedef int USBScanFunc(void *opaque, int bus_num, int addr, int class_id,
-                        int vendor_id, int product_id, 
+                        int vendor_id, int product_id,
                         const char *product_name, int speed);
-static int usb_host_find_device(int *pbus_num, int *paddr, 
+static int usb_host_find_device(int *pbus_num, int *paddr,
                                 char *product_name, int product_name_size,
                                 const char *devname);
 
@@ -65,7 +65,7 @@ static void usb_host_handle_reset(USBDevice *dev)
        done by the host OS */
     ioctl(s->fd, USBDEVFS_RESET);
 #endif
-} 
+}
 
 static void usb_host_handle_destroy(USBDevice *dev)
 {
@@ -157,12 +157,12 @@ USBDevice *usb_host_device_open(const char *devname)
     int bus_num, addr;
     char product_name[PRODUCT_NAME_SZ];
 
-    if (usb_host_find_device(&bus_num, &addr, 
+    if (usb_host_find_device(&bus_num, &addr,
                              product_name, sizeof(product_name),
-                             devname) < 0) 
+                             devname) < 0)
         return NULL;
-    
-    snprintf(buf, sizeof(buf), USBDEVFS_PATH "/%03d/%03d", 
+
+    snprintf(buf, sizeof(buf), USBDEVFS_PATH "/%03d/%03d",
              bus_num, addr);
     fd = open(buf, O_RDWR);
     if (fd < 0) {
@@ -176,7 +176,7 @@ USBDevice *usb_host_device_open(const char *devname)
         perror("read descr");
         goto fail;
     }
-    
+
     i = 0;
     dev_descr_len = descr[0];
     if (dev_descr_len > descr_len)
@@ -228,7 +228,7 @@ USBDevice *usb_host_device_open(const char *devname)
 
 #ifdef DEBUG
     printf("host USB device %d.%d grabbed\n", bus_num, addr);
-#endif    
+#endif
 
     dev = qemu_mallocz(sizeof(USBHostDevice));
     if (!dev)
@@ -256,7 +256,7 @@ USBDevice *usb_host_device_open(const char *devname)
 }
 
 static int get_tag_value(char *buf, int buf_size,
-                         const char *str, const char *tag, 
+                         const char *str, const char *tag,
                          const char *stopchars)
 {
     const char *p;
@@ -285,7 +285,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
     int bus_num, addr, speed, device_count, class_id, product_id, vendor_id;
     int ret;
     char product_name[512];
-    
+
     f = fopen(USBDEVFS_PATH "/devices", "r");
     if (!f) {
         term_printf("Could not open %s\n", USBDEVFS_PATH "/devices");
@@ -302,7 +302,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
         if (line[0] == 'T' && line[1] == ':') {
             if (device_count && (vendor_id || product_id)) {
                 /* New device.  Add the previously discovered device.  */
-                ret = func(opaque, bus_num, addr, class_id, vendor_id, 
+                ret = func(opaque, bus_num, addr, class_id, vendor_id,
                            product_id, product_name, speed);
                 if (ret)
                     goto the_end;
@@ -346,7 +346,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
     }
     if (device_count && (vendor_id || product_id)) {
         /* Add the last device.  */
-        ret = func(opaque, bus_num, addr, class_id, vendor_id, 
+        ret = func(opaque, bus_num, addr, class_id, vendor_id,
                    product_id, product_name, speed);
     }
  the_end:
@@ -362,9 +362,9 @@ typedef struct FindDeviceState {
     char product_name[PRODUCT_NAME_SZ];
 } FindDeviceState;
 
-static int usb_host_find_device_scan(void *opaque, int bus_num, int addr, 
+static int usb_host_find_device_scan(void *opaque, int bus_num, int addr,
                                      int class_id,
-                                     int vendor_id, int product_id, 
+                                     int vendor_id, int product_id,
                                      const char *product_name, int speed)
 {
     FindDeviceState *s = opaque;
@@ -381,10 +381,10 @@ static int usb_host_find_device_scan(void *opaque, int bus_num, int addr,
     }
 }
 
-/* the syntax is : 
-   'bus.addr' (decimal numbers) or 
+/* the syntax is :
+   'bus.addr' (decimal numbers) or
    'vendor_id:product_id' (hexa numbers) */
-static int usb_host_find_device(int *pbus_num, int *paddr, 
+static int usb_host_find_device(int *pbus_num, int *paddr,
                                 char *product_name, int product_name_size,
                                 const char *devname)
 {
@@ -454,31 +454,31 @@ static const char *usb_class_str(uint8_t class)
 }
 
 void usb_info_device(int bus_num, int addr, int class_id,
-                     int vendor_id, int product_id, 
+                     int vendor_id, int product_id,
                      const char *product_name,
                      int speed)
 {
     const char *class_str, *speed_str;
 
     switch(speed) {
-    case USB_SPEED_LOW: 
-        speed_str = "1.5"; 
+    case USB_SPEED_LOW:
+        speed_str = "1.5";
         break;
-    case USB_SPEED_FULL: 
-        speed_str = "12"; 
+    case USB_SPEED_FULL:
+        speed_str = "12";
         break;
-    case USB_SPEED_HIGH: 
-        speed_str = "480"; 
+    case USB_SPEED_HIGH:
+        speed_str = "480";
         break;
     default:
-        speed_str = "?"; 
+        speed_str = "?";
         break;
     }
 
-    term_printf("  Device %d.%d, speed %s Mb/s\n", 
+    term_printf("  Device %d.%d, speed %s Mb/s\n",
                 bus_num, addr, speed_str);
     class_str = usb_class_str(class_id);
-    if (class_str) 
+    if (class_str)
         term_printf("    %s:", class_str);
     else
         term_printf("    Class %02x:", class_id);
@@ -488,9 +488,9 @@ void usb_info_device(int bus_num, int addr, int class_id,
     term_printf("\n");
 }
 
-static int usb_host_info_device(void *opaque, int bus_num, int addr, 
+static int usb_host_info_device(void *opaque, int bus_num, int addr,
                                 int class_id,
-                                int vendor_id, int product_id, 
+                                int vendor_id, int product_id,
                                 const char *product_name,
                                 int speed)
 {
diff --git a/vl.c b/vl.c
index 1757036c0529ae6b148903e10f339bbba9138b0b..7ae143753d62c63862d3bcb7ab0910dca1326ca8 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -1,8 +1,8 @@
 /*
  * QEMU System Emulator
- * 
+ *
  * Copyright (c) 2003-2007 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -242,7 +242,7 @@ void init_ioports(void)
 }
 
 /* size is the word size in byte */
-int register_ioport_read(int start, int length, int size, 
+int register_ioport_read(int start, int length, int size,
                          IOPortReadFunc *func, void *opaque)
 {
     int i, bsize;
@@ -267,7 +267,7 @@ int register_ioport_read(int start, int length, int size,
 }
 
 /* size is the word size in byte */
-int register_ioport_write(int start, int length, int size, 
+int register_ioport_write(int start, int length, int size,
                           IOPortWriteFunc *func, void *opaque)
 {
     int i, bsize;
@@ -313,7 +313,7 @@ void cpu_outb(CPUState *env, int addr, int val)
 #ifdef DEBUG_IOPORT
     if (loglevel & CPU_LOG_IOPORT)
         fprintf(logfile, "outb: %04x %02x\n", addr, val);
-#endif    
+#endif
     ioport_write_table[0][addr](ioport_opaque[addr], addr, val);
 #ifdef USE_KQEMU
     if (env)
@@ -326,7 +326,7 @@ void cpu_outw(CPUState *env, int addr, int val)
 #ifdef DEBUG_IOPORT
     if (loglevel & CPU_LOG_IOPORT)
         fprintf(logfile, "outw: %04x %04x\n", addr, val);
-#endif    
+#endif
     ioport_write_table[1][addr](ioport_opaque[addr], addr, val);
 #ifdef USE_KQEMU
     if (env)
@@ -579,7 +579,7 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)
             uint32_t high, low;
 #else
             uint32_t low, high;
-#endif            
+#endif
         } l;
     } u, res;
     uint64_t rl, rh;
@@ -645,7 +645,7 @@ static int64_t get_clock(void)
         struct timespec ts;
         clock_gettime(CLOCK_MONOTONIC, &ts);
         return ts.tv_sec * 1000000000LL + ts.tv_nsec;
-    } else 
+    } else
 #endif
     {
         /* XXX: using gettimeofday leads to problems if the date
@@ -719,7 +719,7 @@ void cpu_disable_ticks(void)
 
 /***********************************************************/
 /* timers */
+
 #define QEMU_TIMER_REALTIME 0
 #define QEMU_TIMER_VIRTUAL  1
 
@@ -811,7 +811,7 @@ void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time)
         t = *pt;
         if (!t)
             break;
-        if (t->expire_time > expire_time) 
+        if (t->expire_time > expire_time)
             break;
         pt = &t->next;
     }
@@ -840,7 +840,7 @@ static inline int qemu_timer_expired(QEMUTimer *timer_head, int64_t current_time
 static void qemu_run_timers(QEMUTimer **ptimer_head, int64_t current_time)
 {
     QEMUTimer *ts;
-    
+
     for(;;) {
         ts = *ptimer_head;
         if (!ts || ts->expire_time > current_time)
@@ -848,7 +848,7 @@ static void qemu_run_timers(QEMUTimer **ptimer_head, int64_t current_time)
         /* remove timer from the list before calling the callback */
         *ptimer_head = ts->next;
         ts->next = NULL;
-        
+
         /* run the callback (the timer list can be modified) */
         ts->cb(ts->opaque);
     }
@@ -924,7 +924,7 @@ static int timer_load(QEMUFile *f, void *opaque, int version_id)
 }
 
 #ifdef _WIN32
-void CALLBACK host_alarm_handler(UINT uTimerID, UINT uMsg, 
+void CALLBACK host_alarm_handler(UINT uTimerID, UINT uMsg,
                                  DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
 #else
 static void host_alarm_handler(int host_signum)
@@ -1051,10 +1051,10 @@ static void init_timer_alarm(void)
     {
         struct sigaction act;
         struct itimerval itv;
-        
+
         /* get times() syscall frequency */
         timer_freq = sysconf(_SC_CLK_TCK);
-        
+
         /* timer signal */
         sigfillset(&act.sa_mask);
        act.sa_flags = 0;
@@ -1093,11 +1093,11 @@ static void init_timer_alarm(void)
             sigaction(SIGIO, &act, NULL);
             fcntl(rtc_fd, F_SETFL, O_ASYNC);
             fcntl(rtc_fd, F_SETOWN, getpid());
-        } else 
+        } else
 #endif /* defined(__linux__) */
         {
         use_itimer:
-            pit_min_timer_count = ((uint64_t)itv.it_interval.tv_usec * 
+            pit_min_timer_count = ((uint64_t)itv.it_interval.tv_usec *
                                    PIT_FREQ) / 1000000;
         }
     }
@@ -1183,8 +1183,8 @@ void qemu_chr_send_event(CharDriverState *s, int event)
         s->chr_send_event(s, event);
 }
 
-void qemu_chr_add_handlers(CharDriverState *s, 
-                           IOCanRWHandler *fd_can_read, 
+void qemu_chr_add_handlers(CharDriverState *s,
+                           IOCanRWHandler *fd_can_read,
                            IOReadHandler *fd_read,
                            IOEventHandler *fd_event,
                            void *opaque)
@@ -1196,7 +1196,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
     if (s->chr_update_read_handler)
         s->chr_update_read_handler(s);
 }
-             
+
 static int null_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
 {
     return len;
@@ -1238,7 +1238,7 @@ static int socket_init(void)
 static int send_all(int fd, const uint8_t *buf, int len1)
 {
     int ret, len;
-    
+
     len = len1;
     while (len > 0) {
         ret = send(fd, buf, len, 0);
@@ -1330,7 +1330,7 @@ static void fd_chr_read(void *opaque)
     FDCharDriver *s = chr->opaque;
     int size, len;
     uint8_t buf[1024];
-    
+
     len = sizeof(buf);
     if (len > s->max_size)
         len = s->max_size;
@@ -1354,7 +1354,7 @@ static void fd_chr_update_read_handler(CharDriverState *chr)
     if (s->fd_in >= 0) {
         if (nographic && s->fd_in == 0) {
         } else {
-            qemu_set_fd_handler2(s->fd_in, fd_chr_read_poll, 
+            qemu_set_fd_handler2(s->fd_in, fd_chr_read_poll,
                                  fd_chr_read, NULL, chr);
         }
     }
@@ -1455,7 +1455,7 @@ static void stdio_received_byte(int ch)
         case 'x':
             exit(0);
             break;
-        case 's': 
+        case 's':
             {
                 int i;
                 for (i = 0; i < MAX_DISKS; i++) {
@@ -1498,7 +1498,7 @@ static void stdio_received_byte(int ch)
         if (client_index < stdio_nb_clients) {
             uint8_t buf[1];
             CharDriverState *chr;
-            
+
             chr = stdio_clients[client_index];
             if (qemu_chr_can_read(chr) > 0) {
                 buf[0] = ch;
@@ -1535,7 +1535,7 @@ static void stdio_read(void *opaque)
 {
     int size;
     uint8_t buf[1];
-    
+
     size = read(0, buf, 1);
     if (size == 0) {
         /* stdin has been closed. Remove it from the active list.  */
@@ -1566,7 +1566,7 @@ static int stdio_write(CharDriverState *chr, const uint8_t *buf, int len)
                     term_timestamps_start = ti;
                 ti -= term_timestamps_start;
                 secs = ti / 1000000000;
-                snprintf(buf1, sizeof(buf1), 
+                snprintf(buf1, sizeof(buf1),
                          "[%02d:%02d:%02d.%03d] ",
                          secs / 3600,
                          (secs / 60) % 60,
@@ -1608,7 +1608,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);
@@ -1647,12 +1647,12 @@ static CharDriverState *qemu_chr_open_pty(void)
     struct termios tty;
     char slave_name[1024];
     int master_fd, slave_fd;
-    
+
     /* Not satisfying */
     if (openpty(&master_fd, &slave_fd, slave_name, NULL, NULL) < 0) {
         return NULL;
     }
-    
+
     /* Disabling local echo and line-buffered output */
     tcgetattr (master_fd, &tty);
     tty.c_lflag &= ~(ECHO|ICANON|ISIG);
@@ -1664,14 +1664,14 @@ static CharDriverState *qemu_chr_open_pty(void)
     return qemu_chr_open_fd(master_fd, master_fd);
 }
 
-static void tty_serial_init(int fd, int speed, 
+static void tty_serial_init(int fd, int speed,
                             int parity, int data_bits, int stop_bits)
 {
     struct termios tty;
     speed_t spd;
 
 #if 0
-    printf("tty_serial_init: speed=%d parity=%c data=%d stop=%d\n", 
+    printf("tty_serial_init: speed=%d parity=%c data=%d stop=%d\n",
            speed, parity, data_bits, stop_bits);
 #endif
     tcgetattr (fd, &tty);
@@ -1752,19 +1752,19 @@ static void tty_serial_init(int fd, int speed,
     }
     if (stop_bits == 2)
         tty.c_cflag |= CSTOPB;
-    
+
     tcsetattr (fd, TCSANOW, &tty);
 }
 
 static int tty_serial_ioctl(CharDriverState *chr, int cmd, void *arg)
 {
     FDCharDriver *s = chr->opaque;
-    
+
     switch(cmd) {
     case CHR_IOCTL_SERIAL_SET_PARAMS:
         {
             QEMUSerialSetParams *ssp = arg;
-            tty_serial_init(s->fd_in, ssp->speed, ssp->parity, 
+            tty_serial_init(s->fd_in, ssp->speed, ssp->parity,
                             ssp->data_bits, ssp->stop_bits);
         }
         break;
@@ -1924,7 +1924,7 @@ static int win_chr_init(WinCharState *s, CharDriverState *chr, const char *filen
     COMSTAT comstat;
     DWORD size;
     DWORD err;
-    
+
     s->hsend = CreateEvent(NULL, TRUE, FALSE, NULL);
     if (!s->hsend) {
         fprintf(stderr, "Failed CreateEvent\n");
@@ -1943,12 +1943,12 @@ static int win_chr_init(WinCharState *s, CharDriverState *chr, const char *filen
         s->hcom = NULL;
         goto fail;
     }
-    
+
     if (!SetupComm(s->hcom, NRECVBUF, NSENDBUF)) {
         fprintf(stderr, "Failed SetupComm\n");
         goto fail;
     }
-    
+
     ZeroMemory(&comcfg, sizeof(COMMCONFIG));
     size = sizeof(COMMCONFIG);
     GetDefaultCommConfig(filename, &comcfg, &size);
@@ -1970,7 +1970,7 @@ static int win_chr_init(WinCharState *s, CharDriverState *chr, const char *filen
         fprintf(stderr, "Failed SetCommTimeouts\n");
         goto fail;
     }
-    
+
     if (!ClearCommError(s->hcom, &err, &comstat)) {
         fprintf(stderr, "Failed ClearCommError\n");
         goto fail;
@@ -2029,7 +2029,7 @@ static void win_chr_readfile(WinCharState *s)
     int ret, err;
     uint8_t buf[1024];
     DWORD size;
-    
+
     ZeroMemory(&s->orecv, sizeof(s->orecv));
     s->orecv.hEvent = s->hrecv;
     ret = ReadFile(s->hcom, buf, s->len, &size, &s->orecv);
@@ -2051,7 +2051,7 @@ static void win_chr_read(WinCharState *s)
         s->len = s->max_size;
     if (s->len == 0)
         return;
-    
+
     win_chr_readfile(s);
 }
 
@@ -2060,7 +2060,7 @@ static int win_chr_poll(void *opaque)
     WinCharState *s = opaque;
     COMSTAT status;
     DWORD comerr;
-    
+
     ClearCommError(s->hcom, &comerr, &status);
     if (status.cbInQue > 0) {
         s->len = status.cbInQue;
@@ -2075,7 +2075,7 @@ static CharDriverState *qemu_chr_open_win(const char *filename)
 {
     CharDriverState *chr;
     WinCharState *s;
-    
+
     chr = qemu_mallocz(sizeof(CharDriverState));
     if (!chr)
         return NULL;
@@ -2118,7 +2118,7 @@ static int win_chr_pipe_init(WinCharState *s, const char *filename)
     int ret;
     DWORD size;
     char openname[256];
-    
+
     s->fpipe = TRUE;
 
     s->hsend = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -2131,7 +2131,7 @@ static int win_chr_pipe_init(WinCharState *s, const char *filename)
         fprintf(stderr, "Failed CreateEvent\n");
         goto fail;
     }
-    
+
     snprintf(openname, sizeof(openname), "\\\\.\\pipe\\%s", filename);
     s->hcom = CreateNamedPipe(openname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
                               PIPE_TYPE_BYTE | PIPE_READMODE_BYTE |
@@ -2190,7 +2190,7 @@ static CharDriverState *qemu_chr_open_win_pipe(const char *filename)
     chr->opaque = s;
     chr->chr_write = win_chr_write;
     chr->chr_close = win_chr_close;
-    
+
     if (win_chr_pipe_init(s, filename) < 0) {
         free(s);
         free(chr);
@@ -2219,11 +2219,11 @@ static CharDriverState *qemu_chr_open_win_file(HANDLE fd_out)
     qemu_chr_reset(chr);
     return chr;
 }
-    
+
 static CharDriverState *qemu_chr_open_win_file_out(const char *file_out)
 {
     HANDLE fd_out;
-    
+
     fd_out = CreateFile(file_out, GENERIC_WRITE, FILE_SHARE_READ, NULL,
                         OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
     if (fd_out == INVALID_HANDLE_VALUE)
@@ -2555,7 +2555,7 @@ static void tcp_chr_close(CharDriverState *chr)
     qemu_free(s);
 }
 
-static CharDriverState *qemu_chr_open_tcp(const char *host_str, 
+static CharDriverState *qemu_chr_open_tcp(const char *host_str,
                                           int is_telnet,
                                          int is_unix)
 {
@@ -2618,8 +2618,8 @@ static CharDriverState *qemu_chr_open_tcp(const char *host_str,
     else
 #endif
        fd = socket(PF_INET, SOCK_STREAM, 0);
-       
-    if (fd < 0) 
+
+    if (fd < 0)
         goto fail;
 
     if (!is_waitconnect)
@@ -2649,7 +2649,7 @@ static CharDriverState *qemu_chr_open_tcp(const char *host_str,
            val = 1;
            setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const char *)&val, sizeof(val));
        }
-        
+
         ret = bind(fd, addr, addrlen);
         if (ret < 0)
             goto fail;
@@ -2685,7 +2685,7 @@ static CharDriverState *qemu_chr_open_tcp(const char *host_str,
         else
             qemu_set_fd_handler(s->fd, NULL, tcp_chr_connect, chr);
     }
-    
+
     if (is_listen && is_waitconnect) {
         printf("QEMU waiting for connection on: %s\n", host_str);
         tcp_chr_accept(chr);
@@ -2709,7 +2709,7 @@ CharDriverState *qemu_chr_open(const char *filename)
         return text_console_init(&display_state);
     } else if (!strcmp(filename, "null")) {
         return qemu_chr_open_null();
-    } else 
+    } else
     if (strstart(filename, "tcp:", &p)) {
         return qemu_chr_open_tcp(p, 0, 0);
     } else
@@ -2730,15 +2730,15 @@ CharDriverState *qemu_chr_open(const char *filename)
         return qemu_chr_open_pty();
     } else if (!strcmp(filename, "stdio")) {
         return qemu_chr_open_stdio();
-    } else 
+    } else
 #endif
 #if defined(__linux__)
     if (strstart(filename, "/dev/parport", NULL)) {
         return qemu_chr_open_pp(filename);
-    } else 
+    } else
     if (strstart(filename, "/dev/", NULL)) {
         return qemu_chr_open_tty(filename);
-    } else 
+    } else
 #endif
 #ifdef _WIN32
     if (strstart(filename, "COM", NULL)) {
@@ -2797,10 +2797,10 @@ static int parse_macaddr(uint8_t *macaddr, const char *p)
     for(i = 0; i < 6; i++) {
         macaddr[i] = strtol(p, (char **)&p, 16);
         if (i == 5) {
-            if (*p != '\0') 
+            if (*p != '\0')
                 return -1;
         } else {
-            if (*p != ':') 
+            if (*p != ':')
                 return -1;
             p++;
         }
@@ -3027,7 +3027,7 @@ static int net_slirp_init(VLANState *vlan)
         slirp_inited = 1;
         slirp_init();
     }
-    slirp_vc = qemu_new_vlan_client(vlan, 
+    slirp_vc = qemu_new_vlan_client(vlan,
                                     slirp_receive, NULL, NULL);
     snprintf(slirp_vc->info_str, sizeof(slirp_vc->info_str), "user redirector");
     return 0;
@@ -3040,7 +3040,7 @@ static void net_slirp_redir(const char *redir_str)
     const char *p;
     struct in_addr guest_addr;
     int host_port, guest_port;
-    
+
     if (!slirp_inited) {
         slirp_inited = 1;
         slirp_init();
@@ -3070,11 +3070,11 @@ static void net_slirp_redir(const char *redir_str)
     }
     if (!inet_aton(buf, &guest_addr))
         goto fail;
-    
+
     guest_port = strtol(p, &r, 0);
     if (r == p)
         goto fail;
-    
+
     if (slirp_redir(is_udp, host_port, guest_addr, guest_port) < 0) {
         fprintf(stderr, "qemu: could not set up redirection\n");
         exit(1);
@@ -3084,7 +3084,7 @@ static void net_slirp_redir(const char *redir_str)
     fprintf(stderr, "qemu: syntax: -redir [tcp|udp]:host-port:[guest-host]:guest-port\n");
     exit(1);
 }
-    
+
 #ifndef _WIN32
 
 char smb_dir[1024];
@@ -3103,7 +3103,7 @@ static void smb_exit(void)
             break;
         if (strcmp(de->d_name, ".") != 0 &&
             strcmp(de->d_name, "..") != 0) {
-            snprintf(filename, sizeof(filename), "%s/%s", 
+            snprintf(filename, sizeof(filename), "%s/%s",
                      smb_dir, de->d_name);
             unlink(filename);
         }
@@ -3131,13 +3131,13 @@ void net_slirp_smb(const char *exported_dir)
         exit(1);
     }
     snprintf(smb_conf, sizeof(smb_conf), "%s/%s", smb_dir, "smb.conf");
-    
+
     f = fopen(smb_conf, "w");
     if (!f) {
         fprintf(stderr, "qemu: could not create samba server configuration file '%s'\n", smb_conf);
         exit(1);
     }
-    fprintf(f, 
+    fprintf(f,
             "[global]\n"
             "private dir=%s\n"
             "smb ports=0\n"
@@ -3163,7 +3163,7 @@ void net_slirp_smb(const char *exported_dir)
 
     snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s",
              SMBD_COMMAND, smb_conf);
-    
+
     slirp_add_exec(0, smb_cmdline, 4, 139);
 }
 
@@ -3250,7 +3250,7 @@ static int tap_open(char *ifname, int ifname_size)
 {
     struct ifreq ifr;
     int fd, ret;
-    
+
     fd = open("/dev/net/tun", O_RDWR);
     if (fd < 0) {
         fprintf(stderr, "warning: could not open /dev/net/tun: no virtual network emulation\n");
@@ -3317,7 +3317,7 @@ static int net_tap_init(VLANState *vlan, const char *ifname1,
     s = net_tap_fd_init(vlan, fd);
     if (!s)
         return -1;
-    snprintf(s->vc->info_str, sizeof(s->vc->info_str), 
+    snprintf(s->vc->info_str, sizeof(s->vc->info_str),
              "tap: ifname=%s setup_script=%s", ifname, setup_script);
     return 0;
 }
@@ -3354,7 +3354,7 @@ static void net_socket_receive(void *opaque, const uint8_t *buf, int size)
 static void net_socket_receive_dgram(void *opaque, const uint8_t *buf, int size)
 {
     NetSocketState *s = opaque;
-    sendto(s->fd, buf, size, 0, 
+    sendto(s->fd, buf, size, 0,
            (struct sockaddr *)&s->dgram_dst, sizeof(s->dgram_dst));
 }
 
@@ -3368,7 +3368,7 @@ static void net_socket_send(void *opaque)
     size = recv(s->fd, buf1, sizeof(buf1), 0);
     if (size < 0) {
         err = socket_error();
-        if (err != EWOULDBLOCK) 
+        if (err != EWOULDBLOCK)
             goto eoc;
     } else if (size == 0) {
         /* end of connection */
@@ -3420,7 +3420,7 @@ static void net_socket_send_dgram(void *opaque)
     int size;
 
     size = recv(s->fd, s->buf, sizeof(s->buf), 0);
-    if (size < 0) 
+    if (size < 0)
         return;
     if (size == 0) {
         /* end of connection */
@@ -3437,7 +3437,7 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr)
     int val, ret;
     if (!IN_MULTICAST(ntohl(mcastaddr->sin_addr.s_addr))) {
        fprintf(stderr, "qemu: error: specified mcastaddr \"%s\" (0x%08x) does not contain a multicast address\n",
-               inet_ntoa(mcastaddr->sin_addr), 
+               inet_ntoa(mcastaddr->sin_addr),
                 (int)ntohl(mcastaddr->sin_addr.s_addr));
        return -1;
 
@@ -3449,7 +3449,7 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr)
     }
 
     val = 1;
-    ret=setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, 
+    ret=setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
                    (const char *)&val, sizeof(val));
     if (ret < 0) {
        perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");
@@ -3461,12 +3461,12 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr)
         perror("bind");
         goto fail;
     }
-    
+
     /* Add host to multicast group */
     imr.imr_multiaddr = mcastaddr->sin_addr;
     imr.imr_interface.s_addr = htonl(INADDR_ANY);
 
-    ret = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, 
+    ret = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
                      (const char *)&imr, sizeof(struct ip_mreq));
     if (ret < 0) {
        perror("setsockopt(IP_ADD_MEMBERSHIP)");
@@ -3475,7 +3475,7 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr)
 
     /* Force mcast msgs to loopback (eg. several QEMUs in same host */
     val = 1;
-    ret=setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, 
+    ret=setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
                    (const char *)&val, sizeof(val));
     if (ret < 0) {
        perror("setsockopt(SOL_IP, IP_MULTICAST_LOOP)");
@@ -3485,12 +3485,12 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr)
     socket_set_nonblock(fd);
     return fd;
 fail:
-    if (fd >= 0) 
+    if (fd >= 0)
         closesocket(fd);
     return -1;
 }
 
-static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, int fd, 
+static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, int fd,
                                           int is_connected)
 {
     struct sockaddr_in saddr;
@@ -3499,7 +3499,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, int fd,
     NetSocketState *s;
 
     /* fd passed: multicast: "learn" dgram_dst address from bound address and save it
-     * Because this may be "shared" socket from a "master" process, datagrams would be recv() 
+     * Because this may be "shared" socket from a "master" process, datagrams would be recv()
      * by ONLY ONE process: we must "clone" this dgram socket --jjo
      */
 
@@ -3521,7 +3521,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, int fd,
            /* clone newfd to fd, close newfd */
            dup2(newfd, fd);
            close(newfd);
-       
+
        } else {
            fprintf(stderr, "qemu: error: init_dgram: fd=%d failed getsockname(): %s\n",
                    fd, strerror(errno));
@@ -3541,7 +3541,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, int fd,
     if (is_connected) s->dgram_dst=saddr;
 
     snprintf(s->vc->info_str, sizeof(s->vc->info_str),
-           "socket: fd=%d (%s mcast=%s:%d)", 
+           "socket: fd=%d (%s mcast=%s:%d)",
            fd, is_connected? "cloned" : "",
            inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
     return s;
@@ -3553,7 +3553,7 @@ static void net_socket_connect(void *opaque)
     qemu_set_fd_handler(s->fd, net_socket_send, NULL, s);
 }
 
-static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, int fd, 
+static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, int fd,
                                           int is_connected)
 {
     NetSocketState *s;
@@ -3561,7 +3561,7 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, int fd,
     if (!s)
         return NULL;
     s->fd = fd;
-    s->vc = qemu_new_vlan_client(vlan, 
+    s->vc = qemu_new_vlan_client(vlan,
                                  net_socket_receive, NULL, s);
     snprintf(s->vc->info_str, sizeof(s->vc->info_str),
              "socket: fd=%d", fd);
@@ -3573,7 +3573,7 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, int fd,
     return s;
 }
 
-static NetSocketState *net_socket_fd_init(VLANState *vlan, int fd, 
+static NetSocketState *net_socket_fd_init(VLANState *vlan, int fd,
                                           int is_connected)
 {
     int so_type=-1, optlen=sizeof(so_type);
@@ -3597,7 +3597,7 @@ static NetSocketState *net_socket_fd_init(VLANState *vlan, int fd,
 
 static void net_socket_accept(void *opaque)
 {
-    NetSocketListenState *s = opaque;    
+    NetSocketListenState *s = opaque;
     NetSocketState *s1;
     struct sockaddr_in saddr;
     socklen_t len;
@@ -3612,12 +3612,12 @@ static void net_socket_accept(void *opaque)
             break;
         }
     }
-    s1 = net_socket_fd_init(s->vlan, fd, 1); 
+    s1 = net_socket_fd_init(s->vlan, fd, 1);
     if (!s1) {
         closesocket(fd);
     } else {
         snprintf(s1->vc->info_str, sizeof(s1->vc->info_str),
-                 "socket: connection from %s:%d", 
+                 "socket: connection from %s:%d",
                  inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
     }
 }
@@ -3630,7 +3630,7 @@ static int net_socket_listen_init(VLANState *vlan, const char *host_str)
 
     if (parse_host_port(&saddr, host_str) < 0)
         return -1;
-    
+
     s = qemu_mallocz(sizeof(NetSocketListenState));
     if (!s)
         return -1;
@@ -3645,7 +3645,7 @@ static int net_socket_listen_init(VLANState *vlan, const char *host_str)
     /* allow fast reuse */
     val = 1;
     setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const char *)&val, sizeof(val));
-    
+
     ret = bind(fd, (struct sockaddr *)&saddr, sizeof(saddr));
     if (ret < 0) {
         perror("bind");
@@ -3700,7 +3700,7 @@ static int net_socket_connect_init(VLANState *vlan, const char *host_str)
     if (!s)
         return -1;
     snprintf(s->vc->info_str, sizeof(s->vc->info_str),
-             "socket: connect to %s:%d", 
+             "socket: connect to %s:%d",
              inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
     return 0;
 }
@@ -3724,9 +3724,9 @@ static int net_socket_mcast_init(VLANState *vlan, const char *host_str)
         return -1;
 
     s->dgram_dst = saddr;
-    
+
     snprintf(s->vc->info_str, sizeof(s->vc->info_str),
-             "socket: mcast=%s:%d", 
+             "socket: mcast=%s:%d",
              inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
     return 0;
 
@@ -3898,7 +3898,7 @@ static int net_client_init(const char *str)
     if (ret < 0) {
         fprintf(stderr, "Could not initialize device '%s'\n", device);
     }
-    
+
     return ret;
 }
 
@@ -3988,7 +3988,7 @@ static int usb_device_del(const char *devname)
         return -1;
 
     p = strchr(devname, '.');
-    if (!p) 
+    if (!p)
         return -1;
     bus_num = strtoul(devname, NULL, 0);
     addr = strtoul(p + 1, NULL, 0);
@@ -4018,7 +4018,7 @@ void do_usb_add(const char *devname)
 {
     int ret;
     ret = usb_device_add(devname);
-    if (ret < 0) 
+    if (ret < 0)
         term_printf("Could not add USB device '%s'\n", devname);
 }
 
@@ -4026,7 +4026,7 @@ void do_usb_del(const char *devname)
 {
     int ret;
     ret = usb_device_del(devname);
-    if (ret < 0) 
+    if (ret < 0)
         term_printf("Could not remove USB device '%s'\n", devname);
 }
 
@@ -4046,20 +4046,20 @@ void usb_info(void)
         if (!dev)
             continue;
         switch(dev->speed) {
-        case USB_SPEED_LOW: 
-            speed_str = "1.5"; 
+        case USB_SPEED_LOW:
+            speed_str = "1.5";
             break;
-        case USB_SPEED_FULL: 
-            speed_str = "12"; 
+        case USB_SPEED_FULL:
+            speed_str = "12";
             break;
-        case USB_SPEED_HIGH: 
-            speed_str = "480"; 
+        case USB_SPEED_HIGH:
+            speed_str = "480";
             break;
         default:
-            speed_str = "?"; 
+            speed_str = "?";
             break;
         }
-        term_printf("  Device %d.%d, Speed %s Mb/s, Product %s\n", 
+        term_printf("  Device %d.%d, Speed %s Mb/s, Product %s\n",
                     0, dev->addr, speed_str, dev->devname);
     }
 }
@@ -4071,7 +4071,7 @@ static char *pid_filename;
 
 /* Remove PID file. Called on normal exit */
 
-static void remove_pidfile(void) 
+static void remove_pidfile(void)
 {
     unlink (pid_filename);
 }
@@ -4098,7 +4098,7 @@ static void create_pidfile(const char *filename)
             atexit(remove_pidfile);
         }
     } else {
-        fprintf(stderr, "%s already exists. Remove it and try again.\n", 
+        fprintf(stderr, "%s already exists. Remove it and try again.\n",
                 filename);
         exit(1);
     }
@@ -4150,10 +4150,10 @@ static IOHandlerRecord *first_io_handler;
 
 /* XXX: fd_read_poll should be suppressed, but an API change is
    necessary in the character devices to suppress fd_can_read(). */
-int qemu_set_fd_handler2(int fd, 
-                         IOCanRWHandler *fd_read_poll, 
-                         IOHandler *fd_read, 
-                         IOHandler *fd_write, 
+int qemu_set_fd_handler2(int fd,
+                         IOCanRWHandler *fd_read_poll,
+                         IOHandler *fd_read,
+                         IOHandler *fd_write,
                          void *opaque)
 {
     IOHandlerRecord **pioh, *ioh;
@@ -4191,9 +4191,9 @@ int qemu_set_fd_handler2(int fd,
     return 0;
 }
 
-int qemu_set_fd_handler(int fd, 
-                        IOHandler *fd_read, 
-                        IOHandler *fd_write, 
+int qemu_set_fd_handler(int fd,
+                        IOHandler *fd_read,
+                        IOHandler *fd_write,
                         void *opaque)
 {
     return qemu_set_fd_handler2(fd, NULL, fd_read, fd_write, opaque);
@@ -4247,7 +4247,7 @@ typedef struct WaitObjects {
 } WaitObjects;
 
 static WaitObjects wait_objects = {0};
-    
+
 int qemu_add_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque)
 {
     WaitObjects *w = &wait_objects;
@@ -4274,7 +4274,7 @@ void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque)
             w->events[i] = w->events[i + 1];
             w->func[i] = w->func[i + 1];
             w->opaque[i] = w->opaque[i + 1];
-        }            
+        }
     }
     if (found)
         w->num--;
@@ -4348,7 +4348,7 @@ void qemu_fflush(QEMUFile *f)
             fseek(f->outfile, f->buf_offset, SEEK_SET);
             fwrite(f->buf, 1, f->buf_index, f->outfile);
         } else {
-            bdrv_pwrite(f->bs, f->base_offset + f->buf_offset, 
+            bdrv_pwrite(f->bs, f->base_offset + f->buf_offset,
                         f->buf, f->buf_index);
         }
         f->buf_offset += f->buf_index;
@@ -4368,7 +4368,7 @@ static void qemu_fill_buffer(QEMUFile *f)
         if (len < 0)
             len = 0;
     } else {
-        len = bdrv_pread(f->bs, f->base_offset + f->buf_offset, 
+        len = bdrv_pread(f->bs, f->base_offset + f->buf_offset,
                          f->buf, IO_BUF_SIZE);
         if (len < 0)
             len = 0;
@@ -4528,8 +4528,8 @@ typedef struct SaveStateEntry {
 
 static SaveStateEntry *first_se;
 
-int register_savevm(const char *idstr, 
-                    int instance_id, 
+int register_savevm(const char *idstr,
+                    int instance_id,
                     int version_id,
                     SaveStateHandler *save_state,
                     LoadStateHandler *load_state,
@@ -4582,7 +4582,7 @@ int qemu_savevm_state(QEMUFile *f)
         /* record size: filled later */
         len_pos = qemu_ftell(f);
         qemu_put_be32(f, 0);
-        
+
         se->save_state(f, se->opaque);
 
         /* fill record size */
@@ -4606,7 +4606,7 @@ static SaveStateEntry *find_se(const char *idstr, int instance_id)
     SaveStateEntry *se;
 
     for(se = first_se; se != NULL; se = se->next) {
-        if (!strcmp(se->idstr, idstr) && 
+        if (!strcmp(se->idstr, idstr) &&
             instance_id == se->instance_id)
             return se;
     }
@@ -4620,7 +4620,7 @@ int qemu_loadvm_state(QEMUFile *f)
     int64_t total_len, end_pos, cur_pos;
     unsigned int v;
     char idstr[256];
-    
+
     v = qemu_get_be32(f);
     if (v != QEMU_VM_FILE_MAGIC)
         goto fail;
@@ -4642,18 +4642,18 @@ int qemu_loadvm_state(QEMUFile *f)
         version_id = qemu_get_be32(f);
         record_len = qemu_get_be32(f);
 #if 0
-        printf("idstr=%s instance=0x%x version=%d len=%d\n", 
+        printf("idstr=%s instance=0x%x version=%d len=%d\n",
                idstr, instance_id, version_id, record_len);
 #endif
         cur_pos = qemu_ftell(f);
         se = find_se(idstr, instance_id);
         if (!se) {
-            fprintf(stderr, "qemu: warning: instance 0x%x of device '%s' not present in current VM\n", 
+            fprintf(stderr, "qemu: warning: instance 0x%x of device '%s' not present in current VM\n",
                     instance_id, idstr);
         } else {
             ret = se->load_state(f, se->opaque, version_id);
             if (ret < 0) {
-                fprintf(stderr, "qemu: warning: error while loading state for instance 0x%x of device '%s'\n", 
+                fprintf(stderr, "qemu: warning: error while loading state for instance 0x%x of device '%s'\n",
                         instance_id, idstr);
             }
         }
@@ -4704,7 +4704,7 @@ static int bdrv_snapshot_find(BlockDriverState *bs, QEMUSnapshotInfo *sn_info,
 {
     QEMUSnapshotInfo *sn_tab, *sn;
     int nb_sns, i, ret;
-    
+
     ret = -ENOENT;
     nb_sns = bdrv_snapshot_list(bs, &sn_tab);
     if (nb_sns < 0)
@@ -4746,7 +4746,7 @@ void do_savevm(const char *name)
 
     saved_vm_running = vm_running;
     vm_stop(0);
-    
+
     must_delete = 0;
     if (name) {
         ret = bdrv_snapshot_find(bs, old_sn, name);
@@ -4774,13 +4774,13 @@ void do_savevm(const char *name)
     sn->date_nsec = tv.tv_usec * 1000;
 #endif
     sn->vm_clock_nsec = qemu_get_clock(vm_clock);
-    
+
     if (bdrv_get_info(bs, bdi) < 0 || bdi->vm_state_offset <= 0) {
         term_printf("Device %s does not support VM state snapshots\n",
                     bdrv_get_device_name(bs));
         goto the_end;
     }
-    
+
     /* save the VM state */
     f = qemu_fopen_bdrv(bs, bdi->vm_state_offset, 1);
     if (!f) {
@@ -4794,7 +4794,7 @@ void do_savevm(const char *name)
         term_printf("Error %d while writing VM\n", ret);
         goto the_end;
     }
-    
+
     /* create the snapshots */
 
     for(i = 0; i < MAX_DISKS; i++) {
@@ -4833,7 +4833,7 @@ void do_loadvm(const char *name)
         term_printf("No block device supports snapshots\n");
         return;
     }
-    
+
     /* Flush all IO requests so they don't interfere with the new state.  */
     qemu_aio_flush();
 
@@ -4873,7 +4873,7 @@ void do_loadvm(const char *name)
                     bdrv_get_device_name(bs));
         return;
     }
-    
+
     /* restore the VM state */
     f = qemu_fopen_bdrv(bs, bdi->vm_state_offset, 0);
     if (!f) {
@@ -4900,7 +4900,7 @@ void do_delvm(const char *name)
         term_printf("No block device supports snapshots\n");
         return;
     }
-    
+
     for(i = 0; i <= MAX_DISKS; i++) {
         bs1 = bs_table[i];
         if (bdrv_has_snapshot(bs1)) {
@@ -4980,14 +4980,14 @@ void cpu_save(QEMUFile *f, void *opaque)
     uint16_t fptag, fpus, fpuc, fpregs_format;
     uint32_t hflags;
     int i;
-    
+
     for(i = 0; i < CPU_NB_REGS; i++)
         qemu_put_betls(f, &env->regs[i]);
     qemu_put_betls(f, &env->eip);
     qemu_put_betls(f, &env->eflags);
     hflags = env->hflags; /* XXX: suppress most of the redundant hflags */
     qemu_put_be32s(f, &hflags);
-    
+
     /* FPU */
     fpuc = env->fpuc;
     fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11;
@@ -4995,7 +4995,7 @@ void cpu_save(QEMUFile *f, void *opaque)
     for(i = 0; i < 8; i++) {
         fptag |= ((!env->fptags[i]) << i);
     }
-    
+
     qemu_put_be16s(f, &fpuc);
     qemu_put_be16s(f, &fpus);
     qemu_put_be16s(f, &fptag);
@@ -5006,7 +5006,7 @@ void cpu_save(QEMUFile *f, void *opaque)
     fpregs_format = 1;
 #endif
     qemu_put_be16s(f, &fpregs_format);
-    
+
     for(i = 0; i < 8; i++) {
 #ifdef USE_X86LDOUBLE
         {
@@ -5033,16 +5033,16 @@ void cpu_save(QEMUFile *f, void *opaque)
     cpu_put_seg(f, &env->tr);
     cpu_put_seg(f, &env->gdt);
     cpu_put_seg(f, &env->idt);
-    
+
     qemu_put_be32s(f, &env->sysenter_cs);
     qemu_put_be32s(f, &env->sysenter_esp);
     qemu_put_be32s(f, &env->sysenter_eip);
-    
+
     qemu_put_betls(f, &env->cr[0]);
     qemu_put_betls(f, &env->cr[2]);
     qemu_put_betls(f, &env->cr[3]);
     qemu_put_betls(f, &env->cr[4]);
-    
+
     for(i = 0; i < 8; i++)
         qemu_put_betls(f, &env->dr[i]);
 
@@ -5110,7 +5110,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
     qemu_get_be16s(f, &fpus);
     qemu_get_be16s(f, &fptag);
     qemu_get_be16s(f, &fpregs_format);
-    
+
     /* NOTE: we cannot always restore the FPU state if the image come
        from a host with a different 'USE_X86LDOUBLE' define. We guess
        if we are in an MMX state to restore correctly in that case. */
@@ -5118,7 +5118,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
     for(i = 0; i < 8; i++) {
         uint64_t mant;
         uint16_t exp;
-        
+
         switch(fpregs_format) {
         case 0:
             mant = qemu_get_be64(f);
@@ -5149,7 +5149,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
             }
 #else
             env->fpregs[i].mmx.MMX_Q(0) = mant;
-#endif            
+#endif
             break;
         default:
             return -EINVAL;
@@ -5164,23 +5164,23 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
     for(i = 0; i < 8; i++) {
         env->fptags[i] = (fptag >> i) & 1;
     }
-    
+
     for(i = 0; i < 6; i++)
         cpu_get_seg(f, &env->segs[i]);
     cpu_get_seg(f, &env->ldt);
     cpu_get_seg(f, &env->tr);
     cpu_get_seg(f, &env->gdt);
     cpu_get_seg(f, &env->idt);
-    
+
     qemu_get_be32s(f, &env->sysenter_cs);
     qemu_get_be32s(f, &env->sysenter_esp);
     qemu_get_be32s(f, &env->sysenter_eip);
-    
+
     qemu_get_betls(f, &env->cr[0]);
     qemu_get_betls(f, &env->cr[2]);
     qemu_get_betls(f, &env->cr[3]);
     qemu_get_betls(f, &env->cr[4]);
-    
+
     for(i = 0; i < 8; i++)
         qemu_get_betls(f, &env->dr[i]);
 
@@ -5201,7 +5201,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
     qemu_get_be64s(f, &env->fmask);
     qemu_get_be64s(f, &env->kernelgsbase);
 #endif
-    if (version_id >= 4) 
+    if (version_id >= 4)
         qemu_get_be32s(f, &env->smbase);
 
     /* XXX: compute hflags from scratch, except for CPL and IIF */
@@ -5378,7 +5378,7 @@ static int ram_compress_open(RamCompressState *s, QEMUFile *f)
     memset(s, 0, sizeof(*s));
     s->f = f;
     ret = deflateInit2(&s->zstream, 1,
-                       Z_DEFLATED, 15, 
+                       Z_DEFLATED, 15,
                        9, Z_DEFAULT_STRATEGY);
     if (ret != Z_OK)
         return -1;
@@ -5489,7 +5489,7 @@ static void ram_save(QEMUFile *f, void *opaque)
     int i;
     RamCompressState s1, *s = &s1;
     uint8_t buf[10];
-    
+
     qemu_put_be32(f, phys_ram_size);
     if (ram_compress_open(s, f) < 0)
         return;
@@ -5504,7 +5504,7 @@ static void ram_save(QEMUFile *f, void *opaque)
             sector_num = -1;
             for(j = 0; j < MAX_DISKS; j++) {
                 if (bs_table[j]) {
-                    sector_num = bdrv_hash_find(bs_table[j], 
+                    sector_num = bdrv_hash_find(bs_table[j],
                                                 phys_ram_base + i, BDRV_HASH_BLOCK_SIZE);
                     if (sector_num >= 0)
                         break;
@@ -5516,7 +5516,7 @@ static void ram_save(QEMUFile *f, void *opaque)
             buf[1] = j;
             cpu_to_be64wu((uint64_t *)(buf + 2), sector_num);
             ram_compress_buf(s, buf, 10);
-        } else 
+        } else
 #endif
         {
             //        normal_compress:
@@ -5552,7 +5552,7 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
                 fprintf(stderr, "Error while reading ram block address=0x%08x", i);
                 goto error;
             }
-        } else 
+        } else
 #if 0
         if (buf[0] == 1) {
             int bs_index;
@@ -5565,13 +5565,13 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
                 fprintf(stderr, "Invalid block device index %d\n", bs_index);
                 goto error;
             }
-            if (bdrv_read(bs_table[bs_index], sector_num, phys_ram_base + i, 
+            if (bdrv_read(bs_table[bs_index], sector_num, phys_ram_base + i,
                           BDRV_HASH_BLOCK_SIZE / 512) < 0) {
-                fprintf(stderr, "Error while reading sector %d:%" PRId64 "\n", 
+                fprintf(stderr, "Error while reading sector %d:%" PRId64 "\n",
                         bs_index, sector_num);
                 goto error;
             }
-        } else 
+        } else
 #endif
         {
         error:
@@ -5757,7 +5757,7 @@ void vm_start(void)
     }
 }
 
-void vm_stop(int reason) 
+void vm_stop(int reason)
 {
     if (vm_running) {
         cpu_disable_ticks();
@@ -5851,7 +5851,7 @@ void main_loop_wait(int timeout)
     if (ret == 0 && timeout > 0) {
         int err;
         WaitObjects *w = &wait_objects;
-        
+
         ret = WaitForMultipleObjects(w->num, w->events, FALSE, timeout);
         if (WAIT_OBJECT_0 + 0 <= ret && ret <= WAIT_OBJECT_0 + w->num - 1) {
             if (w->func[ret - WAIT_OBJECT_0])
@@ -5883,7 +5883,7 @@ void main_loop_wait(int timeout)
                 nfds = ioh->fd;
         }
     }
-    
+
     tv.tv_sec = 0;
 #ifdef _WIN32
     tv.tv_usec = 0;
@@ -5922,14 +5922,14 @@ void main_loop_wait(int timeout)
     qemu_bh_poll();
 
     if (vm_running) {
-        qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], 
+        qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL],
                         qemu_get_clock(vm_clock));
         /* run dma transfers, if any */
         DMA_run();
     }
-    
+
     /* real time timers */
-    qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], 
+    qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME],
                     qemu_get_clock(rt_clock));
 }
 
@@ -6331,7 +6331,7 @@ static void read_passwords(void)
         if (bs && bdrv_is_encrypted(bs)) {
             term_printf("%s is encrypted.\n", bdrv_get_device_name(bs));
             for(j = 0; j < 3; j++) {
-                monitor_readline("Password: ", 
+                monitor_readline("Password: ",
                                  1, password, sizeof(password));
                 if (bdrv_set_key(bs, password) == 0)
                     break;
@@ -6586,19 +6586,19 @@ int main(int argc, char **argv)
     for(i = 1; i < MAX_SERIAL_PORTS; i++)
         serial_devices[i][0] = '\0';
     serial_device_index = 0;
-    
+
     pstrcpy(parallel_devices[0], sizeof(parallel_devices[0]), "vc");
     for(i = 1; i < MAX_PARALLEL_PORTS; i++)
         parallel_devices[i][0] = '\0';
     parallel_device_index = 0;
-    
+
     usb_devices_index = 0;
-    
+
     nb_net_clients = 0;
 
     nb_nics = 0;
     /* default mac address of the first network interface */
-    
+
     optind = 1;
     for(;;) {
         if (optind >= argc)
@@ -6616,7 +6616,7 @@ int main(int argc, char **argv)
             popt = qemu_options;
             for(;;) {
                 if (!popt->name) {
-                    fprintf(stderr, "%s: invalid option -- '%s'\n", 
+                    fprintf(stderr, "%s: invalid option -- '%s'\n",
                             argv[0], r);
                     exit(1);
                 }
@@ -6643,7 +6643,7 @@ int main(int argc, char **argv)
                     printf("Supported machines are:\n");
                     for(m = first_machine; m != NULL; m = m->next) {
                         printf("%-10s %s%s\n",
-                               m->name, m->desc, 
+                               m->name, m->desc,
                                m == first_machine ? " (default)" : "");
                     }
                     exit(1);
@@ -6721,7 +6721,7 @@ int main(int argc, char **argv)
                 break;
             case QEMU_OPTION_boot:
                 boot_device = optarg[0];
-                if (boot_device != 'a' && 
+                if (boot_device != 'a' &&
 #if defined(TARGET_SPARC) || defined(TARGET_I386)
                    // Network boot
                    boot_device != 'n' &&
@@ -6765,7 +6765,7 @@ int main(int argc, char **argv)
                 break;
 #endif
             case QEMU_OPTION_redir:
-                net_slirp_redir(optarg);                
+                net_slirp_redir(optarg);
                 break;
 #endif
 #ifdef HAS_AUDIO
@@ -6794,7 +6794,7 @@ int main(int argc, char **argv)
                 {
                     int mask;
                     CPULogItem *item;
-                    
+
                     mask = cpu_str_to_log_mask(optarg);
                     if (!mask) {
                         printf("Log items (comma separated):\n");
@@ -6852,7 +6852,7 @@ int main(int argc, char **argv)
                     if (*p == 'x') {
                         p++;
                         depth = strtol(p, (char **)&p, 10);
-                        if (depth != 8 && depth != 15 && depth != 16 && 
+                        if (depth != 8 && depth != 15 && depth != 16 &&
                             depth != 24 && depth != 32)
                             goto graphic_error;
                     } else if (*p == '\0') {
@@ -6860,7 +6860,7 @@ int main(int argc, char **argv)
                     } else {
                         goto graphic_error;
                     }
-                    
+
                     graphic_width = w;
                     graphic_height = h;
                     graphic_depth = depth;
@@ -6874,7 +6874,7 @@ int main(int argc, char **argv)
                     fprintf(stderr, "qemu: too many serial ports\n");
                     exit(1);
                 }
-                pstrcpy(serial_devices[serial_device_index], 
+                pstrcpy(serial_devices[serial_device_index],
                         sizeof(serial_devices[0]), optarg);
                 serial_device_index++;
                 break;
@@ -6883,7 +6883,7 @@ int main(int argc, char **argv)
                     fprintf(stderr, "qemu: too many parallel ports\n");
                     exit(1);
                 }
-                pstrcpy(parallel_devices[parallel_device_index], 
+                pstrcpy(parallel_devices[parallel_device_index],
                         sizeof(parallel_devices[0]), optarg);
                 parallel_device_index++;
                 break;
@@ -6985,7 +6985,7 @@ int main(int argc, char **argv)
            len = read(fds[0], &status, 1);
            if (len == -1 && (errno == EINTR))
                goto again;
-           
+
            if (len != 1 || status != 0)
                exit(1);
            else
@@ -7017,7 +7017,7 @@ int main(int argc, char **argv)
     linux_boot = (kernel_filename != NULL);
 
     if (!linux_boot &&
-        hd_filename[0] == '\0' && 
+        hd_filename[0] == '\0' &&
         (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') &&
         fd_filename[0] == '\0')
         help();
@@ -7031,7 +7031,7 @@ int main(int argc, char **argv)
     }
 
     setvbuf(stdout, NULL, _IOLBF, 0);
-    
+
     init_timers();
     init_timer_alarm();
     qemu_aio_init();
@@ -7177,7 +7177,7 @@ int main(int argc, char **argv)
         if (devname[0] != '\0' && strcmp(devname, "none")) {
             serial_hds[i] = qemu_chr_open(devname);
             if (!serial_hds[i]) {
-                fprintf(stderr, "qemu: could not open serial device '%s'\n", 
+                fprintf(stderr, "qemu: could not open serial device '%s'\n",
                         devname);
                 exit(1);
             }
@@ -7191,7 +7191,7 @@ int main(int argc, char **argv)
         if (devname[0] != '\0' && strcmp(devname, "none")) {
             parallel_hds[i] = qemu_chr_open(devname);
             if (!parallel_hds[i]) {
-                fprintf(stderr, "qemu: could not open parallel device '%s'\n", 
+                fprintf(stderr, "qemu: could not open parallel device '%s'\n",
                         devname);
                 exit(1);
             }
@@ -7226,7 +7226,7 @@ int main(int argc, char **argv)
                     gdbstub_port);
             exit(1);
         }
-    } else 
+    } else
 #endif
     if (loadvm)
         do_loadvm(loadvm);
diff --git a/vl.h b/vl.h
index ff717863f591d19665de96d60d630251ef15df14..50c0eae0d4540c071134dc9d8f1d3be493e7cd63 100644 (file)
--- a/vl.h
+++ b/vl.h
@@ -1,8 +1,8 @@
 /*
  * QEMU System Emulator header
- * 
+ *
  * Copyright (c) 2003 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -236,13 +236,13 @@ typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
 typedef int IOCanRWHandler(void *opaque);
 typedef void IOHandler(void *opaque);
 
-int qemu_set_fd_handler2(int fd, 
-                         IOCanRWHandler *fd_read_poll, 
-                         IOHandler *fd_read, 
-                         IOHandler *fd_write, 
+int qemu_set_fd_handler2(int fd,
+                         IOCanRWHandler *fd_read_poll,
+                         IOHandler *fd_read,
+                         IOHandler *fd_write,
                          void *opaque);
 int qemu_set_fd_handler(int fd,
-                        IOHandler *fd_read, 
+                        IOHandler *fd_read,
                         IOHandler *fd_write,
                         void *opaque);
 
@@ -307,8 +307,8 @@ CharDriverState *qemu_chr_open(const char *filename);
 void qemu_chr_printf(CharDriverState *s, const char *fmt, ...);
 int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len);
 void qemu_chr_send_event(CharDriverState *s, int event);
-void qemu_chr_add_handlers(CharDriverState *s, 
-                           IOCanRWHandler *fd_can_read, 
+void qemu_chr_add_handlers(CharDriverState *s,
+                           IOCanRWHandler *fd_can_read,
                            IOReadHandler *fd_read,
                            IOEventHandler *fd_event,
                            void *opaque);
@@ -506,8 +506,8 @@ int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
 typedef void SaveStateHandler(QEMUFile *f, void *opaque);
 typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 
-int register_savevm(const char *idstr, 
-                    int instance_id, 
+int register_savevm(const char *idstr,
+                    int instance_id,
                     int version_id,
                     SaveStateHandler *save_state,
                     LoadStateHandler *load_state,
@@ -550,9 +550,9 @@ extern BlockDriver bdrv_qcow2;
 
 typedef struct BlockDriverInfo {
     /* in bytes, 0 if irrelevant */
-    int cluster_size; 
+    int cluster_size;
     /* offset at which the VM state can be saved (0 if not possible) */
-    int64_t vm_state_offset; 
+    int64_t vm_state_offset;
 } BlockDriverInfo;
 
 typedef struct QEMUSnapshotInfo {
@@ -578,7 +578,7 @@ typedef struct QEMUSnapshotInfo {
 
 void bdrv_init(void);
 BlockDriver *bdrv_find_format(const char *format_name);
-int bdrv_create(BlockDriver *drv, 
+int bdrv_create(BlockDriver *drv,
                 const char *filename, int64_t size_in_sectors,
                 const char *backing_file, int flags);
 BlockDriverState *bdrv_new(const char *device_name);
@@ -588,13 +588,13 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags);
 int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
                BlockDriver *drv);
 void bdrv_close(BlockDriverState *bs);
-int bdrv_read(BlockDriverState *bs, int64_t sector_num, 
+int bdrv_read(BlockDriverState *bs, int64_t sector_num,
               uint8_t *buf, int nb_sectors);
-int bdrv_write(BlockDriverState *bs, int64_t sector_num, 
+int bdrv_write(BlockDriverState *bs, int64_t sector_num,
                const uint8_t *buf, int nb_sectors);
-int bdrv_pread(BlockDriverState *bs, int64_t offset, 
+int bdrv_pread(BlockDriverState *bs, int64_t offset,
                void *buf, int count);
-int bdrv_pwrite(BlockDriverState *bs, int64_t offset, 
+int bdrv_pwrite(BlockDriverState *bs, int64_t offset,
                 const void *buf, int count);
 int bdrv_truncate(BlockDriverState *bs, int64_t offset);
 int64_t bdrv_getlength(BlockDriverState *bs);
@@ -632,11 +632,11 @@ void bdrv_flush(BlockDriverState *bs);
 #define BIOS_ATA_TRANSLATION_LARGE  3
 #define BIOS_ATA_TRANSLATION_RECHS  4
 
-void bdrv_set_geometry_hint(BlockDriverState *bs, 
+void bdrv_set_geometry_hint(BlockDriverState *bs,
                             int cyls, int heads, int secs);
 void bdrv_set_type_hint(BlockDriverState *bs, int type);
 void bdrv_set_translation_hint(BlockDriverState *bs, int translation);
-void bdrv_get_geometry_hint(BlockDriverState *bs, 
+void bdrv_get_geometry_hint(BlockDriverState *bs,
                             int *pcyls, int *pheads, int *psecs);
 int bdrv_get_type_hint(BlockDriverState *bs);
 int bdrv_get_translation_hint(BlockDriverState *bs);
@@ -647,7 +647,7 @@ int bdrv_media_changed(BlockDriverState *bs);
 int bdrv_is_locked(BlockDriverState *bs);
 void bdrv_set_locked(BlockDriverState *bs, int locked);
 void bdrv_eject(BlockDriverState *bs, int eject_flag);
-void bdrv_set_change_cb(BlockDriverState *bs, 
+void bdrv_set_change_cb(BlockDriverState *bs,
                         void (*change_cb)(void *opaque), void *opaque);
 void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size);
 void bdrv_info(void);
@@ -655,21 +655,21 @@ BlockDriverState *bdrv_find(const char *name);
 void bdrv_iterate(void (*it)(void *opaque, const char *name), void *opaque);
 int bdrv_is_encrypted(BlockDriverState *bs);
 int bdrv_set_key(BlockDriverState *bs, const char *key);
-void bdrv_iterate_format(void (*it)(void *opaque, const char *name), 
+void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
                          void *opaque);
 const char *bdrv_get_device_name(BlockDriverState *bs);
-int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, 
+int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num,
                           const uint8_t *buf, int nb_sectors);
 int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi);
 
-void bdrv_get_backing_filename(BlockDriverState *bs, 
+void bdrv_get_backing_filename(BlockDriverState *bs,
                                char *filename, int filename_size);
-int bdrv_snapshot_create(BlockDriverState *bs, 
+int bdrv_snapshot_create(BlockDriverState *bs,
                          QEMUSnapshotInfo *sn_info);
-int bdrv_snapshot_goto(BlockDriverState *bs, 
+int bdrv_snapshot_goto(BlockDriverState *bs,
                        const char *snapshot_id);
 int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id);
-int bdrv_snapshot_list(BlockDriverState *bs, 
+int bdrv_snapshot_list(BlockDriverState *bs,
                        QEMUSnapshotInfo **psn_info);
 char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn);
 
@@ -681,7 +681,7 @@ void path_combine(char *dest, int dest_size,
 
 #ifndef QEMU_TOOL
 
-typedef void QEMUMachineInitFunc(int ram_size, int vga_ram_size, 
+typedef void QEMUMachineInitFunc(int ram_size, int vga_ram_size,
                                  int boot_device,
              DisplayState *ds, const char **fd_filename, int snapshot,
              const char *kernel_filename, const char *kernel_cmdline,
@@ -706,9 +706,9 @@ extern target_phys_addr_t isa_mem_base;
 typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
 typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address);
 
-int register_ioport_read(int start, int length, int size, 
+int register_ioport_read(int start, int length, int size,
                          IOPortReadFunc *func, void *opaque);
-int register_ioport_write(int start, int length, int size, 
+int register_ioport_write(int start, int length, int size,
                           IOPortWriteFunc *func, void *opaque);
 void isa_unassign_ioport(int start, int length);
 
@@ -721,11 +721,11 @@ extern target_phys_addr_t pci_mem_base;
 typedef struct PCIBus PCIBus;
 typedef struct PCIDevice PCIDevice;
 
-typedef void PCIConfigWriteFunc(PCIDevice *pci_dev, 
+typedef void PCIConfigWriteFunc(PCIDevice *pci_dev,
                                 uint32_t address, uint32_t data, int len);
-typedef uint32_t PCIConfigReadFunc(PCIDevice *pci_dev, 
+typedef uint32_t PCIConfigReadFunc(PCIDevice *pci_dev,
                                    uint32_t address, int len);
-typedef void PCIMapIORegionFunc(PCIDevice *pci_dev, int region_num, 
+typedef void PCIMapIORegionFunc(PCIDevice *pci_dev, int region_num,
                                 uint32_t addr, uint32_t size, int type);
 
 #define PCI_ADDRESS_SPACE_MEM          0x00
@@ -764,7 +764,7 @@ struct PCIDevice {
     int devfn;
     char name[64];
     PCIIORegion io_regions[PCI_NUM_REGIONS];
-    
+
     /* do not access the following fields */
     PCIConfigReadFunc *config_read;
     PCIConfigWriteFunc *config_write;
@@ -777,18 +777,18 @@ struct PCIDevice {
 
 PCIDevice *pci_register_device(PCIBus *bus, const char *name,
                                int instance_size, int devfn,
-                               PCIConfigReadFunc *config_read, 
+                               PCIConfigReadFunc *config_read,
                                PCIConfigWriteFunc *config_write);
 
-void pci_register_io_region(PCIDevice *pci_dev, int region_num, 
-                            uint32_t size, int type, 
+void pci_register_io_region(PCIDevice *pci_dev, int region_num,
+                            uint32_t size, int type,
                             PCIMapIORegionFunc *map_func);
 
 void pci_set_irq(PCIDevice *pci_dev, int irq_num, int level);
 
-uint32_t pci_default_read_config(PCIDevice *d, 
+uint32_t pci_default_read_config(PCIDevice *d,
                                  uint32_t address, int len);
-void pci_default_write_config(PCIDevice *d, 
+void pci_default_write_config(PCIDevice *d,
                               uint32_t address, uint32_t val, int len);
 void pci_device_save(PCIDevice *s, QEMUFile *f);
 int pci_device_load(PCIDevice *s, QEMUFile *f);
@@ -889,16 +889,16 @@ static inline void dpy_resize(DisplayState *s, int w, int h)
     s->dpy_resize(s, w, h);
 }
 
-int isa_vga_init(DisplayState *ds, uint8_t *vga_ram_base, 
+int isa_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
                  unsigned long vga_ram_offset, int vga_ram_size);
-int pci_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, 
+int pci_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
                  unsigned long vga_ram_offset, int vga_ram_size,
                  unsigned long vga_bios_offset, int vga_bios_size);
 
 /* cirrus_vga.c */
-void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, 
+void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
                          unsigned long vga_ram_offset, int vga_ram_size);
-void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base, 
+void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
                          unsigned long vga_ram_offset, int vga_ram_size);
 
 /* sdl.c */
@@ -962,7 +962,7 @@ extern BlockDriverState *fd_table[MAX_FD];
 
 typedef struct fdctrl_t fdctrl_t;
 
-fdctrl_t *fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped, 
+fdctrl_t *fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped,
                        uint32_t io_base,
                        BlockDriverState **fds);
 int fdctrl_get_drive_type(fdctrl_t *fdctrl, int drive_num);
@@ -1158,9 +1158,9 @@ void esp_reset(void *opaque);
 void *sparc32_dma_init(uint32_t daddr, int espirq, int leirq, void *iommu,
                        void *intctl);
 void ledma_set_irq(void *opaque, int isr);
-void ledma_memory_read(void *opaque, target_phys_addr_t addr, 
+void ledma_memory_read(void *opaque, target_phys_addr_t addr,
                        uint8_t *buf, int len, int do_bswap);
-void ledma_memory_write(void *opaque, target_phys_addr_t addr, 
+void ledma_memory_write(void *opaque, target_phys_addr_t addr,
                         uint8_t *buf, int len, int do_bswap);
 void espdma_raise_irq(void *opaque);
 void espdma_clear_irq(void *opaque);
@@ -1230,9 +1230,9 @@ int adb_request(ADBBusState *s, uint8_t *buf_out,
                 const uint8_t *buf, int len);
 int adb_poll(ADBBusState *s, uint8_t *buf_out);
 
-ADBDevice *adb_register_device(ADBBusState *s, int devaddr, 
-                               ADBDeviceRequest *devreq, 
-                               ADBDeviceReset *devreset, 
+ADBDevice *adb_register_device(ADBBusState *s, int devaddr,
+                               ADBDeviceRequest *devreq,
+                               ADBDeviceReset *devreset,
                                void *opaque);
 void adb_kbd_init(ADBBusState *bus);
 void adb_mouse_init(ADBBusState *bus);
@@ -1366,7 +1366,7 @@ typedef struct pflash_t pflash_t;
 pflash_t *pflash_register (target_ulong base, ram_addr_t off,
                            BlockDriverState *bs,
                            target_ulong sector_len, int nb_blocs, int width,
-                           uint16_t id0, uint16_t id1, 
+                           uint16_t id0, uint16_t id1,
                            uint16_t id2, uint16_t id3);
 
 #include "gdbstub.h"
diff --git a/vnc.c b/vnc.c
index f729e05d8fb723c3c3eb04e0c42cb5a1ea4fd87a..5cd6ed7fb083cd89f48cca7f60a1b869ceebab44 100644 (file)
--- a/vnc.c
+++ b/vnc.c
@@ -1,9 +1,9 @@
 /*
  * QEMU VNC display driver
- * 
+ *
  * Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>
  * Copyright (C) 2006 Fabrice Bellard
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * in the Software without restriction, including without limitation the rights
@@ -46,7 +46,7 @@ typedef void VncWritePixels(VncState *vs, void *data, int size);
 
 typedef void VncSendHextileTile(VncState *vs,
                                 int x, int y, int w, int h,
-                                uint32_t *last_bg, 
+                                uint32_t *last_bg,
                                 uint32_t *last_fg,
                                 int *has_bg, int *has_fg);
 
@@ -145,7 +145,7 @@ static inline void vnc_set_bits(uint32_t *d, int n, int nb_words)
         d[j++] = -1;
         n -= 32;
     }
-    if (n > 0) 
+    if (n > 0)
         d[j++] = (1 << n) - 1;
     while (j < nb_words)
         d[j++] = 0;
@@ -156,7 +156,7 @@ static inline int vnc_get_bit(const uint32_t *d, int k)
     return (d[k >> 5] >> (k & 0x1f)) & 1;
 }
 
-static inline int vnc_and_bits(const uint32_t *d1, const uint32_t *d2, 
+static inline int vnc_and_bits(const uint32_t *d1, const uint32_t *d2,
                                int nb_words)
 {
     int i;
@@ -233,8 +233,8 @@ static void vnc_convert_pixel(VncState *vs, uint8_t *buf, uint32_t v)
     r = (v >> vs->red_shift1) & vs->red_max;
     g = (v >> vs->green_shift1) & vs->green_max;
     b = (v >> vs->blue_shift1) & vs->blue_max;
-    v = (r << vs->red_shift) | 
-        (g << vs->green_shift) | 
+    v = (r << vs->red_shift) |
+        (g << vs->green_shift) |
         (b << vs->blue_shift);
     switch(vs->pix_bpp) {
     case 1:
@@ -328,7 +328,7 @@ static void send_framebuffer_update_hextile(VncState *vs, int x, int y, int w, i
     has_fg = has_bg = 0;
     for (j = y; j < (y + h); j += 16) {
        for (i = x; i < (x + w); i += 16) {
-            vs->send_hextile_tile(vs, i, j, 
+            vs->send_hextile_tile(vs, i, j,
                                   MIN(16, x + w - i), MIN(16, y + h - j),
                                   &last_bg32, &last_fg32, &has_bg, &has_fg);
        }
@@ -764,7 +764,7 @@ static void do_key_event(VncState *vs, int down, uint32_t sym)
     int keycode;
 
     keycode = keysym2scancode(vs->kbd_layout, sym & 0xFFFF);
-    
+
     /* QEMU console switch */
     switch(keycode) {
     case 0x2a:                          /* Left Shift */
@@ -778,7 +778,7 @@ static void do_key_event(VncState *vs, int down, uint32_t sym)
         else
             vs->modifiers_state[keycode] = 0;
         break;
-    case 0x02 ... 0x0a: /* '1' to '9' keys */ 
+    case 0x02 ... 0x0a: /* '1' to '9' keys */
         if (down && vs->modifiers_state[0x1d] && vs->modifiers_state[0x38]) {
             /* Reset the modifiers sent to the current console */
             reset_keys(vs);
@@ -858,7 +858,7 @@ static void framebuffer_update_request(VncState *vs, int incremental,
        char *old_row = vs->old_data + y_position * vs->ds->linesize;
 
        for (i = 0; i < h; i++) {
-            vnc_set_bits(vs->dirty_row[y_position + i], 
+            vnc_set_bits(vs->dirty_row[y_position + i],
                          (vs->ds->width / 16), VNC_DIRTY_WORDS);
            memset(old_row, 42, vs->ds->width * vs->depth);
            old_row += vs->ds->linesize;
@@ -930,29 +930,29 @@ static void set_pixel_format(VncState *vs,
        vnc_client_error(vs);
         return;
     }
-    if (bits_per_pixel == 32 && 
+    if (bits_per_pixel == 32 &&
         host_big_endian_flag == big_endian_flag &&
         red_max == 0xff && green_max == 0xff && blue_max == 0xff &&
         red_shift == 16 && green_shift == 8 && blue_shift == 0) {
         vs->depth = 4;
         vs->write_pixels = vnc_write_pixels_copy;
         vs->send_hextile_tile = send_hextile_tile_32;
-    } else 
-    if (bits_per_pixel == 16 && 
+    } else
+    if (bits_per_pixel == 16 &&
         host_big_endian_flag == big_endian_flag &&
         red_max == 31 && green_max == 63 && blue_max == 31 &&
         red_shift == 11 && green_shift == 5 && blue_shift == 0) {
         vs->depth = 2;
         vs->write_pixels = vnc_write_pixels_copy;
         vs->send_hextile_tile = send_hextile_tile_16;
-    } else 
-    if (bits_per_pixel == 8 && 
+    } else
+    if (bits_per_pixel == 8 &&
         red_max == 7 && green_max == 7 && blue_max == 3 &&
         red_shift == 5 && green_shift == 2 && blue_shift == 0) {
         vs->depth = 1;
         vs->write_pixels = vnc_write_pixels_copy;
         vs->send_hextile_tile = send_hextile_tile_8;
-    } else 
+    } else
     {
         /* generic and slower case */
         if (bits_per_pixel != 8 &&
@@ -1048,7 +1048,7 @@ static int protocol_client_msg(VncState *vs, char *data, size_t len)
        vnc_client_error(vs);
        break;
     }
-       
+
     vnc_read_when(vs, protocol_client_msg, 1);
     return 0;
 }
@@ -1097,10 +1097,10 @@ static int protocol_client_init(VncState *vs, char *data, size_t len)
         vs->send_hextile_tile = send_hextile_tile_8;
     }
     vs->write_pixels = vnc_write_pixels_copy;
-       
+
     vnc_write(vs, pad, 3);           /* padding */
 
-    vnc_write_u32(vs, 4);        
+    vnc_write_u32(vs, 4);
     vnc_write(vs, "QEMU", 4);
     vnc_flush(vs);
 
@@ -1229,7 +1229,7 @@ void vnc_display_init(DisplayState *ds, const char *arg)
            fprintf(stderr, "Could not parse VNC address\n");
            exit(1);
        }
-           
+
        iaddr.sin_port = htons(ntohs(iaddr.sin_port) + 5900);
 
        reuse_addr = 1;
index aa575b7df8affabb7ade6bb8cb878d7e05fd5ee0..35dcc57271bcd27a0abcf3f9c3b2ca9575934db5 100644 (file)
@@ -9,7 +9,7 @@
 
 static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
                                              int x, int y, int w, int h,
-                                             uint32_t *last_bg32, 
+                                             uint32_t *last_bg32,
                                              uint32_t *last_fg32,
                                              int *has_bg, int *has_fg)
 {
@@ -86,7 +86,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
        flags |= 0x08;
 
        irow = (pixel_t *)row;
-       
+
        for (j = 0; j < h; j++) {
            int min_x = -1;
            for (i = 0; i < w; i++) {