Hi, me and a friend of mine working on a patch with which xen-tools build with the CFLAGS pie/pic and stack-protection. We saw, that everything builds expect of xen-detect. We developed a patch with which xen-detect builds and we can execute the binary after that, but we dont get the right information, that for example we are running a PV fedora domain. Maybe someone, who is better in assembly than we are can give us some hints. thanx and bye Ben xen-detect: Change assembly cpuinfo code that allows this to be built with -fPIC. diff -r 4b0692880dfa tools/misc/xen-detect.c --- a/tools/misc/xen-detect.c Thu May 05 17:40:34 2011 +0100 +++ b/tools/misc/xen-detect.c Fri May 06 17:14:46 2011 +0200 @@ -41,8 +41,20 @@ int pv_context) { asm volatile ( - "test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid" - : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) + "test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ;" +#if defined(__PIC__)&& defined(__i386__) + "1: pushl %%ebx;" + "cpuid;" + "movl %%ebx,%%esi;" + "popl %%ebx" + : "=S" (*ebx), +#else + "1: cpuid" + : "=b" (*ebx), +#endif + "=a" (*eax), + "=c" (*ecx), + "=d" (*edx) : "0" (idx), "1" (pv_context) ); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Hi, me and a friend of mine working on a patch with which xen-tools build with the CFLAGS pie/pic and stack-protection. We saw, that everything builds expect of xen-detect. We developed a patch with which xen-detect builds and we can execute the binary after that, but we dont get the right information, that for example we are running a PV fedora domain. Maybe someone, who is better in assembly than we are can give us some hints. thanx and bye Ben xen-detect: Change assembly cpuinfo code that allows this to be built with -fPIC. diff -r 4b0692880dfa tools/misc/xen-detect.c --- a/tools/misc/xen-detect.c Thu May 05 17:40:34 2011 +0100 +++ b/tools/misc/xen-detect.c Fri May 06 17:14:46 2011 +0200 @@ -41,8 +41,20 @@ int pv_context) { asm volatile ( - "test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid" - : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) + "test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ;" +#if defined(__PIC__)&& defined(__i386__) + "1: pushl %%ebx;" + "cpuid;" + "movl %%ebx,%%esi;" + "popl %%ebx" + : "=S" (*ebx), +#else + "1: cpuid" + : "=b" (*ebx), +#endif + "=a" (*eax), + "=c" (*ecx), + "=d" (*edx) : "0" (idx), "1" (pv_context) ); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 15/06/2011 12:28, "Benjamin Schweikert" <b.schweikert@googlemail.com> wrote:> Hi, > > me and a friend of mine working on a patch with which xen-tools build with the > CFLAGS pie/pic and stack-protection. We saw, that everything builds expect of > xen-detect. We developed a patch with which xen-detect builds and we can > execute the binary after that, but we dont get the right information, that for > example we are running a PV fedora domain. Maybe someone, who is better in > assembly than we are can give us some hints.Try the attached patch. I can apply it to xen-unstable if it works okay for you. -- Keir> thanx and bye > > Ben > > xen-detect: Change assembly cpuinfo code that allows this to be built with > -fPIC. > > diff -r 4b0692880dfa tools/misc/xen-detect.c > --- a/tools/misc/xen-detect.c Thu May 05 17:40:34 2011 +0100 > +++ b/tools/misc/xen-detect.c Fri May 06 17:14:46 2011 +0200 > @@ -41,8 +41,20 @@ > int pv_context) > { > asm volatile ( > - "test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid" > - : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) > + "test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ;" > +#if defined(__PIC__)&& defined(__i386__) > + "1: pushl %%ebx;" > + "cpuid;" > + "movl %%ebx,%%esi;" > + "popl %%ebx" > + : "=S" (*ebx), > +#else > + "1: cpuid" > + : "=b" (*ebx), > +#endif > + "=a" (*eax), > + "=c" (*ecx), > + "=d" (*edx) > : "0" (idx), "1" (pv_context) ); > } > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel