cpufunc.h (477a642cee98950f11ce12c94468b0156991a8eb) cpufunc.h (db7df99ff1096622d0f64d4c0621362e6cc3a429)
1/*-
2 * Copyright (c) 1993 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
1/*-
2 * Copyright (c) 1993 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $Id: cpufunc.h,v 1.62 1997/03/22 18:52:57 kato Exp $
33 * $Id: cpufunc.h,v 1.63 1997/04/26 11:45:36 peter Exp $
34 */
35
36/*
37 * Functions to provide access to special i386 instructions.
38 */
39
40#ifndef _MACHINE_CPUFUNC_H_
41#define _MACHINE_CPUFUNC_H_
42
43#include <sys/cdefs.h>
44#include <sys/types.h>
45#include <machine/smp.h>
46
34 */
35
36/*
37 * Functions to provide access to special i386 instructions.
38 */
39
40#ifndef _MACHINE_CPUFUNC_H_
41#define _MACHINE_CPUFUNC_H_
42
43#include <sys/cdefs.h>
44#include <sys/types.h>
45#include <machine/smp.h>
46
47#ifdef KERNEL
47#include "opt_smp.h"
48#include "opt_smp_invltlb.h"
48#include "opt_smp.h"
49#include "opt_smp_invltlb.h"
50#endif
49
50#ifdef __GNUC__
51
52static __inline void
53breakpoint(void)
54{
55 __asm __volatile("int $3");
56}

--- 143 unchanged lines hidden (view full) ---

200}
201
202static __inline void
203invd(void)
204{
205 __asm __volatile("invd");
206}
207
51
52#ifdef __GNUC__
53
54static __inline void
55breakpoint(void)
56{
57 __asm __volatile("int $3");
58}

--- 143 unchanged lines hidden (view full) ---

202}
203
204static __inline void
205invd(void)
206{
207 __asm __volatile("invd");
208}
209
208#if defined(SMP) && defined(SMP_INVLTLB)
210#if defined(SMP) && defined(SMP_INVLTLB) && defined(KERNEL)
209
210/*
211 * When using APIC IPI's, the inlining cost is prohibitive..
212 */
213void invlpg __P((u_int addr));
214void invltlb __P((void));
215
216#else

--- 10 unchanged lines hidden (view full) ---

227 u_long temp;
228 /*
229 * This should be implemented as load_cr3(rcr3()) when load_cr3()
230 * is inlined.
231 */
232 __asm __volatile("movl %%cr3, %0; movl %0, %%cr3" : "=r" (temp)
233 : : "memory");
234}
211
212/*
213 * When using APIC IPI's, the inlining cost is prohibitive..
214 */
215void invlpg __P((u_int addr));
216void invltlb __P((void));
217
218#else

--- 10 unchanged lines hidden (view full) ---

229 u_long temp;
230 /*
231 * This should be implemented as load_cr3(rcr3()) when load_cr3()
232 * is inlined.
233 */
234 __asm __volatile("movl %%cr3, %0; movl %0, %%cr3" : "=r" (temp)
235 : : "memory");
236}
235#endif /* SMP && SMP_INVLTLB */
237#endif /* SMP && SMP_INVLTLB && KERNEL */
236
237static __inline u_short
238inw(u_int port)
239{
240 u_short data;
241
242 __asm __volatile("inw %%dx,%0" : "=a" (data) : "d" (port));
243 return (data);

--- 178 unchanged lines hidden ---
238
239static __inline u_short
240inw(u_int port)
241{
242 u_short data;
243
244 __asm __volatile("inw %%dx,%0" : "=a" (data) : "d" (port));
245 return (data);

--- 178 unchanged lines hidden ---