This source file includes following definitions.
- ret_from_sys_call
- start_thread
- exit_thread
- flush_thread
- copy_thread
- dump_thread
- sys_execve
1
2
3
4
5
6
7
8
9
10
11
12 #include <linux/errno.h>
13 #include <linux/sched.h>
14 #include <linux/kernel.h>
15 #include <linux/mm.h>
16 #include <linux/stddef.h>
17 #include <linux/unistd.h>
18 #include <linux/ptrace.h>
19 #include <linux/malloc.h>
20 #include <linux/ldt.h>
21 #include <linux/user.h>
22 #include <linux/a.out.h>
23
24 #include <asm/segment.h>
25 #include <asm/system.h>
26 #include <asm/mipsregs.h>
27 #include <asm/mipsconfig.h>
28 #include <asm/stackframe.h>
29
30
31
32
33 #pragma char wp_works_ok = 0;
34 char wait_available;
35
36
37
38
39 int EISA_bus = 0;
40
41 asmlinkage void ret_from_sys_call(void) __asm__("ret_from_sys_call");
42
43
44
45
46 asmlinkage int sys_idle(void)
47 {
48 #if 0
49 int i;
50 #endif
51
52 if (current->pid != 0)
53 return -EPERM;
54
55 #if 0
56
57 for (i = 0 ; i < 512 ; i++)
58 swapper_pg_dir[i] = 0;
59 #endif
60
61
62 current->counter = -100;
63 for (;;) {
64
65
66
67 if (wait_available && !need_resched)
68 __asm__("wait");
69 schedule();
70 }
71 }
72
73
74
75
76 void start_thread(struct pt_regs * regs, unsigned long eip, unsigned long esp)
77 {
78 regs->cp0_epc = eip;
79 regs->reg29 = esp;
80 }
81
82
83
84
85 void exit_thread(void)
86 {
87
88
89
90 }
91
92 void flush_thread(void)
93 {
94
95
96
97 }
98
99 #define IS_CLONE (regs->orig_reg2 == __NR_clone)
100
101 unsigned long copy_thread(int nr, unsigned long clone_flags, struct task_struct * p, struct pt_regs * regs)
102 {
103 struct pt_regs * childregs;
104
105
106
107
108 p->tss.fs = KERNEL_DS;
109 p->tss.ksp = (p->kernel_stack_page + PAGE_SIZE - 4) | KSEG0;
110 childregs = ((struct pt_regs *) (p->kernel_stack_page + PAGE_SIZE)) - 1;
111 p->tss.reg29 = ((unsigned long) childregs) | KSEG0;
112 p->tss.reg31 = (unsigned long) ret_from_sys_call;
113 *childregs = *regs;
114 childregs->reg2 = 0;
115
116
117
118
119
120 p->tss.cp0_status = regs->cp0_status &
121 ~(ST0_CU1|ST0_CU0|ST0_KSU|ST0_ERL|ST0_EXL);
122 childregs->cp0_status &= ~(ST0_CU1|ST0_CU0);
123
124 if (IS_CLONE) {
125 if (regs->reg4)
126 childregs->reg29 = regs->reg4;
127 clone_flags = regs->reg5;
128 if (childregs->reg29 == regs->reg29)
129 clone_flags |= COPYVM;
130 }
131
132 return clone_flags;
133 }
134
135
136
137
138 void dump_thread(struct pt_regs * regs, struct user * dump)
139 {
140
141
142
143 #if 0
144 int i;
145
146
147 dump->magic = CMAGIC;
148 dump->start_code = 0;
149 dump->start_stack = regs->esp & ~(PAGE_SIZE - 1);
150 dump->u_tsize = ((unsigned long) current->mm->end_code) >> 12;
151 dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> 12;
152 dump->u_dsize -= dump->u_tsize;
153 dump->u_ssize = 0;
154 for (i = 0; i < 8; i++)
155 dump->u_debugreg[i] = current->debugreg[i];
156
157 if (dump->start_stack < TASK_SIZE)
158 dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> 12;
159
160 dump->regs = *regs;
161
162
163
164 if (hard_math) {
165 if ((dump->u_fpvalid = current->used_math) != 0) {
166 if (last_task_used_math == current)
167 __asm__("clts ; fnsave %0": :"m" (dump->i387));
168 else
169 memcpy(&dump->i387,¤t->tss.i387.hard,sizeof(dump->i387));
170 }
171 } else {
172
173
174 dump->u_fpvalid = 0;
175 }
176 #endif
177 }
178
179
180
181
182 asmlinkage int sys_execve(struct pt_regs regs)
183 {
184 int error;
185 char * filename;
186
187 error = getname((char *) regs.reg4, &filename);
188 if (error)
189 return error;
190 error = do_execve(filename, (char **) regs.reg5, (char **) regs.reg6, ®s);
191 putname(filename);
192 return error;
193 }