-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandle.s
More file actions
129 lines (129 loc) · 2.12 KB
/
handle.s
File metadata and controls
129 lines (129 loc) · 2.12 KB
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
.file "handle.c"
.section .rodata
.LC0:
.string "Nice try.\n"
.text
.globl handler
.type handler, @function
handler:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $32, %rsp
movl %edi, -20(%rbp)
movl $1, -4(%rbp)
movl -4(%rbp), %eax
movl $10, %edx
movl $.LC0, %esi
movl %eax, %edi
call write
movq %rax, -16(%rbp)
cmpq $10, -16(%rbp)
je .L1
movl $-999, %edi
call exit
.L1:
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size handler, .-handler
.section .rodata
.LC1:
.string "exiting\n"
.text
.globl sigusr1_handler
.type sigusr1_handler, @function
sigusr1_handler:
.LFB1:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $32, %rsp
movl %edi, -20(%rbp)
movl $1, -4(%rbp)
movl -4(%rbp), %eax
movl $10, %edx
movl $.LC1, %esi
movl %eax, %edi
call write
movq %rax, -16(%rbp)
cmpq $10, -16(%rbp)
je .L4
movl $-999, %edi
call exit
.L4:
movl $1, %edi
call exit
.cfi_endproc
.LFE1:
.size sigusr1_handler, .-sigusr1_handler
.section .rodata
.LC2:
.string "This process's ID is %d\n"
.LC3:
.string "Still here"
.text
.globl main
.type main, @function
main:
.LFB2:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $64, %rsp
movl %edi, -52(%rbp)
movq %rsi, -64(%rbp)
call getpid
movl %eax, -8(%rbp)
movl $.LC2, %ecx
movq stdout(%rip), %rax
movl -8(%rbp), %edx
movq %rcx, %rsi
movq %rax, %rdi
movl $0, %eax
call fprintf
movl $handler, %esi
movl $2, %edi
call Signal
movl $sigusr1_handler, %esi
movl $10, %edi
call Signal
movq $1, -48(%rbp)
movq $0, -40(%rbp)
jmp .L7
.L8:
nop
.L7:
leaq -32(%rbp), %rdx
leaq -48(%rbp), %rax
movq %rdx, %rsi
movq %rax, %rdi
call nanosleep
movl %eax, -4(%rbp)
movl $.LC3, %edi
call puts
cmpl $-1, -4(%rbp)
jne .L8
leaq -32(%rbp), %rdx
leaq -32(%rbp), %rax
movq %rdx, %rsi
movq %rax, %rdi
call nanosleep
jmp .L8
.cfi_endproc
.LFE2:
.size main, .-main
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
.section .note.GNU-stack,"",@progbits