Fix non-portable asm keyword usage in in system header.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-04-28 13:50:11 +02:00
parent 57cddb5cc2
commit f2857047b0
5 changed files with 12 additions and 12 deletions

View File

@ -31,7 +31,7 @@ __BEGIN_DECLS
void gnu_error(int status, int errnum, const char* format, ...); void gnu_error(int status, int errnum, const char* format, ...);
#if __SORTIX_STDLIB_REDIRECTS #if __SORTIX_STDLIB_REDIRECTS
void error(int status, int errnum, const char* format, ...) asm("gnu_error"); void error(int status, int errnum, const char* format, ...) __asm__ ("gnu_error");
#endif #endif
__END_DECLS __END_DECLS

View File

@ -70,7 +70,7 @@ struct lconv
const char* sortix_setlocale(int category, const char* locale); const char* sortix_setlocale(int category, const char* locale);
#if defined(_SORTIX_SOURCE) && __SORTIX_STDLIB_REDIRECTS #if defined(_SORTIX_SOURCE) && __SORTIX_STDLIB_REDIRECTS
const char* setlocale(int category, const char* locale) asm("sortix_setlocale"); const char* setlocale(int category, const char* locale) __asm__ ("sortix_setlocale");
#else #else
char* setlocale(int category, const char* locale); char* setlocale(int category, const char* locale);
#endif #endif

View File

@ -35,25 +35,25 @@
__BEGIN_DECLS __BEGIN_DECLS
__attribute__((unused)) __attribute__((unused))
static inline uint64_t rdmsr(uint32_t msrid) static __inline uint64_t rdmsr(uint32_t msrid)
{ {
uint32_t low; uint32_t low;
uint32_t high; uint32_t high;
asm volatile ("rdmsr" : "=a"(low), "=d"(high) : "c"(msrid)); __asm__ __volatile__ ("rdmsr" : "=a"(low), "=d"(high) : "c"(msrid));
return (uint64_t) low << 0 | (uint64_t) high << 32; return (uint64_t) low << 0 | (uint64_t) high << 32;
} }
__attribute__((unused)) __attribute__((unused))
static inline uint64_t wrmsr(uint32_t msrid, uint64_t value) static __inline uint64_t wrmsr(uint32_t msrid, uint64_t value)
{ {
uint32_t low = value >> 0 & 0xFFFFFFFF; uint32_t low = value >> 0 & 0xFFFFFFFF;
uint32_t high = value >> 32 & 0xFFFFFFFF;; uint32_t high = value >> 32 & 0xFFFFFFFF;;
asm volatile ("wrmsr" : : "a"(low), "d"(high), "c"(msrid) : "memory"); __asm__ __volatile__ ("wrmsr" : : "a"(low), "d"(high), "c"(msrid) : "memory");
return value; return value;
} }
__attribute__((unused)) __attribute__((unused))
static inline void rdmsr_split(uint32_t msrid, uint32_t* low, uint32_t* high) static __inline void rdmsr_split(uint32_t msrid, uint32_t* low, uint32_t* high)
{ {
uint64_t result = rdmsr(msrid); uint64_t result = rdmsr(msrid);
*low = result >> 0 & 0xFFFFFFFF; *low = result >> 0 & 0xFFFFFFFF;
@ -61,7 +61,7 @@ static inline void rdmsr_split(uint32_t msrid, uint32_t* low, uint32_t* high)
} }
__attribute__((unused)) __attribute__((unused))
static inline void wrmsr_split(uint32_t msrid, uint32_t low, uint32_t high) static __inline void wrmsr_split(uint32_t msrid, uint32_t low, uint32_t high)
{ {
wrmsr(msrid, (uint64_t) low << 0 | (uint64_t) high << 32); wrmsr(msrid, (uint64_t) low << 0 | (uint64_t) high << 32);
} }

View File

@ -100,9 +100,9 @@ const char* sortix_strerror_l(int, locale_t);
const char* sortix_strsignal(int signum); const char* sortix_strsignal(int signum);
#endif #endif
#if defined(_SOURCE_SOURCE) && __SORTIX_STDLIB_REDIRECTS #if defined(_SOURCE_SOURCE) && __SORTIX_STDLIB_REDIRECTS
const char* strerror(int errnum) asm ("sortix_strerror"); const char* strerror(int errnum) __asm__ ("sortix_strerror");
const char* strerror_l(int, locale_t) asm ("sortix_strerror_l"); const char* strerror_l(int, locale_t) __asm__ ("sortix_strerror_l");
const char* strsignal(int signum) asm ("sortix_strsignal"); const char* strsignal(int signum) __asm__ ("sortix_strsignal");
#else #else
char* strerror(int errnum); char* strerror(int errnum);
char* strerror_l(int, locale_t); char* strerror_l(int, locale_t);

View File

@ -59,7 +59,7 @@
/* Create a function that selects the right system call and jumps into the /* Create a function that selects the right system call and jumps into the
generic implementation of system calls. */ generic implementation of system calls. */
#define SYSCALL_FUNCTION(syscall_name, syscall_index) \ #define SYSCALL_FUNCTION(syscall_name, syscall_index) \
asm("\n" \ __asm__("\n" \
".pushsection .text\n" \ ".pushsection .text\n" \
".type " #syscall_name ", @function\n" \ ".type " #syscall_name ", @function\n" \
#syscall_name ":\n" \ #syscall_name ":\n" \