Message ID | 20100214201209.GA97896@triton8.kn-bremen.de |
---|---|
State | New |
Headers | show |
On Sun, 14 Feb 2010, Juergen Lock wrote: > Submitted by: Andreas Tobler <andreast@fgznet.ch> > > Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> > > --- a/cache-utils.c > +++ b/cache-utils.c > @@ -57,6 +57,23 @@ > } > #endif > > +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) > +#include <stdio.h> > +#include <sys/types.h> > +#include <sys/sysctl.h> > + > +static void ppc_init_cacheline_sizes(void) > +{ > + size_t len = 4; > + unsigned cacheline; > + > + sysctlbyname ("machdep.cacheline_size", &cacheline, &len, NULL, 0); Error handling missing. > + > + qemu_cache_conf.dcache_bsize = cacheline; > + qemu_cache_conf.icache_bsize = cacheline; > +} > +#endif > + > #ifdef __linux__ > void qemu_cache_utils_init(char **envp) > { > >
On Sun, 14 Feb 2010, Juergen Lock wrote: > Submitted by: Andreas Tobler <andreast@fgznet.ch> > > Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> > > --- a/cache-utils.c > +++ b/cache-utils.c > @@ -57,6 +57,23 @@ > } > #endif > > +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) __FreeBSD_kernel__ is for something like Debian/kFreeBSD? > +#include <stdio.h> > +#include <sys/types.h> > +#include <sys/sysctl.h> > + > +static void ppc_init_cacheline_sizes(void) > +{ > + size_t len = 4; > + unsigned cacheline; > + > + sysctlbyname ("machdep.cacheline_size", &cacheline, &len, NULL, 0); > + > + qemu_cache_conf.dcache_bsize = cacheline; > + qemu_cache_conf.icache_bsize = cacheline; > +} > +#endif > + > #ifdef __linux__ > void qemu_cache_utils_init(char **envp) > { > >
On Mon, Feb 15, 2010 at 06:16:07AM +0300, malc wrote: > On Sun, 14 Feb 2010, Juergen Lock wrote: > > > Submitted by: Andreas Tobler <andreast@fgznet.ch> > > > > Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> > > > > --- a/cache-utils.c > > +++ b/cache-utils.c > > @@ -57,6 +57,23 @@ > > } > > #endif > > > > +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) > > __FreeBSD_kernel__ is for something like Debian/kFreeBSD? Yep, it is. Support for it was added to qemu some time ago so I figured I should do the same. Cheers, Juergen
On Mon, 15 Feb 2010, Juergen Lock wrote: > On Mon, Feb 15, 2010 at 06:16:07AM +0300, malc wrote: > > On Sun, 14 Feb 2010, Juergen Lock wrote: > > > > > Submitted by: Andreas Tobler <andreast@fgznet.ch> > > > > > > Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> > > > > > > --- a/cache-utils.c > > > +++ b/cache-utils.c > > > @@ -57,6 +57,23 @@ > > > } > > > #endif > > > > > > +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) > > > > __FreeBSD_kernel__ is for something like Debian/kFreeBSD? > > Yep, it is. Support for it was added to qemu some time ago so I > figured I should do the same. > Perhaps it would be better to avoid this particular ifdefery and just go with _CALL_SYSV, can you verify that: ~$ gcc -E -dM -x c /dev/null | grep SYSV yields #define _CALL_SYSV 1 on FreeBSD and Debian/kFreeBSD?
On Tue, Feb 16, 2010 at 09:52:50AM +0300, malc wrote: > On Mon, 15 Feb 2010, Juergen Lock wrote: > > > On Mon, Feb 15, 2010 at 06:16:07AM +0300, malc wrote: > > > On Sun, 14 Feb 2010, Juergen Lock wrote: > > > > > > > Submitted by: Andreas Tobler <andreast@fgznet.ch> > > > > > > > > Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> > > > > > > > > --- a/cache-utils.c > > > > +++ b/cache-utils.c > > > > @@ -57,6 +57,23 @@ > > > > } > > > > #endif > > > > > > > > +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) > > > > > > __FreeBSD_kernel__ is for something like Debian/kFreeBSD? > > > > Yep, it is. Support for it was added to qemu some time ago so I > > figured I should do the same. > > > > Perhaps it would be better to avoid this particular ifdefery and > just go with _CALL_SYSV, can you verify that: > > ~$ gcc -E -dM -x c /dev/null | grep SYSV > > yields > > #define _CALL_SYSV 1 > > on FreeBSD and Debian/kFreeBSD? Nope, not found on FreeBSD. (Also I would kinda doubt that sysctl is standardized?) Cheers, Juergen
On Tue, 16 Feb 2010, Juergen Lock wrote: > On Tue, Feb 16, 2010 at 09:52:50AM +0300, malc wrote: > > On Mon, 15 Feb 2010, Juergen Lock wrote: > > > > > On Mon, Feb 15, 2010 at 06:16:07AM +0300, malc wrote: > > > > On Sun, 14 Feb 2010, Juergen Lock wrote: > > > > > > > > > Submitted by: Andreas Tobler <andreast@fgznet.ch> > > > > > > > > > > Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> > > > > > > > > > > --- a/cache-utils.c > > > > > +++ b/cache-utils.c > > > > > @@ -57,6 +57,23 @@ > > > > > } > > > > > #endif > > > > > > > > > > +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) > > > > > > > > __FreeBSD_kernel__ is for something like Debian/kFreeBSD? > > > > > > Yep, it is. Support for it was added to qemu some time ago so I > > > figured I should do the same. > > > > > > > Perhaps it would be better to avoid this particular ifdefery and > > just go with _CALL_SYSV, can you verify that: > > > > ~$ gcc -E -dM -x c /dev/null | grep SYSV > > > > yields > > > > #define _CALL_SYSV 1 > > > > on FreeBSD and Debian/kFreeBSD? > > Nope, not found on FreeBSD. (Also I would kinda doubt that sysctl is > standardized?) _CALL_SYSV means that calling convention is SysV one, nothing to do with sysctl, and i wanted you/patch author to run it on FreeBSD/PPC...
>> Nope, not found on FreeBSD. (Also I would kinda doubt that sysctl is >> standardized?) > > _CALL_SYSV means that calling convention is SysV one, nothing to do with > sysctl, and i wanted you/patch author to run it on FreeBSD/PPC... Yes, one of _CALL_SYSV, _CALL_AIX, _CALL_DARWIN is always defined by GCC on PPC. Don't know about other compilers. Paolo
On Tue, Feb 16, 2010 at 08:50:49PM +0100, Paolo Bonzini wrote: > > >> Nope, not found on FreeBSD. (Also I would kinda doubt that sysctl is > >> standardized?) > > > > _CALL_SYSV means that calling convention is SysV one, nothing to do with > > sysctl, and i wanted you/patch author to run it on FreeBSD/PPC... > > Yes, one of _CALL_SYSV, _CALL_AIX, _CALL_DARWIN is always defined by GCC > on PPC. Don't know about other compilers. Aaah, now I understand, malc meant this patch: [PATCH 3/3] Add FreeBSD/ppc host TCG_TARGET_CALL_{ALIGN_ARGS,STACK_OFFSET} definitions. not the ppc_init_cacheline_sizes() one, right? :) Anyway, I'll pass the question on... Juergen
On Tue, Feb 16, 2010 at 09:34:12PM +0100, Juergen Lock wrote: > On Tue, Feb 16, 2010 at 08:50:49PM +0100, Paolo Bonzini wrote: > > > > >> Nope, not found on FreeBSD. (Also I would kinda doubt that sysctl is > > >> standardized?) > > > > > > _CALL_SYSV means that calling convention is SysV one, nothing to do with > > > sysctl, and i wanted you/patch author to run it on FreeBSD/PPC... > > > > Yes, one of _CALL_SYSV, _CALL_AIX, _CALL_DARWIN is always defined by GCC > > on PPC. Don't know about other compilers. > > Aaah, now I understand, malc meant this patch: > [PATCH 3/3] Add FreeBSD/ppc host > TCG_TARGET_CALL_{ALIGN_ARGS,STACK_OFFSET} definitions. > not the ppc_init_cacheline_sizes() one, right? :) > > Anyway, I'll pass the question on... Yup, confirmed, _CALL_SYSV is defined on FreeBSD/ppc.
--- a/cache-utils.c +++ b/cache-utils.c @@ -57,6 +57,23 @@ } #endif +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#include <stdio.h> +#include <sys/types.h> +#include <sys/sysctl.h> + +static void ppc_init_cacheline_sizes(void) +{ + size_t len = 4; + unsigned cacheline; + + sysctlbyname ("machdep.cacheline_size", &cacheline, &len, NULL, 0); + + qemu_cache_conf.dcache_bsize = cacheline; + qemu_cache_conf.icache_bsize = cacheline; +} +#endif + #ifdef __linux__ void qemu_cache_utils_init(char **envp) {
Submitted by: Andreas Tobler <andreast@fgznet.ch> Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>