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
|
/** @file syscall_asm.S
*
* @brief syscall entries.
*
* @author Hanjie Wu (hanjiew)
* @bug No functional bugs
*/
#include <simics.h>
#include <x86/seg.h>
#define SEGSEL_KERNEL_FS SEGSEL_SPARE2
.macro SYSCALL name index
.global sys_\name
.type sys_\name, %function
sys_\name:
pusha /* save a stack_frame_t structure */
push %ds
push %es
push %fs
push %gs
mov $SEGSEL_KERNEL_DS, %eax
mov %ax, %ds
mov %ax, %es
mov $SEGSEL_KERNEL_FS, %eax
mov %ax, %fs
cld
push $\index
push %esp
call pv_handle_syscall
add $0x8, %esp
test %eax, %eax
je return_to_user
push %esp
call sys_\name\()_real
add $0x4, %esp
jmp return_to_user /* check pending exit before iret */
.endm
SYSCALL fork 0x41
SYSCALL exec 0x42
SYSCALL wait 0x44
SYSCALL yield 0x45
SYSCALL deschedule 0x46
SYSCALL make_runnable 0x47
SYSCALL gettid 0x48
SYSCALL new_pages 0x49
SYSCALL remove_pages 0x4a
SYSCALL sleep 0x4b
SYSCALL getchar 0x4c
SYSCALL readline 0x4d
SYSCALL print 0x4e
SYSCALL set_term_color 0x4f
SYSCALL set_cursor_pos 0x50
SYSCALL get_cursor_pos 0x51
SYSCALL thread_fork 0x52
SYSCALL get_ticks 0x53
SYSCALL misbehave 0x54
SYSCALL halt 0x55
SYSCALL task_vanish 0x57
SYSCALL set_status 0x59
SYSCALL vanish 0x60
SYSCALL readfile 0x62
SYSCALL swexn 0x74
.global sys_hvcall
.type sys_hvcall, %function
sys_hvcall:
pusha /* save a stack_frame_t structure */
push %ds
push %es
push %fs
push %gs
mov $SEGSEL_KERNEL_DS, %eax
mov %ax, %ds
mov %ax, %es
mov $SEGSEL_KERNEL_FS, %eax
mov %ax, %fs
cld
push %esp
call sys_hvcall_real
add $0x4, %esp
jmp return_to_user /* check pending exit before iret */
.macro NONEXIST_SYSCALL name index
.global sys_\name
.type sys_\name, %function
sys_\name:
pusha /* save a stack_frame_t structure */
push %ds
push %es
push %fs
push %gs
mov $SEGSEL_KERNEL_DS, %eax
mov %ax, %ds
mov %ax, %es
mov $SEGSEL_KERNEL_FS, %eax
mov %ax, %fs
cld
push $\index
push %esp
call pv_handle_syscall
add $0x8, %esp
jmp return_to_user /* check pending exit before iret */
.endm
NONEXIST_SYSCALL 67 0x43
NONEXIST_SYSCALL 86 0x56
NONEXIST_SYSCALL 97 0x61
NONEXIST_SYSCALL 99 0x63
NONEXIST_SYSCALL 100 0x64
NONEXIST_SYSCALL 101 0x65
NONEXIST_SYSCALL 102 0x66
NONEXIST_SYSCALL 103 0x67
NONEXIST_SYSCALL 104 0x68
NONEXIST_SYSCALL 105 0x69
NONEXIST_SYSCALL 106 0x6a
NONEXIST_SYSCALL 107 0x6b
NONEXIST_SYSCALL 108 0x6c
NONEXIST_SYSCALL 109 0x6d
NONEXIST_SYSCALL 110 0x6e
NONEXIST_SYSCALL 111 0x6f
NONEXIST_SYSCALL 112 0x70
NONEXIST_SYSCALL 113 0x71
NONEXIST_SYSCALL 114 0x72
NONEXIST_SYSCALL 115 0x73
NONEXIST_SYSCALL 128 0x80
NONEXIST_SYSCALL 129 0x81
NONEXIST_SYSCALL 130 0x82
NONEXIST_SYSCALL 131 0x83
NONEXIST_SYSCALL 132 0x84
NONEXIST_SYSCALL 133 0x85
NONEXIST_SYSCALL 134 0x86
NONEXIST_SYSCALL nonexist 0x0
|