diff mbox

PATCH: Building qemu on OpenSolaris 2009.06 (SPARC) host

Message ID alpine.NEB.1.10.0911262026470.6761@otaku.freeshell.org
State New
Headers show

Commit Message

Palle Lyckegaard Nov. 26, 2009, 8:39 p.m. UTC
Hello brave qemu developers!

Attached are a few patches that will enable qemu to build on a 
OpenSolaris 2009.06 host.

Please consider to apply them to the repository.

Regards
Palle

Comments

Andreas Färber Nov. 27, 2009, 7:27 p.m. UTC | #1
Hello,

Am 26.11.2009 um 21:39 schrieb Palle Lyckegaard:

> Attached are a few patches that will enable qemu to build on a  
> OpenSolaris 2009.06 host.

I can ack the softfloat part (fixes redefinition warnings) and the tap  
part (fixes an unresolved symbol TFR).

But what does the cpu.h part fix?

Andreas
Palle Lyckegaard Nov. 28, 2009, 8:03 p.m. UTC | #2
On Fri, 27 Nov 2009, Andreas Färber wrote:

> I can ack the softfloat part (fixes redefinition warnings) and the tap part 
> (fixes an unresolved symbol TFR).
>
> But what does the cpu.h part fix?
>
> Andreas
>

Hi Andreas,

the cpu.h part is an attempt to avoid warnings about e.g. PSR_EF being 
redefined in /usr/include/v7/sys/privregs.h on my OpenSolaris 2009.06 
SPARC host.

Other redefines are PSR_ICC, PSR_PIL, PSR_S, ...

I consider the softfloat and the tap parts the most important of the three 
patches.

/Palle
Andreas Färber Nov. 28, 2009, 11:54 p.m. UTC | #3
Hi Palle,

Am 28.11.2009 um 21:03 schrieb Palle Lyckegaard:

> On Fri, 27 Nov 2009, Andreas Färber wrote:
>
>> I can ack the softfloat part (fixes redefinition warnings) and the  
>> tap part (fixes an unresolved symbol TFR).
>>
>> But what does the cpu.h part fix?
>
> the cpu.h part is an attempt to avoid warnings about e.g. PSR_EF  
> being redefined in /usr/include/v7/sys/privregs.h on my OpenSolaris  
> 2009.06 SPARC host.
>
> Other redefines are PSR_ICC, PSR_PIL, PSR_S, ...

Not having that v7 dir on amd64 here, did you check whether their  
values are really defined identically?
If not, it may be necessary to either #undef them first or to prefix  
them with TARGET_ as done for the user emulators...

Andreas
Palle Lyckegaard Nov. 29, 2009, 12:34 p.m. UTC | #4
On Sun, 29 Nov 2009, Andreas Färber wrote:

>
> Not having that v7 dir on amd64 here, did you check whether their values are 
> really defined identically?
> If not, it may be necessary to either #undef them first or to prefix them 
> with TARGET_ as done for the user emulators...
>

In which files are TARGET_ examples found (linux-user/strace.c?)
Andreas Färber Nov. 29, 2009, 2:42 p.m. UTC | #5
Am 29.11.2009 um 13:34 schrieb Palle Lyckegaard:

> On Sun, 29 Nov 2009, Andreas Färber wrote:
>
>>
>> Not having that v7 dir on amd64 here, did you check whether their  
>> values are really defined identically?
>> If not, it may be necessary to either #undef them first or to  
>> prefix them with TARGET_ as done for the user emulators...
>>
>
> In which files are TARGET_ examples found (linux-user/strace.c?)

Yes, for example. grep -r came up with this line among many others:

./linux-user/x86_64/termbits.h:#define TARGET_TIOCPKT_NOSTOP		16

I.e. if unavoidable, instead of #define PSR_XXX 123 one might need to  
#define TARGET_PSR_XXX 123 and change *all* uses of PSR_XXX to  
TARGET_PSR_XXX, so that Sun's and QEMU's definitions can live side by  
side. If your approach or #undef works correctly, that would seem less  
intrusive, therefore my question.

Andreas
Palle Lyckegaard Nov. 29, 2009, 8:09 p.m. UTC | #6
On Sun, 29 Nov 2009, Andreas Färber wrote:

> I.e. if unavoidable, instead of #define PSR_XXX 123 one might need to #define 
> TARGET_PSR_XXX 123 and change *all* uses of PSR_XXX to TARGET_PSR_XXX, so 
> that Sun's and QEMU's definitions can live side by side. If your approach or 
> #undef works correctly, that would seem less intrusive, therefore my 
> question.
>

So far I've located only the definitions FSR_FCC1 and FPSR_FEF as being 
differently defined in qemu and OpenSolaris SPARC.

In order to be as little intrusive as possible I will rework my patch for 
the cpu.h file so
- where the definitions in qemu and Solaris are equal: guard with an "if 
!defined(CONFIG_SOLARIS)"
- where the definitions in qemu and Solaris are not equal: add a TARGET_ 
prefix to the definitions

/Palle
Blue Swirl Nov. 30, 2009, 4:56 p.m. UTC | #7
On Sun, Nov 29, 2009 at 10:09 PM, Palle Lyckegaard <palle@lyckegaard.dk> wrote:
> On Sun, 29 Nov 2009, Andreas Färber wrote:
>
>> I.e. if unavoidable, instead of #define PSR_XXX 123 one might need to
>> #define TARGET_PSR_XXX 123 and change *all* uses of PSR_XXX to
>> TARGET_PSR_XXX, so that Sun's and QEMU's definitions can live side by side.
>> If your approach or #undef works correctly, that would seem less intrusive,
>> therefore my question.
>>
>
> So far I've located only the definitions FSR_FCC1 and FPSR_FEF as being
> differently defined in qemu and OpenSolaris SPARC.
>
> In order to be as little intrusive as possible I will rework my patch for
> the cpu.h file so
> - where the definitions in qemu and Solaris are equal: guard with an "if
> !defined(CONFIG_SOLARIS)"
> - where the definitions in qemu and Solaris are not equal: add a TARGET_
> prefix to the definitions

It's cleaner just to rename.

PSR_* are also used for Sparc64 %xcc and %icc, so ICC_  or something
similar would be better.
diff mbox

Patch

diff --git a/fpu/softfloat-native.h b/fpu/softfloat-native.h
index 0893ce3..592beca 100644
--- a/fpu/softfloat-native.h
+++ b/fpu/softfloat-native.h
@@ -21,7 +21,7 @@ 
  */
 #if defined(CONFIG_SOLARIS) && \
            ((CONFIG_SOLARIS_VERSION <= 9 ) || \
-           ((CONFIG_SOLARIS_VERSION >= 10) && (__GNUC__ < 4))) \
+           ((CONFIG_SOLARIS_VERSION == 10) && (__GNUC__ < 4))) \
     || (defined(__OpenBSD__) && (OpenBSD < 200811))
 /*
  * C99 7.12.3 classification macros
diff --git a/net/tap-solaris.c b/net/tap-solaris.c
index ef4e60c..05dcfc1 100644
--- a/net/tap-solaris.c
+++ b/net/tap-solaris.c
@@ -23,6 +23,7 @@ 
  */
 
 #include "net/tap.h"
+#include "sysemu.h"
 
 #include <sys/stat.h>
 #include <sys/ethernet.h>
diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h
index 63aead9..a742133 100644
--- a/target-sparc/cpu.h
+++ b/target-sparc/cpu.h
@@ -83,6 +83,7 @@ 
 #define PSR_OVF   (1 << PSR_OVF_SHIFT)
 #define PSR_CARRY_SHIFT 20
 #define PSR_CARRY (1 << PSR_CARRY_SHIFT)
+#if !defined(CONFIG_SOLARIS)
 #define PSR_ICC   (PSR_NEG|PSR_ZERO|PSR_OVF|PSR_CARRY)
 #define PSR_EF    (1<<12)
 #define PSR_PIL   0xf00
@@ -90,6 +91,7 @@ 
 #define PSR_PS    (1<<6)
 #define PSR_ET    (1<<5)
 #define PSR_CWP   0x1f
+#endif
 
 #define CC_SRC (env->cc_src)
 #define CC_SRC2 (env->cc_src2)
@@ -129,8 +131,9 @@  enum {
 #define PS_IE    (1<<1)
 #define PS_AG    (1<<0) /* v9, zero on UA2007 */
 
+#if !defined(CONFIG_SOLARIS)
 #define FPRS_FEF (1<<2)
-
+#endif
 #define HS_PRIV  (1<<2)
 #endif
 
@@ -187,7 +190,9 @@  enum {
 #define FSR_FTT_INVAL_FPR (6ULL << 14)
 
 #define FSR_FCC1_SHIFT 11
+#if !defined(CONFIG_SOLARIS)
 #define FSR_FCC1  (1ULL << FSR_FCC1_SHIFT)
+#endif
 #define FSR_FCC0_SHIFT 10
 #define FSR_FCC0  (1ULL << FSR_FCC0_SHIFT)