forked from mengning/mykernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mykernel_for_linux3.9.4sc.patch
245 lines (231 loc) · 6.94 KB
/
mykernel_for_linux3.9.4sc.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
diff -Naur linux-3.9.4/arch/x86/kernel/time.c linux-3.9.4.new/arch/x86/kernel/time.c
--- linux-3.9.4/arch/x86/kernel/time.c 2013-05-24 11:45:59.000000000 -0700
+++ linux-3.9.4.new/arch/x86/kernel/time.c 2013-06-25 21:39:34.641299852 -0700
@@ -13,6 +13,7 @@
#include <linux/interrupt.h>
#include <linux/i8253.h>
#include <linux/time.h>
+#include <linux/timer.h>
#include <linux/export.h>
#include <asm/vsyscall.h>
@@ -57,6 +58,7 @@
static irqreturn_t timer_interrupt(int irq, void *dev_id)
{
global_clock_event->event_handler(global_clock_event);
+ my_timer_handler();
return IRQ_HANDLED;
}
@@ -68,6 +70,7 @@
void __init setup_default_timer_irq(void)
{
+ printk(KERN_NOTICE "timer interrupt setup\n");
setup_irq(0, &irq0);
}
diff -Naur linux-3.9.4/include/linux/start_kernel.h linux-3.9.4.new/include/linux/start_kernel.h
--- linux-3.9.4/include/linux/start_kernel.h 2013-05-24 11:45:59.000000000 -0700
+++ linux-3.9.4.new/include/linux/start_kernel.h 2013-06-25 19:18:58.396722448 -0700
@@ -8,5 +8,6 @@
up something else. */
extern asmlinkage void __init start_kernel(void);
+extern void __init my_start_kernel(void);
#endif /* _LINUX_START_KERNEL_H */
diff -Naur linux-3.9.4/include/linux/timer.h linux-3.9.4.new/include/linux/timer.h
--- linux-3.9.4/include/linux/timer.h 2013-05-24 11:45:59.000000000 -0700
+++ linux-3.9.4.new/include/linux/timer.h 2013-06-25 21:28:37.609026644 -0700
@@ -251,6 +251,8 @@
extern void init_timers(void);
extern void run_local_timers(void);
+extern void my_timer_handler(void);
+
struct hrtimer;
extern enum hrtimer_restart it_real_fn(struct hrtimer *);
diff -Naur linux-3.9.4/init/main.c linux-3.9.4.new/init/main.c
--- linux-3.9.4/init/main.c 2013-05-24 11:45:59.000000000 -0700
+++ linux-3.9.4.new/init/main.c 2013-06-25 20:16:17.452763103 -0700
@@ -574,7 +574,6 @@
console_init();
if (panic_later)
panic(panic_later, panic_param);
-
lockdep_info();
/*
@@ -641,6 +640,7 @@
ftrace_init();
+ my_start_kernel();
/* Do the rest non-__init'ed, we're now alive */
rest_init();
}
diff -Naur linux-3.9.4/Makefile linux-3.9.4.new/Makefile
--- linux-3.9.4/Makefile 2013-05-24 11:45:59.000000000 -0700
+++ linux-3.9.4.new/Makefile 2013-06-25 19:16:00.177364039 -0700
@@ -733,7 +733,7 @@
ifeq ($(KBUILD_EXTMOD),)
-core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
+core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ mykernel/
vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
diff -Naur linux-3.9.4/mykernel/Makefile linux-3.9.4.new/mykernel/Makefile
--- linux-3.9.4/mykernel/Makefile 1969-12-31 16:00:00.000000000 -0800
+++ linux-3.9.4.new/mykernel/Makefile 2013-06-25 21:40:24.174030881 -0700
@@ -0,0 +1,6 @@
+#
+# Makefile for the linux mykernel.
+#
+
+obj-y = mymain.o myinterrupt.o
+
diff -Naur linux-3.9.4/mykernel/myinterrupt.c linux-3.9.4.new/mykernel/myinterrupt.c
--- linux-3.9.4/mykernel/myinterrupt.c 1969-12-31 16:00:00.000000000 -0800
+++ linux-3.9.4.new/mykernel/myinterrupt.c 2013-06-25 21:45:38.408915841 -0700
@@ -0,0 +1,47 @@
+/*
+ * linux/mykernel/myinterrupt.c
+ *
+ * Kernel internal my_timer_handler
+ *
+ * Copyright (C) 2013 Mengning
+ *
+ */
+#include <linux/kernel_stat.h>
+#include <linux/export.h>
+#include <linux/interrupt.h>
+#include <linux/percpu.h>
+#include <linux/init.h>
+#include <linux/mm.h>
+#include <linux/swap.h>
+#include <linux/pid_namespace.h>
+#include <linux/notifier.h>
+#include <linux/thread_info.h>
+#include <linux/time.h>
+#include <linux/jiffies.h>
+#include <linux/posix-timers.h>
+#include <linux/cpu.h>
+#include <linux/syscalls.h>
+#include <linux/delay.h>
+#include <linux/tick.h>
+#include <linux/kallsyms.h>
+#include <linux/irq_work.h>
+#include <linux/sched.h>
+#include <linux/sched/sysctl.h>
+#include <linux/slab.h>
+
+#include <asm/uaccess.h>
+#include <asm/unistd.h>
+#include <asm/div64.h>
+#include <asm/timex.h>
+#include <asm/io.h>
+
+#define CREATE_TRACE_POINTS
+#include <trace/events/timer.h>
+
+/*
+ * Called by timer interrupt.
+ */
+void my_timer_handler(void)
+{
+ printk(KERN_NOTICE "\n>>>>>>>>>>>>>>>>>my_timer_handler here<<<<<<<<<<<<<<<<<<\n\n");
+}
diff -Naur linux-3.9.4/mykernel/mymain.c linux-3.9.4.new/mykernel/mymain.c
--- linux-3.9.4/mykernel/mymain.c 1969-12-31 16:00:00.000000000 -0800
+++ linux-3.9.4.new/mykernel/mymain.c 2013-06-25 21:44:59.489317439 -0700
@@ -0,0 +1,93 @@
+/*
+ * linux/mykernel/mymain.c
+ *
+ * Kernel internal my_start_kernel
+ *
+ * Copyright (C) 2013 Mengning
+ *
+ */
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/proc_fs.h>
+#include <linux/kernel.h>
+#include <linux/syscalls.h>
+#include <linux/stackprotector.h>
+#include <linux/string.h>
+#include <linux/ctype.h>
+#include <linux/delay.h>
+#include <linux/ioport.h>
+#include <linux/init.h>
+#include <linux/initrd.h>
+#include <linux/bootmem.h>
+#include <linux/acpi.h>
+#include <linux/tty.h>
+#include <linux/percpu.h>
+#include <linux/kmod.h>
+#include <linux/vmalloc.h>
+#include <linux/kernel_stat.h>
+#include <linux/start_kernel.h>
+#include <linux/security.h>
+#include <linux/smp.h>
+#include <linux/profile.h>
+#include <linux/rcupdate.h>
+#include <linux/moduleparam.h>
+#include <linux/kallsyms.h>
+#include <linux/writeback.h>
+#include <linux/cpu.h>
+#include <linux/cpuset.h>
+#include <linux/cgroup.h>
+#include <linux/efi.h>
+#include <linux/tick.h>
+#include <linux/interrupt.h>
+#include <linux/taskstats_kern.h>
+#include <linux/delayacct.h>
+#include <linux/unistd.h>
+#include <linux/rmap.h>
+#include <linux/mempolicy.h>
+#include <linux/key.h>
+#include <linux/buffer_head.h>
+#include <linux/page_cgroup.h>
+#include <linux/debug_locks.h>
+#include <linux/debugobjects.h>
+#include <linux/lockdep.h>
+#include <linux/kmemleak.h>
+#include <linux/pid_namespace.h>
+#include <linux/device.h>
+#include <linux/kthread.h>
+#include <linux/sched.h>
+#include <linux/signal.h>
+#include <linux/idr.h>
+#include <linux/kgdb.h>
+#include <linux/ftrace.h>
+#include <linux/async.h>
+#include <linux/kmemcheck.h>
+#include <linux/sfi.h>
+#include <linux/shmem_fs.h>
+#include <linux/slab.h>
+#include <linux/perf_event.h>
+#include <linux/file.h>
+#include <linux/ptrace.h>
+#include <linux/blkdev.h>
+#include <linux/elevator.h>
+
+#include <asm/io.h>
+#include <asm/bugs.h>
+#include <asm/setup.h>
+#include <asm/sections.h>
+#include <asm/cacheflush.h>
+
+#ifdef CONFIG_X86_LOCAL_APIC
+#include <asm/smp.h>
+#endif
+
+void __init my_start_kernel(void)
+{
+ int i = 0;
+ while(1)
+ {
+ i++;
+ if(i%100000 == 0)
+ printk(KERN_NOTICE "my_start_kernel here %d \n",i);
+
+ }
+}
diff -Naur linux-3.9.4/mykernel/README.md linux-3.9.4.new/mykernel/README.md
--- linux-3.9.4/mykernel/README.md 1969-12-31 16:00:00.000000000 -0800
+++ linux-3.9.4.new/mykernel/README.md 2013-06-25 21:52:52.467808733 -0700
@@ -0,0 +1,3 @@
+mykernel
+==========
+It is a platform to write your own OS kernel,its based on Linux Kernel 3.9.4 source code.