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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-mips/] [processor.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/*
2
 * include/asm-mips/processor.h
3
 *
4
 * Copyright (C) 1994  Waldorf Electronics
5
 * written by Ralf Baechle
6
 */
7
 
8
#ifndef __ASM_MIPS_PROCESSOR_H
9
#define __ASM_MIPS_PROCESSOR_H
10
 
11
#if !defined (__LANGUAGE_ASSEMBLY__)
12
#include <asm/cachectl.h>
13
#include <asm/mipsregs.h>
14
#include <asm/reg.h>
15
#include <asm/system.h>
16
 
17
/*
18
 * System setup and hardware bug flags..
19
 */
20
extern char wait_available;             /* only available on R4[26]00 */
21
 
22
extern unsigned long intr_count;
23
extern unsigned long event;
24
 
25
/*
26
 * Bus types (default is ISA, but people can check others with these..)
27
 * MCA_bus hardcoded to 0 for now.
28
 *
29
 * This needs to be extended since MIPS systems are being delivered with
30
 * numerous different types of bus systems.
31
 */
32
extern int EISA_bus;
33
#define MCA_bus 0
34
#define MCA_bus__is_a_macro /* for versions in ksyms.c */
35
 
36
/*
37
 * MIPS has no problems with write protection
38
 */
39
#define wp_works_ok 1
40
#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
41
 
42
/*
43
 * User space process size: 2GB. This is hardcoded into a few places,
44
 * so don't change it unless you know what you are doing.
45
 */
46
#define TASK_SIZE       (0x80000000UL)
47
#define MAX_USER_ADDR   TASK_SIZE
48
#define MMAP_SEARCH_START (TASK_SIZE/3)
49
 
50
/*
51
 * Size of io_bitmap in longwords: 32 is ports 0-0x3ff.
52
 */
53
#define IO_BITMAP_SIZE  32
54
 
55
#define NUM_FPU_REGS    32
56
 
57
struct mips_fpu_hard_struct {
58
        double fp_regs[NUM_FPU_REGS];
59
        unsigned int control;
60
};
61
 
62
/*
63
 * FIXME: no fpu emulator yet (but who cares anyway?)
64
 */
65
struct mips_fpu_soft_struct {
66
        long    dummy;
67
        };
68
 
69
union mips_fpu_union {
70
        struct mips_fpu_hard_struct hard;
71
        struct mips_fpu_soft_struct soft;
72
};
73
 
74
#define INIT_FPU { \
75
        {{0,},} \
76
}
77
 
78
/*
79
 * If you change thread_struct remember to change the #defines below too!
80
 */
81
struct thread_struct {
82
        /*
83
         * saved main processor registers
84
         */
85
        unsigned long   reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23;
86
        unsigned long                               reg28, reg29, reg30, reg31;
87
        /*
88
         * saved cp0 stuff
89
         */
90
        unsigned long cp0_status;
91
        /*
92
         * saved fpu/fpu emulator stuff
93
         */
94
        union mips_fpu_union fpu;
95
        /*
96
         * Other stuff associated with the thread
97
         */
98
        unsigned long cp0_badvaddr;
99
        unsigned long error_code;
100
        unsigned long trap_no;
101
        unsigned long ksp;              /* Top of kernel stack   */
102
        unsigned long pg_dir;           /* L1 page table pointer */
103
#define MF_FIXADE 1
104
        unsigned long mflags;
105
};
106
 
107
#endif /* !defined (__LANGUAGE_ASSEMBLY__) */
108
 
109
/*
110
 * If you change the #defines remember to change thread_struct above too!
111
 */
112
#define TOFF_REG16              0
113
#define TOFF_REG17              (TOFF_REG16+4)
114
#define TOFF_REG18              (TOFF_REG17+4)
115
#define TOFF_REG19              (TOFF_REG18+4)
116
#define TOFF_REG20              (TOFF_REG19+4)
117
#define TOFF_REG21              (TOFF_REG20+4)
118
#define TOFF_REG22              (TOFF_REG21+4)
119
#define TOFF_REG23              (TOFF_REG22+4)
120
#define TOFF_REG28              (TOFF_REG23+4)
121
#define TOFF_REG29              (TOFF_REG28+4)
122
#define TOFF_REG30              (TOFF_REG29+4)
123
#define TOFF_REG31              (TOFF_REG30+4)
124
#define TOFF_CP0_STATUS         (TOFF_REG31+4)
125
/*
126
 * Pad for 8 byte boundary!
127
 */
128
#define TOFF_FPU                (((TOFF_CP0_STATUS+4)+(8-1))&~(8-1))
129
#define TOFF_CP0_BADVADDR       (TOFF_FPU+264)
130
#define TOFF_ERROR_CODE         (TOFF_CP0_BADVADDR+4)
131
#define TOFF_TRAP_NO            (TOFF_ERROR_CODE+4)
132
#define TOFF_KSP                (TOFF_TRAP_NO+4)
133
#define TOFF_PG_DIR             (TOFF_KSP+4)
134
#define TOFF_MFLAGS             (TOFF_PG_DIR+4)
135
 
136
#if !defined (__LANGUAGE_ASSEMBLY__)
137
 
138
#define INIT_MMAP { &init_mm, KSEG0, KSEG1, PAGE_SHARED, \
139
                    VM_READ | VM_WRITE | VM_EXEC }
140
 
141
#define INIT_TSS  { \
142
        /* \
143
         * saved main processor registers \
144
         */ \
145
        0, 0, 0, 0, 0, 0, 0, 0, \
146
                    0, 0, 0, 0, \
147
        /* \
148
         * saved cp0 stuff \
149
         */ \
150
        0, \
151
        /* \
152
         * saved fpu/fpu emulator stuff \
153
         */ \
154
        INIT_FPU, \
155
        /* \
156
         * Other stuff associated with the process\
157
         */ \
158
        0, 0, 0, sizeof(init_kernel_stack) + (unsigned long)init_kernel_stack - 8, \
159
        (unsigned long) swapper_pg_dir - PT_OFFSET, 0 \
160
}
161
 
162
/*
163
 * Return saved PC of a blocked thread.
164
 */
165
extern inline unsigned long thread_saved_pc(struct thread_struct *t)
166
{
167
        return ((unsigned long *)t->reg29)[EF_CP0_EPC];
168
}
169
 
170
/*
171
 * Do necessary setup to start up a newly executed thread.
172
 */
173
static __inline__
174
void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
175
{
176
        /*
177
         * Pure paranoia; probably not needed.
178
         */
179
        sys_cacheflush(0, ~0, BCACHE);
180
        sync_mem();
181
        regs->cp0_epc = pc;
182
        /*
183
         * New thread loses kernel privileges.
184
         */
185
        regs->cp0_status = (regs->cp0_status & ~(ST0_CU0|ST0_KSU)) | KSU_USER;
186
        /*
187
         * Reserve argument save space for registers a0 - a3.
188
        regs->reg29 = sp - 4 * sizeof(unsigned long);
189
         */
190
        regs->reg29 = sp;
191
}
192
 
193
#ifdef __KERNEL__
194
 
195
/*
196
 * switch_to(n) should switch tasks to task nr n, first
197
 * checking that n isn't the current task, in which case it does nothing.
198
 */
199
asmlinkage void resume(struct task_struct *tsk, int offset);
200
 
201
#define switch_to(n) \
202
        resume(n, ((int)(&((struct task_struct *)0)->tss)))
203
 
204
/*
205
 * Does the process account for user or for system time?
206
 */
207
#if defined (__R4000__)
208
 
209
#define USES_USER_TIME(regs) (!((regs)->cp0_status & 0x18))
210
 
211
#else /* !defined (__R4000__) */
212
 
213
#define USES_USER_TIME(regs) (!((regs)->cp0_status & 0x4))
214
 
215
#endif /* !defined (__R4000__) */
216
 
217
#endif /* __KERNEL__ */
218
 
219
#endif /* !defined (__LANGUAGE_ASSEMBLY__) */
220
 
221
/*
222
 * ELF support
223
 *
224
 * Using EM_MIPS is actually wrong - this one is reserved for big endian
225
 * machines only
226
 */
227
#define INCOMPATIBLE_MACHINE(m) ((m) != EM_MIPS && (m) != EM_MIPS_RS4_BE)
228
#define ELF_EM_CPU EM_MIPS
229
 
230
#endif /* __ASM_MIPS_PROCESSOR_H */

powered by: WebSVN 2.1.0

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