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