Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/* Project:     OSLib
2
 * Description: The OS Construction Kit
3
 * Date:                1.6.2000
4
 * Idea by:             Luca Abeni & Gerardo Lamastra
5
 *
6
 * OSLib is an SO project aimed at developing a common, easy-to-use
7
 * low-level infrastructure for developing OS kernels and Embedded
8
 * Applications; it partially derives from the HARTIK project but it
9
 * currently is independently developed.
10
 *
11
 * OSLib is distributed under GPL License, and some of its code has
12
 * been derived from the Linux kernel source; also some important
13
 * ideas come from studying the DJGPP go32 extender.
14
 *
15
 * We acknowledge the Linux Community, Free Software Foundation,
16
 * D.J. Delorie and all the other developers who believe in the
17
 * freedom of software and ideas.
18
 *
19
 * For legalese, check out the included GPL license.
20
 */
21
 
22
/*      Code & data fot CPU identification      */
23
 
24
#ifndef __LL_I386_HW_ARCH_H__
25
#define __LL_I386_HW_ARCH_H__
26
 
27
#include <ll/i386/defs.h>
28
BEGIN_DEF
29
 
30
#include <ll/i386/hw-data.h>
31
#include <ll/i386/hw-instr.h>
32
#include <ll/i386/hw-func.h>
33
 
34
/* The following structure is filled up by the ll_init() and can be     */
35
/* read by the kernel modules to know about the architecture            */
36
/* Each time a new hardware CPU is added to the ll layer, you have to   */
37
/* define a new XXX_ARCH structure, whose first field is a char *arch   */
38
/* This is used to identify the architecture, then subsequent field     */
39
/* can be decoded!!                                                     */
40
 
41
/* WARNING: I tried to use bitfields, but this caused am INTO error?!?  */
42
/* only when using GNU-C!! So i preferred to use standard DWORD flags   */
43
 
44
/* Capabilities */
45
#define LL_X86_HAS_INVLPG       0x01
46
#define LL_X86_HAS_CPUID        0x02
47
#define LL_X86_HAS_FPU          0x04
48
#define LL_X86_INTERNAL_FPU     0x08
49
#define LL_X86_HAS_TSTAMP       0x10
50
 
51
/* Bugs */
52
#define LL_X86_FDIV_BUG         0x01
53
#define LL_X86_F00F_BUG         0x02
54
 
55
typedef struct {
56
    char *arch;
57
    int cpu;    /* 0,1,2,3,4,5,6 ->
58
                        8086/8,80186,80286,80386,80486,P5,PII o Overdrive */
59
    int fpu;    /* 0,1,2,3 -> None,8087,80287,80387 */
60
    char *model; /* Dx, Dx2, ... */
61
    char vendor[12]; /* Intel, Cyrix, AMD or unknown */
62
    DWORD capabilities;
63
    DWORD bugs;
64
    /* BUGs!! Warning: Currently, no workaround is available!
65
    */
66
    int f00f_bug;
67
    int fdiv_bug;
68
} X86_ARCH;
69
 
70
struct ll_cpuInfo {
71
        DWORD X86_cpu;
72
        DWORD X86_cpuIdFlag;
73
        DWORD X86_vendor_1;
74
        DWORD X86_vendor_2;
75
        DWORD X86_vendor_3;
76
        DWORD X86_signature;
77
        DWORD X86_IntelFeature_1;
78
        DWORD X86_IntelFeature_2;
79
        DWORD X86_StandardFeature;
80
};
81
 
82
typedef struct {
83
    char *arch;
84
    /* Tonino, fill up this stuff! */
85
} AXP_ARCH;
86
 
87
typedef union {
88
    char *arch;
89
    X86_ARCH x86;
90
    AXP_ARCH axp;
91
} LL_ARCH;
92
 
93
void X86_get_CPU(struct ll_cpuInfo *p);
94
void X86_get_FPU(void);
95
int X86_is386(void);
96
int X86_isCyrix(void);
97
int X86_hasCPUID(void);
98
 
99
extern LL_ARCH ll_arch;
100
 
101
END_DEF
102
#endif /* __LL_I386_HW_ARCH_H__ */