Skip to content

Commit 9248931

Browse files
20190622supress warning
1 parent ae84afb commit 9248931

17 files changed

+87
-163
lines changed

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
# Report of "Raspberry Pi" Challenge Mission
2-
## Foreword
3-
I am extremely sorry that I have to write this report in English although my English is poor. It is because that when I finally start to write this report, I find some problems occured in my Ubuntu18.04LTS Operating System. I cannot install any Chinese input methods on Ubuntu, and I cannot fix this problem despite of all the efforts I poured on it. Because all the codes are written in this linux environment and I need to refer to my code to write this report, it's so difficult to shut down my computer and switch between Windows and Ubuntu again and again. <br>
4-
**I am extermely sorry for all the troubles I caused to the teachers and TAs. Thank you for your forgiveness and understanding**

include/env.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ struct Env {
4141
};
4242
extern struct Env *envs;
4343
extern struct Env *curenv;
44-
4544
LIST_HEAD(Env_list, Env);
45+
46+
unsigned long mkenvid(struct Env *e);
47+
int envid2env(unsigned long envid, struct Env **penv, int checkperm);
48+
void env_init(void);
49+
int env_alloc(struct Env **new, unsigned long parent_id);
50+
void env_create_priority(unsigned char *binary, int size, int priority);
51+
void env_create(unsigned char *binary, int size);
52+
extern void env_pop_tf(struct Trapframe *tf,unsigned long* pgdir);
53+
void env_run(struct Env *e);
54+
void env_check();
4655
#endif // !_ENV_H_

include/printf.h renamed to include/os_printf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#ifndef _printf_h_
1313
#define _printf_h_
1414

15-
#include <stdarg.h>
15+
//#include <stdarg.h>
1616
void printf(char *fmt, ...);
1717

1818
void _panic(const char *, int, const char *, ...)

include/pmap.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define _PMAP_H_
33
#include<mmu.h>
44
#include<queue.h>
5-
#include<printf.h>
5+
#include<os_printf.h>
66

77

88
LIST_HEAD(Page_list, Page);
@@ -38,8 +38,8 @@ extern struct Page *pages;
3838

3939

4040
void mips_detect_memory();
41-
static void *alloc(unsigned long n, unsigned long align, long clear);
42-
static unsigned long* boot_pgdir_walk(unsigned long* pud,unsigned long va,int create);
41+
//static void *alloc(unsigned long n, unsigned long align, long clear);
42+
//static unsigned long* boot_pgdir_walk(unsigned long* pud,unsigned long va,int create);
4343
void boot_map_segment(unsigned long* pgdir,unsigned long va,unsigned long size,
4444
unsigned long pa,unsigned long perm);
4545
void aarch64_vm_init();

include/syscall_lib.h

+2
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66

77
#define SYS_putchar ((__SYSCALL_BASE ) + (0 ) )
88

9+
void invalid_syscall(long a0);
10+
int syscall_putchar(char ch);
911
#endif

init/main.c

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
#include <printf.h>
1+
#include <os_printf.h>
22
#include<pmap.h>
33
#include<mmu.h>
44
#include<timerandirq.h>
55
#include<helpfunct.h>
66
#include<uart.h>
77
#include<trapframe.h>
8+
#include<env.h>
89
extern void printel();
10+
extern void irq_vector_init();
911
extern void user_maina();
1012
extern void user_mainb();
13+
extern void enable_interrupt_controller();
1114
void main() {
12-
unsigned long* tmp;
15+
//unsigned long* tmp;
1316
printf(">>>main.c:\tmain is start ...>>>\n");
1417
printel();
1518
uart_init_boot();
@@ -20,21 +23,19 @@ void main() {
2023
mips_detect_memory();
2124
aarch64_vm_init();
2225
page_init();
23-
irq_vector_init();
2426
env_init();
2527

26-
env_create(&(user_maina),0,1);
27-
env_create(&(user_mainb),0,1);
28-
28+
env_create_priority((unsigned char *)(&(user_maina)),0,1);
29+
env_create_priority((unsigned char *)(&(user_mainb)),0,1);
2930

31+
irq_vector_init();
3032
//enable_irq();
3133
enable_interrupt_controller();
3234
timer_init();
3335
printf(">>>timer interrupt started!\n");
3436
//========TEST===========================
3537

36-
37-
//page_check();
38+
3839
//========HALT==================================
3940

4041
/*printf("HALT! ECHOING EVERYTHING BACK\n");

init/mmu.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include<mmu.h>
22

3-
#include<printf.h>
3+
#include<os_printf.h>
44
extern volatile unsigned char _data[];
55
unsigned long freemem;
66
void boot_mmu_setup(){

init/printel.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <printf.h>
1+
#include <os_printf.h>
22
extern int get_el();
33
void printel(){
44
printf("Current exception level switched to: %d \r\n",get_el());

lib/entry.S

+4-91
Original file line numberDiff line numberDiff line change
@@ -151,86 +151,25 @@ error_invalid_el0_32:
151151
unimplement_entry ERROR_INVALID_EL0_32
152152

153153
el1_irq:
154-
//unimplement_entry IRQ_INVALID_EL1t
155-
/*CLI
156-
saveall
157-
bl handle_irq
158-
restore
159-
STI
160-
eret*/
161-
162154
el0_irq:
163155
CLI
164156
ldr x16,=0x82000000//TIMESTACK
165157
mov sp,x16
166158
saveall
167-
/*sub sp, sp, #280
168-
stp x0, x1, [sp, #16 * 0]
169-
stp x2, x3, [sp, #16 * 1]
170-
stp x4, x5, [sp, #16 * 2]
171-
stp x6, x7, [sp, #16 * 3]
172-
stp x8, x9, [sp, #16 * 4]
173-
stp x10, x11, [sp, #16 * 5]
174-
stp x12, x13, [sp, #16 * 6]
175-
stp x14, x15, [sp, #16 * 7]
176-
stp x16, x17, [sp, #16 * 8]
177-
stp x18, x19, [sp, #16 * 9]
178-
stp x20, x21, [sp, #16 * 10]
179-
stp x22, x23, [sp, #16 * 11]
180-
stp x24, x25, [sp, #16 * 12]
181-
stp x26, x27, [sp, #16 * 13]
182-
stp x28, x29, [sp, #16 * 14]
183-
str x30, [sp, #16 * 15]
184-
185-
mrs x16,sp_el0
186-
str x16,[sp,#8*31]
187-
mrs x16,elr_el1
188-
str x16,[sp,#8*32]
189-
str x16,[sp,#8*34]//pc
190-
191-
mrs x16,spsr_el1
192-
str x16,[sp,#8*33]
193-
*/
194-
159+
195160
bl handle_irq
196161
restore
197-
STI
162+
//STI
198163
eret
199164

200165
el0_sync:
201166
.extern sys_call_table
202167
.extern invalid_syscall
203168
CLI
204-
ldr x16,=0x81fff000//TIMESTACK
169+
ldr x16,=0x81fff000//kernel_sp
205170
mov sp,x16
206171
saveall
207-
/*sub sp, sp, #280
208-
stp x0, x1, [sp, #16 * 0]
209-
stp x2, x3, [sp, #16 * 1]
210-
stp x4, x5, [sp, #16 * 2]
211-
stp x6, x7, [sp, #16 * 3]
212-
stp x8, x9, [sp, #16 * 4]
213-
stp x10, x11, [sp, #16 * 5]
214-
stp x12, x13, [sp, #16 * 6]
215-
stp x14, x15, [sp, #16 * 7]
216-
stp x16, x17, [sp, #16 * 8]
217-
stp x18, x19, [sp, #16 * 9]
218-
stp x20, x21, [sp, #16 * 10]
219-
stp x22, x23, [sp, #16 * 11]
220-
stp x24, x25, [sp, #16 * 12]
221-
stp x26, x27, [sp, #16 * 13]
222-
stp x28, x29, [sp, #16 * 14]
223-
str x30, [sp, #16 * 15]
224-
225-
mrs x16,sp_el0
226-
str x16,[sp,#8*31]
227-
mrs x16,elr_el1
228-
str x16,[sp,#8*32]
229-
str x16,[sp,#8*34]//pc
230-
231-
mrs x16,spsr_el1
232-
str x16,[sp,#8*33]*/
233-
172+
234173
ldr x17,=9527
235174
sub x0,x0,x17
236175
cmp x0,#1//===========1 syscalls
@@ -241,32 +180,6 @@ el0_sync:
241180
ldr x17,[x17]
242181
blr x17
243182

244-
/*ldp x0, x1, [sp, #16 * 0]
245-
ldp x2, x3, [sp, #16 * 1]
246-
ldp x4, x5, [sp, #16 * 2]
247-
ldp x6, x7, [sp, #16 * 3]
248-
ldp x8, x9, [sp, #16 * 4]
249-
ldp x10, x11, [sp, #16 * 5]
250-
ldp x12, x13, [sp, #16 * 6]
251-
ldp x14, x15, [sp, #16 * 7]
252-
ldp x16, x17, [sp, #16 * 8]
253-
ldp x18, x19, [sp, #16 * 9]
254-
ldp x20, x21, [sp, #16 * 10]
255-
ldp x22, x23, [sp, #16 * 11]
256-
ldp x24, x25, [sp, #16 * 12]
257-
ldp x26, x27, [sp, #16 * 13]
258-
ldp x28, x29, [sp, #16 * 14]
259-
ldr x30, [sp, #16 * 15]
260-
261-
ldr x16,[sp,#8*31]
262-
msr sp_el0,x16
263-
264-
ldr x16,[sp,#8*33]
265-
msr spsr_el1,x16
266-
267-
ldr x16,[sp,#8*34]//pc
268-
msr elr_el1,x16
269-
add sp, sp, #280*/
270183
restore
271184
//STI
272185
eret

0 commit comments

Comments
 (0)