clarify the purpose of this project
[nyanglibc.git] / termios / cfsetspeed.shared.s
blobd1374e9d3180ebb741d6e4cf59c51e7922ed27dc
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 #NO_APP
7 .p2align 4,,15
8 .globl cfsetspeed
9 .type cfsetspeed, @function
10 cfsetspeed:
11 pushq %rbp
12 leaq speeds(%rip), %rax
13 pushq %rbx
14 movq %rdi, %rbp
15 xorl %ebx, %ebx
16 subq $8, %rsp
17 leaq 256(%rax), %rdx
18 jmp .L6
19 .p2align 4,,10
20 .p2align 3
21 .L2:
22 cmpl %esi, (%rax)
23 je .L8
24 addq $8, %rax
25 cmpq %rdx, %rax
26 je .L5
27 movl 4(%rax), %ebx
28 .L6:
29 cmpl %esi, %ebx
30 jne .L2
31 .L8:
32 movl %ebx, %esi
33 movq %rbp, %rdi
34 call __GI_cfsetispeed
35 movl %ebx, %esi
36 movq %rbp, %rdi
37 call __GI_cfsetospeed
38 addq $8, %rsp
39 xorl %eax, %eax
40 popq %rbx
41 popq %rbp
42 ret
43 .p2align 4,,10
44 .p2align 3
45 .L5:
46 movq __libc_errno@gottpoff(%rip), %rax
47 movl $22, %fs:(%rax)
48 addq $8, %rsp
49 movl $-1, %eax
50 popq %rbx
51 popq %rbp
52 ret
53 .size cfsetspeed, .-cfsetspeed
54 .section .rodata
55 .align 32
56 .type speeds, @object
57 .size speeds, 256
58 speeds:
59 .long 0
60 .long 0
61 .long 50
62 .long 1
63 .long 75
64 .long 2
65 .long 110
66 .long 3
67 .long 134
68 .long 4
69 .long 150
70 .long 5
71 .long 200
72 .long 6
73 .long 300
74 .long 7
75 .long 600
76 .long 8
77 .long 1200
78 .long 9
79 .long 1200
80 .long 9
81 .long 1800
82 .long 10
83 .long 2400
84 .long 11
85 .long 4800
86 .long 12
87 .long 9600
88 .long 13
89 .long 19200
90 .long 14
91 .long 38400
92 .long 15
93 .long 57600
94 .long 4097
95 .long 115200
96 .long 4098
97 .long 230400
98 .long 4099
99 .long 460800
100 .long 4100
101 .long 500000
102 .long 4101
103 .long 576000
104 .long 4102
105 .long 921600
106 .long 4103
107 .long 1000000
108 .long 4104
109 .long 1152000
110 .long 4105
111 .long 1500000
112 .long 4106
113 .long 2000000
114 .long 4107
115 .long 2500000
116 .long 4108
117 .long 3000000
118 .long 4109
119 .long 3500000
120 .long 4110
121 .long 4000000
122 .long 4111