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