libroot/x86[_64]: relax asm constraints in tls_*() functions

This commit is contained in:
Pawel Dziepak
2014-05-04 02:40:04 +02:00
parent e08c932315
commit 634bc98a3c
3 changed files with 21 additions and 21 deletions
+7 -7
View File
@@ -30,8 +30,8 @@ tls_get(int32 index)
{ {
void *ret; void *ret;
__asm__ __volatile__ ( __asm__ __volatile__ (
"movl %%fs:(,%%edx, 4), %%eax \n\t" "movl %%fs:(, %1, 4), %0"
: "=a"(ret) : "d"(index) ); : "=r" (ret) : "r" (index));
return ret; return ret;
} }
@@ -40,9 +40,9 @@ tls_address(int32 index)
{ {
void **ret; void **ret;
__asm__ __volatile__ ( __asm__ __volatile__ (
"movl %%fs:0, %%eax \n\t" "movl %%fs:0, %0\n\t"
"leal (%%eax, %%edx, 4), %%eax \n\t" "leal (%0, %1, 4), %0\n\t"
: "=a"(ret) : "d"(index) ); : "=&r" (ret) : "r" (index));
return ret; return ret;
} }
@@ -50,8 +50,8 @@ static inline void
tls_set(int32 index, void *value) tls_set(int32 index, void *value)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"movl %%eax, %%fs:(,%%edx, 4) \n\t" "movl %1, %%fs:(, %0, 4)"
: : "d"(index), "a"(value) ); : : "r" (index), "r" (value));
} }
#else #else
+7 -7
View File
@@ -32,8 +32,8 @@ tls_get(int32 index)
{ {
void *ret; void *ret;
__asm__ __volatile__ ( __asm__ __volatile__ (
"movl %%fs:(,%%edx, 4), %%eax \n\t" "movl %%fs:(, %1, 4), %0"
: "=a"(ret) : "d"(index) ); : "=r" (ret) : "r" (index));
return ret; return ret;
} }
@@ -43,9 +43,9 @@ tls_address(int32 index)
{ {
void **ret; void **ret;
__asm__ __volatile__ ( __asm__ __volatile__ (
"movl %%fs:0, %%eax \n\t" "movl %%fs:0, %0\n\t"
"leal (%%eax, %%edx, 4), %%eax \n\t" "leal (%0, %1, 4), %0\n\t"
: "=a"(ret) : "d"(index) ); : "=&r" (ret) : "r" (index));
return ret; return ret;
} }
@@ -54,7 +54,7 @@ void
tls_set(int32 index, void *value) tls_set(int32 index, void *value)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"movl %%eax, %%fs:(,%%edx, 4) \n\t" "movl %1, %%fs:(, %0, 4)"
: : "d"(index), "a"(value) ); : : "r" (index), "r" (value));
} }
+7 -7
View File
@@ -35,8 +35,8 @@ tls_get(int32 _index)
void* ret; void* ret;
__asm__ __volatile__ ( __asm__ __volatile__ (
"movq %%fs:(, %%rdi, 8), %%rax" "movq %%fs:(, %1, 8), %0"
: "=a" (ret) : "D" (index)); : "=r" (ret) : "r" (index));
return ret; return ret;
} }
@@ -48,9 +48,9 @@ tls_address(int32 _index)
void** ret; void** ret;
__asm__ __volatile__ ( __asm__ __volatile__ (
"movq %%fs:0, %%rax\n\t" "movq %%fs:0, %0\n\t"
"leaq (%%rax, %%rdi, 8), %%rax\n\t" "leaq (%0, %1, 8), %0\n\t"
: "=a" (ret) : "D" (index)); : "=&r" (ret) : "r" (index));
return ret; return ret;
} }
@@ -60,6 +60,6 @@ tls_set(int32 _index, void* value)
{ {
int64 index = _index; int64 index = _index;
__asm__ __volatile__ ( __asm__ __volatile__ (
"movq %%rsi, %%fs:(, %%rdi, 8)" "movq %1, %%fs:(, %0, 8)"
: : "D" (index), "S" (value)); : : "r" (index), "r" (value));
} }