summaryrefslogtreecommitdiff
path: root/usr/src/uts/intel/asm
diff options
context:
space:
mode:
authorRichard Lowe <richlowe@richlowe.net>2011-05-15 21:34:10 +0100
committerRichard Lowe <richlowe@richlowe.net>2011-05-15 21:34:10 +0100
commit6b7143d774683daf27dfb2e93ab48d1ade1a3477 (patch)
treefd02f5632a9d915059daa631435065339fb064db /usr/src/uts/intel/asm
parent9b7d742f0ee8ff89c05a8b5275d11359920ec60f (diff)
downloadillumos-joyent-6b7143d774683daf27dfb2e93ab48d1ade1a3477.tar.gz
2251 kernel inlines should support gcc 4
Reviewed by: Andrew Stormont <Andrew.Stormont@nexenta.com> Reviewed by: Milan Jurik <milan.jurik@xylab.cz> Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Joshua M. Clulow <josh@sysmgr.org> Reviewed by: Gordon Ross <gwr@nexenta.com> Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src/uts/intel/asm')
-rw-r--r--usr/src/uts/intel/asm/atomic.h48
-rw-r--r--usr/src/uts/intel/asm/bitmap.h65
-rw-r--r--usr/src/uts/intel/asm/byteorder.h25
-rw-r--r--usr/src/uts/intel/asm/clock.h9
-rw-r--r--usr/src/uts/intel/asm/cpu.h30
-rw-r--r--usr/src/uts/intel/asm/cpuvar.h6
-rw-r--r--usr/src/uts/intel/asm/htable.h18
-rw-r--r--usr/src/uts/intel/asm/mmu.h21
-rw-r--r--usr/src/uts/intel/asm/sunddi.h60
-rw-r--r--usr/src/uts/intel/asm/thread.h6
10 files changed, 159 insertions, 129 deletions
diff --git a/usr/src/uts/intel/asm/atomic.h b/usr/src/uts/intel/asm/atomic.h
index 8e0132967c..6dd675c613 100644
--- a/usr/src/uts/intel/asm/atomic.h
+++ b/usr/src/uts/intel/asm/atomic.h
@@ -27,8 +27,7 @@
#ifndef _ASM_ATOMIC_H
#define _ASM_ATOMIC_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
+#include <sys/ccompile.h>
#include <sys/types.h>
#ifdef __cplusplus
@@ -39,52 +38,57 @@ extern "C" {
#if defined(__amd64)
-extern __inline__ void atomic_or_long(ulong_t *target, ulong_t bits)
+extern __GNU_INLINE void
+atomic_or_long(ulong_t *target, ulong_t bits)
{
__asm__ __volatile__(
- "lock; orq %1, (%0)"
- : /* no output */
- : "r" (target), "r" (bits));
+ "lock; orq %1, (%0)"
+ : /* no output */
+ : "r" (target), "r" (bits));
}
-extern __inline__ void atomic_and_long(ulong_t *target, ulong_t bits)
+extern __GNU_INLINE void
+atomic_and_long(ulong_t *target, ulong_t bits)
{
__asm__ __volatile__(
- "lock; andq %1, (%0)"
- : /* no output */
- : "r" (target), "r" (bits));
+ "lock; andq %1, (%0)"
+ : /* no output */
+ : "r" (target), "r" (bits));
}
#ifdef notdef
-extern __inline__ uint64_t cas64(uint64_t *target, uint64_t cmp,
+extern __GNU_INLINE uint64_t
+cas64(uint64_t *target, uint64_t cmp,
uint64_t newval)
{
uint64_t retval;
__asm__ __volatile__(
- "movq %2, %%rax; lock; cmpxchgq %3, (%1)"
- : "=a" (retval)
- : "r" (target), "r" (cmp), "r" (newval));
+ "movq %2, %%rax; lock; cmpxchgq %3, (%1)"
+ : "=a" (retval)
+ : "r" (target), "r" (cmp), "r" (newval));
return (retval);
}
#endif
#elif defined(__i386)
-extern __inline__ void atomic_or_long(ulong_t *target, ulong_t bits)
+extern __GNU_INLINE void
+atomic_or_long(ulong_t *target, ulong_t bits)
{
__asm__ __volatile__(
- "lock; orl %1, (%0)"
- : /* no output */
- : "r" (target), "r" (bits));
+ "lock; orl %1, (%0)"
+ : /* no output */
+ : "r" (target), "r" (bits));
}
-extern __inline__ void atomic_and_long(ulong_t *target, ulong_t bits)
+extern __GNU_INLINE void
+atomic_and_long(ulong_t *target, ulong_t bits)
{
__asm__ __volatile__(
- "lock; andl %1, (%0)"
- : /* no output */
- : "r" (target), "r" (bits));
+ "lock; andl %1, (%0)"
+ : /* no output */
+ : "r" (target), "r" (bits));
}
#else
diff --git a/usr/src/uts/intel/asm/bitmap.h b/usr/src/uts/intel/asm/bitmap.h
index 650fb555e6..c72f52a8e7 100644
--- a/usr/src/uts/intel/asm/bitmap.h
+++ b/usr/src/uts/intel/asm/bitmap.h
@@ -27,8 +27,7 @@
#ifndef _ASM_BITMAP_H
#define _ASM_BITMAP_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
+#include <sys/ccompile.h>
#include <sys/types.h>
#ifdef __cplusplus
@@ -37,73 +36,73 @@ extern "C" {
#if !defined(__lint) && defined(__GNUC__)
-extern __inline__ int
+extern __GNU_INLINE int
highbit(ulong_t i)
{
long __value = -1l;
#if defined(__amd64)
__asm__(
- "bsrq %1,%0"
- : "+r" (__value)
- : "r" (i)
- : "cc");
+ "bsrq %1,%0"
+ : "+r" (__value)
+ : "r" (i)
+ : "cc");
#elif defined(__i386)
__asm__(
- "bsrl %1,%0"
- : "+r" (__value)
- : "r" (i)
- : "cc");
+ "bsrl %1,%0"
+ : "+r" (__value)
+ : "r" (i)
+ : "cc");
#else
#error "port me"
#endif
return ((int)(__value + 1));
}
-extern __inline__ int
+extern __GNU_INLINE int
lowbit(ulong_t i)
{
long __value = -1l;
#if defined(__amd64)
__asm__(
- "bsfq %1,%0"
- : "+r" (__value)
- : "r" (i)
- : "cc");
+ "bsfq %1,%0"
+ : "+r" (__value)
+ : "r" (i)
+ : "cc");
#elif defined(__i386)
__asm__(
- "bsfl %1,%0"
- : "+r" (__value)
- : "r" (i)
- : "cc");
+ "bsfl %1,%0"
+ : "+r" (__value)
+ : "r" (i)
+ : "cc");
#else
#error "port me"
#endif
return ((int)(__value + 1));
}
-extern __inline__ uint_t
+extern __GNU_INLINE uint_t
atomic_btr32(uint32_t *memory, uint_t bitnum)
{
uint8_t __value;
#if defined(__amd64)
__asm__ __volatile__(
- "lock;"
- "btrl %2, (%0);"
- "setc %1"
- : "+r" (memory), "+r" (__value)
- : "ir" (bitnum)
- : "cc");
+ "lock;"
+ "btrl %2, (%0);"
+ "setc %1"
+ : "+r" (memory), "+r" (__value)
+ : "ir" (bitnum)
+ : "cc");
#elif defined(__i386)
__asm__ __volatile__(
- "lock;"
- "btrl %2, (%0);"
- "setc %1"
- : "+r" (memory), "=r" (__value)
- : "ir" (bitnum)
- : "cc");
+ "lock;"
+ "btrl %2, (%0);"
+ "setc %1"
+ : "+r" (memory), "=r" (__value)
+ : "ir" (bitnum)
+ : "cc");
#else
#error "port me"
#endif
diff --git a/usr/src/uts/intel/asm/byteorder.h b/usr/src/uts/intel/asm/byteorder.h
index 615038f71b..3797d4f3f2 100644
--- a/usr/src/uts/intel/asm/byteorder.h
+++ b/usr/src/uts/intel/asm/byteorder.h
@@ -26,6 +26,7 @@
#ifndef _ASM_BYTEORDER_H
#define _ASM_BYTEORDER_H
+#include <sys/ccompile.h>
#include <sys/types.h>
#ifdef __cplusplus
@@ -44,7 +45,8 @@ extern "C" {
#if defined(__i386) || defined(__amd64)
-extern __inline__ uint16_t htons(uint16_t value)
+extern __GNU_INLINE uint16_t
+htons(uint16_t value)
{
#if defined(__amd64)
__asm__("xchgb %h0, %b0" : "+Q" (value));
@@ -54,7 +56,8 @@ extern __inline__ uint16_t htons(uint16_t value)
return (value);
}
-extern __inline__ uint16_t ntohs(uint16_t value)
+extern __GNU_INLINE uint16_t
+ntohs(uint16_t value)
{
#if defined(__amd64)
__asm__("xchgb %h0, %b0" : "+Q" (value));
@@ -64,26 +67,30 @@ extern __inline__ uint16_t ntohs(uint16_t value)
return (value);
}
-extern __inline__ uint32_t htonl(uint32_t value)
+extern __GNU_INLINE uint32_t
+htonl(uint32_t value)
{
__asm__("bswap %0" : "+r" (value));
return (value);
}
-extern __inline__ uint32_t ntohl(uint32_t value)
+extern __GNU_INLINE uint32_t
+ntohl(uint32_t value)
{
__asm__("bswap %0" : "+r" (value));
return (value);
}
#if defined(__amd64)
-extern __inline__ uint64_t htonll(uint64_t value)
+extern __GNU_INLINE uint64_t
+htonll(uint64_t value)
{
__asm__("bswapq %0" : "+r" (value));
return (value);
}
-extern __inline__ uint64_t ntohll(uint64_t value)
+extern __GNU_INLINE uint64_t
+ntohll(uint64_t value)
{
__asm__("bswapq %0" : "+r" (value));
return (value);
@@ -91,12 +98,14 @@ extern __inline__ uint64_t ntohll(uint64_t value)
#elif defined(__i386)
/* Use the htonl() and ntohl() inline functions defined above */
-extern __inline__ uint64_t htonll(uint64_t value)
+extern __GNU_INLINE uint64_t
+htonll(uint64_t value)
{
return (htonl(value >> 32) | ((uint64_t)htonl(value) << 32));
}
-extern __inline__ uint64_t ntohll(uint64_t value)
+extern __GNU_INLINE uint64_t
+ntohll(uint64_t value)
{
return (ntohl(value >> 32) | (uint64_t)ntohl(value) << 32);
}
diff --git a/usr/src/uts/intel/asm/clock.h b/usr/src/uts/intel/asm/clock.h
index 18adcf9f4d..26e33d0bb5 100644
--- a/usr/src/uts/intel/asm/clock.h
+++ b/usr/src/uts/intel/asm/clock.h
@@ -26,8 +26,7 @@
#ifndef _ASM_CLOCK_H
#define _ASM_CLOCK_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
+#include <sys/ccompile.h>
#include <sys/types.h>
#include <sys/time.h>
@@ -39,7 +38,8 @@ extern "C" {
#include <sys/machlock.h>
-extern __inline__ void unlock_hres_lock(void)
+extern __GNU_INLINE void
+unlock_hres_lock(void)
{
__asm__ __volatile__(
"lock; incl %0"
@@ -50,7 +50,8 @@ extern __inline__ void unlock_hres_lock(void)
#if defined(__xpv)
-extern __inline__ hrtime_t __rdtsc_insn(void)
+extern __GNU_INLINE hrtime_t
+__rdtsc_insn(void)
{
#if defined(__amd64)
uint32_t lobits, hibits;
diff --git a/usr/src/uts/intel/asm/cpu.h b/usr/src/uts/intel/asm/cpu.h
index d70608dc88..b8b6d9f5bf 100644
--- a/usr/src/uts/intel/asm/cpu.h
+++ b/usr/src/uts/intel/asm/cpu.h
@@ -26,6 +26,8 @@
#ifndef _ASM_CPU_H
#define _ASM_CPU_H
+#include <sys/ccompile.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -34,7 +36,7 @@ extern "C" {
#if defined(__i386) || defined(__amd64)
-extern __inline__ void
+extern __GNU_INLINE void
ht_pause(void)
{
__asm__ __volatile__(
@@ -48,7 +50,7 @@ ht_pause(void)
* older 32-bit processors, so define this as a no-op for now
*/
-extern __inline__ void
+extern __GNU_INLINE void
prefetch_read_many(void *addr)
{
#if defined(__amd64)
@@ -60,8 +62,8 @@ prefetch_read_many(void *addr)
#endif /* __amd64 */
}
-extern __inline__ void
-prefetch_read_once(void *addr)
+extern __GNU_INLINE void
+refetch_read_once(void *addr)
{
#if defined(__amd64)
__asm__(
@@ -72,7 +74,7 @@ prefetch_read_once(void *addr)
#endif /* __amd64 */
}
-extern __inline__ void
+extern __GNU_INLINE void
prefetch_write_many(void *addr)
{
#if defined(__amd64)
@@ -84,7 +86,7 @@ prefetch_write_many(void *addr)
#endif /* __amd64 */
}
-extern __inline__ void
+extern __GNU_INLINE void
prefetch_write_once(void *addr)
{
#if defined(__amd64)
@@ -98,21 +100,21 @@ prefetch_write_once(void *addr)
#if !defined(__xpv)
-extern __inline__ void
+extern __GNU_INLINE void
cli(void)
{
__asm__ __volatile__(
"cli" : : : "memory");
}
-extern __inline__ void
+extern __GNU_INLINE void
sti(void)
{
__asm__ __volatile__(
"sti");
}
-extern __inline__ void
+extern __GNU_INLINE void
i86_halt(void)
{
__asm__ __volatile__(
@@ -125,7 +127,7 @@ i86_halt(void)
#if defined(__amd64)
-extern __inline__ void
+extern __GNU_INLINE void
__set_ds(selector_t value)
{
__asm__ __volatile__(
@@ -134,7 +136,7 @@ __set_ds(selector_t value)
: "r" (value));
}
-extern __inline__ void
+extern __GNU_INLINE void
__set_es(selector_t value)
{
__asm__ __volatile__(
@@ -143,7 +145,7 @@ __set_es(selector_t value)
: "r" (value));
}
-extern __inline__ void
+extern __GNU_INLINE void
__set_fs(selector_t value)
{
__asm__ __volatile__(
@@ -152,7 +154,7 @@ __set_fs(selector_t value)
: "r" (value));
}
-extern __inline__ void
+extern __GNU_INLINE void
__set_gs(selector_t value)
{
__asm__ __volatile__(
@@ -163,7 +165,7 @@ __set_gs(selector_t value)
#if !defined(__xpv)
-extern __inline__ void
+extern __GNU_INLINE void
__swapgs(void)
{
__asm__ __volatile__(
diff --git a/usr/src/uts/intel/asm/cpuvar.h b/usr/src/uts/intel/asm/cpuvar.h
index f2712cd2e0..efb09d6651 100644
--- a/usr/src/uts/intel/asm/cpuvar.h
+++ b/usr/src/uts/intel/asm/cpuvar.h
@@ -27,8 +27,7 @@
#ifndef _ASM_CPUVAR_H
#define _ASM_CPUVAR_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
+#include <sys/ccompile.h>
#include <sys/types.h>
#ifdef __cplusplus
@@ -39,7 +38,8 @@ extern "C" {
struct cpu;
-extern __inline__ struct cpu *curcpup(void)
+extern __GNU_INLINE struct cpu *
+curcpup(void)
{
struct cpu *__value;
diff --git a/usr/src/uts/intel/asm/htable.h b/usr/src/uts/intel/asm/htable.h
index ced20e4c1b..dd1d72a3c1 100644
--- a/usr/src/uts/intel/asm/htable.h
+++ b/usr/src/uts/intel/asm/htable.h
@@ -27,8 +27,7 @@
#ifndef _ASM_HTABLE_H
#define _ASM_HTABLE_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
+#include <sys/ccompile.h>
#include <sys/types.h>
#ifdef __cplusplus
@@ -44,7 +43,8 @@ extern "C" {
* for some ia32 hat layer operations.
*/
-extern __inline__ void atomic_orb(uint8_t *addr, uint8_t value)
+extern __GNU_INLINE void
+atomic_orb(uint8_t *addr, uint8_t value)
{
__asm__ __volatile__(
"lock; orb %%dl,%0"
@@ -53,7 +53,8 @@ extern __inline__ void atomic_orb(uint8_t *addr, uint8_t value)
: "cc");
}
-extern __inline__ void atomic_andb(uint8_t *addr, uint8_t value)
+extern __GNU_INLINE void
+atomic_andb(uint8_t *addr, uint8_t value)
{
__asm__ __volatile__(
"lock; andb %%dl,%0"
@@ -62,7 +63,8 @@ extern __inline__ void atomic_andb(uint8_t *addr, uint8_t value)
: "cc");
}
-extern __inline__ void atomic_inc16(uint16_t *addr)
+extern __GNU_INLINE void
+atomic_inc16(uint16_t *addr)
{
__asm__ __volatile__(
"lock; incw %0"
@@ -71,7 +73,8 @@ extern __inline__ void atomic_inc16(uint16_t *addr)
: "cc");
}
-extern __inline__ void atomic_dec16(uint16_t *addr)
+extern __GNU_INLINE void
+atomic_dec16(uint16_t *addr)
{
__asm__ __volatile__(
"lock; decw %0"
@@ -80,7 +83,8 @@ extern __inline__ void atomic_dec16(uint16_t *addr)
: "cc");
}
-extern __inline__ void mmu_tlbflush_entry(caddr_t addr)
+extern __GNU_INLINE void
+mmu_tlbflush_entry(caddr_t addr)
{
__asm__ __volatile__(
"invlpg %0"
diff --git a/usr/src/uts/intel/asm/mmu.h b/usr/src/uts/intel/asm/mmu.h
index 68995f2f41..1be654759d 100644
--- a/usr/src/uts/intel/asm/mmu.h
+++ b/usr/src/uts/intel/asm/mmu.h
@@ -26,8 +26,7 @@
#ifndef _ASM_MMU_H
#define _ASM_MMU_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
+#include <sys/ccompile.h>
#include <sys/types.h>
#ifdef __cplusplus
@@ -38,7 +37,8 @@ extern "C" {
#if defined(__amd64)
-extern __inline__ ulong_t getcr3(void)
+extern __GNU_INLINE ulong_t
+getcr3(void)
{
uint64_t value;
@@ -48,7 +48,8 @@ extern __inline__ ulong_t getcr3(void)
return (value);
}
-extern __inline__ void setcr3(ulong_t value)
+extern __GNU_INLINE void
+setcr3(ulong_t value)
{
__asm__ __volatile__(
"movq %0, %%cr3"
@@ -56,14 +57,16 @@ extern __inline__ void setcr3(ulong_t value)
: "r" (value));
}
-extern __inline__ void reload_cr3(void)
+extern __GNU_INLINE void
+reload_cr3(void)
{
setcr3(getcr3());
}
#elif defined(__i386)
-extern __inline__ ulong_t getcr3(void)
+extern __GNU_INLINE ulong_t
+getcr3(void)
{
uint32_t value;
@@ -73,7 +76,8 @@ extern __inline__ ulong_t getcr3(void)
return (value);
}
-extern __inline__ void setcr3(ulong_t value)
+extern __GNU_INLINE void
+setcr3(ulong_t value)
{
__asm__ __volatile__(
"movl %0, %%cr3"
@@ -81,7 +85,8 @@ extern __inline__ void setcr3(ulong_t value)
: "r" (value));
}
-extern __inline__ void reload_cr3(void)
+extern __GNU_INLINE void
+reload_cr3(void)
{
setcr3(getcr3());
}
diff --git a/usr/src/uts/intel/asm/sunddi.h b/usr/src/uts/intel/asm/sunddi.h
index 0a6bb3b696..0b7025a622 100644
--- a/usr/src/uts/intel/asm/sunddi.h
+++ b/usr/src/uts/intel/asm/sunddi.h
@@ -27,8 +27,7 @@
#ifndef _ASM_SUNDDI_H
#define _ASM_SUNDDI_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
+#include <sys/ccompile.h>
#include <sys/types.h>
#ifdef __cplusplus
@@ -39,75 +38,82 @@ extern "C" {
#if defined(__i386) || defined(__amd64)
-extern __inline__ uint8_t inb(int port)
+extern __GNU_INLINE uint8_t
+inb(int port)
{
uint16_t port16 = (uint16_t)port;
uint8_t value;
__asm__ __volatile__(
- "inb (%1)" /* value in %al */
- : "=a" (value)
- : "d" (port16));
+ "inb (%1)" /* value in %al */
+ : "=a" (value)
+ : "d" (port16));
return (value);
}
-extern __inline__ uint16_t inw(int port)
+extern __GNU_INLINE uint16_t
+inw(int port)
{
uint16_t port16 = (uint16_t)port;
uint16_t value;
__asm__ __volatile__(
- "inw (%1)" /* value in %ax */
- : "=a" (value)
- : "d" (port16));
+ "inw (%1)" /* value in %ax */
+ : "=a" (value)
+ : "d" (port16));
return (value);
}
-extern __inline__ uint32_t inl(int port)
+extern __GNU_INLINE uint32_t
+inl(int port)
{
uint16_t port16 = (uint16_t)port;
uint32_t value;
__asm__ __volatile__(
- "inl (%1)" /* value in %eax */
- : "=a" (value)
- : "d" (port16));
+ "inl (%1)" /* value in %eax */
+ : "=a" (value)
+ : "d" (port16));
return (value);
}
-extern __inline__ void outb(int port, uint8_t value)
+extern __GNU_INLINE void
+outb(int port, uint8_t value)
{
uint16_t port16 = (uint16_t)port;
__asm__ __volatile__(
- "outb (%1)"
- : /* no output */
- : "a" (value), "d" (port16));
+ "outb (%1)"
+ : /* no output */
+ : "a" (value), "d" (port16));
}
-extern __inline__ void outw(int port, uint16_t value)
+extern __GNU_INLINE void
+outw(int port, uint16_t value)
{
uint16_t port16 = (uint16_t)port;
__asm__ __volatile__(
- "outw (%1)"
- : /* no output */
- : "a" (value), "d" (port16));
+ "outw (%1)"
+ : /* no output */
+ : "a" (value), "d" (port16));
}
-extern __inline__ void outl(int port, uint32_t value)
+extern __GNU_INLINE void
+outl(int port, uint32_t value)
{
uint16_t port16 = (uint16_t)port;
__asm__ __volatile__(
- "outl (%1)"
- : /* no output */
- : "a" (value), "d" (port16));
+ "outl (%1)"
+ : /* no output */
+ : "a" (value), "d" (port16));
}
#if defined(_BOOT)
-extern __inline__ void sync_instruction_memory(caddr_t v, size_t len)
+extern __GNU_INLINE void
+sync_instruction_memory(caddr_t v, size_t len)
{
__asm__ __volatile__("nop");
}
diff --git a/usr/src/uts/intel/asm/thread.h b/usr/src/uts/intel/asm/thread.h
index bdafb6b119..df3c211ccf 100644
--- a/usr/src/uts/intel/asm/thread.h
+++ b/usr/src/uts/intel/asm/thread.h
@@ -27,8 +27,7 @@
#ifndef _ASM_THREAD_H
#define _ASM_THREAD_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
+#include <sys/ccompile.h>
#include <sys/types.h>
#ifdef __cplusplus
@@ -46,7 +45,8 @@ struct _kthread;
* Yuck.
*/
-extern __inline__ struct _kthread *threadp(void)
+extern __GNU_INLINE struct _kthread
+*threadp(void)
{
void *__value;