kernel: file format elf32-i386 Disassembly of section .text: 80100000 : 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 : # 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 90 10 00 mov $0x109000,%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 f0 54 11 80 mov $0x801154f0,%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 80 31 10 80 mov $0x80103180,%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 : // Linked list of all buffers, through prev/next. // head.next is most recently used. struct buf head; } bcache; void binit(void) { 80100040: 55 push %ebp 80100041: 89 e5 mov %esp,%ebp 80100043: 53 push %ebx initlock(&bcache.lock, "bcache"); // Create linked list of buffers bcache.head.prev = &bcache.head; bcache.head.next = &bcache.head; for (b = bcache.buf; b < bcache.buf + NBUF; b++) { 80100044: bb 54 a5 10 80 mov $0x8010a554,%ebx void binit(void) { 80100049: 83 ec 0c sub $0xc,%esp initlock(&bcache.lock, "bcache"); 8010004c: 68 e0 73 10 80 push $0x801073e0 80100051: 68 20 a5 10 80 push $0x8010a520 80100056: e8 d5 44 00 00 call 80104530 bcache.head.next = &bcache.head; 8010005b: 83 c4 10 add $0x10,%esp 8010005e: b8 1c ec 10 80 mov $0x8010ec1c,%eax bcache.head.prev = &bcache.head; 80100063: c7 05 6c ec 10 80 1c movl $0x8010ec1c,0x8010ec6c 8010006a: ec 10 80 bcache.head.next = &bcache.head; 8010006d: c7 05 70 ec 10 80 1c movl $0x8010ec1c,0x8010ec70 80100074: ec 10 80 for (b = bcache.buf; b < bcache.buf + NBUF; b++) { 80100077: eb 09 jmp 80100082 80100079: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%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 1c ec 10 80 movl $0x8010ec1c,0x50(%ebx) initsleeplock(&b->lock, "buffer"); 80100092: 68 e7 73 10 80 push $0x801073e7 80100097: 50 push %eax 80100098: e8 63 43 00 00 call 80104400 bcache.head.next->prev = b; 8010009d: a1 70 ec 10 80 mov 0x8010ec70,%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 70 ec 10 80 mov %ebx,0x8010ec70 for (b = bcache.buf; b < bcache.buf + NBUF; b++) { 801000b6: 81 fb c0 e9 10 80 cmp $0x8010e9c0,%ebx 801000bc: 75 c2 jne 80100080 } } 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 : panic("bget: no buffers"); } // Return a locked buf with the contents of the indicated block. struct buf*bread(uint dev, uint blockno) { 801000d0: 55 push %ebp 801000d1: 89 e5 mov %esp,%ebp 801000d3: 57 push %edi 801000d4: 56 push %esi 801000d5: 53 push %ebx 801000d6: 83 ec 18 sub $0x18,%esp 801000d9: 8b 75 08 mov 0x8(%ebp),%esi 801000dc: 8b 7d 0c mov 0xc(%ebp),%edi acquire(&bcache.lock); 801000df: 68 20 a5 10 80 push $0x8010a520 801000e4: e8 17 46 00 00 call 80104700 for (b = bcache.head.next; b != &bcache.head; b = b->next) { 801000e9: 8b 1d 70 ec 10 80 mov 0x8010ec70,%ebx 801000ef: 83 c4 10 add $0x10,%esp 801000f2: 81 fb 1c ec 10 80 cmp $0x8010ec1c,%ebx 801000f8: 75 11 jne 8010010b 801000fa: eb 24 jmp 80100120 801000fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100100: 8b 5b 54 mov 0x54(%ebx),%ebx 80100103: 81 fb 1c ec 10 80 cmp $0x8010ec1c,%ebx 80100109: 74 15 je 80100120 if (b->dev == dev && b->blockno == blockno) { 8010010b: 3b 73 04 cmp 0x4(%ebx),%esi 8010010e: 75 f0 jne 80100100 80100110: 3b 7b 08 cmp 0x8(%ebx),%edi 80100113: 75 eb jne 80100100 b->refcnt++; 80100115: 83 43 4c 01 addl $0x1,0x4c(%ebx) release(&bcache.lock); 80100119: eb 3f jmp 8010015a 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 6c ec 10 80 mov 0x8010ec6c,%ebx 80100126: 81 fb 1c ec 10 80 cmp $0x8010ec1c,%ebx 8010012c: 75 0d jne 8010013b 8010012e: eb 6e jmp 8010019e 80100130: 8b 5b 50 mov 0x50(%ebx),%ebx 80100133: 81 fb 1c ec 10 80 cmp $0x8010ec1c,%ebx 80100139: 74 63 je 8010019e 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 80100142: f6 03 04 testb $0x4,(%ebx) 80100145: 75 e9 jne 80100130 b->dev = dev; 80100147: 89 73 04 mov %esi,0x4(%ebx) b->blockno = blockno; 8010014a: 89 7b 08 mov %edi,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 20 a5 10 80 push $0x8010a520 80100162: e8 39 45 00 00 call 801046a0 acquiresleep(&b->lock); 80100167: 8d 43 0c lea 0xc(%ebx),%eax 8010016a: 89 04 24 mov %eax,(%esp) 8010016d: e8 ce 42 00 00 call 80104440 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 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 6f 22 00 00 call 80102400 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 panic("bget: no buffers"); 8010019e: 83 ec 0c sub $0xc,%esp 801001a1: 68 ee 73 10 80 push $0x801073ee 801001a6: e8 e5 01 00 00 call 80100390 801001ab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801001af: 90 nop 801001b0 : // Write b's contents to disk. Must be locked. void bwrite(struct buf *b) { 801001b0: 55 push %ebp 801001b1: 89 e5 mov %esp,%ebp 801001b3: 53 push %ebx 801001b4: 83 ec 10 sub $0x10,%esp 801001b7: 8b 5d 08 mov 0x8(%ebp),%ebx if (!holdingsleep(&b->lock)) { 801001ba: 8d 43 0c lea 0xc(%ebx),%eax 801001bd: 50 push %eax 801001be: e8 1d 43 00 00 call 801044e0 801001c3: 83 c4 10 add $0x10,%esp 801001c6: 85 c0 test %eax,%eax 801001c8: 74 0f je 801001d9 panic("bwrite"); } b->flags |= B_DIRTY; 801001ca: 83 0b 04 orl $0x4,(%ebx) iderw(b); 801001cd: 89 5d 08 mov %ebx,0x8(%ebp) } 801001d0: 8b 5d fc mov -0x4(%ebp),%ebx 801001d3: c9 leave iderw(b); 801001d4: e9 27 22 00 00 jmp 80102400 panic("bwrite"); 801001d9: 83 ec 0c sub $0xc,%esp 801001dc: 68 ff 73 10 80 push $0x801073ff 801001e1: e8 aa 01 00 00 call 80100390 801001e6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801001ed: 8d 76 00 lea 0x0(%esi),%esi 801001f0 : // Release a locked buffer. // Move to the head of the MRU list. void brelse(struct buf *b) { 801001f0: 55 push %ebp 801001f1: 89 e5 mov %esp,%ebp 801001f3: 56 push %esi 801001f4: 53 push %ebx 801001f5: 8b 5d 08 mov 0x8(%ebp),%ebx if (!holdingsleep(&b->lock)) { 801001f8: 8d 73 0c lea 0xc(%ebx),%esi 801001fb: 83 ec 0c sub $0xc,%esp 801001fe: 56 push %esi 801001ff: e8 dc 42 00 00 call 801044e0 80100204: 83 c4 10 add $0x10,%esp 80100207: 85 c0 test %eax,%eax 80100209: 74 66 je 80100271 panic("brelse"); } releasesleep(&b->lock); 8010020b: 83 ec 0c sub $0xc,%esp 8010020e: 56 push %esi 8010020f: e8 8c 42 00 00 call 801044a0 acquire(&bcache.lock); 80100214: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 8010021b: e8 e0 44 00 00 call 80104700 b->refcnt--; 80100220: 8b 43 4c mov 0x4c(%ebx),%eax if (b->refcnt == 0) { 80100223: 83 c4 10 add $0x10,%esp b->refcnt--; 80100226: 83 e8 01 sub $0x1,%eax 80100229: 89 43 4c mov %eax,0x4c(%ebx) if (b->refcnt == 0) { 8010022c: 85 c0 test %eax,%eax 8010022e: 75 2f jne 8010025f // no one is waiting for it. b->next->prev = b->prev; 80100230: 8b 43 54 mov 0x54(%ebx),%eax 80100233: 8b 53 50 mov 0x50(%ebx),%edx 80100236: 89 50 50 mov %edx,0x50(%eax) b->prev->next = b->next; 80100239: 8b 43 50 mov 0x50(%ebx),%eax 8010023c: 8b 53 54 mov 0x54(%ebx),%edx 8010023f: 89 50 54 mov %edx,0x54(%eax) b->next = bcache.head.next; 80100242: a1 70 ec 10 80 mov 0x8010ec70,%eax b->prev = &bcache.head; 80100247: c7 43 50 1c ec 10 80 movl $0x8010ec1c,0x50(%ebx) b->next = bcache.head.next; 8010024e: 89 43 54 mov %eax,0x54(%ebx) bcache.head.next->prev = b; 80100251: a1 70 ec 10 80 mov 0x8010ec70,%eax 80100256: 89 58 50 mov %ebx,0x50(%eax) bcache.head.next = b; 80100259: 89 1d 70 ec 10 80 mov %ebx,0x8010ec70 } release(&bcache.lock); 8010025f: c7 45 08 20 a5 10 80 movl $0x8010a520,0x8(%ebp) } 80100266: 8d 65 f8 lea -0x8(%ebp),%esp 80100269: 5b pop %ebx 8010026a: 5e pop %esi 8010026b: 5d pop %ebp release(&bcache.lock); 8010026c: e9 2f 44 00 00 jmp 801046a0 panic("brelse"); 80100271: 83 ec 0c sub $0xc,%esp 80100274: 68 06 74 10 80 push $0x80107406 80100279: e8 12 01 00 00 call 80100390 8010027e: 66 90 xchg %ax,%ax 80100280 : if (doprocdump) { procdump(); // now call procdump() wo. cons.lock held } } int consoleread(struct inode *ip, char *dst, int n) { 80100280: 55 push %ebp 80100281: 89 e5 mov %esp,%ebp 80100283: 57 push %edi 80100284: 56 push %esi 80100285: 53 push %ebx 80100286: 83 ec 28 sub $0x28,%esp 80100289: 8b 5d 10 mov 0x10(%ebp),%ebx 8010028c: 8b 75 0c mov 0xc(%ebp),%esi uint target; int c; iunlock(ip); 8010028f: ff 75 08 push 0x8(%ebp) 80100292: e8 e9 16 00 00 call 80101980 target = n; acquire(&cons.lock); 80100297: c7 04 24 40 ef 10 80 movl $0x8010ef40,(%esp) target = n; 8010029e: 89 5d e4 mov %ebx,-0x1c(%ebp) acquire(&cons.lock); 801002a1: e8 5a 44 00 00 call 80104700 while (n > 0) { 801002a6: 83 c4 10 add $0x10,%esp 801002a9: 85 db test %ebx,%ebx 801002ab: 0f 8e aa 00 00 00 jle 8010035b while (input->r == input->w) { 801002b1: a1 80 ee 10 80 mov 0x8010ee80,%eax 801002b6: 8b 90 80 00 00 00 mov 0x80(%eax),%edx 801002bc: 3b 90 84 00 00 00 cmp 0x84(%eax),%edx 801002c2: 74 38 je 801002fc 801002c4: eb 6a jmp 80100330 801002c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801002cd: 8d 76 00 lea 0x0(%esi),%esi if (myproc()->killed) { release(&cons.lock); ilock(ip); return -1; } sleep(&(input->r), &cons.lock); 801002d0: a1 80 ee 10 80 mov 0x8010ee80,%eax 801002d5: 83 ec 08 sub $0x8,%esp 801002d8: 68 40 ef 10 80 push $0x8010ef40 801002dd: 83 e8 80 sub $0xffffff80,%eax 801002e0: 50 push %eax 801002e1: e8 ba 3e 00 00 call 801041a0 while (input->r == input->w) { 801002e6: a1 80 ee 10 80 mov 0x8010ee80,%eax 801002eb: 83 c4 10 add $0x10,%esp 801002ee: 8b 90 80 00 00 00 mov 0x80(%eax),%edx 801002f4: 3b 90 84 00 00 00 cmp 0x84(%eax),%edx 801002fa: 75 34 jne 80100330 if (myproc()->killed) { 801002fc: e8 cf 37 00 00 call 80103ad0 80100301: 8b 48 24 mov 0x24(%eax),%ecx 80100304: 85 c9 test %ecx,%ecx 80100306: 74 c8 je 801002d0 release(&cons.lock); 80100308: 83 ec 0c sub $0xc,%esp 8010030b: 68 40 ef 10 80 push $0x8010ef40 80100310: e8 8b 43 00 00 call 801046a0 ilock(ip); 80100315: 5a pop %edx 80100316: ff 75 08 push 0x8(%ebp) 80100319: e8 82 15 00 00 call 801018a0 return -1; 8010031e: 83 c4 10 add $0x10,%esp } release(&cons.lock); ilock(ip); return target - n; } 80100321: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 80100324: b8 ff ff ff ff mov $0xffffffff,%eax } 80100329: 5b pop %ebx 8010032a: 5e pop %esi 8010032b: 5f pop %edi 8010032c: 5d pop %ebp 8010032d: c3 ret 8010032e: 66 90 xchg %ax,%ax c = input->buf[input->r++ % INPUT_BUF]; 80100330: 8d 4a 01 lea 0x1(%edx),%ecx 80100333: 89 88 80 00 00 00 mov %ecx,0x80(%eax) 80100339: 89 d1 mov %edx,%ecx 8010033b: 83 e1 7f and $0x7f,%ecx 8010033e: 0f be 3c 08 movsbl (%eax,%ecx,1),%edi 80100342: 89 f9 mov %edi,%ecx if (c == C('D')) { // EOF 80100344: 80 f9 04 cmp $0x4,%cl 80100347: 74 38 je 80100381 *dst++ = c; 80100349: 83 c6 01 add $0x1,%esi --n; 8010034c: 83 eb 01 sub $0x1,%ebx *dst++ = c; 8010034f: 88 4e ff mov %cl,-0x1(%esi) if (c == '\n') { 80100352: 83 ff 0a cmp $0xa,%edi 80100355: 0f 85 4e ff ff ff jne 801002a9 release(&cons.lock); 8010035b: 83 ec 0c sub $0xc,%esp 8010035e: 68 40 ef 10 80 push $0x8010ef40 80100363: e8 38 43 00 00 call 801046a0 ilock(ip); 80100368: 58 pop %eax 80100369: ff 75 08 push 0x8(%ebp) 8010036c: e8 2f 15 00 00 call 801018a0 return target - n; 80100371: 8b 45 e4 mov -0x1c(%ebp),%eax 80100374: 83 c4 10 add $0x10,%esp } 80100377: 8d 65 f4 lea -0xc(%ebp),%esp return target - n; 8010037a: 29 d8 sub %ebx,%eax } 8010037c: 5b pop %ebx 8010037d: 5e pop %esi 8010037e: 5f pop %edi 8010037f: 5d pop %ebp 80100380: c3 ret if (n < target) { 80100381: 3b 5d e4 cmp -0x1c(%ebp),%ebx 80100384: 73 d5 jae 8010035b input->r--; 80100386: 89 90 80 00 00 00 mov %edx,0x80(%eax) 8010038c: eb cd jmp 8010035b 8010038e: 66 90 xchg %ax,%ax 80100390 : void panic(char *s) { 80100390: 55 push %ebp 80100391: 89 e5 mov %esp,%ebp 80100393: 56 push %esi 80100394: 53 push %ebx 80100395: 83 ec 30 sub $0x30,%esp static inline void loadgs(ushort v) { asm volatile ("movw %0, %%gs" : : "r" (v)); } static inline void cli(void) { asm volatile ("cli"); 80100398: fa cli cons.locking = 0; 80100399: c7 05 74 ef 10 80 00 movl $0x0,0x8010ef74 801003a0: 00 00 00 getcallerpcs(&s, pcs); 801003a3: 8d 5d d0 lea -0x30(%ebp),%ebx 801003a6: 8d 75 f8 lea -0x8(%ebp),%esi cprintf("lapicid %d: panic: ", lapicid()); 801003a9: e8 62 26 00 00 call 80102a10 801003ae: 83 ec 08 sub $0x8,%esp 801003b1: 50 push %eax 801003b2: 68 0d 74 10 80 push $0x8010740d 801003b7: e8 f4 02 00 00 call 801006b0 cprintf(s); 801003bc: 58 pop %eax 801003bd: ff 75 08 push 0x8(%ebp) 801003c0: e8 eb 02 00 00 call 801006b0 cprintf("\n"); 801003c5: c7 04 24 4f 7d 10 80 movl $0x80107d4f,(%esp) 801003cc: e8 df 02 00 00 call 801006b0 getcallerpcs(&s, pcs); 801003d1: 8d 45 08 lea 0x8(%ebp),%eax 801003d4: 5a pop %edx 801003d5: 59 pop %ecx 801003d6: 53 push %ebx 801003d7: 50 push %eax 801003d8: e8 73 41 00 00 call 80104550 for (i = 0; i < 10; i++) { 801003dd: 83 c4 10 add $0x10,%esp cprintf(" %p", pcs[i]); 801003e0: 83 ec 08 sub $0x8,%esp 801003e3: ff 33 push (%ebx) for (i = 0; i < 10; i++) { 801003e5: 83 c3 04 add $0x4,%ebx cprintf(" %p", pcs[i]); 801003e8: 68 21 74 10 80 push $0x80107421 801003ed: e8 be 02 00 00 call 801006b0 for (i = 0; i < 10; i++) { 801003f2: 83 c4 10 add $0x10,%esp 801003f5: 39 f3 cmp %esi,%ebx 801003f7: 75 e7 jne 801003e0 panicked = 1; // freeze other CPU 801003f9: c7 05 78 ef 10 80 01 movl $0x1,0x8010ef78 80100400: 00 00 00 for (;;) { 80100403: eb fe jmp 80100403 80100405: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010040c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100410 : void 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 uartputc(c); 80100426: 83 ec 0c sub $0xc,%esp 80100429: 50 push %eax 8010042a: e8 a1 5a 00 00 call 80105ed0 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: be d5 03 00 00 mov $0x3d5,%esi 80100444: 89 f2 mov %esi,%edx 80100446: ec in (%dx),%al pos = inb(CRTPORT + 1) << 8; 80100447: 0f b6 c8 movzbl %al,%ecx asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 8010044a: 89 fa mov %edi,%edx 8010044c: b8 0f 00 00 00 mov $0xf,%eax 80100451: c1 e1 08 shl $0x8,%ecx 80100454: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80100455: 89 f2 mov %esi,%edx 80100457: ec in (%dx),%al pos |= inb(CRTPORT + 1); 80100458: 0f b6 c0 movzbl %al,%eax 8010045b: 09 c8 or %ecx,%eax if (c == '\n') { 8010045d: 83 fb 0a cmp $0xa,%ebx 80100460: 0f 84 92 00 00 00 je 801004f8 else if (c == BACKSPACE) { 80100466: 81 fb 00 01 00 00 cmp $0x100,%ebx 8010046c: 74 72 je 801004e0 crt[pos++] = (c & 0xff) | 0x0700; // black on white 8010046e: 0f b6 db movzbl %bl,%ebx 80100471: 8d 70 01 lea 0x1(%eax),%esi 80100474: 80 cf 07 or $0x7,%bh 80100477: 66 89 9c 00 00 80 0b mov %bx,-0x7ff48000(%eax,%eax,1) 8010047e: 80 if (pos < 0 || pos > 25 * 80) { 8010047f: 81 fe d0 07 00 00 cmp $0x7d0,%esi 80100485: 0f 8f fb 00 00 00 jg 80100586 if ((pos / 80) >= 24) { // Scroll up. 8010048b: 81 fe 7f 07 00 00 cmp $0x77f,%esi 80100491: 0f 8f a9 00 00 00 jg 80100540 outb(CRTPORT + 1, pos >> 8); 80100497: 89 f0 mov %esi,%eax crt[pos] = ' ' | 0x0700; 80100499: 8d b4 36 00 80 0b 80 lea -0x7ff48000(%esi,%esi,1),%esi outb(CRTPORT + 1, pos); 801004a0: 88 45 e7 mov %al,-0x19(%ebp) outb(CRTPORT + 1, pos >> 8); 801004a3: 0f b6 fc movzbl %ah,%edi asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 801004a6: bb d4 03 00 00 mov $0x3d4,%ebx 801004ab: b8 0e 00 00 00 mov $0xe,%eax 801004b0: 89 da mov %ebx,%edx 801004b2: ee out %al,(%dx) 801004b3: b9 d5 03 00 00 mov $0x3d5,%ecx 801004b8: 89 f8 mov %edi,%eax 801004ba: 89 ca mov %ecx,%edx 801004bc: ee out %al,(%dx) 801004bd: b8 0f 00 00 00 mov $0xf,%eax 801004c2: 89 da mov %ebx,%edx 801004c4: ee out %al,(%dx) 801004c5: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 801004c9: 89 ca mov %ecx,%edx 801004cb: ee out %al,(%dx) crt[pos] = ' ' | 0x0700; 801004cc: b8 20 07 00 00 mov $0x720,%eax 801004d1: 66 89 06 mov %ax,(%esi) } 801004d4: 8d 65 f4 lea -0xc(%ebp),%esp 801004d7: 5b pop %ebx 801004d8: 5e pop %esi 801004d9: 5f pop %edi 801004da: 5d pop %ebp 801004db: c3 ret 801004dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi --pos; 801004e0: 8d 70 ff lea -0x1(%eax),%esi if (pos > 0) { 801004e3: 85 c0 test %eax,%eax 801004e5: 75 98 jne 8010047f 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 b2 jmp 801004a6 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 6f ff ff ff jmp 8010047f uartputc('\b'); 80100510: 83 ec 0c sub $0xc,%esp 80100513: 6a 08 push $0x8 80100515: e8 b6 59 00 00 call 80105ed0 uartputc(' '); 8010051a: c7 04 24 20 00 00 00 movl $0x20,(%esp) 80100521: e8 aa 59 00 00 call 80105ed0 uartputc('\b'); 80100526: c7 04 24 08 00 00 00 movl $0x8,(%esp) 8010052d: e8 9e 59 00 00 call 80105ed0 80100532: 83 c4 10 add $0x10,%esp 80100535: e9 f8 fe ff ff jmp 80100432 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 outb(CRTPORT + 1, pos); 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 fa 42 00 00 call 80104860 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 45 42 00 00 call 801047c0 outb(CRTPORT + 1, pos); 8010057b: 88 5d e7 mov %bl,-0x19(%ebp) 8010057e: 83 c4 10 add $0x10,%esp 80100581: e9 20 ff ff ff jmp 801004a6 panic("pos under/overflow"); 80100586: 83 ec 0c sub $0xc,%esp 80100589: 68 25 74 10 80 push $0x80107425 8010058e: e8 fd fd ff ff call 80100390 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 : int consolewrite(struct inode *ip, char *buf, int n) { 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 18 sub $0x18,%esp int i; iunlock(ip); 801005a9: ff 75 08 push 0x8(%ebp) int consolewrite(struct inode *ip, char *buf, int n) { 801005ac: 8b 75 10 mov 0x10(%ebp),%esi iunlock(ip); 801005af: e8 cc 13 00 00 call 80101980 acquire(&cons.lock); 801005b4: c7 04 24 40 ef 10 80 movl $0x8010ef40,(%esp) 801005bb: e8 40 41 00 00 call 80104700 for (i = 0; i < n; i++) { 801005c0: 83 c4 10 add $0x10,%esp 801005c3: 85 f6 test %esi,%esi 801005c5: 7e 25 jle 801005ec 801005c7: 8b 5d 0c mov 0xc(%ebp),%ebx 801005ca: 8d 3c 33 lea (%ebx,%esi,1),%edi if (panicked) { 801005cd: 8b 15 78 ef 10 80 mov 0x8010ef78,%edx consputc(buf[i] & 0xff); 801005d3: 0f b6 03 movzbl (%ebx),%eax if (panicked) { 801005d6: 85 d2 test %edx,%edx 801005d8: 74 06 je 801005e0 asm volatile ("cli"); 801005da: fa cli for (;;) { 801005db: eb fe jmp 801005db 801005dd: 8d 76 00 lea 0x0(%esi),%esi 801005e0: e8 2b fe ff ff call 80100410 for (i = 0; i < n; i++) { 801005e5: 83 c3 01 add $0x1,%ebx 801005e8: 39 df cmp %ebx,%edi 801005ea: 75 e1 jne 801005cd } release(&cons.lock); 801005ec: 83 ec 0c sub $0xc,%esp 801005ef: 68 40 ef 10 80 push $0x8010ef40 801005f4: e8 a7 40 00 00 call 801046a0 ilock(ip); 801005f9: 58 pop %eax 801005fa: ff 75 08 push 0x8(%ebp) 801005fd: e8 9e 12 00 00 call 801018a0 return n; } 80100602: 8d 65 f4 lea -0xc(%ebp),%esp 80100605: 89 f0 mov %esi,%eax 80100607: 5b pop %ebx 80100608: 5e pop %esi 80100609: 5f pop %edi 8010060a: 5d pop %ebp 8010060b: c3 ret 8010060c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100610 : static void printint(int xx, int base, int sign) { 80100610: 55 push %ebp 80100611: 89 e5 mov %esp,%ebp 80100613: 57 push %edi 80100614: 56 push %esi 80100615: 53 push %ebx 80100616: 83 ec 2c sub $0x2c,%esp 80100619: 89 55 d4 mov %edx,-0x2c(%ebp) 8010061c: 89 4d d0 mov %ecx,-0x30(%ebp) if (sign && (sign = xx < 0)) { 8010061f: 85 c9 test %ecx,%ecx 80100621: 74 04 je 80100627 80100623: 85 c0 test %eax,%eax 80100625: 78 6d js 80100694 x = xx; 80100627: c7 45 d0 00 00 00 00 movl $0x0,-0x30(%ebp) 8010062e: 89 c1 mov %eax,%ecx i = 0; 80100630: 31 db xor %ebx,%ebx 80100632: 8d b6 00 00 00 00 lea 0x0(%esi),%esi buf[i++] = digits[x % base]; 80100638: 89 c8 mov %ecx,%eax 8010063a: 31 d2 xor %edx,%edx 8010063c: 89 de mov %ebx,%esi 8010063e: 89 cf mov %ecx,%edi 80100640: f7 75 d4 divl -0x2c(%ebp) 80100643: 8d 5b 01 lea 0x1(%ebx),%ebx 80100646: 0f b6 92 50 74 10 80 movzbl -0x7fef8bb0(%edx),%edx while ((x /= base) != 0); 8010064d: 89 c1 mov %eax,%ecx buf[i++] = digits[x % base]; 8010064f: 88 54 1d d7 mov %dl,-0x29(%ebp,%ebx,1) while ((x /= base) != 0); 80100653: 3b 7d d4 cmp -0x2c(%ebp),%edi 80100656: 73 e0 jae 80100638 if (sign) { 80100658: 8b 4d d0 mov -0x30(%ebp),%ecx 8010065b: 85 c9 test %ecx,%ecx 8010065d: 74 0c je 8010066b buf[i++] = '-'; 8010065f: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) buf[i++] = digits[x % base]; 80100664: 89 de mov %ebx,%esi buf[i++] = '-'; 80100666: ba 2d 00 00 00 mov $0x2d,%edx while (--i >= 0) { 8010066b: 8d 5c 35 d7 lea -0x29(%ebp,%esi,1),%ebx 8010066f: 0f be c2 movsbl %dl,%eax if (panicked) { 80100672: 8b 15 78 ef 10 80 mov 0x8010ef78,%edx 80100678: 85 d2 test %edx,%edx 8010067a: 74 04 je 80100680 8010067c: fa cli for (;;) { 8010067d: eb fe jmp 8010067d 8010067f: 90 nop 80100680: e8 8b fd ff ff call 80100410 while (--i >= 0) { 80100685: 8d 45 d7 lea -0x29(%ebp),%eax 80100688: 39 c3 cmp %eax,%ebx 8010068a: 74 0e je 8010069a consputc(buf[i]); 8010068c: 0f be 03 movsbl (%ebx),%eax 8010068f: 83 eb 01 sub $0x1,%ebx 80100692: eb de jmp 80100672 x = -xx; 80100694: f7 d8 neg %eax 80100696: 89 c1 mov %eax,%ecx 80100698: eb 96 jmp 80100630 } 8010069a: 83 c4 2c add $0x2c,%esp 8010069d: 5b pop %ebx 8010069e: 5e pop %esi 8010069f: 5f pop %edi 801006a0: 5d pop %ebp 801006a1: c3 ret 801006a2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801006a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801006b0 : void cprintf(char *fmt, ...) { 801006b0: 55 push %ebp 801006b1: 89 e5 mov %esp,%ebp 801006b3: 57 push %edi 801006b4: 56 push %esi 801006b5: 53 push %ebx 801006b6: 83 ec 1c sub $0x1c,%esp locking = cons.locking; 801006b9: a1 74 ef 10 80 mov 0x8010ef74,%eax 801006be: 89 45 e4 mov %eax,-0x1c(%ebp) if (locking) { 801006c1: 85 c0 test %eax,%eax 801006c3: 0f 85 27 01 00 00 jne 801007f0 if (fmt == 0) { 801006c9: 8b 75 08 mov 0x8(%ebp),%esi 801006cc: 85 f6 test %esi,%esi 801006ce: 0f 84 ac 01 00 00 je 80100880 for (i = 0; (c = fmt[i] & 0xff) != 0; i++) { 801006d4: 0f b6 06 movzbl (%esi),%eax argp = (uint*)(void*)(&fmt + 1); 801006d7: 8d 7d 0c lea 0xc(%ebp),%edi for (i = 0; (c = fmt[i] & 0xff) != 0; i++) { 801006da: 31 db xor %ebx,%ebx 801006dc: 85 c0 test %eax,%eax 801006de: 74 56 je 80100736 if (c != '%') { 801006e0: 83 f8 25 cmp $0x25,%eax 801006e3: 0f 85 cf 00 00 00 jne 801007b8 c = fmt[++i] & 0xff; 801006e9: 83 c3 01 add $0x1,%ebx 801006ec: 0f b6 14 1e movzbl (%esi,%ebx,1),%edx if (c == 0) { 801006f0: 85 d2 test %edx,%edx 801006f2: 74 42 je 80100736 switch (c) { 801006f4: 83 fa 70 cmp $0x70,%edx 801006f7: 0f 84 90 00 00 00 je 8010078d 801006fd: 7f 51 jg 80100750 801006ff: 83 fa 25 cmp $0x25,%edx 80100702: 0f 84 c0 00 00 00 je 801007c8 80100708: 83 fa 64 cmp $0x64,%edx 8010070b: 0f 85 f4 00 00 00 jne 80100805 printint(*argp++, 10, 1); 80100711: 8d 47 04 lea 0x4(%edi),%eax 80100714: b9 01 00 00 00 mov $0x1,%ecx 80100719: ba 0a 00 00 00 mov $0xa,%edx 8010071e: 89 45 e0 mov %eax,-0x20(%ebp) 80100721: 8b 07 mov (%edi),%eax 80100723: e8 e8 fe ff ff call 80100610 80100728: 8b 7d e0 mov -0x20(%ebp),%edi for (i = 0; (c = fmt[i] & 0xff) != 0; i++) { 8010072b: 83 c3 01 add $0x1,%ebx 8010072e: 0f b6 04 1e movzbl (%esi,%ebx,1),%eax 80100732: 85 c0 test %eax,%eax 80100734: 75 aa jne 801006e0 if (locking) { 80100736: 8b 45 e4 mov -0x1c(%ebp),%eax 80100739: 85 c0 test %eax,%eax 8010073b: 0f 85 22 01 00 00 jne 80100863 } 80100741: 8d 65 f4 lea -0xc(%ebp),%esp 80100744: 5b pop %ebx 80100745: 5e pop %esi 80100746: 5f pop %edi 80100747: 5d pop %ebp 80100748: c3 ret 80100749: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi switch (c) { 80100750: 83 fa 73 cmp $0x73,%edx 80100753: 75 33 jne 80100788 if ((s = (char*)*argp++) == 0) { 80100755: 8d 47 04 lea 0x4(%edi),%eax 80100758: 8b 3f mov (%edi),%edi 8010075a: 89 45 e0 mov %eax,-0x20(%ebp) 8010075d: 85 ff test %edi,%edi 8010075f: 0f 84 e3 00 00 00 je 80100848 for (; *s; s++) { 80100765: 0f be 07 movsbl (%edi),%eax 80100768: 84 c0 test %al,%al 8010076a: 0f 84 08 01 00 00 je 80100878 if (panicked) { 80100770: 8b 15 78 ef 10 80 mov 0x8010ef78,%edx 80100776: 85 d2 test %edx,%edx 80100778: 0f 84 b2 00 00 00 je 80100830 8010077e: fa cli for (;;) { 8010077f: eb fe jmp 8010077f 80100781: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi switch (c) { 80100788: 83 fa 78 cmp $0x78,%edx 8010078b: 75 78 jne 80100805 printint(*argp++, 16, 0); 8010078d: 8d 47 04 lea 0x4(%edi),%eax 80100790: 31 c9 xor %ecx,%ecx 80100792: ba 10 00 00 00 mov $0x10,%edx for (i = 0; (c = fmt[i] & 0xff) != 0; i++) { 80100797: 83 c3 01 add $0x1,%ebx printint(*argp++, 16, 0); 8010079a: 89 45 e0 mov %eax,-0x20(%ebp) 8010079d: 8b 07 mov (%edi),%eax 8010079f: e8 6c fe ff ff call 80100610 for (i = 0; (c = fmt[i] & 0xff) != 0; i++) { 801007a4: 0f b6 04 1e movzbl (%esi,%ebx,1),%eax printint(*argp++, 16, 0); 801007a8: 8b 7d e0 mov -0x20(%ebp),%edi for (i = 0; (c = fmt[i] & 0xff) != 0; i++) { 801007ab: 85 c0 test %eax,%eax 801007ad: 0f 85 2d ff ff ff jne 801006e0 801007b3: eb 81 jmp 80100736 801007b5: 8d 76 00 lea 0x0(%esi),%esi if (panicked) { 801007b8: 8b 0d 78 ef 10 80 mov 0x8010ef78,%ecx 801007be: 85 c9 test %ecx,%ecx 801007c0: 74 14 je 801007d6 801007c2: fa cli for (;;) { 801007c3: eb fe jmp 801007c3 801007c5: 8d 76 00 lea 0x0(%esi),%esi if (panicked) { 801007c8: a1 78 ef 10 80 mov 0x8010ef78,%eax 801007cd: 85 c0 test %eax,%eax 801007cf: 75 6c jne 8010083d 801007d1: b8 25 00 00 00 mov $0x25,%eax 801007d6: e8 35 fc ff ff call 80100410 for (i = 0; (c = fmt[i] & 0xff) != 0; i++) { 801007db: 83 c3 01 add $0x1,%ebx 801007de: 0f b6 04 1e movzbl (%esi,%ebx,1),%eax 801007e2: 85 c0 test %eax,%eax 801007e4: 0f 85 f6 fe ff ff jne 801006e0 801007ea: e9 47 ff ff ff jmp 80100736 801007ef: 90 nop acquire(&cons.lock); 801007f0: 83 ec 0c sub $0xc,%esp 801007f3: 68 40 ef 10 80 push $0x8010ef40 801007f8: e8 03 3f 00 00 call 80104700 801007fd: 83 c4 10 add $0x10,%esp 80100800: e9 c4 fe ff ff jmp 801006c9 if (panicked) { 80100805: 8b 0d 78 ef 10 80 mov 0x8010ef78,%ecx 8010080b: 85 c9 test %ecx,%ecx 8010080d: 75 31 jne 80100840 8010080f: b8 25 00 00 00 mov $0x25,%eax 80100814: 89 55 e0 mov %edx,-0x20(%ebp) 80100817: e8 f4 fb ff ff call 80100410 8010081c: 8b 15 78 ef 10 80 mov 0x8010ef78,%edx 80100822: 85 d2 test %edx,%edx 80100824: 8b 55 e0 mov -0x20(%ebp),%edx 80100827: 74 2e je 80100857 80100829: fa cli for (;;) { 8010082a: eb fe jmp 8010082a 8010082c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100830: e8 db fb ff ff call 80100410 for (; *s; s++) { 80100835: 83 c7 01 add $0x1,%edi 80100838: e9 28 ff ff ff jmp 80100765 8010083d: fa cli for (;;) { 8010083e: eb fe jmp 8010083e 80100840: fa cli 80100841: eb fe jmp 80100841 80100843: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100847: 90 nop s = "(null)"; 80100848: bf 38 74 10 80 mov $0x80107438,%edi for (; *s; s++) { 8010084d: b8 28 00 00 00 mov $0x28,%eax 80100852: e9 19 ff ff ff jmp 80100770 80100857: 89 d0 mov %edx,%eax 80100859: e8 b2 fb ff ff call 80100410 8010085e: e9 c8 fe ff ff jmp 8010072b release(&cons.lock); 80100863: 83 ec 0c sub $0xc,%esp 80100866: 68 40 ef 10 80 push $0x8010ef40 8010086b: e8 30 3e 00 00 call 801046a0 80100870: 83 c4 10 add $0x10,%esp } 80100873: e9 c9 fe ff ff jmp 80100741 if ((s = (char*)*argp++) == 0) { 80100878: 8b 7d e0 mov -0x20(%ebp),%edi 8010087b: e9 ab fe ff ff jmp 8010072b panic("null fmt"); 80100880: 83 ec 0c sub $0xc,%esp 80100883: 68 3f 74 10 80 push $0x8010743f 80100888: e8 03 fb ff ff call 80100390 8010088d: 8d 76 00 lea 0x0(%esi),%esi 80100890 : int consoleget(void) { 80100890: 55 push %ebp 80100891: 89 e5 mov %esp,%ebp 80100893: 83 ec 24 sub $0x24,%esp acquire(&cons.lock); 80100896: 68 40 ef 10 80 push $0x8010ef40 8010089b: e8 60 3e 00 00 call 80104700 while ((c = kbdgetc()) <= 0) { 801008a0: 83 c4 10 add $0x10,%esp 801008a3: eb 05 jmp 801008aa 801008a5: 8d 76 00 lea 0x0(%esi),%esi if (c == 0) { 801008a8: 74 26 je 801008d0 while ((c = kbdgetc()) <= 0) { 801008aa: e8 61 1f 00 00 call 80102810 801008af: 85 c0 test %eax,%eax 801008b1: 7e f5 jle 801008a8 release(&cons.lock); 801008b3: 83 ec 0c sub $0xc,%esp 801008b6: 89 45 f4 mov %eax,-0xc(%ebp) 801008b9: 68 40 ef 10 80 push $0x8010ef40 801008be: e8 dd 3d 00 00 call 801046a0 } 801008c3: 8b 45 f4 mov -0xc(%ebp),%eax 801008c6: c9 leave 801008c7: c3 ret 801008c8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801008cf: 90 nop c = kbdgetc(); 801008d0: e8 3b 1f 00 00 call 80102810 801008d5: eb d3 jmp 801008aa 801008d7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801008de: 66 90 xchg %ax,%ax 801008e0 : void consoleintr(int (*getc)(void)) { 801008e0: 55 push %ebp 801008e1: 89 e5 mov %esp,%ebp 801008e3: 57 push %edi 801008e4: 56 push %esi int c, doprocdump = 0; 801008e5: 31 f6 xor %esi,%esi void consoleintr(int (*getc)(void)) { 801008e7: 53 push %ebx 801008e8: 83 ec 28 sub $0x28,%esp 801008eb: 8b 7d 08 mov 0x8(%ebp),%edi acquire(&cons.lock); 801008ee: 68 40 ef 10 80 push $0x8010ef40 801008f3: e8 08 3e 00 00 call 80104700 while ((c = getc()) >= 0) { 801008f8: 83 c4 10 add $0x10,%esp 801008fb: eb 1a jmp 80100917 801008fd: 8d 76 00 lea 0x0(%esi),%esi switch (c) { 80100900: 83 fb 08 cmp $0x8,%ebx 80100903: 0f 84 07 01 00 00 je 80100a10 80100909: 83 fb 10 cmp $0x10,%ebx 8010090c: 0f 85 4a 01 00 00 jne 80100a5c 80100912: be 01 00 00 00 mov $0x1,%esi while ((c = getc()) >= 0) { 80100917: ff d7 call *%edi 80100919: 89 c3 mov %eax,%ebx 8010091b: 85 c0 test %eax,%eax 8010091d: 0f 88 1d 01 00 00 js 80100a40 switch (c) { 80100923: 83 fb 15 cmp $0x15,%ebx 80100926: 0f 84 9e 00 00 00 je 801009ca 8010092c: 7e d2 jle 80100900 8010092e: 83 fb 7f cmp $0x7f,%ebx 80100931: 0f 84 d9 00 00 00 je 80100a10 if (c != 0 && input->e - input->r < INPUT_BUF) { 80100937: 8b 15 80 ee 10 80 mov 0x8010ee80,%edx 8010093d: 8b 82 88 00 00 00 mov 0x88(%edx),%eax 80100943: 89 c1 mov %eax,%ecx 80100945: 2b 8a 80 00 00 00 sub 0x80(%edx),%ecx 8010094b: 83 f9 7f cmp $0x7f,%ecx 8010094e: 77 c7 ja 80100917 if (panicked) { 80100950: 8b 0d 78 ef 10 80 mov 0x8010ef78,%ecx 80100956: 89 4d e4 mov %ecx,-0x1c(%ebp) input->buf[input->e++ % INPUT_BUF] = c; 80100959: 8d 48 01 lea 0x1(%eax),%ecx 8010095c: 83 e0 7f and $0x7f,%eax 8010095f: 89 8a 88 00 00 00 mov %ecx,0x88(%edx) c = (c == '\r') ? '\n' : c; 80100965: 83 fb 0d cmp $0xd,%ebx 80100968: 0f 84 1d 01 00 00 je 80100a8b input->buf[input->e++ % INPUT_BUF] = c; 8010096e: 88 1c 02 mov %bl,(%edx,%eax,1) if (panicked) { 80100971: 8b 55 e4 mov -0x1c(%ebp),%edx 80100974: 85 d2 test %edx,%edx 80100976: 0f 85 1a 01 00 00 jne 80100a96 8010097c: 89 d8 mov %ebx,%eax 8010097e: e8 8d fa ff ff call 80100410 if (c == '\n' || c == C('D') || input->e == input->r + INPUT_BUF) { 80100983: a1 80 ee 10 80 mov 0x8010ee80,%eax 80100988: 83 fb 0a cmp $0xa,%ebx 8010098b: 0f 84 1e 01 00 00 je 80100aaf 80100991: 83 fb 04 cmp $0x4,%ebx 80100994: 0f 84 15 01 00 00 je 80100aaf 8010099a: 8b 88 80 00 00 00 mov 0x80(%eax),%ecx 801009a0: 8d 91 80 00 00 00 lea 0x80(%ecx),%edx 801009a6: 39 90 88 00 00 00 cmp %edx,0x88(%eax) 801009ac: 0f 85 65 ff ff ff jne 80100917 801009b2: e9 fe 00 00 00 jmp 80100ab5 801009b7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801009be: 66 90 xchg %ax,%ax 801009c0: b8 00 01 00 00 mov $0x100,%eax 801009c5: e8 46 fa ff ff call 80100410 while (input->e != input->w && 801009ca: 8b 15 80 ee 10 80 mov 0x8010ee80,%edx 801009d0: 8b 82 88 00 00 00 mov 0x88(%edx),%eax 801009d6: 3b 82 84 00 00 00 cmp 0x84(%edx),%eax 801009dc: 0f 84 35 ff ff ff je 80100917 input->buf[(input->e - 1) % INPUT_BUF] != '\n') { 801009e2: 83 e8 01 sub $0x1,%eax 801009e5: 89 c1 mov %eax,%ecx 801009e7: 83 e1 7f and $0x7f,%ecx while (input->e != input->w && 801009ea: 80 3c 0a 0a cmpb $0xa,(%edx,%ecx,1) 801009ee: 0f 84 23 ff ff ff je 80100917 if (panicked) { 801009f4: 8b 1d 78 ef 10 80 mov 0x8010ef78,%ebx input->e--; 801009fa: 89 82 88 00 00 00 mov %eax,0x88(%edx) if (panicked) { 80100a00: 85 db test %ebx,%ebx 80100a02: 74 bc je 801009c0 80100a04: fa cli for (;;) { 80100a05: eb fe jmp 80100a05 80100a07: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100a0e: 66 90 xchg %ax,%ax if (input->e != input->w) { 80100a10: a1 80 ee 10 80 mov 0x8010ee80,%eax 80100a15: 8b 90 88 00 00 00 mov 0x88(%eax),%edx 80100a1b: 3b 90 84 00 00 00 cmp 0x84(%eax),%edx 80100a21: 0f 84 f0 fe ff ff je 80100917 if (panicked) { 80100a27: 8b 0d 78 ef 10 80 mov 0x8010ef78,%ecx input->e--; 80100a2d: 83 ea 01 sub $0x1,%edx 80100a30: 89 90 88 00 00 00 mov %edx,0x88(%eax) if (panicked) { 80100a36: 85 c9 test %ecx,%ecx 80100a38: 74 36 je 80100a70 80100a3a: fa cli for (;;) { 80100a3b: eb fe jmp 80100a3b 80100a3d: 8d 76 00 lea 0x0(%esi),%esi release(&cons.lock); 80100a40: 83 ec 0c sub $0xc,%esp 80100a43: 68 40 ef 10 80 push $0x8010ef40 80100a48: e8 53 3c 00 00 call 801046a0 if (doprocdump) { 80100a4d: 83 c4 10 add $0x10,%esp 80100a50: 85 f6 test %esi,%esi 80100a52: 75 2b jne 80100a7f } 80100a54: 8d 65 f4 lea -0xc(%ebp),%esp 80100a57: 5b pop %ebx 80100a58: 5e pop %esi 80100a59: 5f pop %edi 80100a5a: 5d pop %ebp 80100a5b: c3 ret if (c != 0 && input->e - input->r < INPUT_BUF) { 80100a5c: 85 db test %ebx,%ebx 80100a5e: 0f 84 b3 fe ff ff je 80100917 80100a64: e9 ce fe ff ff jmp 80100937 80100a69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100a70: b8 00 01 00 00 mov $0x100,%eax 80100a75: e8 96 f9 ff ff call 80100410 80100a7a: e9 98 fe ff ff jmp 80100917 } 80100a7f: 8d 65 f4 lea -0xc(%ebp),%esp 80100a82: 5b pop %ebx 80100a83: 5e pop %esi 80100a84: 5f pop %edi 80100a85: 5d pop %ebp procdump(); // now call procdump() wo. cons.lock held 80100a86: e9 b5 38 00 00 jmp 80104340 input->buf[input->e++ % INPUT_BUF] = c; 80100a8b: c6 04 02 0a movb $0xa,(%edx,%eax,1) if (panicked) { 80100a8f: 8b 45 e4 mov -0x1c(%ebp),%eax 80100a92: 85 c0 test %eax,%eax 80100a94: 74 0a je 80100aa0 80100a96: fa cli for (;;) { 80100a97: eb fe jmp 80100a97 80100a99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100aa0: b8 0a 00 00 00 mov $0xa,%eax 80100aa5: e8 66 f9 ff ff call 80100410 input->w = input->e; 80100aaa: a1 80 ee 10 80 mov 0x8010ee80,%eax 80100aaf: 8b 90 88 00 00 00 mov 0x88(%eax),%edx 80100ab5: 89 90 84 00 00 00 mov %edx,0x84(%eax) wakeup(&(input->r)); 80100abb: 83 ec 0c sub $0xc,%esp 80100abe: 83 e8 80 sub $0xffffff80,%eax 80100ac1: 50 push %eax 80100ac2: e8 99 37 00 00 call 80104260 80100ac7: 83 c4 10 add $0x10,%esp 80100aca: e9 48 fe ff ff jmp 80100917 80100acf: 90 nop 80100ad0 : void consoleinit(void) { 80100ad0: 55 push %ebp 80100ad1: 89 e5 mov %esp,%ebp 80100ad3: 83 ec 10 sub $0x10,%esp initlock(&cons.lock, "console"); 80100ad6: 68 48 74 10 80 push $0x80107448 80100adb: 68 40 ef 10 80 push $0x8010ef40 80100ae0: e8 4b 3a 00 00 call 80104530 devsw[CONSOLE].write = consolewrite; devsw[CONSOLE].read = consoleread; cons.locking = 1; ioapicenable(IRQ_KBD, 0); 80100ae5: 58 pop %eax 80100ae6: 5a pop %edx 80100ae7: 6a 00 push $0x0 80100ae9: 6a 01 push $0x1 input = &inputBuffer; 80100aeb: c7 05 80 ee 10 80 a0 movl $0x8010eea0,0x8010ee80 80100af2: ee 10 80 devsw[CONSOLE].write = consolewrite; 80100af5: c7 05 2c f9 10 80 a0 movl $0x801005a0,0x8010f92c 80100afc: 05 10 80 devsw[CONSOLE].read = consoleread; 80100aff: c7 05 28 f9 10 80 80 movl $0x80100280,0x8010f928 80100b06: 02 10 80 cons.locking = 1; 80100b09: c7 05 74 ef 10 80 01 movl $0x1,0x8010ef74 80100b10: 00 00 00 ioapicenable(IRQ_KBD, 0); 80100b13: e8 88 1a 00 00 call 801025a0 } 80100b18: 83 c4 10 add $0x10,%esp 80100b1b: c9 leave 80100b1c: c3 ret 80100b1d: 66 90 xchg %ax,%ax 80100b1f: 90 nop 80100b20 : #include "proc.h" #include "defs.h" #include "x86.h" #include "elf.h" void cleanupexec(pde_t * pgdir, struct inode *ip) { 80100b20: 55 push %ebp 80100b21: 89 e5 mov %esp,%ebp 80100b23: 53 push %ebx 80100b24: 83 ec 04 sub $0x4,%esp 80100b27: 8b 45 08 mov 0x8(%ebp),%eax 80100b2a: 8b 5d 0c mov 0xc(%ebp),%ebx if (pgdir) { 80100b2d: 85 c0 test %eax,%eax 80100b2f: 74 0c je 80100b3d freevm(pgdir); 80100b31: 83 ec 0c sub $0xc,%esp 80100b34: 50 push %eax 80100b35: e8 a6 64 00 00 call 80106fe0 80100b3a: 83 c4 10 add $0x10,%esp } if (ip) { 80100b3d: 85 db test %ebx,%ebx 80100b3f: 74 1f je 80100b60 iunlockput(ip); 80100b41: 83 ec 0c sub $0xc,%esp 80100b44: 53 push %ebx 80100b45: e8 e6 0f 00 00 call 80101b30 end_op(); } } 80100b4a: 8b 5d fc mov -0x4(%ebp),%ebx end_op(); 80100b4d: 83 c4 10 add $0x10,%esp } 80100b50: c9 leave end_op(); 80100b51: e9 9a 23 00 00 jmp 80102ef0 80100b56: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100b5d: 8d 76 00 lea 0x0(%esi),%esi } 80100b60: 8b 5d fc mov -0x4(%ebp),%ebx 80100b63: c9 leave 80100b64: c3 ret 80100b65: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100b6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100b70 : int exec(char *path, char **argv) { 80100b70: 55 push %ebp 80100b71: 89 e5 mov %esp,%ebp 80100b73: 57 push %edi 80100b74: 56 push %esi 80100b75: 53 push %ebx 80100b76: 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(); 80100b7c: e8 4f 2f 00 00 call 80103ad0 80100b81: 89 85 ec fe ff ff mov %eax,-0x114(%ebp) begin_op(); 80100b87: e8 f4 22 00 00 call 80102e80 if ((ip = namei(path)) == 0) { 80100b8c: 83 ec 0c sub $0xc,%esp 80100b8f: ff 75 08 push 0x8(%ebp) 80100b92: e8 29 16 00 00 call 801021c0 80100b97: 83 c4 10 add $0x10,%esp 80100b9a: 85 c0 test %eax,%eax 80100b9c: 0f 84 49 03 00 00 je 80100eeb end_op(); cprintf("exec: fail\n"); return -1; } ilock(ip); 80100ba2: 83 ec 0c sub $0xc,%esp 80100ba5: 89 c7 mov %eax,%edi 80100ba7: 50 push %eax 80100ba8: e8 f3 0c 00 00 call 801018a0 pgdir = 0; // Check ELF header if (readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf)) { 80100bad: 8d 85 24 ff ff ff lea -0xdc(%ebp),%eax 80100bb3: 6a 34 push $0x34 80100bb5: 6a 00 push $0x0 80100bb7: 50 push %eax 80100bb8: 57 push %edi 80100bb9: e8 f2 0f 00 00 call 80101bb0 80100bbe: 83 c4 20 add $0x20,%esp 80100bc1: 83 f8 34 cmp $0x34,%eax 80100bc4: 0f 85 d6 02 00 00 jne 80100ea0 cleanupexec(pgdir, ip); return -1; } if (elf.magic != ELF_MAGIC) { 80100bca: 81 bd 24 ff ff ff 7f cmpl $0x464c457f,-0xdc(%ebp) 80100bd1: 45 4c 46 80100bd4: 0f 85 c6 02 00 00 jne 80100ea0 cleanupexec(pgdir, ip); return -1; } if ((pgdir = setupkvm()) == 0) { 80100bda: e8 81 64 00 00 call 80107060 80100bdf: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp) 80100be5: 85 c0 test %eax,%eax 80100be7: 0f 84 b3 02 00 00 je 80100ea0 return -1; } // Load program into memory. sz = 0; for (i = 0, off = elf.phoff; i < elf.phnum; i++, off += sizeof(ph)) { 80100bed: 66 83 bd 50 ff ff ff cmpw $0x0,-0xb0(%ebp) 80100bf4: 00 80100bf5: 8b 9d 40 ff ff ff mov -0xc0(%ebp),%ebx 80100bfb: 0f 84 ba 02 00 00 je 80100ebb sz = 0; 80100c01: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) 80100c08: 00 00 00 for (i = 0, off = elf.phoff; i < elf.phnum; i++, off += sizeof(ph)) { 80100c0b: 31 f6 xor %esi,%esi 80100c0d: e9 8c 00 00 00 jmp 80100c9e 80100c12: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if (readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) { cleanupexec(pgdir, ip); return -1; } if (ph.type != ELF_PROG_LOAD) { 80100c18: 83 bd 04 ff ff ff 01 cmpl $0x1,-0xfc(%ebp) 80100c1f: 75 6c jne 80100c8d continue; } if (ph.memsz < ph.filesz) { 80100c21: 8b 85 18 ff ff ff mov -0xe8(%ebp),%eax 80100c27: 3b 85 14 ff ff ff cmp -0xec(%ebp),%eax 80100c2d: 0f 82 87 00 00 00 jb 80100cba cleanupexec(pgdir, ip); return -1; } if (ph.vaddr + ph.memsz < ph.vaddr) { 80100c33: 03 85 0c ff ff ff add -0xf4(%ebp),%eax 80100c39: 72 7f jb 80100cba cleanupexec(pgdir, ip); return -1; } if ((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) { 80100c3b: 83 ec 04 sub $0x4,%esp 80100c3e: 50 push %eax 80100c3f: ff b5 f0 fe ff ff push -0x110(%ebp) 80100c45: ff b5 f4 fe ff ff push -0x10c(%ebp) 80100c4b: e8 30 62 00 00 call 80106e80 80100c50: 83 c4 10 add $0x10,%esp 80100c53: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) 80100c59: 85 c0 test %eax,%eax 80100c5b: 74 5d je 80100cba cleanupexec(pgdir, ip); return -1; } if (ph.vaddr % PGSIZE != 0) { 80100c5d: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax 80100c63: a9 ff 0f 00 00 test $0xfff,%eax 80100c68: 75 50 jne 80100cba cleanupexec(pgdir, ip); return -1; } if (loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) { 80100c6a: 83 ec 0c sub $0xc,%esp 80100c6d: ff b5 14 ff ff ff push -0xec(%ebp) 80100c73: ff b5 08 ff ff ff push -0xf8(%ebp) 80100c79: 57 push %edi 80100c7a: 50 push %eax 80100c7b: ff b5 f4 fe ff ff push -0x10c(%ebp) 80100c81: e8 0a 61 00 00 call 80106d90 80100c86: 83 c4 20 add $0x20,%esp 80100c89: 85 c0 test %eax,%eax 80100c8b: 78 2d js 80100cba for (i = 0, off = elf.phoff; i < elf.phnum; i++, off += sizeof(ph)) { 80100c8d: 0f b7 85 50 ff ff ff movzwl -0xb0(%ebp),%eax 80100c94: 83 c6 01 add $0x1,%esi 80100c97: 83 c3 20 add $0x20,%ebx 80100c9a: 39 f0 cmp %esi,%eax 80100c9c: 7e 4a jle 80100ce8 if (readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) { 80100c9e: 8d 85 04 ff ff ff lea -0xfc(%ebp),%eax 80100ca4: 6a 20 push $0x20 80100ca6: 53 push %ebx 80100ca7: 50 push %eax 80100ca8: 57 push %edi 80100ca9: e8 02 0f 00 00 call 80101bb0 80100cae: 83 c4 10 add $0x10,%esp 80100cb1: 83 f8 20 cmp $0x20,%eax 80100cb4: 0f 84 5e ff ff ff je 80100c18 freevm(pgdir); 80100cba: 83 ec 0c sub $0xc,%esp 80100cbd: ff b5 f4 fe ff ff push -0x10c(%ebp) 80100cc3: e8 18 63 00 00 call 80106fe0 iunlockput(ip); 80100cc8: 89 3c 24 mov %edi,(%esp) 80100ccb: e8 60 0e 00 00 call 80101b30 end_op(); 80100cd0: e8 1b 22 00 00 call 80102ef0 } 80100cd5: 83 c4 10 add $0x10,%esp cleanupexec(pgdir, ip); return -1; 80100cd8: b8 ff ff ff ff mov $0xffffffff,%eax curproc->tf->eip = elf.entry; // main curproc->tf->esp = sp; switchuvm(curproc); freevm(oldpgdir); return 0; } 80100cdd: 8d 65 f4 lea -0xc(%ebp),%esp 80100ce0: 5b pop %ebx 80100ce1: 5e pop %esi 80100ce2: 5f pop %edi 80100ce3: 5d pop %ebp 80100ce4: c3 ret 80100ce5: 8d 76 00 lea 0x0(%esi),%esi sz = PGROUNDUP(sz); 80100ce8: 8b b5 f0 fe ff ff mov -0x110(%ebp),%esi 80100cee: 81 c6 ff 0f 00 00 add $0xfff,%esi 80100cf4: 81 e6 00 f0 ff ff and $0xfffff000,%esi if ((sz = allocuvm(pgdir, sz, sz + 2 * PGSIZE)) == 0) { 80100cfa: 8d 9e 00 20 00 00 lea 0x2000(%esi),%ebx iunlockput(ip); 80100d00: 83 ec 0c sub $0xc,%esp 80100d03: 57 push %edi 80100d04: e8 27 0e 00 00 call 80101b30 end_op(); 80100d09: e8 e2 21 00 00 call 80102ef0 if ((sz = allocuvm(pgdir, sz, sz + 2 * PGSIZE)) == 0) { 80100d0e: 83 c4 0c add $0xc,%esp 80100d11: 53 push %ebx 80100d12: 56 push %esi 80100d13: ff b5 f4 fe ff ff push -0x10c(%ebp) 80100d19: e8 62 61 00 00 call 80106e80 80100d1e: 83 c4 10 add $0x10,%esp 80100d21: 89 c7 mov %eax,%edi 80100d23: 85 c0 test %eax,%eax 80100d25: 0f 84 87 00 00 00 je 80100db2 clearpteu(pgdir, (char*)(sz - 2 * PGSIZE)); 80100d2b: 83 ec 08 sub $0x8,%esp 80100d2e: 8d 80 00 e0 ff ff lea -0x2000(%eax),%eax for (argc = 0; argv[argc]; argc++) { 80100d34: 89 fb mov %edi,%ebx 80100d36: 31 f6 xor %esi,%esi clearpteu(pgdir, (char*)(sz - 2 * PGSIZE)); 80100d38: 50 push %eax 80100d39: ff b5 f4 fe ff ff push -0x10c(%ebp) 80100d3f: e8 bc 63 00 00 call 80107100 for (argc = 0; argv[argc]; argc++) { 80100d44: 8b 45 0c mov 0xc(%ebp),%eax 80100d47: 83 c4 10 add $0x10,%esp 80100d4a: 8b 08 mov (%eax),%ecx 80100d4c: 85 c9 test %ecx,%ecx 80100d4e: 0f 84 73 01 00 00 je 80100ec7 80100d54: 89 bd f0 fe ff ff mov %edi,-0x110(%ebp) 80100d5a: 8b 7d 0c mov 0xc(%ebp),%edi 80100d5d: eb 1f jmp 80100d7e 80100d5f: 90 nop 80100d60: 8d 46 01 lea 0x1(%esi),%eax ustack[3 + argc] = sp; 80100d63: 89 9c b5 64 ff ff ff mov %ebx,-0x9c(%ebp,%esi,4) 80100d6a: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx for (argc = 0; argv[argc]; argc++) { 80100d70: 8b 0c 87 mov (%edi,%eax,4),%ecx 80100d73: 85 c9 test %ecx,%ecx 80100d75: 74 59 je 80100dd0 if (argc >= MAXARG) { 80100d77: 83 f8 20 cmp $0x20,%eax 80100d7a: 74 36 je 80100db2 80100d7c: 89 c6 mov %eax,%esi sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100d7e: 83 ec 0c sub $0xc,%esp 80100d81: 51 push %ecx 80100d82: e8 39 3c 00 00 call 801049c0 if (copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) { 80100d87: 5a pop %edx 80100d88: ff 34 b7 push (%edi,%esi,4) sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100d8b: 29 c3 sub %eax,%ebx 80100d8d: 83 eb 01 sub $0x1,%ebx if (copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) { 80100d90: e8 2b 3c 00 00 call 801049c0 sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100d95: 83 e3 fc and $0xfffffffc,%ebx if (copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) { 80100d98: 83 c0 01 add $0x1,%eax 80100d9b: 50 push %eax 80100d9c: ff 34 b7 push (%edi,%esi,4) 80100d9f: 53 push %ebx 80100da0: ff b5 f4 fe ff ff push -0x10c(%ebp) 80100da6: e8 45 65 00 00 call 801072f0 80100dab: 83 c4 20 add $0x20,%esp 80100dae: 85 c0 test %eax,%eax 80100db0: 79 ae jns 80100d60 freevm(pgdir); 80100db2: 83 ec 0c sub $0xc,%esp 80100db5: ff b5 f4 fe ff ff push -0x10c(%ebp) 80100dbb: e8 20 62 00 00 call 80106fe0 } 80100dc0: 83 c4 10 add $0x10,%esp } 80100dc3: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 80100dc6: b8 ff ff ff ff mov $0xffffffff,%eax } 80100dcb: 5b pop %ebx 80100dcc: 5e pop %esi 80100dcd: 5f pop %edi 80100dce: 5d pop %ebp 80100dcf: c3 ret ustack[2] = sp - (argc + 1) * 4; // argv pointer 80100dd0: 8d 0c b5 08 00 00 00 lea 0x8(,%esi,4),%ecx ustack[3 + argc] = 0; 80100dd7: 8b bd f0 fe ff ff mov -0x110(%ebp),%edi 80100ddd: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) 80100de3: 8d 46 04 lea 0x4(%esi),%eax sp -= (3 + argc + 1) * 4; 80100de6: 8d 71 0c lea 0xc(%ecx),%esi ustack[3 + argc] = 0; 80100de9: c7 84 85 58 ff ff ff movl $0x0,-0xa8(%ebp,%eax,4) 80100df0: 00 00 00 00 ustack[1] = argc; 80100df4: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax if (copyout(pgdir, sp, ustack, (3 + argc + 1) * 4) < 0) { 80100dfa: 56 push %esi ustack[1] = argc; 80100dfb: 89 85 5c ff ff ff mov %eax,-0xa4(%ebp) ustack[2] = sp - (argc + 1) * 4; // argv pointer 80100e01: 89 d8 mov %ebx,%eax sp -= (3 + argc + 1) * 4; 80100e03: 29 f3 sub %esi,%ebx if (copyout(pgdir, sp, ustack, (3 + argc + 1) * 4) < 0) { 80100e05: 52 push %edx ustack[2] = sp - (argc + 1) * 4; // argv pointer 80100e06: 29 c8 sub %ecx,%eax if (copyout(pgdir, sp, ustack, (3 + argc + 1) * 4) < 0) { 80100e08: 53 push %ebx 80100e09: ff b5 f4 fe ff ff push -0x10c(%ebp) ustack[0] = 0xffffffff; // fake return PC 80100e0f: c7 85 58 ff ff ff ff movl $0xffffffff,-0xa8(%ebp) 80100e16: ff ff ff ustack[2] = sp - (argc + 1) * 4; // argv pointer 80100e19: 89 85 60 ff ff ff mov %eax,-0xa0(%ebp) if (copyout(pgdir, sp, ustack, (3 + argc + 1) * 4) < 0) { 80100e1f: e8 cc 64 00 00 call 801072f0 80100e24: 83 c4 10 add $0x10,%esp 80100e27: 85 c0 test %eax,%eax 80100e29: 0f 88 db 00 00 00 js 80100f0a for (last = s = path; *s; s++) { 80100e2f: 8b 45 08 mov 0x8(%ebp),%eax 80100e32: 8b 55 08 mov 0x8(%ebp),%edx 80100e35: 8b 4d 08 mov 0x8(%ebp),%ecx 80100e38: 0f b6 00 movzbl (%eax),%eax 80100e3b: 84 c0 test %al,%al 80100e3d: 74 10 je 80100e4f 80100e3f: 90 nop last = s + 1; 80100e40: 83 c1 01 add $0x1,%ecx 80100e43: 3c 2f cmp $0x2f,%al for (last = s = path; *s; s++) { 80100e45: 0f b6 01 movzbl (%ecx),%eax last = s + 1; 80100e48: 0f 44 d1 cmove %ecx,%edx for (last = s = path; *s; s++) { 80100e4b: 84 c0 test %al,%al 80100e4d: 75 f1 jne 80100e40 safestrcpy(curproc->name, last, sizeof(curproc->name)); 80100e4f: 8b b5 ec fe ff ff mov -0x114(%ebp),%esi 80100e55: 83 ec 04 sub $0x4,%esp 80100e58: 6a 10 push $0x10 80100e5a: 8d 46 6c lea 0x6c(%esi),%eax 80100e5d: 52 push %edx 80100e5e: 50 push %eax 80100e5f: e8 1c 3b 00 00 call 80104980 curproc->pgdir = pgdir; 80100e64: 8b 95 f4 fe ff ff mov -0x10c(%ebp),%edx oldpgdir = curproc->pgdir; 80100e6a: 89 f1 mov %esi,%ecx 80100e6c: 8b 76 04 mov 0x4(%esi),%esi curproc->tf->eip = elf.entry; // main 80100e6f: 8b 41 18 mov 0x18(%ecx),%eax curproc->sz = sz; 80100e72: 89 39 mov %edi,(%ecx) curproc->pgdir = pgdir; 80100e74: 89 51 04 mov %edx,0x4(%ecx) curproc->tf->eip = elf.entry; // main 80100e77: 8b 95 3c ff ff ff mov -0xc4(%ebp),%edx 80100e7d: 89 50 38 mov %edx,0x38(%eax) curproc->tf->esp = sp; 80100e80: 8b 41 18 mov 0x18(%ecx),%eax 80100e83: 89 58 44 mov %ebx,0x44(%eax) switchuvm(curproc); 80100e86: 89 0c 24 mov %ecx,(%esp) 80100e89: e8 72 5d 00 00 call 80106c00 freevm(oldpgdir); 80100e8e: 89 34 24 mov %esi,(%esp) 80100e91: e8 4a 61 00 00 call 80106fe0 return 0; 80100e96: 83 c4 10 add $0x10,%esp 80100e99: 31 c0 xor %eax,%eax 80100e9b: e9 3d fe ff ff jmp 80100cdd iunlockput(ip); 80100ea0: 83 ec 0c sub $0xc,%esp 80100ea3: 57 push %edi 80100ea4: e8 87 0c 00 00 call 80101b30 end_op(); 80100ea9: e8 42 20 00 00 call 80102ef0 } 80100eae: 83 c4 10 add $0x10,%esp return -1; 80100eb1: b8 ff ff ff ff mov $0xffffffff,%eax } 80100eb6: e9 22 fe ff ff jmp 80100cdd for (i = 0, off = elf.phoff; i < elf.phnum; i++, off += sizeof(ph)) { 80100ebb: bb 00 20 00 00 mov $0x2000,%ebx 80100ec0: 31 f6 xor %esi,%esi 80100ec2: e9 39 fe ff ff jmp 80100d00 for (argc = 0; argv[argc]; argc++) { 80100ec7: be 10 00 00 00 mov $0x10,%esi 80100ecc: b9 04 00 00 00 mov $0x4,%ecx 80100ed1: b8 03 00 00 00 mov $0x3,%eax 80100ed6: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) 80100edd: 00 00 00 80100ee0: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx 80100ee6: e9 fe fe ff ff jmp 80100de9 end_op(); 80100eeb: e8 00 20 00 00 call 80102ef0 cprintf("exec: fail\n"); 80100ef0: 83 ec 0c sub $0xc,%esp 80100ef3: 68 61 74 10 80 push $0x80107461 80100ef8: e8 b3 f7 ff ff call 801006b0 return -1; 80100efd: 83 c4 10 add $0x10,%esp 80100f00: b8 ff ff ff ff mov $0xffffffff,%eax 80100f05: e9 d3 fd ff ff jmp 80100cdd cleanupexec(pgdir, ip); 80100f0a: 50 push %eax 80100f0b: 50 push %eax 80100f0c: 6a 00 push $0x0 80100f0e: ff b5 f4 fe ff ff push -0x10c(%ebp) 80100f14: e8 07 fc ff ff call 80100b20 return -1; 80100f19: 83 c4 10 add $0x10,%esp 80100f1c: 83 c8 ff or $0xffffffff,%eax 80100f1f: e9 b9 fd ff ff jmp 80100cdd 80100f24: 66 90 xchg %ax,%ax 80100f26: 66 90 xchg %ax,%ax 80100f28: 66 90 xchg %ax,%ax 80100f2a: 66 90 xchg %ax,%ax 80100f2c: 66 90 xchg %ax,%ax 80100f2e: 66 90 xchg %ax,%ax 80100f30 : struct { struct spinlock lock; struct file file[NFILE]; } ftable; void fileinit(void) { 80100f30: 55 push %ebp 80100f31: 89 e5 mov %esp,%ebp 80100f33: 83 ec 10 sub $0x10,%esp initlock(&ftable.lock, "ftable"); 80100f36: 68 6d 74 10 80 push $0x8010746d 80100f3b: 68 80 ef 10 80 push $0x8010ef80 80100f40: e8 eb 35 00 00 call 80104530 } 80100f45: 83 c4 10 add $0x10,%esp 80100f48: c9 leave 80100f49: c3 ret 80100f4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80100f50 : // Allocate a file structure. struct file* filealloc(void) { 80100f50: 55 push %ebp 80100f51: 89 e5 mov %esp,%ebp 80100f53: 53 push %ebx struct file *f; acquire(&ftable.lock); for (f = ftable.file; f < ftable.file + NFILE; f++) { 80100f54: bb b4 ef 10 80 mov $0x8010efb4,%ebx struct file* filealloc(void) { 80100f59: 83 ec 10 sub $0x10,%esp acquire(&ftable.lock); 80100f5c: 68 80 ef 10 80 push $0x8010ef80 80100f61: e8 9a 37 00 00 call 80104700 80100f66: 83 c4 10 add $0x10,%esp 80100f69: eb 10 jmp 80100f7b 80100f6b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100f6f: 90 nop for (f = ftable.file; f < ftable.file + NFILE; f++) { 80100f70: 83 c3 18 add $0x18,%ebx 80100f73: 81 fb 14 f9 10 80 cmp $0x8010f914,%ebx 80100f79: 74 25 je 80100fa0 if (f->ref == 0) { 80100f7b: 8b 43 04 mov 0x4(%ebx),%eax 80100f7e: 85 c0 test %eax,%eax 80100f80: 75 ee jne 80100f70 f->ref = 1; release(&ftable.lock); 80100f82: 83 ec 0c sub $0xc,%esp f->ref = 1; 80100f85: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx) release(&ftable.lock); 80100f8c: 68 80 ef 10 80 push $0x8010ef80 80100f91: e8 0a 37 00 00 call 801046a0 return f; } } release(&ftable.lock); return 0; } 80100f96: 89 d8 mov %ebx,%eax return f; 80100f98: 83 c4 10 add $0x10,%esp } 80100f9b: 8b 5d fc mov -0x4(%ebp),%ebx 80100f9e: c9 leave 80100f9f: c3 ret release(&ftable.lock); 80100fa0: 83 ec 0c sub $0xc,%esp return 0; 80100fa3: 31 db xor %ebx,%ebx release(&ftable.lock); 80100fa5: 68 80 ef 10 80 push $0x8010ef80 80100faa: e8 f1 36 00 00 call 801046a0 } 80100faf: 89 d8 mov %ebx,%eax return 0; 80100fb1: 83 c4 10 add $0x10,%esp } 80100fb4: 8b 5d fc mov -0x4(%ebp),%ebx 80100fb7: c9 leave 80100fb8: c3 ret 80100fb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100fc0 : // Increment ref count for file f. struct file* filedup(struct file *f) { 80100fc0: 55 push %ebp 80100fc1: 89 e5 mov %esp,%ebp 80100fc3: 53 push %ebx 80100fc4: 83 ec 10 sub $0x10,%esp 80100fc7: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&ftable.lock); 80100fca: 68 80 ef 10 80 push $0x8010ef80 80100fcf: e8 2c 37 00 00 call 80104700 if (f->ref < 1) { 80100fd4: 8b 43 04 mov 0x4(%ebx),%eax 80100fd7: 83 c4 10 add $0x10,%esp 80100fda: 85 c0 test %eax,%eax 80100fdc: 7e 1a jle 80100ff8 panic("filedup"); } f->ref++; 80100fde: 83 c0 01 add $0x1,%eax release(&ftable.lock); 80100fe1: 83 ec 0c sub $0xc,%esp f->ref++; 80100fe4: 89 43 04 mov %eax,0x4(%ebx) release(&ftable.lock); 80100fe7: 68 80 ef 10 80 push $0x8010ef80 80100fec: e8 af 36 00 00 call 801046a0 return f; } 80100ff1: 89 d8 mov %ebx,%eax 80100ff3: 8b 5d fc mov -0x4(%ebp),%ebx 80100ff6: c9 leave 80100ff7: c3 ret panic("filedup"); 80100ff8: 83 ec 0c sub $0xc,%esp 80100ffb: 68 74 74 10 80 push $0x80107474 80101000: e8 8b f3 ff ff call 80100390 80101005: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010100c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101010 : // Close file f. (Decrement ref count, close when reaches 0.) void fileclose(struct file *f) { 80101010: 55 push %ebp 80101011: 89 e5 mov %esp,%ebp 80101013: 57 push %edi 80101014: 56 push %esi 80101015: 53 push %ebx 80101016: 83 ec 28 sub $0x28,%esp 80101019: 8b 5d 08 mov 0x8(%ebp),%ebx struct file ff; acquire(&ftable.lock); 8010101c: 68 80 ef 10 80 push $0x8010ef80 80101021: e8 da 36 00 00 call 80104700 if (f->ref < 1) { 80101026: 8b 53 04 mov 0x4(%ebx),%edx 80101029: 83 c4 10 add $0x10,%esp 8010102c: 85 d2 test %edx,%edx 8010102e: 0f 8e a5 00 00 00 jle 801010d9 panic("fileclose"); } if (--f->ref > 0) { 80101034: 83 ea 01 sub $0x1,%edx 80101037: 89 53 04 mov %edx,0x4(%ebx) 8010103a: 75 44 jne 80101080 release(&ftable.lock); return; } ff = *f; 8010103c: 0f b6 43 09 movzbl 0x9(%ebx),%eax f->ref = 0; f->type = FD_NONE; release(&ftable.lock); 80101040: 83 ec 0c sub $0xc,%esp ff = *f; 80101043: 8b 3b mov (%ebx),%edi f->type = FD_NONE; 80101045: c7 03 00 00 00 00 movl $0x0,(%ebx) ff = *f; 8010104b: 8b 73 0c mov 0xc(%ebx),%esi 8010104e: 88 45 e7 mov %al,-0x19(%ebp) 80101051: 8b 43 10 mov 0x10(%ebx),%eax release(&ftable.lock); 80101054: 68 80 ef 10 80 push $0x8010ef80 ff = *f; 80101059: 89 45 e0 mov %eax,-0x20(%ebp) release(&ftable.lock); 8010105c: e8 3f 36 00 00 call 801046a0 if (ff.type == FD_PIPE) { 80101061: 83 c4 10 add $0x10,%esp 80101064: 83 ff 01 cmp $0x1,%edi 80101067: 74 57 je 801010c0 pipeclose(ff.pipe, ff.writable); } else if (ff.type == FD_INODE) { 80101069: 83 ff 02 cmp $0x2,%edi 8010106c: 74 2a je 80101098 begin_op(); iput(ff.ip); end_op(); } } 8010106e: 8d 65 f4 lea -0xc(%ebp),%esp 80101071: 5b pop %ebx 80101072: 5e pop %esi 80101073: 5f pop %edi 80101074: 5d pop %ebp 80101075: c3 ret 80101076: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010107d: 8d 76 00 lea 0x0(%esi),%esi release(&ftable.lock); 80101080: c7 45 08 80 ef 10 80 movl $0x8010ef80,0x8(%ebp) } 80101087: 8d 65 f4 lea -0xc(%ebp),%esp 8010108a: 5b pop %ebx 8010108b: 5e pop %esi 8010108c: 5f pop %edi 8010108d: 5d pop %ebp release(&ftable.lock); 8010108e: e9 0d 36 00 00 jmp 801046a0 80101093: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101097: 90 nop begin_op(); 80101098: e8 e3 1d 00 00 call 80102e80 iput(ff.ip); 8010109d: 83 ec 0c sub $0xc,%esp 801010a0: ff 75 e0 push -0x20(%ebp) 801010a3: e8 28 09 00 00 call 801019d0 end_op(); 801010a8: 83 c4 10 add $0x10,%esp } 801010ab: 8d 65 f4 lea -0xc(%ebp),%esp 801010ae: 5b pop %ebx 801010af: 5e pop %esi 801010b0: 5f pop %edi 801010b1: 5d pop %ebp end_op(); 801010b2: e9 39 1e 00 00 jmp 80102ef0 801010b7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801010be: 66 90 xchg %ax,%ax pipeclose(ff.pipe, ff.writable); 801010c0: 0f be 5d e7 movsbl -0x19(%ebp),%ebx 801010c4: 83 ec 08 sub $0x8,%esp 801010c7: 53 push %ebx 801010c8: 56 push %esi 801010c9: e8 c2 25 00 00 call 80103690 801010ce: 83 c4 10 add $0x10,%esp } 801010d1: 8d 65 f4 lea -0xc(%ebp),%esp 801010d4: 5b pop %ebx 801010d5: 5e pop %esi 801010d6: 5f pop %edi 801010d7: 5d pop %ebp 801010d8: c3 ret panic("fileclose"); 801010d9: 83 ec 0c sub $0xc,%esp 801010dc: 68 7c 74 10 80 push $0x8010747c 801010e1: e8 aa f2 ff ff call 80100390 801010e6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801010ed: 8d 76 00 lea 0x0(%esi),%esi 801010f0 : // Get metadata about file f. int filestat(struct file *f, struct stat *st) { 801010f0: 55 push %ebp 801010f1: 89 e5 mov %esp,%ebp 801010f3: 53 push %ebx 801010f4: 83 ec 04 sub $0x4,%esp 801010f7: 8b 5d 08 mov 0x8(%ebp),%ebx if (f->type == FD_INODE) { 801010fa: 83 3b 02 cmpl $0x2,(%ebx) 801010fd: 75 31 jne 80101130 ilock(f->ip); 801010ff: 83 ec 0c sub $0xc,%esp 80101102: ff 73 10 push 0x10(%ebx) 80101105: e8 96 07 00 00 call 801018a0 stati(f->ip, st); 8010110a: 58 pop %eax 8010110b: 5a pop %edx 8010110c: ff 75 0c push 0xc(%ebp) 8010110f: ff 73 10 push 0x10(%ebx) 80101112: e8 69 0a 00 00 call 80101b80 iunlock(f->ip); 80101117: 59 pop %ecx 80101118: ff 73 10 push 0x10(%ebx) 8010111b: e8 60 08 00 00 call 80101980 return 0; } return -1; } 80101120: 8b 5d fc mov -0x4(%ebp),%ebx return 0; 80101123: 83 c4 10 add $0x10,%esp 80101126: 31 c0 xor %eax,%eax } 80101128: c9 leave 80101129: c3 ret 8010112a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101130: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80101133: b8 ff ff ff ff mov $0xffffffff,%eax } 80101138: c9 leave 80101139: c3 ret 8010113a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101140 : // Read from file f. int fileread(struct file *f, char *addr, int n) { 80101140: 55 push %ebp 80101141: 89 e5 mov %esp,%ebp 80101143: 57 push %edi 80101144: 56 push %esi 80101145: 53 push %ebx 80101146: 83 ec 0c sub $0xc,%esp 80101149: 8b 5d 08 mov 0x8(%ebp),%ebx 8010114c: 8b 75 0c mov 0xc(%ebp),%esi 8010114f: 8b 7d 10 mov 0x10(%ebp),%edi int r; if (f->readable == 0) { 80101152: 80 7b 08 00 cmpb $0x0,0x8(%ebx) 80101156: 74 60 je 801011b8 return -1; } if (f->type == FD_PIPE) { 80101158: 8b 03 mov (%ebx),%eax 8010115a: 83 f8 01 cmp $0x1,%eax 8010115d: 74 41 je 801011a0 return piperead(f->pipe, addr, n); } if (f->type == FD_INODE) { 8010115f: 83 f8 02 cmp $0x2,%eax 80101162: 75 5b jne 801011bf ilock(f->ip); 80101164: 83 ec 0c sub $0xc,%esp 80101167: ff 73 10 push 0x10(%ebx) 8010116a: e8 31 07 00 00 call 801018a0 if ((r = readi(f->ip, addr, f->off, n)) > 0) { 8010116f: 57 push %edi 80101170: ff 73 14 push 0x14(%ebx) 80101173: 56 push %esi 80101174: ff 73 10 push 0x10(%ebx) 80101177: e8 34 0a 00 00 call 80101bb0 8010117c: 83 c4 20 add $0x20,%esp 8010117f: 89 c6 mov %eax,%esi 80101181: 85 c0 test %eax,%eax 80101183: 7e 03 jle 80101188 f->off += r; 80101185: 01 43 14 add %eax,0x14(%ebx) } iunlock(f->ip); 80101188: 83 ec 0c sub $0xc,%esp 8010118b: ff 73 10 push 0x10(%ebx) 8010118e: e8 ed 07 00 00 call 80101980 return r; 80101193: 83 c4 10 add $0x10,%esp } panic("fileread"); } 80101196: 8d 65 f4 lea -0xc(%ebp),%esp 80101199: 89 f0 mov %esi,%eax 8010119b: 5b pop %ebx 8010119c: 5e pop %esi 8010119d: 5f pop %edi 8010119e: 5d pop %ebp 8010119f: c3 ret return piperead(f->pipe, addr, n); 801011a0: 8b 43 0c mov 0xc(%ebx),%eax 801011a3: 89 45 08 mov %eax,0x8(%ebp) } 801011a6: 8d 65 f4 lea -0xc(%ebp),%esp 801011a9: 5b pop %ebx 801011aa: 5e pop %esi 801011ab: 5f pop %edi 801011ac: 5d pop %ebp return piperead(f->pipe, addr, n); 801011ad: e9 7e 26 00 00 jmp 80103830 801011b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return -1; 801011b8: be ff ff ff ff mov $0xffffffff,%esi 801011bd: eb d7 jmp 80101196 panic("fileread"); 801011bf: 83 ec 0c sub $0xc,%esp 801011c2: 68 86 74 10 80 push $0x80107486 801011c7: e8 c4 f1 ff ff call 80100390 801011cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801011d0 : // Write to file f. int filewrite(struct file *f, char *addr, int n) { 801011d0: 55 push %ebp 801011d1: 89 e5 mov %esp,%ebp 801011d3: 57 push %edi 801011d4: 56 push %esi 801011d5: 53 push %ebx 801011d6: 83 ec 1c sub $0x1c,%esp 801011d9: 8b 45 0c mov 0xc(%ebp),%eax 801011dc: 8b 5d 08 mov 0x8(%ebp),%ebx 801011df: 89 45 dc mov %eax,-0x24(%ebp) 801011e2: 8b 45 10 mov 0x10(%ebp),%eax int r; if (f->writable == 0) { 801011e5: 80 7b 09 00 cmpb $0x0,0x9(%ebx) int filewrite(struct file *f, char *addr, int n) { 801011e9: 89 45 e4 mov %eax,-0x1c(%ebp) if (f->writable == 0) { 801011ec: 0f 84 bd 00 00 00 je 801012af return -1; } if (f->type == FD_PIPE) { 801011f2: 8b 03 mov (%ebx),%eax 801011f4: 83 f8 01 cmp $0x1,%eax 801011f7: 0f 84 bf 00 00 00 je 801012bc return pipewrite(f->pipe, addr, n); } if (f->type == FD_INODE) { 801011fd: 83 f8 02 cmp $0x2,%eax 80101200: 0f 85 c8 00 00 00 jne 801012ce // 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) { 80101206: 8b 45 e4 mov -0x1c(%ebp),%eax int i = 0; 80101209: 31 f6 xor %esi,%esi while (i < n) { 8010120b: 85 c0 test %eax,%eax 8010120d: 7f 30 jg 8010123f 8010120f: e9 94 00 00 00 jmp 801012a8 80101214: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } begin_op(); ilock(f->ip); if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) { f->off += r; 80101218: 01 43 14 add %eax,0x14(%ebx) } iunlock(f->ip); 8010121b: 83 ec 0c sub $0xc,%esp 8010121e: ff 73 10 push 0x10(%ebx) f->off += r; 80101221: 89 45 e0 mov %eax,-0x20(%ebp) iunlock(f->ip); 80101224: e8 57 07 00 00 call 80101980 end_op(); 80101229: e8 c2 1c 00 00 call 80102ef0 if (r < 0) { break; } if (r != n1) { 8010122e: 8b 45 e0 mov -0x20(%ebp),%eax 80101231: 83 c4 10 add $0x10,%esp 80101234: 39 c7 cmp %eax,%edi 80101236: 75 5c jne 80101294 panic("short filewrite"); } i += r; 80101238: 01 fe add %edi,%esi while (i < n) { 8010123a: 39 75 e4 cmp %esi,-0x1c(%ebp) 8010123d: 7e 69 jle 801012a8 int n1 = n - i; 8010123f: 8b 7d e4 mov -0x1c(%ebp),%edi 80101242: b8 00 06 00 00 mov $0x600,%eax 80101247: 29 f7 sub %esi,%edi 80101249: 39 c7 cmp %eax,%edi 8010124b: 0f 4f f8 cmovg %eax,%edi begin_op(); 8010124e: e8 2d 1c 00 00 call 80102e80 ilock(f->ip); 80101253: 83 ec 0c sub $0xc,%esp 80101256: ff 73 10 push 0x10(%ebx) 80101259: e8 42 06 00 00 call 801018a0 if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) { 8010125e: 8b 45 dc mov -0x24(%ebp),%eax 80101261: 57 push %edi 80101262: ff 73 14 push 0x14(%ebx) 80101265: 01 f0 add %esi,%eax 80101267: 50 push %eax 80101268: ff 73 10 push 0x10(%ebx) 8010126b: e8 40 0a 00 00 call 80101cb0 80101270: 83 c4 20 add $0x20,%esp 80101273: 85 c0 test %eax,%eax 80101275: 7f a1 jg 80101218 iunlock(f->ip); 80101277: 83 ec 0c sub $0xc,%esp 8010127a: ff 73 10 push 0x10(%ebx) 8010127d: 89 45 e4 mov %eax,-0x1c(%ebp) 80101280: e8 fb 06 00 00 call 80101980 end_op(); 80101285: e8 66 1c 00 00 call 80102ef0 if (r < 0) { 8010128a: 8b 45 e4 mov -0x1c(%ebp),%eax 8010128d: 83 c4 10 add $0x10,%esp 80101290: 85 c0 test %eax,%eax 80101292: 75 1b jne 801012af panic("short filewrite"); 80101294: 83 ec 0c sub $0xc,%esp 80101297: 68 8f 74 10 80 push $0x8010748f 8010129c: e8 ef f0 ff ff call 80100390 801012a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } return i == n ? n : -1; 801012a8: 89 f0 mov %esi,%eax 801012aa: 3b 75 e4 cmp -0x1c(%ebp),%esi 801012ad: 74 05 je 801012b4 801012af: b8 ff ff ff ff mov $0xffffffff,%eax } panic("filewrite"); } 801012b4: 8d 65 f4 lea -0xc(%ebp),%esp 801012b7: 5b pop %ebx 801012b8: 5e pop %esi 801012b9: 5f pop %edi 801012ba: 5d pop %ebp 801012bb: c3 ret return pipewrite(f->pipe, addr, n); 801012bc: 8b 43 0c mov 0xc(%ebx),%eax 801012bf: 89 45 08 mov %eax,0x8(%ebp) } 801012c2: 8d 65 f4 lea -0xc(%ebp),%esp 801012c5: 5b pop %ebx 801012c6: 5e pop %esi 801012c7: 5f pop %edi 801012c8: 5d pop %ebp return pipewrite(f->pipe, addr, n); 801012c9: e9 62 24 00 00 jmp 80103730 panic("filewrite"); 801012ce: 83 ec 0c sub $0xc,%esp 801012d1: 68 95 74 10 80 push $0x80107495 801012d6: e8 b5 f0 ff ff call 80100390 801012db: 66 90 xchg %ax,%ax 801012dd: 66 90 xchg %ax,%ax 801012df: 90 nop 801012e0 : } panic("balloc: out of blocks"); } // Free a disk block. static void bfree(int dev, uint b) { 801012e0: 55 push %ebp 801012e1: 89 c1 mov %eax,%ecx struct buf *bp; int bi, m; bp = bread(dev, BBLOCK(b, sb)); 801012e3: 89 d0 mov %edx,%eax 801012e5: c1 e8 0c shr $0xc,%eax 801012e8: 03 05 ec 15 11 80 add 0x801115ec,%eax static void bfree(int dev, uint b) { 801012ee: 89 e5 mov %esp,%ebp 801012f0: 56 push %esi 801012f1: 53 push %ebx 801012f2: 89 d3 mov %edx,%ebx bp = bread(dev, BBLOCK(b, sb)); 801012f4: 83 ec 08 sub $0x8,%esp 801012f7: 50 push %eax 801012f8: 51 push %ecx 801012f9: e8 d2 ed ff ff call 801000d0 bi = b % BPB; m = 1 << (bi % 8); 801012fe: 89 d9 mov %ebx,%ecx if ((bp->data[bi / 8] & m) == 0) { 80101300: c1 fb 03 sar $0x3,%ebx 80101303: 83 c4 10 add $0x10,%esp bp = bread(dev, BBLOCK(b, sb)); 80101306: 89 c6 mov %eax,%esi m = 1 << (bi % 8); 80101308: 83 e1 07 and $0x7,%ecx 8010130b: b8 01 00 00 00 mov $0x1,%eax if ((bp->data[bi / 8] & m) == 0) { 80101310: 81 e3 ff 01 00 00 and $0x1ff,%ebx m = 1 << (bi % 8); 80101316: d3 e0 shl %cl,%eax if ((bp->data[bi / 8] & m) == 0) { 80101318: 0f b6 4c 1e 5c movzbl 0x5c(%esi,%ebx,1),%ecx 8010131d: 85 c1 test %eax,%ecx 8010131f: 74 23 je 80101344 panic("freeing free block"); } bp->data[bi / 8] &= ~m; 80101321: f7 d0 not %eax log_write(bp); 80101323: 83 ec 0c sub $0xc,%esp bp->data[bi / 8] &= ~m; 80101326: 21 c8 and %ecx,%eax 80101328: 88 44 1e 5c mov %al,0x5c(%esi,%ebx,1) log_write(bp); 8010132c: 56 push %esi 8010132d: e8 2e 1d 00 00 call 80103060 brelse(bp); 80101332: 89 34 24 mov %esi,(%esp) 80101335: e8 b6 ee ff ff call 801001f0 } 8010133a: 83 c4 10 add $0x10,%esp 8010133d: 8d 65 f8 lea -0x8(%ebp),%esp 80101340: 5b pop %ebx 80101341: 5e pop %esi 80101342: 5d pop %ebp 80101343: c3 ret panic("freeing free block"); 80101344: 83 ec 0c sub $0xc,%esp 80101347: 68 9f 74 10 80 push $0x8010749f 8010134c: e8 3f f0 ff ff call 80100390 80101351: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101358: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010135f: 90 nop 80101360 : static uint balloc(uint dev) { 80101360: 55 push %ebp 80101361: 89 e5 mov %esp,%ebp 80101363: 57 push %edi 80101364: 56 push %esi 80101365: 53 push %ebx 80101366: 83 ec 1c sub $0x1c,%esp for (b = 0; b < sb.size; b += BPB) { 80101369: 8b 0d d4 15 11 80 mov 0x801115d4,%ecx static uint balloc(uint dev) { 8010136f: 89 45 d8 mov %eax,-0x28(%ebp) for (b = 0; b < sb.size; b += BPB) { 80101372: 85 c9 test %ecx,%ecx 80101374: 0f 84 87 00 00 00 je 80101401 8010137a: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) bp = bread(dev, BBLOCK(b, sb)); 80101381: 8b 75 dc mov -0x24(%ebp),%esi 80101384: 83 ec 08 sub $0x8,%esp 80101387: 89 f0 mov %esi,%eax 80101389: c1 f8 0c sar $0xc,%eax 8010138c: 03 05 ec 15 11 80 add 0x801115ec,%eax 80101392: 50 push %eax 80101393: ff 75 d8 push -0x28(%ebp) 80101396: e8 35 ed ff ff call 801000d0 8010139b: 83 c4 10 add $0x10,%esp 8010139e: 89 45 e4 mov %eax,-0x1c(%ebp) for (bi = 0; bi < BPB && b + bi < sb.size; bi++) { 801013a1: a1 d4 15 11 80 mov 0x801115d4,%eax 801013a6: 89 45 e0 mov %eax,-0x20(%ebp) 801013a9: 31 c0 xor %eax,%eax 801013ab: eb 2f jmp 801013dc 801013ad: 8d 76 00 lea 0x0(%esi),%esi m = 1 << (bi % 8); 801013b0: 89 c1 mov %eax,%ecx 801013b2: bb 01 00 00 00 mov $0x1,%ebx if ((bp->data[bi / 8] & m) == 0) { // Is block free? 801013b7: 8b 55 e4 mov -0x1c(%ebp),%edx m = 1 << (bi % 8); 801013ba: 83 e1 07 and $0x7,%ecx 801013bd: d3 e3 shl %cl,%ebx if ((bp->data[bi / 8] & m) == 0) { // Is block free? 801013bf: 89 c1 mov %eax,%ecx 801013c1: c1 f9 03 sar $0x3,%ecx 801013c4: 0f b6 7c 0a 5c movzbl 0x5c(%edx,%ecx,1),%edi 801013c9: 89 fa mov %edi,%edx 801013cb: 85 df test %ebx,%edi 801013cd: 74 41 je 80101410 for (bi = 0; bi < BPB && b + bi < sb.size; bi++) { 801013cf: 83 c0 01 add $0x1,%eax 801013d2: 83 c6 01 add $0x1,%esi 801013d5: 3d 00 10 00 00 cmp $0x1000,%eax 801013da: 74 05 je 801013e1 801013dc: 39 75 e0 cmp %esi,-0x20(%ebp) 801013df: 77 cf ja 801013b0 brelse(bp); 801013e1: 83 ec 0c sub $0xc,%esp 801013e4: ff 75 e4 push -0x1c(%ebp) 801013e7: e8 04 ee ff ff call 801001f0 for (b = 0; b < sb.size; b += BPB) { 801013ec: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp) 801013f3: 83 c4 10 add $0x10,%esp 801013f6: 8b 45 dc mov -0x24(%ebp),%eax 801013f9: 39 05 d4 15 11 80 cmp %eax,0x801115d4 801013ff: 77 80 ja 80101381 panic("balloc: out of blocks"); 80101401: 83 ec 0c sub $0xc,%esp 80101404: 68 b2 74 10 80 push $0x801074b2 80101409: e8 82 ef ff ff call 80100390 8010140e: 66 90 xchg %ax,%ax bp->data[bi / 8] |= m; // Mark block in use. 80101410: 8b 7d e4 mov -0x1c(%ebp),%edi log_write(bp); 80101413: 83 ec 0c sub $0xc,%esp bp->data[bi / 8] |= m; // Mark block in use. 80101416: 09 da or %ebx,%edx 80101418: 88 54 0f 5c mov %dl,0x5c(%edi,%ecx,1) log_write(bp); 8010141c: 57 push %edi 8010141d: e8 3e 1c 00 00 call 80103060 brelse(bp); 80101422: 89 3c 24 mov %edi,(%esp) 80101425: e8 c6 ed ff ff call 801001f0 bp = bread(dev, bno); 8010142a: 58 pop %eax 8010142b: 5a pop %edx 8010142c: 56 push %esi 8010142d: ff 75 d8 push -0x28(%ebp) 80101430: e8 9b ec ff ff call 801000d0 memset(bp->data, 0, BSIZE); 80101435: 83 c4 0c add $0xc,%esp bp = bread(dev, bno); 80101438: 89 c3 mov %eax,%ebx memset(bp->data, 0, BSIZE); 8010143a: 8d 40 5c lea 0x5c(%eax),%eax 8010143d: 68 00 02 00 00 push $0x200 80101442: 6a 00 push $0x0 80101444: 50 push %eax 80101445: e8 76 33 00 00 call 801047c0 log_write(bp); 8010144a: 89 1c 24 mov %ebx,(%esp) 8010144d: e8 0e 1c 00 00 call 80103060 brelse(bp); 80101452: 89 1c 24 mov %ebx,(%esp) 80101455: e8 96 ed ff ff call 801001f0 } 8010145a: 8d 65 f4 lea -0xc(%ebp),%esp 8010145d: 89 f0 mov %esi,%eax 8010145f: 5b pop %ebx 80101460: 5e pop %esi 80101461: 5f pop %edi 80101462: 5d pop %ebp 80101463: c3 ret 80101464: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010146b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010146f: 90 nop 80101470 : } // 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) { 80101470: 55 push %ebp 80101471: 89 e5 mov %esp,%ebp 80101473: 57 push %edi 80101474: 89 c7 mov %eax,%edi 80101476: 56 push %esi struct inode *ip, *empty; acquire(&icache.lock); // Is the inode already cached? empty = 0; 80101477: 31 f6 xor %esi,%esi static struct inode* iget(uint dev, uint inum) { 80101479: 53 push %ebx for (ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++) { 8010147a: bb b4 f9 10 80 mov $0x8010f9b4,%ebx static struct inode* iget(uint dev, uint inum) { 8010147f: 83 ec 28 sub $0x28,%esp 80101482: 89 55 e4 mov %edx,-0x1c(%ebp) acquire(&icache.lock); 80101485: 68 80 f9 10 80 push $0x8010f980 8010148a: e8 71 32 00 00 call 80104700 for (ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++) { 8010148f: 8b 55 e4 mov -0x1c(%ebp),%edx acquire(&icache.lock); 80101492: 83 c4 10 add $0x10,%esp 80101495: eb 1b jmp 801014b2 80101497: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010149e: 66 90 xchg %ax,%ax if (ip->ref > 0 && ip->dev == dev && ip->inum == inum) { 801014a0: 39 3b cmp %edi,(%ebx) 801014a2: 74 6c je 80101510 for (ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++) { 801014a4: 81 c3 90 00 00 00 add $0x90,%ebx 801014aa: 81 fb d4 15 11 80 cmp $0x801115d4,%ebx 801014b0: 73 26 jae 801014d8 if (ip->ref > 0 && ip->dev == dev && ip->inum == inum) { 801014b2: 8b 43 08 mov 0x8(%ebx),%eax 801014b5: 85 c0 test %eax,%eax 801014b7: 7f e7 jg 801014a0 ip->ref++; release(&icache.lock); return ip; } if (empty == 0 && ip->ref == 0) { // Remember empty slot. 801014b9: 85 f6 test %esi,%esi 801014bb: 75 e7 jne 801014a4 801014bd: 85 c0 test %eax,%eax 801014bf: 75 76 jne 80101537 801014c1: 89 de mov %ebx,%esi for (ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++) { 801014c3: 81 c3 90 00 00 00 add $0x90,%ebx 801014c9: 81 fb d4 15 11 80 cmp $0x801115d4,%ebx 801014cf: 72 e1 jb 801014b2 801014d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi empty = ip; } } // Recycle an inode cache entry. if (empty == 0) { 801014d8: 85 f6 test %esi,%esi 801014da: 74 79 je 80101555 ip = empty; ip->dev = dev; ip->inum = inum; ip->ref = 1; ip->valid = 0; release(&icache.lock); 801014dc: 83 ec 0c sub $0xc,%esp ip->dev = dev; 801014df: 89 3e mov %edi,(%esi) ip->inum = inum; 801014e1: 89 56 04 mov %edx,0x4(%esi) ip->ref = 1; 801014e4: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi) ip->valid = 0; 801014eb: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi) release(&icache.lock); 801014f2: 68 80 f9 10 80 push $0x8010f980 801014f7: e8 a4 31 00 00 call 801046a0 return ip; 801014fc: 83 c4 10 add $0x10,%esp } 801014ff: 8d 65 f4 lea -0xc(%ebp),%esp 80101502: 89 f0 mov %esi,%eax 80101504: 5b pop %ebx 80101505: 5e pop %esi 80101506: 5f pop %edi 80101507: 5d pop %ebp 80101508: c3 ret 80101509: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (ip->ref > 0 && ip->dev == dev && ip->inum == inum) { 80101510: 39 53 04 cmp %edx,0x4(%ebx) 80101513: 75 8f jne 801014a4 release(&icache.lock); 80101515: 83 ec 0c sub $0xc,%esp ip->ref++; 80101518: 83 c0 01 add $0x1,%eax return ip; 8010151b: 89 de mov %ebx,%esi release(&icache.lock); 8010151d: 68 80 f9 10 80 push $0x8010f980 ip->ref++; 80101522: 89 43 08 mov %eax,0x8(%ebx) release(&icache.lock); 80101525: e8 76 31 00 00 call 801046a0 return ip; 8010152a: 83 c4 10 add $0x10,%esp } 8010152d: 8d 65 f4 lea -0xc(%ebp),%esp 80101530: 89 f0 mov %esi,%eax 80101532: 5b pop %ebx 80101533: 5e pop %esi 80101534: 5f pop %edi 80101535: 5d pop %ebp 80101536: c3 ret for (ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++) { 80101537: 81 c3 90 00 00 00 add $0x90,%ebx 8010153d: 81 fb d4 15 11 80 cmp $0x801115d4,%ebx 80101543: 73 10 jae 80101555 if (ip->ref > 0 && ip->dev == dev && ip->inum == inum) { 80101545: 8b 43 08 mov 0x8(%ebx),%eax 80101548: 85 c0 test %eax,%eax 8010154a: 0f 8f 50 ff ff ff jg 801014a0 80101550: e9 68 ff ff ff jmp 801014bd panic("iget: no inodes"); 80101555: 83 ec 0c sub $0xc,%esp 80101558: 68 c8 74 10 80 push $0x801074c8 8010155d: e8 2e ee ff ff call 80100390 80101562: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101569: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101570 : // are listed in ip->addrs[]. The next NINDIRECT blocks are // listed in block ip->addrs[NDIRECT]. // 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) { 80101570: 55 push %ebp 80101571: 89 e5 mov %esp,%ebp 80101573: 57 push %edi 80101574: 56 push %esi 80101575: 89 c6 mov %eax,%esi 80101577: 53 push %ebx 80101578: 83 ec 1c sub $0x1c,%esp uint addr, *a; struct buf *bp; if (bn < NDIRECT) { 8010157b: 83 fa 0b cmp $0xb,%edx 8010157e: 0f 86 8c 00 00 00 jbe 80101610 if ((addr = ip->addrs[bn]) == 0) { ip->addrs[bn] = addr = balloc(ip->dev); } return addr; } bn -= NDIRECT; 80101584: 8d 5a f4 lea -0xc(%edx),%ebx if (bn < NINDIRECT) { 80101587: 83 fb 7f cmp $0x7f,%ebx 8010158a: 0f 87 a2 00 00 00 ja 80101632 // Load indirect block, allocating if necessary. if ((addr = ip->addrs[NDIRECT]) == 0) { 80101590: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax 80101596: 85 c0 test %eax,%eax 80101598: 74 5e je 801015f8 ip->addrs[NDIRECT] = addr = balloc(ip->dev); } bp = bread(ip->dev, addr); 8010159a: 83 ec 08 sub $0x8,%esp 8010159d: 50 push %eax 8010159e: ff 36 push (%esi) 801015a0: e8 2b eb ff ff call 801000d0 a = (uint*)bp->data; if ((addr = a[bn]) == 0) { 801015a5: 83 c4 10 add $0x10,%esp 801015a8: 8d 5c 98 5c lea 0x5c(%eax,%ebx,4),%ebx bp = bread(ip->dev, addr); 801015ac: 89 c2 mov %eax,%edx if ((addr = a[bn]) == 0) { 801015ae: 8b 3b mov (%ebx),%edi 801015b0: 85 ff test %edi,%edi 801015b2: 74 1c je 801015d0 a[bn] = addr = balloc(ip->dev); log_write(bp); } brelse(bp); 801015b4: 83 ec 0c sub $0xc,%esp 801015b7: 52 push %edx 801015b8: e8 33 ec ff ff call 801001f0 801015bd: 83 c4 10 add $0x10,%esp return addr; } panic("bmap: out of range"); } 801015c0: 8d 65 f4 lea -0xc(%ebp),%esp 801015c3: 89 f8 mov %edi,%eax 801015c5: 5b pop %ebx 801015c6: 5e pop %esi 801015c7: 5f pop %edi 801015c8: 5d pop %ebp 801015c9: c3 ret 801015ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801015d0: 89 45 e4 mov %eax,-0x1c(%ebp) a[bn] = addr = balloc(ip->dev); 801015d3: 8b 06 mov (%esi),%eax 801015d5: e8 86 fd ff ff call 80101360 log_write(bp); 801015da: 8b 55 e4 mov -0x1c(%ebp),%edx 801015dd: 83 ec 0c sub $0xc,%esp a[bn] = addr = balloc(ip->dev); 801015e0: 89 03 mov %eax,(%ebx) 801015e2: 89 c7 mov %eax,%edi log_write(bp); 801015e4: 52 push %edx 801015e5: e8 76 1a 00 00 call 80103060 801015ea: 8b 55 e4 mov -0x1c(%ebp),%edx 801015ed: 83 c4 10 add $0x10,%esp 801015f0: eb c2 jmp 801015b4 801015f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ip->addrs[NDIRECT] = addr = balloc(ip->dev); 801015f8: 8b 06 mov (%esi),%eax 801015fa: e8 61 fd ff ff call 80101360 801015ff: 89 86 8c 00 00 00 mov %eax,0x8c(%esi) 80101605: eb 93 jmp 8010159a 80101607: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010160e: 66 90 xchg %ax,%ax if ((addr = ip->addrs[bn]) == 0) { 80101610: 8d 5a 14 lea 0x14(%edx),%ebx 80101613: 8b 7c 98 0c mov 0xc(%eax,%ebx,4),%edi 80101617: 85 ff test %edi,%edi 80101619: 75 a5 jne 801015c0 ip->addrs[bn] = addr = balloc(ip->dev); 8010161b: 8b 00 mov (%eax),%eax 8010161d: e8 3e fd ff ff call 80101360 80101622: 89 44 9e 0c mov %eax,0xc(%esi,%ebx,4) 80101626: 89 c7 mov %eax,%edi } 80101628: 8d 65 f4 lea -0xc(%ebp),%esp 8010162b: 5b pop %ebx 8010162c: 89 f8 mov %edi,%eax 8010162e: 5e pop %esi 8010162f: 5f pop %edi 80101630: 5d pop %ebp 80101631: c3 ret panic("bmap: out of range"); 80101632: 83 ec 0c sub $0xc,%esp 80101635: 68 d8 74 10 80 push $0x801074d8 8010163a: e8 51 ed ff ff call 80100390 8010163f: 90 nop 80101640 : void readsb(int dev, struct superblock *sb) { 80101640: 55 push %ebp 80101641: 89 e5 mov %esp,%ebp 80101643: 56 push %esi 80101644: 53 push %ebx 80101645: 8b 75 0c mov 0xc(%ebp),%esi bp = bread(dev, 1); 80101648: 83 ec 08 sub $0x8,%esp 8010164b: 6a 01 push $0x1 8010164d: ff 75 08 push 0x8(%ebp) 80101650: e8 7b ea ff ff call 801000d0 memmove(sb, bp->data, sizeof(*sb)); 80101655: 83 c4 0c add $0xc,%esp bp = bread(dev, 1); 80101658: 89 c3 mov %eax,%ebx memmove(sb, bp->data, sizeof(*sb)); 8010165a: 8d 40 5c lea 0x5c(%eax),%eax 8010165d: 6a 1c push $0x1c 8010165f: 50 push %eax 80101660: 56 push %esi 80101661: e8 fa 31 00 00 call 80104860 brelse(bp); 80101666: 89 5d 08 mov %ebx,0x8(%ebp) 80101669: 83 c4 10 add $0x10,%esp } 8010166c: 8d 65 f8 lea -0x8(%ebp),%esp 8010166f: 5b pop %ebx 80101670: 5e pop %esi 80101671: 5d pop %ebp brelse(bp); 80101672: e9 79 eb ff ff jmp 801001f0 80101677: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010167e: 66 90 xchg %ax,%ax 80101680 : void iinit(int dev) { 80101680: 55 push %ebp 80101681: 89 e5 mov %esp,%ebp 80101683: 53 push %ebx 80101684: bb c0 f9 10 80 mov $0x8010f9c0,%ebx 80101689: 83 ec 0c sub $0xc,%esp initlock(&icache.lock, "icache"); 8010168c: 68 eb 74 10 80 push $0x801074eb 80101691: 68 80 f9 10 80 push $0x8010f980 80101696: e8 95 2e 00 00 call 80104530 for (i = 0; i < NINODE; i++) { 8010169b: 83 c4 10 add $0x10,%esp 8010169e: 66 90 xchg %ax,%ax initsleeplock(&icache.inode[i].lock, "inode"); 801016a0: 83 ec 08 sub $0x8,%esp 801016a3: 68 f2 74 10 80 push $0x801074f2 801016a8: 53 push %ebx for (i = 0; i < NINODE; i++) { 801016a9: 81 c3 90 00 00 00 add $0x90,%ebx initsleeplock(&icache.inode[i].lock, "inode"); 801016af: e8 4c 2d 00 00 call 80104400 for (i = 0; i < NINODE; i++) { 801016b4: 83 c4 10 add $0x10,%esp 801016b7: 81 fb e0 15 11 80 cmp $0x801115e0,%ebx 801016bd: 75 e1 jne 801016a0 bp = bread(dev, 1); 801016bf: 83 ec 08 sub $0x8,%esp 801016c2: 6a 01 push $0x1 801016c4: ff 75 08 push 0x8(%ebp) 801016c7: e8 04 ea ff ff call 801000d0 memmove(sb, bp->data, sizeof(*sb)); 801016cc: 83 c4 0c add $0xc,%esp bp = bread(dev, 1); 801016cf: 89 c3 mov %eax,%ebx memmove(sb, bp->data, sizeof(*sb)); 801016d1: 8d 40 5c lea 0x5c(%eax),%eax 801016d4: 6a 1c push $0x1c 801016d6: 50 push %eax 801016d7: 68 d4 15 11 80 push $0x801115d4 801016dc: e8 7f 31 00 00 call 80104860 brelse(bp); 801016e1: 89 1c 24 mov %ebx,(%esp) 801016e4: e8 07 eb ff ff call 801001f0 cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\ 801016e9: ff 35 ec 15 11 80 push 0x801115ec 801016ef: ff 35 e8 15 11 80 push 0x801115e8 801016f5: ff 35 e4 15 11 80 push 0x801115e4 801016fb: ff 35 e0 15 11 80 push 0x801115e0 80101701: ff 35 dc 15 11 80 push 0x801115dc 80101707: ff 35 d8 15 11 80 push 0x801115d8 8010170d: ff 35 d4 15 11 80 push 0x801115d4 80101713: 68 58 75 10 80 push $0x80107558 80101718: e8 93 ef ff ff call 801006b0 } 8010171d: 8b 5d fc mov -0x4(%ebp),%ebx 80101720: 83 c4 30 add $0x30,%esp 80101723: c9 leave 80101724: c3 ret 80101725: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010172c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101730 : struct inode* ialloc(uint dev, short type) { 80101730: 55 push %ebp 80101731: 89 e5 mov %esp,%ebp 80101733: 57 push %edi 80101734: 56 push %esi 80101735: 53 push %ebx 80101736: 83 ec 1c sub $0x1c,%esp 80101739: 8b 45 0c mov 0xc(%ebp),%eax for (inum = 1; inum < sb.ninodes; inum++) { 8010173c: 83 3d dc 15 11 80 01 cmpl $0x1,0x801115dc struct inode* ialloc(uint dev, short type) { 80101743: 8b 75 08 mov 0x8(%ebp),%esi 80101746: 89 45 e4 mov %eax,-0x1c(%ebp) for (inum = 1; inum < sb.ninodes; inum++) { 80101749: 0f 86 91 00 00 00 jbe 801017e0 8010174f: bf 01 00 00 00 mov $0x1,%edi 80101754: eb 21 jmp 80101777 80101756: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010175d: 8d 76 00 lea 0x0(%esi),%esi brelse(bp); 80101760: 83 ec 0c sub $0xc,%esp for (inum = 1; inum < sb.ninodes; inum++) { 80101763: 83 c7 01 add $0x1,%edi brelse(bp); 80101766: 53 push %ebx 80101767: e8 84 ea ff ff call 801001f0 for (inum = 1; inum < sb.ninodes; inum++) { 8010176c: 83 c4 10 add $0x10,%esp 8010176f: 3b 3d dc 15 11 80 cmp 0x801115dc,%edi 80101775: 73 69 jae 801017e0 bp = bread(dev, IBLOCK(inum, sb)); 80101777: 89 f8 mov %edi,%eax 80101779: 83 ec 08 sub $0x8,%esp 8010177c: c1 e8 03 shr $0x3,%eax 8010177f: 03 05 e8 15 11 80 add 0x801115e8,%eax 80101785: 50 push %eax 80101786: 56 push %esi 80101787: e8 44 e9 ff ff call 801000d0 if (dip->type == 0) { // a free inode 8010178c: 83 c4 10 add $0x10,%esp bp = bread(dev, IBLOCK(inum, sb)); 8010178f: 89 c3 mov %eax,%ebx dip = (struct dinode*)bp->data + inum % IPB; 80101791: 89 f8 mov %edi,%eax 80101793: 83 e0 07 and $0x7,%eax 80101796: c1 e0 06 shl $0x6,%eax 80101799: 8d 4c 03 5c lea 0x5c(%ebx,%eax,1),%ecx if (dip->type == 0) { // a free inode 8010179d: 66 83 39 00 cmpw $0x0,(%ecx) 801017a1: 75 bd jne 80101760 memset(dip, 0, sizeof(*dip)); 801017a3: 83 ec 04 sub $0x4,%esp 801017a6: 89 4d e0 mov %ecx,-0x20(%ebp) 801017a9: 6a 40 push $0x40 801017ab: 6a 00 push $0x0 801017ad: 51 push %ecx 801017ae: e8 0d 30 00 00 call 801047c0 dip->type = type; 801017b3: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax 801017b7: 8b 4d e0 mov -0x20(%ebp),%ecx 801017ba: 66 89 01 mov %ax,(%ecx) log_write(bp); // mark it allocated on the disk 801017bd: 89 1c 24 mov %ebx,(%esp) 801017c0: e8 9b 18 00 00 call 80103060 brelse(bp); 801017c5: 89 1c 24 mov %ebx,(%esp) 801017c8: e8 23 ea ff ff call 801001f0 return iget(dev, inum); 801017cd: 83 c4 10 add $0x10,%esp } 801017d0: 8d 65 f4 lea -0xc(%ebp),%esp return iget(dev, inum); 801017d3: 89 fa mov %edi,%edx } 801017d5: 5b pop %ebx return iget(dev, inum); 801017d6: 89 f0 mov %esi,%eax } 801017d8: 5e pop %esi 801017d9: 5f pop %edi 801017da: 5d pop %ebp return iget(dev, inum); 801017db: e9 90 fc ff ff jmp 80101470 panic("ialloc: no inodes"); 801017e0: 83 ec 0c sub $0xc,%esp 801017e3: 68 f8 74 10 80 push $0x801074f8 801017e8: e8 a3 eb ff ff call 80100390 801017ed: 8d 76 00 lea 0x0(%esi),%esi 801017f0 : void iupdate(struct inode *ip) { 801017f0: 55 push %ebp 801017f1: 89 e5 mov %esp,%ebp 801017f3: 56 push %esi 801017f4: 53 push %ebx 801017f5: 8b 5d 08 mov 0x8(%ebp),%ebx bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801017f8: 8b 43 04 mov 0x4(%ebx),%eax memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 801017fb: 83 c3 5c add $0x5c,%ebx bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801017fe: 83 ec 08 sub $0x8,%esp 80101801: c1 e8 03 shr $0x3,%eax 80101804: 03 05 e8 15 11 80 add 0x801115e8,%eax 8010180a: 50 push %eax 8010180b: ff 73 a4 push -0x5c(%ebx) 8010180e: e8 bd e8 ff ff call 801000d0 dip->type = ip->type; 80101813: 0f b7 53 f4 movzwl -0xc(%ebx),%edx memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 80101817: 83 c4 0c add $0xc,%esp bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 8010181a: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum % IPB; 8010181c: 8b 43 a8 mov -0x58(%ebx),%eax 8010181f: 83 e0 07 and $0x7,%eax 80101822: c1 e0 06 shl $0x6,%eax 80101825: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax dip->type = ip->type; 80101829: 66 89 10 mov %dx,(%eax) dip->major = ip->major; 8010182c: 0f b7 53 f6 movzwl -0xa(%ebx),%edx memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 80101830: 83 c0 0c add $0xc,%eax dip->major = ip->major; 80101833: 66 89 50 f6 mov %dx,-0xa(%eax) dip->minor = ip->minor; 80101837: 0f b7 53 f8 movzwl -0x8(%ebx),%edx 8010183b: 66 89 50 f8 mov %dx,-0x8(%eax) dip->nlink = ip->nlink; 8010183f: 0f b7 53 fa movzwl -0x6(%ebx),%edx 80101843: 66 89 50 fa mov %dx,-0x6(%eax) dip->size = ip->size; 80101847: 8b 53 fc mov -0x4(%ebx),%edx 8010184a: 89 50 fc mov %edx,-0x4(%eax) memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 8010184d: 6a 34 push $0x34 8010184f: 53 push %ebx 80101850: 50 push %eax 80101851: e8 0a 30 00 00 call 80104860 log_write(bp); 80101856: 89 34 24 mov %esi,(%esp) 80101859: e8 02 18 00 00 call 80103060 brelse(bp); 8010185e: 89 75 08 mov %esi,0x8(%ebp) 80101861: 83 c4 10 add $0x10,%esp } 80101864: 8d 65 f8 lea -0x8(%ebp),%esp 80101867: 5b pop %ebx 80101868: 5e pop %esi 80101869: 5d pop %ebp brelse(bp); 8010186a: e9 81 e9 ff ff jmp 801001f0 8010186f: 90 nop 80101870 : struct inode* idup(struct inode *ip) { 80101870: 55 push %ebp 80101871: 89 e5 mov %esp,%ebp 80101873: 53 push %ebx 80101874: 83 ec 10 sub $0x10,%esp 80101877: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&icache.lock); 8010187a: 68 80 f9 10 80 push $0x8010f980 8010187f: e8 7c 2e 00 00 call 80104700 ip->ref++; 80101884: 83 43 08 01 addl $0x1,0x8(%ebx) release(&icache.lock); 80101888: c7 04 24 80 f9 10 80 movl $0x8010f980,(%esp) 8010188f: e8 0c 2e 00 00 call 801046a0 } 80101894: 89 d8 mov %ebx,%eax 80101896: 8b 5d fc mov -0x4(%ebp),%ebx 80101899: c9 leave 8010189a: c3 ret 8010189b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010189f: 90 nop 801018a0 : void ilock(struct inode *ip) { 801018a0: 55 push %ebp 801018a1: 89 e5 mov %esp,%ebp 801018a3: 56 push %esi 801018a4: 53 push %ebx 801018a5: 8b 5d 08 mov 0x8(%ebp),%ebx if (ip == 0 || ip->ref < 1) { 801018a8: 85 db test %ebx,%ebx 801018aa: 0f 84 b7 00 00 00 je 80101967 801018b0: 8b 53 08 mov 0x8(%ebx),%edx 801018b3: 85 d2 test %edx,%edx 801018b5: 0f 8e ac 00 00 00 jle 80101967 acquiresleep(&ip->lock); 801018bb: 83 ec 0c sub $0xc,%esp 801018be: 8d 43 0c lea 0xc(%ebx),%eax 801018c1: 50 push %eax 801018c2: e8 79 2b 00 00 call 80104440 if (ip->valid == 0) { 801018c7: 8b 43 4c mov 0x4c(%ebx),%eax 801018ca: 83 c4 10 add $0x10,%esp 801018cd: 85 c0 test %eax,%eax 801018cf: 74 0f je 801018e0 } 801018d1: 8d 65 f8 lea -0x8(%ebp),%esp 801018d4: 5b pop %ebx 801018d5: 5e pop %esi 801018d6: 5d pop %ebp 801018d7: c3 ret 801018d8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801018df: 90 nop bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801018e0: 8b 43 04 mov 0x4(%ebx),%eax 801018e3: 83 ec 08 sub $0x8,%esp 801018e6: c1 e8 03 shr $0x3,%eax 801018e9: 03 05 e8 15 11 80 add 0x801115e8,%eax 801018ef: 50 push %eax 801018f0: ff 33 push (%ebx) 801018f2: e8 d9 e7 ff ff call 801000d0 memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 801018f7: 83 c4 0c add $0xc,%esp bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801018fa: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum % IPB; 801018fc: 8b 43 04 mov 0x4(%ebx),%eax 801018ff: 83 e0 07 and $0x7,%eax 80101902: c1 e0 06 shl $0x6,%eax 80101905: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax ip->type = dip->type; 80101909: 0f b7 10 movzwl (%eax),%edx memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 8010190c: 83 c0 0c add $0xc,%eax ip->type = dip->type; 8010190f: 66 89 53 50 mov %dx,0x50(%ebx) ip->major = dip->major; 80101913: 0f b7 50 f6 movzwl -0xa(%eax),%edx 80101917: 66 89 53 52 mov %dx,0x52(%ebx) ip->minor = dip->minor; 8010191b: 0f b7 50 f8 movzwl -0x8(%eax),%edx 8010191f: 66 89 53 54 mov %dx,0x54(%ebx) ip->nlink = dip->nlink; 80101923: 0f b7 50 fa movzwl -0x6(%eax),%edx 80101927: 66 89 53 56 mov %dx,0x56(%ebx) ip->size = dip->size; 8010192b: 8b 50 fc mov -0x4(%eax),%edx 8010192e: 89 53 58 mov %edx,0x58(%ebx) memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 80101931: 6a 34 push $0x34 80101933: 50 push %eax 80101934: 8d 43 5c lea 0x5c(%ebx),%eax 80101937: 50 push %eax 80101938: e8 23 2f 00 00 call 80104860 brelse(bp); 8010193d: 89 34 24 mov %esi,(%esp) 80101940: e8 ab e8 ff ff call 801001f0 if (ip->type == 0) { 80101945: 83 c4 10 add $0x10,%esp 80101948: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx) ip->valid = 1; 8010194d: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) if (ip->type == 0) { 80101954: 0f 85 77 ff ff ff jne 801018d1 panic("ilock: no type"); 8010195a: 83 ec 0c sub $0xc,%esp 8010195d: 68 10 75 10 80 push $0x80107510 80101962: e8 29 ea ff ff call 80100390 panic("ilock"); 80101967: 83 ec 0c sub $0xc,%esp 8010196a: 68 0a 75 10 80 push $0x8010750a 8010196f: e8 1c ea ff ff call 80100390 80101974: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010197b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010197f: 90 nop 80101980 : void iunlock(struct inode *ip) { 80101980: 55 push %ebp 80101981: 89 e5 mov %esp,%ebp 80101983: 56 push %esi 80101984: 53 push %ebx 80101985: 8b 5d 08 mov 0x8(%ebp),%ebx if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80101988: 85 db test %ebx,%ebx 8010198a: 74 28 je 801019b4 8010198c: 83 ec 0c sub $0xc,%esp 8010198f: 8d 73 0c lea 0xc(%ebx),%esi 80101992: 56 push %esi 80101993: e8 48 2b 00 00 call 801044e0 80101998: 83 c4 10 add $0x10,%esp 8010199b: 85 c0 test %eax,%eax 8010199d: 74 15 je 801019b4 8010199f: 8b 43 08 mov 0x8(%ebx),%eax 801019a2: 85 c0 test %eax,%eax 801019a4: 7e 0e jle 801019b4 releasesleep(&ip->lock); 801019a6: 89 75 08 mov %esi,0x8(%ebp) } 801019a9: 8d 65 f8 lea -0x8(%ebp),%esp 801019ac: 5b pop %ebx 801019ad: 5e pop %esi 801019ae: 5d pop %ebp releasesleep(&ip->lock); 801019af: e9 ec 2a 00 00 jmp 801044a0 panic("iunlock"); 801019b4: 83 ec 0c sub $0xc,%esp 801019b7: 68 1f 75 10 80 push $0x8010751f 801019bc: e8 cf e9 ff ff call 80100390 801019c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801019c8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801019cf: 90 nop 801019d0 : void iput(struct inode *ip) { 801019d0: 55 push %ebp 801019d1: 89 e5 mov %esp,%ebp 801019d3: 57 push %edi 801019d4: 56 push %esi 801019d5: 53 push %ebx 801019d6: 83 ec 28 sub $0x28,%esp 801019d9: 8b 5d 08 mov 0x8(%ebp),%ebx acquiresleep(&ip->lock); 801019dc: 8d 7b 0c lea 0xc(%ebx),%edi 801019df: 57 push %edi 801019e0: e8 5b 2a 00 00 call 80104440 if (ip->valid && ip->nlink == 0) { 801019e5: 8b 53 4c mov 0x4c(%ebx),%edx 801019e8: 83 c4 10 add $0x10,%esp 801019eb: 85 d2 test %edx,%edx 801019ed: 74 07 je 801019f6 801019ef: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) 801019f4: 74 32 je 80101a28 releasesleep(&ip->lock); 801019f6: 83 ec 0c sub $0xc,%esp 801019f9: 57 push %edi 801019fa: e8 a1 2a 00 00 call 801044a0 acquire(&icache.lock); 801019ff: c7 04 24 80 f9 10 80 movl $0x8010f980,(%esp) 80101a06: e8 f5 2c 00 00 call 80104700 ip->ref--; 80101a0b: 83 6b 08 01 subl $0x1,0x8(%ebx) release(&icache.lock); 80101a0f: 83 c4 10 add $0x10,%esp 80101a12: c7 45 08 80 f9 10 80 movl $0x8010f980,0x8(%ebp) } 80101a19: 8d 65 f4 lea -0xc(%ebp),%esp 80101a1c: 5b pop %ebx 80101a1d: 5e pop %esi 80101a1e: 5f pop %edi 80101a1f: 5d pop %ebp release(&icache.lock); 80101a20: e9 7b 2c 00 00 jmp 801046a0 80101a25: 8d 76 00 lea 0x0(%esi),%esi acquire(&icache.lock); 80101a28: 83 ec 0c sub $0xc,%esp 80101a2b: 68 80 f9 10 80 push $0x8010f980 80101a30: e8 cb 2c 00 00 call 80104700 int r = ip->ref; 80101a35: 8b 73 08 mov 0x8(%ebx),%esi release(&icache.lock); 80101a38: c7 04 24 80 f9 10 80 movl $0x8010f980,(%esp) 80101a3f: e8 5c 2c 00 00 call 801046a0 if (r == 1) { 80101a44: 83 c4 10 add $0x10,%esp 80101a47: 83 fe 01 cmp $0x1,%esi 80101a4a: 75 aa jne 801019f6 80101a4c: 8d 8b 8c 00 00 00 lea 0x8c(%ebx),%ecx 80101a52: 89 7d e4 mov %edi,-0x1c(%ebp) 80101a55: 8d 73 5c lea 0x5c(%ebx),%esi 80101a58: 89 cf mov %ecx,%edi 80101a5a: eb 0b jmp 80101a67 80101a5c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi static void itrunc(struct inode *ip) { int i, j; struct buf *bp; uint *a; for (i = 0; i < NDIRECT; i++) { 80101a60: 83 c6 04 add $0x4,%esi 80101a63: 39 fe cmp %edi,%esi 80101a65: 74 19 je 80101a80 if (ip->addrs[i]) { 80101a67: 8b 16 mov (%esi),%edx 80101a69: 85 d2 test %edx,%edx 80101a6b: 74 f3 je 80101a60 bfree(ip->dev, ip->addrs[i]); 80101a6d: 8b 03 mov (%ebx),%eax 80101a6f: e8 6c f8 ff ff call 801012e0 ip->addrs[i] = 0; 80101a74: c7 06 00 00 00 00 movl $0x0,(%esi) 80101a7a: eb e4 jmp 80101a60 80101a7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } } if (ip->addrs[NDIRECT]) { 80101a80: 8b 83 8c 00 00 00 mov 0x8c(%ebx),%eax 80101a86: 8b 7d e4 mov -0x1c(%ebp),%edi 80101a89: 85 c0 test %eax,%eax 80101a8b: 75 2d jne 80101aba bfree(ip->dev, ip->addrs[NDIRECT]); ip->addrs[NDIRECT] = 0; } ip->size = 0; iupdate(ip); 80101a8d: 83 ec 0c sub $0xc,%esp ip->size = 0; 80101a90: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) iupdate(ip); 80101a97: 53 push %ebx 80101a98: e8 53 fd ff ff call 801017f0 ip->type = 0; 80101a9d: 31 c0 xor %eax,%eax 80101a9f: 66 89 43 50 mov %ax,0x50(%ebx) iupdate(ip); 80101aa3: 89 1c 24 mov %ebx,(%esp) 80101aa6: e8 45 fd ff ff call 801017f0 ip->valid = 0; 80101aab: c7 43 4c 00 00 00 00 movl $0x0,0x4c(%ebx) 80101ab2: 83 c4 10 add $0x10,%esp 80101ab5: e9 3c ff ff ff jmp 801019f6 bp = bread(ip->dev, ip->addrs[NDIRECT]); 80101aba: 83 ec 08 sub $0x8,%esp 80101abd: 50 push %eax 80101abe: ff 33 push (%ebx) 80101ac0: e8 0b e6 ff ff call 801000d0 80101ac5: 89 7d e0 mov %edi,-0x20(%ebp) 80101ac8: 83 c4 10 add $0x10,%esp 80101acb: 8d 88 5c 02 00 00 lea 0x25c(%eax),%ecx 80101ad1: 89 45 e4 mov %eax,-0x1c(%ebp) for (j = 0; j < NINDIRECT; j++) { 80101ad4: 8d 70 5c lea 0x5c(%eax),%esi 80101ad7: 89 cf mov %ecx,%edi 80101ad9: eb 0c jmp 80101ae7 80101adb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101adf: 90 nop 80101ae0: 83 c6 04 add $0x4,%esi 80101ae3: 39 f7 cmp %esi,%edi 80101ae5: 74 0f je 80101af6 if (a[j]) { 80101ae7: 8b 16 mov (%esi),%edx 80101ae9: 85 d2 test %edx,%edx 80101aeb: 74 f3 je 80101ae0 bfree(ip->dev, a[j]); 80101aed: 8b 03 mov (%ebx),%eax 80101aef: e8 ec f7 ff ff call 801012e0 80101af4: eb ea jmp 80101ae0 brelse(bp); 80101af6: 83 ec 0c sub $0xc,%esp 80101af9: ff 75 e4 push -0x1c(%ebp) 80101afc: 8b 7d e0 mov -0x20(%ebp),%edi 80101aff: e8 ec e6 ff ff call 801001f0 bfree(ip->dev, ip->addrs[NDIRECT]); 80101b04: 8b 93 8c 00 00 00 mov 0x8c(%ebx),%edx 80101b0a: 8b 03 mov (%ebx),%eax 80101b0c: e8 cf f7 ff ff call 801012e0 ip->addrs[NDIRECT] = 0; 80101b11: 83 c4 10 add $0x10,%esp 80101b14: c7 83 8c 00 00 00 00 movl $0x0,0x8c(%ebx) 80101b1b: 00 00 00 80101b1e: e9 6a ff ff ff jmp 80101a8d 80101b23: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101b2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101b30 : void iunlockput(struct inode *ip) { 80101b30: 55 push %ebp 80101b31: 89 e5 mov %esp,%ebp 80101b33: 56 push %esi 80101b34: 53 push %ebx 80101b35: 8b 5d 08 mov 0x8(%ebp),%ebx if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80101b38: 85 db test %ebx,%ebx 80101b3a: 74 34 je 80101b70 80101b3c: 83 ec 0c sub $0xc,%esp 80101b3f: 8d 73 0c lea 0xc(%ebx),%esi 80101b42: 56 push %esi 80101b43: e8 98 29 00 00 call 801044e0 80101b48: 83 c4 10 add $0x10,%esp 80101b4b: 85 c0 test %eax,%eax 80101b4d: 74 21 je 80101b70 80101b4f: 8b 43 08 mov 0x8(%ebx),%eax 80101b52: 85 c0 test %eax,%eax 80101b54: 7e 1a jle 80101b70 releasesleep(&ip->lock); 80101b56: 83 ec 0c sub $0xc,%esp 80101b59: 56 push %esi 80101b5a: e8 41 29 00 00 call 801044a0 iput(ip); 80101b5f: 89 5d 08 mov %ebx,0x8(%ebp) 80101b62: 83 c4 10 add $0x10,%esp } 80101b65: 8d 65 f8 lea -0x8(%ebp),%esp 80101b68: 5b pop %ebx 80101b69: 5e pop %esi 80101b6a: 5d pop %ebp iput(ip); 80101b6b: e9 60 fe ff ff jmp 801019d0 panic("iunlock"); 80101b70: 83 ec 0c sub $0xc,%esp 80101b73: 68 1f 75 10 80 push $0x8010751f 80101b78: e8 13 e8 ff ff call 80100390 80101b7d: 8d 76 00 lea 0x0(%esi),%esi 80101b80 : } // Copy stat information from inode. // Caller must hold ip->lock. void stati(struct inode *ip, struct stat *st) { 80101b80: 55 push %ebp 80101b81: 89 e5 mov %esp,%ebp 80101b83: 8b 55 08 mov 0x8(%ebp),%edx 80101b86: 8b 45 0c mov 0xc(%ebp),%eax st->dev = ip->dev; 80101b89: 8b 0a mov (%edx),%ecx 80101b8b: 89 48 04 mov %ecx,0x4(%eax) st->ino = ip->inum; 80101b8e: 8b 4a 04 mov 0x4(%edx),%ecx 80101b91: 89 48 08 mov %ecx,0x8(%eax) st->type = ip->type; 80101b94: 0f b7 4a 50 movzwl 0x50(%edx),%ecx 80101b98: 66 89 08 mov %cx,(%eax) st->nlink = ip->nlink; 80101b9b: 0f b7 4a 56 movzwl 0x56(%edx),%ecx 80101b9f: 66 89 48 0c mov %cx,0xc(%eax) st->size = ip->size; 80101ba3: 8b 52 58 mov 0x58(%edx),%edx 80101ba6: 89 50 10 mov %edx,0x10(%eax) } 80101ba9: 5d pop %ebp 80101baa: c3 ret 80101bab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101baf: 90 nop 80101bb0 : // Read data from inode. // Caller must hold ip->lock. int readi(struct inode *ip, char *dst, uint off, uint n) { 80101bb0: 55 push %ebp 80101bb1: 89 e5 mov %esp,%ebp 80101bb3: 57 push %edi 80101bb4: 56 push %esi 80101bb5: 53 push %ebx 80101bb6: 83 ec 1c sub $0x1c,%esp 80101bb9: 8b 7d 0c mov 0xc(%ebp),%edi 80101bbc: 8b 45 08 mov 0x8(%ebp),%eax 80101bbf: 8b 75 10 mov 0x10(%ebp),%esi 80101bc2: 89 7d e0 mov %edi,-0x20(%ebp) 80101bc5: 8b 7d 14 mov 0x14(%ebp),%edi uint tot, m; struct buf *bp; if (ip->type == T_DEV) { 80101bc8: 66 83 78 50 03 cmpw $0x3,0x50(%eax) int readi(struct inode *ip, char *dst, uint off, uint n) { 80101bcd: 89 45 d8 mov %eax,-0x28(%ebp) 80101bd0: 89 7d e4 mov %edi,-0x1c(%ebp) if (ip->type == T_DEV) { 80101bd3: 0f 84 a7 00 00 00 je 80101c80 return -1; } return devsw[ip->major].read(ip, dst, n); } if (off > ip->size || off + n < off) { 80101bd9: 8b 45 d8 mov -0x28(%ebp),%eax 80101bdc: 8b 40 58 mov 0x58(%eax),%eax 80101bdf: 39 c6 cmp %eax,%esi 80101be1: 0f 87 ba 00 00 00 ja 80101ca1 80101be7: 8b 5d e4 mov -0x1c(%ebp),%ebx 80101bea: 31 c9 xor %ecx,%ecx 80101bec: 89 da mov %ebx,%edx 80101bee: 01 f2 add %esi,%edx 80101bf0: 0f 92 c1 setb %cl 80101bf3: 89 cf mov %ecx,%edi 80101bf5: 0f 82 a6 00 00 00 jb 80101ca1 return -1; } if (off + n > ip->size) { n = ip->size - off; 80101bfb: 89 c1 mov %eax,%ecx 80101bfd: 29 f1 sub %esi,%ecx 80101bff: 39 d0 cmp %edx,%eax 80101c01: 0f 43 cb cmovae %ebx,%ecx 80101c04: 89 4d e4 mov %ecx,-0x1c(%ebp) } for (tot = 0; tot < n; tot += m, off += m, dst += m) { 80101c07: 85 c9 test %ecx,%ecx 80101c09: 74 67 je 80101c72 80101c0b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101c0f: 90 nop bp = bread(ip->dev, bmap(ip, off / BSIZE)); 80101c10: 8b 5d d8 mov -0x28(%ebp),%ebx 80101c13: 89 f2 mov %esi,%edx 80101c15: c1 ea 09 shr $0x9,%edx 80101c18: 89 d8 mov %ebx,%eax 80101c1a: e8 51 f9 ff ff call 80101570 80101c1f: 83 ec 08 sub $0x8,%esp 80101c22: 50 push %eax 80101c23: ff 33 push (%ebx) 80101c25: e8 a6 e4 ff ff call 801000d0 m = min(n - tot, BSIZE - off % BSIZE); 80101c2a: 8b 5d e4 mov -0x1c(%ebp),%ebx 80101c2d: b9 00 02 00 00 mov $0x200,%ecx bp = bread(ip->dev, bmap(ip, off / BSIZE)); 80101c32: 89 c2 mov %eax,%edx m = min(n - tot, BSIZE - off % BSIZE); 80101c34: 89 f0 mov %esi,%eax 80101c36: 25 ff 01 00 00 and $0x1ff,%eax 80101c3b: 29 fb sub %edi,%ebx memmove(dst, bp->data + off % BSIZE, m); 80101c3d: 89 55 dc mov %edx,-0x24(%ebp) m = min(n - tot, BSIZE - off % BSIZE); 80101c40: 29 c1 sub %eax,%ecx memmove(dst, bp->data + off % BSIZE, m); 80101c42: 8d 44 02 5c lea 0x5c(%edx,%eax,1),%eax m = min(n - tot, BSIZE - off % BSIZE); 80101c46: 39 d9 cmp %ebx,%ecx 80101c48: 0f 46 d9 cmovbe %ecx,%ebx memmove(dst, bp->data + off % BSIZE, m); 80101c4b: 83 c4 0c add $0xc,%esp 80101c4e: 53 push %ebx for (tot = 0; tot < n; tot += m, off += m, dst += m) { 80101c4f: 01 df add %ebx,%edi 80101c51: 01 de add %ebx,%esi memmove(dst, bp->data + off % BSIZE, m); 80101c53: 50 push %eax 80101c54: ff 75 e0 push -0x20(%ebp) 80101c57: e8 04 2c 00 00 call 80104860 brelse(bp); 80101c5c: 8b 55 dc mov -0x24(%ebp),%edx 80101c5f: 89 14 24 mov %edx,(%esp) 80101c62: e8 89 e5 ff ff call 801001f0 for (tot = 0; tot < n; tot += m, off += m, dst += m) { 80101c67: 01 5d e0 add %ebx,-0x20(%ebp) 80101c6a: 83 c4 10 add $0x10,%esp 80101c6d: 39 7d e4 cmp %edi,-0x1c(%ebp) 80101c70: 77 9e ja 80101c10 } return n; 80101c72: 8b 45 e4 mov -0x1c(%ebp),%eax } 80101c75: 8d 65 f4 lea -0xc(%ebp),%esp 80101c78: 5b pop %ebx 80101c79: 5e pop %esi 80101c7a: 5f pop %edi 80101c7b: 5d pop %ebp 80101c7c: c3 ret 80101c7d: 8d 76 00 lea 0x0(%esi),%esi if (ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) { 80101c80: 0f bf 40 52 movswl 0x52(%eax),%eax 80101c84: 66 83 f8 09 cmp $0x9,%ax 80101c88: 77 17 ja 80101ca1 80101c8a: 8b 04 c5 20 f9 10 80 mov -0x7fef06e0(,%eax,8),%eax 80101c91: 85 c0 test %eax,%eax 80101c93: 74 0c je 80101ca1 return devsw[ip->major].read(ip, dst, n); 80101c95: 89 7d 10 mov %edi,0x10(%ebp) } 80101c98: 8d 65 f4 lea -0xc(%ebp),%esp 80101c9b: 5b pop %ebx 80101c9c: 5e pop %esi 80101c9d: 5f pop %edi 80101c9e: 5d pop %ebp return devsw[ip->major].read(ip, dst, n); 80101c9f: ff e0 jmp *%eax return -1; 80101ca1: b8 ff ff ff ff mov $0xffffffff,%eax 80101ca6: eb cd jmp 80101c75 80101ca8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101caf: 90 nop 80101cb0 : // Write data to inode. // Caller must hold ip->lock. int writei(struct inode *ip, char *src, uint off, uint n) { 80101cb0: 55 push %ebp 80101cb1: 89 e5 mov %esp,%ebp 80101cb3: 57 push %edi 80101cb4: 56 push %esi 80101cb5: 53 push %ebx 80101cb6: 83 ec 1c sub $0x1c,%esp 80101cb9: 8b 45 08 mov 0x8(%ebp),%eax 80101cbc: 8b 75 0c mov 0xc(%ebp),%esi 80101cbf: 8b 55 14 mov 0x14(%ebp),%edx uint tot, m; struct buf *bp; if (ip->type == T_DEV) { 80101cc2: 66 83 78 50 03 cmpw $0x3,0x50(%eax) int writei(struct inode *ip, char *src, uint off, uint n) { 80101cc7: 89 75 dc mov %esi,-0x24(%ebp) 80101cca: 89 45 d8 mov %eax,-0x28(%ebp) 80101ccd: 8b 75 10 mov 0x10(%ebp),%esi 80101cd0: 89 55 e0 mov %edx,-0x20(%ebp) if (ip->type == T_DEV) { 80101cd3: 0f 84 b7 00 00 00 je 80101d90 return -1; } return devsw[ip->major].write(ip, src, n); } if (off > ip->size || off + n < off) { 80101cd9: 8b 45 d8 mov -0x28(%ebp),%eax 80101cdc: 3b 70 58 cmp 0x58(%eax),%esi 80101cdf: 0f 87 e7 00 00 00 ja 80101dcc 80101ce5: 8b 7d e0 mov -0x20(%ebp),%edi 80101ce8: 31 d2 xor %edx,%edx 80101cea: 89 f8 mov %edi,%eax 80101cec: 01 f0 add %esi,%eax 80101cee: 0f 92 c2 setb %dl return -1; } if (off + n > MAXFILE * BSIZE) { 80101cf1: 3d 00 18 01 00 cmp $0x11800,%eax 80101cf6: 0f 87 d0 00 00 00 ja 80101dcc 80101cfc: 85 d2 test %edx,%edx 80101cfe: 0f 85 c8 00 00 00 jne 80101dcc return -1; } for (tot = 0; tot < n; tot += m, off += m, src += m) { 80101d04: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 80101d0b: 85 ff test %edi,%edi 80101d0d: 74 72 je 80101d81 80101d0f: 90 nop bp = bread(ip->dev, bmap(ip, off / BSIZE)); 80101d10: 8b 7d d8 mov -0x28(%ebp),%edi 80101d13: 89 f2 mov %esi,%edx 80101d15: c1 ea 09 shr $0x9,%edx 80101d18: 89 f8 mov %edi,%eax 80101d1a: e8 51 f8 ff ff call 80101570 80101d1f: 83 ec 08 sub $0x8,%esp 80101d22: 50 push %eax 80101d23: ff 37 push (%edi) 80101d25: e8 a6 e3 ff ff call 801000d0 m = min(n - tot, BSIZE - off % BSIZE); 80101d2a: b9 00 02 00 00 mov $0x200,%ecx 80101d2f: 8b 5d e0 mov -0x20(%ebp),%ebx 80101d32: 2b 5d e4 sub -0x1c(%ebp),%ebx bp = bread(ip->dev, bmap(ip, off / BSIZE)); 80101d35: 89 c7 mov %eax,%edi m = min(n - tot, BSIZE - off % BSIZE); 80101d37: 89 f0 mov %esi,%eax 80101d39: 25 ff 01 00 00 and $0x1ff,%eax 80101d3e: 29 c1 sub %eax,%ecx memmove(bp->data + off % BSIZE, src, m); 80101d40: 8d 44 07 5c lea 0x5c(%edi,%eax,1),%eax m = min(n - tot, BSIZE - off % BSIZE); 80101d44: 39 d9 cmp %ebx,%ecx 80101d46: 0f 46 d9 cmovbe %ecx,%ebx memmove(bp->data + off % BSIZE, src, m); 80101d49: 83 c4 0c add $0xc,%esp 80101d4c: 53 push %ebx for (tot = 0; tot < n; tot += m, off += m, src += m) { 80101d4d: 01 de add %ebx,%esi memmove(bp->data + off % BSIZE, src, m); 80101d4f: ff 75 dc push -0x24(%ebp) 80101d52: 50 push %eax 80101d53: e8 08 2b 00 00 call 80104860 log_write(bp); 80101d58: 89 3c 24 mov %edi,(%esp) 80101d5b: e8 00 13 00 00 call 80103060 brelse(bp); 80101d60: 89 3c 24 mov %edi,(%esp) 80101d63: e8 88 e4 ff ff call 801001f0 for (tot = 0; tot < n; tot += m, off += m, src += m) { 80101d68: 01 5d e4 add %ebx,-0x1c(%ebp) 80101d6b: 83 c4 10 add $0x10,%esp 80101d6e: 8b 45 e4 mov -0x1c(%ebp),%eax 80101d71: 01 5d dc add %ebx,-0x24(%ebp) 80101d74: 39 45 e0 cmp %eax,-0x20(%ebp) 80101d77: 77 97 ja 80101d10 } if (n > 0 && off > ip->size) { 80101d79: 8b 45 d8 mov -0x28(%ebp),%eax 80101d7c: 3b 70 58 cmp 0x58(%eax),%esi 80101d7f: 77 37 ja 80101db8 ip->size = off; iupdate(ip); } return n; 80101d81: 8b 45 e0 mov -0x20(%ebp),%eax } 80101d84: 8d 65 f4 lea -0xc(%ebp),%esp 80101d87: 5b pop %ebx 80101d88: 5e pop %esi 80101d89: 5f pop %edi 80101d8a: 5d pop %ebp 80101d8b: c3 ret 80101d8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) { 80101d90: 0f bf 40 52 movswl 0x52(%eax),%eax 80101d94: 66 83 f8 09 cmp $0x9,%ax 80101d98: 77 32 ja 80101dcc 80101d9a: 8b 04 c5 24 f9 10 80 mov -0x7fef06dc(,%eax,8),%eax 80101da1: 85 c0 test %eax,%eax 80101da3: 74 27 je 80101dcc return devsw[ip->major].write(ip, src, n); 80101da5: 89 55 10 mov %edx,0x10(%ebp) } 80101da8: 8d 65 f4 lea -0xc(%ebp),%esp 80101dab: 5b pop %ebx 80101dac: 5e pop %esi 80101dad: 5f pop %edi 80101dae: 5d pop %ebp return devsw[ip->major].write(ip, src, n); 80101daf: ff e0 jmp *%eax 80101db1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ip->size = off; 80101db8: 8b 45 d8 mov -0x28(%ebp),%eax iupdate(ip); 80101dbb: 83 ec 0c sub $0xc,%esp ip->size = off; 80101dbe: 89 70 58 mov %esi,0x58(%eax) iupdate(ip); 80101dc1: 50 push %eax 80101dc2: e8 29 fa ff ff call 801017f0 80101dc7: 83 c4 10 add $0x10,%esp 80101dca: eb b5 jmp 80101d81 return -1; 80101dcc: b8 ff ff ff ff mov $0xffffffff,%eax 80101dd1: eb b1 jmp 80101d84 80101dd3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101dda: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101de0 : // Directories int namecmp(const char *s, const char *t) { 80101de0: 55 push %ebp 80101de1: 89 e5 mov %esp,%ebp 80101de3: 83 ec 0c sub $0xc,%esp return strncmp(s, t, DIRSIZ); 80101de6: 6a 0e push $0xe 80101de8: ff 75 0c push 0xc(%ebp) 80101deb: ff 75 08 push 0x8(%ebp) 80101dee: e8 dd 2a 00 00 call 801048d0 } 80101df3: c9 leave 80101df4: c3 ret 80101df5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101dfc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101e00 : // 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) { 80101e00: 55 push %ebp 80101e01: 89 e5 mov %esp,%ebp 80101e03: 57 push %edi 80101e04: 56 push %esi 80101e05: 53 push %ebx 80101e06: 83 ec 1c sub $0x1c,%esp 80101e09: 8b 5d 08 mov 0x8(%ebp),%ebx uint off, inum; struct dirent de; if (dp->type != T_DIR) { 80101e0c: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80101e11: 0f 85 85 00 00 00 jne 80101e9c panic("dirlookup not DIR"); } for (off = 0; off < dp->size; off += sizeof(de)) { 80101e17: 8b 53 58 mov 0x58(%ebx),%edx 80101e1a: 31 ff xor %edi,%edi 80101e1c: 8d 75 d8 lea -0x28(%ebp),%esi 80101e1f: 85 d2 test %edx,%edx 80101e21: 74 3e je 80101e61 80101e23: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101e27: 90 nop if (readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 80101e28: 6a 10 push $0x10 80101e2a: 57 push %edi 80101e2b: 56 push %esi 80101e2c: 53 push %ebx 80101e2d: e8 7e fd ff ff call 80101bb0 80101e32: 83 c4 10 add $0x10,%esp 80101e35: 83 f8 10 cmp $0x10,%eax 80101e38: 75 55 jne 80101e8f panic("dirlookup read"); } if (de.inum == 0) { 80101e3a: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 80101e3f: 74 18 je 80101e59 return strncmp(s, t, DIRSIZ); 80101e41: 83 ec 04 sub $0x4,%esp 80101e44: 8d 45 da lea -0x26(%ebp),%eax 80101e47: 6a 0e push $0xe 80101e49: 50 push %eax 80101e4a: ff 75 0c push 0xc(%ebp) 80101e4d: e8 7e 2a 00 00 call 801048d0 continue; } if (namecmp(name, de.name) == 0) { 80101e52: 83 c4 10 add $0x10,%esp 80101e55: 85 c0 test %eax,%eax 80101e57: 74 17 je 80101e70 for (off = 0; off < dp->size; off += sizeof(de)) { 80101e59: 83 c7 10 add $0x10,%edi 80101e5c: 3b 7b 58 cmp 0x58(%ebx),%edi 80101e5f: 72 c7 jb 80101e28 return iget(dp->dev, inum); } } return 0; } 80101e61: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80101e64: 31 c0 xor %eax,%eax } 80101e66: 5b pop %ebx 80101e67: 5e pop %esi 80101e68: 5f pop %edi 80101e69: 5d pop %ebp 80101e6a: c3 ret 80101e6b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101e6f: 90 nop if (poff) { 80101e70: 8b 45 10 mov 0x10(%ebp),%eax 80101e73: 85 c0 test %eax,%eax 80101e75: 74 05 je 80101e7c *poff = off; 80101e77: 8b 45 10 mov 0x10(%ebp),%eax 80101e7a: 89 38 mov %edi,(%eax) inum = de.inum; 80101e7c: 0f b7 55 d8 movzwl -0x28(%ebp),%edx return iget(dp->dev, inum); 80101e80: 8b 03 mov (%ebx),%eax 80101e82: e8 e9 f5 ff ff call 80101470 } 80101e87: 8d 65 f4 lea -0xc(%ebp),%esp 80101e8a: 5b pop %ebx 80101e8b: 5e pop %esi 80101e8c: 5f pop %edi 80101e8d: 5d pop %ebp 80101e8e: c3 ret panic("dirlookup read"); 80101e8f: 83 ec 0c sub $0xc,%esp 80101e92: 68 39 75 10 80 push $0x80107539 80101e97: e8 f4 e4 ff ff call 80100390 panic("dirlookup not DIR"); 80101e9c: 83 ec 0c sub $0xc,%esp 80101e9f: 68 27 75 10 80 push $0x80107527 80101ea4: e8 e7 e4 ff ff call 80100390 80101ea9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101eb0 : // Look up and return the inode for a path name. // 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) { 80101eb0: 55 push %ebp 80101eb1: 89 e5 mov %esp,%ebp 80101eb3: 57 push %edi 80101eb4: 56 push %esi 80101eb5: 53 push %ebx 80101eb6: 89 c3 mov %eax,%ebx 80101eb8: 83 ec 1c sub $0x1c,%esp struct inode *ip, *next; if (*path == '/') { 80101ebb: 80 38 2f cmpb $0x2f,(%eax) static struct inode* namex(char *path, int nameiparent, char *name) { 80101ebe: 89 55 dc mov %edx,-0x24(%ebp) 80101ec1: 89 4d e4 mov %ecx,-0x1c(%ebp) if (*path == '/') { 80101ec4: 0f 84 64 01 00 00 je 8010202e ip = iget(ROOTDEV, ROOTINO); } else { ip = idup(myproc()->cwd); 80101eca: e8 01 1c 00 00 call 80103ad0 acquire(&icache.lock); 80101ecf: 83 ec 0c sub $0xc,%esp ip = idup(myproc()->cwd); 80101ed2: 8b 70 68 mov 0x68(%eax),%esi acquire(&icache.lock); 80101ed5: 68 80 f9 10 80 push $0x8010f980 80101eda: e8 21 28 00 00 call 80104700 ip->ref++; 80101edf: 83 46 08 01 addl $0x1,0x8(%esi) release(&icache.lock); 80101ee3: c7 04 24 80 f9 10 80 movl $0x8010f980,(%esp) 80101eea: e8 b1 27 00 00 call 801046a0 80101eef: 83 c4 10 add $0x10,%esp 80101ef2: eb 07 jmp 80101efb 80101ef4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi path++; 80101ef8: 83 c3 01 add $0x1,%ebx while (*path == '/') { 80101efb: 0f b6 03 movzbl (%ebx),%eax 80101efe: 3c 2f cmp $0x2f,%al 80101f00: 74 f6 je 80101ef8 if (*path == 0) { 80101f02: 84 c0 test %al,%al 80101f04: 0f 84 06 01 00 00 je 80102010 while (*path != '/' && *path != 0) { 80101f0a: 0f b6 03 movzbl (%ebx),%eax 80101f0d: 84 c0 test %al,%al 80101f0f: 0f 84 10 01 00 00 je 80102025 80101f15: 89 df mov %ebx,%edi 80101f17: 3c 2f cmp $0x2f,%al 80101f19: 0f 84 06 01 00 00 je 80102025 80101f1f: 90 nop 80101f20: 0f b6 47 01 movzbl 0x1(%edi),%eax path++; 80101f24: 83 c7 01 add $0x1,%edi while (*path != '/' && *path != 0) { 80101f27: 3c 2f cmp $0x2f,%al 80101f29: 74 04 je 80101f2f 80101f2b: 84 c0 test %al,%al 80101f2d: 75 f1 jne 80101f20 len = path - s; 80101f2f: 89 f8 mov %edi,%eax 80101f31: 29 d8 sub %ebx,%eax if (len >= DIRSIZ) { 80101f33: 83 f8 0d cmp $0xd,%eax 80101f36: 0f 8e ac 00 00 00 jle 80101fe8 memmove(name, s, DIRSIZ); 80101f3c: 83 ec 04 sub $0x4,%esp 80101f3f: 6a 0e push $0xe 80101f41: 53 push %ebx path++; 80101f42: 89 fb mov %edi,%ebx memmove(name, s, DIRSIZ); 80101f44: ff 75 e4 push -0x1c(%ebp) 80101f47: e8 14 29 00 00 call 80104860 80101f4c: 83 c4 10 add $0x10,%esp while (*path == '/') { 80101f4f: 80 3f 2f cmpb $0x2f,(%edi) 80101f52: 75 0c jne 80101f60 80101f54: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi path++; 80101f58: 83 c3 01 add $0x1,%ebx while (*path == '/') { 80101f5b: 80 3b 2f cmpb $0x2f,(%ebx) 80101f5e: 74 f8 je 80101f58 } while ((path = skipelem(path, name)) != 0) { ilock(ip); 80101f60: 83 ec 0c sub $0xc,%esp 80101f63: 56 push %esi 80101f64: e8 37 f9 ff ff call 801018a0 if (ip->type != T_DIR) { 80101f69: 83 c4 10 add $0x10,%esp 80101f6c: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) 80101f71: 0f 85 cd 00 00 00 jne 80102044 iunlockput(ip); return 0; } if (nameiparent && *path == '\0') { 80101f77: 8b 45 dc mov -0x24(%ebp),%eax 80101f7a: 85 c0 test %eax,%eax 80101f7c: 74 09 je 80101f87 80101f7e: 80 3b 00 cmpb $0x0,(%ebx) 80101f81: 0f 84 22 01 00 00 je 801020a9 // Stop one level early. iunlock(ip); return ip; } if ((next = dirlookup(ip, name, 0)) == 0) { 80101f87: 83 ec 04 sub $0x4,%esp 80101f8a: 6a 00 push $0x0 80101f8c: ff 75 e4 push -0x1c(%ebp) 80101f8f: 56 push %esi 80101f90: e8 6b fe ff ff call 80101e00 if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80101f95: 8d 56 0c lea 0xc(%esi),%edx if ((next = dirlookup(ip, name, 0)) == 0) { 80101f98: 83 c4 10 add $0x10,%esp 80101f9b: 89 c7 mov %eax,%edi 80101f9d: 85 c0 test %eax,%eax 80101f9f: 0f 84 e1 00 00 00 je 80102086 if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80101fa5: 83 ec 0c sub $0xc,%esp 80101fa8: 89 55 e0 mov %edx,-0x20(%ebp) 80101fab: 52 push %edx 80101fac: e8 2f 25 00 00 call 801044e0 80101fb1: 83 c4 10 add $0x10,%esp 80101fb4: 85 c0 test %eax,%eax 80101fb6: 0f 84 30 01 00 00 je 801020ec 80101fbc: 8b 56 08 mov 0x8(%esi),%edx 80101fbf: 85 d2 test %edx,%edx 80101fc1: 0f 8e 25 01 00 00 jle 801020ec releasesleep(&ip->lock); 80101fc7: 8b 55 e0 mov -0x20(%ebp),%edx 80101fca: 83 ec 0c sub $0xc,%esp 80101fcd: 52 push %edx 80101fce: e8 cd 24 00 00 call 801044a0 iput(ip); 80101fd3: 89 34 24 mov %esi,(%esp) 80101fd6: 89 fe mov %edi,%esi 80101fd8: e8 f3 f9 ff ff call 801019d0 80101fdd: 83 c4 10 add $0x10,%esp 80101fe0: e9 16 ff ff ff jmp 80101efb 80101fe5: 8d 76 00 lea 0x0(%esi),%esi name[len] = 0; 80101fe8: 8b 4d e4 mov -0x1c(%ebp),%ecx 80101feb: 8d 14 01 lea (%ecx,%eax,1),%edx memmove(name, s, len); 80101fee: 83 ec 04 sub $0x4,%esp 80101ff1: 89 55 e0 mov %edx,-0x20(%ebp) 80101ff4: 50 push %eax 80101ff5: 53 push %ebx name[len] = 0; 80101ff6: 89 fb mov %edi,%ebx memmove(name, s, len); 80101ff8: ff 75 e4 push -0x1c(%ebp) 80101ffb: e8 60 28 00 00 call 80104860 name[len] = 0; 80102000: 8b 55 e0 mov -0x20(%ebp),%edx 80102003: 83 c4 10 add $0x10,%esp 80102006: c6 02 00 movb $0x0,(%edx) 80102009: e9 41 ff ff ff jmp 80101f4f 8010200e: 66 90 xchg %ax,%ax return 0; } iunlockput(ip); ip = next; } if (nameiparent) { 80102010: 8b 45 dc mov -0x24(%ebp),%eax 80102013: 85 c0 test %eax,%eax 80102015: 0f 85 be 00 00 00 jne 801020d9 iput(ip); return 0; } return ip; } 8010201b: 8d 65 f4 lea -0xc(%ebp),%esp 8010201e: 89 f0 mov %esi,%eax 80102020: 5b pop %ebx 80102021: 5e pop %esi 80102022: 5f pop %edi 80102023: 5d pop %ebp 80102024: c3 ret while (*path != '/' && *path != 0) { 80102025: 8b 55 e4 mov -0x1c(%ebp),%edx 80102028: 89 df mov %ebx,%edi 8010202a: 31 c0 xor %eax,%eax 8010202c: eb c0 jmp 80101fee ip = iget(ROOTDEV, ROOTINO); 8010202e: ba 01 00 00 00 mov $0x1,%edx 80102033: b8 01 00 00 00 mov $0x1,%eax 80102038: e8 33 f4 ff ff call 80101470 8010203d: 89 c6 mov %eax,%esi 8010203f: e9 b7 fe ff ff jmp 80101efb if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80102044: 83 ec 0c sub $0xc,%esp 80102047: 8d 5e 0c lea 0xc(%esi),%ebx 8010204a: 53 push %ebx 8010204b: e8 90 24 00 00 call 801044e0 80102050: 83 c4 10 add $0x10,%esp 80102053: 85 c0 test %eax,%eax 80102055: 0f 84 91 00 00 00 je 801020ec 8010205b: 8b 46 08 mov 0x8(%esi),%eax 8010205e: 85 c0 test %eax,%eax 80102060: 0f 8e 86 00 00 00 jle 801020ec releasesleep(&ip->lock); 80102066: 83 ec 0c sub $0xc,%esp 80102069: 53 push %ebx 8010206a: e8 31 24 00 00 call 801044a0 iput(ip); 8010206f: 89 34 24 mov %esi,(%esp) return 0; 80102072: 31 f6 xor %esi,%esi iput(ip); 80102074: e8 57 f9 ff ff call 801019d0 return 0; 80102079: 83 c4 10 add $0x10,%esp } 8010207c: 8d 65 f4 lea -0xc(%ebp),%esp 8010207f: 89 f0 mov %esi,%eax 80102081: 5b pop %ebx 80102082: 5e pop %esi 80102083: 5f pop %edi 80102084: 5d pop %ebp 80102085: c3 ret if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80102086: 83 ec 0c sub $0xc,%esp 80102089: 89 55 e4 mov %edx,-0x1c(%ebp) 8010208c: 52 push %edx 8010208d: e8 4e 24 00 00 call 801044e0 80102092: 83 c4 10 add $0x10,%esp 80102095: 85 c0 test %eax,%eax 80102097: 74 53 je 801020ec 80102099: 8b 4e 08 mov 0x8(%esi),%ecx 8010209c: 85 c9 test %ecx,%ecx 8010209e: 7e 4c jle 801020ec releasesleep(&ip->lock); 801020a0: 8b 55 e4 mov -0x1c(%ebp),%edx 801020a3: 83 ec 0c sub $0xc,%esp 801020a6: 52 push %edx 801020a7: eb c1 jmp 8010206a if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 801020a9: 83 ec 0c sub $0xc,%esp 801020ac: 8d 5e 0c lea 0xc(%esi),%ebx 801020af: 53 push %ebx 801020b0: e8 2b 24 00 00 call 801044e0 801020b5: 83 c4 10 add $0x10,%esp 801020b8: 85 c0 test %eax,%eax 801020ba: 74 30 je 801020ec 801020bc: 8b 7e 08 mov 0x8(%esi),%edi 801020bf: 85 ff test %edi,%edi 801020c1: 7e 29 jle 801020ec releasesleep(&ip->lock); 801020c3: 83 ec 0c sub $0xc,%esp 801020c6: 53 push %ebx 801020c7: e8 d4 23 00 00 call 801044a0 } 801020cc: 83 c4 10 add $0x10,%esp } 801020cf: 8d 65 f4 lea -0xc(%ebp),%esp 801020d2: 89 f0 mov %esi,%eax 801020d4: 5b pop %ebx 801020d5: 5e pop %esi 801020d6: 5f pop %edi 801020d7: 5d pop %ebp 801020d8: c3 ret iput(ip); 801020d9: 83 ec 0c sub $0xc,%esp 801020dc: 56 push %esi return 0; 801020dd: 31 f6 xor %esi,%esi iput(ip); 801020df: e8 ec f8 ff ff call 801019d0 return 0; 801020e4: 83 c4 10 add $0x10,%esp 801020e7: e9 2f ff ff ff jmp 8010201b panic("iunlock"); 801020ec: 83 ec 0c sub $0xc,%esp 801020ef: 68 1f 75 10 80 push $0x8010751f 801020f4: e8 97 e2 ff ff call 80100390 801020f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102100 : int dirlink(struct inode *dp, char *name, uint inum) { 80102100: 55 push %ebp 80102101: 89 e5 mov %esp,%ebp 80102103: 57 push %edi 80102104: 56 push %esi 80102105: 53 push %ebx 80102106: 83 ec 20 sub $0x20,%esp 80102109: 8b 5d 08 mov 0x8(%ebp),%ebx if ((ip = dirlookup(dp, name, 0)) != 0) { 8010210c: 6a 00 push $0x0 8010210e: ff 75 0c push 0xc(%ebp) 80102111: 53 push %ebx 80102112: e8 e9 fc ff ff call 80101e00 80102117: 83 c4 10 add $0x10,%esp 8010211a: 85 c0 test %eax,%eax 8010211c: 75 67 jne 80102185 for (off = 0; off < dp->size; off += sizeof(de)) { 8010211e: 8b 7b 58 mov 0x58(%ebx),%edi 80102121: 8d 75 d8 lea -0x28(%ebp),%esi 80102124: 85 ff test %edi,%edi 80102126: 74 29 je 80102151 80102128: 31 ff xor %edi,%edi 8010212a: 8d 75 d8 lea -0x28(%ebp),%esi 8010212d: eb 09 jmp 80102138 8010212f: 90 nop 80102130: 83 c7 10 add $0x10,%edi 80102133: 3b 7b 58 cmp 0x58(%ebx),%edi 80102136: 73 19 jae 80102151 if (readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 80102138: 6a 10 push $0x10 8010213a: 57 push %edi 8010213b: 56 push %esi 8010213c: 53 push %ebx 8010213d: e8 6e fa ff ff call 80101bb0 80102142: 83 c4 10 add $0x10,%esp 80102145: 83 f8 10 cmp $0x10,%eax 80102148: 75 4e jne 80102198 if (de.inum == 0) { 8010214a: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 8010214f: 75 df jne 80102130 strncpy(de.name, name, DIRSIZ); 80102151: 83 ec 04 sub $0x4,%esp 80102154: 8d 45 da lea -0x26(%ebp),%eax 80102157: 6a 0e push $0xe 80102159: ff 75 0c push 0xc(%ebp) 8010215c: 50 push %eax 8010215d: e8 be 27 00 00 call 80104920 if (writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 80102162: 6a 10 push $0x10 de.inum = inum; 80102164: 8b 45 10 mov 0x10(%ebp),%eax if (writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 80102167: 57 push %edi 80102168: 56 push %esi 80102169: 53 push %ebx de.inum = inum; 8010216a: 66 89 45 d8 mov %ax,-0x28(%ebp) if (writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 8010216e: e8 3d fb ff ff call 80101cb0 80102173: 83 c4 20 add $0x20,%esp 80102176: 83 f8 10 cmp $0x10,%eax 80102179: 75 2a jne 801021a5 return 0; 8010217b: 31 c0 xor %eax,%eax } 8010217d: 8d 65 f4 lea -0xc(%ebp),%esp 80102180: 5b pop %ebx 80102181: 5e pop %esi 80102182: 5f pop %edi 80102183: 5d pop %ebp 80102184: c3 ret iput(ip); 80102185: 83 ec 0c sub $0xc,%esp 80102188: 50 push %eax 80102189: e8 42 f8 ff ff call 801019d0 return -1; 8010218e: 83 c4 10 add $0x10,%esp 80102191: b8 ff ff ff ff mov $0xffffffff,%eax 80102196: eb e5 jmp 8010217d panic("dirlink read"); 80102198: 83 ec 0c sub $0xc,%esp 8010219b: 68 48 75 10 80 push $0x80107548 801021a0: e8 eb e1 ff ff call 80100390 panic("dirlink"); 801021a5: 83 ec 0c sub $0xc,%esp 801021a8: 68 2a 7b 10 80 push $0x80107b2a 801021ad: e8 de e1 ff ff call 80100390 801021b2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801021b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801021c0 : struct inode* namei(char *path) { 801021c0: 55 push %ebp char name[DIRSIZ]; return namex(path, 0, name); 801021c1: 31 d2 xor %edx,%edx struct inode* namei(char *path) { 801021c3: 89 e5 mov %esp,%ebp 801021c5: 83 ec 18 sub $0x18,%esp return namex(path, 0, name); 801021c8: 8b 45 08 mov 0x8(%ebp),%eax 801021cb: 8d 4d ea lea -0x16(%ebp),%ecx 801021ce: e8 dd fc ff ff call 80101eb0 } 801021d3: c9 leave 801021d4: c3 ret 801021d5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801021dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801021e0 : struct inode*nameiparent(char *path, char *name) { 801021e0: 55 push %ebp return namex(path, 1, name); 801021e1: ba 01 00 00 00 mov $0x1,%edx struct inode*nameiparent(char *path, char *name) { 801021e6: 89 e5 mov %esp,%ebp return namex(path, 1, name); 801021e8: 8b 4d 0c mov 0xc(%ebp),%ecx 801021eb: 8b 45 08 mov 0x8(%ebp),%eax } 801021ee: 5d pop %ebp return namex(path, 1, name); 801021ef: e9 bc fc ff ff jmp 80101eb0 801021f4: 66 90 xchg %ax,%ax 801021f6: 66 90 xchg %ax,%ax 801021f8: 66 90 xchg %ax,%ax 801021fa: 66 90 xchg %ax,%ax 801021fc: 66 90 xchg %ax,%ax 801021fe: 66 90 xchg %ax,%ax 80102200 : // Switch back to disk 0. outb(0x1f6, 0xe0 | (0 << 4)); } // Start the request for b. Caller must hold idelock. static void idestart(struct buf *b) { 80102200: 55 push %ebp 80102201: 89 e5 mov %esp,%ebp 80102203: 57 push %edi 80102204: 56 push %esi 80102205: 53 push %ebx 80102206: 83 ec 0c sub $0xc,%esp if (b == 0) { 80102209: 85 c0 test %eax,%eax 8010220b: 0f 84 b4 00 00 00 je 801022c5 panic("idestart"); } if (b->blockno >= FSSIZE) { 80102211: 8b 70 08 mov 0x8(%eax),%esi 80102214: 89 c3 mov %eax,%ebx 80102216: 81 fe e7 03 00 00 cmp $0x3e7,%esi 8010221c: 0f 87 96 00 00 00 ja 801022b8 asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102222: b9 f7 01 00 00 mov $0x1f7,%ecx 80102227: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010222e: 66 90 xchg %ax,%ax 80102230: 89 ca mov %ecx,%edx 80102232: ec in (%dx),%al while (((r = inb(0x1f7)) & (IDE_BSY | IDE_DRDY)) != IDE_DRDY) { 80102233: 83 e0 c0 and $0xffffffc0,%eax 80102236: 3c 40 cmp $0x40,%al 80102238: 75 f6 jne 80102230 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 8010223a: 31 ff xor %edi,%edi 8010223c: ba f6 03 00 00 mov $0x3f6,%edx 80102241: 89 f8 mov %edi,%eax 80102243: ee out %al,(%dx) 80102244: b8 01 00 00 00 mov $0x1,%eax 80102249: ba f2 01 00 00 mov $0x1f2,%edx 8010224e: ee out %al,(%dx) 8010224f: ba f3 01 00 00 mov $0x1f3,%edx 80102254: 89 f0 mov %esi,%eax 80102256: 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); 80102257: 89 f0 mov %esi,%eax 80102259: ba f4 01 00 00 mov $0x1f4,%edx 8010225e: c1 f8 08 sar $0x8,%eax 80102261: ee out %al,(%dx) 80102262: ba f5 01 00 00 mov $0x1f5,%edx 80102267: 89 f8 mov %edi,%eax 80102269: ee out %al,(%dx) outb(0x1f5, (sector >> 16) & 0xff); outb(0x1f6, 0xe0 | ((b->dev & 1) << 4) | ((sector >> 24) & 0x0f)); 8010226a: 0f b6 43 04 movzbl 0x4(%ebx),%eax 8010226e: ba f6 01 00 00 mov $0x1f6,%edx 80102273: c1 e0 04 shl $0x4,%eax 80102276: 83 e0 10 and $0x10,%eax 80102279: 83 c8 e0 or $0xffffffe0,%eax 8010227c: ee out %al,(%dx) if (b->flags & B_DIRTY) { 8010227d: f6 03 04 testb $0x4,(%ebx) 80102280: 75 16 jne 80102298 80102282: b8 20 00 00 00 mov $0x20,%eax 80102287: 89 ca mov %ecx,%edx 80102289: ee out %al,(%dx) outsl(0x1f0, b->data, BSIZE / 4); } else { outb(0x1f7, read_cmd); } } 8010228a: 8d 65 f4 lea -0xc(%ebp),%esp 8010228d: 5b pop %ebx 8010228e: 5e pop %esi 8010228f: 5f pop %edi 80102290: 5d pop %ebp 80102291: c3 ret 80102292: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102298: b8 30 00 00 00 mov $0x30,%eax 8010229d: 89 ca mov %ecx,%edx 8010229f: ee out %al,(%dx) asm volatile ("cld; rep outsl" : 801022a0: b9 80 00 00 00 mov $0x80,%ecx outsl(0x1f0, b->data, BSIZE / 4); 801022a5: 8d 73 5c lea 0x5c(%ebx),%esi 801022a8: ba f0 01 00 00 mov $0x1f0,%edx 801022ad: fc cld 801022ae: f3 6f rep outsl %ds:(%esi),(%dx) } 801022b0: 8d 65 f4 lea -0xc(%ebp),%esp 801022b3: 5b pop %ebx 801022b4: 5e pop %esi 801022b5: 5f pop %edi 801022b6: 5d pop %ebp 801022b7: c3 ret panic("incorrect blockno"); 801022b8: 83 ec 0c sub $0xc,%esp 801022bb: 68 b4 75 10 80 push $0x801075b4 801022c0: e8 cb e0 ff ff call 80100390 panic("idestart"); 801022c5: 83 ec 0c sub $0xc,%esp 801022c8: 68 ab 75 10 80 push $0x801075ab 801022cd: e8 be e0 ff ff call 80100390 801022d2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801022d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801022e0 : void ideinit(void) { 801022e0: 55 push %ebp 801022e1: 89 e5 mov %esp,%ebp 801022e3: 83 ec 10 sub $0x10,%esp initlock(&idelock, "ide"); 801022e6: 68 c6 75 10 80 push $0x801075c6 801022eb: 68 20 16 11 80 push $0x80111620 801022f0: e8 3b 22 00 00 call 80104530 ioapicenable(IRQ_IDE, ncpu - 1); 801022f5: 58 pop %eax 801022f6: a1 a4 17 11 80 mov 0x801117a4,%eax 801022fb: 5a pop %edx 801022fc: 83 e8 01 sub $0x1,%eax 801022ff: 50 push %eax 80102300: 6a 0e push $0xe 80102302: e8 99 02 00 00 call 801025a0 while (((r = inb(0x1f7)) & (IDE_BSY | IDE_DRDY)) != IDE_DRDY) { 80102307: 83 c4 10 add $0x10,%esp asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 8010230a: ba f7 01 00 00 mov $0x1f7,%edx 8010230f: 90 nop 80102310: ec in (%dx),%al 80102311: 83 e0 c0 and $0xffffffc0,%eax 80102314: 3c 40 cmp $0x40,%al 80102316: 75 f8 jne 80102310 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102318: b8 f0 ff ff ff mov $0xfffffff0,%eax 8010231d: ba f6 01 00 00 mov $0x1f6,%edx 80102322: ee out %al,(%dx) 80102323: b9 e8 03 00 00 mov $0x3e8,%ecx asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102328: ba f7 01 00 00 mov $0x1f7,%edx 8010232d: eb 06 jmp 80102335 8010232f: 90 nop for (i = 0; i < 1000; i++) { 80102330: 83 e9 01 sub $0x1,%ecx 80102333: 74 0f je 80102344 80102335: ec in (%dx),%al if (inb(0x1f7) != 0) { 80102336: 84 c0 test %al,%al 80102338: 74 f6 je 80102330 havedisk1 = 1; 8010233a: c7 05 00 16 11 80 01 movl $0x1,0x80111600 80102341: 00 00 00 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102344: b8 e0 ff ff ff mov $0xffffffe0,%eax 80102349: ba f6 01 00 00 mov $0x1f6,%edx 8010234e: ee out %al,(%dx) } 8010234f: c9 leave 80102350: c3 ret 80102351: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102358: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010235f: 90 nop 80102360 : // Interrupt handler. void ideintr(void) { 80102360: 55 push %ebp 80102361: 89 e5 mov %esp,%ebp 80102363: 57 push %edi 80102364: 56 push %esi 80102365: 53 push %ebx 80102366: 83 ec 18 sub $0x18,%esp struct buf *b; // First queued buffer is the active request. acquire(&idelock); 80102369: 68 20 16 11 80 push $0x80111620 8010236e: e8 8d 23 00 00 call 80104700 if ((b = idequeue) == 0) { 80102373: 8b 1d 04 16 11 80 mov 0x80111604,%ebx 80102379: 83 c4 10 add $0x10,%esp 8010237c: 85 db test %ebx,%ebx 8010237e: 74 63 je 801023e3 release(&idelock); return; } idequeue = b->qnext; 80102380: 8b 43 58 mov 0x58(%ebx),%eax 80102383: a3 04 16 11 80 mov %eax,0x80111604 // Read data if needed. if (!(b->flags & B_DIRTY) && idewait(1) >= 0) { 80102388: 8b 33 mov (%ebx),%esi 8010238a: f7 c6 04 00 00 00 test $0x4,%esi 80102390: 75 2f jne 801023c1 asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102392: ba f7 01 00 00 mov $0x1f7,%edx 80102397: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010239e: 66 90 xchg %ax,%ax 801023a0: ec in (%dx),%al while (((r = inb(0x1f7)) & (IDE_BSY | IDE_DRDY)) != IDE_DRDY) { 801023a1: 89 c1 mov %eax,%ecx 801023a3: 83 e1 c0 and $0xffffffc0,%ecx 801023a6: 80 f9 40 cmp $0x40,%cl 801023a9: 75 f5 jne 801023a0 if (checkerr && (r & (IDE_DF | IDE_ERR)) != 0) { 801023ab: a8 21 test $0x21,%al 801023ad: 75 12 jne 801023c1 insl(0x1f0, b->data, BSIZE / 4); 801023af: 8d 7b 5c lea 0x5c(%ebx),%edi asm volatile ("cld; rep insl" : 801023b2: b9 80 00 00 00 mov $0x80,%ecx 801023b7: ba f0 01 00 00 mov $0x1f0,%edx 801023bc: fc cld 801023bd: f3 6d rep insl (%dx),%es:(%edi) } // Wake process waiting for this buf. b->flags |= B_VALID; 801023bf: 8b 33 mov (%ebx),%esi b->flags &= ~B_DIRTY; 801023c1: 83 e6 fb and $0xfffffffb,%esi wakeup(b); 801023c4: 83 ec 0c sub $0xc,%esp b->flags &= ~B_DIRTY; 801023c7: 83 ce 02 or $0x2,%esi 801023ca: 89 33 mov %esi,(%ebx) wakeup(b); 801023cc: 53 push %ebx 801023cd: e8 8e 1e 00 00 call 80104260 // Start disk on next buf in queue. if (idequeue != 0) { 801023d2: a1 04 16 11 80 mov 0x80111604,%eax 801023d7: 83 c4 10 add $0x10,%esp 801023da: 85 c0 test %eax,%eax 801023dc: 74 05 je 801023e3 idestart(idequeue); 801023de: e8 1d fe ff ff call 80102200 release(&idelock); 801023e3: 83 ec 0c sub $0xc,%esp 801023e6: 68 20 16 11 80 push $0x80111620 801023eb: e8 b0 22 00 00 call 801046a0 } release(&idelock); } 801023f0: 8d 65 f4 lea -0xc(%ebp),%esp 801023f3: 5b pop %ebx 801023f4: 5e pop %esi 801023f5: 5f pop %edi 801023f6: 5d pop %ebp 801023f7: c3 ret 801023f8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801023ff: 90 nop 80102400 : // 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) { 80102400: 55 push %ebp 80102401: 89 e5 mov %esp,%ebp 80102403: 53 push %ebx 80102404: 83 ec 10 sub $0x10,%esp 80102407: 8b 5d 08 mov 0x8(%ebp),%ebx struct buf **pp; if (!holdingsleep(&b->lock)) { 8010240a: 8d 43 0c lea 0xc(%ebx),%eax 8010240d: 50 push %eax 8010240e: e8 cd 20 00 00 call 801044e0 80102413: 83 c4 10 add $0x10,%esp 80102416: 85 c0 test %eax,%eax 80102418: 0f 84 c3 00 00 00 je 801024e1 panic("iderw: buf not locked"); } if ((b->flags & (B_VALID | B_DIRTY)) == B_VALID) { 8010241e: 8b 03 mov (%ebx),%eax 80102420: 83 e0 06 and $0x6,%eax 80102423: 83 f8 02 cmp $0x2,%eax 80102426: 0f 84 a8 00 00 00 je 801024d4 panic("iderw: nothing to do"); } if (b->dev != 0 && !havedisk1) { 8010242c: 8b 53 04 mov 0x4(%ebx),%edx 8010242f: 85 d2 test %edx,%edx 80102431: 74 0d je 80102440 80102433: a1 00 16 11 80 mov 0x80111600,%eax 80102438: 85 c0 test %eax,%eax 8010243a: 0f 84 87 00 00 00 je 801024c7 panic("iderw: ide disk 1 not present"); } acquire(&idelock); //DOC:acquire-lock 80102440: 83 ec 0c sub $0xc,%esp 80102443: 68 20 16 11 80 push $0x80111620 80102448: e8 b3 22 00 00 call 80104700 // Append b to idequeue. b->qnext = 0; for (pp = &idequeue; *pp; pp = &(*pp)->qnext) { //DOC:insert-queue 8010244d: a1 04 16 11 80 mov 0x80111604,%eax b->qnext = 0; 80102452: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) for (pp = &idequeue; *pp; pp = &(*pp)->qnext) { //DOC:insert-queue 80102459: 83 c4 10 add $0x10,%esp 8010245c: 85 c0 test %eax,%eax 8010245e: 74 60 je 801024c0 80102460: 89 c2 mov %eax,%edx 80102462: 8b 40 58 mov 0x58(%eax),%eax 80102465: 85 c0 test %eax,%eax 80102467: 75 f7 jne 80102460 80102469: 83 c2 58 add $0x58,%edx ; } *pp = b; 8010246c: 89 1a mov %ebx,(%edx) // Start disk if necessary. if (idequeue == b) { 8010246e: 39 1d 04 16 11 80 cmp %ebx,0x80111604 80102474: 74 3a je 801024b0 idestart(b); } // Wait for request to finish. while ((b->flags & (B_VALID | B_DIRTY)) != B_VALID) { 80102476: 8b 03 mov (%ebx),%eax 80102478: 83 e0 06 and $0x6,%eax 8010247b: 83 f8 02 cmp $0x2,%eax 8010247e: 74 1b je 8010249b sleep(b, &idelock); 80102480: 83 ec 08 sub $0x8,%esp 80102483: 68 20 16 11 80 push $0x80111620 80102488: 53 push %ebx 80102489: e8 12 1d 00 00 call 801041a0 while ((b->flags & (B_VALID | B_DIRTY)) != B_VALID) { 8010248e: 8b 03 mov (%ebx),%eax 80102490: 83 c4 10 add $0x10,%esp 80102493: 83 e0 06 and $0x6,%eax 80102496: 83 f8 02 cmp $0x2,%eax 80102499: 75 e5 jne 80102480 } release(&idelock); 8010249b: c7 45 08 20 16 11 80 movl $0x80111620,0x8(%ebp) } 801024a2: 8b 5d fc mov -0x4(%ebp),%ebx 801024a5: c9 leave release(&idelock); 801024a6: e9 f5 21 00 00 jmp 801046a0 801024ab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801024af: 90 nop idestart(b); 801024b0: 89 d8 mov %ebx,%eax 801024b2: e8 49 fd ff ff call 80102200 801024b7: eb bd jmp 80102476 801024b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for (pp = &idequeue; *pp; pp = &(*pp)->qnext) { //DOC:insert-queue 801024c0: ba 04 16 11 80 mov $0x80111604,%edx 801024c5: eb a5 jmp 8010246c panic("iderw: ide disk 1 not present"); 801024c7: 83 ec 0c sub $0xc,%esp 801024ca: 68 f5 75 10 80 push $0x801075f5 801024cf: e8 bc de ff ff call 80100390 panic("iderw: nothing to do"); 801024d4: 83 ec 0c sub $0xc,%esp 801024d7: 68 e0 75 10 80 push $0x801075e0 801024dc: e8 af de ff ff call 80100390 panic("iderw: buf not locked"); 801024e1: 83 ec 0c sub $0xc,%esp 801024e4: 68 ca 75 10 80 push $0x801075ca 801024e9: e8 a2 de ff ff call 80100390 801024ee: 66 90 xchg %ax,%ax 801024f0 : static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; ioapic->data = data; } void ioapicinit(void) { 801024f0: 55 push %ebp int i, id, maxintr; ioapic = (volatile struct ioapic*)IOAPIC; 801024f1: c7 05 54 16 11 80 00 movl $0xfec00000,0x80111654 801024f8: 00 c0 fe void ioapicinit(void) { 801024fb: 89 e5 mov %esp,%ebp 801024fd: 56 push %esi 801024fe: 53 push %ebx ioapic->reg = reg; 801024ff: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000 80102506: 00 00 00 return ioapic->data; 80102509: 8b 15 54 16 11 80 mov 0x80111654,%edx 8010250f: 8b 72 10 mov 0x10(%edx),%esi ioapic->reg = reg; 80102512: c7 02 00 00 00 00 movl $0x0,(%edx) return ioapic->data; 80102518: 8b 0d 54 16 11 80 mov 0x80111654,%ecx maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; id = ioapicread(REG_ID) >> 24; if (id != ioapicid) { 8010251e: 0f b6 15 a0 17 11 80 movzbl 0x801117a0,%edx maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; 80102525: c1 ee 10 shr $0x10,%esi 80102528: 89 f0 mov %esi,%eax 8010252a: 0f b6 f0 movzbl %al,%esi return ioapic->data; 8010252d: 8b 41 10 mov 0x10(%ecx),%eax id = ioapicread(REG_ID) >> 24; 80102530: c1 e8 18 shr $0x18,%eax if (id != ioapicid) { 80102533: 39 c2 cmp %eax,%edx 80102535: 74 16 je 8010254d cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); 80102537: 83 ec 0c sub $0xc,%esp 8010253a: 68 14 76 10 80 push $0x80107614 8010253f: e8 6c e1 ff ff call 801006b0 ioapic->reg = reg; 80102544: 8b 0d 54 16 11 80 mov 0x80111654,%ecx 8010254a: 83 c4 10 add $0x10,%esp 8010254d: 83 c6 21 add $0x21,%esi void ioapicinit(void) { 80102550: ba 10 00 00 00 mov $0x10,%edx 80102555: b8 20 00 00 00 mov $0x20,%eax 8010255a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ioapic->reg = reg; 80102560: 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)); 80102562: 89 c3 mov %eax,%ebx ioapic->data = data; 80102564: 8b 0d 54 16 11 80 mov 0x80111654,%ecx for (i = 0; i <= maxintr; i++) { 8010256a: 83 c0 01 add $0x1,%eax ioapicwrite(REG_TABLE + 2 * i, INT_DISABLED | (T_IRQ0 + i)); 8010256d: 81 cb 00 00 01 00 or $0x10000,%ebx ioapic->data = data; 80102573: 89 59 10 mov %ebx,0x10(%ecx) ioapic->reg = reg; 80102576: 8d 5a 01 lea 0x1(%edx),%ebx for (i = 0; i <= maxintr; i++) { 80102579: 83 c2 02 add $0x2,%edx ioapic->reg = reg; 8010257c: 89 19 mov %ebx,(%ecx) ioapic->data = data; 8010257e: 8b 0d 54 16 11 80 mov 0x80111654,%ecx 80102584: c7 41 10 00 00 00 00 movl $0x0,0x10(%ecx) for (i = 0; i <= maxintr; i++) { 8010258b: 39 f0 cmp %esi,%eax 8010258d: 75 d1 jne 80102560 ioapicwrite(REG_TABLE + 2 * i + 1, 0); } } 8010258f: 8d 65 f8 lea -0x8(%ebp),%esp 80102592: 5b pop %ebx 80102593: 5e pop %esi 80102594: 5d pop %ebp 80102595: c3 ret 80102596: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010259d: 8d 76 00 lea 0x0(%esi),%esi 801025a0 : void ioapicenable(int irq, int cpunum) { 801025a0: 55 push %ebp ioapic->reg = reg; 801025a1: 8b 0d 54 16 11 80 mov 0x80111654,%ecx void ioapicenable(int irq, int cpunum) { 801025a7: 89 e5 mov %esp,%ebp 801025a9: 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); 801025ac: 8d 50 20 lea 0x20(%eax),%edx 801025af: 8d 44 00 10 lea 0x10(%eax,%eax,1),%eax ioapic->reg = reg; 801025b3: 89 01 mov %eax,(%ecx) ioapic->data = data; 801025b5: 8b 0d 54 16 11 80 mov 0x80111654,%ecx ioapicwrite(REG_TABLE + 2 * irq + 1, cpunum << 24); 801025bb: 83 c0 01 add $0x1,%eax ioapic->data = data; 801025be: 89 51 10 mov %edx,0x10(%ecx) ioapicwrite(REG_TABLE + 2 * irq + 1, cpunum << 24); 801025c1: 8b 55 0c mov 0xc(%ebp),%edx ioapic->reg = reg; 801025c4: 89 01 mov %eax,(%ecx) ioapic->data = data; 801025c6: a1 54 16 11 80 mov 0x80111654,%eax ioapicwrite(REG_TABLE + 2 * irq + 1, cpunum << 24); 801025cb: c1 e2 18 shl $0x18,%edx ioapic->data = data; 801025ce: 89 50 10 mov %edx,0x10(%eax) } 801025d1: 5d pop %ebp 801025d2: c3 ret 801025d3: 66 90 xchg %ax,%ax 801025d5: 66 90 xchg %ax,%ax 801025d7: 66 90 xchg %ax,%ax 801025d9: 66 90 xchg %ax,%ax 801025db: 66 90 xchg %ax,%ax 801025dd: 66 90 xchg %ax,%ax 801025df: 90 nop 801025e0 : // Free the page of physical memory pointed at by v, // 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) { 801025e0: 55 push %ebp 801025e1: 89 e5 mov %esp,%ebp 801025e3: 53 push %ebx 801025e4: 83 ec 04 sub $0x4,%esp 801025e7: 8b 5d 08 mov 0x8(%ebp),%ebx struct run *r; if ((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP) { 801025ea: f7 c3 ff 0f 00 00 test $0xfff,%ebx 801025f0: 75 76 jne 80102668 801025f2: 81 fb f0 54 11 80 cmp $0x801154f0,%ebx 801025f8: 72 6e jb 80102668 801025fa: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 80102600: 3d ff ff ff 0d cmp $0xdffffff,%eax 80102605: 77 61 ja 80102668 panic("kfree"); } // Fill with junk to catch dangling refs. memset(v, 1, PGSIZE); 80102607: 83 ec 04 sub $0x4,%esp 8010260a: 68 00 10 00 00 push $0x1000 8010260f: 6a 01 push $0x1 80102611: 53 push %ebx 80102612: e8 a9 21 00 00 call 801047c0 if (kmem.use_lock) { 80102617: 8b 15 94 16 11 80 mov 0x80111694,%edx 8010261d: 83 c4 10 add $0x10,%esp 80102620: 85 d2 test %edx,%edx 80102622: 75 1c jne 80102640 acquire(&kmem.lock); } r = (struct run*)v; r->next = kmem.freelist; 80102624: a1 98 16 11 80 mov 0x80111698,%eax 80102629: 89 03 mov %eax,(%ebx) kmem.freelist = r; if (kmem.use_lock) { 8010262b: a1 94 16 11 80 mov 0x80111694,%eax kmem.freelist = r; 80102630: 89 1d 98 16 11 80 mov %ebx,0x80111698 if (kmem.use_lock) { 80102636: 85 c0 test %eax,%eax 80102638: 75 1e jne 80102658 release(&kmem.lock); } } 8010263a: 8b 5d fc mov -0x4(%ebp),%ebx 8010263d: c9 leave 8010263e: c3 ret 8010263f: 90 nop acquire(&kmem.lock); 80102640: 83 ec 0c sub $0xc,%esp 80102643: 68 60 16 11 80 push $0x80111660 80102648: e8 b3 20 00 00 call 80104700 8010264d: 83 c4 10 add $0x10,%esp 80102650: eb d2 jmp 80102624 80102652: 8d b6 00 00 00 00 lea 0x0(%esi),%esi release(&kmem.lock); 80102658: c7 45 08 60 16 11 80 movl $0x80111660,0x8(%ebp) } 8010265f: 8b 5d fc mov -0x4(%ebp),%ebx 80102662: c9 leave release(&kmem.lock); 80102663: e9 38 20 00 00 jmp 801046a0 panic("kfree"); 80102668: 83 ec 0c sub $0xc,%esp 8010266b: 68 46 76 10 80 push $0x80107646 80102670: e8 1b dd ff ff call 80100390 80102675: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010267c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102680 : void freerange(void *vstart, void *vend) { 80102680: 55 push %ebp 80102681: 89 e5 mov %esp,%ebp 80102683: 56 push %esi p = (char*)PGROUNDUP((uint)vstart); 80102684: 8b 45 08 mov 0x8(%ebp),%eax void freerange(void *vstart, void *vend) { 80102687: 8b 75 0c mov 0xc(%ebp),%esi 8010268a: 53 push %ebx p = (char*)PGROUNDUP((uint)vstart); 8010268b: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 80102691: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80102697: 81 c3 00 10 00 00 add $0x1000,%ebx 8010269d: 39 de cmp %ebx,%esi 8010269f: 72 23 jb 801026c4 801026a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi kfree(p); 801026a8: 83 ec 0c sub $0xc,%esp 801026ab: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 801026b1: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 801026b7: 50 push %eax 801026b8: e8 23 ff ff ff call 801025e0 for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 801026bd: 83 c4 10 add $0x10,%esp 801026c0: 39 f3 cmp %esi,%ebx 801026c2: 76 e4 jbe 801026a8 } 801026c4: 8d 65 f8 lea -0x8(%ebp),%esp 801026c7: 5b pop %ebx 801026c8: 5e pop %esi 801026c9: 5d pop %ebp 801026ca: c3 ret 801026cb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801026cf: 90 nop 801026d0 : void kinit2(void *vstart, void *vend) { 801026d0: 55 push %ebp 801026d1: 89 e5 mov %esp,%ebp 801026d3: 56 push %esi p = (char*)PGROUNDUP((uint)vstart); 801026d4: 8b 45 08 mov 0x8(%ebp),%eax void kinit2(void *vstart, void *vend) { 801026d7: 8b 75 0c mov 0xc(%ebp),%esi 801026da: 53 push %ebx p = (char*)PGROUNDUP((uint)vstart); 801026db: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 801026e1: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 801026e7: 81 c3 00 10 00 00 add $0x1000,%ebx 801026ed: 39 de cmp %ebx,%esi 801026ef: 72 23 jb 80102714 801026f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi kfree(p); 801026f8: 83 ec 0c sub $0xc,%esp 801026fb: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80102701: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 80102707: 50 push %eax 80102708: e8 d3 fe ff ff call 801025e0 for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 8010270d: 83 c4 10 add $0x10,%esp 80102710: 39 de cmp %ebx,%esi 80102712: 73 e4 jae 801026f8 kmem.use_lock = 1; 80102714: c7 05 94 16 11 80 01 movl $0x1,0x80111694 8010271b: 00 00 00 } 8010271e: 8d 65 f8 lea -0x8(%ebp),%esp 80102721: 5b pop %ebx 80102722: 5e pop %esi 80102723: 5d pop %ebp 80102724: c3 ret 80102725: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010272c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102730 : void kinit1(void *vstart, void *vend) { 80102730: 55 push %ebp 80102731: 89 e5 mov %esp,%ebp 80102733: 56 push %esi 80102734: 53 push %ebx 80102735: 8b 75 0c mov 0xc(%ebp),%esi initlock(&kmem.lock, "kmem"); 80102738: 83 ec 08 sub $0x8,%esp 8010273b: 68 4c 76 10 80 push $0x8010764c 80102740: 68 60 16 11 80 push $0x80111660 80102745: e8 e6 1d 00 00 call 80104530 p = (char*)PGROUNDUP((uint)vstart); 8010274a: 8b 45 08 mov 0x8(%ebp),%eax for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 8010274d: 83 c4 10 add $0x10,%esp kmem.use_lock = 0; 80102750: c7 05 94 16 11 80 00 movl $0x0,0x80111694 80102757: 00 00 00 p = (char*)PGROUNDUP((uint)vstart); 8010275a: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 80102760: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80102766: 81 c3 00 10 00 00 add $0x1000,%ebx 8010276c: 39 de cmp %ebx,%esi 8010276e: 72 1c jb 8010278c kfree(p); 80102770: 83 ec 0c sub $0xc,%esp 80102773: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80102779: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 8010277f: 50 push %eax 80102780: e8 5b fe ff ff call 801025e0 for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80102785: 83 c4 10 add $0x10,%esp 80102788: 39 de cmp %ebx,%esi 8010278a: 73 e4 jae 80102770 } 8010278c: 8d 65 f8 lea -0x8(%ebp),%esp 8010278f: 5b pop %ebx 80102790: 5e pop %esi 80102791: 5d pop %ebp 80102792: c3 ret 80102793: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010279a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801027a0 : // Returns a pointer that the kernel can use. // Returns 0 if the memory cannot be allocated. char* kalloc(void) { struct run *r; if (kmem.use_lock) { 801027a0: a1 94 16 11 80 mov 0x80111694,%eax 801027a5: 85 c0 test %eax,%eax 801027a7: 75 1f jne 801027c8 acquire(&kmem.lock); } r = kmem.freelist; 801027a9: a1 98 16 11 80 mov 0x80111698,%eax if (r) { 801027ae: 85 c0 test %eax,%eax 801027b0: 74 0e je 801027c0 kmem.freelist = r->next; 801027b2: 8b 10 mov (%eax),%edx 801027b4: 89 15 98 16 11 80 mov %edx,0x80111698 } if (kmem.use_lock) { 801027ba: c3 ret 801027bb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801027bf: 90 nop release(&kmem.lock); } return (char*)r; } 801027c0: c3 ret 801027c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi char* kalloc(void) { 801027c8: 55 push %ebp 801027c9: 89 e5 mov %esp,%ebp 801027cb: 83 ec 24 sub $0x24,%esp acquire(&kmem.lock); 801027ce: 68 60 16 11 80 push $0x80111660 801027d3: e8 28 1f 00 00 call 80104700 r = kmem.freelist; 801027d8: a1 98 16 11 80 mov 0x80111698,%eax if (kmem.use_lock) { 801027dd: 8b 15 94 16 11 80 mov 0x80111694,%edx if (r) { 801027e3: 83 c4 10 add $0x10,%esp 801027e6: 85 c0 test %eax,%eax 801027e8: 74 08 je 801027f2 kmem.freelist = r->next; 801027ea: 8b 08 mov (%eax),%ecx 801027ec: 89 0d 98 16 11 80 mov %ecx,0x80111698 if (kmem.use_lock) { 801027f2: 85 d2 test %edx,%edx 801027f4: 74 16 je 8010280c release(&kmem.lock); 801027f6: 83 ec 0c sub $0xc,%esp 801027f9: 89 45 f4 mov %eax,-0xc(%ebp) 801027fc: 68 60 16 11 80 push $0x80111660 80102801: e8 9a 1e 00 00 call 801046a0 return (char*)r; 80102806: 8b 45 f4 mov -0xc(%ebp),%eax release(&kmem.lock); 80102809: 83 c4 10 add $0x10,%esp } 8010280c: c9 leave 8010280d: c3 ret 8010280e: 66 90 xchg %ax,%ax 80102810 : asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102810: ba 64 00 00 00 mov $0x64,%edx 80102815: ec in (%dx),%al normalmap, shiftmap, ctlmap, ctlmap }; uint st, data, c; st = inb(KBSTATP); if ((st & KBS_DIB) == 0) { 80102816: a8 01 test $0x1,%al 80102818: 0f 84 c2 00 00 00 je 801028e0 int kbdgetc(void) { 8010281e: 55 push %ebp 8010281f: ba 60 00 00 00 mov $0x60,%edx 80102824: 89 e5 mov %esp,%ebp 80102826: 53 push %ebx 80102827: ec in (%dx),%al return -1; } data = inb(KBDATAP); if (data == 0xE0) { shift |= E0ESC; 80102828: 8b 1d 9c 16 11 80 mov 0x8011169c,%ebx data = inb(KBDATAP); 8010282e: 0f b6 c8 movzbl %al,%ecx if (data == 0xE0) { 80102831: 3c e0 cmp $0xe0,%al 80102833: 74 5b je 80102890 return 0; } else if (data & 0x80) { // Key released data = (shift & E0ESC ? data : data & 0x7F); 80102835: 89 da mov %ebx,%edx 80102837: 83 e2 40 and $0x40,%edx else if (data & 0x80) { 8010283a: 84 c0 test %al,%al 8010283c: 78 62 js 801028a0 shift &= ~(shiftcode[data] | E0ESC); return 0; } else if (shift & E0ESC) { 8010283e: 85 d2 test %edx,%edx 80102840: 74 09 je 8010284b // Last character was an E0 escape; or with 0x80 data |= 0x80; 80102842: 83 c8 80 or $0xffffff80,%eax shift &= ~E0ESC; 80102845: 83 e3 bf and $0xffffffbf,%ebx data |= 0x80; 80102848: 0f b6 c8 movzbl %al,%ecx } shift |= shiftcode[data]; 8010284b: 0f b6 91 80 77 10 80 movzbl -0x7fef8880(%ecx),%edx shift ^= togglecode[data]; 80102852: 0f b6 81 80 76 10 80 movzbl -0x7fef8980(%ecx),%eax shift |= shiftcode[data]; 80102859: 09 da or %ebx,%edx shift ^= togglecode[data]; 8010285b: 31 c2 xor %eax,%edx c = charcode[shift & (CTL | SHIFT)][data]; 8010285d: 89 d0 mov %edx,%eax shift ^= togglecode[data]; 8010285f: 89 15 9c 16 11 80 mov %edx,0x8011169c c = charcode[shift & (CTL | SHIFT)][data]; 80102865: 83 e0 03 and $0x3,%eax if (shift & CAPSLOCK) { 80102868: 83 e2 08 and $0x8,%edx c = charcode[shift & (CTL | SHIFT)][data]; 8010286b: 8b 04 85 60 76 10 80 mov -0x7fef89a0(,%eax,4),%eax 80102872: 0f b6 04 08 movzbl (%eax,%ecx,1),%eax if (shift & CAPSLOCK) { 80102876: 74 0b je 80102883 if ('a' <= c && c <= 'z') { 80102878: 8d 50 9f lea -0x61(%eax),%edx 8010287b: 83 fa 19 cmp $0x19,%edx 8010287e: 77 48 ja 801028c8 c += 'A' - 'a'; 80102880: 83 e8 20 sub $0x20,%eax else if ('A' <= c && c <= 'Z') { c += 'a' - 'A'; } } return c; } 80102883: 8b 5d fc mov -0x4(%ebp),%ebx 80102886: c9 leave 80102887: c3 ret 80102888: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010288f: 90 nop shift |= E0ESC; 80102890: 83 cb 40 or $0x40,%ebx return 0; 80102893: 31 c0 xor %eax,%eax shift |= E0ESC; 80102895: 89 1d 9c 16 11 80 mov %ebx,0x8011169c } 8010289b: 8b 5d fc mov -0x4(%ebp),%ebx 8010289e: c9 leave 8010289f: c3 ret data = (shift & E0ESC ? data : data & 0x7F); 801028a0: 83 e0 7f and $0x7f,%eax 801028a3: 85 d2 test %edx,%edx 801028a5: 0f 44 c8 cmove %eax,%ecx shift &= ~(shiftcode[data] | E0ESC); 801028a8: 0f b6 81 80 77 10 80 movzbl -0x7fef8880(%ecx),%eax 801028af: 83 c8 40 or $0x40,%eax 801028b2: 0f b6 c0 movzbl %al,%eax 801028b5: f7 d0 not %eax 801028b7: 21 d8 and %ebx,%eax } 801028b9: 8b 5d fc mov -0x4(%ebp),%ebx shift &= ~(shiftcode[data] | E0ESC); 801028bc: a3 9c 16 11 80 mov %eax,0x8011169c return 0; 801028c1: 31 c0 xor %eax,%eax } 801028c3: c9 leave 801028c4: c3 ret 801028c5: 8d 76 00 lea 0x0(%esi),%esi else if ('A' <= c && c <= 'Z') { 801028c8: 8d 48 bf lea -0x41(%eax),%ecx c += 'a' - 'A'; 801028cb: 8d 50 20 lea 0x20(%eax),%edx } 801028ce: 8b 5d fc mov -0x4(%ebp),%ebx 801028d1: c9 leave c += 'a' - 'A'; 801028d2: 83 f9 1a cmp $0x1a,%ecx 801028d5: 0f 42 c2 cmovb %edx,%eax } 801028d8: c3 ret 801028d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return -1; 801028e0: b8 ff ff ff ff mov $0xffffffff,%eax } 801028e5: c3 ret 801028e6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801028ed: 8d 76 00 lea 0x0(%esi),%esi 801028f0 : void kbdintr(void) { 801028f0: 55 push %ebp 801028f1: 89 e5 mov %esp,%ebp 801028f3: 83 ec 14 sub $0x14,%esp consoleintr(kbdgetc); 801028f6: 68 10 28 10 80 push $0x80102810 801028fb: e8 e0 df ff ff call 801008e0 } 80102900: 83 c4 10 add $0x10,%esp 80102903: c9 leave 80102904: c3 ret 80102905: 66 90 xchg %ax,%ax 80102907: 66 90 xchg %ax,%ax 80102909: 66 90 xchg %ax,%ax 8010290b: 66 90 xchg %ax,%ax 8010290d: 66 90 xchg %ax,%ax 8010290f: 90 nop 80102910 : lapic[index] = value; lapic[ID]; // wait for write to finish, by reading } void lapicinit(void) { if (!lapic) { 80102910: a1 a0 16 11 80 mov 0x801116a0,%eax 80102915: 85 c0 test %eax,%eax 80102917: 0f 84 cb 00 00 00 je 801029e8 lapic[index] = value; 8010291d: c7 80 f0 00 00 00 3f movl $0x13f,0xf0(%eax) 80102924: 01 00 00 lapic[ID]; // wait for write to finish, by reading 80102927: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 8010292a: c7 80 e0 03 00 00 0b movl $0xb,0x3e0(%eax) 80102931: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102934: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80102937: c7 80 20 03 00 00 20 movl $0x20020,0x320(%eax) 8010293e: 00 02 00 lapic[ID]; // wait for write to finish, by reading 80102941: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80102944: c7 80 80 03 00 00 80 movl $0x989680,0x380(%eax) 8010294b: 96 98 00 lapic[ID]; // wait for write to finish, by reading 8010294e: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80102951: c7 80 50 03 00 00 00 movl $0x10000,0x350(%eax) 80102958: 00 01 00 lapic[ID]; // wait for write to finish, by reading 8010295b: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 8010295e: c7 80 60 03 00 00 00 movl $0x10000,0x360(%eax) 80102965: 00 01 00 lapic[ID]; // wait for write to finish, by reading 80102968: 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) { 8010296b: 8b 50 30 mov 0x30(%eax),%edx 8010296e: c1 ea 10 shr $0x10,%edx 80102971: 81 e2 fc 00 00 00 and $0xfc,%edx 80102977: 75 77 jne 801029f0 lapic[index] = value; 80102979: c7 80 70 03 00 00 33 movl $0x33,0x370(%eax) 80102980: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102983: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80102986: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) 8010298d: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102990: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80102993: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) 8010299a: 00 00 00 lapic[ID]; // wait for write to finish, by reading 8010299d: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 801029a0: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) 801029a7: 00 00 00 lapic[ID]; // wait for write to finish, by reading 801029aa: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 801029ad: c7 80 10 03 00 00 00 movl $0x0,0x310(%eax) 801029b4: 00 00 00 lapic[ID]; // wait for write to finish, by reading 801029b7: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 801029ba: c7 80 00 03 00 00 00 movl $0x88500,0x300(%eax) 801029c1: 85 08 00 lapic[ID]; // wait for write to finish, by reading 801029c4: 8b 50 20 mov 0x20(%eax),%edx 801029c7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801029ce: 66 90 xchg %ax,%ax 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) { 801029d0: 8b 90 00 03 00 00 mov 0x300(%eax),%edx 801029d6: 80 e6 10 and $0x10,%dh 801029d9: 75 f5 jne 801029d0 lapic[index] = value; 801029db: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax) 801029e2: 00 00 00 lapic[ID]; // wait for write to finish, by reading 801029e5: 8b 40 20 mov 0x20(%eax),%eax ; } // Enable interrupts on the APIC (but not on the processor). lapicw(TPR, 0); } 801029e8: c3 ret 801029e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi lapic[index] = value; 801029f0: c7 80 40 03 00 00 00 movl $0x10000,0x340(%eax) 801029f7: 00 01 00 lapic[ID]; // wait for write to finish, by reading 801029fa: 8b 50 20 mov 0x20(%eax),%edx } 801029fd: e9 77 ff ff ff jmp 80102979 80102a02: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102a09: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102a10 : int lapicid(void) { if (!lapic) { 80102a10: a1 a0 16 11 80 mov 0x801116a0,%eax 80102a15: 85 c0 test %eax,%eax 80102a17: 74 07 je 80102a20 return 0; } return lapic[ID] >> 24; 80102a19: 8b 40 20 mov 0x20(%eax),%eax 80102a1c: c1 e8 18 shr $0x18,%eax 80102a1f: c3 ret return 0; 80102a20: 31 c0 xor %eax,%eax } 80102a22: c3 ret 80102a23: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102a2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102a30 : // Acknowledge interrupt. void lapiceoi(void) { if (lapic) { 80102a30: a1 a0 16 11 80 mov 0x801116a0,%eax 80102a35: 85 c0 test %eax,%eax 80102a37: 74 0d je 80102a46 lapic[index] = value; 80102a39: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) 80102a40: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102a43: 8b 40 20 mov 0x20(%eax),%eax lapicw(EOI, 0); } } 80102a46: c3 ret 80102a47: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102a4e: 66 90 xchg %ax,%ax 80102a50 : // Spin for a given number of microseconds. // On real hardware would want to tune this dynamically. void microdelay(int us) { } 80102a50: c3 ret 80102a51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102a58: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102a5f: 90 nop 80102a60 : #define CMOS_PORT 0x70 #define CMOS_RETURN 0x71 // Start additional processor running entry code at addr. // See Appendix B of MultiProcessor Specification. void lapicstartap(uchar apicid, uint addr) { 80102a60: 55 push %ebp asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102a61: b8 0f 00 00 00 mov $0xf,%eax 80102a66: ba 70 00 00 00 mov $0x70,%edx 80102a6b: 89 e5 mov %esp,%ebp 80102a6d: 53 push %ebx 80102a6e: 8b 4d 0c mov 0xc(%ebp),%ecx 80102a71: 8b 5d 08 mov 0x8(%ebp),%ebx 80102a74: ee out %al,(%dx) 80102a75: b8 0a 00 00 00 mov $0xa,%eax 80102a7a: ba 71 00 00 00 mov $0x71,%edx 80102a7f: 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; 80102a80: 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); 80102a82: c1 e3 18 shl $0x18,%ebx wrv[0] = 0; 80102a85: 66 a3 67 04 00 80 mov %ax,0x80000467 wrv[1] = addr >> 4; 80102a8b: 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)); 80102a8d: c1 e9 0c shr $0xc,%ecx lapicw(ICRHI, apicid << 24); 80102a90: 89 da mov %ebx,%edx wrv[1] = addr >> 4; 80102a92: c1 e8 04 shr $0x4,%eax lapicw(ICRLO, STARTUP | (addr >> 12)); 80102a95: 80 cd 06 or $0x6,%ch wrv[1] = addr >> 4; 80102a98: 66 a3 69 04 00 80 mov %ax,0x80000469 lapic[index] = value; 80102a9e: a1 a0 16 11 80 mov 0x801116a0,%eax 80102aa3: 89 98 10 03 00 00 mov %ebx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 80102aa9: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80102aac: c7 80 00 03 00 00 00 movl $0xc500,0x300(%eax) 80102ab3: c5 00 00 lapic[ID]; // wait for write to finish, by reading 80102ab6: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80102ab9: c7 80 00 03 00 00 00 movl $0x8500,0x300(%eax) 80102ac0: 85 00 00 lapic[ID]; // wait for write to finish, by reading 80102ac3: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80102ac6: 89 90 10 03 00 00 mov %edx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 80102acc: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80102acf: 89 88 00 03 00 00 mov %ecx,0x300(%eax) lapic[ID]; // wait for write to finish, by reading 80102ad5: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80102ad8: 89 90 10 03 00 00 mov %edx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 80102ade: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80102ae1: 89 88 00 03 00 00 mov %ecx,0x300(%eax) lapic[ID]; // wait for write to finish, by reading 80102ae7: 8b 40 20 mov 0x20(%eax),%eax microdelay(200); } } 80102aea: 8b 5d fc mov -0x4(%ebp),%ebx 80102aed: c9 leave 80102aee: c3 ret 80102aef: 90 nop 80102af0 : r->month = cmos_read(MONTH); r->year = cmos_read(YEAR); } // qemu seems to use 24-hour GWT and the values are BCD encoded void cmostime(struct rtcdate *r) { 80102af0: 55 push %ebp 80102af1: b8 0b 00 00 00 mov $0xb,%eax 80102af6: ba 70 00 00 00 mov $0x70,%edx 80102afb: 89 e5 mov %esp,%ebp 80102afd: 57 push %edi 80102afe: 56 push %esi 80102aff: 53 push %ebx 80102b00: 83 ec 4c sub $0x4c,%esp 80102b03: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102b04: ba 71 00 00 00 mov $0x71,%edx 80102b09: ec in (%dx),%al struct rtcdate t1, t2; int sb, bcd; sb = cmos_read(CMOS_STATB); bcd = (sb & (1 << 2)) == 0; 80102b0a: 83 e0 04 and $0x4,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102b0d: bb 70 00 00 00 mov $0x70,%ebx 80102b12: 88 45 b3 mov %al,-0x4d(%ebp) 80102b15: 8d 76 00 lea 0x0(%esi),%esi 80102b18: 31 c0 xor %eax,%eax 80102b1a: 89 da mov %ebx,%edx 80102b1c: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102b1d: b9 71 00 00 00 mov $0x71,%ecx 80102b22: 89 ca mov %ecx,%edx 80102b24: ec in (%dx),%al 80102b25: 88 45 b7 mov %al,-0x49(%ebp) asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102b28: 89 da mov %ebx,%edx 80102b2a: b8 02 00 00 00 mov $0x2,%eax 80102b2f: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102b30: 89 ca mov %ecx,%edx 80102b32: ec in (%dx),%al 80102b33: 88 45 b6 mov %al,-0x4a(%ebp) asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102b36: 89 da mov %ebx,%edx 80102b38: b8 04 00 00 00 mov $0x4,%eax 80102b3d: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102b3e: 89 ca mov %ecx,%edx 80102b40: ec in (%dx),%al 80102b41: 88 45 b5 mov %al,-0x4b(%ebp) asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102b44: 89 da mov %ebx,%edx 80102b46: b8 07 00 00 00 mov $0x7,%eax 80102b4b: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102b4c: 89 ca mov %ecx,%edx 80102b4e: ec in (%dx),%al 80102b4f: 88 45 b4 mov %al,-0x4c(%ebp) asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102b52: 89 da mov %ebx,%edx 80102b54: b8 08 00 00 00 mov $0x8,%eax 80102b59: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102b5a: 89 ca mov %ecx,%edx 80102b5c: ec in (%dx),%al 80102b5d: 89 c7 mov %eax,%edi asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102b5f: 89 da mov %ebx,%edx 80102b61: b8 09 00 00 00 mov $0x9,%eax 80102b66: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102b67: 89 ca mov %ecx,%edx 80102b69: ec in (%dx),%al 80102b6a: 89 c6 mov %eax,%esi asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102b6c: 89 da mov %ebx,%edx 80102b6e: b8 0a 00 00 00 mov $0xa,%eax 80102b73: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102b74: 89 ca mov %ecx,%edx 80102b76: 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) { 80102b77: 84 c0 test %al,%al 80102b79: 78 9d js 80102b18 return inb(CMOS_RETURN); 80102b7b: 0f b6 45 b7 movzbl -0x49(%ebp),%eax 80102b7f: 89 fa mov %edi,%edx 80102b81: 0f b6 fa movzbl %dl,%edi 80102b84: 89 f2 mov %esi,%edx 80102b86: 89 45 b8 mov %eax,-0x48(%ebp) 80102b89: 0f b6 45 b6 movzbl -0x4a(%ebp),%eax 80102b8d: 0f b6 f2 movzbl %dl,%esi asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102b90: 89 da mov %ebx,%edx 80102b92: 89 7d c8 mov %edi,-0x38(%ebp) 80102b95: 89 45 bc mov %eax,-0x44(%ebp) 80102b98: 0f b6 45 b5 movzbl -0x4b(%ebp),%eax 80102b9c: 89 75 cc mov %esi,-0x34(%ebp) 80102b9f: 89 45 c0 mov %eax,-0x40(%ebp) 80102ba2: 0f b6 45 b4 movzbl -0x4c(%ebp),%eax 80102ba6: 89 45 c4 mov %eax,-0x3c(%ebp) 80102ba9: 31 c0 xor %eax,%eax 80102bab: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102bac: 89 ca mov %ecx,%edx 80102bae: ec in (%dx),%al 80102baf: 0f b6 c0 movzbl %al,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102bb2: 89 da mov %ebx,%edx 80102bb4: 89 45 d0 mov %eax,-0x30(%ebp) 80102bb7: b8 02 00 00 00 mov $0x2,%eax 80102bbc: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102bbd: 89 ca mov %ecx,%edx 80102bbf: ec in (%dx),%al 80102bc0: 0f b6 c0 movzbl %al,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102bc3: 89 da mov %ebx,%edx 80102bc5: 89 45 d4 mov %eax,-0x2c(%ebp) 80102bc8: b8 04 00 00 00 mov $0x4,%eax 80102bcd: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102bce: 89 ca mov %ecx,%edx 80102bd0: ec in (%dx),%al 80102bd1: 0f b6 c0 movzbl %al,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102bd4: 89 da mov %ebx,%edx 80102bd6: 89 45 d8 mov %eax,-0x28(%ebp) 80102bd9: b8 07 00 00 00 mov $0x7,%eax 80102bde: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102bdf: 89 ca mov %ecx,%edx 80102be1: ec in (%dx),%al 80102be2: 0f b6 c0 movzbl %al,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102be5: 89 da mov %ebx,%edx 80102be7: 89 45 dc mov %eax,-0x24(%ebp) 80102bea: b8 08 00 00 00 mov $0x8,%eax 80102bef: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102bf0: 89 ca mov %ecx,%edx 80102bf2: ec in (%dx),%al 80102bf3: 0f b6 c0 movzbl %al,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80102bf6: 89 da mov %ebx,%edx 80102bf8: 89 45 e0 mov %eax,-0x20(%ebp) 80102bfb: b8 09 00 00 00 mov $0x9,%eax 80102c00: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80102c01: 89 ca mov %ecx,%edx 80102c03: ec in (%dx),%al 80102c04: 0f b6 c0 movzbl %al,%eax continue; } fill_rtcdate(&t2); if (memcmp(&t1, &t2, sizeof(t1)) == 0) { 80102c07: 83 ec 04 sub $0x4,%esp return inb(CMOS_RETURN); 80102c0a: 89 45 e4 mov %eax,-0x1c(%ebp) if (memcmp(&t1, &t2, sizeof(t1)) == 0) { 80102c0d: 8d 45 d0 lea -0x30(%ebp),%eax 80102c10: 6a 18 push $0x18 80102c12: 50 push %eax 80102c13: 8d 45 b8 lea -0x48(%ebp),%eax 80102c16: 50 push %eax 80102c17: e8 f4 1b 00 00 call 80104810 80102c1c: 83 c4 10 add $0x10,%esp 80102c1f: 85 c0 test %eax,%eax 80102c21: 0f 85 f1 fe ff ff jne 80102b18 break; } } // convert if (bcd) { 80102c27: 80 7d b3 00 cmpb $0x0,-0x4d(%ebp) 80102c2b: 75 78 jne 80102ca5 #define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf)) CONV(second); 80102c2d: 8b 45 b8 mov -0x48(%ebp),%eax 80102c30: 89 c2 mov %eax,%edx 80102c32: 83 e0 0f and $0xf,%eax 80102c35: c1 ea 04 shr $0x4,%edx 80102c38: 8d 14 92 lea (%edx,%edx,4),%edx 80102c3b: 8d 04 50 lea (%eax,%edx,2),%eax 80102c3e: 89 45 b8 mov %eax,-0x48(%ebp) CONV(minute); 80102c41: 8b 45 bc mov -0x44(%ebp),%eax 80102c44: 89 c2 mov %eax,%edx 80102c46: 83 e0 0f and $0xf,%eax 80102c49: c1 ea 04 shr $0x4,%edx 80102c4c: 8d 14 92 lea (%edx,%edx,4),%edx 80102c4f: 8d 04 50 lea (%eax,%edx,2),%eax 80102c52: 89 45 bc mov %eax,-0x44(%ebp) CONV(hour ); 80102c55: 8b 45 c0 mov -0x40(%ebp),%eax 80102c58: 89 c2 mov %eax,%edx 80102c5a: 83 e0 0f and $0xf,%eax 80102c5d: c1 ea 04 shr $0x4,%edx 80102c60: 8d 14 92 lea (%edx,%edx,4),%edx 80102c63: 8d 04 50 lea (%eax,%edx,2),%eax 80102c66: 89 45 c0 mov %eax,-0x40(%ebp) CONV(day ); 80102c69: 8b 45 c4 mov -0x3c(%ebp),%eax 80102c6c: 89 c2 mov %eax,%edx 80102c6e: 83 e0 0f and $0xf,%eax 80102c71: c1 ea 04 shr $0x4,%edx 80102c74: 8d 14 92 lea (%edx,%edx,4),%edx 80102c77: 8d 04 50 lea (%eax,%edx,2),%eax 80102c7a: 89 45 c4 mov %eax,-0x3c(%ebp) CONV(month ); 80102c7d: 8b 45 c8 mov -0x38(%ebp),%eax 80102c80: 89 c2 mov %eax,%edx 80102c82: 83 e0 0f and $0xf,%eax 80102c85: c1 ea 04 shr $0x4,%edx 80102c88: 8d 14 92 lea (%edx,%edx,4),%edx 80102c8b: 8d 04 50 lea (%eax,%edx,2),%eax 80102c8e: 89 45 c8 mov %eax,-0x38(%ebp) CONV(year ); 80102c91: 8b 45 cc mov -0x34(%ebp),%eax 80102c94: 89 c2 mov %eax,%edx 80102c96: 83 e0 0f and $0xf,%eax 80102c99: c1 ea 04 shr $0x4,%edx 80102c9c: 8d 14 92 lea (%edx,%edx,4),%edx 80102c9f: 8d 04 50 lea (%eax,%edx,2),%eax 80102ca2: 89 45 cc mov %eax,-0x34(%ebp) #undef CONV } *r = t1; 80102ca5: 8b 75 08 mov 0x8(%ebp),%esi 80102ca8: 8b 45 b8 mov -0x48(%ebp),%eax 80102cab: 89 06 mov %eax,(%esi) 80102cad: 8b 45 bc mov -0x44(%ebp),%eax 80102cb0: 89 46 04 mov %eax,0x4(%esi) 80102cb3: 8b 45 c0 mov -0x40(%ebp),%eax 80102cb6: 89 46 08 mov %eax,0x8(%esi) 80102cb9: 8b 45 c4 mov -0x3c(%ebp),%eax 80102cbc: 89 46 0c mov %eax,0xc(%esi) 80102cbf: 8b 45 c8 mov -0x38(%ebp),%eax 80102cc2: 89 46 10 mov %eax,0x10(%esi) 80102cc5: 8b 45 cc mov -0x34(%ebp),%eax 80102cc8: 89 46 14 mov %eax,0x14(%esi) r->year += 2000; 80102ccb: 81 46 14 d0 07 00 00 addl $0x7d0,0x14(%esi) } 80102cd2: 8d 65 f4 lea -0xc(%ebp),%esp 80102cd5: 5b pop %ebx 80102cd6: 5e pop %esi 80102cd7: 5f pop %edi 80102cd8: 5d pop %ebp 80102cd9: c3 ret 80102cda: 66 90 xchg %ax,%ax 80102cdc: 66 90 xchg %ax,%ax 80102cde: 66 90 xchg %ax,%ax 80102ce0 : static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 80102ce0: 8b 0d 08 17 11 80 mov 0x80111708,%ecx 80102ce6: 85 c9 test %ecx,%ecx 80102ce8: 0f 8e 8a 00 00 00 jle 80102d78 { 80102cee: 55 push %ebp 80102cef: 89 e5 mov %esp,%ebp 80102cf1: 57 push %edi for (tail = 0; tail < log.lh.n; tail++) { 80102cf2: 31 ff xor %edi,%edi { 80102cf4: 56 push %esi 80102cf5: 53 push %ebx 80102cf6: 83 ec 0c sub $0xc,%esp 80102cf9: 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 80102d00: a1 f4 16 11 80 mov 0x801116f4,%eax 80102d05: 83 ec 08 sub $0x8,%esp 80102d08: 01 f8 add %edi,%eax 80102d0a: 83 c0 01 add $0x1,%eax 80102d0d: 50 push %eax 80102d0e: ff 35 04 17 11 80 push 0x80111704 80102d14: e8 b7 d3 ff ff call 801000d0 80102d19: 89 c6 mov %eax,%esi struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 80102d1b: 58 pop %eax 80102d1c: 5a pop %edx 80102d1d: ff 34 bd 0c 17 11 80 push -0x7feee8f4(,%edi,4) 80102d24: ff 35 04 17 11 80 push 0x80111704 for (tail = 0; tail < log.lh.n; tail++) { 80102d2a: 83 c7 01 add $0x1,%edi struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 80102d2d: e8 9e d3 ff ff call 801000d0 memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 80102d32: 83 c4 0c add $0xc,%esp struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 80102d35: 89 c3 mov %eax,%ebx memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 80102d37: 8d 46 5c lea 0x5c(%esi),%eax 80102d3a: 68 00 02 00 00 push $0x200 80102d3f: 50 push %eax 80102d40: 8d 43 5c lea 0x5c(%ebx),%eax 80102d43: 50 push %eax 80102d44: e8 17 1b 00 00 call 80104860 bwrite(dbuf); // write dst to disk 80102d49: 89 1c 24 mov %ebx,(%esp) 80102d4c: e8 5f d4 ff ff call 801001b0 brelse(lbuf); 80102d51: 89 34 24 mov %esi,(%esp) 80102d54: e8 97 d4 ff ff call 801001f0 brelse(dbuf); 80102d59: 89 1c 24 mov %ebx,(%esp) 80102d5c: e8 8f d4 ff ff call 801001f0 for (tail = 0; tail < log.lh.n; tail++) { 80102d61: 83 c4 10 add $0x10,%esp 80102d64: 39 3d 08 17 11 80 cmp %edi,0x80111708 80102d6a: 7f 94 jg 80102d00 } } 80102d6c: 8d 65 f4 lea -0xc(%ebp),%esp 80102d6f: 5b pop %ebx 80102d70: 5e pop %esi 80102d71: 5f pop %edi 80102d72: 5d pop %ebp 80102d73: c3 ret 80102d74: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102d78: c3 ret 80102d79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102d80 : // Write in-memory log header to disk. // This is the true point at which the // current transaction commits. static void write_head(void) { 80102d80: 55 push %ebp 80102d81: 89 e5 mov %esp,%ebp 80102d83: 53 push %ebx 80102d84: 83 ec 0c sub $0xc,%esp struct buf *buf = bread(log.dev, log.start); 80102d87: ff 35 f4 16 11 80 push 0x801116f4 80102d8d: ff 35 04 17 11 80 push 0x80111704 80102d93: e8 38 d3 ff ff call 801000d0 struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; for (i = 0; i < log.lh.n; i++) { 80102d98: 83 c4 10 add $0x10,%esp struct buf *buf = bread(log.dev, log.start); 80102d9b: 89 c3 mov %eax,%ebx hb->n = log.lh.n; 80102d9d: a1 08 17 11 80 mov 0x80111708,%eax 80102da2: 89 43 5c mov %eax,0x5c(%ebx) for (i = 0; i < log.lh.n; i++) { 80102da5: 85 c0 test %eax,%eax 80102da7: 7e 19 jle 80102dc2 80102da9: 31 d2 xor %edx,%edx 80102dab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102daf: 90 nop hb->block[i] = log.lh.block[i]; 80102db0: 8b 0c 95 0c 17 11 80 mov -0x7feee8f4(,%edx,4),%ecx 80102db7: 89 4c 93 60 mov %ecx,0x60(%ebx,%edx,4) for (i = 0; i < log.lh.n; i++) { 80102dbb: 83 c2 01 add $0x1,%edx 80102dbe: 39 d0 cmp %edx,%eax 80102dc0: 75 ee jne 80102db0 } bwrite(buf); 80102dc2: 83 ec 0c sub $0xc,%esp 80102dc5: 53 push %ebx 80102dc6: e8 e5 d3 ff ff call 801001b0 brelse(buf); 80102dcb: 89 1c 24 mov %ebx,(%esp) 80102dce: e8 1d d4 ff ff call 801001f0 } 80102dd3: 8b 5d fc mov -0x4(%ebp),%ebx 80102dd6: 83 c4 10 add $0x10,%esp 80102dd9: c9 leave 80102dda: c3 ret 80102ddb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102ddf: 90 nop 80102de0 : { 80102de0: 55 push %ebp 80102de1: 89 e5 mov %esp,%ebp 80102de3: 53 push %ebx 80102de4: 83 ec 2c sub $0x2c,%esp 80102de7: 8b 5d 08 mov 0x8(%ebp),%ebx initlock(&log.lock, "log"); 80102dea: 68 80 78 10 80 push $0x80107880 80102def: 68 c0 16 11 80 push $0x801116c0 80102df4: e8 37 17 00 00 call 80104530 readsb(dev, &sb); 80102df9: 58 pop %eax 80102dfa: 8d 45 dc lea -0x24(%ebp),%eax 80102dfd: 5a pop %edx 80102dfe: 50 push %eax 80102dff: 53 push %ebx 80102e00: e8 3b e8 ff ff call 80101640 log.start = sb.logstart; 80102e05: 8b 45 ec mov -0x14(%ebp),%eax struct buf *buf = bread(log.dev, log.start); 80102e08: 59 pop %ecx log.dev = dev; 80102e09: 89 1d 04 17 11 80 mov %ebx,0x80111704 log.size = sb.nlog; 80102e0f: 8b 55 e8 mov -0x18(%ebp),%edx log.start = sb.logstart; 80102e12: a3 f4 16 11 80 mov %eax,0x801116f4 log.size = sb.nlog; 80102e17: 89 15 f8 16 11 80 mov %edx,0x801116f8 struct buf *buf = bread(log.dev, log.start); 80102e1d: 5a pop %edx 80102e1e: 50 push %eax 80102e1f: 53 push %ebx 80102e20: e8 ab d2 ff ff call 801000d0 for (i = 0; i < log.lh.n; i++) { 80102e25: 83 c4 10 add $0x10,%esp log.lh.n = lh->n; 80102e28: 8b 58 5c mov 0x5c(%eax),%ebx 80102e2b: 89 1d 08 17 11 80 mov %ebx,0x80111708 for (i = 0; i < log.lh.n; i++) { 80102e31: 85 db test %ebx,%ebx 80102e33: 7e 1d jle 80102e52 80102e35: 31 d2 xor %edx,%edx 80102e37: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102e3e: 66 90 xchg %ax,%ax log.lh.block[i] = lh->block[i]; 80102e40: 8b 4c 90 60 mov 0x60(%eax,%edx,4),%ecx 80102e44: 89 0c 95 0c 17 11 80 mov %ecx,-0x7feee8f4(,%edx,4) for (i = 0; i < log.lh.n; i++) { 80102e4b: 83 c2 01 add $0x1,%edx 80102e4e: 39 d3 cmp %edx,%ebx 80102e50: 75 ee jne 80102e40 brelse(buf); 80102e52: 83 ec 0c sub $0xc,%esp 80102e55: 50 push %eax 80102e56: e8 95 d3 ff ff call 801001f0 static void recover_from_log(void) { read_head(); install_trans(); // if committed, copy from log to disk 80102e5b: e8 80 fe ff ff call 80102ce0 log.lh.n = 0; 80102e60: c7 05 08 17 11 80 00 movl $0x0,0x80111708 80102e67: 00 00 00 write_head(); // clear the log 80102e6a: e8 11 ff ff ff call 80102d80 } 80102e6f: 8b 5d fc mov -0x4(%ebp),%ebx 80102e72: 83 c4 10 add $0x10,%esp 80102e75: c9 leave 80102e76: c3 ret 80102e77: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102e7e: 66 90 xchg %ax,%ax 80102e80 : } // called at the start of each FS system call. void begin_op(void) { 80102e80: 55 push %ebp 80102e81: 89 e5 mov %esp,%ebp 80102e83: 83 ec 14 sub $0x14,%esp acquire(&log.lock); 80102e86: 68 c0 16 11 80 push $0x801116c0 80102e8b: e8 70 18 00 00 call 80104700 80102e90: 83 c4 10 add $0x10,%esp 80102e93: eb 18 jmp 80102ead 80102e95: 8d 76 00 lea 0x0(%esi),%esi while(1){ if(log.committing){ sleep(&log, &log.lock); 80102e98: 83 ec 08 sub $0x8,%esp 80102e9b: 68 c0 16 11 80 push $0x801116c0 80102ea0: 68 c0 16 11 80 push $0x801116c0 80102ea5: e8 f6 12 00 00 call 801041a0 80102eaa: 83 c4 10 add $0x10,%esp if(log.committing){ 80102ead: a1 00 17 11 80 mov 0x80111700,%eax 80102eb2: 85 c0 test %eax,%eax 80102eb4: 75 e2 jne 80102e98 } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ 80102eb6: a1 fc 16 11 80 mov 0x801116fc,%eax 80102ebb: 8b 15 08 17 11 80 mov 0x80111708,%edx 80102ec1: 83 c0 01 add $0x1,%eax 80102ec4: 8d 0c 80 lea (%eax,%eax,4),%ecx 80102ec7: 8d 14 4a lea (%edx,%ecx,2),%edx 80102eca: 83 fa 1e cmp $0x1e,%edx 80102ecd: 7f c9 jg 80102e98 // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); } else { log.outstanding += 1; release(&log.lock); 80102ecf: 83 ec 0c sub $0xc,%esp log.outstanding += 1; 80102ed2: a3 fc 16 11 80 mov %eax,0x801116fc release(&log.lock); 80102ed7: 68 c0 16 11 80 push $0x801116c0 80102edc: e8 bf 17 00 00 call 801046a0 break; } } } 80102ee1: 83 c4 10 add $0x10,%esp 80102ee4: c9 leave 80102ee5: c3 ret 80102ee6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102eed: 8d 76 00 lea 0x0(%esi),%esi 80102ef0 : // called at the end of each FS system call. // commits if this was the last outstanding operation. void end_op(void) { 80102ef0: 55 push %ebp 80102ef1: 89 e5 mov %esp,%ebp 80102ef3: 57 push %edi 80102ef4: 56 push %esi 80102ef5: 53 push %ebx 80102ef6: 83 ec 18 sub $0x18,%esp int do_commit = 0; acquire(&log.lock); 80102ef9: 68 c0 16 11 80 push $0x801116c0 80102efe: e8 fd 17 00 00 call 80104700 log.outstanding -= 1; 80102f03: a1 fc 16 11 80 mov 0x801116fc,%eax if(log.committing) 80102f08: 8b 35 00 17 11 80 mov 0x80111700,%esi 80102f0e: 83 c4 10 add $0x10,%esp log.outstanding -= 1; 80102f11: 8d 58 ff lea -0x1(%eax),%ebx 80102f14: 89 1d fc 16 11 80 mov %ebx,0x801116fc if(log.committing) 80102f1a: 85 f6 test %esi,%esi 80102f1c: 0f 85 22 01 00 00 jne 80103044 panic("log.committing"); if(log.outstanding == 0){ 80102f22: 85 db test %ebx,%ebx 80102f24: 0f 85 f6 00 00 00 jne 80103020 do_commit = 1; log.committing = 1; 80102f2a: c7 05 00 17 11 80 01 movl $0x1,0x80111700 80102f31: 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); 80102f34: 83 ec 0c sub $0xc,%esp 80102f37: 68 c0 16 11 80 push $0x801116c0 80102f3c: e8 5f 17 00 00 call 801046a0 } static void commit() { if (log.lh.n > 0) { 80102f41: 8b 0d 08 17 11 80 mov 0x80111708,%ecx 80102f47: 83 c4 10 add $0x10,%esp 80102f4a: 85 c9 test %ecx,%ecx 80102f4c: 7f 42 jg 80102f90 acquire(&log.lock); 80102f4e: 83 ec 0c sub $0xc,%esp 80102f51: 68 c0 16 11 80 push $0x801116c0 80102f56: e8 a5 17 00 00 call 80104700 wakeup(&log); 80102f5b: c7 04 24 c0 16 11 80 movl $0x801116c0,(%esp) log.committing = 0; 80102f62: c7 05 00 17 11 80 00 movl $0x0,0x80111700 80102f69: 00 00 00 wakeup(&log); 80102f6c: e8 ef 12 00 00 call 80104260 release(&log.lock); 80102f71: c7 04 24 c0 16 11 80 movl $0x801116c0,(%esp) 80102f78: e8 23 17 00 00 call 801046a0 80102f7d: 83 c4 10 add $0x10,%esp } 80102f80: 8d 65 f4 lea -0xc(%ebp),%esp 80102f83: 5b pop %ebx 80102f84: 5e pop %esi 80102f85: 5f pop %edi 80102f86: 5d pop %ebp 80102f87: c3 ret 80102f88: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102f8f: 90 nop struct buf *to = bread(log.dev, log.start+tail+1); // log block 80102f90: a1 f4 16 11 80 mov 0x801116f4,%eax 80102f95: 83 ec 08 sub $0x8,%esp 80102f98: 01 d8 add %ebx,%eax 80102f9a: 83 c0 01 add $0x1,%eax 80102f9d: 50 push %eax 80102f9e: ff 35 04 17 11 80 push 0x80111704 80102fa4: e8 27 d1 ff ff call 801000d0 80102fa9: 89 c6 mov %eax,%esi struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80102fab: 58 pop %eax 80102fac: 5a pop %edx 80102fad: ff 34 9d 0c 17 11 80 push -0x7feee8f4(,%ebx,4) 80102fb4: ff 35 04 17 11 80 push 0x80111704 for (tail = 0; tail < log.lh.n; tail++) { 80102fba: 83 c3 01 add $0x1,%ebx struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80102fbd: e8 0e d1 ff ff call 801000d0 memmove(to->data, from->data, BSIZE); 80102fc2: 83 c4 0c add $0xc,%esp struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80102fc5: 89 c7 mov %eax,%edi memmove(to->data, from->data, BSIZE); 80102fc7: 8d 40 5c lea 0x5c(%eax),%eax 80102fca: 68 00 02 00 00 push $0x200 80102fcf: 50 push %eax 80102fd0: 8d 46 5c lea 0x5c(%esi),%eax 80102fd3: 50 push %eax 80102fd4: e8 87 18 00 00 call 80104860 bwrite(to); // write the log 80102fd9: 89 34 24 mov %esi,(%esp) 80102fdc: e8 cf d1 ff ff call 801001b0 brelse(from); 80102fe1: 89 3c 24 mov %edi,(%esp) 80102fe4: e8 07 d2 ff ff call 801001f0 brelse(to); 80102fe9: 89 34 24 mov %esi,(%esp) 80102fec: e8 ff d1 ff ff call 801001f0 for (tail = 0; tail < log.lh.n; tail++) { 80102ff1: 83 c4 10 add $0x10,%esp 80102ff4: 3b 1d 08 17 11 80 cmp 0x80111708,%ebx 80102ffa: 7c 94 jl 80102f90 write_log(); // Write modified blocks from cache to log write_head(); // Write header to disk -- the real commit 80102ffc: e8 7f fd ff ff call 80102d80 install_trans(); // Now install writes to home locations 80103001: e8 da fc ff ff call 80102ce0 log.lh.n = 0; 80103006: c7 05 08 17 11 80 00 movl $0x0,0x80111708 8010300d: 00 00 00 write_head(); // Erase the transaction from the log 80103010: e8 6b fd ff ff call 80102d80 80103015: e9 34 ff ff ff jmp 80102f4e 8010301a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi wakeup(&log); 80103020: 83 ec 0c sub $0xc,%esp 80103023: 68 c0 16 11 80 push $0x801116c0 80103028: e8 33 12 00 00 call 80104260 release(&log.lock); 8010302d: c7 04 24 c0 16 11 80 movl $0x801116c0,(%esp) 80103034: e8 67 16 00 00 call 801046a0 80103039: 83 c4 10 add $0x10,%esp } 8010303c: 8d 65 f4 lea -0xc(%ebp),%esp 8010303f: 5b pop %ebx 80103040: 5e pop %esi 80103041: 5f pop %edi 80103042: 5d pop %ebp 80103043: c3 ret panic("log.committing"); 80103044: 83 ec 0c sub $0xc,%esp 80103047: 68 84 78 10 80 push $0x80107884 8010304c: e8 3f d3 ff ff call 80100390 80103051: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103058: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010305f: 90 nop 80103060 : // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { 80103060: 55 push %ebp 80103061: 89 e5 mov %esp,%ebp 80103063: 53 push %ebx 80103064: 83 ec 04 sub $0x4,%esp int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80103067: 8b 15 08 17 11 80 mov 0x80111708,%edx { 8010306d: 8b 5d 08 mov 0x8(%ebp),%ebx if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80103070: 83 fa 1d cmp $0x1d,%edx 80103073: 0f 8f 85 00 00 00 jg 801030fe 80103079: a1 f8 16 11 80 mov 0x801116f8,%eax 8010307e: 83 e8 01 sub $0x1,%eax 80103081: 39 c2 cmp %eax,%edx 80103083: 7d 79 jge 801030fe panic("too big a transaction"); if (log.outstanding < 1) 80103085: a1 fc 16 11 80 mov 0x801116fc,%eax 8010308a: 85 c0 test %eax,%eax 8010308c: 7e 7d jle 8010310b panic("log_write outside of trans"); acquire(&log.lock); 8010308e: 83 ec 0c sub $0xc,%esp 80103091: 68 c0 16 11 80 push $0x801116c0 80103096: e8 65 16 00 00 call 80104700 for (i = 0; i < log.lh.n; i++) { 8010309b: 8b 15 08 17 11 80 mov 0x80111708,%edx 801030a1: 83 c4 10 add $0x10,%esp 801030a4: 85 d2 test %edx,%edx 801030a6: 7e 4a jle 801030f2 if (log.lh.block[i] == b->blockno) // log absorbtion 801030a8: 8b 4b 08 mov 0x8(%ebx),%ecx for (i = 0; i < log.lh.n; i++) { 801030ab: 31 c0 xor %eax,%eax 801030ad: eb 08 jmp 801030b7 801030af: 90 nop 801030b0: 83 c0 01 add $0x1,%eax 801030b3: 39 c2 cmp %eax,%edx 801030b5: 74 29 je 801030e0 if (log.lh.block[i] == b->blockno) // log absorbtion 801030b7: 39 0c 85 0c 17 11 80 cmp %ecx,-0x7feee8f4(,%eax,4) 801030be: 75 f0 jne 801030b0 break; } log.lh.block[i] = b->blockno; 801030c0: 89 0c 85 0c 17 11 80 mov %ecx,-0x7feee8f4(,%eax,4) if (i == log.lh.n) log.lh.n++; b->flags |= B_DIRTY; // prevent eviction 801030c7: 83 0b 04 orl $0x4,(%ebx) release(&log.lock); } 801030ca: 8b 5d fc mov -0x4(%ebp),%ebx release(&log.lock); 801030cd: c7 45 08 c0 16 11 80 movl $0x801116c0,0x8(%ebp) } 801030d4: c9 leave release(&log.lock); 801030d5: e9 c6 15 00 00 jmp 801046a0 801030da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi log.lh.block[i] = b->blockno; 801030e0: 89 0c 95 0c 17 11 80 mov %ecx,-0x7feee8f4(,%edx,4) log.lh.n++; 801030e7: 83 c2 01 add $0x1,%edx 801030ea: 89 15 08 17 11 80 mov %edx,0x80111708 801030f0: eb d5 jmp 801030c7 log.lh.block[i] = b->blockno; 801030f2: 8b 43 08 mov 0x8(%ebx),%eax 801030f5: a3 0c 17 11 80 mov %eax,0x8011170c if (i == log.lh.n) 801030fa: 75 cb jne 801030c7 801030fc: eb e9 jmp 801030e7 panic("too big a transaction"); 801030fe: 83 ec 0c sub $0xc,%esp 80103101: 68 93 78 10 80 push $0x80107893 80103106: e8 85 d2 ff ff call 80100390 panic("log_write outside of trans"); 8010310b: 83 ec 0c sub $0xc,%esp 8010310e: 68 a9 78 10 80 push $0x801078a9 80103113: e8 78 d2 ff ff call 80100390 80103118: 66 90 xchg %ax,%ax 8010311a: 66 90 xchg %ax,%ax 8010311c: 66 90 xchg %ax,%ax 8010311e: 66 90 xchg %ax,%ax 80103120 : lapicinit(); mpmain(); } // Common CPU setup code. static void mpmain(void) { 80103120: 55 push %ebp 80103121: 89 e5 mov %esp,%ebp 80103123: 53 push %ebx 80103124: 83 ec 04 sub $0x4,%esp cprintf("cpu%d: starting %d\n", cpuid(), cpuid()); 80103127: e8 84 09 00 00 call 80103ab0 8010312c: 89 c3 mov %eax,%ebx 8010312e: e8 7d 09 00 00 call 80103ab0 80103133: 83 ec 04 sub $0x4,%esp 80103136: 53 push %ebx 80103137: 50 push %eax 80103138: 68 c4 78 10 80 push $0x801078c4 8010313d: e8 6e d5 ff ff call 801006b0 idtinit(); // load idt register 80103142: e8 b9 29 00 00 call 80105b00 xchg(&(mycpu()->started), 1); // tell startothers() we're up 80103147: e8 04 09 00 00 call 80103a50 8010314c: 89 c2 mov %eax,%edx static inline uint xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile ("lock; xchgl %0, %1" : 8010314e: b8 01 00 00 00 mov $0x1,%eax 80103153: f0 87 82 a0 00 00 00 lock xchg %eax,0xa0(%edx) scheduler(); // start running processes 8010315a: e8 31 0c 00 00 call 80103d90 8010315f: 90 nop 80103160 : static void mpenter(void) { 80103160: 55 push %ebp 80103161: 89 e5 mov %esp,%ebp 80103163: 83 ec 08 sub $0x8,%esp switchkvm(); 80103166: e8 85 3a 00 00 call 80106bf0 seginit(); 8010316b: e8 f0 39 00 00 call 80106b60 lapicinit(); 80103170: e8 9b f7 ff ff call 80102910 mpmain(); 80103175: e8 a6 ff ff ff call 80103120 8010317a: 66 90 xchg %ax,%ax 8010317c: 66 90 xchg %ax,%ax 8010317e: 66 90 xchg %ax,%ax 80103180
: int main(void) { 80103180: 8d 4c 24 04 lea 0x4(%esp),%ecx 80103184: 83 e4 f0 and $0xfffffff0,%esp 80103187: ff 71 fc push -0x4(%ecx) 8010318a: 55 push %ebp 8010318b: 89 e5 mov %esp,%ebp 8010318d: 53 push %ebx 8010318e: 51 push %ecx kinit1(end, P2V(4 * 1024 * 1024)); // phys page allocator 8010318f: 83 ec 08 sub $0x8,%esp 80103192: 68 00 00 40 80 push $0x80400000 80103197: 68 f0 54 11 80 push $0x801154f0 8010319c: e8 8f f5 ff ff call 80102730 kvmalloc(); // kernel page table 801031a1: e8 3a 3f 00 00 call 801070e0 mpinit(); // detect other processors 801031a6: e8 85 01 00 00 call 80103330 lapicinit(); // interrupt controller 801031ab: e8 60 f7 ff ff call 80102910 seginit(); // segment descriptors 801031b0: e8 ab 39 00 00 call 80106b60 picinit(); // disable pic 801031b5: e8 76 03 00 00 call 80103530 ioapicinit(); // another interrupt controller 801031ba: e8 31 f3 ff ff call 801024f0 consoleinit(); // console hardware 801031bf: e8 0c d9 ff ff call 80100ad0 uartinit(); // serial port 801031c4: e8 27 2c 00 00 call 80105df0 pinit(); // process table 801031c9: e8 62 08 00 00 call 80103a30 tvinit(); // trap vectors 801031ce: e8 ad 28 00 00 call 80105a80 binit(); // buffer cache 801031d3: e8 68 ce ff ff call 80100040 fileinit(); // file table 801031d8: e8 53 dd ff ff call 80100f30 ideinit(); // disk 801031dd: e8 fe f0 ff ff call 801022e0 // 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); 801031e2: 83 c4 0c add $0xc,%esp 801031e5: 68 7a 00 00 00 push $0x7a 801031ea: 68 8c a4 10 80 push $0x8010a48c 801031ef: 68 00 70 00 80 push $0x80007000 801031f4: e8 67 16 00 00 call 80104860 for (c = cpus; c < cpus + ncpu; c++) { 801031f9: 83 c4 10 add $0x10,%esp 801031fc: 69 05 a4 17 11 80 b0 imul $0xb0,0x801117a4,%eax 80103203: 00 00 00 80103206: 05 c0 17 11 80 add $0x801117c0,%eax 8010320b: 3d c0 17 11 80 cmp $0x801117c0,%eax 80103210: 76 7e jbe 80103290 80103212: bb c0 17 11 80 mov $0x801117c0,%ebx 80103217: eb 20 jmp 80103239 80103219: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103220: 69 05 a4 17 11 80 b0 imul $0xb0,0x801117a4,%eax 80103227: 00 00 00 8010322a: 81 c3 b0 00 00 00 add $0xb0,%ebx 80103230: 05 c0 17 11 80 add $0x801117c0,%eax 80103235: 39 c3 cmp %eax,%ebx 80103237: 73 57 jae 80103290 if (c == mycpu()) { // We've started already. 80103239: e8 12 08 00 00 call 80103a50 8010323e: 39 c3 cmp %eax,%ebx 80103240: 74 de je 80103220 } // 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(); 80103242: e8 59 f5 ff ff call 801027a0 *(void**)(code - 4) = stack + KSTACKSIZE; *(void(**)(void))(code - 8) = mpenter; *(int**)(code - 12) = (void *) V2P(entrypgdir); lapicstartap(c->apicid, V2P(code)); 80103247: 83 ec 08 sub $0x8,%esp *(void(**)(void))(code - 8) = mpenter; 8010324a: c7 05 f8 6f 00 80 60 movl $0x80103160,0x80006ff8 80103251: 31 10 80 *(int**)(code - 12) = (void *) V2P(entrypgdir); 80103254: c7 05 f4 6f 00 80 00 movl $0x109000,0x80006ff4 8010325b: 90 10 00 *(void**)(code - 4) = stack + KSTACKSIZE; 8010325e: 05 00 10 00 00 add $0x1000,%eax 80103263: a3 fc 6f 00 80 mov %eax,0x80006ffc lapicstartap(c->apicid, V2P(code)); 80103268: 0f b6 03 movzbl (%ebx),%eax 8010326b: 68 00 70 00 00 push $0x7000 80103270: 50 push %eax 80103271: e8 ea f7 ff ff call 80102a60 // wait for cpu to finish mpmain() while (c->started == 0) { 80103276: 83 c4 10 add $0x10,%esp 80103279: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103280: 8b 83 a0 00 00 00 mov 0xa0(%ebx),%eax 80103286: 85 c0 test %eax,%eax 80103288: 74 f6 je 80103280 8010328a: eb 94 jmp 80103220 8010328c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi kinit2(P2V(4 * 1024 * 1024), P2V(PHYSTOP)); // must come after startothers() 80103290: 83 ec 08 sub $0x8,%esp 80103293: 68 00 00 00 8e push $0x8e000000 80103298: 68 00 00 40 80 push $0x80400000 8010329d: e8 2e f4 ff ff call 801026d0 userinit(); // first user process 801032a2: e8 59 08 00 00 call 80103b00 mpmain(); // finish this processor's setup 801032a7: e8 74 fe ff ff call 80103120 801032ac: 66 90 xchg %ax,%ax 801032ae: 66 90 xchg %ax,%ax 801032b0 : } return sum; } // Look for an MP structure in the len bytes at addr. static struct mp*mpsearch1(uint a, int len) { 801032b0: 55 push %ebp 801032b1: 89 e5 mov %esp,%ebp 801032b3: 57 push %edi 801032b4: 56 push %esi uchar *e, *p, *addr; addr = P2V(a); 801032b5: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi static struct mp*mpsearch1(uint a, int len) { 801032bb: 53 push %ebx e = addr + len; 801032bc: 8d 1c 16 lea (%esi,%edx,1),%ebx static struct mp*mpsearch1(uint a, int len) { 801032bf: 83 ec 0c sub $0xc,%esp for (p = addr; p < e; p += sizeof(struct mp)) { 801032c2: 39 de cmp %ebx,%esi 801032c4: 72 10 jb 801032d6 801032c6: eb 50 jmp 80103318 801032c8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801032cf: 90 nop 801032d0: 89 fe mov %edi,%esi 801032d2: 39 fb cmp %edi,%ebx 801032d4: 76 42 jbe 80103318 if (memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) { 801032d6: 83 ec 04 sub $0x4,%esp 801032d9: 8d 7e 10 lea 0x10(%esi),%edi 801032dc: 6a 04 push $0x4 801032de: 68 d8 78 10 80 push $0x801078d8 801032e3: 56 push %esi 801032e4: e8 27 15 00 00 call 80104810 801032e9: 83 c4 10 add $0x10,%esp 801032ec: 85 c0 test %eax,%eax 801032ee: 75 e0 jne 801032d0 801032f0: 89 f2 mov %esi,%edx 801032f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi sum += addr[i]; 801032f8: 0f b6 0a movzbl (%edx),%ecx for (i = 0; i < len; i++) { 801032fb: 83 c2 01 add $0x1,%edx sum += addr[i]; 801032fe: 01 c8 add %ecx,%eax for (i = 0; i < len; i++) { 80103300: 39 fa cmp %edi,%edx 80103302: 75 f4 jne 801032f8 if (memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) { 80103304: 84 c0 test %al,%al 80103306: 75 c8 jne 801032d0 return (struct mp*)p; } } return 0; } 80103308: 8d 65 f4 lea -0xc(%ebp),%esp 8010330b: 89 f0 mov %esi,%eax 8010330d: 5b pop %ebx 8010330e: 5e pop %esi 8010330f: 5f pop %edi 80103310: 5d pop %ebp 80103311: c3 ret 80103312: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103318: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 8010331b: 31 f6 xor %esi,%esi } 8010331d: 5b pop %ebx 8010331e: 89 f0 mov %esi,%eax 80103320: 5e pop %esi 80103321: 5f pop %edi 80103322: 5d pop %ebp 80103323: c3 ret 80103324: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010332b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010332f: 90 nop 80103330 : } *pmp = mp; return conf; } void mpinit(void) { 80103330: 55 push %ebp 80103331: 89 e5 mov %esp,%ebp 80103333: 57 push %edi 80103334: 56 push %esi 80103335: 53 push %ebx 80103336: 83 ec 1c sub $0x1c,%esp if ((p = ((bda[0x0F] << 8) | bda[0x0E]) << 4)) { 80103339: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax 80103340: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx 80103347: c1 e0 08 shl $0x8,%eax 8010334a: 09 d0 or %edx,%eax 8010334c: c1 e0 04 shl $0x4,%eax 8010334f: 75 1b jne 8010336c p = ((bda[0x14] << 8) | bda[0x13]) * 1024; 80103351: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax 80103358: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx 8010335f: c1 e0 08 shl $0x8,%eax 80103362: 09 d0 or %edx,%eax 80103364: c1 e0 0a shl $0xa,%eax if ((mp = mpsearch1(p - 1024, 1024))) { 80103367: 2d 00 04 00 00 sub $0x400,%eax if ((mp = mpsearch1(p, 1024))) { 8010336c: ba 00 04 00 00 mov $0x400,%edx 80103371: e8 3a ff ff ff call 801032b0 80103376: 89 c3 mov %eax,%ebx 80103378: 85 c0 test %eax,%eax 8010337a: 0f 84 40 01 00 00 je 801034c0 if ((mp = mpsearch()) == 0 || mp->physaddr == 0) { 80103380: 8b 73 04 mov 0x4(%ebx),%esi 80103383: 85 f6 test %esi,%esi 80103385: 0f 84 25 01 00 00 je 801034b0 if (memcmp(conf, "PCMP", 4) != 0) { 8010338b: 83 ec 04 sub $0x4,%esp conf = (struct mpconf*) P2V((uint) mp->physaddr); 8010338e: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax if (memcmp(conf, "PCMP", 4) != 0) { 80103394: 6a 04 push $0x4 80103396: 68 dd 78 10 80 push $0x801078dd 8010339b: 50 push %eax conf = (struct mpconf*) P2V((uint) mp->physaddr); 8010339c: 89 45 e4 mov %eax,-0x1c(%ebp) if (memcmp(conf, "PCMP", 4) != 0) { 8010339f: e8 6c 14 00 00 call 80104810 801033a4: 83 c4 10 add $0x10,%esp 801033a7: 85 c0 test %eax,%eax 801033a9: 0f 85 01 01 00 00 jne 801034b0 if (conf->version != 1 && conf->version != 4) { 801033af: 0f b6 86 06 00 00 80 movzbl -0x7ffffffa(%esi),%eax 801033b6: 3c 01 cmp $0x1,%al 801033b8: 74 08 je 801033c2 801033ba: 3c 04 cmp $0x4,%al 801033bc: 0f 85 ee 00 00 00 jne 801034b0 if (sum((uchar*)conf, conf->length) != 0) { 801033c2: 0f b7 96 04 00 00 80 movzwl -0x7ffffffc(%esi),%edx for (i = 0; i < len; i++) { 801033c9: 66 85 d2 test %dx,%dx 801033cc: 74 22 je 801033f0 801033ce: 8d 3c 32 lea (%edx,%esi,1),%edi 801033d1: 89 f0 mov %esi,%eax sum = 0; 801033d3: 31 d2 xor %edx,%edx 801033d5: 8d 76 00 lea 0x0(%esi),%esi sum += addr[i]; 801033d8: 0f b6 88 00 00 00 80 movzbl -0x80000000(%eax),%ecx for (i = 0; i < len; i++) { 801033df: 83 c0 01 add $0x1,%eax sum += addr[i]; 801033e2: 01 ca add %ecx,%edx for (i = 0; i < len; i++) { 801033e4: 39 c7 cmp %eax,%edi 801033e6: 75 f0 jne 801033d8 if (sum((uchar*)conf, conf->length) != 0) { 801033e8: 84 d2 test %dl,%dl 801033ea: 0f 85 c0 00 00 00 jne 801034b0 if ((conf = mpconfig(&mp)) == 0) { panic("Expect to run on an SMP"); } ismp = 1; lapic = (uint*)conf->lapicaddr; 801033f0: 8b 86 24 00 00 80 mov -0x7fffffdc(%esi),%eax 801033f6: a3 a0 16 11 80 mov %eax,0x801116a0 for (p = (uchar*)(conf + 1), e = (uchar*)conf + conf->length; p < e;) { 801033fb: 0f b7 96 04 00 00 80 movzwl -0x7ffffffc(%esi),%edx 80103402: 8d 86 2c 00 00 80 lea -0x7fffffd4(%esi),%eax ismp = 1; 80103408: be 01 00 00 00 mov $0x1,%esi for (p = (uchar*)(conf + 1), e = (uchar*)conf + conf->length; p < e;) { 8010340d: 03 55 e4 add -0x1c(%ebp),%edx 80103410: 89 5d e4 mov %ebx,-0x1c(%ebp) 80103413: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103417: 90 nop 80103418: 39 d0 cmp %edx,%eax 8010341a: 73 15 jae 80103431 switch (*p) { 8010341c: 0f b6 08 movzbl (%eax),%ecx 8010341f: 80 f9 02 cmp $0x2,%cl 80103422: 74 4c je 80103470 80103424: 77 3a ja 80103460 80103426: 84 c9 test %cl,%cl 80103428: 74 56 je 80103480 p += sizeof(struct mpioapic); continue; case MPBUS: case MPIOINTR: case MPLINTR: p += 8; 8010342a: 83 c0 08 add $0x8,%eax for (p = (uchar*)(conf + 1), e = (uchar*)conf + conf->length; p < e;) { 8010342d: 39 d0 cmp %edx,%eax 8010342f: 72 eb jb 8010341c default: ismp = 0; break; } } if (!ismp) { 80103431: 8b 5d e4 mov -0x1c(%ebp),%ebx 80103434: 85 f6 test %esi,%esi 80103436: 0f 84 d9 00 00 00 je 80103515 panic("Didn't find a suitable machine"); } if (mp->imcrp) { 8010343c: 80 7b 0c 00 cmpb $0x0,0xc(%ebx) 80103440: 74 15 je 80103457 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103442: b8 70 00 00 00 mov $0x70,%eax 80103447: ba 22 00 00 00 mov $0x22,%edx 8010344c: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 8010344d: ba 23 00 00 00 mov $0x23,%edx 80103452: 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. 80103453: 83 c8 01 or $0x1,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103456: ee out %al,(%dx) } } 80103457: 8d 65 f4 lea -0xc(%ebp),%esp 8010345a: 5b pop %ebx 8010345b: 5e pop %esi 8010345c: 5f pop %edi 8010345d: 5d pop %ebp 8010345e: c3 ret 8010345f: 90 nop switch (*p) { 80103460: 83 e9 03 sub $0x3,%ecx 80103463: 80 f9 01 cmp $0x1,%cl 80103466: 76 c2 jbe 8010342a 80103468: 31 f6 xor %esi,%esi 8010346a: eb ac jmp 80103418 8010346c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ioapicid = ioapic->apicno; 80103470: 0f b6 48 01 movzbl 0x1(%eax),%ecx p += sizeof(struct mpioapic); 80103474: 83 c0 08 add $0x8,%eax ioapicid = ioapic->apicno; 80103477: 88 0d a0 17 11 80 mov %cl,0x801117a0 continue; 8010347d: eb 99 jmp 80103418 8010347f: 90 nop if (ncpu < NCPU) { 80103480: 8b 0d a4 17 11 80 mov 0x801117a4,%ecx 80103486: 83 f9 07 cmp $0x7,%ecx 80103489: 7f 19 jg 801034a4 cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu 8010348b: 69 f9 b0 00 00 00 imul $0xb0,%ecx,%edi 80103491: 0f b6 58 01 movzbl 0x1(%eax),%ebx ncpu++; 80103495: 83 c1 01 add $0x1,%ecx 80103498: 89 0d a4 17 11 80 mov %ecx,0x801117a4 cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu 8010349e: 88 9f c0 17 11 80 mov %bl,-0x7feee840(%edi) p += sizeof(struct mpproc); 801034a4: 83 c0 14 add $0x14,%eax continue; 801034a7: e9 6c ff ff ff jmp 80103418 801034ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi panic("Expect to run on an SMP"); 801034b0: 83 ec 0c sub $0xc,%esp 801034b3: 68 e2 78 10 80 push $0x801078e2 801034b8: e8 d3 ce ff ff call 80100390 801034bd: 8d 76 00 lea 0x0(%esi),%esi void mpinit(void) { 801034c0: bb 00 00 0f 80 mov $0x800f0000,%ebx 801034c5: eb 13 jmp 801034da 801034c7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801034ce: 66 90 xchg %ax,%ax for (p = addr; p < e; p += sizeof(struct mp)) { 801034d0: 89 f3 mov %esi,%ebx 801034d2: 81 fe 00 00 10 80 cmp $0x80100000,%esi 801034d8: 74 d6 je 801034b0 if (memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) { 801034da: 83 ec 04 sub $0x4,%esp 801034dd: 8d 73 10 lea 0x10(%ebx),%esi 801034e0: 6a 04 push $0x4 801034e2: 68 d8 78 10 80 push $0x801078d8 801034e7: 53 push %ebx 801034e8: e8 23 13 00 00 call 80104810 801034ed: 83 c4 10 add $0x10,%esp 801034f0: 85 c0 test %eax,%eax 801034f2: 75 dc jne 801034d0 801034f4: 89 da mov %ebx,%edx 801034f6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801034fd: 8d 76 00 lea 0x0(%esi),%esi sum += addr[i]; 80103500: 0f b6 0a movzbl (%edx),%ecx for (i = 0; i < len; i++) { 80103503: 83 c2 01 add $0x1,%edx sum += addr[i]; 80103506: 01 c8 add %ecx,%eax for (i = 0; i < len; i++) { 80103508: 39 d6 cmp %edx,%esi 8010350a: 75 f4 jne 80103500 if (memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) { 8010350c: 84 c0 test %al,%al 8010350e: 75 c0 jne 801034d0 80103510: e9 6b fe ff ff jmp 80103380 panic("Didn't find a suitable machine"); 80103515: 83 ec 0c sub $0xc,%esp 80103518: 68 fc 78 10 80 push $0x801078fc 8010351d: e8 6e ce ff ff call 80100390 80103522: 66 90 xchg %ax,%ax 80103524: 66 90 xchg %ax,%ax 80103526: 66 90 xchg %ax,%ax 80103528: 66 90 xchg %ax,%ax 8010352a: 66 90 xchg %ax,%ax 8010352c: 66 90 xchg %ax,%ax 8010352e: 66 90 xchg %ax,%ax 80103530 : 80103530: b8 ff ff ff ff mov $0xffffffff,%eax 80103535: ba 21 00 00 00 mov $0x21,%edx 8010353a: ee out %al,(%dx) 8010353b: ba a1 00 00 00 mov $0xa1,%edx 80103540: ee out %al,(%dx) // Don't use the 8259A interrupt controllers. Xv6 assumes SMP hardware. void picinit(void) { // mask all interrupts outb(IO_PIC1 + 1, 0xFF); outb(IO_PIC2 + 1, 0xFF); } 80103541: c3 ret 80103542: 66 90 xchg %ax,%ax 80103544: 66 90 xchg %ax,%ax 80103546: 66 90 xchg %ax,%ax 80103548: 66 90 xchg %ax,%ax 8010354a: 66 90 xchg %ax,%ax 8010354c: 66 90 xchg %ax,%ax 8010354e: 66 90 xchg %ax,%ax 80103550 : uint nwrite; // number of bytes written int readopen; // read fd is still open int writeopen; // write fd is still open }; void cleanuppipealloc(struct pipe *p, struct file **f0, struct file **f1) { 80103550: 55 push %ebp 80103551: 89 e5 mov %esp,%ebp 80103553: 56 push %esi 80103554: 8b 45 08 mov 0x8(%ebp),%eax 80103557: 8b 75 0c mov 0xc(%ebp),%esi 8010355a: 53 push %ebx 8010355b: 8b 5d 10 mov 0x10(%ebp),%ebx if (p) { 8010355e: 85 c0 test %eax,%eax 80103560: 74 0c je 8010356e kfree((char*)p); 80103562: 83 ec 0c sub $0xc,%esp 80103565: 50 push %eax 80103566: e8 75 f0 ff ff call 801025e0 8010356b: 83 c4 10 add $0x10,%esp } if (*f0) { 8010356e: 8b 06 mov (%esi),%eax 80103570: 85 c0 test %eax,%eax 80103572: 74 0c je 80103580 fileclose(*f0); 80103574: 83 ec 0c sub $0xc,%esp 80103577: 50 push %eax 80103578: e8 93 da ff ff call 80101010 8010357d: 83 c4 10 add $0x10,%esp } if (*f1) { 80103580: 8b 03 mov (%ebx),%eax 80103582: 85 c0 test %eax,%eax 80103584: 74 12 je 80103598 fileclose(*f1); 80103586: 89 45 08 mov %eax,0x8(%ebp) } } 80103589: 8d 65 f8 lea -0x8(%ebp),%esp 8010358c: 5b pop %ebx 8010358d: 5e pop %esi 8010358e: 5d pop %ebp fileclose(*f1); 8010358f: e9 7c da ff ff jmp 80101010 80103594: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } 80103598: 8d 65 f8 lea -0x8(%ebp),%esp 8010359b: 5b pop %ebx 8010359c: 5e pop %esi 8010359d: 5d pop %ebp 8010359e: c3 ret 8010359f: 90 nop 801035a0 : int pipealloc(struct file **f0, struct file **f1) { 801035a0: 55 push %ebp 801035a1: 89 e5 mov %esp,%ebp 801035a3: 57 push %edi 801035a4: 56 push %esi 801035a5: 53 push %ebx 801035a6: 83 ec 0c sub $0xc,%esp 801035a9: 8b 75 08 mov 0x8(%ebp),%esi 801035ac: 8b 7d 0c mov 0xc(%ebp),%edi struct pipe *p; p = 0; *f0 = *f1 = 0; 801035af: c7 07 00 00 00 00 movl $0x0,(%edi) 801035b5: c7 06 00 00 00 00 movl $0x0,(%esi) if ((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) { 801035bb: e8 90 d9 ff ff call 80100f50 801035c0: 89 06 mov %eax,(%esi) 801035c2: 85 c0 test %eax,%eax 801035c4: 0f 84 a5 00 00 00 je 8010366f 801035ca: e8 81 d9 ff ff call 80100f50 801035cf: 89 07 mov %eax,(%edi) 801035d1: 85 c0 test %eax,%eax 801035d3: 0f 84 84 00 00 00 je 8010365d cleanuppipealloc(p, f0, f1); return -1; } if ((p = (struct pipe*)kalloc()) == 0) { 801035d9: e8 c2 f1 ff ff call 801027a0 801035de: 89 c3 mov %eax,%ebx 801035e0: 85 c0 test %eax,%eax 801035e2: 0f 84 a0 00 00 00 je 80103688 cleanuppipealloc(p, f0, f1); return -1; } p->readopen = 1; 801035e8: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax) 801035ef: 00 00 00 p->writeopen = 1; p->nwrite = 0; p->nread = 0; initlock(&p->lock, "pipe"); 801035f2: 83 ec 08 sub $0x8,%esp p->writeopen = 1; 801035f5: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax) 801035fc: 00 00 00 p->nwrite = 0; 801035ff: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax) 80103606: 00 00 00 p->nread = 0; 80103609: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax) 80103610: 00 00 00 initlock(&p->lock, "pipe"); 80103613: 68 1b 79 10 80 push $0x8010791b 80103618: 50 push %eax 80103619: e8 12 0f 00 00 call 80104530 (*f0)->type = FD_PIPE; 8010361e: 8b 06 mov (%esi),%eax (*f0)->pipe = p; (*f1)->type = FD_PIPE; (*f1)->readable = 0; (*f1)->writable = 1; (*f1)->pipe = p; return 0; 80103620: 83 c4 10 add $0x10,%esp (*f0)->type = FD_PIPE; 80103623: c7 00 01 00 00 00 movl $0x1,(%eax) (*f0)->readable = 1; 80103629: 8b 06 mov (%esi),%eax 8010362b: c6 40 08 01 movb $0x1,0x8(%eax) (*f0)->writable = 0; 8010362f: 8b 06 mov (%esi),%eax 80103631: c6 40 09 00 movb $0x0,0x9(%eax) (*f0)->pipe = p; 80103635: 8b 06 mov (%esi),%eax 80103637: 89 58 0c mov %ebx,0xc(%eax) (*f1)->type = FD_PIPE; 8010363a: 8b 07 mov (%edi),%eax 8010363c: c7 00 01 00 00 00 movl $0x1,(%eax) (*f1)->readable = 0; 80103642: 8b 07 mov (%edi),%eax 80103644: c6 40 08 00 movb $0x0,0x8(%eax) (*f1)->writable = 1; 80103648: 8b 07 mov (%edi),%eax 8010364a: c6 40 09 01 movb $0x1,0x9(%eax) (*f1)->pipe = p; 8010364e: 8b 07 mov (%edi),%eax 80103650: 89 58 0c mov %ebx,0xc(%eax) return 0; 80103653: 31 c0 xor %eax,%eax } 80103655: 8d 65 f4 lea -0xc(%ebp),%esp 80103658: 5b pop %ebx 80103659: 5e pop %esi 8010365a: 5f pop %edi 8010365b: 5d pop %ebp 8010365c: c3 ret if (*f0) { 8010365d: 8b 06 mov (%esi),%eax 8010365f: 85 c0 test %eax,%eax 80103661: 74 1e je 80103681 fileclose(*f0); 80103663: 83 ec 0c sub $0xc,%esp 80103666: 50 push %eax 80103667: e8 a4 d9 ff ff call 80101010 8010366c: 83 c4 10 add $0x10,%esp if (*f1) { 8010366f: 8b 07 mov (%edi),%eax 80103671: 85 c0 test %eax,%eax 80103673: 74 0c je 80103681 fileclose(*f1); 80103675: 83 ec 0c sub $0xc,%esp 80103678: 50 push %eax 80103679: e8 92 d9 ff ff call 80101010 8010367e: 83 c4 10 add $0x10,%esp return -1; 80103681: b8 ff ff ff ff mov $0xffffffff,%eax 80103686: eb cd jmp 80103655 if (*f0) { 80103688: 8b 06 mov (%esi),%eax 8010368a: 85 c0 test %eax,%eax 8010368c: 75 d5 jne 80103663 8010368e: eb df jmp 8010366f 80103690 : void pipeclose(struct pipe *p, int writable) { 80103690: 55 push %ebp 80103691: 89 e5 mov %esp,%ebp 80103693: 56 push %esi 80103694: 53 push %ebx 80103695: 8b 5d 08 mov 0x8(%ebp),%ebx 80103698: 8b 75 0c mov 0xc(%ebp),%esi acquire(&p->lock); 8010369b: 83 ec 0c sub $0xc,%esp 8010369e: 53 push %ebx 8010369f: e8 5c 10 00 00 call 80104700 if (writable) { 801036a4: 83 c4 10 add $0x10,%esp 801036a7: 85 f6 test %esi,%esi 801036a9: 74 65 je 80103710 p->writeopen = 0; wakeup(&p->nread); 801036ab: 83 ec 0c sub $0xc,%esp 801036ae: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax p->writeopen = 0; 801036b4: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx) 801036bb: 00 00 00 wakeup(&p->nread); 801036be: 50 push %eax 801036bf: e8 9c 0b 00 00 call 80104260 801036c4: 83 c4 10 add $0x10,%esp } else { p->readopen = 0; wakeup(&p->nwrite); } if (p->readopen == 0 && p->writeopen == 0) { 801036c7: 8b 93 3c 02 00 00 mov 0x23c(%ebx),%edx 801036cd: 85 d2 test %edx,%edx 801036cf: 75 0a jne 801036db 801036d1: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax 801036d7: 85 c0 test %eax,%eax 801036d9: 74 15 je 801036f0 release(&p->lock); kfree((char*)p); } else { release(&p->lock); 801036db: 89 5d 08 mov %ebx,0x8(%ebp) } } 801036de: 8d 65 f8 lea -0x8(%ebp),%esp 801036e1: 5b pop %ebx 801036e2: 5e pop %esi 801036e3: 5d pop %ebp release(&p->lock); 801036e4: e9 b7 0f 00 00 jmp 801046a0 801036e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi release(&p->lock); 801036f0: 83 ec 0c sub $0xc,%esp 801036f3: 53 push %ebx 801036f4: e8 a7 0f 00 00 call 801046a0 kfree((char*)p); 801036f9: 89 5d 08 mov %ebx,0x8(%ebp) 801036fc: 83 c4 10 add $0x10,%esp } 801036ff: 8d 65 f8 lea -0x8(%ebp),%esp 80103702: 5b pop %ebx 80103703: 5e pop %esi 80103704: 5d pop %ebp kfree((char*)p); 80103705: e9 d6 ee ff ff jmp 801025e0 8010370a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi wakeup(&p->nwrite); 80103710: 83 ec 0c sub $0xc,%esp 80103713: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax p->readopen = 0; 80103719: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx) 80103720: 00 00 00 wakeup(&p->nwrite); 80103723: 50 push %eax 80103724: e8 37 0b 00 00 call 80104260 80103729: 83 c4 10 add $0x10,%esp 8010372c: eb 99 jmp 801036c7 8010372e: 66 90 xchg %ax,%ax 80103730 : int pipewrite(struct pipe *p, char *addr, int n) { 80103730: 55 push %ebp 80103731: 89 e5 mov %esp,%ebp 80103733: 57 push %edi 80103734: 56 push %esi 80103735: 53 push %ebx 80103736: 83 ec 28 sub $0x28,%esp 80103739: 8b 5d 08 mov 0x8(%ebp),%ebx int i; acquire(&p->lock); 8010373c: 53 push %ebx 8010373d: e8 be 0f 00 00 call 80104700 for (i = 0; i < n; i++) { 80103742: 8b 45 10 mov 0x10(%ebp),%eax 80103745: 83 c4 10 add $0x10,%esp 80103748: 85 c0 test %eax,%eax 8010374a: 0f 8e c0 00 00 00 jle 80103810 80103750: 8b 45 0c mov 0xc(%ebp),%eax while (p->nwrite == p->nread + PIPESIZE) { //DOC: pipewrite-full 80103753: 8b 8b 38 02 00 00 mov 0x238(%ebx),%ecx if (p->readopen == 0 || myproc()->killed) { release(&p->lock); return -1; } wakeup(&p->nread); 80103759: 8d bb 34 02 00 00 lea 0x234(%ebx),%edi 8010375f: 89 45 e4 mov %eax,-0x1c(%ebp) 80103762: 03 45 10 add 0x10(%ebp),%eax 80103765: 89 45 e0 mov %eax,-0x20(%ebp) while (p->nwrite == p->nread + PIPESIZE) { //DOC: pipewrite-full 80103768: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 8010376e: 8d b3 38 02 00 00 lea 0x238(%ebx),%esi while (p->nwrite == p->nread + PIPESIZE) { //DOC: pipewrite-full 80103774: 89 ca mov %ecx,%edx 80103776: 05 00 02 00 00 add $0x200,%eax 8010377b: 39 c1 cmp %eax,%ecx 8010377d: 74 3f je 801037be 8010377f: eb 67 jmp 801037e8 80103781: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (p->readopen == 0 || myproc()->killed) { 80103788: e8 43 03 00 00 call 80103ad0 8010378d: 8b 48 24 mov 0x24(%eax),%ecx 80103790: 85 c9 test %ecx,%ecx 80103792: 75 34 jne 801037c8 wakeup(&p->nread); 80103794: 83 ec 0c sub $0xc,%esp 80103797: 57 push %edi 80103798: e8 c3 0a 00 00 call 80104260 sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 8010379d: 58 pop %eax 8010379e: 5a pop %edx 8010379f: 53 push %ebx 801037a0: 56 push %esi 801037a1: e8 fa 09 00 00 call 801041a0 while (p->nwrite == p->nread + PIPESIZE) { //DOC: pipewrite-full 801037a6: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax 801037ac: 8b 93 38 02 00 00 mov 0x238(%ebx),%edx 801037b2: 83 c4 10 add $0x10,%esp 801037b5: 05 00 02 00 00 add $0x200,%eax 801037ba: 39 c2 cmp %eax,%edx 801037bc: 75 2a jne 801037e8 if (p->readopen == 0 || myproc()->killed) { 801037be: 8b 83 3c 02 00 00 mov 0x23c(%ebx),%eax 801037c4: 85 c0 test %eax,%eax 801037c6: 75 c0 jne 80103788 release(&p->lock); 801037c8: 83 ec 0c sub $0xc,%esp 801037cb: 53 push %ebx 801037cc: e8 cf 0e 00 00 call 801046a0 return -1; 801037d1: 83 c4 10 add $0x10,%esp 801037d4: 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; } 801037d9: 8d 65 f4 lea -0xc(%ebp),%esp 801037dc: 5b pop %ebx 801037dd: 5e pop %esi 801037de: 5f pop %edi 801037df: 5d pop %ebp 801037e0: c3 ret 801037e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi p->data[p->nwrite++ % PIPESIZE] = addr[i]; 801037e8: 8b 75 e4 mov -0x1c(%ebp),%esi 801037eb: 8d 4a 01 lea 0x1(%edx),%ecx 801037ee: 81 e2 ff 01 00 00 and $0x1ff,%edx 801037f4: 89 8b 38 02 00 00 mov %ecx,0x238(%ebx) 801037fa: 0f b6 06 movzbl (%esi),%eax for (i = 0; i < n; i++) { 801037fd: 83 c6 01 add $0x1,%esi 80103800: 89 75 e4 mov %esi,-0x1c(%ebp) p->data[p->nwrite++ % PIPESIZE] = addr[i]; 80103803: 88 44 13 34 mov %al,0x34(%ebx,%edx,1) for (i = 0; i < n; i++) { 80103807: 3b 75 e0 cmp -0x20(%ebp),%esi 8010380a: 0f 85 58 ff ff ff jne 80103768 wakeup(&p->nread); //DOC: pipewrite-wakeup1 80103810: 83 ec 0c sub $0xc,%esp 80103813: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax 80103819: 50 push %eax 8010381a: e8 41 0a 00 00 call 80104260 release(&p->lock); 8010381f: 89 1c 24 mov %ebx,(%esp) 80103822: e8 79 0e 00 00 call 801046a0 return n; 80103827: 8b 45 10 mov 0x10(%ebp),%eax 8010382a: 83 c4 10 add $0x10,%esp 8010382d: eb aa jmp 801037d9 8010382f: 90 nop 80103830 : int piperead(struct pipe *p, char *addr, int n) { 80103830: 55 push %ebp 80103831: 89 e5 mov %esp,%ebp 80103833: 57 push %edi 80103834: 56 push %esi 80103835: 53 push %ebx 80103836: 83 ec 18 sub $0x18,%esp 80103839: 8b 75 08 mov 0x8(%ebp),%esi 8010383c: 8b 7d 0c mov 0xc(%ebp),%edi int i; acquire(&p->lock); 8010383f: 56 push %esi 80103840: 8d 9e 34 02 00 00 lea 0x234(%esi),%ebx 80103846: e8 b5 0e 00 00 call 80104700 while (p->nread == p->nwrite && p->writeopen) { //DOC: pipe-empty 8010384b: 8b 86 34 02 00 00 mov 0x234(%esi),%eax 80103851: 83 c4 10 add $0x10,%esp 80103854: 39 86 38 02 00 00 cmp %eax,0x238(%esi) 8010385a: 74 2f je 8010388b 8010385c: eb 37 jmp 80103895 8010385e: 66 90 xchg %ax,%ax if (myproc()->killed) { 80103860: e8 6b 02 00 00 call 80103ad0 80103865: 8b 48 24 mov 0x24(%eax),%ecx 80103868: 85 c9 test %ecx,%ecx 8010386a: 0f 85 80 00 00 00 jne 801038f0 release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep 80103870: 83 ec 08 sub $0x8,%esp 80103873: 56 push %esi 80103874: 53 push %ebx 80103875: e8 26 09 00 00 call 801041a0 while (p->nread == p->nwrite && p->writeopen) { //DOC: pipe-empty 8010387a: 8b 86 38 02 00 00 mov 0x238(%esi),%eax 80103880: 83 c4 10 add $0x10,%esp 80103883: 39 86 34 02 00 00 cmp %eax,0x234(%esi) 80103889: 75 0a jne 80103895 8010388b: 8b 86 40 02 00 00 mov 0x240(%esi),%eax 80103891: 85 c0 test %eax,%eax 80103893: 75 cb jne 80103860 } for (i = 0; i < n; i++) { //DOC: piperead-copy 80103895: 8b 55 10 mov 0x10(%ebp),%edx 80103898: 31 db xor %ebx,%ebx 8010389a: 85 d2 test %edx,%edx 8010389c: 7f 20 jg 801038be 8010389e: eb 2c jmp 801038cc if (p->nread == p->nwrite) { break; } addr[i] = p->data[p->nread++ % PIPESIZE]; 801038a0: 8d 48 01 lea 0x1(%eax),%ecx 801038a3: 25 ff 01 00 00 and $0x1ff,%eax 801038a8: 89 8e 34 02 00 00 mov %ecx,0x234(%esi) 801038ae: 0f b6 44 06 34 movzbl 0x34(%esi,%eax,1),%eax 801038b3: 88 04 1f mov %al,(%edi,%ebx,1) for (i = 0; i < n; i++) { //DOC: piperead-copy 801038b6: 83 c3 01 add $0x1,%ebx 801038b9: 39 5d 10 cmp %ebx,0x10(%ebp) 801038bc: 74 0e je 801038cc if (p->nread == p->nwrite) { 801038be: 8b 86 34 02 00 00 mov 0x234(%esi),%eax 801038c4: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax 801038ca: 75 d4 jne 801038a0 } wakeup(&p->nwrite); //DOC: piperead-wakeup 801038cc: 83 ec 0c sub $0xc,%esp 801038cf: 8d 86 38 02 00 00 lea 0x238(%esi),%eax 801038d5: 50 push %eax 801038d6: e8 85 09 00 00 call 80104260 release(&p->lock); 801038db: 89 34 24 mov %esi,(%esp) 801038de: e8 bd 0d 00 00 call 801046a0 return i; 801038e3: 83 c4 10 add $0x10,%esp } 801038e6: 8d 65 f4 lea -0xc(%ebp),%esp 801038e9: 89 d8 mov %ebx,%eax 801038eb: 5b pop %ebx 801038ec: 5e pop %esi 801038ed: 5f pop %edi 801038ee: 5d pop %ebp 801038ef: c3 ret release(&p->lock); 801038f0: 83 ec 0c sub $0xc,%esp return -1; 801038f3: bb ff ff ff ff mov $0xffffffff,%ebx release(&p->lock); 801038f8: 56 push %esi 801038f9: e8 a2 0d 00 00 call 801046a0 return -1; 801038fe: 83 c4 10 add $0x10,%esp } 80103901: 8d 65 f4 lea -0xc(%ebp),%esp 80103904: 89 d8 mov %ebx,%eax 80103906: 5b pop %ebx 80103907: 5e pop %esi 80103908: 5f pop %edi 80103909: 5d pop %ebp 8010390a: c3 ret 8010390b: 66 90 xchg %ax,%ax 8010390d: 66 90 xchg %ax,%ax 8010390f: 90 nop 80103910 : // Look in the process table for an UNUSED proc. // If found, change state to EMBRYO and initialize // state required to run in the kernel. // Otherwise return 0. static struct proc* allocproc(void) { 80103910: 55 push %ebp 80103911: 89 e5 mov %esp,%ebp 80103913: 53 push %ebx char *sp; int found = 0; acquire(&ptable.lock); p = ptable.proc; 80103914: bb 74 1d 11 80 mov $0x80111d74,%ebx static struct proc* allocproc(void) { 80103919: 83 ec 10 sub $0x10,%esp acquire(&ptable.lock); 8010391c: 68 40 1d 11 80 push $0x80111d40 80103921: e8 da 0d 00 00 call 80104700 80103926: 83 c4 10 add $0x10,%esp while (p < &ptable.proc[NPROC] && !found) { if (p->state == UNUSED) { 80103929: 8b 43 0c mov 0xc(%ebx),%eax 8010392c: 85 c0 test %eax,%eax 8010392e: 74 28 je 80103958 found = 1; } else { p++; 80103930: 83 c3 7c add $0x7c,%ebx while (p < &ptable.proc[NPROC] && !found) { 80103933: 81 fb 74 3c 11 80 cmp $0x80113c74,%ebx 80103939: 75 ee jne 80103929 } } if (!found) { release(&ptable.lock); 8010393b: 83 ec 0c sub $0xc,%esp return 0; 8010393e: 31 db xor %ebx,%ebx release(&ptable.lock); 80103940: 68 40 1d 11 80 push $0x80111d40 80103945: e8 56 0d 00 00 call 801046a0 p->context = (struct context*)sp; memset(p->context, 0, sizeof *p->context); p->context->eip = (uint)forkret; return p; } 8010394a: 89 d8 mov %ebx,%eax return 0; 8010394c: 83 c4 10 add $0x10,%esp } 8010394f: 8b 5d fc mov -0x4(%ebp),%ebx 80103952: c9 leave 80103953: c3 ret 80103954: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi p->pid = nextpid++; 80103958: a1 04 a0 10 80 mov 0x8010a004,%eax release(&ptable.lock); 8010395d: 83 ec 0c sub $0xc,%esp p->state = EMBRYO; 80103960: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx) p->pid = nextpid++; 80103967: 89 43 10 mov %eax,0x10(%ebx) 8010396a: 8d 50 01 lea 0x1(%eax),%edx release(&ptable.lock); 8010396d: 68 40 1d 11 80 push $0x80111d40 p->pid = nextpid++; 80103972: 89 15 04 a0 10 80 mov %edx,0x8010a004 release(&ptable.lock); 80103978: e8 23 0d 00 00 call 801046a0 if ((p->kstack = kalloc()) == 0) { 8010397d: e8 1e ee ff ff call 801027a0 80103982: 83 c4 10 add $0x10,%esp 80103985: 89 43 08 mov %eax,0x8(%ebx) 80103988: 85 c0 test %eax,%eax 8010398a: 74 3c je 801039c8 sp -= sizeof *p->tf; 8010398c: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx memset(p->context, 0, sizeof *p->context); 80103992: 83 ec 04 sub $0x4,%esp sp -= sizeof *p->context; 80103995: 05 9c 0f 00 00 add $0xf9c,%eax sp -= sizeof *p->tf; 8010399a: 89 53 18 mov %edx,0x18(%ebx) *(uint*)sp = (uint)trapret; 8010399d: c7 40 14 66 5a 10 80 movl $0x80105a66,0x14(%eax) p->context = (struct context*)sp; 801039a4: 89 43 1c mov %eax,0x1c(%ebx) memset(p->context, 0, sizeof *p->context); 801039a7: 6a 14 push $0x14 801039a9: 6a 00 push $0x0 801039ab: 50 push %eax 801039ac: e8 0f 0e 00 00 call 801047c0 p->context->eip = (uint)forkret; 801039b1: 8b 43 1c mov 0x1c(%ebx),%eax return p; 801039b4: 83 c4 10 add $0x10,%esp p->context->eip = (uint)forkret; 801039b7: c7 40 10 e0 39 10 80 movl $0x801039e0,0x10(%eax) } 801039be: 89 d8 mov %ebx,%eax 801039c0: 8b 5d fc mov -0x4(%ebp),%ebx 801039c3: c9 leave 801039c4: c3 ret 801039c5: 8d 76 00 lea 0x0(%esi),%esi p->state = UNUSED; 801039c8: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) return 0; 801039cf: 31 db xor %ebx,%ebx } 801039d1: 89 d8 mov %ebx,%eax 801039d3: 8b 5d fc mov -0x4(%ebp),%ebx 801039d6: c9 leave 801039d7: c3 ret 801039d8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801039df: 90 nop 801039e0 : release(&ptable.lock); } // A fork child's very first scheduling by scheduler() // will swtch here. "Return" to user space. void forkret(void) { 801039e0: 55 push %ebp 801039e1: 89 e5 mov %esp,%ebp 801039e3: 83 ec 14 sub $0x14,%esp static int first = 1; // Still holding ptable.lock from scheduler. release(&ptable.lock); 801039e6: 68 40 1d 11 80 push $0x80111d40 801039eb: e8 b0 0c 00 00 call 801046a0 if (first) { 801039f0: a1 00 a0 10 80 mov 0x8010a000,%eax 801039f5: 83 c4 10 add $0x10,%esp 801039f8: 85 c0 test %eax,%eax 801039fa: 75 04 jne 80103a00 iinit(ROOTDEV); initlog(ROOTDEV); } // Return to "caller", actually trapret (see allocproc). } 801039fc: c9 leave 801039fd: c3 ret 801039fe: 66 90 xchg %ax,%ax first = 0; 80103a00: c7 05 00 a0 10 80 00 movl $0x0,0x8010a000 80103a07: 00 00 00 iinit(ROOTDEV); 80103a0a: 83 ec 0c sub $0xc,%esp 80103a0d: 6a 01 push $0x1 80103a0f: e8 6c dc ff ff call 80101680 initlog(ROOTDEV); 80103a14: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80103a1b: e8 c0 f3 ff ff call 80102de0 } 80103a20: 83 c4 10 add $0x10,%esp 80103a23: c9 leave 80103a24: c3 ret 80103a25: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103a2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103a30 : void pinit(void) { 80103a30: 55 push %ebp 80103a31: 89 e5 mov %esp,%ebp 80103a33: 83 ec 10 sub $0x10,%esp initlock(&ptable.lock, "ptable"); 80103a36: 68 20 79 10 80 push $0x80107920 80103a3b: 68 40 1d 11 80 push $0x80111d40 80103a40: e8 eb 0a 00 00 call 80104530 } 80103a45: 83 c4 10 add $0x10,%esp 80103a48: c9 leave 80103a49: c3 ret 80103a4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103a50 : struct cpu*mycpu(void) { 80103a50: 55 push %ebp 80103a51: 89 e5 mov %esp,%ebp 80103a53: 56 push %esi 80103a54: 53 push %ebx asm volatile ("pushfl; popl %0" : "=r" (eflags)); 80103a55: 9c pushf 80103a56: 58 pop %eax if (readeflags() & FL_IF) { 80103a57: f6 c4 02 test $0x2,%ah 80103a5a: 75 46 jne 80103aa2 apicid = lapicid(); 80103a5c: e8 af ef ff ff call 80102a10 for (i = 0; i < ncpu; ++i) { 80103a61: 8b 35 a4 17 11 80 mov 0x801117a4,%esi 80103a67: 85 f6 test %esi,%esi 80103a69: 7e 2a jle 80103a95 80103a6b: 31 d2 xor %edx,%edx 80103a6d: eb 08 jmp 80103a77 80103a6f: 90 nop 80103a70: 83 c2 01 add $0x1,%edx 80103a73: 39 f2 cmp %esi,%edx 80103a75: 74 1e je 80103a95 if (cpus[i].apicid == apicid) { 80103a77: 69 ca b0 00 00 00 imul $0xb0,%edx,%ecx 80103a7d: 0f b6 99 c0 17 11 80 movzbl -0x7feee840(%ecx),%ebx 80103a84: 39 c3 cmp %eax,%ebx 80103a86: 75 e8 jne 80103a70 } 80103a88: 8d 65 f8 lea -0x8(%ebp),%esp return &cpus[i]; 80103a8b: 8d 81 c0 17 11 80 lea -0x7feee840(%ecx),%eax } 80103a91: 5b pop %ebx 80103a92: 5e pop %esi 80103a93: 5d pop %ebp 80103a94: c3 ret panic("unknown apicid\n"); 80103a95: 83 ec 0c sub $0xc,%esp 80103a98: 68 27 79 10 80 push $0x80107927 80103a9d: e8 ee c8 ff ff call 80100390 panic("mycpu called with interrupts enabled\n"); 80103aa2: 83 ec 0c sub $0xc,%esp 80103aa5: 68 04 7a 10 80 push $0x80107a04 80103aaa: e8 e1 c8 ff ff call 80100390 80103aaf: 90 nop 80103ab0 : int cpuid() { 80103ab0: 55 push %ebp 80103ab1: 89 e5 mov %esp,%ebp 80103ab3: 83 ec 08 sub $0x8,%esp return mycpu() - cpus; 80103ab6: e8 95 ff ff ff call 80103a50 } 80103abb: c9 leave return mycpu() - cpus; 80103abc: 2d c0 17 11 80 sub $0x801117c0,%eax 80103ac1: c1 f8 04 sar $0x4,%eax 80103ac4: 69 c0 a3 8b 2e ba imul $0xba2e8ba3,%eax,%eax } 80103aca: c3 ret 80103acb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103acf: 90 nop 80103ad0 : struct proc*myproc(void) { 80103ad0: 55 push %ebp 80103ad1: 89 e5 mov %esp,%ebp 80103ad3: 53 push %ebx 80103ad4: 83 ec 04 sub $0x4,%esp pushcli(); 80103ad7: e8 d4 0a 00 00 call 801045b0 c = mycpu(); 80103adc: e8 6f ff ff ff call 80103a50 p = c->proc; 80103ae1: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103ae7: e8 14 0b 00 00 call 80104600 } 80103aec: 89 d8 mov %ebx,%eax 80103aee: 8b 5d fc mov -0x4(%ebp),%ebx 80103af1: c9 leave 80103af2: c3 ret 80103af3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103afa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103b00 : void userinit(void) { 80103b00: 55 push %ebp 80103b01: 89 e5 mov %esp,%ebp 80103b03: 53 push %ebx 80103b04: 83 ec 04 sub $0x4,%esp p = allocproc(); 80103b07: e8 04 fe ff ff call 80103910 80103b0c: 89 c3 mov %eax,%ebx initproc = p; 80103b0e: a3 74 3c 11 80 mov %eax,0x80113c74 if ((p->pgdir = setupkvm()) == 0) { 80103b13: e8 48 35 00 00 call 80107060 80103b18: 89 43 04 mov %eax,0x4(%ebx) 80103b1b: 85 c0 test %eax,%eax 80103b1d: 0f 84 bd 00 00 00 je 80103be0 inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); 80103b23: 83 ec 04 sub $0x4,%esp 80103b26: 68 2c 00 00 00 push $0x2c 80103b2b: 68 60 a4 10 80 push $0x8010a460 80103b30: 50 push %eax 80103b31: e8 da 31 00 00 call 80106d10 memset(p->tf, 0, sizeof(*p->tf)); 80103b36: 83 c4 0c add $0xc,%esp p->sz = PGSIZE; 80103b39: c7 03 00 10 00 00 movl $0x1000,(%ebx) memset(p->tf, 0, sizeof(*p->tf)); 80103b3f: 6a 4c push $0x4c 80103b41: 6a 00 push $0x0 80103b43: ff 73 18 push 0x18(%ebx) 80103b46: e8 75 0c 00 00 call 801047c0 p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 80103b4b: 8b 43 18 mov 0x18(%ebx),%eax 80103b4e: ba 1b 00 00 00 mov $0x1b,%edx safestrcpy(p->name, "initcode", sizeof(p->name)); 80103b53: 83 c4 0c add $0xc,%esp p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 80103b56: b9 23 00 00 00 mov $0x23,%ecx p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 80103b5b: 66 89 50 3c mov %dx,0x3c(%eax) p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 80103b5f: 8b 43 18 mov 0x18(%ebx),%eax 80103b62: 66 89 48 2c mov %cx,0x2c(%eax) p->tf->es = p->tf->ds; 80103b66: 8b 43 18 mov 0x18(%ebx),%eax 80103b69: 0f b7 50 2c movzwl 0x2c(%eax),%edx 80103b6d: 66 89 50 28 mov %dx,0x28(%eax) p->tf->ss = p->tf->ds; 80103b71: 8b 43 18 mov 0x18(%ebx),%eax 80103b74: 0f b7 50 2c movzwl 0x2c(%eax),%edx 80103b78: 66 89 50 48 mov %dx,0x48(%eax) p->tf->eflags = FL_IF; 80103b7c: 8b 43 18 mov 0x18(%ebx),%eax 80103b7f: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax) p->tf->esp = PGSIZE; 80103b86: 8b 43 18 mov 0x18(%ebx),%eax 80103b89: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) p->tf->eip = 0; // beginning of initcode.S 80103b90: 8b 43 18 mov 0x18(%ebx),%eax 80103b93: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) safestrcpy(p->name, "initcode", sizeof(p->name)); 80103b9a: 8d 43 6c lea 0x6c(%ebx),%eax 80103b9d: 6a 10 push $0x10 80103b9f: 68 50 79 10 80 push $0x80107950 80103ba4: 50 push %eax 80103ba5: e8 d6 0d 00 00 call 80104980 p->cwd = namei("/"); 80103baa: c7 04 24 59 79 10 80 movl $0x80107959,(%esp) 80103bb1: e8 0a e6 ff ff call 801021c0 80103bb6: 89 43 68 mov %eax,0x68(%ebx) acquire(&ptable.lock); 80103bb9: c7 04 24 40 1d 11 80 movl $0x80111d40,(%esp) 80103bc0: e8 3b 0b 00 00 call 80104700 p->state = RUNNABLE; 80103bc5: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) release(&ptable.lock); 80103bcc: c7 04 24 40 1d 11 80 movl $0x80111d40,(%esp) 80103bd3: e8 c8 0a 00 00 call 801046a0 } 80103bd8: 8b 5d fc mov -0x4(%ebp),%ebx 80103bdb: 83 c4 10 add $0x10,%esp 80103bde: c9 leave 80103bdf: c3 ret panic("userinit: out of memory?"); 80103be0: 83 ec 0c sub $0xc,%esp 80103be3: 68 37 79 10 80 push $0x80107937 80103be8: e8 a3 c7 ff ff call 80100390 80103bed: 8d 76 00 lea 0x0(%esi),%esi 80103bf0 : int growproc(int n) { 80103bf0: 55 push %ebp 80103bf1: 89 e5 mov %esp,%ebp 80103bf3: 56 push %esi 80103bf4: 53 push %ebx 80103bf5: 8b 75 08 mov 0x8(%ebp),%esi pushcli(); 80103bf8: e8 b3 09 00 00 call 801045b0 c = mycpu(); 80103bfd: e8 4e fe ff ff call 80103a50 p = c->proc; 80103c02: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103c08: e8 f3 09 00 00 call 80104600 sz = curproc->sz; 80103c0d: 8b 03 mov (%ebx),%eax if (n > 0) { 80103c0f: 85 f6 test %esi,%esi 80103c11: 7f 1d jg 80103c30 else if (n < 0) { 80103c13: 75 3b jne 80103c50 switchuvm(curproc); 80103c15: 83 ec 0c sub $0xc,%esp curproc->sz = sz; 80103c18: 89 03 mov %eax,(%ebx) switchuvm(curproc); 80103c1a: 53 push %ebx 80103c1b: e8 e0 2f 00 00 call 80106c00 return 0; 80103c20: 83 c4 10 add $0x10,%esp 80103c23: 31 c0 xor %eax,%eax } 80103c25: 8d 65 f8 lea -0x8(%ebp),%esp 80103c28: 5b pop %ebx 80103c29: 5e pop %esi 80103c2a: 5d pop %ebp 80103c2b: c3 ret 80103c2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if ((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) { 80103c30: 83 ec 04 sub $0x4,%esp 80103c33: 01 c6 add %eax,%esi 80103c35: 56 push %esi 80103c36: 50 push %eax 80103c37: ff 73 04 push 0x4(%ebx) 80103c3a: e8 41 32 00 00 call 80106e80 80103c3f: 83 c4 10 add $0x10,%esp 80103c42: 85 c0 test %eax,%eax 80103c44: 75 cf jne 80103c15 return -1; 80103c46: b8 ff ff ff ff mov $0xffffffff,%eax 80103c4b: eb d8 jmp 80103c25 80103c4d: 8d 76 00 lea 0x0(%esi),%esi if ((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) { 80103c50: 83 ec 04 sub $0x4,%esp 80103c53: 01 c6 add %eax,%esi 80103c55: 56 push %esi 80103c56: 50 push %eax 80103c57: ff 73 04 push 0x4(%ebx) 80103c5a: e8 51 33 00 00 call 80106fb0 80103c5f: 83 c4 10 add $0x10,%esp 80103c62: 85 c0 test %eax,%eax 80103c64: 75 af jne 80103c15 80103c66: eb de jmp 80103c46 80103c68: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103c6f: 90 nop 80103c70 : int fork(void) { 80103c70: 55 push %ebp 80103c71: 89 e5 mov %esp,%ebp 80103c73: 57 push %edi 80103c74: 56 push %esi 80103c75: 53 push %ebx 80103c76: 83 ec 1c sub $0x1c,%esp pushcli(); 80103c79: e8 32 09 00 00 call 801045b0 c = mycpu(); 80103c7e: e8 cd fd ff ff call 80103a50 p = c->proc; 80103c83: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103c89: e8 72 09 00 00 call 80104600 if ((np = allocproc()) == 0) { 80103c8e: e8 7d fc ff ff call 80103910 80103c93: 89 45 e4 mov %eax,-0x1c(%ebp) 80103c96: 85 c0 test %eax,%eax 80103c98: 0f 84 b7 00 00 00 je 80103d55 if ((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0) { 80103c9e: 83 ec 08 sub $0x8,%esp 80103ca1: ff 33 push (%ebx) 80103ca3: 89 c7 mov %eax,%edi 80103ca5: ff 73 04 push 0x4(%ebx) 80103ca8: e8 a3 34 00 00 call 80107150 80103cad: 83 c4 10 add $0x10,%esp 80103cb0: 89 47 04 mov %eax,0x4(%edi) 80103cb3: 85 c0 test %eax,%eax 80103cb5: 0f 84 a1 00 00 00 je 80103d5c np->sz = curproc->sz; 80103cbb: 8b 03 mov (%ebx),%eax 80103cbd: 8b 4d e4 mov -0x1c(%ebp),%ecx 80103cc0: 89 01 mov %eax,(%ecx) *np->tf = *curproc->tf; 80103cc2: 8b 79 18 mov 0x18(%ecx),%edi np->parent = curproc; 80103cc5: 89 c8 mov %ecx,%eax 80103cc7: 89 59 14 mov %ebx,0x14(%ecx) *np->tf = *curproc->tf; 80103cca: b9 13 00 00 00 mov $0x13,%ecx 80103ccf: 8b 73 18 mov 0x18(%ebx),%esi 80103cd2: f3 a5 rep movsl %ds:(%esi),%es:(%edi) for (i = 0; i < NOFILE; i++) { 80103cd4: 31 f6 xor %esi,%esi np->tf->eax = 0; 80103cd6: 8b 40 18 mov 0x18(%eax),%eax 80103cd9: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) if (curproc->ofile[i]) { 80103ce0: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax 80103ce4: 85 c0 test %eax,%eax 80103ce6: 74 13 je 80103cfb np->ofile[i] = filedup(curproc->ofile[i]); 80103ce8: 83 ec 0c sub $0xc,%esp 80103ceb: 50 push %eax 80103cec: e8 cf d2 ff ff call 80100fc0 80103cf1: 8b 55 e4 mov -0x1c(%ebp),%edx 80103cf4: 83 c4 10 add $0x10,%esp 80103cf7: 89 44 b2 28 mov %eax,0x28(%edx,%esi,4) for (i = 0; i < NOFILE; i++) { 80103cfb: 83 c6 01 add $0x1,%esi 80103cfe: 83 fe 10 cmp $0x10,%esi 80103d01: 75 dd jne 80103ce0 np->cwd = idup(curproc->cwd); 80103d03: 83 ec 0c sub $0xc,%esp 80103d06: ff 73 68 push 0x68(%ebx) safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 80103d09: 83 c3 6c add $0x6c,%ebx np->cwd = idup(curproc->cwd); 80103d0c: e8 5f db ff ff call 80101870 80103d11: 8b 7d e4 mov -0x1c(%ebp),%edi safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 80103d14: 83 c4 0c add $0xc,%esp np->cwd = idup(curproc->cwd); 80103d17: 89 47 68 mov %eax,0x68(%edi) safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 80103d1a: 8d 47 6c lea 0x6c(%edi),%eax 80103d1d: 6a 10 push $0x10 80103d1f: 53 push %ebx 80103d20: 50 push %eax 80103d21: e8 5a 0c 00 00 call 80104980 pid = np->pid; 80103d26: 8b 5f 10 mov 0x10(%edi),%ebx acquire(&ptable.lock); 80103d29: c7 04 24 40 1d 11 80 movl $0x80111d40,(%esp) 80103d30: e8 cb 09 00 00 call 80104700 np->state = RUNNABLE; 80103d35: c7 47 0c 03 00 00 00 movl $0x3,0xc(%edi) release(&ptable.lock); 80103d3c: c7 04 24 40 1d 11 80 movl $0x80111d40,(%esp) 80103d43: e8 58 09 00 00 call 801046a0 return pid; 80103d48: 83 c4 10 add $0x10,%esp } 80103d4b: 8d 65 f4 lea -0xc(%ebp),%esp 80103d4e: 89 d8 mov %ebx,%eax 80103d50: 5b pop %ebx 80103d51: 5e pop %esi 80103d52: 5f pop %edi 80103d53: 5d pop %ebp 80103d54: c3 ret return -1; 80103d55: bb ff ff ff ff mov $0xffffffff,%ebx 80103d5a: eb ef jmp 80103d4b kfree(np->kstack); 80103d5c: 8b 5d e4 mov -0x1c(%ebp),%ebx 80103d5f: 83 ec 0c sub $0xc,%esp 80103d62: ff 73 08 push 0x8(%ebx) 80103d65: e8 76 e8 ff ff call 801025e0 np->kstack = 0; 80103d6a: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) return -1; 80103d71: 83 c4 10 add $0x10,%esp np->state = UNUSED; 80103d74: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) return -1; 80103d7b: bb ff ff ff ff mov $0xffffffff,%ebx 80103d80: eb c9 jmp 80103d4b 80103d82: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103d89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103d90 : void scheduler(void) { 80103d90: 55 push %ebp 80103d91: 89 e5 mov %esp,%ebp 80103d93: 57 push %edi 80103d94: 56 push %esi 80103d95: 53 push %ebx 80103d96: 83 ec 0c sub $0xc,%esp struct cpu *c = mycpu(); 80103d99: e8 b2 fc ff ff call 80103a50 c->proc = 0; 80103d9e: c7 80 ac 00 00 00 00 movl $0x0,0xac(%eax) 80103da5: 00 00 00 struct cpu *c = mycpu(); 80103da8: 89 c6 mov %eax,%esi c->proc = 0; 80103daa: 8d 78 04 lea 0x4(%eax),%edi 80103dad: 8d 76 00 lea 0x0(%esi),%esi asm volatile ("sti"); 80103db0: fb sti acquire(&ptable.lock); 80103db1: 83 ec 0c sub $0xc,%esp for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 80103db4: bb 74 1d 11 80 mov $0x80111d74,%ebx acquire(&ptable.lock); 80103db9: 68 40 1d 11 80 push $0x80111d40 80103dbe: e8 3d 09 00 00 call 80104700 80103dc3: 83 c4 10 add $0x10,%esp 80103dc6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103dcd: 8d 76 00 lea 0x0(%esi),%esi if (p->state != RUNNABLE) { 80103dd0: 83 7b 0c 03 cmpl $0x3,0xc(%ebx) 80103dd4: 75 33 jne 80103e09 switchuvm(p); 80103dd6: 83 ec 0c sub $0xc,%esp c->proc = p; 80103dd9: 89 9e ac 00 00 00 mov %ebx,0xac(%esi) switchuvm(p); 80103ddf: 53 push %ebx 80103de0: e8 1b 2e 00 00 call 80106c00 swtch(&(c->scheduler), p->context); 80103de5: 58 pop %eax 80103de6: 5a pop %edx 80103de7: ff 73 1c push 0x1c(%ebx) 80103dea: 57 push %edi p->state = RUNNING; 80103deb: c7 43 0c 04 00 00 00 movl $0x4,0xc(%ebx) swtch(&(c->scheduler), p->context); 80103df2: e8 e4 0b 00 00 call 801049db switchkvm(); 80103df7: e8 f4 2d 00 00 call 80106bf0 c->proc = 0; 80103dfc: 83 c4 10 add $0x10,%esp 80103dff: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi) 80103e06: 00 00 00 for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 80103e09: 83 c3 7c add $0x7c,%ebx 80103e0c: 81 fb 74 3c 11 80 cmp $0x80113c74,%ebx 80103e12: 75 bc jne 80103dd0 release(&ptable.lock); 80103e14: 83 ec 0c sub $0xc,%esp 80103e17: 68 40 1d 11 80 push $0x80111d40 80103e1c: e8 7f 08 00 00 call 801046a0 sti(); 80103e21: 83 c4 10 add $0x10,%esp 80103e24: eb 8a jmp 80103db0 80103e26: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103e2d: 8d 76 00 lea 0x0(%esi),%esi 80103e30 : void sched(void) { 80103e30: 55 push %ebp 80103e31: 89 e5 mov %esp,%ebp 80103e33: 56 push %esi 80103e34: 53 push %ebx pushcli(); 80103e35: e8 76 07 00 00 call 801045b0 c = mycpu(); 80103e3a: e8 11 fc ff ff call 80103a50 p = c->proc; 80103e3f: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103e45: e8 b6 07 00 00 call 80104600 if (!holding(&ptable.lock)) { 80103e4a: 83 ec 0c sub $0xc,%esp 80103e4d: 68 40 1d 11 80 push $0x80111d40 80103e52: e8 09 08 00 00 call 80104660 80103e57: 83 c4 10 add $0x10,%esp 80103e5a: 85 c0 test %eax,%eax 80103e5c: 74 4f je 80103ead if (mycpu()->ncli != 1) { 80103e5e: e8 ed fb ff ff call 80103a50 80103e63: 83 b8 a4 00 00 00 01 cmpl $0x1,0xa4(%eax) 80103e6a: 75 68 jne 80103ed4 if (p->state == RUNNING) { 80103e6c: 83 7b 0c 04 cmpl $0x4,0xc(%ebx) 80103e70: 74 55 je 80103ec7 asm volatile ("pushfl; popl %0" : "=r" (eflags)); 80103e72: 9c pushf 80103e73: 58 pop %eax if (readeflags() & FL_IF) { 80103e74: f6 c4 02 test $0x2,%ah 80103e77: 75 41 jne 80103eba intena = mycpu()->intena; 80103e79: e8 d2 fb ff ff call 80103a50 swtch(&p->context, mycpu()->scheduler); 80103e7e: 83 c3 1c add $0x1c,%ebx intena = mycpu()->intena; 80103e81: 8b b0 a8 00 00 00 mov 0xa8(%eax),%esi swtch(&p->context, mycpu()->scheduler); 80103e87: e8 c4 fb ff ff call 80103a50 80103e8c: 83 ec 08 sub $0x8,%esp 80103e8f: ff 70 04 push 0x4(%eax) 80103e92: 53 push %ebx 80103e93: e8 43 0b 00 00 call 801049db mycpu()->intena = intena; 80103e98: e8 b3 fb ff ff call 80103a50 } 80103e9d: 83 c4 10 add $0x10,%esp mycpu()->intena = intena; 80103ea0: 89 b0 a8 00 00 00 mov %esi,0xa8(%eax) } 80103ea6: 8d 65 f8 lea -0x8(%ebp),%esp 80103ea9: 5b pop %ebx 80103eaa: 5e pop %esi 80103eab: 5d pop %ebp 80103eac: c3 ret panic("sched ptable.lock"); 80103ead: 83 ec 0c sub $0xc,%esp 80103eb0: 68 5b 79 10 80 push $0x8010795b 80103eb5: e8 d6 c4 ff ff call 80100390 panic("sched interruptible"); 80103eba: 83 ec 0c sub $0xc,%esp 80103ebd: 68 87 79 10 80 push $0x80107987 80103ec2: e8 c9 c4 ff ff call 80100390 panic("sched running"); 80103ec7: 83 ec 0c sub $0xc,%esp 80103eca: 68 79 79 10 80 push $0x80107979 80103ecf: e8 bc c4 ff ff call 80100390 panic("sched locks"); 80103ed4: 83 ec 0c sub $0xc,%esp 80103ed7: 68 6d 79 10 80 push $0x8010796d 80103edc: e8 af c4 ff ff call 80100390 80103ee1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103ee8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103eef: 90 nop 80103ef0 : void exit(void) { 80103ef0: 55 push %ebp 80103ef1: 89 e5 mov %esp,%ebp 80103ef3: 57 push %edi 80103ef4: 56 push %esi 80103ef5: 53 push %ebx 80103ef6: 83 ec 0c sub $0xc,%esp struct proc *curproc = myproc(); 80103ef9: e8 d2 fb ff ff call 80103ad0 if (curproc == initproc) { 80103efe: 39 05 74 3c 11 80 cmp %eax,0x80113c74 80103f04: 0f 84 fd 00 00 00 je 80104007 80103f0a: 89 c3 mov %eax,%ebx 80103f0c: 8d 70 28 lea 0x28(%eax),%esi 80103f0f: 8d 78 68 lea 0x68(%eax),%edi 80103f12: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if (curproc->ofile[fd]) { 80103f18: 8b 06 mov (%esi),%eax 80103f1a: 85 c0 test %eax,%eax 80103f1c: 74 12 je 80103f30 fileclose(curproc->ofile[fd]); 80103f1e: 83 ec 0c sub $0xc,%esp 80103f21: 50 push %eax 80103f22: e8 e9 d0 ff ff call 80101010 curproc->ofile[fd] = 0; 80103f27: c7 06 00 00 00 00 movl $0x0,(%esi) 80103f2d: 83 c4 10 add $0x10,%esp for (fd = 0; fd < NOFILE; fd++) { 80103f30: 83 c6 04 add $0x4,%esi 80103f33: 39 f7 cmp %esi,%edi 80103f35: 75 e1 jne 80103f18 begin_op(); 80103f37: e8 44 ef ff ff call 80102e80 iput(curproc->cwd); 80103f3c: 83 ec 0c sub $0xc,%esp 80103f3f: ff 73 68 push 0x68(%ebx) 80103f42: e8 89 da ff ff call 801019d0 end_op(); 80103f47: e8 a4 ef ff ff call 80102ef0 curproc->cwd = 0; 80103f4c: c7 43 68 00 00 00 00 movl $0x0,0x68(%ebx) acquire(&ptable.lock); 80103f53: c7 04 24 40 1d 11 80 movl $0x80111d40,(%esp) 80103f5a: e8 a1 07 00 00 call 80104700 wakeup1(curproc->parent); 80103f5f: 8b 53 14 mov 0x14(%ebx),%edx 80103f62: 83 c4 10 add $0x10,%esp // Wake up all processes sleeping on chan. // The ptable lock must be held. static void wakeup1(void *chan) { struct proc *p; for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 80103f65: b8 74 1d 11 80 mov $0x80111d74,%eax 80103f6a: eb 0e jmp 80103f7a 80103f6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103f70: 83 c0 7c add $0x7c,%eax 80103f73: 3d 74 3c 11 80 cmp $0x80113c74,%eax 80103f78: 74 1c je 80103f96 if (p->state == SLEEPING && p->chan == chan) { 80103f7a: 83 78 0c 02 cmpl $0x2,0xc(%eax) 80103f7e: 75 f0 jne 80103f70 80103f80: 3b 50 20 cmp 0x20(%eax),%edx 80103f83: 75 eb jne 80103f70 p->state = RUNNABLE; 80103f85: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 80103f8c: 83 c0 7c add $0x7c,%eax 80103f8f: 3d 74 3c 11 80 cmp $0x80113c74,%eax 80103f94: 75 e4 jne 80103f7a p->parent = initproc; 80103f96: 8b 0d 74 3c 11 80 mov 0x80113c74,%ecx for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 80103f9c: ba 74 1d 11 80 mov $0x80111d74,%edx 80103fa1: eb 10 jmp 80103fb3 80103fa3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103fa7: 90 nop 80103fa8: 83 c2 7c add $0x7c,%edx 80103fab: 81 fa 74 3c 11 80 cmp $0x80113c74,%edx 80103fb1: 74 3b je 80103fee if (p->parent == curproc) { 80103fb3: 39 5a 14 cmp %ebx,0x14(%edx) 80103fb6: 75 f0 jne 80103fa8 if (p->state == ZOMBIE) { 80103fb8: 83 7a 0c 05 cmpl $0x5,0xc(%edx) p->parent = initproc; 80103fbc: 89 4a 14 mov %ecx,0x14(%edx) if (p->state == ZOMBIE) { 80103fbf: 75 e7 jne 80103fa8 for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 80103fc1: b8 74 1d 11 80 mov $0x80111d74,%eax 80103fc6: eb 12 jmp 80103fda 80103fc8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103fcf: 90 nop 80103fd0: 83 c0 7c add $0x7c,%eax 80103fd3: 3d 74 3c 11 80 cmp $0x80113c74,%eax 80103fd8: 74 ce je 80103fa8 if (p->state == SLEEPING && p->chan == chan) { 80103fda: 83 78 0c 02 cmpl $0x2,0xc(%eax) 80103fde: 75 f0 jne 80103fd0 80103fe0: 3b 48 20 cmp 0x20(%eax),%ecx 80103fe3: 75 eb jne 80103fd0 p->state = RUNNABLE; 80103fe5: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) 80103fec: eb e2 jmp 80103fd0 curproc->state = ZOMBIE; 80103fee: c7 43 0c 05 00 00 00 movl $0x5,0xc(%ebx) sched(); 80103ff5: e8 36 fe ff ff call 80103e30 panic("zombie exit"); 80103ffa: 83 ec 0c sub $0xc,%esp 80103ffd: 68 a8 79 10 80 push $0x801079a8 80104002: e8 89 c3 ff ff call 80100390 panic("init exiting"); 80104007: 83 ec 0c sub $0xc,%esp 8010400a: 68 9b 79 10 80 push $0x8010799b 8010400f: e8 7c c3 ff ff call 80100390 80104014: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010401b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010401f: 90 nop 80104020 : int wait(void) { 80104020: 55 push %ebp 80104021: 89 e5 mov %esp,%ebp 80104023: 56 push %esi 80104024: 53 push %ebx pushcli(); 80104025: e8 86 05 00 00 call 801045b0 c = mycpu(); 8010402a: e8 21 fa ff ff call 80103a50 p = c->proc; 8010402f: 8b b0 ac 00 00 00 mov 0xac(%eax),%esi popcli(); 80104035: e8 c6 05 00 00 call 80104600 acquire(&ptable.lock); 8010403a: 83 ec 0c sub $0xc,%esp 8010403d: 68 40 1d 11 80 push $0x80111d40 80104042: e8 b9 06 00 00 call 80104700 80104047: 83 c4 10 add $0x10,%esp havekids = 0; 8010404a: 31 c0 xor %eax,%eax for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 8010404c: bb 74 1d 11 80 mov $0x80111d74,%ebx 80104051: eb 10 jmp 80104063 80104053: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104057: 90 nop 80104058: 83 c3 7c add $0x7c,%ebx 8010405b: 81 fb 74 3c 11 80 cmp $0x80113c74,%ebx 80104061: 74 1b je 8010407e if (p->parent != curproc) { 80104063: 39 73 14 cmp %esi,0x14(%ebx) 80104066: 75 f0 jne 80104058 if (p->state == ZOMBIE) { 80104068: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) 8010406c: 74 62 je 801040d0 for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 8010406e: 83 c3 7c add $0x7c,%ebx havekids = 1; 80104071: b8 01 00 00 00 mov $0x1,%eax for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 80104076: 81 fb 74 3c 11 80 cmp $0x80113c74,%ebx 8010407c: 75 e5 jne 80104063 if (!havekids || curproc->killed) { 8010407e: 85 c0 test %eax,%eax 80104080: 0f 84 a0 00 00 00 je 80104126 80104086: 8b 46 24 mov 0x24(%esi),%eax 80104089: 85 c0 test %eax,%eax 8010408b: 0f 85 95 00 00 00 jne 80104126 pushcli(); 80104091: e8 1a 05 00 00 call 801045b0 c = mycpu(); 80104096: e8 b5 f9 ff ff call 80103a50 p = c->proc; 8010409b: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 801040a1: e8 5a 05 00 00 call 80104600 if (p == 0) { 801040a6: 85 db test %ebx,%ebx 801040a8: 0f 84 8f 00 00 00 je 8010413d p->chan = chan; 801040ae: 89 73 20 mov %esi,0x20(%ebx) p->state = SLEEPING; 801040b1: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); 801040b8: e8 73 fd ff ff call 80103e30 p->chan = 0; 801040bd: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) } 801040c4: eb 84 jmp 8010404a 801040c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801040cd: 8d 76 00 lea 0x0(%esi),%esi kfree(p->kstack); 801040d0: 83 ec 0c sub $0xc,%esp pid = p->pid; 801040d3: 8b 73 10 mov 0x10(%ebx),%esi kfree(p->kstack); 801040d6: ff 73 08 push 0x8(%ebx) 801040d9: e8 02 e5 ff ff call 801025e0 p->kstack = 0; 801040de: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) freevm(p->pgdir); 801040e5: 5a pop %edx 801040e6: ff 73 04 push 0x4(%ebx) 801040e9: e8 f2 2e 00 00 call 80106fe0 p->pid = 0; 801040ee: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx) p->parent = 0; 801040f5: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) p->name[0] = 0; 801040fc: c6 43 6c 00 movb $0x0,0x6c(%ebx) p->killed = 0; 80104100: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx) p->state = UNUSED; 80104107: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) release(&ptable.lock); 8010410e: c7 04 24 40 1d 11 80 movl $0x80111d40,(%esp) 80104115: e8 86 05 00 00 call 801046a0 return pid; 8010411a: 83 c4 10 add $0x10,%esp } 8010411d: 8d 65 f8 lea -0x8(%ebp),%esp 80104120: 89 f0 mov %esi,%eax 80104122: 5b pop %ebx 80104123: 5e pop %esi 80104124: 5d pop %ebp 80104125: c3 ret release(&ptable.lock); 80104126: 83 ec 0c sub $0xc,%esp return -1; 80104129: be ff ff ff ff mov $0xffffffff,%esi release(&ptable.lock); 8010412e: 68 40 1d 11 80 push $0x80111d40 80104133: e8 68 05 00 00 call 801046a0 return -1; 80104138: 83 c4 10 add $0x10,%esp 8010413b: eb e0 jmp 8010411d panic("sleep"); 8010413d: 83 ec 0c sub $0xc,%esp 80104140: 68 b4 79 10 80 push $0x801079b4 80104145: e8 46 c2 ff ff call 80100390 8010414a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104150 : void yield(void) { 80104150: 55 push %ebp 80104151: 89 e5 mov %esp,%ebp 80104153: 53 push %ebx 80104154: 83 ec 10 sub $0x10,%esp acquire(&ptable.lock); //DOC: yieldlock 80104157: 68 40 1d 11 80 push $0x80111d40 8010415c: e8 9f 05 00 00 call 80104700 pushcli(); 80104161: e8 4a 04 00 00 call 801045b0 c = mycpu(); 80104166: e8 e5 f8 ff ff call 80103a50 p = c->proc; 8010416b: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80104171: e8 8a 04 00 00 call 80104600 myproc()->state = RUNNABLE; 80104176: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) sched(); 8010417d: e8 ae fc ff ff call 80103e30 release(&ptable.lock); 80104182: c7 04 24 40 1d 11 80 movl $0x80111d40,(%esp) 80104189: e8 12 05 00 00 call 801046a0 } 8010418e: 8b 5d fc mov -0x4(%ebp),%ebx 80104191: 83 c4 10 add $0x10,%esp 80104194: c9 leave 80104195: c3 ret 80104196: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010419d: 8d 76 00 lea 0x0(%esi),%esi 801041a0 : void sleep(void *chan, struct spinlock *lk) { 801041a0: 55 push %ebp 801041a1: 89 e5 mov %esp,%ebp 801041a3: 57 push %edi 801041a4: 56 push %esi 801041a5: 53 push %ebx 801041a6: 83 ec 0c sub $0xc,%esp 801041a9: 8b 7d 08 mov 0x8(%ebp),%edi 801041ac: 8b 75 0c mov 0xc(%ebp),%esi pushcli(); 801041af: e8 fc 03 00 00 call 801045b0 c = mycpu(); 801041b4: e8 97 f8 ff ff call 80103a50 p = c->proc; 801041b9: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 801041bf: e8 3c 04 00 00 call 80104600 if (p == 0) { 801041c4: 85 db test %ebx,%ebx 801041c6: 0f 84 87 00 00 00 je 80104253 if (lk == 0) { 801041cc: 85 f6 test %esi,%esi 801041ce: 74 76 je 80104246 if (lk != &ptable.lock) { //DOC: sleeplock0 801041d0: 81 fe 40 1d 11 80 cmp $0x80111d40,%esi 801041d6: 74 50 je 80104228 acquire(&ptable.lock); //DOC: sleeplock1 801041d8: 83 ec 0c sub $0xc,%esp 801041db: 68 40 1d 11 80 push $0x80111d40 801041e0: e8 1b 05 00 00 call 80104700 release(lk); 801041e5: 89 34 24 mov %esi,(%esp) 801041e8: e8 b3 04 00 00 call 801046a0 p->chan = chan; 801041ed: 89 7b 20 mov %edi,0x20(%ebx) p->state = SLEEPING; 801041f0: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); 801041f7: e8 34 fc ff ff call 80103e30 p->chan = 0; 801041fc: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) release(&ptable.lock); 80104203: c7 04 24 40 1d 11 80 movl $0x80111d40,(%esp) 8010420a: e8 91 04 00 00 call 801046a0 acquire(lk); 8010420f: 89 75 08 mov %esi,0x8(%ebp) 80104212: 83 c4 10 add $0x10,%esp } 80104215: 8d 65 f4 lea -0xc(%ebp),%esp 80104218: 5b pop %ebx 80104219: 5e pop %esi 8010421a: 5f pop %edi 8010421b: 5d pop %ebp acquire(lk); 8010421c: e9 df 04 00 00 jmp 80104700 80104221: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi p->chan = chan; 80104228: 89 7b 20 mov %edi,0x20(%ebx) p->state = SLEEPING; 8010422b: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); 80104232: e8 f9 fb ff ff call 80103e30 p->chan = 0; 80104237: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) } 8010423e: 8d 65 f4 lea -0xc(%ebp),%esp 80104241: 5b pop %ebx 80104242: 5e pop %esi 80104243: 5f pop %edi 80104244: 5d pop %ebp 80104245: c3 ret panic("sleep without lk"); 80104246: 83 ec 0c sub $0xc,%esp 80104249: 68 ba 79 10 80 push $0x801079ba 8010424e: e8 3d c1 ff ff call 80100390 panic("sleep"); 80104253: 83 ec 0c sub $0xc,%esp 80104256: 68 b4 79 10 80 push $0x801079b4 8010425b: e8 30 c1 ff ff call 80100390 80104260 : } } } // Wake up all processes sleeping on chan. void wakeup(void *chan) { 80104260: 55 push %ebp 80104261: 89 e5 mov %esp,%ebp 80104263: 53 push %ebx 80104264: 83 ec 10 sub $0x10,%esp 80104267: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&ptable.lock); 8010426a: 68 40 1d 11 80 push $0x80111d40 8010426f: e8 8c 04 00 00 call 80104700 80104274: 83 c4 10 add $0x10,%esp for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 80104277: b8 74 1d 11 80 mov $0x80111d74,%eax 8010427c: eb 0c jmp 8010428a 8010427e: 66 90 xchg %ax,%ax 80104280: 83 c0 7c add $0x7c,%eax 80104283: 3d 74 3c 11 80 cmp $0x80113c74,%eax 80104288: 74 1c je 801042a6 if (p->state == SLEEPING && p->chan == chan) { 8010428a: 83 78 0c 02 cmpl $0x2,0xc(%eax) 8010428e: 75 f0 jne 80104280 80104290: 3b 58 20 cmp 0x20(%eax),%ebx 80104293: 75 eb jne 80104280 p->state = RUNNABLE; 80104295: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 8010429c: 83 c0 7c add $0x7c,%eax 8010429f: 3d 74 3c 11 80 cmp $0x80113c74,%eax 801042a4: 75 e4 jne 8010428a wakeup1(chan); release(&ptable.lock); 801042a6: c7 45 08 40 1d 11 80 movl $0x80111d40,0x8(%ebp) } 801042ad: 8b 5d fc mov -0x4(%ebp),%ebx 801042b0: c9 leave release(&ptable.lock); 801042b1: e9 ea 03 00 00 jmp 801046a0 801042b6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801042bd: 8d 76 00 lea 0x0(%esi),%esi 801042c0 : // 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) { 801042c0: 55 push %ebp 801042c1: 89 e5 mov %esp,%ebp 801042c3: 53 push %ebx 801042c4: 83 ec 10 sub $0x10,%esp 801042c7: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *p; acquire(&ptable.lock); 801042ca: 68 40 1d 11 80 push $0x80111d40 801042cf: e8 2c 04 00 00 call 80104700 801042d4: 83 c4 10 add $0x10,%esp for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 801042d7: b8 74 1d 11 80 mov $0x80111d74,%eax 801042dc: eb 0c jmp 801042ea 801042de: 66 90 xchg %ax,%ax 801042e0: 83 c0 7c add $0x7c,%eax 801042e3: 3d 74 3c 11 80 cmp $0x80113c74,%eax 801042e8: 74 36 je 80104320 if (p->pid == pid) { 801042ea: 39 58 10 cmp %ebx,0x10(%eax) 801042ed: 75 f1 jne 801042e0 p->killed = 1; // Wake process from sleep if necessary. if (p->state == SLEEPING) { 801042ef: 83 78 0c 02 cmpl $0x2,0xc(%eax) p->killed = 1; 801042f3: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) if (p->state == SLEEPING) { 801042fa: 75 07 jne 80104303 p->state = RUNNABLE; 801042fc: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) } release(&ptable.lock); 80104303: 83 ec 0c sub $0xc,%esp 80104306: 68 40 1d 11 80 push $0x80111d40 8010430b: e8 90 03 00 00 call 801046a0 return 0; } } release(&ptable.lock); return -1; } 80104310: 8b 5d fc mov -0x4(%ebp),%ebx return 0; 80104313: 83 c4 10 add $0x10,%esp 80104316: 31 c0 xor %eax,%eax } 80104318: c9 leave 80104319: c3 ret 8010431a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi release(&ptable.lock); 80104320: 83 ec 0c sub $0xc,%esp 80104323: 68 40 1d 11 80 push $0x80111d40 80104328: e8 73 03 00 00 call 801046a0 } 8010432d: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80104330: 83 c4 10 add $0x10,%esp 80104333: b8 ff ff ff ff mov $0xffffffff,%eax } 80104338: c9 leave 80104339: c3 ret 8010433a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104340 : // 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) { 80104340: 55 push %ebp 80104341: 89 e5 mov %esp,%ebp 80104343: 57 push %edi 80104344: 56 push %esi 80104345: 8d 75 e8 lea -0x18(%ebp),%esi 80104348: 53 push %ebx 80104349: bb e0 1d 11 80 mov $0x80111de0,%ebx 8010434e: 83 ec 3c sub $0x3c,%esp 80104351: eb 24 jmp 80104377 80104353: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104357: 90 nop getcallerpcs((uint*)p->context->ebp + 2, pc); for (i = 0; i < 10 && pc[i] != 0; i++) { cprintf(" %p", pc[i]); } } cprintf("\n"); 80104358: 83 ec 0c sub $0xc,%esp 8010435b: 68 4f 7d 10 80 push $0x80107d4f 80104360: e8 4b c3 ff ff call 801006b0 80104365: 83 c4 10 add $0x10,%esp for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 80104368: 83 c3 7c add $0x7c,%ebx 8010436b: 81 fb e0 3c 11 80 cmp $0x80113ce0,%ebx 80104371: 0f 84 81 00 00 00 je 801043f8 if (p->state == UNUSED) { 80104377: 8b 43 a0 mov -0x60(%ebx),%eax 8010437a: 85 c0 test %eax,%eax 8010437c: 74 ea je 80104368 state = "???"; 8010437e: ba cb 79 10 80 mov $0x801079cb,%edx if (p->state >= 0 && p->state < NELEM(states) && states[p->state]) { 80104383: 83 f8 05 cmp $0x5,%eax 80104386: 77 11 ja 80104399 80104388: 8b 14 85 2c 7a 10 80 mov -0x7fef85d4(,%eax,4),%edx state = "???"; 8010438f: b8 cb 79 10 80 mov $0x801079cb,%eax 80104394: 85 d2 test %edx,%edx 80104396: 0f 44 d0 cmove %eax,%edx cprintf("%d %s %s", p->pid, state, p->name); 80104399: 53 push %ebx 8010439a: 52 push %edx 8010439b: ff 73 a4 push -0x5c(%ebx) 8010439e: 68 cf 79 10 80 push $0x801079cf 801043a3: e8 08 c3 ff ff call 801006b0 if (p->state == SLEEPING) { 801043a8: 83 c4 10 add $0x10,%esp 801043ab: 83 7b a0 02 cmpl $0x2,-0x60(%ebx) 801043af: 75 a7 jne 80104358 getcallerpcs((uint*)p->context->ebp + 2, pc); 801043b1: 83 ec 08 sub $0x8,%esp 801043b4: 8d 45 c0 lea -0x40(%ebp),%eax 801043b7: 8d 7d c0 lea -0x40(%ebp),%edi 801043ba: 50 push %eax 801043bb: 8b 43 b0 mov -0x50(%ebx),%eax 801043be: 8b 40 0c mov 0xc(%eax),%eax 801043c1: 83 c0 08 add $0x8,%eax 801043c4: 50 push %eax 801043c5: e8 86 01 00 00 call 80104550 for (i = 0; i < 10 && pc[i] != 0; i++) { 801043ca: 83 c4 10 add $0x10,%esp 801043cd: 8d 76 00 lea 0x0(%esi),%esi 801043d0: 8b 17 mov (%edi),%edx 801043d2: 85 d2 test %edx,%edx 801043d4: 74 82 je 80104358 cprintf(" %p", pc[i]); 801043d6: 83 ec 08 sub $0x8,%esp for (i = 0; i < 10 && pc[i] != 0; i++) { 801043d9: 83 c7 04 add $0x4,%edi cprintf(" %p", pc[i]); 801043dc: 52 push %edx 801043dd: 68 21 74 10 80 push $0x80107421 801043e2: e8 c9 c2 ff ff call 801006b0 for (i = 0; i < 10 && pc[i] != 0; i++) { 801043e7: 83 c4 10 add $0x10,%esp 801043ea: 39 fe cmp %edi,%esi 801043ec: 75 e2 jne 801043d0 801043ee: e9 65 ff ff ff jmp 80104358 801043f3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801043f7: 90 nop } } 801043f8: 8d 65 f4 lea -0xc(%ebp),%esp 801043fb: 5b pop %ebx 801043fc: 5e pop %esi 801043fd: 5f pop %edi 801043fe: 5d pop %ebp 801043ff: c3 ret 80104400 : #include "mmu.h" #include "proc.h" #include "spinlock.h" #include "sleeplock.h" void initsleeplock(struct sleeplock *lk, char *name) { 80104400: 55 push %ebp 80104401: 89 e5 mov %esp,%ebp 80104403: 53 push %ebx 80104404: 83 ec 0c sub $0xc,%esp 80104407: 8b 5d 08 mov 0x8(%ebp),%ebx initlock(&lk->lk, "sleep lock"); 8010440a: 68 44 7a 10 80 push $0x80107a44 8010440f: 8d 43 04 lea 0x4(%ebx),%eax 80104412: 50 push %eax 80104413: e8 18 01 00 00 call 80104530 lk->name = name; 80104418: 8b 45 0c mov 0xc(%ebp),%eax lk->locked = 0; 8010441b: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; } 80104421: 83 c4 10 add $0x10,%esp lk->pid = 0; 80104424: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) lk->name = name; 8010442b: 89 43 38 mov %eax,0x38(%ebx) } 8010442e: 8b 5d fc mov -0x4(%ebp),%ebx 80104431: c9 leave 80104432: c3 ret 80104433: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010443a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104440 : void acquiresleep(struct sleeplock *lk) { 80104440: 55 push %ebp 80104441: 89 e5 mov %esp,%ebp 80104443: 56 push %esi 80104444: 53 push %ebx 80104445: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&lk->lk); 80104448: 8d 73 04 lea 0x4(%ebx),%esi 8010444b: 83 ec 0c sub $0xc,%esp 8010444e: 56 push %esi 8010444f: e8 ac 02 00 00 call 80104700 while (lk->locked) { 80104454: 8b 13 mov (%ebx),%edx 80104456: 83 c4 10 add $0x10,%esp 80104459: 85 d2 test %edx,%edx 8010445b: 74 16 je 80104473 8010445d: 8d 76 00 lea 0x0(%esi),%esi sleep(lk, &lk->lk); 80104460: 83 ec 08 sub $0x8,%esp 80104463: 56 push %esi 80104464: 53 push %ebx 80104465: e8 36 fd ff ff call 801041a0 while (lk->locked) { 8010446a: 8b 03 mov (%ebx),%eax 8010446c: 83 c4 10 add $0x10,%esp 8010446f: 85 c0 test %eax,%eax 80104471: 75 ed jne 80104460 } lk->locked = 1; 80104473: c7 03 01 00 00 00 movl $0x1,(%ebx) lk->pid = myproc()->pid; 80104479: e8 52 f6 ff ff call 80103ad0 8010447e: 8b 40 10 mov 0x10(%eax),%eax 80104481: 89 43 3c mov %eax,0x3c(%ebx) release(&lk->lk); 80104484: 89 75 08 mov %esi,0x8(%ebp) } 80104487: 8d 65 f8 lea -0x8(%ebp),%esp 8010448a: 5b pop %ebx 8010448b: 5e pop %esi 8010448c: 5d pop %ebp release(&lk->lk); 8010448d: e9 0e 02 00 00 jmp 801046a0 80104492: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104499: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801044a0 : void releasesleep(struct sleeplock *lk) { 801044a0: 55 push %ebp 801044a1: 89 e5 mov %esp,%ebp 801044a3: 56 push %esi 801044a4: 53 push %ebx 801044a5: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&lk->lk); 801044a8: 8d 73 04 lea 0x4(%ebx),%esi 801044ab: 83 ec 0c sub $0xc,%esp 801044ae: 56 push %esi 801044af: e8 4c 02 00 00 call 80104700 lk->locked = 0; 801044b4: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; 801044ba: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) wakeup(lk); 801044c1: 89 1c 24 mov %ebx,(%esp) 801044c4: e8 97 fd ff ff call 80104260 release(&lk->lk); 801044c9: 89 75 08 mov %esi,0x8(%ebp) 801044cc: 83 c4 10 add $0x10,%esp } 801044cf: 8d 65 f8 lea -0x8(%ebp),%esp 801044d2: 5b pop %ebx 801044d3: 5e pop %esi 801044d4: 5d pop %ebp release(&lk->lk); 801044d5: e9 c6 01 00 00 jmp 801046a0 801044da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801044e0 : int holdingsleep(struct sleeplock *lk) { 801044e0: 55 push %ebp 801044e1: 89 e5 mov %esp,%ebp 801044e3: 57 push %edi 801044e4: 31 ff xor %edi,%edi 801044e6: 56 push %esi 801044e7: 53 push %ebx 801044e8: 83 ec 18 sub $0x18,%esp 801044eb: 8b 5d 08 mov 0x8(%ebp),%ebx int r; acquire(&lk->lk); 801044ee: 8d 73 04 lea 0x4(%ebx),%esi 801044f1: 56 push %esi 801044f2: e8 09 02 00 00 call 80104700 r = lk->locked && (lk->pid == myproc()->pid); 801044f7: 8b 03 mov (%ebx),%eax 801044f9: 83 c4 10 add $0x10,%esp 801044fc: 85 c0 test %eax,%eax 801044fe: 75 18 jne 80104518 release(&lk->lk); 80104500: 83 ec 0c sub $0xc,%esp 80104503: 56 push %esi 80104504: e8 97 01 00 00 call 801046a0 return r; } 80104509: 8d 65 f4 lea -0xc(%ebp),%esp 8010450c: 89 f8 mov %edi,%eax 8010450e: 5b pop %ebx 8010450f: 5e pop %esi 80104510: 5f pop %edi 80104511: 5d pop %ebp 80104512: c3 ret 80104513: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104517: 90 nop r = lk->locked && (lk->pid == myproc()->pid); 80104518: 8b 5b 3c mov 0x3c(%ebx),%ebx 8010451b: e8 b0 f5 ff ff call 80103ad0 80104520: 39 58 10 cmp %ebx,0x10(%eax) 80104523: 0f 94 c0 sete %al 80104526: 0f b6 c0 movzbl %al,%eax 80104529: 89 c7 mov %eax,%edi 8010452b: eb d3 jmp 80104500 8010452d: 66 90 xchg %ax,%ax 8010452f: 90 nop 80104530 : #include "memlayout.h" #include "mmu.h" #include "proc.h" #include "spinlock.h" void initlock(struct spinlock *lk, char *name) { 80104530: 55 push %ebp 80104531: 89 e5 mov %esp,%ebp 80104533: 8b 45 08 mov 0x8(%ebp),%eax lk->name = name; 80104536: 8b 55 0c mov 0xc(%ebp),%edx lk->locked = 0; 80104539: c7 00 00 00 00 00 movl $0x0,(%eax) lk->name = name; 8010453f: 89 50 04 mov %edx,0x4(%eax) lk->cpu = 0; 80104542: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 80104549: 5d pop %ebp 8010454a: c3 ret 8010454b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010454f: 90 nop 80104550 : popcli(); } // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { 80104550: 55 push %ebp uint *ebp; int i; ebp = (uint*)v - 2; for (i = 0; i < 10; i++) { 80104551: 31 d2 xor %edx,%edx void getcallerpcs(void *v, uint pcs[]) { 80104553: 89 e5 mov %esp,%ebp 80104555: 53 push %ebx ebp = (uint*)v - 2; 80104556: 8b 45 08 mov 0x8(%ebp),%eax void getcallerpcs(void *v, uint pcs[]) { 80104559: 8b 4d 0c mov 0xc(%ebp),%ecx ebp = (uint*)v - 2; 8010455c: 83 e8 08 sub $0x8,%eax for (i = 0; i < 10; i++) { 8010455f: 90 nop if (ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) { 80104560: 8d 98 00 00 00 80 lea -0x80000000(%eax),%ebx 80104566: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx 8010456c: 77 1a ja 80104588 break; } pcs[i] = ebp[1]; // saved %eip 8010456e: 8b 58 04 mov 0x4(%eax),%ebx 80104571: 89 1c 91 mov %ebx,(%ecx,%edx,4) for (i = 0; i < 10; i++) { 80104574: 83 c2 01 add $0x1,%edx ebp = (uint*)ebp[0]; // saved %ebp 80104577: 8b 00 mov (%eax),%eax for (i = 0; i < 10; i++) { 80104579: 83 fa 0a cmp $0xa,%edx 8010457c: 75 e2 jne 80104560 } for (; i < 10; i++) { pcs[i] = 0; } } 8010457e: 8b 5d fc mov -0x4(%ebp),%ebx 80104581: c9 leave 80104582: c3 ret 80104583: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104587: 90 nop for (; i < 10; i++) { 80104588: 8d 04 91 lea (%ecx,%edx,4),%eax 8010458b: 8d 51 28 lea 0x28(%ecx),%edx 8010458e: 66 90 xchg %ax,%ax pcs[i] = 0; 80104590: c7 00 00 00 00 00 movl $0x0,(%eax) for (; i < 10; i++) { 80104596: 83 c0 04 add $0x4,%eax 80104599: 39 d0 cmp %edx,%eax 8010459b: 75 f3 jne 80104590 } 8010459d: 8b 5d fc mov -0x4(%ebp),%ebx 801045a0: c9 leave 801045a1: c3 ret 801045a2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801045a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801045b0 : // Pushcli/popcli are like cli/sti except that they are matched: // it takes two popcli to undo two pushcli. Also, if interrupts // are off, then pushcli, popcli leaves them off. void pushcli(void) { 801045b0: 55 push %ebp 801045b1: 89 e5 mov %esp,%ebp 801045b3: 53 push %ebx 801045b4: 83 ec 04 sub $0x4,%esp 801045b7: 9c pushf 801045b8: 5b pop %ebx asm volatile ("cli"); 801045b9: fa cli int eflags; eflags = readeflags(); cli(); if (mycpu()->ncli == 0) { 801045ba: e8 91 f4 ff ff call 80103a50 801045bf: 8b 80 a4 00 00 00 mov 0xa4(%eax),%eax 801045c5: 85 c0 test %eax,%eax 801045c7: 74 17 je 801045e0 mycpu()->intena = eflags & FL_IF; } mycpu()->ncli += 1; 801045c9: e8 82 f4 ff ff call 80103a50 801045ce: 83 80 a4 00 00 00 01 addl $0x1,0xa4(%eax) } 801045d5: 8b 5d fc mov -0x4(%ebp),%ebx 801045d8: c9 leave 801045d9: c3 ret 801045da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi mycpu()->intena = eflags & FL_IF; 801045e0: e8 6b f4 ff ff call 80103a50 801045e5: 81 e3 00 02 00 00 and $0x200,%ebx 801045eb: 89 98 a8 00 00 00 mov %ebx,0xa8(%eax) 801045f1: eb d6 jmp 801045c9 801045f3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801045fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104600 : void popcli(void) { 80104600: 55 push %ebp 80104601: 89 e5 mov %esp,%ebp 80104603: 83 ec 08 sub $0x8,%esp asm volatile ("pushfl; popl %0" : "=r" (eflags)); 80104606: 9c pushf 80104607: 58 pop %eax if (readeflags() & FL_IF) { 80104608: f6 c4 02 test $0x2,%ah 8010460b: 75 35 jne 80104642 panic("popcli - interruptible"); } if (--mycpu()->ncli < 0) { 8010460d: e8 3e f4 ff ff call 80103a50 80104612: 83 a8 a4 00 00 00 01 subl $0x1,0xa4(%eax) 80104619: 78 34 js 8010464f panic("popcli"); } if (mycpu()->ncli == 0 && mycpu()->intena) { 8010461b: e8 30 f4 ff ff call 80103a50 80104620: 8b 90 a4 00 00 00 mov 0xa4(%eax),%edx 80104626: 85 d2 test %edx,%edx 80104628: 74 06 je 80104630 sti(); } } 8010462a: c9 leave 8010462b: c3 ret 8010462c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (mycpu()->ncli == 0 && mycpu()->intena) { 80104630: e8 1b f4 ff ff call 80103a50 80104635: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax 8010463b: 85 c0 test %eax,%eax 8010463d: 74 eb je 8010462a asm volatile ("sti"); 8010463f: fb sti } 80104640: c9 leave 80104641: c3 ret panic("popcli - interruptible"); 80104642: 83 ec 0c sub $0xc,%esp 80104645: 68 4f 7a 10 80 push $0x80107a4f 8010464a: e8 41 bd ff ff call 80100390 panic("popcli"); 8010464f: 83 ec 0c sub $0xc,%esp 80104652: 68 66 7a 10 80 push $0x80107a66 80104657: e8 34 bd ff ff call 80100390 8010465c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104660 : int holding(struct spinlock *lock) { 80104660: 55 push %ebp 80104661: 89 e5 mov %esp,%ebp 80104663: 56 push %esi 80104664: 53 push %ebx 80104665: 8b 75 08 mov 0x8(%ebp),%esi 80104668: 31 db xor %ebx,%ebx pushcli(); 8010466a: e8 41 ff ff ff call 801045b0 r = lock->locked && lock->cpu == mycpu(); 8010466f: 8b 06 mov (%esi),%eax 80104671: 85 c0 test %eax,%eax 80104673: 75 0b jne 80104680 popcli(); 80104675: e8 86 ff ff ff call 80104600 } 8010467a: 89 d8 mov %ebx,%eax 8010467c: 5b pop %ebx 8010467d: 5e pop %esi 8010467e: 5d pop %ebp 8010467f: c3 ret r = lock->locked && lock->cpu == mycpu(); 80104680: 8b 5e 08 mov 0x8(%esi),%ebx 80104683: e8 c8 f3 ff ff call 80103a50 80104688: 39 c3 cmp %eax,%ebx 8010468a: 0f 94 c3 sete %bl popcli(); 8010468d: e8 6e ff ff ff call 80104600 r = lock->locked && lock->cpu == mycpu(); 80104692: 0f b6 db movzbl %bl,%ebx } 80104695: 89 d8 mov %ebx,%eax 80104697: 5b pop %ebx 80104698: 5e pop %esi 80104699: 5d pop %ebp 8010469a: c3 ret 8010469b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010469f: 90 nop 801046a0 : void release(struct spinlock *lk) { 801046a0: 55 push %ebp 801046a1: 89 e5 mov %esp,%ebp 801046a3: 56 push %esi 801046a4: 53 push %ebx 801046a5: 8b 5d 08 mov 0x8(%ebp),%ebx pushcli(); 801046a8: e8 03 ff ff ff call 801045b0 r = lock->locked && lock->cpu == mycpu(); 801046ad: 8b 03 mov (%ebx),%eax 801046af: 85 c0 test %eax,%eax 801046b1: 75 15 jne 801046c8 popcli(); 801046b3: e8 48 ff ff ff call 80104600 panic("release"); 801046b8: 83 ec 0c sub $0xc,%esp 801046bb: 68 6d 7a 10 80 push $0x80107a6d 801046c0: e8 cb bc ff ff call 80100390 801046c5: 8d 76 00 lea 0x0(%esi),%esi r = lock->locked && lock->cpu == mycpu(); 801046c8: 8b 73 08 mov 0x8(%ebx),%esi 801046cb: e8 80 f3 ff ff call 80103a50 801046d0: 39 c6 cmp %eax,%esi 801046d2: 75 df jne 801046b3 popcli(); 801046d4: e8 27 ff ff ff call 80104600 lk->pcs[0] = 0; 801046d9: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) lk->cpu = 0; 801046e0: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) __sync_synchronize(); 801046e7: f0 83 0c 24 00 lock orl $0x0,(%esp) asm volatile ("movl $0, %0" : "+m" (lk->locked) :); 801046ec: c7 03 00 00 00 00 movl $0x0,(%ebx) } 801046f2: 8d 65 f8 lea -0x8(%ebp),%esp 801046f5: 5b pop %ebx 801046f6: 5e pop %esi 801046f7: 5d pop %ebp popcli(); 801046f8: e9 03 ff ff ff jmp 80104600 801046fd: 8d 76 00 lea 0x0(%esi),%esi 80104700 : void acquire(struct spinlock *lk) { 80104700: 55 push %ebp 80104701: 89 e5 mov %esp,%ebp 80104703: 53 push %ebx 80104704: 83 ec 04 sub $0x4,%esp pushcli(); // disable interrupts to avoid deadlock. 80104707: e8 a4 fe ff ff call 801045b0 if (holding(lk)) { 8010470c: 8b 5d 08 mov 0x8(%ebp),%ebx pushcli(); 8010470f: e8 9c fe ff ff call 801045b0 r = lock->locked && lock->cpu == mycpu(); 80104714: 8b 03 mov (%ebx),%eax 80104716: 85 c0 test %eax,%eax 80104718: 75 7e jne 80104798 popcli(); 8010471a: e8 e1 fe ff ff call 80104600 asm volatile ("lock; xchgl %0, %1" : 8010471f: b9 01 00 00 00 mov $0x1,%ecx 80104724: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi while (xchg(&lk->locked, 1) != 0) { 80104728: 8b 55 08 mov 0x8(%ebp),%edx 8010472b: 89 c8 mov %ecx,%eax 8010472d: f0 87 02 lock xchg %eax,(%edx) 80104730: 85 c0 test %eax,%eax 80104732: 75 f4 jne 80104728 __sync_synchronize(); 80104734: f0 83 0c 24 00 lock orl $0x0,(%esp) lk->cpu = mycpu(); 80104739: 8b 5d 08 mov 0x8(%ebp),%ebx 8010473c: e8 0f f3 ff ff call 80103a50 getcallerpcs(&lk, lk->pcs); 80104741: 8b 4d 08 mov 0x8(%ebp),%ecx ebp = (uint*)v - 2; 80104744: 89 ea mov %ebp,%edx lk->cpu = mycpu(); 80104746: 89 43 08 mov %eax,0x8(%ebx) for (i = 0; i < 10; i++) { 80104749: 31 c0 xor %eax,%eax 8010474b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010474f: 90 nop if (ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) { 80104750: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx 80104756: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx 8010475c: 77 1a ja 80104778 pcs[i] = ebp[1]; // saved %eip 8010475e: 8b 5a 04 mov 0x4(%edx),%ebx 80104761: 89 5c 81 0c mov %ebx,0xc(%ecx,%eax,4) for (i = 0; i < 10; i++) { 80104765: 83 c0 01 add $0x1,%eax ebp = (uint*)ebp[0]; // saved %ebp 80104768: 8b 12 mov (%edx),%edx for (i = 0; i < 10; i++) { 8010476a: 83 f8 0a cmp $0xa,%eax 8010476d: 75 e1 jne 80104750 } 8010476f: 8b 5d fc mov -0x4(%ebp),%ebx 80104772: c9 leave 80104773: c3 ret 80104774: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for (; i < 10; i++) { 80104778: 8d 44 81 0c lea 0xc(%ecx,%eax,4),%eax 8010477c: 8d 51 34 lea 0x34(%ecx),%edx 8010477f: 90 nop pcs[i] = 0; 80104780: c7 00 00 00 00 00 movl $0x0,(%eax) for (; i < 10; i++) { 80104786: 83 c0 04 add $0x4,%eax 80104789: 39 c2 cmp %eax,%edx 8010478b: 75 f3 jne 80104780 } 8010478d: 8b 5d fc mov -0x4(%ebp),%ebx 80104790: c9 leave 80104791: c3 ret 80104792: 8d b6 00 00 00 00 lea 0x0(%esi),%esi r = lock->locked && lock->cpu == mycpu(); 80104798: 8b 5b 08 mov 0x8(%ebx),%ebx 8010479b: e8 b0 f2 ff ff call 80103a50 801047a0: 39 c3 cmp %eax,%ebx 801047a2: 0f 85 72 ff ff ff jne 8010471a popcli(); 801047a8: e8 53 fe ff ff call 80104600 panic("acquire"); 801047ad: 83 ec 0c sub $0xc,%esp 801047b0: 68 75 7a 10 80 push $0x80107a75 801047b5: e8 d6 bb ff ff call 80100390 801047ba: 66 90 xchg %ax,%ax 801047bc: 66 90 xchg %ax,%ax 801047be: 66 90 xchg %ax,%ax 801047c0 : #include "types.h" #include "x86.h" void* memset(void *dst, int c, uint n) { 801047c0: 55 push %ebp 801047c1: 89 e5 mov %esp,%ebp 801047c3: 57 push %edi 801047c4: 8b 55 08 mov 0x8(%ebp),%edx 801047c7: 8b 4d 10 mov 0x10(%ebp),%ecx 801047ca: 53 push %ebx 801047cb: 8b 45 0c mov 0xc(%ebp),%eax if ((int)dst % 4 == 0 && n % 4 == 0) { 801047ce: 89 d7 mov %edx,%edi 801047d0: 09 cf or %ecx,%edi 801047d2: 83 e7 03 and $0x3,%edi 801047d5: 75 29 jne 80104800 c &= 0xFF; 801047d7: 0f b6 f8 movzbl %al,%edi stosl(dst, (c << 24) | (c << 16) | (c << 8) | c, n / 4); 801047da: c1 e0 18 shl $0x18,%eax 801047dd: 89 fb mov %edi,%ebx 801047df: c1 e9 02 shr $0x2,%ecx 801047e2: c1 e3 10 shl $0x10,%ebx 801047e5: 09 d8 or %ebx,%eax 801047e7: 09 f8 or %edi,%eax 801047e9: c1 e7 08 shl $0x8,%edi 801047ec: 09 f8 or %edi,%eax asm volatile ("cld; rep stosl" : 801047ee: 89 d7 mov %edx,%edi 801047f0: fc cld 801047f1: f3 ab rep stos %eax,%es:(%edi) } else { stosb(dst, c, n); } return dst; } 801047f3: 5b pop %ebx 801047f4: 89 d0 mov %edx,%eax 801047f6: 5f pop %edi 801047f7: 5d pop %ebp 801047f8: c3 ret 801047f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi asm volatile ("cld; rep stosb" : 80104800: 89 d7 mov %edx,%edi 80104802: fc cld 80104803: f3 aa rep stos %al,%es:(%edi) 80104805: 5b pop %ebx 80104806: 89 d0 mov %edx,%eax 80104808: 5f pop %edi 80104809: 5d pop %ebp 8010480a: c3 ret 8010480b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010480f: 90 nop 80104810 : int memcmp(const void *v1, const void *v2, uint n) { 80104810: 55 push %ebp 80104811: 89 e5 mov %esp,%ebp 80104813: 56 push %esi 80104814: 8b 75 10 mov 0x10(%ebp),%esi 80104817: 8b 55 08 mov 0x8(%ebp),%edx 8010481a: 53 push %ebx 8010481b: 8b 45 0c mov 0xc(%ebp),%eax const uchar *s1, *s2; s1 = v1; s2 = v2; while (n-- > 0) { 8010481e: 85 f6 test %esi,%esi 80104820: 74 2e je 80104850 80104822: 01 c6 add %eax,%esi 80104824: eb 14 jmp 8010483a 80104826: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010482d: 8d 76 00 lea 0x0(%esi),%esi if (*s1 != *s2) { return *s1 - *s2; } s1++, s2++; 80104830: 83 c0 01 add $0x1,%eax 80104833: 83 c2 01 add $0x1,%edx while (n-- > 0) { 80104836: 39 f0 cmp %esi,%eax 80104838: 74 16 je 80104850 if (*s1 != *s2) { 8010483a: 0f b6 0a movzbl (%edx),%ecx 8010483d: 0f b6 18 movzbl (%eax),%ebx 80104840: 38 d9 cmp %bl,%cl 80104842: 74 ec je 80104830 return *s1 - *s2; 80104844: 0f b6 c1 movzbl %cl,%eax 80104847: 29 d8 sub %ebx,%eax } return 0; } 80104849: 5b pop %ebx 8010484a: 5e pop %esi 8010484b: 5d pop %ebp 8010484c: c3 ret 8010484d: 8d 76 00 lea 0x0(%esi),%esi 80104850: 5b pop %ebx return 0; 80104851: 31 c0 xor %eax,%eax } 80104853: 5e pop %esi 80104854: 5d pop %ebp 80104855: c3 ret 80104856: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010485d: 8d 76 00 lea 0x0(%esi),%esi 80104860 : void* memmove(void *dst, const void *src, uint n) { 80104860: 55 push %ebp 80104861: 89 e5 mov %esp,%ebp 80104863: 57 push %edi 80104864: 8b 55 08 mov 0x8(%ebp),%edx 80104867: 8b 4d 10 mov 0x10(%ebp),%ecx 8010486a: 56 push %esi 8010486b: 8b 75 0c mov 0xc(%ebp),%esi const char *s; char *d; s = src; d = dst; if (s < d && s + n > d) { 8010486e: 39 d6 cmp %edx,%esi 80104870: 73 26 jae 80104898 80104872: 8d 3c 0e lea (%esi,%ecx,1),%edi 80104875: 39 fa cmp %edi,%edx 80104877: 73 1f jae 80104898 80104879: 8d 41 ff lea -0x1(%ecx),%eax s += n; d += n; while (n-- > 0) { 8010487c: 85 c9 test %ecx,%ecx 8010487e: 74 0c je 8010488c *--d = *--s; 80104880: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx 80104884: 88 0c 02 mov %cl,(%edx,%eax,1) while (n-- > 0) { 80104887: 83 e8 01 sub $0x1,%eax 8010488a: 73 f4 jae 80104880 *d++ = *s++; } } return dst; } 8010488c: 5e pop %esi 8010488d: 89 d0 mov %edx,%eax 8010488f: 5f pop %edi 80104890: 5d pop %ebp 80104891: c3 ret 80104892: 8d b6 00 00 00 00 lea 0x0(%esi),%esi while (n-- > 0) { 80104898: 8d 04 0e lea (%esi,%ecx,1),%eax 8010489b: 89 d7 mov %edx,%edi 8010489d: 85 c9 test %ecx,%ecx 8010489f: 74 eb je 8010488c 801048a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi *d++ = *s++; 801048a8: a4 movsb %ds:(%esi),%es:(%edi) while (n-- > 0) { 801048a9: 39 c6 cmp %eax,%esi 801048ab: 75 fb jne 801048a8 } 801048ad: 5e pop %esi 801048ae: 89 d0 mov %edx,%eax 801048b0: 5f pop %edi 801048b1: 5d pop %ebp 801048b2: c3 ret 801048b3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801048ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801048c0 : // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { return memmove(dst, src, n); 801048c0: eb 9e jmp 80104860 801048c2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801048c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801048d0 : } int strncmp(const char *p, const char *q, uint n) { 801048d0: 55 push %ebp 801048d1: 89 e5 mov %esp,%ebp 801048d3: 56 push %esi 801048d4: 8b 75 10 mov 0x10(%ebp),%esi 801048d7: 8b 4d 08 mov 0x8(%ebp),%ecx 801048da: 53 push %ebx 801048db: 8b 55 0c mov 0xc(%ebp),%edx while (n > 0 && *p && *p == *q) { 801048de: 85 f6 test %esi,%esi 801048e0: 74 2e je 80104910 801048e2: 01 d6 add %edx,%esi 801048e4: eb 18 jmp 801048fe 801048e6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801048ed: 8d 76 00 lea 0x0(%esi),%esi 801048f0: 38 d8 cmp %bl,%al 801048f2: 75 14 jne 80104908 n--, p++, q++; 801048f4: 83 c2 01 add $0x1,%edx 801048f7: 83 c1 01 add $0x1,%ecx while (n > 0 && *p && *p == *q) { 801048fa: 39 f2 cmp %esi,%edx 801048fc: 74 12 je 80104910 801048fe: 0f b6 01 movzbl (%ecx),%eax 80104901: 0f b6 1a movzbl (%edx),%ebx 80104904: 84 c0 test %al,%al 80104906: 75 e8 jne 801048f0 } if (n == 0) { return 0; } return (uchar) * p - (uchar) * q; 80104908: 29 d8 sub %ebx,%eax } 8010490a: 5b pop %ebx 8010490b: 5e pop %esi 8010490c: 5d pop %ebp 8010490d: c3 ret 8010490e: 66 90 xchg %ax,%ax 80104910: 5b pop %ebx return 0; 80104911: 31 c0 xor %eax,%eax } 80104913: 5e pop %esi 80104914: 5d pop %ebp 80104915: c3 ret 80104916: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010491d: 8d 76 00 lea 0x0(%esi),%esi 80104920 : char* strncpy(char *s, const char *t, int n) { 80104920: 55 push %ebp 80104921: 89 e5 mov %esp,%ebp 80104923: 57 push %edi 80104924: 56 push %esi 80104925: 8b 75 08 mov 0x8(%ebp),%esi 80104928: 53 push %ebx 80104929: 8b 4d 10 mov 0x10(%ebp),%ecx char *os; os = s; while (n-- > 0 && (*s++ = *t++) != 0) { 8010492c: 89 f0 mov %esi,%eax 8010492e: eb 15 jmp 80104945 80104930: 83 45 0c 01 addl $0x1,0xc(%ebp) 80104934: 8b 7d 0c mov 0xc(%ebp),%edi 80104937: 83 c0 01 add $0x1,%eax 8010493a: 0f b6 57 ff movzbl -0x1(%edi),%edx 8010493e: 88 50 ff mov %dl,-0x1(%eax) 80104941: 84 d2 test %dl,%dl 80104943: 74 09 je 8010494e 80104945: 89 cb mov %ecx,%ebx 80104947: 83 e9 01 sub $0x1,%ecx 8010494a: 85 db test %ebx,%ebx 8010494c: 7f e2 jg 80104930 ; } while (n-- > 0) { 8010494e: 89 c2 mov %eax,%edx 80104950: 85 c9 test %ecx,%ecx 80104952: 7e 17 jle 8010496b 80104954: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *s++ = 0; 80104958: 83 c2 01 add $0x1,%edx 8010495b: 89 c1 mov %eax,%ecx 8010495d: c6 42 ff 00 movb $0x0,-0x1(%edx) while (n-- > 0) { 80104961: 29 d1 sub %edx,%ecx 80104963: 8d 4c 0b ff lea -0x1(%ebx,%ecx,1),%ecx 80104967: 85 c9 test %ecx,%ecx 80104969: 7f ed jg 80104958 } return os; } 8010496b: 5b pop %ebx 8010496c: 89 f0 mov %esi,%eax 8010496e: 5e pop %esi 8010496f: 5f pop %edi 80104970: 5d pop %ebp 80104971: c3 ret 80104972: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104979: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104980 : // Like strncpy but guaranteed to NUL-terminate. char* safestrcpy(char *s, const char *t, int n) { 80104980: 55 push %ebp 80104981: 89 e5 mov %esp,%ebp 80104983: 56 push %esi 80104984: 8b 55 10 mov 0x10(%ebp),%edx 80104987: 8b 75 08 mov 0x8(%ebp),%esi 8010498a: 53 push %ebx 8010498b: 8b 45 0c mov 0xc(%ebp),%eax char *os; os = s; if (n <= 0) { 8010498e: 85 d2 test %edx,%edx 80104990: 7e 25 jle 801049b7 80104992: 8d 5c 10 ff lea -0x1(%eax,%edx,1),%ebx 80104996: 89 f2 mov %esi,%edx 80104998: eb 16 jmp 801049b0 8010499a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return os; } while (--n > 0 && (*s++ = *t++) != 0) { 801049a0: 0f b6 08 movzbl (%eax),%ecx 801049a3: 83 c0 01 add $0x1,%eax 801049a6: 83 c2 01 add $0x1,%edx 801049a9: 88 4a ff mov %cl,-0x1(%edx) 801049ac: 84 c9 test %cl,%cl 801049ae: 74 04 je 801049b4 801049b0: 39 d8 cmp %ebx,%eax 801049b2: 75 ec jne 801049a0 ; } *s = 0; 801049b4: c6 02 00 movb $0x0,(%edx) return os; } 801049b7: 89 f0 mov %esi,%eax 801049b9: 5b pop %ebx 801049ba: 5e pop %esi 801049bb: 5d pop %ebp 801049bc: c3 ret 801049bd: 8d 76 00 lea 0x0(%esi),%esi 801049c0 : int strlen(const char *s) { 801049c0: 55 push %ebp int n; for (n = 0; s[n]; n++) { 801049c1: 31 c0 xor %eax,%eax int strlen(const char *s) { 801049c3: 89 e5 mov %esp,%ebp 801049c5: 8b 55 08 mov 0x8(%ebp),%edx for (n = 0; s[n]; n++) { 801049c8: 80 3a 00 cmpb $0x0,(%edx) 801049cb: 74 0c je 801049d9 801049cd: 8d 76 00 lea 0x0(%esi),%esi 801049d0: 83 c0 01 add $0x1,%eax 801049d3: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) 801049d7: 75 f7 jne 801049d0 ; } return n; } 801049d9: 5d pop %ebp 801049da: c3 ret 801049db : # 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 801049db: 8b 44 24 04 mov 0x4(%esp),%eax movl 8(%esp), %edx 801049df: 8b 54 24 08 mov 0x8(%esp),%edx # Save old callee-saved registers pushl %ebp 801049e3: 55 push %ebp pushl %ebx 801049e4: 53 push %ebx pushl %esi 801049e5: 56 push %esi pushl %edi 801049e6: 57 push %edi # Switch stacks movl %esp, (%eax) 801049e7: 89 20 mov %esp,(%eax) movl %edx, %esp 801049e9: 89 d4 mov %edx,%esp # Load new callee-saved registers popl %edi 801049eb: 5f pop %edi popl %esi 801049ec: 5e pop %esi popl %ebx 801049ed: 5b pop %ebx popl %ebp 801049ee: 5d pop %ebp ret 801049ef: c3 ret 801049f0 : // Arguments on the stack, from the user call to the C // library system call function. The saved user %esp points // 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) { 801049f0: 55 push %ebp 801049f1: 89 e5 mov %esp,%ebp 801049f3: 53 push %ebx 801049f4: 83 ec 04 sub $0x4,%esp 801049f7: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *curproc = myproc(); 801049fa: e8 d1 f0 ff ff call 80103ad0 if (addr >= curproc->sz || addr + 4 > curproc->sz) { 801049ff: 8b 00 mov (%eax),%eax 80104a01: 39 d8 cmp %ebx,%eax 80104a03: 76 1b jbe 80104a20 80104a05: 8d 53 04 lea 0x4(%ebx),%edx 80104a08: 39 d0 cmp %edx,%eax 80104a0a: 72 14 jb 80104a20 return -1; } *ip = *(int*)(addr); 80104a0c: 8b 45 0c mov 0xc(%ebp),%eax 80104a0f: 8b 13 mov (%ebx),%edx 80104a11: 89 10 mov %edx,(%eax) return 0; 80104a13: 31 c0 xor %eax,%eax } 80104a15: 8b 5d fc mov -0x4(%ebp),%ebx 80104a18: c9 leave 80104a19: c3 ret 80104a1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return -1; 80104a20: b8 ff ff ff ff mov $0xffffffff,%eax 80104a25: eb ee jmp 80104a15 80104a27: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104a2e: 66 90 xchg %ax,%ax 80104a30 : // 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) { 80104a30: 55 push %ebp 80104a31: 89 e5 mov %esp,%ebp 80104a33: 53 push %ebx 80104a34: 83 ec 04 sub $0x4,%esp 80104a37: 8b 5d 08 mov 0x8(%ebp),%ebx char *s, *ep; struct proc *curproc = myproc(); 80104a3a: e8 91 f0 ff ff call 80103ad0 if (addr >= curproc->sz) { 80104a3f: 39 18 cmp %ebx,(%eax) 80104a41: 76 2d jbe 80104a70 return -1; } *pp = (char*)addr; 80104a43: 8b 55 0c mov 0xc(%ebp),%edx 80104a46: 89 1a mov %ebx,(%edx) ep = (char*)curproc->sz; 80104a48: 8b 10 mov (%eax),%edx for (s = *pp; s < ep; s++) { 80104a4a: 39 d3 cmp %edx,%ebx 80104a4c: 73 22 jae 80104a70 80104a4e: 89 d8 mov %ebx,%eax 80104a50: eb 0d jmp 80104a5f 80104a52: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104a58: 83 c0 01 add $0x1,%eax 80104a5b: 39 c2 cmp %eax,%edx 80104a5d: 76 11 jbe 80104a70 if (*s == 0) { 80104a5f: 80 38 00 cmpb $0x0,(%eax) 80104a62: 75 f4 jne 80104a58 return s - *pp; 80104a64: 29 d8 sub %ebx,%eax } } return -1; } 80104a66: 8b 5d fc mov -0x4(%ebp),%ebx 80104a69: c9 leave 80104a6a: c3 ret 80104a6b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104a6f: 90 nop 80104a70: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80104a73: b8 ff ff ff ff mov $0xffffffff,%eax } 80104a78: c9 leave 80104a79: c3 ret 80104a7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104a80 : // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { 80104a80: 55 push %ebp 80104a81: 89 e5 mov %esp,%ebp 80104a83: 56 push %esi 80104a84: 53 push %ebx return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80104a85: e8 46 f0 ff ff call 80103ad0 80104a8a: 8b 55 08 mov 0x8(%ebp),%edx 80104a8d: 8b 40 18 mov 0x18(%eax),%eax 80104a90: 8b 40 44 mov 0x44(%eax),%eax 80104a93: 8d 1c 90 lea (%eax,%edx,4),%ebx struct proc *curproc = myproc(); 80104a96: e8 35 f0 ff ff call 80103ad0 return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80104a9b: 8d 73 04 lea 0x4(%ebx),%esi if (addr >= curproc->sz || addr + 4 > curproc->sz) { 80104a9e: 8b 00 mov (%eax),%eax 80104aa0: 39 c6 cmp %eax,%esi 80104aa2: 73 1c jae 80104ac0 80104aa4: 8d 53 08 lea 0x8(%ebx),%edx 80104aa7: 39 d0 cmp %edx,%eax 80104aa9: 72 15 jb 80104ac0 *ip = *(int*)(addr); 80104aab: 8b 45 0c mov 0xc(%ebp),%eax 80104aae: 8b 53 04 mov 0x4(%ebx),%edx 80104ab1: 89 10 mov %edx,(%eax) return 0; 80104ab3: 31 c0 xor %eax,%eax } 80104ab5: 5b pop %ebx 80104ab6: 5e pop %esi 80104ab7: 5d pop %ebp 80104ab8: c3 ret 80104ab9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return -1; 80104ac0: b8 ff ff ff ff mov $0xffffffff,%eax return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80104ac5: eb ee jmp 80104ab5 80104ac7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104ace: 66 90 xchg %ax,%ax 80104ad0 : // 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) { 80104ad0: 55 push %ebp 80104ad1: 89 e5 mov %esp,%ebp 80104ad3: 57 push %edi 80104ad4: 56 push %esi 80104ad5: 53 push %ebx 80104ad6: 83 ec 0c sub $0xc,%esp int i; struct proc *curproc = myproc(); 80104ad9: e8 f2 ef ff ff call 80103ad0 80104ade: 89 c6 mov %eax,%esi return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80104ae0: e8 eb ef ff ff call 80103ad0 80104ae5: 8b 55 08 mov 0x8(%ebp),%edx 80104ae8: 8b 40 18 mov 0x18(%eax),%eax 80104aeb: 8b 40 44 mov 0x44(%eax),%eax 80104aee: 8d 1c 90 lea (%eax,%edx,4),%ebx struct proc *curproc = myproc(); 80104af1: e8 da ef ff ff call 80103ad0 return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80104af6: 8d 7b 04 lea 0x4(%ebx),%edi if (addr >= curproc->sz || addr + 4 > curproc->sz) { 80104af9: 8b 00 mov (%eax),%eax 80104afb: 39 c7 cmp %eax,%edi 80104afd: 73 31 jae 80104b30 80104aff: 8d 4b 08 lea 0x8(%ebx),%ecx 80104b02: 39 c8 cmp %ecx,%eax 80104b04: 72 2a jb 80104b30 if (argint(n, &i) < 0) { return -1; } if (size < 0 || (uint)i >= curproc->sz || (uint)i + size > curproc->sz) { 80104b06: 8b 55 10 mov 0x10(%ebp),%edx *ip = *(int*)(addr); 80104b09: 8b 43 04 mov 0x4(%ebx),%eax if (size < 0 || (uint)i >= curproc->sz || (uint)i + size > curproc->sz) { 80104b0c: 85 d2 test %edx,%edx 80104b0e: 78 20 js 80104b30 80104b10: 8b 16 mov (%esi),%edx 80104b12: 39 c2 cmp %eax,%edx 80104b14: 76 1a jbe 80104b30 80104b16: 8b 5d 10 mov 0x10(%ebp),%ebx 80104b19: 01 c3 add %eax,%ebx 80104b1b: 39 da cmp %ebx,%edx 80104b1d: 72 11 jb 80104b30 return -1; } *pp = (char*)i; 80104b1f: 8b 55 0c mov 0xc(%ebp),%edx 80104b22: 89 02 mov %eax,(%edx) return 0; 80104b24: 31 c0 xor %eax,%eax } 80104b26: 83 c4 0c add $0xc,%esp 80104b29: 5b pop %ebx 80104b2a: 5e pop %esi 80104b2b: 5f pop %edi 80104b2c: 5d pop %ebp 80104b2d: c3 ret 80104b2e: 66 90 xchg %ax,%ax return -1; 80104b30: b8 ff ff ff ff mov $0xffffffff,%eax 80104b35: eb ef jmp 80104b26 80104b37: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104b3e: 66 90 xchg %ax,%ax 80104b40 : // Fetch the nth word-sized system call argument as a string pointer. // 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) { 80104b40: 55 push %ebp 80104b41: 89 e5 mov %esp,%ebp 80104b43: 56 push %esi 80104b44: 53 push %ebx return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80104b45: e8 86 ef ff ff call 80103ad0 80104b4a: 8b 55 08 mov 0x8(%ebp),%edx 80104b4d: 8b 40 18 mov 0x18(%eax),%eax 80104b50: 8b 40 44 mov 0x44(%eax),%eax 80104b53: 8d 1c 90 lea (%eax,%edx,4),%ebx struct proc *curproc = myproc(); 80104b56: e8 75 ef ff ff call 80103ad0 return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80104b5b: 8d 73 04 lea 0x4(%ebx),%esi if (addr >= curproc->sz || addr + 4 > curproc->sz) { 80104b5e: 8b 00 mov (%eax),%eax 80104b60: 39 c6 cmp %eax,%esi 80104b62: 73 44 jae 80104ba8 80104b64: 8d 53 08 lea 0x8(%ebx),%edx 80104b67: 39 d0 cmp %edx,%eax 80104b69: 72 3d jb 80104ba8 *ip = *(int*)(addr); 80104b6b: 8b 5b 04 mov 0x4(%ebx),%ebx struct proc *curproc = myproc(); 80104b6e: e8 5d ef ff ff call 80103ad0 if (addr >= curproc->sz) { 80104b73: 3b 18 cmp (%eax),%ebx 80104b75: 73 31 jae 80104ba8 *pp = (char*)addr; 80104b77: 8b 55 0c mov 0xc(%ebp),%edx 80104b7a: 89 1a mov %ebx,(%edx) ep = (char*)curproc->sz; 80104b7c: 8b 10 mov (%eax),%edx for (s = *pp; s < ep; s++) { 80104b7e: 39 d3 cmp %edx,%ebx 80104b80: 73 26 jae 80104ba8 80104b82: 89 d8 mov %ebx,%eax 80104b84: eb 11 jmp 80104b97 80104b86: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104b8d: 8d 76 00 lea 0x0(%esi),%esi 80104b90: 83 c0 01 add $0x1,%eax 80104b93: 39 c2 cmp %eax,%edx 80104b95: 76 11 jbe 80104ba8 if (*s == 0) { 80104b97: 80 38 00 cmpb $0x0,(%eax) 80104b9a: 75 f4 jne 80104b90 return s - *pp; 80104b9c: 29 d8 sub %ebx,%eax int addr; if (argint(n, &addr) < 0) { return -1; } return fetchstr(addr, pp); } 80104b9e: 5b pop %ebx 80104b9f: 5e pop %esi 80104ba0: 5d pop %ebp 80104ba1: c3 ret 80104ba2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104ba8: 5b pop %ebx return -1; 80104ba9: b8 ff ff ff ff mov $0xffffffff,%eax } 80104bae: 5e pop %esi 80104baf: 5d pop %ebp 80104bb0: c3 ret 80104bb1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104bb8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104bbf: 90 nop 80104bc0 : void syscall(void) { 80104bc0: 55 push %ebp 80104bc1: 89 e5 mov %esp,%ebp 80104bc3: 53 push %ebx 80104bc4: 83 ec 04 sub $0x4,%esp int num; struct proc *curproc = myproc(); 80104bc7: e8 04 ef ff ff call 80103ad0 80104bcc: 89 c3 mov %eax,%ebx num = curproc->tf->eax; 80104bce: 8b 40 18 mov 0x18(%eax),%eax 80104bd1: 8b 40 1c mov 0x1c(%eax),%eax if (num > 0 && num < NELEM(syscalls) && syscalls[num]) { 80104bd4: 8d 50 ff lea -0x1(%eax),%edx 80104bd7: 83 fa 17 cmp $0x17,%edx 80104bda: 77 24 ja 80104c00 80104bdc: 8b 14 85 a0 7a 10 80 mov -0x7fef8560(,%eax,4),%edx 80104be3: 85 d2 test %edx,%edx 80104be5: 74 19 je 80104c00 curproc->tf->eax = syscalls[num](); 80104be7: ff d2 call *%edx 80104be9: 89 c2 mov %eax,%edx 80104beb: 8b 43 18 mov 0x18(%ebx),%eax 80104bee: 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; } } 80104bf1: 8b 5d fc mov -0x4(%ebp),%ebx 80104bf4: c9 leave 80104bf5: c3 ret 80104bf6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104bfd: 8d 76 00 lea 0x0(%esi),%esi cprintf("%d %s: unknown sys call %d\n", 80104c00: 50 push %eax curproc->pid, curproc->name, num); 80104c01: 8d 43 6c lea 0x6c(%ebx),%eax cprintf("%d %s: unknown sys call %d\n", 80104c04: 50 push %eax 80104c05: ff 73 10 push 0x10(%ebx) 80104c08: 68 7d 7a 10 80 push $0x80107a7d 80104c0d: e8 9e ba ff ff call 801006b0 curproc->tf->eax = -1; 80104c12: 8b 43 18 mov 0x18(%ebx),%eax 80104c15: 83 c4 10 add $0x10,%esp 80104c18: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax) } 80104c1f: 8b 5d fc mov -0x4(%ebp),%ebx 80104c22: c9 leave 80104c23: c3 ret 80104c24: 66 90 xchg %ax,%ax 80104c26: 66 90 xchg %ax,%ax 80104c28: 66 90 xchg %ax,%ax 80104c2a: 66 90 xchg %ax,%ax 80104c2c: 66 90 xchg %ax,%ax 80104c2e: 66 90 xchg %ax,%ax 80104c30 : end_op(); return 0; } static struct inode* create(char *path, short type, short major, short minor) { 80104c30: 55 push %ebp 80104c31: 89 e5 mov %esp,%ebp 80104c33: 57 push %edi 80104c34: 56 push %esi struct inode *ip, *dp; char name[DIRSIZ]; if ((dp = nameiparent(path, name)) == 0) { 80104c35: 8d 7d da lea -0x26(%ebp),%edi static struct inode* create(char *path, short type, short major, short minor) { 80104c38: 53 push %ebx 80104c39: 83 ec 34 sub $0x34,%esp 80104c3c: 89 4d d0 mov %ecx,-0x30(%ebp) 80104c3f: 8b 4d 08 mov 0x8(%ebp),%ecx if ((dp = nameiparent(path, name)) == 0) { 80104c42: 57 push %edi 80104c43: 50 push %eax static struct inode* create(char *path, short type, short major, short minor) { 80104c44: 89 55 d4 mov %edx,-0x2c(%ebp) 80104c47: 89 4d cc mov %ecx,-0x34(%ebp) if ((dp = nameiparent(path, name)) == 0) { 80104c4a: e8 91 d5 ff ff call 801021e0 80104c4f: 83 c4 10 add $0x10,%esp 80104c52: 85 c0 test %eax,%eax 80104c54: 0f 84 46 01 00 00 je 80104da0 return 0; } ilock(dp); 80104c5a: 83 ec 0c sub $0xc,%esp 80104c5d: 89 c3 mov %eax,%ebx 80104c5f: 50 push %eax 80104c60: e8 3b cc ff ff call 801018a0 if ((ip = dirlookup(dp, name, 0)) != 0) { 80104c65: 83 c4 0c add $0xc,%esp 80104c68: 6a 00 push $0x0 80104c6a: 57 push %edi 80104c6b: 53 push %ebx 80104c6c: e8 8f d1 ff ff call 80101e00 80104c71: 83 c4 10 add $0x10,%esp 80104c74: 89 c6 mov %eax,%esi 80104c76: 85 c0 test %eax,%eax 80104c78: 74 56 je 80104cd0 iunlockput(dp); 80104c7a: 83 ec 0c sub $0xc,%esp 80104c7d: 53 push %ebx 80104c7e: e8 ad ce ff ff call 80101b30 ilock(ip); 80104c83: 89 34 24 mov %esi,(%esp) 80104c86: e8 15 cc ff ff call 801018a0 if (type == T_FILE && ip->type == T_FILE) { 80104c8b: 83 c4 10 add $0x10,%esp 80104c8e: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp) 80104c93: 75 1b jne 80104cb0 80104c95: 66 83 7e 50 02 cmpw $0x2,0x50(%esi) 80104c9a: 75 14 jne 80104cb0 } iunlockput(dp); return ip; } 80104c9c: 8d 65 f4 lea -0xc(%ebp),%esp 80104c9f: 89 f0 mov %esi,%eax 80104ca1: 5b pop %ebx 80104ca2: 5e pop %esi 80104ca3: 5f pop %edi 80104ca4: 5d pop %ebp 80104ca5: c3 ret 80104ca6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104cad: 8d 76 00 lea 0x0(%esi),%esi iunlockput(ip); 80104cb0: 83 ec 0c sub $0xc,%esp 80104cb3: 56 push %esi return 0; 80104cb4: 31 f6 xor %esi,%esi iunlockput(ip); 80104cb6: e8 75 ce ff ff call 80101b30 return 0; 80104cbb: 83 c4 10 add $0x10,%esp } 80104cbe: 8d 65 f4 lea -0xc(%ebp),%esp 80104cc1: 89 f0 mov %esi,%eax 80104cc3: 5b pop %ebx 80104cc4: 5e pop %esi 80104cc5: 5f pop %edi 80104cc6: 5d pop %ebp 80104cc7: c3 ret 80104cc8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104ccf: 90 nop if ((ip = ialloc(dp->dev, type)) == 0) { 80104cd0: 0f bf 45 d4 movswl -0x2c(%ebp),%eax 80104cd4: 83 ec 08 sub $0x8,%esp 80104cd7: 50 push %eax 80104cd8: ff 33 push (%ebx) 80104cda: e8 51 ca ff ff call 80101730 80104cdf: 83 c4 10 add $0x10,%esp 80104ce2: 89 c6 mov %eax,%esi 80104ce4: 85 c0 test %eax,%eax 80104ce6: 0f 84 cd 00 00 00 je 80104db9 ilock(ip); 80104cec: 83 ec 0c sub $0xc,%esp 80104cef: 50 push %eax 80104cf0: e8 ab cb ff ff call 801018a0 ip->major = major; 80104cf5: 0f b7 45 d0 movzwl -0x30(%ebp),%eax 80104cf9: 66 89 46 52 mov %ax,0x52(%esi) ip->minor = minor; 80104cfd: 0f b7 45 cc movzwl -0x34(%ebp),%eax 80104d01: 66 89 46 54 mov %ax,0x54(%esi) ip->nlink = 1; 80104d05: b8 01 00 00 00 mov $0x1,%eax 80104d0a: 66 89 46 56 mov %ax,0x56(%esi) iupdate(ip); 80104d0e: 89 34 24 mov %esi,(%esp) 80104d11: e8 da ca ff ff call 801017f0 if (type == T_DIR) { // Create . and .. entries. 80104d16: 83 c4 10 add $0x10,%esp 80104d19: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp) 80104d1e: 74 30 je 80104d50 if (dirlink(dp, name, ip->inum) < 0) { 80104d20: 83 ec 04 sub $0x4,%esp 80104d23: ff 76 04 push 0x4(%esi) 80104d26: 57 push %edi 80104d27: 53 push %ebx 80104d28: e8 d3 d3 ff ff call 80102100 80104d2d: 83 c4 10 add $0x10,%esp 80104d30: 85 c0 test %eax,%eax 80104d32: 78 78 js 80104dac iunlockput(dp); 80104d34: 83 ec 0c sub $0xc,%esp 80104d37: 53 push %ebx 80104d38: e8 f3 cd ff ff call 80101b30 return ip; 80104d3d: 83 c4 10 add $0x10,%esp } 80104d40: 8d 65 f4 lea -0xc(%ebp),%esp 80104d43: 89 f0 mov %esi,%eax 80104d45: 5b pop %ebx 80104d46: 5e pop %esi 80104d47: 5f pop %edi 80104d48: 5d pop %ebp 80104d49: c3 ret 80104d4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi iupdate(dp); 80104d50: 83 ec 0c sub $0xc,%esp dp->nlink++; // for ".." 80104d53: 66 83 43 56 01 addw $0x1,0x56(%ebx) iupdate(dp); 80104d58: 53 push %ebx 80104d59: e8 92 ca ff ff call 801017f0 if (dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) { 80104d5e: 83 c4 0c add $0xc,%esp 80104d61: ff 76 04 push 0x4(%esi) 80104d64: 68 20 7b 10 80 push $0x80107b20 80104d69: 56 push %esi 80104d6a: e8 91 d3 ff ff call 80102100 80104d6f: 83 c4 10 add $0x10,%esp 80104d72: 85 c0 test %eax,%eax 80104d74: 78 18 js 80104d8e 80104d76: 83 ec 04 sub $0x4,%esp 80104d79: ff 73 04 push 0x4(%ebx) 80104d7c: 68 1f 7b 10 80 push $0x80107b1f 80104d81: 56 push %esi 80104d82: e8 79 d3 ff ff call 80102100 80104d87: 83 c4 10 add $0x10,%esp 80104d8a: 85 c0 test %eax,%eax 80104d8c: 79 92 jns 80104d20 panic("create dots"); 80104d8e: 83 ec 0c sub $0xc,%esp 80104d91: 68 13 7b 10 80 push $0x80107b13 80104d96: e8 f5 b5 ff ff call 80100390 80104d9b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104d9f: 90 nop } 80104da0: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80104da3: 31 f6 xor %esi,%esi } 80104da5: 5b pop %ebx 80104da6: 89 f0 mov %esi,%eax 80104da8: 5e pop %esi 80104da9: 5f pop %edi 80104daa: 5d pop %ebp 80104dab: c3 ret panic("create: dirlink"); 80104dac: 83 ec 0c sub $0xc,%esp 80104daf: 68 22 7b 10 80 push $0x80107b22 80104db4: e8 d7 b5 ff ff call 80100390 panic("create: ialloc"); 80104db9: 83 ec 0c sub $0xc,%esp 80104dbc: 68 04 7b 10 80 push $0x80107b04 80104dc1: e8 ca b5 ff ff call 80100390 80104dc6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104dcd: 8d 76 00 lea 0x0(%esi),%esi 80104dd0 : int sys_dup(void) { 80104dd0: 55 push %ebp 80104dd1: 89 e5 mov %esp,%ebp 80104dd3: 56 push %esi 80104dd4: 53 push %ebx if (argint(n, &fd) < 0) { 80104dd5: 8d 45 f4 lea -0xc(%ebp),%eax int sys_dup(void) { 80104dd8: 83 ec 18 sub $0x18,%esp if (argint(n, &fd) < 0) { 80104ddb: 50 push %eax 80104ddc: 6a 00 push $0x0 80104dde: e8 9d fc ff ff call 80104a80 80104de3: 83 c4 10 add $0x10,%esp 80104de6: 85 c0 test %eax,%eax 80104de8: 78 36 js 80104e20 if (fd < 0 || fd >= NOFILE || (f = myproc()->ofile[fd]) == 0) { 80104dea: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 80104dee: 77 30 ja 80104e20 80104df0: e8 db ec ff ff call 80103ad0 80104df5: 8b 55 f4 mov -0xc(%ebp),%edx 80104df8: 8b 74 90 28 mov 0x28(%eax,%edx,4),%esi 80104dfc: 85 f6 test %esi,%esi 80104dfe: 74 20 je 80104e20 struct proc *curproc = myproc(); 80104e00: e8 cb ec ff ff call 80103ad0 for (fd = 0; fd < NOFILE; fd++) { 80104e05: 31 db xor %ebx,%ebx 80104e07: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104e0e: 66 90 xchg %ax,%ax if (curproc->ofile[fd] == 0) { 80104e10: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx 80104e14: 85 d2 test %edx,%edx 80104e16: 74 18 je 80104e30 for (fd = 0; fd < NOFILE; fd++) { 80104e18: 83 c3 01 add $0x1,%ebx 80104e1b: 83 fb 10 cmp $0x10,%ebx 80104e1e: 75 f0 jne 80104e10 } 80104e20: 8d 65 f8 lea -0x8(%ebp),%esp return -1; 80104e23: bb ff ff ff ff mov $0xffffffff,%ebx } 80104e28: 89 d8 mov %ebx,%eax 80104e2a: 5b pop %ebx 80104e2b: 5e pop %esi 80104e2c: 5d pop %ebp 80104e2d: c3 ret 80104e2e: 66 90 xchg %ax,%ax filedup(f); 80104e30: 83 ec 0c sub $0xc,%esp curproc->ofile[fd] = f; 80104e33: 89 74 98 28 mov %esi,0x28(%eax,%ebx,4) filedup(f); 80104e37: 56 push %esi 80104e38: e8 83 c1 ff ff call 80100fc0 return fd; 80104e3d: 83 c4 10 add $0x10,%esp } 80104e40: 8d 65 f8 lea -0x8(%ebp),%esp 80104e43: 89 d8 mov %ebx,%eax 80104e45: 5b pop %ebx 80104e46: 5e pop %esi 80104e47: 5d pop %ebp 80104e48: c3 ret 80104e49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104e50 : int sys_read(void) { 80104e50: 55 push %ebp 80104e51: 89 e5 mov %esp,%ebp 80104e53: 56 push %esi 80104e54: 53 push %ebx if (argint(n, &fd) < 0) { 80104e55: 8d 5d f4 lea -0xc(%ebp),%ebx int sys_read(void) { 80104e58: 83 ec 18 sub $0x18,%esp if (argint(n, &fd) < 0) { 80104e5b: 53 push %ebx 80104e5c: 6a 00 push $0x0 80104e5e: e8 1d fc ff ff call 80104a80 80104e63: 83 c4 10 add $0x10,%esp 80104e66: 85 c0 test %eax,%eax 80104e68: 78 5e js 80104ec8 if (fd < 0 || fd >= NOFILE || (f = myproc()->ofile[fd]) == 0) { 80104e6a: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 80104e6e: 77 58 ja 80104ec8 80104e70: e8 5b ec ff ff call 80103ad0 80104e75: 8b 55 f4 mov -0xc(%ebp),%edx 80104e78: 8b 74 90 28 mov 0x28(%eax,%edx,4),%esi 80104e7c: 85 f6 test %esi,%esi 80104e7e: 74 48 je 80104ec8 if (argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) { 80104e80: 83 ec 08 sub $0x8,%esp 80104e83: 8d 45 f0 lea -0x10(%ebp),%eax 80104e86: 50 push %eax 80104e87: 6a 02 push $0x2 80104e89: e8 f2 fb ff ff call 80104a80 80104e8e: 83 c4 10 add $0x10,%esp 80104e91: 85 c0 test %eax,%eax 80104e93: 78 33 js 80104ec8 80104e95: 83 ec 04 sub $0x4,%esp 80104e98: ff 75 f0 push -0x10(%ebp) 80104e9b: 53 push %ebx 80104e9c: 6a 01 push $0x1 80104e9e: e8 2d fc ff ff call 80104ad0 80104ea3: 83 c4 10 add $0x10,%esp 80104ea6: 85 c0 test %eax,%eax 80104ea8: 78 1e js 80104ec8 return fileread(f, p, n); 80104eaa: 83 ec 04 sub $0x4,%esp 80104ead: ff 75 f0 push -0x10(%ebp) 80104eb0: ff 75 f4 push -0xc(%ebp) 80104eb3: 56 push %esi 80104eb4: e8 87 c2 ff ff call 80101140 80104eb9: 83 c4 10 add $0x10,%esp } 80104ebc: 8d 65 f8 lea -0x8(%ebp),%esp 80104ebf: 5b pop %ebx 80104ec0: 5e pop %esi 80104ec1: 5d pop %ebp 80104ec2: c3 ret 80104ec3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104ec7: 90 nop return -1; 80104ec8: b8 ff ff ff ff mov $0xffffffff,%eax 80104ecd: eb ed jmp 80104ebc 80104ecf: 90 nop 80104ed0 : int sys_write(void) { 80104ed0: 55 push %ebp 80104ed1: 89 e5 mov %esp,%ebp 80104ed3: 56 push %esi 80104ed4: 53 push %ebx if (argint(n, &fd) < 0) { 80104ed5: 8d 5d f4 lea -0xc(%ebp),%ebx int sys_write(void) { 80104ed8: 83 ec 18 sub $0x18,%esp if (argint(n, &fd) < 0) { 80104edb: 53 push %ebx 80104edc: 6a 00 push $0x0 80104ede: e8 9d fb ff ff call 80104a80 80104ee3: 83 c4 10 add $0x10,%esp 80104ee6: 85 c0 test %eax,%eax 80104ee8: 78 5e js 80104f48 if (fd < 0 || fd >= NOFILE || (f = myproc()->ofile[fd]) == 0) { 80104eea: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 80104eee: 77 58 ja 80104f48 80104ef0: e8 db eb ff ff call 80103ad0 80104ef5: 8b 55 f4 mov -0xc(%ebp),%edx 80104ef8: 8b 74 90 28 mov 0x28(%eax,%edx,4),%esi 80104efc: 85 f6 test %esi,%esi 80104efe: 74 48 je 80104f48 if (argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) { 80104f00: 83 ec 08 sub $0x8,%esp 80104f03: 8d 45 f0 lea -0x10(%ebp),%eax 80104f06: 50 push %eax 80104f07: 6a 02 push $0x2 80104f09: e8 72 fb ff ff call 80104a80 80104f0e: 83 c4 10 add $0x10,%esp 80104f11: 85 c0 test %eax,%eax 80104f13: 78 33 js 80104f48 80104f15: 83 ec 04 sub $0x4,%esp 80104f18: ff 75 f0 push -0x10(%ebp) 80104f1b: 53 push %ebx 80104f1c: 6a 01 push $0x1 80104f1e: e8 ad fb ff ff call 80104ad0 80104f23: 83 c4 10 add $0x10,%esp 80104f26: 85 c0 test %eax,%eax 80104f28: 78 1e js 80104f48 return filewrite(f, p, n); 80104f2a: 83 ec 04 sub $0x4,%esp 80104f2d: ff 75 f0 push -0x10(%ebp) 80104f30: ff 75 f4 push -0xc(%ebp) 80104f33: 56 push %esi 80104f34: e8 97 c2 ff ff call 801011d0 80104f39: 83 c4 10 add $0x10,%esp } 80104f3c: 8d 65 f8 lea -0x8(%ebp),%esp 80104f3f: 5b pop %ebx 80104f40: 5e pop %esi 80104f41: 5d pop %ebp 80104f42: c3 ret 80104f43: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104f47: 90 nop return -1; 80104f48: b8 ff ff ff ff mov $0xffffffff,%eax 80104f4d: eb ed jmp 80104f3c 80104f4f: 90 nop 80104f50 : int sys_close(void) { 80104f50: 55 push %ebp 80104f51: 89 e5 mov %esp,%ebp 80104f53: 56 push %esi 80104f54: 53 push %ebx if (argint(n, &fd) < 0) { 80104f55: 8d 45 f4 lea -0xc(%ebp),%eax int sys_close(void) { 80104f58: 83 ec 18 sub $0x18,%esp if (argint(n, &fd) < 0) { 80104f5b: 50 push %eax 80104f5c: 6a 00 push $0x0 80104f5e: e8 1d fb ff ff call 80104a80 80104f63: 83 c4 10 add $0x10,%esp 80104f66: 85 c0 test %eax,%eax 80104f68: 78 3e js 80104fa8 if (fd < 0 || fd >= NOFILE || (f = myproc()->ofile[fd]) == 0) { 80104f6a: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 80104f6e: 77 38 ja 80104fa8 80104f70: e8 5b eb ff ff call 80103ad0 80104f75: 8b 55 f4 mov -0xc(%ebp),%edx 80104f78: 8d 5a 08 lea 0x8(%edx),%ebx 80104f7b: 8b 74 98 08 mov 0x8(%eax,%ebx,4),%esi 80104f7f: 85 f6 test %esi,%esi 80104f81: 74 25 je 80104fa8 myproc()->ofile[fd] = 0; 80104f83: e8 48 eb ff ff call 80103ad0 fileclose(f); 80104f88: 83 ec 0c sub $0xc,%esp myproc()->ofile[fd] = 0; 80104f8b: c7 44 98 08 00 00 00 movl $0x0,0x8(%eax,%ebx,4) 80104f92: 00 fileclose(f); 80104f93: 56 push %esi 80104f94: e8 77 c0 ff ff call 80101010 return 0; 80104f99: 83 c4 10 add $0x10,%esp 80104f9c: 31 c0 xor %eax,%eax } 80104f9e: 8d 65 f8 lea -0x8(%ebp),%esp 80104fa1: 5b pop %ebx 80104fa2: 5e pop %esi 80104fa3: 5d pop %ebp 80104fa4: c3 ret 80104fa5: 8d 76 00 lea 0x0(%esi),%esi return -1; 80104fa8: b8 ff ff ff ff mov $0xffffffff,%eax 80104fad: eb ef jmp 80104f9e 80104faf: 90 nop 80104fb0 : int sys_fstat(void) { 80104fb0: 55 push %ebp 80104fb1: 89 e5 mov %esp,%ebp 80104fb3: 56 push %esi 80104fb4: 53 push %ebx if (argint(n, &fd) < 0) { 80104fb5: 8d 5d f4 lea -0xc(%ebp),%ebx int sys_fstat(void) { 80104fb8: 83 ec 18 sub $0x18,%esp if (argint(n, &fd) < 0) { 80104fbb: 53 push %ebx 80104fbc: 6a 00 push $0x0 80104fbe: e8 bd fa ff ff call 80104a80 80104fc3: 83 c4 10 add $0x10,%esp 80104fc6: 85 c0 test %eax,%eax 80104fc8: 78 46 js 80105010 if (fd < 0 || fd >= NOFILE || (f = myproc()->ofile[fd]) == 0) { 80104fca: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 80104fce: 77 40 ja 80105010 80104fd0: e8 fb ea ff ff call 80103ad0 80104fd5: 8b 55 f4 mov -0xc(%ebp),%edx 80104fd8: 8b 74 90 28 mov 0x28(%eax,%edx,4),%esi 80104fdc: 85 f6 test %esi,%esi 80104fde: 74 30 je 80105010 if (argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) { 80104fe0: 83 ec 04 sub $0x4,%esp 80104fe3: 6a 14 push $0x14 80104fe5: 53 push %ebx 80104fe6: 6a 01 push $0x1 80104fe8: e8 e3 fa ff ff call 80104ad0 80104fed: 83 c4 10 add $0x10,%esp 80104ff0: 85 c0 test %eax,%eax 80104ff2: 78 1c js 80105010 return filestat(f, st); 80104ff4: 83 ec 08 sub $0x8,%esp 80104ff7: ff 75 f4 push -0xc(%ebp) 80104ffa: 56 push %esi 80104ffb: e8 f0 c0 ff ff call 801010f0 80105000: 83 c4 10 add $0x10,%esp } 80105003: 8d 65 f8 lea -0x8(%ebp),%esp 80105006: 5b pop %ebx 80105007: 5e pop %esi 80105008: 5d pop %ebp 80105009: c3 ret 8010500a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return -1; 80105010: b8 ff ff ff ff mov $0xffffffff,%eax 80105015: eb ec jmp 80105003 80105017: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010501e: 66 90 xchg %ax,%ax 80105020 : void cleanupsyslink(struct inode * ip) { 80105020: 55 push %ebp 80105021: 89 e5 mov %esp,%ebp 80105023: 53 push %ebx 80105024: 83 ec 10 sub $0x10,%esp 80105027: 8b 5d 08 mov 0x8(%ebp),%ebx ilock(ip); 8010502a: 53 push %ebx 8010502b: e8 70 c8 ff ff call 801018a0 ip->nlink--; 80105030: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); 80105035: 89 1c 24 mov %ebx,(%esp) 80105038: e8 b3 c7 ff ff call 801017f0 iunlockput(ip); 8010503d: 89 1c 24 mov %ebx,(%esp) 80105040: e8 eb ca ff ff call 80101b30 } 80105045: 8b 5d fc mov -0x4(%ebp),%ebx end_op(); 80105048: 83 c4 10 add $0x10,%esp } 8010504b: c9 leave end_op(); 8010504c: e9 9f de ff ff jmp 80102ef0 80105051: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105058: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010505f: 90 nop 80105060 : int sys_link(void) { 80105060: 55 push %ebp 80105061: 89 e5 mov %esp,%ebp 80105063: 57 push %edi 80105064: 56 push %esi if (argstr(0, &old) < 0 || argstr(1, &new) < 0) { 80105065: 8d 45 d4 lea -0x2c(%ebp),%eax int sys_link(void) { 80105068: 53 push %ebx 80105069: 83 ec 34 sub $0x34,%esp if (argstr(0, &old) < 0 || argstr(1, &new) < 0) { 8010506c: 50 push %eax 8010506d: 6a 00 push $0x0 8010506f: e8 cc fa ff ff call 80104b40 80105074: 83 c4 10 add $0x10,%esp 80105077: 85 c0 test %eax,%eax 80105079: 0f 88 ff 00 00 00 js 8010517e 8010507f: 83 ec 08 sub $0x8,%esp 80105082: 8d 45 d0 lea -0x30(%ebp),%eax 80105085: 50 push %eax 80105086: 6a 01 push $0x1 80105088: e8 b3 fa ff ff call 80104b40 8010508d: 83 c4 10 add $0x10,%esp 80105090: 85 c0 test %eax,%eax 80105092: 0f 88 e6 00 00 00 js 8010517e begin_op(); 80105098: e8 e3 dd ff ff call 80102e80 if ((ip = namei(old)) == 0) { 8010509d: 83 ec 0c sub $0xc,%esp 801050a0: ff 75 d4 push -0x2c(%ebp) 801050a3: e8 18 d1 ff ff call 801021c0 801050a8: 83 c4 10 add $0x10,%esp 801050ab: 89 c3 mov %eax,%ebx 801050ad: 85 c0 test %eax,%eax 801050af: 0f 84 e8 00 00 00 je 8010519d ilock(ip); 801050b5: 83 ec 0c sub $0xc,%esp 801050b8: 50 push %eax 801050b9: e8 e2 c7 ff ff call 801018a0 if (ip->type == T_DIR) { 801050be: 83 c4 10 add $0x10,%esp 801050c1: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 801050c6: 0f 84 b9 00 00 00 je 80105185 iupdate(ip); 801050cc: 83 ec 0c sub $0xc,%esp ip->nlink++; 801050cf: 66 83 43 56 01 addw $0x1,0x56(%ebx) if ((dp = nameiparent(new, name)) == 0) { 801050d4: 8d 7d da lea -0x26(%ebp),%edi iupdate(ip); 801050d7: 53 push %ebx 801050d8: e8 13 c7 ff ff call 801017f0 iunlock(ip); 801050dd: 89 1c 24 mov %ebx,(%esp) 801050e0: e8 9b c8 ff ff call 80101980 if ((dp = nameiparent(new, name)) == 0) { 801050e5: 58 pop %eax 801050e6: 5a pop %edx 801050e7: 57 push %edi 801050e8: ff 75 d0 push -0x30(%ebp) 801050eb: e8 f0 d0 ff ff call 801021e0 801050f0: 83 c4 10 add $0x10,%esp 801050f3: 89 c6 mov %eax,%esi 801050f5: 85 c0 test %eax,%eax 801050f7: 0f 84 ac 00 00 00 je 801051a9 ilock(dp); 801050fd: 83 ec 0c sub $0xc,%esp 80105100: 50 push %eax 80105101: e8 9a c7 ff ff call 801018a0 if (dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0) { 80105106: 8b 03 mov (%ebx),%eax 80105108: 83 c4 10 add $0x10,%esp 8010510b: 39 06 cmp %eax,(%esi) 8010510d: 75 41 jne 80105150 8010510f: 83 ec 04 sub $0x4,%esp 80105112: ff 73 04 push 0x4(%ebx) 80105115: 57 push %edi 80105116: 56 push %esi 80105117: e8 e4 cf ff ff call 80102100 8010511c: 83 c4 10 add $0x10,%esp 8010511f: 85 c0 test %eax,%eax 80105121: 78 2d js 80105150 iunlockput(dp); 80105123: 83 ec 0c sub $0xc,%esp 80105126: 56 push %esi 80105127: e8 04 ca ff ff call 80101b30 iput(ip); 8010512c: 89 1c 24 mov %ebx,(%esp) 8010512f: e8 9c c8 ff ff call 801019d0 end_op(); 80105134: e8 b7 dd ff ff call 80102ef0 return 0; 80105139: 83 c4 10 add $0x10,%esp 8010513c: 31 c0 xor %eax,%eax } 8010513e: 8d 65 f4 lea -0xc(%ebp),%esp 80105141: 5b pop %ebx 80105142: 5e pop %esi 80105143: 5f pop %edi 80105144: 5d pop %ebp 80105145: c3 ret 80105146: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010514d: 8d 76 00 lea 0x0(%esi),%esi iunlockput(dp); 80105150: 83 ec 0c sub $0xc,%esp 80105153: 56 push %esi 80105154: e8 d7 c9 ff ff call 80101b30 ilock(ip); 80105159: 89 1c 24 mov %ebx,(%esp) 8010515c: e8 3f c7 ff ff call 801018a0 ip->nlink--; 80105161: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); 80105166: 89 1c 24 mov %ebx,(%esp) 80105169: e8 82 c6 ff ff call 801017f0 iunlockput(ip); 8010516e: 89 1c 24 mov %ebx,(%esp) 80105171: e8 ba c9 ff ff call 80101b30 end_op(); 80105176: e8 75 dd ff ff call 80102ef0 } 8010517b: 83 c4 10 add $0x10,%esp return -1; 8010517e: b8 ff ff ff ff mov $0xffffffff,%eax } 80105183: eb b9 jmp 8010513e iunlockput(ip); 80105185: 83 ec 0c sub $0xc,%esp 80105188: 53 push %ebx 80105189: e8 a2 c9 ff ff call 80101b30 end_op(); 8010518e: e8 5d dd ff ff call 80102ef0 return -1; 80105193: 83 c4 10 add $0x10,%esp 80105196: b8 ff ff ff ff mov $0xffffffff,%eax 8010519b: eb a1 jmp 8010513e end_op(); 8010519d: e8 4e dd ff ff call 80102ef0 return -1; 801051a2: b8 ff ff ff ff mov $0xffffffff,%eax 801051a7: eb 95 jmp 8010513e ilock(ip); 801051a9: 83 ec 0c sub $0xc,%esp 801051ac: 53 push %ebx 801051ad: eb ad jmp 8010515c 801051af: 90 nop 801051b0 : int sys_unlink(void) { 801051b0: 55 push %ebp 801051b1: 89 e5 mov %esp,%ebp 801051b3: 57 push %edi 801051b4: 56 push %esi if (argstr(0, &path) < 0) { 801051b5: 8d 45 c0 lea -0x40(%ebp),%eax int sys_unlink(void) { 801051b8: 53 push %ebx 801051b9: 83 ec 54 sub $0x54,%esp if (argstr(0, &path) < 0) { 801051bc: 50 push %eax 801051bd: 6a 00 push $0x0 801051bf: e8 7c f9 ff ff call 80104b40 801051c4: 83 c4 10 add $0x10,%esp 801051c7: 85 c0 test %eax,%eax 801051c9: 0f 88 4c 01 00 00 js 8010531b begin_op(); 801051cf: e8 ac dc ff ff call 80102e80 if ((dp = nameiparent(path, name)) == 0) { 801051d4: 8d 5d ca lea -0x36(%ebp),%ebx 801051d7: 83 ec 08 sub $0x8,%esp 801051da: 53 push %ebx 801051db: ff 75 c0 push -0x40(%ebp) 801051de: e8 fd cf ff ff call 801021e0 801051e3: 83 c4 10 add $0x10,%esp 801051e6: 89 45 b4 mov %eax,-0x4c(%ebp) 801051e9: 85 c0 test %eax,%eax 801051eb: 0f 84 55 01 00 00 je 80105346 ilock(dp); 801051f1: 83 ec 0c sub $0xc,%esp 801051f4: ff 75 b4 push -0x4c(%ebp) 801051f7: e8 a4 c6 ff ff call 801018a0 if (namecmp(name, ".") == 0 || namecmp(name, "..") == 0) { 801051fc: 5a pop %edx 801051fd: 59 pop %ecx 801051fe: 68 20 7b 10 80 push $0x80107b20 80105203: 53 push %ebx 80105204: e8 d7 cb ff ff call 80101de0 80105209: 83 c4 10 add $0x10,%esp 8010520c: 85 c0 test %eax,%eax 8010520e: 0f 84 2d 01 00 00 je 80105341 80105214: 83 ec 08 sub $0x8,%esp 80105217: 68 1f 7b 10 80 push $0x80107b1f 8010521c: 53 push %ebx 8010521d: e8 be cb ff ff call 80101de0 80105222: 83 c4 10 add $0x10,%esp 80105225: 85 c0 test %eax,%eax 80105227: 0f 84 14 01 00 00 je 80105341 if ((ip = dirlookup(dp, name, &off)) == 0) { 8010522d: 83 ec 04 sub $0x4,%esp 80105230: 8d 45 c4 lea -0x3c(%ebp),%eax 80105233: 50 push %eax 80105234: 53 push %ebx 80105235: ff 75 b4 push -0x4c(%ebp) 80105238: e8 c3 cb ff ff call 80101e00 8010523d: 83 c4 10 add $0x10,%esp 80105240: 89 c3 mov %eax,%ebx 80105242: 85 c0 test %eax,%eax 80105244: 0f 84 f7 00 00 00 je 80105341 ilock(ip); 8010524a: 83 ec 0c sub $0xc,%esp 8010524d: 50 push %eax 8010524e: e8 4d c6 ff ff call 801018a0 if (ip->nlink < 1) { 80105253: 83 c4 10 add $0x10,%esp 80105256: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) 8010525b: 0f 8e 01 01 00 00 jle 80105362 if (ip->type == T_DIR && !isdirempty(ip)) { 80105261: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80105266: 8d 7d d8 lea -0x28(%ebp),%edi 80105269: 74 65 je 801052d0 memset(&de, 0, sizeof(de)); 8010526b: 83 ec 04 sub $0x4,%esp 8010526e: 6a 10 push $0x10 80105270: 6a 00 push $0x0 80105272: 57 push %edi 80105273: e8 48 f5 ff ff call 801047c0 if (writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 80105278: 6a 10 push $0x10 8010527a: ff 75 c4 push -0x3c(%ebp) 8010527d: 57 push %edi 8010527e: ff 75 b4 push -0x4c(%ebp) 80105281: e8 2a ca ff ff call 80101cb0 80105286: 83 c4 20 add $0x20,%esp 80105289: 83 f8 10 cmp $0x10,%eax 8010528c: 0f 85 dd 00 00 00 jne 8010536f if (ip->type == T_DIR) { 80105292: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80105297: 0f 84 8b 00 00 00 je 80105328 iunlockput(dp); 8010529d: 83 ec 0c sub $0xc,%esp 801052a0: ff 75 b4 push -0x4c(%ebp) 801052a3: e8 88 c8 ff ff call 80101b30 ip->nlink--; 801052a8: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); 801052ad: 89 1c 24 mov %ebx,(%esp) 801052b0: e8 3b c5 ff ff call 801017f0 iunlockput(ip); 801052b5: 89 1c 24 mov %ebx,(%esp) 801052b8: e8 73 c8 ff ff call 80101b30 end_op(); 801052bd: e8 2e dc ff ff call 80102ef0 return 0; 801052c2: 83 c4 10 add $0x10,%esp 801052c5: 31 c0 xor %eax,%eax } 801052c7: 8d 65 f4 lea -0xc(%ebp),%esp 801052ca: 5b pop %ebx 801052cb: 5e pop %esi 801052cc: 5f pop %edi 801052cd: 5d pop %ebp 801052ce: c3 ret 801052cf: 90 nop for (off = 2 * sizeof(de); off < dp->size; off += sizeof(de)) { 801052d0: 83 7b 58 20 cmpl $0x20,0x58(%ebx) 801052d4: 76 95 jbe 8010526b 801052d6: be 20 00 00 00 mov $0x20,%esi 801052db: eb 0b jmp 801052e8 801052dd: 8d 76 00 lea 0x0(%esi),%esi 801052e0: 83 c6 10 add $0x10,%esi 801052e3: 39 73 58 cmp %esi,0x58(%ebx) 801052e6: 76 83 jbe 8010526b if (readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 801052e8: 6a 10 push $0x10 801052ea: 56 push %esi 801052eb: 57 push %edi 801052ec: 53 push %ebx 801052ed: e8 be c8 ff ff call 80101bb0 801052f2: 83 c4 10 add $0x10,%esp 801052f5: 83 f8 10 cmp $0x10,%eax 801052f8: 75 5b jne 80105355 if (de.inum != 0) { 801052fa: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 801052ff: 74 df je 801052e0 iunlockput(ip); 80105301: 83 ec 0c sub $0xc,%esp 80105304: 53 push %ebx 80105305: e8 26 c8 ff ff call 80101b30 iunlockput(dp); 8010530a: 58 pop %eax 8010530b: ff 75 b4 push -0x4c(%ebp) 8010530e: e8 1d c8 ff ff call 80101b30 end_op(); 80105313: e8 d8 db ff ff call 80102ef0 return -1; 80105318: 83 c4 10 add $0x10,%esp 8010531b: b8 ff ff ff ff mov $0xffffffff,%eax 80105320: eb a5 jmp 801052c7 80105322: 8d b6 00 00 00 00 lea 0x0(%esi),%esi dp->nlink--; 80105328: 8b 45 b4 mov -0x4c(%ebp),%eax iupdate(dp); 8010532b: 83 ec 0c sub $0xc,%esp dp->nlink--; 8010532e: 66 83 68 56 01 subw $0x1,0x56(%eax) iupdate(dp); 80105333: 50 push %eax 80105334: e8 b7 c4 ff ff call 801017f0 80105339: 83 c4 10 add $0x10,%esp 8010533c: e9 5c ff ff ff jmp 8010529d iunlockput(dp); 80105341: 83 ec 0c sub $0xc,%esp 80105344: eb c5 jmp 8010530b end_op(); 80105346: e8 a5 db ff ff call 80102ef0 return -1; 8010534b: b8 ff ff ff ff mov $0xffffffff,%eax 80105350: e9 72 ff ff ff jmp 801052c7 panic("isdirempty: readi"); 80105355: 83 ec 0c sub $0xc,%esp 80105358: 68 44 7b 10 80 push $0x80107b44 8010535d: e8 2e b0 ff ff call 80100390 panic("unlink: nlink < 1"); 80105362: 83 ec 0c sub $0xc,%esp 80105365: 68 32 7b 10 80 push $0x80107b32 8010536a: e8 21 b0 ff ff call 80100390 panic("unlink: writei"); 8010536f: 83 ec 0c sub $0xc,%esp 80105372: 68 56 7b 10 80 push $0x80107b56 80105377: e8 14 b0 ff ff call 80100390 8010537c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105380 : int sys_open(void) { 80105380: 55 push %ebp 80105381: 89 e5 mov %esp,%ebp 80105383: 57 push %edi 80105384: 56 push %esi char *path; int fd, omode; struct file *f; struct inode *ip; if (argstr(0, &path) < 0 || argint(1, &omode) < 0) { 80105385: 8d 45 e0 lea -0x20(%ebp),%eax int sys_open(void) { 80105388: 53 push %ebx 80105389: 83 ec 24 sub $0x24,%esp if (argstr(0, &path) < 0 || argint(1, &omode) < 0) { 8010538c: 50 push %eax 8010538d: 6a 00 push $0x0 8010538f: e8 ac f7 ff ff call 80104b40 80105394: 83 c4 10 add $0x10,%esp 80105397: 85 c0 test %eax,%eax 80105399: 0f 88 8e 00 00 00 js 8010542d 8010539f: 83 ec 08 sub $0x8,%esp 801053a2: 8d 45 e4 lea -0x1c(%ebp),%eax 801053a5: 50 push %eax 801053a6: 6a 01 push $0x1 801053a8: e8 d3 f6 ff ff call 80104a80 801053ad: 83 c4 10 add $0x10,%esp 801053b0: 85 c0 test %eax,%eax 801053b2: 78 79 js 8010542d return -1; } begin_op(); 801053b4: e8 c7 da ff ff call 80102e80 if (omode & O_CREATE) { 801053b9: f6 45 e5 02 testb $0x2,-0x1b(%ebp) 801053bd: 75 79 jne 80105438 end_op(); return -1; } } else { if ((ip = namei(path)) == 0) { 801053bf: 83 ec 0c sub $0xc,%esp 801053c2: ff 75 e0 push -0x20(%ebp) 801053c5: e8 f6 cd ff ff call 801021c0 801053ca: 83 c4 10 add $0x10,%esp 801053cd: 89 c6 mov %eax,%esi 801053cf: 85 c0 test %eax,%eax 801053d1: 0f 84 7e 00 00 00 je 80105455 end_op(); return -1; } ilock(ip); 801053d7: 83 ec 0c sub $0xc,%esp 801053da: 50 push %eax 801053db: e8 c0 c4 ff ff call 801018a0 if (ip->type == T_DIR && omode != O_RDONLY) { 801053e0: 83 c4 10 add $0x10,%esp 801053e3: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) 801053e8: 0f 84 c2 00 00 00 je 801054b0 end_op(); return -1; } } if ((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0) { 801053ee: e8 5d bb ff ff call 80100f50 801053f3: 89 c7 mov %eax,%edi 801053f5: 85 c0 test %eax,%eax 801053f7: 74 23 je 8010541c struct proc *curproc = myproc(); 801053f9: e8 d2 e6 ff ff call 80103ad0 for (fd = 0; fd < NOFILE; fd++) { 801053fe: 31 db xor %ebx,%ebx if (curproc->ofile[fd] == 0) { 80105400: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx 80105404: 85 d2 test %edx,%edx 80105406: 74 60 je 80105468 for (fd = 0; fd < NOFILE; fd++) { 80105408: 83 c3 01 add $0x1,%ebx 8010540b: 83 fb 10 cmp $0x10,%ebx 8010540e: 75 f0 jne 80105400 if (f) { fileclose(f); 80105410: 83 ec 0c sub $0xc,%esp 80105413: 57 push %edi 80105414: e8 f7 bb ff ff call 80101010 80105419: 83 c4 10 add $0x10,%esp } iunlockput(ip); 8010541c: 83 ec 0c sub $0xc,%esp 8010541f: 56 push %esi 80105420: e8 0b c7 ff ff call 80101b30 end_op(); 80105425: e8 c6 da ff ff call 80102ef0 return -1; 8010542a: 83 c4 10 add $0x10,%esp 8010542d: bb ff ff ff ff mov $0xffffffff,%ebx 80105432: eb 6d jmp 801054a1 80105434: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ip = create(path, T_FILE, 0, 0); 80105438: 83 ec 0c sub $0xc,%esp 8010543b: 8b 45 e0 mov -0x20(%ebp),%eax 8010543e: 31 c9 xor %ecx,%ecx 80105440: ba 02 00 00 00 mov $0x2,%edx 80105445: 6a 00 push $0x0 80105447: e8 e4 f7 ff ff call 80104c30 if (ip == 0) { 8010544c: 83 c4 10 add $0x10,%esp ip = create(path, T_FILE, 0, 0); 8010544f: 89 c6 mov %eax,%esi if (ip == 0) { 80105451: 85 c0 test %eax,%eax 80105453: 75 99 jne 801053ee end_op(); 80105455: e8 96 da ff ff call 80102ef0 return -1; 8010545a: bb ff ff ff ff mov $0xffffffff,%ebx 8010545f: eb 40 jmp 801054a1 80105461: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } iunlock(ip); 80105468: 83 ec 0c sub $0xc,%esp curproc->ofile[fd] = f; 8010546b: 89 7c 98 28 mov %edi,0x28(%eax,%ebx,4) iunlock(ip); 8010546f: 56 push %esi 80105470: e8 0b c5 ff ff call 80101980 end_op(); 80105475: e8 76 da ff ff call 80102ef0 f->type = FD_INODE; 8010547a: c7 07 02 00 00 00 movl $0x2,(%edi) f->ip = ip; f->off = 0; f->readable = !(omode & O_WRONLY); 80105480: 8b 55 e4 mov -0x1c(%ebp),%edx f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 80105483: 83 c4 10 add $0x10,%esp f->ip = ip; 80105486: 89 77 10 mov %esi,0x10(%edi) f->readable = !(omode & O_WRONLY); 80105489: 89 d0 mov %edx,%eax f->off = 0; 8010548b: c7 47 14 00 00 00 00 movl $0x0,0x14(%edi) f->readable = !(omode & O_WRONLY); 80105492: f7 d0 not %eax 80105494: 83 e0 01 and $0x1,%eax f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 80105497: 83 e2 03 and $0x3,%edx f->readable = !(omode & O_WRONLY); 8010549a: 88 47 08 mov %al,0x8(%edi) f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 8010549d: 0f 95 47 09 setne 0x9(%edi) return fd; } 801054a1: 8d 65 f4 lea -0xc(%ebp),%esp 801054a4: 89 d8 mov %ebx,%eax 801054a6: 5b pop %ebx 801054a7: 5e pop %esi 801054a8: 5f pop %edi 801054a9: 5d pop %ebp 801054aa: c3 ret 801054ab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801054af: 90 nop if (ip->type == T_DIR && omode != O_RDONLY) { 801054b0: 8b 4d e4 mov -0x1c(%ebp),%ecx 801054b3: 85 c9 test %ecx,%ecx 801054b5: 0f 84 33 ff ff ff je 801053ee 801054bb: e9 5c ff ff ff jmp 8010541c 801054c0 : int sys_mkdir(void) { 801054c0: 55 push %ebp 801054c1: 89 e5 mov %esp,%ebp 801054c3: 83 ec 18 sub $0x18,%esp char *path; struct inode *ip; begin_op(); 801054c6: e8 b5 d9 ff ff call 80102e80 if (argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0) { 801054cb: 83 ec 08 sub $0x8,%esp 801054ce: 8d 45 f4 lea -0xc(%ebp),%eax 801054d1: 50 push %eax 801054d2: 6a 00 push $0x0 801054d4: e8 67 f6 ff ff call 80104b40 801054d9: 83 c4 10 add $0x10,%esp 801054dc: 85 c0 test %eax,%eax 801054de: 78 30 js 80105510 801054e0: 83 ec 0c sub $0xc,%esp 801054e3: 8b 45 f4 mov -0xc(%ebp),%eax 801054e6: 31 c9 xor %ecx,%ecx 801054e8: ba 01 00 00 00 mov $0x1,%edx 801054ed: 6a 00 push $0x0 801054ef: e8 3c f7 ff ff call 80104c30 801054f4: 83 c4 10 add $0x10,%esp 801054f7: 85 c0 test %eax,%eax 801054f9: 74 15 je 80105510 end_op(); return -1; } iunlockput(ip); 801054fb: 83 ec 0c sub $0xc,%esp 801054fe: 50 push %eax 801054ff: e8 2c c6 ff ff call 80101b30 end_op(); 80105504: e8 e7 d9 ff ff call 80102ef0 return 0; 80105509: 83 c4 10 add $0x10,%esp 8010550c: 31 c0 xor %eax,%eax } 8010550e: c9 leave 8010550f: c3 ret end_op(); 80105510: e8 db d9 ff ff call 80102ef0 return -1; 80105515: b8 ff ff ff ff mov $0xffffffff,%eax } 8010551a: c9 leave 8010551b: c3 ret 8010551c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105520 : int sys_mknod(void) { 80105520: 55 push %ebp 80105521: 89 e5 mov %esp,%ebp 80105523: 83 ec 18 sub $0x18,%esp struct inode *ip; char *path; int major, minor; begin_op(); 80105526: e8 55 d9 ff ff call 80102e80 if ((argstr(0, &path)) < 0 || 8010552b: 83 ec 08 sub $0x8,%esp 8010552e: 8d 45 ec lea -0x14(%ebp),%eax 80105531: 50 push %eax 80105532: 6a 00 push $0x0 80105534: e8 07 f6 ff ff call 80104b40 80105539: 83 c4 10 add $0x10,%esp 8010553c: 85 c0 test %eax,%eax 8010553e: 78 60 js 801055a0 argint(1, &major) < 0 || 80105540: 83 ec 08 sub $0x8,%esp 80105543: 8d 45 f0 lea -0x10(%ebp),%eax 80105546: 50 push %eax 80105547: 6a 01 push $0x1 80105549: e8 32 f5 ff ff call 80104a80 if ((argstr(0, &path)) < 0 || 8010554e: 83 c4 10 add $0x10,%esp 80105551: 85 c0 test %eax,%eax 80105553: 78 4b js 801055a0 argint(2, &minor) < 0 || 80105555: 83 ec 08 sub $0x8,%esp 80105558: 8d 45 f4 lea -0xc(%ebp),%eax 8010555b: 50 push %eax 8010555c: 6a 02 push $0x2 8010555e: e8 1d f5 ff ff call 80104a80 argint(1, &major) < 0 || 80105563: 83 c4 10 add $0x10,%esp 80105566: 85 c0 test %eax,%eax 80105568: 78 36 js 801055a0 (ip = create(path, T_DEV, major, minor)) == 0) { 8010556a: 0f bf 45 f4 movswl -0xc(%ebp),%eax 8010556e: 83 ec 0c sub $0xc,%esp 80105571: 0f bf 4d f0 movswl -0x10(%ebp),%ecx 80105575: ba 03 00 00 00 mov $0x3,%edx 8010557a: 50 push %eax 8010557b: 8b 45 ec mov -0x14(%ebp),%eax 8010557e: e8 ad f6 ff ff call 80104c30 argint(2, &minor) < 0 || 80105583: 83 c4 10 add $0x10,%esp 80105586: 85 c0 test %eax,%eax 80105588: 74 16 je 801055a0 end_op(); return -1; } iunlockput(ip); 8010558a: 83 ec 0c sub $0xc,%esp 8010558d: 50 push %eax 8010558e: e8 9d c5 ff ff call 80101b30 end_op(); 80105593: e8 58 d9 ff ff call 80102ef0 return 0; 80105598: 83 c4 10 add $0x10,%esp 8010559b: 31 c0 xor %eax,%eax } 8010559d: c9 leave 8010559e: c3 ret 8010559f: 90 nop end_op(); 801055a0: e8 4b d9 ff ff call 80102ef0 return -1; 801055a5: b8 ff ff ff ff mov $0xffffffff,%eax } 801055aa: c9 leave 801055ab: c3 ret 801055ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801055b0 : int sys_chdir(void) { 801055b0: 55 push %ebp 801055b1: 89 e5 mov %esp,%ebp 801055b3: 56 push %esi 801055b4: 53 push %ebx 801055b5: 83 ec 10 sub $0x10,%esp char *path; struct inode *ip; struct proc *curproc = myproc(); 801055b8: e8 13 e5 ff ff call 80103ad0 801055bd: 89 c6 mov %eax,%esi begin_op(); 801055bf: e8 bc d8 ff ff call 80102e80 if (argstr(0, &path) < 0 || (ip = namei(path)) == 0) { 801055c4: 83 ec 08 sub $0x8,%esp 801055c7: 8d 45 f4 lea -0xc(%ebp),%eax 801055ca: 50 push %eax 801055cb: 6a 00 push $0x0 801055cd: e8 6e f5 ff ff call 80104b40 801055d2: 83 c4 10 add $0x10,%esp 801055d5: 85 c0 test %eax,%eax 801055d7: 78 77 js 80105650 801055d9: 83 ec 0c sub $0xc,%esp 801055dc: ff 75 f4 push -0xc(%ebp) 801055df: e8 dc cb ff ff call 801021c0 801055e4: 83 c4 10 add $0x10,%esp 801055e7: 89 c3 mov %eax,%ebx 801055e9: 85 c0 test %eax,%eax 801055eb: 74 63 je 80105650 end_op(); return -1; } ilock(ip); 801055ed: 83 ec 0c sub $0xc,%esp 801055f0: 50 push %eax 801055f1: e8 aa c2 ff ff call 801018a0 if (ip->type != T_DIR) { 801055f6: 83 c4 10 add $0x10,%esp 801055f9: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 801055fe: 75 30 jne 80105630 iunlockput(ip); end_op(); return -1; } iunlock(ip); 80105600: 83 ec 0c sub $0xc,%esp 80105603: 53 push %ebx 80105604: e8 77 c3 ff ff call 80101980 iput(curproc->cwd); 80105609: 58 pop %eax 8010560a: ff 76 68 push 0x68(%esi) 8010560d: e8 be c3 ff ff call 801019d0 end_op(); 80105612: e8 d9 d8 ff ff call 80102ef0 curproc->cwd = ip; 80105617: 89 5e 68 mov %ebx,0x68(%esi) return 0; 8010561a: 83 c4 10 add $0x10,%esp 8010561d: 31 c0 xor %eax,%eax } 8010561f: 8d 65 f8 lea -0x8(%ebp),%esp 80105622: 5b pop %ebx 80105623: 5e pop %esi 80105624: 5d pop %ebp 80105625: c3 ret 80105626: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010562d: 8d 76 00 lea 0x0(%esi),%esi iunlockput(ip); 80105630: 83 ec 0c sub $0xc,%esp 80105633: 53 push %ebx 80105634: e8 f7 c4 ff ff call 80101b30 end_op(); 80105639: e8 b2 d8 ff ff call 80102ef0 return -1; 8010563e: 83 c4 10 add $0x10,%esp 80105641: b8 ff ff ff ff mov $0xffffffff,%eax 80105646: eb d7 jmp 8010561f 80105648: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010564f: 90 nop end_op(); 80105650: e8 9b d8 ff ff call 80102ef0 return -1; 80105655: b8 ff ff ff ff mov $0xffffffff,%eax 8010565a: eb c3 jmp 8010561f 8010565c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105660 : int sys_exec(void) { 80105660: 55 push %ebp 80105661: 89 e5 mov %esp,%ebp 80105663: 57 push %edi 80105664: 56 push %esi char *path, *argv[MAXARG]; int i; uint uargv, uarg; if (argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0) { 80105665: 8d 85 5c ff ff ff lea -0xa4(%ebp),%eax int sys_exec(void) { 8010566b: 53 push %ebx 8010566c: 81 ec a4 00 00 00 sub $0xa4,%esp if (argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0) { 80105672: 50 push %eax 80105673: 6a 00 push $0x0 80105675: e8 c6 f4 ff ff call 80104b40 8010567a: 83 c4 10 add $0x10,%esp 8010567d: 85 c0 test %eax,%eax 8010567f: 0f 88 87 00 00 00 js 8010570c 80105685: 83 ec 08 sub $0x8,%esp 80105688: 8d 85 60 ff ff ff lea -0xa0(%ebp),%eax 8010568e: 50 push %eax 8010568f: 6a 01 push $0x1 80105691: e8 ea f3 ff ff call 80104a80 80105696: 83 c4 10 add $0x10,%esp 80105699: 85 c0 test %eax,%eax 8010569b: 78 6f js 8010570c return -1; } memset(argv, 0, sizeof(argv)); 8010569d: 83 ec 04 sub $0x4,%esp 801056a0: 8d b5 68 ff ff ff lea -0x98(%ebp),%esi for (i = 0;; i++) { 801056a6: 31 db xor %ebx,%ebx memset(argv, 0, sizeof(argv)); 801056a8: 68 80 00 00 00 push $0x80 801056ad: 6a 00 push $0x0 801056af: 56 push %esi 801056b0: e8 0b f1 ff ff call 801047c0 801056b5: 83 c4 10 add $0x10,%esp 801056b8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801056bf: 90 nop if (i >= NELEM(argv)) { return -1; } if (fetchint(uargv + 4 * i, (int*)&uarg) < 0) { 801056c0: 83 ec 08 sub $0x8,%esp 801056c3: 8d 85 64 ff ff ff lea -0x9c(%ebp),%eax 801056c9: 8d 3c 9d 00 00 00 00 lea 0x0(,%ebx,4),%edi 801056d0: 50 push %eax 801056d1: 8b 85 60 ff ff ff mov -0xa0(%ebp),%eax 801056d7: 01 f8 add %edi,%eax 801056d9: 50 push %eax 801056da: e8 11 f3 ff ff call 801049f0 801056df: 83 c4 10 add $0x10,%esp 801056e2: 85 c0 test %eax,%eax 801056e4: 78 26 js 8010570c return -1; } if (uarg == 0) { 801056e6: 8b 85 64 ff ff ff mov -0x9c(%ebp),%eax 801056ec: 85 c0 test %eax,%eax 801056ee: 74 30 je 80105720 argv[i] = 0; break; } if (fetchstr(uarg, &argv[i]) < 0) { 801056f0: 83 ec 08 sub $0x8,%esp 801056f3: 8d 14 3e lea (%esi,%edi,1),%edx 801056f6: 52 push %edx 801056f7: 50 push %eax 801056f8: e8 33 f3 ff ff call 80104a30 801056fd: 83 c4 10 add $0x10,%esp 80105700: 85 c0 test %eax,%eax 80105702: 78 08 js 8010570c for (i = 0;; i++) { 80105704: 83 c3 01 add $0x1,%ebx if (i >= NELEM(argv)) { 80105707: 83 fb 20 cmp $0x20,%ebx 8010570a: 75 b4 jne 801056c0 return -1; } } return exec(path, argv); } 8010570c: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 8010570f: b8 ff ff ff ff mov $0xffffffff,%eax } 80105714: 5b pop %ebx 80105715: 5e pop %esi 80105716: 5f pop %edi 80105717: 5d pop %ebp 80105718: c3 ret 80105719: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi argv[i] = 0; 80105720: c7 84 9d 68 ff ff ff movl $0x0,-0x98(%ebp,%ebx,4) 80105727: 00 00 00 00 return exec(path, argv); 8010572b: 83 ec 08 sub $0x8,%esp 8010572e: 56 push %esi 8010572f: ff b5 5c ff ff ff push -0xa4(%ebp) 80105735: e8 36 b4 ff ff call 80100b70 8010573a: 83 c4 10 add $0x10,%esp } 8010573d: 8d 65 f4 lea -0xc(%ebp),%esp 80105740: 5b pop %ebx 80105741: 5e pop %esi 80105742: 5f pop %edi 80105743: 5d pop %ebp 80105744: c3 ret 80105745: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010574c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105750 : int sys_pipe(void) { 80105750: 55 push %ebp 80105751: 89 e5 mov %esp,%ebp 80105753: 57 push %edi 80105754: 56 push %esi int *fd; struct file *rf, *wf; int fd0, fd1; if (argptr(0, (void*)&fd, 2 * sizeof(fd[0])) < 0) { 80105755: 8d 45 dc lea -0x24(%ebp),%eax int sys_pipe(void) { 80105758: 53 push %ebx 80105759: 83 ec 20 sub $0x20,%esp if (argptr(0, (void*)&fd, 2 * sizeof(fd[0])) < 0) { 8010575c: 6a 08 push $0x8 8010575e: 50 push %eax 8010575f: 6a 00 push $0x0 80105761: e8 6a f3 ff ff call 80104ad0 80105766: 83 c4 10 add $0x10,%esp 80105769: 85 c0 test %eax,%eax 8010576b: 78 4a js 801057b7 return -1; } if (pipealloc(&rf, &wf) < 0) { 8010576d: 83 ec 08 sub $0x8,%esp 80105770: 8d 45 e4 lea -0x1c(%ebp),%eax 80105773: 50 push %eax 80105774: 8d 45 e0 lea -0x20(%ebp),%eax 80105777: 50 push %eax 80105778: e8 23 de ff ff call 801035a0 8010577d: 83 c4 10 add $0x10,%esp 80105780: 85 c0 test %eax,%eax 80105782: 78 33 js 801057b7 return -1; } fd0 = -1; if ((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0) { 80105784: 8b 7d e0 mov -0x20(%ebp),%edi for (fd = 0; fd < NOFILE; fd++) { 80105787: 31 db xor %ebx,%ebx struct proc *curproc = myproc(); 80105789: e8 42 e3 ff ff call 80103ad0 for (fd = 0; fd < NOFILE; fd++) { 8010578e: 66 90 xchg %ax,%ax if (curproc->ofile[fd] == 0) { 80105790: 8b 74 98 28 mov 0x28(%eax,%ebx,4),%esi 80105794: 85 f6 test %esi,%esi 80105796: 74 28 je 801057c0 for (fd = 0; fd < NOFILE; fd++) { 80105798: 83 c3 01 add $0x1,%ebx 8010579b: 83 fb 10 cmp $0x10,%ebx 8010579e: 75 f0 jne 80105790 if (fd0 >= 0) { myproc()->ofile[fd0] = 0; } fileclose(rf); 801057a0: 83 ec 0c sub $0xc,%esp 801057a3: ff 75 e0 push -0x20(%ebp) 801057a6: e8 65 b8 ff ff call 80101010 fileclose(wf); 801057ab: 58 pop %eax 801057ac: ff 75 e4 push -0x1c(%ebp) 801057af: e8 5c b8 ff ff call 80101010 return -1; 801057b4: 83 c4 10 add $0x10,%esp 801057b7: b8 ff ff ff ff mov $0xffffffff,%eax 801057bc: eb 53 jmp 80105811 801057be: 66 90 xchg %ax,%ax curproc->ofile[fd] = f; 801057c0: 8d 73 08 lea 0x8(%ebx),%esi 801057c3: 89 7c b0 08 mov %edi,0x8(%eax,%esi,4) if ((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0) { 801057c7: 8b 7d e4 mov -0x1c(%ebp),%edi struct proc *curproc = myproc(); 801057ca: e8 01 e3 ff ff call 80103ad0 for (fd = 0; fd < NOFILE; fd++) { 801057cf: 31 d2 xor %edx,%edx 801057d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (curproc->ofile[fd] == 0) { 801057d8: 8b 4c 90 28 mov 0x28(%eax,%edx,4),%ecx 801057dc: 85 c9 test %ecx,%ecx 801057de: 74 20 je 80105800 for (fd = 0; fd < NOFILE; fd++) { 801057e0: 83 c2 01 add $0x1,%edx 801057e3: 83 fa 10 cmp $0x10,%edx 801057e6: 75 f0 jne 801057d8 myproc()->ofile[fd0] = 0; 801057e8: e8 e3 e2 ff ff call 80103ad0 801057ed: c7 44 b0 08 00 00 00 movl $0x0,0x8(%eax,%esi,4) 801057f4: 00 801057f5: eb a9 jmp 801057a0 801057f7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801057fe: 66 90 xchg %ax,%ax curproc->ofile[fd] = f; 80105800: 89 7c 90 28 mov %edi,0x28(%eax,%edx,4) } fd[0] = fd0; 80105804: 8b 45 dc mov -0x24(%ebp),%eax 80105807: 89 18 mov %ebx,(%eax) fd[1] = fd1; 80105809: 8b 45 dc mov -0x24(%ebp),%eax 8010580c: 89 50 04 mov %edx,0x4(%eax) return 0; 8010580f: 31 c0 xor %eax,%eax } 80105811: 8d 65 f4 lea -0xc(%ebp),%esp 80105814: 5b pop %ebx 80105815: 5e pop %esi 80105816: 5f pop %edi 80105817: 5d pop %ebp 80105818: c3 ret 80105819: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105820 : int sys_getch(void) { return consoleget(); 80105820: e9 6b b0 ff ff jmp 80100890 80105825: 66 90 xchg %ax,%ax 80105827: 66 90 xchg %ax,%ax 80105829: 66 90 xchg %ax,%ax 8010582b: 66 90 xchg %ax,%ax 8010582d: 66 90 xchg %ax,%ax 8010582f: 90 nop 80105830 : #include "mmu.h" #include "proc.h" int sys_fork(void) { return fork(); 80105830: e9 3b e4 ff ff jmp 80103c70 80105835: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010583c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105840 : } int sys_exit(void) { 80105840: 55 push %ebp 80105841: 89 e5 mov %esp,%ebp 80105843: 83 ec 08 sub $0x8,%esp exit(); 80105846: e8 a5 e6 ff ff call 80103ef0 return 0; // not reached } 8010584b: 31 c0 xor %eax,%eax 8010584d: c9 leave 8010584e: c3 ret 8010584f: 90 nop 80105850 : int sys_wait(void) { return wait(); 80105850: e9 cb e7 ff ff jmp 80104020 80105855: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010585c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105860 : } int sys_kill(void) { 80105860: 55 push %ebp 80105861: 89 e5 mov %esp,%ebp 80105863: 83 ec 20 sub $0x20,%esp int pid; if (argint(0, &pid) < 0) 80105866: 8d 45 f4 lea -0xc(%ebp),%eax 80105869: 50 push %eax 8010586a: 6a 00 push $0x0 8010586c: e8 0f f2 ff ff call 80104a80 80105871: 83 c4 10 add $0x10,%esp 80105874: 85 c0 test %eax,%eax 80105876: 78 18 js 80105890 { return -1; } return kill(pid); 80105878: 83 ec 0c sub $0xc,%esp 8010587b: ff 75 f4 push -0xc(%ebp) 8010587e: e8 3d ea ff ff call 801042c0 80105883: 83 c4 10 add $0x10,%esp } 80105886: c9 leave 80105887: c3 ret 80105888: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010588f: 90 nop 80105890: c9 leave return -1; 80105891: b8 ff ff ff ff mov $0xffffffff,%eax } 80105896: c3 ret 80105897: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010589e: 66 90 xchg %ax,%ax 801058a0 : int sys_getpid(void) { 801058a0: 55 push %ebp 801058a1: 89 e5 mov %esp,%ebp 801058a3: 83 ec 08 sub $0x8,%esp return myproc()->pid; 801058a6: e8 25 e2 ff ff call 80103ad0 801058ab: 8b 40 10 mov 0x10(%eax),%eax } 801058ae: c9 leave 801058af: c3 ret 801058b0 : int sys_sbrk(void) { 801058b0: 55 push %ebp 801058b1: 89 e5 mov %esp,%ebp 801058b3: 53 push %ebx int addr; int n; if (argint(0, &n) < 0) 801058b4: 8d 45 f4 lea -0xc(%ebp),%eax { 801058b7: 83 ec 1c sub $0x1c,%esp if (argint(0, &n) < 0) 801058ba: 50 push %eax 801058bb: 6a 00 push $0x0 801058bd: e8 be f1 ff ff call 80104a80 801058c2: 83 c4 10 add $0x10,%esp 801058c5: 85 c0 test %eax,%eax 801058c7: 78 27 js 801058f0 { return -1; } addr = myproc()->sz; 801058c9: e8 02 e2 ff ff call 80103ad0 if (growproc(n) < 0) 801058ce: 83 ec 0c sub $0xc,%esp addr = myproc()->sz; 801058d1: 8b 18 mov (%eax),%ebx if (growproc(n) < 0) 801058d3: ff 75 f4 push -0xc(%ebp) 801058d6: e8 15 e3 ff ff call 80103bf0 801058db: 83 c4 10 add $0x10,%esp 801058de: 85 c0 test %eax,%eax 801058e0: 78 0e js 801058f0 { return -1; } return addr; } 801058e2: 89 d8 mov %ebx,%eax 801058e4: 8b 5d fc mov -0x4(%ebp),%ebx 801058e7: c9 leave 801058e8: c3 ret 801058e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return -1; 801058f0: bb ff ff ff ff mov $0xffffffff,%ebx 801058f5: eb eb jmp 801058e2 801058f7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801058fe: 66 90 xchg %ax,%ax 80105900 : int sys_sleep(void) { 80105900: 55 push %ebp 80105901: 89 e5 mov %esp,%ebp 80105903: 53 push %ebx int n; uint ticks0; if (argint(0, &n) < 0) 80105904: 8d 45 f4 lea -0xc(%ebp),%eax { 80105907: 83 ec 1c sub $0x1c,%esp if (argint(0, &n) < 0) 8010590a: 50 push %eax 8010590b: 6a 00 push $0x0 8010590d: e8 6e f1 ff ff call 80104a80 80105912: 83 c4 10 add $0x10,%esp 80105915: 85 c0 test %eax,%eax 80105917: 0f 88 8a 00 00 00 js 801059a7 { return -1; } acquire(&tickslock); 8010591d: 83 ec 0c sub $0xc,%esp 80105920: 68 a0 3c 11 80 push $0x80113ca0 80105925: e8 d6 ed ff ff call 80104700 ticks0 = ticks; while (ticks - ticks0 < n) 8010592a: 8b 55 f4 mov -0xc(%ebp),%edx ticks0 = ticks; 8010592d: 8b 1d 80 3c 11 80 mov 0x80113c80,%ebx while (ticks - ticks0 < n) 80105933: 83 c4 10 add $0x10,%esp 80105936: 85 d2 test %edx,%edx 80105938: 75 27 jne 80105961 8010593a: eb 54 jmp 80105990 8010593c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (myproc()->killed) { release(&tickslock); return -1; } sleep(&ticks, &tickslock); 80105940: 83 ec 08 sub $0x8,%esp 80105943: 68 a0 3c 11 80 push $0x80113ca0 80105948: 68 80 3c 11 80 push $0x80113c80 8010594d: e8 4e e8 ff ff call 801041a0 while (ticks - ticks0 < n) 80105952: a1 80 3c 11 80 mov 0x80113c80,%eax 80105957: 83 c4 10 add $0x10,%esp 8010595a: 29 d8 sub %ebx,%eax 8010595c: 3b 45 f4 cmp -0xc(%ebp),%eax 8010595f: 73 2f jae 80105990 if (myproc()->killed) 80105961: e8 6a e1 ff ff call 80103ad0 80105966: 8b 40 24 mov 0x24(%eax),%eax 80105969: 85 c0 test %eax,%eax 8010596b: 74 d3 je 80105940 release(&tickslock); 8010596d: 83 ec 0c sub $0xc,%esp 80105970: 68 a0 3c 11 80 push $0x80113ca0 80105975: e8 26 ed ff ff call 801046a0 } release(&tickslock); return 0; } 8010597a: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 8010597d: 83 c4 10 add $0x10,%esp 80105980: b8 ff ff ff ff mov $0xffffffff,%eax } 80105985: c9 leave 80105986: c3 ret 80105987: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010598e: 66 90 xchg %ax,%ax release(&tickslock); 80105990: 83 ec 0c sub $0xc,%esp 80105993: 68 a0 3c 11 80 push $0x80113ca0 80105998: e8 03 ed ff ff call 801046a0 return 0; 8010599d: 83 c4 10 add $0x10,%esp 801059a0: 31 c0 xor %eax,%eax } 801059a2: 8b 5d fc mov -0x4(%ebp),%ebx 801059a5: c9 leave 801059a6: c3 ret return -1; 801059a7: b8 ff ff ff ff mov $0xffffffff,%eax 801059ac: eb f4 jmp 801059a2 801059ae: 66 90 xchg %ax,%ax 801059b0 : // return how many clock tick interrupts have occurred // since start. int sys_uptime(void) { 801059b0: 55 push %ebp 801059b1: 89 e5 mov %esp,%ebp 801059b3: 53 push %ebx 801059b4: 83 ec 10 sub $0x10,%esp uint xticks; acquire(&tickslock); 801059b7: 68 a0 3c 11 80 push $0x80113ca0 801059bc: e8 3f ed ff ff call 80104700 xticks = ticks; 801059c1: 8b 1d 80 3c 11 80 mov 0x80113c80,%ebx release(&tickslock); 801059c7: c7 04 24 a0 3c 11 80 movl $0x80113ca0,(%esp) 801059ce: e8 cd ec ff ff call 801046a0 return xticks; } 801059d3: 89 d8 mov %ebx,%eax 801059d5: 8b 5d fc mov -0x4(%ebp),%ebx 801059d8: c9 leave 801059d9: c3 ret 801059da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801059e0 : int sys_greeting(void) { 801059e0: 55 push %ebp 801059e1: 89 e5 mov %esp,%ebp 801059e3: 83 ec 14 sub $0x14,%esp cprintf("Hello again\n"); 801059e6: 68 65 7b 10 80 push $0x80107b65 801059eb: e8 c0 ac ff ff call 801006b0 return 0; } 801059f0: 31 c0 xor %eax,%eax 801059f2: c9 leave 801059f3: c3 ret 801059f4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801059fb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801059ff: 90 nop 80105a00 : int sys_shutdown(void) { 80105a00: 55 push %ebp 80105a01: 89 e5 mov %esp,%ebp 80105a03: 83 ec 20 sub $0x20,%esp int restart; if (argint(0, &restart) < 0) 80105a06: 8d 45 f4 lea -0xc(%ebp),%eax 80105a09: 50 push %eax 80105a0a: 6a 00 push $0x0 80105a0c: e8 6f f0 ff ff call 80104a80 80105a11: 83 c4 10 add $0x10,%esp 80105a14: 85 c0 test %eax,%eax 80105a16: 78 2f js 80105a47 { return -1; } if (restart == 1) 80105a18: 83 7d f4 01 cmpl $0x1,-0xc(%ebp) 80105a1c: 74 12 je 80105a30 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80105a1e: b8 00 20 00 00 mov $0x2000,%eax 80105a23: ba 04 06 00 00 mov $0x604,%edx 80105a28: 66 ef out %ax,(%dx) else { outw(0x604, 0x2000); } return 0; 80105a2a: c9 leave return 0; 80105a2b: 31 c0 xor %eax,%eax 80105a2d: c3 ret 80105a2e: 66 90 xchg %ax,%ax asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80105a30: ba 64 00 00 00 mov $0x64,%edx 80105a35: 8d 76 00 lea 0x0(%esi),%esi 80105a38: ec in (%dx),%al while (good & 0x02) { 80105a39: a8 02 test $0x2,%al 80105a3b: 75 fb jne 80105a38 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80105a3d: b8 fe ff ff ff mov $0xfffffffe,%eax 80105a42: ee out %al,(%dx) 80105a43: c9 leave return 0; 80105a44: 31 c0 xor %eax,%eax 80105a46: c3 ret 80105a47: c9 leave return -1; 80105a48: b8 ff ff ff ff mov $0xffffffff,%eax 80105a4d: c3 ret 80105a4e : # vectors.S sends all traps here. .globl alltraps alltraps: # Build trap frame. pushl %ds 80105a4e: 1e push %ds pushl %es 80105a4f: 06 push %es pushl %fs 80105a50: 0f a0 push %fs pushl %gs 80105a52: 0f a8 push %gs pushal 80105a54: 60 pusha # Set up data segments. movw $(SEG_KDATA<<3), %ax 80105a55: 66 b8 10 00 mov $0x10,%ax movw %ax, %ds 80105a59: 8e d8 mov %eax,%ds movw %ax, %es 80105a5b: 8e c0 mov %eax,%es # Call trap(tf), where tf=%esp pushl %esp 80105a5d: 54 push %esp call trap 80105a5e: e8 cd 00 00 00 call 80105b30 addl $4, %esp 80105a63: 83 c4 04 add $0x4,%esp 80105a66 : # Return falls through to trapret... .globl trapret trapret: popal 80105a66: 61 popa popl %gs 80105a67: 0f a9 pop %gs popl %fs 80105a69: 0f a1 pop %fs popl %es 80105a6b: 07 pop %es popl %ds 80105a6c: 1f pop %ds addl $0x8, %esp # trapno and errcode 80105a6d: 83 c4 08 add $0x8,%esp iret 80105a70: cf iret 80105a71: 66 90 xchg %ax,%ax 80105a73: 66 90 xchg %ax,%ax 80105a75: 66 90 xchg %ax,%ax 80105a77: 66 90 xchg %ax,%ax 80105a79: 66 90 xchg %ax,%ax 80105a7b: 66 90 xchg %ax,%ax 80105a7d: 66 90 xchg %ax,%ax 80105a7f: 90 nop 80105a80 : struct gatedesc idt[256]; extern uint vectors[]; // in vectors.S: array of 256 entry pointers struct spinlock tickslock; uint ticks; void tvinit(void) { 80105a80: 55 push %ebp int i; for (i = 0; i < 256; i++) { 80105a81: 31 c0 xor %eax,%eax void tvinit(void) { 80105a83: 89 e5 mov %esp,%ebp 80105a85: 83 ec 08 sub $0x8,%esp 80105a88: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105a8f: 90 nop SETGATE(idt[i], 0, SEG_KCODE << 3, vectors[i], 0); 80105a90: 8b 14 85 08 a0 10 80 mov -0x7fef5ff8(,%eax,4),%edx 80105a97: c7 04 c5 e2 3c 11 80 movl $0x8e000008,-0x7feec31e(,%eax,8) 80105a9e: 08 00 00 8e 80105aa2: 66 89 14 c5 e0 3c 11 mov %dx,-0x7feec320(,%eax,8) 80105aa9: 80 80105aaa: c1 ea 10 shr $0x10,%edx 80105aad: 66 89 14 c5 e6 3c 11 mov %dx,-0x7feec31a(,%eax,8) 80105ab4: 80 for (i = 0; i < 256; i++) { 80105ab5: 83 c0 01 add $0x1,%eax 80105ab8: 3d 00 01 00 00 cmp $0x100,%eax 80105abd: 75 d1 jne 80105a90 } SETGATE(idt[T_SYSCALL], 1, SEG_KCODE << 3, vectors[T_SYSCALL], DPL_USER); initlock(&tickslock, "time"); 80105abf: 83 ec 08 sub $0x8,%esp SETGATE(idt[T_SYSCALL], 1, SEG_KCODE << 3, vectors[T_SYSCALL], DPL_USER); 80105ac2: a1 08 a1 10 80 mov 0x8010a108,%eax 80105ac7: c7 05 e2 3e 11 80 08 movl $0xef000008,0x80113ee2 80105ace: 00 00 ef initlock(&tickslock, "time"); 80105ad1: 68 72 7b 10 80 push $0x80107b72 80105ad6: 68 a0 3c 11 80 push $0x80113ca0 SETGATE(idt[T_SYSCALL], 1, SEG_KCODE << 3, vectors[T_SYSCALL], DPL_USER); 80105adb: 66 a3 e0 3e 11 80 mov %ax,0x80113ee0 80105ae1: c1 e8 10 shr $0x10,%eax 80105ae4: 66 a3 e6 3e 11 80 mov %ax,0x80113ee6 initlock(&tickslock, "time"); 80105aea: e8 41 ea ff ff call 80104530 } 80105aef: 83 c4 10 add $0x10,%esp 80105af2: c9 leave 80105af3: c3 ret 80105af4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105afb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105aff: 90 nop 80105b00 : void idtinit(void) { 80105b00: 55 push %ebp pd[0] = size - 1; 80105b01: b8 ff 07 00 00 mov $0x7ff,%eax 80105b06: 89 e5 mov %esp,%ebp 80105b08: 83 ec 10 sub $0x10,%esp 80105b0b: 66 89 45 fa mov %ax,-0x6(%ebp) pd[1] = (uint)p; 80105b0f: b8 e0 3c 11 80 mov $0x80113ce0,%eax 80105b14: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; 80105b18: c1 e8 10 shr $0x10,%eax 80105b1b: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile ("lidt (%0)" : : "r" (pd)); 80105b1f: 8d 45 fa lea -0x6(%ebp),%eax 80105b22: 0f 01 18 lidtl (%eax) lidt(idt, sizeof(idt)); } 80105b25: c9 leave 80105b26: c3 ret 80105b27: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105b2e: 66 90 xchg %ax,%ax 80105b30 : void trap(struct trapframe *tf) { 80105b30: 55 push %ebp 80105b31: 89 e5 mov %esp,%ebp 80105b33: 57 push %edi 80105b34: 56 push %esi 80105b35: 53 push %ebx 80105b36: 83 ec 1c sub $0x1c,%esp 80105b39: 8b 5d 08 mov 0x8(%ebp),%ebx if (tf->trapno == T_SYSCALL) { 80105b3c: 8b 43 30 mov 0x30(%ebx),%eax 80105b3f: 83 f8 40 cmp $0x40,%eax 80105b42: 0f 84 68 01 00 00 je 80105cb0 exit(); } return; } switch (tf->trapno) { 80105b48: 83 e8 20 sub $0x20,%eax 80105b4b: 83 f8 1f cmp $0x1f,%eax 80105b4e: 0f 87 8c 00 00 00 ja 80105be0 80105b54: ff 24 85 18 7c 10 80 jmp *-0x7fef83e8(,%eax,4) 80105b5b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105b5f: 90 nop release(&tickslock); } lapiceoi(); break; case T_IRQ0 + IRQ_IDE: ideintr(); 80105b60: e8 fb c7 ff ff call 80102360 lapiceoi(); 80105b65: e8 c6 ce ff ff call 80102a30 } // 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) { 80105b6a: e8 61 df ff ff call 80103ad0 80105b6f: 85 c0 test %eax,%eax 80105b71: 74 1d je 80105b90 80105b73: e8 58 df ff ff call 80103ad0 80105b78: 8b 50 24 mov 0x24(%eax),%edx 80105b7b: 85 d2 test %edx,%edx 80105b7d: 74 11 je 80105b90 80105b7f: 0f b7 43 3c movzwl 0x3c(%ebx),%eax 80105b83: 83 e0 03 and $0x3,%eax 80105b86: 66 83 f8 03 cmp $0x3,%ax 80105b8a: 0f 84 e8 01 00 00 je 80105d78 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 && 80105b90: e8 3b df ff ff call 80103ad0 80105b95: 85 c0 test %eax,%eax 80105b97: 74 0f je 80105ba8 80105b99: e8 32 df ff ff call 80103ad0 80105b9e: 83 78 0c 04 cmpl $0x4,0xc(%eax) 80105ba2: 0f 84 b8 00 00 00 je 80105c60 tf->trapno == T_IRQ0 + IRQ_TIMER) { yield(); } // Check if the process has been killed since we yielded if (myproc() && myproc()->killed && (tf->cs & 3) == DPL_USER) { 80105ba8: e8 23 df ff ff call 80103ad0 80105bad: 85 c0 test %eax,%eax 80105baf: 74 1d je 80105bce 80105bb1: e8 1a df ff ff call 80103ad0 80105bb6: 8b 40 24 mov 0x24(%eax),%eax 80105bb9: 85 c0 test %eax,%eax 80105bbb: 74 11 je 80105bce 80105bbd: 0f b7 43 3c movzwl 0x3c(%ebx),%eax 80105bc1: 83 e0 03 and $0x3,%eax 80105bc4: 66 83 f8 03 cmp $0x3,%ax 80105bc8: 0f 84 0f 01 00 00 je 80105cdd exit(); } } 80105bce: 8d 65 f4 lea -0xc(%ebp),%esp 80105bd1: 5b pop %ebx 80105bd2: 5e pop %esi 80105bd3: 5f pop %edi 80105bd4: 5d pop %ebp 80105bd5: c3 ret 80105bd6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105bdd: 8d 76 00 lea 0x0(%esi),%esi if (myproc() == 0 || (tf->cs & 3) == 0) { 80105be0: e8 eb de ff ff call 80103ad0 80105be5: 8b 7b 38 mov 0x38(%ebx),%edi 80105be8: 85 c0 test %eax,%eax 80105bea: 0f 84 a2 01 00 00 je 80105d92 80105bf0: f6 43 3c 03 testb $0x3,0x3c(%ebx) 80105bf4: 0f 84 98 01 00 00 je 80105d92 return result; } static inline uint rcr2(void) { uint val; asm volatile ("movl %%cr2,%0" : "=r" (val)); 80105bfa: 0f 20 d1 mov %cr2,%ecx 80105bfd: 89 4d d8 mov %ecx,-0x28(%ebp) cprintf("pid %d %s: trap %d err %d on cpu %d " 80105c00: e8 ab de ff ff call 80103ab0 80105c05: 8b 73 30 mov 0x30(%ebx),%esi 80105c08: 89 45 dc mov %eax,-0x24(%ebp) 80105c0b: 8b 43 34 mov 0x34(%ebx),%eax 80105c0e: 89 45 e4 mov %eax,-0x1c(%ebp) myproc()->pid, myproc()->name, tf->trapno, 80105c11: e8 ba de ff ff call 80103ad0 80105c16: 89 45 e0 mov %eax,-0x20(%ebp) 80105c19: e8 b2 de ff ff call 80103ad0 cprintf("pid %d %s: trap %d err %d on cpu %d " 80105c1e: 8b 4d d8 mov -0x28(%ebp),%ecx 80105c21: 8b 55 dc mov -0x24(%ebp),%edx 80105c24: 51 push %ecx 80105c25: 57 push %edi 80105c26: 52 push %edx 80105c27: ff 75 e4 push -0x1c(%ebp) 80105c2a: 56 push %esi myproc()->pid, myproc()->name, tf->trapno, 80105c2b: 8b 75 e0 mov -0x20(%ebp),%esi 80105c2e: 83 c6 6c add $0x6c,%esi cprintf("pid %d %s: trap %d err %d on cpu %d " 80105c31: 56 push %esi 80105c32: ff 70 10 push 0x10(%eax) 80105c35: 68 d4 7b 10 80 push $0x80107bd4 80105c3a: e8 71 aa ff ff call 801006b0 myproc()->killed = 1; 80105c3f: 83 c4 20 add $0x20,%esp 80105c42: e8 89 de ff ff call 80103ad0 80105c47: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) if (myproc() && myproc()->killed && (tf->cs & 3) == DPL_USER) { 80105c4e: e8 7d de ff ff call 80103ad0 80105c53: 85 c0 test %eax,%eax 80105c55: 0f 85 18 ff ff ff jne 80105b73 80105c5b: e9 30 ff ff ff jmp 80105b90 if (myproc() && myproc()->state == RUNNING && 80105c60: 83 7b 30 20 cmpl $0x20,0x30(%ebx) 80105c64: 0f 85 3e ff ff ff jne 80105ba8 yield(); 80105c6a: e8 e1 e4 ff ff call 80104150 80105c6f: e9 34 ff ff ff jmp 80105ba8 80105c74: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi cprintf("cpu%d: spurious interrupt at %x:%x\n", 80105c78: 8b 7b 38 mov 0x38(%ebx),%edi 80105c7b: 0f b7 73 3c movzwl 0x3c(%ebx),%esi 80105c7f: e8 2c de ff ff call 80103ab0 80105c84: 57 push %edi 80105c85: 56 push %esi 80105c86: 50 push %eax 80105c87: 68 7c 7b 10 80 push $0x80107b7c 80105c8c: e8 1f aa ff ff call 801006b0 lapiceoi(); 80105c91: e8 9a cd ff ff call 80102a30 break; 80105c96: 83 c4 10 add $0x10,%esp if (myproc() && myproc()->killed && (tf->cs & 3) == DPL_USER) { 80105c99: e8 32 de ff ff call 80103ad0 80105c9e: 85 c0 test %eax,%eax 80105ca0: 0f 85 cd fe ff ff jne 80105b73 80105ca6: e9 e5 fe ff ff jmp 80105b90 80105cab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105caf: 90 nop if (myproc()->killed) { 80105cb0: e8 1b de ff ff call 80103ad0 80105cb5: 8b 70 24 mov 0x24(%eax),%esi 80105cb8: 85 f6 test %esi,%esi 80105cba: 0f 85 c8 00 00 00 jne 80105d88 myproc()->tf = tf; 80105cc0: e8 0b de ff ff call 80103ad0 80105cc5: 89 58 18 mov %ebx,0x18(%eax) syscall(); 80105cc8: e8 f3 ee ff ff call 80104bc0 if (myproc()->killed) { 80105ccd: e8 fe dd ff ff call 80103ad0 80105cd2: 8b 48 24 mov 0x24(%eax),%ecx 80105cd5: 85 c9 test %ecx,%ecx 80105cd7: 0f 84 f1 fe ff ff je 80105bce } 80105cdd: 8d 65 f4 lea -0xc(%ebp),%esp 80105ce0: 5b pop %ebx 80105ce1: 5e pop %esi 80105ce2: 5f pop %edi 80105ce3: 5d pop %ebp exit(); 80105ce4: e9 07 e2 ff ff jmp 80103ef0 80105ce9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi uartintr(); 80105cf0: e8 3b 02 00 00 call 80105f30 lapiceoi(); 80105cf5: e8 36 cd ff ff call 80102a30 if (myproc() && myproc()->killed && (tf->cs & 3) == DPL_USER) { 80105cfa: e8 d1 dd ff ff call 80103ad0 80105cff: 85 c0 test %eax,%eax 80105d01: 0f 85 6c fe ff ff jne 80105b73 80105d07: e9 84 fe ff ff jmp 80105b90 80105d0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi kbdintr(); 80105d10: e8 db cb ff ff call 801028f0 lapiceoi(); 80105d15: e8 16 cd ff ff call 80102a30 if (myproc() && myproc()->killed && (tf->cs & 3) == DPL_USER) { 80105d1a: e8 b1 dd ff ff call 80103ad0 80105d1f: 85 c0 test %eax,%eax 80105d21: 0f 85 4c fe ff ff jne 80105b73 80105d27: e9 64 fe ff ff jmp 80105b90 80105d2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (cpuid() == 0) { 80105d30: e8 7b dd ff ff call 80103ab0 80105d35: 85 c0 test %eax,%eax 80105d37: 0f 85 28 fe ff ff jne 80105b65 acquire(&tickslock); 80105d3d: 83 ec 0c sub $0xc,%esp 80105d40: 68 a0 3c 11 80 push $0x80113ca0 80105d45: e8 b6 e9 ff ff call 80104700 wakeup(&ticks); 80105d4a: c7 04 24 80 3c 11 80 movl $0x80113c80,(%esp) ticks++; 80105d51: 83 05 80 3c 11 80 01 addl $0x1,0x80113c80 wakeup(&ticks); 80105d58: e8 03 e5 ff ff call 80104260 release(&tickslock); 80105d5d: c7 04 24 a0 3c 11 80 movl $0x80113ca0,(%esp) 80105d64: e8 37 e9 ff ff call 801046a0 80105d69: 83 c4 10 add $0x10,%esp lapiceoi(); 80105d6c: e9 f4 fd ff ff jmp 80105b65 80105d71: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi exit(); 80105d78: e8 73 e1 ff ff call 80103ef0 80105d7d: e9 0e fe ff ff jmp 80105b90 80105d82: 8d b6 00 00 00 00 lea 0x0(%esi),%esi exit(); 80105d88: e8 63 e1 ff ff call 80103ef0 80105d8d: e9 2e ff ff ff jmp 80105cc0 80105d92: 0f 20 d6 mov %cr2,%esi cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", 80105d95: e8 16 dd ff ff call 80103ab0 80105d9a: 83 ec 0c sub $0xc,%esp 80105d9d: 56 push %esi 80105d9e: 57 push %edi 80105d9f: 50 push %eax 80105da0: ff 73 30 push 0x30(%ebx) 80105da3: 68 a0 7b 10 80 push $0x80107ba0 80105da8: e8 03 a9 ff ff call 801006b0 panic("trap"); 80105dad: 83 c4 14 add $0x14,%esp 80105db0: 68 77 7b 10 80 push $0x80107b77 80105db5: e8 d6 a5 ff ff call 80100390 80105dba: 66 90 xchg %ax,%ax 80105dbc: 66 90 xchg %ax,%ax 80105dbe: 66 90 xchg %ax,%ax 80105dc0 : } outb(COM1 + 0, c); } static int uartgetc(void) { if (!uart) { 80105dc0: a1 e0 44 11 80 mov 0x801144e0,%eax 80105dc5: 85 c0 test %eax,%eax 80105dc7: 74 17 je 80105de0 asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80105dc9: ba fd 03 00 00 mov $0x3fd,%edx 80105dce: ec in (%dx),%al return -1; } if (!(inb(COM1 + 5) & 0x01)) { 80105dcf: a8 01 test $0x1,%al 80105dd1: 74 0d je 80105de0 80105dd3: ba f8 03 00 00 mov $0x3f8,%edx 80105dd8: ec in (%dx),%al return -1; } return inb(COM1 + 0); 80105dd9: 0f b6 c0 movzbl %al,%eax 80105ddc: c3 ret 80105ddd: 8d 76 00 lea 0x0(%esi),%esi return -1; 80105de0: b8 ff ff ff ff mov $0xffffffff,%eax } 80105de5: c3 ret 80105de6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105ded: 8d 76 00 lea 0x0(%esi),%esi 80105df0 : void uartinit(void) { 80105df0: 55 push %ebp asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80105df1: 31 c9 xor %ecx,%ecx 80105df3: 89 c8 mov %ecx,%eax 80105df5: 89 e5 mov %esp,%ebp 80105df7: 57 push %edi 80105df8: bf fa 03 00 00 mov $0x3fa,%edi 80105dfd: 56 push %esi 80105dfe: 89 fa mov %edi,%edx 80105e00: 53 push %ebx 80105e01: 83 ec 1c sub $0x1c,%esp 80105e04: ee out %al,(%dx) 80105e05: be fb 03 00 00 mov $0x3fb,%esi 80105e0a: b8 80 ff ff ff mov $0xffffff80,%eax 80105e0f: 89 f2 mov %esi,%edx 80105e11: ee out %al,(%dx) 80105e12: b8 0c 00 00 00 mov $0xc,%eax 80105e17: ba f8 03 00 00 mov $0x3f8,%edx 80105e1c: ee out %al,(%dx) 80105e1d: bb f9 03 00 00 mov $0x3f9,%ebx 80105e22: 89 c8 mov %ecx,%eax 80105e24: 89 da mov %ebx,%edx 80105e26: ee out %al,(%dx) 80105e27: b8 03 00 00 00 mov $0x3,%eax 80105e2c: 89 f2 mov %esi,%edx 80105e2e: ee out %al,(%dx) 80105e2f: ba fc 03 00 00 mov $0x3fc,%edx 80105e34: 89 c8 mov %ecx,%eax 80105e36: ee out %al,(%dx) 80105e37: b8 01 00 00 00 mov $0x1,%eax 80105e3c: 89 da mov %ebx,%edx 80105e3e: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80105e3f: ba fd 03 00 00 mov $0x3fd,%edx 80105e44: ec in (%dx),%al if (inb(COM1 + 5) == 0xFF) { 80105e45: 3c ff cmp $0xff,%al 80105e47: 74 78 je 80105ec1 uart = 1; 80105e49: c7 05 e0 44 11 80 01 movl $0x1,0x801144e0 80105e50: 00 00 00 80105e53: 89 fa mov %edi,%edx 80105e55: ec in (%dx),%al 80105e56: ba f8 03 00 00 mov $0x3f8,%edx 80105e5b: ec in (%dx),%al ioapicenable(IRQ_COM1, 0); 80105e5c: 83 ec 08 sub $0x8,%esp for (p = "xv6...\n"; *p; p++) { 80105e5f: bf 98 7c 10 80 mov $0x80107c98,%edi 80105e64: be fd 03 00 00 mov $0x3fd,%esi ioapicenable(IRQ_COM1, 0); 80105e69: 6a 00 push $0x0 80105e6b: 6a 04 push $0x4 80105e6d: e8 2e c7 ff ff call 801025a0 for (p = "xv6...\n"; *p; p++) { 80105e72: c6 45 e7 78 movb $0x78,-0x19(%ebp) ioapicenable(IRQ_COM1, 0); 80105e76: 83 c4 10 add $0x10,%esp 80105e79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (!uart) { 80105e80: a1 e0 44 11 80 mov 0x801144e0,%eax 80105e85: bb 80 00 00 00 mov $0x80,%ebx 80105e8a: 85 c0 test %eax,%eax 80105e8c: 75 14 jne 80105ea2 80105e8e: eb 23 jmp 80105eb3 microdelay(10); 80105e90: 83 ec 0c sub $0xc,%esp 80105e93: 6a 0a push $0xa 80105e95: e8 b6 cb ff ff call 80102a50 for (i = 0; i < 128 && !(inb(COM1 + 5) & 0x20); i++) { 80105e9a: 83 c4 10 add $0x10,%esp 80105e9d: 83 eb 01 sub $0x1,%ebx 80105ea0: 74 07 je 80105ea9 80105ea2: 89 f2 mov %esi,%edx 80105ea4: ec in (%dx),%al 80105ea5: a8 20 test $0x20,%al 80105ea7: 74 e7 je 80105e90 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80105ea9: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 80105ead: ba f8 03 00 00 mov $0x3f8,%edx 80105eb2: ee out %al,(%dx) for (p = "xv6...\n"; *p; p++) { 80105eb3: 0f b6 47 01 movzbl 0x1(%edi),%eax 80105eb7: 83 c7 01 add $0x1,%edi 80105eba: 88 45 e7 mov %al,-0x19(%ebp) 80105ebd: 84 c0 test %al,%al 80105ebf: 75 bf jne 80105e80 } 80105ec1: 8d 65 f4 lea -0xc(%ebp),%esp 80105ec4: 5b pop %ebx 80105ec5: 5e pop %esi 80105ec6: 5f pop %edi 80105ec7: 5d pop %ebp 80105ec8: c3 ret 80105ec9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105ed0 : if (!uart) { 80105ed0: a1 e0 44 11 80 mov 0x801144e0,%eax 80105ed5: 85 c0 test %eax,%eax 80105ed7: 74 47 je 80105f20 void uartputc(int c) { 80105ed9: 55 push %ebp 80105eda: 89 e5 mov %esp,%ebp 80105edc: 56 push %esi asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80105edd: be fd 03 00 00 mov $0x3fd,%esi 80105ee2: 53 push %ebx 80105ee3: bb 80 00 00 00 mov $0x80,%ebx 80105ee8: eb 18 jmp 80105f02 80105eea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi microdelay(10); 80105ef0: 83 ec 0c sub $0xc,%esp 80105ef3: 6a 0a push $0xa 80105ef5: e8 56 cb ff ff call 80102a50 for (i = 0; i < 128 && !(inb(COM1 + 5) & 0x20); i++) { 80105efa: 83 c4 10 add $0x10,%esp 80105efd: 83 eb 01 sub $0x1,%ebx 80105f00: 74 07 je 80105f09 80105f02: 89 f2 mov %esi,%edx 80105f04: ec in (%dx),%al 80105f05: a8 20 test $0x20,%al 80105f07: 74 e7 je 80105ef0 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80105f09: 8b 45 08 mov 0x8(%ebp),%eax 80105f0c: ba f8 03 00 00 mov $0x3f8,%edx 80105f11: ee out %al,(%dx) } 80105f12: 8d 65 f8 lea -0x8(%ebp),%esp 80105f15: 5b pop %ebx 80105f16: 5e pop %esi 80105f17: 5d pop %ebp 80105f18: c3 ret 80105f19: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105f20: c3 ret 80105f21: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105f28: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105f2f: 90 nop 80105f30 : void uartintr(void) { 80105f30: 55 push %ebp 80105f31: 89 e5 mov %esp,%ebp 80105f33: 83 ec 14 sub $0x14,%esp consoleintr(uartgetc); 80105f36: 68 c0 5d 10 80 push $0x80105dc0 80105f3b: e8 a0 a9 ff ff call 801008e0 } 80105f40: 83 c4 10 add $0x10,%esp 80105f43: c9 leave 80105f44: c3 ret 80105f45 : # generated by vectors.pl - do not edit # handlers .globl alltraps .globl vector0 vector0: pushl $0 80105f45: 6a 00 push $0x0 pushl $0 80105f47: 6a 00 push $0x0 jmp alltraps 80105f49: e9 00 fb ff ff jmp 80105a4e 80105f4e : .globl vector1 vector1: pushl $0 80105f4e: 6a 00 push $0x0 pushl $1 80105f50: 6a 01 push $0x1 jmp alltraps 80105f52: e9 f7 fa ff ff jmp 80105a4e 80105f57 : .globl vector2 vector2: pushl $0 80105f57: 6a 00 push $0x0 pushl $2 80105f59: 6a 02 push $0x2 jmp alltraps 80105f5b: e9 ee fa ff ff jmp 80105a4e 80105f60 : .globl vector3 vector3: pushl $0 80105f60: 6a 00 push $0x0 pushl $3 80105f62: 6a 03 push $0x3 jmp alltraps 80105f64: e9 e5 fa ff ff jmp 80105a4e 80105f69 : .globl vector4 vector4: pushl $0 80105f69: 6a 00 push $0x0 pushl $4 80105f6b: 6a 04 push $0x4 jmp alltraps 80105f6d: e9 dc fa ff ff jmp 80105a4e 80105f72 : .globl vector5 vector5: pushl $0 80105f72: 6a 00 push $0x0 pushl $5 80105f74: 6a 05 push $0x5 jmp alltraps 80105f76: e9 d3 fa ff ff jmp 80105a4e 80105f7b : .globl vector6 vector6: pushl $0 80105f7b: 6a 00 push $0x0 pushl $6 80105f7d: 6a 06 push $0x6 jmp alltraps 80105f7f: e9 ca fa ff ff jmp 80105a4e 80105f84 : .globl vector7 vector7: pushl $0 80105f84: 6a 00 push $0x0 pushl $7 80105f86: 6a 07 push $0x7 jmp alltraps 80105f88: e9 c1 fa ff ff jmp 80105a4e 80105f8d : .globl vector8 vector8: pushl $8 80105f8d: 6a 08 push $0x8 jmp alltraps 80105f8f: e9 ba fa ff ff jmp 80105a4e 80105f94 : .globl vector9 vector9: pushl $0 80105f94: 6a 00 push $0x0 pushl $9 80105f96: 6a 09 push $0x9 jmp alltraps 80105f98: e9 b1 fa ff ff jmp 80105a4e 80105f9d : .globl vector10 vector10: pushl $10 80105f9d: 6a 0a push $0xa jmp alltraps 80105f9f: e9 aa fa ff ff jmp 80105a4e 80105fa4 : .globl vector11 vector11: pushl $11 80105fa4: 6a 0b push $0xb jmp alltraps 80105fa6: e9 a3 fa ff ff jmp 80105a4e 80105fab : .globl vector12 vector12: pushl $12 80105fab: 6a 0c push $0xc jmp alltraps 80105fad: e9 9c fa ff ff jmp 80105a4e 80105fb2 : .globl vector13 vector13: pushl $13 80105fb2: 6a 0d push $0xd jmp alltraps 80105fb4: e9 95 fa ff ff jmp 80105a4e 80105fb9 : .globl vector14 vector14: pushl $14 80105fb9: 6a 0e push $0xe jmp alltraps 80105fbb: e9 8e fa ff ff jmp 80105a4e 80105fc0 : .globl vector15 vector15: pushl $0 80105fc0: 6a 00 push $0x0 pushl $15 80105fc2: 6a 0f push $0xf jmp alltraps 80105fc4: e9 85 fa ff ff jmp 80105a4e 80105fc9 : .globl vector16 vector16: pushl $0 80105fc9: 6a 00 push $0x0 pushl $16 80105fcb: 6a 10 push $0x10 jmp alltraps 80105fcd: e9 7c fa ff ff jmp 80105a4e 80105fd2 : .globl vector17 vector17: pushl $17 80105fd2: 6a 11 push $0x11 jmp alltraps 80105fd4: e9 75 fa ff ff jmp 80105a4e 80105fd9 : .globl vector18 vector18: pushl $0 80105fd9: 6a 00 push $0x0 pushl $18 80105fdb: 6a 12 push $0x12 jmp alltraps 80105fdd: e9 6c fa ff ff jmp 80105a4e 80105fe2 : .globl vector19 vector19: pushl $0 80105fe2: 6a 00 push $0x0 pushl $19 80105fe4: 6a 13 push $0x13 jmp alltraps 80105fe6: e9 63 fa ff ff jmp 80105a4e 80105feb : .globl vector20 vector20: pushl $0 80105feb: 6a 00 push $0x0 pushl $20 80105fed: 6a 14 push $0x14 jmp alltraps 80105fef: e9 5a fa ff ff jmp 80105a4e 80105ff4 : .globl vector21 vector21: pushl $0 80105ff4: 6a 00 push $0x0 pushl $21 80105ff6: 6a 15 push $0x15 jmp alltraps 80105ff8: e9 51 fa ff ff jmp 80105a4e 80105ffd : .globl vector22 vector22: pushl $0 80105ffd: 6a 00 push $0x0 pushl $22 80105fff: 6a 16 push $0x16 jmp alltraps 80106001: e9 48 fa ff ff jmp 80105a4e 80106006 : .globl vector23 vector23: pushl $0 80106006: 6a 00 push $0x0 pushl $23 80106008: 6a 17 push $0x17 jmp alltraps 8010600a: e9 3f fa ff ff jmp 80105a4e 8010600f : .globl vector24 vector24: pushl $0 8010600f: 6a 00 push $0x0 pushl $24 80106011: 6a 18 push $0x18 jmp alltraps 80106013: e9 36 fa ff ff jmp 80105a4e 80106018 : .globl vector25 vector25: pushl $0 80106018: 6a 00 push $0x0 pushl $25 8010601a: 6a 19 push $0x19 jmp alltraps 8010601c: e9 2d fa ff ff jmp 80105a4e 80106021 : .globl vector26 vector26: pushl $0 80106021: 6a 00 push $0x0 pushl $26 80106023: 6a 1a push $0x1a jmp alltraps 80106025: e9 24 fa ff ff jmp 80105a4e 8010602a : .globl vector27 vector27: pushl $0 8010602a: 6a 00 push $0x0 pushl $27 8010602c: 6a 1b push $0x1b jmp alltraps 8010602e: e9 1b fa ff ff jmp 80105a4e 80106033 : .globl vector28 vector28: pushl $0 80106033: 6a 00 push $0x0 pushl $28 80106035: 6a 1c push $0x1c jmp alltraps 80106037: e9 12 fa ff ff jmp 80105a4e 8010603c : .globl vector29 vector29: pushl $0 8010603c: 6a 00 push $0x0 pushl $29 8010603e: 6a 1d push $0x1d jmp alltraps 80106040: e9 09 fa ff ff jmp 80105a4e 80106045 : .globl vector30 vector30: pushl $0 80106045: 6a 00 push $0x0 pushl $30 80106047: 6a 1e push $0x1e jmp alltraps 80106049: e9 00 fa ff ff jmp 80105a4e 8010604e : .globl vector31 vector31: pushl $0 8010604e: 6a 00 push $0x0 pushl $31 80106050: 6a 1f push $0x1f jmp alltraps 80106052: e9 f7 f9 ff ff jmp 80105a4e 80106057 : .globl vector32 vector32: pushl $0 80106057: 6a 00 push $0x0 pushl $32 80106059: 6a 20 push $0x20 jmp alltraps 8010605b: e9 ee f9 ff ff jmp 80105a4e 80106060 : .globl vector33 vector33: pushl $0 80106060: 6a 00 push $0x0 pushl $33 80106062: 6a 21 push $0x21 jmp alltraps 80106064: e9 e5 f9 ff ff jmp 80105a4e 80106069 : .globl vector34 vector34: pushl $0 80106069: 6a 00 push $0x0 pushl $34 8010606b: 6a 22 push $0x22 jmp alltraps 8010606d: e9 dc f9 ff ff jmp 80105a4e 80106072 : .globl vector35 vector35: pushl $0 80106072: 6a 00 push $0x0 pushl $35 80106074: 6a 23 push $0x23 jmp alltraps 80106076: e9 d3 f9 ff ff jmp 80105a4e 8010607b : .globl vector36 vector36: pushl $0 8010607b: 6a 00 push $0x0 pushl $36 8010607d: 6a 24 push $0x24 jmp alltraps 8010607f: e9 ca f9 ff ff jmp 80105a4e 80106084 : .globl vector37 vector37: pushl $0 80106084: 6a 00 push $0x0 pushl $37 80106086: 6a 25 push $0x25 jmp alltraps 80106088: e9 c1 f9 ff ff jmp 80105a4e 8010608d : .globl vector38 vector38: pushl $0 8010608d: 6a 00 push $0x0 pushl $38 8010608f: 6a 26 push $0x26 jmp alltraps 80106091: e9 b8 f9 ff ff jmp 80105a4e 80106096 : .globl vector39 vector39: pushl $0 80106096: 6a 00 push $0x0 pushl $39 80106098: 6a 27 push $0x27 jmp alltraps 8010609a: e9 af f9 ff ff jmp 80105a4e 8010609f : .globl vector40 vector40: pushl $0 8010609f: 6a 00 push $0x0 pushl $40 801060a1: 6a 28 push $0x28 jmp alltraps 801060a3: e9 a6 f9 ff ff jmp 80105a4e 801060a8 : .globl vector41 vector41: pushl $0 801060a8: 6a 00 push $0x0 pushl $41 801060aa: 6a 29 push $0x29 jmp alltraps 801060ac: e9 9d f9 ff ff jmp 80105a4e 801060b1 : .globl vector42 vector42: pushl $0 801060b1: 6a 00 push $0x0 pushl $42 801060b3: 6a 2a push $0x2a jmp alltraps 801060b5: e9 94 f9 ff ff jmp 80105a4e 801060ba : .globl vector43 vector43: pushl $0 801060ba: 6a 00 push $0x0 pushl $43 801060bc: 6a 2b push $0x2b jmp alltraps 801060be: e9 8b f9 ff ff jmp 80105a4e 801060c3 : .globl vector44 vector44: pushl $0 801060c3: 6a 00 push $0x0 pushl $44 801060c5: 6a 2c push $0x2c jmp alltraps 801060c7: e9 82 f9 ff ff jmp 80105a4e 801060cc : .globl vector45 vector45: pushl $0 801060cc: 6a 00 push $0x0 pushl $45 801060ce: 6a 2d push $0x2d jmp alltraps 801060d0: e9 79 f9 ff ff jmp 80105a4e 801060d5 : .globl vector46 vector46: pushl $0 801060d5: 6a 00 push $0x0 pushl $46 801060d7: 6a 2e push $0x2e jmp alltraps 801060d9: e9 70 f9 ff ff jmp 80105a4e 801060de : .globl vector47 vector47: pushl $0 801060de: 6a 00 push $0x0 pushl $47 801060e0: 6a 2f push $0x2f jmp alltraps 801060e2: e9 67 f9 ff ff jmp 80105a4e 801060e7 : .globl vector48 vector48: pushl $0 801060e7: 6a 00 push $0x0 pushl $48 801060e9: 6a 30 push $0x30 jmp alltraps 801060eb: e9 5e f9 ff ff jmp 80105a4e 801060f0 : .globl vector49 vector49: pushl $0 801060f0: 6a 00 push $0x0 pushl $49 801060f2: 6a 31 push $0x31 jmp alltraps 801060f4: e9 55 f9 ff ff jmp 80105a4e 801060f9 : .globl vector50 vector50: pushl $0 801060f9: 6a 00 push $0x0 pushl $50 801060fb: 6a 32 push $0x32 jmp alltraps 801060fd: e9 4c f9 ff ff jmp 80105a4e 80106102 : .globl vector51 vector51: pushl $0 80106102: 6a 00 push $0x0 pushl $51 80106104: 6a 33 push $0x33 jmp alltraps 80106106: e9 43 f9 ff ff jmp 80105a4e 8010610b : .globl vector52 vector52: pushl $0 8010610b: 6a 00 push $0x0 pushl $52 8010610d: 6a 34 push $0x34 jmp alltraps 8010610f: e9 3a f9 ff ff jmp 80105a4e 80106114 : .globl vector53 vector53: pushl $0 80106114: 6a 00 push $0x0 pushl $53 80106116: 6a 35 push $0x35 jmp alltraps 80106118: e9 31 f9 ff ff jmp 80105a4e 8010611d : .globl vector54 vector54: pushl $0 8010611d: 6a 00 push $0x0 pushl $54 8010611f: 6a 36 push $0x36 jmp alltraps 80106121: e9 28 f9 ff ff jmp 80105a4e 80106126 : .globl vector55 vector55: pushl $0 80106126: 6a 00 push $0x0 pushl $55 80106128: 6a 37 push $0x37 jmp alltraps 8010612a: e9 1f f9 ff ff jmp 80105a4e 8010612f : .globl vector56 vector56: pushl $0 8010612f: 6a 00 push $0x0 pushl $56 80106131: 6a 38 push $0x38 jmp alltraps 80106133: e9 16 f9 ff ff jmp 80105a4e 80106138 : .globl vector57 vector57: pushl $0 80106138: 6a 00 push $0x0 pushl $57 8010613a: 6a 39 push $0x39 jmp alltraps 8010613c: e9 0d f9 ff ff jmp 80105a4e 80106141 : .globl vector58 vector58: pushl $0 80106141: 6a 00 push $0x0 pushl $58 80106143: 6a 3a push $0x3a jmp alltraps 80106145: e9 04 f9 ff ff jmp 80105a4e 8010614a : .globl vector59 vector59: pushl $0 8010614a: 6a 00 push $0x0 pushl $59 8010614c: 6a 3b push $0x3b jmp alltraps 8010614e: e9 fb f8 ff ff jmp 80105a4e 80106153 : .globl vector60 vector60: pushl $0 80106153: 6a 00 push $0x0 pushl $60 80106155: 6a 3c push $0x3c jmp alltraps 80106157: e9 f2 f8 ff ff jmp 80105a4e 8010615c : .globl vector61 vector61: pushl $0 8010615c: 6a 00 push $0x0 pushl $61 8010615e: 6a 3d push $0x3d jmp alltraps 80106160: e9 e9 f8 ff ff jmp 80105a4e 80106165 : .globl vector62 vector62: pushl $0 80106165: 6a 00 push $0x0 pushl $62 80106167: 6a 3e push $0x3e jmp alltraps 80106169: e9 e0 f8 ff ff jmp 80105a4e 8010616e : .globl vector63 vector63: pushl $0 8010616e: 6a 00 push $0x0 pushl $63 80106170: 6a 3f push $0x3f jmp alltraps 80106172: e9 d7 f8 ff ff jmp 80105a4e 80106177 : .globl vector64 vector64: pushl $0 80106177: 6a 00 push $0x0 pushl $64 80106179: 6a 40 push $0x40 jmp alltraps 8010617b: e9 ce f8 ff ff jmp 80105a4e 80106180 : .globl vector65 vector65: pushl $0 80106180: 6a 00 push $0x0 pushl $65 80106182: 6a 41 push $0x41 jmp alltraps 80106184: e9 c5 f8 ff ff jmp 80105a4e 80106189 : .globl vector66 vector66: pushl $0 80106189: 6a 00 push $0x0 pushl $66 8010618b: 6a 42 push $0x42 jmp alltraps 8010618d: e9 bc f8 ff ff jmp 80105a4e 80106192 : .globl vector67 vector67: pushl $0 80106192: 6a 00 push $0x0 pushl $67 80106194: 6a 43 push $0x43 jmp alltraps 80106196: e9 b3 f8 ff ff jmp 80105a4e 8010619b : .globl vector68 vector68: pushl $0 8010619b: 6a 00 push $0x0 pushl $68 8010619d: 6a 44 push $0x44 jmp alltraps 8010619f: e9 aa f8 ff ff jmp 80105a4e 801061a4 : .globl vector69 vector69: pushl $0 801061a4: 6a 00 push $0x0 pushl $69 801061a6: 6a 45 push $0x45 jmp alltraps 801061a8: e9 a1 f8 ff ff jmp 80105a4e 801061ad : .globl vector70 vector70: pushl $0 801061ad: 6a 00 push $0x0 pushl $70 801061af: 6a 46 push $0x46 jmp alltraps 801061b1: e9 98 f8 ff ff jmp 80105a4e 801061b6 : .globl vector71 vector71: pushl $0 801061b6: 6a 00 push $0x0 pushl $71 801061b8: 6a 47 push $0x47 jmp alltraps 801061ba: e9 8f f8 ff ff jmp 80105a4e 801061bf : .globl vector72 vector72: pushl $0 801061bf: 6a 00 push $0x0 pushl $72 801061c1: 6a 48 push $0x48 jmp alltraps 801061c3: e9 86 f8 ff ff jmp 80105a4e 801061c8 : .globl vector73 vector73: pushl $0 801061c8: 6a 00 push $0x0 pushl $73 801061ca: 6a 49 push $0x49 jmp alltraps 801061cc: e9 7d f8 ff ff jmp 80105a4e 801061d1 : .globl vector74 vector74: pushl $0 801061d1: 6a 00 push $0x0 pushl $74 801061d3: 6a 4a push $0x4a jmp alltraps 801061d5: e9 74 f8 ff ff jmp 80105a4e 801061da : .globl vector75 vector75: pushl $0 801061da: 6a 00 push $0x0 pushl $75 801061dc: 6a 4b push $0x4b jmp alltraps 801061de: e9 6b f8 ff ff jmp 80105a4e 801061e3 : .globl vector76 vector76: pushl $0 801061e3: 6a 00 push $0x0 pushl $76 801061e5: 6a 4c push $0x4c jmp alltraps 801061e7: e9 62 f8 ff ff jmp 80105a4e 801061ec : .globl vector77 vector77: pushl $0 801061ec: 6a 00 push $0x0 pushl $77 801061ee: 6a 4d push $0x4d jmp alltraps 801061f0: e9 59 f8 ff ff jmp 80105a4e 801061f5 : .globl vector78 vector78: pushl $0 801061f5: 6a 00 push $0x0 pushl $78 801061f7: 6a 4e push $0x4e jmp alltraps 801061f9: e9 50 f8 ff ff jmp 80105a4e 801061fe : .globl vector79 vector79: pushl $0 801061fe: 6a 00 push $0x0 pushl $79 80106200: 6a 4f push $0x4f jmp alltraps 80106202: e9 47 f8 ff ff jmp 80105a4e 80106207 : .globl vector80 vector80: pushl $0 80106207: 6a 00 push $0x0 pushl $80 80106209: 6a 50 push $0x50 jmp alltraps 8010620b: e9 3e f8 ff ff jmp 80105a4e 80106210 : .globl vector81 vector81: pushl $0 80106210: 6a 00 push $0x0 pushl $81 80106212: 6a 51 push $0x51 jmp alltraps 80106214: e9 35 f8 ff ff jmp 80105a4e 80106219 : .globl vector82 vector82: pushl $0 80106219: 6a 00 push $0x0 pushl $82 8010621b: 6a 52 push $0x52 jmp alltraps 8010621d: e9 2c f8 ff ff jmp 80105a4e 80106222 : .globl vector83 vector83: pushl $0 80106222: 6a 00 push $0x0 pushl $83 80106224: 6a 53 push $0x53 jmp alltraps 80106226: e9 23 f8 ff ff jmp 80105a4e 8010622b : .globl vector84 vector84: pushl $0 8010622b: 6a 00 push $0x0 pushl $84 8010622d: 6a 54 push $0x54 jmp alltraps 8010622f: e9 1a f8 ff ff jmp 80105a4e 80106234 : .globl vector85 vector85: pushl $0 80106234: 6a 00 push $0x0 pushl $85 80106236: 6a 55 push $0x55 jmp alltraps 80106238: e9 11 f8 ff ff jmp 80105a4e 8010623d : .globl vector86 vector86: pushl $0 8010623d: 6a 00 push $0x0 pushl $86 8010623f: 6a 56 push $0x56 jmp alltraps 80106241: e9 08 f8 ff ff jmp 80105a4e 80106246 : .globl vector87 vector87: pushl $0 80106246: 6a 00 push $0x0 pushl $87 80106248: 6a 57 push $0x57 jmp alltraps 8010624a: e9 ff f7 ff ff jmp 80105a4e 8010624f : .globl vector88 vector88: pushl $0 8010624f: 6a 00 push $0x0 pushl $88 80106251: 6a 58 push $0x58 jmp alltraps 80106253: e9 f6 f7 ff ff jmp 80105a4e 80106258 : .globl vector89 vector89: pushl $0 80106258: 6a 00 push $0x0 pushl $89 8010625a: 6a 59 push $0x59 jmp alltraps 8010625c: e9 ed f7 ff ff jmp 80105a4e 80106261 : .globl vector90 vector90: pushl $0 80106261: 6a 00 push $0x0 pushl $90 80106263: 6a 5a push $0x5a jmp alltraps 80106265: e9 e4 f7 ff ff jmp 80105a4e 8010626a : .globl vector91 vector91: pushl $0 8010626a: 6a 00 push $0x0 pushl $91 8010626c: 6a 5b push $0x5b jmp alltraps 8010626e: e9 db f7 ff ff jmp 80105a4e 80106273 : .globl vector92 vector92: pushl $0 80106273: 6a 00 push $0x0 pushl $92 80106275: 6a 5c push $0x5c jmp alltraps 80106277: e9 d2 f7 ff ff jmp 80105a4e 8010627c : .globl vector93 vector93: pushl $0 8010627c: 6a 00 push $0x0 pushl $93 8010627e: 6a 5d push $0x5d jmp alltraps 80106280: e9 c9 f7 ff ff jmp 80105a4e 80106285 : .globl vector94 vector94: pushl $0 80106285: 6a 00 push $0x0 pushl $94 80106287: 6a 5e push $0x5e jmp alltraps 80106289: e9 c0 f7 ff ff jmp 80105a4e 8010628e : .globl vector95 vector95: pushl $0 8010628e: 6a 00 push $0x0 pushl $95 80106290: 6a 5f push $0x5f jmp alltraps 80106292: e9 b7 f7 ff ff jmp 80105a4e 80106297 : .globl vector96 vector96: pushl $0 80106297: 6a 00 push $0x0 pushl $96 80106299: 6a 60 push $0x60 jmp alltraps 8010629b: e9 ae f7 ff ff jmp 80105a4e 801062a0 : .globl vector97 vector97: pushl $0 801062a0: 6a 00 push $0x0 pushl $97 801062a2: 6a 61 push $0x61 jmp alltraps 801062a4: e9 a5 f7 ff ff jmp 80105a4e 801062a9 : .globl vector98 vector98: pushl $0 801062a9: 6a 00 push $0x0 pushl $98 801062ab: 6a 62 push $0x62 jmp alltraps 801062ad: e9 9c f7 ff ff jmp 80105a4e 801062b2 : .globl vector99 vector99: pushl $0 801062b2: 6a 00 push $0x0 pushl $99 801062b4: 6a 63 push $0x63 jmp alltraps 801062b6: e9 93 f7 ff ff jmp 80105a4e 801062bb : .globl vector100 vector100: pushl $0 801062bb: 6a 00 push $0x0 pushl $100 801062bd: 6a 64 push $0x64 jmp alltraps 801062bf: e9 8a f7 ff ff jmp 80105a4e 801062c4 : .globl vector101 vector101: pushl $0 801062c4: 6a 00 push $0x0 pushl $101 801062c6: 6a 65 push $0x65 jmp alltraps 801062c8: e9 81 f7 ff ff jmp 80105a4e 801062cd : .globl vector102 vector102: pushl $0 801062cd: 6a 00 push $0x0 pushl $102 801062cf: 6a 66 push $0x66 jmp alltraps 801062d1: e9 78 f7 ff ff jmp 80105a4e 801062d6 : .globl vector103 vector103: pushl $0 801062d6: 6a 00 push $0x0 pushl $103 801062d8: 6a 67 push $0x67 jmp alltraps 801062da: e9 6f f7 ff ff jmp 80105a4e 801062df : .globl vector104 vector104: pushl $0 801062df: 6a 00 push $0x0 pushl $104 801062e1: 6a 68 push $0x68 jmp alltraps 801062e3: e9 66 f7 ff ff jmp 80105a4e 801062e8 : .globl vector105 vector105: pushl $0 801062e8: 6a 00 push $0x0 pushl $105 801062ea: 6a 69 push $0x69 jmp alltraps 801062ec: e9 5d f7 ff ff jmp 80105a4e 801062f1 : .globl vector106 vector106: pushl $0 801062f1: 6a 00 push $0x0 pushl $106 801062f3: 6a 6a push $0x6a jmp alltraps 801062f5: e9 54 f7 ff ff jmp 80105a4e 801062fa : .globl vector107 vector107: pushl $0 801062fa: 6a 00 push $0x0 pushl $107 801062fc: 6a 6b push $0x6b jmp alltraps 801062fe: e9 4b f7 ff ff jmp 80105a4e 80106303 : .globl vector108 vector108: pushl $0 80106303: 6a 00 push $0x0 pushl $108 80106305: 6a 6c push $0x6c jmp alltraps 80106307: e9 42 f7 ff ff jmp 80105a4e 8010630c : .globl vector109 vector109: pushl $0 8010630c: 6a 00 push $0x0 pushl $109 8010630e: 6a 6d push $0x6d jmp alltraps 80106310: e9 39 f7 ff ff jmp 80105a4e 80106315 : .globl vector110 vector110: pushl $0 80106315: 6a 00 push $0x0 pushl $110 80106317: 6a 6e push $0x6e jmp alltraps 80106319: e9 30 f7 ff ff jmp 80105a4e 8010631e : .globl vector111 vector111: pushl $0 8010631e: 6a 00 push $0x0 pushl $111 80106320: 6a 6f push $0x6f jmp alltraps 80106322: e9 27 f7 ff ff jmp 80105a4e 80106327 : .globl vector112 vector112: pushl $0 80106327: 6a 00 push $0x0 pushl $112 80106329: 6a 70 push $0x70 jmp alltraps 8010632b: e9 1e f7 ff ff jmp 80105a4e 80106330 : .globl vector113 vector113: pushl $0 80106330: 6a 00 push $0x0 pushl $113 80106332: 6a 71 push $0x71 jmp alltraps 80106334: e9 15 f7 ff ff jmp 80105a4e 80106339 : .globl vector114 vector114: pushl $0 80106339: 6a 00 push $0x0 pushl $114 8010633b: 6a 72 push $0x72 jmp alltraps 8010633d: e9 0c f7 ff ff jmp 80105a4e 80106342 : .globl vector115 vector115: pushl $0 80106342: 6a 00 push $0x0 pushl $115 80106344: 6a 73 push $0x73 jmp alltraps 80106346: e9 03 f7 ff ff jmp 80105a4e 8010634b : .globl vector116 vector116: pushl $0 8010634b: 6a 00 push $0x0 pushl $116 8010634d: 6a 74 push $0x74 jmp alltraps 8010634f: e9 fa f6 ff ff jmp 80105a4e 80106354 : .globl vector117 vector117: pushl $0 80106354: 6a 00 push $0x0 pushl $117 80106356: 6a 75 push $0x75 jmp alltraps 80106358: e9 f1 f6 ff ff jmp 80105a4e 8010635d : .globl vector118 vector118: pushl $0 8010635d: 6a 00 push $0x0 pushl $118 8010635f: 6a 76 push $0x76 jmp alltraps 80106361: e9 e8 f6 ff ff jmp 80105a4e 80106366 : .globl vector119 vector119: pushl $0 80106366: 6a 00 push $0x0 pushl $119 80106368: 6a 77 push $0x77 jmp alltraps 8010636a: e9 df f6 ff ff jmp 80105a4e 8010636f : .globl vector120 vector120: pushl $0 8010636f: 6a 00 push $0x0 pushl $120 80106371: 6a 78 push $0x78 jmp alltraps 80106373: e9 d6 f6 ff ff jmp 80105a4e 80106378 : .globl vector121 vector121: pushl $0 80106378: 6a 00 push $0x0 pushl $121 8010637a: 6a 79 push $0x79 jmp alltraps 8010637c: e9 cd f6 ff ff jmp 80105a4e 80106381 : .globl vector122 vector122: pushl $0 80106381: 6a 00 push $0x0 pushl $122 80106383: 6a 7a push $0x7a jmp alltraps 80106385: e9 c4 f6 ff ff jmp 80105a4e 8010638a : .globl vector123 vector123: pushl $0 8010638a: 6a 00 push $0x0 pushl $123 8010638c: 6a 7b push $0x7b jmp alltraps 8010638e: e9 bb f6 ff ff jmp 80105a4e 80106393 : .globl vector124 vector124: pushl $0 80106393: 6a 00 push $0x0 pushl $124 80106395: 6a 7c push $0x7c jmp alltraps 80106397: e9 b2 f6 ff ff jmp 80105a4e 8010639c : .globl vector125 vector125: pushl $0 8010639c: 6a 00 push $0x0 pushl $125 8010639e: 6a 7d push $0x7d jmp alltraps 801063a0: e9 a9 f6 ff ff jmp 80105a4e 801063a5 : .globl vector126 vector126: pushl $0 801063a5: 6a 00 push $0x0 pushl $126 801063a7: 6a 7e push $0x7e jmp alltraps 801063a9: e9 a0 f6 ff ff jmp 80105a4e 801063ae : .globl vector127 vector127: pushl $0 801063ae: 6a 00 push $0x0 pushl $127 801063b0: 6a 7f push $0x7f jmp alltraps 801063b2: e9 97 f6 ff ff jmp 80105a4e 801063b7 : .globl vector128 vector128: pushl $0 801063b7: 6a 00 push $0x0 pushl $128 801063b9: 68 80 00 00 00 push $0x80 jmp alltraps 801063be: e9 8b f6 ff ff jmp 80105a4e 801063c3 : .globl vector129 vector129: pushl $0 801063c3: 6a 00 push $0x0 pushl $129 801063c5: 68 81 00 00 00 push $0x81 jmp alltraps 801063ca: e9 7f f6 ff ff jmp 80105a4e 801063cf : .globl vector130 vector130: pushl $0 801063cf: 6a 00 push $0x0 pushl $130 801063d1: 68 82 00 00 00 push $0x82 jmp alltraps 801063d6: e9 73 f6 ff ff jmp 80105a4e 801063db : .globl vector131 vector131: pushl $0 801063db: 6a 00 push $0x0 pushl $131 801063dd: 68 83 00 00 00 push $0x83 jmp alltraps 801063e2: e9 67 f6 ff ff jmp 80105a4e 801063e7 : .globl vector132 vector132: pushl $0 801063e7: 6a 00 push $0x0 pushl $132 801063e9: 68 84 00 00 00 push $0x84 jmp alltraps 801063ee: e9 5b f6 ff ff jmp 80105a4e 801063f3 : .globl vector133 vector133: pushl $0 801063f3: 6a 00 push $0x0 pushl $133 801063f5: 68 85 00 00 00 push $0x85 jmp alltraps 801063fa: e9 4f f6 ff ff jmp 80105a4e 801063ff : .globl vector134 vector134: pushl $0 801063ff: 6a 00 push $0x0 pushl $134 80106401: 68 86 00 00 00 push $0x86 jmp alltraps 80106406: e9 43 f6 ff ff jmp 80105a4e 8010640b : .globl vector135 vector135: pushl $0 8010640b: 6a 00 push $0x0 pushl $135 8010640d: 68 87 00 00 00 push $0x87 jmp alltraps 80106412: e9 37 f6 ff ff jmp 80105a4e 80106417 : .globl vector136 vector136: pushl $0 80106417: 6a 00 push $0x0 pushl $136 80106419: 68 88 00 00 00 push $0x88 jmp alltraps 8010641e: e9 2b f6 ff ff jmp 80105a4e 80106423 : .globl vector137 vector137: pushl $0 80106423: 6a 00 push $0x0 pushl $137 80106425: 68 89 00 00 00 push $0x89 jmp alltraps 8010642a: e9 1f f6 ff ff jmp 80105a4e 8010642f : .globl vector138 vector138: pushl $0 8010642f: 6a 00 push $0x0 pushl $138 80106431: 68 8a 00 00 00 push $0x8a jmp alltraps 80106436: e9 13 f6 ff ff jmp 80105a4e 8010643b : .globl vector139 vector139: pushl $0 8010643b: 6a 00 push $0x0 pushl $139 8010643d: 68 8b 00 00 00 push $0x8b jmp alltraps 80106442: e9 07 f6 ff ff jmp 80105a4e 80106447 : .globl vector140 vector140: pushl $0 80106447: 6a 00 push $0x0 pushl $140 80106449: 68 8c 00 00 00 push $0x8c jmp alltraps 8010644e: e9 fb f5 ff ff jmp 80105a4e 80106453 : .globl vector141 vector141: pushl $0 80106453: 6a 00 push $0x0 pushl $141 80106455: 68 8d 00 00 00 push $0x8d jmp alltraps 8010645a: e9 ef f5 ff ff jmp 80105a4e 8010645f : .globl vector142 vector142: pushl $0 8010645f: 6a 00 push $0x0 pushl $142 80106461: 68 8e 00 00 00 push $0x8e jmp alltraps 80106466: e9 e3 f5 ff ff jmp 80105a4e 8010646b : .globl vector143 vector143: pushl $0 8010646b: 6a 00 push $0x0 pushl $143 8010646d: 68 8f 00 00 00 push $0x8f jmp alltraps 80106472: e9 d7 f5 ff ff jmp 80105a4e 80106477 : .globl vector144 vector144: pushl $0 80106477: 6a 00 push $0x0 pushl $144 80106479: 68 90 00 00 00 push $0x90 jmp alltraps 8010647e: e9 cb f5 ff ff jmp 80105a4e 80106483 : .globl vector145 vector145: pushl $0 80106483: 6a 00 push $0x0 pushl $145 80106485: 68 91 00 00 00 push $0x91 jmp alltraps 8010648a: e9 bf f5 ff ff jmp 80105a4e 8010648f : .globl vector146 vector146: pushl $0 8010648f: 6a 00 push $0x0 pushl $146 80106491: 68 92 00 00 00 push $0x92 jmp alltraps 80106496: e9 b3 f5 ff ff jmp 80105a4e 8010649b : .globl vector147 vector147: pushl $0 8010649b: 6a 00 push $0x0 pushl $147 8010649d: 68 93 00 00 00 push $0x93 jmp alltraps 801064a2: e9 a7 f5 ff ff jmp 80105a4e 801064a7 : .globl vector148 vector148: pushl $0 801064a7: 6a 00 push $0x0 pushl $148 801064a9: 68 94 00 00 00 push $0x94 jmp alltraps 801064ae: e9 9b f5 ff ff jmp 80105a4e 801064b3 : .globl vector149 vector149: pushl $0 801064b3: 6a 00 push $0x0 pushl $149 801064b5: 68 95 00 00 00 push $0x95 jmp alltraps 801064ba: e9 8f f5 ff ff jmp 80105a4e 801064bf : .globl vector150 vector150: pushl $0 801064bf: 6a 00 push $0x0 pushl $150 801064c1: 68 96 00 00 00 push $0x96 jmp alltraps 801064c6: e9 83 f5 ff ff jmp 80105a4e 801064cb : .globl vector151 vector151: pushl $0 801064cb: 6a 00 push $0x0 pushl $151 801064cd: 68 97 00 00 00 push $0x97 jmp alltraps 801064d2: e9 77 f5 ff ff jmp 80105a4e 801064d7 : .globl vector152 vector152: pushl $0 801064d7: 6a 00 push $0x0 pushl $152 801064d9: 68 98 00 00 00 push $0x98 jmp alltraps 801064de: e9 6b f5 ff ff jmp 80105a4e 801064e3 : .globl vector153 vector153: pushl $0 801064e3: 6a 00 push $0x0 pushl $153 801064e5: 68 99 00 00 00 push $0x99 jmp alltraps 801064ea: e9 5f f5 ff ff jmp 80105a4e 801064ef : .globl vector154 vector154: pushl $0 801064ef: 6a 00 push $0x0 pushl $154 801064f1: 68 9a 00 00 00 push $0x9a jmp alltraps 801064f6: e9 53 f5 ff ff jmp 80105a4e 801064fb : .globl vector155 vector155: pushl $0 801064fb: 6a 00 push $0x0 pushl $155 801064fd: 68 9b 00 00 00 push $0x9b jmp alltraps 80106502: e9 47 f5 ff ff jmp 80105a4e 80106507 : .globl vector156 vector156: pushl $0 80106507: 6a 00 push $0x0 pushl $156 80106509: 68 9c 00 00 00 push $0x9c jmp alltraps 8010650e: e9 3b f5 ff ff jmp 80105a4e 80106513 : .globl vector157 vector157: pushl $0 80106513: 6a 00 push $0x0 pushl $157 80106515: 68 9d 00 00 00 push $0x9d jmp alltraps 8010651a: e9 2f f5 ff ff jmp 80105a4e 8010651f : .globl vector158 vector158: pushl $0 8010651f: 6a 00 push $0x0 pushl $158 80106521: 68 9e 00 00 00 push $0x9e jmp alltraps 80106526: e9 23 f5 ff ff jmp 80105a4e 8010652b : .globl vector159 vector159: pushl $0 8010652b: 6a 00 push $0x0 pushl $159 8010652d: 68 9f 00 00 00 push $0x9f jmp alltraps 80106532: e9 17 f5 ff ff jmp 80105a4e 80106537 : .globl vector160 vector160: pushl $0 80106537: 6a 00 push $0x0 pushl $160 80106539: 68 a0 00 00 00 push $0xa0 jmp alltraps 8010653e: e9 0b f5 ff ff jmp 80105a4e 80106543 : .globl vector161 vector161: pushl $0 80106543: 6a 00 push $0x0 pushl $161 80106545: 68 a1 00 00 00 push $0xa1 jmp alltraps 8010654a: e9 ff f4 ff ff jmp 80105a4e 8010654f : .globl vector162 vector162: pushl $0 8010654f: 6a 00 push $0x0 pushl $162 80106551: 68 a2 00 00 00 push $0xa2 jmp alltraps 80106556: e9 f3 f4 ff ff jmp 80105a4e 8010655b : .globl vector163 vector163: pushl $0 8010655b: 6a 00 push $0x0 pushl $163 8010655d: 68 a3 00 00 00 push $0xa3 jmp alltraps 80106562: e9 e7 f4 ff ff jmp 80105a4e 80106567 : .globl vector164 vector164: pushl $0 80106567: 6a 00 push $0x0 pushl $164 80106569: 68 a4 00 00 00 push $0xa4 jmp alltraps 8010656e: e9 db f4 ff ff jmp 80105a4e 80106573 : .globl vector165 vector165: pushl $0 80106573: 6a 00 push $0x0 pushl $165 80106575: 68 a5 00 00 00 push $0xa5 jmp alltraps 8010657a: e9 cf f4 ff ff jmp 80105a4e 8010657f : .globl vector166 vector166: pushl $0 8010657f: 6a 00 push $0x0 pushl $166 80106581: 68 a6 00 00 00 push $0xa6 jmp alltraps 80106586: e9 c3 f4 ff ff jmp 80105a4e 8010658b : .globl vector167 vector167: pushl $0 8010658b: 6a 00 push $0x0 pushl $167 8010658d: 68 a7 00 00 00 push $0xa7 jmp alltraps 80106592: e9 b7 f4 ff ff jmp 80105a4e 80106597 : .globl vector168 vector168: pushl $0 80106597: 6a 00 push $0x0 pushl $168 80106599: 68 a8 00 00 00 push $0xa8 jmp alltraps 8010659e: e9 ab f4 ff ff jmp 80105a4e 801065a3 : .globl vector169 vector169: pushl $0 801065a3: 6a 00 push $0x0 pushl $169 801065a5: 68 a9 00 00 00 push $0xa9 jmp alltraps 801065aa: e9 9f f4 ff ff jmp 80105a4e 801065af : .globl vector170 vector170: pushl $0 801065af: 6a 00 push $0x0 pushl $170 801065b1: 68 aa 00 00 00 push $0xaa jmp alltraps 801065b6: e9 93 f4 ff ff jmp 80105a4e 801065bb : .globl vector171 vector171: pushl $0 801065bb: 6a 00 push $0x0 pushl $171 801065bd: 68 ab 00 00 00 push $0xab jmp alltraps 801065c2: e9 87 f4 ff ff jmp 80105a4e 801065c7 : .globl vector172 vector172: pushl $0 801065c7: 6a 00 push $0x0 pushl $172 801065c9: 68 ac 00 00 00 push $0xac jmp alltraps 801065ce: e9 7b f4 ff ff jmp 80105a4e 801065d3 : .globl vector173 vector173: pushl $0 801065d3: 6a 00 push $0x0 pushl $173 801065d5: 68 ad 00 00 00 push $0xad jmp alltraps 801065da: e9 6f f4 ff ff jmp 80105a4e 801065df : .globl vector174 vector174: pushl $0 801065df: 6a 00 push $0x0 pushl $174 801065e1: 68 ae 00 00 00 push $0xae jmp alltraps 801065e6: e9 63 f4 ff ff jmp 80105a4e 801065eb : .globl vector175 vector175: pushl $0 801065eb: 6a 00 push $0x0 pushl $175 801065ed: 68 af 00 00 00 push $0xaf jmp alltraps 801065f2: e9 57 f4 ff ff jmp 80105a4e 801065f7 : .globl vector176 vector176: pushl $0 801065f7: 6a 00 push $0x0 pushl $176 801065f9: 68 b0 00 00 00 push $0xb0 jmp alltraps 801065fe: e9 4b f4 ff ff jmp 80105a4e 80106603 : .globl vector177 vector177: pushl $0 80106603: 6a 00 push $0x0 pushl $177 80106605: 68 b1 00 00 00 push $0xb1 jmp alltraps 8010660a: e9 3f f4 ff ff jmp 80105a4e 8010660f : .globl vector178 vector178: pushl $0 8010660f: 6a 00 push $0x0 pushl $178 80106611: 68 b2 00 00 00 push $0xb2 jmp alltraps 80106616: e9 33 f4 ff ff jmp 80105a4e 8010661b : .globl vector179 vector179: pushl $0 8010661b: 6a 00 push $0x0 pushl $179 8010661d: 68 b3 00 00 00 push $0xb3 jmp alltraps 80106622: e9 27 f4 ff ff jmp 80105a4e 80106627 : .globl vector180 vector180: pushl $0 80106627: 6a 00 push $0x0 pushl $180 80106629: 68 b4 00 00 00 push $0xb4 jmp alltraps 8010662e: e9 1b f4 ff ff jmp 80105a4e 80106633 : .globl vector181 vector181: pushl $0 80106633: 6a 00 push $0x0 pushl $181 80106635: 68 b5 00 00 00 push $0xb5 jmp alltraps 8010663a: e9 0f f4 ff ff jmp 80105a4e 8010663f : .globl vector182 vector182: pushl $0 8010663f: 6a 00 push $0x0 pushl $182 80106641: 68 b6 00 00 00 push $0xb6 jmp alltraps 80106646: e9 03 f4 ff ff jmp 80105a4e 8010664b : .globl vector183 vector183: pushl $0 8010664b: 6a 00 push $0x0 pushl $183 8010664d: 68 b7 00 00 00 push $0xb7 jmp alltraps 80106652: e9 f7 f3 ff ff jmp 80105a4e 80106657 : .globl vector184 vector184: pushl $0 80106657: 6a 00 push $0x0 pushl $184 80106659: 68 b8 00 00 00 push $0xb8 jmp alltraps 8010665e: e9 eb f3 ff ff jmp 80105a4e 80106663 : .globl vector185 vector185: pushl $0 80106663: 6a 00 push $0x0 pushl $185 80106665: 68 b9 00 00 00 push $0xb9 jmp alltraps 8010666a: e9 df f3 ff ff jmp 80105a4e 8010666f : .globl vector186 vector186: pushl $0 8010666f: 6a 00 push $0x0 pushl $186 80106671: 68 ba 00 00 00 push $0xba jmp alltraps 80106676: e9 d3 f3 ff ff jmp 80105a4e 8010667b : .globl vector187 vector187: pushl $0 8010667b: 6a 00 push $0x0 pushl $187 8010667d: 68 bb 00 00 00 push $0xbb jmp alltraps 80106682: e9 c7 f3 ff ff jmp 80105a4e 80106687 : .globl vector188 vector188: pushl $0 80106687: 6a 00 push $0x0 pushl $188 80106689: 68 bc 00 00 00 push $0xbc jmp alltraps 8010668e: e9 bb f3 ff ff jmp 80105a4e 80106693 : .globl vector189 vector189: pushl $0 80106693: 6a 00 push $0x0 pushl $189 80106695: 68 bd 00 00 00 push $0xbd jmp alltraps 8010669a: e9 af f3 ff ff jmp 80105a4e 8010669f : .globl vector190 vector190: pushl $0 8010669f: 6a 00 push $0x0 pushl $190 801066a1: 68 be 00 00 00 push $0xbe jmp alltraps 801066a6: e9 a3 f3 ff ff jmp 80105a4e 801066ab : .globl vector191 vector191: pushl $0 801066ab: 6a 00 push $0x0 pushl $191 801066ad: 68 bf 00 00 00 push $0xbf jmp alltraps 801066b2: e9 97 f3 ff ff jmp 80105a4e 801066b7 : .globl vector192 vector192: pushl $0 801066b7: 6a 00 push $0x0 pushl $192 801066b9: 68 c0 00 00 00 push $0xc0 jmp alltraps 801066be: e9 8b f3 ff ff jmp 80105a4e 801066c3 : .globl vector193 vector193: pushl $0 801066c3: 6a 00 push $0x0 pushl $193 801066c5: 68 c1 00 00 00 push $0xc1 jmp alltraps 801066ca: e9 7f f3 ff ff jmp 80105a4e 801066cf : .globl vector194 vector194: pushl $0 801066cf: 6a 00 push $0x0 pushl $194 801066d1: 68 c2 00 00 00 push $0xc2 jmp alltraps 801066d6: e9 73 f3 ff ff jmp 80105a4e 801066db : .globl vector195 vector195: pushl $0 801066db: 6a 00 push $0x0 pushl $195 801066dd: 68 c3 00 00 00 push $0xc3 jmp alltraps 801066e2: e9 67 f3 ff ff jmp 80105a4e 801066e7 : .globl vector196 vector196: pushl $0 801066e7: 6a 00 push $0x0 pushl $196 801066e9: 68 c4 00 00 00 push $0xc4 jmp alltraps 801066ee: e9 5b f3 ff ff jmp 80105a4e 801066f3 : .globl vector197 vector197: pushl $0 801066f3: 6a 00 push $0x0 pushl $197 801066f5: 68 c5 00 00 00 push $0xc5 jmp alltraps 801066fa: e9 4f f3 ff ff jmp 80105a4e 801066ff : .globl vector198 vector198: pushl $0 801066ff: 6a 00 push $0x0 pushl $198 80106701: 68 c6 00 00 00 push $0xc6 jmp alltraps 80106706: e9 43 f3 ff ff jmp 80105a4e 8010670b : .globl vector199 vector199: pushl $0 8010670b: 6a 00 push $0x0 pushl $199 8010670d: 68 c7 00 00 00 push $0xc7 jmp alltraps 80106712: e9 37 f3 ff ff jmp 80105a4e 80106717 : .globl vector200 vector200: pushl $0 80106717: 6a 00 push $0x0 pushl $200 80106719: 68 c8 00 00 00 push $0xc8 jmp alltraps 8010671e: e9 2b f3 ff ff jmp 80105a4e 80106723 : .globl vector201 vector201: pushl $0 80106723: 6a 00 push $0x0 pushl $201 80106725: 68 c9 00 00 00 push $0xc9 jmp alltraps 8010672a: e9 1f f3 ff ff jmp 80105a4e 8010672f : .globl vector202 vector202: pushl $0 8010672f: 6a 00 push $0x0 pushl $202 80106731: 68 ca 00 00 00 push $0xca jmp alltraps 80106736: e9 13 f3 ff ff jmp 80105a4e 8010673b : .globl vector203 vector203: pushl $0 8010673b: 6a 00 push $0x0 pushl $203 8010673d: 68 cb 00 00 00 push $0xcb jmp alltraps 80106742: e9 07 f3 ff ff jmp 80105a4e 80106747 : .globl vector204 vector204: pushl $0 80106747: 6a 00 push $0x0 pushl $204 80106749: 68 cc 00 00 00 push $0xcc jmp alltraps 8010674e: e9 fb f2 ff ff jmp 80105a4e 80106753 : .globl vector205 vector205: pushl $0 80106753: 6a 00 push $0x0 pushl $205 80106755: 68 cd 00 00 00 push $0xcd jmp alltraps 8010675a: e9 ef f2 ff ff jmp 80105a4e 8010675f : .globl vector206 vector206: pushl $0 8010675f: 6a 00 push $0x0 pushl $206 80106761: 68 ce 00 00 00 push $0xce jmp alltraps 80106766: e9 e3 f2 ff ff jmp 80105a4e 8010676b : .globl vector207 vector207: pushl $0 8010676b: 6a 00 push $0x0 pushl $207 8010676d: 68 cf 00 00 00 push $0xcf jmp alltraps 80106772: e9 d7 f2 ff ff jmp 80105a4e 80106777 : .globl vector208 vector208: pushl $0 80106777: 6a 00 push $0x0 pushl $208 80106779: 68 d0 00 00 00 push $0xd0 jmp alltraps 8010677e: e9 cb f2 ff ff jmp 80105a4e 80106783 : .globl vector209 vector209: pushl $0 80106783: 6a 00 push $0x0 pushl $209 80106785: 68 d1 00 00 00 push $0xd1 jmp alltraps 8010678a: e9 bf f2 ff ff jmp 80105a4e 8010678f : .globl vector210 vector210: pushl $0 8010678f: 6a 00 push $0x0 pushl $210 80106791: 68 d2 00 00 00 push $0xd2 jmp alltraps 80106796: e9 b3 f2 ff ff jmp 80105a4e 8010679b : .globl vector211 vector211: pushl $0 8010679b: 6a 00 push $0x0 pushl $211 8010679d: 68 d3 00 00 00 push $0xd3 jmp alltraps 801067a2: e9 a7 f2 ff ff jmp 80105a4e 801067a7 : .globl vector212 vector212: pushl $0 801067a7: 6a 00 push $0x0 pushl $212 801067a9: 68 d4 00 00 00 push $0xd4 jmp alltraps 801067ae: e9 9b f2 ff ff jmp 80105a4e 801067b3 : .globl vector213 vector213: pushl $0 801067b3: 6a 00 push $0x0 pushl $213 801067b5: 68 d5 00 00 00 push $0xd5 jmp alltraps 801067ba: e9 8f f2 ff ff jmp 80105a4e 801067bf : .globl vector214 vector214: pushl $0 801067bf: 6a 00 push $0x0 pushl $214 801067c1: 68 d6 00 00 00 push $0xd6 jmp alltraps 801067c6: e9 83 f2 ff ff jmp 80105a4e 801067cb : .globl vector215 vector215: pushl $0 801067cb: 6a 00 push $0x0 pushl $215 801067cd: 68 d7 00 00 00 push $0xd7 jmp alltraps 801067d2: e9 77 f2 ff ff jmp 80105a4e 801067d7 : .globl vector216 vector216: pushl $0 801067d7: 6a 00 push $0x0 pushl $216 801067d9: 68 d8 00 00 00 push $0xd8 jmp alltraps 801067de: e9 6b f2 ff ff jmp 80105a4e 801067e3 : .globl vector217 vector217: pushl $0 801067e3: 6a 00 push $0x0 pushl $217 801067e5: 68 d9 00 00 00 push $0xd9 jmp alltraps 801067ea: e9 5f f2 ff ff jmp 80105a4e 801067ef : .globl vector218 vector218: pushl $0 801067ef: 6a 00 push $0x0 pushl $218 801067f1: 68 da 00 00 00 push $0xda jmp alltraps 801067f6: e9 53 f2 ff ff jmp 80105a4e 801067fb : .globl vector219 vector219: pushl $0 801067fb: 6a 00 push $0x0 pushl $219 801067fd: 68 db 00 00 00 push $0xdb jmp alltraps 80106802: e9 47 f2 ff ff jmp 80105a4e 80106807 : .globl vector220 vector220: pushl $0 80106807: 6a 00 push $0x0 pushl $220 80106809: 68 dc 00 00 00 push $0xdc jmp alltraps 8010680e: e9 3b f2 ff ff jmp 80105a4e 80106813 : .globl vector221 vector221: pushl $0 80106813: 6a 00 push $0x0 pushl $221 80106815: 68 dd 00 00 00 push $0xdd jmp alltraps 8010681a: e9 2f f2 ff ff jmp 80105a4e 8010681f : .globl vector222 vector222: pushl $0 8010681f: 6a 00 push $0x0 pushl $222 80106821: 68 de 00 00 00 push $0xde jmp alltraps 80106826: e9 23 f2 ff ff jmp 80105a4e 8010682b : .globl vector223 vector223: pushl $0 8010682b: 6a 00 push $0x0 pushl $223 8010682d: 68 df 00 00 00 push $0xdf jmp alltraps 80106832: e9 17 f2 ff ff jmp 80105a4e 80106837 : .globl vector224 vector224: pushl $0 80106837: 6a 00 push $0x0 pushl $224 80106839: 68 e0 00 00 00 push $0xe0 jmp alltraps 8010683e: e9 0b f2 ff ff jmp 80105a4e 80106843 : .globl vector225 vector225: pushl $0 80106843: 6a 00 push $0x0 pushl $225 80106845: 68 e1 00 00 00 push $0xe1 jmp alltraps 8010684a: e9 ff f1 ff ff jmp 80105a4e 8010684f : .globl vector226 vector226: pushl $0 8010684f: 6a 00 push $0x0 pushl $226 80106851: 68 e2 00 00 00 push $0xe2 jmp alltraps 80106856: e9 f3 f1 ff ff jmp 80105a4e 8010685b : .globl vector227 vector227: pushl $0 8010685b: 6a 00 push $0x0 pushl $227 8010685d: 68 e3 00 00 00 push $0xe3 jmp alltraps 80106862: e9 e7 f1 ff ff jmp 80105a4e 80106867 : .globl vector228 vector228: pushl $0 80106867: 6a 00 push $0x0 pushl $228 80106869: 68 e4 00 00 00 push $0xe4 jmp alltraps 8010686e: e9 db f1 ff ff jmp 80105a4e 80106873 : .globl vector229 vector229: pushl $0 80106873: 6a 00 push $0x0 pushl $229 80106875: 68 e5 00 00 00 push $0xe5 jmp alltraps 8010687a: e9 cf f1 ff ff jmp 80105a4e 8010687f : .globl vector230 vector230: pushl $0 8010687f: 6a 00 push $0x0 pushl $230 80106881: 68 e6 00 00 00 push $0xe6 jmp alltraps 80106886: e9 c3 f1 ff ff jmp 80105a4e 8010688b : .globl vector231 vector231: pushl $0 8010688b: 6a 00 push $0x0 pushl $231 8010688d: 68 e7 00 00 00 push $0xe7 jmp alltraps 80106892: e9 b7 f1 ff ff jmp 80105a4e 80106897 : .globl vector232 vector232: pushl $0 80106897: 6a 00 push $0x0 pushl $232 80106899: 68 e8 00 00 00 push $0xe8 jmp alltraps 8010689e: e9 ab f1 ff ff jmp 80105a4e 801068a3 : .globl vector233 vector233: pushl $0 801068a3: 6a 00 push $0x0 pushl $233 801068a5: 68 e9 00 00 00 push $0xe9 jmp alltraps 801068aa: e9 9f f1 ff ff jmp 80105a4e 801068af : .globl vector234 vector234: pushl $0 801068af: 6a 00 push $0x0 pushl $234 801068b1: 68 ea 00 00 00 push $0xea jmp alltraps 801068b6: e9 93 f1 ff ff jmp 80105a4e 801068bb : .globl vector235 vector235: pushl $0 801068bb: 6a 00 push $0x0 pushl $235 801068bd: 68 eb 00 00 00 push $0xeb jmp alltraps 801068c2: e9 87 f1 ff ff jmp 80105a4e 801068c7 : .globl vector236 vector236: pushl $0 801068c7: 6a 00 push $0x0 pushl $236 801068c9: 68 ec 00 00 00 push $0xec jmp alltraps 801068ce: e9 7b f1 ff ff jmp 80105a4e 801068d3 : .globl vector237 vector237: pushl $0 801068d3: 6a 00 push $0x0 pushl $237 801068d5: 68 ed 00 00 00 push $0xed jmp alltraps 801068da: e9 6f f1 ff ff jmp 80105a4e 801068df : .globl vector238 vector238: pushl $0 801068df: 6a 00 push $0x0 pushl $238 801068e1: 68 ee 00 00 00 push $0xee jmp alltraps 801068e6: e9 63 f1 ff ff jmp 80105a4e 801068eb : .globl vector239 vector239: pushl $0 801068eb: 6a 00 push $0x0 pushl $239 801068ed: 68 ef 00 00 00 push $0xef jmp alltraps 801068f2: e9 57 f1 ff ff jmp 80105a4e 801068f7 : .globl vector240 vector240: pushl $0 801068f7: 6a 00 push $0x0 pushl $240 801068f9: 68 f0 00 00 00 push $0xf0 jmp alltraps 801068fe: e9 4b f1 ff ff jmp 80105a4e 80106903 : .globl vector241 vector241: pushl $0 80106903: 6a 00 push $0x0 pushl $241 80106905: 68 f1 00 00 00 push $0xf1 jmp alltraps 8010690a: e9 3f f1 ff ff jmp 80105a4e 8010690f : .globl vector242 vector242: pushl $0 8010690f: 6a 00 push $0x0 pushl $242 80106911: 68 f2 00 00 00 push $0xf2 jmp alltraps 80106916: e9 33 f1 ff ff jmp 80105a4e 8010691b : .globl vector243 vector243: pushl $0 8010691b: 6a 00 push $0x0 pushl $243 8010691d: 68 f3 00 00 00 push $0xf3 jmp alltraps 80106922: e9 27 f1 ff ff jmp 80105a4e 80106927 : .globl vector244 vector244: pushl $0 80106927: 6a 00 push $0x0 pushl $244 80106929: 68 f4 00 00 00 push $0xf4 jmp alltraps 8010692e: e9 1b f1 ff ff jmp 80105a4e 80106933 : .globl vector245 vector245: pushl $0 80106933: 6a 00 push $0x0 pushl $245 80106935: 68 f5 00 00 00 push $0xf5 jmp alltraps 8010693a: e9 0f f1 ff ff jmp 80105a4e 8010693f : .globl vector246 vector246: pushl $0 8010693f: 6a 00 push $0x0 pushl $246 80106941: 68 f6 00 00 00 push $0xf6 jmp alltraps 80106946: e9 03 f1 ff ff jmp 80105a4e 8010694b : .globl vector247 vector247: pushl $0 8010694b: 6a 00 push $0x0 pushl $247 8010694d: 68 f7 00 00 00 push $0xf7 jmp alltraps 80106952: e9 f7 f0 ff ff jmp 80105a4e 80106957 : .globl vector248 vector248: pushl $0 80106957: 6a 00 push $0x0 pushl $248 80106959: 68 f8 00 00 00 push $0xf8 jmp alltraps 8010695e: e9 eb f0 ff ff jmp 80105a4e 80106963 : .globl vector249 vector249: pushl $0 80106963: 6a 00 push $0x0 pushl $249 80106965: 68 f9 00 00 00 push $0xf9 jmp alltraps 8010696a: e9 df f0 ff ff jmp 80105a4e 8010696f : .globl vector250 vector250: pushl $0 8010696f: 6a 00 push $0x0 pushl $250 80106971: 68 fa 00 00 00 push $0xfa jmp alltraps 80106976: e9 d3 f0 ff ff jmp 80105a4e 8010697b : .globl vector251 vector251: pushl $0 8010697b: 6a 00 push $0x0 pushl $251 8010697d: 68 fb 00 00 00 push $0xfb jmp alltraps 80106982: e9 c7 f0 ff ff jmp 80105a4e 80106987 : .globl vector252 vector252: pushl $0 80106987: 6a 00 push $0x0 pushl $252 80106989: 68 fc 00 00 00 push $0xfc jmp alltraps 8010698e: e9 bb f0 ff ff jmp 80105a4e 80106993 : .globl vector253 vector253: pushl $0 80106993: 6a 00 push $0x0 pushl $253 80106995: 68 fd 00 00 00 push $0xfd jmp alltraps 8010699a: e9 af f0 ff ff jmp 80105a4e 8010699f : .globl vector254 vector254: pushl $0 8010699f: 6a 00 push $0x0 pushl $254 801069a1: 68 fe 00 00 00 push $0xfe jmp alltraps 801069a6: e9 a3 f0 ff ff jmp 80105a4e 801069ab : .globl vector255 vector255: pushl $0 801069ab: 6a 00 push $0x0 pushl $255 801069ad: 68 ff 00 00 00 push $0xff jmp alltraps 801069b2: e9 97 f0 ff ff jmp 80105a4e 801069b7: 66 90 xchg %ax,%ax 801069b9: 66 90 xchg %ax,%ax 801069bb: 66 90 xchg %ax,%ax 801069bd: 66 90 xchg %ax,%ax 801069bf: 90 nop 801069c0 : // 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) { 801069c0: 55 push %ebp 801069c1: 89 e5 mov %esp,%ebp 801069c3: 57 push %edi 801069c4: 56 push %esi 801069c5: 53 push %ebx if (newsz >= oldsz) { return oldsz; } a = PGROUNDUP(newsz); 801069c6: 8d 99 ff 0f 00 00 lea 0xfff(%ecx),%ebx 801069cc: 81 e3 00 f0 ff ff and $0xfffff000,%ebx int deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 801069d2: 83 ec 1c sub $0x1c,%esp 801069d5: 89 4d e0 mov %ecx,-0x20(%ebp) for (; a < oldsz; a += PGSIZE) { 801069d8: 39 d3 cmp %edx,%ebx 801069da: 73 49 jae 80106a25 801069dc: 89 c7 mov %eax,%edi 801069de: eb 0c jmp 801069ec pte = walkpgdir(pgdir, (char*)a, 0); if (!pte) { a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; 801069e0: 83 c0 01 add $0x1,%eax 801069e3: c1 e0 16 shl $0x16,%eax 801069e6: 89 c3 mov %eax,%ebx for (; a < oldsz; a += PGSIZE) { 801069e8: 39 da cmp %ebx,%edx 801069ea: 76 39 jbe 80106a25 pde = &pgdir[PDX(va)]; 801069ec: 89 d8 mov %ebx,%eax 801069ee: c1 e8 16 shr $0x16,%eax if (*pde & PTE_P) { 801069f1: 8b 0c 87 mov (%edi,%eax,4),%ecx 801069f4: f6 c1 01 test $0x1,%cl 801069f7: 74 e7 je 801069e0 return &pgtab[PTX(va)]; 801069f9: 89 de mov %ebx,%esi pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 801069fb: 81 e1 00 f0 ff ff and $0xfffff000,%ecx return &pgtab[PTX(va)]; 80106a01: c1 ee 0a shr $0xa,%esi 80106a04: 81 e6 fc 0f 00 00 and $0xffc,%esi 80106a0a: 8d b4 31 00 00 00 80 lea -0x80000000(%ecx,%esi,1),%esi if (!pte) { 80106a11: 85 f6 test %esi,%esi 80106a13: 74 cb je 801069e0 } else if ((*pte & PTE_P) != 0) { 80106a15: 8b 06 mov (%esi),%eax 80106a17: a8 01 test $0x1,%al 80106a19: 75 15 jne 80106a30 for (; a < oldsz; a += PGSIZE) { 80106a1b: 81 c3 00 10 00 00 add $0x1000,%ebx 80106a21: 39 da cmp %ebx,%edx 80106a23: 77 c7 ja 801069ec kfree(v); *pte = 0; } } return newsz; } 80106a25: 8b 45 e0 mov -0x20(%ebp),%eax 80106a28: 8d 65 f4 lea -0xc(%ebp),%esp 80106a2b: 5b pop %ebx 80106a2c: 5e pop %esi 80106a2d: 5f pop %edi 80106a2e: 5d pop %ebp 80106a2f: c3 ret if (pa == 0) { 80106a30: 25 00 f0 ff ff and $0xfffff000,%eax 80106a35: 74 25 je 80106a5c kfree(v); 80106a37: 83 ec 0c sub $0xc,%esp char *v = P2V(pa); 80106a3a: 05 00 00 00 80 add $0x80000000,%eax 80106a3f: 89 55 e4 mov %edx,-0x1c(%ebp) for (; a < oldsz; a += PGSIZE) { 80106a42: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(v); 80106a48: 50 push %eax 80106a49: e8 92 bb ff ff call 801025e0 *pte = 0; 80106a4e: c7 06 00 00 00 00 movl $0x0,(%esi) for (; a < oldsz; a += PGSIZE) { 80106a54: 8b 55 e4 mov -0x1c(%ebp),%edx 80106a57: 83 c4 10 add $0x10,%esp 80106a5a: eb 8c jmp 801069e8 panic("kfree"); 80106a5c: 83 ec 0c sub $0xc,%esp 80106a5f: 68 46 76 10 80 push $0x80107646 80106a64: e8 27 99 ff ff call 80100390 80106a69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106a70 : static int mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm) { 80106a70: 55 push %ebp 80106a71: 89 e5 mov %esp,%ebp 80106a73: 57 push %edi 80106a74: 56 push %esi 80106a75: 53 push %ebx a = (char*)PGROUNDDOWN((uint)va); 80106a76: 89 d3 mov %edx,%ebx 80106a78: 81 e3 00 f0 ff ff and $0xfffff000,%ebx static int mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm) { 80106a7e: 83 ec 1c sub $0x1c,%esp 80106a81: 89 45 e4 mov %eax,-0x1c(%ebp) last = (char*)PGROUNDDOWN(((uint)va) + size - 1); 80106a84: 8d 44 0a ff lea -0x1(%edx,%ecx,1),%eax 80106a88: 25 00 f0 ff ff and $0xfffff000,%eax 80106a8d: 89 45 dc mov %eax,-0x24(%ebp) 80106a90: 8b 45 08 mov 0x8(%ebp),%eax 80106a93: 29 d8 sub %ebx,%eax 80106a95: 89 45 e0 mov %eax,-0x20(%ebp) 80106a98: eb 3d jmp 80106ad7 80106a9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return &pgtab[PTX(va)]; 80106aa0: 89 da mov %ebx,%edx pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 80106aa2: 25 00 f0 ff ff and $0xfffff000,%eax return &pgtab[PTX(va)]; 80106aa7: c1 ea 0a shr $0xa,%edx 80106aaa: 81 e2 fc 0f 00 00 and $0xffc,%edx 80106ab0: 8d 84 10 00 00 00 80 lea -0x80000000(%eax,%edx,1),%eax if ((pte = walkpgdir(pgdir, a, 1)) == 0) { 80106ab7: 85 c0 test %eax,%eax 80106ab9: 74 75 je 80106b30 if (*pte & PTE_P) { 80106abb: f6 00 01 testb $0x1,(%eax) 80106abe: 0f 85 86 00 00 00 jne 80106b4a *pte = pa | perm | PTE_P; 80106ac4: 0b 75 0c or 0xc(%ebp),%esi 80106ac7: 83 ce 01 or $0x1,%esi 80106aca: 89 30 mov %esi,(%eax) if (a == last) { 80106acc: 3b 5d dc cmp -0x24(%ebp),%ebx 80106acf: 74 6f je 80106b40 a += PGSIZE; 80106ad1: 81 c3 00 10 00 00 add $0x1000,%ebx for (;;) { 80106ad7: 8b 45 e0 mov -0x20(%ebp),%eax pde = &pgdir[PDX(va)]; 80106ada: 8b 4d e4 mov -0x1c(%ebp),%ecx 80106add: 8d 34 18 lea (%eax,%ebx,1),%esi 80106ae0: 89 d8 mov %ebx,%eax 80106ae2: c1 e8 16 shr $0x16,%eax 80106ae5: 8d 3c 81 lea (%ecx,%eax,4),%edi if (*pde & PTE_P) { 80106ae8: 8b 07 mov (%edi),%eax 80106aea: a8 01 test $0x1,%al 80106aec: 75 b2 jne 80106aa0 if (!alloc || (pgtab = (pte_t*)kalloc()) == 0) { 80106aee: e8 ad bc ff ff call 801027a0 80106af3: 85 c0 test %eax,%eax 80106af5: 74 39 je 80106b30 memset(pgtab, 0, PGSIZE); 80106af7: 83 ec 04 sub $0x4,%esp 80106afa: 89 45 d8 mov %eax,-0x28(%ebp) 80106afd: 68 00 10 00 00 push $0x1000 80106b02: 6a 00 push $0x0 80106b04: 50 push %eax 80106b05: e8 b6 dc ff ff call 801047c0 *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; 80106b0a: 8b 55 d8 mov -0x28(%ebp),%edx return &pgtab[PTX(va)]; 80106b0d: 83 c4 10 add $0x10,%esp *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; 80106b10: 8d 82 00 00 00 80 lea -0x80000000(%edx),%eax 80106b16: 83 c8 07 or $0x7,%eax 80106b19: 89 07 mov %eax,(%edi) return &pgtab[PTX(va)]; 80106b1b: 89 d8 mov %ebx,%eax 80106b1d: c1 e8 0a shr $0xa,%eax 80106b20: 25 fc 0f 00 00 and $0xffc,%eax 80106b25: 01 d0 add %edx,%eax 80106b27: eb 92 jmp 80106abb 80106b29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } 80106b30: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 80106b33: b8 ff ff ff ff mov $0xffffffff,%eax } 80106b38: 5b pop %ebx 80106b39: 5e pop %esi 80106b3a: 5f pop %edi 80106b3b: 5d pop %ebp 80106b3c: c3 ret 80106b3d: 8d 76 00 lea 0x0(%esi),%esi 80106b40: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80106b43: 31 c0 xor %eax,%eax } 80106b45: 5b pop %ebx 80106b46: 5e pop %esi 80106b47: 5f pop %edi 80106b48: 5d pop %ebp 80106b49: c3 ret panic("remap"); 80106b4a: 83 ec 0c sub $0xc,%esp 80106b4d: 68 a0 7c 10 80 push $0x80107ca0 80106b52: e8 39 98 ff ff call 80100390 80106b57: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106b5e: 66 90 xchg %ax,%ax 80106b60 : void seginit(void) { 80106b60: 55 push %ebp 80106b61: 89 e5 mov %esp,%ebp 80106b63: 83 ec 18 sub $0x18,%esp c = &cpus[cpuid()]; 80106b66: e8 45 cf ff ff call 80103ab0 pd[0] = size - 1; 80106b6b: ba 2f 00 00 00 mov $0x2f,%edx 80106b70: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax 80106b76: 66 89 55 f2 mov %dx,-0xe(%ebp) c->gdt[SEG_KCODE] = SEG(STA_X | STA_R, 0, 0xffffffff, 0); 80106b7a: c7 80 38 18 11 80 ff movl $0xffff,-0x7feee7c8(%eax) 80106b81: ff 00 00 80106b84: c7 80 3c 18 11 80 00 movl $0xcf9a00,-0x7feee7c4(%eax) 80106b8b: 9a cf 00 c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); 80106b8e: c7 80 40 18 11 80 ff movl $0xffff,-0x7feee7c0(%eax) 80106b95: ff 00 00 80106b98: c7 80 44 18 11 80 00 movl $0xcf9200,-0x7feee7bc(%eax) 80106b9f: 92 cf 00 c->gdt[SEG_UCODE] = SEG(STA_X | STA_R, 0, 0xffffffff, DPL_USER); 80106ba2: c7 80 48 18 11 80 ff movl $0xffff,-0x7feee7b8(%eax) 80106ba9: ff 00 00 80106bac: c7 80 4c 18 11 80 00 movl $0xcffa00,-0x7feee7b4(%eax) 80106bb3: fa cf 00 c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); 80106bb6: c7 80 50 18 11 80 ff movl $0xffff,-0x7feee7b0(%eax) 80106bbd: ff 00 00 80106bc0: c7 80 54 18 11 80 00 movl $0xcff200,-0x7feee7ac(%eax) 80106bc7: f2 cf 00 lgdt(c->gdt, sizeof(c->gdt)); 80106bca: 05 30 18 11 80 add $0x80111830,%eax pd[1] = (uint)p; 80106bcf: 66 89 45 f4 mov %ax,-0xc(%ebp) pd[2] = (uint)p >> 16; 80106bd3: c1 e8 10 shr $0x10,%eax 80106bd6: 66 89 45 f6 mov %ax,-0xa(%ebp) asm volatile ("lgdt (%0)" : : "r" (pd)); 80106bda: 8d 45 f2 lea -0xe(%ebp),%eax 80106bdd: 0f 01 10 lgdtl (%eax) } 80106be0: c9 leave 80106be1: c3 ret 80106be2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106be9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106bf0 : lcr3(V2P(kpgdir)); // switch to the kernel page table 80106bf0: a1 e4 44 11 80 mov 0x801144e4,%eax 80106bf5: 05 00 00 00 80 add $0x80000000,%eax return val; } static inline void lcr3(uint val) { asm volatile ("movl %0,%%cr3" : : "r" (val)); 80106bfa: 0f 22 d8 mov %eax,%cr3 } 80106bfd: c3 ret 80106bfe: 66 90 xchg %ax,%ax 80106c00 : void switchuvm(struct proc *p) { 80106c00: 55 push %ebp 80106c01: 89 e5 mov %esp,%ebp 80106c03: 57 push %edi 80106c04: 56 push %esi 80106c05: 53 push %ebx 80106c06: 83 ec 1c sub $0x1c,%esp 80106c09: 8b 75 08 mov 0x8(%ebp),%esi if (p == 0) { 80106c0c: 85 f6 test %esi,%esi 80106c0e: 0f 84 cb 00 00 00 je 80106cdf if (p->kstack == 0) { 80106c14: 8b 46 08 mov 0x8(%esi),%eax 80106c17: 85 c0 test %eax,%eax 80106c19: 0f 84 da 00 00 00 je 80106cf9 if (p->pgdir == 0) { 80106c1f: 8b 46 04 mov 0x4(%esi),%eax 80106c22: 85 c0 test %eax,%eax 80106c24: 0f 84 c2 00 00 00 je 80106cec pushcli(); 80106c2a: e8 81 d9 ff ff call 801045b0 mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, 80106c2f: e8 1c ce ff ff call 80103a50 80106c34: 89 c3 mov %eax,%ebx 80106c36: e8 15 ce ff ff call 80103a50 80106c3b: 89 c7 mov %eax,%edi 80106c3d: e8 0e ce ff ff call 80103a50 80106c42: 83 c7 08 add $0x8,%edi 80106c45: 89 45 e4 mov %eax,-0x1c(%ebp) 80106c48: e8 03 ce ff ff call 80103a50 80106c4d: 8b 4d e4 mov -0x1c(%ebp),%ecx 80106c50: ba 67 00 00 00 mov $0x67,%edx 80106c55: 66 89 bb 9a 00 00 00 mov %di,0x9a(%ebx) 80106c5c: 83 c0 08 add $0x8,%eax 80106c5f: 66 89 93 98 00 00 00 mov %dx,0x98(%ebx) mycpu()->ts.iomb = (ushort) 0xFFFF; 80106c66: bf ff ff ff ff mov $0xffffffff,%edi mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, 80106c6b: 83 c1 08 add $0x8,%ecx 80106c6e: c1 e8 18 shr $0x18,%eax 80106c71: c1 e9 10 shr $0x10,%ecx 80106c74: 88 83 9f 00 00 00 mov %al,0x9f(%ebx) 80106c7a: 88 8b 9c 00 00 00 mov %cl,0x9c(%ebx) 80106c80: b9 99 40 00 00 mov $0x4099,%ecx 80106c85: 66 89 8b 9d 00 00 00 mov %cx,0x9d(%ebx) mycpu()->ts.ss0 = SEG_KDATA << 3; 80106c8c: bb 10 00 00 00 mov $0x10,%ebx mycpu()->gdt[SEG_TSS].s = 0; 80106c91: e8 ba cd ff ff call 80103a50 80106c96: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax) mycpu()->ts.ss0 = SEG_KDATA << 3; 80106c9d: e8 ae cd ff ff call 80103a50 80106ca2: 66 89 58 10 mov %bx,0x10(%eax) mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE; 80106ca6: 8b 5e 08 mov 0x8(%esi),%ebx 80106ca9: 81 c3 00 10 00 00 add $0x1000,%ebx 80106caf: e8 9c cd ff ff call 80103a50 80106cb4: 89 58 0c mov %ebx,0xc(%eax) mycpu()->ts.iomb = (ushort) 0xFFFF; 80106cb7: e8 94 cd ff ff call 80103a50 80106cbc: 66 89 78 6e mov %di,0x6e(%eax) asm volatile ("ltr %0" : : "r" (sel)); 80106cc0: b8 28 00 00 00 mov $0x28,%eax 80106cc5: 0f 00 d8 ltr %ax lcr3(V2P(p->pgdir)); // switch to process's address space 80106cc8: 8b 46 04 mov 0x4(%esi),%eax 80106ccb: 05 00 00 00 80 add $0x80000000,%eax asm volatile ("movl %0,%%cr3" : : "r" (val)); 80106cd0: 0f 22 d8 mov %eax,%cr3 } 80106cd3: 8d 65 f4 lea -0xc(%ebp),%esp 80106cd6: 5b pop %ebx 80106cd7: 5e pop %esi 80106cd8: 5f pop %edi 80106cd9: 5d pop %ebp popcli(); 80106cda: e9 21 d9 ff ff jmp 80104600 panic("switchuvm: no process"); 80106cdf: 83 ec 0c sub $0xc,%esp 80106ce2: 68 a6 7c 10 80 push $0x80107ca6 80106ce7: e8 a4 96 ff ff call 80100390 panic("switchuvm: no pgdir"); 80106cec: 83 ec 0c sub $0xc,%esp 80106cef: 68 d1 7c 10 80 push $0x80107cd1 80106cf4: e8 97 96 ff ff call 80100390 panic("switchuvm: no kstack"); 80106cf9: 83 ec 0c sub $0xc,%esp 80106cfc: 68 bc 7c 10 80 push $0x80107cbc 80106d01: e8 8a 96 ff ff call 80100390 80106d06: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106d0d: 8d 76 00 lea 0x0(%esi),%esi 80106d10 : void inituvm(pde_t *pgdir, char *init, uint sz) { 80106d10: 55 push %ebp 80106d11: 89 e5 mov %esp,%ebp 80106d13: 57 push %edi 80106d14: 56 push %esi 80106d15: 53 push %ebx 80106d16: 83 ec 1c sub $0x1c,%esp 80106d19: 8b 45 0c mov 0xc(%ebp),%eax 80106d1c: 8b 75 10 mov 0x10(%ebp),%esi 80106d1f: 8b 7d 08 mov 0x8(%ebp),%edi 80106d22: 89 45 e4 mov %eax,-0x1c(%ebp) if (sz >= PGSIZE) { 80106d25: 81 fe ff 0f 00 00 cmp $0xfff,%esi 80106d2b: 77 4b ja 80106d78 mem = kalloc(); 80106d2d: e8 6e ba ff ff call 801027a0 memset(mem, 0, PGSIZE); 80106d32: 83 ec 04 sub $0x4,%esp 80106d35: 68 00 10 00 00 push $0x1000 mem = kalloc(); 80106d3a: 89 c3 mov %eax,%ebx memset(mem, 0, PGSIZE); 80106d3c: 6a 00 push $0x0 80106d3e: 50 push %eax 80106d3f: e8 7c da ff ff call 801047c0 mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W | PTE_U); 80106d44: 58 pop %eax 80106d45: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 80106d4b: 5a pop %edx 80106d4c: 6a 06 push $0x6 80106d4e: b9 00 10 00 00 mov $0x1000,%ecx 80106d53: 31 d2 xor %edx,%edx 80106d55: 50 push %eax 80106d56: 89 f8 mov %edi,%eax 80106d58: e8 13 fd ff ff call 80106a70 memmove(mem, init, sz); 80106d5d: 8b 45 e4 mov -0x1c(%ebp),%eax 80106d60: 89 75 10 mov %esi,0x10(%ebp) 80106d63: 83 c4 10 add $0x10,%esp 80106d66: 89 5d 08 mov %ebx,0x8(%ebp) 80106d69: 89 45 0c mov %eax,0xc(%ebp) } 80106d6c: 8d 65 f4 lea -0xc(%ebp),%esp 80106d6f: 5b pop %ebx 80106d70: 5e pop %esi 80106d71: 5f pop %edi 80106d72: 5d pop %ebp memmove(mem, init, sz); 80106d73: e9 e8 da ff ff jmp 80104860 panic("inituvm: more than a page"); 80106d78: 83 ec 0c sub $0xc,%esp 80106d7b: 68 e5 7c 10 80 push $0x80107ce5 80106d80: e8 0b 96 ff ff call 80100390 80106d85: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106d8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106d90 : int loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz) { 80106d90: 55 push %ebp 80106d91: 89 e5 mov %esp,%ebp 80106d93: 57 push %edi 80106d94: 56 push %esi 80106d95: 53 push %ebx 80106d96: 83 ec 1c sub $0x1c,%esp 80106d99: 8b 45 0c mov 0xc(%ebp),%eax 80106d9c: 8b 75 18 mov 0x18(%ebp),%esi if ((uint) addr % PGSIZE != 0) { 80106d9f: a9 ff 0f 00 00 test $0xfff,%eax 80106da4: 0f 85 bb 00 00 00 jne 80106e65 for (i = 0; i < sz; i += PGSIZE) { 80106daa: 01 f0 add %esi,%eax 80106dac: 89 f3 mov %esi,%ebx 80106dae: 89 45 e4 mov %eax,-0x1c(%ebp) if (readi(ip, P2V(pa), offset + i, n) != n) { 80106db1: 8b 45 14 mov 0x14(%ebp),%eax 80106db4: 01 f0 add %esi,%eax 80106db6: 89 45 e0 mov %eax,-0x20(%ebp) for (i = 0; i < sz; i += PGSIZE) { 80106db9: 85 f6 test %esi,%esi 80106dbb: 0f 84 87 00 00 00 je 80106e48 80106dc1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi pde = &pgdir[PDX(va)]; 80106dc8: 8b 45 e4 mov -0x1c(%ebp),%eax if (*pde & PTE_P) { 80106dcb: 8b 4d 08 mov 0x8(%ebp),%ecx 80106dce: 29 d8 sub %ebx,%eax pde = &pgdir[PDX(va)]; 80106dd0: 89 c2 mov %eax,%edx 80106dd2: c1 ea 16 shr $0x16,%edx if (*pde & PTE_P) { 80106dd5: 8b 14 91 mov (%ecx,%edx,4),%edx 80106dd8: f6 c2 01 test $0x1,%dl 80106ddb: 75 13 jne 80106df0 panic("loaduvm: address should exist"); 80106ddd: 83 ec 0c sub $0xc,%esp 80106de0: 68 ff 7c 10 80 push $0x80107cff 80106de5: e8 a6 95 ff ff call 80100390 80106dea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return &pgtab[PTX(va)]; 80106df0: c1 e8 0a shr $0xa,%eax pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 80106df3: 81 e2 00 f0 ff ff and $0xfffff000,%edx return &pgtab[PTX(va)]; 80106df9: 25 fc 0f 00 00 and $0xffc,%eax 80106dfe: 8d 84 02 00 00 00 80 lea -0x80000000(%edx,%eax,1),%eax if ((pte = walkpgdir(pgdir, addr + i, 0)) == 0) { 80106e05: 85 c0 test %eax,%eax 80106e07: 74 d4 je 80106ddd pa = PTE_ADDR(*pte); 80106e09: 8b 00 mov (%eax),%eax if (readi(ip, P2V(pa), offset + i, n) != n) { 80106e0b: 8b 4d e0 mov -0x20(%ebp),%ecx if (sz - i < PGSIZE) { 80106e0e: bf 00 10 00 00 mov $0x1000,%edi pa = PTE_ADDR(*pte); 80106e13: 25 00 f0 ff ff and $0xfffff000,%eax if (sz - i < PGSIZE) { 80106e18: 81 fb ff 0f 00 00 cmp $0xfff,%ebx 80106e1e: 0f 46 fb cmovbe %ebx,%edi if (readi(ip, P2V(pa), offset + i, n) != n) { 80106e21: 29 d9 sub %ebx,%ecx 80106e23: 05 00 00 00 80 add $0x80000000,%eax 80106e28: 57 push %edi 80106e29: 51 push %ecx 80106e2a: 50 push %eax 80106e2b: ff 75 10 push 0x10(%ebp) 80106e2e: e8 7d ad ff ff call 80101bb0 80106e33: 83 c4 10 add $0x10,%esp 80106e36: 39 f8 cmp %edi,%eax 80106e38: 75 1e jne 80106e58 for (i = 0; i < sz; i += PGSIZE) { 80106e3a: 81 eb 00 10 00 00 sub $0x1000,%ebx 80106e40: 89 f0 mov %esi,%eax 80106e42: 29 d8 sub %ebx,%eax 80106e44: 39 c6 cmp %eax,%esi 80106e46: 77 80 ja 80106dc8 } 80106e48: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80106e4b: 31 c0 xor %eax,%eax } 80106e4d: 5b pop %ebx 80106e4e: 5e pop %esi 80106e4f: 5f pop %edi 80106e50: 5d pop %ebp 80106e51: c3 ret 80106e52: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106e58: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 80106e5b: b8 ff ff ff ff mov $0xffffffff,%eax } 80106e60: 5b pop %ebx 80106e61: 5e pop %esi 80106e62: 5f pop %edi 80106e63: 5d pop %ebp 80106e64: c3 ret panic("loaduvm: addr must be page aligned"); 80106e65: 83 ec 0c sub $0xc,%esp 80106e68: 68 a0 7d 10 80 push $0x80107da0 80106e6d: e8 1e 95 ff ff call 80100390 80106e72: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106e79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106e80 : int allocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 80106e80: 55 push %ebp 80106e81: 89 e5 mov %esp,%ebp 80106e83: 57 push %edi 80106e84: 56 push %esi 80106e85: 53 push %ebx 80106e86: 83 ec 1c sub $0x1c,%esp if (newsz >= KERNBASE) { 80106e89: 8b 45 10 mov 0x10(%ebp),%eax int allocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 80106e8c: 8b 7d 08 mov 0x8(%ebp),%edi if (newsz >= KERNBASE) { 80106e8f: 89 45 e4 mov %eax,-0x1c(%ebp) 80106e92: 85 c0 test %eax,%eax 80106e94: 0f 88 b6 00 00 00 js 80106f50 if (newsz < oldsz) { 80106e9a: 3b 45 0c cmp 0xc(%ebp),%eax return oldsz; 80106e9d: 8b 45 0c mov 0xc(%ebp),%eax if (newsz < oldsz) { 80106ea0: 0f 82 9a 00 00 00 jb 80106f40 a = PGROUNDUP(oldsz); 80106ea6: 8d b0 ff 0f 00 00 lea 0xfff(%eax),%esi 80106eac: 81 e6 00 f0 ff ff and $0xfffff000,%esi for (; a < newsz; a += PGSIZE) { 80106eb2: 39 75 10 cmp %esi,0x10(%ebp) 80106eb5: 77 44 ja 80106efb 80106eb7: e9 87 00 00 00 jmp 80106f43 80106ebc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi memset(mem, 0, PGSIZE); 80106ec0: 83 ec 04 sub $0x4,%esp 80106ec3: 68 00 10 00 00 push $0x1000 80106ec8: 6a 00 push $0x0 80106eca: 50 push %eax 80106ecb: e8 f0 d8 ff ff call 801047c0 if (mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W | PTE_U) < 0) { 80106ed0: 58 pop %eax 80106ed1: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 80106ed7: 5a pop %edx 80106ed8: 6a 06 push $0x6 80106eda: b9 00 10 00 00 mov $0x1000,%ecx 80106edf: 89 f2 mov %esi,%edx 80106ee1: 50 push %eax 80106ee2: 89 f8 mov %edi,%eax 80106ee4: e8 87 fb ff ff call 80106a70 80106ee9: 83 c4 10 add $0x10,%esp 80106eec: 85 c0 test %eax,%eax 80106eee: 78 78 js 80106f68 for (; a < newsz; a += PGSIZE) { 80106ef0: 81 c6 00 10 00 00 add $0x1000,%esi 80106ef6: 39 75 10 cmp %esi,0x10(%ebp) 80106ef9: 76 48 jbe 80106f43 mem = kalloc(); 80106efb: e8 a0 b8 ff ff call 801027a0 80106f00: 89 c3 mov %eax,%ebx if (mem == 0) { 80106f02: 85 c0 test %eax,%eax 80106f04: 75 ba jne 80106ec0 cprintf("allocuvm out of memory\n"); 80106f06: 83 ec 0c sub $0xc,%esp 80106f09: 68 1d 7d 10 80 push $0x80107d1d 80106f0e: e8 9d 97 ff ff call 801006b0 if (newsz >= oldsz) { 80106f13: 8b 45 0c mov 0xc(%ebp),%eax 80106f16: 83 c4 10 add $0x10,%esp 80106f19: 39 45 10 cmp %eax,0x10(%ebp) 80106f1c: 74 32 je 80106f50 80106f1e: 8b 55 10 mov 0x10(%ebp),%edx 80106f21: 89 c1 mov %eax,%ecx 80106f23: 89 f8 mov %edi,%eax 80106f25: e8 96 fa ff ff call 801069c0 return 0; 80106f2a: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) } 80106f31: 8b 45 e4 mov -0x1c(%ebp),%eax 80106f34: 8d 65 f4 lea -0xc(%ebp),%esp 80106f37: 5b pop %ebx 80106f38: 5e pop %esi 80106f39: 5f pop %edi 80106f3a: 5d pop %ebp 80106f3b: c3 ret 80106f3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return oldsz; 80106f40: 89 45 e4 mov %eax,-0x1c(%ebp) } 80106f43: 8b 45 e4 mov -0x1c(%ebp),%eax 80106f46: 8d 65 f4 lea -0xc(%ebp),%esp 80106f49: 5b pop %ebx 80106f4a: 5e pop %esi 80106f4b: 5f pop %edi 80106f4c: 5d pop %ebp 80106f4d: c3 ret 80106f4e: 66 90 xchg %ax,%ax return 0; 80106f50: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) } 80106f57: 8b 45 e4 mov -0x1c(%ebp),%eax 80106f5a: 8d 65 f4 lea -0xc(%ebp),%esp 80106f5d: 5b pop %ebx 80106f5e: 5e pop %esi 80106f5f: 5f pop %edi 80106f60: 5d pop %ebp 80106f61: c3 ret 80106f62: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cprintf("allocuvm out of memory (2)\n"); 80106f68: 83 ec 0c sub $0xc,%esp 80106f6b: 68 35 7d 10 80 push $0x80107d35 80106f70: e8 3b 97 ff ff call 801006b0 if (newsz >= oldsz) { 80106f75: 8b 45 0c mov 0xc(%ebp),%eax 80106f78: 83 c4 10 add $0x10,%esp 80106f7b: 39 45 10 cmp %eax,0x10(%ebp) 80106f7e: 74 0c je 80106f8c 80106f80: 8b 55 10 mov 0x10(%ebp),%edx 80106f83: 89 c1 mov %eax,%ecx 80106f85: 89 f8 mov %edi,%eax 80106f87: e8 34 fa ff ff call 801069c0 kfree(mem); 80106f8c: 83 ec 0c sub $0xc,%esp 80106f8f: 53 push %ebx 80106f90: e8 4b b6 ff ff call 801025e0 return 0; 80106f95: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 80106f9c: 83 c4 10 add $0x10,%esp } 80106f9f: 8b 45 e4 mov -0x1c(%ebp),%eax 80106fa2: 8d 65 f4 lea -0xc(%ebp),%esp 80106fa5: 5b pop %ebx 80106fa6: 5e pop %esi 80106fa7: 5f pop %edi 80106fa8: 5d pop %ebp 80106fa9: c3 ret 80106faa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106fb0 : int deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 80106fb0: 55 push %ebp 80106fb1: 89 e5 mov %esp,%ebp 80106fb3: 8b 55 0c mov 0xc(%ebp),%edx 80106fb6: 8b 4d 10 mov 0x10(%ebp),%ecx 80106fb9: 8b 45 08 mov 0x8(%ebp),%eax if (newsz >= oldsz) { 80106fbc: 39 d1 cmp %edx,%ecx 80106fbe: 73 10 jae 80106fd0 } 80106fc0: 5d pop %ebp 80106fc1: e9 fa f9 ff ff jmp 801069c0 80106fc6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106fcd: 8d 76 00 lea 0x0(%esi),%esi 80106fd0: 89 d0 mov %edx,%eax 80106fd2: 5d pop %ebp 80106fd3: c3 ret 80106fd4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106fdb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106fdf: 90 nop 80106fe0 : // Free a page table and all the physical memory pages // in the user part. void freevm(pde_t *pgdir) { 80106fe0: 55 push %ebp 80106fe1: 89 e5 mov %esp,%ebp 80106fe3: 57 push %edi 80106fe4: 56 push %esi 80106fe5: 53 push %ebx 80106fe6: 83 ec 0c sub $0xc,%esp 80106fe9: 8b 75 08 mov 0x8(%ebp),%esi uint i; if (pgdir == 0) { 80106fec: 85 f6 test %esi,%esi 80106fee: 74 59 je 80107049 if (newsz >= oldsz) { 80106ff0: 31 c9 xor %ecx,%ecx 80106ff2: ba 00 00 00 80 mov $0x80000000,%edx 80106ff7: 89 f0 mov %esi,%eax 80106ff9: 89 f3 mov %esi,%ebx 80106ffb: e8 c0 f9 ff ff call 801069c0 panic("freevm: no pgdir"); } deallocuvm(pgdir, KERNBASE, 0); for (i = 0; i < NPDENTRIES; i++) { 80107000: 8d be 00 10 00 00 lea 0x1000(%esi),%edi 80107006: eb 0f jmp 80107017 80107008: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010700f: 90 nop 80107010: 83 c3 04 add $0x4,%ebx 80107013: 39 df cmp %ebx,%edi 80107015: 74 23 je 8010703a if (pgdir[i] & PTE_P) { 80107017: 8b 03 mov (%ebx),%eax 80107019: a8 01 test $0x1,%al 8010701b: 74 f3 je 80107010 char * v = P2V(PTE_ADDR(pgdir[i])); 8010701d: 25 00 f0 ff ff and $0xfffff000,%eax kfree(v); 80107022: 83 ec 0c sub $0xc,%esp for (i = 0; i < NPDENTRIES; i++) { 80107025: 83 c3 04 add $0x4,%ebx char * v = P2V(PTE_ADDR(pgdir[i])); 80107028: 05 00 00 00 80 add $0x80000000,%eax kfree(v); 8010702d: 50 push %eax 8010702e: e8 ad b5 ff ff call 801025e0 80107033: 83 c4 10 add $0x10,%esp for (i = 0; i < NPDENTRIES; i++) { 80107036: 39 df cmp %ebx,%edi 80107038: 75 dd jne 80107017 } } kfree((char*)pgdir); 8010703a: 89 75 08 mov %esi,0x8(%ebp) } 8010703d: 8d 65 f4 lea -0xc(%ebp),%esp 80107040: 5b pop %ebx 80107041: 5e pop %esi 80107042: 5f pop %edi 80107043: 5d pop %ebp kfree((char*)pgdir); 80107044: e9 97 b5 ff ff jmp 801025e0 panic("freevm: no pgdir"); 80107049: 83 ec 0c sub $0xc,%esp 8010704c: 68 51 7d 10 80 push $0x80107d51 80107051: e8 3a 93 ff ff call 80100390 80107056: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010705d: 8d 76 00 lea 0x0(%esi),%esi 80107060 : pde_t*setupkvm(void) { 80107060: 55 push %ebp 80107061: 89 e5 mov %esp,%ebp 80107063: 56 push %esi 80107064: 53 push %ebx if ((pgdir = (pde_t*)kalloc()) == 0) { 80107065: e8 36 b7 ff ff call 801027a0 8010706a: 89 c6 mov %eax,%esi 8010706c: 85 c0 test %eax,%eax 8010706e: 74 42 je 801070b2 memset(pgdir, 0, PGSIZE); 80107070: 83 ec 04 sub $0x4,%esp for (k = kmap; k < &kmap[NELEM(kmap)]; k++) { 80107073: bb 20 a4 10 80 mov $0x8010a420,%ebx memset(pgdir, 0, PGSIZE); 80107078: 68 00 10 00 00 push $0x1000 8010707d: 6a 00 push $0x0 8010707f: 50 push %eax 80107080: e8 3b d7 ff ff call 801047c0 80107085: 83 c4 10 add $0x10,%esp (uint)k->phys_start, k->perm) < 0) { 80107088: 8b 43 04 mov 0x4(%ebx),%eax if (mappages(pgdir, k->virt, k->phys_end - k->phys_start, 8010708b: 83 ec 08 sub $0x8,%esp 8010708e: 8b 4b 08 mov 0x8(%ebx),%ecx 80107091: ff 73 0c push 0xc(%ebx) 80107094: 8b 13 mov (%ebx),%edx 80107096: 50 push %eax 80107097: 29 c1 sub %eax,%ecx 80107099: 89 f0 mov %esi,%eax 8010709b: e8 d0 f9 ff ff call 80106a70 801070a0: 83 c4 10 add $0x10,%esp 801070a3: 85 c0 test %eax,%eax 801070a5: 78 19 js 801070c0 for (k = kmap; k < &kmap[NELEM(kmap)]; k++) { 801070a7: 83 c3 10 add $0x10,%ebx 801070aa: 81 fb 60 a4 10 80 cmp $0x8010a460,%ebx 801070b0: 75 d6 jne 80107088 } 801070b2: 8d 65 f8 lea -0x8(%ebp),%esp 801070b5: 89 f0 mov %esi,%eax 801070b7: 5b pop %ebx 801070b8: 5e pop %esi 801070b9: 5d pop %ebp 801070ba: c3 ret 801070bb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801070bf: 90 nop freevm(pgdir); 801070c0: 83 ec 0c sub $0xc,%esp 801070c3: 56 push %esi return 0; 801070c4: 31 f6 xor %esi,%esi freevm(pgdir); 801070c6: e8 15 ff ff ff call 80106fe0 return 0; 801070cb: 83 c4 10 add $0x10,%esp } 801070ce: 8d 65 f8 lea -0x8(%ebp),%esp 801070d1: 89 f0 mov %esi,%eax 801070d3: 5b pop %ebx 801070d4: 5e pop %esi 801070d5: 5d pop %ebp 801070d6: c3 ret 801070d7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801070de: 66 90 xchg %ax,%ax 801070e0 : void kvmalloc(void) { 801070e0: 55 push %ebp 801070e1: 89 e5 mov %esp,%ebp 801070e3: 83 ec 08 sub $0x8,%esp kpgdir = setupkvm(); 801070e6: e8 75 ff ff ff call 80107060 801070eb: a3 e4 44 11 80 mov %eax,0x801144e4 lcr3(V2P(kpgdir)); // switch to the kernel page table 801070f0: 05 00 00 00 80 add $0x80000000,%eax 801070f5: 0f 22 d8 mov %eax,%cr3 } 801070f8: c9 leave 801070f9: c3 ret 801070fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80107100 : // Clear PTE_U on a page. Used to create an inaccessible // page beneath the user stack. void clearpteu(pde_t *pgdir, char *uva) { 80107100: 55 push %ebp 80107101: 89 e5 mov %esp,%ebp 80107103: 83 ec 08 sub $0x8,%esp 80107106: 8b 45 0c mov 0xc(%ebp),%eax if (*pde & PTE_P) { 80107109: 8b 55 08 mov 0x8(%ebp),%edx pde = &pgdir[PDX(va)]; 8010710c: 89 c1 mov %eax,%ecx 8010710e: c1 e9 16 shr $0x16,%ecx if (*pde & PTE_P) { 80107111: 8b 14 8a mov (%edx,%ecx,4),%edx 80107114: f6 c2 01 test $0x1,%dl 80107117: 75 17 jne 80107130 pte_t *pte; pte = walkpgdir(pgdir, uva, 0); if (pte == 0) { panic("clearpteu"); 80107119: 83 ec 0c sub $0xc,%esp 8010711c: 68 62 7d 10 80 push $0x80107d62 80107121: e8 6a 92 ff ff call 80100390 80107126: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010712d: 8d 76 00 lea 0x0(%esi),%esi return &pgtab[PTX(va)]; 80107130: c1 e8 0a shr $0xa,%eax pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 80107133: 81 e2 00 f0 ff ff and $0xfffff000,%edx return &pgtab[PTX(va)]; 80107139: 25 fc 0f 00 00 and $0xffc,%eax 8010713e: 8d 84 02 00 00 00 80 lea -0x80000000(%edx,%eax,1),%eax if (pte == 0) { 80107145: 85 c0 test %eax,%eax 80107147: 74 d0 je 80107119 } *pte &= ~PTE_U; 80107149: 83 20 fb andl $0xfffffffb,(%eax) } 8010714c: c9 leave 8010714d: c3 ret 8010714e: 66 90 xchg %ax,%ax 80107150 : // Given a parent process's page table, create a copy // of it for a child. pde_t* copyuvm(pde_t *pgdir, uint sz) { 80107150: 55 push %ebp 80107151: 89 e5 mov %esp,%ebp 80107153: 57 push %edi 80107154: 56 push %esi 80107155: 53 push %ebx 80107156: 83 ec 1c sub $0x1c,%esp pde_t *d; pte_t *pte; uint pa, i, flags; char *mem; if ((d = setupkvm()) == 0) { 80107159: e8 02 ff ff ff call 80107060 8010715e: 89 45 e0 mov %eax,-0x20(%ebp) 80107161: 85 c0 test %eax,%eax 80107163: 0f 84 bd 00 00 00 je 80107226 return 0; } for (i = 0; i < sz; i += PGSIZE) { 80107169: 8b 5d 0c mov 0xc(%ebp),%ebx 8010716c: 85 db test %ebx,%ebx 8010716e: 0f 84 b2 00 00 00 je 80107226 80107174: 31 f6 xor %esi,%esi 80107176: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010717d: 8d 76 00 lea 0x0(%esi),%esi if (*pde & PTE_P) { 80107180: 8b 4d 08 mov 0x8(%ebp),%ecx pde = &pgdir[PDX(va)]; 80107183: 89 f0 mov %esi,%eax 80107185: c1 e8 16 shr $0x16,%eax if (*pde & PTE_P) { 80107188: 8b 04 81 mov (%ecx,%eax,4),%eax 8010718b: a8 01 test $0x1,%al 8010718d: 75 11 jne 801071a0 if ((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) { panic("copyuvm: pte should exist"); 8010718f: 83 ec 0c sub $0xc,%esp 80107192: 68 6c 7d 10 80 push $0x80107d6c 80107197: e8 f4 91 ff ff call 80100390 8010719c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return &pgtab[PTX(va)]; 801071a0: 89 f2 mov %esi,%edx pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 801071a2: 25 00 f0 ff ff and $0xfffff000,%eax return &pgtab[PTX(va)]; 801071a7: c1 ea 0a shr $0xa,%edx 801071aa: 81 e2 fc 0f 00 00 and $0xffc,%edx 801071b0: 8d 84 10 00 00 00 80 lea -0x80000000(%eax,%edx,1),%eax if ((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) { 801071b7: 85 c0 test %eax,%eax 801071b9: 74 d4 je 8010718f } if (!(*pte & PTE_P)) { 801071bb: 8b 00 mov (%eax),%eax 801071bd: a8 01 test $0x1,%al 801071bf: 0f 84 c2 00 00 00 je 80107287 panic("copyuvm: page not present"); } pa = PTE_ADDR(*pte); 801071c5: 89 c7 mov %eax,%edi flags = PTE_FLAGS(*pte); 801071c7: 25 ff 0f 00 00 and $0xfff,%eax 801071cc: 89 45 e4 mov %eax,-0x1c(%ebp) pa = PTE_ADDR(*pte); 801071cf: 81 e7 00 f0 ff ff and $0xfffff000,%edi if ((mem = kalloc()) == 0) { 801071d5: e8 c6 b5 ff ff call 801027a0 801071da: 89 c3 mov %eax,%ebx 801071dc: 85 c0 test %eax,%eax 801071de: 74 58 je 80107238 freevm(d); return 0; } memmove(mem, (char*)P2V(pa), PGSIZE); 801071e0: 83 ec 04 sub $0x4,%esp 801071e3: 81 c7 00 00 00 80 add $0x80000000,%edi 801071e9: 68 00 10 00 00 push $0x1000 801071ee: 57 push %edi 801071ef: 50 push %eax 801071f0: e8 6b d6 ff ff call 80104860 if (mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) { 801071f5: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 801071fb: 5a pop %edx 801071fc: 59 pop %ecx 801071fd: ff 75 e4 push -0x1c(%ebp) 80107200: b9 00 10 00 00 mov $0x1000,%ecx 80107205: 89 f2 mov %esi,%edx 80107207: 50 push %eax 80107208: 8b 45 e0 mov -0x20(%ebp),%eax 8010720b: e8 60 f8 ff ff call 80106a70 80107210: 83 c4 10 add $0x10,%esp 80107213: 85 c0 test %eax,%eax 80107215: 78 49 js 80107260 for (i = 0; i < sz; i += PGSIZE) { 80107217: 81 c6 00 10 00 00 add $0x1000,%esi 8010721d: 39 75 0c cmp %esi,0xc(%ebp) 80107220: 0f 87 5a ff ff ff ja 80107180 freevm(d); return 0; } } return d; } 80107226: 8b 45 e0 mov -0x20(%ebp),%eax 80107229: 8d 65 f4 lea -0xc(%ebp),%esp 8010722c: 5b pop %ebx 8010722d: 5e pop %esi 8010722e: 5f pop %edi 8010722f: 5d pop %ebp 80107230: c3 ret 80107231: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi freevm(d); 80107238: 83 ec 0c sub $0xc,%esp 8010723b: ff 75 e0 push -0x20(%ebp) 8010723e: e8 9d fd ff ff call 80106fe0 return 0; 80107243: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) 8010724a: 83 c4 10 add $0x10,%esp } 8010724d: 8b 45 e0 mov -0x20(%ebp),%eax 80107250: 8d 65 f4 lea -0xc(%ebp),%esp 80107253: 5b pop %ebx 80107254: 5e pop %esi 80107255: 5f pop %edi 80107256: 5d pop %ebp 80107257: c3 ret 80107258: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010725f: 90 nop kfree(mem); 80107260: 83 ec 0c sub $0xc,%esp 80107263: 53 push %ebx 80107264: e8 77 b3 ff ff call 801025e0 freevm(d); 80107269: 58 pop %eax 8010726a: ff 75 e0 push -0x20(%ebp) 8010726d: e8 6e fd ff ff call 80106fe0 return 0; 80107272: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) 80107279: 83 c4 10 add $0x10,%esp } 8010727c: 8b 45 e0 mov -0x20(%ebp),%eax 8010727f: 8d 65 f4 lea -0xc(%ebp),%esp 80107282: 5b pop %ebx 80107283: 5e pop %esi 80107284: 5f pop %edi 80107285: 5d pop %ebp 80107286: c3 ret panic("copyuvm: page not present"); 80107287: 83 ec 0c sub $0xc,%esp 8010728a: 68 86 7d 10 80 push $0x80107d86 8010728f: e8 fc 90 ff ff call 80100390 80107294: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010729b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010729f: 90 nop 801072a0 : // Map user virtual address to kernel address. char*uva2ka(pde_t *pgdir, char *uva) { 801072a0: 55 push %ebp 801072a1: 89 e5 mov %esp,%ebp 801072a3: 8b 45 0c mov 0xc(%ebp),%eax if (*pde & PTE_P) { 801072a6: 8b 55 08 mov 0x8(%ebp),%edx pde = &pgdir[PDX(va)]; 801072a9: 89 c1 mov %eax,%ecx 801072ab: c1 e9 16 shr $0x16,%ecx if (*pde & PTE_P) { 801072ae: 8b 14 8a mov (%edx,%ecx,4),%edx 801072b1: f6 c2 01 test $0x1,%dl 801072b4: 0f 84 00 01 00 00 je 801073ba return &pgtab[PTX(va)]; 801072ba: c1 e8 0c shr $0xc,%eax pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 801072bd: 81 e2 00 f0 ff ff and $0xfffff000,%edx } if ((*pte & PTE_U) == 0) { return 0; } return (char*)P2V(PTE_ADDR(*pte)); } 801072c3: 5d pop %ebp return &pgtab[PTX(va)]; 801072c4: 25 ff 03 00 00 and $0x3ff,%eax if ((*pte & PTE_P) == 0) { 801072c9: 8b 84 82 00 00 00 80 mov -0x80000000(%edx,%eax,4),%eax if ((*pte & PTE_U) == 0) { 801072d0: 89 c2 mov %eax,%edx return (char*)P2V(PTE_ADDR(*pte)); 801072d2: 25 00 f0 ff ff and $0xfffff000,%eax if ((*pte & PTE_U) == 0) { 801072d7: 83 e2 05 and $0x5,%edx return (char*)P2V(PTE_ADDR(*pte)); 801072da: 05 00 00 00 80 add $0x80000000,%eax 801072df: 83 fa 05 cmp $0x5,%edx 801072e2: ba 00 00 00 00 mov $0x0,%edx 801072e7: 0f 45 c2 cmovne %edx,%eax } 801072ea: c3 ret 801072eb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801072ef: 90 nop 801072f0 : // 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) { 801072f0: 55 push %ebp 801072f1: 89 e5 mov %esp,%ebp 801072f3: 57 push %edi 801072f4: 56 push %esi 801072f5: 53 push %ebx 801072f6: 83 ec 0c sub $0xc,%esp 801072f9: 8b 75 14 mov 0x14(%ebp),%esi 801072fc: 8b 45 0c mov 0xc(%ebp),%eax 801072ff: 8b 55 10 mov 0x10(%ebp),%edx char *buf, *pa0; uint n, va0; buf = (char*)p; while (len > 0) { 80107302: 85 f6 test %esi,%esi 80107304: 75 51 jne 80107357 80107306: e9 a5 00 00 00 jmp 801073b0 8010730b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010730f: 90 nop return (char*)P2V(PTE_ADDR(*pte)); 80107310: 81 e3 00 f0 ff ff and $0xfffff000,%ebx 80107316: 8d 8b 00 00 00 80 lea -0x80000000(%ebx),%ecx va0 = (uint)PGROUNDDOWN(va); pa0 = uva2ka(pgdir, (char*)va0); if (pa0 == 0) { 8010731c: 81 fb 00 00 00 80 cmp $0x80000000,%ebx 80107322: 74 75 je 80107399 return -1; } n = PGSIZE - (va - va0); 80107324: 89 fb mov %edi,%ebx if (n > len) { n = len; } memmove(pa0 + (va - va0), buf, n); 80107326: 89 55 10 mov %edx,0x10(%ebp) n = PGSIZE - (va - va0); 80107329: 29 c3 sub %eax,%ebx 8010732b: 81 c3 00 10 00 00 add $0x1000,%ebx 80107331: 39 f3 cmp %esi,%ebx 80107333: 0f 47 de cmova %esi,%ebx memmove(pa0 + (va - va0), buf, n); 80107336: 29 f8 sub %edi,%eax 80107338: 83 ec 04 sub $0x4,%esp 8010733b: 01 c1 add %eax,%ecx 8010733d: 53 push %ebx 8010733e: 52 push %edx 8010733f: 51 push %ecx 80107340: e8 1b d5 ff ff call 80104860 len -= n; buf += n; 80107345: 8b 55 10 mov 0x10(%ebp),%edx va = va0 + PGSIZE; 80107348: 8d 87 00 10 00 00 lea 0x1000(%edi),%eax while (len > 0) { 8010734e: 83 c4 10 add $0x10,%esp buf += n; 80107351: 01 da add %ebx,%edx while (len > 0) { 80107353: 29 de sub %ebx,%esi 80107355: 74 59 je 801073b0 if (*pde & PTE_P) { 80107357: 8b 5d 08 mov 0x8(%ebp),%ebx pde = &pgdir[PDX(va)]; 8010735a: 89 c1 mov %eax,%ecx va0 = (uint)PGROUNDDOWN(va); 8010735c: 89 c7 mov %eax,%edi pde = &pgdir[PDX(va)]; 8010735e: c1 e9 16 shr $0x16,%ecx va0 = (uint)PGROUNDDOWN(va); 80107361: 81 e7 00 f0 ff ff and $0xfffff000,%edi if (*pde & PTE_P) { 80107367: 8b 0c 8b mov (%ebx,%ecx,4),%ecx 8010736a: f6 c1 01 test $0x1,%cl 8010736d: 0f 84 4e 00 00 00 je 801073c1 return &pgtab[PTX(va)]; 80107373: 89 fb mov %edi,%ebx pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 80107375: 81 e1 00 f0 ff ff and $0xfffff000,%ecx return &pgtab[PTX(va)]; 8010737b: c1 eb 0c shr $0xc,%ebx 8010737e: 81 e3 ff 03 00 00 and $0x3ff,%ebx if ((*pte & PTE_P) == 0) { 80107384: 8b 9c 99 00 00 00 80 mov -0x80000000(%ecx,%ebx,4),%ebx if ((*pte & PTE_U) == 0) { 8010738b: 89 d9 mov %ebx,%ecx 8010738d: 83 e1 05 and $0x5,%ecx 80107390: 83 f9 05 cmp $0x5,%ecx 80107393: 0f 84 77 ff ff ff je 80107310 } return 0; } 80107399: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 8010739c: b8 ff ff ff ff mov $0xffffffff,%eax } 801073a1: 5b pop %ebx 801073a2: 5e pop %esi 801073a3: 5f pop %edi 801073a4: 5d pop %ebp 801073a5: c3 ret 801073a6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801073ad: 8d 76 00 lea 0x0(%esi),%esi 801073b0: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 801073b3: 31 c0 xor %eax,%eax } 801073b5: 5b pop %ebx 801073b6: 5e pop %esi 801073b7: 5f pop %edi 801073b8: 5d pop %ebp 801073b9: c3 ret 801073ba : if ((*pte & PTE_P) == 0) { 801073ba: a1 00 00 00 00 mov 0x0,%eax 801073bf: 0f 0b ud2 801073c1 : 801073c1: a1 00 00 00 00 mov 0x0,%eax 801073c6: 0f 0b ud2