Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
descrambler: re-add %ebx saving
The %ebx saving is necessary when the compiler is generating
position-indepent code.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
  • Loading branch information
swegener authored and perexg committed Nov 9, 2015
1 parent 44746cf commit 4f18ff1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/descrambler/ffdecsa/ffdecsa_interface.c
Expand Up @@ -118,9 +118,12 @@ static inline void
native_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
{
asm volatile("cpuid"
/* saving ebx is necessary for PIC compatibility */
asm volatile("mov %%"REG_b", %%"REG_S"\n\t"
"cpuid\n\t"
"xchg %%"REG_b", %%"REG_S
: "=a" (*eax),
"=b" (*ebx),
"=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "0" (*eax), "2" (*ecx));
Expand Down

2 comments on commit 4f18ff1

@matthuisman
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am getting this error now when trying to compile

src/descrambler/ffdecsa/ffdecsa_interface.c: In function 'native_cpuid':
src/descrambler/ffdecsa/ffdecsa_interface.c:122:24: error: expected ':' or ')' before 'REG_b'
asm volatile("mov %%"REG_b", %%"REG_S"\n\t"

@matthuisman
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverting back to previous version of this file

{
asm volatile("cpuid"
: "=a" (_eax),
"=b" (_ebx),
"=c" (_ecx),
"=d" (_edx)
: "0" (_eax), "2" (_ecx));
}

https://github.com/tvheadend/tvheadend/blob/9a7c9688e71839ceccce28815b597a4858c5ff05/src/descrambler/ffdecsa/ffdecsa_interface.c
fixed compilation error

Please sign in to comment.