[Qemu-devel] [PATCH] define ENOMEDIUM if not defined

2007-01-18 Thread Pierre d'Herbemont

Hi,

This patch fix block.c build on Mac OS X/Darwin.

Pierre.

Index: block.c
===
RCS file: /sources/qemu/qemu/block.c,v
retrieving revision 1.40
diff -u -r1.40 block.c
--- block.c 7 Jan 2007 18:22:37 -   1.40
+++ block.c 18 Jan 2007 12:29:58 -
@@ -35,6 +35,10 @@
 #define SECTOR_BITS 9
 #define SECTOR_SIZE (1  SECTOR_BITS)
 
+#ifndefENOMEDIUM
+#defineENOMEDIUM ENODEV
+#endif
+
 typedef struct BlockDriverAIOCBSync {
 BlockDriverAIOCB common;
 QEMUBH *bh;
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] [PATCH] siginfo fix for Darwin/Mac OS X on PowerPC and cleanup

2007-01-18 Thread Pierre d'Herbemont

Hi,

This patch addresses cpu-exec.c compilation on Mac OS X/ppc. It also  
cleans up unused Macro definition.


Pierre.
Index: cpu-exec.c
===
RCS file: /sources/qemu/qemu/cpu-exec.c,v
retrieving revision 1.88
diff -u -r1.88 cpu-exec.c
--- cpu-exec.c  7 Dec 2006 18:28:42 -   1.88
+++ cpu-exec.c  18 Jan 2007 12:30:04 -
@@ -1334,51 +1334,30 @@
 /* All Registers access - only for local access */
 # define REG_sig(reg_name, context)
((context)-uc_mcontext.regs-reg_name)
 /* Gpr Registers access  */
-# define GPR_sig(reg_num, context) REG_sig(gpr[reg_num], context)
 # define IAR_sig(context)  REG_sig(nip, context)   /* 
Program counter */
-# define MSR_sig(context)  REG_sig(msr, context)   /* 
Machine State Register (Supervisor) */
-# define CTR_sig(context)  REG_sig(ctr, context)   /* 
Count register */
-# define XER_sig(context)  REG_sig(xer, context) /* User's 
integer exception register */
-# define LR_sig(context)   REG_sig(link, context) /* Link 
register */
-# define CR_sig(context)   REG_sig(ccr, context) /* 
Condition register */
-/* Float Registers access  */
-# define FLOAT_sig(reg_num, context)   
(((double*)((char*)((context)-uc_mcontext.regs+48*4)))[reg_num])
 # define FPSCR_sig(context)
(*(int*)((char*)((context)-uc_mcontext.regs+(48+32*2)*4)))
 /* Exception Registers access */
-# define DAR_sig(context)  REG_sig(dar, context)
 # define DSISR_sig(context)REG_sig(dsisr, context)
 # define TRAP_sig(context) REG_sig(trap, context)
 #endif /* linux */
 
 #ifdef __APPLE__
 # include sys/ucontext.h
-typedef struct ucontext SIGCONTEXT;
 /* All Registers access - only for local access */
 # define REG_sig(reg_name, context)
((context)-uc_mcontext-ss.reg_name)
-# define FLOATREG_sig(reg_name, context)   
((context)-uc_mcontext-fs.reg_name)
 # define EXCEPREG_sig(reg_name, context)   
((context)-uc_mcontext-es.reg_name)
-# define VECREG_sig(reg_name, context) 
((context)-uc_mcontext-vs.reg_name)
 /* Gpr Registers access */
-# define GPR_sig(reg_num, context) REG_sig(r##reg_num, context)
 # define IAR_sig(context)  REG_sig(srr0, context)  /* 
Program counter */
-# define MSR_sig(context)  REG_sig(srr1, context)  /* 
Machine State Register (Supervisor) */
-# define CTR_sig(context)  REG_sig(ctr, context)
-# define XER_sig(context)  REG_sig(xer, context) /* Link 
register */
-# define LR_sig(context)   REG_sig(lr, context)  /* User's 
integer exception register */
-# define CR_sig(context)   REG_sig(cr, context)  /* 
Condition register */
-/* Float Registers access */
-# define FLOAT_sig(reg_num, context)   FLOATREG_sig(fpregs[reg_num], 
context)
-# define FPSCR_sig(context)((double)FLOATREG_sig(fpscr, 
context))
 /* Exception Registers access */
-# define DAR_sig(context)  EXCEPREG_sig(dar, context) 
/* Fault registers for coredump */
 # define DSISR_sig(context)EXCEPREG_sig(dsisr, context)
 # define TRAP_sig(context) EXCEPREG_sig(exception, 
context) /* number of powerpc exception taken */
 #endif /* __APPLE__ */
 
-int cpu_signal_handler(int host_signum, struct siginfo *info, 
+int cpu_signal_handler(int host_signum, struct siginfo *pinfo, 
void *puc)
 {
 struct ucontext *uc = puc;
+siginfo_t *info = pinfo;
 unsigned long pc;
 int is_write;
 
___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] [PATCH] darwin-user merge attempt - patch v3

2007-01-18 Thread Pierre d'Herbemont


On 17 janv. 07, at 23:13, Thiemo Seufer wrote:

I figure it needs some more work to keep the Linux build happy.


Oh sorry! Here goes the fix:


darwin_user.3.diff.txt.gz
Description: GNU Zip compressed data


Thanks for the report,

Pierre.___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] Tracking memory dirtying in QEMU

2007-01-18 Thread Fabrice Bellard

Anthony Liguori wrote:

Howdy,

I've been working on migration for QEMU and have run into a snag.  I've 
got a non-live migration patch that works quite happily[1].  I modified 
the save/restore code to not seek at all, and then basically pipe a save 
over a pipe to a subprocess (usually, ssh).


qumranet has written some code to do live migration too. IMHO, 
client/server code should be integrated in QEMU in order to ease the use 
of live migration.


Conceptually, adding support for live migration is really easy.  All I 
think I need to do is extend the current code, to have a pre-save hook 
that is activated before the VM is stopped.  This hook will be called 
until it says it's done and then the rest of the save/load handlers are 
invoked.  At first, I'm just going to do a pre-save handler for RAM 
which should significantly reduce the amount of down time.  I think the 
only other device we'll have to handle specially is the VGA memory but 
I'm happy to ignore that for now.


So, all I really need is to be able to track which pages are dirtied.  I 
also need the a method to reset the dirty map.


I started looking at adding another map like phys_ram_dirty.  That seems 
to work for some of the IO_MEM_RAM pages, but not all.  My initial 
thought is that all memory operations should go through one of the 
st[bwl]_phys functions but that doesn't seem to be the case.


Can anyone provide me with some advice on how to do this?  Am I right in 
assuming that all IO will go through some function?


RAM access is not handled via I/O for efficiency, but the phys_ram_dirty 
flags are always up to date. In order to use it, you must allocate one 
bit in the dirty flags not used by QEMU and kqemu. Then you can use:


cpu_physical_memory_reset_dirty() to mark a page as not dirty and 
cpu_physical_memory_get_dirty() to test for dirtiness.


Note that for performance reasons the dirty bits are not handled while 
QEMU modifies the A and D bits in the PTEs and it can be a problem for 
your application.


FYI, the dirty bits are currently used in QEMU to optimize VGA refreshs 
and to track self modifying code. They are also used internally by kqemu.


Regards,

Fabrice.


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] qemu Makefile.target configure gdbstub.c darwin...

2007-01-18 Thread Thiemo Seufer
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Thiemo Seufer ths 07/01/18 20:06:33

Modified files:
.  : Makefile.target configure gdbstub.c 
Added files:
darwin-user: commpage.c ioctls.h ioctls_types.h machload.c 
 main.c mmap.c qemu.h signal.c syscall.c 
 syscalls.h 

Log message:
Darwin userspace emulation, by Pierre d'Herbemont.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/Makefile.target?cvsroot=qemur1=1.137r2=1.138
http://cvs.savannah.gnu.org/viewcvs/qemu/configure?cvsroot=qemur1=1.118r2=1.119
http://cvs.savannah.gnu.org/viewcvs/qemu/gdbstub.c?cvsroot=qemur1=1.42r2=1.43
http://cvs.savannah.gnu.org/viewcvs/qemu/darwin-user/commpage.c?cvsroot=qemurev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/darwin-user/ioctls.h?cvsroot=qemurev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/darwin-user/ioctls_types.h?cvsroot=qemurev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/darwin-user/machload.c?cvsroot=qemurev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/darwin-user/main.c?cvsroot=qemurev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/darwin-user/mmap.c?cvsroot=qemurev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/darwin-user/qemu.h?cvsroot=qemurev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/darwin-user/signal.c?cvsroot=qemurev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/darwin-user/syscall.c?cvsroot=qemurev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/darwin-user/syscalls.h?cvsroot=qemurev=1.1


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


[Qemu-devel] qemu Changelog

2007-01-18 Thread Thiemo Seufer
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Thiemo Seufer ths 07/01/18 22:14:53

Modified files:
.  : Changelog 

Log message:
Add Darwin userspace emulation to Changelog.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/Changelog?cvsroot=qemur1=1.126r2=1.127


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] [PATCH] siginfo fix for Darwin/Mac OS X on PowerPC and cleanup

2007-01-18 Thread Thiemo Seufer
Pierre d'Herbemont wrote:
 Hi,
 
 This patch addresses cpu-exec.c compilation on Mac OS X/ppc. It also  
 cleans up unused Macro definition.
 
 Pierre.

 Index: cpu-exec.c
 ===
 RCS file: /sources/qemu/qemu/cpu-exec.c,v
 retrieving revision 1.88
 diff -u -r1.88 cpu-exec.c
 --- cpu-exec.c7 Dec 2006 18:28:42 -   1.88
 +++ cpu-exec.c18 Jan 2007 12:30:04 -
 @@ -1334,51 +1334,30 @@
  /* All Registers access - only for local access */
  # define REG_sig(reg_name, context)  
 ((context)-uc_mcontext.regs-reg_name)
  /* Gpr Registers access  */
 -# define GPR_sig(reg_num, context)   REG_sig(gpr[reg_num], context)
  # define IAR_sig(context)REG_sig(nip, context)   /* 
 Program counter */
 -# define MSR_sig(context)REG_sig(msr, context)   /* 
 Machine State Register (Supervisor) */
 -# define CTR_sig(context)REG_sig(ctr, context)   /* 
 Count register */
 -# define XER_sig(context)REG_sig(xer, context) /* User's 
 integer exception register */
 -# define LR_sig(context) REG_sig(link, context) /* Link 
 register */
 -# define CR_sig(context) REG_sig(ccr, context) /* 
 Condition register */
 -/* Float Registers access  */
 -# define FLOAT_sig(reg_num, context) 
 (((double*)((char*)((context)-uc_mcontext.regs+48*4)))[reg_num])
  # define FPSCR_sig(context)  
 (*(int*)((char*)((context)-uc_mcontext.regs+(48+32*2)*4)))
  /* Exception Registers access */
 -# define DAR_sig(context)REG_sig(dar, context)
  # define DSISR_sig(context)  REG_sig(dsisr, context)
  # define TRAP_sig(context)   REG_sig(trap, context)
  #endif /* linux */
  
  #ifdef __APPLE__
  # include sys/ucontext.h
 -typedef struct ucontext SIGCONTEXT;
  /* All Registers access - only for local access */
  # define REG_sig(reg_name, context)  
 ((context)-uc_mcontext-ss.reg_name)
 -# define FLOATREG_sig(reg_name, context) 
 ((context)-uc_mcontext-fs.reg_name)
  # define EXCEPREG_sig(reg_name, context) 
 ((context)-uc_mcontext-es.reg_name)
 -# define VECREG_sig(reg_name, context)   
 ((context)-uc_mcontext-vs.reg_name)
  /* Gpr Registers access */
 -# define GPR_sig(reg_num, context)   REG_sig(r##reg_num, context)
  # define IAR_sig(context)REG_sig(srr0, context)  /* 
 Program counter */
 -# define MSR_sig(context)REG_sig(srr1, context)  /* 
 Machine State Register (Supervisor) */
 -# define CTR_sig(context)REG_sig(ctr, context)
 -# define XER_sig(context)REG_sig(xer, context) /* Link 
 register */
 -# define LR_sig(context) REG_sig(lr, context)  /* User's 
 integer exception register */
 -# define CR_sig(context) REG_sig(cr, context)  /* 
 Condition register */
 -/* Float Registers access */
 -# define FLOAT_sig(reg_num, context) FLOATREG_sig(fpregs[reg_num], 
 context)
 -# define FPSCR_sig(context)  ((double)FLOATREG_sig(fpscr, 
 context))
  /* Exception Registers access */
 -# define DAR_sig(context)EXCEPREG_sig(dar, context) 
 /* Fault registers for coredump */
  # define DSISR_sig(context)  EXCEPREG_sig(dsisr, context)
  # define TRAP_sig(context)   EXCEPREG_sig(exception, 
 context) /* number of powerpc exception taken */
  #endif /* __APPLE__ */

It might be better to keep the full set around for documentation.

 -int cpu_signal_handler(int host_signum, struct siginfo *info, 
 +int cpu_signal_handler(int host_signum, struct siginfo *pinfo, 
 void *puc)
  {
  struct ucontext *uc = puc;
 +siginfo_t *info = pinfo;
  unsigned long pc;
  int is_write;

Why does this make a difference?


Thiemo


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Re: [Qemu-devel] [PATCH] siginfo fix for Darwin/Mac OS X on PowerPC and cleanup

2007-01-18 Thread Pierre d'Herbemont


On 18 janv. 07, at 23:57, Thiemo Seufer wrote:



It might be better to keep the full set around for documentation.


It's a good point.


-int cpu_signal_handler(int host_signum, struct siginfo *info,
+int cpu_signal_handler(int host_signum, struct siginfo *pinfo,
void *puc)
 {
 struct ucontext *uc = puc;
+siginfo_t *info = pinfo;
 unsigned long pc;
 int is_write;


Why does this make a difference?


struct siginfo is not defined on darwin. (it works because struct  
siginfo is defined also as an anonymous structure in qemu header)


But after re-thinking, my patch is rather unelegant. I think we  
should definitely use a void * type for info, rather than using the  
anonymous struct siginfo trick. Any thought?


Pierre.


___
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel