1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

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, ...);
#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
__END_DECLS

View file

@ -70,7 +70,7 @@ struct lconv
const char* sortix_setlocale(int category, const char* locale);
#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
char* setlocale(int category, const char* locale);
#endif

View file

@ -35,25 +35,25 @@
__BEGIN_DECLS
__attribute__((unused))
static inline uint64_t rdmsr(uint32_t msrid)
static __inline uint64_t rdmsr(uint32_t msrid)
{
uint32_t low;
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;
}
__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 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;
}
__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);
*low = result >> 0 & 0xFFFFFFFF;
@ -61,7 +61,7 @@ static inline void rdmsr_split(uint32_t msrid, uint32_t* low, uint32_t* high)
}
__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);
}

View file

@ -100,9 +100,9 @@ const char* sortix_strerror_l(int, locale_t);
const char* sortix_strsignal(int signum);
#endif
#if defined(_SOURCE_SOURCE) && __SORTIX_STDLIB_REDIRECTS
const char* strerror(int errnum) asm ("sortix_strerror");
const char* strerror_l(int, locale_t) asm ("sortix_strerror_l");
const char* strsignal(int signum) asm ("sortix_strsignal");
const char* strerror(int errnum) __asm__ ("sortix_strerror");
const char* strerror_l(int, locale_t) __asm__ ("sortix_strerror_l");
const char* strsignal(int signum) __asm__ ("sortix_strsignal");
#else
char* strerror(int errnum);
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
generic implementation of system calls. */
#define SYSCALL_FUNCTION(syscall_name, syscall_index) \
asm("\n" \
__asm__("\n" \
".pushsection .text\n" \
".type " #syscall_name ", @function\n" \
#syscall_name ":\n" \