1 /*--------------------------------------------------------------------
3 * include/asm-nios2nommu/processor.h
5 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
6 * Copyright (C) 2001 Ken Hill (khill@microtronix.com)
7 * Vic Phillips (vic@microtronix.com)
8 * Copyright (C) 2004 Microtronix Datacom Ltd
11 * include/asm-sparc/processor.h
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
24 * Jan/20/2004 dgt NiosII
25 * Nov/02/2003 dgt Fix task_size
27 ---------------------------------------------------------------------*/
29 #ifndef __ASM_NIOS_PROCESSOR_H
30 #define __ASM_NIOS_PROCESSOR_H
32 #define NIOS2_FLAG_KTHREAD 0x00000001 /* task is a kernel thread */
33 #define NIOS2_FLAG_COPROC 0x00000002 /* Thread used coprocess */
34 #define NIOS2_FLAG_DEBUG 0x00000004 /* task is being debugged */
36 #define NIOS2_OP_NOP 0x1883a
37 #define NIOS2_OP_BREAK 0x3da03a
42 * Default implementation of macro that returns current
43 * instruction pointer ("program counter").
45 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
47 #include <linux/a.out.h>
48 #include <linux/string.h>
50 #include <asm/ptrace.h>
51 #include <asm/signal.h>
52 #include <asm/segment.h>
53 #include <asm/current.h>
54 #include <asm/system.h> /* for get_hi_limit */
60 #define EISA_bus__is_a_macro /* for versions in ksyms.c */
62 #define MCA_bus__is_a_macro /* for versions in ksyms.c */
65 * The nios has no problems with write protection
68 #define wp_works_ok__is_a_macro /* for versions in ksyms.c */
70 /* Whee, this is STACK_TOP and the lowest kernel address too... */
72 #define KERNBASE 0x00000000 /* First address the kernel will eventually be */
73 #define TASK_SIZE (KERNBASE)
74 #define MAX_USER_ADDR TASK_SIZE
75 #define MMAP_SEARCH_START (TASK_SIZE/3)
78 #define TASK_SIZE ((unsigned int) nasys_program_mem_end) //...this is better...
81 * This decides where the kernel will search for a free chunk of vm
82 * space during mmap's. We won't be using it
84 #define TASK_UNMAPPED_BASE 0
86 /* The Nios processor specific thread struct. */
87 struct thread_struct
{
88 struct pt_regs
*kregs
;
90 /* For signal handling */
91 unsigned long sig_address
;
92 unsigned long sig_desc
;
94 /* Context switch saved kernel state. */
99 /* Flags are defined below */
103 struct exec core_exec
; /* just what it says. */
106 #define INIT_MMAP { &init_mm, (0), (0), \
107 __pgprot(0x0) , VM_READ | VM_WRITE | VM_EXEC }
109 #define INIT_THREAD { \
116 .flags = NIOS2_FLAG_KTHREAD, \
117 .current_ds = __KERNEL_DS, \
118 .core_exec = INIT_EXEC \
121 /* Free all resources held by a thread. */
122 extern void release_thread(struct task_struct
*);
124 extern unsigned long thread_saved_pc(struct task_struct
*t
);
126 extern void start_thread(struct pt_regs
* regs
, unsigned long pc
, unsigned long sp
);
128 /* Prepare to copy thread state - unlazy all lazy status */
129 #define prepare_to_copy(tsk) do { } while (0)
131 extern int kernel_thread(int (*fn
)(void *), void * arg
, unsigned long flags
);
133 unsigned long get_wchan(struct task_struct
*p
);
135 #define KSTK_EIP(tsk) ((tsk)->thread.kregs->ea)
136 #define KSTK_ESP(tsk) ((tsk)->thread.kregs->sp)
139 /* Allocation and freeing of basic task resources. */
141 //;dgt2;#define alloc_task_struct() ((struct task_struct *) xx..see..linux..fork..xx __get_free_pages(GFP_KERNEL,1))
142 //;dgt2;#define get_task_struct(tsk) xx..see..linux..sched.h...atomic_inc(&mem_map[MAP_NR(tsk)].count)
146 #define cpu_relax() do { } while (0)
147 #endif /* __ASSEMBLY__ */
148 #endif /* __ASM_NIOS_PROCESSOR_H */