1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/*
* Copyright (C) 2006, 2011 Free Software Foundation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _MACHINE_LOCORE_H_
#define _MACHINE_LOCORE_H_
#include <sys/types.h>
#include <kern/sched_prim.h>
/*
* Fault recovery in copyin/copyout routines.
*/
struct recovery {
int fault_addr;
int recover_addr;
};
extern struct recovery recover_table[];
extern struct recovery recover_table_end[];
/*
* Recovery from Successful fault in copyout does not
* return directly - it retries the pte check, since
* the 386 ignores write protection in kernel mode.
*/
extern struct recovery retry_table[];
extern struct recovery retry_table_end[];
extern int call_continuation (continuation_t continuation);
extern int discover_x86_cpu_type (void);
extern int copyin (const void *userbuf, void *kernelbuf, size_t cn);
extern int copyinmsg (const void *userbuf, void *kernelbuf, size_t cn);
extern int copyout (const void *kernelbuf, void *userbuf, size_t cn);
extern int copyoutmsg (const void *kernelbuf, void *userbuf, size_t cn);
extern int inst_fetch (int eip, int cs);
extern void cpu_shutdown (void);
extern unsigned int cpu_features[1];
#define CPU_FEATURE_FPU 0
#define CPU_FEATURE_VME 1
#define CPU_FEATURE_DE 2
#define CPU_FEATURE_PSE 3
#define CPU_FEATURE_TSC 4
#define CPU_FEATURE_MSR 5
#define CPU_FEATURE_PAE 6
#define CPU_FEATURE_MCE 7
#define CPU_FEATURE_CX8 8
#define CPU_FEATURE_APIC 9
#define CPU_FEATURE_SEP 11
#define CPU_FEATURE_MTRR 12
#define CPU_FEATURE_PGE 13
#define CPU_FEATURE_MCA 14
#define CPU_FEATURE_CMOV 15
#define CPU_FEATURE_PAT 16
#define CPU_FEATURE_PSE_36 17
#define CPU_FEATURE_PSN 18
#define CPU_FEATURE_CFLSH 19
#define CPU_FEATURE_DS 21
#define CPU_FEATURE_ACPI 22
#define CPU_FEATURE_MMX 23
#define CPU_FEATURE_FXSR 24
#define CPU_FEATURE_SSE 25
#define CPU_FEATURE_SSE2 26
#define CPU_FEATURE_SS 27
#define CPU_FEATURE_HTT 28
#define CPU_FEATURE_TM 29
#define CPU_FEATURE_PBE 31
#define CPU_HAS_FEATURE(feature) (cpu_features[(feature) / 32] & (1 << ((feature) % 32)))
#endif /* _MACHINE__LOCORE_H_ */
|