text
stringlengths
1
1.05M
ViridianCity_h: db OVERWORLD ; tileset db VIRIDIAN_CITY_HEIGHT, VIRIDIAN_CITY_WIDTH ; dimensions (y, x) dw ViridianCityBlocks, ViridianCityTextPointers, ViridianCityScript ; blocks, texts, scripts db NORTH | SOUTH | WEST ; connections NORTH_MAP_CONNECTION VIRIDIAN_CITY, ROUTE_2, 5, 0, Route2Blocks SOUTH_MAP_CONNECTION VIRIDIAN_CITY, ROUTE_1, 5, 0, Route1Blocks, 1 WEST_MAP_CONNECTION VIRIDIAN_CITY, ROUTE_22, 4, 0, Route22Blocks dw ViridianCityObject ; objects
_kill: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(int argc, char **argv) { 0: f3 0f 1e fb endbr32 4: 8d 4c 24 04 lea 0x4(%esp),%ecx 8: 83 e4 f0 and $0xfffffff0,%esp b: ff 71 fc pushl -0x4(%ecx) e: 55 push %ebp f: 89 e5 mov %esp,%ebp 11: 57 push %edi 12: 56 push %esi 13: 53 push %ebx 14: 51 push %ecx 15: 83 ec 08 sub $0x8,%esp 18: 8b 31 mov (%ecx),%esi 1a: 8b 79 04 mov 0x4(%ecx),%edi int i; if(argc < 2){ 1d: 83 fe 01 cmp $0x1,%esi 20: 7e 07 jle 29 <main+0x29> printf(2, "usage: kill pid...\n"); exit(); } for(i=1; i<argc; i++) 22: bb 01 00 00 00 mov $0x1,%ebx 27: eb 2d jmp 56 <main+0x56> printf(2, "usage: kill pid...\n"); 29: 83 ec 08 sub $0x8,%esp 2c: 68 7c 07 00 00 push $0x77c 31: 6a 02 push $0x2 33: e8 87 04 00 00 call 4bf <printf> exit(); 38: e8 39 03 00 00 call 376 <exit> kill(atoi(argv[i])); 3d: 83 ec 0c sub $0xc,%esp 40: ff 34 9f pushl (%edi,%ebx,4) 43: e8 6a 01 00 00 call 1b2 <atoi> 48: 89 04 24 mov %eax,(%esp) 4b: e8 5e 03 00 00 call 3ae <kill> for(i=1; i<argc; i++) 50: 83 c3 01 add $0x1,%ebx 53: 83 c4 10 add $0x10,%esp 56: 39 f3 cmp %esi,%ebx 58: 7c e3 jl 3d <main+0x3d> exit(); 5a: e8 17 03 00 00 call 376 <exit> 0000005f <strcpy>: ptr_storage ptr_pairs[NPROC]; int cell_full[NPROC]; char* strcpy(char *s, const char *t) { 5f: f3 0f 1e fb endbr32 63: 55 push %ebp 64: 89 e5 mov %esp,%ebp 66: 56 push %esi 67: 53 push %ebx 68: 8b 75 08 mov 0x8(%ebp),%esi 6b: 8b 55 0c mov 0xc(%ebp),%edx char *os; os = s; while((*s++ = *t++) != 0) 6e: 89 f0 mov %esi,%eax 70: 89 d1 mov %edx,%ecx 72: 83 c2 01 add $0x1,%edx 75: 89 c3 mov %eax,%ebx 77: 83 c0 01 add $0x1,%eax 7a: 0f b6 09 movzbl (%ecx),%ecx 7d: 88 0b mov %cl,(%ebx) 7f: 84 c9 test %cl,%cl 81: 75 ed jne 70 <strcpy+0x11> ; return os; } 83: 89 f0 mov %esi,%eax 85: 5b pop %ebx 86: 5e pop %esi 87: 5d pop %ebp 88: c3 ret 00000089 <strcmp>: int strcmp(const char *p, const char *q) { 89: f3 0f 1e fb endbr32 8d: 55 push %ebp 8e: 89 e5 mov %esp,%ebp 90: 8b 4d 08 mov 0x8(%ebp),%ecx 93: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) 96: 0f b6 01 movzbl (%ecx),%eax 99: 84 c0 test %al,%al 9b: 74 0c je a9 <strcmp+0x20> 9d: 3a 02 cmp (%edx),%al 9f: 75 08 jne a9 <strcmp+0x20> p++, q++; a1: 83 c1 01 add $0x1,%ecx a4: 83 c2 01 add $0x1,%edx a7: eb ed jmp 96 <strcmp+0xd> return (uchar)*p - (uchar)*q; a9: 0f b6 c0 movzbl %al,%eax ac: 0f b6 12 movzbl (%edx),%edx af: 29 d0 sub %edx,%eax } b1: 5d pop %ebp b2: c3 ret 000000b3 <strlen>: uint strlen(const char *s) { b3: f3 0f 1e fb endbr32 b7: 55 push %ebp b8: 89 e5 mov %esp,%ebp ba: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) bd: b8 00 00 00 00 mov $0x0,%eax c2: 80 3c 01 00 cmpb $0x0,(%ecx,%eax,1) c6: 74 05 je cd <strlen+0x1a> c8: 83 c0 01 add $0x1,%eax cb: eb f5 jmp c2 <strlen+0xf> ; return n; } cd: 5d pop %ebp ce: c3 ret 000000cf <memset>: void* memset(void *dst, int c, uint n) { cf: f3 0f 1e fb endbr32 d3: 55 push %ebp d4: 89 e5 mov %esp,%ebp d6: 57 push %edi d7: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : da: 89 d7 mov %edx,%edi dc: 8b 4d 10 mov 0x10(%ebp),%ecx df: 8b 45 0c mov 0xc(%ebp),%eax e2: fc cld e3: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } e5: 89 d0 mov %edx,%eax e7: 5f pop %edi e8: 5d pop %ebp e9: c3 ret 000000ea <strchr>: char* strchr(const char *s, char c) { ea: f3 0f 1e fb endbr32 ee: 55 push %ebp ef: 89 e5 mov %esp,%ebp f1: 8b 45 08 mov 0x8(%ebp),%eax f4: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) f8: 0f b6 10 movzbl (%eax),%edx fb: 84 d2 test %dl,%dl fd: 74 09 je 108 <strchr+0x1e> if(*s == c) ff: 38 ca cmp %cl,%dl 101: 74 0a je 10d <strchr+0x23> for(; *s; s++) 103: 83 c0 01 add $0x1,%eax 106: eb f0 jmp f8 <strchr+0xe> return (char*)s; return 0; 108: b8 00 00 00 00 mov $0x0,%eax } 10d: 5d pop %ebp 10e: c3 ret 0000010f <gets>: char* gets(char *buf, int max) { 10f: f3 0f 1e fb endbr32 113: 55 push %ebp 114: 89 e5 mov %esp,%ebp 116: 57 push %edi 117: 56 push %esi 118: 53 push %ebx 119: 83 ec 1c sub $0x1c,%esp 11c: 8b 7d 08 mov 0x8(%ebp),%edi int i, cc; char c; for(i=0; i+1 < max; ){ 11f: bb 00 00 00 00 mov $0x0,%ebx 124: 89 de mov %ebx,%esi 126: 83 c3 01 add $0x1,%ebx 129: 3b 5d 0c cmp 0xc(%ebp),%ebx 12c: 7d 2e jge 15c <gets+0x4d> cc = read(0, &c, 1); 12e: 83 ec 04 sub $0x4,%esp 131: 6a 01 push $0x1 133: 8d 45 e7 lea -0x19(%ebp),%eax 136: 50 push %eax 137: 6a 00 push $0x0 139: e8 58 02 00 00 call 396 <read> if(cc < 1) 13e: 83 c4 10 add $0x10,%esp 141: 85 c0 test %eax,%eax 143: 7e 17 jle 15c <gets+0x4d> break; buf[i++] = c; 145: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 149: 88 04 37 mov %al,(%edi,%esi,1) if(c == '\n' || c == '\r') 14c: 3c 0a cmp $0xa,%al 14e: 0f 94 c2 sete %dl 151: 3c 0d cmp $0xd,%al 153: 0f 94 c0 sete %al 156: 08 c2 or %al,%dl 158: 74 ca je 124 <gets+0x15> buf[i++] = c; 15a: 89 de mov %ebx,%esi break; } buf[i] = '\0'; 15c: c6 04 37 00 movb $0x0,(%edi,%esi,1) return buf; } 160: 89 f8 mov %edi,%eax 162: 8d 65 f4 lea -0xc(%ebp),%esp 165: 5b pop %ebx 166: 5e pop %esi 167: 5f pop %edi 168: 5d pop %ebp 169: c3 ret 0000016a <stat>: int stat(const char *n, struct stat *st) { 16a: f3 0f 1e fb endbr32 16e: 55 push %ebp 16f: 89 e5 mov %esp,%ebp 171: 56 push %esi 172: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 173: 83 ec 08 sub $0x8,%esp 176: 6a 00 push $0x0 178: ff 75 08 pushl 0x8(%ebp) 17b: e8 3e 02 00 00 call 3be <open> if(fd < 0) 180: 83 c4 10 add $0x10,%esp 183: 85 c0 test %eax,%eax 185: 78 24 js 1ab <stat+0x41> 187: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); 189: 83 ec 08 sub $0x8,%esp 18c: ff 75 0c pushl 0xc(%ebp) 18f: 50 push %eax 190: e8 41 02 00 00 call 3d6 <fstat> 195: 89 c6 mov %eax,%esi close(fd); 197: 89 1c 24 mov %ebx,(%esp) 19a: e8 07 02 00 00 call 3a6 <close> return r; 19f: 83 c4 10 add $0x10,%esp } 1a2: 89 f0 mov %esi,%eax 1a4: 8d 65 f8 lea -0x8(%ebp),%esp 1a7: 5b pop %ebx 1a8: 5e pop %esi 1a9: 5d pop %ebp 1aa: c3 ret return -1; 1ab: be ff ff ff ff mov $0xffffffff,%esi 1b0: eb f0 jmp 1a2 <stat+0x38> 000001b2 <atoi>: int atoi(const char *s) { 1b2: f3 0f 1e fb endbr32 1b6: 55 push %ebp 1b7: 89 e5 mov %esp,%ebp 1b9: 53 push %ebx 1ba: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; 1bd: ba 00 00 00 00 mov $0x0,%edx while('0' <= *s && *s <= '9') 1c2: 0f b6 01 movzbl (%ecx),%eax 1c5: 8d 58 d0 lea -0x30(%eax),%ebx 1c8: 80 fb 09 cmp $0x9,%bl 1cb: 77 12 ja 1df <atoi+0x2d> n = n*10 + *s++ - '0'; 1cd: 8d 1c 92 lea (%edx,%edx,4),%ebx 1d0: 8d 14 1b lea (%ebx,%ebx,1),%edx 1d3: 83 c1 01 add $0x1,%ecx 1d6: 0f be c0 movsbl %al,%eax 1d9: 8d 54 10 d0 lea -0x30(%eax,%edx,1),%edx 1dd: eb e3 jmp 1c2 <atoi+0x10> return n; } 1df: 89 d0 mov %edx,%eax 1e1: 5b pop %ebx 1e2: 5d pop %ebp 1e3: c3 ret 000001e4 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 1e4: f3 0f 1e fb endbr32 1e8: 55 push %ebp 1e9: 89 e5 mov %esp,%ebp 1eb: 56 push %esi 1ec: 53 push %ebx 1ed: 8b 75 08 mov 0x8(%ebp),%esi 1f0: 8b 4d 0c mov 0xc(%ebp),%ecx 1f3: 8b 45 10 mov 0x10(%ebp),%eax char *dst; const char *src; dst = vdst; 1f6: 89 f2 mov %esi,%edx src = vsrc; while(n-- > 0) 1f8: 8d 58 ff lea -0x1(%eax),%ebx 1fb: 85 c0 test %eax,%eax 1fd: 7e 0f jle 20e <memmove+0x2a> *dst++ = *src++; 1ff: 0f b6 01 movzbl (%ecx),%eax 202: 88 02 mov %al,(%edx) 204: 8d 49 01 lea 0x1(%ecx),%ecx 207: 8d 52 01 lea 0x1(%edx),%edx while(n-- > 0) 20a: 89 d8 mov %ebx,%eax 20c: eb ea jmp 1f8 <memmove+0x14> return vdst; } 20e: 89 f0 mov %esi,%eax 210: 5b pop %ebx 211: 5e pop %esi 212: 5d pop %ebp 213: c3 ret 00000214 <thread_create>: int thread_create(void (*start_routine)(void *, void *), void *arg1, void *arg2) { 214: f3 0f 1e fb endbr32 218: 55 push %ebp 219: 89 e5 mov %esp,%ebp 21b: 53 push %ebx 21c: 83 ec 10 sub $0x10,%esp void *curr_ptr = malloc(PGSIZE*2); 21f: 68 00 20 00 00 push $0x2000 224: e8 c7 04 00 00 call 6f0 <malloc> void *user_stack = curr_ptr; if ((uint)user_stack % PGSIZE != 0) { 229: 83 c4 10 add $0x10,%esp 22c: 89 c2 mov %eax,%edx 22e: 81 e2 ff 0f 00 00 and $0xfff,%edx 234: 74 22 je 258 <thread_create+0x44> user_stack += (PGSIZE - ((uint)user_stack % PGSIZE)); 236: b9 00 10 00 00 mov $0x1000,%ecx 23b: 29 d1 sub %edx,%ecx 23d: 01 c1 add %eax,%ecx } int i; for (i = 0; i < NPROC; i++) { 23f: ba 00 00 00 00 mov $0x0,%edx 244: 83 fa 3f cmp $0x3f,%edx 247: 7f 13 jg 25c <thread_create+0x48> if (cell_full[i] != 1) { break; } 249: 83 3c 95 20 0e 00 00 cmpl $0x1,0xe20(,%edx,4) 250: 01 251: 75 09 jne 25c <thread_create+0x48> for (i = 0; i < NPROC; i++) { 253: 83 c2 01 add $0x1,%edx 256: eb ec jmp 244 <thread_create+0x30> void *user_stack = curr_ptr; 258: 89 c1 mov %eax,%ecx 25a: eb e3 jmp 23f <thread_create+0x2b> } if (cell_full[i] == 1) { 25c: 83 3c 95 20 0e 00 00 cmpl $0x1,0xe20(,%edx,4) 263: 01 264: 74 34 je 29a <thread_create+0x86> return -1; } ptr_pairs[i].orig_ptr = curr_ptr; 266: 8d 1c 52 lea (%edx,%edx,2),%ebx 269: c1 e3 02 shl $0x2,%ebx 26c: 89 83 20 0b 00 00 mov %eax,0xb20(%ebx) ptr_pairs[i].offset_ptr = user_stack; 272: 89 8b 24 0b 00 00 mov %ecx,0xb24(%ebx) cell_full[i] = 1; 278: c7 04 95 20 0e 00 00 movl $0x1,0xe20(,%edx,4) 27f: 01 00 00 00 // curr_ptrs->next->orig_ptr = curr_ptr; // curr_ptrs->next->offset_ptr = user_stack; // curr_ptrs->next->next = NULL; // } return clone(user_stack, start_routine, arg1, arg2); 283: ff 75 10 pushl 0x10(%ebp) 286: ff 75 0c pushl 0xc(%ebp) 289: ff 75 08 pushl 0x8(%ebp) 28c: 51 push %ecx 28d: e8 dc 00 00 00 call 36e <clone> 292: 83 c4 10 add $0x10,%esp } 295: 8b 5d fc mov -0x4(%ebp),%ebx 298: c9 leave 299: c3 ret return -1; 29a: b8 ff ff ff ff mov $0xffffffff,%eax 29f: eb f4 jmp 295 <thread_create+0x81> 000002a1 <thread_join>: int thread_join(){ 2a1: f3 0f 1e fb endbr32 2a5: 55 push %ebp 2a6: 89 e5 mov %esp,%ebp 2a8: 56 push %esi 2a9: 53 push %ebx 2aa: 83 ec 1c sub $0x1c,%esp void* diov; int out = join(&diov); 2ad: 8d 45 f4 lea -0xc(%ebp),%eax 2b0: 50 push %eax 2b1: e8 d0 00 00 00 call 386 <join> 2b6: 89 c6 mov %eax,%esi // free(curr_ptrs->orig_ptr); // prev_ptrs->next = curr_ptrs->next; // free(curr_ptrs); int i; for (i = 0; i < NPROC; i++) { 2b8: 83 c4 10 add $0x10,%esp 2bb: bb 00 00 00 00 mov $0x0,%ebx 2c0: 83 fb 3f cmp $0x3f,%ebx 2c3: 7f 14 jg 2d9 <thread_join+0x38> if (ptr_pairs[i].offset_ptr == diov) { break; } 2c5: 8d 04 5b lea (%ebx,%ebx,2),%eax 2c8: 8b 55 f4 mov -0xc(%ebp),%edx 2cb: 39 14 85 24 0b 00 00 cmp %edx,0xb24(,%eax,4) 2d2: 74 05 je 2d9 <thread_join+0x38> for (i = 0; i < NPROC; i++) { 2d4: 83 c3 01 add $0x1,%ebx 2d7: eb e7 jmp 2c0 <thread_join+0x1f> } if (ptr_pairs[i].offset_ptr != diov) { return -1; } 2d9: 8d 04 5b lea (%ebx,%ebx,2),%eax 2dc: 8b 4d f4 mov -0xc(%ebp),%ecx 2df: 39 0c 85 24 0b 00 00 cmp %ecx,0xb24(,%eax,4) 2e6: 75 26 jne 30e <thread_join+0x6d> free(ptr_pairs[i].orig_ptr); 2e8: 83 ec 0c sub $0xc,%esp 2eb: ff 34 85 20 0b 00 00 pushl 0xb20(,%eax,4) 2f2: e8 35 03 00 00 call 62c <free> cell_full[i] = 0; 2f7: c7 04 9d 20 0e 00 00 movl $0x0,0xe20(,%ebx,4) 2fe: 00 00 00 00 return out; 302: 83 c4 10 add $0x10,%esp } 305: 89 f0 mov %esi,%eax 307: 8d 65 f8 lea -0x8(%ebp),%esp 30a: 5b pop %ebx 30b: 5e pop %esi 30c: 5d pop %ebp 30d: c3 ret if (ptr_pairs[i].offset_ptr != diov) { return -1; } 30e: be ff ff ff ff mov $0xffffffff,%esi 313: eb f0 jmp 305 <thread_join+0x64> 00000315 <lock_init>: : "memory" ); return value; } void lock_init(lock_t *lock) { 315: f3 0f 1e fb endbr32 319: 55 push %ebp 31a: 89 e5 mov %esp,%ebp 31c: 8b 45 08 mov 0x8(%ebp),%eax lock->ticket = 0; 31f: c7 00 00 00 00 00 movl $0x0,(%eax) lock->turn = 0; 325: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) } 32c: 5d pop %ebp 32d: c3 ret 0000032e <lock_acquire>: void lock_acquire(lock_t *lock) { 32e: f3 0f 1e fb endbr32 332: 55 push %ebp 333: 89 e5 mov %esp,%ebp 335: 8b 55 08 mov 0x8(%ebp),%edx __asm__ volatile("lock; xaddl %0, %1" 338: b9 01 00 00 00 mov $0x1,%ecx 33d: f0 0f c1 0a lock xadd %ecx,(%edx) 341: b8 00 00 00 00 mov $0x0,%eax 346: f0 0f c1 42 04 lock xadd %eax,0x4(%edx) int myturn = fetch_and_add(&lock->ticket, 1); while( fetch_and_add(&lock->turn, 0) != myturn ) { //changed 34b: 39 c1 cmp %eax,%ecx 34d: 75 f2 jne 341 <lock_acquire+0x13> ; // spin } } 34f: 5d pop %ebp 350: c3 ret 00000351 <lock_release>: void lock_release(lock_t *lock) { 351: f3 0f 1e fb endbr32 355: 55 push %ebp 356: 89 e5 mov %esp,%ebp 358: 8b 55 08 mov 0x8(%ebp),%edx lock->turn = lock->turn + 1; 35b: 8b 42 04 mov 0x4(%edx),%eax 35e: 83 c0 01 add $0x1,%eax 361: 89 42 04 mov %eax,0x4(%edx) } 364: 5d pop %ebp 365: c3 ret 00000366 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 366: b8 01 00 00 00 mov $0x1,%eax 36b: cd 40 int $0x40 36d: c3 ret 0000036e <clone>: SYSCALL(clone) 36e: b8 16 00 00 00 mov $0x16,%eax 373: cd 40 int $0x40 375: c3 ret 00000376 <exit>: SYSCALL(exit) 376: b8 02 00 00 00 mov $0x2,%eax 37b: cd 40 int $0x40 37d: c3 ret 0000037e <wait>: SYSCALL(wait) 37e: b8 03 00 00 00 mov $0x3,%eax 383: cd 40 int $0x40 385: c3 ret 00000386 <join>: SYSCALL(join) 386: b8 17 00 00 00 mov $0x17,%eax 38b: cd 40 int $0x40 38d: c3 ret 0000038e <pipe>: SYSCALL(pipe) 38e: b8 04 00 00 00 mov $0x4,%eax 393: cd 40 int $0x40 395: c3 ret 00000396 <read>: SYSCALL(read) 396: b8 05 00 00 00 mov $0x5,%eax 39b: cd 40 int $0x40 39d: c3 ret 0000039e <write>: SYSCALL(write) 39e: b8 10 00 00 00 mov $0x10,%eax 3a3: cd 40 int $0x40 3a5: c3 ret 000003a6 <close>: SYSCALL(close) 3a6: b8 15 00 00 00 mov $0x15,%eax 3ab: cd 40 int $0x40 3ad: c3 ret 000003ae <kill>: SYSCALL(kill) 3ae: b8 06 00 00 00 mov $0x6,%eax 3b3: cd 40 int $0x40 3b5: c3 ret 000003b6 <exec>: SYSCALL(exec) 3b6: b8 07 00 00 00 mov $0x7,%eax 3bb: cd 40 int $0x40 3bd: c3 ret 000003be <open>: SYSCALL(open) 3be: b8 0f 00 00 00 mov $0xf,%eax 3c3: cd 40 int $0x40 3c5: c3 ret 000003c6 <mknod>: SYSCALL(mknod) 3c6: b8 11 00 00 00 mov $0x11,%eax 3cb: cd 40 int $0x40 3cd: c3 ret 000003ce <unlink>: SYSCALL(unlink) 3ce: b8 12 00 00 00 mov $0x12,%eax 3d3: cd 40 int $0x40 3d5: c3 ret 000003d6 <fstat>: SYSCALL(fstat) 3d6: b8 08 00 00 00 mov $0x8,%eax 3db: cd 40 int $0x40 3dd: c3 ret 000003de <link>: SYSCALL(link) 3de: b8 13 00 00 00 mov $0x13,%eax 3e3: cd 40 int $0x40 3e5: c3 ret 000003e6 <mkdir>: SYSCALL(mkdir) 3e6: b8 14 00 00 00 mov $0x14,%eax 3eb: cd 40 int $0x40 3ed: c3 ret 000003ee <chdir>: SYSCALL(chdir) 3ee: b8 09 00 00 00 mov $0x9,%eax 3f3: cd 40 int $0x40 3f5: c3 ret 000003f6 <dup>: SYSCALL(dup) 3f6: b8 0a 00 00 00 mov $0xa,%eax 3fb: cd 40 int $0x40 3fd: c3 ret 000003fe <getpid>: SYSCALL(getpid) 3fe: b8 0b 00 00 00 mov $0xb,%eax 403: cd 40 int $0x40 405: c3 ret 00000406 <sbrk>: SYSCALL(sbrk) 406: b8 0c 00 00 00 mov $0xc,%eax 40b: cd 40 int $0x40 40d: c3 ret 0000040e <sleep>: SYSCALL(sleep) 40e: b8 0d 00 00 00 mov $0xd,%eax 413: cd 40 int $0x40 415: c3 ret 00000416 <uptime>: SYSCALL(uptime) 416: b8 0e 00 00 00 mov $0xe,%eax 41b: cd 40 int $0x40 41d: c3 ret 0000041e <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 41e: 55 push %ebp 41f: 89 e5 mov %esp,%ebp 421: 83 ec 1c sub $0x1c,%esp 424: 88 55 f4 mov %dl,-0xc(%ebp) write(fd, &c, 1); 427: 6a 01 push $0x1 429: 8d 55 f4 lea -0xc(%ebp),%edx 42c: 52 push %edx 42d: 50 push %eax 42e: e8 6b ff ff ff call 39e <write> } 433: 83 c4 10 add $0x10,%esp 436: c9 leave 437: c3 ret 00000438 <printint>: static void printint(int fd, int xx, int base, int sgn) { 438: 55 push %ebp 439: 89 e5 mov %esp,%ebp 43b: 57 push %edi 43c: 56 push %esi 43d: 53 push %ebx 43e: 83 ec 2c sub $0x2c,%esp 441: 89 45 d0 mov %eax,-0x30(%ebp) 444: 89 d6 mov %edx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 446: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 44a: 0f 95 c2 setne %dl 44d: 89 f0 mov %esi,%eax 44f: c1 e8 1f shr $0x1f,%eax 452: 84 c2 test %al,%dl 454: 74 42 je 498 <printint+0x60> neg = 1; x = -xx; 456: f7 de neg %esi neg = 1; 458: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%ebp) } else { x = xx; } i = 0; 45f: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; 464: 89 f0 mov %esi,%eax 466: ba 00 00 00 00 mov $0x0,%edx 46b: f7 f1 div %ecx 46d: 89 df mov %ebx,%edi 46f: 83 c3 01 add $0x1,%ebx 472: 0f b6 92 98 07 00 00 movzbl 0x798(%edx),%edx 479: 88 54 3d d8 mov %dl,-0x28(%ebp,%edi,1) }while((x /= base) != 0); 47d: 89 f2 mov %esi,%edx 47f: 89 c6 mov %eax,%esi 481: 39 d1 cmp %edx,%ecx 483: 76 df jbe 464 <printint+0x2c> if(neg) 485: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) 489: 74 2f je 4ba <printint+0x82> buf[i++] = '-'; 48b: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) 490: 8d 5f 02 lea 0x2(%edi),%ebx 493: 8b 75 d0 mov -0x30(%ebp),%esi 496: eb 15 jmp 4ad <printint+0x75> neg = 0; 498: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) 49f: eb be jmp 45f <printint+0x27> while(--i >= 0) putc(fd, buf[i]); 4a1: 0f be 54 1d d8 movsbl -0x28(%ebp,%ebx,1),%edx 4a6: 89 f0 mov %esi,%eax 4a8: e8 71 ff ff ff call 41e <putc> while(--i >= 0) 4ad: 83 eb 01 sub $0x1,%ebx 4b0: 79 ef jns 4a1 <printint+0x69> } 4b2: 83 c4 2c add $0x2c,%esp 4b5: 5b pop %ebx 4b6: 5e pop %esi 4b7: 5f pop %edi 4b8: 5d pop %ebp 4b9: c3 ret 4ba: 8b 75 d0 mov -0x30(%ebp),%esi 4bd: eb ee jmp 4ad <printint+0x75> 000004bf <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 4bf: f3 0f 1e fb endbr32 4c3: 55 push %ebp 4c4: 89 e5 mov %esp,%ebp 4c6: 57 push %edi 4c7: 56 push %esi 4c8: 53 push %ebx 4c9: 83 ec 1c sub $0x1c,%esp char *s; int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; 4cc: 8d 45 10 lea 0x10(%ebp),%eax 4cf: 89 45 e4 mov %eax,-0x1c(%ebp) state = 0; 4d2: be 00 00 00 00 mov $0x0,%esi for(i = 0; fmt[i]; i++){ 4d7: bb 00 00 00 00 mov $0x0,%ebx 4dc: eb 14 jmp 4f2 <printf+0x33> c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); 4de: 89 fa mov %edi,%edx 4e0: 8b 45 08 mov 0x8(%ebp),%eax 4e3: e8 36 ff ff ff call 41e <putc> 4e8: eb 05 jmp 4ef <printf+0x30> } } else if(state == '%'){ 4ea: 83 fe 25 cmp $0x25,%esi 4ed: 74 25 je 514 <printf+0x55> for(i = 0; fmt[i]; i++){ 4ef: 83 c3 01 add $0x1,%ebx 4f2: 8b 45 0c mov 0xc(%ebp),%eax 4f5: 0f b6 04 18 movzbl (%eax,%ebx,1),%eax 4f9: 84 c0 test %al,%al 4fb: 0f 84 23 01 00 00 je 624 <printf+0x165> c = fmt[i] & 0xff; 501: 0f be f8 movsbl %al,%edi 504: 0f b6 c0 movzbl %al,%eax if(state == 0){ 507: 85 f6 test %esi,%esi 509: 75 df jne 4ea <printf+0x2b> if(c == '%'){ 50b: 83 f8 25 cmp $0x25,%eax 50e: 75 ce jne 4de <printf+0x1f> state = '%'; 510: 89 c6 mov %eax,%esi 512: eb db jmp 4ef <printf+0x30> if(c == 'd'){ 514: 83 f8 64 cmp $0x64,%eax 517: 74 49 je 562 <printf+0xa3> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 519: 83 f8 78 cmp $0x78,%eax 51c: 0f 94 c1 sete %cl 51f: 83 f8 70 cmp $0x70,%eax 522: 0f 94 c2 sete %dl 525: 08 d1 or %dl,%cl 527: 75 63 jne 58c <printf+0xcd> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 529: 83 f8 73 cmp $0x73,%eax 52c: 0f 84 84 00 00 00 je 5b6 <printf+0xf7> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 532: 83 f8 63 cmp $0x63,%eax 535: 0f 84 b7 00 00 00 je 5f2 <printf+0x133> putc(fd, *ap); ap++; } else if(c == '%'){ 53b: 83 f8 25 cmp $0x25,%eax 53e: 0f 84 cc 00 00 00 je 610 <printf+0x151> putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 544: ba 25 00 00 00 mov $0x25,%edx 549: 8b 45 08 mov 0x8(%ebp),%eax 54c: e8 cd fe ff ff call 41e <putc> putc(fd, c); 551: 89 fa mov %edi,%edx 553: 8b 45 08 mov 0x8(%ebp),%eax 556: e8 c3 fe ff ff call 41e <putc> } state = 0; 55b: be 00 00 00 00 mov $0x0,%esi 560: eb 8d jmp 4ef <printf+0x30> printint(fd, *ap, 10, 1); 562: 8b 7d e4 mov -0x1c(%ebp),%edi 565: 8b 17 mov (%edi),%edx 567: 83 ec 0c sub $0xc,%esp 56a: 6a 01 push $0x1 56c: b9 0a 00 00 00 mov $0xa,%ecx 571: 8b 45 08 mov 0x8(%ebp),%eax 574: e8 bf fe ff ff call 438 <printint> ap++; 579: 83 c7 04 add $0x4,%edi 57c: 89 7d e4 mov %edi,-0x1c(%ebp) 57f: 83 c4 10 add $0x10,%esp state = 0; 582: be 00 00 00 00 mov $0x0,%esi 587: e9 63 ff ff ff jmp 4ef <printf+0x30> printint(fd, *ap, 16, 0); 58c: 8b 7d e4 mov -0x1c(%ebp),%edi 58f: 8b 17 mov (%edi),%edx 591: 83 ec 0c sub $0xc,%esp 594: 6a 00 push $0x0 596: b9 10 00 00 00 mov $0x10,%ecx 59b: 8b 45 08 mov 0x8(%ebp),%eax 59e: e8 95 fe ff ff call 438 <printint> ap++; 5a3: 83 c7 04 add $0x4,%edi 5a6: 89 7d e4 mov %edi,-0x1c(%ebp) 5a9: 83 c4 10 add $0x10,%esp state = 0; 5ac: be 00 00 00 00 mov $0x0,%esi 5b1: e9 39 ff ff ff jmp 4ef <printf+0x30> s = (char*)*ap; 5b6: 8b 45 e4 mov -0x1c(%ebp),%eax 5b9: 8b 30 mov (%eax),%esi ap++; 5bb: 83 c0 04 add $0x4,%eax 5be: 89 45 e4 mov %eax,-0x1c(%ebp) if(s == 0) 5c1: 85 f6 test %esi,%esi 5c3: 75 28 jne 5ed <printf+0x12e> s = "(null)"; 5c5: be 90 07 00 00 mov $0x790,%esi 5ca: 8b 7d 08 mov 0x8(%ebp),%edi 5cd: eb 0d jmp 5dc <printf+0x11d> putc(fd, *s); 5cf: 0f be d2 movsbl %dl,%edx 5d2: 89 f8 mov %edi,%eax 5d4: e8 45 fe ff ff call 41e <putc> s++; 5d9: 83 c6 01 add $0x1,%esi while(*s != 0){ 5dc: 0f b6 16 movzbl (%esi),%edx 5df: 84 d2 test %dl,%dl 5e1: 75 ec jne 5cf <printf+0x110> state = 0; 5e3: be 00 00 00 00 mov $0x0,%esi 5e8: e9 02 ff ff ff jmp 4ef <printf+0x30> 5ed: 8b 7d 08 mov 0x8(%ebp),%edi 5f0: eb ea jmp 5dc <printf+0x11d> putc(fd, *ap); 5f2: 8b 7d e4 mov -0x1c(%ebp),%edi 5f5: 0f be 17 movsbl (%edi),%edx 5f8: 8b 45 08 mov 0x8(%ebp),%eax 5fb: e8 1e fe ff ff call 41e <putc> ap++; 600: 83 c7 04 add $0x4,%edi 603: 89 7d e4 mov %edi,-0x1c(%ebp) state = 0; 606: be 00 00 00 00 mov $0x0,%esi 60b: e9 df fe ff ff jmp 4ef <printf+0x30> putc(fd, c); 610: 89 fa mov %edi,%edx 612: 8b 45 08 mov 0x8(%ebp),%eax 615: e8 04 fe ff ff call 41e <putc> state = 0; 61a: be 00 00 00 00 mov $0x0,%esi 61f: e9 cb fe ff ff jmp 4ef <printf+0x30> } } } 624: 8d 65 f4 lea -0xc(%ebp),%esp 627: 5b pop %ebx 628: 5e pop %esi 629: 5f pop %edi 62a: 5d pop %ebp 62b: c3 ret 0000062c <free>: static Header base; static Header *freep; void free(void *ap) { 62c: f3 0f 1e fb endbr32 630: 55 push %ebp 631: 89 e5 mov %esp,%ebp 633: 57 push %edi 634: 56 push %esi 635: 53 push %ebx 636: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; 639: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 63c: a1 00 0b 00 00 mov 0xb00,%eax 641: eb 02 jmp 645 <free+0x19> 643: 89 d0 mov %edx,%eax 645: 39 c8 cmp %ecx,%eax 647: 73 04 jae 64d <free+0x21> 649: 39 08 cmp %ecx,(%eax) 64b: 77 12 ja 65f <free+0x33> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 64d: 8b 10 mov (%eax),%edx 64f: 39 c2 cmp %eax,%edx 651: 77 f0 ja 643 <free+0x17> 653: 39 c8 cmp %ecx,%eax 655: 72 08 jb 65f <free+0x33> 657: 39 ca cmp %ecx,%edx 659: 77 04 ja 65f <free+0x33> 65b: 89 d0 mov %edx,%eax 65d: eb e6 jmp 645 <free+0x19> break; if(bp + bp->s.size == p->s.ptr){ 65f: 8b 73 fc mov -0x4(%ebx),%esi 662: 8d 3c f1 lea (%ecx,%esi,8),%edi 665: 8b 10 mov (%eax),%edx 667: 39 d7 cmp %edx,%edi 669: 74 19 je 684 <free+0x58> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 66b: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 66e: 8b 50 04 mov 0x4(%eax),%edx 671: 8d 34 d0 lea (%eax,%edx,8),%esi 674: 39 ce cmp %ecx,%esi 676: 74 1b je 693 <free+0x67> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 678: 89 08 mov %ecx,(%eax) freep = p; 67a: a3 00 0b 00 00 mov %eax,0xb00 } 67f: 5b pop %ebx 680: 5e pop %esi 681: 5f pop %edi 682: 5d pop %ebp 683: c3 ret bp->s.size += p->s.ptr->s.size; 684: 03 72 04 add 0x4(%edx),%esi 687: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 68a: 8b 10 mov (%eax),%edx 68c: 8b 12 mov (%edx),%edx 68e: 89 53 f8 mov %edx,-0x8(%ebx) 691: eb db jmp 66e <free+0x42> p->s.size += bp->s.size; 693: 03 53 fc add -0x4(%ebx),%edx 696: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 699: 8b 53 f8 mov -0x8(%ebx),%edx 69c: 89 10 mov %edx,(%eax) 69e: eb da jmp 67a <free+0x4e> 000006a0 <morecore>: static Header* morecore(uint nu) { 6a0: 55 push %ebp 6a1: 89 e5 mov %esp,%ebp 6a3: 53 push %ebx 6a4: 83 ec 04 sub $0x4,%esp 6a7: 89 c3 mov %eax,%ebx char *p; Header *hp; if(nu < 4096) 6a9: 3d ff 0f 00 00 cmp $0xfff,%eax 6ae: 77 05 ja 6b5 <morecore+0x15> nu = 4096; 6b0: bb 00 10 00 00 mov $0x1000,%ebx p = sbrk(nu * sizeof(Header)); 6b5: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax 6bc: 83 ec 0c sub $0xc,%esp 6bf: 50 push %eax 6c0: e8 41 fd ff ff call 406 <sbrk> if(p == (char*)-1) 6c5: 83 c4 10 add $0x10,%esp 6c8: 83 f8 ff cmp $0xffffffff,%eax 6cb: 74 1c je 6e9 <morecore+0x49> return 0; hp = (Header*)p; hp->s.size = nu; 6cd: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 6d0: 83 c0 08 add $0x8,%eax 6d3: 83 ec 0c sub $0xc,%esp 6d6: 50 push %eax 6d7: e8 50 ff ff ff call 62c <free> return freep; 6dc: a1 00 0b 00 00 mov 0xb00,%eax 6e1: 83 c4 10 add $0x10,%esp } 6e4: 8b 5d fc mov -0x4(%ebp),%ebx 6e7: c9 leave 6e8: c3 ret return 0; 6e9: b8 00 00 00 00 mov $0x0,%eax 6ee: eb f4 jmp 6e4 <morecore+0x44> 000006f0 <malloc>: void* malloc(uint nbytes) { 6f0: f3 0f 1e fb endbr32 6f4: 55 push %ebp 6f5: 89 e5 mov %esp,%ebp 6f7: 53 push %ebx 6f8: 83 ec 04 sub $0x4,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 6fb: 8b 45 08 mov 0x8(%ebp),%eax 6fe: 8d 58 07 lea 0x7(%eax),%ebx 701: c1 eb 03 shr $0x3,%ebx 704: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ 707: 8b 0d 00 0b 00 00 mov 0xb00,%ecx 70d: 85 c9 test %ecx,%ecx 70f: 74 04 je 715 <malloc+0x25> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 711: 8b 01 mov (%ecx),%eax 713: eb 4b jmp 760 <malloc+0x70> base.s.ptr = freep = prevp = &base; 715: c7 05 00 0b 00 00 04 movl $0xb04,0xb00 71c: 0b 00 00 71f: c7 05 04 0b 00 00 04 movl $0xb04,0xb04 726: 0b 00 00 base.s.size = 0; 729: c7 05 08 0b 00 00 00 movl $0x0,0xb08 730: 00 00 00 base.s.ptr = freep = prevp = &base; 733: b9 04 0b 00 00 mov $0xb04,%ecx 738: eb d7 jmp 711 <malloc+0x21> if(p->s.size >= nunits){ if(p->s.size == nunits) 73a: 74 1a je 756 <malloc+0x66> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 73c: 29 da sub %ebx,%edx 73e: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 741: 8d 04 d0 lea (%eax,%edx,8),%eax p->s.size = nunits; 744: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; 747: 89 0d 00 0b 00 00 mov %ecx,0xb00 return (void*)(p + 1); 74d: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 750: 83 c4 04 add $0x4,%esp 753: 5b pop %ebx 754: 5d pop %ebp 755: c3 ret prevp->s.ptr = p->s.ptr; 756: 8b 10 mov (%eax),%edx 758: 89 11 mov %edx,(%ecx) 75a: eb eb jmp 747 <malloc+0x57> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 75c: 89 c1 mov %eax,%ecx 75e: 8b 00 mov (%eax),%eax if(p->s.size >= nunits){ 760: 8b 50 04 mov 0x4(%eax),%edx 763: 39 da cmp %ebx,%edx 765: 73 d3 jae 73a <malloc+0x4a> if(p == freep) 767: 39 05 00 0b 00 00 cmp %eax,0xb00 76d: 75 ed jne 75c <malloc+0x6c> if((p = morecore(nunits)) == 0) 76f: 89 d8 mov %ebx,%eax 771: e8 2a ff ff ff call 6a0 <morecore> 776: 85 c0 test %eax,%eax 778: 75 e2 jne 75c <malloc+0x6c> 77a: eb d4 jmp 750 <malloc+0x60>
; Addition of two 8 bit numbers ORG 0000H ; Starting address of the program MOV R1,#10H ; First number MOV R2,#20H ; Second number MOV A,R1 ; Input first number from R1 to A MOV B,R2 ; Input second number from R2 to B ADD A,B ; Add A and B MOV R3,A ; Store the result in R3 RET
// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. #include "precomp.h" #include "AttrRow.hpp" // Routine Description: // - constructor // Arguments: // - cchRowWidth - the length of the default text attribute // - attr - the default text attribute // Return Value: // - constructed object // Note: will throw exception if unable to allocate memory for text attribute storage ATTR_ROW::ATTR_ROW(const UINT cchRowWidth, const TextAttribute attr) { _list.push_back(TextAttributeRun(cchRowWidth, attr)); _cchRowWidth = cchRowWidth; } // Routine Description: // - Sets all properties of the ATTR_ROW to default values // Arguments: // - attr - The default text attributes to use on text in this row. void ATTR_ROW::Reset(const TextAttribute attr) { _list.clear(); _list.push_back(TextAttributeRun(_cchRowWidth, attr)); } // Routine Description: // - Takes an existing row of attributes, and changes the length so that it fills the NewWidth. // If the new size is bigger, then the last attr is extended to fill the NewWidth. // If the new size is smaller, the runs are cut off to fit. // Arguments: // - oldWidth - The original width of the row. // - newWidth - The new width of the row. // Return Value: // - <none>, throws exceptions on failures. void ATTR_ROW::Resize(const size_t newWidth) { THROW_HR_IF(E_INVALIDARG, 0 == newWidth); // Easy case. If the new row is longer, increase the length of the last run by how much new space there is. if (newWidth > _cchRowWidth) { // Get the attribute that covers the final column of old width. const auto runPos = FindAttrIndex(_cchRowWidth - 1, nullptr); auto& run = _list.at(runPos); // Extend its length by the additional columns we're adding. run.SetLength(run.GetLength() + newWidth - _cchRowWidth); // Store that the new total width we represent is the new width. _cchRowWidth = newWidth; } // harder case: new row is shorter. else { // Get the attribute that covers the final column of the new width size_t CountOfAttr = 0; const auto runPos = FindAttrIndex(newWidth - 1, &CountOfAttr); auto& run = _list.at(runPos); // CountOfAttr was given to us as "how many columns left from this point forward are covered by the returned run" // So if the original run was B5 covering a 5 size OldWidth and we have a NewWidth of 3 // then when we called FindAttrIndex, it returned the B5 as the pIndexedRun and a 2 for how many more segments it covers // after and including the 3rd column. // B5-2 = B3, which is what we desire to cover the new 3 size buffer. run.SetLength(run.GetLength() - CountOfAttr + 1); // Store that the new total width we represent is the new width. _cchRowWidth = newWidth; // Erase segments after the one we just updated. _list.erase(_list.cbegin() + runPos + 1, _list.cend()); // NOTE: Under some circumstances here, we have leftover run segments in memory or blank run segments // in memory. We're not going to waste time redimensioning the array in the heap. We're just noting that the useful // portions of it have changed. } } // Routine Description: // - returns a copy of the TextAttribute at the specified column // Arguments: // - column - the column to get the attribute for // Return Value: // - the text attribute at column // Note: // - will throw on error TextAttribute ATTR_ROW::GetAttrByColumn(const size_t column) const { return GetAttrByColumn(column, nullptr); } // Routine Description: // - returns a copy of the TextAttribute at the specified column // Arguments: // - column - the column to get the attribute for // - pApplies - if given, fills how long this attribute will apply for // Return Value: // - the text attribute at column // Note: // - will throw on error TextAttribute ATTR_ROW::GetAttrByColumn(const size_t column, size_t* const pApplies) const { THROW_HR_IF(E_INVALIDARG, column >= _cchRowWidth); const auto runPos = FindAttrIndex(column, pApplies); return _list.at(runPos).GetAttributes(); } // Routine Description: // - reports how many runs we have stored (to be used for some optimizations // Return Value: // - Count of runs. 1 means we have 1 color to represent the entire row. size_t ATTR_ROW::GetNumberOfRuns() const noexcept { return _list.size(); } // Routine Description: // - This routine finds the nth attribute in this ATTR_ROW. // Arguments: // - index - which attribute to find // - applies - on output, contains corrected length of indexed attr. // for example, if the attribute string was { 5, BLUE } and the requested // index was 3, CountOfAttr would be 2. // Return Value: // - const reference to attribute run object size_t ATTR_ROW::FindAttrIndex(const size_t index, size_t* const pApplies) const { FAIL_FAST_IF(!(index < _cchRowWidth)); // The requested index cannot be longer than the total length described by this set of Attrs. size_t cTotalLength = 0; FAIL_FAST_IF(!(_list.size() > 0)); // There should be a non-zero and positive number of items in the array. // Scan through the internal array from position 0 adding up the lengths that each attribute applies to auto runPos = _list.cbegin(); do { cTotalLength += runPos->GetLength(); if (cTotalLength > index) { // If we've just passed up the requested index with the length we added, break early break; } runPos++; } while (runPos < _list.cend()); // we should have broken before falling out the while case. // if we didn't break, then this ATTR_ROW wasn't filled with enough attributes for the entire row of characters FAIL_FAST_IF(runPos >= _list.cend()); // The remaining iterator position is the position of the attribute that is applicable at the position requested (index) // Calculate its remaining applicability if requested // The length on which the found attribute applies is the total length seen so far minus the index we were searching for. FAIL_FAST_IF(!(cTotalLength > index)); // The length of all attributes we counted up so far should be longer than the index requested or we'll underflow. if (nullptr != pApplies) { const auto attrApplies = cTotalLength - index; FAIL_FAST_IF(!(attrApplies > 0)); // An attribute applies for >0 characters // MSFT: 17130145 - will restore this and add a better assert to catch the real issue. //FAIL_FAST_IF(!(attrApplies <= _cchRowWidth)); // An attribute applies for a maximum of the total length available to us *pApplies = attrApplies; } return runPos - _list.cbegin(); } // Routine Description: // - Finds the hyperlink IDs present in this row and returns them // Return value: // - An unordered set containing the hyperlink IDs present in this row std::unordered_set<uint16_t> ATTR_ROW::GetHyperlinks() { std::unordered_set<uint16_t> ids; for (const auto& run : _list) { if (run.GetAttributes().IsHyperlink()) { ids.emplace(run.GetAttributes().GetHyperlinkId()); } } return ids; } // Routine Description: // - Sets the attributes (colors) of all character positions from the given position through the end of the row. // Arguments: // - iStart - Starting index position within the row // - attr - Attribute (color) to fill remaining characters with // Return Value: // - <none> bool ATTR_ROW::SetAttrToEnd(const UINT iStart, const TextAttribute attr) { size_t const length = _cchRowWidth - iStart; const TextAttributeRun run(length, attr); return SUCCEEDED(InsertAttrRuns({ &run, 1 }, iStart, _cchRowWidth - 1, _cchRowWidth)); } // Method Description: // - Replaces all runs in the row with the given toBeReplacedAttr with the new // attribute replaceWith. // Arguments: // - toBeReplacedAttr - the attribute to replace in this row. // - replaceWith - the new value for the matching runs' attributes. // Return Value: // - <none> void ATTR_ROW::ReplaceAttrs(const TextAttribute& toBeReplacedAttr, const TextAttribute& replaceWith) noexcept { for (auto& run : _list) { if (run.GetAttributes() == toBeReplacedAttr) { run.SetAttributes(replaceWith); } } } // Routine Description: // - Takes a array of attribute runs, and inserts them into this row from startIndex to endIndex. // - For example, if the current row was was [{4, BLUE}], the merge string // was [{ 2, RED }], with (StartIndex, EndIndex) = (1, 2), // then the row would modified to be = [{ 1, BLUE}, {2, RED}, {1, BLUE}]. // Arguments: // - rgInsertAttrs - The array of attrRuns to merge into this row. // - cInsertAttrs - The number of elements in rgInsertAttrs // - iStart - The index in the row to place the array of runs. // - iEnd - the final index of the merge runs // - BufferWidth - the width of the row. // Return Value: // - STATUS_NO_MEMORY if there wasn't enough memory to insert the runs // otherwise STATUS_SUCCESS if we were successful. [[nodiscard]] HRESULT ATTR_ROW::InsertAttrRuns(const gsl::span<const TextAttributeRun> newAttrs, const size_t iStart, const size_t iEnd, const size_t cBufferWidth) { // Definitions: // Existing Run = The run length encoded color array we're already storing in memory before this was called. // Insert Run = The run length encoded color array that someone is asking us to inject into our stored memory run. // New Run = The run length encoded color array that we have to allocate and rebuild to store internally // which will replace Existing Run at the end of this function. // Example: // cBufferWidth = 10. // Existing Run: R3 -> G5 -> B2 // Insert Run: Y1 -> N1 at iStart = 5 and iEnd = 6 // (rgInsertAttrs is a 2 length array with Y1->N1 in it and cInsertAttrs = 2) // Final Run: R3 -> G2 -> Y1 -> N1 -> G1 -> B2 // We'll need to know what the last valid column is for some calculations versus iEnd // because iEnd is specified to us as an inclusive index value. // Do the -1 math here now so we don't have to have -1s scattered all over this function. const size_t iLastBufferCol = cBufferWidth - 1; // If the insertion size is 1, do some pre-processing to // see if we can get this done quickly. if (newAttrs.size() == 1) { // Get the new color attribute we're trying to apply const TextAttribute NewAttr = til::at(newAttrs, 0).GetAttributes(); // If the existing run was only 1 element... // ...and the new color is the same as the old, we don't have to do anything and can exit quick. if (_list.size() == 1 && _list.at(0).GetAttributes() == NewAttr) { return S_OK; } // .. otherwise if we internally have a list of 2 or more and we're about to insert a single color // it's possible that we just walk left-to-right through the row and find a quick exit. else if (iStart >= 0 && iStart == iEnd) { // First we try to find the run where the insertion happens, using lowerBound and upperBound to track // where we are currently at. const auto begin = _list.begin(); size_t lowerBound = 0; size_t upperBound = 0; for (size_t i = 0; i < _list.size(); i++) { const auto curr = begin + i; upperBound += curr->GetLength(); if (iStart >= lowerBound && iStart < upperBound) { // The run that we try to insert into has the same color as the new one. // e.g. // AAAAABBBBBBBCCC // ^ // AAAAABBBBBBBCCC // // 'B' is the new color and '^' represents where iStart is. We don't have to // do anything. if (curr->GetAttributes() == NewAttr) { return S_OK; } // If the current run has length of exactly one, we can simply change the attribute // of the current run. // e.g. // AAAAABCCCCCCCCC // ^ // AAAAADCCCCCCCCC // // Here 'D' is the new color. if (curr->GetLength() == 1) { curr->SetAttributes(NewAttr); return S_OK; } // If the insertion happens at current run's lower boundary... if (iStart == lowerBound && i > 0) { const auto prev = std::prev(curr, 1); // ... and the previous run has the same color as the new one, we can // just adjust the counts in the existing two elements in our internal list. // e.g. // AAAAABBBBBBBCCC // ^ // AAAAAABBBBBBCCC // // Here 'A' is the new color. if (NewAttr == prev->GetAttributes()) { prev->IncrementLength(); curr->DecrementLength(); // If we just reduced the right half to zero, just erase it out of the list. if (curr->GetLength() == 0) { _list.erase(curr); } return S_OK; } } // If the insertion happens at current run's upper boundary... if (iStart == upperBound - 1 && i + 1 < _list.size()) { // ...then let's try our luck with the next run if possible. This is basically the opposite // of what we did with the previous run. // e.g. // AAAAAABBBBBBCCC // ^ // AAAAABBBBBBBCCC // // Here 'B' is the new color. const auto next = std::next(curr, 1); if (NewAttr == next->GetAttributes()) { curr->DecrementLength(); next->IncrementLength(); if (curr->GetLength() == 0) { _list.erase(curr); } return S_OK; } } } // Advance one run in the _list. lowerBound = upperBound; // The lowerBound is larger than iStart, which means we fail to find an early exit at the run // where the insertion happens. We can just break out. if (lowerBound > iStart) { break; } } } } // If we're about to cover the entire existing run with a new one, we can also make an optimization. if (iStart == 0 && iEnd == iLastBufferCol) { // Just dump what we're given over what we have and call it a day. _list.assign(newAttrs.begin(), newAttrs.end()); return S_OK; } // In the worst case scenario, we will need a new run that is the length of // The existing run in memory + The new run in memory + 1. // This worst case occurs when we inject a new item in the middle of an existing run like so // Existing R3->B5->G2, Insertion Y2 starting at 5 (in the middle of the B5) // becomes R3->B2->Y2->B1->G2. // The original run was 3 long. The insertion run was 1 long. We need 1 more for the // fact that an existing piece of the run was split in half (to hold the latter half). const size_t cNewRun = _list.size() + newAttrs.size() + 1; std::vector<TextAttributeRun> newRun; newRun.reserve(cNewRun); // We will start analyzing from the beginning of our existing run. // Use some pointers to keep track of where we are in walking through our runs. // Get the existing run that we'll be updating/manipulating. const auto existingRun = _list.begin(); auto pExistingRunPos = existingRun; const auto pExistingRunEnd = _list.end(); auto pInsertRunPos = newAttrs.begin(); size_t cInsertRunRemaining = newAttrs.size(); size_t iExistingRunCoverage = 0; // Copy the existing run into the new buffer up to the "start index" where the new run will be injected. // If the new run starts at 0, we have nothing to copy from the beginning. if (iStart != 0) { // While we're less than the desired insertion position... while (iExistingRunCoverage < iStart) { // Add up how much length we can cover by copying an item from the existing run. iExistingRunCoverage += pExistingRunPos->GetLength(); // Copy it to the new run buffer and advance both pointers. newRun.push_back(*pExistingRunPos++); } // When we get to this point, we've copied full segments from the original existing run // into our new run buffer. We will have 1 or more full segments of color attributes and // we MIGHT have to cut the last copied segment's length back depending on where the inserted // attributes will fall in the final/new run. // Some examples: // - Starting with the original string R3 -> G5 -> B2 // - 1. If the insertion is Y5 at start index 3 // We are trying to get a result/final/new run of R3 -> Y5 -> B2. // We just copied R3 to the new destination buffer and we cang skip down and start inserting the new attrs. // - 2. If the insertion is Y3 at start index 5 // We are trying to get a result/final/new run of R3 -> G2 -> Y3 -> B2. // We just copied R3 -> G5 to the new destination buffer with the code above. // But the insertion is going to cut out some of the length of the G5. // We need to fix this up below so it says G2 instead to leave room for the Y3 to fit in // the new/final run. // Fetch out the length so we can fix it up based on the below conditions. size_t length = newRun.back().GetLength(); // If we've covered more cells already than the start of the attributes to be inserted... if (iExistingRunCoverage > iStart) { // ..then subtract some of the length of the final cell we copied. // We want to take remove the difference in distance between the cells we've covered in the new // run and the insertion point. // (This turns G5 into G2 from Example 2 just above) length -= (iExistingRunCoverage - iStart); } // Now we're still on that "last cell copied" into the new run. // If the color of that existing copied cell matches the color of the first segment // of the run we're about to insert, we can just increment the length to extend the coverage. if (newRun.back().GetAttributes() == pInsertRunPos->GetAttributes()) { length += pInsertRunPos->GetLength(); // Since the color matched, we have already "used up" part of the insert run // and can skip it in our big "memcopy" step below that will copy the bulk of the insert run. cInsertRunRemaining--; pInsertRunPos++; } // We're done manipulating the length. Store it back. newRun.back().SetLength(length); } // Bulk copy the majority (or all, depending on circumstance) of the insert run into the final run buffer. std::copy_n(pInsertRunPos, cInsertRunRemaining, std::back_inserter(newRun)); // We're technically done with the insert run now and have 0 remaining, but won't bother updating its pointers // and counts any further because we won't use them. // Now we need to move our pointer for the original existing run forward and update our counts // on how many cells we could have copied from the source before finishing off the new run. while (iExistingRunCoverage <= iEnd) { FAIL_FAST_IF(!(pExistingRunPos != pExistingRunEnd)); iExistingRunCoverage += pExistingRunPos->GetLength(); pExistingRunPos++; } // If we still have original existing run cells remaining, copy them into the final new run. if (pExistingRunPos != pExistingRunEnd || iExistingRunCoverage != (iEnd + 1)) { // We advanced the existing run pointer and its count to on or past the end of what the insertion run filled in. // If this ended up being past the end of what the insertion run covers, we have to account for the cells after // the insertion run but before the next piece of the original existing run. // The example in this case is if we had... // Existing Run = R3 -> G5 -> B2 -> X5 // Insert Run = Y2 @ iStart = 7 and iEnd = 8 // ... then at this point in time, our states would look like... // New Run so far = R3 -> G4 -> Y2 // Existing Run Pointer is at X5 // Existing run coverage count at 3 + 5 + 2 = 10. // However, in order to get the final desired New Run // (which is R3 -> G4 -> Y2 -> B1 -> X5) // we would need to grab a piece of that B2 we already skipped past. // iExistingRunCoverage = 10. iEnd = 8. iEnd+1 = 9. 10 > 9. So we skipped something. if (iExistingRunCoverage > (iEnd + 1)) { // Back up the existing run pointer so we can grab the piece we skipped. pExistingRunPos--; // If the color matches what's already in our run, just increment the count value. // This case is slightly off from the example above. This case is for if the B2 above was actually Y2. // That Y2 from the existing run is the same color as the Y2 we just filled a few columns left in the final run // so we can just adjust the final run's column count instead of adding another segment here. if (newRun.back().GetAttributes() == pExistingRunPos->GetAttributes()) { size_t length = newRun.back().GetLength(); length += (iExistingRunCoverage - (iEnd + 1)); newRun.back().SetLength(length); } else { // If the color didn't match, then we just need to copy the piece we skipped and adjust // its length for the discrepancy in columns not yet covered by the final/new run. // Move forward to a blank spot in the new run newRun.emplace_back(); // Copy the existing run's color information to the new run newRun.back().SetAttributes(pExistingRunPos->GetAttributes()); // Adjust the length of that copied color to cover only the reduced number of columns needed // now that some have been replaced by the insert run. newRun.back().SetLength(iExistingRunCoverage - (iEnd + 1)); } // Now that we're done recovering a piece of the existing run we skipped, move the pointer forward again. pExistingRunPos++; } // OK. In this case, we didn't skip anything. The end of the insert run fell right at a boundary // in columns that was in the original existing run. // However, the next piece of the original existing run might happen to have the same color attribute // as the final piece of what we just copied. // As an example... // Existing Run = R3 -> G5 -> B2. // Insert Run = B5 @ iStart = 3 and iEnd = 7 // New Run so far = R3 -> B5 // New Run desired when done = R3 -> B7 // Existing run pointer is on B2. // We want to merge the 2 from the B2 into the B5 so we get B7. else if (newRun.back().GetAttributes() == pExistingRunPos->GetAttributes()) { // Add the value from the existing run into the current new run position. size_t length = newRun.back().GetLength(); length += pExistingRunPos->GetLength(); newRun.back().SetLength(length); // Advance the existing run position since we consumed its value and merged it in. pExistingRunPos++; } // Now bulk copy any segments left in the original existing run if (pExistingRunPos < pExistingRunEnd) { std::copy_n(pExistingRunPos, (pExistingRunEnd - pExistingRunPos), std::back_inserter(newRun)); } } // OK, phew. We're done. Now we just need to free the existing run and store the new run in its place. _list.swap(newRun); return S_OK; } // Routine Description: // - packs a vector of TextAttribute into a vector of TextAttributeRun // Arguments: // - attrs - text attributes to pack // Return Value: // - packed text attribute run std::vector<TextAttributeRun> ATTR_ROW::PackAttrs(const std::vector<TextAttribute>& attrs) { std::vector<TextAttributeRun> runs; if (attrs.empty()) { return runs; } for (auto attr : attrs) { if (runs.empty() || runs.back().GetAttributes() != attr) { const TextAttributeRun run(1, attr); runs.push_back(run); } else { runs.back().SetLength(runs.back().GetLength() + 1); } } return runs; } ATTR_ROW::const_iterator ATTR_ROW::begin() const noexcept { return AttrRowIterator(this); } ATTR_ROW::const_iterator ATTR_ROW::end() const noexcept { return AttrRowIterator::CreateEndIterator(this); } ATTR_ROW::const_iterator ATTR_ROW::cbegin() const noexcept { return AttrRowIterator(this); } ATTR_ROW::const_iterator ATTR_ROW::cend() const noexcept { return AttrRowIterator::CreateEndIterator(this); } bool operator==(const ATTR_ROW& a, const ATTR_ROW& b) noexcept { return (a._list.size() == b._list.size() && a._list.data() == b._list.data() && a._cchRowWidth == b._cchRowWidth); }
/** * * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows * * Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*! \author Steve Lhomme \version \$Id$ */ #if !defined(STRICT) #define STRICT #endif // STRICT #include <algorithm> #include <windows.h> #include <windowsx.h> #include <intshcut.h> #include <mmreg.h> #include <msacm.h> #include <msacmdrv.h> #include <assert.h> #include <lame.h> #include "adebug.h" #include "resource.h" #include "ACMStream.h" #ifdef ENABLE_DECODING #include "DecodeStream.h" #endif // ENABLE_DECODING #include "ACM.h" #ifndef IDC_HAND #define IDC_HAND MAKEINTRESOURCE(32649) #endif // IDC_HAND char ACM::VersionString[120]; const char ACM_VERSION[] = "0.9.2"; #ifdef WIN32 // // 32-bit versions // #if (WINVER >= 0x0400) #define VERSION_ACM_DRIVER MAKE_ACM_VERSION(4, 0, 0) #else #define VERSION_ACM_DRIVER MAKE_ACM_VERSION(3, 51, 0) #endif #define VERSION_MSACM MAKE_ACM_VERSION(3, 50, 0) #else // // 16-bit versions // #define VERSION_ACM_DRIVER MAKE_ACM_VERSION(1, 0, 0) #define VERSION_MSACM MAKE_ACM_VERSION(2, 1, 0) #endif #define PERSONAL_FORMAT WAVE_FORMAT_MPEGLAYER3 #define SIZE_FORMAT_STRUCT sizeof(MPEGLAYER3WAVEFORMAT) //#define SIZE_FORMAT_STRUCT 0 //static const char channel_mode[][13] = {"mono","stereo","joint stereo","dual channel"}; static const char channel_mode[][13] = {"mono","stereo"}; static const unsigned int mpeg1_freq[] = {48000,44100,32000}; static const unsigned int mpeg2_freq[] = {24000,22050,16000,12000,11025,8000}; static const unsigned int mpeg1_bitrate[] = {320, 256, 224, 192, 160, 128, 112, 96, 80, 64, 56, 48, 40, 32}; static const unsigned int mpeg2_bitrate[] = {160, 144, 128, 112, 96, 80, 64, 56, 48, 40, 32, 24, 16, 8}; #define SIZE_CHANNEL_MODE (sizeof(channel_mode) / (sizeof(char) * 13)) #define SIZE_FREQ_MPEG1 (sizeof(mpeg1_freq) / sizeof(unsigned int)) #define SIZE_FREQ_MPEG2 (sizeof(mpeg2_freq) / sizeof(unsigned int)) #define SIZE_BITRATE_MPEG1 (sizeof(mpeg1_bitrate) / sizeof(unsigned int)) #define SIZE_BITRATE_MPEG2 (sizeof(mpeg2_bitrate) / sizeof(unsigned int)) static const int FORMAT_TAG_MAX_NB = 2; // PCM and PERSONAL (mandatory to have at least PCM and your format) static const int FILTER_TAG_MAX_NB = 0; // this is a codec, not a filter // number of supported PCM formats static const int FORMAT_MAX_NB_PCM = 2 * // number of PCM channel mode (stereo/mono) (SIZE_FREQ_MPEG1 + // number of MPEG 1 sampling freq SIZE_FREQ_MPEG2); // number of MPEG 2 sampling freq ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// bool bitrate_item::operator<(const bitrate_item & other_bitrate) const { return (other_bitrate.frequency < frequency || (other_bitrate.frequency == frequency && (other_bitrate.bitrate < bitrate || (other_bitrate.bitrate == bitrate && (other_bitrate.channels < channels))))); } ////////////////////////////////////////////////////////////////////// // Configuration Dialog ////////////////////////////////////////////////////////////////////// /* static CALLBACK ConfigProc( HWND hwndDlg, // handle to dialog box UINT uMsg, // message WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ) { BOOL bResult; switch (uMsg) { case WM_COMMAND: UINT command; command = GET_WM_COMMAND_ID(wParam, lParam); if (IDOK == command) { EndDialog(hwndDlg, (IDOK == command)); } else if (IDCANCEL == command) { EndDialog(hwndDlg, (IDOK == command)); } bResult = FALSE; break; default: bResult = FALSE; // will be treated by DefWindowProc } return bResult; } inline DWORD ACM::Configure(HWND hParentWindow, LPDRVCONFIGINFO pConfig) { my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "ACM : Configure (Parent Window = 0x%08X)",hParentWindow); DialogBoxParam( my_hModule, MAKEINTRESOURCE(IDD_CONFIG), hParentWindow, ::ConfigProc , (LPARAM)this); return DRVCNF_OK; // Can also return // DRVCNF_CANCEL // and DRVCNF_RESTART } */ ////////////////////////////////////////////////////////////////////// // About Dialog ////////////////////////////////////////////////////////////////////// static BOOL CALLBACK AboutProc( HWND hwndDlg, // handle to dialog box UINT uMsg, // message WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ) { static HBRUSH hBrushStatic = NULL; // static LOGFONT lf; // structure for font information // static HFONT hfnt; static HCURSOR hcOverCursor = NULL; BOOL bResult = FALSE; switch (uMsg) { case WM_INITDIALOG: char tmp[150]; wsprintf(tmp,"LAME MP3 codec v%s", ACM::GetVersionString()); ::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_ABOUT_TITLE), tmp); /* ::GetObject(::GetStockObject(DEFAULT_GUI_FONT), sizeof(LOGFONT), &lf); lf.lfUnderline = TRUE; hfnt = ::CreateFontIndirect(&lf); ::SendMessage(::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL), WM_SETFONT, (WPARAM) hfnt, TRUE); * / hBrushStatic = ::CreateSolidBrush(::GetSysColor (COLOR_BTNFACE)); */ hcOverCursor = ::LoadCursor(NULL,(LPCTSTR)IDC_HAND); if (hcOverCursor == NULL) hcOverCursor = ::LoadCursor(NULL,(LPCTSTR)IDC_CROSS); bResult = TRUE; break; /* case WM_CTLCOLORSTATIC: /// \todo only if there are URLs if ((HWND)lParam == ::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL)) { ::SetTextColor((HDC)wParam, ::GetSysColor (COLOR_HIGHLIGHT)); ::SetBkColor((HDC)wParam, ::GetSysColor (COLOR_BTNFACE)); return (LRESULT) hBrushStatic; } else return (LRESULT) NULL; */ case WM_MOUSEMOVE: { POINT pnt; ::GetCursorPos(&pnt); RECT rect; ::GetWindowRect( ::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL), &rect); if ( ::PtInRect(&rect,pnt) ) { ::SetCursor(hcOverCursor); } } break; case WM_LBUTTONUP: { POINT pnt; ::GetCursorPos(&pnt); RECT rect; ::GetWindowRect( ::GetDlgItem(hwndDlg,IDC_STATIC_ABOUT_URL), &rect); TCHAR Url[200]; bool bUrl = false; if (::PtInRect(&rect,pnt)) { wsprintf(Url,get_lame_url()); bUrl = true; } if (bUrl) { LPSTR tmpStr; HRESULT hresult = ::TranslateURL(Url, TRANSLATEURL_FL_GUESS_PROTOCOL|TRANSLATEURL_FL_GUESS_PROTOCOL, &tmpStr); if (hresult == S_OK) ::ShellExecute(hwndDlg,"open",tmpStr,NULL,"",SW_SHOWMAXIMIZED ); else if (hresult == S_FALSE) ::ShellExecute(hwndDlg,"open",Url,NULL,"",SW_SHOWMAXIMIZED ); } } break; case WM_COMMAND: UINT command; command = GET_WM_COMMAND_ID(wParam, lParam); if (IDOK == command) { EndDialog(hwndDlg, TRUE); } bResult = FALSE; break; case IDC_STATIC_ABOUT_URL: break; default: bResult = FALSE; // will be treated by DefWindowProc } return bResult; } inline DWORD ACM::About(HWND hParentWindow) { my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "ACM : About (Parent Window = 0x%08X)",hParentWindow); DialogBoxParam( my_hModule, MAKEINTRESOURCE(IDD_ABOUT), hParentWindow, ::AboutProc , (LPARAM)this); return DRVCNF_OK; // Can also return // DRVCNF_CANCEL // and DRVCNF_RESTART } ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// ACM::ACM( HMODULE hModule ) :my_hModule(hModule), my_hIcon(NULL), my_debug(ADbg(DEBUG_LEVEL_CREATION)), my_EncodingProperties(hModule) { my_EncodingProperties.ParamsRestore(); /// \todo get the debug level from the registry unsigned char DebugFileName[512]; char tmp[128]; wsprintf(tmp,"LAMEacm 0x%08X",this); my_debug.setPrefix(tmp); /// \todo get it from the registry my_debug.setIncludeTime(true); /// \todo get it from the registry // Check in the registry if we have to Output Debug information DebugFileName[0] = '\0'; HKEY OssKey; if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SOFTWARE\\MUKOLI", 0, KEY_READ , &OssKey ) == ERROR_SUCCESS) { DWORD DataType; DWORD DebugFileNameSize = 512; if (RegQueryValueEx( OssKey, "DebugFile", NULL, &DataType, DebugFileName, &DebugFileNameSize ) == ERROR_SUCCESS) { if (DataType == REG_SZ) { my_debug.setUseFile(true); my_debug.setDebugFile((char *)DebugFileName); my_debug.OutPut("Debug file is %s",(char *)DebugFileName); } } } wsprintf(VersionString,"%s - %s", ACM_VERSION, get_lame_version() ); BuildBitrateTable(); my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "New ACM Creation (0x%08X)",this); } ACM::~ACM() { // not used, it's done automatically when closing the driver if (my_hIcon != NULL) // CloseHandle(my_hIcon); bitrate_table.clear(); my_debug.OutPut(DEBUG_LEVEL_FUNC_START, "ACM Deleted (0x%08X)",this); } ////////////////////////////////////////////////////////////////////// // Main message handler ////////////////////////////////////////////////////////////////////// LONG ACM::DriverProcedure(const HDRVR hdrvr, const UINT msg, LONG lParam1, LONG lParam2) { DWORD dwRes = 0L; //my_debug.OutPut(DEBUG_LEVEL_MSG, "message 0x%08X for ThisACM 0x%08X", msg, this); switch (msg) { case DRV_INSTALL: my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_INSTALL"); // Sent when the driver is installed. dwRes = DRVCNF_OK; // Can also return break; // DRVCNF_CANCEL // and DRV_RESTART case DRV_REMOVE: // Sent when the driver is removed. my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_REMOVE"); dwRes = 1L; // return value ignored break; case DRV_QUERYCONFIGURE: my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_QUERYCONFIGURE"); // Sent to determine if the driver can be // configured. dwRes = 1L; // Zero indicates configuration break; // NOT supported case DRV_CONFIGURE: my_debug.OutPut(DEBUG_LEVEL_MSG, "DRV_CONFIGURE"); // Sent to display the configuration // dialog box for the driver. // dwRes = Configure( (HWND) lParam1, (LPDRVCONFIGINFO) lParam2 ); if (my_EncodingProperties.Config(my_hModule, (HWND) lParam1)) { dwRes = DRVCNF_OK; // Can also return // DRVCNF_CANCEL // and DRVCNF_RESTART } else { dwRes = DRVCNF_CANCEL; } break; /************************************** // ACM additional messages ***************************************/ case ACMDM_DRIVER_ABOUT: my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_DRIVER_ABOUT"); dwRes = About( (HWND) lParam1 ); break; case ACMDM_DRIVER_DETAILS: // acmDriverDetails // Fill-in general informations about the driver/codec my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_DRIVER_DETAILS"); dwRes = OnDriverDetails(hdrvr, (LPACMDRIVERDETAILS) lParam1); break; case ACMDM_FORMATTAG_DETAILS: // acmFormatTagDetails my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_FORMATTAG_DETAILS"); dwRes = OnFormatTagDetails((LPACMFORMATTAGDETAILS) lParam1, lParam2); break; case ACMDM_FORMAT_DETAILS: // acmFormatDetails my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_FORMAT_DETAILS"); dwRes = OnFormatDetails((LPACMFORMATDETAILS) lParam1, lParam2); break; case ACMDM_FORMAT_SUGGEST: // acmFormatSuggest // Sent to determine if the driver can be // configured. my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_FORMAT_SUGGEST"); dwRes = OnFormatSuggest((LPACMDRVFORMATSUGGEST) lParam1); break; /************************************** // ACM stream messages ***************************************/ case ACMDM_STREAM_OPEN: // Sent to determine if the driver can be // configured. my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_OPEN"); dwRes = OnStreamOpen((LPACMDRVSTREAMINSTANCE) lParam1); break; case ACMDM_STREAM_SIZE: // returns a recommended size for a source // or destination buffer on an ACM stream my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_SIZE"); dwRes = OnStreamSize((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMDRVSTREAMSIZE)lParam2); break; case ACMDM_STREAM_PREPARE: // prepares an ACMSTREAMHEADER structure for // an ACM stream conversion my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_PREPARE"); dwRes = OnStreamPrepareHeader((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMSTREAMHEADER) lParam2); break; case ACMDM_STREAM_UNPREPARE: // cleans up the preparation performed by // the ACMDM_STREAM_PREPARE message for an ACM stream my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_UNPREPARE"); dwRes = OnStreamUnPrepareHeader((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMSTREAMHEADER) lParam2); break; case ACMDM_STREAM_CONVERT: // perform a conversion on the specified conversion stream my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_CONVERT"); dwRes = OnStreamConvert((LPACMDRVSTREAMINSTANCE)lParam1, (LPACMDRVSTREAMHEADER) lParam2); break; case ACMDM_STREAM_CLOSE: // closes an ACM conversion stream my_debug.OutPut(DEBUG_LEVEL_MSG, "ACMDM_STREAM_CLOSE"); dwRes = OnStreamClose((LPACMDRVSTREAMINSTANCE)lParam1); break; /************************************** // Unknown message ***************************************/ default: // Process any other messages. my_debug.OutPut(DEBUG_LEVEL_MSG, "ACM::DriverProc unknown message (0x%08X), lParam1 = 0x%08X, lParam2 = 0x%08X", msg, lParam1, lParam2); return DefDriverProc ((DWORD)this, hdrvr, msg, lParam1, lParam2); } return dwRes; } ////////////////////////////////////////////////////////////////////// // Special message handlers ////////////////////////////////////////////////////////////////////// /*! Retreive the config details of this ACM driver The index represent the specified format \param a_FormatDetails will be filled with all the corresponding data */ inline DWORD ACM::OnFormatDetails(LPACMFORMATDETAILS a_FormatDetails, const LPARAM a_Query) { DWORD Result = ACMERR_NOTPOSSIBLE; my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATDETAILS a_Query = 0x%08X",a_Query); switch (a_Query & ACM_FORMATDETAILSF_QUERYMASK) { // Fill-in the informations corresponding to the FormatDetails->dwFormatTagIndex case ACM_FORMATDETAILSF_INDEX : my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "enter ACM_FORMATDETAILSF_INDEX for index 0x%04X:%03d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex); if (a_FormatDetails->dwFormatTag == PERSONAL_FORMAT) { if (a_FormatDetails->dwFormatIndex < GetNumberEncodingFormats()) { LPWAVEFORMATEX WaveExt; WaveExt = a_FormatDetails->pwfx; WaveExt->wFormatTag = PERSONAL_FORMAT; my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format in : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec); GetMP3FormatForIndex(a_FormatDetails->dwFormatIndex, *WaveExt, a_FormatDetails->szFormat); my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format out : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec); Result = MMSYSERR_NOERROR; } else { my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATDETAILSF_INDEX unknown index 0x%04X:%03d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex); } } else if (a_FormatDetails->dwFormatTag == WAVE_FORMAT_PCM) { if (a_FormatDetails->dwFormatIndex < FORMAT_MAX_NB_PCM) { LPWAVEFORMATEX WaveExt; WaveExt = a_FormatDetails->pwfx; WaveExt->wFormatTag = WAVE_FORMAT_PCM; my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format in : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec); GetPCMFormatForIndex(a_FormatDetails->dwFormatIndex, *WaveExt, a_FormatDetails->szFormat); my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "format out : channels %d, sample rate %d", WaveExt->nChannels, WaveExt->nSamplesPerSec); Result = MMSYSERR_NOERROR; } else { my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATDETAILSF_INDEX unknown index 0x%04X:%03d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex); } } else { my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Unknown a_FormatDetails->dwFormatTag = 0x%08X",a_FormatDetails->dwFormatTag); } case ACM_FORMATDETAILSF_FORMAT : /// \todo we may output the corresponding strong (only for personal format) LPWAVEFORMATEX WaveExt; WaveExt = a_FormatDetails->pwfx; my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "enter ACM_FORMATDETAILSF_FORMAT : 0x%04X:%03d, format in : channels %d, sample rate %d",a_FormatDetails->dwFormatTag,a_FormatDetails->dwFormatIndex, WaveExt->nChannels, WaveExt->nSamplesPerSec); Result = MMSYSERR_NOERROR; break; default: Result = ACMERR_NOTPOSSIBLE; break; } a_FormatDetails->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; return Result; } /*! Retreive the details of each known format by this ACM driver The index represent the specified format (0 = MP3 / 1 = PCM) \param a_FormatTagDetails will be filled with all the corresponding data */ inline DWORD ACM::OnFormatTagDetails(LPACMFORMATTAGDETAILS a_FormatTagDetails, const LPARAM a_Query) { DWORD Result; DWORD the_format = WAVE_FORMAT_UNKNOWN; // the format to give details if (a_FormatTagDetails->cbStruct >= sizeof(*a_FormatTagDetails)) { my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACMDM_FORMATTAG_DETAILS, a_Query = 0x%08X",a_Query); switch(a_Query & ACM_FORMATTAGDETAILSF_QUERYMASK) { case ACM_FORMATTAGDETAILSF_INDEX: // Fill-in the informations corresponding to the a_FormatDetails->dwFormatTagIndex my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "get ACM_FORMATTAGDETAILSF_INDEX for index %03d",a_FormatTagDetails->dwFormatTagIndex); if (a_FormatTagDetails->dwFormatTagIndex < FORMAT_TAG_MAX_NB) { switch (a_FormatTagDetails->dwFormatTagIndex) { case 0: the_format = PERSONAL_FORMAT; break; default : the_format = WAVE_FORMAT_PCM; break; } } else { my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATTAGDETAILSF_INDEX for unsupported index %03d",a_FormatTagDetails->dwFormatTagIndex); Result = ACMERR_NOTPOSSIBLE; } break; case ACM_FORMATTAGDETAILSF_FORMATTAG: // Fill-in the informations corresponding to the a_FormatDetails->dwFormatTagIndex and hdrvr given switch (a_FormatTagDetails->dwFormatTag) { case WAVE_FORMAT_PCM: the_format = WAVE_FORMAT_PCM; break; case PERSONAL_FORMAT: the_format = PERSONAL_FORMAT; break; default: return (ACMERR_NOTPOSSIBLE); } my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "get ACM_FORMATTAGDETAILSF_FORMATTAG for index 0x%02X, cStandardFormats = %d",a_FormatTagDetails->dwFormatTagIndex,a_FormatTagDetails->cStandardFormats); break; case ACM_FORMATTAGDETAILSF_LARGESTSIZE: my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "ACM_FORMATTAGDETAILSF_LARGESTSIZE not used"); Result = 0L; break; default: my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails Unknown Format tag query"); Result = MMSYSERR_NOTSUPPORTED; break; } my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails the_format = 0x%08X",the_format); switch(the_format) { case WAVE_FORMAT_PCM: a_FormatTagDetails->dwFormatTag = WAVE_FORMAT_PCM; a_FormatTagDetails->dwFormatTagIndex = 0; a_FormatTagDetails->cbFormatSize = sizeof(PCMWAVEFORMAT); /// \note 0 may mean we don't know how to decode a_FormatTagDetails->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; a_FormatTagDetails->cStandardFormats = FORMAT_MAX_NB_PCM; // should be filled by Windows a_FormatTagDetails->szFormatTag[0] = '\0'; Result = MMSYSERR_NOERROR; break; case PERSONAL_FORMAT: a_FormatTagDetails->dwFormatTag = PERSONAL_FORMAT; a_FormatTagDetails->dwFormatTagIndex = 1; a_FormatTagDetails->cbFormatSize = SIZE_FORMAT_STRUCT; a_FormatTagDetails->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; a_FormatTagDetails->cStandardFormats = GetNumberEncodingFormats(); lstrcpyW( a_FormatTagDetails->szFormatTag, L"Lame MP3" ); Result = MMSYSERR_NOERROR; break; default: my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails Unknown format 0x%08X",the_format); return (ACMERR_NOTPOSSIBLE); } my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnFormatTagDetails %d possibilities for format 0x%08X",a_FormatTagDetails->cStandardFormats,the_format); } else { my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "a_FormatTagDetails->cbStruct < sizeof(*a_FormatDetails)"); Result = ACMERR_NOTPOSSIBLE; } return Result; } /*! Retreive the global details of this ACM driver \param a_DriverDetail will be filled with all the corresponding data */ inline DWORD ACM::OnDriverDetails(const HDRVR hdrvr, LPACMDRIVERDETAILS a_DriverDetail) { if (my_hIcon == NULL) my_hIcon = LoadIcon(GetDriverModuleHandle(hdrvr), MAKEINTRESOURCE(IDI_ICON)); a_DriverDetail->hicon = my_hIcon; a_DriverDetail->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC; a_DriverDetail->fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED; /// \note this is an explicit hack of the FhG values /// \note later it could be a new value when the decoding is done a_DriverDetail->wMid = MM_FRAUNHOFER_IIS; a_DriverDetail->wPid = MM_FHGIIS_MPEGLAYER3; a_DriverDetail->vdwACM = VERSION_MSACM; a_DriverDetail->vdwDriver = VERSION_ACM_DRIVER; a_DriverDetail->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC; a_DriverDetail->cFormatTags = FORMAT_TAG_MAX_NB; // 2 : MP3 and PCM // a_DriverDetail->cFormatTags = 1; // 2 : MP3 and PCM a_DriverDetail->cFilterTags = FILTER_TAG_MAX_NB; lstrcpyW( a_DriverDetail->szShortName, L"LAME MP3" ); char tmpStr[128]; wsprintf(tmpStr, "LAME MP3 Codec v%s", GetVersionString()); int u = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, tmpStr, -1, a_DriverDetail->szLongName, 0); MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, tmpStr, -1, a_DriverDetail->szLongName, u); lstrcpyW( a_DriverDetail->szCopyright, L"2002 Steve Lhomme" ); lstrcpyW( a_DriverDetail->szLicensing, L"LGPL (see gnu.org)" ); /// \todo update this part when the code changes lstrcpyW( a_DriverDetail->szFeatures , L"only CBR implementation" ); return MMSYSERR_NOERROR; // Can also return DRVCNF_CANCEL } /*! Suggest an output format for the specified input format \param a_FormatSuggest will be filled with all the corresponding data */ inline DWORD ACM::OnFormatSuggest(LPACMDRVFORMATSUGGEST a_FormatSuggest) { DWORD Result = MMSYSERR_NOTSUPPORTED; DWORD fdwSuggest = (ACM_FORMATSUGGESTF_TYPEMASK & a_FormatSuggest->fdwSuggest); my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest %s%s%s%s (0x%08X)", (fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS) ? "channels, ":"", (fdwSuggest & ACM_FORMATSUGGESTF_NSAMPLESPERSEC) ? "samples/sec, ":"", (fdwSuggest & ACM_FORMATSUGGESTF_WBITSPERSAMPLE) ? "bits/sample, ":"", (fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG) ? "format, ":"", fdwSuggest); my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest for source format = 0x%04X, channels = %d, Samples/s = %d, AvgB/s = %d, BlockAlign = %d, b/sample = %d", a_FormatSuggest->pwfxSrc->wFormatTag, a_FormatSuggest->pwfxSrc->nChannels, a_FormatSuggest->pwfxSrc->nSamplesPerSec, a_FormatSuggest->pwfxSrc->nAvgBytesPerSec, a_FormatSuggest->pwfxSrc->nBlockAlign, a_FormatSuggest->pwfxSrc->wBitsPerSample); my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggested destination format = 0x%04X, channels = %d, Samples/s = %d, AvgB/s = %d, BlockAlign = %d, b/sample = %d", a_FormatSuggest->pwfxDst->wFormatTag, a_FormatSuggest->pwfxDst->nChannels, a_FormatSuggest->pwfxDst->nSamplesPerSec, a_FormatSuggest->pwfxDst->nAvgBytesPerSec, a_FormatSuggest->pwfxDst->nBlockAlign, a_FormatSuggest->pwfxDst->wBitsPerSample); switch (a_FormatSuggest->pwfxSrc->wFormatTag) { case WAVE_FORMAT_PCM: /// \todo handle here the decoding ? my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest for PCM source"); // // if the destination format tag is restricted, verify that // it is within our capabilities... // // this driver is able to decode to PCM // if (ACM_FORMATSUGGESTF_WFORMATTAG & fdwSuggest) { if (PERSONAL_FORMAT != a_FormatSuggest->pwfxDst->wFormatTag) return (ACMERR_NOTPOSSIBLE); } else { a_FormatSuggest->pwfxDst->wFormatTag = PERSONAL_FORMAT; } my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed A"); // // if the destination channel count is restricted, verify that // it is within our capabilities... // // this driver is not able to change the number of channels // if (ACM_FORMATSUGGESTF_NCHANNELS & fdwSuggest) { if (a_FormatSuggest->pwfxSrc->nChannels != a_FormatSuggest->pwfxDst->nChannels) return (ACMERR_NOTPOSSIBLE); } else { a_FormatSuggest->pwfxDst->nChannels = a_FormatSuggest->pwfxSrc->nChannels; } if (a_FormatSuggest->pwfxSrc->nChannels != 1 && a_FormatSuggest->pwfxSrc->nChannels != 2) return MMSYSERR_INVALPARAM; my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed B"); // // if the destination samples per second is restricted, verify // that it is within our capabilities... // // this driver is not able to change the sample rate // if (ACM_FORMATSUGGESTF_NSAMPLESPERSEC & fdwSuggest) { if (a_FormatSuggest->pwfxSrc->nSamplesPerSec != a_FormatSuggest->pwfxDst->nSamplesPerSec) return (ACMERR_NOTPOSSIBLE); } else { a_FormatSuggest->pwfxDst->nSamplesPerSec = a_FormatSuggest->pwfxSrc->nSamplesPerSec; } my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed C"); // // if the destination bits per sample is restricted, verify // that it is within our capabilities... // // We prefer decoding to 16-bit PCM. // if (ACM_FORMATSUGGESTF_WBITSPERSAMPLE & fdwSuggest) { if ( (16 != a_FormatSuggest->pwfxDst->wBitsPerSample) && (8 != a_FormatSuggest->pwfxDst->wBitsPerSample) ) return (ACMERR_NOTPOSSIBLE); } else { a_FormatSuggest->pwfxDst->wBitsPerSample = 16; } // a_FormatSuggest->pwfxDst->nBlockAlign = FORMAT_BLOCK_ALIGN; a_FormatSuggest->pwfxDst->nBlockAlign = a_FormatSuggest->pwfxDst->nChannels * a_FormatSuggest->pwfxDst->wBitsPerSample / 8; a_FormatSuggest->pwfxDst->nAvgBytesPerSec = a_FormatSuggest->pwfxDst->nChannels * 64000 / 8; my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed"); Result = MMSYSERR_NOERROR; break; case PERSONAL_FORMAT: my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest for PERSONAL source"); // // if the destination format tag is restricted, verify that // it is within our capabilities... // // this driver is able to decode to PCM // if (ACM_FORMATSUGGESTF_WFORMATTAG & fdwSuggest) { if (WAVE_FORMAT_PCM != a_FormatSuggest->pwfxDst->wFormatTag) return (ACMERR_NOTPOSSIBLE); } else { a_FormatSuggest->pwfxDst->wFormatTag = WAVE_FORMAT_PCM; } // // if the destination channel count is restricted, verify that // it is within our capabilities... // // this driver is not able to change the number of channels // if (ACM_FORMATSUGGESTF_NCHANNELS & fdwSuggest) { if (a_FormatSuggest->pwfxSrc->nChannels != a_FormatSuggest->pwfxDst->nChannels) return (ACMERR_NOTPOSSIBLE); } else { a_FormatSuggest->pwfxDst->nChannels = a_FormatSuggest->pwfxSrc->nChannels; } // // if the destination samples per second is restricted, verify // that it is within our capabilities... // // this driver is not able to change the sample rate // if (ACM_FORMATSUGGESTF_NSAMPLESPERSEC & fdwSuggest) { if (a_FormatSuggest->pwfxSrc->nSamplesPerSec != a_FormatSuggest->pwfxDst->nSamplesPerSec) return (ACMERR_NOTPOSSIBLE); } else { a_FormatSuggest->pwfxDst->nSamplesPerSec = a_FormatSuggest->pwfxSrc->nSamplesPerSec; } // // if the destination bits per sample is restricted, verify // that it is within our capabilities... // // We prefer decoding to 16-bit PCM. // if (ACM_FORMATSUGGESTF_WBITSPERSAMPLE & fdwSuggest) { if ( (16 != a_FormatSuggest->pwfxDst->wBitsPerSample) && (8 != a_FormatSuggest->pwfxDst->wBitsPerSample) ) return (ACMERR_NOTPOSSIBLE); } else { a_FormatSuggest->pwfxDst->wBitsPerSample = 16; } // a_FormatSuggest->pwfxDst->nBlockAlign = FORMAT_BLOCK_ALIGN; a_FormatSuggest->pwfxDst->nBlockAlign = a_FormatSuggest->pwfxDst->nChannels * a_FormatSuggest->pwfxDst->wBitsPerSample / 8; /// \todo this value must be a correct one ! a_FormatSuggest->pwfxDst->nAvgBytesPerSec = a_FormatSuggest->pwfxDst->nSamplesPerSec * a_FormatSuggest->pwfxDst->nChannels * a_FormatSuggest->pwfxDst->wBitsPerSample / 8; my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggest succeed"); Result = MMSYSERR_NOERROR; break; } my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Suggested destination format = 0x%04X, channels = %d, Samples/s = %d, AvgB/s = %d, BlockAlign = %d, b/sample = %d", a_FormatSuggest->pwfxDst->wFormatTag, a_FormatSuggest->pwfxDst->nChannels, a_FormatSuggest->pwfxDst->nSamplesPerSec, a_FormatSuggest->pwfxDst->nAvgBytesPerSec, a_FormatSuggest->pwfxDst->nBlockAlign, a_FormatSuggest->pwfxDst->wBitsPerSample); return Result; } /*! Create a stream instance for decoding/encoding \param a_StreamInstance contain information about the stream desired */ inline DWORD ACM::OnStreamOpen(LPACMDRVSTREAMINSTANCE a_StreamInstance) { DWORD Result = ACMERR_NOTPOSSIBLE; // // the most important condition to check before doing anything else // is that this ACM driver can actually perform the conversion we are // being opened for. this check should fail as quickly as possible // if the conversion is not possible by this driver. // // it is VERY important to fail quickly so the ACM can attempt to // find a driver that is suitable for the conversion. also note that // the ACM may call this driver several times with slightly different // format specifications before giving up. // // this driver first verifies that the source and destination formats // are acceptable... // switch (a_StreamInstance->pwfxSrc->wFormatTag) { case WAVE_FORMAT_PCM: my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PCM source (%05d samples %d channels %d bits/sample)",a_StreamInstance->pwfxSrc->nSamplesPerSec,a_StreamInstance->pwfxSrc->nChannels,a_StreamInstance->pwfxSrc->wBitsPerSample); if (a_StreamInstance->pwfxDst->wFormatTag == PERSONAL_FORMAT) { unsigned int OutputFrequency; /// \todo Smart mode if (my_EncodingProperties.GetSmartOutputMode()) OutputFrequency = ACMStream::GetOutputSampleRate(a_StreamInstance->pwfxSrc->nSamplesPerSec,a_StreamInstance->pwfxDst->nAvgBytesPerSec,a_StreamInstance->pwfxDst->nChannels); else OutputFrequency = a_StreamInstance->pwfxSrc->nSamplesPerSec; my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PERSONAL output (%05d samples %d channels %d bits/sample %d kbps)",a_StreamInstance->pwfxDst->nSamplesPerSec,a_StreamInstance->pwfxDst->nChannels,a_StreamInstance->pwfxDst->wBitsPerSample,8 * a_StreamInstance->pwfxDst->nAvgBytesPerSec); /// \todo add the possibility to have channel resampling (mono to stereo / stereo to mono) /// \todo support resampling ? /// \todo only do the test on OutputFrequency in "Smart Output" mode if (a_StreamInstance->pwfxDst->nSamplesPerSec != OutputFrequency || // a_StreamInstance->pwfxSrc->nSamplesPerSec != a_StreamInstance->pwfxDst->nSamplesPerSec || a_StreamInstance->pwfxSrc->nChannels != a_StreamInstance->pwfxDst->nChannels || a_StreamInstance->pwfxSrc->wBitsPerSample != 16) { Result = ACMERR_NOTPOSSIBLE; } else { if ((a_StreamInstance->fdwOpen & ACM_STREAMOPENF_QUERY) == 0) { ACMStream * the_stream = ACMStream::Create(); a_StreamInstance->dwInstance = (DWORD) the_stream; if (the_stream != NULL) { MPEGLAYER3WAVEFORMAT * casted = (MPEGLAYER3WAVEFORMAT *) a_StreamInstance->pwfxDst; vbr_mode a_mode = (casted->fdwFlags-2 == 0)?vbr_abr:vbr_off; if (the_stream->init(a_StreamInstance->pwfxDst->nSamplesPerSec, OutputFrequency, a_StreamInstance->pwfxDst->nChannels, a_StreamInstance->pwfxDst->nAvgBytesPerSec, a_mode)) Result = MMSYSERR_NOERROR; else ACMStream::Erase( the_stream ); } } else { Result = MMSYSERR_NOERROR; } } } break; case PERSONAL_FORMAT: my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PERSONAL source (%05d samples %d channels %d bits/sample %d kbps)",a_StreamInstance->pwfxSrc->nSamplesPerSec,a_StreamInstance->pwfxSrc->nChannels,a_StreamInstance->pwfxSrc->wBitsPerSample,8 * a_StreamInstance->pwfxSrc->nAvgBytesPerSec); if (a_StreamInstance->pwfxDst->wFormatTag == WAVE_FORMAT_PCM) { #ifdef ENABLE_DECODING if ((a_StreamInstance->fdwOpen & ACM_STREAMOPENF_QUERY) == 0) { /// \todo create the decoding stream my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream for PCM output (%05d samples %d channels %d bits/sample %d B/s)",a_StreamInstance->pwfxDst->nSamplesPerSec,a_StreamInstance->pwfxDst->nChannels,a_StreamInstance->pwfxDst->wBitsPerSample,a_StreamInstance->pwfxDst->nAvgBytesPerSec); DecodeStream * the_stream = DecodeStream::Create(); a_StreamInstance->dwInstance = (DWORD) the_stream; if (the_stream != NULL) { if (the_stream->init(a_StreamInstance->pwfxDst->nSamplesPerSec, a_StreamInstance->pwfxDst->nChannels, a_StreamInstance->pwfxDst->nAvgBytesPerSec, a_StreamInstance->pwfxSrc->nAvgBytesPerSec)) Result = MMSYSERR_NOERROR; else DecodeStream::Erase( the_stream ); } } else { /// \todo decoding verification my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream is valid"); Result = MMSYSERR_NOERROR; } #endif // ENABLE_DECODING } break; } my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Open stream Result = %d",Result); return Result; } inline DWORD ACM::OnStreamSize(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMSIZE the_StreamSize) { DWORD Result = ACMERR_NOTPOSSIBLE; switch (ACM_STREAMSIZEF_QUERYMASK & the_StreamSize->fdwSize) { case ACM_STREAMSIZEF_DESTINATION: my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Get source buffer size for destination size = %d",the_StreamSize->cbDstLength); break; case ACM_STREAMSIZEF_SOURCE: my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "Get destination buffer size for source size = %d",the_StreamSize->cbSrcLength); if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag && PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag) { ACMStream * the_stream = (ACMStream *) a_StreamInstance->dwInstance; if (the_stream != NULL) { the_StreamSize->cbDstLength = the_stream->GetOutputSizeForInput(the_StreamSize->cbSrcLength); Result = MMSYSERR_NOERROR; } } else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag && WAVE_FORMAT_PCM== a_StreamInstance->pwfxDst->wFormatTag) { #ifdef ENABLE_DECODING DecodeStream * the_stream = (DecodeStream *) a_StreamInstance->dwInstance; if (the_stream != NULL) { the_StreamSize->cbDstLength = the_stream->GetOutputSizeForInput(the_StreamSize->cbSrcLength); Result = MMSYSERR_NOERROR; } #endif // ENABLE_DECODING } break; default: Result = MMSYSERR_INVALFLAG; break; } return Result; } inline DWORD ACM::OnStreamClose(LPACMDRVSTREAMINSTANCE a_StreamInstance) { DWORD Result = ACMERR_NOTPOSSIBLE; my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamClose the stream 0x%X",a_StreamInstance->dwInstance); if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag && PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag) { ACMStream::Erase( (ACMStream *) a_StreamInstance->dwInstance ); } else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag && WAVE_FORMAT_PCM== a_StreamInstance->pwfxDst->wFormatTag) { #ifdef ENABLE_DECODING DecodeStream::Erase( (DecodeStream *) a_StreamInstance->dwInstance ); #endif // ENABLE_DECODING } // nothing to do yet Result = MMSYSERR_NOERROR; return Result; } inline DWORD ACM::OnStreamPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader) { DWORD Result = ACMERR_NOTPOSSIBLE; my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, " prepare : Src : %d (0x%08X) / %d - Dst : %d (0x%08X) / %d" , a_StreamHeader->cbSrcLength , a_StreamHeader->pbSrc , a_StreamHeader->cbSrcLengthUsed , a_StreamHeader->cbDstLength , a_StreamHeader->pbDst , a_StreamHeader->cbDstLengthUsed ); if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag && PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag) { ACMStream * the_stream = (ACMStream *)a_StreamInstance->dwInstance; if (the_stream->open(my_EncodingProperties)) Result = MMSYSERR_NOERROR; } else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag && WAVE_FORMAT_PCM == a_StreamInstance->pwfxDst->wFormatTag) { #ifdef ENABLE_DECODING DecodeStream * the_stream = (DecodeStream *)a_StreamInstance->dwInstance; if (the_stream->open()) Result = MMSYSERR_NOERROR; #endif // ENABLE_DECODING } return Result; } inline DWORD ACM::OnStreamUnPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader) { DWORD Result = ACMERR_NOTPOSSIBLE; my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "unprepare : Src : %d / %d - Dst : %d / %d" , a_StreamHeader->cbSrcLength , a_StreamHeader->cbSrcLengthUsed , a_StreamHeader->cbDstLength , a_StreamHeader->cbDstLengthUsed ); if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag && PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag) { ACMStream * the_stream = (ACMStream *)a_StreamInstance->dwInstance; DWORD OutputSize = a_StreamHeader->cbDstLength; if (the_stream->close(a_StreamHeader->pbDst, &OutputSize) && (OutputSize <= a_StreamHeader->cbDstLength)) { a_StreamHeader->cbDstLengthUsed = OutputSize; Result = MMSYSERR_NOERROR; } } else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag && WAVE_FORMAT_PCM== a_StreamInstance->pwfxDst->wFormatTag) { #ifdef ENABLE_DECODING DecodeStream * the_stream = (DecodeStream *)a_StreamInstance->dwInstance; DWORD OutputSize = a_StreamHeader->cbDstLength; if (the_stream->close(a_StreamHeader->pbDst, &OutputSize) && (OutputSize <= a_StreamHeader->cbDstLength)) { a_StreamHeader->cbDstLengthUsed = OutputSize; Result = MMSYSERR_NOERROR; } #endif // ENABLE_DECODING } return Result; } inline DWORD ACM::OnStreamConvert(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMHEADER a_StreamHeader) { DWORD Result = ACMERR_NOTPOSSIBLE; if (WAVE_FORMAT_PCM == a_StreamInstance->pwfxSrc->wFormatTag && PERSONAL_FORMAT == a_StreamInstance->pwfxDst->wFormatTag) { my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamConvert SRC = PCM (encode)"); ACMStream * the_stream = (ACMStream *) a_StreamInstance->dwInstance; if (the_stream != NULL) { if (the_stream->ConvertBuffer( a_StreamHeader )) Result = MMSYSERR_NOERROR; } } else if (PERSONAL_FORMAT == a_StreamInstance->pwfxSrc->wFormatTag && WAVE_FORMAT_PCM == a_StreamInstance->pwfxDst->wFormatTag) { my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamConvert SRC = MP3 (decode)"); #ifdef ENABLE_DECODING DecodeStream * the_stream = (DecodeStream *) a_StreamInstance->dwInstance; if (the_stream != NULL) { if (the_stream->ConvertBuffer( a_StreamHeader )) Result = MMSYSERR_NOERROR; } #endif // ENABLE_DECODING } else my_debug.OutPut(DEBUG_LEVEL_FUNC_CODE, "OnStreamConvert unsupported conversion"); return Result; } void ACM::GetMP3FormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const { int Block_size; char temp[ACMFORMATDETAILS_FORMAT_CHARS]; if (the_Index < bitrate_table.size()) { // the_Format.wBitsPerSample = 16; the_Format.wBitsPerSample = 0; /// \todo handle more channel modes (mono, stereo, joint-stereo, dual-channel) // the_Format.nChannels = SIZE_CHANNEL_MODE - int(the_Index % SIZE_CHANNEL_MODE); the_Format.nBlockAlign = 1; the_Format.nSamplesPerSec = bitrate_table[the_Index].frequency; the_Format.nAvgBytesPerSec = bitrate_table[the_Index].bitrate * 1000 / 8; if (bitrate_table[the_Index].frequency >= mpeg1_freq[SIZE_FREQ_MPEG1-1]) Block_size = 1152; else Block_size = 576; the_Format.nChannels = bitrate_table[the_Index].channels; the_Format.cbSize = sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX); MPEGLAYER3WAVEFORMAT * tmpFormat = (MPEGLAYER3WAVEFORMAT *) &the_Format; tmpFormat->wID = 1; // this is the only way I found to know if we do CBR or ABR tmpFormat->fdwFlags = 2 + ((bitrate_table[the_Index].mode == vbr_abr)?0:2); tmpFormat->nBlockSize = Block_size * the_Format.nAvgBytesPerSec / the_Format.nSamplesPerSec; tmpFormat->nFramesPerBlock = 1; tmpFormat->nCodecDelay = 0; // 0x0571 on FHG /// \todo : generate the string with the appropriate stereo mode if (bitrate_table[the_Index].mode == vbr_abr) wsprintfA( temp, "%d Hz, %d kbps ABR, %s", the_Format.nSamplesPerSec, the_Format.nAvgBytesPerSec * 8 / 1000, (the_Format.nChannels == 1)?"Mono":"Stereo"); else wsprintfA( temp, "%d Hz, %d kbps CBR, %s", the_Format.nSamplesPerSec, the_Format.nAvgBytesPerSec * 8 / 1000, (the_Format.nChannels == 1)?"Mono":"Stereo"); MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, temp, -1, the_String, ACMFORMATDETAILS_FORMAT_CHARS); } } void ACM::GetPCMFormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const { the_Format.nChannels = SIZE_CHANNEL_MODE - int(the_Index % SIZE_CHANNEL_MODE); the_Format.wBitsPerSample = 16; the_Format.nBlockAlign = the_Format.nChannels * the_Format.wBitsPerSample / 8; DWORD a_Channel_Independent = the_Index / SIZE_CHANNEL_MODE; // first MPEG1 frequencies if (a_Channel_Independent < SIZE_FREQ_MPEG1) { the_Format.nSamplesPerSec = mpeg1_freq[a_Channel_Independent]; } else { a_Channel_Independent -= SIZE_FREQ_MPEG1; the_Format.nSamplesPerSec = mpeg2_freq[a_Channel_Independent]; } the_Format.nAvgBytesPerSec = the_Format.nSamplesPerSec * the_Format.nChannels * the_Format.wBitsPerSample / 8; } DWORD ACM::GetNumberEncodingFormats() const { return bitrate_table.size(); } bool ACM::IsSmartOutput(const int frequency, const int bitrate, const int channels) const { double compression_ratio = double(frequency * 2 * channels) / double(bitrate * 100); //my_debug.OutPut(DEBUG_LEVEL_FUNC_DEBUG, "compression_ratio %f, freq %d, bitrate %d, channels %d", compression_ratio, frequency, bitrate, channels); if(my_EncodingProperties.GetSmartOutputMode()) return (compression_ratio <= my_EncodingProperties.GetSmartRatio()); else return true; } void ACM::BuildBitrateTable() { my_debug.OutPut("entering BuildBitrateTable"); // fill the table unsigned int channel,bitrate,freq; bitrate_table.clear(); // CBR bitrates for (channel = 0;channel < SIZE_CHANNEL_MODE;channel++) { // MPEG I for (freq = 0;freq < SIZE_FREQ_MPEG1;freq++) { for (bitrate = 0;bitrate < SIZE_BITRATE_MPEG1;bitrate++) { if (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg1_freq[freq], mpeg1_bitrate[bitrate], channel+1)) { bitrate_item bitrate_table_tmp; bitrate_table_tmp.frequency = mpeg1_freq[freq]; bitrate_table_tmp.bitrate = mpeg1_bitrate[bitrate]; bitrate_table_tmp.channels = channel+1; bitrate_table_tmp.mode = vbr_off; bitrate_table.push_back(bitrate_table_tmp); } } } // MPEG II / II.5 for (freq = 0;freq < SIZE_FREQ_MPEG2;freq++) { for (bitrate = 0;bitrate < SIZE_BITRATE_MPEG2;bitrate++) { if (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg2_freq[freq], mpeg2_bitrate[bitrate], channel+1)) { bitrate_item bitrate_table_tmp; bitrate_table_tmp.frequency = mpeg2_freq[freq]; bitrate_table_tmp.bitrate = mpeg2_bitrate[bitrate]; bitrate_table_tmp.channels = channel+1; bitrate_table_tmp.mode = vbr_abr; bitrate_table.push_back(bitrate_table_tmp); } } } } if (my_EncodingProperties.GetAbrOutputMode()) // ABR bitrates { for (channel = 0;channel < SIZE_CHANNEL_MODE;channel++) { // MPEG I for (freq = 0;freq < SIZE_FREQ_MPEG1;freq++) { for (bitrate = my_EncodingProperties.GetAbrBitrateMax(); bitrate >= my_EncodingProperties.GetAbrBitrateMin(); bitrate -= my_EncodingProperties.GetAbrBitrateStep()) { if (bitrate >= mpeg1_bitrate[SIZE_BITRATE_MPEG1-1] && (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg1_freq[freq], bitrate, channel+1))) { bitrate_item bitrate_table_tmp; bitrate_table_tmp.frequency = mpeg1_freq[freq]; bitrate_table_tmp.bitrate = bitrate; bitrate_table_tmp.channels = channel+1; bitrate_table_tmp.mode = vbr_abr; bitrate_table.push_back(bitrate_table_tmp); } } } // MPEG II / II.5 for (freq = 0;freq < SIZE_FREQ_MPEG2;freq++) { for (bitrate = my_EncodingProperties.GetAbrBitrateMax(); bitrate >= my_EncodingProperties.GetAbrBitrateMin(); bitrate -= my_EncodingProperties.GetAbrBitrateStep()) { if (bitrate >= mpeg2_bitrate[SIZE_BITRATE_MPEG2-1] && (!my_EncodingProperties.GetSmartOutputMode() || IsSmartOutput(mpeg2_freq[freq], bitrate, channel+1))) { bitrate_item bitrate_table_tmp; bitrate_table_tmp.frequency = mpeg2_freq[freq]; bitrate_table_tmp.bitrate = bitrate; bitrate_table_tmp.channels = channel+1; bitrate_table_tmp.mode = vbr_abr; bitrate_table.push_back(bitrate_table_tmp); } } } } } // sorting by frequency/bitrate/channel std::sort(bitrate_table.begin(), bitrate_table.end()); /* { // display test int i=0; for (i=0; i<bitrate_table.size();i++) { my_debug.OutPut("bitrate_table[%d].frequency = %d",i,bitrate_table[i].frequency); my_debug.OutPut("bitrate_table[%d].bitrate = %d",i,bitrate_table[i].bitrate); my_debug.OutPut("bitrate_table[%d].channel = %d",i,bitrate_table[i].channels); my_debug.OutPut("bitrate_table[%d].ABR = %s\n",i,(bitrate_table[i].mode == vbr_abr)?"ABR":"CBR"); } }*/ my_debug.OutPut("leaving BuildBitrateTable"); }
; A142245: Expansion of 2*x*(6 + 5*x) / ((1 - x)*(1 - x - x^2)). ; 0,12,34,68,124,214,360,596,978,1596,2596,4214,6832,11068,17922,29012,46956,75990,122968,198980,321970,520972,842964,1363958,2206944,3570924,5777890,9348836,15126748,24475606,39602376,64078004,103680402,167758428,271438852,439197302,710636176,1149833500,1860469698,3010303220,4870772940,7881076182,12751849144,20632925348,33384774514,54017699884,87402474420,141420174326,228822648768,370242823116,599065471906,969308295044,1568373766972,2537682062038,4106055829032,6643737891092,10749793720146,17393531611260,28143325331428,45536856942710,73680182274160,119217039216892,192897221491074,312114260707988,505011482199084,817125742907094,1322137225106200,2139262968013316,3461400193119538,5600663161132876,9062063354252436 add $0,3 mov $1,1 mov $2,4 lpb $0 sub $0,1 mov $3,$2 mov $2,$1 add $1,$3 lpe sub $1,11 mul $1,2
 /* Copyright (c) 2016-present Maximus5 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. The name of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''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 AUTHOR 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. */ #define HIDE_USE_EXCEPTION_INFO #define SHOWDEBUGSTR #include "Header.h" #include "ConEmu.h" #include "OptionsClass.h" #include "SetPgFeatures.h" #include "../common/MFileLogEx.h" CSetPgFeatures::CSetPgFeatures() { } CSetPgFeatures::~CSetPgFeatures() { } LRESULT CSetPgFeatures::OnInitDialog(HWND hDlg, bool abInitial) { checkDlgButton(hDlg, cbAutoRegFonts, gpSet->isAutoRegisterFonts); checkDlgButton(hDlg, cbDebugSteps, gpSet->isDebugSteps); checkDlgButton(hDlg, cbDebugLog, gpSet->isLogging()); UpdateLogLocation(); checkDlgButton(hDlg, cbMonitorConsoleLang, gpSet->isMonitorConsoleLang ? BST_CHECKED : BST_UNCHECKED); checkDlgButton(hDlg, cbSleepInBackground, gpSet->isSleepInBackground); checkDlgButton(hDlg, cbRetardInactivePanes, gpSet->isRetardInactivePanes); checkDlgButton(hDlg, cbVisible, gpSet->isConVisible); checkDlgButton(hDlg, cbUseInjects, gpSet->isUseInjects); checkDlgButton(hDlg, cbProcessAnsi, gpSet->isProcessAnsi); checkDlgButton(hDlg, cbAnsiLog, gpSet->isAnsiLog); checkDlgButton(hDlg, cbAnsiLogCodes, gpSet->isAnsiLogCodes); SetDlgItemText(hDlg, tAnsiLogPath, (gpSet->pszAnsiLog && *gpSet->pszAnsiLog) ? gpSet->pszAnsiLog : CEANSILOGFOLDER); checkDlgButton(hDlg, cbKillSshAgent, gpSet->isKillSshAgent); checkDlgButton(hDlg, cbProcessNewConArg, gpSet->isProcessNewConArg); checkDlgButton(hDlg, cbProcessCmdStart, gpSet->isProcessCmdStart); checkDlgButton(hDlg, cbProcessCtrlZ, gpSet->isProcessCtrlZ); checkDlgButton(hDlg, cbSkipFocusEvents, gpSet->isSkipFocusEvents); checkDlgButton(hDlg, cbSuppressBells, gpSet->isSuppressBells); checkDlgButton(hDlg, cbConsoleExceptionHandler, gpSet->isConsoleExceptionHandler); checkDlgButton(hDlg, cbUseClink, gpSet->isUseClink() ? BST_CHECKED : BST_UNCHECKED); // Show if DosBox is found, and allow user to click checkbox for recheck and message checkDlgButton(hDlg, cbDosBox, gpConEmu->CheckDosBoxExists()); EnableWindow(GetDlgItem(hDlg, cbDosBox), !gpConEmu->mb_DosBoxExists); //EnableWindow(GetDlgItem(hDlg, bDosBoxSettings), FALSE); ShowWindow(GetDlgItem(hDlg, bDosBoxSettings), SW_HIDE); checkDlgButton(hDlg, cbDisableAllFlashing, gpSet->isDisableAllFlashing); return 0; } void CSetPgFeatures::UpdateLogLocation() const { // Cut log file to directory only const auto pLogger = gpConEmu->GetLogger(); CEStr lsLogPath(pLogger ? pLogger->GetLogFileName() : L""); LPCWSTR pszName = lsLogPath.IsEmpty() ? nullptr : PointToName(lsLogPath.ms_Val); if (pszName) *(wchar_t*)pszName = 0; SetDlgItemText(gpSetCls->GetPage(thi_Features), tDebugLogDir, lsLogPath); } LRESULT CSetPgFeatures::OnEditChanged(HWND hDlg, WORD nCtrlId) { switch (nCtrlId) { case tAnsiLogPath: SafeFree(gpSet->pszAnsiLog); gpSet->pszAnsiLog = GetDlgItemTextPtr(hDlg, tAnsiLogPath).Detach(); break; case tDebugLogDir: break; // read-only default: _ASSERTE(FALSE && "EditBox was not processed"); } return 0; }
/* @printSHORTREAL @printREAL @float */ .proc @printSHORTREAL jsr @expandToCARD.SMALL jmp @printREAL .endp .proc @printREAL stx @sp lda :STACKORIGIN+STACKWIDTH*3,x spl jsr @printMINUS sta dx+2 mva :STACKORIGIN,x fracpart+2 ; intpart := uvalue shr 8 mva :STACKORIGIN+STACKWIDTH,x dx; fracpart := uvalue and $FF (dx) mva :STACKORIGIN+STACKWIDTH*2,x dx+1 ; mva :STACKORIGIN+STACKWIDTH*3,x dx+2 mva #$00 dx+3 sta fracpart sta fracpart+1 mva #4 @float.afterpoint ; wymagana liczba miejsc po przecinku @float #5000 ldx #0 @sp equ *-1 rts .endp .proc @float (.long axy) .reg sty cx stx cx+1 sta cx+2 lda @printVALUE.pout ; print integer part pha jsr @printVALUE pla sta @printVALUE.pout lda #0 sta dx sta dx+1 sta dx+2 sta dx+3 loop lda fracpart+2 bpl skp clc ; lda cx ; spl ; sec lda dx adc cx sta dx lda dx+1 adc cx+1 sta dx+1 lda dx+2 adc cx+2 sta dx+2 ; lda dx+3 ; adc #0 ; sta dx+3 skp lsr cx+2 ror cx+1 ror cx asl fracpart rol fracpart+1 rol fracpart+2 lda cx ora cx+1 ora cx+2 bne loop ldy #'.' jsr @printVALUE.pout :4 mva dx+# fracpart+# lda @printVALUE.pout pha lda #{rts} sta @printVALUE.pout jsr @printVALUE ; floating part length sta cnt pla sta @printVALUE.pout lp lda #0 cnt equ *-1 cmp #4 ; N miejsc po przecinku afterpoint equ *-1 bcs ok ldy #'0' jsr @printVALUE.pout inc cnt bne lp ok :4 mva fracpart+# dx+# jmp @printVALUE ; print floating part .endp
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x424a, %rdx nop nop nop cmp $21816, %r13 movl $0x61626364, (%rdx) nop nop nop nop xor %rdx, %rdx lea addresses_WC_ht+0x1db96, %rsi lea addresses_normal_ht+0x2ace, %rdi nop nop and %rbp, %rbp mov $110, %rcx rep movsl nop nop nop nop cmp %rbp, %rbp lea addresses_A_ht+0x162ce, %r13 cmp %r10, %r10 movw $0x6162, (%r13) nop nop nop nop nop sub %rcx, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r14 push %rcx // Faulty Load lea addresses_RW+0x62ce, %r14 nop nop nop nop nop cmp $23669, %r13 mov (%r14), %r10 lea oracles, %r12 and $0xff, %r10 shlq $12, %r10 mov (%r12,%r10,1), %r10 pop %rcx pop %r14 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 11, 'size': 2, 'same': True, 'NT': False}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
; A225491: Maximal frequency depth for multisets over an alphabet of n letters. ; 0,4,5,6,6,6,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 mov $2,2 lpb $0 add $0,$2 mov $1,8 mov $3,14 div $3,$0 mov $0,0 sub $1,$3 lpe mov $0,$1
; ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved. ; ; Use of this source code is governed by a BSD-style license ; that can be found in the LICENSE file in the root of the source ; tree. An additional intellectual property rights grant can be found ; in the file PATENTS. All contributing project authors may ; be found in the AUTHORS file in the root of the source tree. ; EXPORT |vp8_copy_mem16x16_v6| ; ARM ; REQUIRE8 ; PRESERVE8 AREA Block, CODE, READONLY ; name this block of code ;void copy_mem16x16_v6( unsigned char *src, int src_stride, unsigned char *dst, int dst_stride) ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |vp8_copy_mem16x16_v6| PROC stmdb sp!, {r4 - r7} ;push {r4-r7} ;preload pld [r0] pld [r0, r1] pld [r0, r1, lsl #1] ands r4, r0, #15 beq copy_mem16x16_fast ands r4, r0, #7 beq copy_mem16x16_8 ands r4, r0, #3 beq copy_mem16x16_4 ;copy one byte each time ldrb r4, [r0] ldrb r5, [r0, #1] ldrb r6, [r0, #2] ldrb r7, [r0, #3] mov r12, #16 copy_mem16x16_1_loop strb r4, [r2] strb r5, [r2, #1] strb r6, [r2, #2] strb r7, [r2, #3] ldrb r4, [r0, #4] ldrb r5, [r0, #5] ldrb r6, [r0, #6] ldrb r7, [r0, #7] subs r12, r12, #1 strb r4, [r2, #4] strb r5, [r2, #5] strb r6, [r2, #6] strb r7, [r2, #7] ldrb r4, [r0, #8] ldrb r5, [r0, #9] ldrb r6, [r0, #10] ldrb r7, [r0, #11] strb r4, [r2, #8] strb r5, [r2, #9] strb r6, [r2, #10] strb r7, [r2, #11] ldrb r4, [r0, #12] ldrb r5, [r0, #13] ldrb r6, [r0, #14] ldrb r7, [r0, #15] add r0, r0, r1 strb r4, [r2, #12] strb r5, [r2, #13] strb r6, [r2, #14] strb r7, [r2, #15] add r2, r2, r3 ldrneb r4, [r0] ldrneb r5, [r0, #1] ldrneb r6, [r0, #2] ldrneb r7, [r0, #3] bne copy_mem16x16_1_loop ldmia sp!, {r4 - r7} ;pop {r4-r7} mov pc, lr ;copy 4 bytes each time copy_mem16x16_4 ldr r4, [r0] ldr r5, [r0, #4] ldr r6, [r0, #8] ldr r7, [r0, #12] mov r12, #16 copy_mem16x16_4_loop subs r12, r12, #1 add r0, r0, r1 str r4, [r2] str r5, [r2, #4] str r6, [r2, #8] str r7, [r2, #12] add r2, r2, r3 ldrne r4, [r0] ldrne r5, [r0, #4] ldrne r6, [r0, #8] ldrne r7, [r0, #12] bne copy_mem16x16_4_loop ldmia sp!, {r4 - r7} ;pop {r4-r7} mov pc, lr ;copy 8 bytes each time copy_mem16x16_8 sub r1, r1, #16 sub r3, r3, #16 mov r12, #16 copy_mem16x16_8_loop ldmia r0!, {r4-r5} ;ldm r0, {r4-r5} ldmia r0!, {r6-r7} add r0, r0, r1 stmia r2!, {r4-r5} subs r12, r12, #1 ;stm r2, {r4-r5} stmia r2!, {r6-r7} add r2, r2, r3 bne copy_mem16x16_8_loop ldmia sp!, {r4 - r7} ;pop {r4-r7} mov pc, lr ;copy 16 bytes each time copy_mem16x16_fast ;sub r1, r1, #16 ;sub r3, r3, #16 mov r12, #16 copy_mem16x16_fast_loop ldmia r0, {r4-r7} ;ldm r0, {r4-r7} add r0, r0, r1 subs r12, r12, #1 stmia r2, {r4-r7} ;stm r2, {r4-r7} add r2, r2, r3 bne copy_mem16x16_fast_loop ldmia sp!, {r4 - r7} ;pop {r4-r7} mov pc, lr ENDP ; |vp8_copy_mem16x16_v6| END
; A048477: a(n) = T(5,n), array T given by A048472. ; 1,7,25,73,193,481,1153,2689,6145,13825,30721,67585,147457,319489,688129,1474561,3145729,6684673,14155777,29884417,62914561,132120577,276824065,578813953,1207959553,2516582401,5234491393,10871635969,22548578305,46707769345,96636764161,199715979265,412316860417,850403524609,1752346656769,3607772528641,7421703487489,15255723835393,31336081391617,64321430224897,131941395333121,270479860432897,554153860399105,1134695999864833,2322168557862913,4749890231992321 mov $1,2 pow $1,$0 mul $1,$0 mul $1,3 add $1,1
<% from pwnlib.shellcraft.i386.linux import syscall %> <%page args=""/> <%docstring> Invokes the syscall pause. See 'man 2 pause' for more information. Arguments: </%docstring> ${syscall('SYS_pause')}
; float __fspoly (const float x, const float d[], uint16_t n) SECTION code_clib SECTION code_math PUBLIC cm32_sccz80_fspoly_callee EXTERN m32_fspoly_callee ; evaluation of a polynomial function ; ; enter : stack = uint16_t n, float d[], float x, ret ; ; exit : dehl = 32-bit product ; carry reset ; ; uses : af, bc, de, hl, af', bc', de', hl' DEFC cm32_sccz80_fspoly_callee = m32_fspoly_callee
; uint in_JoyKempston(void) ; 2002 aralbrec XLIB in_JoyKempston ; exit : HL = F000RLDU active high ; uses : AF,DE,HL .in_JoyKempston in a,($1f) and $1f ld e,a ld d,0 ld hl,kemptbl add hl,de ld l,(hl) ld h,d ret .kemptbl defb $00,$08,$04,$0c defb $02,$0a,$06,$0e defb $01,$09,$05,$0d defb $03,$0b,$07,$0f defb $80,$88,$84,$8c defb $82,$8a,$86,$8e defb $81,$89,$85,$8d defb $83,$8b,$87,$8f
; --------------------------------------------------------------------------- ; Sprite mappings - rings ; --------------------------------------------------------------------------- dc.w byte_9FA2-Map_obj25, byte_9FA8-Map_obj25 dc.w byte_9FAE-Map_obj25, byte_9FB4-Map_obj25 dc.w byte_9FBA-Map_obj25, byte_9FC0-Map_obj25 dc.w byte_9FC6-Map_obj25, byte_9FCC-Map_obj25 byte_9FA2: dc.b 1 dc.b $F8, 5, 0, 0, $F8 byte_9FA8: dc.b 1 dc.b $F8, 5, 0, 4, $F8 byte_9FAE: dc.b 1 dc.b $F8, 1, 0, 8, $FC byte_9FB4: dc.b 1 dc.b $F8, 5, 8, 4, $F8 byte_9FBA: dc.b 1 dc.b $F8, 5, 0, $A, $F8 byte_9FC0: dc.b 1 dc.b $F8, 5, $18, $A, $F8 byte_9FC6: dc.b 1 dc.b $F8, 5, 8, $A, $F8 byte_9FCC: dc.b 1 dc.b $F8, 5, $10, $A, $F8 even
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r9 push %rbp push %rcx push %rdi push %rdx // Store lea addresses_PSE+0x1f30, %rdi clflush (%rdi) nop nop add %rdx, %rdx mov $0x5152535455565758, %rcx movq %rcx, (%rdi) add $20276, %r9 // Faulty Load lea addresses_PSE+0x1f30, %rdx nop nop nop nop nop cmp $10353, %r10 mov (%rdx), %bp lea oracles, %r14 and $0xff, %rbp shlq $12, %rbp mov (%r14,%rbp,1), %rbp pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_PSE'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
; T2_Blink_MACRO_Enhanced.asm ;Macro magic with embedded Interrupt Vector and Interrupt ; service routine. ; Blink LED on specified port and pin using Timer 2 Overflow Interrupt ; If there is a #define SIM statement then Timer 2 Clock Select = MCU_clk/1 ; else Timer 2 Clock Select = MCU_clk/1024 ; ; Usage Example: T2_BLINK PORTB, PB0 ;Blink Led on PORTB, Pin PB0 ; .MACRO T2_BLINK MACRO_START: .ORG OVF2addr rjmp T2_isr .ORG MACRO_START sbi @0-1, @1 ;PORTx - 1 = DDRx ldi TEMP, (1<<TOIE2) sts TIMSK2, TEMP #ifdef SIM ldi TEMP, (0<<CS22)|(0<<CS21)|(1<<CS20) #else ldi TEMP, (1<<CS22)|(1<<CS21)|(1<<CS20) #endif sts TCCR2B, TEMP rjmp Macro_Return T2_isr: sbi @0-2, @1 ;PORTx - 2 = PINx reti Macro_Return: .ENDMACRO ;----------------------------------------------------------------------------- .MACRO STACK_POINTER_INIT #ifdef SPH ldi TEMP, high(RAMEND) out SPH, TEMP #endif ldi TEMP, low(RAMEND) out SPL, TEMP .ENDMACRO ;----------------------------------------------------------------------------- .MACRO DELAY_QUARTER_SEC MACRO_DELAY_START: .ORG OC2Aaddr rjmp T2_DEL_Q .ORG MACRO_DELAY_START lds TEMP, TCCR2B push TEMP lds TEMP, TCCR2A push TEMP lds TEMP, TIMSK2 push TEMP lds TEMP, OCR2A push TEMP ldi TEMP, $FC sts OCR2A, TEMP ldi TEMP, (1<<OCIE2A) sts TIMSK2, TEMP ldi TEMP, (1<<WGM21)|(0<<WGM20) sts TCCR2A, TEMP ldi TEMP, (0<<WGM22)|(1<<CS02)|(1<<CS01)|(1<<CS00) sts TCCR2B, TEMP sbi GPIOR0, 7 ldi TEMP, @0 DEL_Q_WAIT: sbic GPIOR0, 7 rjmp DEL_Q_WAIT rjmp DELAY_END T2_DEL_Q: sbi TIFR2, OCIE2A dec TEMP brne CONTINUE_DELAY cbi GPIOR0, 7 CONTINUE_DELAY: reti DELAY_END: pop TEMP sts OCR2A, TEMP pop TEMP sts TIMSK2, TEMP pop TEMP sts TCCR2A, TEMP pop TEMP sts TCCR2B, TEMP .ENDMACRO ;----------------------------------------------------------------------------- .LISTMAC
; A339012: Written in factorial base, n ends in a(n) consecutive non-0 digits. ; 0,1,0,2,0,2,0,1,0,3,0,3,0,1,0,3,0,3,0,1,0,3,0,3,0,1,0,2,0,2,0,1,0,4,0,4,0,1,0,4,0,4,0,1,0,4,0,4,0,1,0,2,0,2,0,1,0,4,0,4,0,1,0,4,0,4,0,1,0,4,0,4,0,1,0,2,0,2,0,1,0,4,0,4,0,1,0,4,0,4,0,1,0,4,0,4,0,1,0,2 mov $1,2 mov $3,$0 mov $4,$0 lpb $3 mov $5,$4 lpb $5 mov $2,$0 div $0,$1 mod $2,$1 cmp $2,0 mov $5,0 sub $5,$2 lpe add $1,1 mov $3,$0 lpe sub $1,2 mov $0,$1
playerPosTableX .for l=0, l<=8, l=l+1 .byte 38+l*16 .next playerPosTableY .for l=0, l<=8, l=l+1 .byte 74+l*16 .next
; A327565: Number of transfers of marbles between two sets until the first repetition. ; 2,3,4,3,5,4,4,5,6,4,5,6,5,5,6,5,7,6,5,7,6,5,7,6,6,7,6,6,7,6,6,7,8,6,7,8,6,7,8,6,7,8,6,7,8,6,7,8,7,7,8,7,7,8,7,7,8,7,7,8,7,7,8,7,9,8,7,9,8,7,9,8,7,9,8,7,9,8,7,9 lpb $0 add $1,1 sub $2,$0 mod $2,2 mul $2,2 add $0,$2 div $0,2 lpe add $1,2 mov $0,$1
#include <chrono> #include <functional> double measure_time(std::function<void (void)> func_to_measure) { std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); for (unsigned int i{ 0 }; i < 100; ++i) func_to_measure(); std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); auto duration = std::chrono::duration_cast<std::chrono::microseconds> (end - begin).count(); return (double)duration / 100.0f; } #include <string> #include <cstddef> std::string remove_ctrl_0(std::string s) { std::string result; for (int i = 0; i < s.length(); ++i) { if (s[i] >= 0x20) result = result + s[i]; } return result; } std::string remove_ctrl_mutating_1(std::string s) { std::string result; for (int i = 0; i < s.length(); ++i) { if (s[i] >= 0x20) result += s[i]; } return result; } std::string remove_ctrl_reserve_2(std::string s) { std::string result; result.reserve(s.length()); for (int i = 0; i < s.length(); ++i) { if (s[i] >= 0x20) result += s[i]; } return result; } std::string remove_ctrl_ref_args_3(const std::string& s) { std::string result; result.reserve(s.length()); for (int i = 0; i < s.length(); ++i) { if (s[i] >= 0x20) result += s[i]; } return result; } std::string remove_ctrl_ref_args_it_4(const std::string& s) { std::string result; result.reserve(s.length()); for (auto it = s.begin(), end = s.end(); it != end; ++it) { if (*it >= 0x20) result += *it; } return result; } void remove_ctrl_ref_result_it_5(std::string& result, std::string const& s) { result.clear(); result.reserve(s.length()); for (auto it = s.begin(), end = s.end(); it != end; ++it) { if (*it >= 0x20) result += *it; } } void remove_ctrl_cstrings_6(char* destp, char const* srcp, size_t size) { for (size_t i = 0; i < size; ++i) { if (srcp[i] >= 0x20) *destp++ = srcp[i]; } *destp = 0; } #include <random> std::string get_random_string() { std::random_device rd; std::mt19937 rng(rd()); std::uniform_int_distribution<int> uni(0, 120); std::string result{}; for (unsigned int i{ 0 }; i < 2000; ++i) { char c = uni(rng); result += c; } return result; } #include <iostream> int main() { auto s = get_random_string(); std::cout << "f0 (micros): " << measure_time([&s]() -> void { remove_ctrl_0(s); }) << std::endl; std::cout << "f1 (micros): " << measure_time([&s]() -> void { remove_ctrl_mutating_1(s); }) << std::endl; std::cout << "f2 (micros): " << measure_time([&s]() -> void { remove_ctrl_reserve_2(s); }) << std::endl; std::cout << "f3 (micros): " << measure_time([&s]() -> void { remove_ctrl_ref_args_3(s); }) << std::endl; std::cout << "f4 (micros): " << measure_time([&s]() -> void { remove_ctrl_ref_args_it_4(s); }) << std::endl; std::string result{}; std::cout << "f5 (micros): " << measure_time([&s, &result]() -> void { remove_ctrl_ref_result_it_5(result, s); }) << std::endl; char p[s.length()]; std::cout << "f6 (micros): " << measure_time([&s, &p]() -> void { remove_ctrl_cstrings_6(p, s.c_str(), s.length()); }) << std::endl; return 0; }
/************************************************************************ * $Id$ * Copyright (c) 1997, Fort Gunnison, Inc. * * SimpleWin.cp: SimpleWinクラスの実装 * * Author: Shin'ya Koga (koga@ftgun.co.jp) * Created: Dec. 10, 1997 * Last update: Dec. 12, 1997 ************************************************************************ */ /* ######################################################### */ /* # I N C L U D E F I L E S # */ /* ######################################################### */ #include "SimpleWin.h" #include <app/Application.h> /* ######################################################### */ /* # L O C A L D E F I N E S # */ /* ######################################################### */ /* ######################################################### */ /* # L O C A L S T O R A G E # */ /* ######################################################### */ /* ######################################################### */ /* # P R I V A T E F U N C T I O N S # */ /* ######################################################### */ /* ######################################################### */ /* # P U B L I C F U N C T I O N S # */ /* ######################################################### */ /* SimpleWinクラスの公開メソッド */ /* * 初期化と解放; SimpleWin */ SimpleWin::SimpleWin (BRect frame, const char* title, window_type type, uint32 flags, uint32 workspace) : BWindow(frame, title, type, flags, workspace) { BView* viewObj; /* BViewオブジェクトを生成して自身に貼り付ける */ viewObj = new BView( this->Bounds(), "content", B_FOLLOW_ALL_SIDES, 0); this->AddChild(viewObj); } SimpleWin::~SimpleWin (void) { /* do nothing */ } /* * 終了時処理; SimpleWin */ void SimpleWin::Quit (void) { /* アプリケーション本体に終了通知 */ be_app->PostMessage(B_QUIT_REQUESTED, be_app); /* 親クラスのメソッドを実行 */ BWindow::Quit(); return; } /* * 描画処理; SimpleWin */ void SimpleWin::Show (void) { BView* viewObj = this->FindView("content"); rgb_color currColor = viewObj->HighColor(); /* 親クラスのメソッドを実行 */ BWindow::Show(); ::snooze(40 * 1000); /* wait for unvealing the view */ /* 文字列と図形を描画 */ this->Lock(); /* 自身をロック */ viewObj->SetHighColor(0xD0, 0xD0, 0xD0); viewObj->FillRect(viewObj->Frame()); viewObj->SetHighColor(currColor); viewObj->DrawString("This is the my first app.", BPoint(10, 10)); viewObj->SetHighColor(255, 0, 0); viewObj->FillRect(BRect(110, 30, 140, 60)); this->Unlock(); /* ロック解除 */ this->Flush(); /* flushing the draw instruction */ return; } /* * End of File */
; A315631: Coordination sequence Gal.5.68.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,6,12,16,20,24,28,32,38,44,50,56,60,64,68,72,76,82,88,94,100,104,108,112,116,120,126,132,138,144,148,152,156,160,164,170,176,182,188,192,196,200,204,208,214,220,226,232,236,240 mov $1,$0 seq $1,312683 ; Coordination sequence Gal.5.113.1 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. mov $2,$0 mul $0,6 sub $0,1 mod $0,$1 add $0,1 mov $3,$2 mul $3,4 add $0,$3
obj/__user_faultreadkernel.out: 文件格式 elf32-i386 Disassembly of section .text: 00800020 <__panic>: #include <stdio.h> #include <ulib.h> #include <error.h> void __panic(const char *file, int line, const char *fmt, ...) { 800020: 55 push %ebp 800021: 89 e5 mov %esp,%ebp 800023: 83 ec 18 sub $0x18,%esp // print the 'message' va_list ap; va_start(ap, fmt); 800026: 8d 45 14 lea 0x14(%ebp),%eax 800029: 89 45 f4 mov %eax,-0xc(%ebp) cprintf("user panic at %s:%d:\n ", file, line); 80002c: 83 ec 04 sub $0x4,%esp 80002f: ff 75 0c pushl 0xc(%ebp) 800032: ff 75 08 pushl 0x8(%ebp) 800035: 68 80 0f 80 00 push $0x800f80 80003a: e8 9a 02 00 00 call 8002d9 <cprintf> 80003f: 83 c4 10 add $0x10,%esp vcprintf(fmt, ap); 800042: 8b 45 f4 mov -0xc(%ebp),%eax 800045: 83 ec 08 sub $0x8,%esp 800048: 50 push %eax 800049: ff 75 10 pushl 0x10(%ebp) 80004c: e8 5f 02 00 00 call 8002b0 <vcprintf> 800051: 83 c4 10 add $0x10,%esp cprintf("\n"); 800054: 83 ec 0c sub $0xc,%esp 800057: 68 9a 0f 80 00 push $0x800f9a 80005c: e8 78 02 00 00 call 8002d9 <cprintf> 800061: 83 c4 10 add $0x10,%esp va_end(ap); exit(-E_PANIC); 800064: 83 ec 0c sub $0xc,%esp 800067: 6a f6 push $0xfffffff6 800069: e8 49 01 00 00 call 8001b7 <exit> 0080006e <__warn>: } void __warn(const char *file, int line, const char *fmt, ...) { 80006e: 55 push %ebp 80006f: 89 e5 mov %esp,%ebp 800071: 83 ec 18 sub $0x18,%esp va_list ap; va_start(ap, fmt); 800074: 8d 45 14 lea 0x14(%ebp),%eax 800077: 89 45 f4 mov %eax,-0xc(%ebp) cprintf("user warning at %s:%d:\n ", file, line); 80007a: 83 ec 04 sub $0x4,%esp 80007d: ff 75 0c pushl 0xc(%ebp) 800080: ff 75 08 pushl 0x8(%ebp) 800083: 68 9c 0f 80 00 push $0x800f9c 800088: e8 4c 02 00 00 call 8002d9 <cprintf> 80008d: 83 c4 10 add $0x10,%esp vcprintf(fmt, ap); 800090: 8b 45 f4 mov -0xc(%ebp),%eax 800093: 83 ec 08 sub $0x8,%esp 800096: 50 push %eax 800097: ff 75 10 pushl 0x10(%ebp) 80009a: e8 11 02 00 00 call 8002b0 <vcprintf> 80009f: 83 c4 10 add $0x10,%esp cprintf("\n"); 8000a2: 83 ec 0c sub $0xc,%esp 8000a5: 68 9a 0f 80 00 push $0x800f9a 8000aa: e8 2a 02 00 00 call 8002d9 <cprintf> 8000af: 83 c4 10 add $0x10,%esp va_end(ap); } 8000b2: 90 nop 8000b3: c9 leave 8000b4: c3 ret 008000b5 <syscall>: #include <syscall.h> #define MAX_ARGS 5 static inline int syscall(int num, ...) { 8000b5: 55 push %ebp 8000b6: 89 e5 mov %esp,%ebp 8000b8: 57 push %edi 8000b9: 56 push %esi 8000ba: 53 push %ebx 8000bb: 83 ec 20 sub $0x20,%esp va_list ap; va_start(ap, num); 8000be: 8d 45 0c lea 0xc(%ebp),%eax 8000c1: 89 45 e8 mov %eax,-0x18(%ebp) uint32_t a[MAX_ARGS]; int i, ret; for (i = 0; i < MAX_ARGS; i ++) { 8000c4: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 8000cb: eb 16 jmp 8000e3 <syscall+0x2e> a[i] = va_arg(ap, uint32_t); 8000cd: 8b 45 e8 mov -0x18(%ebp),%eax 8000d0: 8d 50 04 lea 0x4(%eax),%edx 8000d3: 89 55 e8 mov %edx,-0x18(%ebp) 8000d6: 8b 10 mov (%eax),%edx 8000d8: 8b 45 f0 mov -0x10(%ebp),%eax 8000db: 89 54 85 d4 mov %edx,-0x2c(%ebp,%eax,4) syscall(int num, ...) { va_list ap; va_start(ap, num); uint32_t a[MAX_ARGS]; int i, ret; for (i = 0; i < MAX_ARGS; i ++) { 8000df: 83 45 f0 01 addl $0x1,-0x10(%ebp) 8000e3: 83 7d f0 04 cmpl $0x4,-0x10(%ebp) 8000e7: 7e e4 jle 8000cd <syscall+0x18> asm volatile ( "int %1;" : "=a" (ret) : "i" (T_SYSCALL), "a" (num), "d" (a[0]), 8000e9: 8b 55 d4 mov -0x2c(%ebp),%edx "c" (a[1]), 8000ec: 8b 4d d8 mov -0x28(%ebp),%ecx "b" (a[2]), 8000ef: 8b 5d dc mov -0x24(%ebp),%ebx "D" (a[3]), 8000f2: 8b 7d e0 mov -0x20(%ebp),%edi "S" (a[4]) 8000f5: 8b 75 e4 mov -0x1c(%ebp),%esi for (i = 0; i < MAX_ARGS; i ++) { a[i] = va_arg(ap, uint32_t); } va_end(ap); asm volatile ( 8000f8: 8b 45 08 mov 0x8(%ebp),%eax 8000fb: cd 80 int $0x80 8000fd: 89 45 ec mov %eax,-0x14(%ebp) "c" (a[1]), "b" (a[2]), "D" (a[3]), "S" (a[4]) : "cc", "memory"); return ret; 800100: 8b 45 ec mov -0x14(%ebp),%eax } 800103: 83 c4 20 add $0x20,%esp 800106: 5b pop %ebx 800107: 5e pop %esi 800108: 5f pop %edi 800109: 5d pop %ebp 80010a: c3 ret 0080010b <sys_exit>: int sys_exit(int error_code) { 80010b: 55 push %ebp 80010c: 89 e5 mov %esp,%ebp return syscall(SYS_exit, error_code); 80010e: ff 75 08 pushl 0x8(%ebp) 800111: 6a 01 push $0x1 800113: e8 9d ff ff ff call 8000b5 <syscall> 800118: 83 c4 08 add $0x8,%esp } 80011b: c9 leave 80011c: c3 ret 0080011d <sys_fork>: int sys_fork(void) { 80011d: 55 push %ebp 80011e: 89 e5 mov %esp,%ebp return syscall(SYS_fork); 800120: 6a 02 push $0x2 800122: e8 8e ff ff ff call 8000b5 <syscall> 800127: 83 c4 04 add $0x4,%esp } 80012a: c9 leave 80012b: c3 ret 0080012c <sys_wait>: int sys_wait(int pid, int *store) { 80012c: 55 push %ebp 80012d: 89 e5 mov %esp,%ebp return syscall(SYS_wait, pid, store); 80012f: ff 75 0c pushl 0xc(%ebp) 800132: ff 75 08 pushl 0x8(%ebp) 800135: 6a 03 push $0x3 800137: e8 79 ff ff ff call 8000b5 <syscall> 80013c: 83 c4 0c add $0xc,%esp } 80013f: c9 leave 800140: c3 ret 00800141 <sys_yield>: int sys_yield(void) { 800141: 55 push %ebp 800142: 89 e5 mov %esp,%ebp return syscall(SYS_yield); 800144: 6a 0a push $0xa 800146: e8 6a ff ff ff call 8000b5 <syscall> 80014b: 83 c4 04 add $0x4,%esp } 80014e: c9 leave 80014f: c3 ret 00800150 <sys_kill>: int sys_kill(int pid) { 800150: 55 push %ebp 800151: 89 e5 mov %esp,%ebp return syscall(SYS_kill, pid); 800153: ff 75 08 pushl 0x8(%ebp) 800156: 6a 0c push $0xc 800158: e8 58 ff ff ff call 8000b5 <syscall> 80015d: 83 c4 08 add $0x8,%esp } 800160: c9 leave 800161: c3 ret 00800162 <sys_getpid>: int sys_getpid(void) { 800162: 55 push %ebp 800163: 89 e5 mov %esp,%ebp return syscall(SYS_getpid); 800165: 6a 12 push $0x12 800167: e8 49 ff ff ff call 8000b5 <syscall> 80016c: 83 c4 04 add $0x4,%esp } 80016f: c9 leave 800170: c3 ret 00800171 <sys_putc>: int sys_putc(int c) { 800171: 55 push %ebp 800172: 89 e5 mov %esp,%ebp return syscall(SYS_putc, c); 800174: ff 75 08 pushl 0x8(%ebp) 800177: 6a 1e push $0x1e 800179: e8 37 ff ff ff call 8000b5 <syscall> 80017e: 83 c4 08 add $0x8,%esp } 800181: c9 leave 800182: c3 ret 00800183 <sys_pgdir>: int sys_pgdir(void) { 800183: 55 push %ebp 800184: 89 e5 mov %esp,%ebp return syscall(SYS_pgdir); 800186: 6a 1f push $0x1f 800188: e8 28 ff ff ff call 8000b5 <syscall> 80018d: 83 c4 04 add $0x4,%esp } 800190: c9 leave 800191: c3 ret 00800192 <sys_gettime>: size_t sys_gettime(void) { 800192: 55 push %ebp 800193: 89 e5 mov %esp,%ebp return syscall(SYS_gettime); 800195: 6a 11 push $0x11 800197: e8 19 ff ff ff call 8000b5 <syscall> 80019c: 83 c4 04 add $0x4,%esp } 80019f: c9 leave 8001a0: c3 ret 008001a1 <sys_lab6_set_priority>: void sys_lab6_set_priority(uint32_t priority) { 8001a1: 55 push %ebp 8001a2: 89 e5 mov %esp,%ebp syscall(SYS_lab6_set_priority, priority); 8001a4: ff 75 08 pushl 0x8(%ebp) 8001a7: 68 ff 00 00 00 push $0xff 8001ac: e8 04 ff ff ff call 8000b5 <syscall> 8001b1: 83 c4 08 add $0x8,%esp } 8001b4: 90 nop 8001b5: c9 leave 8001b6: c3 ret 008001b7 <exit>: #include <syscall.h> #include <stdio.h> #include <ulib.h> void exit(int error_code) { 8001b7: 55 push %ebp 8001b8: 89 e5 mov %esp,%ebp 8001ba: 83 ec 08 sub $0x8,%esp sys_exit(error_code); 8001bd: 83 ec 0c sub $0xc,%esp 8001c0: ff 75 08 pushl 0x8(%ebp) 8001c3: e8 43 ff ff ff call 80010b <sys_exit> 8001c8: 83 c4 10 add $0x10,%esp cprintf("BUG: exit failed.\n"); 8001cb: 83 ec 0c sub $0xc,%esp 8001ce: 68 b8 0f 80 00 push $0x800fb8 8001d3: e8 01 01 00 00 call 8002d9 <cprintf> 8001d8: 83 c4 10 add $0x10,%esp while (1); 8001db: eb fe jmp 8001db <exit+0x24> 008001dd <fork>: } int fork(void) { 8001dd: 55 push %ebp 8001de: 89 e5 mov %esp,%ebp 8001e0: 83 ec 08 sub $0x8,%esp return sys_fork(); 8001e3: e8 35 ff ff ff call 80011d <sys_fork> } 8001e8: c9 leave 8001e9: c3 ret 008001ea <wait>: int wait(void) { 8001ea: 55 push %ebp 8001eb: 89 e5 mov %esp,%ebp 8001ed: 83 ec 08 sub $0x8,%esp return sys_wait(0, NULL); 8001f0: 83 ec 08 sub $0x8,%esp 8001f3: 6a 00 push $0x0 8001f5: 6a 00 push $0x0 8001f7: e8 30 ff ff ff call 80012c <sys_wait> 8001fc: 83 c4 10 add $0x10,%esp } 8001ff: c9 leave 800200: c3 ret 00800201 <waitpid>: int waitpid(int pid, int *store) { 800201: 55 push %ebp 800202: 89 e5 mov %esp,%ebp 800204: 83 ec 08 sub $0x8,%esp return sys_wait(pid, store); 800207: 83 ec 08 sub $0x8,%esp 80020a: ff 75 0c pushl 0xc(%ebp) 80020d: ff 75 08 pushl 0x8(%ebp) 800210: e8 17 ff ff ff call 80012c <sys_wait> 800215: 83 c4 10 add $0x10,%esp } 800218: c9 leave 800219: c3 ret 0080021a <yield>: void yield(void) { 80021a: 55 push %ebp 80021b: 89 e5 mov %esp,%ebp 80021d: 83 ec 08 sub $0x8,%esp sys_yield(); 800220: e8 1c ff ff ff call 800141 <sys_yield> } 800225: 90 nop 800226: c9 leave 800227: c3 ret 00800228 <kill>: int kill(int pid) { 800228: 55 push %ebp 800229: 89 e5 mov %esp,%ebp 80022b: 83 ec 08 sub $0x8,%esp return sys_kill(pid); 80022e: 83 ec 0c sub $0xc,%esp 800231: ff 75 08 pushl 0x8(%ebp) 800234: e8 17 ff ff ff call 800150 <sys_kill> 800239: 83 c4 10 add $0x10,%esp } 80023c: c9 leave 80023d: c3 ret 0080023e <getpid>: int getpid(void) { 80023e: 55 push %ebp 80023f: 89 e5 mov %esp,%ebp 800241: 83 ec 08 sub $0x8,%esp return sys_getpid(); 800244: e8 19 ff ff ff call 800162 <sys_getpid> } 800249: c9 leave 80024a: c3 ret 0080024b <print_pgdir>: //print_pgdir - print the PDT&PT void print_pgdir(void) { 80024b: 55 push %ebp 80024c: 89 e5 mov %esp,%ebp 80024e: 83 ec 08 sub $0x8,%esp sys_pgdir(); 800251: e8 2d ff ff ff call 800183 <sys_pgdir> } 800256: 90 nop 800257: c9 leave 800258: c3 ret 00800259 <gettime_msec>: unsigned int gettime_msec(void) { 800259: 55 push %ebp 80025a: 89 e5 mov %esp,%ebp 80025c: 83 ec 08 sub $0x8,%esp return (unsigned int)sys_gettime(); 80025f: e8 2e ff ff ff call 800192 <sys_gettime> } 800264: c9 leave 800265: c3 ret 00800266 <lab6_set_priority>: void lab6_set_priority(uint32_t priority) { 800266: 55 push %ebp 800267: 89 e5 mov %esp,%ebp 800269: 83 ec 08 sub $0x8,%esp sys_lab6_set_priority(priority); 80026c: 83 ec 0c sub $0xc,%esp 80026f: ff 75 08 pushl 0x8(%ebp) 800272: e8 2a ff ff ff call 8001a1 <sys_lab6_set_priority> 800277: 83 c4 10 add $0x10,%esp } 80027a: 90 nop 80027b: c9 leave 80027c: c3 ret 0080027d <_start>: .text .globl _start _start: # set ebp for backtrace movl $0x0, %ebp 80027d: bd 00 00 00 00 mov $0x0,%ebp # move down the esp register # since it may cause page fault in backtrace subl $0x20, %esp 800282: 83 ec 20 sub $0x20,%esp # call user-program function call umain 800285: e8 c3 00 00 00 call 80034d <umain> 1: jmp 1b 80028a: eb fe jmp 80028a <_start+0xd> 0080028c <cputch>: /* * * cputch - writes a single character @c to stdout, and it will * increace the value of counter pointed by @cnt. * */ static void cputch(int c, int *cnt) { 80028c: 55 push %ebp 80028d: 89 e5 mov %esp,%ebp 80028f: 83 ec 08 sub $0x8,%esp sys_putc(c); 800292: 83 ec 0c sub $0xc,%esp 800295: ff 75 08 pushl 0x8(%ebp) 800298: e8 d4 fe ff ff call 800171 <sys_putc> 80029d: 83 c4 10 add $0x10,%esp (*cnt) ++; 8002a0: 8b 45 0c mov 0xc(%ebp),%eax 8002a3: 8b 00 mov (%eax),%eax 8002a5: 8d 50 01 lea 0x1(%eax),%edx 8002a8: 8b 45 0c mov 0xc(%ebp),%eax 8002ab: 89 10 mov %edx,(%eax) } 8002ad: 90 nop 8002ae: c9 leave 8002af: c3 ret 008002b0 <vcprintf>: * * Call this function if you are already dealing with a va_list. * Or you probably want cprintf() instead. * */ int vcprintf(const char *fmt, va_list ap) { 8002b0: 55 push %ebp 8002b1: 89 e5 mov %esp,%ebp 8002b3: 83 ec 18 sub $0x18,%esp int cnt = 0; 8002b6: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) vprintfmt((void*)cputch, &cnt, fmt, ap); 8002bd: ff 75 0c pushl 0xc(%ebp) 8002c0: ff 75 08 pushl 0x8(%ebp) 8002c3: 8d 45 f4 lea -0xc(%ebp),%eax 8002c6: 50 push %eax 8002c7: 68 8c 02 80 00 push $0x80028c 8002cc: e8 fc 06 00 00 call 8009cd <vprintfmt> 8002d1: 83 c4 10 add $0x10,%esp return cnt; 8002d4: 8b 45 f4 mov -0xc(%ebp),%eax } 8002d7: c9 leave 8002d8: c3 ret 008002d9 <cprintf>: * * The return value is the number of characters which would be * written to stdout. * */ int cprintf(const char *fmt, ...) { 8002d9: 55 push %ebp 8002da: 89 e5 mov %esp,%ebp 8002dc: 83 ec 18 sub $0x18,%esp va_list ap; va_start(ap, fmt); 8002df: 8d 45 0c lea 0xc(%ebp),%eax 8002e2: 89 45 f0 mov %eax,-0x10(%ebp) int cnt = vcprintf(fmt, ap); 8002e5: 8b 45 f0 mov -0x10(%ebp),%eax 8002e8: 83 ec 08 sub $0x8,%esp 8002eb: 50 push %eax 8002ec: ff 75 08 pushl 0x8(%ebp) 8002ef: e8 bc ff ff ff call 8002b0 <vcprintf> 8002f4: 83 c4 10 add $0x10,%esp 8002f7: 89 45 f4 mov %eax,-0xc(%ebp) va_end(ap); return cnt; 8002fa: 8b 45 f4 mov -0xc(%ebp),%eax } 8002fd: c9 leave 8002fe: c3 ret 008002ff <cputs>: /* * * cputs- writes the string pointed by @str to stdout and * appends a newline character. * */ int cputs(const char *str) { 8002ff: 55 push %ebp 800300: 89 e5 mov %esp,%ebp 800302: 83 ec 18 sub $0x18,%esp int cnt = 0; 800305: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) char c; while ((c = *str ++) != '\0') { 80030c: eb 14 jmp 800322 <cputs+0x23> cputch(c, &cnt); 80030e: 0f be 45 f7 movsbl -0x9(%ebp),%eax 800312: 83 ec 08 sub $0x8,%esp 800315: 8d 55 f0 lea -0x10(%ebp),%edx 800318: 52 push %edx 800319: 50 push %eax 80031a: e8 6d ff ff ff call 80028c <cputch> 80031f: 83 c4 10 add $0x10,%esp * */ int cputs(const char *str) { int cnt = 0; char c; while ((c = *str ++) != '\0') { 800322: 8b 45 08 mov 0x8(%ebp),%eax 800325: 8d 50 01 lea 0x1(%eax),%edx 800328: 89 55 08 mov %edx,0x8(%ebp) 80032b: 0f b6 00 movzbl (%eax),%eax 80032e: 88 45 f7 mov %al,-0x9(%ebp) 800331: 80 7d f7 00 cmpb $0x0,-0x9(%ebp) 800335: 75 d7 jne 80030e <cputs+0xf> cputch(c, &cnt); } cputch('\n', &cnt); 800337: 83 ec 08 sub $0x8,%esp 80033a: 8d 45 f0 lea -0x10(%ebp),%eax 80033d: 50 push %eax 80033e: 6a 0a push $0xa 800340: e8 47 ff ff ff call 80028c <cputch> 800345: 83 c4 10 add $0x10,%esp return cnt; 800348: 8b 45 f0 mov -0x10(%ebp),%eax } 80034b: c9 leave 80034c: c3 ret 0080034d <umain>: #include <ulib.h> int main(void); void umain(void) { 80034d: 55 push %ebp 80034e: 89 e5 mov %esp,%ebp 800350: 83 ec 18 sub $0x18,%esp int ret = main(); 800353: e8 d3 0b 00 00 call 800f2b <main> 800358: 89 45 f4 mov %eax,-0xc(%ebp) exit(ret); 80035b: 83 ec 0c sub $0xc,%esp 80035e: ff 75 f4 pushl -0xc(%ebp) 800361: e8 51 fe ff ff call 8001b7 <exit> 00800366 <strlen>: * @s: the input string * * The strlen() function returns the length of string @s. * */ size_t strlen(const char *s) { 800366: 55 push %ebp 800367: 89 e5 mov %esp,%ebp 800369: 83 ec 10 sub $0x10,%esp size_t cnt = 0; 80036c: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while (*s ++ != '\0') { 800373: eb 04 jmp 800379 <strlen+0x13> cnt ++; 800375: 83 45 fc 01 addl $0x1,-0x4(%ebp) * The strlen() function returns the length of string @s. * */ size_t strlen(const char *s) { size_t cnt = 0; while (*s ++ != '\0') { 800379: 8b 45 08 mov 0x8(%ebp),%eax 80037c: 8d 50 01 lea 0x1(%eax),%edx 80037f: 89 55 08 mov %edx,0x8(%ebp) 800382: 0f b6 00 movzbl (%eax),%eax 800385: 84 c0 test %al,%al 800387: 75 ec jne 800375 <strlen+0xf> cnt ++; } return cnt; 800389: 8b 45 fc mov -0x4(%ebp),%eax } 80038c: c9 leave 80038d: c3 ret 0080038e <strnlen>: * The return value is strlen(s), if that is less than @len, or * @len if there is no '\0' character among the first @len characters * pointed by @s. * */ size_t strnlen(const char *s, size_t len) { 80038e: 55 push %ebp 80038f: 89 e5 mov %esp,%ebp 800391: 83 ec 10 sub $0x10,%esp size_t cnt = 0; 800394: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while (cnt < len && *s ++ != '\0') { 80039b: eb 04 jmp 8003a1 <strnlen+0x13> cnt ++; 80039d: 83 45 fc 01 addl $0x1,-0x4(%ebp) * pointed by @s. * */ size_t strnlen(const char *s, size_t len) { size_t cnt = 0; while (cnt < len && *s ++ != '\0') { 8003a1: 8b 45 fc mov -0x4(%ebp),%eax 8003a4: 3b 45 0c cmp 0xc(%ebp),%eax 8003a7: 73 10 jae 8003b9 <strnlen+0x2b> 8003a9: 8b 45 08 mov 0x8(%ebp),%eax 8003ac: 8d 50 01 lea 0x1(%eax),%edx 8003af: 89 55 08 mov %edx,0x8(%ebp) 8003b2: 0f b6 00 movzbl (%eax),%eax 8003b5: 84 c0 test %al,%al 8003b7: 75 e4 jne 80039d <strnlen+0xf> cnt ++; } return cnt; 8003b9: 8b 45 fc mov -0x4(%ebp),%eax } 8003bc: c9 leave 8003bd: c3 ret 008003be <strcpy>: * To avoid overflows, the size of array pointed by @dst should be long enough to * contain the same string as @src (including the terminating null character), and * should not overlap in memory with @src. * */ char * strcpy(char *dst, const char *src) { 8003be: 55 push %ebp 8003bf: 89 e5 mov %esp,%ebp 8003c1: 57 push %edi 8003c2: 56 push %esi 8003c3: 83 ec 20 sub $0x20,%esp 8003c6: 8b 45 08 mov 0x8(%ebp),%eax 8003c9: 89 45 f4 mov %eax,-0xc(%ebp) 8003cc: 8b 45 0c mov 0xc(%ebp),%eax 8003cf: 89 45 f0 mov %eax,-0x10(%ebp) #ifndef __HAVE_ARCH_STRCPY #define __HAVE_ARCH_STRCPY static inline char * __strcpy(char *dst, const char *src) { int d0, d1, d2; asm volatile ( 8003d2: 8b 55 f0 mov -0x10(%ebp),%edx 8003d5: 8b 45 f4 mov -0xc(%ebp),%eax 8003d8: 89 d1 mov %edx,%ecx 8003da: 89 c2 mov %eax,%edx 8003dc: 89 ce mov %ecx,%esi 8003de: 89 d7 mov %edx,%edi 8003e0: ac lods %ds:(%esi),%al 8003e1: aa stos %al,%es:(%edi) 8003e2: 84 c0 test %al,%al 8003e4: 75 fa jne 8003e0 <strcpy+0x22> 8003e6: 89 fa mov %edi,%edx 8003e8: 89 f1 mov %esi,%ecx 8003ea: 89 4d ec mov %ecx,-0x14(%ebp) 8003ed: 89 55 e8 mov %edx,-0x18(%ebp) 8003f0: 89 45 e4 mov %eax,-0x1c(%ebp) "stosb;" "testb %%al, %%al;" "jne 1b;" : "=&S" (d0), "=&D" (d1), "=&a" (d2) : "0" (src), "1" (dst) : "memory"); return dst; 8003f3: 8b 45 f4 mov -0xc(%ebp),%eax #ifdef __HAVE_ARCH_STRCPY return __strcpy(dst, src); 8003f6: 90 nop char *p = dst; while ((*p ++ = *src ++) != '\0') /* nothing */; return dst; #endif /* __HAVE_ARCH_STRCPY */ } 8003f7: 83 c4 20 add $0x20,%esp 8003fa: 5e pop %esi 8003fb: 5f pop %edi 8003fc: 5d pop %ebp 8003fd: c3 ret 008003fe <strncpy>: * @len: maximum number of characters to be copied from @src * * The return value is @dst * */ char * strncpy(char *dst, const char *src, size_t len) { 8003fe: 55 push %ebp 8003ff: 89 e5 mov %esp,%ebp 800401: 83 ec 10 sub $0x10,%esp char *p = dst; 800404: 8b 45 08 mov 0x8(%ebp),%eax 800407: 89 45 fc mov %eax,-0x4(%ebp) while (len > 0) { 80040a: eb 21 jmp 80042d <strncpy+0x2f> if ((*p = *src) != '\0') { 80040c: 8b 45 0c mov 0xc(%ebp),%eax 80040f: 0f b6 10 movzbl (%eax),%edx 800412: 8b 45 fc mov -0x4(%ebp),%eax 800415: 88 10 mov %dl,(%eax) 800417: 8b 45 fc mov -0x4(%ebp),%eax 80041a: 0f b6 00 movzbl (%eax),%eax 80041d: 84 c0 test %al,%al 80041f: 74 04 je 800425 <strncpy+0x27> src ++; 800421: 83 45 0c 01 addl $0x1,0xc(%ebp) } p ++, len --; 800425: 83 45 fc 01 addl $0x1,-0x4(%ebp) 800429: 83 6d 10 01 subl $0x1,0x10(%ebp) * The return value is @dst * */ char * strncpy(char *dst, const char *src, size_t len) { char *p = dst; while (len > 0) { 80042d: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 800431: 75 d9 jne 80040c <strncpy+0xe> if ((*p = *src) != '\0') { src ++; } p ++, len --; } return dst; 800433: 8b 45 08 mov 0x8(%ebp),%eax } 800436: c9 leave 800437: c3 ret 00800438 <strcmp>: * - A value greater than zero indicates that the first character that does * not match has a greater value in @s1 than in @s2; * - And a value less than zero indicates the opposite. * */ int strcmp(const char *s1, const char *s2) { 800438: 55 push %ebp 800439: 89 e5 mov %esp,%ebp 80043b: 57 push %edi 80043c: 56 push %esi 80043d: 83 ec 20 sub $0x20,%esp 800440: 8b 45 08 mov 0x8(%ebp),%eax 800443: 89 45 f4 mov %eax,-0xc(%ebp) 800446: 8b 45 0c mov 0xc(%ebp),%eax 800449: 89 45 f0 mov %eax,-0x10(%ebp) #ifndef __HAVE_ARCH_STRCMP #define __HAVE_ARCH_STRCMP static inline int __strcmp(const char *s1, const char *s2) { int d0, d1, ret; asm volatile ( 80044c: 8b 55 f4 mov -0xc(%ebp),%edx 80044f: 8b 45 f0 mov -0x10(%ebp),%eax 800452: 89 d1 mov %edx,%ecx 800454: 89 c2 mov %eax,%edx 800456: 89 ce mov %ecx,%esi 800458: 89 d7 mov %edx,%edi 80045a: ac lods %ds:(%esi),%al 80045b: ae scas %es:(%edi),%al 80045c: 75 08 jne 800466 <strcmp+0x2e> 80045e: 84 c0 test %al,%al 800460: 75 f8 jne 80045a <strcmp+0x22> 800462: 31 c0 xor %eax,%eax 800464: eb 04 jmp 80046a <strcmp+0x32> 800466: 19 c0 sbb %eax,%eax 800468: 0c 01 or $0x1,%al 80046a: 89 fa mov %edi,%edx 80046c: 89 f1 mov %esi,%ecx 80046e: 89 45 ec mov %eax,-0x14(%ebp) 800471: 89 4d e8 mov %ecx,-0x18(%ebp) 800474: 89 55 e4 mov %edx,-0x1c(%ebp) "orb $1, %%al;" "3:" : "=a" (ret), "=&S" (d0), "=&D" (d1) : "1" (s1), "2" (s2) : "memory"); return ret; 800477: 8b 45 ec mov -0x14(%ebp),%eax #ifdef __HAVE_ARCH_STRCMP return __strcmp(s1, s2); 80047a: 90 nop while (*s1 != '\0' && *s1 == *s2) { s1 ++, s2 ++; } return (int)((unsigned char)*s1 - (unsigned char)*s2); #endif /* __HAVE_ARCH_STRCMP */ } 80047b: 83 c4 20 add $0x20,%esp 80047e: 5e pop %esi 80047f: 5f pop %edi 800480: 5d pop %ebp 800481: c3 ret 00800482 <strncmp>: * they are equal to each other, it continues with the following pairs until * the characters differ, until a terminating null-character is reached, or * until @n characters match in both strings, whichever happens first. * */ int strncmp(const char *s1, const char *s2, size_t n) { 800482: 55 push %ebp 800483: 89 e5 mov %esp,%ebp while (n > 0 && *s1 != '\0' && *s1 == *s2) { 800485: eb 0c jmp 800493 <strncmp+0x11> n --, s1 ++, s2 ++; 800487: 83 6d 10 01 subl $0x1,0x10(%ebp) 80048b: 83 45 08 01 addl $0x1,0x8(%ebp) 80048f: 83 45 0c 01 addl $0x1,0xc(%ebp) * the characters differ, until a terminating null-character is reached, or * until @n characters match in both strings, whichever happens first. * */ int strncmp(const char *s1, const char *s2, size_t n) { while (n > 0 && *s1 != '\0' && *s1 == *s2) { 800493: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 800497: 74 1a je 8004b3 <strncmp+0x31> 800499: 8b 45 08 mov 0x8(%ebp),%eax 80049c: 0f b6 00 movzbl (%eax),%eax 80049f: 84 c0 test %al,%al 8004a1: 74 10 je 8004b3 <strncmp+0x31> 8004a3: 8b 45 08 mov 0x8(%ebp),%eax 8004a6: 0f b6 10 movzbl (%eax),%edx 8004a9: 8b 45 0c mov 0xc(%ebp),%eax 8004ac: 0f b6 00 movzbl (%eax),%eax 8004af: 38 c2 cmp %al,%dl 8004b1: 74 d4 je 800487 <strncmp+0x5> n --, s1 ++, s2 ++; } return (n == 0) ? 0 : (int)((unsigned char)*s1 - (unsigned char)*s2); 8004b3: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8004b7: 74 18 je 8004d1 <strncmp+0x4f> 8004b9: 8b 45 08 mov 0x8(%ebp),%eax 8004bc: 0f b6 00 movzbl (%eax),%eax 8004bf: 0f b6 d0 movzbl %al,%edx 8004c2: 8b 45 0c mov 0xc(%ebp),%eax 8004c5: 0f b6 00 movzbl (%eax),%eax 8004c8: 0f b6 c0 movzbl %al,%eax 8004cb: 29 c2 sub %eax,%edx 8004cd: 89 d0 mov %edx,%eax 8004cf: eb 05 jmp 8004d6 <strncmp+0x54> 8004d1: b8 00 00 00 00 mov $0x0,%eax } 8004d6: 5d pop %ebp 8004d7: c3 ret 008004d8 <strchr>: * * The strchr() function returns a pointer to the first occurrence of * character in @s. If the value is not found, the function returns 'NULL'. * */ char * strchr(const char *s, char c) { 8004d8: 55 push %ebp 8004d9: 89 e5 mov %esp,%ebp 8004db: 83 ec 04 sub $0x4,%esp 8004de: 8b 45 0c mov 0xc(%ebp),%eax 8004e1: 88 45 fc mov %al,-0x4(%ebp) while (*s != '\0') { 8004e4: eb 14 jmp 8004fa <strchr+0x22> if (*s == c) { 8004e6: 8b 45 08 mov 0x8(%ebp),%eax 8004e9: 0f b6 00 movzbl (%eax),%eax 8004ec: 3a 45 fc cmp -0x4(%ebp),%al 8004ef: 75 05 jne 8004f6 <strchr+0x1e> return (char *)s; 8004f1: 8b 45 08 mov 0x8(%ebp),%eax 8004f4: eb 13 jmp 800509 <strchr+0x31> } s ++; 8004f6: 83 45 08 01 addl $0x1,0x8(%ebp) * The strchr() function returns a pointer to the first occurrence of * character in @s. If the value is not found, the function returns 'NULL'. * */ char * strchr(const char *s, char c) { while (*s != '\0') { 8004fa: 8b 45 08 mov 0x8(%ebp),%eax 8004fd: 0f b6 00 movzbl (%eax),%eax 800500: 84 c0 test %al,%al 800502: 75 e2 jne 8004e6 <strchr+0xe> if (*s == c) { return (char *)s; } s ++; } return NULL; 800504: b8 00 00 00 00 mov $0x0,%eax } 800509: c9 leave 80050a: c3 ret 0080050b <strfind>: * The strfind() function is like strchr() except that if @c is * not found in @s, then it returns a pointer to the null byte at the * end of @s, rather than 'NULL'. * */ char * strfind(const char *s, char c) { 80050b: 55 push %ebp 80050c: 89 e5 mov %esp,%ebp 80050e: 83 ec 04 sub $0x4,%esp 800511: 8b 45 0c mov 0xc(%ebp),%eax 800514: 88 45 fc mov %al,-0x4(%ebp) while (*s != '\0') { 800517: eb 0f jmp 800528 <strfind+0x1d> if (*s == c) { 800519: 8b 45 08 mov 0x8(%ebp),%eax 80051c: 0f b6 00 movzbl (%eax),%eax 80051f: 3a 45 fc cmp -0x4(%ebp),%al 800522: 74 10 je 800534 <strfind+0x29> break; } s ++; 800524: 83 45 08 01 addl $0x1,0x8(%ebp) * not found in @s, then it returns a pointer to the null byte at the * end of @s, rather than 'NULL'. * */ char * strfind(const char *s, char c) { while (*s != '\0') { 800528: 8b 45 08 mov 0x8(%ebp),%eax 80052b: 0f b6 00 movzbl (%eax),%eax 80052e: 84 c0 test %al,%al 800530: 75 e7 jne 800519 <strfind+0xe> 800532: eb 01 jmp 800535 <strfind+0x2a> if (*s == c) { break; 800534: 90 nop } s ++; } return (char *)s; 800535: 8b 45 08 mov 0x8(%ebp),%eax } 800538: c9 leave 800539: c3 ret 0080053a <strtol>: * an optional "0x" or "0X" prefix. * * The strtol() function returns the converted integral number as a long int value. * */ long strtol(const char *s, char **endptr, int base) { 80053a: 55 push %ebp 80053b: 89 e5 mov %esp,%ebp 80053d: 83 ec 10 sub $0x10,%esp int neg = 0; 800540: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) long val = 0; 800547: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp) // gobble initial whitespace while (*s == ' ' || *s == '\t') { 80054e: eb 04 jmp 800554 <strtol+0x1a> s ++; 800550: 83 45 08 01 addl $0x1,0x8(%ebp) strtol(const char *s, char **endptr, int base) { int neg = 0; long val = 0; // gobble initial whitespace while (*s == ' ' || *s == '\t') { 800554: 8b 45 08 mov 0x8(%ebp),%eax 800557: 0f b6 00 movzbl (%eax),%eax 80055a: 3c 20 cmp $0x20,%al 80055c: 74 f2 je 800550 <strtol+0x16> 80055e: 8b 45 08 mov 0x8(%ebp),%eax 800561: 0f b6 00 movzbl (%eax),%eax 800564: 3c 09 cmp $0x9,%al 800566: 74 e8 je 800550 <strtol+0x16> s ++; } // plus/minus sign if (*s == '+') { 800568: 8b 45 08 mov 0x8(%ebp),%eax 80056b: 0f b6 00 movzbl (%eax),%eax 80056e: 3c 2b cmp $0x2b,%al 800570: 75 06 jne 800578 <strtol+0x3e> s ++; 800572: 83 45 08 01 addl $0x1,0x8(%ebp) 800576: eb 15 jmp 80058d <strtol+0x53> } else if (*s == '-') { 800578: 8b 45 08 mov 0x8(%ebp),%eax 80057b: 0f b6 00 movzbl (%eax),%eax 80057e: 3c 2d cmp $0x2d,%al 800580: 75 0b jne 80058d <strtol+0x53> s ++, neg = 1; 800582: 83 45 08 01 addl $0x1,0x8(%ebp) 800586: c7 45 fc 01 00 00 00 movl $0x1,-0x4(%ebp) } // hex or octal base prefix if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) { 80058d: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 800591: 74 06 je 800599 <strtol+0x5f> 800593: 83 7d 10 10 cmpl $0x10,0x10(%ebp) 800597: 75 24 jne 8005bd <strtol+0x83> 800599: 8b 45 08 mov 0x8(%ebp),%eax 80059c: 0f b6 00 movzbl (%eax),%eax 80059f: 3c 30 cmp $0x30,%al 8005a1: 75 1a jne 8005bd <strtol+0x83> 8005a3: 8b 45 08 mov 0x8(%ebp),%eax 8005a6: 83 c0 01 add $0x1,%eax 8005a9: 0f b6 00 movzbl (%eax),%eax 8005ac: 3c 78 cmp $0x78,%al 8005ae: 75 0d jne 8005bd <strtol+0x83> s += 2, base = 16; 8005b0: 83 45 08 02 addl $0x2,0x8(%ebp) 8005b4: c7 45 10 10 00 00 00 movl $0x10,0x10(%ebp) 8005bb: eb 2a jmp 8005e7 <strtol+0xad> } else if (base == 0 && s[0] == '0') { 8005bd: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8005c1: 75 17 jne 8005da <strtol+0xa0> 8005c3: 8b 45 08 mov 0x8(%ebp),%eax 8005c6: 0f b6 00 movzbl (%eax),%eax 8005c9: 3c 30 cmp $0x30,%al 8005cb: 75 0d jne 8005da <strtol+0xa0> s ++, base = 8; 8005cd: 83 45 08 01 addl $0x1,0x8(%ebp) 8005d1: c7 45 10 08 00 00 00 movl $0x8,0x10(%ebp) 8005d8: eb 0d jmp 8005e7 <strtol+0xad> } else if (base == 0) { 8005da: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 8005de: 75 07 jne 8005e7 <strtol+0xad> base = 10; 8005e0: c7 45 10 0a 00 00 00 movl $0xa,0x10(%ebp) // digits while (1) { int dig; if (*s >= '0' && *s <= '9') { 8005e7: 8b 45 08 mov 0x8(%ebp),%eax 8005ea: 0f b6 00 movzbl (%eax),%eax 8005ed: 3c 2f cmp $0x2f,%al 8005ef: 7e 1b jle 80060c <strtol+0xd2> 8005f1: 8b 45 08 mov 0x8(%ebp),%eax 8005f4: 0f b6 00 movzbl (%eax),%eax 8005f7: 3c 39 cmp $0x39,%al 8005f9: 7f 11 jg 80060c <strtol+0xd2> dig = *s - '0'; 8005fb: 8b 45 08 mov 0x8(%ebp),%eax 8005fe: 0f b6 00 movzbl (%eax),%eax 800601: 0f be c0 movsbl %al,%eax 800604: 83 e8 30 sub $0x30,%eax 800607: 89 45 f4 mov %eax,-0xc(%ebp) 80060a: eb 48 jmp 800654 <strtol+0x11a> } else if (*s >= 'a' && *s <= 'z') { 80060c: 8b 45 08 mov 0x8(%ebp),%eax 80060f: 0f b6 00 movzbl (%eax),%eax 800612: 3c 60 cmp $0x60,%al 800614: 7e 1b jle 800631 <strtol+0xf7> 800616: 8b 45 08 mov 0x8(%ebp),%eax 800619: 0f b6 00 movzbl (%eax),%eax 80061c: 3c 7a cmp $0x7a,%al 80061e: 7f 11 jg 800631 <strtol+0xf7> dig = *s - 'a' + 10; 800620: 8b 45 08 mov 0x8(%ebp),%eax 800623: 0f b6 00 movzbl (%eax),%eax 800626: 0f be c0 movsbl %al,%eax 800629: 83 e8 57 sub $0x57,%eax 80062c: 89 45 f4 mov %eax,-0xc(%ebp) 80062f: eb 23 jmp 800654 <strtol+0x11a> } else if (*s >= 'A' && *s <= 'Z') { 800631: 8b 45 08 mov 0x8(%ebp),%eax 800634: 0f b6 00 movzbl (%eax),%eax 800637: 3c 40 cmp $0x40,%al 800639: 7e 3c jle 800677 <strtol+0x13d> 80063b: 8b 45 08 mov 0x8(%ebp),%eax 80063e: 0f b6 00 movzbl (%eax),%eax 800641: 3c 5a cmp $0x5a,%al 800643: 7f 32 jg 800677 <strtol+0x13d> dig = *s - 'A' + 10; 800645: 8b 45 08 mov 0x8(%ebp),%eax 800648: 0f b6 00 movzbl (%eax),%eax 80064b: 0f be c0 movsbl %al,%eax 80064e: 83 e8 37 sub $0x37,%eax 800651: 89 45 f4 mov %eax,-0xc(%ebp) } else { break; } if (dig >= base) { 800654: 8b 45 f4 mov -0xc(%ebp),%eax 800657: 3b 45 10 cmp 0x10(%ebp),%eax 80065a: 7d 1a jge 800676 <strtol+0x13c> break; } s ++, val = (val * base) + dig; 80065c: 83 45 08 01 addl $0x1,0x8(%ebp) 800660: 8b 45 f8 mov -0x8(%ebp),%eax 800663: 0f af 45 10 imul 0x10(%ebp),%eax 800667: 89 c2 mov %eax,%edx 800669: 8b 45 f4 mov -0xc(%ebp),%eax 80066c: 01 d0 add %edx,%eax 80066e: 89 45 f8 mov %eax,-0x8(%ebp) // we don't properly detect overflow! } 800671: e9 71 ff ff ff jmp 8005e7 <strtol+0xad> } else { break; } if (dig >= base) { break; 800676: 90 nop } s ++, val = (val * base) + dig; // we don't properly detect overflow! } if (endptr) { 800677: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 80067b: 74 08 je 800685 <strtol+0x14b> *endptr = (char *) s; 80067d: 8b 45 0c mov 0xc(%ebp),%eax 800680: 8b 55 08 mov 0x8(%ebp),%edx 800683: 89 10 mov %edx,(%eax) } return (neg ? -val : val); 800685: 83 7d fc 00 cmpl $0x0,-0x4(%ebp) 800689: 74 07 je 800692 <strtol+0x158> 80068b: 8b 45 f8 mov -0x8(%ebp),%eax 80068e: f7 d8 neg %eax 800690: eb 03 jmp 800695 <strtol+0x15b> 800692: 8b 45 f8 mov -0x8(%ebp),%eax } 800695: c9 leave 800696: c3 ret 00800697 <memset>: * @n: number of bytes to be set to the value * * The memset() function returns @s. * */ void * memset(void *s, char c, size_t n) { 800697: 55 push %ebp 800698: 89 e5 mov %esp,%ebp 80069a: 57 push %edi 80069b: 83 ec 24 sub $0x24,%esp 80069e: 8b 45 0c mov 0xc(%ebp),%eax 8006a1: 88 45 d8 mov %al,-0x28(%ebp) #ifdef __HAVE_ARCH_MEMSET return __memset(s, c, n); 8006a4: 0f be 45 d8 movsbl -0x28(%ebp),%eax 8006a8: 8b 55 08 mov 0x8(%ebp),%edx 8006ab: 89 55 f8 mov %edx,-0x8(%ebp) 8006ae: 88 45 f7 mov %al,-0x9(%ebp) 8006b1: 8b 45 10 mov 0x10(%ebp),%eax 8006b4: 89 45 f0 mov %eax,-0x10(%ebp) #ifndef __HAVE_ARCH_MEMSET #define __HAVE_ARCH_MEMSET static inline void * __memset(void *s, char c, size_t n) { int d0, d1; asm volatile ( 8006b7: 8b 4d f0 mov -0x10(%ebp),%ecx 8006ba: 0f b6 45 f7 movzbl -0x9(%ebp),%eax 8006be: 8b 55 f8 mov -0x8(%ebp),%edx 8006c1: 89 d7 mov %edx,%edi 8006c3: f3 aa rep stos %al,%es:(%edi) 8006c5: 89 fa mov %edi,%edx 8006c7: 89 4d ec mov %ecx,-0x14(%ebp) 8006ca: 89 55 e8 mov %edx,-0x18(%ebp) "rep; stosb;" : "=&c" (d0), "=&D" (d1) : "0" (n), "a" (c), "1" (s) : "memory"); return s; 8006cd: 8b 45 f8 mov -0x8(%ebp),%eax 8006d0: 90 nop while (n -- > 0) { *p ++ = c; } return s; #endif /* __HAVE_ARCH_MEMSET */ } 8006d1: 83 c4 24 add $0x24,%esp 8006d4: 5f pop %edi 8006d5: 5d pop %ebp 8006d6: c3 ret 008006d7 <memmove>: * @n: number of bytes to copy * * The memmove() function returns @dst. * */ void * memmove(void *dst, const void *src, size_t n) { 8006d7: 55 push %ebp 8006d8: 89 e5 mov %esp,%ebp 8006da: 57 push %edi 8006db: 56 push %esi 8006dc: 53 push %ebx 8006dd: 83 ec 30 sub $0x30,%esp 8006e0: 8b 45 08 mov 0x8(%ebp),%eax 8006e3: 89 45 f0 mov %eax,-0x10(%ebp) 8006e6: 8b 45 0c mov 0xc(%ebp),%eax 8006e9: 89 45 ec mov %eax,-0x14(%ebp) 8006ec: 8b 45 10 mov 0x10(%ebp),%eax 8006ef: 89 45 e8 mov %eax,-0x18(%ebp) #ifndef __HAVE_ARCH_MEMMOVE #define __HAVE_ARCH_MEMMOVE static inline void * __memmove(void *dst, const void *src, size_t n) { if (dst < src) { 8006f2: 8b 45 f0 mov -0x10(%ebp),%eax 8006f5: 3b 45 ec cmp -0x14(%ebp),%eax 8006f8: 73 42 jae 80073c <memmove+0x65> 8006fa: 8b 45 f0 mov -0x10(%ebp),%eax 8006fd: 89 45 e4 mov %eax,-0x1c(%ebp) 800700: 8b 45 ec mov -0x14(%ebp),%eax 800703: 89 45 e0 mov %eax,-0x20(%ebp) 800706: 8b 45 e8 mov -0x18(%ebp),%eax 800709: 89 45 dc mov %eax,-0x24(%ebp) "andl $3, %%ecx;" "jz 1f;" "rep; movsb;" "1:" : "=&c" (d0), "=&D" (d1), "=&S" (d2) : "0" (n / 4), "g" (n), "1" (dst), "2" (src) 80070c: 8b 45 dc mov -0x24(%ebp),%eax 80070f: c1 e8 02 shr $0x2,%eax 800712: 89 c1 mov %eax,%ecx #ifndef __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMCPY static inline void * __memcpy(void *dst, const void *src, size_t n) { int d0, d1, d2; asm volatile ( 800714: 8b 55 e4 mov -0x1c(%ebp),%edx 800717: 8b 45 e0 mov -0x20(%ebp),%eax 80071a: 89 d7 mov %edx,%edi 80071c: 89 c6 mov %eax,%esi 80071e: f3 a5 rep movsl %ds:(%esi),%es:(%edi) 800720: 8b 4d dc mov -0x24(%ebp),%ecx 800723: 83 e1 03 and $0x3,%ecx 800726: 74 02 je 80072a <memmove+0x53> 800728: f3 a4 rep movsb %ds:(%esi),%es:(%edi) 80072a: 89 f0 mov %esi,%eax 80072c: 89 fa mov %edi,%edx 80072e: 89 4d d8 mov %ecx,-0x28(%ebp) 800731: 89 55 d4 mov %edx,-0x2c(%ebp) 800734: 89 45 d0 mov %eax,-0x30(%ebp) "rep; movsb;" "1:" : "=&c" (d0), "=&D" (d1), "=&S" (d2) : "0" (n / 4), "g" (n), "1" (dst), "2" (src) : "memory"); return dst; 800737: 8b 45 e4 mov -0x1c(%ebp),%eax #ifdef __HAVE_ARCH_MEMMOVE return __memmove(dst, src, n); 80073a: eb 36 jmp 800772 <memmove+0x9b> asm volatile ( "std;" "rep; movsb;" "cld;" : "=&c" (d0), "=&S" (d1), "=&D" (d2) : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst) 80073c: 8b 45 e8 mov -0x18(%ebp),%eax 80073f: 8d 50 ff lea -0x1(%eax),%edx 800742: 8b 45 ec mov -0x14(%ebp),%eax 800745: 01 c2 add %eax,%edx 800747: 8b 45 e8 mov -0x18(%ebp),%eax 80074a: 8d 48 ff lea -0x1(%eax),%ecx 80074d: 8b 45 f0 mov -0x10(%ebp),%eax 800750: 8d 1c 01 lea (%ecx,%eax,1),%ebx __memmove(void *dst, const void *src, size_t n) { if (dst < src) { return __memcpy(dst, src, n); } int d0, d1, d2; asm volatile ( 800753: 8b 45 e8 mov -0x18(%ebp),%eax 800756: 89 c1 mov %eax,%ecx 800758: 89 d8 mov %ebx,%eax 80075a: 89 d6 mov %edx,%esi 80075c: 89 c7 mov %eax,%edi 80075e: fd std 80075f: f3 a4 rep movsb %ds:(%esi),%es:(%edi) 800761: fc cld 800762: 89 f8 mov %edi,%eax 800764: 89 f2 mov %esi,%edx 800766: 89 4d cc mov %ecx,-0x34(%ebp) 800769: 89 55 c8 mov %edx,-0x38(%ebp) 80076c: 89 45 c4 mov %eax,-0x3c(%ebp) "rep; movsb;" "cld;" : "=&c" (d0), "=&S" (d1), "=&D" (d2) : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst) : "memory"); return dst; 80076f: 8b 45 f0 mov -0x10(%ebp),%eax *d ++ = *s ++; } } return dst; #endif /* __HAVE_ARCH_MEMMOVE */ } 800772: 83 c4 30 add $0x30,%esp 800775: 5b pop %ebx 800776: 5e pop %esi 800777: 5f pop %edi 800778: 5d pop %ebp 800779: c3 ret 0080077a <memcpy>: * it always copies exactly @n bytes. To avoid overflows, the size of arrays pointed * by both @src and @dst, should be at least @n bytes, and should not overlap * (for overlapping memory area, memmove is a safer approach). * */ void * memcpy(void *dst, const void *src, size_t n) { 80077a: 55 push %ebp 80077b: 89 e5 mov %esp,%ebp 80077d: 57 push %edi 80077e: 56 push %esi 80077f: 83 ec 20 sub $0x20,%esp 800782: 8b 45 08 mov 0x8(%ebp),%eax 800785: 89 45 f4 mov %eax,-0xc(%ebp) 800788: 8b 45 0c mov 0xc(%ebp),%eax 80078b: 89 45 f0 mov %eax,-0x10(%ebp) 80078e: 8b 45 10 mov 0x10(%ebp),%eax 800791: 89 45 ec mov %eax,-0x14(%ebp) "andl $3, %%ecx;" "jz 1f;" "rep; movsb;" "1:" : "=&c" (d0), "=&D" (d1), "=&S" (d2) : "0" (n / 4), "g" (n), "1" (dst), "2" (src) 800794: 8b 45 ec mov -0x14(%ebp),%eax 800797: c1 e8 02 shr $0x2,%eax 80079a: 89 c1 mov %eax,%ecx #ifndef __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMCPY static inline void * __memcpy(void *dst, const void *src, size_t n) { int d0, d1, d2; asm volatile ( 80079c: 8b 55 f4 mov -0xc(%ebp),%edx 80079f: 8b 45 f0 mov -0x10(%ebp),%eax 8007a2: 89 d7 mov %edx,%edi 8007a4: 89 c6 mov %eax,%esi 8007a6: f3 a5 rep movsl %ds:(%esi),%es:(%edi) 8007a8: 8b 4d ec mov -0x14(%ebp),%ecx 8007ab: 83 e1 03 and $0x3,%ecx 8007ae: 74 02 je 8007b2 <memcpy+0x38> 8007b0: f3 a4 rep movsb %ds:(%esi),%es:(%edi) 8007b2: 89 f0 mov %esi,%eax 8007b4: 89 fa mov %edi,%edx 8007b6: 89 4d e8 mov %ecx,-0x18(%ebp) 8007b9: 89 55 e4 mov %edx,-0x1c(%ebp) 8007bc: 89 45 e0 mov %eax,-0x20(%ebp) "rep; movsb;" "1:" : "=&c" (d0), "=&D" (d1), "=&S" (d2) : "0" (n / 4), "g" (n), "1" (dst), "2" (src) : "memory"); return dst; 8007bf: 8b 45 f4 mov -0xc(%ebp),%eax #ifdef __HAVE_ARCH_MEMCPY return __memcpy(dst, src, n); 8007c2: 90 nop while (n -- > 0) { *d ++ = *s ++; } return dst; #endif /* __HAVE_ARCH_MEMCPY */ } 8007c3: 83 c4 20 add $0x20,%esp 8007c6: 5e pop %esi 8007c7: 5f pop %edi 8007c8: 5d pop %ebp 8007c9: c3 ret 008007ca <memcmp>: * match in both memory blocks has a greater value in @v1 than in @v2 * as if evaluated as unsigned char values; * - And a value less than zero indicates the opposite. * */ int memcmp(const void *v1, const void *v2, size_t n) { 8007ca: 55 push %ebp 8007cb: 89 e5 mov %esp,%ebp 8007cd: 83 ec 10 sub $0x10,%esp const char *s1 = (const char *)v1; 8007d0: 8b 45 08 mov 0x8(%ebp),%eax 8007d3: 89 45 fc mov %eax,-0x4(%ebp) const char *s2 = (const char *)v2; 8007d6: 8b 45 0c mov 0xc(%ebp),%eax 8007d9: 89 45 f8 mov %eax,-0x8(%ebp) while (n -- > 0) { 8007dc: eb 30 jmp 80080e <memcmp+0x44> if (*s1 != *s2) { 8007de: 8b 45 fc mov -0x4(%ebp),%eax 8007e1: 0f b6 10 movzbl (%eax),%edx 8007e4: 8b 45 f8 mov -0x8(%ebp),%eax 8007e7: 0f b6 00 movzbl (%eax),%eax 8007ea: 38 c2 cmp %al,%dl 8007ec: 74 18 je 800806 <memcmp+0x3c> return (int)((unsigned char)*s1 - (unsigned char)*s2); 8007ee: 8b 45 fc mov -0x4(%ebp),%eax 8007f1: 0f b6 00 movzbl (%eax),%eax 8007f4: 0f b6 d0 movzbl %al,%edx 8007f7: 8b 45 f8 mov -0x8(%ebp),%eax 8007fa: 0f b6 00 movzbl (%eax),%eax 8007fd: 0f b6 c0 movzbl %al,%eax 800800: 29 c2 sub %eax,%edx 800802: 89 d0 mov %edx,%eax 800804: eb 1a jmp 800820 <memcmp+0x56> } s1 ++, s2 ++; 800806: 83 45 fc 01 addl $0x1,-0x4(%ebp) 80080a: 83 45 f8 01 addl $0x1,-0x8(%ebp) * */ int memcmp(const void *v1, const void *v2, size_t n) { const char *s1 = (const char *)v1; const char *s2 = (const char *)v2; while (n -- > 0) { 80080e: 8b 45 10 mov 0x10(%ebp),%eax 800811: 8d 50 ff lea -0x1(%eax),%edx 800814: 89 55 10 mov %edx,0x10(%ebp) 800817: 85 c0 test %eax,%eax 800819: 75 c3 jne 8007de <memcmp+0x14> if (*s1 != *s2) { return (int)((unsigned char)*s1 - (unsigned char)*s2); } s1 ++, s2 ++; } return 0; 80081b: b8 00 00 00 00 mov $0x0,%eax } 800820: c9 leave 800821: c3 ret 00800822 <printnum>: * @width: maximum number of digits, if the actual width is less than @width, use @padc instead * @padc: character that padded on the left if the actual width is less than @width * */ static void printnum(void (*putch)(int, void*), void *putdat, unsigned long long num, unsigned base, int width, int padc) { 800822: 55 push %ebp 800823: 89 e5 mov %esp,%ebp 800825: 83 ec 38 sub $0x38,%esp 800828: 8b 45 10 mov 0x10(%ebp),%eax 80082b: 89 45 d0 mov %eax,-0x30(%ebp) 80082e: 8b 45 14 mov 0x14(%ebp),%eax 800831: 89 45 d4 mov %eax,-0x2c(%ebp) unsigned long long result = num; 800834: 8b 45 d0 mov -0x30(%ebp),%eax 800837: 8b 55 d4 mov -0x2c(%ebp),%edx 80083a: 89 45 e8 mov %eax,-0x18(%ebp) 80083d: 89 55 ec mov %edx,-0x14(%ebp) unsigned mod = do_div(result, base); 800840: 8b 45 18 mov 0x18(%ebp),%eax 800843: 89 45 e4 mov %eax,-0x1c(%ebp) 800846: 8b 45 e8 mov -0x18(%ebp),%eax 800849: 8b 55 ec mov -0x14(%ebp),%edx 80084c: 89 45 e0 mov %eax,-0x20(%ebp) 80084f: 89 55 f0 mov %edx,-0x10(%ebp) 800852: 8b 45 f0 mov -0x10(%ebp),%eax 800855: 89 45 f4 mov %eax,-0xc(%ebp) 800858: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 80085c: 74 1c je 80087a <printnum+0x58> 80085e: 8b 45 f0 mov -0x10(%ebp),%eax 800861: ba 00 00 00 00 mov $0x0,%edx 800866: f7 75 e4 divl -0x1c(%ebp) 800869: 89 55 f4 mov %edx,-0xc(%ebp) 80086c: 8b 45 f0 mov -0x10(%ebp),%eax 80086f: ba 00 00 00 00 mov $0x0,%edx 800874: f7 75 e4 divl -0x1c(%ebp) 800877: 89 45 f0 mov %eax,-0x10(%ebp) 80087a: 8b 45 e0 mov -0x20(%ebp),%eax 80087d: 8b 55 f4 mov -0xc(%ebp),%edx 800880: f7 75 e4 divl -0x1c(%ebp) 800883: 89 45 e0 mov %eax,-0x20(%ebp) 800886: 89 55 dc mov %edx,-0x24(%ebp) 800889: 8b 45 e0 mov -0x20(%ebp),%eax 80088c: 8b 55 f0 mov -0x10(%ebp),%edx 80088f: 89 45 e8 mov %eax,-0x18(%ebp) 800892: 89 55 ec mov %edx,-0x14(%ebp) 800895: 8b 45 dc mov -0x24(%ebp),%eax 800898: 89 45 d8 mov %eax,-0x28(%ebp) // first recursively print all preceding (more significant) digits if (num >= base) { 80089b: 8b 45 18 mov 0x18(%ebp),%eax 80089e: ba 00 00 00 00 mov $0x0,%edx 8008a3: 3b 55 d4 cmp -0x2c(%ebp),%edx 8008a6: 77 41 ja 8008e9 <printnum+0xc7> 8008a8: 3b 55 d4 cmp -0x2c(%ebp),%edx 8008ab: 72 05 jb 8008b2 <printnum+0x90> 8008ad: 3b 45 d0 cmp -0x30(%ebp),%eax 8008b0: 77 37 ja 8008e9 <printnum+0xc7> printnum(putch, putdat, result, base, width - 1, padc); 8008b2: 8b 45 1c mov 0x1c(%ebp),%eax 8008b5: 83 e8 01 sub $0x1,%eax 8008b8: 83 ec 04 sub $0x4,%esp 8008bb: ff 75 20 pushl 0x20(%ebp) 8008be: 50 push %eax 8008bf: ff 75 18 pushl 0x18(%ebp) 8008c2: ff 75 ec pushl -0x14(%ebp) 8008c5: ff 75 e8 pushl -0x18(%ebp) 8008c8: ff 75 0c pushl 0xc(%ebp) 8008cb: ff 75 08 pushl 0x8(%ebp) 8008ce: e8 4f ff ff ff call 800822 <printnum> 8008d3: 83 c4 20 add $0x20,%esp 8008d6: eb 1b jmp 8008f3 <printnum+0xd1> } else { // print any needed pad characters before first digit while (-- width > 0) putch(padc, putdat); 8008d8: 83 ec 08 sub $0x8,%esp 8008db: ff 75 0c pushl 0xc(%ebp) 8008de: ff 75 20 pushl 0x20(%ebp) 8008e1: 8b 45 08 mov 0x8(%ebp),%eax 8008e4: ff d0 call *%eax 8008e6: 83 c4 10 add $0x10,%esp // first recursively print all preceding (more significant) digits if (num >= base) { printnum(putch, putdat, result, base, width - 1, padc); } else { // print any needed pad characters before first digit while (-- width > 0) 8008e9: 83 6d 1c 01 subl $0x1,0x1c(%ebp) 8008ed: 83 7d 1c 00 cmpl $0x0,0x1c(%ebp) 8008f1: 7f e5 jg 8008d8 <printnum+0xb6> putch(padc, putdat); } // then print this (the least significant) digit putch("0123456789abcdef"[mod], putdat); 8008f3: 8b 45 d8 mov -0x28(%ebp),%eax 8008f6: 05 e4 10 80 00 add $0x8010e4,%eax 8008fb: 0f b6 00 movzbl (%eax),%eax 8008fe: 0f be c0 movsbl %al,%eax 800901: 83 ec 08 sub $0x8,%esp 800904: ff 75 0c pushl 0xc(%ebp) 800907: 50 push %eax 800908: 8b 45 08 mov 0x8(%ebp),%eax 80090b: ff d0 call *%eax 80090d: 83 c4 10 add $0x10,%esp } 800910: 90 nop 800911: c9 leave 800912: c3 ret 00800913 <getuint>: * getuint - get an unsigned int of various possible sizes from a varargs list * @ap: a varargs list pointer * @lflag: determines the size of the vararg that @ap points to * */ static unsigned long long getuint(va_list *ap, int lflag) { 800913: 55 push %ebp 800914: 89 e5 mov %esp,%ebp if (lflag >= 2) { 800916: 83 7d 0c 01 cmpl $0x1,0xc(%ebp) 80091a: 7e 14 jle 800930 <getuint+0x1d> return va_arg(*ap, unsigned long long); 80091c: 8b 45 08 mov 0x8(%ebp),%eax 80091f: 8b 00 mov (%eax),%eax 800921: 8d 48 08 lea 0x8(%eax),%ecx 800924: 8b 55 08 mov 0x8(%ebp),%edx 800927: 89 0a mov %ecx,(%edx) 800929: 8b 50 04 mov 0x4(%eax),%edx 80092c: 8b 00 mov (%eax),%eax 80092e: eb 30 jmp 800960 <getuint+0x4d> } else if (lflag) { 800930: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 800934: 74 16 je 80094c <getuint+0x39> return va_arg(*ap, unsigned long); 800936: 8b 45 08 mov 0x8(%ebp),%eax 800939: 8b 00 mov (%eax),%eax 80093b: 8d 48 04 lea 0x4(%eax),%ecx 80093e: 8b 55 08 mov 0x8(%ebp),%edx 800941: 89 0a mov %ecx,(%edx) 800943: 8b 00 mov (%eax),%eax 800945: ba 00 00 00 00 mov $0x0,%edx 80094a: eb 14 jmp 800960 <getuint+0x4d> } else { return va_arg(*ap, unsigned int); 80094c: 8b 45 08 mov 0x8(%ebp),%eax 80094f: 8b 00 mov (%eax),%eax 800951: 8d 48 04 lea 0x4(%eax),%ecx 800954: 8b 55 08 mov 0x8(%ebp),%edx 800957: 89 0a mov %ecx,(%edx) 800959: 8b 00 mov (%eax),%eax 80095b: ba 00 00 00 00 mov $0x0,%edx } } 800960: 5d pop %ebp 800961: c3 ret 00800962 <getint>: * getint - same as getuint but signed, we can't use getuint because of sign extension * @ap: a varargs list pointer * @lflag: determines the size of the vararg that @ap points to * */ static long long getint(va_list *ap, int lflag) { 800962: 55 push %ebp 800963: 89 e5 mov %esp,%ebp if (lflag >= 2) { 800965: 83 7d 0c 01 cmpl $0x1,0xc(%ebp) 800969: 7e 14 jle 80097f <getint+0x1d> return va_arg(*ap, long long); 80096b: 8b 45 08 mov 0x8(%ebp),%eax 80096e: 8b 00 mov (%eax),%eax 800970: 8d 48 08 lea 0x8(%eax),%ecx 800973: 8b 55 08 mov 0x8(%ebp),%edx 800976: 89 0a mov %ecx,(%edx) 800978: 8b 50 04 mov 0x4(%eax),%edx 80097b: 8b 00 mov (%eax),%eax 80097d: eb 28 jmp 8009a7 <getint+0x45> } else if (lflag) { 80097f: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 800983: 74 12 je 800997 <getint+0x35> return va_arg(*ap, long); 800985: 8b 45 08 mov 0x8(%ebp),%eax 800988: 8b 00 mov (%eax),%eax 80098a: 8d 48 04 lea 0x4(%eax),%ecx 80098d: 8b 55 08 mov 0x8(%ebp),%edx 800990: 89 0a mov %ecx,(%edx) 800992: 8b 00 mov (%eax),%eax 800994: 99 cltd 800995: eb 10 jmp 8009a7 <getint+0x45> } else { return va_arg(*ap, int); 800997: 8b 45 08 mov 0x8(%ebp),%eax 80099a: 8b 00 mov (%eax),%eax 80099c: 8d 48 04 lea 0x4(%eax),%ecx 80099f: 8b 55 08 mov 0x8(%ebp),%edx 8009a2: 89 0a mov %ecx,(%edx) 8009a4: 8b 00 mov (%eax),%eax 8009a6: 99 cltd } } 8009a7: 5d pop %ebp 8009a8: c3 ret 008009a9 <printfmt>: * @putch: specified putch function, print a single character * @putdat: used by @putch function * @fmt: the format string to use * */ void printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) { 8009a9: 55 push %ebp 8009aa: 89 e5 mov %esp,%ebp 8009ac: 83 ec 18 sub $0x18,%esp va_list ap; va_start(ap, fmt); 8009af: 8d 45 14 lea 0x14(%ebp),%eax 8009b2: 89 45 f4 mov %eax,-0xc(%ebp) vprintfmt(putch, putdat, fmt, ap); 8009b5: 8b 45 f4 mov -0xc(%ebp),%eax 8009b8: 50 push %eax 8009b9: ff 75 10 pushl 0x10(%ebp) 8009bc: ff 75 0c pushl 0xc(%ebp) 8009bf: ff 75 08 pushl 0x8(%ebp) 8009c2: e8 06 00 00 00 call 8009cd <vprintfmt> 8009c7: 83 c4 10 add $0x10,%esp va_end(ap); } 8009ca: 90 nop 8009cb: c9 leave 8009cc: c3 ret 008009cd <vprintfmt>: * * Call this function if you are already dealing with a va_list. * Or you probably want printfmt() instead. * */ void vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap) { 8009cd: 55 push %ebp 8009ce: 89 e5 mov %esp,%ebp 8009d0: 56 push %esi 8009d1: 53 push %ebx 8009d2: 83 ec 20 sub $0x20,%esp register int ch, err; unsigned long long num; int base, width, precision, lflag, altflag; while (1) { while ((ch = *(unsigned char *)fmt ++) != '%') { 8009d5: eb 17 jmp 8009ee <vprintfmt+0x21> if (ch == '\0') { 8009d7: 85 db test %ebx,%ebx 8009d9: 0f 84 8e 03 00 00 je 800d6d <vprintfmt+0x3a0> return; } putch(ch, putdat); 8009df: 83 ec 08 sub $0x8,%esp 8009e2: ff 75 0c pushl 0xc(%ebp) 8009e5: 53 push %ebx 8009e6: 8b 45 08 mov 0x8(%ebp),%eax 8009e9: ff d0 call *%eax 8009eb: 83 c4 10 add $0x10,%esp register int ch, err; unsigned long long num; int base, width, precision, lflag, altflag; while (1) { while ((ch = *(unsigned char *)fmt ++) != '%') { 8009ee: 8b 45 10 mov 0x10(%ebp),%eax 8009f1: 8d 50 01 lea 0x1(%eax),%edx 8009f4: 89 55 10 mov %edx,0x10(%ebp) 8009f7: 0f b6 00 movzbl (%eax),%eax 8009fa: 0f b6 d8 movzbl %al,%ebx 8009fd: 83 fb 25 cmp $0x25,%ebx 800a00: 75 d5 jne 8009d7 <vprintfmt+0xa> } putch(ch, putdat); } // Process a %-escape sequence char padc = ' '; 800a02: c6 45 db 20 movb $0x20,-0x25(%ebp) width = precision = -1; 800a06: c7 45 e4 ff ff ff ff movl $0xffffffff,-0x1c(%ebp) 800a0d: 8b 45 e4 mov -0x1c(%ebp),%eax 800a10: 89 45 e8 mov %eax,-0x18(%ebp) lflag = altflag = 0; 800a13: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) 800a1a: 8b 45 dc mov -0x24(%ebp),%eax 800a1d: 89 45 e0 mov %eax,-0x20(%ebp) reswitch: switch (ch = *(unsigned char *)fmt ++) { 800a20: 8b 45 10 mov 0x10(%ebp),%eax 800a23: 8d 50 01 lea 0x1(%eax),%edx 800a26: 89 55 10 mov %edx,0x10(%ebp) 800a29: 0f b6 00 movzbl (%eax),%eax 800a2c: 0f b6 d8 movzbl %al,%ebx 800a2f: 8d 43 dd lea -0x23(%ebx),%eax 800a32: 83 f8 55 cmp $0x55,%eax 800a35: 0f 87 05 03 00 00 ja 800d40 <vprintfmt+0x373> 800a3b: 8b 04 85 08 11 80 00 mov 0x801108(,%eax,4),%eax 800a42: ff e0 jmp *%eax // flag to pad on the right case '-': padc = '-'; 800a44: c6 45 db 2d movb $0x2d,-0x25(%ebp) goto reswitch; 800a48: eb d6 jmp 800a20 <vprintfmt+0x53> // flag to pad with 0's instead of spaces case '0': padc = '0'; 800a4a: c6 45 db 30 movb $0x30,-0x25(%ebp) goto reswitch; 800a4e: eb d0 jmp 800a20 <vprintfmt+0x53> // width field case '1' ... '9': for (precision = 0; ; ++ fmt) { 800a50: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) precision = precision * 10 + ch - '0'; 800a57: 8b 55 e4 mov -0x1c(%ebp),%edx 800a5a: 89 d0 mov %edx,%eax 800a5c: c1 e0 02 shl $0x2,%eax 800a5f: 01 d0 add %edx,%eax 800a61: 01 c0 add %eax,%eax 800a63: 01 d8 add %ebx,%eax 800a65: 83 e8 30 sub $0x30,%eax 800a68: 89 45 e4 mov %eax,-0x1c(%ebp) ch = *fmt; 800a6b: 8b 45 10 mov 0x10(%ebp),%eax 800a6e: 0f b6 00 movzbl (%eax),%eax 800a71: 0f be d8 movsbl %al,%ebx if (ch < '0' || ch > '9') { 800a74: 83 fb 2f cmp $0x2f,%ebx 800a77: 7e 39 jle 800ab2 <vprintfmt+0xe5> 800a79: 83 fb 39 cmp $0x39,%ebx 800a7c: 7f 34 jg 800ab2 <vprintfmt+0xe5> padc = '0'; goto reswitch; // width field case '1' ... '9': for (precision = 0; ; ++ fmt) { 800a7e: 83 45 10 01 addl $0x1,0x10(%ebp) precision = precision * 10 + ch - '0'; ch = *fmt; if (ch < '0' || ch > '9') { break; } } 800a82: eb d3 jmp 800a57 <vprintfmt+0x8a> goto process_precision; case '*': precision = va_arg(ap, int); 800a84: 8b 45 14 mov 0x14(%ebp),%eax 800a87: 8d 50 04 lea 0x4(%eax),%edx 800a8a: 89 55 14 mov %edx,0x14(%ebp) 800a8d: 8b 00 mov (%eax),%eax 800a8f: 89 45 e4 mov %eax,-0x1c(%ebp) goto process_precision; 800a92: eb 1f jmp 800ab3 <vprintfmt+0xe6> case '.': if (width < 0) 800a94: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 800a98: 79 86 jns 800a20 <vprintfmt+0x53> width = 0; 800a9a: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp) goto reswitch; 800aa1: e9 7a ff ff ff jmp 800a20 <vprintfmt+0x53> case '#': altflag = 1; 800aa6: c7 45 dc 01 00 00 00 movl $0x1,-0x24(%ebp) goto reswitch; 800aad: e9 6e ff ff ff jmp 800a20 <vprintfmt+0x53> ch = *fmt; if (ch < '0' || ch > '9') { break; } } goto process_precision; 800ab2: 90 nop case '#': altflag = 1; goto reswitch; process_precision: if (width < 0) 800ab3: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 800ab7: 0f 89 63 ff ff ff jns 800a20 <vprintfmt+0x53> width = precision, precision = -1; 800abd: 8b 45 e4 mov -0x1c(%ebp),%eax 800ac0: 89 45 e8 mov %eax,-0x18(%ebp) 800ac3: c7 45 e4 ff ff ff ff movl $0xffffffff,-0x1c(%ebp) goto reswitch; 800aca: e9 51 ff ff ff jmp 800a20 <vprintfmt+0x53> // long flag (doubled for long long) case 'l': lflag ++; 800acf: 83 45 e0 01 addl $0x1,-0x20(%ebp) goto reswitch; 800ad3: e9 48 ff ff ff jmp 800a20 <vprintfmt+0x53> // character case 'c': putch(va_arg(ap, int), putdat); 800ad8: 8b 45 14 mov 0x14(%ebp),%eax 800adb: 8d 50 04 lea 0x4(%eax),%edx 800ade: 89 55 14 mov %edx,0x14(%ebp) 800ae1: 8b 00 mov (%eax),%eax 800ae3: 83 ec 08 sub $0x8,%esp 800ae6: ff 75 0c pushl 0xc(%ebp) 800ae9: 50 push %eax 800aea: 8b 45 08 mov 0x8(%ebp),%eax 800aed: ff d0 call *%eax 800aef: 83 c4 10 add $0x10,%esp break; 800af2: e9 71 02 00 00 jmp 800d68 <vprintfmt+0x39b> // error message case 'e': err = va_arg(ap, int); 800af7: 8b 45 14 mov 0x14(%ebp),%eax 800afa: 8d 50 04 lea 0x4(%eax),%edx 800afd: 89 55 14 mov %edx,0x14(%ebp) 800b00: 8b 18 mov (%eax),%ebx if (err < 0) { 800b02: 85 db test %ebx,%ebx 800b04: 79 02 jns 800b08 <vprintfmt+0x13b> err = -err; 800b06: f7 db neg %ebx } if (err > MAXERROR || (p = error_string[err]) == NULL) { 800b08: 83 fb 18 cmp $0x18,%ebx 800b0b: 7f 0b jg 800b18 <vprintfmt+0x14b> 800b0d: 8b 34 9d 80 10 80 00 mov 0x801080(,%ebx,4),%esi 800b14: 85 f6 test %esi,%esi 800b16: 75 19 jne 800b31 <vprintfmt+0x164> printfmt(putch, putdat, "error %d", err); 800b18: 53 push %ebx 800b19: 68 f5 10 80 00 push $0x8010f5 800b1e: ff 75 0c pushl 0xc(%ebp) 800b21: ff 75 08 pushl 0x8(%ebp) 800b24: e8 80 fe ff ff call 8009a9 <printfmt> 800b29: 83 c4 10 add $0x10,%esp } else { printfmt(putch, putdat, "%s", p); } break; 800b2c: e9 37 02 00 00 jmp 800d68 <vprintfmt+0x39b> } if (err > MAXERROR || (p = error_string[err]) == NULL) { printfmt(putch, putdat, "error %d", err); } else { printfmt(putch, putdat, "%s", p); 800b31: 56 push %esi 800b32: 68 fe 10 80 00 push $0x8010fe 800b37: ff 75 0c pushl 0xc(%ebp) 800b3a: ff 75 08 pushl 0x8(%ebp) 800b3d: e8 67 fe ff ff call 8009a9 <printfmt> 800b42: 83 c4 10 add $0x10,%esp } break; 800b45: e9 1e 02 00 00 jmp 800d68 <vprintfmt+0x39b> // string case 's': if ((p = va_arg(ap, char *)) == NULL) { 800b4a: 8b 45 14 mov 0x14(%ebp),%eax 800b4d: 8d 50 04 lea 0x4(%eax),%edx 800b50: 89 55 14 mov %edx,0x14(%ebp) 800b53: 8b 30 mov (%eax),%esi 800b55: 85 f6 test %esi,%esi 800b57: 75 05 jne 800b5e <vprintfmt+0x191> p = "(null)"; 800b59: be 01 11 80 00 mov $0x801101,%esi } if (width > 0 && padc != '-') { 800b5e: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 800b62: 7e 76 jle 800bda <vprintfmt+0x20d> 800b64: 80 7d db 2d cmpb $0x2d,-0x25(%ebp) 800b68: 74 70 je 800bda <vprintfmt+0x20d> for (width -= strnlen(p, precision); width > 0; width --) { 800b6a: 8b 45 e4 mov -0x1c(%ebp),%eax 800b6d: 83 ec 08 sub $0x8,%esp 800b70: 50 push %eax 800b71: 56 push %esi 800b72: e8 17 f8 ff ff call 80038e <strnlen> 800b77: 83 c4 10 add $0x10,%esp 800b7a: 89 c2 mov %eax,%edx 800b7c: 8b 45 e8 mov -0x18(%ebp),%eax 800b7f: 29 d0 sub %edx,%eax 800b81: 89 45 e8 mov %eax,-0x18(%ebp) 800b84: eb 17 jmp 800b9d <vprintfmt+0x1d0> putch(padc, putdat); 800b86: 0f be 45 db movsbl -0x25(%ebp),%eax 800b8a: 83 ec 08 sub $0x8,%esp 800b8d: ff 75 0c pushl 0xc(%ebp) 800b90: 50 push %eax 800b91: 8b 45 08 mov 0x8(%ebp),%eax 800b94: ff d0 call *%eax 800b96: 83 c4 10 add $0x10,%esp case 's': if ((p = va_arg(ap, char *)) == NULL) { p = "(null)"; } if (width > 0 && padc != '-') { for (width -= strnlen(p, precision); width > 0; width --) { 800b99: 83 6d e8 01 subl $0x1,-0x18(%ebp) 800b9d: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 800ba1: 7f e3 jg 800b86 <vprintfmt+0x1b9> putch(padc, putdat); } } for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) { 800ba3: eb 35 jmp 800bda <vprintfmt+0x20d> if (altflag && (ch < ' ' || ch > '~')) { 800ba5: 83 7d dc 00 cmpl $0x0,-0x24(%ebp) 800ba9: 74 1c je 800bc7 <vprintfmt+0x1fa> 800bab: 83 fb 1f cmp $0x1f,%ebx 800bae: 7e 05 jle 800bb5 <vprintfmt+0x1e8> 800bb0: 83 fb 7e cmp $0x7e,%ebx 800bb3: 7e 12 jle 800bc7 <vprintfmt+0x1fa> putch('?', putdat); 800bb5: 83 ec 08 sub $0x8,%esp 800bb8: ff 75 0c pushl 0xc(%ebp) 800bbb: 6a 3f push $0x3f 800bbd: 8b 45 08 mov 0x8(%ebp),%eax 800bc0: ff d0 call *%eax 800bc2: 83 c4 10 add $0x10,%esp 800bc5: eb 0f jmp 800bd6 <vprintfmt+0x209> } else { putch(ch, putdat); 800bc7: 83 ec 08 sub $0x8,%esp 800bca: ff 75 0c pushl 0xc(%ebp) 800bcd: 53 push %ebx 800bce: 8b 45 08 mov 0x8(%ebp),%eax 800bd1: ff d0 call *%eax 800bd3: 83 c4 10 add $0x10,%esp if (width > 0 && padc != '-') { for (width -= strnlen(p, precision); width > 0; width --) { putch(padc, putdat); } } for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) { 800bd6: 83 6d e8 01 subl $0x1,-0x18(%ebp) 800bda: 89 f0 mov %esi,%eax 800bdc: 8d 70 01 lea 0x1(%eax),%esi 800bdf: 0f b6 00 movzbl (%eax),%eax 800be2: 0f be d8 movsbl %al,%ebx 800be5: 85 db test %ebx,%ebx 800be7: 74 26 je 800c0f <vprintfmt+0x242> 800be9: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 800bed: 78 b6 js 800ba5 <vprintfmt+0x1d8> 800bef: 83 6d e4 01 subl $0x1,-0x1c(%ebp) 800bf3: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 800bf7: 79 ac jns 800ba5 <vprintfmt+0x1d8> } else { putch(ch, putdat); } } for (; width > 0; width --) { 800bf9: eb 14 jmp 800c0f <vprintfmt+0x242> putch(' ', putdat); 800bfb: 83 ec 08 sub $0x8,%esp 800bfe: ff 75 0c pushl 0xc(%ebp) 800c01: 6a 20 push $0x20 800c03: 8b 45 08 mov 0x8(%ebp),%eax 800c06: ff d0 call *%eax 800c08: 83 c4 10 add $0x10,%esp } else { putch(ch, putdat); } } for (; width > 0; width --) { 800c0b: 83 6d e8 01 subl $0x1,-0x18(%ebp) 800c0f: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 800c13: 7f e6 jg 800bfb <vprintfmt+0x22e> putch(' ', putdat); } break; 800c15: e9 4e 01 00 00 jmp 800d68 <vprintfmt+0x39b> // (signed) decimal case 'd': num = getint(&ap, lflag); 800c1a: 83 ec 08 sub $0x8,%esp 800c1d: ff 75 e0 pushl -0x20(%ebp) 800c20: 8d 45 14 lea 0x14(%ebp),%eax 800c23: 50 push %eax 800c24: e8 39 fd ff ff call 800962 <getint> 800c29: 83 c4 10 add $0x10,%esp 800c2c: 89 45 f0 mov %eax,-0x10(%ebp) 800c2f: 89 55 f4 mov %edx,-0xc(%ebp) if ((long long)num < 0) { 800c32: 8b 45 f0 mov -0x10(%ebp),%eax 800c35: 8b 55 f4 mov -0xc(%ebp),%edx 800c38: 85 d2 test %edx,%edx 800c3a: 79 23 jns 800c5f <vprintfmt+0x292> putch('-', putdat); 800c3c: 83 ec 08 sub $0x8,%esp 800c3f: ff 75 0c pushl 0xc(%ebp) 800c42: 6a 2d push $0x2d 800c44: 8b 45 08 mov 0x8(%ebp),%eax 800c47: ff d0 call *%eax 800c49: 83 c4 10 add $0x10,%esp num = -(long long)num; 800c4c: 8b 45 f0 mov -0x10(%ebp),%eax 800c4f: 8b 55 f4 mov -0xc(%ebp),%edx 800c52: f7 d8 neg %eax 800c54: 83 d2 00 adc $0x0,%edx 800c57: f7 da neg %edx 800c59: 89 45 f0 mov %eax,-0x10(%ebp) 800c5c: 89 55 f4 mov %edx,-0xc(%ebp) } base = 10; 800c5f: c7 45 ec 0a 00 00 00 movl $0xa,-0x14(%ebp) goto number; 800c66: e9 9f 00 00 00 jmp 800d0a <vprintfmt+0x33d> // unsigned decimal case 'u': num = getuint(&ap, lflag); 800c6b: 83 ec 08 sub $0x8,%esp 800c6e: ff 75 e0 pushl -0x20(%ebp) 800c71: 8d 45 14 lea 0x14(%ebp),%eax 800c74: 50 push %eax 800c75: e8 99 fc ff ff call 800913 <getuint> 800c7a: 83 c4 10 add $0x10,%esp 800c7d: 89 45 f0 mov %eax,-0x10(%ebp) 800c80: 89 55 f4 mov %edx,-0xc(%ebp) base = 10; 800c83: c7 45 ec 0a 00 00 00 movl $0xa,-0x14(%ebp) goto number; 800c8a: eb 7e jmp 800d0a <vprintfmt+0x33d> // (unsigned) octal case 'o': num = getuint(&ap, lflag); 800c8c: 83 ec 08 sub $0x8,%esp 800c8f: ff 75 e0 pushl -0x20(%ebp) 800c92: 8d 45 14 lea 0x14(%ebp),%eax 800c95: 50 push %eax 800c96: e8 78 fc ff ff call 800913 <getuint> 800c9b: 83 c4 10 add $0x10,%esp 800c9e: 89 45 f0 mov %eax,-0x10(%ebp) 800ca1: 89 55 f4 mov %edx,-0xc(%ebp) base = 8; 800ca4: c7 45 ec 08 00 00 00 movl $0x8,-0x14(%ebp) goto number; 800cab: eb 5d jmp 800d0a <vprintfmt+0x33d> // pointer case 'p': putch('0', putdat); 800cad: 83 ec 08 sub $0x8,%esp 800cb0: ff 75 0c pushl 0xc(%ebp) 800cb3: 6a 30 push $0x30 800cb5: 8b 45 08 mov 0x8(%ebp),%eax 800cb8: ff d0 call *%eax 800cba: 83 c4 10 add $0x10,%esp putch('x', putdat); 800cbd: 83 ec 08 sub $0x8,%esp 800cc0: ff 75 0c pushl 0xc(%ebp) 800cc3: 6a 78 push $0x78 800cc5: 8b 45 08 mov 0x8(%ebp),%eax 800cc8: ff d0 call *%eax 800cca: 83 c4 10 add $0x10,%esp num = (unsigned long long)(uintptr_t)va_arg(ap, void *); 800ccd: 8b 45 14 mov 0x14(%ebp),%eax 800cd0: 8d 50 04 lea 0x4(%eax),%edx 800cd3: 89 55 14 mov %edx,0x14(%ebp) 800cd6: 8b 00 mov (%eax),%eax 800cd8: 89 45 f0 mov %eax,-0x10(%ebp) 800cdb: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) base = 16; 800ce2: c7 45 ec 10 00 00 00 movl $0x10,-0x14(%ebp) goto number; 800ce9: eb 1f jmp 800d0a <vprintfmt+0x33d> // (unsigned) hexadecimal case 'x': num = getuint(&ap, lflag); 800ceb: 83 ec 08 sub $0x8,%esp 800cee: ff 75 e0 pushl -0x20(%ebp) 800cf1: 8d 45 14 lea 0x14(%ebp),%eax 800cf4: 50 push %eax 800cf5: e8 19 fc ff ff call 800913 <getuint> 800cfa: 83 c4 10 add $0x10,%esp 800cfd: 89 45 f0 mov %eax,-0x10(%ebp) 800d00: 89 55 f4 mov %edx,-0xc(%ebp) base = 16; 800d03: c7 45 ec 10 00 00 00 movl $0x10,-0x14(%ebp) number: printnum(putch, putdat, num, base, width, padc); 800d0a: 0f be 55 db movsbl -0x25(%ebp),%edx 800d0e: 8b 45 ec mov -0x14(%ebp),%eax 800d11: 83 ec 04 sub $0x4,%esp 800d14: 52 push %edx 800d15: ff 75 e8 pushl -0x18(%ebp) 800d18: 50 push %eax 800d19: ff 75 f4 pushl -0xc(%ebp) 800d1c: ff 75 f0 pushl -0x10(%ebp) 800d1f: ff 75 0c pushl 0xc(%ebp) 800d22: ff 75 08 pushl 0x8(%ebp) 800d25: e8 f8 fa ff ff call 800822 <printnum> 800d2a: 83 c4 20 add $0x20,%esp break; 800d2d: eb 39 jmp 800d68 <vprintfmt+0x39b> // escaped '%' character case '%': putch(ch, putdat); 800d2f: 83 ec 08 sub $0x8,%esp 800d32: ff 75 0c pushl 0xc(%ebp) 800d35: 53 push %ebx 800d36: 8b 45 08 mov 0x8(%ebp),%eax 800d39: ff d0 call *%eax 800d3b: 83 c4 10 add $0x10,%esp break; 800d3e: eb 28 jmp 800d68 <vprintfmt+0x39b> // unrecognized escape sequence - just print it literally default: putch('%', putdat); 800d40: 83 ec 08 sub $0x8,%esp 800d43: ff 75 0c pushl 0xc(%ebp) 800d46: 6a 25 push $0x25 800d48: 8b 45 08 mov 0x8(%ebp),%eax 800d4b: ff d0 call *%eax 800d4d: 83 c4 10 add $0x10,%esp for (fmt --; fmt[-1] != '%'; fmt --) 800d50: 83 6d 10 01 subl $0x1,0x10(%ebp) 800d54: eb 04 jmp 800d5a <vprintfmt+0x38d> 800d56: 83 6d 10 01 subl $0x1,0x10(%ebp) 800d5a: 8b 45 10 mov 0x10(%ebp),%eax 800d5d: 83 e8 01 sub $0x1,%eax 800d60: 0f b6 00 movzbl (%eax),%eax 800d63: 3c 25 cmp $0x25,%al 800d65: 75 ef jne 800d56 <vprintfmt+0x389> /* do nothing */; break; 800d67: 90 nop } } 800d68: e9 68 fc ff ff jmp 8009d5 <vprintfmt+0x8> int base, width, precision, lflag, altflag; while (1) { while ((ch = *(unsigned char *)fmt ++) != '%') { if (ch == '\0') { return; 800d6d: 90 nop for (fmt --; fmt[-1] != '%'; fmt --) /* do nothing */; break; } } } 800d6e: 8d 65 f8 lea -0x8(%ebp),%esp 800d71: 5b pop %ebx 800d72: 5e pop %esi 800d73: 5d pop %ebp 800d74: c3 ret 00800d75 <sprintputch>: * sprintputch - 'print' a single character in a buffer * @ch: the character will be printed * @b: the buffer to place the character @ch * */ static void sprintputch(int ch, struct sprintbuf *b) { 800d75: 55 push %ebp 800d76: 89 e5 mov %esp,%ebp b->cnt ++; 800d78: 8b 45 0c mov 0xc(%ebp),%eax 800d7b: 8b 40 08 mov 0x8(%eax),%eax 800d7e: 8d 50 01 lea 0x1(%eax),%edx 800d81: 8b 45 0c mov 0xc(%ebp),%eax 800d84: 89 50 08 mov %edx,0x8(%eax) if (b->buf < b->ebuf) { 800d87: 8b 45 0c mov 0xc(%ebp),%eax 800d8a: 8b 10 mov (%eax),%edx 800d8c: 8b 45 0c mov 0xc(%ebp),%eax 800d8f: 8b 40 04 mov 0x4(%eax),%eax 800d92: 39 c2 cmp %eax,%edx 800d94: 73 12 jae 800da8 <sprintputch+0x33> *b->buf ++ = ch; 800d96: 8b 45 0c mov 0xc(%ebp),%eax 800d99: 8b 00 mov (%eax),%eax 800d9b: 8d 48 01 lea 0x1(%eax),%ecx 800d9e: 8b 55 0c mov 0xc(%ebp),%edx 800da1: 89 0a mov %ecx,(%edx) 800da3: 8b 55 08 mov 0x8(%ebp),%edx 800da6: 88 10 mov %dl,(%eax) } } 800da8: 90 nop 800da9: 5d pop %ebp 800daa: c3 ret 00800dab <snprintf>: * @str: the buffer to place the result into * @size: the size of buffer, including the trailing null space * @fmt: the format string to use * */ int snprintf(char *str, size_t size, const char *fmt, ...) { 800dab: 55 push %ebp 800dac: 89 e5 mov %esp,%ebp 800dae: 83 ec 18 sub $0x18,%esp va_list ap; int cnt; va_start(ap, fmt); 800db1: 8d 45 14 lea 0x14(%ebp),%eax 800db4: 89 45 f0 mov %eax,-0x10(%ebp) cnt = vsnprintf(str, size, fmt, ap); 800db7: 8b 45 f0 mov -0x10(%ebp),%eax 800dba: 50 push %eax 800dbb: ff 75 10 pushl 0x10(%ebp) 800dbe: ff 75 0c pushl 0xc(%ebp) 800dc1: ff 75 08 pushl 0x8(%ebp) 800dc4: e8 0b 00 00 00 call 800dd4 <vsnprintf> 800dc9: 83 c4 10 add $0x10,%esp 800dcc: 89 45 f4 mov %eax,-0xc(%ebp) va_end(ap); return cnt; 800dcf: 8b 45 f4 mov -0xc(%ebp),%eax } 800dd2: c9 leave 800dd3: c3 ret 00800dd4 <vsnprintf>: * * Call this function if you are already dealing with a va_list. * Or you probably want snprintf() instead. * */ int vsnprintf(char *str, size_t size, const char *fmt, va_list ap) { 800dd4: 55 push %ebp 800dd5: 89 e5 mov %esp,%ebp 800dd7: 83 ec 18 sub $0x18,%esp struct sprintbuf b = {str, str + size - 1, 0}; 800dda: 8b 45 08 mov 0x8(%ebp),%eax 800ddd: 89 45 ec mov %eax,-0x14(%ebp) 800de0: 8b 45 0c mov 0xc(%ebp),%eax 800de3: 8d 50 ff lea -0x1(%eax),%edx 800de6: 8b 45 08 mov 0x8(%ebp),%eax 800de9: 01 d0 add %edx,%eax 800deb: 89 45 f0 mov %eax,-0x10(%ebp) 800dee: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) if (str == NULL || b.buf > b.ebuf) { 800df5: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 800df9: 74 0a je 800e05 <vsnprintf+0x31> 800dfb: 8b 55 ec mov -0x14(%ebp),%edx 800dfe: 8b 45 f0 mov -0x10(%ebp),%eax 800e01: 39 c2 cmp %eax,%edx 800e03: 76 07 jbe 800e0c <vsnprintf+0x38> return -E_INVAL; 800e05: b8 fd ff ff ff mov $0xfffffffd,%eax 800e0a: eb 20 jmp 800e2c <vsnprintf+0x58> } // print the string to the buffer vprintfmt((void*)sprintputch, &b, fmt, ap); 800e0c: ff 75 14 pushl 0x14(%ebp) 800e0f: ff 75 10 pushl 0x10(%ebp) 800e12: 8d 45 ec lea -0x14(%ebp),%eax 800e15: 50 push %eax 800e16: 68 75 0d 80 00 push $0x800d75 800e1b: e8 ad fb ff ff call 8009cd <vprintfmt> 800e20: 83 c4 10 add $0x10,%esp // null terminate the buffer *b.buf = '\0'; 800e23: 8b 45 ec mov -0x14(%ebp),%eax 800e26: c6 00 00 movb $0x0,(%eax) return b.cnt; 800e29: 8b 45 f4 mov -0xc(%ebp),%eax } 800e2c: c9 leave 800e2d: c3 ret 00800e2e <hash32>: * @bits: the number of bits in a return value * * High bits are more random, so we use them. * */ uint32_t hash32(uint32_t val, unsigned int bits) { 800e2e: 55 push %ebp 800e2f: 89 e5 mov %esp,%ebp 800e31: 83 ec 10 sub $0x10,%esp uint32_t hash = val * GOLDEN_RATIO_PRIME_32; 800e34: 8b 45 08 mov 0x8(%ebp),%eax 800e37: 69 c0 01 00 37 9e imul $0x9e370001,%eax,%eax 800e3d: 89 45 fc mov %eax,-0x4(%ebp) return (hash >> (32 - bits)); 800e40: b8 20 00 00 00 mov $0x20,%eax 800e45: 2b 45 0c sub 0xc(%ebp),%eax 800e48: 8b 55 fc mov -0x4(%ebp),%edx 800e4b: 89 c1 mov %eax,%ecx 800e4d: d3 ea shr %cl,%edx 800e4f: 89 d0 mov %edx,%eax } 800e51: c9 leave 800e52: c3 ret 00800e53 <rand>: * rand - returns a pseudo-random integer * * The rand() function return a value in the range [0, RAND_MAX]. * */ int rand(void) { 800e53: 55 push %ebp 800e54: 89 e5 mov %esp,%ebp 800e56: 57 push %edi 800e57: 56 push %esi 800e58: 53 push %ebx 800e59: 83 ec 24 sub $0x24,%esp next = (next * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1); 800e5c: a1 00 20 80 00 mov 0x802000,%eax 800e61: 8b 15 04 20 80 00 mov 0x802004,%edx 800e67: 69 fa 6d e6 ec de imul $0xdeece66d,%edx,%edi 800e6d: 6b f0 05 imul $0x5,%eax,%esi 800e70: 01 fe add %edi,%esi 800e72: bf 6d e6 ec de mov $0xdeece66d,%edi 800e77: f7 e7 mul %edi 800e79: 01 d6 add %edx,%esi 800e7b: 89 f2 mov %esi,%edx 800e7d: 83 c0 0b add $0xb,%eax 800e80: 83 d2 00 adc $0x0,%edx 800e83: 89 c7 mov %eax,%edi 800e85: 83 e7 ff and $0xffffffff,%edi 800e88: 89 f9 mov %edi,%ecx 800e8a: 0f b7 da movzwl %dx,%ebx 800e8d: 89 0d 00 20 80 00 mov %ecx,0x802000 800e93: 89 1d 04 20 80 00 mov %ebx,0x802004 unsigned long long result = (next >> 12); 800e99: a1 00 20 80 00 mov 0x802000,%eax 800e9e: 8b 15 04 20 80 00 mov 0x802004,%edx 800ea4: 0f ac d0 0c shrd $0xc,%edx,%eax 800ea8: c1 ea 0c shr $0xc,%edx 800eab: 89 45 e0 mov %eax,-0x20(%ebp) 800eae: 89 55 e4 mov %edx,-0x1c(%ebp) return (int)do_div(result, RAND_MAX + 1); 800eb1: c7 45 dc 00 00 00 80 movl $0x80000000,-0x24(%ebp) 800eb8: 8b 45 e0 mov -0x20(%ebp),%eax 800ebb: 8b 55 e4 mov -0x1c(%ebp),%edx 800ebe: 89 45 d8 mov %eax,-0x28(%ebp) 800ec1: 89 55 e8 mov %edx,-0x18(%ebp) 800ec4: 8b 45 e8 mov -0x18(%ebp),%eax 800ec7: 89 45 ec mov %eax,-0x14(%ebp) 800eca: 83 7d e8 00 cmpl $0x0,-0x18(%ebp) 800ece: 74 1c je 800eec <rand+0x99> 800ed0: 8b 45 e8 mov -0x18(%ebp),%eax 800ed3: ba 00 00 00 00 mov $0x0,%edx 800ed8: f7 75 dc divl -0x24(%ebp) 800edb: 89 55 ec mov %edx,-0x14(%ebp) 800ede: 8b 45 e8 mov -0x18(%ebp),%eax 800ee1: ba 00 00 00 00 mov $0x0,%edx 800ee6: f7 75 dc divl -0x24(%ebp) 800ee9: 89 45 e8 mov %eax,-0x18(%ebp) 800eec: 8b 45 d8 mov -0x28(%ebp),%eax 800eef: 8b 55 ec mov -0x14(%ebp),%edx 800ef2: f7 75 dc divl -0x24(%ebp) 800ef5: 89 45 d8 mov %eax,-0x28(%ebp) 800ef8: 89 55 d4 mov %edx,-0x2c(%ebp) 800efb: 8b 45 d8 mov -0x28(%ebp),%eax 800efe: 8b 55 e8 mov -0x18(%ebp),%edx 800f01: 89 45 e0 mov %eax,-0x20(%ebp) 800f04: 89 55 e4 mov %edx,-0x1c(%ebp) 800f07: 8b 45 d4 mov -0x2c(%ebp),%eax } 800f0a: 83 c4 24 add $0x24,%esp 800f0d: 5b pop %ebx 800f0e: 5e pop %esi 800f0f: 5f pop %edi 800f10: 5d pop %ebp 800f11: c3 ret 00800f12 <srand>: /* * * srand - seed the random number generator with the given number * @seed: the required seed number * */ void srand(unsigned int seed) { 800f12: 55 push %ebp 800f13: 89 e5 mov %esp,%ebp next = seed; 800f15: 8b 45 08 mov 0x8(%ebp),%eax 800f18: ba 00 00 00 00 mov $0x0,%edx 800f1d: a3 00 20 80 00 mov %eax,0x802000 800f22: 89 15 04 20 80 00 mov %edx,0x802004 } 800f28: 90 nop 800f29: 5d pop %ebp 800f2a: c3 ret 00800f2b <main>: #include <stdio.h> #include <ulib.h> int main(void) { 800f2b: 8d 4c 24 04 lea 0x4(%esp),%ecx 800f2f: 83 e4 f0 and $0xfffffff0,%esp 800f32: ff 71 fc pushl -0x4(%ecx) 800f35: 55 push %ebp 800f36: 89 e5 mov %esp,%ebp 800f38: 51 push %ecx 800f39: 83 ec 04 sub $0x4,%esp cprintf("I read %08x from 0xfac00000!\n", *(unsigned *)0xfac00000); 800f3c: b8 00 00 c0 fa mov $0xfac00000,%eax 800f41: 8b 00 mov (%eax),%eax 800f43: 83 ec 08 sub $0x8,%esp 800f46: 50 push %eax 800f47: 68 60 12 80 00 push $0x801260 800f4c: e8 88 f3 ff ff call 8002d9 <cprintf> 800f51: 83 c4 10 add $0x10,%esp panic("FAIL: T.T\n"); 800f54: 83 ec 04 sub $0x4,%esp 800f57: 68 7e 12 80 00 push $0x80127e 800f5c: 6a 07 push $0x7 800f5e: 68 89 12 80 00 push $0x801289 800f63: e8 b8 f0 ff ff call 800020 <__panic>
; A033964: Trajectory of 1 under map n->13n+1 if n odd, n->n/2 if n even ; Submitted by Simon Strandgaard ; 1,14,7,92,46,23,300,150,75,976,488,244,122,61,794,397,5162,2581,33554,16777,218102,109051,1417664,708832,354416,177208,88604,44302,22151,287964,143982,71991,935884,467942 add $0,1 mov $1,$0 mov $0,1 lpb $1 mov $2,$0 mod $2,2 mov $3,2 sub $3,$2 mov $4,$0 mul $0,2 lpb $2 mul $0,13 add $0,2 sub $2,1 lpe lpb $3 div $0,2 sub $3,1 lpe sub $1,1 lpe mov $0,$4
; A158249: 256n^2 - 2n. ; 254,1020,2298,4088,6390,9204,12530,16368,20718,25580,30954,36840,43238,50148,57570,65504,73950,82908,92378,102360,112854,123860,135378,147408,159950,173004,186570,200648,215238,230340,245954,262080,278718,295868,313530,331704,350390,369588,389298,409520,430254,451500,473258,495528,518310,541604,565410,589728,614558,639900,665754,692120,718998,746388,774290,802704,831630,861068,891018,921480,952454,983940,1015938,1048448,1081470,1115004,1149050,1183608,1218678,1254260,1290354,1326960,1364078,1401708,1439850,1478504,1517670,1557348,1597538,1638240,1679454,1721180,1763418,1806168,1849430,1893204,1937490,1982288,2027598,2073420,2119754,2166600,2213958,2261828,2310210,2359104,2408510,2458428,2508858,2559800,2611254,2663220,2715698,2768688,2822190,2876204,2930730,2985768,3041318,3097380,3153954,3211040,3268638,3326748,3385370,3444504,3504150,3564308,3624978,3686160,3747854,3810060,3872778,3936008,3999750,4064004,4128770,4194048,4259838,4326140,4392954,4460280,4528118,4596468,4665330,4734704,4804590,4874988,4945898,5017320,5089254,5161700,5234658,5308128,5382110,5456604,5531610,5607128,5683158,5759700,5836754,5914320,5992398,6070988,6150090,6229704,6309830,6390468,6471618,6553280,6635454,6718140,6801338,6885048,6969270,7054004,7139250,7225008,7311278,7398060,7485354,7573160,7661478,7750308,7839650,7929504,8019870,8110748,8202138,8294040,8386454,8479380,8572818,8666768,8761230,8856204,8951690,9047688,9144198,9241220,9338754,9436800,9535358,9634428,9734010,9834104,9934710,10035828,10137458,10239600,10342254,10445420,10549098,10653288,10757990,10863204,10968930,11075168,11181918,11289180,11396954,11505240,11614038,11723348,11833170,11943504,12054350,12165708,12277578,12389960,12502854,12616260,12730178,12844608,12959550,13075004,13190970,13307448,13424438,13541940,13659954,13778480,13897518,14017068,14137130,14257704,14378790,14500388,14622498,14745120,14868254,14991900,15116058,15240728,15365910,15491604,15617810,15744528,15871758,15999500 mov $1,8 mov $2,$0 add $2,1 mul $2,2 mul $1,$2 pow $1,2 sub $1,$2
; A005752: a(n) = n^2 + n*floor(n*tau) - floor(n*tau)^2. ; 0,1,1,5,4,1,9,5,16,11,4,19,11,1,20,9,31,19,5,31,16,45,29,11,44,25,4,41,19,59,36,11,55,29,1,49,20,71,41,9,64,31,89,55,19,81,44,5,71,31,100,59,16,89,45,121,76,29,109 mov $1,$0 pow $0,2 mov $2,$0 lpb $2 sub $0,$1 sub $0,1 sub $2,1 sub $2,$1 add $1,2 lpe
; A238908: Number of (n+1) X (3+1) 0..2 arrays with no element equal to all horizontal neighbors or equal to all vertical neighbors, and new values 0..2 introduced in row major order. ; Submitted by Christian Krause ; 54,486,17496,408726,10789686,274834944,7073353350,181499433750,4661259221016,119679993219366,3073064486445414,78906460267708416,2026077840987433686,52023421931028414534,1335801507196609225944,34299270055897770119094,880699693329714473020566,22613657338534171484911104,580649117942144535598659366,14909282154596845106538092406,382824476203321944215168310936,9829754246217288936830471713350,252397833863223215436649415474886,6480799513668539272165160858517504,166406984139249694519119367745539446 seq $0,238906 ; Number of (n+1) X (1+1) 0..2 arrays with no element equal to all horizontal neighbors or equal to all vertical neighbors, and new values 0..2 introduced in row major order. pow $0,2 div $0,9 mul $0,54
#include "Platform.inc" radix decimal udata global lcdFlags global lcdContrast lcdFlags res 1 lcdContrast res 1 LcdContrastDummies code end
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /* * GCENV.EE.CPP * * GCToEEInterface implementation * * */ #include "gcrefmap.h" void GCToEEInterface::SuspendEE(SUSPEND_REASON reason) { WRAPPER_NO_CONTRACT; static_assert_no_msg(SUSPEND_FOR_GC == (int)ThreadSuspend::SUSPEND_FOR_GC); static_assert_no_msg(SUSPEND_FOR_GC_PREP == (int)ThreadSuspend::SUSPEND_FOR_GC_PREP); _ASSERTE(reason == SUSPEND_FOR_GC || reason == SUSPEND_FOR_GC_PREP); g_pDebugInterface->SuspendForGarbageCollectionStarted(); ThreadSuspend::SuspendEE((ThreadSuspend::SUSPEND_REASON)reason); g_pDebugInterface->SuspendForGarbageCollectionCompleted(); } void GCToEEInterface::RestartEE(bool bFinishedGC) { WRAPPER_NO_CONTRACT; g_pDebugInterface->ResumeForGarbageCollectionStarted(); ThreadSuspend::RestartEE(bFinishedGC, TRUE); } VOID GCToEEInterface::SyncBlockCacheWeakPtrScan(HANDLESCANPROC scanProc, uintptr_t lp1, uintptr_t lp2) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; SyncBlockCache::GetSyncBlockCache()->GCWeakPtrScan(scanProc, lp1, lp2); } //EE can perform post stack scanning action, while the // user threads are still suspended VOID GCToEEInterface::AfterGcScanRoots (int condemned, int max_gen, ScanContext* sc) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; #ifdef FEATURE_COMINTEROP // Go through all the only app domain and detach all the *unmarked* RCWs to prevent // the RCW cache from resurrecting them. ::GetAppDomain()->DetachRCWs(); #endif // FEATURE_COMINTEROP } /* * Scan all stack roots */ static void ScanStackRoots(Thread * pThread, promote_func* fn, ScanContext* sc) { GCCONTEXT gcctx; gcctx.f = fn; gcctx.sc = sc; gcctx.cf = NULL; ENABLE_FORBID_GC_LOADER_USE_IN_THIS_SCOPE(); // Either we are in a concurrent situation (in which case the thread is unknown to // us), or we are performing a synchronous GC and we are the GC thread, holding // the threadstore lock. _ASSERTE(dbgOnly_IsSpecialEEThread() || GetThread() == NULL || // this is for background GC threads which always call this when EE is suspended. IsGCSpecialThread() || (GetThread() == ThreadSuspend::GetSuspensionThread() && ThreadStore::HoldingThreadStore())); Frame* pTopFrame = pThread->GetFrame(); Object ** topStack = (Object **)pTopFrame; if ((pTopFrame != ((Frame*)-1)) && (pTopFrame->GetVTablePtr() == InlinedCallFrame::GetMethodFrameVPtr())) { // It is an InlinedCallFrame. Get SP from it. InlinedCallFrame* pInlinedFrame = (InlinedCallFrame*)pTopFrame; topStack = (Object **)pInlinedFrame->GetCallSiteSP(); } sc->stack_limit = (uintptr_t)topStack; #ifdef FEATURE_CONSERVATIVE_GC if (g_pConfig->GetGCConservative()) { // Conservative stack root reporting // We will treat everything on stack as a pinned interior GC pointer // Since we report every thing as pinned, we don't need to run following code for relocation phase. if (sc->promotion) { Object ** bottomStack = (Object **) pThread->GetCachedStackBase(); Object ** walk; for (walk = topStack; walk < bottomStack; walk ++) { if (((void*)*walk > (void*)bottomStack || (void*)*walk < (void*)topStack) && ((void*)*walk >= (void*)g_lowest_address && (void*)*walk <= (void*)g_highest_address) ) { //DbgPrintf("promote " FMT_ADDR " : " FMT_ADDR "\n", walk, *walk); fn(walk, sc, GC_CALL_INTERIOR|GC_CALL_PINNED); } } } // Also ask the explicit Frames to report any references they might know about. // Generally these will be a subset of the objects reported below but there's // nothing that guarantees that and in the specific case of a GC protect frame the // references it protects may live at a lower address than the frame itself (and // thus escape the stack range we scanned above). Frame *pFrame = pThread->GetFrame(); while (pFrame != FRAME_TOP) { pFrame->GcScanRoots(fn, sc); pFrame = pFrame->PtrNextFrame(); } } else #endif { unsigned flagsStackWalk = ALLOW_ASYNC_STACK_WALK | ALLOW_INVALID_OBJECTS; #if defined(FEATURE_EH_FUNCLETS) flagsStackWalk |= GC_FUNCLET_REFERENCE_REPORTING; #endif // defined(FEATURE_EH_FUNCLETS) pThread->StackWalkFrames( GcStackCrawlCallBack, &gcctx, flagsStackWalk); } GCFrame* pGCFrame = pThread->GetGCFrame(); while (pGCFrame != NULL) { pGCFrame->GcScanRoots(fn, sc); pGCFrame = pGCFrame->PtrNextFrame(); } } static void ScanTailCallArgBufferRoots(Thread* pThread, promote_func* fn, ScanContext* sc) { TailCallArgBuffer* argBuffer = pThread->GetTailCallTls()->GetArgBuffer(); if (argBuffer == NULL || argBuffer->GCDesc == NULL) return; if (argBuffer->State == TAILCALLARGBUFFER_ABANDONED) return; bool instArgOnly = argBuffer->State == TAILCALLARGBUFFER_INSTARG_ONLY; GCRefMapDecoder decoder(static_cast<PTR_BYTE>(argBuffer->GCDesc)); while (!decoder.AtEnd()) { int pos = decoder.CurrentPos(); int token = decoder.ReadToken(); PTR_TADDR ppObj = dac_cast<PTR_TADDR>(((BYTE*)argBuffer->Args) + pos * sizeof(TADDR)); switch (token) { case GCREFMAP_SKIP: break; case GCREFMAP_REF: if (!instArgOnly) fn(dac_cast<PTR_PTR_Object>(ppObj), sc, CHECK_APP_DOMAIN); break; case GCREFMAP_INTERIOR: if (!instArgOnly) PromoteCarefully(fn, dac_cast<PTR_PTR_Object>(ppObj), sc, GC_CALL_INTERIOR); break; case GCREFMAP_METHOD_PARAM: if (sc->promotion) { #ifndef DACCESS_COMPILE MethodDesc *pMDReal = dac_cast<PTR_MethodDesc>(*ppObj); if (pMDReal != NULL) GcReportLoaderAllocator(fn, sc, pMDReal->GetLoaderAllocator()); #endif } break; case GCREFMAP_TYPE_PARAM: if (sc->promotion) { #ifndef DACCESS_COMPILE MethodTable *pMTReal = dac_cast<PTR_MethodTable>(*ppObj); if (pMTReal != NULL) GcReportLoaderAllocator(fn, sc, pMTReal->GetLoaderAllocator()); #endif } break; default: _ASSERTE(!"Unhandled GCREFMAP token in arg buffer GC desc"); break; } } } void GCToEEInterface::GcScanRoots(promote_func* fn, int condemned, int max_gen, ScanContext* sc) { STRESS_LOG1(LF_GCROOTS, LL_INFO10, "GCScan: Promotion Phase = %d\n", sc->promotion); Thread* pThread = NULL; while ((pThread = ThreadStore::GetThreadList(pThread)) != NULL) { STRESS_LOG2(LF_GC | LF_GCROOTS, LL_INFO100, "{ Starting scan of Thread %p ID = %x\n", pThread, pThread->GetThreadId()); if (GCHeapUtilities::GetGCHeap()->IsThreadUsingAllocationContextHeap( pThread->GetAllocContext(), sc->thread_number)) { sc->thread_under_crawl = pThread; #ifdef FEATURE_EVENT_TRACE sc->dwEtwRootKind = kEtwGCRootKindStack; #endif // FEATURE_EVENT_TRACE ScanStackRoots(pThread, fn, sc); ScanTailCallArgBufferRoots(pThread, fn, sc); #ifdef FEATURE_EVENT_TRACE sc->dwEtwRootKind = kEtwGCRootKindOther; #endif // FEATURE_EVENT_TRACE } STRESS_LOG2(LF_GC | LF_GCROOTS, LL_INFO100, "Ending scan of Thread %p ID = 0x%x }\n", pThread, pThread->GetThreadId()); } // In server GC, we should be competing for marking the statics // It's better to do this *after* stack scanning, because this way // we can make up for imbalances in stack scanning // This would not apply to the initial mark phase in background GC, // but it would apply to blocking Gen 2 collections and the final // marking stage in background GC where we catch up to the user program if (GCHeapUtilities::MarkShouldCompeteForStatics()) { if (condemned == max_gen && sc->promotion) { SystemDomain::EnumAllStaticGCRefs(fn, sc); } } } void GCToEEInterface::GcStartWork (int condemned, int max_gen) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; #ifdef VERIFY_HEAP // Validate byrefs pinned by IL stubs since the last GC. StubHelpers::ProcessByrefValidationList(); #endif // VERIFY_HEAP ExecutionManager::CleanupCodeHeaps(); #ifdef FEATURE_EVENT_TRACE ETW::TypeSystemLog::Cleanup(); #endif #ifdef FEATURE_COMINTEROP Interop::OnGCStarted(condemned); #endif // FEATURE_COMINTEROP if (condemned == max_gen) { ThreadStore::s_pThreadStore->OnMaxGenerationGCStarted(); } } void GCToEEInterface::GcDone(int condemned) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; #ifdef FEATURE_COMINTEROP Interop::OnGCFinished(condemned); #endif // FEATURE_COMINTEROP } bool GCToEEInterface::RefCountedHandleCallbacks(Object * pObject) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; #ifdef FEATURE_COMINTEROP //<REVISIT_TODO>@todo optimize the access to the ref-count ComCallWrapper* pWrap = ComCallWrapper::GetWrapperForObject((OBJECTREF)pObject); if (pWrap != NULL && pWrap->IsWrapperActive()) return true; #endif #ifdef FEATURE_COMWRAPPERS bool isRooted = false; if (ComWrappersNative::HasManagedObjectComWrapper((OBJECTREF)pObject, &isRooted)) return isRooted; #endif return false; } void GCToEEInterface::GcBeforeBGCSweepWork() { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; #ifdef VERIFY_HEAP // Validate byrefs pinned by IL stubs since the last GC. StubHelpers::ProcessByrefValidationList(); #endif // VERIFY_HEAP } void GCToEEInterface::SyncBlockCacheDemote(int max_gen) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; SyncBlockCache::GetSyncBlockCache()->GCDone(TRUE, max_gen); } void GCToEEInterface::SyncBlockCachePromotionsGranted(int max_gen) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; SyncBlockCache::GetSyncBlockCache()->GCDone(FALSE, max_gen); } uint32_t GCToEEInterface::GetActiveSyncBlockCount() { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; return SyncBlockCache::GetSyncBlockCache()->GetActiveCount(); } gc_alloc_context * GCToEEInterface::GetAllocContext() { WRAPPER_NO_CONTRACT; Thread* pThread = ::GetThread(); if (!pThread) { return nullptr; } return pThread->GetAllocContext(); } void GCToEEInterface::GcEnumAllocContexts(enum_alloc_context_func* fn, void* param) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; if (GCHeapUtilities::UseThreadAllocationContexts()) { Thread * pThread = NULL; while ((pThread = ThreadStore::GetThreadList(pThread)) != NULL) { fn(pThread->GetAllocContext(), param); } } else { fn(&g_global_alloc_context, param); } } uint8_t* GCToEEInterface::GetLoaderAllocatorObjectForGC(Object* pObject) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; return pObject->GetGCSafeMethodTable()->GetLoaderAllocatorObjectForGC(); } bool GCToEEInterface::IsPreemptiveGCDisabled() { WRAPPER_NO_CONTRACT; Thread* pThread = ::GetThread(); return (pThread && pThread->PreemptiveGCDisabled()); } bool GCToEEInterface::EnablePreemptiveGC() { WRAPPER_NO_CONTRACT; Thread* pThread = ::GetThread(); if (pThread && pThread->PreemptiveGCDisabled()) { pThread->EnablePreemptiveGC(); return true; } return false; } void GCToEEInterface::DisablePreemptiveGC() { WRAPPER_NO_CONTRACT; Thread* pThread = ::GetThread(); if (pThread) { pThread->DisablePreemptiveGC(); } } Thread* GCToEEInterface::GetThread() { WRAPPER_NO_CONTRACT; return ::GetThread(); } // // Diagnostics code // #if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE) // Tracks all surviving objects (moved or otherwise). inline bool ShouldTrackSurvivorsForProfilerOrEtw() { #ifdef GC_PROFILING if (CORProfilerTrackGC()) return true; #endif #ifdef FEATURE_EVENT_TRACE if (ETW::GCLog::ShouldTrackMovementForEtw()) return true; #endif return false; } // Only tracks surviving objects in compacting GCs (moved or otherwise). inline bool ShouldTrackSurvivorsInCompactingGCsForProfiler() { #ifdef GC_PROFILING if (CORProfilerTrackGCMovedObjects()) return true; #endif return false; } #endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE) void ProfScanRootsHelper(Object** ppObject, ScanContext *pSC, uint32_t dwFlags) { #if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE) Object *pObj = *ppObject; if (dwFlags & GC_CALL_INTERIOR) { pObj = GCHeapUtilities::GetGCHeap()->GetContainingObject(pObj, true); if (pObj == nullptr) return; } ScanRootsHelper(pObj, ppObject, pSC, dwFlags); #endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE) } // TODO - at some point we would like to completely decouple profiling // from ETW tracing using a pattern similar to this, where the // ProfilingScanContext has flags about whether or not certain things // should be tracked, and each one of these ProfilerShouldXYZ functions // will check these flags and determine what to do based upon that. // GCProfileWalkHeapWorker can, in turn, call those methods without fear // of things being ifdef'd out. // Returns TRUE if GC profiling is enabled and the profiler // should scan dependent handles, FALSE otherwise. BOOL ProfilerShouldTrackConditionalWeakTableElements() { #if defined(GC_PROFILING) return CORProfilerTrackConditionalWeakTableElements(); #else return FALSE; #endif // defined (GC_PROFILING) } // If GC profiling is enabled, informs the profiler that we are done // tracing dependent handles. void ProfilerEndConditionalWeakTableElementReferences(void* heapId) { #if defined (GC_PROFILING) g_profControlBlock.pProfInterface->EndConditionalWeakTableElementReferences(heapId); #else UNREFERENCED_PARAMETER(heapId); #endif // defined (GC_PROFILING) } // If GC profiling is enabled, informs the profiler that we are done // tracing root references. void ProfilerEndRootReferences2(void* heapId) { #if defined (GC_PROFILING) g_profControlBlock.pProfInterface->EndRootReferences2(heapId); #else UNREFERENCED_PARAMETER(heapId); #endif // defined (GC_PROFILING) } void GcScanRootsForProfilerAndETW(promote_func* fn, int condemned, int max_gen, ScanContext* sc) { Thread* pThread = NULL; while ((pThread = ThreadStore::GetThreadList(pThread)) != NULL) { sc->thread_under_crawl = pThread; #ifdef FEATURE_EVENT_TRACE sc->dwEtwRootKind = kEtwGCRootKindStack; #endif // FEATURE_EVENT_TRACE ScanStackRoots(pThread, fn, sc); ScanTailCallArgBufferRoots(pThread, fn, sc); #ifdef FEATURE_EVENT_TRACE sc->dwEtwRootKind = kEtwGCRootKindOther; #endif // FEATURE_EVENT_TRACE } } void ScanHandleForProfilerAndETW(Object** pRef, Object* pSec, uint32_t flags, ScanContext* context, bool isDependent) { ProfilingScanContext* pSC = (ProfilingScanContext*)context; #ifdef GC_PROFILING // Give the profiler the objectref. if (pSC->fProfilerPinned) { if (!isDependent) { BEGIN_PIN_PROFILER(CORProfilerTrackGC()); g_profControlBlock.pProfInterface->RootReference2( (uint8_t *)*pRef, kEtwGCRootKindHandle, (EtwGCRootFlags)flags, pRef, &pSC->pHeapId); END_PIN_PROFILER(); } else { BEGIN_PIN_PROFILER(CORProfilerTrackConditionalWeakTableElements()); g_profControlBlock.pProfInterface->ConditionalWeakTableElementReference( (uint8_t*)*pRef, (uint8_t*)pSec, pRef, &pSC->pHeapId); END_PIN_PROFILER(); } } #endif // GC_PROFILING #if defined(FEATURE_EVENT_TRACE) // Notify ETW of the handle if (ETW::GCLog::ShouldWalkHeapRootsForEtw()) { ETW::GCLog::RootReference( pRef, *pRef, // object being rooted pSec, // pSecondaryNodeForDependentHandle isDependent, pSC, 0, // dwGCFlags, flags); // ETW handle flags } #endif // defined(FEATURE_EVENT_TRACE) } // This is called only if we've determined that either: // a) The Profiling API wants to do a walk of the heap, and it has pinned the // profiler in place (so it cannot be detached), and it's thus safe to call into the // profiler, OR // b) ETW infrastructure wants to do a walk of the heap either to log roots, // objects, or both. // This can also be called to do a single walk for BOTH a) and b) simultaneously. Since // ETW can ask for roots, but not objects #if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE) void GCProfileWalkHeapWorker(BOOL fProfilerPinned, BOOL fShouldWalkHeapRootsForEtw, BOOL fShouldWalkHeapObjectsForEtw) { { ProfilingScanContext SC(fProfilerPinned); unsigned max_generation = GCHeapUtilities::GetGCHeap()->GetMaxGeneration(); // **** Scan roots: Only scan roots if profiling API wants them or ETW wants them. if (fProfilerPinned || fShouldWalkHeapRootsForEtw) { GcScanRootsForProfilerAndETW(&ProfScanRootsHelper, max_generation, max_generation, &SC); SC.dwEtwRootKind = kEtwGCRootKindFinalizer; GCHeapUtilities::GetGCHeap()->DiagScanFinalizeQueue(&ProfScanRootsHelper, &SC); // Handles are kept independent of wks/svr/concurrent builds SC.dwEtwRootKind = kEtwGCRootKindHandle; GCHeapUtilities::GetGCHeap()->DiagScanHandles(&ScanHandleForProfilerAndETW, max_generation, &SC); // indicate that regular handle scanning is over, so we can flush the buffered roots // to the profiler. (This is for profapi only. ETW will flush after the // entire heap was is complete, via ETW::GCLog::EndHeapDump.) if (fProfilerPinned) { ProfilerEndRootReferences2(&SC.pHeapId); } } // **** Scan dependent handles: only if the profiler supports it or ETW wants roots if ((fProfilerPinned && ProfilerShouldTrackConditionalWeakTableElements()) || fShouldWalkHeapRootsForEtw) { // GcScanDependentHandlesForProfiler double-checks // CORProfilerTrackConditionalWeakTableElements() before calling into the profiler ProfilingScanContext* pSC = &SC; // we'll re-use pHeapId (which was either unused (0) or freed by EndRootReferences2 // (-1)), so reset it to NULL _ASSERTE((*((size_t *)(&pSC->pHeapId)) == (size_t)(-1)) || (*((size_t *)(&pSC->pHeapId)) == (size_t)(0))); pSC->pHeapId = NULL; GCHeapUtilities::GetGCHeap()->DiagScanDependentHandles(&ScanHandleForProfilerAndETW, max_generation, &SC); // indicate that dependent handle scanning is over, so we can flush the buffered roots // to the profiler. (This is for profapi only. ETW will flush after the // entire heap was is complete, via ETW::GCLog::EndHeapDump.) if (fProfilerPinned && ProfilerShouldTrackConditionalWeakTableElements()) { ProfilerEndConditionalWeakTableElementReferences(&SC.pHeapId); } } ProfilerWalkHeapContext profilerWalkHeapContext(fProfilerPinned, SC.pvEtwContext); // **** Walk objects on heap: only if profiling API wants them or ETW wants them. if (fProfilerPinned || fShouldWalkHeapObjectsForEtw) { GCHeapUtilities::GetGCHeap()->DiagWalkHeap(&HeapWalkHelper, &profilerWalkHeapContext, max_generation, true /* walk the large object heap */); } #ifdef FEATURE_EVENT_TRACE // **** Done! Indicate to ETW helpers that the heap walk is done, so any buffers // should be flushed into the ETW stream if (fShouldWalkHeapObjectsForEtw || fShouldWalkHeapRootsForEtw) { ETW::GCLog::EndHeapDump(&profilerWalkHeapContext); } #endif // FEATURE_EVENT_TRACE } } #endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE) void GCProfileWalkHeap(bool etwOnly) { BOOL fWalkedHeapForProfiler = FALSE; #ifdef FEATURE_EVENT_TRACE if (ETW::GCLog::ShouldWalkStaticsAndCOMForEtw()) ETW::GCLog::WalkStaticsAndCOMForETW(); BOOL fShouldWalkHeapRootsForEtw = ETW::GCLog::ShouldWalkHeapRootsForEtw(); BOOL fShouldWalkHeapObjectsForEtw = ETW::GCLog::ShouldWalkHeapObjectsForEtw(); #else // !FEATURE_EVENT_TRACE BOOL fShouldWalkHeapRootsForEtw = FALSE; BOOL fShouldWalkHeapObjectsForEtw = FALSE; #endif // FEATURE_EVENT_TRACE #if defined (GC_PROFILING) { BEGIN_PIN_PROFILER(!etwOnly && CORProfilerTrackGC()); GCProfileWalkHeapWorker(TRUE /* fProfilerPinned */, fShouldWalkHeapRootsForEtw, fShouldWalkHeapObjectsForEtw); fWalkedHeapForProfiler = TRUE; END_PIN_PROFILER(); } #endif // defined (GC_PROFILING) #if defined (GC_PROFILING) || defined(FEATURE_EVENT_TRACE) // we need to walk the heap if one of GC_PROFILING or FEATURE_EVENT_TRACE // is defined, since both of them make use of the walk heap worker. if (!fWalkedHeapForProfiler && (fShouldWalkHeapRootsForEtw || fShouldWalkHeapObjectsForEtw)) { GCProfileWalkHeapWorker(FALSE /* fProfilerPinned */, fShouldWalkHeapRootsForEtw, fShouldWalkHeapObjectsForEtw); } #endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE) } void WalkFReachableObjects(bool isCritical, void* objectID) { g_profControlBlock.pProfInterface->FinalizeableObjectQueued(isCritical, (ObjectID)objectID); } static fq_walk_fn g_FQWalkFn = &WalkFReachableObjects; void GCToEEInterface::DiagGCStart(int gen, bool isInduced) { #ifdef GC_PROFILING DiagUpdateGenerationBounds(); GarbageCollectionStartedCallback(gen, isInduced); { BEGIN_PIN_PROFILER(CORProfilerTrackGC()); size_t context = 0; // When we're walking objects allocated by class, then we don't want to walk the large // object heap because then it would count things that may have been around for a while. GCHeapUtilities::GetGCHeap()->DiagWalkHeap(&AllocByClassHelper, (void *)&context, 0, false); // Notify that we've reached the end of the Gen 0 scan g_profControlBlock.pProfInterface->EndAllocByClass(&context); END_PIN_PROFILER(); } #endif // GC_PROFILING } void GCToEEInterface::DiagUpdateGenerationBounds() { #ifdef GC_PROFILING if (CORProfilerTrackGC() || CORProfilerTrackBasicGC()) UpdateGenerationBounds(); #endif // GC_PROFILING } void GCToEEInterface::DiagGCEnd(size_t index, int gen, int reason, bool fConcurrent) { #ifdef GC_PROFILING // We were only doing generation bounds and GC finish callback for non concurrent GCs so // I am keeping that behavior to not break profilers. But if BasicGC monitoring is enabled // we will do these for all GCs. if (!fConcurrent) { GCProfileWalkHeap(false); } if (CORProfilerTrackBasicGC() || (!fConcurrent && CORProfilerTrackGC())) { DiagUpdateGenerationBounds(); GarbageCollectionFinishedCallback(); } #endif // GC_PROFILING } void GCToEEInterface::DiagWalkFReachableObjects(void* gcContext) { #ifdef GC_PROFILING if (CORProfilerTrackGC()) { BEGIN_PIN_PROFILER(CORProfilerPresent()); GCHeapUtilities::GetGCHeap()->DiagWalkFinalizeQueue(gcContext, g_FQWalkFn); END_PIN_PROFILER(); } #endif //GC_PROFILING } // Note on last parameter: when calling this for bgc, only ETW // should be sending these events so that existing profapi profilers // don't get confused. void WalkMovedReferences(uint8_t* begin, uint8_t* end, ptrdiff_t reloc, void* context, bool fCompacting, bool fBGC) { ETW::GCLog::MovedReference(begin, end, (fCompacting ? reloc : 0), (size_t)context, fCompacting, !fBGC); } void GCToEEInterface::DiagWalkSurvivors(void* gcContext, bool fCompacting) { #if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE) if (ShouldTrackSurvivorsForProfilerOrEtw() || (fCompacting && ShouldTrackSurvivorsInCompactingGCsForProfiler())) { size_t context = 0; ETW::GCLog::BeginMovedReferences(&context); GCHeapUtilities::GetGCHeap()->DiagWalkSurvivorsWithType(gcContext, &WalkMovedReferences, (void*)context, walk_for_gc); ETW::GCLog::EndMovedReferences(context); } #endif //GC_PROFILING || FEATURE_EVENT_TRACE } void GCToEEInterface::DiagWalkUOHSurvivors(void* gcContext, int gen) { #if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE) if (ShouldTrackSurvivorsForProfilerOrEtw()) { size_t context = 0; ETW::GCLog::BeginMovedReferences(&context); GCHeapUtilities::GetGCHeap()->DiagWalkSurvivorsWithType(gcContext, &WalkMovedReferences, (void*)context, walk_for_uoh, gen); ETW::GCLog::EndMovedReferences(context); } #endif //GC_PROFILING || FEATURE_EVENT_TRACE } void GCToEEInterface::DiagWalkBGCSurvivors(void* gcContext) { #if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE) if (ShouldTrackSurvivorsForProfilerOrEtw()) { size_t context = 0; ETW::GCLog::BeginMovedReferences(&context); GCHeapUtilities::GetGCHeap()->DiagWalkSurvivorsWithType(gcContext, &WalkMovedReferences, (void*)context, walk_for_bgc); ETW::GCLog::EndMovedReferences(context); } #endif //GC_PROFILING || FEATURE_EVENT_TRACE } void GCToEEInterface::StompWriteBarrier(WriteBarrierParameters* args) { assert(args != nullptr); int stompWBCompleteActions = SWB_PASS; bool is_runtime_suspended = args->is_runtime_suspended; switch (args->operation) { case WriteBarrierOp::StompResize: // StompResize requires a new card table, a new lowest address, and // a new highest address assert(args->card_table != nullptr); assert(args->lowest_address != nullptr); assert(args->highest_address != nullptr); // We are sensitive to the order of writes here (more comments on this further in the method) // In particular g_card_table must be written before writing the heap bounds. // For platforms with weak memory ordering we will issue fences, for x64/x86 we are ok // as long as compiler does not reorder these writes. // That is unlikely since we have method calls in between. // Just to be robust agains possible refactoring/inlining we will do a compiler-fenced store here. VolatileStoreWithoutBarrier(&g_card_table, args->card_table); #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES assert(args->card_bundle_table != nullptr); g_card_bundle_table = args->card_bundle_table; #endif #ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP if (g_sw_ww_enabled_for_gc_heap && (args->write_watch_table != nullptr)) { assert(args->is_runtime_suspended); g_sw_ww_table = args->write_watch_table; } #endif // FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP stompWBCompleteActions |= ::StompWriteBarrierResize(is_runtime_suspended, args->requires_upper_bounds_check); is_runtime_suspended = (stompWBCompleteActions & SWB_EE_RESTART) || is_runtime_suspended; if (stompWBCompleteActions & SWB_ICACHE_FLUSH) { // flushing/invalidating the write barrier's body for the current process // NOTE: the underlying API may flush more than needed or nothing at all if Icache is coherent. ::FlushWriteBarrierInstructionCache(); } // IMPORTANT: managed heap segments may surround unmanaged/stack segments. In such cases adding another managed // heap segment may put a stack/unmanaged write inside the new heap range. However the old card table would // not cover it. Therefore we must ensure that the write barriers see the new table before seeing the new bounds. // // On architectures with strong ordering, we only need to prevent compiler reordering. // Otherwise we put a process-wide fence here (so that we could use an ordinary read in the barrier) #if defined(HOST_ARM64) || defined(HOST_ARM) if (!is_runtime_suspended) { // If runtime is not suspended, force all threads to see the changed table before seeing updated heap boundaries. // See: http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/346765 FlushProcessWriteBuffers(); } #endif g_lowest_address = args->lowest_address; g_highest_address = args->highest_address; #if defined(HOST_ARM64) || defined(HOST_ARM) // Need to reupdate for changes to g_highest_address g_lowest_address stompWBCompleteActions |= ::StompWriteBarrierResize(is_runtime_suspended, args->requires_upper_bounds_check); #ifdef HOST_ARM if (stompWBCompleteActions & SWB_ICACHE_FLUSH) { // flushing/invalidating the write barrier's body for the current process // NOTE: the underlying API may flush more than needed or nothing at all if Icache is coherent. ::FlushWriteBarrierInstructionCache(); } #endif #endif // At this point either the old or the new set of globals (card_table, bounds etc) can be used. Card tables and card bundles allow such use. // When card tables are de-published (at EE suspension) all the info will be merged, so the information will not be lost. // Another point - we should not yet have any managed objects/addresses outside of the former bounds, so either old or new bounds are fine. // That is - because bounds can only become wider and we are not yet done with widening. // // However!! // Once we are done, a new object can (and likely will) be allocated outside of the former bounds. // So, before such object can be used in a write barier, we must ensure that the barrier also uses the new bounds. // // This is easy to arrange for architectures with strong memory ordering. We only need to ensure that // - object is allocated/published _after_ we publish bounds here // - write barrier reads bounds after reading the new object locations // // for architectures with strong memory ordering (x86/x64) both conditions above are naturally guaranteed. // Systems with weak ordering are more interesting. We could either: // a) issue a write fence here and pair it with a read fence in the write barrier, or // b) issue a process-wide full fence here and do ordinary reads in the barrier. // // We will do "b" because executing write barrier is by far more common than updating card table. // // I.E. - for weak architectures we have to do a process-wide fence. // // NOTE: suspending/resuming EE works the same as process-wide fence for our purposes here. // (we care only about managed threads and suspend/resume will do full fences - good enough for us). // #if defined(HOST_ARM64) || defined(HOST_ARM) is_runtime_suspended = (stompWBCompleteActions & SWB_EE_RESTART) || is_runtime_suspended; if (!is_runtime_suspended) { // If runtime is not suspended, force all threads to see the changed state before observing future allocations. FlushProcessWriteBuffers(); } #endif if (stompWBCompleteActions & SWB_EE_RESTART) { assert(!args->is_runtime_suspended && "if runtime was suspended in patching routines then it was in running state at beginning"); ThreadSuspend::RestartEE(FALSE, TRUE); } return; // unlike other branches we have already done cleanup so bailing out here case WriteBarrierOp::StompEphemeral: assert(args->is_runtime_suspended && "the runtime must be suspended here!"); // StompEphemeral requires a new ephemeral low and a new ephemeral high assert(args->ephemeral_low != nullptr); assert(args->ephemeral_high != nullptr); g_ephemeral_low = args->ephemeral_low; g_ephemeral_high = args->ephemeral_high; stompWBCompleteActions |= ::StompWriteBarrierEphemeral(args->is_runtime_suspended); break; case WriteBarrierOp::Initialize: assert(args->is_runtime_suspended && "the runtime must be suspended here!"); // This operation should only be invoked once, upon initialization. assert(g_card_table == nullptr); assert(g_lowest_address == nullptr); assert(g_highest_address == nullptr); assert(args->card_table != nullptr); assert(args->lowest_address != nullptr); assert(args->highest_address != nullptr); assert(args->ephemeral_low != nullptr); assert(args->ephemeral_high != nullptr); assert(!args->requires_upper_bounds_check && "the ephemeral generation must be at the top of the heap!"); g_card_table = args->card_table; #ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES assert(g_card_bundle_table == nullptr); g_card_bundle_table = args->card_bundle_table; #endif g_lowest_address = args->lowest_address; g_highest_address = args->highest_address; stompWBCompleteActions |= ::StompWriteBarrierResize(true, false); // StompWriteBarrierResize does not necessarily bash g_ephemeral_low // usages, so we must do so here. This is particularly true on x86, // where StompWriteBarrierResize will not bash g_ephemeral_low when // called with the parameters (true, false), as it is above. g_ephemeral_low = args->ephemeral_low; g_ephemeral_high = args->ephemeral_high; stompWBCompleteActions |= ::StompWriteBarrierEphemeral(true); break; case WriteBarrierOp::SwitchToWriteWatch: #ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP assert(args->is_runtime_suspended && "the runtime must be suspended here!"); assert(args->write_watch_table != nullptr); g_sw_ww_table = args->write_watch_table; g_sw_ww_enabled_for_gc_heap = true; stompWBCompleteActions |= ::SwitchToWriteWatchBarrier(true); #else assert(!"should never be called without FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP"); #endif // FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP break; case WriteBarrierOp::SwitchToNonWriteWatch: #ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP assert(args->is_runtime_suspended && "the runtime must be suspended here!"); g_sw_ww_table = 0; g_sw_ww_enabled_for_gc_heap = false; stompWBCompleteActions |= ::SwitchToNonWriteWatchBarrier(true); #else assert(!"should never be called without FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP"); #endif // FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP break; default: assert(!"unknown WriteBarrierOp enum"); } if (stompWBCompleteActions & SWB_ICACHE_FLUSH) { ::FlushWriteBarrierInstructionCache(); } if (stompWBCompleteActions & SWB_EE_RESTART) { assert(!args->is_runtime_suspended && "if runtime was suspended in patching routines then it was in running state at beginning"); ThreadSuspend::RestartEE(FALSE, TRUE); } } void GCToEEInterface::EnableFinalization(bool foundFinalizers) { if (foundFinalizers || FinalizerThread::HaveExtraWorkForFinalizer()) { FinalizerThread::EnableFinalization(); } } void GCToEEInterface::HandleFatalError(unsigned int exitCode) { EEPOLICY_HANDLE_FATAL_ERROR(exitCode); } bool GCToEEInterface::EagerFinalized(Object* obj) { MethodTable* pMT = obj->GetGCSafeMethodTable(); if (pMT == pWeakReferenceMT || pMT->GetCanonicalMethodTable() == pWeakReferenceOfTCanonMT) { FinalizeWeakReference(obj); return true; } return false; } MethodTable* GCToEEInterface::GetFreeObjectMethodTable() { assert(g_pFreeObjectMethodTable != nullptr); return g_pFreeObjectMethodTable; } // This is arbitrary, we shouldn't ever be having config keys // longer than these lengths. const size_t MaxConfigKeyLength = 255; bool GCToEEInterface::GetBooleanConfigValue(const char* privateKey, const char* publicKey, bool* value) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; // these configuration values are given to us via startup flags. if (strcmp(privateKey, "gcServer") == 0) { *value = g_heap_type == GC_HEAP_SVR; return true; } if (strcmp(privateKey, "gcConcurrent") == 0) { *value = !!g_pConfig->GetGCconcurrent(); return true; } if (strcmp(privateKey, "GCRetainVM") == 0) { *value = !!g_pConfig->GetGCRetainVM(); return true; } WCHAR configKey[MaxConfigKeyLength]; if (MultiByteToWideChar(CP_ACP, 0, privateKey, -1 /* key is null-terminated */, configKey, MaxConfigKeyLength) == 0) { // whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.) return false; } // otherwise, ask the config subsystem. if (CLRConfig::IsConfigOptionSpecified(configKey)) { CLRConfig::ConfigDWORDInfo info { configKey , 0, CLRConfig::EEConfig_default }; *value = CLRConfig::GetConfigValue(info) != 0; return true; } else if (publicKey != NULL) { if (MultiByteToWideChar(CP_ACP, 0, publicKey, -1 /* key is null-terminated */, configKey, MaxConfigKeyLength) == 0) { // whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.) return false; } if (Configuration::GetKnobStringValue(configKey) != NULL) { *value = Configuration::GetKnobBooleanValue(configKey, false); return true; } } return false; } bool GCToEEInterface::GetIntConfigValue(const char* privateKey, const char* publicKey, int64_t* value) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; if (strcmp(privateKey, "GCLOHThreshold") == 0) { *value = g_pConfig->GetGCLOHThreshold(); return true; } WCHAR configKey[MaxConfigKeyLength]; if (MultiByteToWideChar(CP_ACP, 0, privateKey, -1 /* key is null-terminated */, configKey, MaxConfigKeyLength) == 0) { // whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.) return false; } // There is no ConfigULONGLONGInfo, and the GC uses 64 bit values for things like GCHeapAffinitizeMask, // so have to fake it with getting the string and converting to uint64_t if (CLRConfig::IsConfigOptionSpecified(configKey)) { CLRConfig::ConfigStringInfo info { configKey, CLRConfig::EEConfig_default }; LPWSTR out = CLRConfig::GetConfigValue(info); if (!out) { // config not found CLRConfig::FreeConfigString(out); return false; } WCHAR *end; uint64_t result; errno = 0; result = _wcstoui64(out, &end, 16); // errno is ERANGE if the number is out of range, and end is set to pvalue if // no valid conversion exists. if (errno == ERANGE || end == out) { CLRConfig::FreeConfigString(out); return false; } *value = static_cast<int64_t>(result); CLRConfig::FreeConfigString(out); return true; } else if (publicKey != NULL) { if (MultiByteToWideChar(CP_ACP, 0, publicKey, -1 /* key is null-terminated */, configKey, MaxConfigKeyLength) == 0) { // whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.) return false; } if (Configuration::GetKnobStringValue(configKey) != NULL) { *value = Configuration::GetKnobULONGLONGValue(configKey, 0); return true; } } return false; } bool GCToEEInterface::GetStringConfigValue(const char* privateKey, const char* publicKey, const char** value) { CONTRACTL { NOTHROW; GC_NOTRIGGER; } CONTRACTL_END; WCHAR configKey[MaxConfigKeyLength]; if (MultiByteToWideChar(CP_ACP, 0, privateKey, -1 /* key is null-terminated */, configKey, MaxConfigKeyLength) == 0) { // whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.) return false; } CLRConfig::ConfigStringInfo info { configKey, CLRConfig::EEConfig_default }; LPWSTR fromClrConfig = CLRConfig::GetConfigValue(info); LPCWSTR out = fromClrConfig; if (out == NULL) { if (publicKey != NULL) { if (MultiByteToWideChar(CP_ACP, 0, publicKey, -1 /* key is null-terminated */, configKey, MaxConfigKeyLength) == 0) { // whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.) return false; } out = Configuration::GetKnobStringValue(configKey); if (out == NULL) { return false; } } } int charCount = WideCharToMultiByte(CP_ACP, 0, out, -1 /* out is null-terminated */, NULL, 0, nullptr, nullptr); if (charCount == 0) { // this should only happen if the config subsystem gives us a string that's not valid // unicode. if (fromClrConfig) { CLRConfig::FreeConfigString(fromClrConfig); } return false; } // not allocated on the stack since it escapes this function AStringHolder configResult = new (nothrow) char[charCount]; if (!configResult) { if (fromClrConfig) { CLRConfig::FreeConfigString(fromClrConfig); } return false; } if (WideCharToMultiByte(CP_ACP, 0, out, -1 /* out is null-terminated */, configResult.GetValue(), charCount, nullptr, nullptr) == 0) { // this should never happen, the previous call to WideCharToMultiByte that computed the charCount should // have caught all issues. assert(false); if (fromClrConfig) { CLRConfig::FreeConfigString(fromClrConfig); } return false; } *value = configResult.Extract(); if (fromClrConfig) { CLRConfig::FreeConfigString(fromClrConfig); } return true; } void GCToEEInterface::FreeStringConfigValue(const char* value) { delete [] value; } bool GCToEEInterface::IsGCThread() { return !!::IsGCThread(); } bool GCToEEInterface::WasCurrentThreadCreatedByGC() { return !!::IsGCSpecialThread(); } struct SuspendableThreadStubArguments { void* Argument; void (*ThreadStart)(void*); Thread* Thread; bool HasStarted; CLREvent ThreadStartedEvent; }; struct ThreadStubArguments { void* Argument; void (*ThreadStart)(void*); HANDLE Thread; bool HasStarted; CLREvent ThreadStartedEvent; }; namespace { const size_t MaxThreadNameSize = 255; bool CreateSuspendableThread( void (*threadStart)(void*), void* argument, const WCHAR* name) { LIMITED_METHOD_CONTRACT; SuspendableThreadStubArguments args; args.Argument = argument; args.ThreadStart = threadStart; args.Thread = nullptr; args.HasStarted = false; if (!args.ThreadStartedEvent.CreateAutoEventNoThrow(FALSE)) { return false; } EX_TRY { args.Thread = SetupUnstartedThread(FALSE); } EX_CATCH { } EX_END_CATCH(SwallowAllExceptions) if (!args.Thread) { args.ThreadStartedEvent.CloseEvent(); return false; } auto threadStub = [](void* argument) -> DWORD { SuspendableThreadStubArguments* args = static_cast<SuspendableThreadStubArguments*>(argument); assert(args != nullptr); ClrFlsSetThreadType(ThreadType_GC); args->Thread->SetGCSpecial(true); STRESS_LOG_RESERVE_MEM(GC_STRESSLOG_MULTIPLY); args->HasStarted = !!args->Thread->HasStarted(false); Thread* thread = args->Thread; auto threadStart = args->ThreadStart; void* threadArgument = args->Argument; bool hasStarted = args->HasStarted; args->ThreadStartedEvent.Set(); // The stubArgs cannot be used once the event is set, since that releases wait on the // event in the function that created this thread and the stubArgs go out of scope. if (hasStarted) { threadStart(threadArgument); DestroyThread(thread); } return 0; }; if (!args.Thread->CreateNewThread(0, threadStub, &args, name)) { args.Thread->DecExternalCount(FALSE); args.ThreadStartedEvent.CloseEvent(); return false; } args.Thread->SetBackground(TRUE, FALSE); args.Thread->StartThread(); // Wait for the thread to be in its main loop uint32_t res = args.ThreadStartedEvent.Wait(INFINITE, FALSE); args.ThreadStartedEvent.CloseEvent(); _ASSERTE(res == WAIT_OBJECT_0); if (!args.HasStarted) { // The thread has failed to start and the Thread object was destroyed in the Thread::HasStarted // failure code path. return false; } return true; } bool CreateNonSuspendableThread( void (*threadStart)(void*), void* argument, const WCHAR* name) { LIMITED_METHOD_CONTRACT; ThreadStubArguments args; args.Argument = argument; args.ThreadStart = threadStart; args.Thread = INVALID_HANDLE_VALUE; if (!args.ThreadStartedEvent.CreateAutoEventNoThrow(FALSE)) { return false; } auto threadStub = [](void* argument) -> DWORD { ThreadStubArguments* args = static_cast<ThreadStubArguments*>(argument); assert(args != nullptr); ClrFlsSetThreadType(ThreadType_GC); STRESS_LOG_RESERVE_MEM(GC_STRESSLOG_MULTIPLY); args->HasStarted = true; auto threadStart = args->ThreadStart; void* threadArgument = args->Argument; args->ThreadStartedEvent.Set(); // The stub args cannot be used once the event is set, since that releases wait on the // event in the function that created this thread and the stubArgs go out of scope. threadStart(threadArgument); return 0; }; args.Thread = Thread::CreateUtilityThread(Thread::StackSize_Medium, threadStub, &args, name); if (args.Thread == INVALID_HANDLE_VALUE) { args.ThreadStartedEvent.CloseEvent(); return false; } // Wait for the thread to be in its main loop uint32_t res = args.ThreadStartedEvent.Wait(INFINITE, FALSE); args.ThreadStartedEvent.CloseEvent(); _ASSERTE(res == WAIT_OBJECT_0); CloseHandle(args.Thread); return true; } } // anonymous namespace bool GCToEEInterface::CreateThread(void (*threadStart)(void*), void* arg, bool is_suspendable, const char* name) { InlineSString<MaxThreadNameSize> wideName; const WCHAR* namePtr = nullptr; EX_TRY { if (name != nullptr) { wideName.SetUTF8(name); namePtr = wideName.GetUnicode(); } } EX_CATCH { // we're not obligated to provide a name - if it's not valid, // just report nullptr as the name. } EX_END_CATCH(SwallowAllExceptions) LIMITED_METHOD_CONTRACT; if (is_suspendable) { return CreateSuspendableThread(threadStart, arg, namePtr); } else { return CreateNonSuspendableThread(threadStart, arg, namePtr); } } void GCToEEInterface::WalkAsyncPinnedForPromotion(Object* object, ScanContext* sc, promote_func* callback) { LIMITED_METHOD_CONTRACT; assert(object != nullptr); assert(sc != nullptr); assert(callback != nullptr); if (object->GetGCSafeMethodTable() != g_pOverlappedDataClass) { // not an overlapped data object - nothing to do. return; } // reporting the pinned user objects OverlappedDataObject *pOverlapped = (OverlappedDataObject *)object; if (pOverlapped->m_userObject != NULL) { if (pOverlapped->m_userObject->GetGCSafeMethodTable() == g_pPredefinedArrayTypes[ELEMENT_TYPE_OBJECT].AsMethodTable()) { // OverlappedDataObject is very special. An async pin handle keeps it alive. // During GC, we also make sure // 1. m_userObject itself does not move if m_userObject is not array // 2. Every object pointed by m_userObject does not move if m_userObject is array // We do not want to pin m_userObject if it is array. ArrayBase* pUserObject = (ArrayBase*)OBJECTREFToObject(pOverlapped->m_userObject); Object **ppObj = (Object**)pUserObject->GetDataPtr(TRUE); size_t num = pUserObject->GetNumComponents(); for (size_t i = 0; i < num; i++) { callback(ppObj + i, sc, GC_CALL_PINNED); } } else { callback(&OBJECTREF_TO_UNCHECKED_OBJECTREF(pOverlapped->m_userObject), (ScanContext *)sc, GC_CALL_PINNED); } } } void GCToEEInterface::WalkAsyncPinned(Object* object, void* context, void (*callback)(Object*, Object*, void*)) { LIMITED_METHOD_CONTRACT; assert(object != nullptr); assert(callback != nullptr); if (object->GetGCSafeMethodTable() != g_pOverlappedDataClass) { return; } OverlappedDataObject *pOverlapped = (OverlappedDataObject *)(object); if (pOverlapped->m_userObject != NULL) { Object * pUserObject = OBJECTREFToObject(pOverlapped->m_userObject); callback(object, pUserObject, context); if (pOverlapped->m_userObject->GetGCSafeMethodTable() == g_pPredefinedArrayTypes[ELEMENT_TYPE_OBJECT].AsMethodTable()) { ArrayBase* pUserArrayObject = (ArrayBase*)pUserObject; Object **pObj = (Object**)pUserArrayObject->GetDataPtr(TRUE); size_t num = pUserArrayObject->GetNumComponents(); for (size_t i = 0; i < num; i ++) { callback(pUserObject, pObj[i], context); } } } } IGCToCLREventSink* GCToEEInterface::EventSink() { LIMITED_METHOD_CONTRACT; return &g_gcToClrEventSink; } uint32_t GCToEEInterface::GetTotalNumSizedRefHandles() { LIMITED_METHOD_CONTRACT; return SystemDomain::System()->GetTotalNumSizedRefHandles(); } bool GCToEEInterface::AnalyzeSurvivorsRequested(int condemnedGeneration) { LIMITED_METHOD_CONTRACT; // Is the list active? GcNotifications gn(g_pGcNotificationTable); if (gn.IsActive()) { GcEvtArgs gea = { GC_MARK_END, { (1<<condemnedGeneration) } }; if (gn.GetNotification(gea) != 0) { return true; } } return false; } void GCToEEInterface::AnalyzeSurvivorsFinished(size_t gcIndex, int condemnedGeneration, uint64_t promoted_bytes, void (*reportGenerationBounds)()) { LIMITED_METHOD_CONTRACT; // Is the list active? GcNotifications gn(g_pGcNotificationTable); if (gn.IsActive()) { GcEvtArgs gea = { GC_MARK_END, { (1<<condemnedGeneration) } }; if (gn.GetNotification(gea) != 0) { DACNotify::DoGCNotification(gea); } } if (gcGenAnalysisState == GcGenAnalysisState::Enabled) { #ifndef GEN_ANALYSIS_STRESS if ((condemnedGeneration == gcGenAnalysisGen) && (promoted_bytes > (uint64_t)gcGenAnalysisBytes) && (gcIndex > (uint64_t)gcGenAnalysisIndex)) #endif { EventPipeAdapter::ResumeSession(gcGenAnalysisEventPipeSession); FireEtwGenAwareBegin((int)gcIndex, GetClrInstanceId()); s_forcedGCInProgress = true; GCProfileWalkHeap(true); s_forcedGCInProgress = false; reportGenerationBounds(); FireEtwGenAwareEnd((int)gcIndex, GetClrInstanceId()); EventPipeAdapter::PauseSession(gcGenAnalysisEventPipeSession); gcGenAnalysisState = GcGenAnalysisState::Done; EnableFinalization(true); } } } void GCToEEInterface::VerifySyncTableEntry() { LIMITED_METHOD_CONTRACT; #ifdef VERIFY_HEAP SyncBlockCache::GetSyncBlockCache()->VerifySyncTableEntry(); #endif // VERIFY_HEAP } void GCToEEInterface::UpdateGCEventStatus(int currentPublicLevel, int currentPublicKeywords, int currentPrivateLevel, int currentPrivateKeywords) { #if defined(__linux__) && defined(FEATURE_EVENT_TRACE) LIMITED_METHOD_CONTRACT; // LTTng does not have a notion of enabling events via "keyword"/"level" but we have to // somehow implement a similar behavior to it. // To do this, we manaully check for events that are enabled via different provider/keywords/level. // Ex 1. GCJoin_V2 is what we use to check whether the GC keyword is enabled in verbose level in the public provider // Ex 2. SetGCHandle is what we use to check whether the GCHandle keyword is enabled in informational level in the public provider // Refer to the comments in src/vm/gcenv.ee.h next to the EXTERN C definitions to see which events are enabled. // WARNING: To change an event's GC level, perfcollect script needs to be updated simultaneously to reflect it. BOOL keyword_gc_verbose = EventXplatEnabledGCJoin_V2() || EventPipeEventEnabledGCJoin_V2(); BOOL keyword_gc_informational = EventXplatEnabledGCStart() || EventPipeEventEnabledGCStart(); BOOL keyword_gc_heapsurvival_and_movement_informational = EventXplatEnabledGCGenerationRange() || EventPipeEventEnabledGCGenerationRange(); BOOL keyword_gchandle_informational = EventXplatEnabledSetGCHandle() || EventPipeEventEnabledSetGCHandle(); BOOL keyword_gchandle_prv_informational = EventXplatEnabledPrvSetGCHandle() || EventPipeEventEnabledPrvSetGCHandle(); BOOL prv_gcprv_informational = EventXplatEnabledBGCBegin() || EventPipeEventEnabledBGCBegin(); BOOL prv_gcprv_verbose = EventXplatEnabledPinPlugAtGCTime() || EventPipeEventEnabledPinPlugAtGCTime(); int publicProviderLevel = keyword_gc_verbose ? GCEventLevel_Verbose : (keyword_gc_informational ? GCEventLevel_Information : GCEventLevel_None); int publicProviderKeywords = (keyword_gc_informational ? GCEventKeyword_GC : GCEventKeyword_None) | (keyword_gchandle_informational ? GCEventKeyword_GCHandle : GCEventKeyword_None) | (keyword_gc_heapsurvival_and_movement_informational ? GCEventKeyword_GCHeapSurvivalAndMovement : GCEventKeyword_None); int privateProviderLevel = prv_gcprv_verbose ? GCEventLevel_Verbose : (prv_gcprv_informational ? GCEventLevel_Information : GCEventLevel_None); int privateProviderKeywords = (prv_gcprv_informational ? GCEventKeyword_GCPrivate : GCEventKeyword_None) | (keyword_gchandle_prv_informational ? GCEventKeyword_GCHandlePrivate : GCEventKeyword_None); if (publicProviderLevel != currentPublicLevel || publicProviderKeywords != currentPublicKeywords) { GCEventLevel publicLevel = static_cast<GCEventLevel>(publicProviderLevel); GCEventKeyword publicKeywords = static_cast<GCEventKeyword>(publicProviderKeywords); GCHeapUtilities::RecordEventStateChange(true, publicKeywords, publicLevel); } if (privateProviderLevel != currentPrivateLevel || privateProviderKeywords != currentPrivateKeywords) { GCEventLevel privateLevel = static_cast<GCEventLevel>(privateProviderLevel); GCEventKeyword privateKeywords = static_cast<GCEventKeyword>(privateProviderKeywords); GCHeapUtilities::RecordEventStateChange(false, privateKeywords, privateLevel); } #endif // __linux__ && FEATURE_EVENT_TRACE }
; DV3 QXL Hard Disk Hold / Release controller  1998 Tony Tebby section dv3 xdef hd_hold xdef hd_release include 'dev8_dv3_keys' include 'dev8_dv3_hd_keys' include 'dev8_keys_sys' include 'dev8_keys_err' include 'dev8_mac_assert' ;+++ ; This routine is called to take the disk controller ; ; d0 cr p preserved if OK ; d7 c p drive ID / number ; a3 c p linkage block ; a4 c p drive definition ; ; status return 0, err.nc, err.mchk ;--- hd_hold bset #7,sys_stiu(a6) ; take the sector transfer buffer bne.s hdh_nc cmp.b d0,d0 hdh_rts rts hdh_nc moveq #err.nc,d0 rts ;+++ ; This routine is called to release the disk controller ; ; d0 c p ; d7 c p drive ID / number ; a3 c p linkage block ; a4 c p drive definition ; ; status return accoding to d0 ;--- hd_release move.b hdl_apnd(a3),hdl_actm(a3) ; ... let it go bclr #7,sys_stiu(a6) ; relase the sector transfer buffer tst.l d0 rts end
// SP = 256 @256 D=A @SP M=D // call Sys.init 0 @$RET$0 D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @5 D=A @0 D=A+D @SP D=M-D @ARG M=D @SP D=M @LCL M=D @Sys.init 0;JMP ($RET$0) // function Sys.init 0 (Sys.init) // push constant 4000 @4000 D=A @SP A=M M=D @SP M=M+1 // pop pointer 0 @THIS D=A @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D // push constant 5000 @5000 D=A @SP A=M M=D @SP M=M+1 // pop pointer 1 @THAT D=A @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D // call Sys.main 0 @Sys.init$RET$1 D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @5 D=A @0 D=A+D @SP D=M-D @ARG M=D @SP D=M @LCL M=D @Sys.main 0;JMP (Sys.init$RET$1) // pop temp 1 @5 D=A @1 D=A+D @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D // label LOOP (Sys.init$LOOP) // goto LOOP @Sys.init$LOOP 0;JMP // function Sys.main 5 (Sys.main) @0 D=A @SP A=M M=D @SP M=M+1 @0 D=A @SP A=M M=D @SP M=M+1 @0 D=A @SP A=M M=D @SP M=M+1 @0 D=A @SP A=M M=D @SP M=M+1 @0 D=A @SP A=M M=D @SP M=M+1 // push constant 4001 @4001 D=A @SP A=M M=D @SP M=M+1 // pop pointer 0 @THIS D=A @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D // push constant 5001 @5001 D=A @SP A=M M=D @SP M=M+1 // pop pointer 1 @THAT D=A @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D // push constant 200 @200 D=A @SP A=M M=D @SP M=M+1 // pop local 1 @LCL D=M @1 D=A+D @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D // push constant 40 @40 D=A @SP A=M M=D @SP M=M+1 // pop local 2 @LCL D=M @2 D=A+D @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D // push constant 6 @6 D=A @SP A=M M=D @SP M=M+1 // pop local 3 @LCL D=M @3 D=A+D @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D // push constant 123 @123 D=A @SP A=M M=D @SP M=M+1 // call Sys.add12 1 @Sys.main$RET$2 D=A @SP A=M M=D @SP M=M+1 @LCL D=M @SP A=M M=D @SP M=M+1 @ARG D=M @SP A=M M=D @SP M=M+1 @THIS D=M @SP A=M M=D @SP M=M+1 @THAT D=M @SP A=M M=D @SP M=M+1 @5 D=A @1 D=A+D @SP D=M-D @ARG M=D @SP D=M @LCL M=D @Sys.add12 0;JMP (Sys.main$RET$2) // pop temp 0 @5 D=A @0 D=A+D @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D // push local 0 @LCL D=M @0 A=A+D D=M @SP A=M M=D @SP M=M+1 // push local 1 @LCL D=M @1 A=A+D D=M @SP A=M M=D @SP M=M+1 // push local 2 @LCL D=M @2 A=A+D D=M @SP A=M M=D @SP M=M+1 // push local 3 @LCL D=M @3 A=A+D D=M @SP A=M M=D @SP M=M+1 // push local 4 @LCL D=M @4 A=A+D D=M @SP A=M M=D @SP M=M+1 // add @SP AM=M-1 D=M A=A-1 M=M+D // add @SP AM=M-1 D=M A=A-1 M=M+D // add @SP AM=M-1 D=M A=A-1 M=M+D // add @SP AM=M-1 D=M A=A-1 M=M+D // return @LCL D=M @R13 M=D @R14 D=A @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D @ARG D=M @SP M=D @R13 D=M @1 A=D-A D=M @THAT M=D @R13 D=M @2 A=D-A D=M @THIS M=D @R13 D=M @3 A=D-A D=M @ARG M=D @R13 D=M @4 A=D-A D=M @LCL M=D @R13 D=M @5 A=D-A D=M @R13 M=D @R14 D=M @SP A=M M=D @SP M=M+1 @R13 A=M 0;JMP // function Sys.add12 0 (Sys.add12) // push constant 4002 @4002 D=A @SP A=M M=D @SP M=M+1 // pop pointer 0 @THIS D=A @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D // push constant 5002 @5002 D=A @SP A=M M=D @SP M=M+1 // pop pointer 1 @THAT D=A @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D // push argument 0 @ARG D=M @0 A=A+D D=M @SP A=M M=D @SP M=M+1 // push constant 12 @12 D=A @SP A=M M=D @SP M=M+1 // add @SP AM=M-1 D=M A=A-1 M=M+D // return @LCL D=M @R13 M=D @R14 D=A @SP A=M M=D @SP AM=M-1 D=M @SP A=M+1 A=M M=D @ARG D=M @SP M=D @R13 D=M @1 A=D-A D=M @THAT M=D @R13 D=M @2 A=D-A D=M @THIS M=D @R13 D=M @3 A=D-A D=M @ARG M=D @R13 D=M @4 A=D-A D=M @LCL M=D @R13 D=M @5 A=D-A D=M @R13 M=D @R14 D=M @SP A=M M=D @SP M=M+1 @R13 A=M 0;JMP
#include "ios_build_settings.h" #include <engine/core/util/PathUtil.h> #include <engine/core/io/IO.h> #include <engine/core/main/Engine.h> #include <thirdparty/pugixml/pugixml.hpp> #include <QProcess> #include "ImageHelper.h" #include <engine/core/main/module.h> #include <engine/core/io/stream/FileHandleDataStream.h> namespace Echo { iOSBuildSettings::AppIconItem::AppIconItem(i32 size) : m_size(size) { } iOSBuildSettings::LaunchImageItem::LaunchImageItem(i32 width, i32 height, i32 scale, iOSBuildSettings::DeviceType type) : m_width(width) , m_height(height) , m_scale(scale) , m_type(type) {} String iOSBuildSettings::LaunchImageItem::getPortraitPath() const { return " ${MODULE_PATH}/frame/Platform/iOS/Launch/" + getPortraitName(); } String iOSBuildSettings::LaunchImageItem::getLandscapePath() const { return " ${MODULE_PATH}/frame/Platform/iOS/Launch/" + getLandscapeName(); } String iOSBuildSettings::LaunchImageItem::getPortraitName() const { i32 width = std::min<i32>(m_width, m_height); i32 height = std::max<i32>(m_width, m_height); return StringUtil::Format("Default-Portrait-%dx%d@%dx.png", width, height, m_scale); } String iOSBuildSettings::LaunchImageItem::getLandscapeName() const { i32 width = std::max<i32>(m_width, m_height); i32 height = std::min<i32>(m_width, m_height); return StringUtil::Format("Default-Landscape-%dx%d@%dx.png", width, height, m_scale); } iOSBuildSettings::iOSBuildSettings() { configAppIcons(); configLaunchImages(); } iOSBuildSettings::~iOSBuildSettings() { } iOSBuildSettings* iOSBuildSettings::instance() { static iOSBuildSettings* inst = EchoNew(iOSBuildSettings); return inst; } void iOSBuildSettings::bindMethods() { CLASS_BIND_METHOD(iOSBuildSettings, getAppName, DEF_METHOD("getAppName")); CLASS_BIND_METHOD(iOSBuildSettings, setAppName, DEF_METHOD("setAppName")); CLASS_BIND_METHOD(iOSBuildSettings, getIdentifier, DEF_METHOD("getIdentifier")); CLASS_BIND_METHOD(iOSBuildSettings, setIdentifier, DEF_METHOD("setIdentifier")); CLASS_BIND_METHOD(iOSBuildSettings, getVersion, DEF_METHOD("getVersion")); CLASS_BIND_METHOD(iOSBuildSettings, setVersion, DEF_METHOD("setVersion")); CLASS_BIND_METHOD(iOSBuildSettings, getIconRes, DEF_METHOD("getIconRes")); CLASS_BIND_METHOD(iOSBuildSettings, setIconRes, DEF_METHOD("setIconRes")); CLASS_BIND_METHOD(iOSBuildSettings, isHiddenStatusBar, DEF_METHOD("isHiddenStatusBar")); CLASS_BIND_METHOD(iOSBuildSettings, setHiddenStatusBar, DEF_METHOD("setHiddenStatusBar")); CLASS_REGISTER_PROPERTY(iOSBuildSettings, "AppName", Variant::Type::String, "getAppName", "setAppName"); CLASS_REGISTER_PROPERTY(iOSBuildSettings, "Identifier", Variant::Type::String, "getIdentifier", "setIdentifier"); CLASS_REGISTER_PROPERTY(iOSBuildSettings, "Version", Variant::Type::String, "getVersion", "setVersion"); CLASS_REGISTER_PROPERTY(iOSBuildSettings, "Icon", Variant::Type::ResourcePath, "getIconRes", "setIconRes"); CLASS_REGISTER_PROPERTY(iOSBuildSettings, "HiddenStatusBar", Variant::Type::Bool, "isHiddenStatusBar","setHiddenStatusBar"); // Ui interface orientation CLASS_BIND_METHOD(iOSBuildSettings, isUIInterfaceOrientationPortrait, DEF_METHOD("isUIInterfaceOrientationPortrait")); CLASS_BIND_METHOD(iOSBuildSettings, setUIInterfaceOrientationPortrait, DEF_METHOD("setUIInterfaceOrientationPortrait")); CLASS_BIND_METHOD(iOSBuildSettings, isUIInterfaceOrientationPortraitUpsideDown, DEF_METHOD("isUIInterfaceOrientationPortraitUpsideDown")); CLASS_BIND_METHOD(iOSBuildSettings, setUIInterfaceOrientationPortraitUpsideDown,DEF_METHOD("setUIInterfaceOrientationPortraitUpsideDown")); CLASS_BIND_METHOD(iOSBuildSettings, isUIInterfaceOrientationLandscapeLeft, DEF_METHOD("isUIInterfaceOrientationLandscapeLeft")); CLASS_BIND_METHOD(iOSBuildSettings, setUIInterfaceOrientationLandscapeLeft, DEF_METHOD("setUIInterfaceOrientationLandscapeLeft")); CLASS_BIND_METHOD(iOSBuildSettings, isUIInterfaceOrientationLandscapeRight, DEF_METHOD("isUIInterfaceOrientationLandscapeRight")); CLASS_BIND_METHOD(iOSBuildSettings, setUIInterfaceOrientationLandscapeRight, DEF_METHOD("setUIInterfaceOrientationLandscapeRight")); CLASS_REGISTER_PROPERTY(iOSBuildSettings, "Portrait", Variant::Type::Bool, "isUIInterfaceOrientationPortrait", "setUIInterfaceOrientationPortrait"); CLASS_REGISTER_PROPERTY(iOSBuildSettings, "PortraitUpsideDown", Variant::Type::Bool, "isUIInterfaceOrientationPortraitUpsideDown", "setUIInterfaceOrientationPortraitUpsideDown"); CLASS_REGISTER_PROPERTY(iOSBuildSettings, "LandscapeLeft", Variant::Type::Bool, "isUIInterfaceOrientationLandscapeLeft", "setUIInterfaceOrientationLandscapeLeft"); CLASS_REGISTER_PROPERTY(iOSBuildSettings, "LandscapeRight", Variant::Type::Bool, "isUIInterfaceOrientationLandscapeRight", "setUIInterfaceOrientationLandscapeRight"); CLASS_REGISTER_PROPERTY_HINT(iOSBuildSettings, "Portrait", PropertyHintType::Category, "Device Orientation"); CLASS_REGISTER_PROPERTY_HINT(iOSBuildSettings, "PortraitUpsideDown", PropertyHintType::Category, "Device Orientation"); CLASS_REGISTER_PROPERTY_HINT(iOSBuildSettings, "LandscapeLeft", PropertyHintType::Category, "Device Orientation"); CLASS_REGISTER_PROPERTY_HINT(iOSBuildSettings, "LandscapeRight", PropertyHintType::Category, "Device Orientation"); } ImagePtr iOSBuildSettings::getPlatformThumbnail() const { return Image::loadFromFile(Engine::instance()->getRootPath() + "editor/echo/Editor/Modules/build/editor/icon/ios.png"); } void iOSBuildSettings::configAppIcons() { m_appIcons.emplace_back(20); m_appIcons.emplace_back(29); m_appIcons.emplace_back(40); m_appIcons.emplace_back(58); m_appIcons.emplace_back(60); m_appIcons.emplace_back(76); m_appIcons.emplace_back(80); m_appIcons.emplace_back(87); m_appIcons.emplace_back(120); m_appIcons.emplace_back(152); m_appIcons.emplace_back(167); m_appIcons.emplace_back(180); m_appIcons.emplace_back(1024); } void iOSBuildSettings::configLaunchImages() { // https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/launch-screen/ // iphone se m_launchImages.emplace_back(320, 568, 2, DeviceType::iPhone); // iphone6s,iphone7,iphone8 m_launchImages.emplace_back(375, 667, 2, DeviceType::iPhone); // iphone6s plus, iphone7 plus, iphone8 plus m_launchImages.emplace_back(414, 736, 3, DeviceType::iPhone); // iphoneX, iphoneXs 1125px × 2436px m_launchImages.emplace_back(375, 812, 3, DeviceType::iPhone); // iphone XR m_launchImages.emplace_back(414, 896, 2, DeviceType::iPhone); // iphone Xs Max m_launchImages.emplace_back(414, 896, 3, DeviceType::iPhone); // ipad mini, ipad m_launchImages.emplace_back(1024, 768, 2, DeviceType::iPad); // 10.5 iPad pro m_launchImages.emplace_back(1112, 834, 2, DeviceType::iPad); // 11 iPad pro m_launchImages.emplace_back(1194, 834, 2, DeviceType::iPad); // 12.9 iPad pro m_launchImages.emplace_back(1366, 1024, 2, DeviceType::iPad); } void iOSBuildSettings::setOutputDir(const String& outputDir) { m_outputDir = outputDir; PathUtil::FormatPath(m_outputDir, false); } bool iOSBuildSettings::prepare() { m_rootDir = Engine::instance()->getRootPath(); m_projectDir = Engine::instance()->getResPath(); m_outputDir = m_outputDir.empty() ? PathUtil::GetCurrentDir() + "/build/ios/" : m_outputDir; m_solutionDir = m_outputDir + "xcode/"; // delete output dir if(PathUtil::IsDirExist(m_outputDir)) { PathUtil::DelPath(m_outputDir); } // create dir if(!PathUtil::IsDirExist(m_outputDir)) { log("Create output directory : [%s]", m_outputDir.c_str()); PathUtil::CreateDir(m_outputDir); } return true; } void iOSBuildSettings::setIconRes(const ResourcePath& path) { } void iOSBuildSettings::copySrc() { log("Copy Engine Source Code ..."); // copy app PathUtil::CopyDir( m_rootDir + "app/ios/", m_outputDir + "app/ios/"); // copy engine PathUtil::CopyDir( m_rootDir + "engine/", m_outputDir + "engine/"); // copy thirdparty PathUtil::CopyDir( m_rootDir + "thirdparty/", m_outputDir + "thirdparty/"); // copy CMakeLists.txt PathUtil::CopyFilePath( m_rootDir + "CMakeLists.txt", m_outputDir + "CMakeLists.txt"); // copy build script PathUtil::CopyFilePath( m_rootDir + "tool/build/ios/cmake.sh", m_outputDir + "cmake.sh"); } void iOSBuildSettings::copyRes() { log("Convert Project File ..."); // copy res PathUtil::CopyDir( m_projectDir, m_outputDir + "app/ios/resources/data/"); packageRes(m_outputDir + "app/ios/resources/data/"); // rename String projectFile = PathUtil::GetPureFilename( Engine::instance()->getConfig().m_projectFile); PathUtil::RenameFile(m_outputDir + "app/ios/resources/data/" + projectFile, m_outputDir + "app/ios/resources/data/app.echo"); } bool iOSBuildSettings::rescaleIcon( const char* iFilePath, const char* oFilePath, ui32 targetWidth, ui32 targetHeight) { ImageHelper helper; return helper.rescaleImage(iFilePath,oFilePath,targetWidth,targetHeight); } void iOSBuildSettings::replaceIcon() { String iconFullPath = IO::instance()->convertResPathToFullPath( m_iconRes.getPath()); if(PathUtil::IsFileExist(iconFullPath)) { for(const AppIconItem& item : m_appIcons) { String outputPath = m_outputDir + StringUtil::Format("app/ios/Assets.xcassets/AppIcon.appiconset/Icon%dx%d.png", item.m_size, item.m_size); PathUtil::DelPath(outputPath); rescaleIcon( iconFullPath.c_str(), outputPath.c_str(), item.m_size, item.m_size); } } } void iOSBuildSettings::replaceLaunchImage() { } void iOSBuildSettings::cmake() { String workingDir = m_outputDir + "build/ios/"; String cmakeCmd = "sh cmake.sh"; if(!m_listener->onExecCmd(cmakeCmd.c_str(), workingDir.c_str())) { log("exec command [%s] failed.", cmakeCmd.c_str()); } } void iOSBuildSettings::compile() { } void iOSBuildSettings::build() { log("Build App for iOS platform."); m_listener->onBegin(); if(prepare()) { copySrc(); copyRes(); replaceIcon(); replaceLaunchImage(); // overwrite config writeInfoPlist(); writeCMakeList(); writeModuleConfig(); //cmake(); //compile(); } m_listener->onEnd(); } String iOSBuildSettings::getProjectName() const { return PathUtil::GetPureFilename( Engine::instance()->getConfig().m_projectFile, false); } String iOSBuildSettings::getAppName() const { if(m_appName.empty()) return getProjectName(); else return m_appName; } String iOSBuildSettings::getIdentifier() const { if(m_identifier.empty()) { String appName = PathUtil::GetPureFilename( Engine::instance()->getConfig().m_projectFile, false); String identifier = "com.echo." + appName; identifier = StringUtil::Replace( identifier, ' ', '_'); return identifier; } else { return m_identifier; } } String iOSBuildSettings::getFinalResultPath() { String FinalResultPath = m_outputDir + "bin/app/"; return PathUtil::IsDirExist(FinalResultPath) ? FinalResultPath : m_outputDir; } void iOSBuildSettings::writeUIInterfaceOrientationInfo(void* parent) { pugi::xml_node* root_dict = (pugi::xml_node*)(parent); root_dict->append_child("key").append_child(pugi::node_pcdata).set_value("UIRequiresFullScreen"); root_dict->append_child("true"); // https://developer.apple.com/documentation/uikit/uiinterfaceorientation?language=objc root_dict->append_child("key").append_child(pugi::node_pcdata).set_value("UISupportedInterfaceOrientations"); pugi::xml_node orient_node = root_dict->append_child("array"); if(m_uiInterfaceOrientationPortrait) orient_node.append_child("string").append_child(pugi::node_pcdata).set_value("UIInterfaceOrientationPortrait"); if(m_uiInterfaceOrientationPortraitUpsideDown) orient_node.append_child("string").append_child(pugi::node_pcdata).set_value("UIInterfaceOrientationPortraitUpsideDown"); if(m_uiInterfaceOrientationLandscapeLeft) orient_node.append_child("string").append_child(pugi::node_pcdata).set_value("UIInterfaceOrientationLandscapeLeft"); if(m_uiInterfaceOrientationLandscapeRight) orient_node.append_child("string").append_child(pugi::node_pcdata).set_value("UIInterfaceOrientationLandscapeRight"); } void iOSBuildSettings::writeLaunchImageInfo(void* parent) { pugi::xml_node* root_dict = (pugi::xml_node*)(parent); // iphone root_dict->append_child("key").append_child(pugi::node_pcdata).set_value("UILaunchImages~iphone"); pugi::xml_node iphone_node = root_dict->append_child("array"); // ipad root_dict->append_child("key").append_child(pugi::node_pcdata).set_value("UILaunchImages~ipad"); pugi::xml_node ipad_node = root_dict->append_child("array"); for(const LaunchImageItem& image : m_launchImages) { i32 minDimension = std::min<i32>(image.m_width, image.m_height); i32 maxDimension = std::max<i32>(image.m_width, image.m_height); pugi::xml_node dict_parent = image.m_type == DeviceType::iPhone ? iphone_node : ipad_node; if(m_uiInterfaceOrientationPortrait || m_uiInterfaceOrientationPortraitUpsideDown) { pugi::xml_node dict_node = dict_parent.append_child("dict"); dict_node.append_child("key").append_child(pugi::node_pcdata).set_value("UILaunchImageMinimumOSVersion"); dict_node.append_child("string").append_child(pugi::node_pcdata).set_value("8.0"); dict_node.append_child("key").append_child(pugi::node_pcdata).set_value("UILaunchImageName"); dict_node.append_child("string").append_child(pugi::node_pcdata).set_value(image.getPortraitName().c_str()); dict_node.append_child("key").append_child(pugi::node_pcdata).set_value("UILaunchImageOrientation"); dict_node.append_child("string").append_child(pugi::node_pcdata).set_value("Portrait"); dict_node.append_child("key").append_child(pugi::node_pcdata).set_value("UILaunchImageSize"); dict_node.append_child("string").append_child(pugi::node_pcdata).set_value(StringUtil::Format("{%d, %d}", minDimension, maxDimension).c_str()); } if(m_uiInterfaceOrientationLandscapeLeft || m_uiInterfaceOrientationLandscapeRight) { pugi::xml_node dict_node = dict_parent.append_child("dict"); dict_node.append_child("key").append_child(pugi::node_pcdata).set_value("UILaunchImageMinimumOSVersion"); dict_node.append_child("string").append_child(pugi::node_pcdata).set_value("8.0"); dict_node.append_child("key").append_child(pugi::node_pcdata).set_value("UILaunchImageName"); dict_node.append_child("string").append_child(pugi::node_pcdata).set_value(image.getLandscapeName().c_str()); dict_node.append_child("key").append_child(pugi::node_pcdata).set_value("UILaunchImageOrientation"); dict_node.append_child("string").append_child(pugi::node_pcdata).set_value("Landscape"); dict_node.append_child("key").append_child(pugi::node_pcdata).set_value("UILaunchImageSize"); dict_node.append_child("string").append_child(pugi::node_pcdata).set_value(StringUtil::Format("{%d, %d}", maxDimension, minDimension).c_str()); } } } void iOSBuildSettings::writeInfoPlist() { pugi::xml_document doc; pugi::xml_node dec = doc.prepend_child(pugi::node_declaration); dec.append_attribute("version") = "1.0"; dec.append_attribute("encoding") = "utf-8"; pugi::xml_node root_node= doc.append_child("plist" ); root_node.append_attribute("version").set_value("1.0"); pugi::xml_node root_dict = root_node.append_child("dict"); root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("CFBundleVersion"); root_dict.append_child("string").append_child(pugi::node_pcdata).set_value(m_version.c_str()); root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("CFBundleShortVersionString"); root_dict.append_child("string").append_child(pugi::node_pcdata).set_value(m_version.c_str()); root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("CFBundleDevelopmentRegion"); root_dict.append_child("string").append_child(pugi::node_pcdata).set_value("English"); root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("CFBundleExecutable"); root_dict.append_child("string").append_child(pugi::node_pcdata).set_value("$(EXECUTABLE_NAME)"); root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("CFBundleGetInfoString"); root_dict.append_child("string").append_child(pugi::node_pcdata).set_value(""); root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("CFBundleIconName"); root_dict.append_child("string").append_child(pugi::node_pcdata).set_value("AppIcon"); root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("CFBundleIdentifier"); root_dict.append_child("string").append_child(pugi::node_pcdata).set_value(getIdentifier().c_str()); root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("CFBundleInfoDictionaryVersion"); root_dict.append_child("string").append_child(pugi::node_pcdata).set_value("6.0"); root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("CFBundleName"); root_dict.append_child("string").append_child(pugi::node_pcdata).set_value(getAppName().c_str()); root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("CFBundlePackageType"); root_dict.append_child("string").append_child(pugi::node_pcdata).set_value("APPL"); if(m_hiddenStatusBar) { root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("UIStatusBarHidden"); root_dict.append_child("true"); root_dict.append_child("key").append_child(pugi::node_pcdata).set_value("UIViewControllerBasedStatusBarAppearance"); root_dict.append_child("false"); } writeUIInterfaceOrientationInfo(&root_dict); writeLaunchImageInfo(&root_dict); Echo::String savePath = m_outputDir + "app/ios/frame/Platform/iOS/Info.plist"; doc.save_file(savePath.c_str(), "\t", 1U, pugi::encoding_utf8); } void iOSBuildSettings::writeCMakeList() { String cmakeStr; // module String moduleName = StringUtil::Replace(getProjectName(), " ", ""); writeLine( cmakeStr, StringUtil::Format("SET(MODULE_NAME %s)", moduleName.c_str())); // set module path writeLine( cmakeStr, "SET(MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})"); // include directories writeLine( cmakeStr, "INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})"); writeLine( cmakeStr, "INCLUDE_DIRECtORIES(${ECHO_ROOT_PATH})"); // link directories writeLine( cmakeStr, "LINK_DIRECTORIES(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})"); writeLine( cmakeStr, "LINK_DIRECTORIES(${ECHO_LIB_PATH})"); writeLine( cmakeStr, "LINK_DIRECTORIES(${ECHO_ROOT_PATH}/thirdparty/live2d/Cubism31SdkNative-EAP5/Core/lib/ios/)"); // AddFrameWork Macro writeLine( cmakeStr, "MACRO(ADD_FRAMEWORK fwname)"); writeLine( cmakeStr, " SET(FRAMEWORKS \"${FRAMEWORKS} -framework ${fwname}\")"); writeLine( cmakeStr, "ENDMACRO(ADD_FRAMEWORK)"); // Get all project files recursively writeLine( cmakeStr, "FILE(GLOB_RECURSE HEADER_FILES *.h *.inl)"); writeLine( cmakeStr, "FILE(GLOB_RECURSE SOURCE_FILES *.cpp *.m *.mm)"); writeLine( cmakeStr, "SET(ALL_FILES ${HEADER_FILES} ${SOURCE_FILES})"); // group source files writeLine( cmakeStr, "GROUP_FILES(ALL_FILES ${CMAKE_CURRENT_SOURCE_DIR})"); // iOS platform resources writeLine( cmakeStr, "SET(IOS_RESOURCE_FILES"); // icon writeLine( cmakeStr, " ${MODULE_PATH}/Assets.xcassets"); // launch images for(const LaunchImageItem& image : m_launchImages) { if(m_uiInterfaceOrientationPortrait || m_uiInterfaceOrientationPortraitUpsideDown) writeLine( cmakeStr, image.getPortraitPath()); if(m_uiInterfaceOrientationLandscapeLeft || m_uiInterfaceOrientationLandscapeRight) writeLine(cmakeStr, image.getLandscapePath()); } // data writeLine( cmakeStr, " ${MODULE_PATH}/resources/data"); writeLine( cmakeStr, ")"); writeLine( cmakeStr, "SET_SOURCE_FILES_PROPERTIES(${IOS_RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)"); // add framework writeLine( cmakeStr, "ADD_FRAMEWORK(MediaPlayer)"); writeLine( cmakeStr, "ADD_FRAMEWORK(AudioToolbox)"); writeLine( cmakeStr, "ADD_FRAMEWORK(CoreGraphics)"); writeLine( cmakeStr, "ADD_FRAMEWORK(QuartzCore)"); writeLine( cmakeStr, "ADD_FRAMEWORK(UIKit)"); writeLine( cmakeStr, "ADD_FRAMEWORK(GLKit)"); writeLine( cmakeStr, "ADD_FRAMEWORK(OpenGLES)"); writeLine( cmakeStr, "ADD_FRAMEWORK(OpenAL)"); writeLine( cmakeStr, "ADD_FRAMEWORK(CFNetwork)"); writeLine( cmakeStr, "ADD_FRAMEWORK(MobileCoreServices)"); writeLine( cmakeStr, "ADD_FRAMEWORK(SystemConfiguration)"); writeLine( cmakeStr, "ADD_FRAMEWORK(AVFoundation)"); writeLine( cmakeStr, "ADD_FRAMEWORK(AdSupport)"); writeLine( cmakeStr, "ADD_FRAMEWORK(CoreFoundation)"); writeLine( cmakeStr, "ADD_FRAMEWORK(CoreTelephony)"); writeLine( cmakeStr, "ADD_FRAMEWORK(CoreText)"); writeLine( cmakeStr, "ADD_FRAMEWORK(iAd)"); writeLine( cmakeStr, "ADD_FRAMEWORK(StoreKit)"); writeLine( cmakeStr, "ADD_FRAMEWORK(CoreData)"); writeLine( cmakeStr, "ADD_FRAMEWORK(CoreMedia)"); writeLine( cmakeStr, "ADD_FRAMEWORK(CoreMotion)"); writeLine( cmakeStr, "ADD_FRAMEWORK(Security)"); // settings writeLine( cmakeStr, "SET(FRAMEWORKS \"${FRAMEWORKS} -ObjC\")"); writeLine( cmakeStr, "SET(CMAKE_EXE_LINKER_FLAGS ${FRAMEWORKS})"); writeLine( cmakeStr, "SET(CMAKE_OSX_ARCHITECTURES \"${ARCHS_STANDARD}\")"); writeLine( cmakeStr, "ADD_EXECUTABLE(${MODULE_NAME} MACOSX_BUNDLE ${HEADER_FILES} ${SOURCE_FILES} ${IOS_RESOURCE_FILES} CMakeLists.txt)"); // link libraries writeLine( cmakeStr, "TARGET_LINK_LIBRARIES(${MODULE_NAME} engine)"); writeLine( cmakeStr, "TARGET_LINK_LIBRARIES(${MODULE_NAME} pugixml physx spine recast lua freeimage freetype zlib box2d)"); writeLine( cmakeStr, "TARGET_LINK_LIBRARIES(${MODULE_NAME} Live2DCubismCore)"); writeLine( cmakeStr, "TARGET_LINK_LIBRARIES(${MODULE_NAME} glslang spirv-cross)"); // set target properties writeLine( cmakeStr, "SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${MODULE_PATH}/Frame/Platform/iOS/Info.plist)"); writeLine( cmakeStr, "SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD \"c++14\")"); writeLine( cmakeStr, "SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY \"1,2\")"); writeLine( cmakeStr, "SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME \"AppIcon\")"); // for archive https://stackoverflow.com/questions/10715211/cannot-generate-ios-app-archive-in-xcode writeLine( cmakeStr, "SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_SKIP_INSTALL \"No\")"); writeLine( cmakeStr, "SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_INSTALL_PATH \"$(LOCAL_APPS_DIR)\")"); // messages writeLine( cmakeStr, "MESSAGE(STATUS \"Configure iOS App success!\")"); // write to file String savePath = m_outputDir + "app/ios/CMakeLists.txt"; FileHandleDataStream stream(savePath, DataStream::WRITE); if(!stream.fail()) { stream.write(cmakeStr.data(), cmakeStr.size()); stream.close(); } } void iOSBuildSettings::writeModuleConfig() { String moduleSrc; // include writeLine(moduleSrc, "#include <engine/core/main/module.h>\n"); // namespace writeLine(moduleSrc, "namespace Echo\n{"); writeLine(moduleSrc, "\tvoid registerModules()"); writeLine(moduleSrc, "\t{"); vector<Module*>::type* allModules = Module::getAllModules(); if (allModules) { for (Module* module : *allModules) { if (module->isEnable() && !module->isEditorOnly()) writeLine(moduleSrc, StringUtil::Format("\t\tREGISTER_MODULE(%s)", module->getClassName().c_str())); } } // end namespace writeLine(moduleSrc, "\t}\n}\n"); // Write to file String savePath = m_outputDir + "app/ios/frame/Config/ModuleConfig.cpp"; FileHandleDataStream stream(savePath, DataStream::WRITE); if (!stream.fail()) { stream.write(moduleSrc.data(), moduleSrc.size()); stream.close(); } } }
; A145849: a(n) = A145812(2n-1). ; 1,9,33,41,129,137,161,169,513,521,545,553,641,649,673,681,2049,2057,2081,2089,2177,2185,2209,2217,2561,2569,2593,2601,2689,2697,2721,2729,8193,8201,8225,8233,8321,8329,8353,8361,8705,8713,8737,8745,8833,8841,8865,8873,10241,10249,10273,10281,10369,10377,10401,10409,10753,10761,10785,10793,10881,10889,10913,10921,32769,32777,32801,32809,32897,32905,32929,32937,33281,33289,33313,33321,33409,33417,33441,33449,34817,34825,34849,34857,34945,34953,34977,34985,35329,35337,35361,35369,35457,35465,35489,35497,40961,40969,40993,41001,41089,41097,41121,41129,41473,41481,41505,41513,41601,41609,41633,41641,43009,43017,43041,43049,43137,43145,43169,43177,43521,43529,43553,43561,43649,43657,43681,43689,131073,131081,131105,131113,131201,131209,131233,131241,131585,131593,131617,131625,131713,131721,131745,131753,133121,133129,133153,133161,133249,133257,133281,133289,133633,133641,133665,133673,133761,133769,133793,133801,139265,139273,139297,139305,139393,139401,139425,139433,139777,139785,139809,139817,139905,139913,139937,139945,141313,141321,141345,141353,141441,141449,141473,141481,141825,141833,141857,141865,141953,141961,141985,141993,163841,163849,163873,163881,163969,163977,164001,164009,164353,164361,164385,164393,164481,164489,164513,164521,165889,165897,165921,165929,166017,166025,166049,166057,166401,166409,166433,166441,166529,166537,166561,166569,172033,172041,172065,172073,172161,172169,172193,172201,172545,172553,172577,172585,172673,172681,172705,172713,174081,174089,174113,174121,174209,174217,174241,174249,174593,174601 mov $2,$0 mov $5,$0 lpb $2,1 mov $0,$5 sub $2,1 sub $0,$2 mov $3,$0 lpb $0,1 add $3,$0 mov $0,0 gcd $3,281474976710656 mov $4,3 mov $6,0 add $6,$3 mov $7,1 lpe sub $4,$7 mul $6,$4 pow $6,2 add $6,$4 mov $3,$6 div $3,6 add $3,1 add $1,$3 lpe div $1,4 mul $1,8 add $1,1
; ; PX-8 routines ; by Stefano Bodrato, 2019 ; ; Internal use routine, SLVFLG must be set first. ; ; $Id: subcpu_call.asm $ ; ; ; IN: HL = packet descriptor ; SECTION code_clib PUBLIC subcpu_call PUBLIC _subcpu_call subcpu_call: _subcpu_call: ex de,hl ; ld hl,(1) ; Use WBOOT address to find the first entry in the BIOS jp table ld bc,$f358 ld a,$eb ; Overseas version ? ( HC-80 should be $E7, HC-88 is probably $C1) cp h jr z,european ld bc,$f080 .european push bc ld a,$ff ; SLVFLAG, enable all the communications with the slave CPU ld (bc),a ld a,$72 ; slave BIOS call offset add l ld l,a ld bc,retaddr push bc jp (hl) .retaddr pop hl ld (hl),0 ; restore SLVFLAG ld l,a ; return status from the slave BIOS call ld h,0 ret
; Graciously aped from http://nocash.emubase.de/pandocs.htm . ; MBC3 MBC3SRamEnable EQU $0000 MBC3RomBank EQU $2000 MBC3SRamBank EQU $4000 MBC3LatchClock EQU $6000 MBC3RTC EQU $a000 SRAM_DISABLE EQU $00 SRAM_ENABLE EQU $0a NUM_SRAM_BANKS EQU 4 RTC_S EQU $08 ; Seconds 0-59 (0-3Bh) RTC_M EQU $09 ; Minutes 0-59 (0-3Bh) RTC_H EQU $0a ; Hours 0-23 (0-17h) RTC_DL EQU $0b ; Lower 8 bits of Day Counter (0-FFh) RTC_DH EQU $0c ; Upper 1 bit of Day Counter, Carry Bit, Halt Flag ; Bit 0 Most significant bit of Day Counter (Bit 8) ; Bit 6 Halt (0=Active, 1=Stop Timer) ; Bit 7 Day Counter Carry Bit (1=Counter Overflow) ; interrupt flags VBLANK EQU 0 LCD_STAT EQU 1 TIMER EQU 2 SERIAL EQU 3 JOYPAD EQU 4 ; OAM attribute flags OAM_PALETTE EQU %111 OAM_TILE_BANK EQU 3 OAM_OBP_NUM EQU 4 ; Non CGB Mode Only OAM_X_FLIP EQU 5 OAM_Y_FLIP EQU 6 OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) ; Hardware registers rJOYP EQU $ff00 ; Joypad (R/W) rSB EQU $ff01 ; Serial transfer data (R/W) rSC EQU $ff02 ; Serial Transfer Control (R/W) rSC_ON EQU 7 rSC_CGB EQU 1 rSC_CLOCK EQU 0 rDIV EQU $ff04 ; Divider Register (R/W) rTIMA EQU $ff05 ; Timer counter (R/W) rTMA EQU $ff06 ; Timer Modulo (R/W) rTAC EQU $ff07 ; Timer Control (R/W) rTAC_ON EQU 2 rTAC_4096_HZ EQU 0 rTAC_262144_HZ EQU 1 rTAC_65536_HZ EQU 2 rTAC_16384_HZ EQU 3 rIF EQU $ff0f ; Interrupt Flag (R/W) rNR10 EQU $ff10 ; Channel 1 Sweep register (R/W) rNR11 EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W) rNR12 EQU $ff12 ; Channel 1 Volume Envelope (R/W) rNR13 EQU $ff13 ; Channel 1 Frequency lo (Write Only) rNR14 EQU $ff14 ; Channel 1 Frequency hi (R/W) rNR21 EQU $ff16 ; Channel 2 Sound Length/Wave Pattern Duty (R/W) rNR22 EQU $ff17 ; Channel 2 Volume Envelope (R/W) rNR23 EQU $ff18 ; Channel 2 Frequency lo data (W) rNR24 EQU $ff19 ; Channel 2 Frequency hi data (R/W) rNR30 EQU $ff1a ; Channel 3 Sound on/off (R/W) rNR31 EQU $ff1b ; Channel 3 Sound Length rNR32 EQU $ff1c ; Channel 3 Select output level (R/W) rNR33 EQU $ff1d ; Channel 3 Frequency's lower data (W) rNR34 EQU $ff1e ; Channel 3 Frequency's higher data (R/W) rNR41 EQU $ff20 ; Channel 4 Sound Length (R/W) rNR42 EQU $ff21 ; Channel 4 Volume Envelope (R/W) rNR43 EQU $ff22 ; Channel 4 Polynomial Counter (R/W) rNR44 EQU $ff23 ; Channel 4 Counter/consecutive; Inital (R/W) rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W) rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W) rNR52 EQU $ff26 ; Sound on/off rLCDC EQU $ff40 ; LCD Control (R/W) rSTAT EQU $ff41 ; LCDC Status (R/W) rSCY EQU $ff42 ; Scroll Y (R/W) rSCX EQU $ff43 ; Scroll X (R/W) rLY EQU $ff44 ; LCDC Y-Coordinate (R) rLYC EQU $ff45 ; LY Compare (R/W) rDMA EQU $ff46 ; DMA Transfer and Start Address (W) rBGP EQU $ff47 ; BG Palette Data (R/W) - Non CGB Mode Only rOBP0 EQU $ff48 ; Object Palette 0 Data (R/W) - Non CGB Mode Only rOBP1 EQU $ff49 ; Object Palette 1 Data (R/W) - Non CGB Mode Only rWY EQU $ff4a ; Window Y Position (R/W) rWX EQU $ff4b ; Window X Position minus 7 (R/W) rKEY1 EQU $ff4d ; CGB Mode Only - Prepare Speed Switch rVBK EQU $ff4f ; CGB Mode Only - VRAM Bank rHDMA1 EQU $ff51 ; CGB Mode Only - New DMA Source, High rHDMA2 EQU $ff52 ; CGB Mode Only - New DMA Source, Low rHDMA3 EQU $ff53 ; CGB Mode Only - New DMA Destination, High rHDMA4 EQU $ff54 ; CGB Mode Only - New DMA Destination, Low rHDMA5 EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port rBGPI EQU $ff68 ; CGB Mode Only - Background Palette Index rBGPD EQU $ff69 ; CGB Mode Only - Background Palette Data rOBPI EQU $ff6a ; CGB Mode Only - Sprite Palette Index rOBPD EQU $ff6b ; CGB Mode Only - Sprite Palette Data rUNKNOWN1 EQU $ff6c ; (FEh) Bit 0 (Read/Write) - CGB Mode Only rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank rUNKNOWN2 EQU $ff72 ; (00h) - Bit 0-7 (Read/Write) rUNKNOWN3 EQU $ff73 ; (00h) - Bit 0-7 (Read/Write) rUNKNOWN4 EQU $ff74 ; (00h) - Bit 0-7 (Read/Write) - CGB Mode Only rUNKNOWN5 EQU $ff75 ; (8Fh) - Bit 4-6 (Read/Write) rUNKNOWN6 EQU $ff76 ; (00h) - Always 00h (Read Only) rUNKNOWN7 EQU $ff77 ; (00h) - Always 00h (Read Only) rIE EQU $ffff ; Interrupt Enable (R/W)
//================================================================================================= /*! // \file src/eigen/TMat3TMat3Add.cpp // \brief Source file for the Eigen 3D transpose matrix/transpose matrix addition kernel // // Copyright (C) 2012-2018 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. 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. // 3. Neither the names of the Blaze development group 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. */ //================================================================================================= //************************************************************************************************* // Includes //************************************************************************************************* #include <iostream> #include <vector> #include <Eigen/Dense> #include <blaze/util/Timing.h> #include <blazemark/eigen/init/Matrix.h> #include <blazemark/eigen/TMat3TMat3Add.h> #include <blazemark/system/Config.h> namespace blazemark { namespace eigen { //================================================================================================= // // KERNEL FUNCTIONS // //================================================================================================= //************************************************************************************************* /*!\brief Eigen uBLAS 3-dimensional transpose matrix/transpose matrix addition kernel. // // \param N The number of 3x3 matrices to be computed. // \param steps The number of iteration steps to perform. // \return Minimum runtime of the kernel function. // // This kernel function implements the 3-dimensional transpose matrix/transpose matrix addition // by means of the Eigen functionality. */ double tmat3tmat3add( size_t N, size_t steps ) { using ::blazemark::element_t; using ::Eigen::Dynamic; using ::Eigen::ColMajor; ::blaze::setSeed( seed ); ::std::vector< ::Eigen::Matrix<element_t,3,3,ColMajor> > A( N ), B( N ), C( N ); ::blaze::timing::WcTimer timer; for( size_t i=0UL; i<N; ++i ) { init( A[i] ); init( B[i] ); } for( size_t i=0UL; i<N; ++i ) { C[i].noalias() = A[i] + B[i]; } for( size_t rep=0UL; rep<reps; ++rep ) { timer.start(); for( size_t step=0UL, i=0UL; step<steps; ++step, ++i ) { if( i == N ) i = 0UL; C[i].noalias() = A[i] + B[i]; } timer.end(); for( size_t i=0UL; i<N; ++i ) if( C[i](0,0) < element_t(0) ) std::cerr << " Line " << __LINE__ << ": ERROR detected!!!\n"; if( timer.last() > maxtime ) break; } const double minTime( timer.min() ); const double avgTime( timer.average() ); if( minTime * ( 1.0 + deviation*0.01 ) < avgTime ) std::cerr << " Eigen kernel 'tmat3tmat3add': Time deviation too large!!!\n"; return minTime; } //************************************************************************************************* } // namespace eigen } // namespace blazemark
; ============================================================================= ; Ultima Underworld Hacks -- additional character mappings ; ----------------------------------------------------------------------------- ; mapScancodeToCharacter scancode, character %macro mapScancodeToCharacter 2 %define scancode_%[mappedCharacterCount] %1 %define character_%[mappedCharacterCount] %2 %assign mappedCharacterCount mappedCharacterCount + 1 %endmacro ; mapScancodeToCharacter scancode, character, characterName %macro mapScancodeToCharacter 3 mapScancodeToCharacter %1, %2 ; define a macro naming the character %define %3 %2 %endmacro %assign mappedCharacterCount 0 ; each key mapped with and without Shift modifier (S|): mapScancodeToCharacter ( 0x2A), 0xB0, LShift mapScancodeToCharacter (S|0x2A), 0xB0 mapScancodeToCharacter ( 0x36), 0xB1, RShift mapScancodeToCharacter (S|0x36), 0xB1 mapScancodeToCharacter ( 0x1D), 0xB2, LCtrl mapScancodeToCharacter (S|0x1D), 0xB2 mapScancodeToCharacter 0x62, 0xB3, RCtrl mapScancodeToCharacter S|0x62, 0xB3 mapScancodeToCharacter 0x38, 0xB4, LAlt mapScancodeToCharacter S|0x38, 0xB4 mapScancodeToCharacter 0x65, 0xB5, RAlt mapScancodeToCharacter S|0x65, 0xB5
;******************************************************************************* ;* TMS320C55x C/C++ Codegen PC v4.4.1 * ;* Date/Time created: Sat Oct 06 06:37:32 2018 * ;******************************************************************************* .compiler_opts --hll_source=on --mem_model:code=flat --mem_model:data=large --object_format=coff --silicon_core_3_3 --symdebug:dwarf .mmregs .cpl_on .arms_on .c54cm_off .asg AR6, FP .asg XAR6, XFP .asg DPH, MDP .model call=c55_std .model mem=large .noremark 5002 ; code respects overwrite rules ;******************************************************************************* ;* GLOBAL FILE PARAMETERS * ;* * ;* Architecture : TMS320C55x * ;* Optimizing for : Speed * ;* Memory : Large Model (23-Bit Data Pointers) * ;* Calls : Normal Library ASM calls * ;* Debug Info : Standard TI Debug Information * ;******************************************************************************* $C$DW$CU .dwtag DW_TAG_compile_unit .dwattr $C$DW$CU, DW_AT_name("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$CU, DW_AT_producer("TMS320C55x C/C++ Codegen PC v4.4.1 Copyright (c) 1996-2012 Texas Instruments Incorporated") .dwattr $C$DW$CU, DW_AT_TI_version(0x01) .dwattr $C$DW$CU, DW_AT_comp_dir("F:\eZdsp_DBG\tmp1\c55x-sim2\foo\Debug") ; F:\t\cc5p5\ccsv5\tools\compiler\c5500_4.4.1\bin\acp55.exe -@f:\\AppData\\Local\\Temp\\0929612 .sect ".text" .align 4 .global _GPIO_open $C$DW$1 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_open") .dwattr $C$DW$1, DW_AT_low_pc(_GPIO_open) .dwattr $C$DW$1, DW_AT_high_pc(0x00) .dwattr $C$DW$1, DW_AT_TI_symbol_name("_GPIO_open") .dwattr $C$DW$1, DW_AT_external .dwattr $C$DW$1, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$1, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$1, DW_AT_TI_begin_line(0x41) .dwattr $C$DW$1, DW_AT_TI_begin_column(0x0d) .dwattr $C$DW$1, DW_AT_TI_max_frame_size(0x08) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 69,column 1,is_stmt,address _GPIO_open .dwfde $C$DW$CIE, _GPIO_open $C$DW$2 .dwtag DW_TAG_formal_parameter, DW_AT_name("GpioObj") .dwattr $C$DW$2, DW_AT_TI_symbol_name("_GpioObj") .dwattr $C$DW$2, DW_AT_type(*$C$DW$T$38) .dwattr $C$DW$2, DW_AT_location[DW_OP_reg17] $C$DW$3 .dwtag DW_TAG_formal_parameter, DW_AT_name("status") .dwattr $C$DW$3, DW_AT_TI_symbol_name("_status") .dwattr $C$DW$3, DW_AT_type(*$C$DW$T$42) .dwattr $C$DW$3, DW_AT_location[DW_OP_reg19] ;******************************************************************************* ;* FUNCTION NAME: GPIO_open * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,AR0,XAR0,AR1,XAR1,AR3,XAR3,SP,TC1, * ;* M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 8 words * ;* (2 return address/alignment) * ;* (6 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_open: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-7, SP .dwcfi cfa_offset, 8 $C$DW$4 .dwtag DW_TAG_variable, DW_AT_name("GpioObj") .dwattr $C$DW$4, DW_AT_TI_symbol_name("_GpioObj") .dwattr $C$DW$4, DW_AT_type(*$C$DW$T$38) .dwattr $C$DW$4, DW_AT_location[DW_OP_bregx 0x24 0] $C$DW$5 .dwtag DW_TAG_variable, DW_AT_name("status") .dwattr $C$DW$5, DW_AT_TI_symbol_name("_status") .dwattr $C$DW$5, DW_AT_type(*$C$DW$T$42) .dwattr $C$DW$5, DW_AT_location[DW_OP_bregx 0x24 2] $C$DW$6 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$6, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$6, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$6, DW_AT_location[DW_OP_bregx 0x24 4] MOV XAR1, dbl(*SP(#2)) MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 70,column 17,is_stmt MOV #0, AC0 ; |70| MOV AC0, dbl(*SP(#4)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 72,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |72| CMPU AC1 != AC0, TC1 ; |72| BCC $C$L1,TC1 ; |72| ; branchcc occurs ; |72| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 74,column 9,is_stmt MOV dbl(*SP(#2)), XAR3 MOV #-5, *AR3 ; |74| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 75,column 9,is_stmt AMOV #0, XAR0 ; |75| B $C$L2 ; |75| ; branch occurs ; |75| $C$L1: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 78,column 5,is_stmt MOV #32, *AR3(short(#1)) ; |78| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 80,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV #7168, *AR3 ; |80| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 81,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, dbl(*SP(#4)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 82,column 5,is_stmt MOV dbl(*SP(#2)), XAR3 MOV #0, *AR3 ; |82| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 84,column 5,is_stmt MOV dbl(*SP(#4)), XAR0 $C$L2: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 85,column 1,is_stmt AADD #7, SP .dwcfi cfa_offset, 1 $C$DW$7 .dwtag DW_TAG_TI_branch .dwattr $C$DW$7, DW_AT_low_pc(0x00) .dwattr $C$DW$7, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$1, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$1, DW_AT_TI_end_line(0x55) .dwattr $C$DW$1, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$1 .sect ".text" .align 4 .global _GPIO_close $C$DW$8 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_close") .dwattr $C$DW$8, DW_AT_low_pc(_GPIO_close) .dwattr $C$DW$8, DW_AT_high_pc(0x00) .dwattr $C$DW$8, DW_AT_TI_symbol_name("_GPIO_close") .dwattr $C$DW$8, DW_AT_external .dwattr $C$DW$8, DW_AT_type(*$C$DW$T$41) .dwattr $C$DW$8, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$8, DW_AT_TI_begin_line(0x78) .dwattr $C$DW$8, DW_AT_TI_begin_column(0x0d) .dwattr $C$DW$8, DW_AT_TI_max_frame_size(0x04) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 123,column 1,is_stmt,address _GPIO_close .dwfde $C$DW$CIE, _GPIO_close $C$DW$9 .dwtag DW_TAG_formal_parameter, DW_AT_name("hGpio") .dwattr $C$DW$9, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$9, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$9, DW_AT_location[DW_OP_reg17] ;******************************************************************************* ;* FUNCTION NAME: GPIO_close * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,T0,AR0,XAR0,AR3,XAR3,SP,TC1,M40,SATA,* ;* SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 4 words * ;* (2 return address/alignment) * ;* (2 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_close: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-3, SP .dwcfi cfa_offset, 4 $C$DW$10 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$10, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$10, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$10, DW_AT_location[DW_OP_bregx 0x24 0] MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 125,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |125| CMPU AC1 != AC0, TC1 ; |125| BCC $C$L3,TC1 ; |125| ; branchcc occurs ; |125| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 127,column 9,is_stmt MOV #-5, T0 B $C$L4 ; |127| ; branch occurs ; |127| $C$L3: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 129,column 5,is_stmt MOV #0, *AR3 ; |129| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 130,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV #0, *AR3(short(#1)) ; |130| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 132,column 5,is_stmt MOV #0, T0 $C$L4: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 133,column 1,is_stmt AADD #3, SP .dwcfi cfa_offset, 1 $C$DW$11 .dwtag DW_TAG_TI_branch .dwattr $C$DW$11, DW_AT_low_pc(0x00) .dwattr $C$DW$11, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$8, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$8, DW_AT_TI_end_line(0x85) .dwattr $C$DW$8, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$8 .sect ".text" .align 4 .global _GPIO_config $C$DW$12 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_config") .dwattr $C$DW$12, DW_AT_low_pc(_GPIO_config) .dwattr $C$DW$12, DW_AT_high_pc(0x00) .dwattr $C$DW$12, DW_AT_TI_symbol_name("_GPIO_config") .dwattr $C$DW$12, DW_AT_external .dwattr $C$DW$12, DW_AT_type(*$C$DW$T$41) .dwattr $C$DW$12, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$12, DW_AT_TI_begin_line(0xba) .dwattr $C$DW$12, DW_AT_TI_begin_column(0x0d) .dwattr $C$DW$12, DW_AT_TI_max_frame_size(0x06) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 190,column 1,is_stmt,address _GPIO_config .dwfde $C$DW$CIE, _GPIO_config $C$DW$13 .dwtag DW_TAG_formal_parameter, DW_AT_name("hGpio") .dwattr $C$DW$13, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$13, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$13, DW_AT_location[DW_OP_reg17] $C$DW$14 .dwtag DW_TAG_formal_parameter, DW_AT_name("config") .dwattr $C$DW$14, DW_AT_TI_symbol_name("_config") .dwattr $C$DW$14, DW_AT_type(*$C$DW$T$45) .dwattr $C$DW$14, DW_AT_location[DW_OP_reg19] ;******************************************************************************* ;* FUNCTION NAME: GPIO_config * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,T0,AR0,XAR0,AR1,XAR1,AR3,XAR3,SP,TC1,* ;* M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 6 words * ;* (2 return address/alignment) * ;* (4 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_config: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-5, SP .dwcfi cfa_offset, 6 $C$DW$15 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$15, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$15, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$15, DW_AT_location[DW_OP_bregx 0x24 0] $C$DW$16 .dwtag DW_TAG_variable, DW_AT_name("config") .dwattr $C$DW$16, DW_AT_TI_symbol_name("_config") .dwattr $C$DW$16, DW_AT_type(*$C$DW$T$45) .dwattr $C$DW$16, DW_AT_location[DW_OP_bregx 0x24 2] MOV XAR1, dbl(*SP(#2)) MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 192,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |192| CMPU AC1 != AC0, TC1 ; |192| BCC $C$L5,TC1 ; |192| ; branchcc occurs ; |192| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 194,column 9,is_stmt MOV #-5, T0 B $C$L7 ; |194| ; branch occurs ; |194| $C$L5: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 196,column 5,is_stmt MOV dbl(*SP(#2)), XAR3 MOV XAR3, AC0 CMPU AC1 != AC0, TC1 ; |196| BCC $C$L6,TC1 ; |196| ; branchcc occurs ; |196| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 198,column 9,is_stmt MOV #-6, T0 B $C$L7 ; |198| ; branch occurs ; |198| $C$L6: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 201,column 5,is_stmt MOV *AR3, AR1 ; |201| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |201| MOV AR1, port(*AR3(short(#6))) ; |201| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 202,column 5,is_stmt MOV dbl(*SP(#2)), XAR3 MOV *AR3(short(#1)), AR1 ; |202| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |202| MOV AR1, port(*AR3(short(#7))) ; |202| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 204,column 5,is_stmt MOV dbl(*SP(#2)), XAR3 MOV *AR3(short(#2)), AR1 ; |204| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |204| AMOV #12, T0 MOV AR1, port(*AR3(T0)) ; |204| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 205,column 5,is_stmt MOV dbl(*SP(#2)), XAR3 MOV *AR3(short(#3)), AR1 ; |205| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |205| AMOV #13, T0 MOV AR1, port(*AR3(T0)) ; |205| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 207,column 5,is_stmt MOV dbl(*SP(#2)), XAR3 MOV *AR3(short(#4)), AR1 ; |207| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |207| AMOV #14, T0 MOV AR1, port(*AR3(T0)) ; |207| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 208,column 5,is_stmt MOV dbl(*SP(#2)), XAR3 MOV *AR3(short(#5)), AR1 ; |208| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |208| AMOV #15, T0 MOV AR1, port(*AR3(T0)) ; |208| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 210,column 5,is_stmt MOV #0, T0 $C$L7: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 211,column 1,is_stmt AADD #5, SP .dwcfi cfa_offset, 1 $C$DW$17 .dwtag DW_TAG_TI_branch .dwattr $C$DW$17, DW_AT_low_pc(0x00) .dwattr $C$DW$17, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$12, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$12, DW_AT_TI_end_line(0xd3) .dwattr $C$DW$12, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$12 .sect ".text" .align 4 .global _GPIO_getConfig $C$DW$18 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_getConfig") .dwattr $C$DW$18, DW_AT_low_pc(_GPIO_getConfig) .dwattr $C$DW$18, DW_AT_high_pc(0x00) .dwattr $C$DW$18, DW_AT_TI_symbol_name("_GPIO_getConfig") .dwattr $C$DW$18, DW_AT_external .dwattr $C$DW$18, DW_AT_type(*$C$DW$T$41) .dwattr $C$DW$18, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$18, DW_AT_TI_begin_line(0x102) .dwattr $C$DW$18, DW_AT_TI_begin_column(0x0d) .dwattr $C$DW$18, DW_AT_TI_max_frame_size(0x06) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 262,column 1,is_stmt,address _GPIO_getConfig .dwfde $C$DW$CIE, _GPIO_getConfig $C$DW$19 .dwtag DW_TAG_formal_parameter, DW_AT_name("hGpio") .dwattr $C$DW$19, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$19, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$19, DW_AT_location[DW_OP_reg17] $C$DW$20 .dwtag DW_TAG_formal_parameter, DW_AT_name("config") .dwattr $C$DW$20, DW_AT_TI_symbol_name("_config") .dwattr $C$DW$20, DW_AT_type(*$C$DW$T$45) .dwattr $C$DW$20, DW_AT_location[DW_OP_reg19] ;******************************************************************************* ;* FUNCTION NAME: GPIO_getConfig * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,T0,AR0,XAR0,AR1,XAR1,AR3,XAR3,SP,TC1,* ;* M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 6 words * ;* (2 return address/alignment) * ;* (4 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_getConfig: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-5, SP .dwcfi cfa_offset, 6 $C$DW$21 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$21, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$21, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$21, DW_AT_location[DW_OP_bregx 0x24 0] $C$DW$22 .dwtag DW_TAG_variable, DW_AT_name("config") .dwattr $C$DW$22, DW_AT_TI_symbol_name("_config") .dwattr $C$DW$22, DW_AT_type(*$C$DW$T$45) .dwattr $C$DW$22, DW_AT_location[DW_OP_bregx 0x24 2] MOV XAR1, dbl(*SP(#2)) MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 264,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |264| CMPU AC1 != AC0, TC1 ; |264| BCC $C$L8,TC1 ; |264| ; branchcc occurs ; |264| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 266,column 9,is_stmt MOV #-5, T0 B $C$L10 ; |266| ; branch occurs ; |266| $C$L8: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 269,column 5,is_stmt MOV dbl(*SP(#2)), XAR3 MOV XAR3, AC0 CMPU AC1 != AC0, TC1 ; |269| BCC $C$L9,TC1 ; |269| ; branchcc occurs ; |269| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 271,column 9,is_stmt MOV #-6, T0 B $C$L10 ; |271| ; branch occurs ; |271| $C$L9: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 274,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |274| MOV port(*AR3(short(#6))), AR1 ; |274| MOV dbl(*SP(#2)), XAR3 MOV AR1, *AR3 ; |274| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 275,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |275| MOV port(*AR3(short(#7))), AR1 ; |275| MOV dbl(*SP(#2)), XAR3 MOV AR1, *AR3(short(#1)) ; |275| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 278,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |278| AMOV #12, T0 MOV port(*AR3(T0)), AR1 ; |278| MOV dbl(*SP(#2)), XAR3 MOV AR1, *AR3(short(#2)) ; |278| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 279,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |279| AMOV #13, T0 MOV port(*AR3(T0)), AR1 ; |279| MOV dbl(*SP(#2)), XAR3 MOV AR1, *AR3(short(#3)) ; |279| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 282,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |282| AMOV #14, T0 MOV port(*AR3(T0)), AR1 ; |282| MOV dbl(*SP(#2)), XAR3 MOV AR1, *AR3(short(#4)) ; |282| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 283,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |283| AMOV #15, T0 MOV port(*AR3(T0)), AR1 ; |283| MOV dbl(*SP(#2)), XAR3 MOV AR1, *AR3(short(#5)) ; |283| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 285,column 5,is_stmt MOV #0, T0 $C$L10: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 286,column 1,is_stmt AADD #5, SP .dwcfi cfa_offset, 1 $C$DW$23 .dwtag DW_TAG_TI_branch .dwattr $C$DW$23, DW_AT_low_pc(0x00) .dwattr $C$DW$23, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$18, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$18, DW_AT_TI_end_line(0x11e) .dwattr $C$DW$18, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$18 .sect ".text" .align 4 .global _GPIO_read $C$DW$24 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_read") .dwattr $C$DW$24, DW_AT_low_pc(_GPIO_read) .dwattr $C$DW$24, DW_AT_high_pc(0x00) .dwattr $C$DW$24, DW_AT_TI_symbol_name("_GPIO_read") .dwattr $C$DW$24, DW_AT_external .dwattr $C$DW$24, DW_AT_type(*$C$DW$T$41) .dwattr $C$DW$24, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$24, DW_AT_TI_begin_line(0x155) .dwattr $C$DW$24, DW_AT_TI_begin_column(0x0c) .dwattr $C$DW$24, DW_AT_TI_max_frame_size(0x08) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 346,column 1,is_stmt,address _GPIO_read .dwfde $C$DW$CIE, _GPIO_read $C$DW$25 .dwtag DW_TAG_formal_parameter, DW_AT_name("hGpio") .dwattr $C$DW$25, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$25, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$25, DW_AT_location[DW_OP_reg17] $C$DW$26 .dwtag DW_TAG_formal_parameter, DW_AT_name("pinNum") .dwattr $C$DW$26, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$26, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$26, DW_AT_location[DW_OP_reg12] $C$DW$27 .dwtag DW_TAG_formal_parameter, DW_AT_name("buffer") .dwattr $C$DW$27, DW_AT_TI_symbol_name("_buffer") .dwattr $C$DW$27, DW_AT_type(*$C$DW$T$50) .dwattr $C$DW$27, DW_AT_location[DW_OP_reg19] ;******************************************************************************* ;* FUNCTION NAME: GPIO_read * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,T0,T1,AR0,XAR0,AR1,XAR1,AR2,AR3,XAR3,* ;* SP,CARRY,TC1,M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 8 words * ;* (1 return address/alignment) * ;* (7 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_read: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-7, SP .dwcfi cfa_offset, 8 $C$DW$28 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$28, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$28, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$28, DW_AT_location[DW_OP_bregx 0x24 0] $C$DW$29 .dwtag DW_TAG_variable, DW_AT_name("pinNum") .dwattr $C$DW$29, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$29, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$29, DW_AT_location[DW_OP_bregx 0x24 2] $C$DW$30 .dwtag DW_TAG_variable, DW_AT_name("buffer") .dwattr $C$DW$30, DW_AT_TI_symbol_name("_buffer") .dwattr $C$DW$30, DW_AT_type(*$C$DW$T$50) .dwattr $C$DW$30, DW_AT_location[DW_OP_bregx 0x24 4] $C$DW$31 .dwtag DW_TAG_variable, DW_AT_name("pin") .dwattr $C$DW$31, DW_AT_TI_symbol_name("_pin") .dwattr $C$DW$31, DW_AT_type(*$C$DW$T$19) .dwattr $C$DW$31, DW_AT_location[DW_OP_bregx 0x24 6] MOV XAR1, dbl(*SP(#4)) MOV T0, *SP(#2) ; |346| MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 349,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |349| CMPU AC1 != AC0, TC1 ; |349| BCC $C$L11,TC1 ; |349| ; branchcc occurs ; |349| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 351,column 9,is_stmt MOV #-5, T0 B $C$L16 ; |351| ; branch occurs ; |351| $C$L11: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 354,column 5,is_stmt MOV dbl(*SP(#4)), XAR3 MOV XAR3, AC0 CMPU AC1 == AC0, TC1 ; |354| BCC $C$L12,TC1 ; |354| ; branchcc occurs ; |354| MOV *SP(#2), AR1 ; |354| MOV #31, AR2 ; |354| CMP AR2 < AR1, TC1 ; |354| BCC $C$L12,TC1 ; |354| ; branchcc occurs ; |354| BCC $C$L13,AR1 >= #0 ; |354| ; branchcc occurs ; |354| $C$L12: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 356,column 9,is_stmt MOV #-6, T0 B $C$L16 ; |356| ; branch occurs ; |356| $C$L13: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 359,column 5,is_stmt MOV #16, AR2 ; |359| CMP AR1 >= AR2, TC1 ; |359| BCC $C$L14,TC1 ; |359| ; branchcc occurs ; |359| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 362,column 9,is_stmt MOV *SP(#2), AR1 ; |362| MOV AR1, *SP(#6) ; |362| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 363,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |363| AMOV #8, T0 MOV uns(port(*AR3(T0))), AC0 ; |363| MOV dbl(*SP(#4)), XAR3 NEG AR1, T1 ; |363| SFTS AC0, T1, AC0 ; |363| AND #0x0001, AC0, AC0 ; |363| MOV AC0, *AR3 ; |363| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 364,column 5,is_stmt B $C$L15 ; |364| ; branch occurs ; |364| $C$L14: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 368,column 9,is_stmt SUB #16, AR1, AR1 ; |368| MOV AR1, *SP(#6) ; |368| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 369,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |369| AMOV #9, T0 MOV uns(port(*AR3(T0))), AC0 ; |369| MOV dbl(*SP(#4)), XAR3 NEG AR1, T1 ; |369| SFTS AC0, T1, AC0 ; |369| AND #0x0001, AC0, AC0 ; |369| MOV AC0, *AR3 ; |369| $C$L15: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 371,column 5,is_stmt MOV #0, T0 $C$L16: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 372,column 1,is_stmt AADD #7, SP .dwcfi cfa_offset, 1 $C$DW$32 .dwtag DW_TAG_TI_branch .dwattr $C$DW$32, DW_AT_low_pc(0x00) .dwattr $C$DW$32, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$24, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$24, DW_AT_TI_end_line(0x174) .dwattr $C$DW$24, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$24 .sect ".text" .align 4 .global _GPIO_write $C$DW$33 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_write") .dwattr $C$DW$33, DW_AT_low_pc(_GPIO_write) .dwattr $C$DW$33, DW_AT_high_pc(0x00) .dwattr $C$DW$33, DW_AT_TI_symbol_name("_GPIO_write") .dwattr $C$DW$33, DW_AT_external .dwattr $C$DW$33, DW_AT_type(*$C$DW$T$41) .dwattr $C$DW$33, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$33, DW_AT_TI_begin_line(0x1aa) .dwattr $C$DW$33, DW_AT_TI_begin_column(0x0c) .dwattr $C$DW$33, DW_AT_TI_max_frame_size(0x06) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 431,column 1,is_stmt,address _GPIO_write .dwfde $C$DW$CIE, _GPIO_write $C$DW$34 .dwtag DW_TAG_formal_parameter, DW_AT_name("hGpio") .dwattr $C$DW$34, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$34, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$34, DW_AT_location[DW_OP_reg17] $C$DW$35 .dwtag DW_TAG_formal_parameter, DW_AT_name("pinNum") .dwattr $C$DW$35, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$35, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$35, DW_AT_location[DW_OP_reg12] $C$DW$36 .dwtag DW_TAG_formal_parameter, DW_AT_name("buffer") .dwattr $C$DW$36, DW_AT_TI_symbol_name("_buffer") .dwattr $C$DW$36, DW_AT_type(*$C$DW$T$19) .dwattr $C$DW$36, DW_AT_location[DW_OP_reg13] ;******************************************************************************* ;* FUNCTION NAME: GPIO_write * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,T0,T1,AR0,XAR0,AR1,AR2,AR3,XAR3,SP, * ;* CARRY,TC1,M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 6 words * ;* (1 return address/alignment) * ;* (5 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_write: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-5, SP .dwcfi cfa_offset, 6 $C$DW$37 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$37, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$37, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$37, DW_AT_location[DW_OP_bregx 0x24 0] $C$DW$38 .dwtag DW_TAG_variable, DW_AT_name("pinNum") .dwattr $C$DW$38, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$38, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$38, DW_AT_location[DW_OP_bregx 0x24 2] $C$DW$39 .dwtag DW_TAG_variable, DW_AT_name("buffer") .dwattr $C$DW$39, DW_AT_TI_symbol_name("_buffer") .dwattr $C$DW$39, DW_AT_type(*$C$DW$T$19) .dwattr $C$DW$39, DW_AT_location[DW_OP_bregx 0x24 3] $C$DW$40 .dwtag DW_TAG_variable, DW_AT_name("pin") .dwattr $C$DW$40, DW_AT_TI_symbol_name("_pin") .dwattr $C$DW$40, DW_AT_type(*$C$DW$T$19) .dwattr $C$DW$40, DW_AT_location[DW_OP_bregx 0x24 4] MOV T1, *SP(#3) ; |431| MOV T0, *SP(#2) ; |431| MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 434,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |434| CMPU AC1 != AC0, TC1 ; |434| BCC $C$L17,TC1 ; |434| ; branchcc occurs ; |434| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 436,column 9,is_stmt MOV #-5, T0 B $C$L23 ; |436| ; branch occurs ; |436| $C$L17: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 439,column 5,is_stmt MOV *SP(#2), AR1 ; |439| MOV #31, AR2 ; |439| CMP AR2 < AR1, TC1 ; |439| BCC $C$L18,TC1 ; |439| ; branchcc occurs ; |439| BCC $C$L19,AR1 >= #0 ; |439| ; branchcc occurs ; |439| $C$L18: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 441,column 9,is_stmt MOV #-6, T0 B $C$L23 ; |441| ; branch occurs ; |441| $C$L19: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 444,column 5,is_stmt CMP *SP(#3) == #1, TC1 ; |444| BCC $C$L20,TC1 ; |444| ; branchcc occurs ; |444| MOV *SP(#3), AR1 ; |444| BCC $C$L20,AR1 == #0 ; |444| ; branchcc occurs ; |444| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 446,column 9,is_stmt MOV #-6, T0 B $C$L23 ; |446| ; branch occurs ; |446| $C$L20: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 449,column 5,is_stmt MOV #16, AR2 ; |449| MOV *SP(#2), AR1 ; |449| CMP AR1 >= AR2, TC1 ; |449| BCC $C$L21,TC1 ; |449| ; branchcc occurs ; |449| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 452,column 9,is_stmt MOV *SP(#2), AR1 ; |452| MOV AR1, *SP(#4) ; |452| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 453,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |453| MOV *SP(#4), T1 ; |453| || MOV #1, AC0 SFTS AC0, T1, AC0 ; |453| NOT AC0, AR1 ; |453| || AMOV #10, T0 AND port(*AR3(T0)), AR1, AR1 ; |453| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |453| MOV *SP(#3), AR2 ; |453| AND #0x0001, AR2, AC0 ; |453| SFTL AC0, T1, AC0 ; |453| OR AR1, AC0 ; |453| MOV AC0, port(*AR3(T0)) ; |453| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 454,column 5,is_stmt B $C$L22 ; |454| ; branch occurs ; |454| $C$L21: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 458,column 9,is_stmt SUB #16, AR1, AR1 ; |458| MOV AR1, *SP(#4) ; |458| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 459,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |459| MOV *SP(#4), T1 ; |459| || MOV #1, AC0 SFTS AC0, T1, AC0 ; |459| NOT AC0, AR1 ; |459| || AMOV #11, T0 AND port(*AR3(T0)), AR1, AR1 ; |459| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |459| MOV *SP(#3), AR2 ; |459| AND #0x0001, AR2, AC0 ; |459| SFTL AC0, T1, AC0 ; |459| OR AR1, AC0 ; |459| MOV AC0, port(*AR3(T0)) ; |459| $C$L22: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 461,column 5,is_stmt MOV #0, T0 $C$L23: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 462,column 1,is_stmt AADD #5, SP .dwcfi cfa_offset, 1 $C$DW$41 .dwtag DW_TAG_TI_branch .dwattr $C$DW$41, DW_AT_low_pc(0x00) .dwattr $C$DW$41, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$33, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$33, DW_AT_TI_end_line(0x1ce) .dwattr $C$DW$33, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$33 .sect ".text" .align 4 .global _GPIO_configBit $C$DW$42 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_configBit") .dwattr $C$DW$42, DW_AT_low_pc(_GPIO_configBit) .dwattr $C$DW$42, DW_AT_high_pc(0x00) .dwattr $C$DW$42, DW_AT_TI_symbol_name("_GPIO_configBit") .dwattr $C$DW$42, DW_AT_external .dwattr $C$DW$42, DW_AT_type(*$C$DW$T$41) .dwattr $C$DW$42, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$42, DW_AT_TI_begin_line(0x1ff) .dwattr $C$DW$42, DW_AT_TI_begin_column(0x0c) .dwattr $C$DW$42, DW_AT_TI_max_frame_size(0x06) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 515,column 1,is_stmt,address _GPIO_configBit .dwfde $C$DW$CIE, _GPIO_configBit $C$DW$43 .dwtag DW_TAG_formal_parameter, DW_AT_name("hGpio") .dwattr $C$DW$43, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$43, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$43, DW_AT_location[DW_OP_reg17] $C$DW$44 .dwtag DW_TAG_formal_parameter, DW_AT_name("config") .dwattr $C$DW$44, DW_AT_TI_symbol_name("_config") .dwattr $C$DW$44, DW_AT_type(*$C$DW$T$47) .dwattr $C$DW$44, DW_AT_location[DW_OP_reg19] ;******************************************************************************* ;* FUNCTION NAME: GPIO_configBit * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,T0,T1,AR0,XAR0,AR1,XAR1,AR2,AR3,XAR3,* ;* SP,CARRY,TC1,M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 6 words * ;* (1 return address/alignment) * ;* (5 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_configBit: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-5, SP .dwcfi cfa_offset, 6 $C$DW$45 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$45, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$45, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$45, DW_AT_location[DW_OP_bregx 0x24 0] $C$DW$46 .dwtag DW_TAG_variable, DW_AT_name("config") .dwattr $C$DW$46, DW_AT_TI_symbol_name("_config") .dwattr $C$DW$46, DW_AT_type(*$C$DW$T$47) .dwattr $C$DW$46, DW_AT_location[DW_OP_bregx 0x24 2] $C$DW$47 .dwtag DW_TAG_variable, DW_AT_name("pinNum") .dwattr $C$DW$47, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$47, DW_AT_type(*$C$DW$T$19) .dwattr $C$DW$47, DW_AT_location[DW_OP_bregx 0x24 4] MOV XAR1, dbl(*SP(#2)) MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 518,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |518| CMPU AC1 != AC0, TC1 ; |518| BCC $C$L24,TC1 ; |518| ; branchcc occurs ; |518| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 520,column 9,is_stmt MOV #-5, T0 B $C$L33 ; |520| ; branch occurs ; |520| $C$L24: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 523,column 5,is_stmt MOV dbl(*SP(#2)), XAR3 MOV #31, AR2 ; |523| MOV *AR3, AR1 ; |523| CMP AR2 < AR1, TC1 ; |523| BCC $C$L25,TC1 ; |523| ; branchcc occurs ; |523| MOV *AR3, AR1 ; |523| BCC $C$L26,AR1 >= #0 ; |523| ; branchcc occurs ; |523| $C$L25: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 525,column 9,is_stmt MOV #-6, T0 B $C$L33 ; |525| ; branch occurs ; |525| $C$L26: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 528,column 5,is_stmt MOV *AR3(short(#1)), AR1 ; |528| BCC $C$L27,AR1 == #0 ; |528| ; branchcc occurs ; |528| CMP *AR3(short(#1)) == #1, TC1 ; |528| BCC $C$L27,TC1 ; |528| ; branchcc occurs ; |528| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 531,column 9,is_stmt MOV #-6, T0 B $C$L33 ; |531| ; branch occurs ; |531| $C$L27: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 533,column 5,is_stmt MOV #0, AR2 || MOV *AR3(short(#2)), AR1 ; |533| CMP AR2 == AR1, TC1 ; |533| BCC $C$L28,TC1 ; |533| ; branchcc occurs ; |533| MOV #1, AR2 || MOV *AR3(short(#2)), AR1 ; |533| CMP AR2 == AR1, TC1 ; |533| BCC $C$L28,TC1 ; |533| ; branchcc occurs ; |533| MOV #2, AR2 || MOV *AR3(short(#2)), AR1 ; |533| CMP AR2 == AR1, TC1 ; |533| BCC $C$L28,TC1 ; |533| ; branchcc occurs ; |533| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 537,column 9,is_stmt MOV #-6, T0 B $C$L33 ; |537| ; branch occurs ; |537| $C$L28: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 541,column 5,is_stmt MOV #16, AR2 ; |541| MOV *AR3, AR1 ; |541| CMP AR1 >= AR2, TC1 ; |541| BCC $C$L30,TC1 ; |541| ; branchcc occurs ; |541| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 544,column 9,is_stmt MOV *AR3, AR1 ; |544| MOV AR1, *SP(#4) ; |544| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 545,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |545| MOV *SP(#4), T1 ; |545| || MOV #1, AC0 SFTS AC0, T1, AC0 ; |545| NOT AC0, AR1 ; |545| AND port(*AR3(short(#6))), AR1, AR1 ; |545| MOV dbl(*SP(#2)), XAR3 MOV *AR3(short(#1)), AR2 ; |545| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |545| AND #0x0001, AR2, AC0 ; |545| SFTS AC0, T1, AC0 ; |545| OR AR1, AC0 ; |545| MOV AC0, port(*AR3(short(#6))) ; |545| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 547,column 9,is_stmt MOV dbl(*SP(#2)), XAR3 MOV *AR3(short(#2)), AR1 ; |547| || MOV #1, AR2 CMP AR2 == AR1, TC1 ; |547| BCC $C$L29,TC1 ; |547| ; branchcc occurs ; |547| MOV #0, AR2 || MOV *AR3(short(#2)), AR1 ; |547| CMP AR2 != AR1, TC1 ; |547| BCC $C$L32,TC1 ; |547| ; branchcc occurs ; |547| $C$L29: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 550,column 13,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |550| MOV #1, AC0 || MOV *SP(#4), T1 ; |550| SFTS AC0, T1, AC0 ; |550| NOT AC0, AR1 ; |550| || AMOV #12, T0 AND port(*AR3(T0)), AR1, AR1 ; |550| MOV dbl(*SP(#2)), XAR3 MOV *AR3(short(#2)), AR2 ; |550| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |550| AND #0x0001, AR2, AC0 ; |550| SFTS AC0, T1, AC0 ; |550| OR AR1, AC0 ; |550| MOV AC0, port(*AR3(T0)) ; |550| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 553,column 5,is_stmt B $C$L32 ; |553| ; branch occurs ; |553| $C$L30: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 558,column 9,is_stmt MOV *AR3, AR1 ; |558| SUB #16, AR1, AR1 ; |558| MOV AR1, *SP(#4) ; |558| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 559,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |559| MOV *SP(#4), T1 ; |559| || MOV #1, AC0 SFTS AC0, T1, AC0 ; |559| NOT AC0, AR1 ; |559| AND port(*AR3(short(#7))), AR1, AR1 ; |559| MOV dbl(*SP(#2)), XAR3 MOV *AR3(short(#1)), AR2 ; |559| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |559| AND #0x0001, AR2, AC0 ; |559| SFTS AC0, T1, AC0 ; |559| OR AR1, AC0 ; |559| MOV AC0, port(*AR3(short(#7))) ; |559| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 561,column 9,is_stmt MOV dbl(*SP(#2)), XAR3 MOV *AR3(short(#2)), AR1 ; |561| || MOV #1, AR2 CMP AR2 == AR1, TC1 ; |561| BCC $C$L31,TC1 ; |561| ; branchcc occurs ; |561| MOV #0, AR2 || MOV *AR3(short(#2)), AR1 ; |561| CMP AR2 != AR1, TC1 ; |561| BCC $C$L32,TC1 ; |561| ; branchcc occurs ; |561| $C$L31: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 564,column 13,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |564| MOV #1, AC0 || MOV *SP(#4), T1 ; |564| SFTS AC0, T1, AC0 ; |564| NOT AC0, AR1 ; |564| || AMOV #13, T0 AND port(*AR3(T0)), AR1, AR1 ; |564| MOV dbl(*SP(#2)), XAR3 MOV *AR3(short(#2)), AR2 ; |564| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |564| AND #0x0001, AR2, AC0 ; |564| SFTS AC0, T1, AC0 ; |564| OR AR1, AC0 ; |564| MOV AC0, port(*AR3(T0)) ; |564| $C$L32: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 569,column 5,is_stmt MOV #0, T0 $C$L33: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 570,column 1,is_stmt AADD #5, SP .dwcfi cfa_offset, 1 $C$DW$48 .dwtag DW_TAG_TI_branch .dwattr $C$DW$48, DW_AT_low_pc(0x00) .dwattr $C$DW$48, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$42, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$42, DW_AT_TI_end_line(0x23a) .dwattr $C$DW$42, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$42 .sect ".text" .align 4 .global _GPIO_disableInt $C$DW$49 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_disableInt") .dwattr $C$DW$49, DW_AT_low_pc(_GPIO_disableInt) .dwattr $C$DW$49, DW_AT_high_pc(0x00) .dwattr $C$DW$49, DW_AT_TI_symbol_name("_GPIO_disableInt") .dwattr $C$DW$49, DW_AT_external .dwattr $C$DW$49, DW_AT_type(*$C$DW$T$41) .dwattr $C$DW$49, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$49, DW_AT_TI_begin_line(0x26b) .dwattr $C$DW$49, DW_AT_TI_begin_column(0x0c) .dwattr $C$DW$49, DW_AT_TI_max_frame_size(0x06) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 623,column 1,is_stmt,address _GPIO_disableInt .dwfde $C$DW$CIE, _GPIO_disableInt $C$DW$50 .dwtag DW_TAG_formal_parameter, DW_AT_name("hGpio") .dwattr $C$DW$50, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$50, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$50, DW_AT_location[DW_OP_reg17] $C$DW$51 .dwtag DW_TAG_formal_parameter, DW_AT_name("pinNum") .dwattr $C$DW$51, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$51, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$51, DW_AT_location[DW_OP_reg12] ;******************************************************************************* ;* FUNCTION NAME: GPIO_disableInt * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,T0,T1,AR0,XAR0,AR1,AR2,AR3,XAR3,SP, * ;* CARRY,TC1,M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 6 words * ;* (2 return address/alignment) * ;* (4 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_disableInt: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-5, SP .dwcfi cfa_offset, 6 $C$DW$52 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$52, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$52, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$52, DW_AT_location[DW_OP_bregx 0x24 0] $C$DW$53 .dwtag DW_TAG_variable, DW_AT_name("pinNum") .dwattr $C$DW$53, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$53, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$53, DW_AT_location[DW_OP_bregx 0x24 2] $C$DW$54 .dwtag DW_TAG_variable, DW_AT_name("pin") .dwattr $C$DW$54, DW_AT_TI_symbol_name("_pin") .dwattr $C$DW$54, DW_AT_type(*$C$DW$T$19) .dwattr $C$DW$54, DW_AT_location[DW_OP_bregx 0x24 3] MOV T0, *SP(#2) ; |623| MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 626,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |626| CMPU AC1 != AC0, TC1 ; |626| BCC $C$L34,TC1 ; |626| ; branchcc occurs ; |626| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 628,column 9,is_stmt MOV #-5, T0 B $C$L39 ; |628| ; branch occurs ; |628| $C$L34: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 631,column 5,is_stmt MOV *SP(#2), AR1 ; |631| MOV #31, AR2 ; |631| CMP AR2 < AR1, TC1 ; |631| BCC $C$L35,TC1 ; |631| ; branchcc occurs ; |631| BCC $C$L36,AR1 >= #0 ; |631| ; branchcc occurs ; |631| $C$L35: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 633,column 9,is_stmt MOV #-6, T0 B $C$L39 ; |633| ; branch occurs ; |633| $C$L36: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 636,column 5,is_stmt MOV #16, AR2 ; |636| CMP AR1 >= AR2, TC1 ; |636| BCC $C$L37,TC1 ; |636| ; branchcc occurs ; |636| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 639,column 9,is_stmt MOV *SP(#2), AR1 ; |639| MOV AR1, *SP(#3) ; |639| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 640,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |640| MOV *SP(#3), T1 ; |640| || MOV #1, AC0 SFTS AC0, T1, AC0 ; |640| NOT AC0, AR1 ; |640| || AMOV #14, T0 AND port(*AR3(T0)), AR1, AC0 ; |640| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |640| MOV AC0, port(*AR3(T0)) ; |640| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 641,column 5,is_stmt B $C$L38 ; |641| ; branch occurs ; |641| $C$L37: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 645,column 9,is_stmt SUB #16, AR1, AR1 ; |645| MOV AR1, *SP(#3) ; |645| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 646,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |646| MOV *SP(#3), T1 ; |646| || MOV #1, AC0 SFTS AC0, T1, AC0 ; |646| NOT AC0, AR1 ; |646| || AMOV #15, T0 AND port(*AR3(T0)), AR1, AC0 ; |646| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |646| MOV AC0, port(*AR3(T0)) ; |646| $C$L38: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 649,column 5,is_stmt MOV #0, T0 $C$L39: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 650,column 1,is_stmt AADD #5, SP .dwcfi cfa_offset, 1 $C$DW$55 .dwtag DW_TAG_TI_branch .dwattr $C$DW$55, DW_AT_low_pc(0x00) .dwattr $C$DW$55, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$49, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$49, DW_AT_TI_end_line(0x28a) .dwattr $C$DW$49, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$49 .sect ".text" .align 4 .global _GPIO_enableInt $C$DW$56 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_enableInt") .dwattr $C$DW$56, DW_AT_low_pc(_GPIO_enableInt) .dwattr $C$DW$56, DW_AT_high_pc(0x00) .dwattr $C$DW$56, DW_AT_TI_symbol_name("_GPIO_enableInt") .dwattr $C$DW$56, DW_AT_external .dwattr $C$DW$56, DW_AT_type(*$C$DW$T$41) .dwattr $C$DW$56, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$56, DW_AT_TI_begin_line(0x2bc) .dwattr $C$DW$56, DW_AT_TI_begin_column(0x0c) .dwattr $C$DW$56, DW_AT_TI_max_frame_size(0x06) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 704,column 1,is_stmt,address _GPIO_enableInt .dwfde $C$DW$CIE, _GPIO_enableInt $C$DW$57 .dwtag DW_TAG_formal_parameter, DW_AT_name("hGpio") .dwattr $C$DW$57, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$57, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$57, DW_AT_location[DW_OP_reg17] $C$DW$58 .dwtag DW_TAG_formal_parameter, DW_AT_name("pinNum") .dwattr $C$DW$58, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$58, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$58, DW_AT_location[DW_OP_reg12] ;******************************************************************************* ;* FUNCTION NAME: GPIO_enableInt * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,T0,T1,AR0,XAR0,AR1,AR2,AR3,XAR3,SP, * ;* CARRY,TC1,M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 6 words * ;* (2 return address/alignment) * ;* (4 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_enableInt: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-5, SP .dwcfi cfa_offset, 6 $C$DW$59 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$59, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$59, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$59, DW_AT_location[DW_OP_bregx 0x24 0] $C$DW$60 .dwtag DW_TAG_variable, DW_AT_name("pinNum") .dwattr $C$DW$60, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$60, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$60, DW_AT_location[DW_OP_bregx 0x24 2] $C$DW$61 .dwtag DW_TAG_variable, DW_AT_name("pin") .dwattr $C$DW$61, DW_AT_TI_symbol_name("_pin") .dwattr $C$DW$61, DW_AT_type(*$C$DW$T$19) .dwattr $C$DW$61, DW_AT_location[DW_OP_bregx 0x24 3] MOV T0, *SP(#2) ; |704| MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 707,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |707| CMPU AC1 != AC0, TC1 ; |707| BCC $C$L40,TC1 ; |707| ; branchcc occurs ; |707| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 709,column 9,is_stmt MOV #-5, T0 B $C$L45 ; |709| ; branch occurs ; |709| $C$L40: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 713,column 5,is_stmt MOV *SP(#2), AR1 ; |713| MOV #31, AR2 ; |713| CMP AR2 < AR1, TC1 ; |713| BCC $C$L41,TC1 ; |713| ; branchcc occurs ; |713| BCC $C$L42,AR1 >= #0 ; |713| ; branchcc occurs ; |713| $C$L41: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 715,column 9,is_stmt MOV #-6, T0 B $C$L45 ; |715| ; branch occurs ; |715| $C$L42: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 717,column 5,is_stmt MOV #16, AR2 ; |717| CMP AR1 >= AR2, TC1 ; |717| BCC $C$L43,TC1 ; |717| ; branchcc occurs ; |717| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 720,column 9,is_stmt MOV *SP(#2), AR1 ; |720| MOV AR1, *SP(#3) ; |720| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 721,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |721| MOV *SP(#3), T1 ; |721| || MOV #1, AC0 SFTS AC0, T1, AC0 ; |721| NOT AC0, AR1 ; |721| || AMOV #14, T0 AND port(*AR3(T0)), AR1, AR1 ; |721| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |721| MOV #1, AC0 SFTS AC0, T1, AC0 ; |721| OR AR1, AC0 ; |721| MOV AC0, port(*AR3(T0)) ; |721| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 722,column 5,is_stmt B $C$L44 ; |722| ; branch occurs ; |722| $C$L43: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 726,column 9,is_stmt SUB #16, AR1, AR1 ; |726| MOV AR1, *SP(#3) ; |726| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 727,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |727| MOV *SP(#3), T1 ; |727| || MOV #1, AC0 SFTS AC0, T1, AC0 ; |727| NOT AC0, AR1 ; |727| || AMOV #15, T0 AND port(*AR3(T0)), AR1, AR1 ; |727| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |727| MOV #1, AC0 SFTS AC0, T1, AC0 ; |727| OR AR1, AC0 ; |727| MOV AC0, port(*AR3(T0)) ; |727| $C$L44: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 730,column 5,is_stmt MOV #0, T0 $C$L45: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 731,column 1,is_stmt AADD #5, SP .dwcfi cfa_offset, 1 $C$DW$62 .dwtag DW_TAG_TI_branch .dwattr $C$DW$62, DW_AT_low_pc(0x00) .dwattr $C$DW$62, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$56, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$56, DW_AT_TI_end_line(0x2db) .dwattr $C$DW$56, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$56 .sect ".text" .align 4 .global _GPIO_clearInt $C$DW$63 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_clearInt") .dwattr $C$DW$63, DW_AT_low_pc(_GPIO_clearInt) .dwattr $C$DW$63, DW_AT_high_pc(0x00) .dwattr $C$DW$63, DW_AT_TI_symbol_name("_GPIO_clearInt") .dwattr $C$DW$63, DW_AT_external .dwattr $C$DW$63, DW_AT_type(*$C$DW$T$41) .dwattr $C$DW$63, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$63, DW_AT_TI_begin_line(0x310) .dwattr $C$DW$63, DW_AT_TI_begin_column(0x0c) .dwattr $C$DW$63, DW_AT_TI_max_frame_size(0x06) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 788,column 1,is_stmt,address _GPIO_clearInt .dwfde $C$DW$CIE, _GPIO_clearInt $C$DW$64 .dwtag DW_TAG_formal_parameter, DW_AT_name("hGpio") .dwattr $C$DW$64, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$64, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$64, DW_AT_location[DW_OP_reg17] $C$DW$65 .dwtag DW_TAG_formal_parameter, DW_AT_name("pinNum") .dwattr $C$DW$65, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$65, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$65, DW_AT_location[DW_OP_reg12] ;******************************************************************************* ;* FUNCTION NAME: GPIO_clearInt * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,T0,T1,AR0,XAR0,AR1,AR2,AR3,XAR3,SP, * ;* CARRY,TC1,M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 6 words * ;* (2 return address/alignment) * ;* (4 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_clearInt: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-5, SP .dwcfi cfa_offset, 6 $C$DW$66 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$66, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$66, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$66, DW_AT_location[DW_OP_bregx 0x24 0] $C$DW$67 .dwtag DW_TAG_variable, DW_AT_name("pinNum") .dwattr $C$DW$67, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$67, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$67, DW_AT_location[DW_OP_bregx 0x24 2] $C$DW$68 .dwtag DW_TAG_variable, DW_AT_name("pin") .dwattr $C$DW$68, DW_AT_TI_symbol_name("_pin") .dwattr $C$DW$68, DW_AT_type(*$C$DW$T$19) .dwattr $C$DW$68, DW_AT_location[DW_OP_bregx 0x24 3] MOV T0, *SP(#2) ; |788| MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 791,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |791| CMPU AC1 != AC0, TC1 ; |791| BCC $C$L46,TC1 ; |791| ; branchcc occurs ; |791| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 793,column 9,is_stmt MOV #-5, T0 B $C$L51 ; |793| ; branch occurs ; |793| $C$L46: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 796,column 5,is_stmt MOV *SP(#2), AR1 ; |796| MOV #31, AR2 ; |796| CMP AR2 < AR1, TC1 ; |796| BCC $C$L47,TC1 ; |796| ; branchcc occurs ; |796| BCC $C$L48,AR1 >= #0 ; |796| ; branchcc occurs ; |796| $C$L47: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 798,column 9,is_stmt MOV #-6, T0 B $C$L51 ; |798| ; branch occurs ; |798| $C$L48: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 800,column 5,is_stmt MOV #16, AR2 ; |800| CMP AR1 >= AR2, TC1 ; |800| BCC $C$L49,TC1 ; |800| ; branchcc occurs ; |800| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 803,column 9,is_stmt MOV *SP(#2), AR1 ; |803| MOV AR1, *SP(#3) ; |803| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 804,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV #16, T0 ; |804| MOV *AR3, AR3 ; |804| MOV *SP(#3), T1 ; |804| || MOV #1, AC0 SFTS AC0, T1, AC0 ; |804| NOT AC0, AR1 ; |804| AND port(*AR3(T0)), AR1, AR1 ; |804| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |804| MOV #1, AC0 SFTS AC0, T1, AC0 ; |804| OR AR1, AC0 ; |804| MOV AC0, port(*AR3(T0)) ; |804| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 805,column 5,is_stmt B $C$L50 ; |805| ; branch occurs ; |805| $C$L49: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 809,column 9,is_stmt SUB #16, AR1, AR1 ; |809| MOV AR1, *SP(#3) ; |809| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 810,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV #17, T0 ; |810| MOV *AR3, AR3 ; |810| MOV *SP(#3), T1 ; |810| || MOV #1, AC0 SFTS AC0, T1, AC0 ; |810| NOT AC0, AR1 ; |810| AND port(*AR3(T0)), AR1, AR1 ; |810| MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |810| MOV #1, AC0 SFTS AC0, T1, AC0 ; |810| OR AR1, AC0 ; |810| MOV AC0, port(*AR3(T0)) ; |810| $C$L50: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 813,column 5,is_stmt MOV #0, T0 $C$L51: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 815,column 1,is_stmt AADD #5, SP .dwcfi cfa_offset, 1 $C$DW$69 .dwtag DW_TAG_TI_branch .dwattr $C$DW$69, DW_AT_low_pc(0x00) .dwattr $C$DW$69, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$63, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$63, DW_AT_TI_end_line(0x32f) .dwattr $C$DW$63, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$63 .sect ".text" .align 4 .global _GPIO_statusBit $C$DW$70 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_statusBit") .dwattr $C$DW$70, DW_AT_low_pc(_GPIO_statusBit) .dwattr $C$DW$70, DW_AT_high_pc(0x00) .dwattr $C$DW$70, DW_AT_TI_symbol_name("_GPIO_statusBit") .dwattr $C$DW$70, DW_AT_external .dwattr $C$DW$70, DW_AT_type(*$C$DW$T$10) .dwattr $C$DW$70, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$70, DW_AT_TI_begin_line(0x364) .dwattr $C$DW$70, DW_AT_TI_begin_column(0x05) .dwattr $C$DW$70, DW_AT_TI_max_frame_size(0x0a) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 873,column 1,is_stmt,address _GPIO_statusBit .dwfde $C$DW$CIE, _GPIO_statusBit $C$DW$71 .dwtag DW_TAG_formal_parameter, DW_AT_name("hGpio") .dwattr $C$DW$71, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$71, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$71, DW_AT_location[DW_OP_reg17] $C$DW$72 .dwtag DW_TAG_formal_parameter, DW_AT_name("pinNum") .dwattr $C$DW$72, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$72, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$72, DW_AT_location[DW_OP_reg12] $C$DW$73 .dwtag DW_TAG_formal_parameter, DW_AT_name("status") .dwattr $C$DW$73, DW_AT_TI_symbol_name("_status") .dwattr $C$DW$73, DW_AT_type(*$C$DW$T$42) .dwattr $C$DW$73, DW_AT_location[DW_OP_reg19] ;******************************************************************************* ;* FUNCTION NAME: GPIO_statusBit * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,T0,T1,AR0,XAR0,AR1,XAR1,AR2,AR3,XAR3,* ;* SP,CARRY,TC1,M40,SATA,SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 10 words * ;* (2 return address/alignment) * ;* (8 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_statusBit: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-9, SP .dwcfi cfa_offset, 10 $C$DW$74 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$74, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$74, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$74, DW_AT_location[DW_OP_bregx 0x24 0] $C$DW$75 .dwtag DW_TAG_variable, DW_AT_name("pinNum") .dwattr $C$DW$75, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$75, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$75, DW_AT_location[DW_OP_bregx 0x24 2] $C$DW$76 .dwtag DW_TAG_variable, DW_AT_name("status") .dwattr $C$DW$76, DW_AT_TI_symbol_name("_status") .dwattr $C$DW$76, DW_AT_type(*$C$DW$T$42) .dwattr $C$DW$76, DW_AT_location[DW_OP_bregx 0x24 4] $C$DW$77 .dwtag DW_TAG_variable, DW_AT_name("flagBit") .dwattr $C$DW$77, DW_AT_TI_symbol_name("_flagBit") .dwattr $C$DW$77, DW_AT_type(*$C$DW$T$10) .dwattr $C$DW$77, DW_AT_location[DW_OP_bregx 0x24 6] $C$DW$78 .dwtag DW_TAG_variable, DW_AT_name("pin") .dwattr $C$DW$78, DW_AT_TI_symbol_name("_pin") .dwattr $C$DW$78, DW_AT_type(*$C$DW$T$19) .dwattr $C$DW$78, DW_AT_location[DW_OP_bregx 0x24 7] MOV XAR1, dbl(*SP(#4)) MOV T0, *SP(#2) ; |873| MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 877,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |877| CMPU AC1 != AC0, TC1 ; |877| BCC $C$L52,TC1 ; |877| ; branchcc occurs ; |877| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 879,column 9,is_stmt MOV dbl(*SP(#4)), XAR3 MOV #-5, *AR3 ; |879| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 880,column 9,is_stmt MOV #-5, T0 B $C$L57 ; |880| ; branch occurs ; |880| $C$L52: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 884,column 5,is_stmt MOV *SP(#2), AR1 ; |884| MOV #31, AR2 ; |884| CMP AR2 < AR1, TC1 ; |884| BCC $C$L53,TC1 ; |884| ; branchcc occurs ; |884| BCC $C$L54,AR1 >= #0 ; |884| ; branchcc occurs ; |884| $C$L53: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 886,column 9,is_stmt MOV dbl(*SP(#4)), XAR3 MOV #-6, *AR3 ; |886| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 887,column 9,is_stmt MOV #-6, T0 B $C$L57 ; |887| ; branch occurs ; |887| $C$L54: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 890,column 5,is_stmt MOV #16, AR2 ; |890| CMP AR1 >= AR2, TC1 ; |890| BCC $C$L55,TC1 ; |890| ; branchcc occurs ; |890| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 893,column 9,is_stmt MOV *SP(#2), AR1 ; |893| MOV AR1, *SP(#7) ; |893| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 894,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV #16, T0 ; |894| MOV *AR3, AR3 ; |894| NEG AR1, T1 ; |894| MOV uns(port(*AR3(T0))), AC0 ; |894| SFTS AC0, T1, AC0 ; |894| AND #0x0001, AC0, AC0 ; |894| MOV AC0, *SP(#6) ; |894| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 895,column 5,is_stmt B $C$L56 ; |895| ; branch occurs ; |895| $C$L55: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 899,column 9,is_stmt SUB #16, AR1, AR1 ; |899| MOV AR1, *SP(#7) ; |899| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 900,column 9,is_stmt MOV dbl(*SP(#0)), XAR3 MOV #17, T0 ; |900| MOV *AR3, AR3 ; |900| NEG AR1, T1 ; |900| MOV uns(port(*AR3(T0))), AC0 ; |900| SFTS AC0, T1, AC0 ; |900| AND #0x0001, AC0, AC0 ; |900| MOV AC0, *SP(#6) ; |900| $C$L56: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 903,column 5,is_stmt MOV dbl(*SP(#4)), XAR3 MOV #0, *AR3 ; |903| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 904,column 5,is_stmt MOV *SP(#6), T0 ; |904| $C$L57: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 905,column 1,is_stmt AADD #9, SP .dwcfi cfa_offset, 1 $C$DW$79 .dwtag DW_TAG_TI_branch .dwattr $C$DW$79, DW_AT_low_pc(0x00) .dwattr $C$DW$79, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$70, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$70, DW_AT_TI_end_line(0x389) .dwattr $C$DW$70, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$70 .sect ".text" .align 4 .global _GPIO_reset $C$DW$80 .dwtag DW_TAG_subprogram, DW_AT_name("GPIO_reset") .dwattr $C$DW$80, DW_AT_low_pc(_GPIO_reset) .dwattr $C$DW$80, DW_AT_high_pc(0x00) .dwattr $C$DW$80, DW_AT_TI_symbol_name("_GPIO_reset") .dwattr $C$DW$80, DW_AT_external .dwattr $C$DW$80, DW_AT_type(*$C$DW$T$41) .dwattr $C$DW$80, DW_AT_TI_begin_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$80, DW_AT_TI_begin_line(0x3b9) .dwattr $C$DW$80, DW_AT_TI_begin_column(0x0c) .dwattr $C$DW$80, DW_AT_TI_max_frame_size(0x04) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 956,column 1,is_stmt,address _GPIO_reset .dwfde $C$DW$CIE, _GPIO_reset $C$DW$81 .dwtag DW_TAG_formal_parameter, DW_AT_name("hGpio") .dwattr $C$DW$81, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$81, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$81, DW_AT_location[DW_OP_reg17] ;******************************************************************************* ;* FUNCTION NAME: GPIO_reset * ;* * ;* Function Uses Regs : AC0,AC0,AC1,AC1,T0,AR0,XAR0,AR3,XAR3,SP,TC1,M40,SATA,* ;* SATD,RDM,FRCT,SMUL * ;* Stack Frame : Compact (No Frame Pointer, w/ debug) * ;* Total Frame Size : 4 words * ;* (2 return address/alignment) * ;* (2 local values) * ;* Min System Stack : 1 word * ;******************************************************************************* _GPIO_reset: .dwcfi cfa_offset, 1 .dwcfi save_reg_to_mem, 91, -1 AADD #-3, SP .dwcfi cfa_offset, 4 $C$DW$82 .dwtag DW_TAG_variable, DW_AT_name("hGpio") .dwattr $C$DW$82, DW_AT_TI_symbol_name("_hGpio") .dwattr $C$DW$82, DW_AT_type(*$C$DW$T$39) .dwattr $C$DW$82, DW_AT_location[DW_OP_bregx 0x24 0] MOV XAR0, dbl(*SP(#0)) .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 958,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV XAR3, AC0 || MOV #0, AC1 ; |958| CMPU AC1 != AC0, TC1 ; |958| BCC $C$L58,TC1 ; |958| ; branchcc occurs ; |958| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 960,column 9,is_stmt MOV #-5, T0 B $C$L59 ; |960| ; branch occurs ; |960| $C$L58: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 963,column 2,is_stmt MOV *AR3, AR3 ; |963| AMOV #14, T0 MOV #0, port(*AR3(T0)) ; |963| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 964,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |964| AMOV #15, T0 MOV #0, port(*AR3(T0)) ; |964| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 966,column 2,is_stmt MOV dbl(*SP(#0)), XAR3 MOV #16, T0 ; |966| MOV *AR3, AR3 ; |966| MOV #65535, port(*AR3(T0)) ; |966| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 967,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV #17, T0 ; |967| MOV *AR3, AR3 ; |967| MOV #65535, port(*AR3(T0)) ; |967| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 969,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |969| AMOV #12, T0 MOV #0, port(*AR3(T0)) ; |969| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 970,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |970| AMOV #13, T0 MOV #0, port(*AR3(T0)) ; |970| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 972,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |972| MOV #0, port(*AR3(short(#6))) ; |972| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 973,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |973| MOV #0, port(*AR3(short(#7))) ; |973| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 975,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |975| AMOV #10, T0 MOV #0, port(*AR3(T0)) ; |975| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 976,column 5,is_stmt MOV dbl(*SP(#0)), XAR3 MOV *AR3, AR3 ; |976| AMOV #11, T0 MOV #0, port(*AR3(T0)) ; |976| .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 978,column 5,is_stmt MOV #0, T0 $C$L59: .dwpsn file "../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c",line 979,column 1,is_stmt AADD #3, SP .dwcfi cfa_offset, 1 $C$DW$83 .dwtag DW_TAG_TI_branch .dwattr $C$DW$83, DW_AT_low_pc(0x00) .dwattr $C$DW$83, DW_AT_TI_return RET ; return occurs .dwattr $C$DW$80, DW_AT_TI_end_file("../c5535_bsl_revc/ezdsp5535_v1/c55xx_csl/src/csl_gpio.c") .dwattr $C$DW$80, DW_AT_TI_end_line(0x3d3) .dwattr $C$DW$80, DW_AT_TI_end_column(0x01) .dwendentry .dwendtag $C$DW$80 ;******************************************************************************* ;* TYPE INFORMATION * ;******************************************************************************* $C$DW$T$30 .dwtag DW_TAG_enumeration_type .dwattr $C$DW$T$30, DW_AT_byte_size(0x01) $C$DW$84 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN0"), DW_AT_const_value(0x00) $C$DW$85 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN1"), DW_AT_const_value(0x01) $C$DW$86 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN2"), DW_AT_const_value(0x02) $C$DW$87 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN3"), DW_AT_const_value(0x03) $C$DW$88 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN4"), DW_AT_const_value(0x04) $C$DW$89 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN5"), DW_AT_const_value(0x05) $C$DW$90 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN6"), DW_AT_const_value(0x06) $C$DW$91 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN7"), DW_AT_const_value(0x07) $C$DW$92 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN8"), DW_AT_const_value(0x08) $C$DW$93 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN9"), DW_AT_const_value(0x09) $C$DW$94 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN10"), DW_AT_const_value(0x0a) $C$DW$95 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN11"), DW_AT_const_value(0x0b) $C$DW$96 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN12"), DW_AT_const_value(0x0c) $C$DW$97 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN13"), DW_AT_const_value(0x0d) $C$DW$98 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN14"), DW_AT_const_value(0x0e) $C$DW$99 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN15"), DW_AT_const_value(0x0f) $C$DW$100 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN16"), DW_AT_const_value(0x10) $C$DW$101 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN17"), DW_AT_const_value(0x11) $C$DW$102 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN18"), DW_AT_const_value(0x12) $C$DW$103 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN19"), DW_AT_const_value(0x13) $C$DW$104 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN20"), DW_AT_const_value(0x14) $C$DW$105 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN21"), DW_AT_const_value(0x15) $C$DW$106 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN22"), DW_AT_const_value(0x16) $C$DW$107 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN23"), DW_AT_const_value(0x17) $C$DW$108 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN24"), DW_AT_const_value(0x18) $C$DW$109 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN25"), DW_AT_const_value(0x19) $C$DW$110 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN26"), DW_AT_const_value(0x1a) $C$DW$111 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN27"), DW_AT_const_value(0x1b) $C$DW$112 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN28"), DW_AT_const_value(0x1c) $C$DW$113 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN29"), DW_AT_const_value(0x1d) $C$DW$114 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN30"), DW_AT_const_value(0x1e) $C$DW$115 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_PIN31"), DW_AT_const_value(0x1f) .dwendtag $C$DW$T$30 $C$DW$T$31 .dwtag DW_TAG_typedef, DW_AT_name("CSL_GpioPinNum") .dwattr $C$DW$T$31, DW_AT_type(*$C$DW$T$30) .dwattr $C$DW$T$31, DW_AT_language(DW_LANG_C) $C$DW$T$32 .dwtag DW_TAG_enumeration_type .dwattr $C$DW$T$32, DW_AT_byte_size(0x01) $C$DW$116 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_DIR_INPUT"), DW_AT_const_value(0x00) $C$DW$117 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_DIR_OUTPUT"), DW_AT_const_value(0x01) .dwendtag $C$DW$T$32 $C$DW$T$33 .dwtag DW_TAG_typedef, DW_AT_name("CSL_GpioDirection") .dwattr $C$DW$T$33, DW_AT_type(*$C$DW$T$32) .dwattr $C$DW$T$33, DW_AT_language(DW_LANG_C) $C$DW$T$34 .dwtag DW_TAG_enumeration_type .dwattr $C$DW$T$34, DW_AT_byte_size(0x01) $C$DW$118 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_TRIG_RISING_EDGE"), DW_AT_const_value(0x00) $C$DW$119 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_TRIG_FALLING_EDGE"), DW_AT_const_value(0x01) $C$DW$120 .dwtag DW_TAG_enumerator, DW_AT_name("CSL_GPIO_TRIG_CLEAR_EDGE"), DW_AT_const_value(0x02) .dwendtag $C$DW$T$34 $C$DW$T$35 .dwtag DW_TAG_typedef, DW_AT_name("CSL_GpioTriggerType") .dwattr $C$DW$T$35, DW_AT_type(*$C$DW$T$34) .dwattr $C$DW$T$35, DW_AT_language(DW_LANG_C) $C$DW$T$22 .dwtag DW_TAG_structure_type .dwattr $C$DW$T$22, DW_AT_byte_size(0x12) $C$DW$121 .dwtag DW_TAG_member .dwattr $C$DW$121, DW_AT_type(*$C$DW$T$21) .dwattr $C$DW$121, DW_AT_name("RSVD0") .dwattr $C$DW$121, DW_AT_TI_symbol_name("_RSVD0") .dwattr $C$DW$121, DW_AT_data_member_location[DW_OP_plus_uconst 0x0] .dwattr $C$DW$121, DW_AT_accessibility(DW_ACCESS_public) $C$DW$122 .dwtag DW_TAG_member .dwattr $C$DW$122, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$122, DW_AT_name("IODIR1") .dwattr $C$DW$122, DW_AT_TI_symbol_name("_IODIR1") .dwattr $C$DW$122, DW_AT_data_member_location[DW_OP_plus_uconst 0x6] .dwattr $C$DW$122, DW_AT_accessibility(DW_ACCESS_public) $C$DW$123 .dwtag DW_TAG_member .dwattr $C$DW$123, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$123, DW_AT_name("IODIR2") .dwattr $C$DW$123, DW_AT_TI_symbol_name("_IODIR2") .dwattr $C$DW$123, DW_AT_data_member_location[DW_OP_plus_uconst 0x7] .dwattr $C$DW$123, DW_AT_accessibility(DW_ACCESS_public) $C$DW$124 .dwtag DW_TAG_member .dwattr $C$DW$124, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$124, DW_AT_name("IOINDATA1") .dwattr $C$DW$124, DW_AT_TI_symbol_name("_IOINDATA1") .dwattr $C$DW$124, DW_AT_data_member_location[DW_OP_plus_uconst 0x8] .dwattr $C$DW$124, DW_AT_accessibility(DW_ACCESS_public) $C$DW$125 .dwtag DW_TAG_member .dwattr $C$DW$125, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$125, DW_AT_name("IOINDATA2") .dwattr $C$DW$125, DW_AT_TI_symbol_name("_IOINDATA2") .dwattr $C$DW$125, DW_AT_data_member_location[DW_OP_plus_uconst 0x9] .dwattr $C$DW$125, DW_AT_accessibility(DW_ACCESS_public) $C$DW$126 .dwtag DW_TAG_member .dwattr $C$DW$126, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$126, DW_AT_name("IOOUTDATA1") .dwattr $C$DW$126, DW_AT_TI_symbol_name("_IOOUTDATA1") .dwattr $C$DW$126, DW_AT_data_member_location[DW_OP_plus_uconst 0xa] .dwattr $C$DW$126, DW_AT_accessibility(DW_ACCESS_public) $C$DW$127 .dwtag DW_TAG_member .dwattr $C$DW$127, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$127, DW_AT_name("IOOUTDATA2") .dwattr $C$DW$127, DW_AT_TI_symbol_name("_IOOUTDATA2") .dwattr $C$DW$127, DW_AT_data_member_location[DW_OP_plus_uconst 0xb] .dwattr $C$DW$127, DW_AT_accessibility(DW_ACCESS_public) $C$DW$128 .dwtag DW_TAG_member .dwattr $C$DW$128, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$128, DW_AT_name("IOINTEDG1") .dwattr $C$DW$128, DW_AT_TI_symbol_name("_IOINTEDG1") .dwattr $C$DW$128, DW_AT_data_member_location[DW_OP_plus_uconst 0xc] .dwattr $C$DW$128, DW_AT_accessibility(DW_ACCESS_public) $C$DW$129 .dwtag DW_TAG_member .dwattr $C$DW$129, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$129, DW_AT_name("IOINTEDG2") .dwattr $C$DW$129, DW_AT_TI_symbol_name("_IOINTEDG2") .dwattr $C$DW$129, DW_AT_data_member_location[DW_OP_plus_uconst 0xd] .dwattr $C$DW$129, DW_AT_accessibility(DW_ACCESS_public) $C$DW$130 .dwtag DW_TAG_member .dwattr $C$DW$130, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$130, DW_AT_name("IOINTEN1") .dwattr $C$DW$130, DW_AT_TI_symbol_name("_IOINTEN1") .dwattr $C$DW$130, DW_AT_data_member_location[DW_OP_plus_uconst 0xe] .dwattr $C$DW$130, DW_AT_accessibility(DW_ACCESS_public) $C$DW$131 .dwtag DW_TAG_member .dwattr $C$DW$131, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$131, DW_AT_name("IOINTEN2") .dwattr $C$DW$131, DW_AT_TI_symbol_name("_IOINTEN2") .dwattr $C$DW$131, DW_AT_data_member_location[DW_OP_plus_uconst 0xf] .dwattr $C$DW$131, DW_AT_accessibility(DW_ACCESS_public) $C$DW$132 .dwtag DW_TAG_member .dwattr $C$DW$132, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$132, DW_AT_name("IOINTFLG1") .dwattr $C$DW$132, DW_AT_TI_symbol_name("_IOINTFLG1") .dwattr $C$DW$132, DW_AT_data_member_location[DW_OP_plus_uconst 0x10] .dwattr $C$DW$132, DW_AT_accessibility(DW_ACCESS_public) $C$DW$133 .dwtag DW_TAG_member .dwattr $C$DW$133, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$133, DW_AT_name("IOINTFLG2") .dwattr $C$DW$133, DW_AT_TI_symbol_name("_IOINTFLG2") .dwattr $C$DW$133, DW_AT_data_member_location[DW_OP_plus_uconst 0x11] .dwattr $C$DW$133, DW_AT_accessibility(DW_ACCESS_public) .dwendtag $C$DW$T$22 $C$DW$T$23 .dwtag DW_TAG_typedef, DW_AT_name("CSL_GpioRegs") .dwattr $C$DW$T$23, DW_AT_type(*$C$DW$T$22) .dwattr $C$DW$T$23, DW_AT_language(DW_LANG_C) $C$DW$134 .dwtag DW_TAG_TI_far_type .dwattr $C$DW$134, DW_AT_type(*$C$DW$T$23) $C$DW$135 .dwtag DW_TAG_TI_ioport_type .dwattr $C$DW$135, DW_AT_type(*$C$DW$134) $C$DW$T$24 .dwtag DW_TAG_volatile_type .dwattr $C$DW$T$24, DW_AT_type(*$C$DW$135) $C$DW$T$25 .dwtag DW_TAG_pointer_type .dwattr $C$DW$T$25, DW_AT_type(*$C$DW$T$24) .dwattr $C$DW$T$25, DW_AT_address_class(0x10) $C$DW$T$26 .dwtag DW_TAG_typedef, DW_AT_name("CSL_GpioRegsOvly") .dwattr $C$DW$T$26, DW_AT_type(*$C$DW$T$25) .dwattr $C$DW$T$26, DW_AT_language(DW_LANG_C) $C$DW$T$28 .dwtag DW_TAG_structure_type .dwattr $C$DW$T$28, DW_AT_byte_size(0x02) $C$DW$136 .dwtag DW_TAG_member .dwattr $C$DW$136, DW_AT_type(*$C$DW$T$26) .dwattr $C$DW$136, DW_AT_name("baseAddr") .dwattr $C$DW$136, DW_AT_TI_symbol_name("_baseAddr") .dwattr $C$DW$136, DW_AT_data_member_location[DW_OP_plus_uconst 0x0] .dwattr $C$DW$136, DW_AT_accessibility(DW_ACCESS_public) $C$DW$137 .dwtag DW_TAG_member .dwattr $C$DW$137, DW_AT_type(*$C$DW$T$27) .dwattr $C$DW$137, DW_AT_name("numPins") .dwattr $C$DW$137, DW_AT_TI_symbol_name("_numPins") .dwattr $C$DW$137, DW_AT_data_member_location[DW_OP_plus_uconst 0x1] .dwattr $C$DW$137, DW_AT_accessibility(DW_ACCESS_public) .dwendtag $C$DW$T$28 $C$DW$T$37 .dwtag DW_TAG_typedef, DW_AT_name("CSL_GpioObj") .dwattr $C$DW$T$37, DW_AT_type(*$C$DW$T$28) .dwattr $C$DW$T$37, DW_AT_language(DW_LANG_C) $C$DW$T$38 .dwtag DW_TAG_pointer_type .dwattr $C$DW$T$38, DW_AT_type(*$C$DW$T$37) .dwattr $C$DW$T$38, DW_AT_address_class(0x17) $C$DW$T$39 .dwtag DW_TAG_typedef, DW_AT_name("GPIO_Handle") .dwattr $C$DW$T$39, DW_AT_type(*$C$DW$T$38) .dwattr $C$DW$T$39, DW_AT_language(DW_LANG_C) $C$DW$T$29 .dwtag DW_TAG_structure_type .dwattr $C$DW$T$29, DW_AT_byte_size(0x06) $C$DW$138 .dwtag DW_TAG_member .dwattr $C$DW$138, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$138, DW_AT_name("GPIODIRL") .dwattr $C$DW$138, DW_AT_TI_symbol_name("_GPIODIRL") .dwattr $C$DW$138, DW_AT_data_member_location[DW_OP_plus_uconst 0x0] .dwattr $C$DW$138, DW_AT_accessibility(DW_ACCESS_public) $C$DW$139 .dwtag DW_TAG_member .dwattr $C$DW$139, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$139, DW_AT_name("GPIODIRH") .dwattr $C$DW$139, DW_AT_TI_symbol_name("_GPIODIRH") .dwattr $C$DW$139, DW_AT_data_member_location[DW_OP_plus_uconst 0x1] .dwattr $C$DW$139, DW_AT_accessibility(DW_ACCESS_public) $C$DW$140 .dwtag DW_TAG_member .dwattr $C$DW$140, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$140, DW_AT_name("GPIOINTTRIGL") .dwattr $C$DW$140, DW_AT_TI_symbol_name("_GPIOINTTRIGL") .dwattr $C$DW$140, DW_AT_data_member_location[DW_OP_plus_uconst 0x2] .dwattr $C$DW$140, DW_AT_accessibility(DW_ACCESS_public) $C$DW$141 .dwtag DW_TAG_member .dwattr $C$DW$141, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$141, DW_AT_name("GPIOINTTRIGH") .dwattr $C$DW$141, DW_AT_TI_symbol_name("_GPIOINTTRIGH") .dwattr $C$DW$141, DW_AT_data_member_location[DW_OP_plus_uconst 0x3] .dwattr $C$DW$141, DW_AT_accessibility(DW_ACCESS_public) $C$DW$142 .dwtag DW_TAG_member .dwattr $C$DW$142, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$142, DW_AT_name("GPIOINTENAL") .dwattr $C$DW$142, DW_AT_TI_symbol_name("_GPIOINTENAL") .dwattr $C$DW$142, DW_AT_data_member_location[DW_OP_plus_uconst 0x4] .dwattr $C$DW$142, DW_AT_accessibility(DW_ACCESS_public) $C$DW$143 .dwtag DW_TAG_member .dwattr $C$DW$143, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$143, DW_AT_name("GPIOINTENAH") .dwattr $C$DW$143, DW_AT_TI_symbol_name("_GPIOINTENAH") .dwattr $C$DW$143, DW_AT_data_member_location[DW_OP_plus_uconst 0x5] .dwattr $C$DW$143, DW_AT_accessibility(DW_ACCESS_public) .dwendtag $C$DW$T$29 $C$DW$T$44 .dwtag DW_TAG_typedef, DW_AT_name("CSL_GpioConfig") .dwattr $C$DW$T$44, DW_AT_type(*$C$DW$T$29) .dwattr $C$DW$T$44, DW_AT_language(DW_LANG_C) $C$DW$T$45 .dwtag DW_TAG_pointer_type .dwattr $C$DW$T$45, DW_AT_type(*$C$DW$T$44) .dwattr $C$DW$T$45, DW_AT_address_class(0x17) $C$DW$T$36 .dwtag DW_TAG_structure_type .dwattr $C$DW$T$36, DW_AT_byte_size(0x03) $C$DW$144 .dwtag DW_TAG_member .dwattr $C$DW$144, DW_AT_type(*$C$DW$T$31) .dwattr $C$DW$144, DW_AT_name("pinNum") .dwattr $C$DW$144, DW_AT_TI_symbol_name("_pinNum") .dwattr $C$DW$144, DW_AT_data_member_location[DW_OP_plus_uconst 0x0] .dwattr $C$DW$144, DW_AT_accessibility(DW_ACCESS_public) $C$DW$145 .dwtag DW_TAG_member .dwattr $C$DW$145, DW_AT_type(*$C$DW$T$33) .dwattr $C$DW$145, DW_AT_name("direction") .dwattr $C$DW$145, DW_AT_TI_symbol_name("_direction") .dwattr $C$DW$145, DW_AT_data_member_location[DW_OP_plus_uconst 0x1] .dwattr $C$DW$145, DW_AT_accessibility(DW_ACCESS_public) $C$DW$146 .dwtag DW_TAG_member .dwattr $C$DW$146, DW_AT_type(*$C$DW$T$35) .dwattr $C$DW$146, DW_AT_name("trigger") .dwattr $C$DW$146, DW_AT_TI_symbol_name("_trigger") .dwattr $C$DW$146, DW_AT_data_member_location[DW_OP_plus_uconst 0x2] .dwattr $C$DW$146, DW_AT_accessibility(DW_ACCESS_public) .dwendtag $C$DW$T$36 $C$DW$T$46 .dwtag DW_TAG_typedef, DW_AT_name("CSL_GpioPinConfig") .dwattr $C$DW$T$46, DW_AT_type(*$C$DW$T$36) .dwattr $C$DW$T$46, DW_AT_language(DW_LANG_C) $C$DW$T$47 .dwtag DW_TAG_pointer_type .dwattr $C$DW$T$47, DW_AT_type(*$C$DW$T$46) .dwattr $C$DW$T$47, DW_AT_address_class(0x17) $C$DW$T$4 .dwtag DW_TAG_base_type .dwattr $C$DW$T$4, DW_AT_encoding(DW_ATE_boolean) .dwattr $C$DW$T$4, DW_AT_name("bool") .dwattr $C$DW$T$4, DW_AT_byte_size(0x01) $C$DW$T$5 .dwtag DW_TAG_base_type .dwattr $C$DW$T$5, DW_AT_encoding(DW_ATE_signed_char) .dwattr $C$DW$T$5, DW_AT_name("signed char") .dwattr $C$DW$T$5, DW_AT_byte_size(0x01) $C$DW$T$6 .dwtag DW_TAG_base_type .dwattr $C$DW$T$6, DW_AT_encoding(DW_ATE_unsigned_char) .dwattr $C$DW$T$6, DW_AT_name("unsigned char") .dwattr $C$DW$T$6, DW_AT_byte_size(0x01) $C$DW$T$27 .dwtag DW_TAG_typedef, DW_AT_name("Uint8") .dwattr $C$DW$T$27, DW_AT_type(*$C$DW$T$6) .dwattr $C$DW$T$27, DW_AT_language(DW_LANG_C) $C$DW$T$7 .dwtag DW_TAG_base_type .dwattr $C$DW$T$7, DW_AT_encoding(DW_ATE_signed_char) .dwattr $C$DW$T$7, DW_AT_name("wchar_t") .dwattr $C$DW$T$7, DW_AT_byte_size(0x01) $C$DW$T$8 .dwtag DW_TAG_base_type .dwattr $C$DW$T$8, DW_AT_encoding(DW_ATE_signed) .dwattr $C$DW$T$8, DW_AT_name("short") .dwattr $C$DW$T$8, DW_AT_byte_size(0x01) $C$DW$T$40 .dwtag DW_TAG_typedef, DW_AT_name("Int16") .dwattr $C$DW$T$40, DW_AT_type(*$C$DW$T$8) .dwattr $C$DW$T$40, DW_AT_language(DW_LANG_C) $C$DW$T$41 .dwtag DW_TAG_typedef, DW_AT_name("CSL_Status") .dwattr $C$DW$T$41, DW_AT_type(*$C$DW$T$40) .dwattr $C$DW$T$41, DW_AT_language(DW_LANG_C) $C$DW$T$42 .dwtag DW_TAG_pointer_type .dwattr $C$DW$T$42, DW_AT_type(*$C$DW$T$41) .dwattr $C$DW$T$42, DW_AT_address_class(0x17) $C$DW$T$9 .dwtag DW_TAG_base_type .dwattr $C$DW$T$9, DW_AT_encoding(DW_ATE_unsigned) .dwattr $C$DW$T$9, DW_AT_name("unsigned short") .dwattr $C$DW$T$9, DW_AT_byte_size(0x01) $C$DW$T$19 .dwtag DW_TAG_typedef, DW_AT_name("Uint16") .dwattr $C$DW$T$19, DW_AT_type(*$C$DW$T$9) .dwattr $C$DW$T$19, DW_AT_language(DW_LANG_C) $C$DW$147 .dwtag DW_TAG_TI_far_type .dwattr $C$DW$147, DW_AT_type(*$C$DW$T$19) $C$DW$T$20 .dwtag DW_TAG_volatile_type .dwattr $C$DW$T$20, DW_AT_type(*$C$DW$147) $C$DW$T$21 .dwtag DW_TAG_array_type .dwattr $C$DW$T$21, DW_AT_type(*$C$DW$T$20) .dwattr $C$DW$T$21, DW_AT_language(DW_LANG_C) .dwattr $C$DW$T$21, DW_AT_byte_size(0x06) $C$DW$148 .dwtag DW_TAG_subrange_type .dwattr $C$DW$148, DW_AT_upper_bound(0x05) .dwendtag $C$DW$T$21 $C$DW$T$50 .dwtag DW_TAG_pointer_type .dwattr $C$DW$T$50, DW_AT_type(*$C$DW$T$19) .dwattr $C$DW$T$50, DW_AT_address_class(0x17) $C$DW$T$10 .dwtag DW_TAG_base_type .dwattr $C$DW$T$10, DW_AT_encoding(DW_ATE_signed) .dwattr $C$DW$T$10, DW_AT_name("int") .dwattr $C$DW$T$10, DW_AT_byte_size(0x01) $C$DW$T$11 .dwtag DW_TAG_base_type .dwattr $C$DW$T$11, DW_AT_encoding(DW_ATE_unsigned) .dwattr $C$DW$T$11, DW_AT_name("unsigned int") .dwattr $C$DW$T$11, DW_AT_byte_size(0x01) $C$DW$T$12 .dwtag DW_TAG_base_type .dwattr $C$DW$T$12, DW_AT_encoding(DW_ATE_signed) .dwattr $C$DW$T$12, DW_AT_name("long") .dwattr $C$DW$T$12, DW_AT_byte_size(0x02) $C$DW$T$13 .dwtag DW_TAG_base_type .dwattr $C$DW$T$13, DW_AT_encoding(DW_ATE_unsigned) .dwattr $C$DW$T$13, DW_AT_name("unsigned long") .dwattr $C$DW$T$13, DW_AT_byte_size(0x02) $C$DW$T$14 .dwtag DW_TAG_base_type .dwattr $C$DW$T$14, DW_AT_encoding(DW_ATE_signed) .dwattr $C$DW$T$14, DW_AT_name("long long") .dwattr $C$DW$T$14, DW_AT_byte_size(0x04) .dwattr $C$DW$T$14, DW_AT_bit_size(0x28) .dwattr $C$DW$T$14, DW_AT_bit_offset(0x18) $C$DW$T$15 .dwtag DW_TAG_base_type .dwattr $C$DW$T$15, DW_AT_encoding(DW_ATE_unsigned) .dwattr $C$DW$T$15, DW_AT_name("unsigned long long") .dwattr $C$DW$T$15, DW_AT_byte_size(0x04) .dwattr $C$DW$T$15, DW_AT_bit_size(0x28) .dwattr $C$DW$T$15, DW_AT_bit_offset(0x18) $C$DW$T$16 .dwtag DW_TAG_base_type .dwattr $C$DW$T$16, DW_AT_encoding(DW_ATE_float) .dwattr $C$DW$T$16, DW_AT_name("float") .dwattr $C$DW$T$16, DW_AT_byte_size(0x02) $C$DW$T$17 .dwtag DW_TAG_base_type .dwattr $C$DW$T$17, DW_AT_encoding(DW_ATE_float) .dwattr $C$DW$T$17, DW_AT_name("double") .dwattr $C$DW$T$17, DW_AT_byte_size(0x02) $C$DW$T$18 .dwtag DW_TAG_base_type .dwattr $C$DW$T$18, DW_AT_encoding(DW_ATE_float) .dwattr $C$DW$T$18, DW_AT_name("long double") .dwattr $C$DW$T$18, DW_AT_byte_size(0x02) .dwattr $C$DW$CU, DW_AT_language(DW_LANG_C) ;*************************************************************** ;* DWARF CIE ENTRIES * ;*************************************************************** $C$DW$CIE .dwcie 91 .dwcfi cfa_register, 36 .dwcfi cfa_offset, 0 .dwcfi undefined, 0 .dwcfi undefined, 1 .dwcfi undefined, 2 .dwcfi undefined, 3 .dwcfi undefined, 4 .dwcfi undefined, 5 .dwcfi undefined, 6 .dwcfi undefined, 7 .dwcfi undefined, 8 .dwcfi undefined, 9 .dwcfi undefined, 10 .dwcfi undefined, 11 .dwcfi undefined, 12 .dwcfi undefined, 13 .dwcfi same_value, 14 .dwcfi same_value, 15 .dwcfi undefined, 16 .dwcfi undefined, 17 .dwcfi undefined, 18 .dwcfi undefined, 19 .dwcfi undefined, 20 .dwcfi undefined, 21 .dwcfi undefined, 22 .dwcfi undefined, 23 .dwcfi undefined, 24 .dwcfi undefined, 25 .dwcfi same_value, 26 .dwcfi same_value, 27 .dwcfi same_value, 28 .dwcfi same_value, 29 .dwcfi same_value, 30 .dwcfi same_value, 31 .dwcfi undefined, 32 .dwcfi undefined, 33 .dwcfi undefined, 34 .dwcfi undefined, 35 .dwcfi undefined, 36 .dwcfi undefined, 37 .dwcfi undefined, 38 .dwcfi undefined, 39 .dwcfi undefined, 40 .dwcfi undefined, 41 .dwcfi undefined, 42 .dwcfi undefined, 43 .dwcfi undefined, 44 .dwcfi undefined, 45 .dwcfi undefined, 46 .dwcfi undefined, 47 .dwcfi undefined, 48 .dwcfi undefined, 49 .dwcfi undefined, 50 .dwcfi undefined, 51 .dwcfi undefined, 52 .dwcfi undefined, 53 .dwcfi undefined, 54 .dwcfi undefined, 55 .dwcfi undefined, 56 .dwcfi undefined, 57 .dwcfi undefined, 58 .dwcfi undefined, 59 .dwcfi undefined, 60 .dwcfi undefined, 61 .dwcfi undefined, 62 .dwcfi undefined, 63 .dwcfi undefined, 64 .dwcfi undefined, 65 .dwcfi undefined, 66 .dwcfi undefined, 67 .dwcfi undefined, 68 .dwcfi undefined, 69 .dwcfi undefined, 70 .dwcfi undefined, 71 .dwcfi undefined, 72 .dwcfi undefined, 73 .dwcfi undefined, 74 .dwcfi undefined, 75 .dwcfi undefined, 76 .dwcfi undefined, 77 .dwcfi undefined, 78 .dwcfi undefined, 79 .dwcfi undefined, 80 .dwcfi undefined, 81 .dwcfi undefined, 82 .dwcfi undefined, 83 .dwcfi undefined, 84 .dwcfi undefined, 85 .dwcfi undefined, 86 .dwcfi undefined, 87 .dwcfi undefined, 88 .dwcfi undefined, 89 .dwcfi undefined, 90 .dwcfi undefined, 91 .dwendentry ;*************************************************************** ;* DWARF REGISTER MAP * ;*************************************************************** $C$DW$149 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0") .dwattr $C$DW$149, DW_AT_location[DW_OP_reg0] $C$DW$150 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0") .dwattr $C$DW$150, DW_AT_location[DW_OP_reg1] $C$DW$151 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC0_G") .dwattr $C$DW$151, DW_AT_location[DW_OP_reg2] $C$DW$152 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1") .dwattr $C$DW$152, DW_AT_location[DW_OP_reg3] $C$DW$153 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1") .dwattr $C$DW$153, DW_AT_location[DW_OP_reg4] $C$DW$154 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC1_G") .dwattr $C$DW$154, DW_AT_location[DW_OP_reg5] $C$DW$155 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2") .dwattr $C$DW$155, DW_AT_location[DW_OP_reg6] $C$DW$156 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2") .dwattr $C$DW$156, DW_AT_location[DW_OP_reg7] $C$DW$157 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC2_G") .dwattr $C$DW$157, DW_AT_location[DW_OP_reg8] $C$DW$158 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3") .dwattr $C$DW$158, DW_AT_location[DW_OP_reg9] $C$DW$159 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3") .dwattr $C$DW$159, DW_AT_location[DW_OP_reg10] $C$DW$160 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AC3_G") .dwattr $C$DW$160, DW_AT_location[DW_OP_reg11] $C$DW$161 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T0") .dwattr $C$DW$161, DW_AT_location[DW_OP_reg12] $C$DW$162 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T1") .dwattr $C$DW$162, DW_AT_location[DW_OP_reg13] $C$DW$163 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T2") .dwattr $C$DW$163, DW_AT_location[DW_OP_reg14] $C$DW$164 .dwtag DW_TAG_TI_assign_register, DW_AT_name("T3") .dwattr $C$DW$164, DW_AT_location[DW_OP_reg15] $C$DW$165 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR0") .dwattr $C$DW$165, DW_AT_location[DW_OP_reg16] $C$DW$166 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR0") .dwattr $C$DW$166, DW_AT_location[DW_OP_reg17] $C$DW$167 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR1") .dwattr $C$DW$167, DW_AT_location[DW_OP_reg18] $C$DW$168 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR1") .dwattr $C$DW$168, DW_AT_location[DW_OP_reg19] $C$DW$169 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR2") .dwattr $C$DW$169, DW_AT_location[DW_OP_reg20] $C$DW$170 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR2") .dwattr $C$DW$170, DW_AT_location[DW_OP_reg21] $C$DW$171 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR3") .dwattr $C$DW$171, DW_AT_location[DW_OP_reg22] $C$DW$172 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR3") .dwattr $C$DW$172, DW_AT_location[DW_OP_reg23] $C$DW$173 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR4") .dwattr $C$DW$173, DW_AT_location[DW_OP_reg24] $C$DW$174 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR4") .dwattr $C$DW$174, DW_AT_location[DW_OP_reg25] $C$DW$175 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR5") .dwattr $C$DW$175, DW_AT_location[DW_OP_reg26] $C$DW$176 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR5") .dwattr $C$DW$176, DW_AT_location[DW_OP_reg27] $C$DW$177 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR6") .dwattr $C$DW$177, DW_AT_location[DW_OP_reg28] $C$DW$178 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR6") .dwattr $C$DW$178, DW_AT_location[DW_OP_reg29] $C$DW$179 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR7") .dwattr $C$DW$179, DW_AT_location[DW_OP_reg30] $C$DW$180 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XAR7") .dwattr $C$DW$180, DW_AT_location[DW_OP_reg31] $C$DW$181 .dwtag DW_TAG_TI_assign_register, DW_AT_name("FP") .dwattr $C$DW$181, DW_AT_location[DW_OP_regx 0x20] $C$DW$182 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XFP") .dwattr $C$DW$182, DW_AT_location[DW_OP_regx 0x21] $C$DW$183 .dwtag DW_TAG_TI_assign_register, DW_AT_name("PC") .dwattr $C$DW$183, DW_AT_location[DW_OP_regx 0x22] $C$DW$184 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SP") .dwattr $C$DW$184, DW_AT_location[DW_OP_regx 0x23] $C$DW$185 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XSP") .dwattr $C$DW$185, DW_AT_location[DW_OP_regx 0x24] $C$DW$186 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BKC") .dwattr $C$DW$186, DW_AT_location[DW_OP_regx 0x25] $C$DW$187 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BK03") .dwattr $C$DW$187, DW_AT_location[DW_OP_regx 0x26] $C$DW$188 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BK47") .dwattr $C$DW$188, DW_AT_location[DW_OP_regx 0x27] $C$DW$189 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST0") .dwattr $C$DW$189, DW_AT_location[DW_OP_regx 0x28] $C$DW$190 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST1") .dwattr $C$DW$190, DW_AT_location[DW_OP_regx 0x29] $C$DW$191 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST2") .dwattr $C$DW$191, DW_AT_location[DW_OP_regx 0x2a] $C$DW$192 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ST3") .dwattr $C$DW$192, DW_AT_location[DW_OP_regx 0x2b] $C$DW$193 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP") .dwattr $C$DW$193, DW_AT_location[DW_OP_regx 0x2c] $C$DW$194 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP05") .dwattr $C$DW$194, DW_AT_location[DW_OP_regx 0x2d] $C$DW$195 .dwtag DW_TAG_TI_assign_register, DW_AT_name("MDP67") .dwattr $C$DW$195, DW_AT_location[DW_OP_regx 0x2e] $C$DW$196 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRC0") .dwattr $C$DW$196, DW_AT_location[DW_OP_regx 0x2f] $C$DW$197 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA0") .dwattr $C$DW$197, DW_AT_location[DW_OP_regx 0x30] $C$DW$198 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA0_H") .dwattr $C$DW$198, DW_AT_location[DW_OP_regx 0x31] $C$DW$199 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA0") .dwattr $C$DW$199, DW_AT_location[DW_OP_regx 0x32] $C$DW$200 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA0_H") .dwattr $C$DW$200, DW_AT_location[DW_OP_regx 0x33] $C$DW$201 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRS1") .dwattr $C$DW$201, DW_AT_location[DW_OP_regx 0x34] $C$DW$202 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BRC1") .dwattr $C$DW$202, DW_AT_location[DW_OP_regx 0x35] $C$DW$203 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA1") .dwattr $C$DW$203, DW_AT_location[DW_OP_regx 0x36] $C$DW$204 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RSA1_H") .dwattr $C$DW$204, DW_AT_location[DW_OP_regx 0x37] $C$DW$205 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA1") .dwattr $C$DW$205, DW_AT_location[DW_OP_regx 0x38] $C$DW$206 .dwtag DW_TAG_TI_assign_register, DW_AT_name("REA1_H") .dwattr $C$DW$206, DW_AT_location[DW_OP_regx 0x39] $C$DW$207 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CSR") .dwattr $C$DW$207, DW_AT_location[DW_OP_regx 0x3a] $C$DW$208 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RPTC") .dwattr $C$DW$208, DW_AT_location[DW_OP_regx 0x3b] $C$DW$209 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CDP") .dwattr $C$DW$209, DW_AT_location[DW_OP_regx 0x3c] $C$DW$210 .dwtag DW_TAG_TI_assign_register, DW_AT_name("XCDP") .dwattr $C$DW$210, DW_AT_location[DW_OP_regx 0x3d] $C$DW$211 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TRN0") .dwattr $C$DW$211, DW_AT_location[DW_OP_regx 0x3e] $C$DW$212 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TRN1") .dwattr $C$DW$212, DW_AT_location[DW_OP_regx 0x3f] $C$DW$213 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA01") .dwattr $C$DW$213, DW_AT_location[DW_OP_regx 0x40] $C$DW$214 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA23") .dwattr $C$DW$214, DW_AT_location[DW_OP_regx 0x41] $C$DW$215 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA45") .dwattr $C$DW$215, DW_AT_location[DW_OP_regx 0x42] $C$DW$216 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSA67") .dwattr $C$DW$216, DW_AT_location[DW_OP_regx 0x43] $C$DW$217 .dwtag DW_TAG_TI_assign_register, DW_AT_name("BSAC") .dwattr $C$DW$217, DW_AT_location[DW_OP_regx 0x44] $C$DW$218 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CARRY") .dwattr $C$DW$218, DW_AT_location[DW_OP_regx 0x45] $C$DW$219 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TC1") .dwattr $C$DW$219, DW_AT_location[DW_OP_regx 0x46] $C$DW$220 .dwtag DW_TAG_TI_assign_register, DW_AT_name("TC2") .dwattr $C$DW$220, DW_AT_location[DW_OP_regx 0x47] $C$DW$221 .dwtag DW_TAG_TI_assign_register, DW_AT_name("M40") .dwattr $C$DW$221, DW_AT_location[DW_OP_regx 0x48] $C$DW$222 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SXMD") .dwattr $C$DW$222, DW_AT_location[DW_OP_regx 0x49] $C$DW$223 .dwtag DW_TAG_TI_assign_register, DW_AT_name("ARMS") .dwattr $C$DW$223, DW_AT_location[DW_OP_regx 0x4a] $C$DW$224 .dwtag DW_TAG_TI_assign_register, DW_AT_name("C54CM") .dwattr $C$DW$224, DW_AT_location[DW_OP_regx 0x4b] $C$DW$225 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SATA") .dwattr $C$DW$225, DW_AT_location[DW_OP_regx 0x4c] $C$DW$226 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SATD") .dwattr $C$DW$226, DW_AT_location[DW_OP_regx 0x4d] $C$DW$227 .dwtag DW_TAG_TI_assign_register, DW_AT_name("RDM") .dwattr $C$DW$227, DW_AT_location[DW_OP_regx 0x4e] $C$DW$228 .dwtag DW_TAG_TI_assign_register, DW_AT_name("FRCT") .dwattr $C$DW$228, DW_AT_location[DW_OP_regx 0x4f] $C$DW$229 .dwtag DW_TAG_TI_assign_register, DW_AT_name("SMUL") .dwattr $C$DW$229, DW_AT_location[DW_OP_regx 0x50] $C$DW$230 .dwtag DW_TAG_TI_assign_register, DW_AT_name("INTM") .dwattr $C$DW$230, DW_AT_location[DW_OP_regx 0x51] $C$DW$231 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR0LC") .dwattr $C$DW$231, DW_AT_location[DW_OP_regx 0x52] $C$DW$232 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR1LC") .dwattr $C$DW$232, DW_AT_location[DW_OP_regx 0x53] $C$DW$233 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR2LC") .dwattr $C$DW$233, DW_AT_location[DW_OP_regx 0x54] $C$DW$234 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR3LC") .dwattr $C$DW$234, DW_AT_location[DW_OP_regx 0x55] $C$DW$235 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR4LC") .dwattr $C$DW$235, DW_AT_location[DW_OP_regx 0x56] $C$DW$236 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR5LC") .dwattr $C$DW$236, DW_AT_location[DW_OP_regx 0x57] $C$DW$237 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR6LC") .dwattr $C$DW$237, DW_AT_location[DW_OP_regx 0x58] $C$DW$238 .dwtag DW_TAG_TI_assign_register, DW_AT_name("AR7LC") .dwattr $C$DW$238, DW_AT_location[DW_OP_regx 0x59] $C$DW$239 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CDPLC") .dwattr $C$DW$239, DW_AT_location[DW_OP_regx 0x5a] $C$DW$240 .dwtag DW_TAG_TI_assign_register, DW_AT_name("CIE_RETA") .dwattr $C$DW$240, DW_AT_location[DW_OP_regx 0x5b] .dwendtag $C$DW$CU
#import "64spec/lib/64spec.asm" #import "../lib/tiles-color-ram-shift.asm" #import "common/lib/invoke-global.asm" sfspec: init_spec() describe("_shiftInterleavedLeft odd") it("shifts mem left by 1 from [0,0]"); { c64lib_pushParamW(initialScreenData0) c64lib_pushParamW(testScreenData) c64lib_pushParamW(1000) jsr copyLargeMemForward lda #0 sta x sta y jsr shiftInterleavedLeft assert_bytes_equal 1000: testScreenData: expectedScreenLeft0 } it("shifts mem left by 1 from [1,1]"); { c64lib_pushParamW(initialScreenData1) c64lib_pushParamW(testScreenData) c64lib_pushParamW(1000) jsr copyLargeMemForward lda #%10000000 sta x sta y jsr shiftInterleavedLeft assert_bytes_equal 1000: testScreenData: expectedScreenLeft1 } describe("_shiftInterleavedRight") it("shifts mem right by 1 from [0,0]"); { c64lib_pushParamW(initialScreenData0) c64lib_pushParamW(testScreenData) c64lib_pushParamW(1000) jsr copyLargeMemForward lda #0 sta x sta y jsr shiftInterleavedRight assert_bytes_equal 1000: testScreenData: expectedScreenRight0 } it("shifts mem right by 1 from [1,1]"); { c64lib_pushParamW(initialScreenData1) c64lib_pushParamW(testScreenData) c64lib_pushParamW(1000) jsr copyLargeMemForward lda #%10000000 sta x sta y jsr shiftInterleavedRight assert_bytes_equal 1000: testScreenData: expectedScreenRight1 } describe("_shiftInterleavedTop") it("shifts mem top by 1 from [0,0]"); { c64lib_pushParamW(initialScreenData0) c64lib_pushParamW(testScreenData) c64lib_pushParamW(1000) jsr copyLargeMemForward lda #0 sta x sta y jsr shiftInterleavedTop assert_bytes_equal 1000: testScreenData: expectedScreenTop0 } it("shifts mem top by 1 from [1,1]"); { c64lib_pushParamW(initialScreenData1) c64lib_pushParamW(testScreenData) c64lib_pushParamW(1000) jsr copyLargeMemForward lda #%10000000 sta x sta y jsr shiftInterleavedTop assert_bytes_equal 1000: testScreenData: expectedScreenTop1 } describe("_shiftInterleavedBottom") it("shifts mem bottm by 1 from [0,0]"); { c64lib_pushParamW(initialScreenData0) c64lib_pushParamW(testScreenData) c64lib_pushParamW(1000) jsr copyLargeMemForward lda #0 sta x sta y jsr shiftInterleavedBottom assert_bytes_equal 1000: testScreenData: expectedScreenBottom0 } it("shifts mem bottm by 1 from [1,1]"); { c64lib_pushParamW(initialScreenData1) c64lib_pushParamW(testScreenData) c64lib_pushParamW(1000) jsr copyLargeMemForward lda #%10000000 sta x sta y jsr shiftInterleavedBottom assert_bytes_equal 1000: testScreenData: expectedScreenBottom1 } finish_spec() * = * "Data" x: .word 0 y: .word 0 .namespace c64lib { .var @cfg = TileCommonConfig() .eval @cfg.bank = 0 .eval @cfg.page0 = 5120/1024 .eval @cfg.startRow = 1 .eval @cfg.endRow = 23 .eval @cfg.x = x .eval @cfg.y = y } initialScreenData0: { // "0000011111222223333344444555556666677777" .text "1234567890123456789012345678901234567890" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "1234567890123456789012345678901234567890" } initialScreenData1: { // "0000011111222223333344444555556666677777" .text "1234567890123456789012345678901234567890" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "1234567890123456789012345678901234567890" } testScreenData: { .fill 1000, 0 } expectedScreenLeft0: { // "0000011111222223333344444555556666677777" .text "1234567890123456789012345678901234567890" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xxx" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xxx" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xxx" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xxx" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xxx" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xxx" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xxx" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xxx" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xxx" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xxx" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xxx" .text "1234567890123456789012345678901234567890" } expectedScreenLeft1: { // "0000011111222223333344444555556666677777" .text "1234567890123456789012345678901234567890" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "1234567890123456789012345678901234567890" } expectedScreenRight0: { // "0000011111222223333344444555556666677777" .text "1234567890123456789012345678901234567890" .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "...xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "...xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "...xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "...xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "...xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "...xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "...xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "...xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "...xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "...xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "xxx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "...xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "1234567890123456789012345678901234567890" } expectedScreenRight1: { // "0000011111222223333344444555556666677777" .text "1234567890123456789012345678901234567890" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "1234567890123456789012345678901234567890" } expectedScreenTop0: { // "0000011111222223333344444555556666677777" .text "1234567890123456789012345678901234567890" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "1234567890123456789012345678901234567890" } expectedScreenTop1: { // "0000011111222223333344444555556666677777" .text "1234567890123456789012345678901234567890" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "1234567890123456789012345678901234567890" } expectedScreenBottom0: { // "0000011111222223333344444555556666677777" .text "1234567890123456789012345678901234567890" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "..xx..xx..xx..xx..xx..xx..xx..xx..xx..xx" .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "xx..xx..xx..xx..xx..xx..xx..xx..xx..xx.." .text "1234567890123456789012345678901234567890" } expectedScreenBottom1: { // "0000011111222223333344444555556666677777" .text "1234567890123456789012345678901234567890" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text "x..xx..xx..xx..xx..xx..xx..xx..xx..xx..x" .text ".xx..xx..xx..xx..xx..xx..xx..xx..xx..xx." .text "1234567890123456789012345678901234567890" } codeBegin: shiftInterleavedLeft: .namespace c64lib { _t2_shiftInterleavedLeft(@cfg, testScreenData, 2); rts } shiftInterleavedRight: .namespace c64lib { _t2_shiftInterleavedRight(@cfg, testScreenData, 2); rts } shiftInterleavedTop: .namespace c64lib { _t2_shiftInterleavedTop(@cfg, testScreenData, 2); rts } shiftInterleavedBottom: .namespace c64lib { _t2_shiftInterleavedBottom(@cfg, testScreenData, 2); rts } codeEnd: copyLargeMemForward: #import "common/lib/sub/copy-large-mem-forward.asm" .print "Total size of tested subroutines = " + (codeEnd - codeBegin) + " bytes"
/// \file // Range v3 library // // Copyright Eric Niebler 2014-present // // Use, modification and distribution is subject to 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) // // Project home: https://github.com/ericniebler/range-v3 // #ifndef RANGES_V3_ALGORITHM_REPLACE_COPY_IF_HPP #define RANGES_V3_ALGORITHM_REPLACE_COPY_IF_HPP #include <meta/meta.hpp> #include <range/v3/range_fwd.hpp> #include <range/v3/algorithm/result_types.hpp> #include <range/v3/functional/identity.hpp> #include <range/v3/functional/invoke.hpp> #include <range/v3/iterator/concepts.hpp> #include <range/v3/iterator/traits.hpp> #include <range/v3/range/access.hpp> #include <range/v3/range/concepts.hpp> #include <range/v3/range/dangling.hpp> #include <range/v3/range/traits.hpp> #include <range/v3/utility/static_const.hpp> #include <range/v3/detail/prologue.hpp> namespace ranges { /// \addtogroup group-algorithms /// @{ template<typename I, typename O> using replace_copy_if_result = detail::in_out_result<I, O>; RANGES_FUNC_BEGIN(replace_copy_if) /// \brief function template \c replace_copy_if template(typename I, typename S, typename O, typename C, typename T, typename P = identity)( /// \pre requires input_iterator<I> AND sentinel_for<S, I> AND output_iterator<O, T const &> AND indirect_unary_predicate<C, projected<I, P>> AND indirectly_copyable<I, O>) replace_copy_if_result<I, O> RANGES_FUNC(replace_copy_if)( I first, S last, O out, C pred, T const & new_value, P proj = {}) // { for(; first != last; ++first, ++out) { auto && x = *first; if(invoke(pred, invoke(proj, x))) *out = new_value; else *out = (decltype(x) &&)x; } return {first, out}; } /// \overload template(typename Rng, typename O, typename C, typename T, typename P = identity)( /// \pre requires input_range<Rng> AND output_iterator<O, T const &> AND indirect_unary_predicate<C, projected<iterator_t<Rng>, P>> AND indirectly_copyable<iterator_t<Rng>, O>) replace_copy_if_result<borrowed_iterator_t<Rng>, O> RANGES_FUNC(replace_copy_if)( Rng && rng, O out, C pred, T const & new_value, P proj = {}) // { return (*this)(begin(rng), end(rng), std::move(out), std::move(pred), new_value, std::move(proj)); } RANGES_FUNC_END(replace_copy_if) namespace cpp20 { using ranges::replace_copy_if; using ranges::replace_copy_if_result; } // namespace cpp20 /// @} } // namespace ranges #include <range/v3/detail/epilogue.hpp> #endif
// Copyright (c) 2012 The Bitcoin developers // Copyright (c) 2014 The Inutoshi developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "version.h" #include <string> // Name of client reported in the 'version' message. Report the same name // for both speedtradecoind and speedtradecoin-qt, to make it harder for attackers to // target servers or GUI users specifically. const std::string CLIENT_NAME("ligoshi"); // Client version number #define CLIENT_VERSION_SUFFIX "" // The following part of the code determines the CLIENT_BUILD variable. // Several mechanisms are used for this: // * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is // generated by the build environment, possibly containing the output // of git-describe in a macro called BUILD_DESC // * secondly, if this is an exported version of the code, GIT_ARCHIVE will // be defined (automatically using the export-subst git attribute), and // GIT_COMMIT will contain the commit id. // * then, three options exist for determining CLIENT_BUILD: // * if BUILD_DESC is defined, use that literally (output of git-describe) // * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit] // * otherwise, use v[maj].[min].[rev].[build]-unk // finally CLIENT_VERSION_SUFFIX is added // First, include build.h if requested #ifdef HAVE_BUILD_INFO # include "build.h" #endif // git will put "#define GIT_ARCHIVE 1" on the next line inside archives. #define GIT_ARCHIVE 1 #ifdef GIT_ARCHIVE # define GIT_COMMIT_ID "eab30077f" # define GIT_COMMIT_DATE "Tue, 20 Oct 2017 20:19:01 +0200" #endif #define BUILD_DESC_WITH_SUFFIX(maj,min,rev,build,suffix) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix) #define BUILD_DESC_FROM_COMMIT(maj,min,rev,build,commit) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit #define BUILD_DESC_FROM_UNKNOWN(maj,min,rev,build) \ "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk" #ifndef BUILD_DESC # ifdef BUILD_SUFFIX # define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX) # elif defined(GIT_COMMIT_ID) # define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID) # else # define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD) # endif #endif #ifndef BUILD_DATE # ifdef GIT_COMMIT_DATE # define BUILD_DATE GIT_COMMIT_DATE # else # define BUILD_DATE __DATE__ ", " __TIME__ # endif #endif const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX); const std::string CLIENT_DATE(BUILD_DATE);
;/* ; * FreeRTOS Kernel <DEVELOPMENT BRANCH> ; * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. ; * ; * SPDX-License-Identifier: MIT ; * ; * 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. ; * ; * https://www.FreeRTOS.org ; * https://github.com/FreeRTOS ; * ; */ .text .arm .ref vTaskSwitchContext .ref xTaskIncrementTick .ref ulTaskHasFPUContext .ref pxCurrentTCB ;/*-----------------------------------------------------------*/ ; ; Save Task Context ; portSAVE_CONTEXT .macro DSB ; Push R0 as we are going to use it STMDB SP!, {R0} ; Set R0 to point to the task stack pointer. STMDB SP,{SP}^ SUB SP, SP, #4 LDMIA SP!,{R0} ; Push the return address onto the stack. STMDB R0!, {LR} ; Now LR has been saved, it can be used instead of R0. MOV LR, R0 ; Pop R0 so it can be saved onto the task stack. LDMIA SP!, {R0} ; Push all the system mode registers onto the task stack. STMDB LR,{R0-LR}^ SUB LR, LR, #60 ; Push the SPSR onto the task stack. MRS R0, SPSR STMDB LR!, {R0} .if (__TI_VFP_SUPPORT__) ;Determine if the task maintains an FPU context. LDR R0, ulFPUContextConst LDR R0, [R0] ; Test the flag CMP R0, #0 ; If the task is not using a floating point context then skip the ; saving of the FPU registers. BEQ $+16 FSTMDBD LR!, {D0-D15} FMRX R1, FPSCR STMFD LR!, {R1} ; Save the flag STMDB LR!, {R0} .endif ; Store the new top of stack for the task. LDR R0, pxCurrentTCBConst LDR R0, [R0] STR LR, [R0] .endm ;/*-----------------------------------------------------------*/ ; ; Restore Task Context ; portRESTORE_CONTEXT .macro LDR R0, pxCurrentTCBConst LDR R0, [R0] LDR LR, [R0] .if (__TI_VFP_SUPPORT__) ; The floating point context flag is the first thing on the stack. LDR R0, ulFPUContextConst LDMFD LR!, {R1} STR R1, [R0] ; Test the flag CMP R1, #0 ; If the task is not using a floating point context then skip the ; VFP register loads. BEQ $+16 ; Restore the floating point context. LDMFD LR!, {R0} FLDMIAD LR!, {D0-D15} FMXR FPSCR, R0 .endif ; Get the SPSR from the stack. LDMFD LR!, {R0} MSR SPSR_CSXF, R0 ; Restore all system mode registers for the task. LDMFD LR, {R0-R14}^ ; Restore the return address. LDR LR, [LR, #+60] ; And return - correcting the offset in the LR to obtain the ; correct address. SUBS PC, LR, #4 .endm ;/*-----------------------------------------------------------*/ ; Start the first task by restoring its context. .def vPortStartFirstTask vPortStartFirstTask: portRESTORE_CONTEXT ;/*-----------------------------------------------------------*/ ; Yield to another task. .def vPortYieldProcessor vPortYieldProcessor: ; Within an IRQ ISR the link register has an offset from the true return ; address. SWI doesn't do this. Add the offset manually so the ISR ; return code can be used. ADD LR, LR, #4 ; First save the context of the current task. portSAVE_CONTEXT ; Select the next task to execute. */ BL vTaskSwitchContext ; Restore the context of the task selected to execute. portRESTORE_CONTEXT ;/*-----------------------------------------------------------*/ ; Yield to another task from within the FreeRTOS API .def vPortYeildWithinAPI vPortYeildWithinAPI: ; Save the context of the current task. portSAVE_CONTEXT ; Clear SSI flag. MOVW R0, #0xFFF4 MOVT R0, #0xFFFF LDR R0, [R0] ; Select the next task to execute. */ BL vTaskSwitchContext ; Restore the context of the task selected to execute. portRESTORE_CONTEXT ;/*-----------------------------------------------------------*/ ; Preemptive Tick .def vPortPreemptiveTick vPortPreemptiveTick: ; Save the context of the current task. portSAVE_CONTEXT ; Clear interrupt flag MOVW R0, #0xFC88 MOVT R0, #0xFFFF MOV R1, #1 STR R1, [R0] ; Increment the tick count, making any adjustments to the blocked lists ; that may be necessary. BL xTaskIncrementTick ; Select the next task to execute. CMP R0, #0 BLNE vTaskSwitchContext ; Restore the context of the task selected to execute. portRESTORE_CONTEXT ;------------------------------------------------------------------------------- .if (__TI_VFP_SUPPORT__) .def vPortInitialiseFPSCR vPortInitialiseFPSCR: MOV R0, #0 FMXR FPSCR, R0 BX LR .endif ;__TI_VFP_SUPPORT__ pxCurrentTCBConst .word pxCurrentTCB ulFPUContextConst .word ulTaskHasFPUContext ;-------------------------------------------------------------------------------
; ; Copyright (c) 2010 The WebM project authors. All Rights Reserved. ; ; Use of this source code is governed by a BSD-style license ; that can be found in the LICENSE file in the root of the source ; tree. An additional intellectual property rights grant can be found ; in the file PATENTS. All contributing project authors may ; be found in the AUTHORS file in the root of the source tree. ; %include "vpx_ports/x86_abi_support.asm" ;void vp8_loop_filter_horizontal_edge_mmx ;( ; unsigned char *src_ptr, ; int src_pixel_step, ; const char *flimit, ; const char *limit, ; const char *thresh, ; int count ;) global sym(vp8_loop_filter_horizontal_edge_mmx) sym(vp8_loop_filter_horizontal_edge_mmx): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 GET_GOT rbx push rsi push rdi ; end prolog ALIGN_STACK 16, rax sub rsp, 32 ; reserve 32 bytes %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8]; %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8]; mov rsi, arg(0) ;src_ptr movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch? movsxd rcx, dword ptr arg(5) ;count next8_h: mov rdx, arg(3) ;limit movq mm7, [rdx] mov rdi, rsi ; rdi points to row +1 for indirect addressing add rdi, rax ; calculate breakout conditions movq mm2, [rdi+2*rax] ; q3 movq mm1, [rsi+2*rax] ; q2 movq mm6, mm1 ; q2 psubusb mm1, mm2 ; q2-=q3 psubusb mm2, mm6 ; q3-=q2 por mm1, mm2 ; abs(q3-q2) psubusb mm1, mm7 ; movq mm4, [rsi+rax] ; q1 movq mm3, mm4 ; q1 psubusb mm4, mm6 ; q1-=q2 psubusb mm6, mm3 ; q2-=q1 por mm4, mm6 ; abs(q2-q1) psubusb mm4, mm7 por mm1, mm4 movq mm4, [rsi] ; q0 movq mm0, mm4 ; q0 psubusb mm4, mm3 ; q0-=q1 psubusb mm3, mm0 ; q1-=q0 por mm4, mm3 ; abs(q0-q1) movq t0, mm4 ; save to t0 psubusb mm4, mm7 por mm1, mm4 neg rax ; negate pitch to deal with above border movq mm2, [rsi+4*rax] ; p3 movq mm4, [rdi+4*rax] ; p2 movq mm5, mm4 ; p2 psubusb mm4, mm2 ; p2-=p3 psubusb mm2, mm5 ; p3-=p2 por mm4, mm2 ; abs(p3 - p2) psubusb mm4, mm7 por mm1, mm4 movq mm4, [rsi+2*rax] ; p1 movq mm3, mm4 ; p1 psubusb mm4, mm5 ; p1-=p2 psubusb mm5, mm3 ; p2-=p1 por mm4, mm5 ; abs(p2 - p1) psubusb mm4, mm7 por mm1, mm4 movq mm2, mm3 ; p1 movq mm4, [rsi+rax] ; p0 movq mm5, mm4 ; p0 psubusb mm4, mm3 ; p0-=p1 psubusb mm3, mm5 ; p1-=p0 por mm4, mm3 ; abs(p1 - p0) movq t1, mm4 ; save to t1 psubusb mm4, mm7 por mm1, mm4 movq mm3, [rdi] ; q1 movq mm4, mm3 ; q1 psubusb mm3, mm2 ; q1-=p1 psubusb mm2, mm4 ; p1-=q1 por mm2, mm3 ; abs(p1-q1) pand mm2, [GLOBAL(tfe)] ; set lsb of each byte to zero psrlw mm2, 1 ; abs(p1-q1)/2 movq mm6, mm5 ; p0 movq mm3, [rsi] ; q0 psubusb mm5, mm3 ; p0-=q0 psubusb mm3, mm6 ; q0-=p0 por mm5, mm3 ; abs(p0 - q0) paddusb mm5, mm5 ; abs(p0-q0)*2 paddusb mm5, mm2 ; abs (p0 - q0) *2 + abs(p1-q1)/2 mov rdx, arg(2) ;flimit ; get flimit movq mm2, [rdx] ; flimit mm2 paddb mm2, mm2 ; flimit*2 (less than 255) paddb mm7, mm2 ; flimit * 2 + limit (less than 255) psubusb mm5, mm7 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > flimit * 2 + limit por mm1, mm5 pxor mm5, mm5 pcmpeqb mm1, mm5 ; mask mm1 ; calculate high edge variance mov rdx, arg(4) ;thresh ; get thresh movq mm7, [rdx] ; movq mm4, t0 ; get abs (q1 - q0) psubusb mm4, mm7 movq mm3, t1 ; get abs (p1 - p0) psubusb mm3, mm7 paddb mm4, mm3 ; abs(q1 - q0) > thresh || abs(p1 - p0) > thresh pcmpeqb mm4, mm5 pcmpeqb mm5, mm5 pxor mm4, mm5 ; start work on filters movq mm2, [rsi+2*rax] ; p1 movq mm7, [rdi] ; q1 pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values psubsb mm2, mm7 ; p1 - q1 pand mm2, mm4 ; high var mask (hvm)(p1 - q1) pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values movq mm3, mm0 ; q0 psubsb mm0, mm6 ; q0 - p0 paddsb mm2, mm0 ; 1 * (q0 - p0) + hvm(p1 - q1) paddsb mm2, mm0 ; 2 * (q0 - p0) + hvm(p1 - q1) paddsb mm2, mm0 ; 3 * (q0 - p0) + hvm(p1 - q1) pand mm1, mm2 ; mask filter values we don't care about movq mm2, mm1 paddsb mm1, [GLOBAL(t4)] ; 3* (q0 - p0) + hvm(p1 - q1) + 4 paddsb mm2, [GLOBAL(t3)] ; 3* (q0 - p0) + hvm(p1 - q1) + 3 pxor mm0, mm0 ; pxor mm5, mm5 punpcklbw mm0, mm2 ; punpckhbw mm5, mm2 ; psraw mm0, 11 ; psraw mm5, 11 packsswb mm0, mm5 movq mm2, mm0 ; (3* (q0 - p0) + hvm(p1 - q1) + 3) >> 3; pxor mm0, mm0 ; 0 movq mm5, mm1 ; abcdefgh punpcklbw mm0, mm1 ; e0f0g0h0 psraw mm0, 11 ; sign extended shift right by 3 pxor mm1, mm1 ; 0 punpckhbw mm1, mm5 ; a0b0c0d0 psraw mm1, 11 ; sign extended shift right by 3 movq mm5, mm0 ; save results packsswb mm0, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>3 paddsw mm5, [GLOBAL(ones)] paddsw mm1, [GLOBAL(ones)] psraw mm5, 1 ; partial shifted one more time for 2nd tap psraw mm1, 1 ; partial shifted one more time for 2nd tap packsswb mm5, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>4 pandn mm4, mm5 ; high edge variance additive paddsb mm6, mm2 ; p0+= p0 add pxor mm6, [GLOBAL(t80)] ; unoffset movq [rsi+rax], mm6 ; write back movq mm6, [rsi+2*rax] ; p1 pxor mm6, [GLOBAL(t80)] ; reoffset paddsb mm6, mm4 ; p1+= p1 add pxor mm6, [GLOBAL(t80)] ; unoffset movq [rsi+2*rax], mm6 ; write back psubsb mm3, mm0 ; q0-= q0 add pxor mm3, [GLOBAL(t80)] ; unoffset movq [rsi], mm3 ; write back psubsb mm7, mm4 ; q1-= q1 add pxor mm7, [GLOBAL(t80)] ; unoffset movq [rdi], mm7 ; write back add rsi,8 neg rax dec rcx jnz next8_h add rsp, 32 pop rsp ; begin epilog pop rdi pop rsi RESTORE_GOT UNSHADOW_ARGS pop rbp ret ;void vp8_loop_filter_vertical_edge_mmx ;( ; unsigned char *src_ptr, ; int src_pixel_step, ; const char *flimit, ; const char *limit, ; const char *thresh, ; int count ;) global sym(vp8_loop_filter_vertical_edge_mmx) sym(vp8_loop_filter_vertical_edge_mmx): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 GET_GOT rbx push rsi push rdi ; end prolog ALIGN_STACK 16, rax sub rsp, 64 ; reserve 64 bytes %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8]; %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8]; %define srct [rsp + 32] ;__declspec(align(16)) char srct[32]; mov rsi, arg(0) ;src_ptr movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch? lea rsi, [rsi + rax*4 - 4] movsxd rcx, dword ptr arg(5) ;count next8_v: mov rdi, rsi ; rdi points to row +1 for indirect addressing add rdi, rax ;transpose movq mm6, [rsi+2*rax] ; 67 66 65 64 63 62 61 60 movq mm7, mm6 ; 77 76 75 74 73 72 71 70 punpckhbw mm7, [rdi+2*rax] ; 77 67 76 66 75 65 74 64 punpcklbw mm6, [rdi+2*rax] ; 73 63 72 62 71 61 70 60 movq mm4, [rsi] ; 47 46 45 44 43 42 41 40 movq mm5, mm4 ; 47 46 45 44 43 42 41 40 punpckhbw mm5, [rsi+rax] ; 57 47 56 46 55 45 54 44 punpcklbw mm4, [rsi+rax] ; 53 43 52 42 51 41 50 40 movq mm3, mm5 ; 57 47 56 46 55 45 54 44 punpckhwd mm5, mm7 ; 77 67 57 47 76 66 56 46 punpcklwd mm3, mm7 ; 75 65 55 45 74 64 54 44 movq mm2, mm4 ; 53 43 52 42 51 41 50 40 punpckhwd mm4, mm6 ; 73 63 53 43 72 62 52 42 punpcklwd mm2, mm6 ; 71 61 51 41 70 60 50 40 neg rax movq mm6, [rsi+rax*2] ; 27 26 25 24 23 22 21 20 movq mm1, mm6 ; 27 26 25 24 23 22 21 20 punpckhbw mm6, [rsi+rax] ; 37 27 36 36 35 25 34 24 punpcklbw mm1, [rsi+rax] ; 33 23 32 22 31 21 30 20 movq mm7, [rsi+rax*4]; ; 07 06 05 04 03 02 01 00 punpckhbw mm7, [rdi+rax*4] ; 17 07 16 06 15 05 14 04 movq mm0, mm7 ; 17 07 16 06 15 05 14 04 punpckhwd mm7, mm6 ; 37 27 17 07 36 26 16 06 punpcklwd mm0, mm6 ; 35 25 15 05 34 24 14 04 movq mm6, mm7 ; 37 27 17 07 36 26 16 06 punpckhdq mm7, mm5 ; 77 67 57 47 37 27 17 07 = q3 punpckldq mm6, mm5 ; 76 66 56 46 36 26 16 06 = q2 movq mm5, mm6 ; 76 66 56 46 36 26 16 06 psubusb mm5, mm7 ; q2-q3 psubusb mm7, mm6 ; q3-q2 por mm7, mm5; ; mm7=abs (q3-q2) movq mm5, mm0 ; 35 25 15 05 34 24 14 04 punpckhdq mm5, mm3 ; 75 65 55 45 35 25 15 05 = q1 punpckldq mm0, mm3 ; 74 64 54 44 34 24 15 04 = q0 movq mm3, mm5 ; 75 65 55 45 35 25 15 05 = q1 psubusb mm3, mm6 ; q1-q2 psubusb mm6, mm5 ; q2-q1 por mm6, mm3 ; mm6=abs(q2-q1) lea rdx, srct movq [rdx+24], mm5 ; save q1 movq [rdx+16], mm0 ; save q0 movq mm3, [rsi+rax*4] ; 07 06 05 04 03 02 01 00 punpcklbw mm3, [rdi+rax*4] ; 13 03 12 02 11 01 10 00 movq mm0, mm3 ; 13 03 12 02 11 01 10 00 punpcklwd mm0, mm1 ; 31 21 11 01 30 20 10 00 punpckhwd mm3, mm1 ; 33 23 13 03 32 22 12 02 movq mm1, mm0 ; 31 21 11 01 30 20 10 00 punpckldq mm0, mm2 ; 70 60 50 40 30 20 10 00 =p3 punpckhdq mm1, mm2 ; 71 61 51 41 31 21 11 01 =p2 movq mm2, mm1 ; 71 61 51 41 31 21 11 01 =p2 psubusb mm2, mm0 ; p2-p3 psubusb mm0, mm1 ; p3-p2 por mm0, mm2 ; mm0=abs(p3-p2) movq mm2, mm3 ; 33 23 13 03 32 22 12 02 punpckldq mm2, mm4 ; 72 62 52 42 32 22 12 02 = p1 punpckhdq mm3, mm4 ; 73 63 53 43 33 23 13 03 = p0 movq [rdx+8], mm3 ; save p0 movq [rdx], mm2 ; save p1 movq mm5, mm2 ; mm5 = p1 psubusb mm2, mm1 ; p1-p2 psubusb mm1, mm5 ; p2-p1 por mm1, mm2 ; mm1=abs(p2-p1) mov rdx, arg(3) ;limit movq mm4, [rdx] ; mm4 = limit psubusb mm7, mm4 psubusb mm0, mm4 psubusb mm1, mm4 psubusb mm6, mm4 por mm7, mm6 por mm0, mm1 por mm0, mm7 ; abs(q3-q2) > limit || abs(p3-p2) > limit ||abs(p2-p1) > limit || abs(q2-q1) > limit movq mm1, mm5 ; p1 movq mm7, mm3 ; mm3=mm7=p0 psubusb mm7, mm5 ; p0 - p1 psubusb mm5, mm3 ; p1 - p0 por mm5, mm7 ; abs(p1-p0) movq t0, mm5 ; save abs(p1-p0) lea rdx, srct psubusb mm5, mm4 por mm0, mm5 ; mm0=mask movq mm5, [rdx+16] ; mm5=q0 movq mm7, [rdx+24] ; mm7=q1 movq mm6, mm5 ; mm6=q0 movq mm2, mm7 ; q1 psubusb mm5, mm7 ; q0-q1 psubusb mm7, mm6 ; q1-q0 por mm7, mm5 ; abs(q1-q0) movq t1, mm7 ; save abs(q1-q0) psubusb mm7, mm4 por mm0, mm7 ; mask movq mm5, mm2 ; q1 psubusb mm5, mm1 ; q1-=p1 psubusb mm1, mm2 ; p1-=q1 por mm5, mm1 ; abs(p1-q1) pand mm5, [GLOBAL(tfe)] ; set lsb of each byte to zero psrlw mm5, 1 ; abs(p1-q1)/2 mov rdx, arg(2) ;flimit ; movq mm2, [rdx] ;flimit mm2 movq mm1, mm3 ; mm1=mm3=p0 movq mm7, mm6 ; mm7=mm6=q0 psubusb mm1, mm7 ; p0-q0 psubusb mm7, mm3 ; q0-p0 por mm1, mm7 ; abs(q0-p0) paddusb mm1, mm1 ; abs(q0-p0)*2 paddusb mm1, mm5 ; abs (p0 - q0) *2 + abs(p1-q1)/2 paddb mm2, mm2 ; flimit*2 (less than 255) paddb mm4, mm2 ; flimit * 2 + limit (less than 255) psubusb mm1, mm4 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > flimit * 2 + limit por mm1, mm0; ; mask pxor mm0, mm0 pcmpeqb mm1, mm0 ; calculate high edge variance mov rdx, arg(4) ;thresh ; get thresh movq mm7, [rdx] ; movq mm4, t0 ; get abs (q1 - q0) psubusb mm4, mm7 movq mm3, t1 ; get abs (p1 - p0) psubusb mm3, mm7 por mm4, mm3 ; abs(q1 - q0) > thresh || abs(p1 - p0) > thresh pcmpeqb mm4, mm0 pcmpeqb mm0, mm0 pxor mm4, mm0 ; start work on filters lea rdx, srct movq mm2, [rdx] ; p1 movq mm7, [rdx+24] ; q1 movq mm6, [rdx+8] ; p0 movq mm0, [rdx+16] ; q0 pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values psubsb mm2, mm7 ; p1 - q1 pand mm2, mm4 ; high var mask (hvm)(p1 - q1) pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values movq mm3, mm0 ; q0 psubsb mm0, mm6 ; q0 - p0 paddsb mm2, mm0 ; 1 * (q0 - p0) + hvm(p1 - q1) paddsb mm2, mm0 ; 2 * (q0 - p0) + hvm(p1 - q1) paddsb mm2, mm0 ; 3 * (q0 - p0) + hvm(p1 - q1) pand mm1, mm2 ; mask filter values we don't care about movq mm2, mm1 paddsb mm1, [GLOBAL(t4)] ; 3* (q0 - p0) + hvm(p1 - q1) + 4 paddsb mm2, [GLOBAL(t3)] ; 3* (q0 - p0) + hvm(p1 - q1) + 3 pxor mm0, mm0 ; pxor mm5, mm5 punpcklbw mm0, mm2 ; punpckhbw mm5, mm2 ; psraw mm0, 11 ; psraw mm5, 11 packsswb mm0, mm5 movq mm2, mm0 ; (3* (q0 - p0) + hvm(p1 - q1) + 3) >> 3; pxor mm0, mm0 ; 0 movq mm5, mm1 ; abcdefgh punpcklbw mm0, mm1 ; e0f0g0h0 psraw mm0, 11 ; sign extended shift right by 3 pxor mm1, mm1 ; 0 punpckhbw mm1, mm5 ; a0b0c0d0 psraw mm1, 11 ; sign extended shift right by 3 movq mm5, mm0 ; save results packsswb mm0, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>3 paddsw mm5, [GLOBAL(ones)] paddsw mm1, [GLOBAL(ones)] psraw mm5, 1 ; partial shifted one more time for 2nd tap psraw mm1, 1 ; partial shifted one more time for 2nd tap packsswb mm5, mm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>4 pandn mm4, mm5 ; high edge variance additive paddsb mm6, mm2 ; p0+= p0 add pxor mm6, [GLOBAL(t80)] ; unoffset ; mm6=p0 ; movq mm1, [rdx] ; p1 pxor mm1, [GLOBAL(t80)] ; reoffset paddsb mm1, mm4 ; p1+= p1 add pxor mm1, [GLOBAL(t80)] ; unoffset ; mm6 = p0 mm1 = p1 psubsb mm3, mm0 ; q0-= q0 add pxor mm3, [GLOBAL(t80)] ; unoffset ; mm3 = q0 psubsb mm7, mm4 ; q1-= q1 add pxor mm7, [GLOBAL(t80)] ; unoffset ; mm7 = q1 ; tranpose and write back ; mm1 = 72 62 52 42 32 22 12 02 ; mm6 = 73 63 53 43 33 23 13 03 ; mm3 = 74 64 54 44 34 24 14 04 ; mm7 = 75 65 55 45 35 25 15 05 movq mm2, mm1 ; 72 62 52 42 32 22 12 02 punpcklbw mm2, mm6 ; 33 32 23 22 13 12 03 02 movq mm4, mm3 ; 74 64 54 44 34 24 14 04 punpckhbw mm1, mm6 ; 73 72 63 62 53 52 43 42 punpcklbw mm4, mm7 ; 35 34 25 24 15 14 05 04 punpckhbw mm3, mm7 ; 75 74 65 64 55 54 45 44 movq mm6, mm2 ; 33 32 23 22 13 12 03 02 punpcklwd mm2, mm4 ; 15 14 13 12 05 04 03 02 punpckhwd mm6, mm4 ; 35 34 33 32 25 24 23 22 movq mm5, mm1 ; 73 72 63 62 53 52 43 42 punpcklwd mm1, mm3 ; 55 54 53 52 45 44 43 42 punpckhwd mm5, mm3 ; 75 74 73 72 65 64 63 62 ; mm2 = 15 14 13 12 05 04 03 02 ; mm6 = 35 34 33 32 25 24 23 22 ; mm5 = 55 54 53 52 45 44 43 42 ; mm1 = 75 74 73 72 65 64 63 62 movd [rsi+rax*4+2], mm2 psrlq mm2, 32 movd [rdi+rax*4+2], mm2 movd [rsi+rax*2+2], mm6 psrlq mm6, 32 movd [rsi+rax+2],mm6 movd [rsi+2], mm1 psrlq mm1, 32 movd [rdi+2], mm1 neg rax movd [rdi+rax+2],mm5 psrlq mm5, 32 movd [rdi+rax*2+2], mm5 lea rsi, [rsi+rax*8] dec rcx jnz next8_v add rsp, 64 pop rsp ; begin epilog pop rdi pop rsi RESTORE_GOT UNSHADOW_ARGS pop rbp ret ;void vp8_mbloop_filter_horizontal_edge_mmx ;( ; unsigned char *src_ptr, ; int src_pixel_step, ; const char *flimit, ; const char *limit, ; const char *thresh, ; int count ;) global sym(vp8_mbloop_filter_horizontal_edge_mmx) sym(vp8_mbloop_filter_horizontal_edge_mmx): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 GET_GOT rbx push rsi push rdi ; end prolog ALIGN_STACK 16, rax sub rsp, 32 ; reserve 32 bytes %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8]; %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8]; mov rsi, arg(0) ;src_ptr movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch? movsxd rcx, dword ptr arg(5) ;count next8_mbh: mov rdx, arg(3) ;limit movq mm7, [rdx] mov rdi, rsi ; rdi points to row +1 for indirect addressing add rdi, rax ; calculate breakout conditions movq mm2, [rdi+2*rax] ; q3 movq mm1, [rsi+2*rax] ; q2 movq mm6, mm1 ; q2 psubusb mm1, mm2 ; q2-=q3 psubusb mm2, mm6 ; q3-=q2 por mm1, mm2 ; abs(q3-q2) psubusb mm1, mm7 ; mm1 = abs(q3-q2), mm6 =q2, mm7 = limit movq mm4, [rsi+rax] ; q1 movq mm3, mm4 ; q1 psubusb mm4, mm6 ; q1-=q2 psubusb mm6, mm3 ; q2-=q1 por mm4, mm6 ; abs(q2-q1) psubusb mm4, mm7 por mm1, mm4 ; mm1 = mask, mm3=q1, mm7 = limit movq mm4, [rsi] ; q0 movq mm0, mm4 ; q0 psubusb mm4, mm3 ; q0-=q1 psubusb mm3, mm0 ; q1-=q0 por mm4, mm3 ; abs(q0-q1) movq t0, mm4 ; save to t0 psubusb mm4, mm7 por mm1, mm4 ; mm1 = mask, mm0=q0, mm7 = limit, t0 = abs(q0-q1) neg rax ; negate pitch to deal with above border movq mm2, [rsi+4*rax] ; p3 movq mm4, [rdi+4*rax] ; p2 movq mm5, mm4 ; p2 psubusb mm4, mm2 ; p2-=p3 psubusb mm2, mm5 ; p3-=p2 por mm4, mm2 ; abs(p3 - p2) psubusb mm4, mm7 por mm1, mm4 ; mm1 = mask, mm0=q0, mm7 = limit, t0 = abs(q0-q1) movq mm4, [rsi+2*rax] ; p1 movq mm3, mm4 ; p1 psubusb mm4, mm5 ; p1-=p2 psubusb mm5, mm3 ; p2-=p1 por mm4, mm5 ; abs(p2 - p1) psubusb mm4, mm7 por mm1, mm4 movq mm2, mm3 ; p1 ; mm1 = mask, mm0=q0, mm7 = limit, t0 = abs(q0-q1) movq mm4, [rsi+rax] ; p0 movq mm5, mm4 ; p0 psubusb mm4, mm3 ; p0-=p1 psubusb mm3, mm5 ; p1-=p0 por mm4, mm3 ; abs(p1 - p0) movq t1, mm4 ; save to t1 psubusb mm4, mm7 por mm1, mm4 ; mm1 = mask, mm0=q0, mm7 = limit, t0 = abs(q0-q1) t1 = abs(p1-p0) ; mm5 = p0 movq mm3, [rdi] ; q1 movq mm4, mm3 ; q1 psubusb mm3, mm2 ; q1-=p1 psubusb mm2, mm4 ; p1-=q1 por mm2, mm3 ; abs(p1-q1) pand mm2, [GLOBAL(tfe)] ; set lsb of each byte to zero psrlw mm2, 1 ; abs(p1-q1)/2 movq mm6, mm5 ; p0 movq mm3, mm0 ; q0 psubusb mm5, mm3 ; p0-=q0 psubusb mm3, mm6 ; q0-=p0 por mm5, mm3 ; abs(p0 - q0) paddusb mm5, mm5 ; abs(p0-q0)*2 paddusb mm5, mm2 ; abs (p0 - q0) *2 + abs(p1-q1)/2 mov rdx, arg(2) ;flimit ; get flimit movq mm2, [rdx] ; flimit mm2 paddb mm2, mm2 ; flimit*2 (less than 255) paddb mm7, mm2 ; flimit * 2 + limit (less than 255) psubusb mm5, mm7 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > flimit * 2 + limit por mm1, mm5 pxor mm5, mm5 pcmpeqb mm1, mm5 ; mask mm1 ; mm1 = mask, mm0=q0, mm7 = flimit, t0 = abs(q0-q1) t1 = abs(p1-p0) ; mm6 = p0, ; calculate high edge variance mov rdx, arg(4) ;thresh ; get thresh movq mm7, [rdx] ; movq mm4, t0 ; get abs (q1 - q0) psubusb mm4, mm7 movq mm3, t1 ; get abs (p1 - p0) psubusb mm3, mm7 paddb mm4, mm3 ; abs(q1 - q0) > thresh || abs(p1 - p0) > thresh pcmpeqb mm4, mm5 pcmpeqb mm5, mm5 pxor mm4, mm5 ; mm1 = mask, mm0=q0, mm7 = thresh, t0 = abs(q0-q1) t1 = abs(p1-p0) ; mm6 = p0, mm4=hev ; start work on filters movq mm2, [rsi+2*rax] ; p1 movq mm7, [rdi] ; q1 pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values psubsb mm2, mm7 ; p1 - q1 pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values movq mm3, mm0 ; q0 psubsb mm0, mm6 ; q0 - p0 paddsb mm2, mm0 ; 1 * (q0 - p0) + (p1 - q1) paddsb mm2, mm0 ; 2 * (q0 - p0) paddsb mm2, mm0 ; 3 * (q0 - p0) + (p1 - q1) pand mm1, mm2 ; mask filter values we don't care about ; mm1 = vp8_filter, mm4=hev, mm6=ps0, mm3=qs0 movq mm2, mm1 ; vp8_filter pand mm2, mm4; ; Filter2 = vp8_filter & hev movq mm5, mm2 ; paddsb mm5, [GLOBAL(t3)]; pxor mm0, mm0 ; 0 pxor mm7, mm7 ; 0 punpcklbw mm0, mm5 ; e0f0g0h0 psraw mm0, 11 ; sign extended shift right by 3 punpckhbw mm7, mm5 ; a0b0c0d0 psraw mm7, 11 ; sign extended shift right by 3 packsswb mm0, mm7 ; Filter2 >>=3; movq mm5, mm0 ; Filter2 paddsb mm2, [GLOBAL(t4)] ; vp8_signed_char_clamp(Filter2 + 4) pxor mm0, mm0 ; 0 pxor mm7, mm7 ; 0 punpcklbw mm0, mm2 ; e0f0g0h0 psraw mm0, 11 ; sign extended shift right by 3 punpckhbw mm7, mm2 ; a0b0c0d0 psraw mm7, 11 ; sign extended shift right by 3 packsswb mm0, mm7 ; Filter2 >>=3; ; mm0= filter2 mm1 = vp8_filter, mm3 =qs0 mm5=s mm4 =hev mm6=ps0 psubsb mm3, mm0 ; qs0 =qs0 - filter1 paddsb mm6, mm5 ; ps0 =ps0 + Fitler2 ; mm1=vp8_filter, mm3=qs0, mm4 =hev mm6=ps0 ; vp8_filter &= ~hev; ; Filter2 = vp8_filter; pandn mm4, mm1 ; vp8_filter&=~hev ; mm3=qs0, mm4=filter2, mm6=ps0 ; u = vp8_signed_char_clamp((63 + Filter2 * 27)>>7); ; s = vp8_signed_char_clamp(qs0 - u); ; *oq0 = s^0x80; ; s = vp8_signed_char_clamp(ps0 + u); ; *op0 = s^0x80; pxor mm0, mm0 pxor mm1, mm1 pxor mm2, mm2 punpcklbw mm1, mm4 punpckhbw mm2, mm4 pmulhw mm1, [GLOBAL(s27)] pmulhw mm2, [GLOBAL(s27)] paddw mm1, [GLOBAL(s63)] paddw mm2, [GLOBAL(s63)] psraw mm1, 7 psraw mm2, 7 packsswb mm1, mm2 psubsb mm3, mm1 paddsb mm6, mm1 pxor mm3, [GLOBAL(t80)] pxor mm6, [GLOBAL(t80)] movq [rsi+rax], mm6 movq [rsi], mm3 ; roughly 2/7th difference across boundary ; u = vp8_signed_char_clamp((63 + Filter2 * 18)>>7); ; s = vp8_signed_char_clamp(qs1 - u); ; *oq1 = s^0x80; ; s = vp8_signed_char_clamp(ps1 + u); ; *op1 = s^0x80; pxor mm1, mm1 pxor mm2, mm2 punpcklbw mm1, mm4 punpckhbw mm2, mm4 pmulhw mm1, [GLOBAL(s18)] pmulhw mm2, [GLOBAL(s18)] paddw mm1, [GLOBAL(s63)] paddw mm2, [GLOBAL(s63)] psraw mm1, 7 psraw mm2, 7 packsswb mm1, mm2 movq mm3, [rdi] movq mm6, [rsi+rax*2] ; p1 pxor mm3, [GLOBAL(t80)] pxor mm6, [GLOBAL(t80)] paddsb mm6, mm1 psubsb mm3, mm1 pxor mm6, [GLOBAL(t80)] pxor mm3, [GLOBAL(t80)] movq [rdi], mm3 movq [rsi+rax*2], mm6 ; roughly 1/7th difference across boundary ; u = vp8_signed_char_clamp((63 + Filter2 * 9)>>7); ; s = vp8_signed_char_clamp(qs2 - u); ; *oq2 = s^0x80; ; s = vp8_signed_char_clamp(ps2 + u); ; *op2 = s^0x80; pxor mm1, mm1 pxor mm2, mm2 punpcklbw mm1, mm4 punpckhbw mm2, mm4 pmulhw mm1, [GLOBAL(s9)] pmulhw mm2, [GLOBAL(s9)] paddw mm1, [GLOBAL(s63)] paddw mm2, [GLOBAL(s63)] psraw mm1, 7 psraw mm2, 7 packsswb mm1, mm2 movq mm6, [rdi+rax*4] neg rax movq mm3, [rdi+rax ] pxor mm6, [GLOBAL(t80)] pxor mm3, [GLOBAL(t80)] paddsb mm6, mm1 psubsb mm3, mm1 pxor mm6, [GLOBAL(t80)] pxor mm3, [GLOBAL(t80)] movq [rdi+rax ], mm3 neg rax movq [rdi+rax*4], mm6 ;EARLY_BREAK_OUT: neg rax add rsi,8 dec rcx jnz next8_mbh add rsp, 32 pop rsp ; begin epilog pop rdi pop rsi RESTORE_GOT UNSHADOW_ARGS pop rbp ret ;void vp8_mbloop_filter_vertical_edge_mmx ;( ; unsigned char *src_ptr, ; int src_pixel_step, ; const char *flimit, ; const char *limit, ; const char *thresh, ; int count ;) global sym(vp8_mbloop_filter_vertical_edge_mmx) sym(vp8_mbloop_filter_vertical_edge_mmx): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 GET_GOT rbx push rsi push rdi ; end prolog ALIGN_STACK 16, rax sub rsp, 96 ; reserve 96 bytes %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8]; %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8]; %define srct [rsp + 32] ;__declspec(align(16)) char srct[64]; mov rsi, arg(0) ;src_ptr movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch? lea rsi, [rsi + rax*4 - 4] movsxd rcx, dword ptr arg(5) ;count next8_mbv: lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing ;transpose movq mm0, [rdi+2*rax] ; 77 76 75 74 73 72 71 70 movq mm6, [rsi+2*rax] ; 67 66 65 64 63 62 61 60 movq mm7, mm6 ; 77 76 75 74 73 72 71 70 punpckhbw mm7, mm0 ; 77 67 76 66 75 65 74 64 punpcklbw mm6, mm0 ; 73 63 72 62 71 61 70 60 movq mm0, [rsi+rax] ; 57 56 55 54 53 52 51 50 movq mm4, [rsi] ; 47 46 45 44 43 42 41 40 movq mm5, mm4 ; 47 46 45 44 43 42 41 40 punpckhbw mm5, mm0 ; 57 47 56 46 55 45 54 44 punpcklbw mm4, mm0 ; 53 43 52 42 51 41 50 40 movq mm3, mm5 ; 57 47 56 46 55 45 54 44 punpckhwd mm5, mm7 ; 77 67 57 47 76 66 56 46 punpcklwd mm3, mm7 ; 75 65 55 45 74 64 54 44 movq mm2, mm4 ; 53 43 52 42 51 41 50 40 punpckhwd mm4, mm6 ; 73 63 53 43 72 62 52 42 punpcklwd mm2, mm6 ; 71 61 51 41 70 60 50 40 neg rax movq mm7, [rsi+rax] ; 37 36 35 34 33 32 31 30 movq mm6, [rsi+rax*2] ; 27 26 25 24 23 22 21 20 movq mm1, mm6 ; 27 26 25 24 23 22 21 20 punpckhbw mm6, mm7 ; 37 27 36 36 35 25 34 24 punpcklbw mm1, mm7 ; 33 23 32 22 31 21 30 20 movq mm7, [rsi+rax*4]; ; 07 06 05 04 03 02 01 00 punpckhbw mm7, [rdi+rax*4] ; 17 07 16 06 15 05 14 04 movq mm0, mm7 ; 17 07 16 06 15 05 14 04 punpckhwd mm7, mm6 ; 37 27 17 07 36 26 16 06 punpcklwd mm0, mm6 ; 35 25 15 05 34 24 14 04 movq mm6, mm7 ; 37 27 17 07 36 26 16 06 punpckhdq mm7, mm5 ; 77 67 57 47 37 27 17 07 = q3 punpckldq mm6, mm5 ; 76 66 56 46 36 26 16 06 = q2 lea rdx, srct movq mm5, mm6 ; 76 66 56 46 36 26 16 06 movq [rdx+56], mm7 psubusb mm5, mm7 ; q2-q3 movq [rdx+48], mm6 psubusb mm7, mm6 ; q3-q2 por mm7, mm5; ; mm7=abs (q3-q2) movq mm5, mm0 ; 35 25 15 05 34 24 14 04 punpckhdq mm5, mm3 ; 75 65 55 45 35 25 15 05 = q1 punpckldq mm0, mm3 ; 74 64 54 44 34 24 15 04 = q0 movq mm3, mm5 ; 75 65 55 45 35 25 15 05 = q1 psubusb mm3, mm6 ; q1-q2 psubusb mm6, mm5 ; q2-q1 por mm6, mm3 ; mm6=abs(q2-q1) movq [rdx+40], mm5 ; save q1 movq [rdx+32], mm0 ; save q0 movq mm3, [rsi+rax*4] ; 07 06 05 04 03 02 01 00 punpcklbw mm3, [rdi+rax*4] ; 13 03 12 02 11 01 10 00 movq mm0, mm3 ; 13 03 12 02 11 01 10 00 punpcklwd mm0, mm1 ; 31 21 11 01 30 20 10 00 punpckhwd mm3, mm1 ; 33 23 13 03 32 22 12 02 movq mm1, mm0 ; 31 21 11 01 30 20 10 00 punpckldq mm0, mm2 ; 70 60 50 40 30 20 10 00 =p3 punpckhdq mm1, mm2 ; 71 61 51 41 31 21 11 01 =p2 movq [rdx], mm0 ; save p3 movq [rdx+8], mm1 ; save p2 movq mm2, mm1 ; 71 61 51 41 31 21 11 01 =p2 psubusb mm2, mm0 ; p2-p3 psubusb mm0, mm1 ; p3-p2 por mm0, mm2 ; mm0=abs(p3-p2) movq mm2, mm3 ; 33 23 13 03 32 22 12 02 punpckldq mm2, mm4 ; 72 62 52 42 32 22 12 02 = p1 punpckhdq mm3, mm4 ; 73 63 53 43 33 23 13 03 = p0 movq [rdx+24], mm3 ; save p0 movq [rdx+16], mm2 ; save p1 movq mm5, mm2 ; mm5 = p1 psubusb mm2, mm1 ; p1-p2 psubusb mm1, mm5 ; p2-p1 por mm1, mm2 ; mm1=abs(p2-p1) mov rdx, arg(3) ;limit movq mm4, [rdx] ; mm4 = limit psubusb mm7, mm4 ; abs(q3-q2) > limit psubusb mm0, mm4 ; abs(p3-p2) > limit psubusb mm1, mm4 ; abs(p2-p1) > limit psubusb mm6, mm4 ; abs(q2-q1) > limit por mm7, mm6 ; or por mm0, mm1 ; por mm0, mm7 ; abs(q3-q2) > limit || abs(p3-p2) > limit ||abs(p2-p1) > limit || abs(q2-q1) > limit movq mm1, mm5 ; p1 movq mm7, mm3 ; mm3=mm7=p0 psubusb mm7, mm5 ; p0 - p1 psubusb mm5, mm3 ; p1 - p0 por mm5, mm7 ; abs(p1-p0) movq t0, mm5 ; save abs(p1-p0) lea rdx, srct psubusb mm5, mm4 ; mm5 = abs(p1-p0) > limit por mm0, mm5 ; mm0=mask movq mm5, [rdx+32] ; mm5=q0 movq mm7, [rdx+40] ; mm7=q1 movq mm6, mm5 ; mm6=q0 movq mm2, mm7 ; q1 psubusb mm5, mm7 ; q0-q1 psubusb mm7, mm6 ; q1-q0 por mm7, mm5 ; abs(q1-q0) movq t1, mm7 ; save abs(q1-q0) psubusb mm7, mm4 ; mm7=abs(q1-q0)> limit por mm0, mm7 ; mask movq mm5, mm2 ; q1 psubusb mm5, mm1 ; q1-=p1 psubusb mm1, mm2 ; p1-=q1 por mm5, mm1 ; abs(p1-q1) pand mm5, [GLOBAL(tfe)] ; set lsb of each byte to zero psrlw mm5, 1 ; abs(p1-q1)/2 mov rdx, arg(2) ;flimit ; movq mm2, [rdx] ;flimit mm2 movq mm1, mm3 ; mm1=mm3=p0 movq mm7, mm6 ; mm7=mm6=q0 psubusb mm1, mm7 ; p0-q0 psubusb mm7, mm3 ; q0-p0 por mm1, mm7 ; abs(q0-p0) paddusb mm1, mm1 ; abs(q0-p0)*2 paddusb mm1, mm5 ; abs (p0 - q0) *2 + abs(p1-q1)/2 paddb mm2, mm2 ; flimit*2 (less than 255) paddb mm4, mm2 ; flimit * 2 + limit (less than 255) psubusb mm1, mm4 ; abs (p0 - q0) *2 + abs(p1-q1)/2 > flimit * 2 + limit por mm1, mm0; ; mask pxor mm0, mm0 pcmpeqb mm1, mm0 ; calculate high edge variance mov rdx, arg(4) ;thresh ; get thresh movq mm7, [rdx] ; movq mm4, t0 ; get abs (q1 - q0) psubusb mm4, mm7 ; abs(q1 - q0) > thresh movq mm3, t1 ; get abs (p1 - p0) psubusb mm3, mm7 ; abs(p1 - p0)> thresh por mm4, mm3 ; abs(q1 - q0) > thresh || abs(p1 - p0) > thresh pcmpeqb mm4, mm0 pcmpeqb mm0, mm0 pxor mm4, mm0 ; start work on filters lea rdx, srct ; start work on filters movq mm2, [rdx+16] ; p1 movq mm7, [rdx+40] ; q1 pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values psubsb mm2, mm7 ; p1 - q1 movq mm6, [rdx+24] ; p0 movq mm0, [rdx+32] ; q0 pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values movq mm3, mm0 ; q0 psubsb mm0, mm6 ; q0 - p0 paddsb mm2, mm0 ; 1 * (q0 - p0) + (p1 - q1) paddsb mm2, mm0 ; 2 * (q0 - p0) paddsb mm2, mm0 ; 3 * (q0 - p0) + (p1 - q1) pand mm1, mm2 ; mask filter values we don't care about ; mm1 = vp8_filter, mm4=hev, mm6=ps0, mm3=qs0 movq mm2, mm1 ; vp8_filter pand mm2, mm4; ; Filter2 = vp8_filter & hev movq mm5, mm2 ; paddsb mm5, [GLOBAL(t3)]; pxor mm0, mm0 ; 0 pxor mm7, mm7 ; 0 punpcklbw mm0, mm5 ; e0f0g0h0 psraw mm0, 11 ; sign extended shift right by 3 punpckhbw mm7, mm5 ; a0b0c0d0 psraw mm7, 11 ; sign extended shift right by 3 packsswb mm0, mm7 ; Filter2 >>=3; movq mm5, mm0 ; Filter2 paddsb mm2, [GLOBAL(t4)] ; vp8_signed_char_clamp(Filter2 + 4) pxor mm0, mm0 ; 0 pxor mm7, mm7 ; 0 punpcklbw mm0, mm2 ; e0f0g0h0 psraw mm0, 11 ; sign extended shift right by 3 punpckhbw mm7, mm2 ; a0b0c0d0 psraw mm7, 11 ; sign extended shift right by 3 packsswb mm0, mm7 ; Filter2 >>=3; ; mm0= filter2 mm1 = vp8_filter, mm3 =qs0 mm5=s mm4 =hev mm6=ps0 psubsb mm3, mm0 ; qs0 =qs0 - filter1 paddsb mm6, mm5 ; ps0 =ps0 + Fitler2 ; mm1=vp8_filter, mm3=qs0, mm4 =hev mm6=ps0 ; vp8_filter &= ~hev; ; Filter2 = vp8_filter; pandn mm4, mm1 ; vp8_filter&=~hev ; mm3=qs0, mm4=filter2, mm6=ps0 ; u = vp8_signed_char_clamp((63 + Filter2 * 27)>>7); ; s = vp8_signed_char_clamp(qs0 - u); ; *oq0 = s^0x80; ; s = vp8_signed_char_clamp(ps0 + u); ; *op0 = s^0x80; pxor mm0, mm0 pxor mm1, mm1 pxor mm2, mm2 punpcklbw mm1, mm4 punpckhbw mm2, mm4 pmulhw mm1, [GLOBAL(s27)] pmulhw mm2, [GLOBAL(s27)] paddw mm1, [GLOBAL(s63)] paddw mm2, [GLOBAL(s63)] psraw mm1, 7 psraw mm2, 7 packsswb mm1, mm2 psubsb mm3, mm1 paddsb mm6, mm1 pxor mm3, [GLOBAL(t80)] pxor mm6, [GLOBAL(t80)] movq [rdx+24], mm6 movq [rdx+32], mm3 ; roughly 2/7th difference across boundary ; u = vp8_signed_char_clamp((63 + Filter2 * 18)>>7); ; s = vp8_signed_char_clamp(qs1 - u); ; *oq1 = s^0x80; ; s = vp8_signed_char_clamp(ps1 + u); ; *op1 = s^0x80; pxor mm1, mm1 pxor mm2, mm2 punpcklbw mm1, mm4 punpckhbw mm2, mm4 pmulhw mm1, [GLOBAL(s18)] pmulhw mm2, [GLOBAL(s18)] paddw mm1, [GLOBAL(s63)] paddw mm2, [GLOBAL(s63)] psraw mm1, 7 psraw mm2, 7 packsswb mm1, mm2 movq mm3, [rdx + 40] movq mm6, [rdx + 16] ; p1 pxor mm3, [GLOBAL(t80)] pxor mm6, [GLOBAL(t80)] paddsb mm6, mm1 psubsb mm3, mm1 pxor mm6, [GLOBAL(t80)] pxor mm3, [GLOBAL(t80)] movq [rdx + 40], mm3 movq [rdx + 16], mm6 ; roughly 1/7th difference across boundary ; u = vp8_signed_char_clamp((63 + Filter2 * 9)>>7); ; s = vp8_signed_char_clamp(qs2 - u); ; *oq2 = s^0x80; ; s = vp8_signed_char_clamp(ps2 + u); ; *op2 = s^0x80; pxor mm1, mm1 pxor mm2, mm2 punpcklbw mm1, mm4 punpckhbw mm2, mm4 pmulhw mm1, [GLOBAL(s9)] pmulhw mm2, [GLOBAL(s9)] paddw mm1, [GLOBAL(s63)] paddw mm2, [GLOBAL(s63)] psraw mm1, 7 psraw mm2, 7 packsswb mm1, mm2 movq mm6, [rdx+ 8] movq mm3, [rdx+48] pxor mm6, [GLOBAL(t80)] pxor mm3, [GLOBAL(t80)] paddsb mm6, mm1 psubsb mm3, mm1 pxor mm6, [GLOBAL(t80)] ; mm6 = 71 61 51 41 31 21 11 01 pxor mm3, [GLOBAL(t80)] ; mm3 = 76 66 56 46 36 26 15 06 ; tranpose and write back movq mm0, [rdx] ; mm0 = 70 60 50 40 30 20 10 00 movq mm1, mm0 ; mm0 = 70 60 50 40 30 20 10 00 punpcklbw mm0, mm6 ; mm0 = 31 30 21 20 11 10 01 00 punpckhbw mm1, mm6 ; mm3 = 71 70 61 60 51 50 41 40 movq mm2, [rdx+16] ; mm2 = 72 62 52 42 32 22 12 02 movq mm6, mm2 ; mm3 = 72 62 52 42 32 22 12 02 punpcklbw mm2, [rdx+24] ; mm2 = 33 32 23 22 13 12 03 02 punpckhbw mm6, [rdx+24] ; mm3 = 73 72 63 62 53 52 43 42 movq mm5, mm0 ; mm5 = 31 30 21 20 11 10 01 00 punpcklwd mm0, mm2 ; mm0 = 13 12 11 10 03 02 01 00 punpckhwd mm5, mm2 ; mm5 = 33 32 31 30 23 22 21 20 movq mm4, mm1 ; mm4 = 71 70 61 60 51 50 41 40 punpcklwd mm1, mm6 ; mm1 = 53 52 51 50 43 42 41 40 punpckhwd mm4, mm6 ; mm4 = 73 72 71 70 63 62 61 60 movq mm2, [rdx+32] ; mm2 = 74 64 54 44 34 24 14 04 punpcklbw mm2, [rdx+40] ; mm2 = 35 34 25 24 15 14 05 04 movq mm6, mm3 ; mm6 = 76 66 56 46 36 26 15 06 punpcklbw mm6, [rdx+56] ; mm6 = 37 36 27 26 17 16 07 06 movq mm7, mm2 ; mm7 = 35 34 25 24 15 14 05 04 punpcklwd mm2, mm6 ; mm2 = 17 16 15 14 07 06 05 04 punpckhwd mm7, mm6 ; mm7 = 37 36 35 34 27 26 25 24 movq mm6, mm0 ; mm6 = 13 12 11 10 03 02 01 00 punpckldq mm0, mm2 ; mm0 = 07 06 05 04 03 02 01 00 punpckhdq mm6, mm2 ; mm6 = 17 16 15 14 13 12 11 10 movq [rsi+rax*4], mm0 ; write out movq [rdi+rax*4], mm6 ; write out movq mm0, mm5 ; mm0 = 33 32 31 30 23 22 21 20 punpckldq mm0, mm7 ; mm0 = 27 26 25 24 23 22 20 20 punpckhdq mm5, mm7 ; mm5 = 37 36 35 34 33 32 31 30 movq [rsi+rax*2], mm0 ; write out movq [rdi+rax*2], mm5 ; write out movq mm2, [rdx+32] ; mm2 = 74 64 54 44 34 24 14 04 punpckhbw mm2, [rdx+40] ; mm2 = 75 74 65 64 54 54 45 44 punpckhbw mm3, [rdx+56] ; mm3 = 77 76 67 66 57 56 47 46 movq mm5, mm2 ; mm5 = 75 74 65 64 54 54 45 44 punpcklwd mm2, mm3 ; mm2 = 57 56 55 54 47 46 45 44 punpckhwd mm5, mm3 ; mm5 = 77 76 75 74 67 66 65 64 movq mm0, mm1 ; mm0= 53 52 51 50 43 42 41 40 movq mm3, mm4 ; mm4 = 73 72 71 70 63 62 61 60 punpckldq mm0, mm2 ; mm0 = 47 46 45 44 43 42 41 40 punpckhdq mm1, mm2 ; mm1 = 57 56 55 54 53 52 51 50 movq [rsi], mm0 ; write out movq [rdi], mm1 ; write out neg rax punpckldq mm3, mm5 ; mm3 = 67 66 65 64 63 62 61 60 punpckhdq mm4, mm5 ; mm4 = 77 76 75 74 73 72 71 60 movq [rsi+rax*2], mm3 movq [rdi+rax*2], mm4 lea rsi, [rsi+rax*8] dec rcx jnz next8_mbv add rsp, 96 pop rsp ; begin epilog pop rdi pop rsi RESTORE_GOT UNSHADOW_ARGS pop rbp ret ;void vp8_loop_filter_simple_horizontal_edge_mmx ;( ; unsigned char *src_ptr, ; int src_pixel_step, ; const char *flimit, ; const char *limit, ; const char *thresh, ; int count ;) global sym(vp8_loop_filter_simple_horizontal_edge_mmx) sym(vp8_loop_filter_simple_horizontal_edge_mmx): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 GET_GOT rbx push rsi push rdi ; end prolog mov rsi, arg(0) ;src_ptr movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch? movsxd rcx, dword ptr arg(5) ;count nexts8_h: mov rdx, arg(3) ;limit movq mm7, [rdx] mov rdx, arg(2) ;flimit ; get flimit movq mm3, [rdx] ; paddb mm3, mm3 ; flimit*2 (less than 255) paddb mm3, mm7 ; flimit * 2 + limit (less than 255) mov rdi, rsi ; rdi points to row +1 for indirect addressing add rdi, rax neg rax ; calculate mask movq mm1, [rsi+2*rax] ; p1 movq mm0, [rdi] ; q1 movq mm2, mm1 movq mm7, mm0 movq mm4, mm0 psubusb mm0, mm1 ; q1-=p1 psubusb mm1, mm4 ; p1-=q1 por mm1, mm0 ; abs(p1-q1) pand mm1, [GLOBAL(tfe)] ; set lsb of each byte to zero psrlw mm1, 1 ; abs(p1-q1)/2 movq mm5, [rsi+rax] ; p0 movq mm4, [rsi] ; q0 movq mm0, mm4 ; q0 movq mm6, mm5 ; p0 psubusb mm5, mm4 ; p0-=q0 psubusb mm4, mm6 ; q0-=p0 por mm5, mm4 ; abs(p0 - q0) paddusb mm5, mm5 ; abs(p0-q0)*2 paddusb mm5, mm1 ; abs (p0 - q0) *2 + abs(p1-q1)/2 psubusb mm5, mm3 ; abs(p0 - q0) *2 + abs(p1-q1)/2 > flimit * 2 + limit pxor mm3, mm3 pcmpeqb mm5, mm3 ; start work on filters pxor mm2, [GLOBAL(t80)] ; p1 offset to convert to signed values pxor mm7, [GLOBAL(t80)] ; q1 offset to convert to signed values psubsb mm2, mm7 ; p1 - q1 pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values pxor mm0, [GLOBAL(t80)] ; offset to convert to signed values movq mm3, mm0 ; q0 psubsb mm0, mm6 ; q0 - p0 paddsb mm2, mm0 ; p1 - q1 + 1 * (q0 - p0) paddsb mm2, mm0 ; p1 - q1 + 2 * (q0 - p0) paddsb mm2, mm0 ; p1 - q1 + 3 * (q0 - p0) pand mm5, mm2 ; mask filter values we don't care about ; do + 4 side paddsb mm5, [GLOBAL(t4)] ; 3* (q0 - p0) + (p1 - q1) + 4 movq mm0, mm5 ; get a copy of filters psllw mm0, 8 ; shift left 8 psraw mm0, 3 ; arithmetic shift right 11 psrlw mm0, 8 movq mm1, mm5 ; get a copy of filters psraw mm1, 11 ; arithmetic shift right 11 psllw mm1, 8 ; shift left 8 to put it back por mm0, mm1 ; put the two together to get result psubsb mm3, mm0 ; q0-= q0 add pxor mm3, [GLOBAL(t80)] ; unoffset movq [rsi], mm3 ; write back ; now do +3 side psubsb mm5, [GLOBAL(t1s)] ; +3 instead of +4 movq mm0, mm5 ; get a copy of filters psllw mm0, 8 ; shift left 8 psraw mm0, 3 ; arithmetic shift right 11 psrlw mm0, 8 psraw mm5, 11 ; arithmetic shift right 11 psllw mm5, 8 ; shift left 8 to put it back por mm0, mm5 ; put the two together to get result paddsb mm6, mm0 ; p0+= p0 add pxor mm6, [GLOBAL(t80)] ; unoffset movq [rsi+rax], mm6 ; write back add rsi,8 neg rax dec rcx jnz nexts8_h ; begin epilog pop rdi pop rsi RESTORE_GOT UNSHADOW_ARGS pop rbp ret ;void vp8_loop_filter_simple_vertical_edge_mmx ;( ; unsigned char *src_ptr, ; int src_pixel_step, ; const char *flimit, ; const char *limit, ; const char *thresh, ; int count ;) global sym(vp8_loop_filter_simple_vertical_edge_mmx) sym(vp8_loop_filter_simple_vertical_edge_mmx): push rbp mov rbp, rsp SHADOW_ARGS_TO_STACK 6 GET_GOT rbx push rsi push rdi ; end prolog ALIGN_STACK 16, rax sub rsp, 32 ; reserve 32 bytes %define t0 [rsp + 0] ;__declspec(align(16)) char t0[8]; %define t1 [rsp + 16] ;__declspec(align(16)) char t1[8]; mov rsi, arg(0) ;src_ptr movsxd rax, dword ptr arg(1) ;src_pixel_step ; destination pitch? lea rsi, [rsi + rax*4- 2]; ; movsxd rcx, dword ptr arg(5) ;count nexts8_v: lea rdi, [rsi + rax]; movd mm0, [rdi + rax * 2] ; xx xx xx xx 73 72 71 70 movd mm6, [rsi + rax * 2] ; xx xx xx xx 63 62 61 60 punpcklbw mm6, mm0 ; 73 63 72 62 71 61 70 60 movd mm0, [rsi + rax] ; xx xx xx xx 53 52 51 50 movd mm4, [rsi] ; xx xx xx xx 43 42 41 40 punpcklbw mm4, mm0 ; 53 43 52 42 51 41 50 40 movq mm5, mm4 ; 53 43 52 42 51 41 50 40 punpcklwd mm4, mm6 ; 71 61 51 41 70 60 50 40 punpckhwd mm5, mm6 ; 73 63 53 43 72 62 52 42 neg rax movd mm7, [rsi + rax] ; xx xx xx xx 33 32 31 30 movd mm6, [rsi + rax * 2] ; xx xx xx xx 23 22 21 20 punpcklbw mm6, mm7 ; 33 23 32 22 31 21 30 20 movd mm1, [rdi + rax * 4] ; xx xx xx xx 13 12 11 10 movd mm0, [rsi + rax * 4] ; xx xx xx xx 03 02 01 00 punpcklbw mm0, mm1 ; 13 03 12 02 11 01 10 00 movq mm2, mm0 ; 13 03 12 02 11 01 10 00 punpcklwd mm0, mm6 ; 31 21 11 01 30 20 10 00 punpckhwd mm2, mm6 ; 33 23 13 03 32 22 12 02 movq mm1, mm0 ; 13 03 12 02 11 01 10 00 punpckldq mm0, mm4 ; 70 60 50 40 30 20 10 00 = p1 movq mm3, mm2 ; 33 23 13 03 32 22 12 02 punpckhdq mm1, mm4 ; 71 61 51 41 31 21 11 01 = p0 punpckldq mm2, mm5 ; 72 62 52 42 32 22 12 02 = q0 punpckhdq mm3, mm5 ; 73 63 53 43 33 23 13 03 = q1 ; calculate mask movq mm6, mm0 ; p1 movq mm7, mm3 ; q1 psubusb mm7, mm6 ; q1-=p1 psubusb mm6, mm3 ; p1-=q1 por mm6, mm7 ; abs(p1-q1) pand mm6, [GLOBAL(tfe)] ; set lsb of each byte to zero psrlw mm6, 1 ; abs(p1-q1)/2 movq mm5, mm1 ; p0 movq mm4, mm2 ; q0 psubusb mm5, mm2 ; p0-=q0 psubusb mm4, mm1 ; q0-=p0 por mm5, mm4 ; abs(p0 - q0) paddusb mm5, mm5 ; abs(p0-q0)*2 paddusb mm5, mm6 ; abs (p0 - q0) *2 + abs(p1-q1)/2 mov rdx, arg(2) ;flimit ; get flimit movq mm7, [rdx] mov rdx, arg(3) ; get limit movq mm6, [rdx] paddb mm7, mm7 ; flimit*2 (less than 255) paddb mm7, mm6 ; flimit * 2 + limit (less than 255) psubusb mm5, mm7 ; abs(p0 - q0) *2 + abs(p1-q1)/2 > flimit * 2 + limit pxor mm7, mm7 pcmpeqb mm5, mm7 ; mm5 = mask ; start work on filters movq t0, mm0 movq t1, mm3 pxor mm0, [GLOBAL(t80)] ; p1 offset to convert to signed values pxor mm3, [GLOBAL(t80)] ; q1 offset to convert to signed values psubsb mm0, mm3 ; p1 - q1 movq mm6, mm1 ; p0 movq mm7, mm2 ; q0 pxor mm6, [GLOBAL(t80)] ; offset to convert to signed values pxor mm7, [GLOBAL(t80)] ; offset to convert to signed values movq mm3, mm7 ; offseted ; q0 psubsb mm7, mm6 ; q0 - p0 paddsb mm0, mm7 ; p1 - q1 + 1 * (q0 - p0) paddsb mm0, mm7 ; p1 - q1 + 2 * (q0 - p0) paddsb mm0, mm7 ; p1 - q1 + 3 * (q0 - p0) pand mm5, mm0 ; mask filter values we don't care about paddsb mm5, [GLOBAL(t4)] ; 3* (q0 - p0) + (p1 - q1) + 4 movq mm0, mm5 ; get a copy of filters psllw mm0, 8 ; shift left 8 psraw mm0, 3 ; arithmetic shift right 11 psrlw mm0, 8 movq mm7, mm5 ; get a copy of filters psraw mm7, 11 ; arithmetic shift right 11 psllw mm7, 8 ; shift left 8 to put it back por mm0, mm7 ; put the two together to get result psubsb mm3, mm0 ; q0-= q0sz add pxor mm3, [GLOBAL(t80)] ; unoffset ; now do +3 side psubsb mm5, [GLOBAL(t1s)] ; +3 instead of +4 movq mm0, mm5 ; get a copy of filters psllw mm0, 8 ; shift left 8 psraw mm0, 3 ; arithmetic shift right 11 psrlw mm0, 8 psraw mm5, 11 ; arithmetic shift right 11 psllw mm5, 8 ; shift left 8 to put it back por mm0, mm5 ; put the two together to get result paddsb mm6, mm0 ; p0+= p0 add pxor mm6, [GLOBAL(t80)] ; unoffset movq mm0, t0 movq mm4, t1 ; mm0 = 70 60 50 40 30 20 10 00 ; mm6 = 71 61 51 41 31 21 11 01 ; mm3 = 72 62 52 42 32 22 12 02 ; mm4 = 73 63 53 43 33 23 13 03 ; transpose back to write out movq mm1, mm0 ; punpcklbw mm0, mm6 ; 31 30 21 20 11 10 01 00 punpckhbw mm1, mm6 ; 71 70 61 60 51 50 41 40 movq mm2, mm3 ; punpcklbw mm2, mm4 ; 33 32 23 22 13 12 03 02 movq mm5, mm1 ; 71 70 61 60 51 50 41 40 punpckhbw mm3, mm4 ; 73 72 63 62 53 52 43 42 movq mm6, mm0 ; 31 30 21 20 11 10 01 00 punpcklwd mm0, mm2 ; 13 12 11 10 03 02 01 00 punpckhwd mm6, mm2 ; 33 32 31 30 23 22 21 20 movd [rsi+rax*4], mm0 ; write 03 02 01 00 punpcklwd mm1, mm3 ; 53 52 51 50 43 42 41 40 psrlq mm0, 32 ; xx xx xx xx 13 12 11 10 punpckhwd mm5, mm3 ; 73 72 71 70 63 62 61 60 movd [rdi+rax*4], mm0 ; write 13 12 11 10 movd [rsi+rax*2], mm6 ; write 23 22 21 20 psrlq mm6, 32 ; 33 32 31 30 movd [rsi], mm1 ; write 43 42 41 40 movd [rsi + rax], mm6 ; write 33 32 31 30 neg rax movd [rsi + rax*2], mm5 ; write 63 62 61 60 psrlq mm1, 32 ; 53 52 51 50 movd [rdi], mm1 ; write out 53 52 51 50 psrlq mm5, 32 ; 73 72 71 70 movd [rdi + rax*2], mm5 ; write 73 72 71 70 lea rsi, [rsi+rax*8] ; next 8 dec rcx jnz nexts8_v add rsp, 32 pop rsp ; begin epilog pop rdi pop rsi RESTORE_GOT UNSHADOW_ARGS pop rbp ret ;void fast_loop_filter_vertical_edges_mmx(unsigned char *y_ptr, ; int y_stride, ; loop_filter_info *lfi) ;{ ; ; ; vp8_loop_filter_simple_vertical_edge_mmx(y_ptr+4, y_stride, lfi->flim,lfi->lim,lfi->thr,2); ; vp8_loop_filter_simple_vertical_edge_mmx(y_ptr+8, y_stride, lfi->flim,lfi->lim,lfi->thr,2); ; vp8_loop_filter_simple_vertical_edge_mmx(y_ptr+12, y_stride, lfi->flim,lfi->lim,lfi->thr,2); ;} SECTION_RODATA align 16 tfe: times 8 db 0xfe align 16 t80: times 8 db 0x80 align 16 t1s: times 8 db 0x01 align 16 t3: times 8 db 0x03 align 16 t4: times 8 db 0x04 align 16 ones: times 4 dw 0x0001 align 16 s27: times 4 dw 0x1b00 align 16 s18: times 4 dw 0x1200 align 16 s9: times 4 dw 0x0900 align 16 s63: times 4 dw 0x003f
;-----------------------------------------------------------------------------; ; Author: Michael Schierl (schierlm[at]gmx[dot]de) ; Version: 1.0 (29 December 2012) ;-----------------------------------------------------------------------------; [BITS 32] ; Input: EBP - Data to decode ; ECX - Data length ; ESI - Key (16 bytes for simplicity) ; EDI - pointer to 0x100 bytes scratch space for S-box ; Direction flag has to be cleared ; Output: None. Data is decoded in place. ; Clobbers: EAX, EBX, ECX, EDX, EBP (stack is not used) ; Initialize S-box xor eax, eax ; Start with 0 init: stosb ; Store next S-Box byte S[i] = i inc al ; increase byte to write (EDI is increased automatically) jnz init ; loop until we wrap around sub edi, 0x100 ; restore EDI ; permute S-box according to key xor ebx, ebx ; Clear EBX (EAX is already cleared) permute: add bl, [edi+eax] ; BL += S[AL] + KEY[AL % 16] mov edx, eax and dl, 0xF add bl, [esi+edx] mov dl, [edi+eax] ; swap S[AL] and S[BL] xchg dl, [edi+ebx] mov [edi+eax], dl inc al ; AL += 1 until we wrap around jnz permute ; decryption loop xor ebx, ebx ; Clear EBX (EAX is already cleared) decrypt: inc al ; AL += 1 add bl, [edi+eax] ; BL += S[AL] mov dl, [edi+eax] ; swap S[AL] and S[BL] xchg dl, [edi+ebx] mov [edi+eax], dl add dl, [edi+ebx] ; DL = S[AL]+S[BL] mov dl, [edi+edx] ; DL = S[DL] xor [ebp], dl ; [EBP] ^= DL inc ebp ; advance data pointer dec ecx ; reduce counter jnz decrypt ; until finished
_ps: file format elf32-i386 Disassembly of section .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: 51 push %ecx e: 83 ec 04 sub $0x4,%esp cps(); 11: e8 fc 02 00 00 call 312 <cps> exit(); 16: e8 57 02 00 00 call 272 <exit> 1b: 66 90 xchg %ax,%ax 1d: 66 90 xchg %ax,%ax 1f: 90 nop 00000020 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 20: 55 push %ebp 21: 89 e5 mov %esp,%ebp 23: 53 push %ebx 24: 8b 45 08 mov 0x8(%ebp),%eax 27: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 2a: 89 c2 mov %eax,%edx 2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 30: 83 c1 01 add $0x1,%ecx 33: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 37: 83 c2 01 add $0x1,%edx 3a: 84 db test %bl,%bl 3c: 88 5a ff mov %bl,-0x1(%edx) 3f: 75 ef jne 30 <strcpy+0x10> ; return os; } 41: 5b pop %ebx 42: 5d pop %ebp 43: c3 ret 44: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 4a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000050 <strcmp>: int strcmp(const char *p, const char *q) { 50: 55 push %ebp 51: 89 e5 mov %esp,%ebp 53: 53 push %ebx 54: 8b 55 08 mov 0x8(%ebp),%edx 57: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 5a: 0f b6 02 movzbl (%edx),%eax 5d: 0f b6 19 movzbl (%ecx),%ebx 60: 84 c0 test %al,%al 62: 75 1c jne 80 <strcmp+0x30> 64: eb 2a jmp 90 <strcmp+0x40> 66: 8d 76 00 lea 0x0(%esi),%esi 69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 70: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 73: 0f b6 02 movzbl (%edx),%eax p++, q++; 76: 83 c1 01 add $0x1,%ecx 79: 0f b6 19 movzbl (%ecx),%ebx while(*p && *p == *q) 7c: 84 c0 test %al,%al 7e: 74 10 je 90 <strcmp+0x40> 80: 38 d8 cmp %bl,%al 82: 74 ec je 70 <strcmp+0x20> return (uchar)*p - (uchar)*q; 84: 29 d8 sub %ebx,%eax } 86: 5b pop %ebx 87: 5d pop %ebp 88: c3 ret 89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 90: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 92: 29 d8 sub %ebx,%eax } 94: 5b pop %ebx 95: 5d pop %ebp 96: c3 ret 97: 89 f6 mov %esi,%esi 99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000000a0 <strlen>: uint strlen(char *s) { a0: 55 push %ebp a1: 89 e5 mov %esp,%ebp a3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) a6: 80 39 00 cmpb $0x0,(%ecx) a9: 74 15 je c0 <strlen+0x20> ab: 31 d2 xor %edx,%edx ad: 8d 76 00 lea 0x0(%esi),%esi b0: 83 c2 01 add $0x1,%edx b3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) b7: 89 d0 mov %edx,%eax b9: 75 f5 jne b0 <strlen+0x10> ; return n; } bb: 5d pop %ebp bc: c3 ret bd: 8d 76 00 lea 0x0(%esi),%esi for(n = 0; s[n]; n++) c0: 31 c0 xor %eax,%eax } c2: 5d pop %ebp c3: c3 ret c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000000d0 <memset>: void* memset(void *dst, int c, uint n) { d0: 55 push %ebp d1: 89 e5 mov %esp,%ebp d3: 57 push %edi d4: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : d7: 8b 4d 10 mov 0x10(%ebp),%ecx da: 8b 45 0c mov 0xc(%ebp),%eax dd: 89 d7 mov %edx,%edi df: fc cld e0: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } e2: 89 d0 mov %edx,%eax e4: 5f pop %edi e5: 5d pop %ebp e6: c3 ret e7: 89 f6 mov %esi,%esi e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000000f0 <strchr>: char* strchr(const char *s, char c) { f0: 55 push %ebp f1: 89 e5 mov %esp,%ebp f3: 53 push %ebx f4: 8b 45 08 mov 0x8(%ebp),%eax f7: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) fa: 0f b6 10 movzbl (%eax),%edx fd: 84 d2 test %dl,%dl ff: 74 1d je 11e <strchr+0x2e> if(*s == c) 101: 38 d3 cmp %dl,%bl 103: 89 d9 mov %ebx,%ecx 105: 75 0d jne 114 <strchr+0x24> 107: eb 17 jmp 120 <strchr+0x30> 109: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 110: 38 ca cmp %cl,%dl 112: 74 0c je 120 <strchr+0x30> for(; *s; s++) 114: 83 c0 01 add $0x1,%eax 117: 0f b6 10 movzbl (%eax),%edx 11a: 84 d2 test %dl,%dl 11c: 75 f2 jne 110 <strchr+0x20> return (char*)s; return 0; 11e: 31 c0 xor %eax,%eax } 120: 5b pop %ebx 121: 5d pop %ebp 122: c3 ret 123: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000130 <gets>: char* gets(char *buf, int max) { 130: 55 push %ebp 131: 89 e5 mov %esp,%ebp 133: 57 push %edi 134: 56 push %esi 135: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 136: 31 f6 xor %esi,%esi 138: 89 f3 mov %esi,%ebx { 13a: 83 ec 1c sub $0x1c,%esp 13d: 8b 7d 08 mov 0x8(%ebp),%edi for(i=0; i+1 < max; ){ 140: eb 2f jmp 171 <gets+0x41> 142: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 148: 8d 45 e7 lea -0x19(%ebp),%eax 14b: 83 ec 04 sub $0x4,%esp 14e: 6a 01 push $0x1 150: 50 push %eax 151: 6a 00 push $0x0 153: e8 32 01 00 00 call 28a <read> if(cc < 1) 158: 83 c4 10 add $0x10,%esp 15b: 85 c0 test %eax,%eax 15d: 7e 1c jle 17b <gets+0x4b> break; buf[i++] = c; 15f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 163: 83 c7 01 add $0x1,%edi 166: 88 47 ff mov %al,-0x1(%edi) if(c == '\n' || c == '\r') 169: 3c 0a cmp $0xa,%al 16b: 74 23 je 190 <gets+0x60> 16d: 3c 0d cmp $0xd,%al 16f: 74 1f je 190 <gets+0x60> for(i=0; i+1 < max; ){ 171: 83 c3 01 add $0x1,%ebx 174: 3b 5d 0c cmp 0xc(%ebp),%ebx 177: 89 fe mov %edi,%esi 179: 7c cd jl 148 <gets+0x18> 17b: 89 f3 mov %esi,%ebx break; } buf[i] = '\0'; return buf; } 17d: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 180: c6 03 00 movb $0x0,(%ebx) } 183: 8d 65 f4 lea -0xc(%ebp),%esp 186: 5b pop %ebx 187: 5e pop %esi 188: 5f pop %edi 189: 5d pop %ebp 18a: c3 ret 18b: 90 nop 18c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 190: 8b 75 08 mov 0x8(%ebp),%esi 193: 8b 45 08 mov 0x8(%ebp),%eax 196: 01 de add %ebx,%esi 198: 89 f3 mov %esi,%ebx buf[i] = '\0'; 19a: c6 03 00 movb $0x0,(%ebx) } 19d: 8d 65 f4 lea -0xc(%ebp),%esp 1a0: 5b pop %ebx 1a1: 5e pop %esi 1a2: 5f pop %edi 1a3: 5d pop %ebp 1a4: c3 ret 1a5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001b0 <stat>: int stat(char *n, struct stat *st) { 1b0: 55 push %ebp 1b1: 89 e5 mov %esp,%ebp 1b3: 56 push %esi 1b4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 1b5: 83 ec 08 sub $0x8,%esp 1b8: 6a 00 push $0x0 1ba: ff 75 08 pushl 0x8(%ebp) 1bd: e8 f0 00 00 00 call 2b2 <open> if(fd < 0) 1c2: 83 c4 10 add $0x10,%esp 1c5: 85 c0 test %eax,%eax 1c7: 78 27 js 1f0 <stat+0x40> return -1; r = fstat(fd, st); 1c9: 83 ec 08 sub $0x8,%esp 1cc: ff 75 0c pushl 0xc(%ebp) 1cf: 89 c3 mov %eax,%ebx 1d1: 50 push %eax 1d2: e8 f3 00 00 00 call 2ca <fstat> close(fd); 1d7: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 1da: 89 c6 mov %eax,%esi close(fd); 1dc: e8 b9 00 00 00 call 29a <close> return r; 1e1: 83 c4 10 add $0x10,%esp } 1e4: 8d 65 f8 lea -0x8(%ebp),%esp 1e7: 89 f0 mov %esi,%eax 1e9: 5b pop %ebx 1ea: 5e pop %esi 1eb: 5d pop %ebp 1ec: c3 ret 1ed: 8d 76 00 lea 0x0(%esi),%esi return -1; 1f0: be ff ff ff ff mov $0xffffffff,%esi 1f5: eb ed jmp 1e4 <stat+0x34> 1f7: 89 f6 mov %esi,%esi 1f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000200 <atoi>: int atoi(const char *s) { 200: 55 push %ebp 201: 89 e5 mov %esp,%ebp 203: 53 push %ebx 204: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 207: 0f be 11 movsbl (%ecx),%edx 20a: 8d 42 d0 lea -0x30(%edx),%eax 20d: 3c 09 cmp $0x9,%al n = 0; 20f: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 214: 77 1f ja 235 <atoi+0x35> 216: 8d 76 00 lea 0x0(%esi),%esi 219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 220: 8d 04 80 lea (%eax,%eax,4),%eax 223: 83 c1 01 add $0x1,%ecx 226: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax while('0' <= *s && *s <= '9') 22a: 0f be 11 movsbl (%ecx),%edx 22d: 8d 5a d0 lea -0x30(%edx),%ebx 230: 80 fb 09 cmp $0x9,%bl 233: 76 eb jbe 220 <atoi+0x20> return n; } 235: 5b pop %ebx 236: 5d pop %ebp 237: c3 ret 238: 90 nop 239: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000240 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 240: 55 push %ebp 241: 89 e5 mov %esp,%ebp 243: 56 push %esi 244: 53 push %ebx 245: 8b 5d 10 mov 0x10(%ebp),%ebx 248: 8b 45 08 mov 0x8(%ebp),%eax 24b: 8b 75 0c mov 0xc(%ebp),%esi char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 24e: 85 db test %ebx,%ebx 250: 7e 14 jle 266 <memmove+0x26> 252: 31 d2 xor %edx,%edx 254: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 258: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 25c: 88 0c 10 mov %cl,(%eax,%edx,1) 25f: 83 c2 01 add $0x1,%edx while(n-- > 0) 262: 39 d3 cmp %edx,%ebx 264: 75 f2 jne 258 <memmove+0x18> return vdst; } 266: 5b pop %ebx 267: 5e pop %esi 268: 5d pop %ebp 269: c3 ret 0000026a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 26a: b8 01 00 00 00 mov $0x1,%eax 26f: cd 40 int $0x40 271: c3 ret 00000272 <exit>: SYSCALL(exit) 272: b8 02 00 00 00 mov $0x2,%eax 277: cd 40 int $0x40 279: c3 ret 0000027a <wait>: SYSCALL(wait) 27a: b8 03 00 00 00 mov $0x3,%eax 27f: cd 40 int $0x40 281: c3 ret 00000282 <pipe>: SYSCALL(pipe) 282: b8 04 00 00 00 mov $0x4,%eax 287: cd 40 int $0x40 289: c3 ret 0000028a <read>: SYSCALL(read) 28a: b8 05 00 00 00 mov $0x5,%eax 28f: cd 40 int $0x40 291: c3 ret 00000292 <write>: SYSCALL(write) 292: b8 10 00 00 00 mov $0x10,%eax 297: cd 40 int $0x40 299: c3 ret 0000029a <close>: SYSCALL(close) 29a: b8 15 00 00 00 mov $0x15,%eax 29f: cd 40 int $0x40 2a1: c3 ret 000002a2 <kill>: SYSCALL(kill) 2a2: b8 06 00 00 00 mov $0x6,%eax 2a7: cd 40 int $0x40 2a9: c3 ret 000002aa <exec>: SYSCALL(exec) 2aa: b8 07 00 00 00 mov $0x7,%eax 2af: cd 40 int $0x40 2b1: c3 ret 000002b2 <open>: SYSCALL(open) 2b2: b8 0f 00 00 00 mov $0xf,%eax 2b7: cd 40 int $0x40 2b9: c3 ret 000002ba <mknod>: SYSCALL(mknod) 2ba: b8 11 00 00 00 mov $0x11,%eax 2bf: cd 40 int $0x40 2c1: c3 ret 000002c2 <unlink>: SYSCALL(unlink) 2c2: b8 12 00 00 00 mov $0x12,%eax 2c7: cd 40 int $0x40 2c9: c3 ret 000002ca <fstat>: SYSCALL(fstat) 2ca: b8 08 00 00 00 mov $0x8,%eax 2cf: cd 40 int $0x40 2d1: c3 ret 000002d2 <link>: SYSCALL(link) 2d2: b8 13 00 00 00 mov $0x13,%eax 2d7: cd 40 int $0x40 2d9: c3 ret 000002da <mkdir>: SYSCALL(mkdir) 2da: b8 14 00 00 00 mov $0x14,%eax 2df: cd 40 int $0x40 2e1: c3 ret 000002e2 <chdir>: SYSCALL(chdir) 2e2: b8 09 00 00 00 mov $0x9,%eax 2e7: cd 40 int $0x40 2e9: c3 ret 000002ea <dup>: SYSCALL(dup) 2ea: b8 0a 00 00 00 mov $0xa,%eax 2ef: cd 40 int $0x40 2f1: c3 ret 000002f2 <getpid>: SYSCALL(getpid) 2f2: b8 0b 00 00 00 mov $0xb,%eax 2f7: cd 40 int $0x40 2f9: c3 ret 000002fa <sbrk>: SYSCALL(sbrk) 2fa: b8 0c 00 00 00 mov $0xc,%eax 2ff: cd 40 int $0x40 301: c3 ret 00000302 <sleep>: SYSCALL(sleep) 302: b8 0d 00 00 00 mov $0xd,%eax 307: cd 40 int $0x40 309: c3 ret 0000030a <uptime>: SYSCALL(uptime) 30a: b8 0e 00 00 00 mov $0xe,%eax 30f: cd 40 int $0x40 311: c3 ret 00000312 <cps>: SYSCALL(cps) 312: b8 16 00 00 00 mov $0x16,%eax 317: cd 40 int $0x40 319: c3 ret 0000031a <chpr>: SYSCALL(chpr) 31a: b8 17 00 00 00 mov $0x17,%eax 31f: cd 40 int $0x40 321: c3 ret 00000322 <getppid>: SYSCALL(getppid) 322: b8 18 00 00 00 mov $0x18,%eax 327: cd 40 int $0x40 329: c3 ret 32a: 66 90 xchg %ax,%ax 32c: 66 90 xchg %ax,%ax 32e: 66 90 xchg %ax,%ax 00000330 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 330: 55 push %ebp 331: 89 e5 mov %esp,%ebp 333: 57 push %edi 334: 56 push %esi 335: 53 push %ebx 336: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 339: 85 d2 test %edx,%edx { 33b: 89 45 c0 mov %eax,-0x40(%ebp) neg = 1; x = -xx; 33e: 89 d0 mov %edx,%eax if(sgn && xx < 0){ 340: 79 76 jns 3b8 <printint+0x88> 342: f6 45 08 01 testb $0x1,0x8(%ebp) 346: 74 70 je 3b8 <printint+0x88> x = -xx; 348: f7 d8 neg %eax neg = 1; 34a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) } else { x = xx; } i = 0; 351: 31 f6 xor %esi,%esi 353: 8d 5d d7 lea -0x29(%ebp),%ebx 356: eb 0a jmp 362 <printint+0x32> 358: 90 nop 359: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi do{ buf[i++] = digits[x % base]; 360: 89 fe mov %edi,%esi 362: 31 d2 xor %edx,%edx 364: 8d 7e 01 lea 0x1(%esi),%edi 367: f7 f1 div %ecx 369: 0f b6 92 30 07 00 00 movzbl 0x730(%edx),%edx }while((x /= base) != 0); 370: 85 c0 test %eax,%eax buf[i++] = digits[x % base]; 372: 88 14 3b mov %dl,(%ebx,%edi,1) }while((x /= base) != 0); 375: 75 e9 jne 360 <printint+0x30> if(neg) 377: 8b 45 c4 mov -0x3c(%ebp),%eax 37a: 85 c0 test %eax,%eax 37c: 74 08 je 386 <printint+0x56> buf[i++] = '-'; 37e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1) 383: 8d 7e 02 lea 0x2(%esi),%edi 386: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi 38a: 8b 7d c0 mov -0x40(%ebp),%edi 38d: 8d 76 00 lea 0x0(%esi),%esi 390: 0f b6 06 movzbl (%esi),%eax write(fd, &c, 1); 393: 83 ec 04 sub $0x4,%esp 396: 83 ee 01 sub $0x1,%esi 399: 6a 01 push $0x1 39b: 53 push %ebx 39c: 57 push %edi 39d: 88 45 d7 mov %al,-0x29(%ebp) 3a0: e8 ed fe ff ff call 292 <write> while(--i >= 0) 3a5: 83 c4 10 add $0x10,%esp 3a8: 39 de cmp %ebx,%esi 3aa: 75 e4 jne 390 <printint+0x60> putc(fd, buf[i]); } 3ac: 8d 65 f4 lea -0xc(%ebp),%esp 3af: 5b pop %ebx 3b0: 5e pop %esi 3b1: 5f pop %edi 3b2: 5d pop %ebp 3b3: c3 ret 3b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; 3b8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 3bf: eb 90 jmp 351 <printint+0x21> 3c1: eb 0d jmp 3d0 <printf> 3c3: 90 nop 3c4: 90 nop 3c5: 90 nop 3c6: 90 nop 3c7: 90 nop 3c8: 90 nop 3c9: 90 nop 3ca: 90 nop 3cb: 90 nop 3cc: 90 nop 3cd: 90 nop 3ce: 90 nop 3cf: 90 nop 000003d0 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 3d0: 55 push %ebp 3d1: 89 e5 mov %esp,%ebp 3d3: 57 push %edi 3d4: 56 push %esi 3d5: 53 push %ebx 3d6: 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++){ 3d9: 8b 75 0c mov 0xc(%ebp),%esi 3dc: 0f b6 1e movzbl (%esi),%ebx 3df: 84 db test %bl,%bl 3e1: 0f 84 b3 00 00 00 je 49a <printf+0xca> ap = (uint*)(void*)&fmt + 1; 3e7: 8d 45 10 lea 0x10(%ebp),%eax 3ea: 83 c6 01 add $0x1,%esi state = 0; 3ed: 31 ff xor %edi,%edi ap = (uint*)(void*)&fmt + 1; 3ef: 89 45 d4 mov %eax,-0x2c(%ebp) 3f2: eb 2f jmp 423 <printf+0x53> 3f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 3f8: 83 f8 25 cmp $0x25,%eax 3fb: 0f 84 a7 00 00 00 je 4a8 <printf+0xd8> write(fd, &c, 1); 401: 8d 45 e2 lea -0x1e(%ebp),%eax 404: 83 ec 04 sub $0x4,%esp 407: 88 5d e2 mov %bl,-0x1e(%ebp) 40a: 6a 01 push $0x1 40c: 50 push %eax 40d: ff 75 08 pushl 0x8(%ebp) 410: e8 7d fe ff ff call 292 <write> 415: 83 c4 10 add $0x10,%esp 418: 83 c6 01 add $0x1,%esi for(i = 0; fmt[i]; i++){ 41b: 0f b6 5e ff movzbl -0x1(%esi),%ebx 41f: 84 db test %bl,%bl 421: 74 77 je 49a <printf+0xca> if(state == 0){ 423: 85 ff test %edi,%edi c = fmt[i] & 0xff; 425: 0f be cb movsbl %bl,%ecx 428: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 42b: 74 cb je 3f8 <printf+0x28> state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 42d: 83 ff 25 cmp $0x25,%edi 430: 75 e6 jne 418 <printf+0x48> if(c == 'd'){ 432: 83 f8 64 cmp $0x64,%eax 435: 0f 84 05 01 00 00 je 540 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 43b: 81 e1 f7 00 00 00 and $0xf7,%ecx 441: 83 f9 70 cmp $0x70,%ecx 444: 74 72 je 4b8 <printf+0xe8> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 446: 83 f8 73 cmp $0x73,%eax 449: 0f 84 99 00 00 00 je 4e8 <printf+0x118> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 44f: 83 f8 63 cmp $0x63,%eax 452: 0f 84 08 01 00 00 je 560 <printf+0x190> putc(fd, *ap); ap++; } else if(c == '%'){ 458: 83 f8 25 cmp $0x25,%eax 45b: 0f 84 ef 00 00 00 je 550 <printf+0x180> write(fd, &c, 1); 461: 8d 45 e7 lea -0x19(%ebp),%eax 464: 83 ec 04 sub $0x4,%esp 467: c6 45 e7 25 movb $0x25,-0x19(%ebp) 46b: 6a 01 push $0x1 46d: 50 push %eax 46e: ff 75 08 pushl 0x8(%ebp) 471: e8 1c fe ff ff call 292 <write> 476: 83 c4 0c add $0xc,%esp 479: 8d 45 e6 lea -0x1a(%ebp),%eax 47c: 88 5d e6 mov %bl,-0x1a(%ebp) 47f: 6a 01 push $0x1 481: 50 push %eax 482: ff 75 08 pushl 0x8(%ebp) 485: 83 c6 01 add $0x1,%esi } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 488: 31 ff xor %edi,%edi write(fd, &c, 1); 48a: e8 03 fe ff ff call 292 <write> for(i = 0; fmt[i]; i++){ 48f: 0f b6 5e ff movzbl -0x1(%esi),%ebx write(fd, &c, 1); 493: 83 c4 10 add $0x10,%esp for(i = 0; fmt[i]; i++){ 496: 84 db test %bl,%bl 498: 75 89 jne 423 <printf+0x53> } } } 49a: 8d 65 f4 lea -0xc(%ebp),%esp 49d: 5b pop %ebx 49e: 5e pop %esi 49f: 5f pop %edi 4a0: 5d pop %ebp 4a1: c3 ret 4a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi state = '%'; 4a8: bf 25 00 00 00 mov $0x25,%edi 4ad: e9 66 ff ff ff jmp 418 <printf+0x48> 4b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 4b8: 83 ec 0c sub $0xc,%esp 4bb: b9 10 00 00 00 mov $0x10,%ecx 4c0: 6a 00 push $0x0 4c2: 8b 7d d4 mov -0x2c(%ebp),%edi 4c5: 8b 45 08 mov 0x8(%ebp),%eax 4c8: 8b 17 mov (%edi),%edx 4ca: e8 61 fe ff ff call 330 <printint> ap++; 4cf: 89 f8 mov %edi,%eax 4d1: 83 c4 10 add $0x10,%esp state = 0; 4d4: 31 ff xor %edi,%edi ap++; 4d6: 83 c0 04 add $0x4,%eax 4d9: 89 45 d4 mov %eax,-0x2c(%ebp) 4dc: e9 37 ff ff ff jmp 418 <printf+0x48> 4e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi s = (char*)*ap; 4e8: 8b 45 d4 mov -0x2c(%ebp),%eax 4eb: 8b 08 mov (%eax),%ecx ap++; 4ed: 83 c0 04 add $0x4,%eax 4f0: 89 45 d4 mov %eax,-0x2c(%ebp) if(s == 0) 4f3: 85 c9 test %ecx,%ecx 4f5: 0f 84 8e 00 00 00 je 589 <printf+0x1b9> while(*s != 0){ 4fb: 0f b6 01 movzbl (%ecx),%eax state = 0; 4fe: 31 ff xor %edi,%edi s = (char*)*ap; 500: 89 cb mov %ecx,%ebx while(*s != 0){ 502: 84 c0 test %al,%al 504: 0f 84 0e ff ff ff je 418 <printf+0x48> 50a: 89 75 d0 mov %esi,-0x30(%ebp) 50d: 89 de mov %ebx,%esi 50f: 8b 5d 08 mov 0x8(%ebp),%ebx 512: 8d 7d e3 lea -0x1d(%ebp),%edi 515: 8d 76 00 lea 0x0(%esi),%esi write(fd, &c, 1); 518: 83 ec 04 sub $0x4,%esp s++; 51b: 83 c6 01 add $0x1,%esi 51e: 88 45 e3 mov %al,-0x1d(%ebp) write(fd, &c, 1); 521: 6a 01 push $0x1 523: 57 push %edi 524: 53 push %ebx 525: e8 68 fd ff ff call 292 <write> while(*s != 0){ 52a: 0f b6 06 movzbl (%esi),%eax 52d: 83 c4 10 add $0x10,%esp 530: 84 c0 test %al,%al 532: 75 e4 jne 518 <printf+0x148> 534: 8b 75 d0 mov -0x30(%ebp),%esi state = 0; 537: 31 ff xor %edi,%edi 539: e9 da fe ff ff jmp 418 <printf+0x48> 53e: 66 90 xchg %ax,%ax printint(fd, *ap, 10, 1); 540: 83 ec 0c sub $0xc,%esp 543: b9 0a 00 00 00 mov $0xa,%ecx 548: 6a 01 push $0x1 54a: e9 73 ff ff ff jmp 4c2 <printf+0xf2> 54f: 90 nop write(fd, &c, 1); 550: 83 ec 04 sub $0x4,%esp 553: 88 5d e5 mov %bl,-0x1b(%ebp) 556: 8d 45 e5 lea -0x1b(%ebp),%eax 559: 6a 01 push $0x1 55b: e9 21 ff ff ff jmp 481 <printf+0xb1> putc(fd, *ap); 560: 8b 7d d4 mov -0x2c(%ebp),%edi write(fd, &c, 1); 563: 83 ec 04 sub $0x4,%esp putc(fd, *ap); 566: 8b 07 mov (%edi),%eax write(fd, &c, 1); 568: 6a 01 push $0x1 ap++; 56a: 83 c7 04 add $0x4,%edi putc(fd, *ap); 56d: 88 45 e4 mov %al,-0x1c(%ebp) write(fd, &c, 1); 570: 8d 45 e4 lea -0x1c(%ebp),%eax 573: 50 push %eax 574: ff 75 08 pushl 0x8(%ebp) 577: e8 16 fd ff ff call 292 <write> ap++; 57c: 89 7d d4 mov %edi,-0x2c(%ebp) 57f: 83 c4 10 add $0x10,%esp state = 0; 582: 31 ff xor %edi,%edi 584: e9 8f fe ff ff jmp 418 <printf+0x48> s = "(null)"; 589: bb 28 07 00 00 mov $0x728,%ebx while(*s != 0){ 58e: b8 28 00 00 00 mov $0x28,%eax 593: e9 72 ff ff ff jmp 50a <printf+0x13a> 598: 66 90 xchg %ax,%ax 59a: 66 90 xchg %ax,%ax 59c: 66 90 xchg %ax,%ax 59e: 66 90 xchg %ax,%ax 000005a0 <free>: static Header base; static Header *freep; void free(void *ap) { 5a0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5a1: a1 d4 09 00 00 mov 0x9d4,%eax { 5a6: 89 e5 mov %esp,%ebp 5a8: 57 push %edi 5a9: 56 push %esi 5aa: 53 push %ebx 5ab: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header*)ap - 1; 5ae: 8d 4b f8 lea -0x8(%ebx),%ecx 5b1: 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) 5b8: 39 c8 cmp %ecx,%eax 5ba: 8b 10 mov (%eax),%edx 5bc: 73 32 jae 5f0 <free+0x50> 5be: 39 d1 cmp %edx,%ecx 5c0: 72 04 jb 5c6 <free+0x26> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5c2: 39 d0 cmp %edx,%eax 5c4: 72 32 jb 5f8 <free+0x58> break; if(bp + bp->s.size == p->s.ptr){ 5c6: 8b 73 fc mov -0x4(%ebx),%esi 5c9: 8d 3c f1 lea (%ecx,%esi,8),%edi 5cc: 39 fa cmp %edi,%edx 5ce: 74 30 je 600 <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; 5d0: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 5d3: 8b 50 04 mov 0x4(%eax),%edx 5d6: 8d 34 d0 lea (%eax,%edx,8),%esi 5d9: 39 f1 cmp %esi,%ecx 5db: 74 3a je 617 <free+0x77> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 5dd: 89 08 mov %ecx,(%eax) freep = p; 5df: a3 d4 09 00 00 mov %eax,0x9d4 } 5e4: 5b pop %ebx 5e5: 5e pop %esi 5e6: 5f pop %edi 5e7: 5d pop %ebp 5e8: c3 ret 5e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5f0: 39 d0 cmp %edx,%eax 5f2: 72 04 jb 5f8 <free+0x58> 5f4: 39 d1 cmp %edx,%ecx 5f6: 72 ce jb 5c6 <free+0x26> { 5f8: 89 d0 mov %edx,%eax 5fa: eb bc jmp 5b8 <free+0x18> 5fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp->s.size += p->s.ptr->s.size; 600: 03 72 04 add 0x4(%edx),%esi 603: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 606: 8b 10 mov (%eax),%edx 608: 8b 12 mov (%edx),%edx 60a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 60d: 8b 50 04 mov 0x4(%eax),%edx 610: 8d 34 d0 lea (%eax,%edx,8),%esi 613: 39 f1 cmp %esi,%ecx 615: 75 c6 jne 5dd <free+0x3d> p->s.size += bp->s.size; 617: 03 53 fc add -0x4(%ebx),%edx freep = p; 61a: a3 d4 09 00 00 mov %eax,0x9d4 p->s.size += bp->s.size; 61f: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 622: 8b 53 f8 mov -0x8(%ebx),%edx 625: 89 10 mov %edx,(%eax) } 627: 5b pop %ebx 628: 5e pop %esi 629: 5f pop %edi 62a: 5d pop %ebp 62b: c3 ret 62c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000630 <malloc>: return freep; } void* malloc(uint nbytes) { 630: 55 push %ebp 631: 89 e5 mov %esp,%ebp 633: 57 push %edi 634: 56 push %esi 635: 53 push %ebx 636: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 639: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 63c: 8b 15 d4 09 00 00 mov 0x9d4,%edx nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 642: 8d 78 07 lea 0x7(%eax),%edi 645: c1 ef 03 shr $0x3,%edi 648: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 64b: 85 d2 test %edx,%edx 64d: 0f 84 9d 00 00 00 je 6f0 <malloc+0xc0> 653: 8b 02 mov (%edx),%eax 655: 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){ 658: 39 cf cmp %ecx,%edi 65a: 76 6c jbe 6c8 <malloc+0x98> 65c: 81 ff 00 10 00 00 cmp $0x1000,%edi 662: bb 00 10 00 00 mov $0x1000,%ebx 667: 0f 43 df cmovae %edi,%ebx p = sbrk(nu * sizeof(Header)); 66a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi 671: eb 0e jmp 681 <malloc+0x51> 673: 90 nop 674: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 678: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 67a: 8b 48 04 mov 0x4(%eax),%ecx 67d: 39 f9 cmp %edi,%ecx 67f: 73 47 jae 6c8 <malloc+0x98> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 681: 39 05 d4 09 00 00 cmp %eax,0x9d4 687: 89 c2 mov %eax,%edx 689: 75 ed jne 678 <malloc+0x48> p = sbrk(nu * sizeof(Header)); 68b: 83 ec 0c sub $0xc,%esp 68e: 56 push %esi 68f: e8 66 fc ff ff call 2fa <sbrk> if(p == (char*)-1) 694: 83 c4 10 add $0x10,%esp 697: 83 f8 ff cmp $0xffffffff,%eax 69a: 74 1c je 6b8 <malloc+0x88> hp->s.size = nu; 69c: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 69f: 83 ec 0c sub $0xc,%esp 6a2: 83 c0 08 add $0x8,%eax 6a5: 50 push %eax 6a6: e8 f5 fe ff ff call 5a0 <free> return freep; 6ab: 8b 15 d4 09 00 00 mov 0x9d4,%edx if((p = morecore(nunits)) == 0) 6b1: 83 c4 10 add $0x10,%esp 6b4: 85 d2 test %edx,%edx 6b6: 75 c0 jne 678 <malloc+0x48> return 0; } } 6b8: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 6bb: 31 c0 xor %eax,%eax } 6bd: 5b pop %ebx 6be: 5e pop %esi 6bf: 5f pop %edi 6c0: 5d pop %ebp 6c1: c3 ret 6c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(p->s.size == nunits) 6c8: 39 cf cmp %ecx,%edi 6ca: 74 54 je 720 <malloc+0xf0> p->s.size -= nunits; 6cc: 29 f9 sub %edi,%ecx 6ce: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 6d1: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 6d4: 89 78 04 mov %edi,0x4(%eax) freep = prevp; 6d7: 89 15 d4 09 00 00 mov %edx,0x9d4 } 6dd: 8d 65 f4 lea -0xc(%ebp),%esp return (void*)(p + 1); 6e0: 83 c0 08 add $0x8,%eax } 6e3: 5b pop %ebx 6e4: 5e pop %esi 6e5: 5f pop %edi 6e6: 5d pop %ebp 6e7: c3 ret 6e8: 90 nop 6e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; 6f0: c7 05 d4 09 00 00 d8 movl $0x9d8,0x9d4 6f7: 09 00 00 6fa: c7 05 d8 09 00 00 d8 movl $0x9d8,0x9d8 701: 09 00 00 base.s.size = 0; 704: b8 d8 09 00 00 mov $0x9d8,%eax 709: c7 05 dc 09 00 00 00 movl $0x0,0x9dc 710: 00 00 00 713: e9 44 ff ff ff jmp 65c <malloc+0x2c> 718: 90 nop 719: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi prevp->s.ptr = p->s.ptr; 720: 8b 08 mov (%eax),%ecx 722: 89 0a mov %ecx,(%edx) 724: eb b1 jmp 6d7 <malloc+0xa7>
; Copyright Oliver Kowalke 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) ; --------------------------------------------------------------------------------- ; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ; --------------------------------------------------------------------------------- ; | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch | ; --------------------------------------------------------------------------------- ; | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI | ; --------------------------------------------------------------------------------- ; --------------------------------------------------------------------------------- ; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ; --------------------------------------------------------------------------------- ; | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch | ; --------------------------------------------------------------------------------- ; | ESI | EBX | EBP | EIP | EXIT | | SEH NXT |SEH HNDLR| ; --------------------------------------------------------------------------------- .386 .XMM .model flat, c .code meow_asm_context_jump PROC BOOST_CONTEXT_EXPORT ; fourth arg of meow_asm_context_jump() == flag indicating preserving FPU mov ecx, [esp+010h] push ebp ; save EBP push ebx ; save EBX push esi ; save ESI push edi ; save EDI assume fs:nothing ; load NT_TIB into ECX mov edx, fs:[018h] assume fs:error ; load current SEH exception list mov eax, [edx] push eax ; load current stack base mov eax, [edx+04h] push eax ; load current stack limit mov eax, [edx+08h] push eax ; load current deallocation stack mov eax, [edx+0e0ch] push eax ; load fiber local storage mov eax, [edx+010h] push eax ; prepare stack for FPU lea esp, [esp-08h] ; test for flag preserve_fpu test ecx, ecx je nxt1 ; save MMX control- and status-word stmxcsr [esp] ; save x87 control-word fnstcw [esp+04h] nxt1: ; first arg of meow_asm_context_jump() == context jumping from mov eax, [esp+030h] ; store ESP (pointing to context-data) in EAX mov [eax], esp ; second arg of meow_asm_context_jump() == context jumping to mov edx, [esp+034h] ; third arg of meow_asm_context_jump() == value to be returned after jump mov eax, [esp+038h] ; restore ESP (pointing to context-data) from EDX mov esp, edx ; test for flag preserve_fpu test ecx, ecx je nxt2 ; restore MMX control- and status-word ldmxcsr [esp] ; restore x87 control-word fldcw [esp+04h] nxt2: ; prepare stack for FPU lea esp, [esp+08h] assume fs:nothing ; load NT_TIB into ECX mov edx, fs:[018h] assume fs:error ; restore fiber local storage pop ecx mov [edx+010h], ecx ; restore current deallocation stack pop ecx mov [edx+0e0ch], ecx ; restore current stack limit pop ecx mov [edx+08h], ecx ; restore current stack base pop ecx mov [edx+04h], ecx ; restore current SEH exception list pop ecx mov [edx], ecx pop edi ; save EDI pop esi ; save ESI pop ebx ; save EBX pop ebp ; save EBP ; restore return-address pop edx ; use value in EAX as return-value after jump ; use value in EAX as first arg in context function mov [esp+04h], eax ; indirect jump to context jmp edx meow_asm_context_jump ENDP END
CFG_DAMAGE_MULTIPLYER: .byte 0x00 EXTERN_DAMAGE_MULTIPLYER: .byte 0x00 .align 4 Apply_Damage_Multiplier: li t7, CFG_DAMAGE_MULTIPLYER lb t7, 0x00(t7) li t8, EXTERN_DAMAGE_MULTIPLYER lb t8, 0x00(t8) add t7, t7, t8 bltz t7, @@DivDamage li at, 3 blt t7, at, @@MulDamage nop li t7, 8 @@MulDamage: b @@DoubleDefence sllv s0, s0, t7 ; damage multiplier @@DivDamage: sub t7, zero, t7 srav s0, s0, t7 ; damage multiplier @@DoubleDefence: lbu t7, 0x3D(a1) ; check if has double defense beq t7, zero, @@return nop sra s0, s0, 1 ; double defense sll s0, s0, 0x10 sra s0, s0, 0x10 ; s0 = damage @@return: jr ra nop
// Copyright (c) 2014-2018 The Bitcoin Core developers // Copyright (c) 2017 The Raven Core developers // Copyright (c) 2018 The Liquidcash Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "peertablemodel.h" #include "clientmodel.h" #include "guiconstants.h" #include "guiutil.h" #include "validation.h" // for cs_main #include "sync.h" #include <QDebug> #include <QList> #include <QTimer> bool NodeLessThan::operator()(const CNodeCombinedStats &left, const CNodeCombinedStats &right) const { const CNodeStats *pLeft = &(left.nodeStats); const CNodeStats *pRight = &(right.nodeStats); if (order == Qt::DescendingOrder) std::swap(pLeft, pRight); switch(column) { case PeerTableModel::NetNodeId: return pLeft->nodeid < pRight->nodeid; case PeerTableModel::Address: return pLeft->addrName.compare(pRight->addrName) < 0; case PeerTableModel::Subversion: return pLeft->cleanSubVer.compare(pRight->cleanSubVer) < 0; case PeerTableModel::Ping: return pLeft->dMinPing < pRight->dMinPing; case PeerTableModel::Sent: return pLeft->nSendBytes < pRight->nSendBytes; case PeerTableModel::Received: return pLeft->nRecvBytes < pRight->nRecvBytes; } return false; } // private implementation class PeerTablePriv { public: /** Local cache of peer information */ QList<CNodeCombinedStats> cachedNodeStats; /** Column to sort nodes by */ int sortColumn; /** Order (ascending or descending) to sort nodes by */ Qt::SortOrder sortOrder; /** Index of rows by node ID */ std::map<NodeId, int> mapNodeRows; /** Pull a full list of peers from vNodes into our cache */ void refreshPeers() { { cachedNodeStats.clear(); std::vector<CNodeStats> vstats; if(g_connman) g_connman->GetNodeStats(vstats); #if QT_VERSION >= 0x040700 cachedNodeStats.reserve(vstats.size()); #endif for (const CNodeStats& nodestats : vstats) { CNodeCombinedStats stats; stats.nodeStateStats.nMisbehavior = 0; stats.nodeStateStats.nSyncHeight = -1; stats.nodeStateStats.nCommonHeight = -1; stats.fNodeStateStatsAvailable = false; stats.nodeStats = nodestats; cachedNodeStats.append(stats); } } // Try to retrieve the CNodeStateStats for each node. { TRY_LOCK(cs_main, lockMain); if (lockMain) { for (CNodeCombinedStats &stats : cachedNodeStats) stats.fNodeStateStatsAvailable = GetNodeStateStats(stats.nodeStats.nodeid, stats.nodeStateStats); } } if (sortColumn >= 0) // sort cacheNodeStats (use stable sort to prevent rows jumping around unnecessarily) qStableSort(cachedNodeStats.begin(), cachedNodeStats.end(), NodeLessThan(sortColumn, sortOrder)); // build index map mapNodeRows.clear(); int row = 0; for (const CNodeCombinedStats& stats : cachedNodeStats) mapNodeRows.insert(std::pair<NodeId, int>(stats.nodeStats.nodeid, row++)); } int size() const { return cachedNodeStats.size(); } CNodeCombinedStats *index(int idx) { if (idx >= 0 && idx < cachedNodeStats.size()) return &cachedNodeStats[idx]; return 0; } }; PeerTableModel::PeerTableModel(ClientModel *parent) : QAbstractTableModel(parent), clientModel(parent), timer(0) { columns << tr("NodeId") << tr("Node/Service") << tr("Ping") << tr("Sent") << tr("Received") << tr("User Agent"); priv.reset(new PeerTablePriv()); // default to unsorted priv->sortColumn = -1; // set up timer for auto refresh timer = new QTimer(this); connect(timer, SIGNAL(timeout()), SLOT(refresh())); timer->setInterval(MODEL_UPDATE_DELAY); // load initial data refresh(); } PeerTableModel::~PeerTableModel() { // Intentionally left empty } void PeerTableModel::startAutoRefresh() { timer->start(); } void PeerTableModel::stopAutoRefresh() { timer->stop(); } int PeerTableModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); return priv->size(); } int PeerTableModel::columnCount(const QModelIndex &parent) const { Q_UNUSED(parent); return columns.length(); } QVariant PeerTableModel::data(const QModelIndex &index, int role) const { if(!index.isValid()) return QVariant(); CNodeCombinedStats *rec = static_cast<CNodeCombinedStats*>(index.internalPointer()); if (role == Qt::DisplayRole) { switch(index.column()) { case NetNodeId: return (qint64)rec->nodeStats.nodeid; case Address: return QString::fromStdString(rec->nodeStats.addrName); case Subversion: return QString::fromStdString(rec->nodeStats.cleanSubVer); case Ping: return GUIUtil::formatPingTime(rec->nodeStats.dMinPing); case Sent: return GUIUtil::formatBytes(rec->nodeStats.nSendBytes); case Received: return GUIUtil::formatBytes(rec->nodeStats.nRecvBytes); } } else if (role == Qt::TextAlignmentRole) { switch (index.column()) { case Ping: case Sent: case Received: return QVariant(Qt::AlignRight | Qt::AlignVCenter); default: return QVariant(); } } return QVariant(); } QVariant PeerTableModel::headerData(int section, Qt::Orientation orientation, int role) const { if(orientation == Qt::Horizontal) { if(role == Qt::DisplayRole && section < columns.size()) { return columns[section]; } } return QVariant(); } Qt::ItemFlags PeerTableModel::flags(const QModelIndex &index) const { if(!index.isValid()) return 0; Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; return retval; } QModelIndex PeerTableModel::index(int row, int column, const QModelIndex &parent) const { Q_UNUSED(parent); CNodeCombinedStats *data = priv->index(row); if (data) return createIndex(row, column, data); return QModelIndex(); } const CNodeCombinedStats *PeerTableModel::getNodeStats(int idx) { return priv->index(idx); } void PeerTableModel::refresh() { Q_EMIT layoutAboutToBeChanged(); priv->refreshPeers(); Q_EMIT layoutChanged(); } int PeerTableModel::getRowByNodeId(NodeId nodeid) { std::map<NodeId, int>::iterator it = priv->mapNodeRows.find(nodeid); if (it == priv->mapNodeRows.end()) return -1; return it->second; } void PeerTableModel::sort(int column, Qt::SortOrder order) { priv->sortColumn = column; priv->sortOrder = order; refresh(); }
;PhaserX ;by utz 09'2016 * www.irrlichtproject.de ;Sharp MZ-700 port by MooZ 03'2018 * https://blog.blockos.org/ ;******************************************************************************* ;include "equates.h" mix_xor equ #ac00 mix_or equ #b400 mix_and equ #a400 fsid equ #4 fnoise equ #80 noupd1 equ #1 noupd2 equ #40 kick equ #1 hhat equ #80 ptnend equ #40 rest equ 0 a0 equ #e4 ais0 equ #f1 b0 equ #100 c1 equ #10f cis1 equ #11f d1 equ #130 dis1 equ #142 e1 equ #155 f1 equ #169 fis1 equ #17f g1 equ #196 gis1 equ #1ae a1 equ #1c7 ais1 equ #1e2 b1 equ #1ff c2 equ #21d cis2 equ #23e d2 equ #260 dis2 equ #284 e2 equ #2aa f2 equ #2d3 fis2 equ #2fe g2 equ #32b gis2 equ #35b a2 equ #38f ais2 equ #3c5 b2 equ #3fe c3 equ #43b cis3 equ #47b d3 equ #4bf dis3 equ #508 e3 equ #554 f3 equ #5a5 fis3 equ #5fb g3 equ #656 gis3 equ #6b7 a3 equ #71d ais3 equ #789 b3 equ #7fc c4 equ #876 cis4 equ #8f6 d4 equ #97f dis4 equ #a0f e4 equ #aa9 f4 equ #b4b fis4 equ #bf7 g4 equ #cad gis4 equ #d6e a4 equ #e3a ais4 equ #f13 b4 equ #ff8 c5 equ #10eb cis5 equ #11ed d5 equ #12fe dis5 equ #141f e5 equ #1551 f5 equ #1696 fis5 equ #17ed g5 equ #195a gis5 equ #1adc a5 equ #1c74 ais5 equ #1e26 b5 equ #1ff0 c6 equ #21d7 cis6 equ #23da d6 equ #25fb dis6 equ #283e e6 equ #2aa2 f6 equ #2d2b fis6 equ #2fdb g6 equ #32b3 gis6 equ #35b7 a6 equ #38e9 ais6 equ #3c4b b6 equ #3fe1 c7 equ #43ad cis7 equ #47b3 d7 equ #4bf7 dis7 equ #507b e7 equ #5544 f7 equ #5a56 fis7 equ #5fb6 g7 equ #6567 gis7 equ #6b6e a7 equ #71d1 BORDER equ #14 ; org #8000 org #1200 di out (0x0e0), a out (0x0e3), a ld hl, 0xe008 ;sound on ld (hl), 0x01 exx push hl ;preserve HL' for return to BASIC ld (oldSP),sp ld hl,musicData ld (seqpntr),hl ld iyl,0 ;remit lo ;******************************************************************************* rdseq seqpntr equ $+1 ld sp,0 xor a pop de ;pattern pointer to DE or d ld (seqpntr),sp jr nz,rdptn0 ;jp exit ;uncomment to disable looping ld sp,loop ;get loop point jr rdseq+3 ;******************************************************************************* exit oldSP equ $+1 ld sp,0 pop hl exx ei ret ;******************************************************************************* rdptn0 ld (ptnpntr),de readPtn ; in a,(#fe) ;read kbd ; cpl ; and #1f ; jr nz,exit ptnpntr equ $+1 ld sp,0 pop af ;speed + drums jr z,rdseq jp c,drum1 jp m,drum2 ex af,af' ;' drumret pop af ;flags + mix_method (xor = #ac, or = #b4, and = a4) ld (mixMethod),a jr c,noUpdateCh1 exx ld a,#9f ;sbc a,a jp pe,setSid ld a,#97 ;sub a,a setSid ld (sid),a ld hl,#04cb ;rlc h jp m,setNoise ld hl,#0 setNoise ld (noise),hl pop bc ;dutymod/duty 1 ld a,b ld (dutymod1),a pop de ;freq1 ld hl,0 ;reset ch1 accu exx noUpdateCh1 jr z,noUpdateCh2 pop hl ;dutymod 2a/b ld a,h ld (dutymod2a),a ld a,l ld (dutymod2b),a pop bc ;duty 2a/b pop de ;freq 2a pop hl ;freq 2b ld (freq2b),hl pop ix ;phase 2b ld hl,0 ;reset ch2a accu noUpdateCh2 ld (ptnpntr),sp freq2b equ $+1 ld sp,0 ;******************************************************************************* playNote exx ;4 add hl,de ;11 sid sbc a,a ;4 ;replace with sub a for no sid ld b,a ;4 ;temp add a,c ;4 ;c = duty ld c,a ;4 ld a,b ;4 dutymod1 equ $+1 and #0 ;7 xor c ;4 ld c,a ;4 cp h ;4 sbc a,a ;4 noise ds 2 ;8 ;replace with rlc h for noise exx ;4 add hl,de ;11 and #08 or #20 ld (0xe007), a ; out (#fe),a ;11___104 sbc a,a ;4 dutymod2a equ $+1 and #0 ;7 xor b ;4 ld b,a ;4 cp h ;4 sbc a,a ;4 ld iyh,a ;8 add ix,sp ;15 sbc a,a ;4 dutymod2b equ $+1 and #0 ;7 xor c ;4 ld c,a ;4 cp ixh ;8 sbc a,a ;4 mixMethod equ $+1 and iyh ;8 dec iyl ;8 jr nz,skipTimerHi ;12 ex af,af' dec a jp z,readPtn ex af,af' skipTimerHi and #08 or #20 ld (0xe007), a ; out (#fe),a ;11___120 jr playNote ;12 ;224 ;******************************************************************************* drum2 ld (restoreHL),hl ld (restoreBC),bc ex af,af' ld hl,hat1 ld b,hat1end-hat1 jr drentry drum1 ld (restoreHL),hl ld (restoreBC),bc ex af,af' ld hl,kick1 ;10 ld b,kick1end-kick1 ;7 drentry ld a, 0x20 ;4 _s2 xor 0x8 ;7 ld c,(hl) ;7 inc hl ;6 _s1 ld (0xe007), a ; out (#fe),a ;11 dec c ;4 jr nz,_s1 ;12/7 djnz _s2 ;13/8 ld iyl,#11 ;7 ;correct tempo restoreHL equ $+1 ld hl,0 restoreBC equ $+1 ld bc,0 jp drumret ;10 kick1 ;27*16*4 + 27*32*4 + 27*64*4 + 27*128*4 + 27*256*4 = 53568, + 20*33 = 53568 -> -239 loops -> AF' = #11 ds 4,#10 ds 4,#20 ds 4,#40 ds 4,#80 ds 4,0 kick1end hat1 db 16,3,12,6,9,20,4,8,2,14,9,17,5,8,12,4,7,16,13,22,5,3,16,3,12,6,9,20,4,8,2,14,9,17,5,8,12,4,7,16,13,22,5,3 db 12,8,1,24,6,7,4,9,18,12,8,3,11,7,5,8,3,17,9,15,22,6,5,8,11,13,4,8,12,9,2,4,7,8,12,6,7,4,19,22,1,9,6,27,4,3,11 db 5,8,14,2,11,13,5,9,2,17,10,3,7,19,4,3,8,2,9,11,4,17,6,4,9,14,2,22,8,4,19,2,3,5,11,1,16,20,4,7 db 8,9,4,12,2,8,14,3,7,7,13,9,15,1,8,4,17,3,22,4,8,11,4,21,9,6,12,4,3,8,7,17,5,9,2,11,17,4,9,3,2 db 22,4,7,3,8,9,4,11,8,5,9,2,6,2,8,8,3,11,5,3,9,6,7,4,8 hat1end musicData ; include "music.asm" ;sequence dw mdb_Patterns_pattern00 dw mdb_Patterns_blk0 dw mdb_Patterns_blk24 dw mdb_Patterns_blk1 dw mdb_Patterns_blk2 dw mdb_Patterns_blk4 dw mdb_Patterns_blk6 dw mdb_Patterns_blk23 dw mdb_Patterns_blk3 dw mdb_Patterns_blk5 dw mdb_Patterns_blk7 dw mdb_Patterns_blk8 dw mdb_Patterns_blk9 dw mdb_Patterns_blk10 loop dw mdb_Patterns_blk11 dw mdb_Patterns_blk12 dw mdb_Patterns_blk11 dw mdb_Patterns_blk13 dw mdb_Patterns_blk14 dw mdb_Patterns_blk15 dw mdb_Patterns_blk18 dw mdb_Patterns_blk19 dw mdb_Patterns_blk20 dw mdb_Patterns_blk20 dw mdb_Patterns_blk20 dw mdb_Patterns_blk21 dw mdb_Patterns_blk22 dw 0 mdb_Patterns_pattern00 dw $800, $ac04, $80, b3, 0, $8080, 0, 0, 0 dw $800, $ac44, $80, a3 dw $800, $ac44, $80, g3 dw $800, $ac44, $80, a3 dw $800, $ac44, $80, g3 dw $800, $ac44, $80, d3 db $40 mdb_Patterns_blk0 dw $401, $ac04, $4010, e2, $4010, $1080, e1, e1+1, 0 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac44, $4010, rest dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $401, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac80, $4040, gis4, $4010, $1080, e2, e1+1, $400 dw $400, $acc0, $4020, gis4 dw $400, $acc0, $4010, gis4 dw $400, $acc1 dw $400, $acc0, $4008, gis4 dw $400, $ac40, $4008, rest dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, e2, $4010, $1080, e1, e1+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac44, $4010, rest dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $401, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, g2, $4010, $1080, g1, g1+1, $400 dw $400, $ac45 dw $400, $ac04, $4010, e2, $4010, $1080, e1, e1+1, $400 dw $400, $ac45 dw $401, $ac04, $4010, g2, $4010, $1080, g1, g1+1, $400 dw $400, $ac45 dw $480, $ac04, $4010, b2, $4010, $1080, b1, b1+1, $400 dw $400, $ac45 dw $400, $ac04, $4010, a2, $4010, $1080, a1, a1+1, $400 dw $400, $ac45 dw $401, $ac04, $4010, g2, $4010, $1080, g1, g1+1, $400 dw $400, $ac45 db $40 mdb_Patterns_blk24 dw $401, $ac04, $4010, e2, $4010, $1080, e1, e1+1, 0 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac44, $4010, rest dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $401, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac80, $4040, gis4, $4010, $1080, e2, e1+1, $400 dw $400, $acc0, $4020, gis4 dw $400, $acc0, $4010, gis4 dw $400, $acc1 dw $400, $acc0, $4008, gis4 dw $400, $ac40, $4008, rest dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, e2, $4010, $1080, e1, e1+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac44, $4010, rest dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $401, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, g2, $4010, $1080, g1, g1+1, $400 dw $400, $ac45 dw $400, $ac04, $4010, e2, $4010, $1080, e1, e1+1, $400 dw $400, $ac45 dw $401, $ac04, $4010, g2, $4010, $1080, g1, g1+1, $400 dw $400, $ac45 dw $480, $ac04, $4010, b2, $4010, $1080, b1, b1+1, $400 dw $400, $ac45 dw $480, $ac04, $4010, a2, $4010, $1080, a1, a1+1, $400 dw $400, $ac45 dw $480, $ac04, $4010, g2, $4010, $1080, g1, g1+1, $400 dw $400, $ac45 db $40 mdb_Patterns_blk1 dw $401, $ac04, $4080, a2, $4010, $1080, a1, a1+1, 0 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac44, $4080, rest dw $400, $ac04, $4080, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4080, rest, $4010, $1080, rest, a1+1, $400 dw $400, $ac04, $4080, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4080, rest, $4010, $1080, rest, a1+1, $400 dw $401, $ac04, $4080, a1, $4010, $1080, a1, a1+1, $400 dw $401, $ac04, $4080, rest, $4010, $1080, rest, a1+1, $400 dw $401, $ac80, $40, gis4, $4010, $1080, a1, a1+1, $400 dw $400, $acc0, $20, gis4 dw $400, $acc0, $10, gis4 dw $400, $acc1 dw $400, $acc0, $8, gis4 dw $400, $ac40, $8, rest dw $400, $ac04, $4010, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, a1+1, $400 dw $400, $ac04, $4010, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, a1+1, $400 dw $401, $ac04, $4010, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, a1+1, $400 dw $401, $ac04, $4010, a2, $4010, $1080, a1, a1+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac44, $4010, rest dw $400, $ac04, $4010, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, a1+1, $400 dw $400, $ac04, $4010, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, a1+1, $400 dw $401, $ac04, $4010, a1, $4010, $1080, a1, a1+1, $400 dw $401, $ac04, $4010, rest, $4010, $1080, rest, a1+1, $400 dw $401, $ac04, $4010, a2, $4010, $1080, a1, a1+1, $400 dw $400, $ac45 dw $400, $ac04, $4010, g2, $4010, $1080, g1, g1+1, $400 dw $400, $ac45 dw $401, $ac04, $4010, a2, $4010, $1080, a1, a1+1, $400 dw $400, $ac45 dw $480, $ac04, $4010, b2, $4010, $1080, b1, b1+1, $400 dw $400, $ac45 dw $400, $ac04, $4010, a2, $4010, $1080, a1, a1+1, $400 dw $400, $ac45 dw $401, $ac04, $4010, g2, $4010, $1080, g1, g1+1, $400 dw $400, $ac45 db $40 mdb_Patterns_blk2 dw $401, $ac04, $4080, a2, $4010, $1080, a1, a1+1, 0 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac44, $4080, rest dw $400, $ac04, $4080, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4080, rest, $4010, $1080, rest, a1+1, $400 dw $400, $ac04, $4080, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4080, rest, $4010, $1080, rest, a1+1, $400 dw $401, $ac04, $4080, a1, $4010, $1080, a1, a1+1, $400 dw $401, $ac04, $4080, rest, $4010, $1080, rest, a1+1, $400 dw $401, $ac80, $4040, gis4, $4010, $1080, a1, a1+1, $400 dw $400, $acc0, $4020, gis4 dw $400, $acc0, $4010, gis4 dw $400, $acc1 dw $400, $acc0, $4008, gis4 dw $400, $ac40, $4008, rest dw $400, $ac04, $4010, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, a1+1, $400 dw $400, $ac04, $4010, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, a1+1, $400 dw $401, $ac04, $4010, a1, $4010, $1080, a1, a1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, a1+1, $400 dw $401, $ac04, $4010, b2, $4010, $1080, b1, b1+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac44, $4010, rest dw $400, $ac04, $4010, b1, $4010, $1080, b1, b1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, b1+1, $400 dw $400, $ac04, $4010, b1, $4010, $1080, b1, b1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, b1+1, $400 dw $401, $ac04, $4010, b1, $4010, $1080, b1, b1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, b1+1, $400 dw $401, $ac04, $4010, b2, $4010, $1080, b1, b1+1, $400 dw $401, $ac45 dw $401, $ac04, $4010, a2, $4010, $1080, a1, a1+1, $400 dw $401, $ac45 dw $401, $ac04, $4010, g2, $4010, $1080, g1, g1+1, $400 dw $401, $ac45 dw $401, $ac04, $4010, b2, $4010, $1080, b1, b1+1, $400 dw $401, $ac45 dw $401, $ac04, $4010, a2, $4010, $1080, a1, a1+1, $400 dw $401, $ac45 dw $401, $ac04, $4010, g2, $4010, $1080, g1, g1+1, $400 dw $401, $ac45 db $40 mdb_Patterns_blk4 dw $401, $ac04, $8040, e1, $2040, $1010, b4, b3+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $480, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac04, $8040, e1, $2040, $1010, e4, e3+1, $400 dw $400, $ac45 dw $401, $ac04, $8040, e1, $2040, $1010, a4, a3+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $400, $ac05, $2040, $1010, fis4, fis3+1, $400 dw $400, $ac45 dw $401, $ac05, $2040, $1010, g4, g3+1, $400 dw $400, $ac45 dw $401, $ac84, $8040, gis4, $2040, $1010, a4, a3+1, $400 dw $400, $acc4, $8020, gis4 dw $401, $ac04, $8040, e1, $2040, $1010, g4, g3+1, $400 dw $400, $ac45 dw $401, $ac05, $2040, $1010, fis4, fis3+1, $400 dw $400, $ac45 db $40 mdb_Patterns_blk6 dw $401, $ac04, $8040, e1, $2040, $1010, g4, g3+2, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac04, $8040, e1, $2040, $1010, fis4, fis3+2, $400 dw $401, $ac45 dw $401, $ac04, $8040, e1, $2040, $1010, e4, e3+2, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac45 dw $400, $ac45 dw $401, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, g1 dw $400, $ac45 dw $401, $b404, $8040, fis3, $2040, $c0f0, e2, fis3, $400 dw $400, $b445 dw $401, $b404, $8040, g3, $2040, $c0f0, g2, g3, $400 dw $400, $b445 dw $401, $b480, $8040, gis4, $2040, $c0f0, b2, b3, $400 dw $400, $b4c0, $8020, gis4 dw $401, $b404, $8040, g3, $2040, $c0f0, a2, g3, $400 dw $401, $b445 dw $401, $b404, $8040, fis3, $2040, $c0f0, g2, fis3, $400 dw $400, $b445 db $40 mdb_Patterns_blk23 dw $401, $ac04, $8040, e1, $2040, $1010, b4, b3+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $480, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac04, $8040, e1, $2040, $1010, e4, e3+1, $400 dw $400, $ac45 dw $401, $ac04, $8040, e1, $2040, $1010, a4, a3+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $400, $ac05, $2040, $1010, fis4, fis3+1, $400 dw $400, $ac45 dw $401, $ac05, $2040, $1010, g4, g3+1, $400 dw $400, $ac45 dw $401, $ac84, $8040, gis4, $2040, $1010, a4, a3+1, $400 dw $400, $acc4, $8020, gis4 dw $401, $ac04, $8040, e1, $2040, $1010, g4, g3+1, $400 dw $401, $ac45 dw $401, $ac05, $2040, $1010, fis4, fis3+1, $400 dw $400, $ac45 db $40 mdb_Patterns_blk3 dw $401, $ac04, $8020, e1, $2040, $1010, g4, g3+2, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8020, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac45 dw $400, $ac45 dw $401, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, g1 dw $400, $ac45 dw $401, $b404, $8040, fis3, $2040, $c0f0, e2, fis3, $400 dw $400, $b445 dw $401, $b404, $8040, g3, $2040, $c0f0, g2, g3, $400 dw $400, $b445 dw $401, $b480, $8040, gis4, $2040, $c0f0, b2, b3, $400 dw $401, $b4c0, $8020, gis4 dw $401, $b404, $8040, g3, $2040, $c0f0, a2, g3, $400 dw $400, $b445 dw $401, $b404, $8040, fis3, $2040, $c0f0, g2, fis3, $400 dw $400, $b445 db $40 mdb_Patterns_blk5 dw $401, $ac04, $8040, a1, $2040, $1010, c5, c4+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $480, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, a1 dw $400, $ac45 dw $401, $ac04, $8040, a1, $2040, $1010, b4, b3+1, $400 dw $400, $ac45 dw $401, $ac04, $8040, a1, $2040, $1010, a4, a3+2, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, a1 dw $400, $ac45 dw $401, $ac44, $8040, a1 dw $400, $ac45 dw $401, $ac44, $8040, a1 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, a1 dw $400, $ac45 dw $401, $ac44, $8040, a1 dw $401, $ac45 dw $401, $ac44, $8040, a1 dw $400, $ac45 dw $400, $ac05, $2040, $1010, fis4, fis3+1, $400 dw $400, $ac45 dw $401, $ac05, $2040, $1010, g4, g3+1, $400 dw $400, $ac45 dw $401, $ac84, $8040, gis4, $2040, $1010, a4, a3+1, $400 dw $400, $acc4, $8020, gis4 dw $401, $ac04, $8040, a1, $2040, $1010, g4, g3+1, $400 dw $400, $ac45 dw $401, $ac05, $2040, $1010, fis4, fis3+1, $400 dw $400, $ac45 db $40 mdb_Patterns_blk7 dw $401, $ac04, $8040, a1, $2040, $1010, c5, c4+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, a1 dw $400, $ac45 dw $401, $ac44, $8040, a1 dw $401, $ac45 dw $401, $ac44, $8040, a1 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, a1 dw $400, $ac45 dw $401, $ac45 dw $400, $ac45 dw $401, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, a1 dw $400, $ac45 dw $401, $ac44, $8040, a1 dw $400, $ac45 dw $401, $ac04, $8040, g1, $2040, $1010, e5, e4, $400 dw $400, $ac45 dw $401, $ac04, $8040, fis3, $2040, $1010, d5, d4, $400 dw $400, $ac45 dw $401, $ac04, $8040, g3, $2040, $1010, c5, c4, $400 dw $400, $ac45 dw $401, $ac80, $8040, gis4, $2040, $1010, d5, d4, $400 dw $400, $acc0, $8020, gis4 dw $401, $ac04, $8040, g3, $2040, $1010, c5, c4, $400 dw $401, $ac45 dw $401, $ac04, $8040, fis3, $2040, $1010, d4, d3, $400 dw $400, $ac45 db $40 mdb_Patterns_blk8 dw $401, $ac04, $8040, e1, $2040, $1010, b4, b3+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $480, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac04, $8040, e1, $2040, $1010, a4, a3+1, $400 dw $400, $ac45 dw $401, $ac04, $8040, e1, $2040, $1010, g4, g3+2, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $480, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $400, $ac05, $2040, $1010, fis4, fis3+1, $400 dw $400, $ac45 dw $401, $ac05, $2040, $1010, g4, g3+1, $400 dw $400, $ac45 dw $401, $ac84, $8040, gis4, $2040, $1010, a4, a3+1, $400 dw $400, $acc4, $8020, gis4 dw $401, $ac04, $8040, e1, $2040, $1010, g4, g3+1, $400 dw $400, $ac45 dw $401, $ac05, $2040, $1010, fis4, fis3+1, $400 dw $400, $ac45 db $40 mdb_Patterns_blk9 dw $401, $ac04, $8040, e1, $2040, $1010, b4, b3+1, $400 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $401, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac45 dw $400, $ac45 dw $401, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $acc0, $8040, gis4 dw $400, $acc0, $8020, gis4 dw $400, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac44, $8040, e1 dw $400, $ac45 dw $401, $ac04, $8040, g1, $2040, $1010, e5, e4, $400 dw $400, $ac45 dw $401, $ac04, $8040, fis3, $2040, $1010, d5, d4, $400 dw $400, $ac45 dw $401, $ac04, $8040, g3, $2040, $1010, c5, c4, $400 dw $400, $ac45 dw $401, $ac80, $8040, gis4, $2040, $1010, d5, d4, $400 dw $400, $acc0, $8020, gis4 dw $401, $ac04, $8040, g3, $2040, $1010, c5, c4, $400 dw $401, $ac45 dw $401, $ac04, $8040, fis3, $2040, $1010, d4, d3, $400 dw $400, $ac45 db $40 mdb_Patterns_blk10 dw $401, $a480, $60, gis4, $400, $808, e3, e3+1, 0 dw $400, $a4c0, $40, gis4 dw $400, $a4c0, $20, gis4 dw $400, $a4c0, $10, gis4 dw $400, $a4c1 dw $400, $a4c0, $8, gis4 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c0, $4, gis4 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a481, $400, $808, b3, b3+1, 0 dw $400, $a4c0, $2, gis4 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c0, $1, gis4 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c0, $1, rest dw $400, $a4c1 dw $400, $a481, $400, $808, ais3, ais3+1, 0 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a481, $400, $808, fis3, fis3+1, 0 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 dw $400, $a4c1 db $40 mdb_Patterns_blk11 dw $401, $a404, $8020, e1, $4040, $1008, e4, e3+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a404, $8020, b1, $4040, $1008, b4, b3+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a404, $8020, ais1, $4040, $1008, ais4, ais3+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a404, $8020, fis1, $4040, $1008, fis4, fis3+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 db $40 mdb_Patterns_blk12 dw $401, $a404, $8020, g1, $4040, $1008, g4, g3+1, 0 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a405, $4040, $1008, fis4, fis3+1, 0 dw $400, $a445 dw $401, $a405, $4040, $1008, g4, g3+1, 0 dw $400, $a445 dw $401, $a405, $4040, $1008, a4, a3+1, 0 dw $401, $a445 dw $401, $a405, $4040, $1008, g4, g3+1, 0 dw $400, $a445 dw $401, $a405, $4040, $1008, fis4, fis3+1, 0 dw $400, $a445 db $40 mdb_Patterns_blk13 dw $401, $a404, $8020, g1, $4040, $1008, b4, g3+1, 0 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a405, $4040, $1008, a4, fis3+1, 0 dw $400, $a445 dw $401, $a405, $4040, $1008, b4, g3+1, 0 dw $400, $a445 dw $401, $a405, $4040, $1008, c5, a3+1, 0 dw $400, $a445 dw $401, $a405, $4040, $1008, b4, g3+1, 0 dw $401, $a445 dw $401, $a405, $4040, $1008, a4, fis3+1, 0 dw $400, $a445 db $40 mdb_Patterns_blk14 dw $401, $a404, $8020, e1, $4040, $1008, g4, e4+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a404, $8020, b1, $4040, $1008, b4, g4+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a404, $8020, ais1, $4040, $1008, ais4, fis4+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a404, $8020, fis1, $4040, $1008, fis4, dis4+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 db $40 mdb_Patterns_blk15 dw $401, $a404, $8020, g1, $4040, $1008, g4, e4+1, 0 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a405, $4040, $1008, a4, fis3+1, 0 dw $400, $a445 dw $401, $a405, $4040, $1008, b4, g3+1, 0 dw $400, $a445 dw $401, $a405, $4040, $1008, c5, a3+1, 0 dw $401, $a445 dw $401, $a405, $4040, $1008, b4, g3+1, 0 dw $400, $a445 dw $401, $a405, $4040, $1008, a4, fis3+1, 0 dw $400, $a445 db $40 mdb_Patterns_blk18 dw $401, $a404, $8020, e1, $4040, $1008, e5, e3+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a404, $8020, b1, $4040, $1008, b5, b3+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a404, $8020, ais1, $4040, $1008, ais5, ais3+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a404, $8020, fis1, $4040, $1008, fis5, fis3+1, 0 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $400, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 db $40 mdb_Patterns_blk19 dw $401, $a404, $8020, g1, $4040, $1008, g5, b3+1, 0 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $401, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a445 dw $400, $a445 dw $401, $a405, $4040, $1008, fis5, fis3+1, 0 dw $400, $a445 dw $401, $a405, $4040, $1008, g5, g3+1, 0 dw $400, $a445 dw $401, $a405, $4040, $1008, a5, a3+1, 0 dw $401, $a445 dw $401, $a404, $8020, fis1, $4040, $1008, g5, g3+1, 0 dw $400, $a445 dw $401, $a404, $8020, f1, $4040, $1008, fis5, fis3+1, 0 dw $400, $a445 db $40 mdb_Patterns_blk20 dw $401, $ac04, $4010, e2, $4010, $1080, e3, e1+1, 0 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac44, $4010, rest dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $401, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac80, $4040, gis4, $4010, $1080, e2, e1+1, $400 dw $400, $acc0, $4020, gis4 dw $400, $acc0, $4010, gis4 dw $400, $acc1 dw $400, $acc0, $4008, gis4 dw $400, $ac40, $4008, rest dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 db $40 mdb_Patterns_blk21 dw $401, $ac04, $4010, e2, $4010, $1080, e3, e1+1, 0 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac44, $4010, rest dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $400, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $400, $ac04, $4010, rest, $4010, $1080, rest, e1+1, $400 dw $401, $ac04, $4010, e1, $4010, $1080, e1, e1+1, $400 dw $401, $ac44, $4010, rest dw $401, $a404, $4010, b1, $4040, $1008, b5, b3+1, $400 dw $400, $a445 dw $400, $a404, $4010, a1, $4040, $1008, a5, a3+1, $400 dw $400, $a445 dw $400, $a404, $4010, g1, $4040, $1008, g5, g3+1, $400 dw $400, $a445 dw $400, $a404, $4010, a1, $4040, $1008, a5, a3+1, $400 dw $400, $a445 dw $400, $a404, $4010, g1, $4040, $1008, g5, g3+1, $400 dw $400, $a445 dw $400, $a404, $4010, d1, $4040, $1008, d5, d3+1, $400 dw $400, $a445 db $40 mdb_Patterns_blk22 dw $401, $ac04, $4010, e1, $4010, $1080, e1, e1+1, 0 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $400, $ac04, $4010, rest, $4010, $1080, e1, rest, 0 dw $400, $ac05, $4010, $1080, rest, rest, 0 dw $400, $ac45 dw $400, $ac45 dw $400, $ac45 dw $401, $ac45 dw $401, $ac45 dw $401, $a4c0, $60, gis4 dw $400, $a4c0, $40, gis4 dw $400, $a4c0, $20, gis4 dw $400, $a4c1 dw $400, $a4c0, $10, gis4 dw $400, $a4c1 dw $400, $a4c0, $8, gis4 dw $400, $a4c0, $4, gis4 dw $400, $a4c0, $2, gis4 dw $400, $a4c0, $1, gis4 dw $400, $a4c0, $1, rest dw $400, $a4c1 db $40
ori $1, $0, 15 ori $2, $0, 2 ori $3, $0, 6 ori $4, $0, 6 sw $3, 0($0) sw $4, 4($0) sw $3, 8($0) sw $2, 12($0) sw $3, 16($0) sw $2, 20($0) sw $4, 24($0) sw $3, 28($0) sw $1, 32($0) sw $2, 36($0) sw $1, 40($0) sw $4, 44($0) sw $2, 48($0) sw $2, 52($0) sw $2, 56($0) sw $2, 60($0) sw $4, 64($0) sw $4, 68($0) sw $3, 72($0) sw $2, 76($0) sw $1, 80($0) sw $1, 84($0) sw $3, 88($0) sw $4, 92($0) sw $1, 96($0) sw $1, 100($0) sw $3, 104($0) sw $4, 108($0) sw $4, 112($0) sw $1, 116($0) sw $4, 120($0) sw $4, 124($0) mtlo $2 addu $1, $2, $2 mult $2, $1 sw $1, 0($1) TAG1: lui $3, 13 beq $1, $3, TAG2 subu $1, $3, $1 lui $2, 1 TAG2: beq $2, $2, TAG3 sll $0, $0, 0 lw $1, 0($2) bgez $1, TAG3 TAG3: lui $3, 3 sll $0, $0, 0 srl $4, $1, 6 sll $0, $0, 0 TAG4: sll $0, $0, 0 lw $1, -13311($4) bne $2, $1, TAG5 addiu $3, $2, 11 TAG5: mtlo $3 blez $3, TAG6 mfhi $4 sh $3, 0($4) TAG6: mthi $4 mthi $4 nor $1, $4, $4 sll $3, $1, 9 TAG7: divu $3, $3 xor $1, $3, $3 lbu $2, 512($3) blez $2, TAG8 TAG8: andi $4, $2, 13 blez $2, TAG9 lbu $4, 0($2) mflo $4 TAG9: mflo $3 sb $3, 0($3) lbu $3, 0($3) andi $2, $3, 4 TAG10: slt $3, $2, $2 lui $2, 11 mfhi $1 sll $0, $0, 0 TAG11: mfhi $1 sltu $3, $1, $1 bltz $1, TAG12 sw $3, 0($1) TAG12: or $2, $3, $3 mflo $4 bgez $2, TAG13 mflo $2 TAG13: beq $2, $2, TAG14 lui $3, 12 srlv $4, $3, $3 mfhi $3 TAG14: mfhi $2 beq $3, $2, TAG15 mthi $2 bne $2, $3, TAG15 TAG15: lui $4, 2 lbu $1, 0($2) sll $0, $0, 0 sh $2, 0($1) TAG16: addiu $2, $1, 14 lhu $3, 0($2) sb $1, 0($2) sb $1, 0($2) TAG17: sw $3, 0($3) bne $3, $3, TAG18 sltiu $2, $3, 8 bne $3, $3, TAG18 TAG18: sb $2, 0($2) bne $2, $2, TAG19 mtlo $2 mult $2, $2 TAG19: mflo $1 lb $2, 0($1) srav $4, $2, $2 bgez $1, TAG20 TAG20: mfhi $4 lui $1, 10 and $3, $4, $4 lui $3, 8 TAG21: mtlo $3 mflo $4 blez $3, TAG22 div $3, $4 TAG22: sll $0, $0, 0 multu $4, $2 bltz $4, TAG23 lbu $2, 0($2) TAG23: bgez $2, TAG24 lbu $3, 0($2) subu $1, $2, $2 multu $1, $3 TAG24: sll $0, $0, 0 addiu $4, $4, 4 div $4, $4 sltu $3, $4, $4 TAG25: slt $2, $3, $3 lbu $3, 0($2) mflo $2 lb $1, 0($2) TAG26: xor $4, $1, $1 mfhi $1 lbu $4, 0($1) mfhi $4 TAG27: sh $4, 0($4) mthi $4 sb $4, 0($4) sh $4, 0($4) TAG28: xor $3, $4, $4 slti $1, $4, 12 mult $3, $3 bltz $1, TAG29 TAG29: mflo $1 mfhi $3 mtlo $1 lui $4, 8 TAG30: sll $0, $0, 0 divu $4, $4 sll $0, $0, 0 multu $3, $4 TAG31: sh $3, 0($3) mflo $4 addiu $2, $3, 1 mthi $2 TAG32: bne $2, $2, TAG33 slti $3, $2, 11 xori $1, $2, 7 bgtz $2, TAG33 TAG33: lh $4, 0($1) lh $3, 0($4) divu $1, $1 mtlo $4 TAG34: addu $2, $3, $3 multu $2, $2 slti $4, $2, 13 mult $4, $3 TAG35: div $4, $4 bgez $4, TAG36 lbu $4, 0($4) lbu $1, 0($4) TAG36: sh $1, 0($1) addiu $4, $1, 0 bgez $4, TAG37 mflo $1 TAG37: mfhi $1 sra $4, $1, 9 sra $2, $1, 4 multu $2, $2 TAG38: bgez $2, TAG39 lw $1, 0($2) mult $1, $1 sb $2, 0($2) TAG39: lbu $3, 0($1) lbu $4, 0($1) mfhi $2 mflo $1 TAG40: mthi $1 ori $4, $1, 11 lbu $4, 0($4) lbu $1, 0($1) TAG41: slt $2, $1, $1 sw $1, 0($2) bltz $1, TAG42 mthi $1 TAG42: subu $1, $2, $2 sb $2, 0($1) lui $1, 0 mfhi $2 TAG43: mtlo $2 mflo $4 mtlo $4 multu $2, $2 TAG44: srav $4, $4, $4 addiu $4, $4, 2 sb $4, 0($4) sh $4, 0($4) TAG45: beq $4, $4, TAG46 mfhi $3 mthi $4 bgez $3, TAG46 TAG46: multu $3, $3 ori $1, $3, 8 or $3, $3, $1 lui $3, 0 TAG47: beq $3, $3, TAG48 mult $3, $3 sra $3, $3, 13 mfhi $4 TAG48: or $4, $4, $4 bgez $4, TAG49 sll $3, $4, 13 mthi $4 TAG49: mfhi $4 mfhi $1 srav $2, $3, $1 lw $1, -16384($2) TAG50: andi $4, $1, 13 slti $3, $4, 8 sll $2, $3, 0 div $4, $1 TAG51: sltiu $2, $2, 10 sb $2, 0($2) mthi $2 lbu $4, 0($2) TAG52: bne $4, $4, TAG53 mflo $2 mthi $2 sll $1, $2, 3 TAG53: sh $1, 0($1) mthi $1 xor $2, $1, $1 srl $3, $1, 2 TAG54: or $3, $3, $3 mult $3, $3 lbu $3, 0($3) multu $3, $3 TAG55: mult $3, $3 mtlo $3 add $3, $3, $3 lh $3, 0($3) TAG56: mflo $1 slti $3, $1, 7 divu $3, $3 blez $1, TAG57 TAG57: div $3, $3 and $2, $3, $3 mtlo $2 lb $1, 0($2) TAG58: lhu $2, 0($1) mthi $1 bne $2, $1, TAG59 nor $2, $1, $1 TAG59: andi $1, $2, 10 beq $1, $2, TAG60 mtlo $1 lui $3, 2 TAG60: mtlo $3 bne $3, $3, TAG61 sllv $2, $3, $3 bne $2, $3, TAG61 TAG61: mfhi $3 bgez $2, TAG62 mtlo $2 sll $4, $3, 9 TAG62: lbu $2, 0($4) mthi $4 bgez $2, TAG63 lbu $2, 0($4) TAG63: andi $4, $2, 5 beq $4, $2, TAG64 sltiu $2, $2, 5 lui $1, 13 TAG64: lui $4, 5 divu $1, $1 bne $1, $4, TAG65 sll $0, $0, 0 TAG65: mtlo $4 divu $4, $4 bne $4, $4, TAG66 div $4, $4 TAG66: lui $1, 15 mtlo $4 sll $0, $0, 0 sll $0, $0, 0 TAG67: bne $2, $2, TAG68 div $2, $2 bgtz $2, TAG68 lbu $2, 0($2) TAG68: sb $2, 0($2) sh $2, 0($2) bgtz $2, TAG69 multu $2, $2 TAG69: sb $2, 0($2) bne $2, $2, TAG70 lb $4, 0($2) lb $1, 0($2) TAG70: bltz $1, TAG71 mthi $1 multu $1, $1 addiu $1, $1, 14 TAG71: bne $1, $1, TAG72 mult $1, $1 mflo $2 sll $1, $1, 5 TAG72: mfhi $2 divu $1, $1 beq $2, $1, TAG73 mfhi $4 TAG73: lui $3, 7 lhu $1, 0($4) mflo $4 addiu $1, $1, 13 TAG74: mthi $1 and $3, $1, $1 addiu $2, $1, 0 lui $4, 7 TAG75: beq $4, $4, TAG76 sll $0, $0, 0 addu $3, $4, $3 sb $3, 0($4) TAG76: bltz $3, TAG77 lui $3, 4 mtlo $3 sll $0, $0, 0 TAG77: bne $4, $4, TAG78 srl $4, $4, 13 sb $4, 0($4) bne $4, $4, TAG78 TAG78: mtlo $4 sllv $2, $4, $4 subu $4, $4, $2 beq $4, $4, TAG79 TAG79: sll $0, $0, 0 mtlo $4 mfhi $3 mfhi $1 TAG80: mult $1, $1 mflo $3 bgtz $1, TAG81 mfhi $3 TAG81: mthi $3 mult $3, $3 sra $4, $3, 6 mtlo $3 TAG82: beq $4, $4, TAG83 lui $2, 0 lb $3, 0($2) mult $2, $2 TAG83: lui $1, 9 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG84: sub $2, $2, $2 mflo $3 sltiu $4, $2, 0 beq $2, $2, TAG85 TAG85: mult $4, $4 sh $4, 0($4) lui $3, 14 lui $1, 2 TAG86: bltz $1, TAG87 sll $0, $0, 0 mult $4, $1 bgez $4, TAG87 TAG87: lbu $3, 0($4) sltu $2, $3, $3 mfhi $4 bltz $3, TAG88 TAG88: mult $4, $4 lui $3, 15 lh $4, 0($4) sll $2, $3, 11 TAG89: blez $2, TAG90 srl $3, $2, 11 sll $0, $0, 0 divu $3, $2 TAG90: srl $2, $2, 9 bgtz $2, TAG91 lui $1, 7 blez $2, TAG91 TAG91: lui $2, 14 lui $3, 2 mtlo $2 sltiu $1, $3, 5 TAG92: sb $1, 0($1) sb $1, 0($1) bne $1, $1, TAG93 lui $4, 0 TAG93: sb $4, 0($4) mthi $4 sw $4, 0($4) andi $2, $4, 8 TAG94: bne $2, $2, TAG95 xori $2, $2, 12 blez $2, TAG95 lui $1, 10 TAG95: sltu $3, $1, $1 lui $1, 8 lui $3, 10 addu $2, $3, $3 TAG96: sltiu $1, $2, 7 sll $0, $0, 0 beq $1, $2, TAG97 srlv $2, $2, $2 TAG97: beq $2, $2, TAG98 lui $3, 8 sra $4, $3, 0 addi $1, $3, 6 TAG98: mtlo $1 mflo $4 mthi $4 slti $1, $1, 8 TAG99: mflo $4 lh $4, 0($4) lbu $2, 0($1) lui $3, 10 TAG100: addu $1, $3, $3 srav $3, $3, $3 mfhi $1 and $3, $1, $1 TAG101: sll $4, $3, 7 multu $3, $4 mfhi $4 mthi $3 TAG102: lb $1, 0($4) bgez $1, TAG103 sh $4, 0($4) lhu $3, 0($1) TAG103: lhu $4, 0($3) beq $4, $3, TAG104 sb $4, 0($3) lui $2, 11 TAG104: beq $2, $2, TAG105 lw $2, 0($2) sltu $2, $2, $2 mthi $2 TAG105: nor $4, $2, $2 sltu $1, $2, $2 multu $4, $1 lb $4, 0($2) TAG106: bgez $4, TAG107 mfhi $2 mfhi $2 mthi $2 TAG107: mult $2, $2 lh $2, 0($2) mfhi $3 blez $2, TAG108 TAG108: mflo $4 multu $4, $4 sw $3, 0($3) bne $3, $4, TAG109 TAG109: sw $4, 0($4) mflo $1 lhu $2, 0($1) mtlo $1 TAG110: sw $2, 0($2) multu $2, $2 lbu $4, 0($2) bne $4, $4, TAG111 TAG111: lw $2, 0($4) sb $4, 0($2) multu $2, $4 bltz $2, TAG112 TAG112: mfhi $1 or $3, $1, $1 beq $1, $2, TAG113 lui $4, 9 TAG113: bgtz $4, TAG114 mult $4, $4 lui $2, 11 div $2, $2 TAG114: sllv $2, $2, $2 sltiu $1, $2, 3 bgtz $2, TAG115 lw $4, 0($2) TAG115: or $4, $4, $4 sh $4, 0($4) srav $4, $4, $4 ori $3, $4, 8 TAG116: lui $1, 7 div $3, $1 slt $2, $3, $3 bgez $3, TAG117 TAG117: add $1, $2, $2 srl $4, $2, 5 multu $2, $2 bgtz $1, TAG118 TAG118: mtlo $4 beq $4, $4, TAG119 sw $4, 0($4) lhu $3, 0($4) TAG119: xor $3, $3, $3 lb $4, 0($3) mtlo $3 lh $1, 0($4) TAG120: srav $3, $1, $1 sh $3, 0($3) bne $1, $1, TAG121 mult $3, $1 TAG121: xori $1, $3, 6 multu $3, $1 andi $4, $1, 14 mult $1, $4 TAG122: slti $3, $4, 4 lui $1, 7 mthi $1 mthi $1 TAG123: lui $4, 12 beq $1, $1, TAG124 mtlo $4 beq $4, $1, TAG124 TAG124: and $2, $4, $4 div $4, $2 lui $1, 11 sll $0, $0, 0 TAG125: mult $1, $1 andi $4, $1, 3 bltz $1, TAG126 slti $4, $1, 0 TAG126: andi $1, $4, 15 mult $1, $1 lhu $3, 0($4) multu $4, $1 TAG127: sw $3, 0($3) beq $3, $3, TAG128 sb $3, 0($3) ori $1, $3, 12 TAG128: lhu $3, 0($1) lbu $1, 0($1) sh $1, 0($3) mflo $1 TAG129: bgtz $1, TAG130 mfhi $3 addu $3, $3, $3 mult $3, $3 TAG130: mthi $3 sra $2, $3, 11 bne $2, $3, TAG131 ori $4, $2, 6 TAG131: lui $4, 12 mult $4, $4 sll $0, $0, 0 bltz $1, TAG132 TAG132: lbu $3, 0($1) bne $1, $3, TAG133 sb $1, 0($3) bgez $1, TAG133 TAG133: mult $3, $3 ori $3, $3, 10 lhu $2, 0($3) mfhi $2 TAG134: lw $3, 0($2) lhu $4, 0($3) bgtz $4, TAG135 mflo $3 TAG135: bgtz $3, TAG136 xori $4, $3, 14 lb $1, 0($3) lb $1, 0($4) TAG136: sb $1, 0($1) lui $1, 10 nor $3, $1, $1 bgtz $1, TAG137 TAG137: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 beq $3, $3, TAG138 TAG138: srl $1, $1, 13 sltiu $3, $1, 15 lw $2, 0($1) multu $3, $1 TAG139: mfhi $4 mflo $1 sw $1, 0($1) bne $2, $1, TAG140 TAG140: mthi $1 sub $1, $1, $1 bgez $1, TAG141 sll $2, $1, 9 TAG141: bne $2, $2, TAG142 mflo $2 mfhi $4 lui $4, 11 TAG142: bgtz $4, TAG143 mflo $4 lh $2, 0($4) bgtz $2, TAG143 TAG143: mtlo $2 bne $2, $2, TAG144 mflo $4 sh $4, 0($2) TAG144: lb $1, 0($4) sb $4, 0($1) mthi $4 mfhi $2 TAG145: andi $2, $2, 15 mfhi $1 mult $2, $2 mtlo $2 TAG146: bgez $1, TAG147 lui $1, 4 beq $1, $1, TAG147 and $3, $1, $1 TAG147: xori $2, $3, 7 sllv $1, $2, $2 bne $3, $2, TAG148 divu $2, $2 TAG148: bltz $1, TAG149 sh $1, -384($1) mfhi $3 lui $1, 5 TAG149: beq $1, $1, TAG150 mfhi $1 mtlo $1 lb $1, 0($1) TAG150: sh $1, 0($1) sltiu $4, $1, 11 bne $4, $1, TAG151 lb $2, 0($4) TAG151: bgez $2, TAG152 sh $2, 0($2) bgtz $2, TAG152 addi $1, $2, 2 TAG152: lbu $2, 0($1) mult $2, $2 multu $1, $2 lb $1, 0($1) TAG153: lhu $3, 0($1) addu $1, $3, $3 mtlo $1 lw $4, 0($3) TAG154: mtlo $4 mthi $4 mflo $1 lui $4, 15 TAG155: sll $0, $0, 0 lw $1, 0($3) mtlo $1 bne $3, $3, TAG156 TAG156: lui $3, 14 sll $0, $0, 0 beq $3, $1, TAG157 sll $2, $1, 0 TAG157: lbu $1, 0($2) bgez $1, TAG158 sw $2, 0($2) sw $1, 0($1) TAG158: sb $1, 0($1) bltz $1, TAG159 addi $2, $1, 0 sltu $1, $2, $2 TAG159: sb $1, 0($1) multu $1, $1 lui $1, 6 sll $0, $0, 0 TAG160: bgez $2, TAG161 lw $2, 0($2) andi $3, $2, 3 and $4, $2, $2 TAG161: srlv $2, $4, $4 mflo $3 sll $0, $0, 0 blez $4, TAG162 TAG162: sw $3, 0($3) beq $3, $3, TAG163 lui $2, 8 lhu $4, 0($2) TAG163: lui $4, 10 mflo $4 mtlo $4 mfhi $2 TAG164: mult $2, $2 mult $2, $2 addi $2, $2, 5 lui $4, 11 TAG165: sll $0, $0, 0 sll $0, $0, 0 ori $1, $4, 7 sll $0, $0, 0 TAG166: divu $1, $1 sll $0, $0, 0 beq $1, $1, TAG167 sll $0, $0, 0 TAG167: srav $3, $1, $1 mfhi $3 mflo $3 lui $1, 15 TAG168: sll $2, $1, 9 beq $2, $2, TAG169 sll $0, $0, 0 lw $3, 0($2) TAG169: lui $4, 10 sltu $2, $3, $3 sll $0, $0, 0 mfhi $4 TAG170: mfhi $1 sb $1, 0($4) lw $2, 0($1) sb $2, 0($2) TAG171: beq $2, $2, TAG172 sll $4, $2, 0 mtlo $2 multu $2, $4 TAG172: bne $4, $4, TAG173 lui $3, 11 xori $3, $3, 8 sll $0, $0, 0 TAG173: sll $0, $0, 0 mthi $3 multu $3, $3 ori $4, $3, 13 TAG174: nor $3, $4, $4 blez $3, TAG175 mfhi $1 beq $3, $1, TAG175 TAG175: mthi $1 lb $4, 0($1) lui $4, 10 multu $4, $4 TAG176: beq $4, $4, TAG177 multu $4, $4 lui $2, 5 lhu $3, 0($2) TAG177: sra $2, $3, 9 bgtz $3, TAG178 lui $3, 7 mthi $3 TAG178: mthi $3 sll $0, $0, 0 sll $0, $0, 0 or $3, $3, $3 TAG179: divu $3, $3 and $4, $3, $3 mthi $4 nor $1, $3, $4 TAG180: sll $0, $0, 0 bne $1, $1, TAG181 sll $0, $0, 0 sll $0, $0, 0 TAG181: sb $2, 1409($2) ori $1, $2, 14 srlv $4, $1, $2 bne $2, $1, TAG182 TAG182: div $4, $4 mult $4, $4 bgez $4, TAG183 mflo $3 TAG183: lui $2, 5 sltu $2, $3, $2 mthi $2 mtlo $2 TAG184: mtlo $2 divu $2, $2 sltiu $2, $2, 3 lbu $2, 0($2) TAG185: mult $2, $2 bne $2, $2, TAG186 multu $2, $2 lui $1, 14 TAG186: mtlo $1 mfhi $1 mult $1, $1 mtlo $1 TAG187: srl $4, $1, 5 bne $4, $1, TAG188 sll $3, $1, 5 blez $1, TAG188 TAG188: mtlo $3 ori $1, $3, 0 bgez $3, TAG189 mflo $3 TAG189: srav $3, $3, $3 mthi $3 mthi $3 mfhi $3 TAG190: sltiu $3, $3, 6 mtlo $3 lb $2, 0($3) lbu $3, 0($3) TAG191: mflo $3 mtlo $3 mflo $4 sltiu $2, $3, 14 TAG192: lui $2, 9 lui $4, 5 mtlo $4 bgez $2, TAG193 TAG193: sll $0, $0, 0 addu $2, $4, $4 bltz $2, TAG194 sll $0, $0, 0 TAG194: sll $0, $0, 0 bgtz $3, TAG195 mfhi $2 lbu $3, 0($2) TAG195: bne $3, $3, TAG196 multu $3, $3 mthi $3 lui $4, 1 TAG196: mflo $4 mthi $4 sb $4, 0($4) mtlo $4 TAG197: bne $4, $4, TAG198 mthi $4 blez $4, TAG198 lui $2, 7 TAG198: multu $2, $2 subu $4, $2, $2 div $2, $2 mflo $1 TAG199: sb $1, 0($1) divu $1, $1 bgtz $1, TAG200 sltiu $1, $1, 12 TAG200: addiu $3, $1, 5 lui $4, 5 sb $4, 0($3) bgez $4, TAG201 TAG201: sll $0, $0, 0 bgtz $4, TAG202 mthi $4 mfhi $1 TAG202: lbu $2, 0($1) sb $2, 0($2) srlv $2, $1, $1 blez $1, TAG203 TAG203: mult $2, $2 mtlo $2 lui $4, 8 addiu $1, $2, 13 TAG204: lui $2, 3 mult $1, $1 mtlo $2 lui $4, 0 TAG205: mtlo $4 bgez $4, TAG206 and $2, $4, $4 mult $2, $2 TAG206: mflo $2 beq $2, $2, TAG207 sltiu $4, $2, 12 div $2, $4 TAG207: div $4, $4 beq $4, $4, TAG208 and $1, $4, $4 and $4, $4, $4 TAG208: mfhi $1 add $2, $1, $4 bne $4, $4, TAG209 sllv $4, $4, $1 TAG209: addiu $3, $4, 5 nor $3, $4, $4 mflo $1 mflo $2 TAG210: beq $2, $2, TAG211 mflo $1 sltiu $1, $1, 13 sll $1, $1, 11 TAG211: sb $1, 0($1) sb $1, 0($1) mult $1, $1 multu $1, $1 TAG212: sltiu $4, $1, 1 lb $2, 0($4) mtlo $1 lui $2, 6 TAG213: sllv $1, $2, $2 and $2, $1, $1 mthi $2 sll $0, $0, 0 TAG214: beq $2, $2, TAG215 sll $0, $0, 0 mtlo $2 beq $3, $3, TAG215 TAG215: sll $0, $0, 0 lw $3, 2($3) mthi $3 lui $4, 14 TAG216: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 TAG217: sw $3, -383($3) lui $1, 10 blez $3, TAG218 sb $3, -383($3) TAG218: addiu $2, $1, 2 mult $1, $1 lui $3, 10 bgez $2, TAG219 TAG219: addu $4, $3, $3 mfhi $3 divu $4, $3 sw $4, 0($3) TAG220: srl $1, $3, 13 beq $1, $3, TAG221 sll $1, $1, 7 addi $3, $1, 8 TAG221: bltz $3, TAG222 lbu $3, 0($3) sh $3, 0($3) bgez $3, TAG222 TAG222: srlv $3, $3, $3 bne $3, $3, TAG223 sh $3, 0($3) mult $3, $3 TAG223: addi $3, $3, 9 beq $3, $3, TAG224 divu $3, $3 mthi $3 TAG224: ori $2, $3, 10 mtlo $3 bgez $2, TAG225 lui $3, 11 TAG225: sll $0, $0, 0 sll $0, $0, 0 bltz $3, TAG226 sll $0, $0, 0 TAG226: lui $1, 2 mfhi $3 mflo $4 lb $2, 0($2) TAG227: sb $2, 0($2) sltu $2, $2, $2 srav $3, $2, $2 lhu $1, 0($3) TAG228: sh $1, 0($1) lw $4, 0($1) beq $1, $1, TAG229 slti $1, $4, 5 TAG229: bltz $1, TAG230 mthi $1 andi $2, $1, 3 slti $1, $2, 14 TAG230: lbu $1, 0($1) mthi $1 bgtz $1, TAG231 srlv $3, $1, $1 TAG231: beq $3, $3, TAG232 lui $4, 4 blez $4, TAG232 lui $1, 7 TAG232: bltz $1, TAG233 sb $1, 0($1) mflo $2 bltz $2, TAG233 TAG233: mult $2, $2 mult $2, $2 mthi $2 lui $1, 9 TAG234: bgtz $1, TAG235 sll $0, $0, 0 blez $3, TAG235 mtlo $3 TAG235: sh $3, 0($3) mthi $3 mult $3, $3 sw $3, 0($3) TAG236: mthi $3 slti $2, $3, 14 lbu $1, 0($2) subu $1, $2, $1 TAG237: bgez $1, TAG238 srlv $3, $1, $1 bne $1, $3, TAG238 lbu $1, 0($1) TAG238: mflo $3 sb $3, 0($3) mflo $3 mflo $3 TAG239: bgtz $3, TAG240 ori $1, $3, 14 mtlo $3 bltz $1, TAG240 TAG240: srav $3, $1, $1 sltiu $1, $1, 5 mtlo $3 lui $1, 10 TAG241: lui $4, 13 mult $4, $1 blez $1, TAG242 mult $1, $1 TAG242: sra $1, $4, 5 lb $4, -26624($1) mthi $4 bltz $1, TAG243 TAG243: sra $2, $4, 14 lui $1, 12 multu $2, $2 mult $2, $4 TAG244: mflo $4 lhu $2, 0($4) subu $3, $4, $2 mflo $3 TAG245: lw $1, 0($3) xor $3, $1, $1 bne $3, $1, TAG246 sh $3, 0($3) TAG246: andi $4, $3, 14 beq $4, $4, TAG247 sb $4, 0($4) lbu $1, 0($4) TAG247: sltiu $4, $1, 2 mult $1, $1 divu $4, $4 sw $1, 0($1) TAG248: mflo $4 lui $3, 3 bne $3, $3, TAG249 sb $4, 0($4) TAG249: lui $3, 13 addu $2, $3, $3 mflo $2 blez $3, TAG250 TAG250: mthi $2 sltiu $1, $2, 0 sb $2, 0($2) bgtz $1, TAG251 TAG251: addu $4, $1, $1 lbu $4, 0($1) mult $4, $4 sltiu $2, $4, 14 TAG252: lui $1, 11 mtlo $1 or $3, $2, $1 mfhi $3 TAG253: bne $3, $3, TAG254 subu $2, $3, $3 mult $3, $2 lui $4, 13 TAG254: addiu $1, $4, 3 mfhi $4 sb $4, 0($4) mflo $4 TAG255: lbu $3, 0($4) beq $3, $3, TAG256 slti $3, $4, 13 lui $3, 2 TAG256: sb $3, 0($3) multu $3, $3 mult $3, $3 sb $3, 0($3) TAG257: mflo $2 bgtz $2, TAG258 sb $3, 0($3) sra $2, $3, 0 TAG258: mult $2, $2 mthi $2 lbu $1, 0($2) ori $3, $1, 11 TAG259: mtlo $3 slti $4, $3, 9 lhu $3, 0($4) sw $4, -256($3) TAG260: bgtz $3, TAG261 andi $3, $3, 8 bgtz $3, TAG261 mflo $2 TAG261: blez $2, TAG262 addiu $2, $2, 5 sh $2, 0($2) lhu $3, 0($2) TAG262: lb $4, 0($3) lb $1, 0($3) addiu $2, $1, 1 bgez $1, TAG263 TAG263: sb $2, 0($2) mthi $2 sb $2, 0($2) bne $2, $2, TAG264 TAG264: mthi $2 div $2, $2 mtlo $2 sra $4, $2, 7 TAG265: mult $4, $4 andi $2, $4, 0 mtlo $2 beq $4, $2, TAG266 TAG266: sh $2, 0($2) mult $2, $2 lw $4, 0($2) subu $2, $4, $2 TAG267: lui $4, 9 mthi $2 sh $2, 0($2) sra $4, $2, 8 TAG268: lh $3, 0($4) sltu $1, $4, $4 mtlo $1 mfhi $2 TAG269: mfhi $2 mult $2, $2 sw $2, 0($2) blez $2, TAG270 TAG270: mfhi $2 lhu $1, 0($2) lb $3, 0($2) sltiu $1, $1, 14 TAG271: multu $1, $1 lb $4, 0($1) bltz $4, TAG272 mfhi $2 TAG272: sltiu $4, $2, 3 srlv $2, $4, $2 sb $4, 0($2) sllv $4, $4, $2 TAG273: lui $3, 0 lui $1, 15 lbu $3, 0($3) lbu $4, 0($4) TAG274: lhu $1, 0($4) mult $1, $4 bne $1, $1, TAG275 mult $4, $4 TAG275: div $1, $1 lui $1, 13 blez $1, TAG276 xor $2, $1, $1 TAG276: slt $3, $2, $2 beq $2, $2, TAG277 andi $1, $3, 9 srl $4, $3, 12 TAG277: mtlo $4 bne $4, $4, TAG278 mult $4, $4 beq $4, $4, TAG278 TAG278: lh $2, 0($4) mult $4, $4 sra $2, $4, 15 mfhi $3 TAG279: lui $3, 0 addu $3, $3, $3 mthi $3 lhu $1, 0($3) TAG280: mfhi $1 lw $4, 0($1) blez $1, TAG281 mthi $1 TAG281: sll $0, $0, 0 bgtz $3, TAG282 sh $3, -256($4) mthi $4 TAG282: mfhi $2 lui $1, 0 divu $3, $2 mfhi $1 TAG283: blez $1, TAG284 xori $1, $1, 9 mtlo $1 beq $1, $1, TAG284 TAG284: slt $2, $1, $1 multu $2, $2 sltu $2, $2, $1 mthi $1 TAG285: mfhi $4 lb $2, 0($2) mfhi $2 sb $4, 0($2) TAG286: slti $3, $2, 14 bne $2, $3, TAG287 sb $2, 0($3) bne $2, $2, TAG287 TAG287: mflo $3 mflo $4 srl $1, $3, 1 mflo $1 TAG288: multu $1, $1 mult $1, $1 ori $4, $1, 0 bgez $1, TAG289 TAG289: lui $2, 11 sh $4, 0($4) sll $0, $0, 0 sh $2, 0($3) TAG290: multu $3, $3 xor $4, $3, $3 lb $1, 0($3) mtlo $1 TAG291: mthi $1 mtlo $1 sltiu $1, $1, 11 lbu $4, 0($1) TAG292: bne $4, $4, TAG293 sub $1, $4, $4 sltiu $1, $1, 5 divu $1, $1 TAG293: addu $3, $1, $1 subu $3, $1, $1 mfhi $3 mflo $3 TAG294: sb $3, 0($3) sb $3, 0($3) bgtz $3, TAG295 srav $2, $3, $3 TAG295: lb $3, 0($2) mflo $1 lw $2, 0($2) lui $1, 1 TAG296: div $1, $1 mtlo $1 mtlo $1 mult $1, $1 TAG297: sll $0, $0, 0 multu $2, $2 sh $2, -256($2) sll $0, $0, 0 TAG298: multu $2, $2 subu $4, $2, $2 bne $4, $4, TAG299 lbu $4, -256($2) TAG299: bgez $4, TAG300 mtlo $4 sra $2, $4, 11 bgtz $4, TAG300 TAG300: sll $0, $0, 0 mthi $3 lui $4, 3 bne $2, $3, TAG301 TAG301: sll $0, $0, 0 multu $4, $4 lui $2, 12 bne $2, $4, TAG302 TAG302: sll $0, $0, 0 sra $2, $2, 6 lui $4, 8 lb $4, -12288($2) TAG303: lui $4, 12 sll $0, $0, 0 bgez $4, TAG304 mflo $4 TAG304: bne $4, $4, TAG305 mfhi $1 lui $1, 2 mthi $1 TAG305: lui $2, 4 mtlo $1 sll $0, $0, 0 sll $0, $0, 0 TAG306: mflo $2 mflo $2 sll $0, $0, 0 mtlo $2 TAG307: bgez $3, TAG308 mtlo $3 bgtz $3, TAG308 multu $3, $3 TAG308: mthi $3 and $3, $3, $3 or $3, $3, $3 andi $2, $3, 7 TAG309: mtlo $2 mflo $2 addu $3, $2, $2 bne $2, $3, TAG310 TAG310: multu $3, $3 beq $3, $3, TAG311 multu $3, $3 mfhi $1 TAG311: sll $2, $1, 9 mthi $2 mtlo $2 divu $2, $1 TAG312: beq $2, $2, TAG313 sll $0, $0, 0 lw $2, 0($2) mfhi $2 TAG313: lui $1, 15 subu $1, $2, $2 xor $2, $1, $1 lui $3, 6 TAG314: nor $4, $3, $3 lui $2, 3 lui $3, 1 sll $0, $0, 0 TAG315: sltu $3, $3, $3 bltz $3, TAG316 sll $2, $3, 15 mfhi $3 TAG316: addi $1, $3, 12 sb $3, 0($1) and $2, $3, $1 mtlo $3 TAG317: mthi $2 mthi $2 bgez $2, TAG318 xor $4, $2, $2 TAG318: add $4, $4, $4 sub $3, $4, $4 sb $3, 0($3) sw $3, 0($3) TAG319: mult $3, $3 lui $1, 12 mthi $3 bltz $1, TAG320 TAG320: sll $0, $0, 0 mfhi $1 mflo $3 lh $3, 0($1) TAG321: srlv $2, $3, $3 multu $2, $2 lui $3, 14 mtlo $2 TAG322: mthi $3 divu $3, $3 bgez $3, TAG323 sll $0, $0, 0 TAG323: lui $1, 6 lui $3, 11 mtlo $1 mflo $2 TAG324: mtlo $2 xor $1, $2, $2 bne $2, $1, TAG325 divu $1, $2 TAG325: blez $1, TAG326 mflo $1 div $1, $1 lui $1, 3 TAG326: bgez $1, TAG327 mult $1, $1 mtlo $1 blez $1, TAG327 TAG327: sb $1, 0($1) mult $1, $1 lui $4, 0 lui $2, 1 TAG328: sll $0, $0, 0 bne $2, $2, TAG329 sltiu $1, $3, 2 mtlo $3 TAG329: lui $2, 14 sll $0, $0, 0 lb $1, 0($1) srl $3, $2, 5 TAG330: addu $2, $3, $3 srlv $1, $3, $3 mthi $1 sb $3, -28672($1) TAG331: mthi $1 bgtz $1, TAG332 lbu $2, -28672($1) sllv $4, $1, $2 TAG332: mult $4, $4 bne $4, $4, TAG333 mflo $1 xori $2, $4, 13 TAG333: sltiu $2, $2, 11 multu $2, $2 bltz $2, TAG334 mfhi $3 TAG334: bne $3, $3, TAG335 sh $3, 0($3) mflo $3 beq $3, $3, TAG335 TAG335: lbu $2, 0($3) multu $3, $3 mthi $2 lhu $4, 0($3) TAG336: lh $4, 0($4) mult $4, $4 lw $3, 0($4) lbu $1, 0($4) TAG337: lui $4, 12 bgez $1, TAG338 sll $0, $0, 0 lui $2, 15 TAG338: mthi $2 bltz $2, TAG339 lbu $1, 0($2) bne $1, $1, TAG339 TAG339: mfhi $3 mthi $3 sb $1, 0($3) mfhi $1 TAG340: blez $1, TAG341 mtlo $1 lw $1, 0($1) bne $1, $1, TAG341 TAG341: multu $1, $1 mflo $3 sw $1, 0($1) xor $3, $1, $3 TAG342: mflo $3 sub $4, $3, $3 bgez $3, TAG343 lbu $1, 0($4) TAG343: lui $4, 14 lui $2, 0 mfhi $4 mthi $1 TAG344: xori $2, $4, 11 xor $4, $4, $4 lui $3, 15 mthi $4 TAG345: bltz $3, TAG346 multu $3, $3 multu $3, $3 bne $3, $3, TAG346 TAG346: sll $0, $0, 0 lb $1, 0($2) divu $1, $3 beq $3, $2, TAG347 TAG347: lui $4, 0 bne $1, $4, TAG348 mflo $1 mtlo $4 TAG348: sw $1, 0($1) mthi $1 sll $3, $1, 9 mult $1, $3 TAG349: xor $4, $3, $3 lb $3, 0($4) mtlo $3 lui $4, 15 TAG350: slt $4, $4, $4 mfhi $4 sll $4, $4, 13 mfhi $1 TAG351: lui $1, 4 srlv $2, $1, $1 slti $4, $1, 7 sll $0, $0, 0 TAG352: mflo $2 mthi $1 sll $3, $2, 13 bgez $1, TAG353 TAG353: mflo $2 addiu $3, $3, 8 bgtz $2, TAG354 addiu $2, $3, 6 TAG354: sb $2, 0($2) lui $1, 0 beq $2, $1, TAG355 mthi $1 TAG355: mflo $3 sh $3, 0($1) or $4, $3, $3 mtlo $1 TAG356: lh $1, 0($4) mtlo $1 mthi $4 mfhi $2 TAG357: lui $3, 15 sll $0, $0, 0 bgtz $2, TAG358 andi $4, $2, 3 TAG358: lui $1, 5 multu $4, $4 mflo $1 sw $1, 0($1) TAG359: beq $1, $1, TAG360 mflo $1 multu $1, $1 beq $1, $1, TAG360 TAG360: sub $2, $1, $1 lui $1, 1 beq $1, $1, TAG361 lw $3, 0($2) TAG361: bltz $3, TAG362 slti $3, $3, 11 sb $3, 0($3) addiu $4, $3, 10 TAG362: lb $4, 0($4) lui $3, 11 mflo $4 mtlo $3 TAG363: lb $2, 0($4) lhu $2, 0($4) sb $2, -256($2) lui $3, 7 TAG364: mthi $3 div $3, $3 sll $0, $0, 0 addu $1, $3, $3 TAG365: sll $0, $0, 0 beq $1, $3, TAG366 sll $0, $0, 0 bltz $1, TAG366 TAG366: mult $4, $4 bgtz $4, TAG367 mflo $3 sw $3, 0($3) TAG367: multu $3, $3 mfhi $1 mflo $3 bgtz $1, TAG368 TAG368: lhu $4, 0($3) mult $3, $4 mfhi $1 addiu $3, $3, 14 TAG369: divu $3, $3 sh $3, 0($3) lh $3, 0($3) subu $4, $3, $3 TAG370: bne $4, $4, TAG371 addi $1, $4, 7 lui $2, 8 mult $2, $1 TAG371: bgez $2, TAG372 sll $0, $0, 0 mtlo $2 bgtz $2, TAG372 TAG372: mflo $4 multu $2, $2 mtlo $2 blez $4, TAG373 TAG373: divu $4, $4 lui $2, 6 multu $2, $4 beq $4, $2, TAG374 TAG374: lui $3, 0 mult $3, $3 xori $2, $3, 14 multu $2, $2 TAG375: sh $2, 0($2) lb $3, 0($2) srlv $3, $2, $2 lbu $4, 0($3) TAG376: lui $4, 14 sll $0, $0, 0 mflo $4 sh $4, -196($4) TAG377: bgez $4, TAG378 mflo $2 lb $3, 0($4) multu $4, $4 TAG378: mtlo $3 srlv $2, $3, $3 sra $3, $3, 5 multu $2, $2 TAG379: mflo $3 bne $3, $3, TAG380 xori $1, $3, 12 beq $3, $3, TAG380 TAG380: lh $3, 0($1) lh $3, 0($3) lui $4, 14 mfhi $1 TAG381: bne $1, $1, TAG382 mult $1, $1 sh $1, 0($1) lui $4, 5 TAG382: bltz $4, TAG383 srlv $3, $4, $4 mflo $1 lui $2, 5 TAG383: mthi $2 mfhi $3 mfhi $3 lui $3, 9 TAG384: lui $4, 13 blez $3, TAG385 lui $4, 14 mflo $1 TAG385: srl $2, $1, 3 mfhi $3 bgtz $2, TAG386 subu $2, $2, $3 TAG386: sll $0, $0, 0 bgez $2, TAG387 or $1, $2, $2 sllv $3, $1, $2 TAG387: srav $1, $3, $3 bne $1, $1, TAG388 sllv $3, $1, $1 srlv $2, $3, $1 TAG388: mtlo $2 andi $3, $2, 14 bne $2, $2, TAG389 addu $1, $3, $3 TAG389: bltz $1, TAG390 mtlo $1 bne $1, $1, TAG390 sb $1, 0($1) TAG390: slt $3, $1, $1 multu $1, $1 mflo $3 mtlo $3 TAG391: sb $3, 0($3) mtlo $3 bgez $3, TAG392 sw $3, 0($3) TAG392: beq $3, $3, TAG393 mult $3, $3 mthi $3 mult $3, $3 TAG393: sb $3, 0($3) xori $1, $3, 5 lbu $2, 0($3) mflo $1 TAG394: lh $1, 0($1) mflo $4 sw $4, 0($1) mtlo $1 TAG395: bne $4, $4, TAG396 lui $1, 4 div $4, $1 sll $0, $0, 0 TAG396: sb $3, 0($3) bgtz $3, TAG397 multu $3, $3 mflo $1 TAG397: lhu $1, 0($1) bgez $1, TAG398 mfhi $2 bne $1, $1, TAG398 TAG398: lui $1, 4 mtlo $2 sll $0, $0, 0 subu $4, $1, $2 TAG399: mtlo $4 sll $0, $0, 0 mult $4, $4 bne $4, $4, TAG400 TAG400: lui $3, 8 bne $3, $4, TAG401 ori $1, $3, 3 slti $3, $1, 9 TAG401: slt $3, $3, $3 srlv $4, $3, $3 addiu $2, $3, 2 lui $2, 10 TAG402: multu $2, $2 mthi $2 div $2, $2 sll $0, $0, 0 TAG403: sll $0, $0, 0 sltiu $4, $2, 4 sll $0, $0, 0 lui $3, 4 TAG404: mflo $3 mult $3, $3 srl $3, $3, 9 lh $3, 0($3) TAG405: sb $3, 0($3) mthi $3 sll $4, $3, 1 nor $2, $3, $4 TAG406: lui $1, 11 lui $4, 0 mfhi $4 mthi $2 TAG407: bne $4, $4, TAG408 lui $2, 1 lb $4, 0($4) bne $4, $4, TAG408 TAG408: multu $4, $4 sb $4, 0($4) mfhi $4 beq $4, $4, TAG409 TAG409: ori $3, $4, 8 sh $4, 0($4) lui $2, 3 mflo $1 TAG410: bltz $1, TAG411 sb $1, 0($1) mtlo $1 mthi $1 TAG411: lui $4, 3 mthi $4 mfhi $2 sll $0, $0, 0 TAG412: div $4, $4 lui $4, 3 lui $2, 4 sra $2, $4, 1 TAG413: mult $2, $2 bgtz $2, TAG414 slti $1, $2, 4 sb $2, 0($1) TAG414: sb $1, 0($1) mflo $3 xori $4, $3, 9 sll $0, $0, 0 TAG415: mfhi $1 bgtz $1, TAG416 divu $4, $1 add $1, $1, $1 TAG416: lui $3, 5 subu $2, $3, $1 sll $0, $0, 0 sh $3, 0($1) TAG417: sh $1, 0($1) subu $3, $1, $1 bne $1, $3, TAG418 sw $1, 0($3) TAG418: sh $3, 0($3) beq $3, $3, TAG419 or $2, $3, $3 add $3, $2, $2 TAG419: mtlo $3 srav $3, $3, $3 sb $3, 0($3) mult $3, $3 TAG420: sw $3, 0($3) mult $3, $3 mflo $4 bgez $4, TAG421 TAG421: mult $4, $4 nor $1, $4, $4 lui $3, 8 lui $1, 7 TAG422: lui $4, 10 and $2, $4, $4 mflo $1 bne $2, $4, TAG423 TAG423: add $2, $1, $1 mflo $3 addi $1, $2, 7 srav $4, $3, $1 TAG424: mtlo $4 lui $1, 12 multu $4, $1 srl $1, $1, 8 TAG425: sh $1, -3072($1) divu $1, $1 sh $1, -3072($1) lui $2, 0 TAG426: sb $2, 0($2) mflo $2 subu $1, $2, $2 sllv $3, $2, $2 TAG427: bgtz $3, TAG428 lbu $1, 0($3) lhu $4, 0($3) lw $3, 0($3) TAG428: lhu $1, 0($3) mfhi $2 multu $2, $2 lui $4, 12 TAG429: mtlo $4 lui $1, 0 beq $1, $4, TAG430 lui $2, 11 TAG430: mthi $2 andi $4, $2, 6 bltz $2, TAG431 sll $0, $0, 0 TAG431: multu $4, $4 sb $4, 0($4) blez $4, TAG432 sra $1, $4, 1 TAG432: bne $1, $1, TAG433 sb $1, 0($1) srl $3, $1, 9 sh $3, 0($3) TAG433: lui $1, 4 lui $1, 14 mfhi $4 div $4, $1 TAG434: sll $4, $4, 0 mfhi $1 mult $4, $4 sb $4, 0($4) TAG435: bltz $1, TAG436 lbu $2, 0($1) ori $3, $1, 13 bne $3, $2, TAG436 TAG436: mflo $4 mflo $3 slti $3, $4, 12 divu $4, $3 TAG437: bne $3, $3, TAG438 or $4, $3, $3 sb $4, 0($4) beq $4, $3, TAG438 TAG438: xori $1, $4, 4 mtlo $4 divu $1, $4 sb $4, 0($1) TAG439: addiu $4, $1, 15 mthi $1 multu $4, $1 bltz $4, TAG440 TAG440: div $4, $4 beq $4, $4, TAG441 lui $2, 15 sw $2, 0($4) TAG441: sll $0, $0, 0 slti $2, $2, 13 slti $4, $2, 10 mflo $4 TAG442: slti $4, $4, 1 bgez $4, TAG443 mtlo $4 lui $2, 2 TAG443: lui $2, 8 mfhi $4 bne $2, $4, TAG444 mult $2, $4 TAG444: mfhi $2 mult $2, $2 lui $3, 13 lui $2, 1 TAG445: bgtz $2, TAG446 lui $4, 13 div $2, $2 blez $2, TAG446 TAG446: mult $4, $4 sll $0, $0, 0 mtlo $4 bltz $2, TAG447 TAG447: sll $0, $0, 0 div $2, $2 sltu $1, $2, $2 sll $1, $1, 0 TAG448: nor $3, $1, $1 ori $2, $1, 7 mflo $4 lui $4, 2 TAG449: mfhi $4 mtlo $4 lui $1, 11 lh $4, 0($4) TAG450: beq $4, $4, TAG451 ori $1, $4, 13 bltz $4, TAG451 mflo $2 TAG451: mult $2, $2 lb $4, 0($2) blez $4, TAG452 sb $4, 0($4) TAG452: bne $4, $4, TAG453 mtlo $4 xor $1, $4, $4 beq $1, $1, TAG453 TAG453: mthi $1 beq $1, $1, TAG454 lui $2, 11 sh $1, 0($2) TAG454: lui $3, 11 bne $2, $2, TAG455 sll $0, $0, 0 mtlo $2 TAG455: mthi $4 addiu $2, $4, 10 bgez $4, TAG456 divu $4, $2 TAG456: bgez $2, TAG457 mfhi $2 lb $1, 0($2) mtlo $2 TAG457: beq $1, $1, TAG458 lw $3, 0($1) bltz $1, TAG458 mthi $1 TAG458: subu $3, $3, $3 mflo $4 mthi $3 sb $3, 0($3) TAG459: multu $4, $4 mult $4, $4 subu $1, $4, $4 slt $2, $4, $4 TAG460: bltz $2, TAG461 sh $2, 0($2) blez $2, TAG461 lh $3, 0($2) TAG461: lui $1, 8 sra $1, $3, 1 mtlo $1 mtlo $1 TAG462: mthi $1 mthi $1 mthi $1 sllv $4, $1, $1 TAG463: mult $4, $4 mtlo $4 srlv $1, $4, $4 mult $4, $1 TAG464: bgez $1, TAG465 mtlo $1 sra $3, $1, 2 lui $4, 3 TAG465: srlv $4, $4, $4 lui $1, 1 mtlo $4 bgez $1, TAG466 TAG466: xori $2, $1, 0 slt $3, $1, $1 sll $0, $0, 0 sltiu $4, $2, 0 TAG467: blez $4, TAG468 mtlo $4 andi $2, $4, 14 bne $4, $4, TAG468 TAG468: mflo $3 addu $1, $2, $3 lhu $1, 0($3) lui $1, 5 TAG469: sll $0, $0, 0 mthi $1 slti $4, $1, 3 mflo $1 TAG470: mfhi $3 beq $1, $1, TAG471 lui $2, 6 lhu $3, 0($2) TAG471: beq $3, $3, TAG472 mflo $3 beq $3, $3, TAG472 sltiu $2, $3, 12 TAG472: sra $2, $2, 3 lui $1, 0 lui $3, 10 mthi $2 TAG473: sll $0, $0, 0 mflo $2 lui $3, 1 mflo $1 TAG474: mfhi $3 sh $3, 0($1) mult $3, $1 lui $1, 8 TAG475: lui $1, 9 sll $0, $0, 0 sll $0, $0, 0 bne $4, $1, TAG476 TAG476: sh $4, 0($4) lui $2, 12 bgez $2, TAG477 slti $1, $4, 7 TAG477: sb $1, 0($1) bne $1, $1, TAG478 sltiu $2, $1, 7 lb $1, 0($2) TAG478: mfhi $4 lbu $2, 0($4) lui $4, 12 mtlo $2 TAG479: sll $0, $0, 0 sll $0, $0, 0 mult $1, $4 sll $0, $0, 0 TAG480: lui $2, 9 beq $1, $2, TAG481 mfhi $2 bne $2, $2, TAG481 TAG481: sh $2, 0($2) sw $2, 0($2) mult $2, $2 mtlo $2 TAG482: lw $3, 0($2) beq $3, $2, TAG483 mtlo $2 divu $2, $3 TAG483: addiu $1, $3, 3 bltz $3, TAG484 lw $1, 0($3) beq $1, $1, TAG484 TAG484: ori $2, $1, 0 sltiu $1, $1, 0 mtlo $2 lw $2, 0($2) TAG485: mtlo $2 lui $4, 15 sll $0, $0, 0 ori $1, $2, 15 TAG486: mfhi $4 xori $3, $1, 6 lb $4, 0($4) sb $1, 0($1) TAG487: srlv $2, $4, $4 slti $4, $4, 14 bgtz $4, TAG488 lb $2, 0($2) TAG488: blez $2, TAG489 lui $1, 8 multu $2, $1 mtlo $2 TAG489: bgez $1, TAG490 lui $4, 11 lb $1, 0($1) mfhi $3 TAG490: ori $2, $3, 3 sb $3, 0($3) mult $3, $3 addu $1, $2, $3 TAG491: lui $4, 1 bgtz $4, TAG492 multu $4, $4 div $1, $1 TAG492: mflo $1 mtlo $1 subu $3, $1, $4 lui $4, 12 TAG493: sll $0, $0, 0 sra $2, $4, 3 sll $0, $0, 0 or $1, $4, $2 TAG494: and $4, $1, $1 mtlo $4 div $4, $4 ori $1, $1, 2 TAG495: beq $1, $1, TAG496 mthi $1 lui $3, 6 xor $2, $3, $1 TAG496: mult $2, $2 sll $0, $0, 0 beq $2, $2, TAG497 mult $2, $2 TAG497: sll $0, $0, 0 mthi $2 beq $4, $4, TAG498 div $2, $4 TAG498: slt $3, $4, $4 beq $3, $3, TAG499 sub $2, $3, $3 lui $2, 6 TAG499: addiu $3, $2, 12 mthi $3 mult $3, $3 lui $1, 4 TAG500: sllv $2, $1, $1 mult $2, $2 subu $2, $2, $2 nor $3, $1, $1 TAG501: bgtz $3, TAG502 mtlo $3 sll $0, $0, 0 or $1, $3, $2 TAG502: mfhi $3 bne $3, $3, TAG503 addiu $1, $1, 11 bne $1, $1, TAG503 TAG503: mtlo $1 mfhi $3 bgtz $3, TAG504 mthi $1 TAG504: mflo $4 bgtz $3, TAG505 sllv $2, $3, $3 lhu $3, 0($4) TAG505: sb $3, 0($3) slt $3, $3, $3 mthi $3 bne $3, $3, TAG506 TAG506: sw $3, 0($3) sb $3, 0($3) mthi $3 mfhi $4 TAG507: lui $1, 3 mthi $1 addi $1, $4, 3 lui $1, 10 TAG508: srl $2, $1, 13 sll $0, $0, 0 multu $4, $4 subu $3, $2, $2 TAG509: bltz $3, TAG510 mult $3, $3 mfhi $1 lui $3, 14 TAG510: sll $0, $0, 0 or $4, $3, $3 xori $1, $4, 9 sll $0, $0, 0 TAG511: mtlo $1 andi $4, $1, 2 slti $2, $1, 12 beq $2, $4, TAG512 TAG512: mthi $2 sra $3, $2, 1 mtlo $3 blez $2, TAG513 TAG513: lui $1, 5 lui $2, 4 beq $1, $3, TAG514 mflo $3 TAG514: sllv $4, $3, $3 lui $1, 4 mthi $4 blez $4, TAG515 TAG515: sll $0, $0, 0 bltz $1, TAG516 sll $0, $0, 0 ori $1, $1, 4 TAG516: mfhi $3 srlv $3, $1, $1 addiu $4, $3, 10 lbu $1, -16394($4) TAG517: addiu $3, $1, 0 lui $1, 0 blez $1, TAG518 mfhi $4 TAG518: bgtz $4, TAG519 srlv $1, $4, $4 bgez $4, TAG519 and $2, $1, $1 TAG519: lui $1, 13 sw $2, 0($2) bgtz $1, TAG520 sll $0, $0, 0 TAG520: ori $1, $3, 13 subu $1, $3, $1 sltu $4, $1, $1 lw $2, 0($4) TAG521: ori $3, $2, 8 andi $3, $2, 3 addi $3, $3, 10 lui $3, 10 TAG522: beq $3, $3, TAG523 nor $3, $3, $3 divu $3, $3 mflo $1 TAG523: mflo $4 ori $1, $1, 8 mult $1, $4 divu $1, $1 TAG524: lui $1, 4 lui $2, 11 multu $1, $2 addu $3, $1, $1 TAG525: lui $1, 4 xor $1, $3, $3 lw $4, 0($1) mult $1, $1 TAG526: bne $4, $4, TAG527 mfhi $4 sb $4, 0($4) lhu $2, 0($4) TAG527: addiu $1, $2, 11 sltiu $1, $1, 14 sw $1, 0($2) mthi $1 TAG528: sb $1, 0($1) xori $2, $1, 6 slt $3, $1, $1 srl $2, $2, 11 TAG529: sh $2, 0($2) bne $2, $2, TAG530 lui $1, 13 mflo $3 TAG530: blez $3, TAG531 andi $2, $3, 10 sh $2, 0($2) add $1, $3, $2 TAG531: andi $4, $1, 5 bne $4, $4, TAG532 mfhi $4 sb $1, 0($4) TAG532: lb $3, 0($4) mflo $1 blez $1, TAG533 mflo $1 TAG533: mult $1, $1 mfhi $4 addiu $4, $4, 5 xori $4, $4, 12 TAG534: lb $3, 0($4) nor $4, $4, $3 sllv $3, $4, $3 andi $4, $4, 15 TAG535: bne $4, $4, TAG536 multu $4, $4 mtlo $4 mult $4, $4 TAG536: srl $4, $4, 10 lb $3, 0($4) sh $4, 0($3) xori $2, $4, 10 TAG537: andi $4, $2, 1 and $3, $2, $4 lh $4, 0($2) andi $2, $4, 12 TAG538: lw $3, 0($2) bne $3, $2, TAG539 lb $3, 0($2) lui $1, 15 TAG539: div $1, $1 xori $2, $1, 3 bne $1, $2, TAG540 multu $2, $1 TAG540: xor $1, $2, $2 sh $1, 0($1) sll $0, $0, 0 lui $2, 6 TAG541: mult $2, $2 lui $4, 1 mfhi $3 mflo $3 TAG542: xori $4, $3, 6 mfhi $1 lui $4, 13 xori $1, $4, 1 TAG543: sll $0, $0, 0 and $3, $1, $1 mult $3, $1 beq $1, $1, TAG544 TAG544: ori $3, $3, 0 sll $0, $0, 0 andi $2, $3, 3 sb $3, 0($2) TAG545: sb $2, 0($2) blez $2, TAG546 div $2, $2 sb $2, 0($2) TAG546: srl $4, $2, 14 mult $4, $4 blez $2, TAG547 sb $2, 0($2) TAG547: bgtz $4, TAG548 mthi $4 mtlo $4 lw $2, 0($4) TAG548: sllv $2, $2, $2 lui $4, 5 lui $4, 5 sll $0, $0, 0 TAG549: beq $4, $4, TAG550 sll $0, $0, 0 nor $1, $4, $4 slt $2, $4, $1 TAG550: mfhi $3 mflo $1 or $4, $2, $1 beq $3, $2, TAG551 TAG551: divu $4, $4 slti $1, $4, 14 ori $4, $1, 14 div $4, $4 TAG552: addu $3, $4, $4 bne $4, $4, TAG553 mfhi $1 lui $1, 4 TAG553: divu $1, $1 blez $1, TAG554 addiu $4, $1, 9 sll $0, $0, 0 TAG554: sll $0, $0, 0 lui $2, 9 sll $0, $0, 0 subu $4, $4, $4 TAG555: xori $3, $4, 9 mflo $1 mthi $1 sltu $3, $4, $1 TAG556: bne $3, $3, TAG557 sb $3, 0($3) subu $1, $3, $3 bltz $3, TAG557 TAG557: sw $1, 0($1) lui $4, 2 multu $1, $4 lui $1, 13 TAG558: sll $0, $0, 0 bltz $1, TAG559 lui $2, 6 lui $3, 10 TAG559: multu $3, $3 sll $0, $0, 0 lui $4, 14 srl $1, $3, 3 TAG560: slti $4, $1, 4 bltz $1, TAG561 addiu $1, $1, 9 srl $4, $1, 0 TAG561: bne $4, $4, TAG562 multu $4, $4 mflo $3 bgez $3, TAG562 TAG562: lui $2, 13 sltiu $3, $3, 7 beq $3, $2, TAG563 sh $2, 0($3) TAG563: blez $3, TAG564 sh $3, 0($3) lhu $2, 0($3) sw $2, 0($3) TAG564: mflo $2 bgez $2, TAG565 sll $0, $0, 0 divu $4, $2 TAG565: subu $2, $4, $4 sra $2, $4, 11 xori $2, $4, 0 lui $4, 3 TAG566: mult $4, $4 div $4, $4 mthi $4 bgez $4, TAG567 TAG567: sll $4, $4, 7 mfhi $1 bgtz $1, TAG568 sll $0, $0, 0 TAG568: mflo $2 bgez $2, TAG569 mflo $3 sh $3, 0($3) TAG569: mtlo $3 sb $3, 0($3) mtlo $3 bgez $3, TAG570 TAG570: lb $2, 0($3) mfhi $3 mflo $4 mfhi $2 TAG571: sll $0, $0, 0 sll $0, $0, 0 sll $0, $0, 0 beq $2, $2, TAG572 TAG572: mtlo $3 bne $3, $3, TAG573 sll $0, $0, 0 sll $0, $0, 0 TAG573: divu $2, $2 sltiu $1, $2, 2 bgtz $2, TAG574 sll $0, $0, 0 TAG574: mfhi $1 mult $1, $1 lui $2, 13 bgtz $4, TAG575 TAG575: mflo $2 add $4, $2, $2 mfhi $4 ori $3, $2, 13 TAG576: mflo $1 bgtz $3, TAG577 lui $3, 1 mflo $2 TAG577: lui $3, 2 lui $4, 9 mflo $3 ori $3, $3, 4 TAG578: bne $3, $3, TAG579 nor $4, $3, $3 srlv $3, $3, $4 sh $4, 0($3) TAG579: mtlo $3 lh $1, 0($3) srav $4, $1, $1 mflo $3 TAG580: beq $3, $3, TAG581 sub $3, $3, $3 divu $3, $3 sll $3, $3, 8 TAG581: lh $2, 0($3) mult $3, $3 sb $2, 5($2) lui $1, 8 TAG582: mthi $1 addu $3, $1, $1 mthi $3 beq $1, $1, TAG583 TAG583: sll $0, $0, 0 mtlo $3 sltiu $1, $3, 13 blez $3, TAG584 TAG584: xori $4, $1, 0 mfhi $1 blez $1, TAG585 lui $1, 15 TAG585: addu $2, $1, $1 mtlo $2 sll $3, $1, 6 bne $1, $1, TAG586 TAG586: addiu $2, $3, 2 slti $1, $2, 9 addu $2, $2, $3 mult $3, $2 TAG587: mflo $2 mflo $1 sll $0, $0, 0 sll $0, $0, 0 TAG588: addu $4, $1, $1 bgtz $1, TAG589 sll $0, $0, 0 multu $1, $1 TAG589: bgtz $4, TAG590 sll $0, $0, 0 divu $4, $4 sb $4, 0($4) TAG590: mfhi $3 mflo $3 multu $3, $3 slt $2, $3, $4 TAG591: lbu $1, 0($2) mfhi $2 mthi $2 lui $1, 0 TAG592: lui $3, 4 mtlo $1 lh $3, 0($1) mfhi $2 TAG593: sll $0, $0, 0 lui $3, 3 subu $4, $4, $2 subu $1, $2, $4 TAG594: mtlo $1 sll $0, $0, 0 div $1, $1 mthi $1 TAG595: sll $0, $0, 0 sll $0, $0, 0 mfhi $2 blez $2, TAG596 TAG596: div $2, $2 lui $2, 4 sll $0, $0, 0 addiu $2, $2, 6 TAG597: or $4, $2, $2 sll $3, $2, 1 beq $3, $2, TAG598 sll $0, $0, 0 TAG598: mthi $3 lui $2, 10 mtlo $3 sltu $4, $2, $3 TAG599: mthi $4 lui $4, 8 lui $1, 4 sll $0, $0, 0 TAG600: bne $3, $3, TAG601 mthi $3 andi $2, $3, 15 sll $0, $0, 0 TAG601: bne $2, $2, TAG602 sltiu $2, $2, 14 beq $2, $2, TAG602 srl $4, $2, 1 TAG602: srl $2, $4, 3 mthi $2 lhu $4, 0($2) lui $3, 13 TAG603: lui $4, 10 sll $0, $0, 0 mflo $4 sll $0, $0, 0 TAG604: mthi $1 bne $1, $1, TAG605 sllv $4, $1, $1 subu $4, $1, $1 TAG605: sh $4, 0($4) beq $4, $4, TAG606 lui $3, 1 bne $4, $3, TAG606 TAG606: mflo $4 lui $3, 2 addu $2, $3, $4 bltz $4, TAG607 TAG607: lui $4, 5 mthi $4 mfhi $1 addiu $3, $4, 1 TAG608: blez $3, TAG609 lui $1, 8 beq $3, $1, TAG609 mtlo $3 TAG609: addiu $3, $1, 2 sll $0, $0, 0 bne $1, $3, TAG610 xor $1, $1, $1 TAG610: mult $1, $1 bgez $1, TAG611 ori $4, $1, 10 mfhi $1 TAG611: lh $4, 0($1) bltz $1, TAG612 xor $3, $1, $4 beq $1, $1, TAG612 TAG612: mthi $3 sh $3, 0($3) multu $3, $3 beq $3, $3, TAG613 TAG613: lw $3, 0($3) mthi $3 lui $4, 0 beq $3, $4, TAG614 TAG614: multu $4, $4 lui $3, 11 andi $4, $3, 1 mflo $3 TAG615: mfhi $4 lui $2, 5 multu $2, $4 mult $2, $3 TAG616: multu $2, $2 bne $2, $2, TAG617 div $2, $2 sll $0, $0, 0 TAG617: lw $4, 0($4) mfhi $3 mfhi $1 bgtz $1, TAG618 TAG618: mtlo $1 multu $1, $1 multu $1, $1 lh $3, 0($1) TAG619: addiu $2, $3, 8 beq $3, $3, TAG620 lw $3, 0($3) lui $4, 12 TAG620: sb $4, 0($4) mult $4, $4 lhu $3, 0($4) lui $1, 7 TAG621: mflo $2 mthi $1 lui $2, 10 mtlo $1 TAG622: bltz $2, TAG623 sll $0, $0, 0 beq $2, $2, TAG623 mfhi $4 TAG623: mtlo $4 mfhi $4 beq $4, $4, TAG624 mtlo $4 TAG624: sll $0, $0, 0 beq $1, $4, TAG625 sll $0, $0, 0 beq $4, $1, TAG625 TAG625: sll $0, $0, 0 mflo $4 blez $3, TAG626 sra $3, $1, 1 TAG626: sll $0, $0, 0 or $1, $3, $3 multu $1, $3 bltz $3, TAG627 TAG627: mtlo $1 sll $0, $0, 0 sltiu $4, $3, 0 sh $3, 0($4) TAG628: lui $4, 6 sll $0, $0, 0 div $4, $1 mflo $1 TAG629: bltz $1, TAG630 srlv $1, $1, $1 beq $1, $1, TAG630 sh $1, 0($1) TAG630: multu $1, $1 lui $4, 6 sb $4, 0($1) sll $2, $1, 10 TAG631: bne $2, $2, TAG632 lb $2, 0($2) mult $2, $2 sb $2, 0($2) TAG632: sw $2, 0($2) sllv $4, $2, $2 lw $2, 0($4) beq $2, $4, TAG633 TAG633: mult $2, $2 srlv $2, $2, $2 mtlo $2 mfhi $2 TAG634: lb $2, 0($2) sltu $3, $2, $2 sw $2, 0($2) beq $2, $2, TAG635 TAG635: mflo $2 sh $2, 0($3) mfhi $2 sra $2, $2, 10 TAG636: bne $2, $2, TAG637 mfhi $4 addiu $3, $4, 8 lui $3, 0 TAG637: srav $2, $3, $3 lhu $3, 0($3) lw $3, 0($2) mthi $3 TAG638: multu $3, $3 lh $4, 0($3) lw $2, 0($3) andi $1, $4, 10 TAG639: sb $1, 0($1) addiu $2, $1, 3 multu $2, $2 mfhi $3 TAG640: beq $3, $3, TAG641 mult $3, $3 beq $3, $3, TAG641 addu $4, $3, $3 TAG641: lui $4, 15 mflo $4 bgtz $4, TAG642 lui $1, 12 TAG642: lui $1, 15 mtlo $1 mthi $1 sll $0, $0, 0 TAG643: slti $4, $1, 8 xor $1, $4, $1 sll $0, $0, 0 sltiu $1, $1, 1 TAG644: addiu $3, $1, 13 subu $1, $1, $3 mflo $1 beq $1, $1, TAG645 TAG645: mflo $2 sll $0, $0, 0 bltz $4, TAG646 mtlo $2 TAG646: bgtz $4, TAG647 addiu $3, $4, 12 mthi $3 ori $4, $3, 1 TAG647: andi $2, $4, 5 lui $4, 11 bltz $2, TAG648 mtlo $4 TAG648: sll $0, $0, 0 beq $4, $4, TAG649 divu $4, $4 sh $4, 0($4) TAG649: multu $4, $4 lui $3, 0 divu $3, $4 blez $4, TAG650 TAG650: mult $3, $3 mtlo $3 sltiu $3, $3, 2 sltiu $1, $3, 10 TAG651: lb $4, 0($1) beq $1, $1, TAG652 sb $1, 0($1) mflo $3 TAG652: sra $2, $3, 7 or $1, $3, $3 multu $1, $2 bne $1, $3, TAG653 TAG653: mflo $1 bltz $1, TAG654 addi $1, $1, 5 sltiu $1, $1, 8 TAG654: sb $1, 0($1) slt $1, $1, $1 beq $1, $1, TAG655 mult $1, $1 TAG655: mfhi $4 mult $1, $1 lui $1, 15 and $3, $1, $4 TAG656: mult $3, $3 lbu $4, 0($3) lb $1, 0($3) beq $1, $1, TAG657 TAG657: lhu $2, 0($1) mfhi $4 sw $4, -256($2) lui $3, 14 TAG658: sll $0, $0, 0 mthi $3 sll $0, $0, 0 addu $1, $4, $4 TAG659: lb $4, 0($1) lui $4, 4 bgez $4, TAG660 mthi $4 TAG660: lui $3, 7 lui $1, 13 mfhi $3 mflo $2 TAG661: lui $3, 2 lui $3, 15 sll $0, $0, 0 sllv $2, $4, $2 TAG662: mult $2, $2 addu $3, $2, $2 multu $2, $3 blez $2, TAG663 TAG663: lui $2, 4 addu $2, $3, $2 sll $0, $0, 0 bne $3, $3, TAG664 TAG664: lui $3, 12 bgez $2, TAG665 mthi $2 bne $3, $3, TAG665 TAG665: divu $3, $3 mfhi $3 mthi $3 lui $1, 8 TAG666: addiu $4, $1, 2 sra $3, $1, 4 mthi $1 div $1, $1 TAG667: sll $0, $0, 0 sll $0, $0, 0 blez $3, TAG668 sll $0, $0, 0 TAG668: addiu $4, $1, 0 addiu $3, $4, 10 bne $1, $3, TAG669 mflo $4 TAG669: sra $4, $4, 6 lui $2, 10 beq $4, $4, TAG670 sll $0, $0, 0 TAG670: subu $1, $1, $1 sh $1, 0($1) ori $1, $1, 9 divu $1, $1 TAG671: subu $3, $1, $1 sb $1, 0($1) addiu $3, $3, 7 lbu $2, 0($1) TAG672: multu $2, $2 xor $2, $2, $2 beq $2, $2, TAG673 mfhi $3 TAG673: bgtz $3, TAG674 lui $2, 10 mult $3, $3 beq $2, $3, TAG674 TAG674: sll $0, $0, 0 mfhi $2 sltiu $4, $2, 12 xori $1, $2, 7 TAG675: srl $2, $1, 5 bltz $1, TAG676 mtlo $1 sw $1, 0($2) TAG676: multu $2, $2 sll $3, $2, 13 slti $2, $2, 1 and $2, $2, $2 TAG677: bltz $2, TAG678 lbu $2, 0($2) bne $2, $2, TAG678 lhu $3, 0($2) TAG678: blez $3, TAG679 multu $3, $3 andi $1, $3, 1 bltz $3, TAG679 TAG679: lb $3, 0($1) lui $1, 5 divu $1, $1 slti $2, $1, 4 TAG680: mfhi $3 mfhi $1 addi $3, $2, 11 multu $3, $2 TAG681: bne $3, $3, TAG682 srlv $3, $3, $3 bgtz $3, TAG682 lui $3, 4 TAG682: sll $0, $0, 0 blez $3, TAG683 sll $0, $0, 0 xor $2, $4, $4 TAG683: mult $2, $2 sw $2, 0($2) beq $2, $2, TAG684 multu $2, $2 TAG684: sltiu $4, $2, 12 nor $3, $4, $2 mflo $2 mtlo $3 TAG685: mthi $2 sb $2, 0($2) lb $1, 0($2) andi $4, $2, 12 TAG686: beq $4, $4, TAG687 lhu $4, 0($4) lui $3, 6 mflo $2 TAG687: multu $2, $2 sh $2, 0($2) mthi $2 ori $2, $2, 1 TAG688: mflo $2 bltz $2, TAG689 mthi $2 mflo $3 TAG689: lw $2, 0($3) slti $3, $2, 9 sb $3, 0($3) lbu $1, 0($3) TAG690: beq $1, $1, TAG691 divu $1, $1 mflo $2 sb $2, 0($2) TAG691: multu $2, $2 blez $2, TAG692 mtlo $2 lui $4, 0 TAG692: sllv $2, $4, $4 sh $4, 0($2) sh $4, 0($2) ori $2, $4, 8 TAG693: addu $3, $2, $2 sltu $1, $2, $2 blez $2, TAG694 mult $1, $1 TAG694: mult $1, $1 multu $1, $1 mult $1, $1 bgtz $1, TAG695 TAG695: addiu $3, $1, 0 lbu $2, 0($3) mthi $1 multu $2, $1 TAG696: sw $2, 0($2) bgtz $2, TAG697 mfhi $1 blez $2, TAG697 TAG697: lhu $3, 0($1) bne $1, $1, TAG698 multu $1, $3 mthi $1 TAG698: addu $1, $3, $3 sltiu $2, $1, 3 lui $1, 5 mfhi $3 TAG699: mtlo $3 bne $3, $3, TAG700 mtlo $3 lui $4, 11 TAG700: sll $0, $0, 0 mthi $4 lui $1, 1 bgtz $4, TAG701 TAG701: addiu $2, $1, 7 sll $0, $0, 0 sll $0, $0, 0 multu $2, $2 TAG702: bne $1, $1, TAG703 addiu $4, $1, 12 sll $0, $0, 0 blez $1, TAG703 TAG703: mtlo $4 mult $4, $4 addiu $2, $4, 10 bltz $2, TAG704 TAG704: lui $3, 6 srav $3, $3, $2 bltz $3, TAG705 mfhi $3 TAG705: addiu $3, $3, 15 lhu $3, 0($3) sw $3, 0($3) div $3, $3 TAG706: multu $3, $3 addu $4, $3, $3 bgez $4, TAG707 andi $1, $3, 15 TAG707: mthi $1 mflo $1 sb $1, -256($1) sb $1, -256($1) TAG708: sra $1, $1, 9 ori $3, $1, 8 lbu $2, 0($3) lui $2, 5 TAG709: mflo $4 multu $4, $4 div $2, $2 multu $2, $4 TAG710: multu $4, $4 sw $4, -256($4) sw $4, -256($4) sll $4, $4, 8 TAG711: divu $4, $4 div $4, $4 sll $0, $0, 0 mtlo $4 TAG712: beq $4, $4, TAG713 sll $0, $0, 0 bltz $4, TAG713 lbu $4, 0($4) TAG713: sll $0, $0, 0 mthi $4 mtlo $4 sll $0, $0, 0 TAG714: mtlo $4 divu $4, $4 beq $4, $4, TAG715 multu $4, $4 TAG715: sll $0, $0, 0 mthi $4 mtlo $4 bgtz $4, TAG716 TAG716: mfhi $3 addu $1, $3, $4 mfhi $4 beq $4, $4, TAG717 TAG717: sra $3, $4, 11 ori $2, $4, 3 sll $0, $0, 0 lb $2, 0($3) TAG718: slti $1, $2, 12 mtlo $1 div $1, $2 sb $1, 0($2) TAG719: ori $2, $1, 12 bgez $2, TAG720 lui $4, 11 mfhi $4 TAG720: mtlo $4 sll $0, $0, 0 mflo $2 sltiu $3, $4, 10 TAG721: mthi $3 multu $3, $3 mult $3, $3 lui $3, 3 TAG722: blez $3, TAG723 nor $1, $3, $3 lui $2, 13 multu $2, $3 TAG723: addiu $2, $2, 12 mtlo $2 mfhi $3 xori $4, $2, 0 TAG724: div $4, $4 sltiu $4, $4, 5 mfhi $3 sb $4, 0($4) TAG725: multu $3, $3 multu $3, $3 ori $3, $3, 0 srlv $1, $3, $3 TAG726: lui $1, 4 blez $1, TAG727 div $1, $1 sll $0, $0, 0 TAG727: mtlo $1 sll $0, $0, 0 divu $1, $1 subu $2, $1, $1 TAG728: bne $2, $2, TAG729 multu $2, $2 xor $1, $2, $2 srl $2, $2, 8 TAG729: sb $2, 0($2) bgez $2, TAG730 lui $1, 10 mtlo $2 TAG730: div $1, $1 beq $1, $1, TAG731 and $4, $1, $1 divu $1, $4 TAG731: mult $4, $4 sll $0, $0, 0 multu $4, $2 lui $2, 12 TAG732: addiu $2, $2, 3 mtlo $2 sll $0, $0, 0 lui $2, 10 TAG733: subu $2, $2, $2 lui $1, 8 bgez $2, TAG734 div $2, $1 TAG734: mfhi $3 bne $3, $3, TAG735 multu $3, $3 bltz $3, TAG735 TAG735: mtlo $3 mthi $3 mthi $3 bgez $3, TAG736 TAG736: lui $3, 2 mthi $3 mtlo $3 nor $3, $3, $3 TAG737: div $3, $3 bne $3, $3, TAG738 srav $3, $3, $3 sh $3, 1($3) TAG738: div $3, $3 lui $4, 11 sllv $4, $3, $4 divu $4, $4 TAG739: multu $4, $4 blez $4, TAG740 multu $4, $4 sw $4, 0($4) TAG740: mthi $4 lui $1, 5 bltz $4, TAG741 ori $3, $4, 10 TAG741: mtlo $3 bne $3, $3, TAG742 div $3, $3 div $3, $3 TAG742: sll $1, $3, 15 slt $2, $1, $1 ori $1, $1, 13 mfhi $4 TAG743: sb $4, 0($4) mult $4, $4 addi $3, $4, 3 ori $1, $3, 1 TAG744: mtlo $1 mult $1, $1 lui $4, 1 mtlo $4 TAG745: beq $4, $4, TAG746 sll $0, $0, 0 mflo $3 mthi $4 TAG746: xori $2, $3, 13 addiu $2, $2, 11 lui $2, 2 addiu $4, $2, 8 TAG747: mthi $4 beq $4, $4, TAG748 andi $4, $4, 13 lui $4, 14 TAG748: mthi $4 slt $2, $4, $4 lui $3, 7 xori $3, $4, 0 TAG749: bne $3, $3, TAG750 sllv $2, $3, $3 bne $3, $3, TAG750 lhu $1, 0($3) TAG750: nop nop test_end: beq $0, $0, test_end nop
;Ascending order ORG 0000H mov r3,#0AH ;moving count(n) of array(arr) dec r3 ;n=n-1 again: mov a,r3 mov r1,a ;storing number of remaining elements(m) in R1 mov dptr,#0D001H ;index(i) pointing at location of start of array up: movx a,@dptr mov r0,a ;fetch and store arr[i] inc dptr ;index(i) pointing to i+1 location in array movx a,@dptr mov r2,a ;fetch and store arr[i+1] clr c ;prepare for subtraction to compare subb a,r0 ;subtract arr[i+1]-arr[i] jnc skip ;skip if arr[i]<arr[i+1] mov a,r2 xch a,r0 movx @dptr,a dec dpl mov a,r0 movx @dptr,a ;exchange the elements if arr[i]>arr[i+1] inc dptr ;point back to default skip: djnz r1,up ;m=m-1, skip if 0 djnz r3,again ;n=n-1, skip if 0 END
#include "stdafx.h" #include "log.h" #include "../../core_dispatcher.h" #include "../../utils/gui_coll_helper.h" using namespace Ui; namespace { void log(const QString &type, const QString &area, const QString &text); } namespace Log { void trace(const QString& area, const QString& text) { static const QString type("trace"); log(type, area, text); } void info(const QString& area, const QString& text) { static const QString type("info"); log(type, area, text); } void warn(const QString& area, const QString& text) { static const QString type("warn"); log(type, area, text); } void error(const QString& area, const QString& text) { static const QString type("error"); log(type, area, text); } } QTextStream& operator <<(QTextStream &oss, const core::file_sharing_content_type arg) { using namespace core; assert(arg > file_sharing_content_type::min); assert(arg < file_sharing_content_type::max); switch (arg) { case file_sharing_content_type::gif: return (oss << "gif"); case file_sharing_content_type::image: return (oss << "image"); case file_sharing_content_type::ptt: return (oss << "ptt"); case file_sharing_content_type::snap_gif: return (oss << "snap_gif"); case file_sharing_content_type::snap_image: return (oss << "snap_image"); case file_sharing_content_type::snap_video: return (oss << "snap_video"); case file_sharing_content_type::undefined: return (oss << "undefined"); case file_sharing_content_type::video: return (oss << "video"); default: assert(!"unexpected file sharing content type"); } return (oss << "#unknown"); } QTextStream& operator <<(QTextStream &oss, const core::file_sharing_function arg) { using namespace core; assert(arg > file_sharing_function::min); assert(arg < file_sharing_function::max); switch(arg) { case file_sharing_function::check_local_copy_exists: oss << "check_local_copy_exists"; break; case file_sharing_function::download_file: oss << "download_file"; break; case file_sharing_function::download_file_metainfo: oss << "download_file_metainfo"; break; case file_sharing_function::download_preview_metainfo: oss << "download_preview_metainfo"; break; default: assert(!"unknown core::file_sharing_function value"); break; } return oss; } namespace { void log(const QString &type, const QString &area, const QString &text) { assert(!type.isEmpty()); assert(!area.isEmpty()); assert(!text.isEmpty()); gui_coll_helper collection(GetDispatcher()->create_collection(), true); collection.set_value_as_qstring("type", type); collection.set_value_as_qstring("area", area); collection.set_value_as_string("text", text.toUtf8().data(), text.toUtf8().size()); Ui::GetDispatcher()->post_message_to_core("log", collection.get()); } }
; namespace DebugStub ; optionally exclude this serial version ; All information relating to our serial usage should be documented in this comment. ; http://wiki.osdev.org/Serial_ports ; We do not use IRQs for debugstub serial. This is becuase DebugStub (DS) ; MUST be: ; - As simple as possible ; - Interact as minimal as possible wtih normal Cosmos code because ; the debugstub must *always* work even if the normal code is fubarred ; The serial port that is used for DS should be 'hidden' from Cosmos main ; so that Cosmos main pretends it does not exist. ; IRQs would create a clash/mix of code. ; This does make the serial code in DebugStub inefficient, but its well worth ; the benefits received by following these rules. ; Baud rate is set to 115200. Likely our code could not exceed this rate ; anyways the way it is written and there are compatibility issues on some ; hardware above this rate. ; We assume a minimum level of a 16550A, which should be no problem on any ; common hardware today. VMWare emulates the 16550A ; We do not handle flow control for outbound data (DS --> DC). ; The DebugConnector (DC, the code in the Visual Studio side) however is threaded ; and easily should be able to receive data faster than we can send it. ; Most things are transactional with data being sent only when asked for, but ; with tracing we do send a data directly. ; Currently there is no inbound flow control either (DC --> DS) ; For now we assume all commands in bound are 16 bytes or less to ensure ; that they fit in the FIFO. Commands in DS must wait for a command ID ACK ; before sending another command. ; See notes in ProcessCommand. ; http://www.nondot.org/sabre/os/files/Communication/ser_port.txt ; //! %ifndef Exclude_IOPort_Based_SerialInit %ifndef Exclude_IOPort_Based_SerialInit ; Todo Auto params ; Todo ebp frame ptr auto etc ; function InitSerial { DebugStub_InitSerial: ; Disable interrupts ; DX = 1 Mov DX, 0x1 ; AL = 0 Mov AL, 0x0 ; WriteRegister() Call DebugStub_WriteRegister ; Enable DLAB (set baud rate divisor) ; DX = 3 Mov DX, 0x3 ; AL = $80 Mov AL, 0x80 ; WriteRegister() Call DebugStub_WriteRegister ; 0x01, 0x00 - 115200 ; 0x02, 0x00 - 57600 ; 0x03, 0x00 - 38400 ; Set divisor (lo byte) ; DX = 0 Mov DX, 0x0 ; AL = $01 Mov AL, 0x1 ; WriteRegister() Call DebugStub_WriteRegister ; hi byte ; DX = 1 Mov DX, 0x1 ; AL = $00 Mov AL, 0x0 ; WriteRegister() Call DebugStub_WriteRegister ; 8N1 ; DX = 3 Mov DX, 0x3 ; AL = $03 Mov AL, 0x3 ; WriteRegister() Call DebugStub_WriteRegister ; Enable FIFO, clear them ; Set 14-byte threshold for IRQ. ; We dont use IRQ, but you cant set it to 0 ; either. IRQ is enabled/disabled separately ; DX = 2 Mov DX, 0x2 ; AL = $C7 Mov AL, 0xC7 ; WriteRegister() Call DebugStub_WriteRegister ; 0x20 AFE Automatic Flow control Enable - 16550 (VMWare uses 16550A) is most common and does not support it ; 0x02 RTS ; 0x01 DTR ; Send 0x03 if no AFE ; DX = 4 Mov DX, 0x4 ; AL = $03 Mov AL, 0x3 ; WriteRegister() Call DebugStub_WriteRegister ; } ; Modifies: AL, DX ; function ComReadAL { DebugStub_ComReadAL: ; DX = 5 Mov DX, 0x5 ; Wait: DebugStub_Wait: ; ReadRegister() Call DebugStub_ReadRegister ; AL test $01 Test AL, 0x1 ; if 0 goto Wait ; DX = 0 Mov DX, 0x0 ; ReadRegister() Call DebugStub_ReadRegister ; } ; function ComWrite8 { DebugStub_ComWrite8: ; Input: ESI ; Output: None ; Modifies: EAX, EDX ; Sends byte at [ESI] to com port and does esi + 1 ; This sucks to use the stack, but x86 can only read and write ports from AL and ; we need to read a port before we can write out the value to another port. ; The overhead is a lot, but compared to the speed of the serial and the fact ; that we wait on the serial port anyways, its a wash. ; This could be changed to use interrupts, but that then complicates ; the code and causes interaction with other code. DebugStub should be ; as isolated as possible from any other code. ; Sucks again to use DX just for this, but x86 only supports ; 8 bit address for literals on ports ; DX = 5 Mov DX, 0x5 ; Wait for serial port to be ready ; Bit 5 (0x20) test for Transmit Holding Register to be empty. ; Wait: DebugStub_Wait: ; ReadRegister() Call DebugStub_ReadRegister ; AL test $20 Test AL, 0x20 ; if 0 goto Wait ; Set address of port ; DX = 0 Mov DX, 0x0 ; Get byte to send ; AL = [ESI] Mov AL, BYTE [ESI] ; Send the byte ; WriteRegister() Call DebugStub_WriteRegister ; ESI++ Inc ESI ; } ; //! %endif %endif
; A288998: Positions of 0 in A288997; complement of A288999. ; 1,2,4,5,6,8,9,11,12,13,15,16,18,19,21,22,23,25,26,28,29,30,32,33,35,36,38,39,40,42,43,45,46,47,49,50,52,53,54,56,57,59,60,62,63,64,66,67,69,70,71,73,74,76,77,79,80,81,83,84,86,87,88,90,91,93,94,95,97,98,100,101,103,104,105,107,108,110,111,112,114,115,117,118,120,121,122,124,125,127,128,129,131,132,134,135,137,138,139,141 add $0,3 mov $1,$0 pow $1,2 lpb $1 sub $1,$0 add $0,1 sub $1,$0 lpe sub $0,3
; ; Fast background save ; ; ZX Spectrum version (speeded up with a row table) ; ; $Id: bksave.asm,v 1.2 2016/10/31 07:06:49 stefano Exp $ ; SECTION code_clib PUBLIC bksave PUBLIC _bksave EXTERN zx_rowtab EXTERN p3_peek .bksave ._bksave push ix ld hl,4 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y __gfx_coords ld (ix+2),d ld (ix+3),e ld a,d ld d,0 ld hl,zx_rowtab add hl,de add hl,de ld (actrow),hl ; save row table position ld e,(hl) inc hl ld h,(hl) ld l,e ld e,a srl e srl e srl e ld (actcol),de add hl,de ld a,(ix+0) ld b,(ix+1) dec a srl a srl a srl a inc a inc a ; INT ((Xsize-1)/8+2) ld (rbytes+1),a .bksaves push bc .rbytes ld b,0 .rloop push bc call p3_peek pop bc ;ld a,(hl) ld (ix+4),a inc hl inc ix djnz rloop ; --------- ld hl,(actrow) inc hl inc hl ld (actrow),hl ld b,(hl) inc hl ld h,(hl) ld l,b ld bc,(actcol) add hl,bc ; --------- pop bc djnz bksaves pop ix ret SECTION bss_clib .actrow defw 0 .actcol defw 0
; ; ; This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. ; ; Copyright 2007-2019 Broadcom Inc. All rights reserved. ; ; ;Here is an example program for programming the LEDs on the 5605. ; ;The situation is this: ; ; 26 ports (port 0-25) each have three LEDs. ; led 0: RX ; led 1: TX ; led 2: COLL ; ; The scan out order is RX, TX, COLL status for port 0, then ; for port 1, ... ; ; ;-------------------------- start of program -------------------------- begin: ld A,0 ; start with port 0 ld (portnum),A portloop: port A ; specify which port we're dealing with pushst RX pack ; send to output buffer pushst TX pack ; send to output buffer pushst COLL pack ; send to output buffer inc (portnum) ld A,(portnum) cmp A,26 jnz portloop send 78 ; send 26*3 LED pulses and halt ; data storage portnum equ 0x7F ; temp to hold which port we're working on ; symbolic labels ; this gives symbolic names to the various bits of the port status fields RX equ 0x0 ; received packet TX equ 0x1 ; transmitted packet COLL equ 0x2 ; collision indicator SPEED_C equ 0x3 ; 100 Mbps SPEED_M equ 0x4 ; 1000 Mbps DUPLEX equ 0x5 ; half/full duplex FLOW equ 0x6 ; flow control capable LINKUP equ 0x7 ; link down/up status LINKEN equ 0x8 ; link disabled/enabled status ;-------------------------- end of program -------------------------- ; ;This program is 24 bytes in length and is only slightly more complicated ;than Example #1.
; ba_priority_queue_t * ; ba_priority_queue_init(void *p, void *data, size_t capacity, int (*compar)(const void *, const void *)) SECTION code_clib SECTION code_adt_ba_priority_queue PUBLIC ba_priority_queue_init EXTERN asm_ba_priority_queue_init ba_priority_queue_init: pop af pop ix pop bc pop de pop hl push hl push de push bc push hl push af jp asm_ba_priority_queue_init ; SDCC bridge for Classic IF __CLASSIC PUBLIC _ba_priority_queue_init defc _ba_priority_queue_init = ba_priority_queue_init ENDIF
addi x10, x0, 10 addi x11, x0, -2 addi x12, x0, 34 addi x13, x0, 37 addi x14, x0, 4 sw x10, 0, x0 # memoria[0..3] = 10 sw x13, 4, x0 # memoria[4..7] = 37 amomaxu.w x20, x11, x0 amomaxu.w x21, x12, x14
#include "widgets/PianoWidget.hpp" #include <QPainter> #include <QScrollBar> constexpr int KEYINDEX_NULL = -1; constexpr int N_OCTAVES = 7; constexpr int N_WHITEKEYS = 7; constexpr int N_BLACKKEYS = 5; // IMPORTANT! these widths must match the widths of the key images constexpr int WKEY_WIDTH = 12; constexpr int BKEY_WIDTH = 8; constexpr int BKEY_HEIGHT = 42; constexpr int PIANO_WIDTH = N_OCTAVES * N_WHITEKEYS * WKEY_WIDTH; constexpr int PIANO_HEIGHT = 64; constexpr int BKEY_WIDTH_HALF = BKEY_WIDTH / 2; // white key index: 0..6 ==> C, D, E, F, G, A, B // black key index: 0..4 ==> C#, D#, F#, G#, A# // lookup table gets the black key to the left of the given white key index // for the right of a white key, increment the index by 1 static const int BLACKKEY_LEFTOF[] = { KEYINDEX_NULL, // C -> none 0, // D -> C# 1, // E -> D# KEYINDEX_NULL, // F -> none 2, // G -> F# 3, // A -> G# 4, // B -> A# }; struct KeyPaintInfo { bool isBlack; int xoffset; }; static const KeyPaintInfo KEY_INFO[] = { { false, 0 }, // C { true, WKEY_WIDTH - BKEY_WIDTH_HALF }, // C# { false, WKEY_WIDTH * 1 }, // D { true, WKEY_WIDTH * 2 - BKEY_WIDTH_HALF }, // D# { false, WKEY_WIDTH * 2 }, // E { false, WKEY_WIDTH * 3 }, // F { true, WKEY_WIDTH * 4 - BKEY_WIDTH_HALF }, // F# { false, WKEY_WIDTH * 4 }, // G { true, WKEY_WIDTH * 5 - BKEY_WIDTH_HALF }, // G# { false, WKEY_WIDTH * 5 }, // A { true, WKEY_WIDTH * 6 - BKEY_WIDTH_HALF }, // A# { false, WKEY_WIDTH * 6 }, // B }; // table to convert a white key index to a trackerboy note static const trackerboy::Note WHITEKEY_TO_NOTE[] = { trackerboy::NOTE_C, trackerboy::NOTE_D, trackerboy::NOTE_E, trackerboy::NOTE_F, trackerboy::NOTE_G, trackerboy::NOTE_A, trackerboy::NOTE_B }; // table converts a black key index to a trackerboy note static const trackerboy::Note BLACKKEY_TO_NOTE[] = { trackerboy::NOTE_Db, // C# trackerboy::NOTE_Eb, // D# trackerboy::NOTE_Gb, // F# trackerboy::NOTE_Ab, // G# trackerboy::NOTE_Bb // A# }; std::optional<PianoWidget::Pixmaps> PianoWidget::mPixmaps; PianoWidget::PianoWidget(PianoInput const& input, QWidget *parent) : QWidget(parent), mIsKeyDown(false), mNote(trackerboy::NOTE_C), mInput(input), mLastKeyPressed(Qt::Key_unknown) { setFocusPolicy(Qt::StrongFocus); if (!mPixmaps) { auto &pixmaps = mPixmaps.emplace(); pixmaps.whiteKeyDown.load(QStringLiteral(":/images/whitekey_down.png")); pixmaps.blackKeyDown.load(QStringLiteral(":/images/blackkey_down.png")); pixmaps.pianoWhitePix.load(QStringLiteral(":/images/piano_whitekeys.png")); pixmaps.pianoBlackPix.load(QStringLiteral(":/images/piano_blackkeys.png")); } setFixedWidth(PIANO_WIDTH); setFixedHeight(PIANO_HEIGHT); } void PianoWidget::play(int note) { mNote = note; update(); if (mIsKeyDown) { emit keyChange(mNote); } else { mIsKeyDown = true; emit keyDown(mNote); } } void PianoWidget::release() { mIsKeyDown = false; update(); emit keyUp(); } void PianoWidget::midiNoteOn(int note) { if (isEnabled()) { play(note); } } void PianoWidget::midiNoteOff() { if (isEnabled()) { release(); } } void PianoWidget::focusOutEvent(QFocusEvent *evt) { Q_UNUSED(evt); if (mIsKeyDown) { release(); mLastKeyPressed = Qt::Key_unknown; } } void PianoWidget::keyPressEvent(QKeyEvent *evt) { if (!evt->isAutoRepeat()) { auto key = evt->key(); auto note = mInput.keyToNote(key); if (note && *note <= trackerboy::NOTE_LAST) { mLastKeyPressed = key; play(note.value()); return; } } QWidget::keyPressEvent(evt); } void PianoWidget::keyReleaseEvent(QKeyEvent *evt) { if (!evt->isAutoRepeat()) { auto key = evt->key(); auto note = mInput.keyToNote(key); if (note && key == mLastKeyPressed) { release(); return; } } QWidget::keyReleaseEvent(evt); } void PianoWidget::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { play(getNoteFromMouse(event->x(), event->y())); } } void PianoWidget::mouseReleaseEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { release(); } } void PianoWidget::mouseMoveEvent(QMouseEvent *event) { if (!event->buttons().testFlag(Qt::LeftButton)) { return; } int x = event->x(); int y = event->y(); if (rect().contains(x, y)) { auto note = getNoteFromMouse(x, y); if (!mIsKeyDown || note != mNote) { play(note); } } else { release(); } } void PianoWidget::paintEvent(QPaintEvent *event) { (void)event; int octaveOffset = 0; KeyPaintInfo keyInfo{ 0 }; if (mIsKeyDown) { octaveOffset = mNote / 12; int keyInOctave = mNote % 12; octaveOffset *= N_WHITEKEYS * WKEY_WIDTH; keyInfo = KEY_INFO[keyInOctave]; } auto &pixmaps = mPixmaps.value(); QPainter painter(this); painter.drawPixmap(0, 0, pixmaps.pianoWhitePix); if (mIsKeyDown && !keyInfo.isBlack) { painter.drawPixmap(octaveOffset + keyInfo.xoffset, 0, pixmaps.whiteKeyDown); } painter.drawPixmap(0, 0, pixmaps.pianoBlackPix); if (mIsKeyDown && keyInfo.isBlack) { painter.drawPixmap(octaveOffset + keyInfo.xoffset, 0, pixmaps.blackKeyDown); } if (!isEnabled()) { painter.setCompositionMode(QPainter::CompositionMode_Plus); painter.fillRect(rect(), QColor(128, 128, 128)); } } int PianoWidget::getNoteFromMouse(int x, int y) { bool isBlack = false; int wkeyInOctave = x / WKEY_WIDTH; int octave = wkeyInOctave / N_WHITEKEYS; wkeyInOctave %= N_WHITEKEYS; int bkeyInOctave = 0; if (y < BKEY_HEIGHT) { // check if the mouse is over a black key bkeyInOctave = BLACKKEY_LEFTOF[wkeyInOctave]; int wkeyx = x % WKEY_WIDTH; if (bkeyInOctave != KEYINDEX_NULL && wkeyx <= BKEY_WIDTH_HALF) { // mouse is over the black key to the left of the white key isBlack = true; } else { // now check the right // get the black key to the left of the next white key bkeyInOctave = BLACKKEY_LEFTOF[wkeyInOctave == N_WHITEKEYS - 1 ? 0 : wkeyInOctave + 1]; if (bkeyInOctave != KEYINDEX_NULL && wkeyx >= WKEY_WIDTH - BKEY_WIDTH_HALF) { isBlack = true; } } } int note = octave * 12; if (isBlack) { note += BLACKKEY_TO_NOTE[bkeyInOctave]; } else { note += WHITEKEY_TO_NOTE[wkeyInOctave]; } return note; }
; A147560: a(n) = 4*A046162(n+1). ; 0,4,16,12,64,100,48,196,256,108,400,484,192,676,784,300,1024,1156,432,1444,1600,588,1936,2116,768,2500,2704,972,3136,3364,1200,3844,4096,1452,4624,4900,1728,5476,5776,2028,6400,6724,2352,7396,7744,2700,8464 mov $1,$0 gcd $0,3 pow $1,2 div $1,$0 mul $1,4
SECTION code_clib SECTION code_fp_math48 PUBLIC asm_asinh EXTERN am48_asinh defc asm_asinh = am48_asinh
%define org_start 7c00h boot: org org_start mov ax, cs mov ds, ax mov es, ax call screenClean call stringPrint jmp $ screenClean: push bp mov bp, sp pusha mov ah, 07h ; tells BIOS to scroll down window mov al, 00h ; clear entire window mov bh, 07h ; white on black mov cx, 00h ; specifies top left of screen as (0,0) mov dh, 18h ; 18h = 24 rows of chars mov dl, 4fh ; 4fh = 79 cols of chars int 10h ; calls video interrupt popa mov sp, bp pop bp ret stringPrint: mov bp, helloString mov cx, [helloStringSize] mov ax, 01301h mov bx, 000ch mov dx, 0000h int 10h; ret helloString: db "Hello, world!" helloStringSize: db $-helloString fill: times 510-($-$$) db 0; dw 0xaa55 ; MBR signature
;------------------------------------------------------------------------------- ; dabort.asm ; ; Copyright (C) 2009-2016 Texas Instruments Incorporated - www.ti.com ; ; ; 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 Texas Instruments Incorporated 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. ; ; ; .text .arm ;------------------------------------------------------------------------------- ; Run Memory Test .ref custom_dabort .def _dabort .asmfunc _dabort stmfd r13!, {r0 - r12, lr}; push registers and link register on to stack ldr r12, esmsr3 ; ESM Group3 status register ldr r0, [r12] tst r0, #0x8 ; check if bit 3 is set, this indicates uncorrectable ECC error on B0TCM bne ramErrorFound tst r0, #0x20 ; check if bit 5 is set, this indicates uncorrectable ECC error on B1TCM bne ramErrorFound2 noRAMerror tst r0, #0x80 ; check if bit 7 is set, this indicates uncorrectable ECC error on ATCM bne flashErrorFound bl custom_dabort ; custom data abort handler required ; If this custom handler is written in assembly, all registers used in the routine ; and the link register must be saved on to the stack upon entry, and restored before ; return from the routine. ldmfd r13!, {r0 - r12, lr}; pop registers and link register from stack subs pc, lr, #8 ; restore state of CPU when abort occurred, and branch back to instruction that was aborted ramErrorFound ldr r1, ramctrl ; RAM control register for B0TCM TCRAMW ldr r2, [r1] tst r2, #0x100 ; check if bit 8 is set in RAMCTRL, this indicates ECC memory write is enabled beq ramErrorReal mov r2, #0x20 str r2, [r1, #0x10] ; clear RAM error status register mov r2, #0x08 str r2, [r12] ; clear ESM group3 channel3 flag for uncorrectable RAM ECC errors mov r2, #5 str r2, [r12, #0x18] ; The nERROR pin will become inactive once the LTC counter expires ldmfd r13!, {r0 - r12, lr} subs pc, lr, #4 ; branch to instruction after the one that caused the abort ; this is the case because the data abort was caused intentionally ; and we do not want to cause the same data abort again. ramErrorFound2 ldr r1, ram2ctrl ; RAM control register for B1TCM TCRAMW ldr r2, [r1] tst r2, #0x100 ; check if bit 8 is set in RAMCTRL, this indicates ECC memory write is enabled beq ramErrorReal mov r2, #0x20 str r2, [r1, #0x10] ; clear RAM error status register mov r2, #0x20 str r2, [r12] ; clear ESM group3 flags channel5 flag for uncorrectable RAM ECC errors mov r2, #5 str r2, [r12, #0x18] ; The nERROR pin will become inactive once the LTC counter expires ldmfd r13!, {r0 - r12, lr} subs pc, lr, #4 ; branch to instruction after the one that caused the abort ; this is the case because the data abort was caused intentionally ; and we do not want to cause the same data abort again. ramErrorReal b ramErrorReal ; branch here forever as continuing operation is not recommended flashErrorFound ldr r1, flashbase ldr r2, [r1, #0x6C] ; read FDIAGCTRL register mov r2, r2, lsr #16 tst r2, #5 ; check if bits 19:16 are 5, this indicates diagnostic mode is enabled beq flashErrorReal mov r2, #1 mov r2, r2, lsl #8 str r2, [r1, #0x1C] ; clear FEDACSTATUS error flag mov r2, #0x80 str r2, [r12] ; clear ESM group3 flag for uncorrectable flash ECC error mov r2, #5 str r2, [r12, #0x18] ; The nERROR pin will become inactive once the LTC counter expires ldmfd r13!, {r0 - r12, lr} subs pc, lr, #4 ; branch to instruction after the one that caused the abort ; this is the case because the data abort was caused intentionally ; and we do not want to cause the same data abort again. flashErrorReal b flashErrorReal ; branch here forever as continuing operation is not recommended esmsr3 .word 0xFFFFF520 ramctrl .word 0xFFFFF800 ram2ctrl .word 0xFFFFF900 ram1errstat .word 0xFFFFF810 ram2errstat .word 0xFFFFF910 flashbase .word 0xFFF87000 .endasmfunc
; A045650: Numbers that cannot be expressed as k + floor(log(k)) where k is an integer. ; 3,9,23,58,153,409,1103,2988,8112,22036,59885,162766,442426,1202618,3269032,8886126,24154969,65659987,178482319,485165215,1318815755,3584912868,9744803469,26489122153,72004899362,195729609454 add $0,1 mov $2,1 mov $3,$0 mul $3,5 lpb $3 mul $1,$0 mul $2,$3 add $1,$2 div $1,$0 div $2,$0 sub $3,1 max $3,1 lpe mul $1,$0 div $1,$2 add $1,1 add $1,$0 mov $0,$1
; A060161: a(n) = 2^n - 1 + 2*Fibonacci(n-1). ; 1,5,9,19,37,73,143,281,553,1091,2157,4273,8479,16849,33521,66755,133045,265337,529455,1056937,2110681,4216195,8424029,16834529,33647167,67258913,134460513,268828291,537506533,1074770281,2149147727,4297659833,8594291209,17186918339,34371144141,68737931665,137468814175,274926222577,549833990225,1099638119747,2199227923861,4398377671385,8796628850799,17593053033289,35185774906297,70371013984003,140741160979133,281480919140801,562959568475263,1125915464326721,2251824986223297,4503640357392643,9007265157301189,18014505142064329,36028969554106511,72057873205652825,144115639778723305,288231107022304067,576461934876883245,1152923418050899057,2305846105231205791,4611691027888951825,9223380142333851569,18446757188650191299,36893509367838818677,73787010630198561593,147574008145456483503,295147995070493251561,590295955805626147993,1180591856055472225411,2361183622219804025117,4722367098992687553953,9444733962647314185919,18889467544509646953569,37778934472896251566881,75557867948884479375235,151115734284737892651685,302231465959536695446057,604462927696103234936015,1208925848559297224058617,2417851686062715046347721,4835703354236641445112515,9671406679528614840872589,19342813312223772984809809,38685626548669421223331807,77371252974727261003440433,154742505751064815817369873,309485011181128344002005571,618970021842865694181765973,1237940042845339106908552601,2475880084330894938539880687,4951760166461614320347557513,9903520329363269808685686649,19807040652966405228629741059,39614081296612717236508421501,79228162578145206863524150145,158456325131890092896804546815,316912650224299637353872647297,633825300384718405437765094785,1267650600666075393165813543427 mov $3,$0 mov $5,2 lpb $5 mov $0,$3 sub $5,1 add $0,$5 trn $0,1 seq $0,101353 ; a(n) = Sum_{k=0..n} (2^k + Fibonacci(k)). mov $2,$5 mul $2,$0 add $4,$2 lpe min $3,1 mul $3,$0 mov $0,$4 sub $0,$3 sub $0,1 mul $0,2 add $0,1
SECTION "Evolutions and Attacks 3", ROMX EvosAttacksPointers3:: dw CoinpurEvosAttacks dw KatuEvosAttacks dw AdbarstorkEvosAttacks dw PupperonEvosAttacks dw BipullaEvosAttacks dw MoibelleEvoAttacks CoinpurEvosAttacks: dbbw EVOLVE_HAPPINESS, TR_MORNDAY, MEOWTH db 0 ; no more evolutions dbw 1, SCRATCH dbw 1, GROWL dbw 7, BITE dbw 13, PAY_DAY dbw 19, FURY_SWIPES dbw 25, FAINT_ATTACK dbw 31, COIN_HURL dbw 37, SCREECH dbw 43, SLASH db 0 ; no more level-up moves KatuEvosAttacks: dbbw EVOLVE_ITEM, HEART_STONE, XATU db 0 ; no more evolutions dbw 1, PECK dbw 1, CONFUSION dbw 5, NIGHT_SHADE dbw 10, NIGHT_SHADE dbw 20, TELEPORT dbw 26, QUICK_ATTACK dbw 30, PSYBEAM dbw 35, PURSUIT dbw 40, FUTURE_SIGHT dbw 45, CONFUSE_RAY dbw 50, WING_ATTACK ; put Synchronoise in this slot for final dbw 53, DRILL_PECK dbw 61, PSYCHIC_M db 0 ; no more level-up moves AdbarstorkEvosAttacks: db 0; no more evolutions dbw 1, PECK dbw 5, GROWL dbw 9, FURY_ATTACK dbw 12, WHIRLWIND dbw 19, TWISTER dbw 25, WING_ATTACK dbw 31, SCREECH dbw 39, MIRROR_MOVE dbw 45, DRILL_PECK dbw 52, FLY db 0 ; no more level-up moves PupperonEvosAttacks: db EVOLVE_HAPPINESS, TR_ANYTIME, GROWLITHE db 0 ; no more evolutions db 1, BITE db 1, CHARM db 6, EMBER db 12, LEER db 17, FLAME_WHEEL db 23, REVERSAL db 28, TAKE_DOWN db 34, FLAMETHROWER db 39, AGILITY db 45, CRUNCH db 50, OUTRAGE db 56, FIRE_BLAST db 0 ; no more level-up moves BipullaEvosAttacks: db EVOLVE_LEVEL, 17, GIRAFARIG db 0 ; no more evolutions dbw 1, TACKLE dbw 1, GROWL dbw 5, LICK dbw 9, CONFUSE_RAY db 0 ; no more level-up moves MoibelleEvoAttacks: db 0 ;no more evolutions db 1, SCRATCH db 1, GROWL db 7, PURSUIT db 12, BITE db 18, COIN_HURL db 23, FURY_SWIPES db 27, HEAL_BELL db 30, FAINT_ATTACK db 34, LOVELY_KISS db 34, SWEET_KISS db 40, CONFUSE_RAY db 45, ATTRACT db 50, SLASH db 0 ; no more level-up moves
//qbr echo this should print out 1 lines //qbr echo 1 //nothing done on this line //qbr echo 2 //qbr echo you should't see this, because a non-comment line exists in the code //preceding it. int main(int, char *[]) { //qbr echo you should't see this return 0; } //qbr echo you should't see this
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r15 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0x180e4, %rax nop nop nop nop inc %r10 movb (%rax), %r15b nop nop nop inc %rcx lea addresses_WT_ht+0x1e094, %rsi dec %rbp mov $0x6162636465666768, %rcx movq %rcx, %xmm5 vmovups %ymm5, (%rsi) nop nop xor %rcx, %rcx lea addresses_D_ht+0xa494, %rsi lea addresses_UC_ht+0x1a774, %rdi add $54977, %rdx mov $99, %rcx rep movsq nop nop nop nop nop dec %r15 lea addresses_WT_ht+0x18090, %rax nop nop nop cmp $14398, %rbp movb $0x61, (%rax) nop nop nop nop add $31888, %r10 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r15 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r14 push %rcx push %rdx // Faulty Load lea addresses_WT+0x1c94, %r11 nop nop nop nop nop cmp %r12, %r12 mov (%r11), %edx lea oracles, %r11 and $0xff, %rdx shlq $12, %rdx mov (%r11,%rdx,1), %rdx pop %rdx pop %rcx pop %r14 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': True, 'type': 'addresses_WT'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 10, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
Origin 4x0000 SEGMENT CodeSegment: ; wb -> ex SR1 ADD R0, R0, 1 ADD R0, R0, 1 AND R1, R1, 0 NOP NOP NOP NOP NOP NOP NOP ; wb -> ex SR2 ADD R1, R1, 5 ADD R2, R0, R1 NOP NOP NOP NOP NOP NOP NOP HALT: BRnzp HALT NOP NOP NOP NOP NOP NOP NOP
; A013835: a(n) = 5^(5*n + 2). ; 25,78125,244140625,762939453125,2384185791015625,7450580596923828125,23283064365386962890625,72759576141834259033203125,227373675443232059478759765625,710542735760100185871124267578125 mul $0,5 add $0,2 mov $1,5 pow $1,$0 mov $0,$1
; A161714: a(n) = 28*n + 1. ; 1,29,57,85,113,141,169,197,225,253,281,309,337,365,393,421,449,477,505,533,561,589,617,645,673,701,729,757,785,813,841,869,897,925,953,981,1009,1037,1065,1093,1121,1149,1177,1205,1233,1261,1289,1317,1345,1373,1401,1429,1457,1485,1513,1541,1569,1597,1625,1653,1681,1709,1737,1765,1793,1821,1849,1877,1905,1933,1961,1989,2017,2045,2073,2101,2129,2157,2185,2213,2241,2269,2297,2325,2353,2381,2409,2437,2465,2493,2521,2549,2577,2605,2633,2661,2689,2717,2745,2773 mul $0,28 add $0,1
<% import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft %> <%docstring>fstatfs64(fildes, buf) -> str Invokes the syscall fstatfs64. See 'man 2 fstatfs64' for more information. Arguments: fildes(int): fildes buf(statfs64*): buf Returns: int </%docstring> <%page args="fildes=0, buf=0"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack regs = abi.register_arguments[1:] allregs = pwnlib.shellcraft.registers.current() can_pushstr = [] can_pushstr_array = [] argument_names = ['fildes', 'buf'] argument_values = [fildes, buf] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() stack_arguments = collections.OrderedDict() string_arguments = dict() dict_arguments = dict() array_arguments = dict() syscall_repr = [] for name, arg in zip(argument_names, argument_values): if arg is not None: syscall_repr.append('%s=%r' % (name, arg)) # If the argument itself (input) is a register... if arg in allregs: index = argument_names.index(name) if index < len(regs): target = regs[index] register_arguments[target] = arg elif arg is not None: stack_arguments[index] = arg # The argument is not a register. It is a string value, and we # are expecting a string value elif name in can_pushstr and isinstance(arg, str): string_arguments[name] = arg # The argument is not a register. It is a dictionary, and we are # expecting K:V paris. elif name in can_pushstr_array and isinstance(arg, dict): array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] # The arguent is not a register. It is a list, and we are expecting # a list of arguments. elif name in can_pushstr_array and isinstance(arg, (list, tuple)): array_arguments[name] = arg # The argument is not a register, string, dict, or list. # It could be a constant string ('O_RDONLY') for an integer argument, # an actual integer value, or a constant. else: index = argument_names.index(name) if index < len(regs): target = regs[index] register_arguments[target] = arg elif arg is not None: stack_arguments[target] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. for syscall in ['SYS_fstatfs64']: if hasattr(pwnlib.constants, syscall): break else: raise Exception("Could not locate any syscalls: %r" % syscalls) %> /* fstatfs64(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): ${pwnlib.shellcraft.pushstr(arg, append_null=('\x00' not in arg))} ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} %endfor %for name, arg in array_arguments.items(): ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} %endfor %for name, arg in stack_arguments.items(): ${pwnlib.shellcraft.push(arg)} %endfor ${pwnlib.shellcraft.setregs(register_arguments)} ${pwnlib.shellcraft.syscall(syscall)}
; A006325: 4-dimensional analog of centered polygonal numbers. ; 0,0,1,7,26,70,155,301,532,876,1365,2035,2926,4082,5551,7385,9640,12376,15657,19551,24130,29470,35651,42757,50876,60100,70525,82251,95382,110026,126295,144305,164176,186032,210001,236215,264810,295926,329707,366301,405860,448540,494501,543907,596926,653730,714495,779401,848632,922376,1000825,1084175,1172626,1266382,1365651,1470645,1581580,1698676,1822157,1952251,2089190,2233210,2384551,2543457,2710176,2884960,3068065,3259751,3460282,3669926,3888955,4117645,4356276,4605132,4864501,5134675,5415950 bin $0,2 mul $0,-2 bin $0,2 div $0,3
Route18GateUpstairsObject: db $a ; border block db $1 ; warps db $7, $7, $4, ROUTE_18_GATE_1F db $2 ; signs db $2, $1, $2 ; Route18GateUpstairsText2 db $2, $6, $3 ; Route18GateUpstairsText3 db $1 ; objects object SPRITE_COOK, $4, $2, WALK, $2, $1 ; person ; warp-to EVENT_DISP ROUTE_18_GATE_2F_WIDTH, $7, $7 ; ROUTE_18_GATE_1F
; ; Z88dk Generic Floating Point Math Library ; ; ; $Id: fsub.asm,v 1.1 2008/07/27 21:44:57 aralbrec Exp $: XLIB fsub LIB minusfa LIB fadd .fsub call minusfa jp fadd
; A245467: a(n) = ( 4*n^2 - 2*n + 1 - (2*n^2 - 6*n + 1) * (-1)^n )/16. ; 0,0,1,2,3,7,6,15,10,26,15,40,21,57,28,77,36,100,45,126,55,155,66,187,78,222,91,260,105,301,120,345,136,392,153,442,171,495,190,551,210,610,231,672,253,737,276,805,300,876,325,950,351,1027,378,1107,406,1190,435,1276,465,1365,496,1457,528,1552,561,1650,595,1751,630,1855,666,1962,703,2072,741,2185,780,2301,820,2420,861,2542,903,2667,946,2795,990,2926,1035,3060,1081,3197,1128,3337,1176,3480,1225,3626 mov $1,$0 div $1,2 sub $2,$1 sub $1,$2 bin $0,$1 sub $0,$2 mul $1,$0 mov $0,$1 div $0,4
; A177099: a(n) = 81*n^2 + 2*n. ; 83,328,735,1304,2035,2928,3983,5200,6579,8120,9823,11688,13715,15904,18255,20768,23443,26280,29279,32440,35763,39248,42895,46704,50675,54808,59103,63560,68179,72960,77903,83008,88275,93704,99295,105048,110963,117040,123279,129680,136243,142968,149855,156904,164115,171488,179023,186720,194579,202600,210783,219128,227635,236304,245135,254128,263283,272600,282079,291720,301523,311488,321615,331904,342355,352968,363743,374680,385779,397040,408463,420048,431795,443704,455775,468008,480403,492960 mov $1,$0 mul $0,9 pow $0,2 add $0,83 mov $2,$1 mul $2,164 add $0,$2
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r14 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_UC_ht+0x32a2, %r10 and %r12, %r12 movw $0x6162, (%r10) xor $29217, %rbp lea addresses_WC_ht+0x13f52, %rsi lea addresses_normal_ht+0xf422, %rdi nop nop nop nop inc %rbx mov $75, %rcx rep movsq add $27449, %rdi lea addresses_UC_ht+0xf42, %rsi lea addresses_normal_ht+0x1a20e, %rdi nop nop cmp %rbx, %rbx mov $64, %rcx rep movsw nop cmp $16797, %rdi lea addresses_A_ht+0x15190, %r12 nop nop nop nop inc %rsi movb (%r12), %bl nop nop cmp $38363, %r10 lea addresses_WT_ht+0xfa52, %rsi nop nop nop nop cmp $58362, %r12 mov $0x6162636465666768, %r10 movq %r10, %xmm5 movups %xmm5, (%rsi) nop nop nop nop nop add %r12, %r12 lea addresses_WC_ht+0x18552, %r10 nop nop nop nop nop and $27910, %r14 movw $0x6162, (%r10) nop nop nop nop nop and $34560, %rbx lea addresses_UC_ht+0x1688a, %rsi lea addresses_WT_ht+0xffd2, %rdi nop nop nop xor $50586, %rbp mov $66, %rcx rep movsb nop nop nop nop nop sub %r14, %r14 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r14 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r9 push %rax push %rbp push %rcx // Store lea addresses_WT+0x19ef2, %r14 xor $49709, %rbp mov $0x5152535455565758, %r9 movq %r9, %xmm0 movups %xmm0, (%r14) nop nop nop nop nop add %r14, %r14 // Faulty Load lea addresses_PSE+0x18b52, %rbp clflush (%rbp) nop nop nop nop nop and $41933, %rax movntdqa (%rbp), %xmm4 vpextrq $1, %xmm4, %rcx lea oracles, %rbp and $0xff, %rcx shlq $12, %rcx mov (%rbp,%rcx,1), %rcx pop %rcx pop %rbp pop %rax pop %r9 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_PSE', 'same': True, 'size': 16, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'00': 15635, '48': 6194} 00 00 48 00 00 48 00 48 00 00 00 00 00 48 00 48 00 00 48 00 00 00 00 00 00 00 48 00 00 48 00 00 48 00 48 00 00 00 00 00 00 00 48 00 00 00 00 00 48 00 00 48 00 48 00 00 48 00 00 48 00 00 00 00 48 48 00 48 00 00 48 00 00 48 00 00 48 00 00 00 00 48 00 48 00 00 48 00 48 48 00 48 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 48 00 00 00 00 00 00 48 00 00 48 00 48 48 00 48 00 00 48 00 00 48 00 00 00 00 00 00 00 48 00 00 00 00 48 00 00 48 00 48 00 00 00 00 00 00 00 48 48 00 48 00 00 48 00 00 48 00 48 00 00 48 00 00 48 00 48 00 00 00 00 00 48 00 00 48 00 00 00 00 48 00 00 48 00 48 00 00 00 00 00 48 00 48 48 00 48 00 00 48 00 00 48 00 00 00 00 48 00 00 00 00 48 48 00 00 00 00 48 00 00 48 00 00 48 00 48 00 00 48 00 48 00 00 48 00 00 00 00 00 00 00 48 48 00 48 00 00 00 00 00 00 48 00 00 48 00 00 48 48 00 00 48 00 00 48 00 00 48 00 48 48 00 48 00 00 48 00 00 00 00 48 00 00 48 00 00 00 00 00 48 00 48 00 00 48 00 00 48 00 48 00 48 00 00 48 00 00 00 00 00 00 00 00 00 48 00 00 48 00 48 00 00 48 00 00 48 00 00 00 00 00 00 00 00 00 48 00 00 48 00 00 48 00 48 48 00 00 00 00 48 00 48 00 00 48 00 00 00 00 00 00 48 00 00 48 00 48 00 48 00 00 48 00 00 00 00 00 48 00 00 00 00 00 00 00 48 00 00 00 00 48 00 00 48 00 00 48 00 48 00 00 48 00 00 48 00 00 48 00 48 00 00 00 00 00 48 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 48 48 00 48 00 00 48 00 00 00 00 48 00 00 48 00 48 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 48 00 48 00 00 48 00 00 48 00 48 00 48 00 00 48 00 00 48 00 48 00 00 48 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 48 48 48 00 00 48 00 48 48 00 48 00 00 48 00 48 00 00 48 00 00 48 00 00 00 00 00 00 00 00 00 00 00 48 00 00 48 00 00 00 00 00 00 00 48 00 00 00 00 48 00 00 00 00 00 48 00 48 00 00 48 00 00 48 00 48 00 00 00 00 00 00 00 00 48 00 48 48 00 48 00 00 48 00 00 48 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 48 00 00 00 48 00 00 00 00 00 48 00 48 48 00 48 00 00 48 00 48 48 00 00 00 00 48 00 00 00 00 00 48 00 48 00 00 48 00 00 48 00 00 00 00 00 00 00 48 00 48 00 00 48 00 00 48 00 00 00 00 00 00 00 48 00 00 00 00 00 48 00 48 00 00 48 00 00 00 00 00 00 00 48 00 00 00 00 00 48 00 48 00 00 48 00 00 00 00 48 00 00 48 00 00 48 00 00 00 00 00 00 48 00 00 48 00 00 00 00 48 00 00 48 00 00 00 00 00 00 00 48 00 00 48 00 00 48 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 48 00 00 48 00 00 00 00 00 00 00 48 00 00 48 00 00 00 00 00 00 00 48 00 00 00 00 48 00 00 00 48 48 00 48 00 00 48 00 00 48 00 00 48 00 00 00 00 48 00 00 48 00 00 48 00 48 00 00 48 00 00 48 00 48 00 00 48 00 00 48 00 00 00 00 48 48 00 48 00 00 48 00 00 48 00 00 00 00 48 00 00 48 00 48 48 00 00 00 00 48 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 48 00 00 48 00 00 48 00 00 00 00 48 00 00 48 00 00 48 00 48 00 00 00 00 00 00 00 48 00 00 48 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 48 00 00 00 00 48 00 00 00 48 00 48 00 00 00 00 48 00 00 00 48 00 00 00 00 00 00 48 00 48 00 00 00 48 00 00 00 48 00 00 48 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 48 00 00 48 00 */
%include "../utils/printf32.asm" section .data var_byte db 'A' var_byte1 db 0x41 var_byte2 db 65 var_word dw 10 var_dword dd 1 var_qword dq 0x0123456789ABCDEF str: db "salut", 0 str1 db 's', 'a', 'l', 'u', 't', 0 arr dd 0, 1, 2, 3 section .rodata str2 db "salut", 0 section .bss v_byte resb 1 v_bytes resb 10 v_word resw 1 v_words resw 100 section .text extern printf global main main: push ebp mov ebp, esp ; Mem, reg mov eax, var_dword PRINTF32 `var_dword = 0x%x\n\x0`, eax mov [var_dword], dword 30 PRINTF32 `var_dword = 0x%x\n\x0`, [eax] mov eax, [var_dword] PRINTF32 `[var_dword] = %d\n\x0`, eax mov dword [var_dword], 10 PRINTF32 `[var_dword] = %d\n\x0`, [var_dword] mov [var_dword], dword 200000000 PRINTF32 `[var_dword] = %d\n\x0`, [var_dword] mov [var_dword], byte 255 PRINTF32 `[var_dword] = %d\n\x0`, [var_dword] PRINTF32 `[var_qword] = 0x%x\x0`, [var_qword + 4] PRINTF32 `%x\n\x0`, [var_qword] ; ; Arrays ; mov ecx, 4 ; xor eax, eax ; PRINTF32 `arr:\n\x0` ; print: ; PRINTF32 `%d\n\x0`, [arr + eax * 4] ; inc eax ; cmp ecx, eax ; jnz print ; ; Multiplication ; mov eax, 12 ; mov ebx, 3 ; mul bl ; PRINTF32 `%d\n\x0`, eax ; mov eax, 12 ; mul byte [var_byte] ; PRINTF32 `%d\n\x0`, eax ; mov eax, 14 ; mov ebx, 5 ; div bl ; PRINTF32 `{R, C} = 0x%x\n\x0`, eax ; xor ebx, ebx ; mov bl, al ; PRINTF32 `C = %d\n\x0`, ebx ; xor ebx, ebx ; mov bl, ah ; PRINTF32 `R = %d\n\x0`, ebx leave ret
; A014682: The Collatz or 3x+1 function: a(n) = n/2 if n is even, otherwise (3n+1)/2. ; 0,2,1,5,2,8,3,11,4,14,5,17,6,20,7,23,8,26,9,29,10,32,11,35,12,38,13,41,14,44,15,47,16,50,17,53,18,56,19,59,20,62,21,65,22,68,23,71,24,74,25,77,26,80,27,83,28,86,29,89,30,92,31,95,32,98,33,101,34,104,35,107,36,110,37,113,38,116,39,119,40,122,41,125,42,128,43,131,44,134,45,137,46,140,47,143,48,146,49,149,50,152,51,155,52,158,53,161,54,164,55,167,56,170,57,173,58,176,59,179,60,182,61,185,62,188,63,191,64,194,65,197,66,200,67,203,68,206,69,209,70,212,71,215,72,218,73,221,74,224,75,227,76,230,77,233,78,236,79,239,80,242,81,245,82,248,83,251,84,254,85,257,86,260,87,263,88,266,89,269,90,272,91,275,92,278,93,281,94,284,95,287,96,290,97,293,98,296,99,299,100,302,101,305,102,308,103,311,104,314,105,317,106,320,107,323,108,326,109,329,110,332,111,335,112,338,113,341,114,344,115,347,116,350,117,353,118,356,119,359,120,362,121,365,122,368,123,371,124,374 mov $2,-2 bin $2,$0 div $2,2 sub $0,$2 mov $1,$0
; ; Fast background restore ; ; ZX Spectrum version (speeded up with a row table) ; ; $Id: bkrestore.asm,v 1.5 2016-04-13 21:09:09 dom Exp $ ; SECTION code_clib PUBLIC bkrestore PUBLIC _bkrestore EXTERN zx_rowtab .bkrestore ._bkrestore ; __FASTCALL__ : sprite ptr in HL push ix push hl pop ix ld d,(ix+2) ld e,(ix+3) ld a,d ld d,0 ld hl,zx_rowtab add hl,de add hl,de ld (actrow+1),hl ; save row table position ld e,(hl) inc hl ld h,(hl) ld l,e push af srl a srl a srl a ld (actcol+1),a ld e,a pop af add hl,de ld a,(ix+0) ld b,(ix+1) dec a srl a srl a srl a inc a inc a ; INT ((Xsize-1)/8+2) ld (rbytes+1),a di .bkrestores push bc .rbytes ld b,0 .rloop ld a,(ix+4) ld (hl),a inc hl inc ix djnz rloop ; --------- .actrow ld hl,0 inc hl inc hl ld (actrow+1),hl ld b,(hl) inc hl ld h,(hl) ld l,b .actcol ld bc,0 add hl,bc ; --------- pop bc djnz bkrestores ei pop ix ret
// Copyright 2016 National Renewable Energy Laboratory // // 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 "SamplingPlanes.h" #include "core/ClassRegistry.h" #include "core/PerfUtils.h" #include <Shards_BasicTopologies.hpp> #include <stk_util/parallel/Parallel.hpp> #include <stk_util/parallel/BroadcastArg.hpp> #include <stk_util/parallel/ParallelReduce.hpp> #include <stk_mesh/base/FindRestriction.hpp> #include <stk_mesh/base/MetaData.hpp> #include <stk_mesh/base/BulkData.hpp> #include <stk_mesh/base/Entity.hpp> #include <stk_mesh/base/Field.hpp> #include <stk_mesh/base/CoordinateSystems.hpp> #include <stk_mesh/base/Comm.hpp> #include <stk_mesh/base/Stencils.hpp> #include <stk_mesh/base/TopologyDimensions.hpp> #include <stk_mesh/base/FEMHelpers.hpp> #include <stk_io/IossBridge.hpp> #include <stk_io/StkMeshIoBroker.hpp> #include <Ionit_Initializer.h> #include <iostream> namespace sierra { namespace nalu { REGISTER_DERIVED_CLASS(PreProcessingTask, SamplingPlanes, "generate_planes_deprecated"); SamplingPlanes::SamplingPlanes( CFDMesh& mesh, const YAML::Node& node ) : PreProcessingTask(mesh), meta_(mesh.meta()), bulk_(mesh.bulk()), heights_(0), bBox_(), name_format_(), fluidPartNames_(), fluidParts_(), vertices_(4, std::vector<double>(2,0.0)), dx_(0.0), dy_(0.0), nx_(0), ny_(0), mx_(0), my_(0), ndim_(meta_.spatial_dimension()) { if (ndim_ != 3) throw std::runtime_error("SamplingPlanes only available for 3-D meshes"); load(node); } void SamplingPlanes::load(const YAML::Node& zp) { const auto& fParts = zp["fluid_part"]; if (fParts.Type() == YAML::NodeType::Scalar) { fluidPartNames_.push_back(fParts.as<std::string>()); } else { fluidPartNames_ = fParts.as<std::vector<std::string>>(); } if (zp["boundary_type"]) { std::string bdy_type_name = zp["boundary_type"].as<std::string>(); if (bdy_type_name == "bounding_box") bdyType_ = BOUND_BOX; else if (bdy_type_name == "quad_vertices") bdyType_ = QUAD_VERTICES; else throw std::runtime_error("Bad option specified for boundary type: " + bdy_type_name); } else { bdyType_ = BOUND_BOX; } heights_ = zp["heights"].as<std::vector<double>>(); name_format_ = zp["part_name_format"].as<std::string>(); if (bdyType_ == BOUND_BOX) { dx_ = zp["dx"].as<double>(); dy_ = zp["dy"].as<double>(); } else { mx_ = zp["nx"].as<int>(); my_ = zp["ny"].as<int>(); nx_ = mx_ + 1; ny_ = my_ + 1; vertices_ = zp["vertices"].as<std::vector<std::vector<double>>>(); if (vertices_.size() != 4) throw std::runtime_error("Incorrect number of vertices provided. Expected 4."); for (size_t i=0; i<vertices_.size(); i++) { size_t nl = vertices_[i].size(); if ((nl < 2) || (nl > 3)) throw std::runtime_error( "Inconsistent vertices provided. Check input file."); } } } void SamplingPlanes::initialize() { const std::string timerName = "SamplingPlanes::initialize"; auto timeMon = get_stopwatch(timerName); const auto iproc = bulk_.parallel_rank(); for (auto pName: fluidPartNames_){ stk::mesh::Part* part = meta_.get_part(pName); if (NULL == part) { throw std::runtime_error( "SamplingPlanes: Fluid realm not found in mesh database."); } else { fluidParts_.push_back(part); } } if (iproc == 0) std::cout << "SamplingPlanes: Registering parts to meta data:" << std::endl; for(auto zh: heights_) { std::string pName = name_format_ + std::to_string(zh); stk::mesh::Part* part_check = meta_.get_part(pName); if (part_check != NULL){ throw std::runtime_error( "SamplingPlanes: Cannot overwrite existing part in database: "+ pName); } else { stk::mesh::Part& part = meta_.declare_part( pName, stk::topology::NODE_RANK); stk::io::put_io_part_attribute(part); // stk::mesh::set_topology(part, stk::topology::SHELL_QUAD_4); if (iproc == 0) std::cout << "\t " << pName << std::endl; VectorFieldType* coords = meta_.get_field<VectorFieldType>( stk::topology::NODE_RANK, "coordinates"); stk::mesh::put_field_on_mesh(*coords, part, meta_.spatial_dimension(), nullptr); } } } void SamplingPlanes::run() { const std::string timerName = "SamplingPlanes::run"; auto timeMon = get_stopwatch(timerName); calc_bounding_box(); stk::parallel_machine_barrier(bulk_.parallel()); for (auto zh: heights_) { generate_zplane(zh); } mesh_.set_write_flag(); } void SamplingPlanes::calc_bounding_box() { const std::string timerName = "SamplingPlanes::calc_bounding_box"; auto timeMon = get_stopwatch(timerName); auto iproc = bulk_.parallel_rank(); VectorFieldType* coords = meta_.get_field<VectorFieldType>( stk::topology::NODE_RANK, "coordinates"); stk::mesh::Selector s_part = stk::mesh::selectUnion(fluidParts_); const stk::mesh::BucketVector& node_buckets = bulk_.get_buckets( stk::topology::NODE_RANK, s_part); // Setup bounding box array std::vector<double> bBoxMin(ndim_); std::vector<double> bBoxMax(ndim_); for (int i=0; i<ndim_; i++) { bBoxMin[i] = std::numeric_limits<double>::max(); bBoxMax[i] = -std::numeric_limits<double>::max(); } for(size_t ib=0; ib < node_buckets.size(); ib++) { stk::mesh::Bucket& bukt = *node_buckets[ib]; double* pt = stk::mesh::field_data(*coords, bukt); for(size_t in=0; in<bukt.size(); in++) { for(int i=0; i<ndim_; i++) { if (pt[i] < bBoxMin[i]) bBoxMin[i] = pt[in * ndim_ + i]; if (pt[i] > bBoxMax[i]) bBoxMax[i] = pt[in * ndim_ + i]; } } } stk::all_reduce_min( bulk_.parallel(), bBoxMin.data(), bBox_[0].data(), ndim_); stk::all_reduce_max( bulk_.parallel(), bBoxMax.data(), bBox_[1].data(), ndim_); if (iproc == 0) { std::cout << "Mesh bounding box: " << std::endl; for(size_t i=0; i<2; i++) { for(int j=0; j<ndim_; j++) std::cout << "\t" << bBox_[i][j]; std::cout << std::endl; } } if (bdyType_ == BOUND_BOX) { mx_ = (bBox_[1][0] - bBox_[0][0]) / dx_; my_ = (bBox_[1][1] - bBox_[0][1]) / dy_; nx_ = mx_ + 1; ny_ = my_ + 1; // S-W corner (0 vertex) vertices_[0][0] = bBox_[0][0]; vertices_[0][1] = bBox_[0][1]; // S-E corner (1 vertex) vertices_[1][0] = bBox_[1][0]; vertices_[1][1] = bBox_[0][1]; // N-E corner (2 vertex) vertices_[2][0] = bBox_[1][0]; vertices_[2][1] = bBox_[1][1]; // N-W corner (1 vertex) vertices_[3][0] = bBox_[0][0]; vertices_[3][1] = bBox_[1][1]; } // Reset dx and dy for computations dx_ = 1.0 / static_cast<double>(mx_); dy_ = 1.0 / static_cast<double>(my_); if (iproc == 0){ std::cout << "Number of nodes per plane: " << (nx_ * ny_) << " [ " << nx_ << " x " << ny_ << " ]" << std::endl; } } void SamplingPlanes::generate_zplane(const double zh) { const std::string timerName = "SamplingPlanes::generate_zplane"; auto timeMon = get_stopwatch(timerName); const unsigned iproc = bulk_.parallel_rank(); const unsigned nproc = bulk_.parallel_size(); const std::string pName = name_format_ + std::to_string(zh); stk::mesh::Part& part = *meta_.get_part(pName); unsigned gNumPoints = nx_ * ny_; unsigned numPoints = 0; unsigned offset = 0; if ((gNumPoints < nproc) && (iproc < gNumPoints)) { numPoints = 1; } else { numPoints = gNumPoints / nproc; offset = iproc * numPoints; unsigned rem = gNumPoints % nproc; if ((rem > 0) && (iproc < rem)) numPoints++; offset += (iproc < rem)? iproc : rem; } std::vector<stk::mesh::EntityId> newIDs(numPoints); std::vector<stk::mesh::Entity> nodeVec(numPoints); bulk_.modification_begin(); if (numPoints > 0) { bulk_.generate_new_ids(stk::topology::NODE_RANK, numPoints, newIDs); for(unsigned i=0; i<numPoints; i++) { stk::mesh::Entity node = bulk_.declare_entity( stk::topology::NODE_RANK, newIDs[i], part); nodeVec[i] = node; } } bulk_.modification_end(); VectorFieldType* coords = meta_.get_field<VectorFieldType>( stk::topology::NODE_RANK, "coordinates"); for (unsigned k=0; k < numPoints; k++) { int j = (offset+k) / nx_; int i = (offset+k) % nx_; double* pt = stk::mesh::field_data(*coords, nodeVec[k]); const double rx = i * dx_; const double ry = j * dy_; pt[0] = ((1.0 - rx) * (1.0 - ry) * vertices_[0][0] + rx * (1.0 - ry) * vertices_[1][0] + rx * ry * vertices_[2][0] + (1.0 - rx) * ry * vertices_[3][0]); pt[1] = ((1.0 - rx) * (1.0 - ry) * vertices_[0][1] + rx * (1.0 - ry) * vertices_[1][1] + rx * ry * vertices_[2][1] + (1.0 - rx) * ry * vertices_[3][1]); pt[2] = zh; } } } // nalu } // sierra
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0x3347, %rsi nop nop nop dec %rdi and $0xffffffffffffffc0, %rsi movntdqa (%rsi), %xmm7 vpextrq $1, %xmm7, %rax nop nop nop inc %r14 lea addresses_WT_ht+0x1cc47, %rsi lea addresses_WT_ht+0x6877, %rdi nop nop sub %r14, %r14 mov $89, %rcx rep movsb nop nop cmp $31960, %rax lea addresses_WT_ht+0x11581, %r9 nop nop nop inc %r15 movups (%r9), %xmm5 vpextrq $0, %xmm5, %rdi nop nop sub $47127, %rsi lea addresses_D_ht+0xf3fe, %rsi lea addresses_D_ht+0xd1c, %rdi nop nop nop and $61269, %r12 mov $92, %rcx rep movsw nop nop nop nop nop add $1965, %rsi lea addresses_D_ht+0x4066, %r14 nop nop cmp %r15, %r15 mov $0x6162636465666768, %rdi movq %rdi, (%r14) nop nop add %rdi, %rdi lea addresses_WC_ht+0x6107, %rsi lea addresses_D_ht+0x9447, %rdi clflush (%rsi) nop nop nop nop nop sub %r14, %r14 mov $96, %rcx rep movsb nop nop nop nop and %rsi, %rsi lea addresses_normal_ht+0xa047, %rsi lea addresses_WC_ht+0xd5be, %rdi nop nop nop and %rax, %rax mov $63, %rcx rep movsb nop nop inc %rdi lea addresses_A_ht+0x18d87, %rsi lea addresses_A_ht+0x1e447, %rdi nop nop nop xor %rax, %rax mov $106, %rcx rep movsb nop nop dec %rcx lea addresses_A_ht+0x6047, %rsi lea addresses_D_ht+0x5847, %rdi clflush (%rsi) nop nop add $40280, %r15 mov $46, %rcx rep movsq nop nop xor $53997, %r14 lea addresses_A_ht+0xd847, %rsi lea addresses_A_ht+0xf9eb, %rdi nop nop nop cmp %r9, %r9 mov $76, %rcx rep movsw nop nop nop nop and %r12, %r12 lea addresses_WC_ht+0x14b07, %rax nop nop and $27937, %r12 mov $0x6162636465666768, %r14 movq %r14, %xmm7 vmovups %ymm7, (%rax) nop nop nop nop nop sub %r9, %r9 lea addresses_A_ht+0xd447, %rax nop nop nop nop xor %r12, %r12 movl $0x61626364, (%rax) nop nop cmp %rsi, %rsi lea addresses_UC_ht+0x11e47, %r14 clflush (%r14) nop nop nop nop lfence mov $0x6162636465666768, %r12 movq %r12, (%r14) nop nop nop nop cmp $8435, %r14 pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r14 push %r15 push %r8 push %rbp push %rcx // Load mov $0x32a0fb00000007b7, %r11 nop nop nop nop nop inc %r8 mov (%r11), %ebp nop cmp %rcx, %rcx // Store lea addresses_WT+0x5987, %r14 clflush (%r14) nop nop cmp %r13, %r13 movb $0x51, (%r14) nop nop nop nop nop and $60830, %r8 // Faulty Load mov $0x7ca4120000000447, %rbp nop nop nop sub $33028, %r14 mov (%rbp), %r8w lea oracles, %r13 and $0xff, %r8 shlq $12, %r8 mov (%r13,%r8,1), %r8 pop %rcx pop %rbp pop %r8 pop %r15 pop %r14 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 1, 'AVXalign': True, 'NT': True, 'congruent': 6, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'00': 4761} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r8 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x14541, %rsi lea addresses_normal_ht+0x125, %rdi clflush (%rdi) nop nop nop nop sub %rdx, %rdx mov $28, %rcx rep movsb and $17704, %rax lea addresses_WC_ht+0xd25, %rsi lea addresses_UC_ht+0x7225, %rdi nop nop nop nop add $5046, %r15 mov $61, %rcx rep movsb nop nop nop add $28969, %r15 lea addresses_A_ht+0x151a5, %rsi lea addresses_A_ht+0x3e5, %rdi clflush (%rdi) nop nop nop dec %r8 mov $52, %rcx rep movsw nop nop add %rdi, %rdi lea addresses_A_ht+0x14095, %r8 nop nop nop nop nop inc %rcx movl $0x61626364, (%r8) nop nop nop nop xor $5960, %r15 lea addresses_WC_ht+0x15f25, %rsi lea addresses_WC_ht+0xa555, %rdi nop nop nop nop mfence mov $3, %rcx rep movsq nop cmp $29901, %rsi lea addresses_UC_ht+0x3225, %rcx nop nop nop cmp $60558, %rdi mov $0x6162636465666768, %rax movq %rax, (%rcx) and $13614, %r15 lea addresses_WC_ht+0x19a25, %rsi lea addresses_D_ht+0xda85, %rdi nop nop nop and $3970, %r11 mov $5, %rcx rep movsl nop nop nop nop add $56048, %r15 lea addresses_WC_ht+0x6725, %rsi lea addresses_D_ht+0xb125, %rdi nop nop nop xor %r15, %r15 mov $34, %rcx rep movsw nop nop nop nop dec %rdi lea addresses_A_ht+0x13225, %rdi add %rax, %rax mov (%rdi), %esi nop nop xor %rax, %rax lea addresses_WC_ht+0x12285, %rsi lea addresses_WC_ht+0x1c6f0, %rdi nop add %rax, %rax mov $46, %rcx rep movsb nop nop nop nop nop cmp $42716, %r11 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r8 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r15 push %r9 push %rax push %rbp push %rbx // Store mov $0x42af5f0000000d25, %r10 nop nop nop nop cmp %r15, %r15 movw $0x5152, (%r10) add $27016, %r10 // Store mov $0x42af5f0000000d25, %r9 nop cmp %rbp, %rbp mov $0x5152535455565758, %rbx movq %rbx, %xmm2 vmovups %ymm2, (%r9) nop sub %r14, %r14 // Load mov $0xd6d, %r9 nop nop sub %r14, %r14 mov (%r9), %r15w nop nop sub %rbp, %rbp // Store mov $0x95f, %r15 nop nop nop nop cmp $52033, %rbp movw $0x5152, (%r15) nop nop nop cmp %rbx, %rbx // Store lea addresses_WC+0x3c25, %r9 nop nop nop nop nop cmp $14125, %rax mov $0x5152535455565758, %rbp movq %rbp, %xmm6 vmovups %ymm6, (%r9) nop nop nop cmp %r9, %r9 // Faulty Load mov $0x42af5f0000000d25, %r14 nop nop nop nop nop cmp %rbx, %rbx mov (%r14), %r10d lea oracles, %r15 and $0xff, %r10 shlq $12, %r10 mov (%r15,%r10,1), %r10 pop %rbx pop %rbp pop %rax pop %r9 pop %r15 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': True, 'type': 'addresses_NC', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 2, 'AVXalign': True}} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 32, 'AVXalign': False}} {'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_P', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_P', 'size': 2, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WC', 'size': 32, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 4, 'NT': False, 'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': True, 'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}} {'src': {'same': False, 'congruent': 8, 'NT': True, 'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}} {'58': 108, '00': 8} 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 00 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 */
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x14d9, %rbx nop nop nop nop sub $64944, %rcx and $0xffffffffffffffc0, %rbx vmovntdqa (%rbx), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $0, %xmm0, %r13 nop nop nop add %rbx, %rbx lea addresses_WC_ht+0x91aa, %rsi lea addresses_A_ht+0x14979, %rdi inc %r9 mov $120, %rcx rep movsw add $34796, %rcx lea addresses_A_ht+0x12399, %rsi lea addresses_WC_ht+0x9579, %rdi clflush (%rsi) nop nop nop cmp %rdx, %rdx mov $1, %rcx rep movsb nop nop dec %rcx lea addresses_UC_ht+0x13179, %rdi nop nop nop nop cmp $50500, %r13 mov (%rdi), %r9 nop nop add %r13, %r13 lea addresses_normal_ht+0xc469, %rsi nop nop nop nop dec %r13 mov (%rsi), %dx nop nop nop and %r13, %r13 lea addresses_normal_ht+0x1d679, %rsi lea addresses_normal_ht+0xe979, %rdi nop nop nop inc %r14 mov $8, %rcx rep movsb nop xor %r9, %r9 lea addresses_WC_ht+0x12579, %rsi lea addresses_A_ht+0x1cf79, %rdi clflush (%rdi) nop nop xor $57014, %rdx mov $58, %rcx rep movsw nop nop nop cmp $8105, %r13 lea addresses_UC_ht+0x3b5d, %rsi nop and %rdi, %rdi mov $0x6162636465666768, %r13 movq %r13, %xmm1 and $0xffffffffffffffc0, %rsi vmovntdq %ymm1, (%rsi) nop nop and %rbx, %rbx lea addresses_UC_ht+0x1dd79, %rsi lea addresses_WT_ht+0xd079, %rdi nop nop nop nop nop and $46786, %rdx mov $8, %rcx rep movsq sub $28089, %r14 lea addresses_normal_ht+0x51a9, %rsi lea addresses_A_ht+0x19559, %rdi nop xor $3641, %rdx mov $45, %rcx rep movsb nop nop nop nop cmp %rdi, %rdi lea addresses_WT_ht+0x4131, %rsi nop nop nop nop nop cmp $64558, %r14 movb $0x61, (%rsi) dec %rdx lea addresses_D_ht+0x8579, %r9 inc %r13 movups (%r9), %xmm7 vpextrq $1, %xmm7, %rcx nop sub %r14, %r14 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r15 push %r8 push %r9 push %rbx push %rdx // Store mov $0x4c74b70000000c19, %r8 nop nop nop cmp %rdx, %rdx mov $0x5152535455565758, %r15 movq %r15, %xmm0 movups %xmm0, (%r8) nop xor $18364, %r9 // Store lea addresses_UC+0x6871, %r11 sub $16401, %r15 mov $0x5152535455565758, %r9 movq %r9, %xmm4 movups %xmm4, (%r11) nop nop nop add %r9, %r9 // Faulty Load lea addresses_US+0xe179, %r11 nop nop nop dec %rbx mov (%r11), %r13 lea oracles, %rdx and $0xff, %r13 shlq $12, %r13 mov (%rdx,%r13,1), %r13 pop %rdx pop %rbx pop %r9 pop %r8 pop %r15 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_NC', 'AVXalign': False, 'size': 16}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_UC', 'AVXalign': False, 'size': 16}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': True, 'same': False, 'congruent': 3, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}} {'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'NT': True, 'same': False, 'congruent': 4, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}} {'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 2, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}} {'src': {'same': True, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}} {'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1}} {'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
#include "RigidBody/FineCollision/CollisionPrimitive.h" using namespace cyclone; void CollisionPrimitive::CalculateInternals() { if (body != nullptr) { transform = body->GetTransform() * offset; } } Vector3 CollisionPrimitive::GetAxis(const unsigned index) const { return Vector3(transform.M[0][index], transform.M[1][index], transform.M[2][index]); } const Matrix& CollisionPrimitive::GetTransform() const { return transform; }
;;; Copyright 2020 Tadashi G. Takaoka ;;; ;;; 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. cpu 8085 org 0100h include "test_i8080.inc" align 32 include "test_i8085.inc" end ;;; Local Variables: ;;; mode: asm ;;; End: ;;; vim: set ft=asm:
; A057087: Scaled Chebyshev U-polynomials evaluated at i. Generalized Fibonacci sequence. ; 1,4,20,96,464,2240,10816,52224,252160,1217536,5878784,28385280,137056256,661766144,3195289600,15428222976,74494050304,359689093120,1736732573696,8385686667264,40489676963840,195501454524416,943964525953024,4557863921909760 mov $1,1 lpb $0,1 sub $0,1 mov $3,$1 add $3,$1 mul $1,2 sub $1,1 add $2,1 add $1,$2 mul $1,2 mov $2,$3 lpe
;=============================================================================== ; Copyright 2014-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. ;=============================================================================== ; ; ; Purpose: Cryptography Primitive. ; Rijndael Inverse Cipher function ; ; Content: ; Encrypt_RIJ128_AES_NI() ; ; .686P .XMM .MODEL FLAT,C include asmdefs.inc include ia_emm.inc COPY_8U MACRO dst, src, limit, tmp LOCAL next_byte xor ecx, ecx next_byte: mov tmp, byte ptr[src+ecx] mov byte ptr[dst+ecx], tmp add ecx, 1 cmp ecx, limit jl next_byte ENDM COPY_32U MACRO dst, src, limit, tmp LOCAL next_dword xor ecx, ecx next_dword: mov tmp, dword ptr[src+ecx] mov dword ptr[dst+ecx], tmp add ecx, 4 cmp ecx, limit jl next_dword ENDM COPY_128U MACRO dst, src, limit, tmp LOCAL next_oword xor ecx, ecx next_oword: movdqu tmp, oword ptr[src+ecx] movdqu oword ptr[dst+ecx], tmp add ecx, 16 cmp ecx, limit jl next_oword ENDM IPPCODE SEGMENT 'CODE' ALIGN (IPP_ALIGN_FACTOR) ;*************************************************************** ;* Purpose: RIJ128 CFB encryption ;* ;* void EncryptCFB_RIJ128_AES_NI(const Ipp32u* inpBlk, ;* Ipp32u* outBlk, ;* int nr, ;* const Ipp32u* pRKey, ;* int len, ;* int cfbSize, ;* const Ipp8u* pIV) ;*************************************************************** IF (_IPP GE _IPP_P8) ;; ;; Lib = P8 ;; ;; Caller = ippsRijndael128EncryptCFB ;; ALIGN IPP_ALIGN_FACTOR IPPASM EncryptCFB_RIJ128_AES_NI PROC NEAR PUBLIC \ USES esi edi ebx,\ pInpBlk:PTR DWORD,\ ; input blocks address pOutBlk:PTR DWORD,\ ; output blocks address nr:DWORD,\ ; number of rounds pKey:PTR DWORD,\ ; key material address len:DWORD,\ ; length of stream in bytes cfbSize:DWORD,\ ; cfb blk size pIV:PTR BYTE ; pointer to the IV SC equ (4) BLKS_PER_LOOP = (4) sub esp,16*(1+4+4) ; allocate stask: ; +0*16 IV ; +1*16 inp0, inp1, inp2, inp3 ; +5*16 out0, out1, out2, out3 mov eax, pIV ; IV address movdqu xmm4, oword ptr[eax] ; get IV movdqu oword ptr [esp+0*16], xmm4 ; into the stack ;; ;; processing ;; blks_loop: mov esi,pInpBlk ; input data address mov edx,cfbSize ; size of block lea ebx, [edx*BLKS_PER_LOOP] ; 4 cfb block mov edx, len cmp edx, ebx cmovl ebx, edx COPY_8U <esp+5*16>, esi, ebx, dl ; move 1-4 input blocks to stack ; get actual address of key material: pRKeys += (nr-9) * SC mov ecx, pKey mov edx, nr lea eax,[edx*4] lea eax, [ecx+eax*4-9*(SC)*4] ; AES-128 round keys xor esi, esi ; index mov edi, ebx single_blk: movdqu xmm0, oword ptr [esp+esi] ; get processing blocks pxor xmm0, oword ptr [ecx] ; whitening cmp edx,12 ; switch according to number of rounds jl key_128_s jz key_192_s ; do encryption key_256_s: aesenc xmm0, oword ptr[eax-4*4*SC] aesenc xmm0, oword ptr[eax-3*4*SC] key_192_s: aesenc xmm0, oword ptr[eax-2*4*SC] aesenc xmm0, oword ptr[eax-1*4*SC] key_128_s: aesenc xmm0, oword ptr[eax+0*4*SC] aesenc xmm0, oword ptr[eax+1*4*SC] aesenc xmm0, oword ptr[eax+2*4*SC] aesenc xmm0, oword ptr[eax+3*4*SC] aesenc xmm0, oword ptr[eax+4*4*SC] aesenc xmm0, oword ptr[eax+5*4*SC] aesenc xmm0, oword ptr[eax+6*4*SC] aesenc xmm0, oword ptr[eax+7*4*SC] aesenc xmm0, oword ptr[eax+8*4*SC] aesenclast xmm0, oword ptr[eax+9*4*SC] movdqu xmm1, oword ptr[esp+5*16+esi] ; get src blocks from the stack pxor xmm0, xmm1 ; xor src movdqu oword ptr[esp+1*16+esi],xmm0 ;and store into the stack add esi, cfbSize ; advance index sub edi, cfbSize ; decrease lenth jg single_blk mov edi,pOutBlk ; output data address COPY_8U edi, <esp+1*16>, ebx, dl ; move 1-4 blocks to output movdqu xmm0, oword ptr[esp+ebx]; update IV movdqu oword ptr[esp], xmm0 add pInpBlk, ebx add pOutBlk, ebx sub len, ebx jg blks_loop add esp, 16*(1+4+4) ret IPPASM EncryptCFB_RIJ128_AES_NI ENDP ALIGN IPP_ALIGN_FACTOR IPPASM EncryptCFB32_RIJ128_AES_NI PROC NEAR PUBLIC \ USES esi edi ebx,\ pInpBlk:PTR DWORD,\ ; input blocks address pOutBlk:PTR DWORD,\ ; output blocks address nr:DWORD,\ ; number of rounds pKey:PTR DWORD,\ ; key material address len:DWORD,\ ; length of stream in bytes cfbSize:DWORD,\ ; cfb blk size pIV:PTR BYTE ; pointer to the IV SC equ (4) BLKS_PER_LOOP = (4) sub esp,16*(1+4+4) ; allocate stask: ; +0*16 IV ; +1*16 inp0, inp1, inp2, inp3 ; +5*16 out0, out1, out2, out3 mov eax, pIV ; IV address movdqu xmm4, oword ptr[eax] ; get IV movdqu oword ptr [esp+0*16], xmm4 ; into the stack ;; ;; processing ;; blks_loop: mov esi,pInpBlk ; input data address mov edx,cfbSize ; size of block lea ebx, [edx*BLKS_PER_LOOP] ; 4 cfb block mov edx, len cmp edx, ebx cmovl ebx, edx COPY_32U <esp+5*16>, esi, ebx, edx ; move 1-4 input blocks to stack ; get actual address of key material: pRKeys += (nr-9) * SC mov ecx, pKey mov edx, nr lea eax,[edx*4] lea eax, [ecx+eax*4-9*(SC)*4] ; AES-128 round keys xor esi, esi ; index mov edi, ebx single_blk: movdqu xmm0, oword ptr [esp+esi] ; get processing blocks pxor xmm0, oword ptr [ecx] ; whitening cmp edx,12 ; switch according to number of rounds jl key_128_s jz key_192_s ; do encryption key_256_s: aesenc xmm0, oword ptr[eax-4*4*SC] aesenc xmm0, oword ptr[eax-3*4*SC] key_192_s: aesenc xmm0, oword ptr[eax-2*4*SC] aesenc xmm0, oword ptr[eax-1*4*SC] key_128_s: aesenc xmm0, oword ptr[eax+0*4*SC] aesenc xmm0, oword ptr[eax+1*4*SC] aesenc xmm0, oword ptr[eax+2*4*SC] aesenc xmm0, oword ptr[eax+3*4*SC] aesenc xmm0, oword ptr[eax+4*4*SC] aesenc xmm0, oword ptr[eax+5*4*SC] aesenc xmm0, oword ptr[eax+6*4*SC] aesenc xmm0, oword ptr[eax+7*4*SC] aesenc xmm0, oword ptr[eax+8*4*SC] aesenclast xmm0, oword ptr[eax+9*4*SC] movdqu xmm1, oword ptr[esp+5*16+esi] ; get src blocks from the stack pxor xmm0, xmm1 ; xor src movdqu oword ptr[esp+1*16+esi],xmm0 ;and store into the stack add esi, cfbSize ; advance index sub edi, cfbSize ; decrease lenth jg single_blk mov edi,pOutBlk ; output data address COPY_32U edi, <esp+1*16>, ebx, edx ; move 1-4 blocks to output movdqu xmm0, oword ptr[esp+ebx] ; update IV movdqu oword ptr[esp], xmm0 add pInpBlk, ebx add pOutBlk, ebx sub len, ebx jg blks_loop add esp, 16*(1+4+4) ret IPPASM EncryptCFB32_RIJ128_AES_NI ENDP ALIGN IPP_ALIGN_FACTOR IPPASM EncryptCFB128_RIJ128_AES_NI PROC NEAR PUBLIC \ USES esi edi ebx,\ pInpBlk:PTR DWORD,\ ; input blocks address pOutBlk:PTR DWORD,\ ; output blocks address nr:DWORD,\ ; number of rounds pKey:PTR DWORD,\ ; key material address len:DWORD,\ ; length of stream in bytes pIV:PTR BYTE ; pointer to the IV SC equ (4) BLKS_PER_LOOP = (4) mov eax, pIV ; IV address movdqu xmm0, oword ptr[eax] ; get IV mov esi,pInpBlk ; input data address mov edi,pOutBlk ; output data address mov ebx, len ; get actual address of key material: pRKeys += (nr-9) * SC mov ecx, pKey mov edx, nr lea eax,[edx*4] lea eax, [ecx+eax*4-9*(SC)*4] ; AES-128 round keys ;; ;; processing ;; blks_loop: pxor xmm0, oword ptr [ecx] ; whitening movdqu xmm1, oword ptr[esi] ; input blocks cmp edx,12 ; switch according to number of rounds jl key_128_s jz key_192_s ; do encryption key_256_s: aesenc xmm0, oword ptr[eax-4*4*SC] aesenc xmm0, oword ptr[eax-3*4*SC] key_192_s: aesenc xmm0, oword ptr[eax-2*4*SC] aesenc xmm0, oword ptr[eax-1*4*SC] key_128_s: aesenc xmm0, oword ptr[eax+0*4*SC] aesenc xmm0, oword ptr[eax+1*4*SC] aesenc xmm0, oword ptr[eax+2*4*SC] aesenc xmm0, oword ptr[eax+3*4*SC] aesenc xmm0, oword ptr[eax+4*4*SC] aesenc xmm0, oword ptr[eax+5*4*SC] aesenc xmm0, oword ptr[eax+6*4*SC] aesenc xmm0, oword ptr[eax+7*4*SC] aesenc xmm0, oword ptr[eax+8*4*SC] aesenclast xmm0, oword ptr[eax+9*4*SC] pxor xmm0, xmm1 ; xor src movdqu oword ptr[edi],xmm0 ;and store into the dst add esi, 16 add edi, 16 sub ebx, 16 jg blks_loop ret IPPASM EncryptCFB128_RIJ128_AES_NI ENDP ENDIF END
#ruledef test { ld {x: u8} => 0x55 @ x } ld 0x123 ; error: failed / error: out of range
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifdef HAVE_CONFIG_H #include "config/dreamteam3-config.h" #endif #include "netaddress.h" #include "netbase.h" #include "hash.h" #include "utilstrencodings.h" #include "tinyformat.h" static const unsigned char pchIPv4[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff }; static const unsigned char pchOnionCat[] = {0xFD,0x87,0xD8,0x7E,0xEB,0x43}; bool fAllowPrivateNet = DEFAULT_ALLOWPRIVATENET; void CNetAddr::Init() { memset(ip, 0, sizeof(ip)); scopeId = 0; } void CNetAddr::SetIP(const CNetAddr& ipIn) { memcpy(ip, ipIn.ip, sizeof(ip)); } void CNetAddr::SetRaw(Network network, const uint8_t *ip_in) { switch(network) { case NET_IPV4: memcpy(ip, pchIPv4, 12); memcpy(ip+12, ip_in, 4); break; case NET_IPV6: memcpy(ip, ip_in, 16); break; default: assert(!"invalid network"); } } bool CNetAddr::SetSpecial(const std::string &strName) { if (strName.size()>6 && strName.substr(strName.size() - 6, 6) == ".onion") { std::vector<unsigned char> vchAddr = DecodeBase32(strName.substr(0, strName.size() - 6).c_str()); if (vchAddr.size() != 16-sizeof(pchOnionCat)) return false; memcpy(ip, pchOnionCat, sizeof(pchOnionCat)); for (unsigned int i=0; i<16-sizeof(pchOnionCat); i++) ip[i + sizeof(pchOnionCat)] = vchAddr[i]; return true; } return false; } CNetAddr::CNetAddr() { Init(); } CNetAddr::CNetAddr(const struct in_addr& ipv4Addr) { SetRaw(NET_IPV4, (const uint8_t*)&ipv4Addr); } CNetAddr::CNetAddr(const struct in6_addr& ipv6Addr, const uint32_t scope) { SetRaw(NET_IPV6, (const uint8_t*)&ipv6Addr); scopeId = scope; } unsigned int CNetAddr::GetByte(int n) const { return ip[15-n]; } bool CNetAddr::IsIPv4() const { return (memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0); } bool CNetAddr::IsIPv6() const { return (!IsIPv4() && !IsTor()); } bool CNetAddr::IsRFC1918() const { return IsIPv4() && ( GetByte(3) == 10 || (GetByte(3) == 192 && GetByte(2) == 168) || (GetByte(3) == 172 && (GetByte(2) >= 16 && GetByte(2) <= 31))); } bool CNetAddr::IsRFC2544() const { return IsIPv4() && GetByte(3) == 198 && (GetByte(2) == 18 || GetByte(2) == 19); } bool CNetAddr::IsRFC3927() const { return IsIPv4() && (GetByte(3) == 169 && GetByte(2) == 254); } bool CNetAddr::IsRFC6598() const { return IsIPv4() && GetByte(3) == 100 && GetByte(2) >= 64 && GetByte(2) <= 127; } bool CNetAddr::IsRFC5737() const { return IsIPv4() && ((GetByte(3) == 192 && GetByte(2) == 0 && GetByte(1) == 2) || (GetByte(3) == 198 && GetByte(2) == 51 && GetByte(1) == 100) || (GetByte(3) == 203 && GetByte(2) == 0 && GetByte(1) == 113)); } bool CNetAddr::IsRFC3849() const { return GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x0D && GetByte(12) == 0xB8; } bool CNetAddr::IsRFC3964() const { return (GetByte(15) == 0x20 && GetByte(14) == 0x02); } bool CNetAddr::IsRFC6052() const { static const unsigned char pchRFC6052[] = {0,0x64,0xFF,0x9B,0,0,0,0,0,0,0,0}; return (memcmp(ip, pchRFC6052, sizeof(pchRFC6052)) == 0); } bool CNetAddr::IsRFC4380() const { return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0 && GetByte(12) == 0); } bool CNetAddr::IsRFC4862() const { static const unsigned char pchRFC4862[] = {0xFE,0x80,0,0,0,0,0,0}; return (memcmp(ip, pchRFC4862, sizeof(pchRFC4862)) == 0); } bool CNetAddr::IsRFC4193() const { return ((GetByte(15) & 0xFE) == 0xFC); } bool CNetAddr::IsRFC6145() const { static const unsigned char pchRFC6145[] = {0,0,0,0,0,0,0,0,0xFF,0xFF,0,0}; return (memcmp(ip, pchRFC6145, sizeof(pchRFC6145)) == 0); } bool CNetAddr::IsRFC4843() const { return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x00 && (GetByte(12) & 0xF0) == 0x10); } bool CNetAddr::IsTor() const { return (memcmp(ip, pchOnionCat, sizeof(pchOnionCat)) == 0); } bool CNetAddr::IsLocal() const { // IPv4 loopback if (IsIPv4() && (GetByte(3) == 127 || GetByte(3) == 0)) return true; // IPv6 loopback (::1/128) static const unsigned char pchLocal[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}; if (memcmp(ip, pchLocal, 16) == 0) return true; return false; } bool CNetAddr::IsMulticast() const { return (IsIPv4() && (GetByte(3) & 0xF0) == 0xE0) || (GetByte(15) == 0xFF); } bool CNetAddr::IsValid() const { // Cleanup 3-byte shifted addresses caused by garbage in size field // of addr messages from versions before 0.2.9 checksum. // Two consecutive addr messages look like this: // header20 vectorlen3 addr26 addr26 addr26 header20 vectorlen3 addr26 addr26 addr26... // so if the first length field is garbled, it reads the second batch // of addr misaligned by 3 bytes. if (memcmp(ip, pchIPv4+3, sizeof(pchIPv4)-3) == 0) return false; // unspecified IPv6 address (::/128) unsigned char ipNone6[16] = {}; if (memcmp(ip, ipNone6, 16) == 0) return false; // documentation IPv6 address if (IsRFC3849()) return false; if (IsIPv4()) { // INADDR_NONE uint32_t ipNone = INADDR_NONE; if (memcmp(ip+12, &ipNone, 4) == 0) return false; // 0 ipNone = 0; if (memcmp(ip+12, &ipNone, 4) == 0) return false; } return true; } bool CNetAddr::IsRoutable() const { if (!IsValid()) return false; if (!fAllowPrivateNet && IsRFC1918()) return false; return !(IsRFC2544() || IsRFC3927() || IsRFC4862() || IsRFC6598() || IsRFC5737() || (IsRFC4193() && !IsTor()) || IsRFC4843() || IsLocal()); } enum Network CNetAddr::GetNetwork() const { if (!IsRoutable()) return NET_UNROUTABLE; if (IsIPv4()) return NET_IPV4; if (IsTor()) return NET_TOR; return NET_IPV6; } std::string CNetAddr::ToStringIP(bool fUseGetnameinfo) const { if (IsTor()) return EncodeBase32(&ip[6], 10) + ".onion"; if (fUseGetnameinfo) { CService serv(*this, 0); struct sockaddr_storage sockaddr; socklen_t socklen = sizeof(sockaddr); if (serv.GetSockAddr((struct sockaddr*)&sockaddr, &socklen)) { char name[1025] = ""; if (!getnameinfo((const struct sockaddr*)&sockaddr, socklen, name, sizeof(name), NULL, 0, NI_NUMERICHOST)) return std::string(name); } } if (IsIPv4()) return strprintf("%u.%u.%u.%u", GetByte(3), GetByte(2), GetByte(1), GetByte(0)); else return strprintf("%x:%x:%x:%x:%x:%x:%x:%x", GetByte(15) << 8 | GetByte(14), GetByte(13) << 8 | GetByte(12), GetByte(11) << 8 | GetByte(10), GetByte(9) << 8 | GetByte(8), GetByte(7) << 8 | GetByte(6), GetByte(5) << 8 | GetByte(4), GetByte(3) << 8 | GetByte(2), GetByte(1) << 8 | GetByte(0)); } std::string CNetAddr::ToString() const { return ToStringIP(); } bool operator==(const CNetAddr& a, const CNetAddr& b) { return (memcmp(a.ip, b.ip, 16) == 0); } bool operator!=(const CNetAddr& a, const CNetAddr& b) { return (memcmp(a.ip, b.ip, 16) != 0); } bool operator<(const CNetAddr& a, const CNetAddr& b) { return (memcmp(a.ip, b.ip, 16) < 0); } bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const { if (!IsIPv4()) return false; memcpy(pipv4Addr, ip+12, 4); return true; } bool CNetAddr::GetIn6Addr(struct in6_addr* pipv6Addr) const { memcpy(pipv6Addr, ip, 16); return true; } // get canonical identifier of an address' group // no two connections will be attempted to addresses with the same group std::vector<unsigned char> CNetAddr::GetGroup() const { std::vector<unsigned char> vchRet; int nClass = NET_IPV6; int nStartByte = 0; int nBits = 16; // all local addresses belong to the same group if (IsLocal()) { nClass = 255; nBits = 0; } // all unroutable addresses belong to the same group if (!IsRoutable()) { nClass = NET_UNROUTABLE; nBits = 0; } // for IPv4 addresses, '1' + the 16 higher-order bits of the IP // includes mapped IPv4, SIIT translated IPv4, and the well-known prefix else if (IsIPv4() || IsRFC6145() || IsRFC6052()) { nClass = NET_IPV4; nStartByte = 12; } // for 6to4 tunnelled addresses, use the encapsulated IPv4 address else if (IsRFC3964()) { nClass = NET_IPV4; nStartByte = 2; } // for Teredo-tunnelled IPv6 addresses, use the encapsulated IPv4 address else if (IsRFC4380()) { vchRet.push_back(NET_IPV4); vchRet.push_back(GetByte(3) ^ 0xFF); vchRet.push_back(GetByte(2) ^ 0xFF); return vchRet; } else if (IsTor()) { nClass = NET_TOR; nStartByte = 6; nBits = 4; } // for he.net, use /36 groups else if (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x04 && GetByte(12) == 0x70) nBits = 36; // for the rest of the IPv6 network, use /32 groups else nBits = 32; vchRet.push_back(nClass); while (nBits >= 8) { vchRet.push_back(GetByte(15 - nStartByte)); nStartByte++; nBits -= 8; } if (nBits > 0) vchRet.push_back(GetByte(15 - nStartByte) | ((1 << (8 - nBits)) - 1)); return vchRet; } uint64_t CNetAddr::GetHash() const { uint256 hash = Hash(&ip[0], &ip[16]); uint64_t nRet; memcpy(&nRet, &hash, sizeof(nRet)); return nRet; } // private extensions to enum Network, only returned by GetExtNetwork, // and only used in GetReachabilityFrom static const int NET_UNKNOWN = NET_MAX + 0; static const int NET_TEREDO = NET_MAX + 1; int static GetExtNetwork(const CNetAddr *addr) { if (addr == NULL) return NET_UNKNOWN; if (addr->IsRFC4380()) return NET_TEREDO; return addr->GetNetwork(); } /** Calculates a metric for how reachable (*this) is from a given partner */ int CNetAddr::GetReachabilityFrom(const CNetAddr *paddrPartner) const { enum Reachability { REACH_UNREACHABLE, REACH_DEFAULT, REACH_TEREDO, REACH_IPV6_WEAK, REACH_IPV4, REACH_IPV6_STRONG, REACH_PRIVATE }; if (!IsRoutable()) return REACH_UNREACHABLE; int ourNet = GetExtNetwork(this); int theirNet = GetExtNetwork(paddrPartner); bool fTunnel = IsRFC3964() || IsRFC6052() || IsRFC6145(); switch(theirNet) { case NET_IPV4: switch(ourNet) { default: return REACH_DEFAULT; case NET_IPV4: return REACH_IPV4; } case NET_IPV6: switch(ourNet) { default: return REACH_DEFAULT; case NET_TEREDO: return REACH_TEREDO; case NET_IPV4: return REACH_IPV4; case NET_IPV6: return fTunnel ? REACH_IPV6_WEAK : REACH_IPV6_STRONG; // only prefer giving our IPv6 address if it's not tunnelled } case NET_TOR: switch(ourNet) { default: return REACH_DEFAULT; case NET_IPV4: return REACH_IPV4; // Tor users can connect to IPv4 as well case NET_TOR: return REACH_PRIVATE; } case NET_TEREDO: switch(ourNet) { default: return REACH_DEFAULT; case NET_TEREDO: return REACH_TEREDO; case NET_IPV6: return REACH_IPV6_WEAK; case NET_IPV4: return REACH_IPV4; } case NET_UNKNOWN: case NET_UNROUTABLE: default: switch(ourNet) { default: return REACH_DEFAULT; case NET_TEREDO: return REACH_TEREDO; case NET_IPV6: return REACH_IPV6_WEAK; case NET_IPV4: return REACH_IPV4; case NET_TOR: return REACH_PRIVATE; // either from Tor, or don't care about our address } } } void CService::Init() { port = 0; } CService::CService() { Init(); } CService::CService(const CNetAddr& cip, unsigned short portIn) : CNetAddr(cip), port(portIn) { } CService::CService(const struct in_addr& ipv4Addr, unsigned short portIn) : CNetAddr(ipv4Addr), port(portIn) { } CService::CService(const struct in6_addr& ipv6Addr, unsigned short portIn) : CNetAddr(ipv6Addr), port(portIn) { } CService::CService(const struct sockaddr_in& addr) : CNetAddr(addr.sin_addr), port(ntohs(addr.sin_port)) { assert(addr.sin_family == AF_INET); } CService::CService(const struct sockaddr_in6 &addr) : CNetAddr(addr.sin6_addr, addr.sin6_scope_id), port(ntohs(addr.sin6_port)) { assert(addr.sin6_family == AF_INET6); } bool CService::SetSockAddr(const struct sockaddr *paddr) { switch (paddr->sa_family) { case AF_INET: *this = CService(*(const struct sockaddr_in*)paddr); return true; case AF_INET6: *this = CService(*(const struct sockaddr_in6*)paddr); return true; default: return false; } } unsigned short CService::GetPort() const { return port; } bool operator==(const CService& a, const CService& b) { return (CNetAddr)a == (CNetAddr)b && a.port == b.port; } bool operator!=(const CService& a, const CService& b) { return (CNetAddr)a != (CNetAddr)b || a.port != b.port; } bool operator<(const CService& a, const CService& b) { return (CNetAddr)a < (CNetAddr)b || ((CNetAddr)a == (CNetAddr)b && a.port < b.port); } bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const { if (IsIPv4()) { if (*addrlen < (socklen_t)sizeof(struct sockaddr_in)) return false; *addrlen = sizeof(struct sockaddr_in); struct sockaddr_in *paddrin = (struct sockaddr_in*)paddr; memset(paddrin, 0, *addrlen); if (!GetInAddr(&paddrin->sin_addr)) return false; paddrin->sin_family = AF_INET; paddrin->sin_port = htons(port); return true; } if (IsIPv6()) { if (*addrlen < (socklen_t)sizeof(struct sockaddr_in6)) return false; *addrlen = sizeof(struct sockaddr_in6); struct sockaddr_in6 *paddrin6 = (struct sockaddr_in6*)paddr; memset(paddrin6, 0, *addrlen); if (!GetIn6Addr(&paddrin6->sin6_addr)) return false; paddrin6->sin6_scope_id = scopeId; paddrin6->sin6_family = AF_INET6; paddrin6->sin6_port = htons(port); return true; } return false; } std::vector<unsigned char> CService::GetKey() const { std::vector<unsigned char> vKey; vKey.resize(18); memcpy(&vKey[0], ip, 16); vKey[16] = port / 0x100; vKey[17] = port & 0x0FF; return vKey; } std::string CService::ToStringPort() const { return strprintf("%u", port); } std::string CService::ToStringIPPort(bool fUseGetnameinfo) const { if (IsIPv4() || IsTor()) { return ToStringIP(fUseGetnameinfo) + ":" + ToStringPort(); } else { return "[" + ToStringIP(fUseGetnameinfo) + "]:" + ToStringPort(); } } std::string CService::ToString(bool fUseGetnameinfo) const { return ToStringIPPort(fUseGetnameinfo); } void CService::SetPort(unsigned short portIn) { port = portIn; } CSubNet::CSubNet(): valid(false) { memset(netmask, 0, sizeof(netmask)); } CSubNet::CSubNet(const CNetAddr &addr, int32_t mask) { valid = true; network = addr; // Default to /32 (IPv4) or /128 (IPv6), i.e. match single address memset(netmask, 255, sizeof(netmask)); // IPv4 addresses start at offset 12, and first 12 bytes must match, so just offset n const int astartofs = network.IsIPv4() ? 12 : 0; int32_t n = mask; if(n >= 0 && n <= (128 - astartofs*8)) // Only valid if in range of bits of address { n += astartofs*8; // Clear bits [n..127] for (; n < 128; ++n) netmask[n>>3] &= ~(1<<(7-(n&7))); } else valid = false; // Normalize network according to netmask for(int x=0; x<16; ++x) network.ip[x] &= netmask[x]; } CSubNet::CSubNet(const CNetAddr &addr, const CNetAddr &mask) { valid = true; network = addr; // Default to /32 (IPv4) or /128 (IPv6), i.e. match single address memset(netmask, 255, sizeof(netmask)); // IPv4 addresses start at offset 12, and first 12 bytes must match, so just offset n const int astartofs = network.IsIPv4() ? 12 : 0; for(int x=astartofs; x<16; ++x) netmask[x] = mask.ip[x]; // Normalize network according to netmask for(int x=0; x<16; ++x) network.ip[x] &= netmask[x]; } CSubNet::CSubNet(const CNetAddr &addr): valid(addr.IsValid()) { memset(netmask, 255, sizeof(netmask)); network = addr; } bool CSubNet::Match(const CNetAddr &addr) const { if (!valid || !addr.IsValid()) return false; for(int x=0; x<16; ++x) if ((addr.ip[x] & netmask[x]) != network.ip[x]) return false; return true; } static inline int NetmaskBits(uint8_t x) { switch(x) { case 0x00: return 0; break; case 0x80: return 1; break; case 0xc0: return 2; break; case 0xe0: return 3; break; case 0xf0: return 4; break; case 0xf8: return 5; break; case 0xfc: return 6; break; case 0xfe: return 7; break; case 0xff: return 8; break; default: return -1; break; } } std::string CSubNet::ToString() const { /* Parse binary 1{n}0{N-n} to see if mask can be represented as /n */ int cidr = 0; bool valid_cidr = true; int n = network.IsIPv4() ? 12 : 0; for (; n < 16 && netmask[n] == 0xff; ++n) cidr += 8; if (n < 16) { int bits = NetmaskBits(netmask[n]); if (bits < 0) valid_cidr = false; else cidr += bits; ++n; } for (; n < 16 && valid_cidr; ++n) if (netmask[n] != 0x00) valid_cidr = false; /* Format output */ std::string strNetmask; if (valid_cidr) { strNetmask = strprintf("%u", cidr); } else { if (network.IsIPv4()) strNetmask = strprintf("%u.%u.%u.%u", netmask[12], netmask[13], netmask[14], netmask[15]); else strNetmask = strprintf("%x:%x:%x:%x:%x:%x:%x:%x", netmask[0] << 8 | netmask[1], netmask[2] << 8 | netmask[3], netmask[4] << 8 | netmask[5], netmask[6] << 8 | netmask[7], netmask[8] << 8 | netmask[9], netmask[10] << 8 | netmask[11], netmask[12] << 8 | netmask[13], netmask[14] << 8 | netmask[15]); } return network.ToString() + "/" + strNetmask; } bool CSubNet::IsValid() const { return valid; } bool operator==(const CSubNet& a, const CSubNet& b) { return a.valid == b.valid && a.network == b.network && !memcmp(a.netmask, b.netmask, 16); } bool operator!=(const CSubNet& a, const CSubNet& b) { return !(a==b); } bool operator<(const CSubNet& a, const CSubNet& b) { return (a.network < b.network || (a.network == b.network && memcmp(a.netmask, b.netmask, 16) < 0)); }
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_D_ht+0x80ac, %rsi lea addresses_normal_ht+0x13d74, %rdi nop nop cmp %r11, %r11 mov $39, %rcx rep movsl nop nop dec %rbp lea addresses_D_ht+0x2b2c, %r14 nop sub $38555, %r11 and $0xffffffffffffffc0, %r14 movntdqa (%r14), %xmm4 vpextrq $1, %xmm4, %rdi nop nop nop nop dec %rdi lea addresses_WT_ht+0x1072c, %rsi lea addresses_WC_ht+0x1d12c, %rdi add %r9, %r9 mov $114, %rcx rep movsb nop nop nop nop and $53988, %r11 pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r15 push %r8 push %r9 push %rbx push %rsi // Store lea addresses_WC+0x19f2c, %r14 nop nop nop xor %r11, %r11 movw $0x5152, (%r14) nop nop nop cmp %rbx, %rbx // Load lea addresses_WT+0x12e2c, %r11 xor $51562, %r9 mov (%r11), %r14w nop nop add %r11, %r11 // Faulty Load lea addresses_normal+0x1172c, %r14 clflush (%r14) nop nop cmp %rbx, %rbx mov (%r14), %r9w lea oracles, %rsi and $0xff, %r9 shlq $12, %r9 mov (%rsi,%r9,1), %r9 pop %rsi pop %rbx pop %r9 pop %r8 pop %r15 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}} {'34': 1296} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
; A061066: a(n) = (prime(n)^2 - 1)/8. ; 1,3,6,15,21,36,45,66,105,120,171,210,231,276,351,435,465,561,630,666,780,861,990,1176,1275,1326,1431,1485,1596,2016,2145,2346,2415,2775,2850,3081,3321,3486,3741,4005,4095,4560,4656,4851,4950,5565,6216,6441,6555,6786,7140,7260,7875,8256,8646,9045,9180,9591,9870,10011,10731,11781,12090,12246,12561,13695,14196,15051,15225,15576,16110,16836,17391,17955,18336,18915,19701,20100,20910,21945,22155,23220,23436,24090,24531,25200,26106,26565,26796,27261,28680,29646,30135,31125,31626,32385,33930,34191,36585,37401 seq $0,98090 ; Numbers k such that 2k-3 is prime. sub $0,1 bin $0,2
; A088580: a(n) = 1 + sigma(n). ; Submitted by Christian Krause ; 2,4,5,8,7,13,9,16,14,19,13,29,15,25,25,32,19,40,21,43,33,37,25,61,32,43,41,57,31,73,33,64,49,55,49,92,39,61,57,91,43,97,45,85,79,73,49,125,58,94,73,99,55,121,73,121,81,91,61,169,63,97,105,128,85,145,69,127,97,145,73,196,75,115,125,141,97,169,81,187,122,127,85,225,109,133,121,181,91,235,113,169,129,145,121,253,99,172,157,218 add $0,1 mov $2,$0 lpb $0 mov $3,$2 dif $3,$0 cmp $3,$2 cmp $3,0 mul $3,$0 sub $0,1 add $1,$3 lpe mov $0,$1 add $0,2
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1994 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: loader.asm AUTHOR: Gene Anderson, Mar 21, 1994 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Gene 3/21/94 Initial revision DESCRIPTION: $Id: loader.asm,v 1.1 97/04/04 17:27:36 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ kcode segment para public 'CODE' cgroup group kcode, stack include main.asm include locate.asm include strings.asm include ini.asm include load.asm include heap.asm include path.asm ifndef NO_AUTODETECT include videoDetect.asm endif kcode ends end LoadGeos
#include "FrameLib_Prioritise.h" // Constructor FrameLib_Prioritise::FrameLib_Prioritise(FrameLib_Context context, const FrameLib_Parameters::Serial *serialisedParameters, FrameLib_Proxy *proxy) : FrameLib_Processor(context, proxy, &sParamInfo) { mParameters.addInt(kNumIns, "num_ins", 2, 0); mParameters.setClip(2, 32); mParameters.setInstantiation(); mParameters.addEnum(kMode, "order", 1); mParameters.addEnumItem(kLow, "low"); mParameters.addEnumItem(kHigh, "high"); mParameters.setInstantiation(); mParameters.set(serialisedParameters); setIO(mParameters.getInt(kNumIns), 1); } // Info std::string FrameLib_Prioritise::objectInfo(bool verbose) { return formatInfo("Apply a fixed priority ranking to synchronous input frames: " "Frames arriving asynchronously are sent to the output. " "When frames arrive synchronously only one is sent to the output. " "The input number is used to proritise synchonous inputs. " "Either higher or lower numbered inputs can be prioritised.", "Apply a fixed priority ranking to synchronous input frames.", verbose); } std::string FrameLib_Prioritise::inputInfo(unsigned long idx, bool verbose) { return formatInfo("Input #", idx); } std::string FrameLib_Prioritise::outputInfo(unsigned long idx, bool verbose) { return "Output"; } // Parameter Info FrameLib_Prioritise::ParameterInfo FrameLib_Prioritise::sParamInfo; FrameLib_Prioritise::ParameterInfo::ParameterInfo() { add("Sets the number of inputs."); add("Set whether to prioritise lower or higher numbered inputs."); } // Process void FrameLib_Prioritise::process() { FrameLib_TimeFormat now = getFrameTime(); unsigned long input = 0; // Find the prioritised input Modes mode = mParameters.getEnum<Modes>(kMode); switch (mode) { case kLow: { for ( ; input < getNumIns(); input++) if (now == getInputFrameTime(input)) break; assert(input < getNumIns() && "No current input found"); break; } case kHigh: { for (input = getNumIns(); input > 0; input--) if (now == getInputFrameTime(input - 1)) break; assert(input > 0 && "No current input found"); input--; break; } } prepareCopyInputToOutput(input, 0); allocateOutputs(); copyInputToOutput(input, 0); }
#pragma once #include "sync.hpp" #include "resources.hpp" #include <random> #include <vector> #include <functional> #include <thread> #include <ncurses.h> #include <chrono> #include <ctime> using namespace std::chrono_literals; struct IJob { const int id; const std::string name; const int numOfRequiredCores; std::vector<std::reference_wrapper<Core>> heldCores; std::vector<std::reference_wrapper<File>> files; CIPlatform& sync; std::mt19937 randEngine{ std::random_device{}() }; std::uniform_int_distribution<> randNumber{2, 5}; int getRandNumber(); bool areFilesFree(); void waitNicely(int multiplier = 1); void lockCores(); void unlockCores(); void lockFiles(); void unlockFiles(); virtual void execute() = 0; virtual void printState(std::string) = 0; IJob(int id, std::string name, int required_resources_num, std::vector<std::reference_wrapper<File>> required_files, CIPlatform& ci_platform) : id(id), name(name), sync(ci_platform), numOfRequiredCores(required_resources_num), files(std::move(required_files)) { heldCores.reserve(numOfRequiredCores); } virtual ~IJob() { std::lock_guard<std::mutex> sa_counter_mutex(sync.saEndMutex); sync.saEndCounter++; if (sync.saEndCounter == NUM_JOBS - 1) { { std::lock_guard<std::mutex> sa_end_mutex(sync.ciMutex); sync.jobDispatchList.push_front(NUM_JOBS - 1); } sync.ciCv.notify_one(); } } }; struct StandardJob : public IJob { void execute() override { printState("is idle"); while(sync.run) { printState("is waiting to be queued"); { std::lock_guard<std::mutex> jobListLock(sync.ciMutex); lastExecuted = std::chrono::system_clock::now(); printDate(); sync.jobDispatchList.push_back(id); sync.printJobList(); } std::unique_lock<std::mutex> criticalSectionLock(sync.ciMutex); printState("is waiting for files and resources"); sync.ciCv.wait(criticalSectionLock, [&] { return (sync.jobDispatchList.front() == id) && (sync.cpu.numOfFreeCores >= numOfRequiredCores) && (areFilesFree()); }); sync.jobDispatchList.pop_front(); sync.printJobList(); printState("is acquiring files and resources"); waitNicely(); if (isAnyFileNewerThanJob()) { printState("is older than files and will be started again"); criticalSectionLock.unlock(); sync.ciCv.notify_all(); waitNicely(); continue; } lockCores(); lockFiles(); printState("has acquired files and resources and is executing"); criticalSectionLock.unlock(); sync.ciCv.notify_all(); waitNicely(); { std::lock_guard<std::mutex> resourceLock(sync.ciMutex); printState("has finished executing; releasing resources"); waitNicely(); unlockFiles(); unlockCores(); } sync.ciCv.notify_all(); printState("is waiting to be dispatched again"); waitNicely(); } printState("END OF WORK"); } bool isAnyFileNewerThanJob(); void printDate(); void printState(std::string state) override { std::scoped_lock<std::mutex> printLock(sync.printMutex); auto time = std::chrono::system_clock::to_time_t(lastExecuted); char formattedTime[20] = {0}; std::strftime(formattedTime, sizeof(formattedTime), "%Y-%m-%d %H:%M:%S", std::localtime(&time)); move(id, 0); clrtoeol(); mvprintw(id, 0, "%d. %s", id, name.c_str()); mvprintw(id, 30, "last run: %s", formattedTime); mvprintw(id, 60, "%s", state.c_str()); refresh(); } std::chrono::system_clock::time_point lastExecuted { std::chrono::system_clock::now() }; std::thread workingThread; StandardJob() = delete; StandardJob(int id, std::string name, int required_resources_num, std::vector<std::reference_wrapper<File>> required_files, CIPlatform& ci_platform) : IJob(id, name, required_resources_num, required_files, ci_platform), workingThread(&StandardJob::execute, this) { } ~StandardJob() {workingThread.join();} }; struct Commit : public IJob { void execute() override { printState("is idle"); while(sync.run) { printState("is waiting to be queued"); { std::lock_guard<std::mutex> jobListLock(sync.ciMutex); sync.jobDispatchList.push_back(id); sync.printJobList(); } std::unique_lock<std::mutex> criticalSectionLock(sync.ciMutex); printState("is waiting for files and resources"); sync.ciCv.wait(criticalSectionLock, [&] { return (sync.jobDispatchList.front() == id) && (sync.cpu.numOfFreeCores >= numOfRequiredCores) && (areFilesFree()); }); sync.jobDispatchList.pop_front(); sync.printJobList(); printState("is acquiring files and resources"); waitNicely(); lockCores(); lockFiles(); printState("has acquired files and resources and is executing"); criticalSectionLock.unlock(); sync.ciCv.notify_all(); waitNicely(); { std::lock_guard<std::mutex> resourceLock(sync.ciMutex); updateFiles(); printState("has finished executing; releasing resources"); waitNicely(); unlockFiles(); unlockCores(); } sync.ciCv.notify_all(); printState("is waiting to be dispatched again"); waitNicely(20); } printState("END OF WORK"); } void updateFiles(); void printState(std::string state) override { std::scoped_lock<std::mutex> printLock(sync.printMutex); move(id, 0); clrtoeol(); mvprintw(id, 0, "%d. %s", id, name.c_str()); mvprintw(id, 30, "%s", state.c_str()); refresh(); } std::thread workingThread; Commit() = delete; Commit(int id, std::string name, int required_resources_num, std::vector<std::reference_wrapper<File>> required_files, CIPlatform& ci_platform) : IJob(id, name, required_resources_num, required_files, ci_platform), workingThread(&Commit::execute, this) { } ~Commit() {workingThread.join();} }; struct StaticAnalysisJob : public IJob { void execute() override { printState("is idle"); while(sync.run) { std::unique_lock<std::mutex> criticalSectionLock(sync.ciMutex); printState("is waiting to be dispatched"); sync.ciCv.wait(criticalSectionLock, [&] { return (sync.jobDispatchList.front() == id) && (sync.cpu.numOfFreeCores >= numOfRequiredCores) && (areFilesFree()); }); sync.jobDispatchList.pop_front(); { std::lock_guard<std::mutex> saCounterMutex(sync.saEndMutex); if (sync.saEndCounter == NUM_JOBS - 1) return; } sync.printJobList(); printState("is acquiring files and resources"); waitNicely(); lockCores(); lockFiles(); printState("has acquired files and resources and is executing"); criticalSectionLock.unlock(); sync.ciCv.notify_all(); waitNicely(); { std::lock_guard<std::mutex> resourceLock(sync.ciMutex); updateFiles(); printState("has finished executing; releasing resources"); waitNicely(); unlockFiles(); unlockCores(); } sync.ciCv.notify_all(); } printState("END OF WORK"); } void updateFiles(); void printState(std::string state) override { std::scoped_lock<std::mutex> printLock(sync.printMutex); move(id, 0); clrtoeol(); mvprintw(id, 0, "%d. %s", id, name.c_str()); mvprintw(id, 30, "%s", state.c_str()); refresh(); } std::thread workingThread; StaticAnalysisJob() = delete; StaticAnalysisJob(int id, std::string name, int required_resources_num, std::vector<std::reference_wrapper<File>> required_files, CIPlatform& ci_platform) : IJob(id, name, required_resources_num, required_files, ci_platform), workingThread(&StaticAnalysisJob::execute, this) { } ~StaticAnalysisJob() {workingThread.join();} };
// Copyright (C) 2012 National ICT Australia (NICTA) // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. // ------------------------------------------------------------------- // // Written by Conrad Sanderson - http://conradsanderson.id.au //! \addtogroup cond_rel //! @{ // // for preventing pedantic compiler warnings template<const bool do_eval> class cond_rel { public: template<typename eT> arma_inline static bool lt(const eT A, const eT B); template<typename eT> arma_inline static bool gt(const eT A, const eT B); template<typename eT> arma_inline static bool leq(const eT A, const eT B); template<typename eT> arma_inline static bool geq(const eT A, const eT B); template<typename eT> arma_inline static eT make_neg(const eT val); }; //! @}