Skip to content

Commit 80550c9

Browse files
committed
lab4 finished
1 parent 4a6f96a commit 80550c9

34 files changed

+1224
-1011
lines changed

os/.tags

Lines changed: 100 additions & 103 deletions
Large diffs are not rendered by default.

os/.tags1

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44
!_TAG_PROGRAM_NAME Exuberant Ctags //
55
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
66
!_TAG_PROGRAM_VERSION 5.8 //
7-
curenv Z:\RaspberryPi3_OS_new\os\lib\env.c /^struct Env *curenv; \/\/ the current env$/;" variable line:10 typeref:struct:Env
8-
env_free_list Z:\RaspberryPi3_OS_new\os\lib\env.c /^static struct Env_list env_free_list; \/\/ Free list$/;" variable line:12 typeref:struct:Env_list file:
9-
mkenvid Z:\RaspberryPi3_OS_new\os\lib\env.c /^u_int mkenvid(struct Env *e)$/;" function line:28 signature:(struct Env *e)
10-
envid2env Z:\RaspberryPi3_OS_new\os\lib\env.c /^int envid2env(u_int envid, struct Env **penv, int checkperm)$/;" function line:51 signature:(u_int envid, struct Env **penv, int checkperm)
11-
env_init Z:\RaspberryPi3_OS_new\os\lib\env.c /^void env_init(void)$/;" function line:95 signature:(void)
12-
env_setup_vm Z:\RaspberryPi3_OS_new\os\lib\env.c /^static int env_setup_vm(struct Env *e)$/;" function line:126 file: signature:(struct Env *e)
13-
env_alloc Z:\RaspberryPi3_OS_new\os\lib\env.c /^int env_alloc(struct Env **new, u_int parent_id)$/;" function line:166 signature:(struct Env **new, u_int parent_id)
14-
load_icode_mapper Z:\RaspberryPi3_OS_new\os\lib\env.c /^static int load_icode_mapper(u_long va, u_int32_t sgsize,$/;" function line:218 file: signature:(u_long va, u_int32_t sgsize, u_char *bin, u_int32_t bin_size, void *user_data)
15-
load_icode Z:\RaspberryPi3_OS_new\os\lib\env.c /^static void load_icode(struct Env *e, u_char *binary, u_int size)$/;" function line:297 file: signature:(struct Env *e, u_char *binary, u_int size)
16-
env_create Z:\RaspberryPi3_OS_new\os\lib\env.c /^void env_create(u_char *binary, int size)$/;" function line:337 signature:(u_char *binary, int size)
17-
env_free Z:\RaspberryPi3_OS_new\os\lib\env.c /^void env_free(struct Env *e)$/;" function line:351 signature:(struct Env *e)
18-
env_destroy Z:\RaspberryPi3_OS_new\os\lib\env.c /^void env_destroy(struct Env *e)$/;" function line:419 signature:(struct Env *e)
19-
env_run Z:\RaspberryPi3_OS_new\os\lib\env.c /^void env_run(struct Env *e)$/;" function line:447 signature:(struct Env *e)
7+
curenv Z:\RaspberryPi3_OS\os\lib\env.c /^struct Env *curenv; \/\/ the current env$/;" variable line:11 typeref:struct:Env
8+
env_free_list Z:\RaspberryPi3_OS\os\lib\env.c /^static struct Env_list env_free_list; \/\/ Free list$/;" variable line:13 typeref:struct:Env_list file:
9+
mkenvid Z:\RaspberryPi3_OS\os\lib\env.c /^u_int mkenvid(struct Env *e)$/;" function line:26 signature:(struct Env *e)
10+
_getenvid Z:\RaspberryPi3_OS\os\lib\env.c /^u_int _getenvid(void)$/;" function line:39 signature:(void)
11+
envid2env Z:\RaspberryPi3_OS\os\lib\env.c /^int envid2env(u_int envid, struct Env **penv, int checkperm)$/;" function line:56 signature:(u_int envid, struct Env **penv, int checkperm)
12+
env_init Z:\RaspberryPi3_OS\os\lib\env.c /^void env_init(void)$/;" function line:100 signature:(void)
13+
env_setup_vm Z:\RaspberryPi3_OS\os\lib\env.c /^static int env_setup_vm(struct Env *e)$/;" function line:124 file: signature:(struct Env *e)
14+
env_alloc Z:\RaspberryPi3_OS\os\lib\env.c /^int env_alloc(struct Env **new, u_int parent_id)$/;" function line:164 signature:(struct Env **new, u_int parent_id)
15+
load_icode_mapper Z:\RaspberryPi3_OS\os\lib\env.c /^static int load_icode_mapper(u_long va, u_int32_t sgsize,$/;" function line:216 file: signature:(u_long va, u_int32_t sgsize, u_char *bin, u_int32_t bin_size, void *user_data)
16+
load_icode Z:\RaspberryPi3_OS\os\lib\env.c /^static void load_icode(struct Env *e, u_char *binary, u_int size)$/;" function line:290 file: signature:(struct Env *e, u_char *binary, u_int size)
17+
env_create Z:\RaspberryPi3_OS\os\lib\env.c /^void env_create(u_char *binary, int size)$/;" function line:329 signature:(u_char *binary, int size)
18+
env_free Z:\RaspberryPi3_OS\os\lib\env.c /^void env_free(struct Env *e)$/;" function line:343 signature:(struct Env *e)
19+
_env_destroy Z:\RaspberryPi3_OS\os\lib\env.c /^void _env_destroy(u_int envid)$/;" function line:411 signature:(u_int envid)
20+
env_run Z:\RaspberryPi3_OS\os\lib\env.c /^void env_run(struct Env *e)$/;" function line:447 signature:(struct Env *e)
21+
_fork Z:\RaspberryPi3_OS\os\lib\env.c /^void _fork(void)$/;" function line:471 signature:(void)
22+
_ipc_recv Z:\RaspberryPi3_OS\os\lib\env.c /^void _ipc_recv(u_long dstva)$/;" function line:543 signature:(u_long dstva)
23+
_ipc_can_send Z:\RaspberryPi3_OS\os\lib\env.c /^int _ipc_can_send(u_int envid, u_int value, u_int srcva, u_int perm)$/;" function line:578 signature:(u_int envid, u_int value, u_int srcva, u_int perm)

os/boot/asm.s

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jump_to_el0:
1414
cmp x0, #8
1515
beq 2f
1616

17-
ldr x0, =0xe00000
18-
msr sp_el0, x0 // init the stack of el0
17+
// ldr x0, =0xe00000
18+
// msr sp_el0, x0 // init the stack of el0
1919

2020
// return to el0 from el1
2121
mov x0, #0x0
@@ -67,3 +67,18 @@ get_sctlr_el1:
6767
get_esr:
6868
mrs x0, esr_el1
6969
ret
70+
71+
.globl get_spsr
72+
get_spsr:
73+
mrs x0, spsr_el1
74+
ret
75+
76+
.globl get_elr
77+
get_elr:
78+
mrs x0, elr_el1
79+
ret
80+
81+
.globl get_far
82+
get_far:
83+
mrs x0, far_el1
84+
ret

os/boot/main.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
extern u_long get_current_el();
1010

11-
extern u_char userA[];
12-
extern u_long userA_size;
13-
extern u_char userB[];
14-
extern u_long userB_size;
11+
// extern u_char userA[];
12+
// extern u_long userA_size;
13+
// extern u_char userB[];
14+
// extern u_long userB_size;
15+
extern u_char user[];
16+
extern u_long user_size;
1517

1618
void main(void)
1719
{
@@ -33,9 +35,9 @@ void main(void)
3335
gpio_output_init(27);
3436

3537
_printf("creating new env...\n");
36-
env_create(userA, userA_size);
37-
env_create(userB, userB_size);
38-
38+
//env_create(userA, userA_size);
39+
//env_create(userB, userB_size);
40+
env_create(user, user_size);
3941

4042
_printf("activating system timer...\n");
4143
set_system_timer_irq(1000000);

os/include.mk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
CROSS_COMPILE := aarch64-none-elf
2-
#CROSS_COMPILE := ~/gcc-linaro-aarch64-linux-gnu-4.8-2013.10_linux/bin/aarch64-linux-gnu
3-
CC := $(CROSS_COMPILE)-gcc
4-
CFLAGS := -Wall -O2 -nostdlib -nostartfiles -ffreestanding
5-
LD := $(CROSS_COMPILE)-ld
6-
AS := $(CROSS_COMPILE)-as
7-
OBJCOPY := $(CROSS_COMPILE)-objcopy
8-
OBJDUMP := $(CROSS_COMPILE)-objdump
1+
CROSS_COMPILE := aarch64-none-elf
2+
#CROSS_COMPILE := ~/gcc-linaro-aarch64-linux-gnu-4.8-2013.10_linux/bin/aarch64-linux-gnu
3+
CC := $(CROSS_COMPILE)-gcc
4+
CFLAGS := -Wall -nostdlib -nostartfiles -ffreestanding
5+
LD := $(CROSS_COMPILE)-ld
6+
AS := $(CROSS_COMPILE)-as
7+
OBJCOPY := $(CROSS_COMPILE)-objcopy
8+
OBJDUMP := $(CROSS_COMPILE)-objdump

os/include/kerelf.h

Lines changed: 0 additions & 112 deletions
This file was deleted.

0 commit comments

Comments
 (0)