pre-2.3.4..
[davej-history.git] / include / asm-m68k / processor.h
blob3115e46c352fd0cdb2c257ca756b77a0ac0d1a27
1 /*
2 * include/asm-m68k/processor.h
4 * Copyright (C) 1995 Hamish Macdonald
5 */
7 #ifndef __ASM_M68K_PROCESSOR_H
8 #define __ASM_M68K_PROCESSOR_H
11 * Default implementation of macro that returns current
12 * instruction pointer ("program counter").
14 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
16 #include <asm/segment.h>
17 #include <asm/fpu.h>
20 * User space process size: 3.75GB. This is hardcoded into a few places,
21 * so don't change it unless you know what you are doing.
23 #define TASK_SIZE (0xF0000000UL)
25 /* This decides where the kernel will search for a free chunk of vm
26 * space during mmap's.
28 #define TASK_UNMAPPED_BASE 0xC0000000UL
29 #define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
32 * Bus types
34 #define EISA_bus 0
35 #define MCA_bus 0
37 /*
38 * if you change this structure, you must change the code and offsets
39 * in m68k/machasm.S
42 struct thread_struct {
43 unsigned long ksp; /* kernel stack pointer */
44 unsigned long usp; /* user stack pointer */
45 unsigned short sr; /* saved status register */
46 unsigned short fs; /* saved fs (sfc, dfc) */
47 unsigned long crp[2]; /* cpu root pointer */
48 unsigned long esp0; /* points to SR of stack frame */
49 unsigned long fp[8*3];
50 unsigned long fpcntl[3]; /* fp control regs */
51 unsigned char fpstate[FPSTATESIZE]; /* floating point state */
54 #define INIT_MMAP { &init_mm, 0, 0x40000000, NULL, __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED), VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
56 #define INIT_TSS { \
57 sizeof(init_stack) + (unsigned long) init_stack, 0, \
58 PS_S, __KERNEL_DS, \
59 {0, 0}, 0, {0,}, {0, 0, 0}, {0,}, \
63 * Do necessary setup to start up a newly executed thread.
65 static inline void start_thread(struct pt_regs * regs, unsigned long pc,
66 unsigned long usp)
68 /* reads from user space */
69 set_fs(USER_DS);
71 regs->pc = pc;
72 regs->sr &= ~0x2000;
73 wrusp(usp);
76 /* Free all resources held by a thread. */
77 static inline void release_thread(struct task_struct *dead_task)
81 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
83 #define copy_segments(nr, tsk, mm) do { } while (0)
84 #define release_segments(mm) do { } while (0)
85 #define forget_segments() do { } while (0)
88 * Free current thread data structures etc..
90 static inline void exit_thread(void)
95 * Return saved PC of a blocked thread.
97 extern inline unsigned long thread_saved_pc(struct thread_struct *t)
99 extern void scheduling_functions_start_here(void);
100 extern void scheduling_functions_end_here(void);
101 struct switch_stack *sw = (struct switch_stack *)t->ksp;
102 /* Check whether the thread is blocked in resume() */
103 if (sw->retpc > (unsigned long)scheduling_functions_start_here &&
104 sw->retpc < (unsigned long)scheduling_functions_end_here)
105 return ((unsigned long *)sw->a6)[1];
106 else
107 return sw->retpc;
110 /* Allocation and freeing of basic task resources. */
111 #define alloc_task_struct() \
112 ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
113 #define free_task_struct(p) free_pages((unsigned long)(p),1)
115 #define init_task (init_task_union.task)
116 #define init_stack (init_task_union.stack)
118 #endif