OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-i386/] [processor.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/*
2
 * include/asm-i386/processor.h
3
 *
4
 * Copyright (C) 1994 Linus Torvalds
5
 */
6
 
7
#ifndef __ASM_I386_PROCESSOR_H
8
#define __ASM_I386_PROCESSOR_H
9
 
10
#include <asm/vm86.h>
11
#include <asm/math_emu.h>
12
 
13
/*
14
 * System setup and hardware bug flags..
15
 * [Note we don't test the 386 multiply bug or popad bug]
16
 */
17
 
18
extern char hard_math;
19
extern char x86;                /* lower 4 bits */
20
extern char x86_vendor_id[13];
21
extern char x86_model;          /* lower 4 bits */
22
extern char x86_mask;           /* lower 4 bits */
23
extern int  x86_capability;     /* field of flags */
24
extern int  fdiv_bug;
25
extern char ignore_irq13;
26
extern char wp_works_ok;        /* doesn't work on a 386 */
27
extern char hlt_works_ok;       /* problems on some 486Dx4's and old 386's */
28
extern int  have_cpuid;         /* We have a CPUID */
29
 
30
extern unsigned long cpu_hz;    /* CPU clock frequency from time.c */
31
 
32
/*
33
 *      Detection of CPU model (CPUID).
34
 */
35
extern inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx)
36
{
37
        __asm__("cpuid"
38
                : "=a" (*eax),
39
                  "=b" (*ebx),
40
                  "=c" (*ecx),
41
                  "=d" (*edx)
42
                : "a" (op)
43
                : "cc");
44
}
45
 
46
/*
47
 * Cyrix CPU register indexes (use special macros to access these)
48
 */
49
#define CX86_CCR2 0xc2
50
#define CX86_CCR3 0xc3
51
#define CX86_CCR4 0xe8
52
#define CX86_CCR5 0xe9
53
#define CX86_DIR0 0xfe
54
#define CX86_DIR1 0xff
55
 
56
/*
57
 * Cyrix CPU register access macros
58
 */
59
 
60
extern inline unsigned char getCx86(unsigned char reg)
61
{
62
        unsigned char data;
63
 
64
        __asm__ __volatile__("movb %1,%%al\n\t"
65
                      "outb %%al,$0x22\n\t"
66
                      "inb $0x23,%%al" : "=a" (data) : "q" (reg));
67
        return data;
68
}
69
 
70
extern inline void setCx86(unsigned char reg, unsigned char data)
71
{
72
        __asm__ __volatile__("outb %%al,$0x22\n\t"
73
             "movb %1,%%al\n\t"
74
             "outb %%al,$0x23" : : "a" (reg), "q" (data));
75
}
76
 
77
/*
78
 * Bus types (default is ISA, but people can check others with these..)
79
 * MCA_bus hardcoded to 0 for now.
80
 */
81
extern int EISA_bus;
82
#define MCA_bus 0
83
#define MCA_bus__is_a_macro /* for versions in ksyms.c */
84
 
85
/*
86
 * User space process size: 3GB (default).
87
 */
88
#define TASK_SIZE       ((unsigned long)__PAGE_OFFSET)
89
#define MAX_USER_ADDR   TASK_SIZE
90
#define MMAP_SEARCH_START (TASK_SIZE/3)
91
 
92
/*
93
 * Size of io_bitmap in longwords: 32 is ports 0-0x3ff.
94
 */
95
#define IO_BITMAP_SIZE  32
96
 
97
struct i387_hard_struct {
98
        long    cwd;
99
        long    swd;
100
        long    twd;
101
        long    fip;
102
        long    fcs;
103
        long    foo;
104
        long    fos;
105
        long    st_space[20];   /* 8*10 bytes for each FP-reg = 80 bytes */
106
        long    status;         /* software status information */
107
};
108
 
109
struct i387_soft_struct {
110
        long    cwd;
111
        long    swd;
112
        long    twd;
113
        long    fip;
114
        long    fcs;
115
        long    foo;
116
        long    fos;
117
        long    top;
118
        struct fpu_reg  regs[8];        /* 8*16 bytes for each FP-reg = 128 bytes */
119
        unsigned char   lookahead;
120
        struct info     *info;
121
        unsigned long   entry_eip;
122
};
123
 
124
union i387_union {
125
        struct i387_hard_struct hard;
126
        struct i387_soft_struct soft;
127
};
128
 
129
struct thread_struct {
130
        unsigned short  back_link,__blh;
131
        unsigned long   esp0;
132
        unsigned short  ss0,__ss0h;
133
        unsigned long   esp1;
134
        unsigned short  ss1,__ss1h;
135
        unsigned long   esp2;
136
        unsigned short  ss2,__ss2h;
137
        unsigned long   cr3;
138
        unsigned long   eip;
139
        unsigned long   eflags;
140
        unsigned long   eax,ecx,edx,ebx;
141
        unsigned long   esp;
142
        unsigned long   ebp;
143
        unsigned long   esi;
144
        unsigned long   edi;
145
        unsigned short  es, __esh;
146
        unsigned short  cs, __csh;
147
        unsigned short  ss, __ssh;
148
        unsigned short  ds, __dsh;
149
        unsigned short  fs, __fsh;
150
        unsigned short  gs, __gsh;
151
        unsigned short  ldt, __ldth;
152
        unsigned short  trace, bitmap;
153
        unsigned long   io_bitmap[IO_BITMAP_SIZE+1];
154
        unsigned long   tr;
155
        unsigned long   cr2, trap_no, error_code;
156
/* floating point info */
157
        union i387_union i387;
158
/* virtual 86 mode info */
159
        struct vm86_struct * vm86_info;
160
        unsigned long screen_bitmap;
161
        unsigned long v86flags, v86mask, v86mode;
162
};
163
 
164
#define INIT_MMAP { &init_mm, 0, 0x40000000, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC }
165
 
166
#define INIT_TSS  { \
167
        0,0, \
168
        sizeof(init_kernel_stack) + (long) &init_kernel_stack, \
169
        KERNEL_DS, 0, \
170
        0,0,0,0,0,0, \
171
        (long) &swapper_pg_dir, \
172
        0,0,0,0,0,0,0,0,0,0, \
173
        USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0, \
174
        _LDT(0),0, \
175
        0, 0x8000, \
176
        {~0, }, /* ioperm */ \
177
        _TSS(0), 0, 0,0, \
178
        { { 0, }, },  /* 387 state */ \
179
        NULL, 0, 0, 0, 0 /* vm86_info */ \
180
}
181
 
182
#define alloc_kernel_stack()    __get_free_page(GFP_KERNEL)
183
#define free_kernel_stack(page) free_page((page))
184
 
185
static inline void start_thread(struct pt_regs * regs, unsigned long eip, unsigned long esp)
186
{
187
        regs->cs = USER_CS;
188
        regs->ds = regs->es = regs->ss = regs->fs = regs->gs = USER_DS;
189
        regs->eip = eip;
190
        regs->esp = esp;
191
}
192
 
193
/*
194
 * Return saved PC of a blocked thread.
195
 */
196
extern inline unsigned long thread_saved_pc(struct thread_struct *t)
197
{
198
        return ((unsigned long *)t->esp)[3];
199
}
200
 
201
#endif /* __ASM_I386_PROCESSOR_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.