17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 56e541dddSmrj * Common Development and Distribution License (the "License"). 66e541dddSmrj * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 2226a04d67SDave Plauger * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _ASM_CPU_H 277c478bd9Sstevel@tonic-gate #define _ASM_CPU_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #if !defined(__lint) && defined(__GNUC__) 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64) 367c478bd9Sstevel@tonic-gate 37*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 38*aca118b7Slucy wang - Sun Microsystems - Beijing China ht_pause(void) 397c478bd9Sstevel@tonic-gate { 407c478bd9Sstevel@tonic-gate __asm__ __volatile__( 417c478bd9Sstevel@tonic-gate "pause"); 427c478bd9Sstevel@tonic-gate } 437c478bd9Sstevel@tonic-gate 4494e7edb1Slucy wang - Sun Microsystems - Beijing China /* 4594e7edb1Slucy wang - Sun Microsystems - Beijing China * prefetch 64 bytes 4694e7edb1Slucy wang - Sun Microsystems - Beijing China * 4794e7edb1Slucy wang - Sun Microsystems - Beijing China * prefetch is an SSE extension which is not supported on 4894e7edb1Slucy wang - Sun Microsystems - Beijing China * older 32-bit processors, so define this as a no-op for now 4994e7edb1Slucy wang - Sun Microsystems - Beijing China */ 5094e7edb1Slucy wang - Sun Microsystems - Beijing China 51*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 52*aca118b7Slucy wang - Sun Microsystems - Beijing China prefetch_read_many(void *addr) 5394e7edb1Slucy wang - Sun Microsystems - Beijing China { 5494e7edb1Slucy wang - Sun Microsystems - Beijing China #if defined(__amd64) 5594e7edb1Slucy wang - Sun Microsystems - Beijing China __asm__( 5694e7edb1Slucy wang - Sun Microsystems - Beijing China "prefetcht0 (%0);" 5794e7edb1Slucy wang - Sun Microsystems - Beijing China "prefetcht0 32(%0);" 5894e7edb1Slucy wang - Sun Microsystems - Beijing China : /* no output */ 5994e7edb1Slucy wang - Sun Microsystems - Beijing China : "r" (addr)); 6094e7edb1Slucy wang - Sun Microsystems - Beijing China #endif /* __amd64 */ 6194e7edb1Slucy wang - Sun Microsystems - Beijing China } 6294e7edb1Slucy wang - Sun Microsystems - Beijing China 63*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 64*aca118b7Slucy wang - Sun Microsystems - Beijing China prefetch_read_once(void *addr) 6594e7edb1Slucy wang - Sun Microsystems - Beijing China { 6694e7edb1Slucy wang - Sun Microsystems - Beijing China #if defined(__amd64) 6794e7edb1Slucy wang - Sun Microsystems - Beijing China __asm__( 6894e7edb1Slucy wang - Sun Microsystems - Beijing China "prefetchnta (%0);" 6994e7edb1Slucy wang - Sun Microsystems - Beijing China "prefetchnta 32(%0);" 7094e7edb1Slucy wang - Sun Microsystems - Beijing China : /* no output */ 7194e7edb1Slucy wang - Sun Microsystems - Beijing China : "r" (addr)); 7294e7edb1Slucy wang - Sun Microsystems - Beijing China #endif /* __amd64 */ 7394e7edb1Slucy wang - Sun Microsystems - Beijing China } 7494e7edb1Slucy wang - Sun Microsystems - Beijing China 75*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 76*aca118b7Slucy wang - Sun Microsystems - Beijing China prefetch_write_many(void *addr) 7794e7edb1Slucy wang - Sun Microsystems - Beijing China { 7894e7edb1Slucy wang - Sun Microsystems - Beijing China #if defined(__amd64) 7994e7edb1Slucy wang - Sun Microsystems - Beijing China __asm__( 8094e7edb1Slucy wang - Sun Microsystems - Beijing China "prefetcht0 (%0);" 8194e7edb1Slucy wang - Sun Microsystems - Beijing China "prefetcht0 32(%0);" 8294e7edb1Slucy wang - Sun Microsystems - Beijing China : /* no output */ 8394e7edb1Slucy wang - Sun Microsystems - Beijing China : "r" (addr)); 8494e7edb1Slucy wang - Sun Microsystems - Beijing China #endif /* __amd64 */ 8594e7edb1Slucy wang - Sun Microsystems - Beijing China } 8694e7edb1Slucy wang - Sun Microsystems - Beijing China 87*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 88*aca118b7Slucy wang - Sun Microsystems - Beijing China prefetch_write_once(void *addr) 8994e7edb1Slucy wang - Sun Microsystems - Beijing China { 9094e7edb1Slucy wang - Sun Microsystems - Beijing China #if defined(__amd64) 9194e7edb1Slucy wang - Sun Microsystems - Beijing China __asm__( 9294e7edb1Slucy wang - Sun Microsystems - Beijing China "prefetcht0 (%0);" 9394e7edb1Slucy wang - Sun Microsystems - Beijing China "prefetcht0 32(%0);" 9494e7edb1Slucy wang - Sun Microsystems - Beijing China : /* no output */ 9594e7edb1Slucy wang - Sun Microsystems - Beijing China : "r" (addr)); 9694e7edb1Slucy wang - Sun Microsystems - Beijing China #endif /* __amd64 */ 9794e7edb1Slucy wang - Sun Microsystems - Beijing China } 9894e7edb1Slucy wang - Sun Microsystems - Beijing China 99843e1988Sjohnlev #if !defined(__xpv) 100843e1988Sjohnlev 101*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 102*aca118b7Slucy wang - Sun Microsystems - Beijing China cli(void) 1037c478bd9Sstevel@tonic-gate { 1047c478bd9Sstevel@tonic-gate __asm__ __volatile__( 1057c478bd9Sstevel@tonic-gate "cli" : : : "memory"); 1067c478bd9Sstevel@tonic-gate } 1077c478bd9Sstevel@tonic-gate 108*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 109*aca118b7Slucy wang - Sun Microsystems - Beijing China sti(void) 1107c478bd9Sstevel@tonic-gate { 1117c478bd9Sstevel@tonic-gate __asm__ __volatile__( 1127c478bd9Sstevel@tonic-gate "sti"); 1137c478bd9Sstevel@tonic-gate } 1147c478bd9Sstevel@tonic-gate 115*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 116*aca118b7Slucy wang - Sun Microsystems - Beijing China i86_halt(void) 1177c478bd9Sstevel@tonic-gate { 1187c478bd9Sstevel@tonic-gate __asm__ __volatile__( 1197c478bd9Sstevel@tonic-gate "sti; hlt"); 1207c478bd9Sstevel@tonic-gate } 1217c478bd9Sstevel@tonic-gate 122843e1988Sjohnlev #endif /* !__xpv */ 123843e1988Sjohnlev 1247c478bd9Sstevel@tonic-gate #endif /* __i386 || defined(__amd64) */ 1257c478bd9Sstevel@tonic-gate 1266e541dddSmrj #if defined(__amd64) 1276e541dddSmrj 128*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 129*aca118b7Slucy wang - Sun Microsystems - Beijing China __set_ds(selector_t value) 1306e541dddSmrj { 1316e541dddSmrj __asm__ __volatile__( 1326e541dddSmrj "movw %0, %%ds" 1336e541dddSmrj : /* no output */ 1346e541dddSmrj : "r" (value)); 1356e541dddSmrj } 1366e541dddSmrj 137*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 138*aca118b7Slucy wang - Sun Microsystems - Beijing China __set_es(selector_t value) 1396e541dddSmrj { 1406e541dddSmrj __asm__ __volatile__( 1416e541dddSmrj "movw %0, %%es" 1426e541dddSmrj : /* no output */ 1436e541dddSmrj : "r" (value)); 1446e541dddSmrj } 1456e541dddSmrj 146*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 147*aca118b7Slucy wang - Sun Microsystems - Beijing China __set_fs(selector_t value) 1486e541dddSmrj { 1496e541dddSmrj __asm__ __volatile__( 1506e541dddSmrj "movw %0, %%fs" 1516e541dddSmrj : /* no output */ 1526e541dddSmrj : "r" (value)); 1536e541dddSmrj } 1546e541dddSmrj 155*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 156*aca118b7Slucy wang - Sun Microsystems - Beijing China __set_gs(selector_t value) 1576e541dddSmrj { 1586e541dddSmrj __asm__ __volatile__( 1596e541dddSmrj "movw %0, %%gs" 1606e541dddSmrj : /* no output */ 1616e541dddSmrj : "r" (value)); 1626e541dddSmrj } 1636e541dddSmrj 164843e1988Sjohnlev #if !defined(__xpv) 165843e1988Sjohnlev 166*aca118b7Slucy wang - Sun Microsystems - Beijing China extern __inline__ void 167*aca118b7Slucy wang - Sun Microsystems - Beijing China __swapgs(void) 1686e541dddSmrj { 1696e541dddSmrj __asm__ __volatile__( 1706e541dddSmrj "mfence; swapgs"); 1716e541dddSmrj } 1726e541dddSmrj 173843e1988Sjohnlev #endif /* !__xpv */ 174843e1988Sjohnlev 1756e541dddSmrj #endif /* __amd64 */ 1766e541dddSmrj 1777c478bd9Sstevel@tonic-gate #endif /* !__lint && __GNUC__ */ 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1807c478bd9Sstevel@tonic-gate } 1817c478bd9Sstevel@tonic-gate #endif 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate #endif /* _ASM_CPU_H */ 184