-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcontext_mgr_test.s
93 lines (83 loc) · 2.08 KB
/
context_mgr_test.s
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
.text
main:
{
# {
# @hcb_addr = $s0
# @khcb_addr_loc = $s1
# @mem_id = $s2
# @loc = $t0
# @err = $t1
#
# sbrk_imm 4096 @hcb_addr
# li $a1 1024
# add $a0 @hcb_addr $zero
# call initialize_heap
#
# addu $a0 $0 0x10
# addu $a1 @hcb_addr $zero
# call alloc
# addu @mem_id $v0 $zero
# addu @hcb_addr $v1 $zero
#
# khcb_writeback_2 @hcb_addr
#
# addu @loc $0 $0
# put @loc @mem_id @hcb_addr $0 @err
# }
{
@head = $s0
@current = $s1
@counter = $s2
@khcb_addr = $s3
addu $a0 $zero 1
addu $a1 $zero 11
call ll_init
addu @head $v0 $zero
addu $a0 @head $zero
addu $a1 $zero 2
addu $a2 $zero 22
call ll_append
addu $a0 @head $zero
addu $a1 $zero 3
addu $a2 $zero 33
call ll_append
addu $a0 @head $zero
addu $a1 $zero 4
addu $a2 $zero 44
call ll_append
addu @current $v0 $zero
khcb_getaddr_2 @khcb_addr
#print_hcb @khcb_addr
addu $a0 @head $zero
addu $a1 @current $zero
call ll_remove
addu @head $v0 $zero
khcb_getaddr_2 @khcb_addr
#print_hcb @khcb_addr
addu $a0 @head $zero
call ll_print
addu $a0 @head $zero
addu $a1 $zero 1
call ll_find_pid
addu $a0 $v1 $zero
call print_int
li $a0 10
call print_char
li @counter 10
addu @current @head $zero
loop:
addu $a0 @head $zero
addu $a1 @current $zero
call ll_next
addu @current $v0 $zero
addu $a0 @current $zero
call print_int
li $a0 32
call print_char
addi @counter @counter -1
bgtz @counter loop
li $a0 10
call print_char
exit
}
}