[Qemu-devel] system_reset command cause assert failed

2010-01-31 Thread Roy Tam
Dear all,

In latest git revision, when guest OS restarts or system_reset command
issues from monitor console, it asserts failed:
Assertion failed: obj != NULL, file C:/msys/home/User/qemu/monitor.c, line 338

Best regards,
Roy Tam




Re: [Qemu-devel] Re: qemu without an X?

2010-01-31 Thread Mulyadi Santosa
On Sun, Jan 31, 2010 at 3:17 AM, jonatan perry jonata...@gmail.com wrote:
 Opps... sent to this list by mistake :-(

 On Sat, Jan 30, 2010 at 10:17 PM, jonatan perry jonata...@gmail.com wrote:

 Hello all,

 Can Qemu running on Linux without an X server run windows operation
 system? is the virtualization can be directly with the hardware without
 Qemu/Linux interruption?

use builtin Qemu's VNC server, maybe?

about your #2 question, not sure what does that mean. You mean, you
want to use somekind like KVM instead of pure Qemu's cpu+hardware
emulation?

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com




Re: [Qemu-devel] RE: Qemu-devel Digest, Vol 82, Issue 324

2010-01-31 Thread Mulyadi Santosa
2010/1/30 Yasin Yenidünya mac...@gmail.com:
 Hello,

 I want to develop an linux os. Does anyone has a tutorial to build an
 operting system? Or if some one has the soruce code of linux that comes with
 qemu it is also enought for me..

You wanna develop from scratch? or extend the existing one like Linux kernel?

Anyway, maybe you'll find this URL interesting: www.kernelnewbies.org

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com




[Qemu-devel] [PATCH] Add cpu model configuration support..

2010-01-31 Thread john cooper
This is a reimplementation of prior versions which adds
the ability to define cpu models for contemporary processors.
The added models are likewise selected via -cpu name,
and are intended to displace the existing convention
of -cpu qemu64 augmented with a series of feature flags.

A primary motivation was determination of a least common
denominator within a given processor class to simplify guest
migration.  It is still possible to modify an arbitrary model
via additional feature flags however the goal here was to
make doing so unnecessary in typical usage.  The other
consideration was providing models names reflective of
current processors.  Both AMD and Intel have reviewed the
models in terms of balancing generality of migration vs.
excessive feature downgrade relative to released silicon. 

This version of the patch replaces the prior hard wired
definitions with a configuration file approach for new
models.  Existing models are thus far left as-is but may
easily be transitioned to (or may be overridden by) the
configuration file representation.

Proposed new model definitions are provided here for current
AMD and Intel processors.  Each model consists of a name
used to select it on the command line (-cpu name), and a
model_id which corresponds to a least common denominator
commercial instance of the processor class.

A table of names/model_ids may be queried via -cpu ?model:

:
x86   Opteron_G3  AMD Opteron 23xx (Gen 3 Class Opteron)  
x86   Opteron_G2  AMD Opteron 22xx (Gen 2 Class Opteron)  
x86   Opteron_G1  AMD Opteron 240 (Gen 1 Class Opteron)   
x86  Nehalem  Intel Core i7 9xx (Nehalem Class Core i7)   
x86   Penryn  Intel Core 2 Duo P9xxx (Penryn Class Core 2)
x86   Conroe  Intel Celeron_4x0 (Conroe/Merom Class Core 2)
: 

Also added is -cpu ?dump which exhaustively outputs all config
data for all defined models, and -cpu ?cpuid which enumerates
all qemu recognized CPUID feature flags.

The pseudo cpuid flag 'check' when added to the feature flag list
will warn when feature flags (either implicit in a cpu model or
explicit on the command line) would have otherwise been quietly
unavailable to a guest:

# qemu-system-x86_64 ... -cpu Nehalem,check
warning: host cpuid _0001 lacks requested flag 'sse4.2|sse4_2' 
[0x0010]
warning: host cpuid _0001 lacks requested flag 'popcnt' [0x0080]

A similar 'enforce' pseudo flag exists which in addition
to the above causes qemu to error exit if requested flags are
unavailable.

Configuration data for a cpu model resides in the target config
file which by default will be installed as:

/usr/local/etc/qemu/target-arch.conf

The format of this file should be self explanatory given the
definitions for the above six models and essentially mimics
the structure of the static x86_def_t x86_defs.

Encoding of cpuid flags names now allows aliases for both the
configuration file and the command line which reconciles some
Intel/AMD/Linux/Qemu naming differences.

This patch was tested relative to qemu.git.

Signed-off-by: john cooper john.coo...@redhat.com
---

diff --git a/Makefile b/Makefile
index 3848627..b7fa6ef 100644
--- a/Makefile
+++ b/Makefile
@@ -191,7 +191,11 @@ ifdef CONFIG_POSIX
$(INSTALL_DATA) qemu-nbd.8 $(DESTDIR)$(mandir)/man8
 endif
 
-install: all $(if $(BUILD_DOCS),install-doc)
+install-sysconfig:
+   $(INSTALL_DIR) $(sysconfdir)/qemu
+   $(INSTALL_DATA) sysconfigs/target/target-x86_64.conf 
$(sysconfdir)/qemu
+
+install: all $(if $(BUILD_DOCS),install-doc) install-sysconfig
$(INSTALL_DIR) $(DESTDIR)$(bindir)
 ifneq ($(TOOLS),)
$(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) $(DESTDIR)$(bindir)
diff --git a/qemu-config.c b/qemu-config.c
index c3203c8..246fae6 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -242,6 +242,54 @@ QemuOptsList qemu_mon_opts = {
 },
 };
 
+QemuOptsList qemu_cpudef_opts = {
+.name = cpudef,
+.head = QTAILQ_HEAD_INITIALIZER(qemu_cpudef_opts.head),
+.desc = {
+{
+.name = name,
+.type = QEMU_OPT_STRING,
+},{
+.name = level,
+.type = QEMU_OPT_NUMBER,
+},{
+.name = vendor,
+.type = QEMU_OPT_STRING,
+},{
+.name = family,
+.type = QEMU_OPT_NUMBER,
+},{
+.name = model,
+.type = QEMU_OPT_NUMBER,
+},{
+.name = stepping,
+.type = QEMU_OPT_NUMBER,
+},{
+.name = feature_edx,  /* cpuid _0001.edx */
+.type = QEMU_OPT_STRING,
+},{
+.name = feature_ecx,  /* cpuid _0001.ecx */
+.type = QEMU_OPT_STRING,
+},{
+.name = extfeature_edx,   /* cpuid 8000_0001.edx */
+.type = QEMU_OPT_STRING,
+},{
+.name = extfeature_ecx,   /* cpuid 8000_0001.ecx */
+   

[Qemu-devel] Re: sparc32 don't mark page dirty when failing

2010-01-31 Thread Blue Swirl
Thanks, applied.


On Sun, Jan 31, 2010 at 4:27 AM, Artyom Tarasenko
atar4q...@googlemail.com wrote:
 if the access check fails, the page can not be modified
 and shouldn't be marked dirty.
 The patch fixes the hsfs_putpage: dirty HSFS page
 error in Solaris guests.

 Signed-off-by: Artyom Tarasenko atar4q...@gmail.com
 ---
 diff --git a/target-sparc/helper.c b/target-sparc/helper.c
 index b5b4e7c..ffe93e3 100644
 --- a/target-sparc/helper.c
 +++ b/target-sparc/helper.c
 @@ -185,6 +185,12 @@ static int get_physical_address(CPUState *env, 
 target_phys_addr_t *physical,
         }
     }

 +    /* check access */
 +    access_perms = (pde  PTE_ACCESS_MASK)  PTE_ACCESS_SHIFT;
 +    error_code = access_table[*access_index][access_perms];
 +    if (error_code  !((env-mmuregs[0]  MMU_NF)  is_user))
 +        return error_code;
 +
     /* update page modified and dirty bits */
     is_dirty = (rw  1)  !(pde  PG_MODIFIED_MASK);
     if (!(pde  PG_ACCESSED_MASK) || is_dirty) {
 @@ -193,11 +199,6 @@ static int get_physical_address(CPUState *env, 
 target_phys_addr_t *physical,
             pde |= PG_MODIFIED_MASK;
         stl_phys_notdirty(pde_ptr, pde);
     }
 -    /* check access */
 -    access_perms = (pde  PTE_ACCESS_MASK)  PTE_ACCESS_SHIFT;
 -    error_code = access_table[*access_index][access_perms];
 -    if (error_code  !((env-mmuregs[0]  MMU_NF)  is_user))
 -        return error_code;

     /* the page can be put in the TLB */
     *prot = perm_table[is_user][access_perms];





[Qemu-devel] Re: [PATCH 6/6] fix audio_bug related failures

2010-01-31 Thread Paolo Bonzini

On 01/31/2010 04:08 AM, malc wrote:

On Wed, 27 Jan 2010, Anthony Liguori wrote:


On 01/27/2010 05:56 AM, Paolo Bonzini wrote:

On 01/27/2010 03:10 AM, Anthony Liguori wrote:

What did clang complain about?  It's not obvious to me.


It doesn't see that audio_bug returns cond, and gives quite a few false
positive in its callers.


Ah, this is a clang issue.  I'll have to defer to malc on this one.


I'm against it.


Ok, I'll withdraw this patch.  I already posted v2.

Paolo





[Qemu-devel] Re: [PATCH v2] qemu-img: Fix qemu-img can't create qcow image based on read-only image

2010-01-31 Thread Naphtali Sprei
Sheng Yang wrote:
 Commit 03cbdac7 Disable fall-back to read-only when cannot open drive's
 file for read-write result in read-only image can't be used as backed
 image in qemu-img.
 
 Cc: Naphtali Sprei nsp...@redhat.com
 Signed-off-by: Sheng Yang sh...@linux.intel.com

Acked-by: Naphtali Sprei nsp...@redhat.com

Unfortunately, I see there are still problems with using the resulting images.
Investigating it, will send patches.

  Naphtali





[Qemu-devel] [PATCH] Fix missing symbols in .rel/.rela.plt sections

2010-01-31 Thread Loïc Minier
Fix .rel.plt sections in the output to not only include .rel.plt
sections from the input but also the .rel.iplt sections and to define
the hidden symbols __rel_iplt_start and __rel_iplt_end around
.rel.iplt as otherwise we get undefined references to these when
linking statically to a multilib libc.a.  This fixes the static build
under i386.

Apply similar logic to rela.plt/.iplt and __rela_iplt/_plt_start/_end to
fix the static build under amd64.

Signed-off-by: Loïc Minier l...@dooz.org
---
 i386.ld   |   16 ++--
 x86_64.ld |   16 ++--
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/i386.ld b/i386.ld
index f2dafec..f8df7bf 100644
--- a/i386.ld
+++ b/i386.ld
@@ -39,8 +39,20 @@ SECTIONS
   .rela.fini : { *(.rela.fini) }
   .rel.bss   : { *(.rel.bss)   }
   .rela.bss  : { *(.rela.bss)  }
-  .rel.plt   : { *(.rel.plt)   }
-  .rela.plt  : { *(.rela.plt)  }
+  .rel.plt  :
+  {
+*(.rel.plt)
+PROVIDE_HIDDEN (__rel_iplt_start = .);
+*(.rel.iplt)
+PROVIDE_HIDDEN (__rel_iplt_end = .);
+  }
+  .rela.plt   :
+  {
+*(.rela.plt)
+PROVIDE_HIDDEN (__rela_iplt_start = .);
+*(.rela.iplt)
+PROVIDE_HIDDEN (__rela_iplt_end = .);
+  }
   .init  : { *(.init)  } =0x47ff041f
   .text  :
   {
diff --git a/x86_64.ld b/x86_64.ld
index 24ea77d..46d8d4d 100644
--- a/x86_64.ld
+++ b/x86_64.ld
@@ -35,8 +35,20 @@ SECTIONS
   .rela.got   : { *(.rela.got) }
   .rel.bss: { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
   .rela.bss   : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
-  .rel.plt: { *(.rel.plt) }
-  .rela.plt   : { *(.rela.plt) }
+  .rel.plt  :
+  {
+*(.rel.plt)
+PROVIDE_HIDDEN (__rel_iplt_start = .);
+*(.rel.iplt)
+PROVIDE_HIDDEN (__rel_iplt_end = .);
+  }
+  .rela.plt   :
+  {
+*(.rela.plt)
+PROVIDE_HIDDEN (__rela_iplt_start = .);
+*(.rela.iplt)
+PROVIDE_HIDDEN (__rela_iplt_end = .);
+  }
   .init   :
   {
 KEEP (*(.init))
-- 
1.6.5





[Qemu-devel] [PATCH] Add -static earlier to LDFLAGS for compile_prog()

2010-01-31 Thread Loïc Minier
Add -static to LDFLAGS earlier as to run the compile_prog() tests with
this flags, this will avoid turning on features for which a shared
library is available but not a static one.

Signed-off-by: Loïc Minier l...@dooz.org
---
 configure |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 42ef628..ab6bd8e 100755
--- a/configure
+++ b/configure
@@ -488,7 +488,9 @@ for opt do
   ;;
   --enable-gprof) gprof=yes
   ;;
-  --static) static=yes
+  --static)
+static=yes
+LDFLAGS=-static $LDFLAGS
   ;;
   --sysconfdir) sysconfdir=$optarg
   ;;
@@ -2025,7 +2027,6 @@ if test $solaris = yes ; then
 fi
 if test $static = yes ; then
   echo CONFIG_STATIC=y  $config_host_mak
-  LDFLAGS=-static $LDFLAGS
 fi
 if test $profiler = yes ; then
   echo CONFIG_PROFILER=y  $config_host_mak
-- 
1.6.5





[Qemu-devel] [PATCH] Remove conditional rom loading support

2010-01-31 Thread Blue Swirl
Commit c2039bd0ffce8807e0eaac55254fde790825fa92 made rom loading
automatic for non-PC architectures. Remove now mostly unused
conditional rom loading support.

Signed-off-by: Blue Swirl blauwir...@gmail.com
---
 hw/loader.c |5 -
 hw/loader.h |1 -
 hw/pc.c |3 ---
 3 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/hw/loader.c b/hw/loader.c
index b3bbd77..1448887 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -537,7 +537,6 @@ struct Rom {

 static FWCfgState *fw_cfg;
 static QTAILQ_HEAD(, Rom) roms = QTAILQ_HEAD_INITIALIZER(roms);
-int rom_enable_driver_roms;

 static void rom_insert(Rom *rom)
 {
@@ -624,15 +623,11 @@ int rom_add_blob(const char *name, const void
*blob, size_t len,

 int rom_add_vga(const char *file)
 {
-if (!rom_enable_driver_roms)
-return 0;
 return rom_add_file(file, vgaroms, 0);
 }

 int rom_add_option(const char *file)
 {
-if (!rom_enable_driver_roms)
-return 0;
 return rom_add_file(file, genroms, 0);
 }

diff --git a/hw/loader.h b/hw/loader.h
index 8ff3c94..56676e1 100644
--- a/hw/loader.h
+++ b/hw/loader.h
@@ -41,7 +41,6 @@ void do_info_roms(Monitor *mon);
 #define PC_ROM_ALIGN   0x800
 #define PC_ROM_SIZE(PC_ROM_MAX - PC_ROM_MIN_VGA)

-extern int rom_enable_driver_roms;
 int rom_add_vga(const char *file);
 int rom_add_option(const char *file);

diff --git a/hw/pc.c b/hw/pc.c
index a674dbf..176d3cc 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -855,9 +855,6 @@ static void pc_init1(ram_addr_t ram_size,
  isa_bios_size,
  (bios_offset + bios_size -
isa_bios_size) | IO_MEM_ROM);

-
-
-rom_enable_driver_roms = 1;
 option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE);
 cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE,
option_rom_offset);

-- 
1.6.2.4




[Qemu-devel] [PATCH] block: Enable fall-back to read-only for backing file

2010-01-31 Thread Naphtali Sprei
There's a problem when trying to use an image file based on a read-only image 
file.
Before this patch, qemu fails to open the base image and stop.
With this patch, qemu tries to open the backing file with same permissions as 
the top file,
but if it fails, qemu tries to open it with read-only permissions. If succeeded 
it goes on.

This fall-back works both for an image file based on a read-only file
and also for a read-only file opened with the snapshot attribute/mode (where 
the real file is the backing file
for the snapshot file).

Is it better to always open the backing file with read-only mode ? this will be 
more consistent/predictable ?
Or is it better not to fall-back to read-only ? Will a warning message help ?

 TIA,

   Naphtali
   

From 4a10750f5c91b1383118e4421f6b8d3ff3e79b2f Mon Sep 17 00:00:00 2001
From: Naphtali Sprei nsp...@redhat.com
Date: Sun, 31 Jan 2010 18:23:44 +0200
Subject: [PATCH] block: Enable fall-back to read-only for backing file

In order to use an image file backed by a read-only file, allow opening
the backing file with read-only permission.

Signed-off-by: Naphtali Sprei nsp...@redhat.com
---
 block.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/block.c b/block.c
index 1919d19..d1b0f3d 100644
--- a/block.c
+++ b/block.c
@@ -483,6 +483,11 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, 
int flags,
 back_drv = bdrv_find_format(bs-backing_format);
 ret = bdrv_open2(bs-backing_hd, backing_filename, open_flags,
  back_drv);
+if (ret  0) {
+open_flags = ~BDRV_O_RDWR;  /* Fall-back to read-only for the 
backing file */
+ret = bdrv_open2(bs-backing_hd, backing_filename, open_flags,
+ back_drv);
+}
 bs-backing_hd-read_only =  (open_flags  BDRV_O_RDWR) == 0;
 if (ret  0) {
 bdrv_close(bs);
-- 
1.6.3.3





Re: [Qemu-devel] Re: qemu without an X?

2010-01-31 Thread jonatan perry
Hi Mulyadi!
Regarding my first qeustion: no, I don't want remote access to the machine,
I want local access, something like starting a linux os, and launch from
shell qemu so he will run a graphic operation system, like windows.

I want my emulator to run the virtual machine opcodes natively on my cpu, I
don't want to emulate ALL my virtual machine opcode, my goal is to get more
faster and stable virtual machine.

thanks!
On Sun, Jan 31, 2010 at 10:43 AM, Mulyadi Santosa mulyadi.sant...@gmail.com
 wrote:

 On Sun, Jan 31, 2010 at 3:17 AM, jonatan perry jonata...@gmail.com
 wrote:
  Opps... sent to this list by mistake :-(
 
  On Sat, Jan 30, 2010 at 10:17 PM, jonatan perry jonata...@gmail.com
 wrote:
 
  Hello all,
 
  Can Qemu running on Linux without an X server run windows operation
  system? is the virtualization can be directly with the hardware without
  Qemu/Linux interruption?

 use builtin Qemu's VNC server, maybe?

 about your #2 question, not sure what does that mean. You mean, you
 want to use somekind like KVM instead of pure Qemu's cpu+hardware
 emulation?

 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer and consultant

 blog: the-hydra.blogspot.com
 training: mulyaditraining.blogspot.com



Re: [Qemu-devel] Re: qemu without an X?

2010-01-31 Thread Ben Taylor
On Sun, Jan 31, 2010 at 1:56 PM, jonatan perry jonata...@gmail.com wrote:
 Hi Mulyadi!
 Regarding my first qeustion: no, I don't want remote access to the machine,
 I want local access, something like starting a linux os, and launch from
 shell qemu so he will run a graphic operation system, like windows.

 I want my emulator to run the virtual machine opcodes natively on my cpu, I
 don't want to emulate ALL my virtual machine opcode, my goal is to get more
 faster and stable virtual machine.

QEMU doesn't do HW emulation then output to your local graphics device.
You have to use some sort of display, whether it be vnc, or X if you're talking
about some sort of GUI on the client.




Re: [Qemu-devel] [PATCH] Porting TCG to alpha platform

2010-01-31 Thread Richard Henderson

tcg_out_ld(s, TCG_TYPE_I64, r1, r1, offsetof(CPUTLBEntry, addend) -
offsetof(CPUTLBEntry, addr_read));

should be modified to

tcg_out_ld(s, TCG_TYPE_I64, r1, r1, offsetof(CPUTLBEntry, addend));


Actually, it should be the entire offset from CPUState.  The ADDR_WRITE
offset before was entirely stuffed into the LD offset.


At the end of tcg_out_tlb_cmp(), R0's value is (page# | low bit of
VA), if the branch is taken, i.e., TLB miss, R0 will be passed as an
argument to helper functions, is it currently holding the correct
value? I think at this time R0 should equal to addr_reg.


You're absolutely right here.

Here's the kind of patch I think will fix it.


r~
commit 04e0dc252203bfbc5b02c2d3d8757a005e304a39
Author: Richard Henderson r...@twiddle.net
Date:   Sun Jan 31 15:06:35 2010 -0800

tcg-alpha: Fix problems in qemu_ld/st.

Copy address to R0 in tcg_out_tlb_cmp, for use in helper path.
Use entire TLB constant offset performing the ADDEND read.

diff --git a/tcg/alpha/tcg-target.c b/tcg/alpha/tcg-target.c
index 519edef..463b7ee 100644
--- a/tcg/alpha/tcg-target.c
+++ b/tcg/alpha/tcg-target.c
@@ -709,9 +709,10 @@ static void *qemu_st_helpers[4] = {
 static void tcg_out_tlb_cmp(TCGContext *s, int sizeop, int r0, int r1,
 int addr_reg, int label1, long tlb_offset)
 {
+int addrsizeop = TARGET_LONG_BITS == 32 ? 2 : 3;
 long val;
 
-/* Mask the page, plus the low bits of the access, into R0.  Note
+/* Mask the page, plus the low bits of the access, into TMP3.  Note
that the low bits are added in order to catch unaligned accesses,
as those bits won't be set in the TLB entry.  For 32-bit targets,
force the high bits of the mask to be zero, as the high bits of
@@ -720,7 +721,7 @@ static void tcg_out_tlb_cmp(TCGContext *s, int sizeop, int 
r0, int r1,
 if (TARGET_LONG_BITS == 32) {
 val = 0xu;
 }
-tcg_out_andi(s, addr_reg, val, r0);
+tcg_out_andi(s, addr_reg, val, TMP_REG3);
 
 /* Compute the index into the TLB into R1.  Again, note that the
high bits of a 32-bit address must be cleared.  */
@@ -736,11 +737,14 @@ static void tcg_out_tlb_cmp(TCGContext *s, int sizeop, 
int r0, int r1,
 /* Load the word at (R1 + CPU_ENV + TLB_OFFSET).  Note that we
arrange for a 32-bit load to be zero-extended.  */
 tcg_out_fmt_opr(s, INSN_ADDQ, r1, TCG_AREG0, r1);
-tcg_out_ld_sz(s, TARGET_LONG_BITS == 32 ? 2 : 3,
-  TMP_REG2, r1, tlb_offset);
+tcg_out_ld_sz(s, addrsizeop, TMP_REG2, r1, tlb_offset);
 
-/* Compare R0 with the value loaded from the TLB.  */
-tcg_out_brcond(s, TCG_COND_NE, TMP_REG2, r0, 0, label1);
+/* Copy the original address into R0.  This is needed on the
+   slow path through the helper function.  */
+tcg_out_extend(s, addrsizeop, addr_reg, r0);
+
+/* Compare TMP3 with the value loaded from the TLB.  */
+tcg_out_brcond(s, TCG_COND_NE, TMP_REG2, TMP_REG3, 0, label1);
 }
 #endif /* SOFTMMU */
 
@@ -769,20 +773,12 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg 
*args, int sizeop)
 /* TLB Hit.  Note that Alpha statically predicts forward branch as
not taken, so arrange the fallthru as the common case.
 
-   ADDR_REG contains the guest address, and R1 contains the pointer
-   to TLB_ENTRY.ADDR_READ.  We need to load TLB_ENTRY.ADDEND and
-   add it to ADDR_REG to get the host address.  */
+   R0 contains the guest address, and R1 contains the pointer
+   to CPU_ENV plus the TLB entry offset.  */
 
 tcg_out_ld(s, TCG_TYPE_I64, r1, r1,
-   offsetof(CPUTLBEntry, addend)
-   - offsetof(CPUTLBEntry, addr_read));
-
-if (TARGET_LONG_BITS == 32) {
-tcg_out_extend(s, 2, addr_reg, r0);
-addr_reg = r0;
-}
-
-tcg_out_fmt_opr(s, INSN_ADDQ, addr_reg, r1, r0);
+   offsetof(CPUState, tlb_table[mem_index][0].addend));
+tcg_out_fmt_opr(s, INSN_ADDQ, r0, r1, r0);
 val = 0;
 #else
 r0 = addr_reg;
@@ -841,20 +837,12 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg 
*args, int sizeop)
 /* TLB Hit.  Note that Alpha statically predicts forward branch as
not taken, so arrange the fallthru as the common case.
 
-   ADDR_REG contains the guest address, and R1 contains the pointer
-   to TLB_ENTRY.ADDR_READ.  We need to load TLB_ENTRY.ADDEND and
-   add it to ADDR_REG to get the host address.  */
+   R0 contains the guest address, and R1 contains the pointer
+   to CPU_ENV plus the TLB entry offset.  */
 
 tcg_out_ld(s, TCG_TYPE_I64, r1, r1,
-   offsetof(CPUTLBEntry, addend)
-   - offsetof(CPUTLBEntry, addr_write));
-
-if (TARGET_LONG_BITS == 32) {
-tcg_out_extend(s, 2, addr_reg, r0);
-addr_reg = r0;
-}
-
-tcg_out_fmt_opr(s, INSN_ADDQ, addr_reg, r1, r0);
+   offsetof(CPUState, tlb_table[mem_index][0].addend));
+

[Qemu-devel] [PATCH] Build and install more documentation formats

2010-01-31 Thread Dirk Ullrich
Hi,

I have patched QEMU's configure script and its main makefile: Now
QEMU's documentation is also created in PDF format (using texi2pdf),
and the targets install-all-doc / install-all install
documentation in INFO and PDF format, too. May be others find this
feature useful.

Dirk

For response please CC me since I am no qemu-devel subscriber (yet).

diff --git a/Makefile b/Makefile
index 3848627..641fdbd 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,8 @@ endif
 Makefile: ;
 configure: ;

-.PHONY: all clean cscope distclean dvi html info install install-doc \
+.PHONY: all clean cscope distclean dvi pdf html info install install-all \
+   install-nodoc install-doc install-all-doc \
recurse-all speed tar tarbin test build-all

 $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
@@ -34,6 +35,12 @@ else
 DOCS=
 endif

+ifdef BUILD_DOCS
+MORE_DOCS=qemu-doc.pdf qemu-tech.pdf qemu-doc.info qemu-tech.info
+else
+MORE_DOCS=
+endif
+
 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
 SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))

@@ -65,7 +72,7 @@ defconfig:

 -include config-all-devices.mak

-build-all: $(DOCS) $(TOOLS) recurse-all
+build-all: $(DOCS) $(MORE_DOCS) $(TOOLS) recurse-all

 config-host.h: config-host.h-timestamp
 config-host.h-timestamp: config-host.mak
@@ -160,7 +167,7 @@ distclean: clean
rm -f config-host.mak config-host.h* config-host.ld $(DOCS)
qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
rm -f config-all-devices.mak
rm -f roms/seabios/config.mak roms/vgabios/config.mak
-   rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
+   rm -f qemu-{doc,tech}.{info,aux,cp,dvi,pdf,fn,info,ky,log,pg,toc,tp,vr}
for d in $(TARGET_DIRS) libhw32 libhw64 libuser; do \
rm -rf $$d || exit 1 ; \
 done
@@ -191,7 +198,19 @@ ifdef CONFIG_POSIX
$(INSTALL_DATA) qemu-nbd.8 $(DESTDIR)$(mandir)/man8
 endif

-install: all $(if $(BUILD_DOCS),install-doc)
+install-all-doc: $(MORE_DOCS) install-doc
+   $(INSTALL_DIR) $(DESTDIR)$(docdir)
+   $(INSTALL_DATA) qemu-doc.pdf  qemu-tech.pdf $(DESTDIR)$(docdir)
+ifdef CONFIG_POSIX
+   $(INSTALL_DIR) $(DESTDIR)$(infodir)
+   $(INSTALL_DATA) qemu-doc.info  qemu-tech.info $(DESTDIR)$(infodir)
+   install-info --info-dir=$(DESTDIR)$(infodir) \
+   $(DESTDIR)$(infodir)/qemu-doc.info
+   install-info --info-dir=$(DESTDIR)$(infodir) \
+   $(DESTDIR)$(infodir)/qemu-tech.info
+endif
+
+install-nodoc: all
$(INSTALL_DIR) $(DESTDIR)$(bindir)
 ifneq ($(TOOLS),)
$(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) $(DESTDIR)$(bindir)
@@ -207,9 +226,13 @@ endif
$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x
$(DESTDIR)$(datadir)/keymaps; \
done
for d in $(TARGET_DIRS); do \
-   $(MAKE) -C $$d $@ || exit 1 ; \
+   $(MAKE) -C $$d install || exit 1 ; \
 done

+install: install-nodoc $(if $(BUILD_DOCS),install-doc)
+
+install-all: install-nodoc $(if $(BUILD_DOCS),install-all-doc)
+
 # various test targets
 test speed: all
$(MAKE) -C tests $@
@@ -233,6 +256,9 @@ cscope:
 %.dvi: %.texi
$(call quiet-command,texi2dvi -I . $,  GEN   $@)

+%.pdf: %.texi
+   $(call quiet-command,texi2pdf -I . $,  GEN   $@)
+
 qemu-options.texi: $(SRC_PATH)/qemu-options.hx
$(call quiet-command,sh $(SRC_PATH)/hxtool -t  $  $@,  GEN   $@)

@@ -266,7 +292,9 @@ dvi: qemu-doc.dvi qemu-tech.dvi

 html: qemu-doc.html qemu-tech.html

-qemu-doc.dvi qemu-doc.html qemu-doc.info: qemu-img.texi qemu-nbd.texi
qemu-options.texi qemu-monitor.texi qemu-img-cmds.texi
+pdf: qemu-doc.pdf qemu-tech.pdf
+
+qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: qemu-img.texi
qemu-nbd.texi qemu-options.texi qemu-monitor.texi qemu-img-cmds.texi

 VERSION ?= $(shell cat VERSION)
 FILE = qemu-$(VERSION)
diff --git a/configure b/configure
index 42ef628..27f9a75 100755
--- a/configure
+++ b/configure
@@ -1872,6 +1872,7 @@ if test $mingw32 = yes ; then
   prefix=c:/Program Files/Qemu
   fi
   mansuffix=
+  infosuffix=
   datasuffix=
   confsuffix=
   docsuffix=
@@ -1884,6 +1885,7 @@ else
   prefix=/usr/local
   fi
   mansuffix=/share/man
+  infosuffix=/share/info
   datasuffix=/share/qemu
   docsuffix=/share/doc/qemu
   binsuffix=/bin
@@ -1897,6 +1899,7 @@ echo BIOS directory$prefix$datasuffix
 echo binary directory  $prefix$binsuffix
 if test $mingw32 = no ; then
 echo Manual directory  $prefix$mansuffix
+echo Info directory$prefix$infosuffix
 echo ELF interp prefix $interp_prefix
 fi
 echo Source path   $source_path
@@ -2215,6 +2218,7 @@ echo ROMS=$roms  $config_host_mak
 echo prefix=$prefix  $config_host_mak
 echo bindir=\${prefix}$binsuffix  $config_host_mak
 echo mandir=\${prefix}$mansuffix  $config_host_mak
+echo infodir=\${prefix}$infosuffix  $config_host_mak
 echo datadir=\${prefix}$datasuffix  $config_host_mak
 echo sysconfdir=$sysconfdir  $config_host_mak
 echo