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
|
/** @file 410user/libtest/testasm.S
* @brief Test library.
* @author elly1 U2009
*/
#include <simics.h>
#include <syscall_int.h>
.global exhaustion
#define EX_BASE 0x20000000
#define EX_SIZE 1024 * 1024 * 1024
/* %edi - continuation
* %esi - syscall arg frame
* %ebx - argument
*/
exhaustion:
mov 4(%esp), %edi
mov 8(%esp), %ebx
lea -8(%esp), %esi /* argument frame space */
mov $EX_BASE, %ecx
mov $EX_SIZE, %edx
mov $4, %esp /* don't tempt the user to think that their stack is
* still live */
loop:
cmp $4096, %edx
jb 1f
mov %ecx, (%esi)
mov %edx, 4(%esi)
int $NEW_PAGES_INT
test %eax, %eax
jnz smaller
add %edx, %ecx
jmp loop
smaller:
shr $1, %edx
jmp loop
1:
jmp *%edi
.global fork_and_exit
fork_and_exit:
mov %ebx, %ecx
int $FORK_INT
test %eax, %eax
jz 1f
INLINE_SIMCALL(SIM_PUTS, %ecx, $0)
1:
mov $0, %esi
int $SET_STATUS_INT
int $VANISH_INT
.global exit_success
exit_success:
mov %ebx, %ecx
INLINE_SIMCALL(SIM_PUTS, %ecx, $0)
INLINE_SIMCALL(SIM_TEST_REPORT, %ecx, $1)
mov $0, %esi
int $SET_STATUS_INT
int $VANISH_INT
.global illegal
illegal:
xor %eax, %eax
mov %eax, %cr0
ret
/* Don't code like this: "authorized personnel only". */
.global assuredly_misbehave
assuredly_misbehave:
pushl %ebp
movl %esp, %ebp
pusha
movl 8(%ebp), %esi
int $MISBEHAVE_INT
popa
leave
ret
|