This source file includes following definitions.
- sys_idle
- hard_reset_now
- show_regs
- exit_thread
- flush_thread
- copy_thread
- dump_thread
- sys_fork
- sys_execve
1
2
3
4
5
6
7
8
9
10
11 #include <linux/errno.h>
12 #include <linux/sched.h>
13 #include <linux/kernel.h>
14 #include <linux/mm.h>
15 #include <linux/stddef.h>
16 #include <linux/unistd.h>
17 #include <linux/ptrace.h>
18 #include <linux/malloc.h>
19 #include <linux/ldt.h>
20 #include <linux/user.h>
21 #include <linux/a.out.h>
22
23 #include <asm/oplib.h>
24 #include <asm/segment.h>
25 #include <asm/system.h>
26 #include <asm/processor.h>
27
28
29
30
31 asmlinkage int sys_idle(void)
32 {
33
34 if (current->pid != 0)
35 return -EPERM;
36
37 printk("in sys_idle...\n");
38
39
40
41
42 current->counter = -100;
43 for (;;) {
44 printk("calling schedule() aieee!\n");
45 schedule();
46 printk("schedule() returned, halting...\n");
47 halt();
48 }
49 }
50
51 void hard_reset_now(void)
52 {
53 prom_reboot("boot vmlinux");
54 }
55
56 void show_regs(struct pt_regs * regs)
57 {
58 printk("\nFP: %08lx PC: %08lx NPC: %08lx\n", regs->u_regs[14],
59 regs->pc, regs->npc);
60 }
61
62
63
64
65 void exit_thread(void)
66 {
67 halt();
68 }
69
70 void flush_thread(void)
71 {
72 halt();
73 }
74
75 extern void ret_sys_call(void);
76
77
78
79
80
81
82
83
84
85
86
87
88 void copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
89 struct task_struct * p, struct pt_regs * regs)
90 {
91 struct pt_regs *childregs;
92 unsigned char *old_stack;
93 unsigned char *new_stack;
94 int i;
95
96
97 p->tss.context = -1;
98
99
100 childregs = ((struct pt_regs *)
101 ((p->kernel_stack_page + PAGE_SIZE - 80)&(~7)));
102
103 *childregs = *regs;
104
105 p->tss.usp = sp;
106
107
108
109
110
111 p->tss.ksp = (unsigned long) ((p->kernel_stack_page + PAGE_SIZE - 80 - 96)&(~7));
112 new_stack = (unsigned char *) (p->tss.ksp);
113 old_stack = (unsigned char *) (((unsigned long) regs) - 96);
114
115
116 for(i=0; i<96; i++) *new_stack++ = *old_stack++;
117
118
119
120
121
122 p->tss.pc = (((unsigned long) ret_sys_call) - 8);
123 p->tss.npc = p->tss.pc+4;
124
125
126 regs->u_regs[8] = p->pid;
127 childregs->u_regs[8] = 0;
128
129 return;
130 }
131
132
133
134
135 void dump_thread(struct pt_regs * regs, struct user * dump)
136 {
137 return;
138 }
139
140 asmlinkage int sys_fork(struct pt_regs *regs)
141 {
142 return do_fork(SIGCHLD, regs->u_regs[14], regs);
143 }
144
145
146
147
148 asmlinkage int sys_execve(struct pt_regs regs)
149 {
150 printk("sys_execve()... halting\n");
151 halt();
152 return 0;
153 }
154