All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] siginfo fix for Darwin/Mac OS X on PowerPC and cleanup
@ 2007-01-18 12:43 Pierre d'Herbemont
  2007-01-18 22:57 ` Thiemo Seufer
  0 siblings, 1 reply; 3+ messages in thread
From: Pierre d'Herbemont @ 2007-01-18 12:43 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 120 bytes --]

Hi,

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

Pierre.

[-- Attachment #2: darwin_ppc_siginfo_build_fix_and_cleanup.diff.txt --]
[-- Type: text/plain, Size: 3208 bytes --]

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 -0000	1.88
+++ cpu-exec.c	18 Jan 2007 12:30:04 -0000
@@ -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;
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] siginfo fix for Darwin/Mac OS X on PowerPC and cleanup
  2007-01-18 12:43 [Qemu-devel] [PATCH] siginfo fix for Darwin/Mac OS X on PowerPC and cleanup Pierre d'Herbemont
@ 2007-01-18 22:57 ` Thiemo Seufer
  2007-01-18 23:15   ` Pierre d'Herbemont
  0 siblings, 1 reply; 3+ messages in thread
From: Thiemo Seufer @ 2007-01-18 22:57 UTC (permalink / raw)
  To: Pierre d'Herbemont; +Cc: qemu-devel

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.c	7 Dec 2006 18:28:42 -0000	1.88
> +++ cpu-exec.c	18 Jan 2007 12:30:04 -0000
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] siginfo fix for Darwin/Mac OS X on PowerPC and cleanup
  2007-01-18 22:57 ` Thiemo Seufer
@ 2007-01-18 23:15   ` Pierre d'Herbemont
  0 siblings, 0 replies; 3+ messages in thread
From: Pierre d'Herbemont @ 2007-01-18 23:15 UTC (permalink / raw)
  To: qemu-devel


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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-18 23:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-18 12:43 [Qemu-devel] [PATCH] siginfo fix for Darwin/Mac OS X on PowerPC and cleanup Pierre d'Herbemont
2007-01-18 22:57 ` Thiemo Seufer
2007-01-18 23:15   ` Pierre d'Herbemont

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.