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 b0 10 00 mov $0x10b000,%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 50 22 12 80 mov $0x80122250,%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 50 45 10 80 mov $0x80104550,%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 c5 10 80 mov $0x8010c554,%ebx void binit(void) { 80100049: 83 ec 0c sub $0xc,%esp initlock(&bcache.lock, "bcache"); 8010004c: 68 60 89 10 80 push $0x80108960 80100051: 68 20 c5 10 80 push $0x8010c520 80100056: e8 55 59 00 00 call 801059b0 bcache.head.next = &bcache.head; 8010005b: 83 c4 10 add $0x10,%esp 8010005e: b8 1c 0c 11 80 mov $0x80110c1c,%eax bcache.head.prev = &bcache.head; 80100063: c7 05 6c 0c 11 80 1c movl $0x80110c1c,0x80110c6c 8010006a: 0c 11 80 bcache.head.next = &bcache.head; 8010006d: c7 05 70 0c 11 80 1c movl $0x80110c1c,0x80110c70 80100074: 0c 11 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 0c 11 80 movl $0x80110c1c,0x50(%ebx) initsleeplock(&b->lock, "buffer"); 80100092: 68 67 89 10 80 push $0x80108967 80100097: 50 push %eax 80100098: e8 e3 57 00 00 call 80105880 bcache.head.next->prev = b; 8010009d: a1 70 0c 11 80 mov 0x80110c70,%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 0c 11 80 mov %ebx,0x80110c70 for (b = bcache.buf; b < bcache.buf + NBUF; b++) { 801000b6: 81 fb c0 09 11 80 cmp $0x801109c0,%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 c5 10 80 push $0x8010c520 801000e4: e8 97 5a 00 00 call 80105b80 for (b = bcache.head.next; b != &bcache.head; b = b->next) { 801000e9: 8b 1d 70 0c 11 80 mov 0x80110c70,%ebx 801000ef: 83 c4 10 add $0x10,%esp 801000f2: 81 fb 1c 0c 11 80 cmp $0x80110c1c,%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 0c 11 80 cmp $0x80110c1c,%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 0c 11 80 mov 0x80110c6c,%ebx 80100126: 81 fb 1c 0c 11 80 cmp $0x80110c1c,%ebx 8010012c: 75 0d jne 8010013b 8010012e: eb 6e jmp 8010019e 80100130: 8b 5b 50 mov 0x50(%ebx),%ebx 80100133: 81 fb 1c 0c 11 80 cmp $0x80110c1c,%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 c5 10 80 push $0x8010c520 80100162: e8 b9 59 00 00 call 80105b20 acquiresleep(&b->lock); 80100167: 8d 43 0c lea 0xc(%ebx),%eax 8010016a: 89 04 24 mov %eax,(%esp) 8010016d: e8 4e 57 00 00 call 801058c0 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 3f 36 00 00 call 801037d0 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 6e 89 10 80 push $0x8010896e 801001a6: e8 d5 02 00 00 call 80100480 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 9d 57 00 00 call 80105960 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 f7 35 00 00 jmp 801037d0 panic("bwrite"); 801001d9: 83 ec 0c sub $0xc,%esp 801001dc: 68 7f 89 10 80 push $0x8010897f 801001e1: e8 9a 02 00 00 call 80100480 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 5c 57 00 00 call 80105960 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 0c 57 00 00 call 80105920 acquire(&bcache.lock); 80100214: c7 04 24 20 c5 10 80 movl $0x8010c520,(%esp) 8010021b: e8 60 59 00 00 call 80105b80 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 0c 11 80 mov 0x80110c70,%eax b->prev = &bcache.head; 80100247: c7 43 50 1c 0c 11 80 movl $0x80110c1c,0x50(%ebx) b->next = bcache.head.next; 8010024e: 89 43 54 mov %eax,0x54(%ebx) bcache.head.next->prev = b; 80100251: a1 70 0c 11 80 mov 0x80110c70,%eax 80100256: 89 58 50 mov %ebx,0x50(%eax) bcache.head.next = b; 80100259: 89 1d 70 0c 11 80 mov %ebx,0x80110c70 } release(&bcache.lock); 8010025f: c7 45 08 20 c5 10 80 movl $0x8010c520,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 af 58 00 00 jmp 80105b20 panic("brelse"); 80100271: 83 ec 0c sub $0xc,%esp 80100274: 68 86 89 10 80 push $0x80108986 80100279: e8 02 02 00 00 call 80100480 8010027e: 66 90 xchg %ax,%ax 80100280 : menuactive = 1; } // Function that handles the moving of the highlight bar for the menu static void navigatemenu(int dir) { 80100280: 55 push %ebp int resultcount = 0; 80100281: 31 d2 xor %edx,%edx { 80100283: 89 e5 mov %esp,%ebp 80100285: 53 push %ebx int pos = 0; int newindex = currentmenuitem + dir; 80100286: 8b 1d c0 b6 11 80 mov 0x8011b6c0,%ebx 8010028c: 8d 0c 03 lea (%ebx,%eax,1),%ecx for (int i = 0; i < MAXVCONSOLES; i++) 8010028f: b8 0c 1f 11 80 mov $0x80111f0c,%eax 80100294: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi resultcount++; 80100298: 83 38 01 cmpl $0x1,(%eax) 8010029b: 83 da ff sbb $0xffffffff,%edx for (int i = 0; i < MAXVCONSOLES; i++) 8010029e: 05 b0 10 00 00 add $0x10b0,%eax 801002a3: 3d ec c5 11 80 cmp $0x8011c5ec,%eax 801002a8: 75 ee jne 80100298 int totalactiveconsoles = getcurrentactiveconsolecount(); if (newindex < 0) 801002aa: 85 c9 test %ecx,%ecx 801002ac: 78 62 js 80100310 { newindex = 0; } else if (newindex >= totalactiveconsoles) { newindex = totalactiveconsoles - 1; 801002ae: 8d 42 ff lea -0x1(%edx),%eax 801002b1: 39 d1 cmp %edx,%ecx 801002b3: 0f 4d c8 cmovge %eax,%ecx } // make sure the new index isnt just the same as the current selected menu item, we then change the background bits around // which saves us from redrawing the menu every time the selected item changes if (newindex != currentmenuitem) 801002b6: 39 cb cmp %ecx,%ebx 801002b8: 74 48 je 80100302 { // change the background bits of the last selected item to black pos = TITLEOFF + ((currentmenuitem + 1) * SCRWIDTH); 801002ba: 8d 54 9b 0a lea 0xa(%ebx,%ebx,4),%edx 801002be: c1 e2 04 shl $0x4,%edx for (int x = 2; x < MENUWIDTH - 2; x++) 801002c1: 8d 84 12 04 80 0b 80 lea -0x7ff47ffc(%edx,%edx,1),%eax 801002c8: 8d 94 12 32 80 0b 80 lea -0x7ff47fce(%edx,%edx,1),%edx 801002cf: 90 nop { crt[pos + x] = (crt[pos + x] & 0x00FF) | 0x0700; 801002d0: c6 40 01 07 movb $0x7,0x1(%eax) for (int x = 2; x < MENUWIDTH - 2; x++) 801002d4: 83 c0 02 add $0x2,%eax 801002d7: 39 d0 cmp %edx,%eax 801002d9: 75 f5 jne 801002d0 } // change the background bits of the new selected item to the highlight color pos = TITLEOFF + ((newindex + 1) * SCRWIDTH); 801002db: 8d 54 89 0a lea 0xa(%ecx,%ecx,4),%edx 801002df: c1 e2 04 shl $0x4,%edx for (int x = 2; x < MENUWIDTH - 2; x++) 801002e2: 8d 84 12 04 80 0b 80 lea -0x7ff47ffc(%edx,%edx,1),%eax 801002e9: 8d 94 12 32 80 0b 80 lea -0x7ff47fce(%edx,%edx,1),%edx { crt[pos + x] = crt[pos + x] | 0xCF00; 801002f0: 66 81 08 00 cf orw $0xcf00,(%eax) for (int x = 2; x < MENUWIDTH - 2; x++) 801002f5: 83 c0 02 add $0x2,%eax 801002f8: 39 c2 cmp %eax,%edx 801002fa: 75 f4 jne 801002f0 } currentmenuitem = newindex; 801002fc: 89 0d c0 b6 11 80 mov %ecx,0x8011b6c0 } } 80100302: 8b 5d fc mov -0x4(%ebp),%ebx 80100305: c9 leave 80100306: c3 ret 80100307: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010030e: 66 90 xchg %ax,%ax newindex = 0; 80100310: 31 c9 xor %ecx,%ecx 80100312: eb a2 jmp 801002b6 80100314: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010031b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010031f: 90 nop 80100320 : } } } int consoleread(struct inode *ip, char *dst, int n) { 80100320: 55 push %ebp 80100321: 89 e5 mov %esp,%ebp 80100323: 57 push %edi 80100324: 56 push %esi 80100325: 53 push %ebx 80100326: 83 ec 1c sub $0x1c,%esp if (myproc() == 0x0) 80100329: e8 82 4b 00 00 call 80104eb0 8010032e: 85 c0 test %eax,%eax 80100330: 0f 84 aa 00 00 00 je 801003e0 inconsoleptr = myproc()->consoleptr; 80100336: e8 75 4b 00 00 call 80104eb0 8010033b: 8b 58 7c mov 0x7c(%eax),%ebx if (inconsoleptr == 0) 8010033e: 85 db test %ebx,%ebx 80100340: 0f 84 9a 00 00 00 je 801003e0 uint target; int c; struct vconsole* inconsoleptr = getvalidprocessconsoleptr(); struct kbdbuffer* consolekbdbuffer = &inconsoleptr->keybuffer; iunlock(ip); 80100346: 83 ec 0c sub $0xc,%esp 80100349: ff 75 08 push 0x8(%ebp) target = n; acquire(&inconsoleptr->lock); 8010034c: 8d 73 04 lea 0x4(%ebx),%esi { release(&inconsoleptr->lock); ilock(ip); return -1; } sleep(&(consolekbdbuffer->r), &inconsoleptr->lock); 8010034f: 8d bb 5c 10 00 00 lea 0x105c(%ebx),%edi iunlock(ip); 80100355: e8 f6 29 00 00 call 80102d50 target = n; 8010035a: 8b 45 10 mov 0x10(%ebp),%eax acquire(&inconsoleptr->lock); 8010035d: 89 34 24 mov %esi,(%esp) target = n; 80100360: 89 45 e4 mov %eax,-0x1c(%ebp) acquire(&inconsoleptr->lock); 80100363: e8 18 58 00 00 call 80105b80 while (n > 0) 80100368: 83 c4 10 add $0x10,%esp 8010036b: 8b 55 10 mov 0x10(%ebp),%edx 8010036e: 85 d2 test %edx,%edx 80100370: 0f 8e bc 00 00 00 jle 80100432 while (consolekbdbuffer->r == consolekbdbuffer->w) 80100376: 8b 83 5c 10 00 00 mov 0x105c(%ebx),%eax 8010037c: 3b 83 60 10 00 00 cmp 0x1060(%ebx),%eax 80100382: 74 27 je 801003ab 80100384: eb 7a jmp 80100400 80100386: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010038d: 8d 76 00 lea 0x0(%esi),%esi sleep(&(consolekbdbuffer->r), &inconsoleptr->lock); 80100390: 83 ec 08 sub $0x8,%esp 80100393: 56 push %esi 80100394: 57 push %edi 80100395: e8 46 52 00 00 call 801055e0 while (consolekbdbuffer->r == consolekbdbuffer->w) 8010039a: 8b 83 5c 10 00 00 mov 0x105c(%ebx),%eax 801003a0: 83 c4 10 add $0x10,%esp 801003a3: 3b 83 60 10 00 00 cmp 0x1060(%ebx),%eax 801003a9: 75 55 jne 80100400 if (myproc()->killed) 801003ab: e8 00 4b 00 00 call 80104eb0 801003b0: 8b 40 24 mov 0x24(%eax),%eax 801003b3: 85 c0 test %eax,%eax 801003b5: 74 d9 je 80100390 release(&inconsoleptr->lock); 801003b7: 83 ec 0c sub $0xc,%esp 801003ba: 56 push %esi 801003bb: e8 60 57 00 00 call 80105b20 ilock(ip); 801003c0: 59 pop %ecx 801003c1: ff 75 08 push 0x8(%ebp) 801003c4: e8 a7 28 00 00 call 80102c70 return -1; 801003c9: 83 c4 10 add $0x10,%esp } release(&inconsoleptr->lock); ilock(ip); return target - n; } 801003cc: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 801003cf: b8 ff ff ff ff mov $0xffffffff,%eax } 801003d4: 5b pop %ebx 801003d5: 5e pop %esi 801003d6: 5f pop %edi 801003d7: 5d pop %ebp 801003d8: c3 ret 801003d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi inconsoleptr = currentconsole; 801003e0: 8b 1d 80 0e 11 80 mov 0x80110e80,%ebx if (inconsoleptr == 0) 801003e6: 85 db test %ebx,%ebx 801003e8: 0f 85 58 ff ff ff jne 80100346 inconsoleptr = &consoles[0]; 801003ee: bb a0 0e 11 80 mov $0x80110ea0,%ebx 801003f3: e9 4e ff ff ff jmp 80100346 801003f8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801003ff: 90 nop c = consolekbdbuffer->buf[consolekbdbuffer->r++ % INPUT_BUF]; 80100400: 8d 50 01 lea 0x1(%eax),%edx 80100403: 89 93 5c 10 00 00 mov %edx,0x105c(%ebx) 80100409: 89 c2 mov %eax,%edx 8010040b: 83 e2 7f and $0x7f,%edx 8010040e: 0f be 8c 13 dc 0f 00 movsbl 0xfdc(%ebx,%edx,1),%ecx 80100415: 00 if (c == C('D')) 80100416: 80 f9 04 cmp $0x4,%cl 80100419: 74 3a je 80100455 *dst++ = c; 8010041b: 83 45 0c 01 addl $0x1,0xc(%ebp) 8010041f: 8b 45 0c mov 0xc(%ebp),%eax --n; 80100422: 83 6d 10 01 subl $0x1,0x10(%ebp) *dst++ = c; 80100426: 88 48 ff mov %cl,-0x1(%eax) if (c == '\n') 80100429: 83 f9 0a cmp $0xa,%ecx 8010042c: 0f 85 39 ff ff ff jne 8010036b release(&inconsoleptr->lock); 80100432: 83 ec 0c sub $0xc,%esp 80100435: 56 push %esi 80100436: e8 e5 56 00 00 call 80105b20 ilock(ip); 8010043b: 58 pop %eax 8010043c: ff 75 08 push 0x8(%ebp) 8010043f: e8 2c 28 00 00 call 80102c70 return target - n; 80100444: 8b 45 e4 mov -0x1c(%ebp),%eax 80100447: 83 c4 10 add $0x10,%esp 8010044a: 2b 45 10 sub 0x10(%ebp),%eax } 8010044d: 8d 65 f4 lea -0xc(%ebp),%esp 80100450: 5b pop %ebx 80100451: 5e pop %esi 80100452: 5f pop %edi 80100453: 5d pop %ebp 80100454: c3 ret if (n < target) 80100455: 8b 4d e4 mov -0x1c(%ebp),%ecx 80100458: 39 4d 10 cmp %ecx,0x10(%ebp) 8010045b: 73 d5 jae 80100432 consolekbdbuffer->r--; 8010045d: 89 83 5c 10 00 00 mov %eax,0x105c(%ebx) 80100463: eb cd jmp 80100432 80100465: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010046c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100470 : { 80100470: 55 push %ebp 80100471: 89 e5 mov %esp,%ebp return consolein->consoleindex; 80100473: 8b 45 08 mov 0x8(%ebp),%eax } 80100476: 5d pop %ebp return consolein->consoleindex; 80100477: 8b 00 mov (%eax),%eax } 80100479: c3 ret 8010047a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80100480 : { 80100480: 55 push %ebp 80100481: 89 e5 mov %esp,%ebp 80100483: 56 push %esi 80100484: 53 push %ebx 80100485: 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"); 80100488: fa cli cons.locking = 0; 80100489: c7 05 b4 b6 11 80 00 movl $0x0,0x8011b6b4 80100490: 00 00 00 getcallerpcs(&s, pcs); 80100493: 8d 5d d0 lea -0x30(%ebp),%ebx 80100496: 8d 75 f8 lea -0x8(%ebp),%esi cprintf("lapicid %d: panic: ", lapicid()); 80100499: e8 42 39 00 00 call 80103de0 8010049e: 83 ec 08 sub $0x8,%esp 801004a1: 50 push %eax 801004a2: 68 8d 89 10 80 push $0x8010898d 801004a7: e8 e4 03 00 00 call 80100890 cprintf(s); 801004ac: 58 pop %eax 801004ad: ff 75 08 push 0x8(%ebp) 801004b0: e8 db 03 00 00 call 80100890 cprintf("\n"); 801004b5: c7 04 24 b3 94 10 80 movl $0x801094b3,(%esp) 801004bc: e8 cf 03 00 00 call 80100890 getcallerpcs(&s, pcs); 801004c1: 8d 45 08 lea 0x8(%ebp),%eax 801004c4: 5a pop %edx 801004c5: 59 pop %ecx 801004c6: 53 push %ebx 801004c7: 50 push %eax 801004c8: e8 03 55 00 00 call 801059d0 for (i = 0; i < 10; i++) 801004cd: 83 c4 10 add $0x10,%esp cprintf(" %p", pcs[i]); 801004d0: 83 ec 08 sub $0x8,%esp 801004d3: ff 33 push (%ebx) for (i = 0; i < 10; i++) 801004d5: 83 c3 04 add $0x4,%ebx cprintf(" %p", pcs[i]); 801004d8: 68 a1 89 10 80 push $0x801089a1 801004dd: e8 ae 03 00 00 call 80100890 for (i = 0; i < 10; i++) 801004e2: 83 c4 10 add $0x10,%esp 801004e5: 39 f3 cmp %esi,%ebx 801004e7: 75 e7 jne 801004d0 panicked = 1; // freeze other CPU 801004e9: c7 05 b8 b6 11 80 01 movl $0x1,0x8011b6b8 801004f0: 00 00 00 for (;;) 801004f3: eb fe jmp 801004f3 801004f5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801004fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100500 : { 80100500: 55 push %ebp 80100501: 89 e5 mov %esp,%ebp 80100503: 57 push %edi 80100504: 56 push %esi 80100505: 89 c6 mov %eax,%esi 80100507: 53 push %ebx 80100508: 83 ec 2c sub $0x2c,%esp if (myproc() == 0x0) 8010050b: e8 a0 49 00 00 call 80104eb0 80100510: 85 c0 test %eax,%eax 80100512: 0f 84 f8 00 00 00 je 80100610 inconsoleptr = myproc()->consoleptr; 80100518: e8 93 49 00 00 call 80104eb0 8010051d: 8b 78 7c mov 0x7c(%eax),%edi if (inconsoleptr == 0) 80100520: 85 ff test %edi,%edi 80100522: 0f 84 e8 00 00 00 je 80100610 if (inconsoleptr->inuse) 80100528: 8b 8f 70 10 00 00 mov 0x1070(%edi),%ecx ushort *currentbuffer = inconsoleptr->screenbuffer; 8010052e: 8d 47 3c lea 0x3c(%edi),%eax 80100531: 89 45 e4 mov %eax,-0x1c(%ebp) if (inconsoleptr->inuse) 80100534: 85 c9 test %ecx,%ecx 80100536: 0f 84 04 01 00 00 je 80100640 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 8010053c: bb d4 03 00 00 mov $0x3d4,%ebx 80100541: b8 0e 00 00 00 mov $0xe,%eax 80100546: 89 da mov %ebx,%edx 80100548: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80100549: ba d5 03 00 00 mov $0x3d5,%edx 8010054e: ec in (%dx),%al pos = inb(CRTPORT + 1) << 8; 8010054f: 0f b6 c0 movzbl %al,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80100552: 89 da mov %ebx,%edx 80100554: c1 e0 08 shl $0x8,%eax 80100557: 89 45 e0 mov %eax,-0x20(%ebp) 8010055a: b8 0f 00 00 00 mov $0xf,%eax 8010055f: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80100560: ba d5 03 00 00 mov $0x3d5,%edx 80100565: ec in (%dx),%al pos |= inb(CRTPORT + 1); 80100566: 0f b6 d8 movzbl %al,%ebx 80100569: 0b 5d e0 or -0x20(%ebp),%ebx if (c == '\n') 8010056c: 83 fe 0a cmp $0xa,%esi 8010056f: 0f 84 da 00 00 00 je 8010064f else if (c == BACKSPACE) 80100575: 81 fe 00 01 00 00 cmp $0x100,%esi 8010057b: 0f 84 ef 00 00 00 je 80100670 crt[pos] = (c & 0xff) | 0x0700; // black on white 80100581: 89 f2 mov %esi,%edx currentbuffer[pos] = 0; // Clear the character from the buffer 80100583: 8d 04 1b lea (%ebx,%ebx,1),%eax crt[pos] = (c & 0xff) | 0x0700; // black on white 80100586: 0f b6 f2 movzbl %dl,%esi 80100589: 66 81 ce 00 07 or $0x700,%si if (inconsoleptr->inuse) 8010058e: 85 c9 test %ecx,%ecx 80100590: 74 07 je 80100599 crt[pos] = (c & 0xff) | 0x0700; // black on white 80100592: 66 89 b0 00 80 0b 80 mov %si,-0x7ff48000(%eax) currentbuffer[pos] = (c & 0xff) | 0x0700; // black on white 80100599: 8b 4d e4 mov -0x1c(%ebp),%ecx pos++; 8010059c: 83 c3 01 add $0x1,%ebx currentbuffer[pos] = (c & 0xff) | 0x0700; // black on white 8010059f: 66 89 34 01 mov %si,(%ecx,%eax,1) if (pos < TITLEOFF || pos > SCRHEIGHT * SCRWIDTH) 801005a3: 8d 73 b0 lea -0x50(%ebx),%esi 801005a6: 81 fe 80 07 00 00 cmp $0x780,%esi 801005ac: 0f 87 1f 02 00 00 ja 801007d1 if ((pos / 80) >= 24) 801005b2: 81 fb 7f 07 00 00 cmp $0x77f,%ebx 801005b8: 0f 8f d2 00 00 00 jg 80100690 if (inconsoleptr->inuse) 801005be: 8b 87 70 10 00 00 mov 0x1070(%edi),%eax inconsoleptr->pos = pos; 801005c4: 89 9f 68 10 00 00 mov %ebx,0x1068(%edi) if (inconsoleptr->inuse) 801005ca: 85 c0 test %eax,%eax 801005cc: 74 34 je 80100602 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 801005ce: be d4 03 00 00 mov $0x3d4,%esi 801005d3: b8 0e 00 00 00 mov $0xe,%eax 801005d8: 89 f2 mov %esi,%edx 801005da: ee out %al,(%dx) 801005db: b9 d5 03 00 00 mov $0x3d5,%ecx outb(CRTPORT + 1, pos >> 8); 801005e0: 89 d8 mov %ebx,%eax 801005e2: c1 f8 08 sar $0x8,%eax 801005e5: 89 ca mov %ecx,%edx 801005e7: ee out %al,(%dx) 801005e8: b8 0f 00 00 00 mov $0xf,%eax 801005ed: 89 f2 mov %esi,%edx 801005ef: ee out %al,(%dx) 801005f0: 89 d8 mov %ebx,%eax 801005f2: 89 ca mov %ecx,%edx 801005f4: ee out %al,(%dx) crt[pos] = ' ' | 0x0700; 801005f5: b8 20 07 00 00 mov $0x720,%eax 801005fa: 66 89 84 1b 00 80 0b mov %ax,-0x7ff48000(%ebx,%ebx,1) 80100601: 80 } 80100602: 8d 65 f4 lea -0xc(%ebp),%esp 80100605: 5b pop %ebx 80100606: 5e pop %esi 80100607: 5f pop %edi 80100608: 5d pop %ebp 80100609: c3 ret 8010060a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi inconsoleptr = currentconsole; 80100610: 8b 3d 80 0e 11 80 mov 0x80110e80,%edi if (inconsoleptr == 0) 80100616: 85 ff test %edi,%edi 80100618: 0f 85 0a ff ff ff jne 80100528 inconsoleptr = &consoles[0]; 8010061e: bf a0 0e 11 80 mov $0x80110ea0,%edi if (inconsoleptr->inuse) 80100623: 8b 8f 70 10 00 00 mov 0x1070(%edi),%ecx ushort *currentbuffer = inconsoleptr->screenbuffer; 80100629: 8d 47 3c lea 0x3c(%edi),%eax 8010062c: 89 45 e4 mov %eax,-0x1c(%ebp) if (inconsoleptr->inuse) 8010062f: 85 c9 test %ecx,%ecx 80100631: 0f 85 05 ff ff ff jne 8010053c 80100637: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010063e: 66 90 xchg %ax,%ax pos = inconsoleptr->pos; 80100640: 8b 9f 68 10 00 00 mov 0x1068(%edi),%ebx if (c == '\n') 80100646: 83 fe 0a cmp $0xa,%esi 80100649: 0f 85 26 ff ff ff jne 80100575 pos += SCRWIDTH - pos % SCRWIDTH; 8010064f: 89 d8 mov %ebx,%eax 80100651: ba 67 66 66 66 mov $0x66666667,%edx 80100656: c1 fb 1f sar $0x1f,%ebx 80100659: f7 ea imul %edx 8010065b: c1 fa 05 sar $0x5,%edx 8010065e: 29 da sub %ebx,%edx 80100660: 8d 04 92 lea (%edx,%edx,4),%eax 80100663: c1 e0 04 shl $0x4,%eax 80100666: 8d 58 50 lea 0x50(%eax),%ebx 80100669: e9 35 ff ff ff jmp 801005a3 8010066e: 66 90 xchg %ax,%ax if (pos > (TITLEOFF)) 80100670: 83 fb 50 cmp $0x50,%ebx 80100673: 0f 8e 2a ff ff ff jle 801005a3 currentbuffer[pos] = 0; // Clear the character from the buffer 80100679: 8b 45 e4 mov -0x1c(%ebp),%eax 8010067c: 31 f6 xor %esi,%esi 8010067e: 66 89 34 58 mov %si,(%eax,%ebx,2) --pos; 80100682: 83 eb 01 sub $0x1,%ebx 80100685: e9 19 ff ff ff jmp 801005a3 8010068a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi memmove(currentbuffer + TITLEOFF, currentbuffer + (SCRWIDTH + TITLEOFF), sizeof(crt[0]) * (SCRHEIGHT - 1) * SCRWIDTH); 80100690: 83 ec 04 sub $0x4,%esp 80100693: 8d 87 7c 01 00 00 lea 0x17c(%edi),%eax pos -= 80; 80100699: 89 f3 mov %esi,%ebx memmove(currentbuffer + TITLEOFF, currentbuffer + (SCRWIDTH + TITLEOFF), sizeof(crt[0]) * (SCRHEIGHT - 1) * SCRWIDTH); 8010069b: 68 00 0f 00 00 push $0xf00 801006a0: 50 push %eax 801006a1: 8d 87 dc 00 00 00 lea 0xdc(%edi),%eax 801006a7: 50 push %eax 801006a8: e8 33 56 00 00 call 80105ce0 memset(currentbuffer + pos, 0, sizeof(crt[0]) * (SCRHEIGHT * SCRWIDTH - pos)); 801006ad: b8 d0 07 00 00 mov $0x7d0,%eax 801006b2: 83 c4 0c add $0xc,%esp 801006b5: 8d 0c 36 lea (%esi,%esi,1),%ecx 801006b8: 29 f0 sub %esi,%eax 801006ba: 89 4d dc mov %ecx,-0x24(%ebp) 801006bd: 01 c0 add %eax,%eax 801006bf: 50 push %eax 801006c0: 89 45 e0 mov %eax,-0x20(%ebp) 801006c3: 8b 45 e4 mov -0x1c(%ebp),%eax 801006c6: 6a 00 push $0x0 801006c8: 01 c8 add %ecx,%eax 801006ca: 50 push %eax 801006cb: e8 70 55 00 00 call 80105c40 if (inconsoleptr->inuse) 801006d0: 8b 8f 70 10 00 00 mov 0x1070(%edi),%ecx 801006d6: 83 c4 10 add $0x10,%esp 801006d9: 85 c9 test %ecx,%ecx 801006db: 0f 84 c7 00 00 00 je 801007a8 if (menuactive) 801006e1: 8b 15 bc b6 11 80 mov 0x8011b6bc,%edx 801006e7: 85 d2 test %edx,%edx 801006e9: 0f 84 d1 00 00 00 je 801007c0 801006ef: b8 0c 1f 11 80 mov $0x80111f0c,%eax int resultcount = 0; 801006f4: 31 d2 xor %edx,%edx 801006f6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801006fd: 8d 76 00 lea 0x0(%esi),%esi resultcount++; 80100700: 83 38 01 cmpl $0x1,(%eax) 80100703: 83 da ff sbb $0xffffffff,%edx for (int i = 0; i < MAXVCONSOLES; i++) 80100706: 05 b0 10 00 00 add $0x10b0,%eax 8010070b: 3d ec c5 11 80 cmp $0x8011c5ec,%eax 80100710: 75 ee jne 80100700 for (int y = 0; y < menuitems; y++) 80100712: 89 55 d8 mov %edx,-0x28(%ebp) int menuitems = getcurrentactiveconsolecount() + 3; 80100715: be d6 80 0b 80 mov $0x800b80d6,%esi 8010071a: 8d 42 03 lea 0x3(%edx),%eax for (int y = 0; y < menuitems; y++) 8010071d: 31 c9 xor %ecx,%ecx 8010071f: 89 5d e4 mov %ebx,-0x1c(%ebp) 80100722: 89 cb mov %ecx,%ebx 80100724: 89 7d d4 mov %edi,-0x2c(%ebp) 80100727: 89 f7 mov %esi,%edi 80100729: 89 c6 mov %eax,%esi 8010072b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010072f: 90 nop memmove(crt + menuoffset + TITLEOFF + MENUWIDTH, crt + menuoffset + (SCRWIDTH + TITLEOFF) + MENUWIDTH, sizeof(crt[0]) * (SCRWIDTH - MENUWIDTH)); 80100730: 83 ec 04 sub $0x4,%esp 80100733: 89 f8 mov %edi,%eax 80100735: 81 c7 a0 00 00 00 add $0xa0,%edi for (int y = 0; y < menuitems; y++) 8010073b: 83 c3 01 add $0x1,%ebx memmove(crt + menuoffset + TITLEOFF + MENUWIDTH, crt + menuoffset + (SCRWIDTH + TITLEOFF) + MENUWIDTH, sizeof(crt[0]) * (SCRWIDTH - MENUWIDTH)); 8010073e: 6a 6a push $0x6a 80100740: 57 push %edi 80100741: 50 push %eax 80100742: e8 99 55 00 00 call 80105ce0 for (int y = 0; y < menuitems; y++) 80100747: 83 c4 10 add $0x10,%esp 8010074a: 39 de cmp %ebx,%esi 8010074c: 75 e2 jne 80100730 8010074e: 8b 55 d8 mov -0x28(%ebp),%edx 80100751: 8b 5d e4 mov -0x1c(%ebp),%ebx 80100754: 8b 7d d4 mov -0x2c(%ebp),%edi 80100757: 8d 04 92 lea (%edx,%edx,4),%eax memmove(crt + TITLEOFF + menuoffset, crt + (SCRWIDTH + TITLEOFF) + menuoffset, (sizeof(crt[0]) * (SCRHEIGHT - 1) * SCRWIDTH) - menuoffset); 8010075a: ba 10 0e 00 00 mov $0xe10,%edx 8010075f: c1 e0 04 shl $0x4,%eax 80100762: 29 c2 sub %eax,%edx 80100764: 8d 84 00 20 03 00 00 lea 0x320(%eax,%eax,1),%eax 8010076b: 8d 88 00 80 0b 80 lea -0x7ff48000(%eax),%ecx 80100771: 2d a0 80 f4 7f sub $0x7ff480a0,%eax 80100776: 83 ec 04 sub $0x4,%esp 80100779: 52 push %edx 8010077a: 51 push %ecx 8010077b: 50 push %eax 8010077c: e8 5f 55 00 00 call 80105ce0 memset(crt + pos, 0, sizeof(crt[0]) * (SCRHEIGHT * SCRWIDTH - pos)); 80100781: 8b 45 dc mov -0x24(%ebp),%eax 80100784: 83 c4 0c add $0xc,%esp 80100787: ff 75 e0 push -0x20(%ebp) 8010078a: 6a 00 push $0x0 8010078c: 2d 00 80 f4 7f sub $0x7ff48000,%eax 80100791: 50 push %eax 80100792: e8 a9 54 00 00 call 80105c40 if (inconsoleptr->inuse) 80100797: 8b 87 70 10 00 00 mov 0x1070(%edi),%eax 8010079d: 83 c4 10 add $0x10,%esp 801007a0: e9 1f fe ff ff jmp 801005c4 801007a5: 8d 76 00 lea 0x0(%esi),%esi inconsoleptr->pos = pos; 801007a8: 89 b7 68 10 00 00 mov %esi,0x1068(%edi) } 801007ae: 8d 65 f4 lea -0xc(%ebp),%esp 801007b1: 5b pop %ebx 801007b2: 5e pop %esi 801007b3: 5f pop %edi 801007b4: 5d pop %ebp 801007b5: c3 ret 801007b6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801007bd: 8d 76 00 lea 0x0(%esi),%esi 801007c0: b8 a0 80 0b 80 mov $0x800b80a0,%eax 801007c5: b9 40 81 0b 80 mov $0x800b8140,%ecx 801007ca: ba 00 0f 00 00 mov $0xf00,%edx 801007cf: eb a5 jmp 80100776 panic("pos under/overflow"); 801007d1: 83 ec 0c sub $0xc,%esp 801007d4: 68 a5 89 10 80 push $0x801089a5 801007d9: e8 a2 fc ff ff call 80100480 801007de: 66 90 xchg %ax,%ax 801007e0 : int consolewrite(struct inode *ip, char *buf, int n) { 801007e0: 55 push %ebp 801007e1: 89 e5 mov %esp,%ebp 801007e3: 57 push %edi 801007e4: 56 push %esi 801007e5: 53 push %ebx 801007e6: 83 ec 1c sub $0x1c,%esp if (myproc() == 0x0) 801007e9: e8 c2 46 00 00 call 80104eb0 801007ee: 85 c0 test %eax,%eax 801007f0: 74 4e je 80100840 inconsoleptr = myproc()->consoleptr; 801007f2: e8 b9 46 00 00 call 80104eb0 801007f7: 8b 58 7c mov 0x7c(%eax),%ebx if (inconsoleptr == 0) 801007fa: 85 db test %ebx,%ebx 801007fc: 74 42 je 80100840 int i; struct vconsole* inconsoleptr = getvalidprocessconsoleptr(); iunlock(ip); 801007fe: 83 ec 0c sub $0xc,%esp 80100801: ff 75 08 push 0x8(%ebp) acquire(&inconsoleptr->lock); 80100804: 83 c3 04 add $0x4,%ebx iunlock(ip); 80100807: e8 44 25 00 00 call 80102d50 acquire(&inconsoleptr->lock); 8010080c: 89 1c 24 mov %ebx,(%esp) 8010080f: e8 6c 53 00 00 call 80105b80 for (i = 0; i < n; i++) 80100814: 8b 4d 10 mov 0x10(%ebp),%ecx 80100817: 83 c4 10 add $0x10,%esp 8010081a: 85 c9 test %ecx,%ecx 8010081c: 7e 51 jle 8010086f 8010081e: 8b 75 0c mov 0xc(%ebp),%esi 80100821: 8b 7d 10 mov 0x10(%ebp),%edi 80100824: 01 f7 add %esi,%edi if (panicked) 80100826: 8b 15 b8 b6 11 80 mov 0x8011b6b8,%edx { consputc(buf[i] & 0xff); 8010082c: 0f b6 06 movzbl (%esi),%eax if (panicked) 8010082f: 85 d2 test %edx,%edx 80100831: 74 1e je 80100851 asm volatile ("cli"); 80100833: fa cli for (;;) 80100834: eb fe jmp 80100834 80100836: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010083d: 8d 76 00 lea 0x0(%esi),%esi inconsoleptr = currentconsole; 80100840: 8b 1d 80 0e 11 80 mov 0x80110e80,%ebx if (inconsoleptr == 0) 80100846: 85 db test %ebx,%ebx 80100848: 75 b4 jne 801007fe inconsoleptr = &consoles[0]; 8010084a: bb a0 0e 11 80 mov $0x80110ea0,%ebx 8010084f: eb ad jmp 801007fe uartputc(c); 80100851: 83 ec 0c sub $0xc,%esp 80100854: 89 45 e4 mov %eax,-0x1c(%ebp) for (i = 0; i < n; i++) 80100857: 83 c6 01 add $0x1,%esi uartputc(c); 8010085a: 50 push %eax 8010085b: e8 f0 6b 00 00 call 80107450 cgaputc(c); 80100860: 8b 45 e4 mov -0x1c(%ebp),%eax 80100863: e8 98 fc ff ff call 80100500 for (i = 0; i < n; i++) 80100868: 83 c4 10 add $0x10,%esp 8010086b: 39 f7 cmp %esi,%edi 8010086d: 75 b7 jne 80100826 } release(&inconsoleptr->lock); 8010086f: 83 ec 0c sub $0xc,%esp 80100872: 53 push %ebx 80100873: e8 a8 52 00 00 call 80105b20 ilock(ip); 80100878: 58 pop %eax 80100879: ff 75 08 push 0x8(%ebp) 8010087c: e8 ef 23 00 00 call 80102c70 return n; } 80100881: 8b 45 10 mov 0x10(%ebp),%eax 80100884: 8d 65 f4 lea -0xc(%ebp),%esp 80100887: 5b pop %ebx 80100888: 5e pop %esi 80100889: 5f pop %edi 8010088a: 5d pop %ebp 8010088b: c3 ret 8010088c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100890 : { 80100890: 55 push %ebp 80100891: 89 e5 mov %esp,%ebp 80100893: 57 push %edi 80100894: 56 push %esi 80100895: 53 push %ebx 80100896: 83 ec 3c sub $0x3c,%esp if (myproc() == 0x0) 80100899: e8 12 46 00 00 call 80104eb0 8010089e: 85 c0 test %eax,%eax 801008a0: 0f 84 7a 01 00 00 je 80100a20 inconsoleptr = myproc()->consoleptr; 801008a6: e8 05 46 00 00 call 80104eb0 801008ab: 8b 40 7c mov 0x7c(%eax),%eax 801008ae: 89 45 cc mov %eax,-0x34(%ebp) if (inconsoleptr == 0) 801008b1: 85 c0 test %eax,%eax 801008b3: 0f 84 67 01 00 00 je 80100a20 locking = cons.locking; 801008b9: a1 b4 b6 11 80 mov 0x8011b6b4,%eax 801008be: 89 45 c4 mov %eax,-0x3c(%ebp) if (locking) 801008c1: 85 c0 test %eax,%eax 801008c3: 0f 85 87 01 00 00 jne 80100a50 if (fmt == 0) 801008c9: 8b 45 08 mov 0x8(%ebp),%eax 801008cc: 89 45 d0 mov %eax,-0x30(%ebp) 801008cf: 85 c0 test %eax,%eax 801008d1: 0f 84 10 03 00 00 je 80100be7 for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 801008d7: 0f b6 18 movzbl (%eax),%ebx argp = (uint *)(void *)(&fmt + 1); 801008da: 8d 45 0c lea 0xc(%ebp),%eax for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 801008dd: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) argp = (uint *)(void *)(&fmt + 1); 801008e4: 89 45 c8 mov %eax,-0x38(%ebp) for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 801008e7: 85 db test %ebx,%ebx 801008e9: 0f 84 e2 01 00 00 je 80100ad1 if (c != '%') 801008ef: 83 fb 25 cmp $0x25,%ebx 801008f2: 0f 85 78 01 00 00 jne 80100a70 c = fmt[++i] & 0xff; 801008f8: 83 45 d4 01 addl $0x1,-0x2c(%ebp) 801008fc: 8b 75 d0 mov -0x30(%ebp),%esi 801008ff: 8b 45 d4 mov -0x2c(%ebp),%eax 80100902: 0f b6 1c 06 movzbl (%esi,%eax,1),%ebx if (c == 0) 80100906: 85 db test %ebx,%ebx 80100908: 0f 84 c3 01 00 00 je 80100ad1 switch (c) 8010090e: 83 fb 70 cmp $0x70,%ebx 80100911: 0f 84 c2 00 00 00 je 801009d9 80100917: 7f 7f jg 80100998 80100919: 83 fb 25 cmp $0x25,%ebx 8010091c: 0f 84 c6 01 00 00 je 80100ae8 80100922: 83 fb 64 cmp $0x64,%ebx 80100925: 0f 85 d5 01 00 00 jne 80100b00 printint(*argp++, 10, 1); 8010092b: 8b 45 c8 mov -0x38(%ebp),%eax 8010092e: 8b 08 mov (%eax),%ecx x = -xx; 80100930: 89 c8 mov %ecx,%eax printint(*argp++, 10, 1); 80100932: 89 4d c0 mov %ecx,-0x40(%ebp) x = -xx; 80100935: f7 d8 neg %eax 80100937: 0f 49 c8 cmovns %eax,%ecx for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 8010093a: 31 db xor %ebx,%ebx 8010093c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi buf[i++] = digits[x % base]; 80100940: b8 cd cc cc cc mov $0xcccccccd,%eax 80100945: 89 cf mov %ecx,%edi 80100947: 89 de mov %ebx,%esi 80100949: f7 e1 mul %ecx 8010094b: 8d 5b 01 lea 0x1(%ebx),%ebx 8010094e: c1 ea 03 shr $0x3,%edx 80100951: 8d 04 92 lea (%edx,%edx,4),%eax 80100954: 01 c0 add %eax,%eax 80100956: 29 c7 sub %eax,%edi 80100958: 0f b6 87 90 8a 10 80 movzbl -0x7fef7570(%edi),%eax 8010095f: 88 44 1d d7 mov %al,-0x29(%ebp,%ebx,1) } while ((x /= base) != 0); 80100963: 89 c8 mov %ecx,%eax 80100965: 89 d1 mov %edx,%ecx 80100967: 83 f8 09 cmp $0x9,%eax 8010096a: 77 d4 ja 80100940 if (sign) 8010096c: 8b 7d c0 mov -0x40(%ebp),%edi 8010096f: 85 ff test %edi,%edi 80100971: 79 07 jns 8010097a buf[i++] = '-'; 80100973: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) buf[i++] = digits[x % base]; 80100978: 89 de mov %ebx,%esi while (--i >= 0) 8010097a: 8d 45 d8 lea -0x28(%ebp),%eax 8010097d: 01 c6 add %eax,%esi if (panicked) 8010097f: 8b 0d b8 b6 11 80 mov 0x8011b6b8,%ecx consputc(buf[i]); 80100985: 0f be 1e movsbl (%esi),%ebx if (panicked) 80100988: 85 c9 test %ecx,%ecx 8010098a: 0f 84 88 01 00 00 je 80100b18 80100990: fa cli for (;;) 80100991: eb fe jmp 80100991 80100993: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100997: 90 nop switch (c) 80100998: 83 fb 73 cmp $0x73,%ebx 8010099b: 75 33 jne 801009d0 if ((s = (char *)*argp++) == 0) 8010099d: 8b 45 c8 mov -0x38(%ebp),%eax 801009a0: 8b 30 mov (%eax),%esi 801009a2: 8d 58 04 lea 0x4(%eax),%ebx 801009a5: 85 f6 test %esi,%esi 801009a7: 0f 84 02 02 00 00 je 80100baf for (; *s; s++) 801009ad: 0f b6 06 movzbl (%esi),%eax 801009b0: 84 c0 test %al,%al 801009b2: 0f 84 ac 01 00 00 je 80100b64 if (panicked) 801009b8: 8b 3d b8 b6 11 80 mov 0x8011b6b8,%edi 801009be: 85 ff test %edi,%edi 801009c0: 0f 84 7a 01 00 00 je 80100b40 801009c6: fa cli for (;;) 801009c7: eb fe jmp 801009c7 801009c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi switch (c) 801009d0: 83 fb 78 cmp $0x78,%ebx 801009d3: 0f 85 27 01 00 00 jne 80100b00 printint(*argp++, 16, 0); 801009d9: 8b 45 c8 mov -0x38(%ebp),%eax 801009dc: 8b 08 mov (%eax),%ecx i = 0; 801009de: 31 c0 xor %eax,%eax buf[i++] = digits[x % base]; 801009e0: 89 ca mov %ecx,%edx 801009e2: 89 c3 mov %eax,%ebx 801009e4: 83 c0 01 add $0x1,%eax 801009e7: 83 e2 0f and $0xf,%edx 801009ea: 0f b6 92 90 8a 10 80 movzbl -0x7fef7570(%edx),%edx 801009f1: 88 54 05 d7 mov %dl,-0x29(%ebp,%eax,1) } while ((x /= base) != 0); 801009f5: 89 ca mov %ecx,%edx 801009f7: c1 e9 04 shr $0x4,%ecx 801009fa: 83 fa 0f cmp $0xf,%edx 801009fd: 77 e1 ja 801009e0 801009ff: 8d 45 d8 lea -0x28(%ebp),%eax 80100a02: 01 c3 add %eax,%ebx if (panicked) 80100a04: 8b 15 b8 b6 11 80 mov 0x8011b6b8,%edx consputc(buf[i]); 80100a0a: 0f b6 03 movzbl (%ebx),%eax if (panicked) 80100a0d: 85 d2 test %edx,%edx 80100a0f: 0f 84 57 01 00 00 je 80100b6c 80100a15: fa cli for (;;) 80100a16: eb fe jmp 80100a16 80100a18: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100a1f: 90 nop inconsoleptr = currentconsole; 80100a20: a1 80 0e 11 80 mov 0x80110e80,%eax 80100a25: 89 45 cc mov %eax,-0x34(%ebp) if (inconsoleptr == 0) 80100a28: 85 c0 test %eax,%eax 80100a2a: 0f 85 89 fe ff ff jne 801008b9 locking = cons.locking; 80100a30: a1 b4 b6 11 80 mov 0x8011b6b4,%eax inconsoleptr = &consoles[0]; 80100a35: c7 45 cc a0 0e 11 80 movl $0x80110ea0,-0x34(%ebp) locking = cons.locking; 80100a3c: 89 45 c4 mov %eax,-0x3c(%ebp) if (locking) 80100a3f: 85 c0 test %eax,%eax 80100a41: 0f 84 82 fe ff ff je 801008c9 80100a47: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100a4e: 66 90 xchg %ax,%ax acquire(&inconsoleptr->lock); 80100a50: 8b 45 cc mov -0x34(%ebp),%eax 80100a53: 83 ec 0c sub $0xc,%esp 80100a56: 83 c0 04 add $0x4,%eax 80100a59: 50 push %eax 80100a5a: e8 21 51 00 00 call 80105b80 80100a5f: 83 c4 10 add $0x10,%esp 80100a62: e9 62 fe ff ff jmp 801008c9 80100a67: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100a6e: 66 90 xchg %ax,%ax if (panicked) 80100a70: a1 b8 b6 11 80 mov 0x8011b6b8,%eax 80100a75: 85 c0 test %eax,%eax 80100a77: 74 2f je 80100aa8 80100a79: fa cli for (;;) 80100a7a: eb fe jmp 80100a7a 80100a7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi uartputc(c); 80100a80: 83 ec 0c sub $0xc,%esp 80100a83: 6a 25 push $0x25 80100a85: e8 c6 69 00 00 call 80107450 cgaputc(c); 80100a8a: b8 25 00 00 00 mov $0x25,%eax 80100a8f: e8 6c fa ff ff call 80100500 if (panicked) 80100a94: a1 b8 b6 11 80 mov 0x8011b6b8,%eax 80100a99: 83 c4 10 add $0x10,%esp 80100a9c: 85 c0 test %eax,%eax 80100a9e: 0f 85 23 01 00 00 jne 80100bc7 80100aa4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi uartputc(c); 80100aa8: 83 ec 0c sub $0xc,%esp 80100aab: 53 push %ebx 80100aac: e8 9f 69 00 00 call 80107450 cgaputc(c); 80100ab1: 89 d8 mov %ebx,%eax 80100ab3: e8 48 fa ff ff call 80100500 } 80100ab8: 83 c4 10 add $0x10,%esp for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 80100abb: 83 45 d4 01 addl $0x1,-0x2c(%ebp) 80100abf: 8b 75 d0 mov -0x30(%ebp),%esi 80100ac2: 8b 45 d4 mov -0x2c(%ebp),%eax 80100ac5: 0f b6 1c 06 movzbl (%esi,%eax,1),%ebx 80100ac9: 85 db test %ebx,%ebx 80100acb: 0f 85 1e fe ff ff jne 801008ef if (locking) 80100ad1: 8b 45 c4 mov -0x3c(%ebp),%eax 80100ad4: 85 c0 test %eax,%eax 80100ad6: 0f 85 f4 00 00 00 jne 80100bd0 } 80100adc: 8d 65 f4 lea -0xc(%ebp),%esp 80100adf: 5b pop %ebx 80100ae0: 5e pop %esi 80100ae1: 5f pop %edi 80100ae2: 5d pop %ebp 80100ae3: c3 ret 80100ae4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (panicked) 80100ae8: 8b 0d b8 b6 11 80 mov 0x8011b6b8,%ecx 80100aee: 85 c9 test %ecx,%ecx 80100af0: 0f 84 9d 00 00 00 je 80100b93 80100af6: fa cli for (;;) 80100af7: eb fe jmp 80100af7 80100af9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (panicked) 80100b00: 8b 15 b8 b6 11 80 mov 0x8011b6b8,%edx 80100b06: 85 d2 test %edx,%edx 80100b08: 0f 84 72 ff ff ff je 80100a80 80100b0e: fa cli for (;;) 80100b0f: eb fe jmp 80100b0f 80100b11: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi uartputc(c); 80100b18: 83 ec 0c sub $0xc,%esp while (--i >= 0) 80100b1b: 8d 7d d8 lea -0x28(%ebp),%edi uartputc(c); 80100b1e: 53 push %ebx 80100b1f: e8 2c 69 00 00 call 80107450 cgaputc(c); 80100b24: 89 d8 mov %ebx,%eax 80100b26: e8 d5 f9 ff ff call 80100500 while (--i >= 0) 80100b2b: 8d 46 ff lea -0x1(%esi),%eax 80100b2e: 83 c4 10 add $0x10,%esp 80100b31: 39 f7 cmp %esi,%edi 80100b33: 0f 84 85 00 00 00 je 80100bbe 80100b39: 89 c6 mov %eax,%esi 80100b3b: e9 3f fe ff ff jmp 8010097f uartputc(c); 80100b40: 83 ec 0c sub $0xc,%esp consputc(*s); 80100b43: 0f be f8 movsbl %al,%edi for (; *s; s++) 80100b46: 83 c6 01 add $0x1,%esi uartputc(c); 80100b49: 57 push %edi 80100b4a: e8 01 69 00 00 call 80107450 cgaputc(c); 80100b4f: 89 f8 mov %edi,%eax 80100b51: e8 aa f9 ff ff call 80100500 for (; *s; s++) 80100b56: 0f b6 06 movzbl (%esi),%eax 80100b59: 83 c4 10 add $0x10,%esp 80100b5c: 84 c0 test %al,%al 80100b5e: 0f 85 54 fe ff ff jne 801009b8 if ((s = (char *)*argp++) == 0) 80100b64: 89 5d c8 mov %ebx,-0x38(%ebp) 80100b67: e9 4f ff ff ff jmp 80100abb uartputc(c); 80100b6c: 83 ec 0c sub $0xc,%esp consputc(buf[i]); 80100b6f: 0f be f0 movsbl %al,%esi while (--i >= 0) 80100b72: 8d 7d d8 lea -0x28(%ebp),%edi uartputc(c); 80100b75: 56 push %esi 80100b76: e8 d5 68 00 00 call 80107450 cgaputc(c); 80100b7b: 89 f0 mov %esi,%eax 80100b7d: e8 7e f9 ff ff call 80100500 while (--i >= 0) 80100b82: 8d 43 ff lea -0x1(%ebx),%eax 80100b85: 83 c4 10 add $0x10,%esp 80100b88: 39 df cmp %ebx,%edi 80100b8a: 74 32 je 80100bbe 80100b8c: 89 c3 mov %eax,%ebx 80100b8e: e9 71 fe ff ff jmp 80100a04 uartputc(c); 80100b93: 83 ec 0c sub $0xc,%esp 80100b96: 6a 25 push $0x25 80100b98: e8 b3 68 00 00 call 80107450 cgaputc(c); 80100b9d: b8 25 00 00 00 mov $0x25,%eax 80100ba2: e8 59 f9 ff ff call 80100500 } 80100ba7: 83 c4 10 add $0x10,%esp 80100baa: e9 0c ff ff ff jmp 80100abb s = "(null)"; 80100baf: be b8 89 10 80 mov $0x801089b8,%esi for (; *s; s++) 80100bb4: b8 28 00 00 00 mov $0x28,%eax 80100bb9: e9 fa fd ff ff jmp 801009b8 printint(*argp++, 16, 0); 80100bbe: 83 45 c8 04 addl $0x4,-0x38(%ebp) } 80100bc2: e9 f4 fe ff ff jmp 80100abb 80100bc7: fa cli for (;;) 80100bc8: eb fe jmp 80100bc8 80100bca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi release(&inconsoleptr->lock); 80100bd0: 8b 45 cc mov -0x34(%ebp),%eax 80100bd3: 83 ec 0c sub $0xc,%esp 80100bd6: 83 c0 04 add $0x4,%eax 80100bd9: 50 push %eax 80100bda: e8 41 4f 00 00 call 80105b20 80100bdf: 83 c4 10 add $0x10,%esp } 80100be2: e9 f5 fe ff ff jmp 80100adc panic("null fmt"); 80100be7: 83 ec 0c sub $0xc,%esp 80100bea: 68 bf 89 10 80 push $0x801089bf 80100bef: e8 8c f8 ff ff call 80100480 80100bf4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100bfb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100bff: 90 nop 80100c00 : { 80100c00: 55 push %ebp 80100c01: 89 e5 mov %esp,%ebp 80100c03: 57 push %edi 80100c04: 56 push %esi 80100c05: 53 push %ebx 80100c06: 83 ec 3c sub $0x3c,%esp if (fmt == 0) 80100c09: 8b 45 0c mov 0xc(%ebp),%eax 80100c0c: 89 45 d0 mov %eax,-0x30(%ebp) 80100c0f: 85 c0 test %eax,%eax 80100c11: 0f 84 69 02 00 00 je 80100e80 for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 80100c17: 0f b6 00 movzbl (%eax),%eax argp = (uint *)(void *)(&fmt + 1); 80100c1a: 8d 75 10 lea 0x10(%ebp),%esi for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 80100c1d: 31 ff xor %edi,%edi si = 0; 80100c1f: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) 80100c26: 89 f3 mov %esi,%ebx 80100c28: 89 fe mov %edi,%esi for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 80100c2a: 89 c2 mov %eax,%edx 80100c2c: 85 c0 test %eax,%eax 80100c2e: 75 2b jne 80100c5b 80100c30: e9 21 01 00 00 jmp 80100d56 80100c35: 8d 76 00 lea 0x0(%esi),%esi strbuffer[si] = c; 80100c38: 8b 45 d4 mov -0x2c(%ebp),%eax 80100c3b: 8b 7d 08 mov 0x8(%ebp),%edi 80100c3e: 88 14 07 mov %dl,(%edi,%eax,1) si++; 80100c41: 83 c0 01 add $0x1,%eax 80100c44: 89 45 d4 mov %eax,-0x2c(%ebp) for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 80100c47: 8b 45 d0 mov -0x30(%ebp),%eax 80100c4a: 83 c6 01 add $0x1,%esi 80100c4d: 0f b6 04 30 movzbl (%eax,%esi,1),%eax 80100c51: 89 c2 mov %eax,%edx 80100c53: 85 c0 test %eax,%eax 80100c55: 0f 84 f5 00 00 00 je 80100d50 if (c != '%') 80100c5b: 83 f8 25 cmp $0x25,%eax 80100c5e: 75 d8 jne 80100c38 c = fmt[++i] & 0xff; 80100c60: 8b 45 d0 mov -0x30(%ebp),%eax 80100c63: 83 c6 01 add $0x1,%esi 80100c66: 0f b6 04 30 movzbl (%eax,%esi,1),%eax 80100c6a: 89 c2 mov %eax,%edx if (c == 0) 80100c6c: 85 c0 test %eax,%eax 80100c6e: 0f 84 dc 00 00 00 je 80100d50 switch (c) 80100c74: 83 f8 70 cmp $0x70,%eax 80100c77: 0f 84 58 01 00 00 je 80100dd5 80100c7d: 0f 8f e5 00 00 00 jg 80100d68 80100c83: 83 f8 25 cmp $0x25,%eax 80100c86: 0f 84 e4 01 00 00 je 80100e70 80100c8c: 83 f8 64 cmp $0x64,%eax 80100c8f: 0f 85 ba 01 00 00 jne 80100e4f memset(buf, 0, sizeof buf); 80100c95: 83 ec 04 sub $0x4,%esp 80100c98: 8d 45 d8 lea -0x28(%ebp),%eax 80100c9b: 6a 10 push $0x10 80100c9d: 6a 00 push $0x0 80100c9f: 50 push %eax 80100ca0: e8 9b 4f 00 00 call 80105c40 x = itoa(*argp++, 10, 1, buf); 80100ca5: 8b 0b mov (%ebx),%ecx 80100ca7: 8d 43 04 lea 0x4(%ebx),%eax buf[i++] = digits[x % base]; 80100caa: 89 75 c4 mov %esi,-0x3c(%ebp) x = itoa(*argp++, 10, 1, buf); 80100cad: 89 45 c0 mov %eax,-0x40(%ebp) if (sign && (sign = xx < 0)) 80100cb0: 83 c4 10 add $0x10,%esp x = -xx; 80100cb3: 89 c8 mov %ecx,%eax x = itoa(*argp++, 10, 1, buf); 80100cb5: 89 4d c8 mov %ecx,-0x38(%ebp) x = -xx; 80100cb8: f7 d8 neg %eax 80100cba: 0f 49 c8 cmovns %eax,%ecx for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 80100cbd: 31 db xor %ebx,%ebx 80100cbf: 90 nop buf[i++] = digits[x % base]; 80100cc0: b8 cd cc cc cc mov $0xcccccccd,%eax 80100cc5: 89 cf mov %ecx,%edi 80100cc7: 89 de mov %ebx,%esi 80100cc9: f7 e1 mul %ecx 80100ccb: 8d 5b 01 lea 0x1(%ebx),%ebx 80100cce: c1 ea 03 shr $0x3,%edx 80100cd1: 8d 04 92 lea (%edx,%edx,4),%eax 80100cd4: 01 c0 add %eax,%eax 80100cd6: 29 c7 sub %eax,%edi 80100cd8: 0f b6 87 90 8a 10 80 movzbl -0x7fef7570(%edi),%eax 80100cdf: 88 44 1d d7 mov %al,-0x29(%ebp,%ebx,1) } while ((x /= base) != 0); 80100ce3: 89 c8 mov %ecx,%eax 80100ce5: 89 d1 mov %edx,%ecx 80100ce7: 83 f8 09 cmp $0x9,%eax 80100cea: 77 d4 ja 80100cc0 if (sign) 80100cec: 8b 45 c8 mov -0x38(%ebp),%eax 80100cef: 89 75 cc mov %esi,-0x34(%ebp) 80100cf2: 8b 75 c4 mov -0x3c(%ebp),%esi 80100cf5: 85 c0 test %eax,%eax 80100cf7: 79 08 jns 80100d01 buf[i++] = '-'; 80100cf9: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) buf[i++] = digits[x % base]; 80100cfe: 89 5d cc mov %ebx,-0x34(%ebp) while (--x >= 0) 80100d01: 8b 55 d4 mov -0x2c(%ebp),%edx 80100d04: 8d 45 d8 lea -0x28(%ebp),%eax 80100d07: 03 55 08 add 0x8(%ebp),%edx 80100d0a: 03 45 cc add -0x34(%ebp),%eax 80100d0d: 8d 76 00 lea 0x0(%esi),%esi strbuffer[si] = buf[x]; 80100d10: 0f b6 08 movzbl (%eax),%ecx while (--x >= 0) 80100d13: 8d 7d d8 lea -0x28(%ebp),%edi 80100d16: 83 c2 01 add $0x1,%edx strbuffer[si] = buf[x]; 80100d19: 88 4a ff mov %cl,-0x1(%edx) while (--x >= 0) 80100d1c: 89 c1 mov %eax,%ecx 80100d1e: 83 e8 01 sub $0x1,%eax 80100d21: 39 cf cmp %ecx,%edi 80100d23: 75 eb jne 80100d10 si++; 80100d25: 8b 45 d4 mov -0x2c(%ebp),%eax 80100d28: 8b 7d cc mov -0x34(%ebp),%edi for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 80100d2b: 83 c6 01 add $0x1,%esi x = itoa(*argp++, 10, 1, buf); 80100d2e: 8b 5d c0 mov -0x40(%ebp),%ebx si++; 80100d31: 8d 44 38 01 lea 0x1(%eax,%edi,1),%eax 80100d35: 89 45 d4 mov %eax,-0x2c(%ebp) for (i = 0; (c = fmt[i] & 0xff) != 0; i++) 80100d38: 8b 45 d0 mov -0x30(%ebp),%eax 80100d3b: 0f b6 04 30 movzbl (%eax,%esi,1),%eax 80100d3f: 89 c2 mov %eax,%edx 80100d41: 85 c0 test %eax,%eax 80100d43: 0f 85 12 ff ff ff jne 80100c5b 80100d49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi strbuffer[si] = '\0'; 80100d50: 8b 45 d4 mov -0x2c(%ebp),%eax 80100d53: 01 45 08 add %eax,0x8(%ebp) 80100d56: 8b 45 08 mov 0x8(%ebp),%eax 80100d59: c6 00 00 movb $0x0,(%eax) } 80100d5c: 8d 65 f4 lea -0xc(%ebp),%esp 80100d5f: 5b pop %ebx 80100d60: 5e pop %esi 80100d61: 5f pop %edi 80100d62: 5d pop %ebp 80100d63: c3 ret 80100d64: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi switch (c) 80100d68: 83 f8 73 cmp $0x73,%eax 80100d6b: 75 63 jne 80100dd0 if ((s = (char *)*argp++) == 0) 80100d6d: 8b 13 mov (%ebx),%edx 80100d6f: 8d 43 04 lea 0x4(%ebx),%eax strbuffer[si] = s[sli]; 80100d72: 8b 4d 08 mov 0x8(%ebp),%ecx 80100d75: 89 75 c4 mov %esi,-0x3c(%ebp) if ((s = (char *)*argp++) == 0) 80100d78: 89 45 c8 mov %eax,-0x38(%ebp) 80100d7b: b8 b8 89 10 80 mov $0x801089b8,%eax 80100d80: 85 d2 test %edx,%edx 80100d82: 0f 45 c2 cmovne %edx,%eax for (int sli = 0; sli < strlen(s); sli++) 80100d85: 31 ff xor %edi,%edi if ((s = (char *)*argp++) == 0) 80100d87: 89 c3 mov %eax,%ebx strbuffer[si] = s[sli]; 80100d89: 8b 45 d4 mov -0x2c(%ebp),%eax 80100d8c: 01 c1 add %eax,%ecx 80100d8e: 89 c6 mov %eax,%esi 80100d90: 89 f8 mov %edi,%eax 80100d92: 89 df mov %ebx,%edi 80100d94: 89 4d cc mov %ecx,-0x34(%ebp) 80100d97: 89 c3 mov %eax,%ebx for (int sli = 0; sli < strlen(s); sli++) 80100d99: eb 12 jmp 80100dad 80100d9b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100d9f: 90 nop strbuffer[si] = s[sli]; 80100da0: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax 80100da4: 8b 4d cc mov -0x34(%ebp),%ecx 80100da7: 88 04 19 mov %al,(%ecx,%ebx,1) for (int sli = 0; sli < strlen(s); sli++) 80100daa: 83 c3 01 add $0x1,%ebx 80100dad: 83 ec 0c sub $0xc,%esp 80100db0: 8d 04 33 lea (%ebx,%esi,1),%eax 80100db3: 57 push %edi 80100db4: 89 45 d4 mov %eax,-0x2c(%ebp) 80100db7: e8 84 50 00 00 call 80105e40 80100dbc: 83 c4 10 add $0x10,%esp 80100dbf: 39 d8 cmp %ebx,%eax 80100dc1: 7f dd jg 80100da0 if ((s = (char *)*argp++) == 0) 80100dc3: 8b 75 c4 mov -0x3c(%ebp),%esi 80100dc6: 8b 5d c8 mov -0x38(%ebp),%ebx 80100dc9: e9 79 fe ff ff jmp 80100c47 80100dce: 66 90 xchg %ax,%ax switch (c) 80100dd0: 83 f8 78 cmp $0x78,%eax 80100dd3: 75 7a jne 80100e4f memset(buf, 0, sizeof buf); 80100dd5: 83 ec 04 sub $0x4,%esp 80100dd8: 8d 45 d8 lea -0x28(%ebp),%eax 80100ddb: 6a 10 push $0x10 80100ddd: 6a 00 push $0x0 80100ddf: 50 push %eax 80100de0: e8 5b 4e 00 00 call 80105c40 x = itoa(*argp++, 16, 0, buf); 80100de5: 8d 43 04 lea 0x4(%ebx),%eax 80100de8: 83 c4 10 add $0x10,%esp i = 0; 80100deb: 31 d2 xor %edx,%edx x = itoa(*argp++, 16, 0, buf); 80100ded: 89 45 cc mov %eax,-0x34(%ebp) 80100df0: 8b 03 mov (%ebx),%eax i = 0; 80100df2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi buf[i++] = digits[x % base]; 80100df8: 89 c3 mov %eax,%ebx 80100dfa: 89 d1 mov %edx,%ecx 80100dfc: 8d 52 01 lea 0x1(%edx),%edx 80100dff: 83 e3 0f and $0xf,%ebx 80100e02: 0f b6 9b 90 8a 10 80 movzbl -0x7fef7570(%ebx),%ebx 80100e09: 88 5c 15 d7 mov %bl,-0x29(%ebp,%edx,1) } while ((x /= base) != 0); 80100e0d: 89 c3 mov %eax,%ebx 80100e0f: c1 e8 04 shr $0x4,%eax 80100e12: 83 fb 0f cmp $0xf,%ebx 80100e15: 77 e1 ja 80100df8 80100e17: 8d 45 d8 lea -0x28(%ebp),%eax 80100e1a: 8b 55 d4 mov -0x2c(%ebp),%edx 80100e1d: 03 55 08 add 0x8(%ebp),%edx 80100e20: 01 c8 add %ecx,%eax 80100e22: 8d b6 00 00 00 00 lea 0x0(%esi),%esi strbuffer[si] = buf[x]; 80100e28: 0f b6 18 movzbl (%eax),%ebx while (--x >= 0) 80100e2b: 8d 7d d8 lea -0x28(%ebp),%edi 80100e2e: 83 c2 01 add $0x1,%edx strbuffer[si] = buf[x]; 80100e31: 88 5a ff mov %bl,-0x1(%edx) while (--x >= 0) 80100e34: 89 c3 mov %eax,%ebx 80100e36: 83 e8 01 sub $0x1,%eax 80100e39: 39 df cmp %ebx,%edi 80100e3b: 75 eb jne 80100e28 si++; 80100e3d: 8b 45 d4 mov -0x2c(%ebp),%eax x = itoa(*argp++, 16, 0, buf); 80100e40: 8b 5d cc mov -0x34(%ebp),%ebx si++; 80100e43: 8d 44 01 01 lea 0x1(%ecx,%eax,1),%eax 80100e47: 89 45 d4 mov %eax,-0x2c(%ebp) 80100e4a: e9 f8 fd ff ff jmp 80100c47 strbuffer[si] = '%'; 80100e4f: 8b 45 d4 mov -0x2c(%ebp),%eax 80100e52: 8b 7d 08 mov 0x8(%ebp),%edi 80100e55: c6 04 07 25 movb $0x25,(%edi,%eax,1) strbuffer[si] = c; 80100e59: 88 54 07 01 mov %dl,0x1(%edi,%eax,1) si++; 80100e5d: 83 c0 02 add $0x2,%eax 80100e60: 89 45 d4 mov %eax,-0x2c(%ebp) break; 80100e63: e9 df fd ff ff jmp 80100c47 80100e68: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100e6f: 90 nop strbuffer[i] = '%'; 80100e70: 8b 45 08 mov 0x8(%ebp),%eax si++; 80100e73: 83 45 d4 01 addl $0x1,-0x2c(%ebp) strbuffer[i] = '%'; 80100e77: c6 04 30 25 movb $0x25,(%eax,%esi,1) break; 80100e7b: e9 c7 fd ff ff jmp 80100c47 panic("null fmt"); 80100e80: 83 ec 0c sub $0xc,%esp 80100e83: 68 bf 89 10 80 push $0x801089bf 80100e88: e8 f3 f5 ff ff call 80100480 80100e8d: 8d 76 00 lea 0x0(%esi),%esi 80100e90 : { 80100e90: 55 push %ebp 80100e91: 89 e5 mov %esp,%ebp 80100e93: 53 push %ebx 80100e94: 83 ec 24 sub $0x24,%esp if (myproc() == 0x0) 80100e97: e8 14 40 00 00 call 80104eb0 80100e9c: 85 c0 test %eax,%eax 80100e9e: 0f 84 9d 00 00 00 je 80100f41 inconsoleptr = myproc()->consoleptr; 80100ea4: e8 07 40 00 00 call 80104eb0 80100ea9: 8b 58 7c mov 0x7c(%eax),%ebx if (inconsoleptr == 0) 80100eac: 85 db test %ebx,%ebx 80100eae: 0f 84 8d 00 00 00 je 80100f41 char menutext[] = "(M)enu"; 80100eb4: b8 6e 75 00 00 mov $0x756e,%eax sprintf(consoletitletext, "Console %d", inconsoleptr->consoleindex); 80100eb9: 83 ec 04 sub $0x4,%esp 80100ebc: ff 33 push (%ebx) char menutext[] = "(M)enu"; 80100ebe: 66 89 45 eb mov %ax,-0x15(%ebp) sprintf(consoletitletext, "Console %d", inconsoleptr->consoleindex); 80100ec2: 8d 45 ee lea -0x12(%ebp),%eax 80100ec5: 68 c8 89 10 80 push $0x801089c8 80100eca: 50 push %eax char menutext[] = "(M)enu"; 80100ecb: c7 45 e7 28 4d 29 65 movl $0x65294d28,-0x19(%ebp) 80100ed2: c6 45 ed 00 movb $0x0,-0x13(%ebp) sprintf(consoletitletext, "Console %d", inconsoleptr->consoleindex); 80100ed6: e8 25 fd ff ff call 80100c00 crt[pos] = (c & 0xff) | inconsoleptr->titlebgcol; 80100edb: 8b 8b 74 10 00 00 mov 0x1074(%ebx),%ecx 80100ee1: 83 c4 10 add $0x10,%esp for (pos = 0; pos < SCRWIDTH; pos++) 80100ee4: 31 c0 xor %eax,%eax 80100ee6: eb 4d jmp 80100f35 80100ee8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100eef: 90 nop else if (pos >= 10 && pos < 20) 80100ef0: 8d 50 f6 lea -0xa(%eax),%edx 80100ef3: 83 fa 09 cmp $0x9,%edx 80100ef6: 76 6d jbe 80100f65 else if (pos >= 25 && pos < 45) 80100ef8: 8d 50 e7 lea -0x19(%eax),%edx 80100efb: 83 fa 13 cmp $0x13,%edx 80100efe: 76 76 jbe 80100f76 else if (pos >= 50 && pos < 80) 80100f00: 8d 50 ce lea -0x32(%eax),%edx 80100f03: 83 fa 1d cmp $0x1d,%edx 80100f06: 76 64 jbe 80100f6c 80100f08: ba 20 00 00 00 mov $0x20,%edx if (inconsoleptr->inuse) 80100f0d: 83 bb 70 10 00 00 00 cmpl $0x0,0x1070(%ebx) 80100f14: 74 10 je 80100f26 crt[pos] = (c & 0xff) | inconsoleptr->titlebgcol; 80100f16: 09 d1 or %edx,%ecx 80100f18: 66 89 8c 00 00 80 0b mov %cx,-0x7ff48000(%eax,%eax,1) 80100f1f: 80 inconsoleptr->screenbuffer[pos] = (c & 0xff) | inconsoleptr->titlebgcol; 80100f20: 8b 8b 74 10 00 00 mov 0x1074(%ebx),%ecx 80100f26: 09 ca or %ecx,%edx 80100f28: 66 89 54 43 3c mov %dx,0x3c(%ebx,%eax,2) for (pos = 0; pos < SCRWIDTH; pos++) 80100f2d: 83 c0 01 add $0x1,%eax 80100f30: 83 f8 50 cmp $0x50,%eax 80100f33: 74 2b je 80100f60 if (pos < 6) { 80100f35: 83 f8 05 cmp $0x5,%eax 80100f38: 7f b6 jg 80100ef0 crt[pos] = (c & 0xff) | inconsoleptr->titlebgcol; 80100f3a: 0f b6 54 05 e7 movzbl -0x19(%ebp,%eax,1),%edx 80100f3f: eb cc jmp 80100f0d inconsoleptr = currentconsole; 80100f41: 8b 1d 80 0e 11 80 mov 0x80110e80,%ebx if (inconsoleptr == 0) 80100f47: 85 db test %ebx,%ebx 80100f49: 0f 85 65 ff ff ff jne 80100eb4 inconsoleptr = &consoles[0]; 80100f4f: bb a0 0e 11 80 mov $0x80110ea0,%ebx 80100f54: e9 5b ff ff ff jmp 80100eb4 80100f59: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } 80100f60: 8b 5d fc mov -0x4(%ebp),%ebx 80100f63: c9 leave 80100f64: c3 ret crt[pos] = (c & 0xff) | inconsoleptr->titlebgcol; 80100f65: 0f b6 54 05 e4 movzbl -0x1c(%ebp,%eax,1),%edx 80100f6a: eb a1 jmp 80100f0d 80100f6c: 0f b6 94 03 5e 10 00 movzbl 0x105e(%ebx,%eax,1),%edx 80100f73: 00 80100f74: eb 97 jmp 80100f0d 80100f76: 0f b6 94 03 5f 10 00 movzbl 0x105f(%ebx,%eax,1),%edx 80100f7d: 00 80100f7e: eb 8d jmp 80100f0d 80100f80 : { 80100f80: 55 push %ebp 80100f81: 89 e5 mov %esp,%ebp 80100f83: 83 ec 08 sub $0x8,%esp if (myproc() == 0x0) 80100f86: e8 25 3f 00 00 call 80104eb0 80100f8b: 85 c0 test %eax,%eax 80100f8d: 74 11 je 80100fa0 inconsoleptr = myproc()->consoleptr; 80100f8f: e8 1c 3f 00 00 call 80104eb0 80100f94: 8b 40 7c mov 0x7c(%eax),%eax if (inconsoleptr == 0) 80100f97: 85 c0 test %eax,%eax 80100f99: 74 05 je 80100fa0 } 80100f9b: c9 leave 80100f9c: c3 ret 80100f9d: 8d 76 00 lea 0x0(%esi),%esi inconsoleptr = currentconsole; 80100fa0: a1 80 0e 11 80 mov 0x80110e80,%eax if (inconsoleptr == 0) 80100fa5: 85 c0 test %eax,%eax 80100fa7: 75 f2 jne 80100f9b } 80100fa9: c9 leave inconsoleptr = &consoles[0]; 80100faa: b8 a0 0e 11 80 mov $0x80110ea0,%eax } 80100faf: c3 ret 80100fb0 : { 80100fb0: 55 push %ebp 80100fb1: 89 e5 mov %esp,%ebp 80100fb3: 83 ec 24 sub $0x24,%esp acquire(&cons.lock); 80100fb6: 68 80 b6 11 80 push $0x8011b680 80100fbb: e8 c0 4b 00 00 call 80105b80 while ((c = kbdgetc()) <= 0) 80100fc0: 83 c4 10 add $0x10,%esp 80100fc3: eb 05 jmp 80100fca 80100fc5: 8d 76 00 lea 0x0(%esi),%esi if (c == 0) 80100fc8: 74 26 je 80100ff0 while ((c = kbdgetc()) <= 0) 80100fca: e8 11 2c 00 00 call 80103be0 80100fcf: 85 c0 test %eax,%eax 80100fd1: 7e f5 jle 80100fc8 release(&cons.lock); 80100fd3: 83 ec 0c sub $0xc,%esp 80100fd6: 89 45 f4 mov %eax,-0xc(%ebp) 80100fd9: 68 80 b6 11 80 push $0x8011b680 80100fde: e8 3d 4b 00 00 call 80105b20 } 80100fe3: 8b 45 f4 mov -0xc(%ebp),%eax 80100fe6: c9 leave 80100fe7: c3 ret 80100fe8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100fef: 90 nop c = kbdgetc(); 80100ff0: e8 eb 2b 00 00 call 80103be0 80100ff5: eb d3 jmp 80100fca 80100ff7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100ffe: 66 90 xchg %ax,%ax 80101000 : // Function to flood a buffer with A-Z characters looping (for testing initially) void testfillbuffer(ushort *bufferin) { 80101000: 55 push %ebp ushort firstchar = 65; ushort lastchar = 90; ushort currentchar = firstchar; 80101001: ba 41 00 00 00 mov $0x41,%edx { 80101006: 89 e5 mov %esp,%ebp 80101008: 53 push %ebx 80101009: 8b 45 08 mov 0x8(%ebp),%eax 8010100c: 8d 98 a0 0f 00 00 lea 0xfa0(%eax),%ebx 80101012: eb 17 jmp 8010102b 80101014: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (currentchar > lastchar) { currentchar = firstchar; } bufferin[i] = (currentchar & 0xff) | 0x0700; 80101018: 89 d1 mov %edx,%ecx for (int i = 0; i < (SCRHEIGHT * SCRWIDTH); i++) 8010101a: 83 c0 02 add $0x2,%eax currentchar++; 8010101d: 83 c2 01 add $0x1,%edx bufferin[i] = (currentchar & 0xff) | 0x0700; 80101020: 80 cd 07 or $0x7,%ch 80101023: 66 89 48 fe mov %cx,-0x2(%eax) for (int i = 0; i < (SCRHEIGHT * SCRWIDTH); i++) 80101027: 39 c3 cmp %eax,%ebx 80101029: 74 1b je 80101046 if (currentchar > lastchar) 8010102b: 66 83 fa 5b cmp $0x5b,%dx 8010102f: 75 e7 jne 80101018 80101031: b9 41 07 00 00 mov $0x741,%ecx for (int i = 0; i < (SCRHEIGHT * SCRWIDTH); i++) 80101036: 83 c0 02 add $0x2,%eax 80101039: ba 42 00 00 00 mov $0x42,%edx bufferin[i] = (currentchar & 0xff) | 0x0700; 8010103e: 66 89 48 fe mov %cx,-0x2(%eax) for (int i = 0; i < (SCRHEIGHT * SCRWIDTH); i++) 80101042: 39 c3 cmp %eax,%ebx 80101044: 75 e5 jne 8010102b } } 80101046: 8b 5d fc mov -0x4(%ebp),%ebx 80101049: c9 leave 8010104a: c3 ret 8010104b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010104f: 90 nop 80101050 : // Function to get a pointer to the base console struct vconsole* getbaseconsoleptr(void) { return &consoles[0]; } 80101050: b8 a0 0e 11 80 mov $0x80110ea0,%eax 80101055: c3 ret 80101056: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010105d: 8d 76 00 lea 0x0(%esi),%esi 80101060 : // Function to clear a given buffer using its pointer/address void clearconsole(ushort *bufferin) { 80101060: 55 push %ebp 80101061: 89 e5 mov %esp,%ebp 80101063: 83 ec 0c sub $0xc,%esp // Flood the screen buffer with blank spaces memset(bufferin, 0, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 80101066: 68 a0 0f 00 00 push $0xfa0 8010106b: 6a 00 push $0x0 8010106d: ff 75 08 push 0x8(%ebp) 80101070: e8 cb 4b 00 00 call 80105c40 } 80101075: 83 c4 10 add $0x10,%esp 80101078: c9 leave 80101079: c3 ret 8010107a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101080 : // Function for loading an entire buffer into the screen memory using its pointer/address void loadscreenbuffer(ushort *bufferin) { 80101080: 55 push %ebp 80101081: 89 e5 mov %esp,%ebp 80101083: 83 ec 0c sub $0xc,%esp // Copy the memory from the console buffer to the crt buffer memmove(crt, bufferin, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 80101086: 68 a0 0f 00 00 push $0xfa0 8010108b: ff 75 08 push 0x8(%ebp) 8010108e: 68 00 80 0b 80 push $0x800b8000 80101093: e8 48 4c 00 00 call 80105ce0 } 80101098: 83 c4 10 add $0x10,%esp 8010109b: c9 leave 8010109c: c3 ret 8010109d: 8d 76 00 lea 0x0(%esi),%esi 801010a0 : // Function for saving the current screen memory into a given buffer void savescreenbuffer(ushort *bufferin) { 801010a0: 55 push %ebp 801010a1: 89 e5 mov %esp,%ebp 801010a3: 83 ec 0c sub $0xc,%esp // Copy the memory from the console buffer to the crt buffer memmove(bufferin, crt, sizeof(crt[0]) * SCRHEIGHT * SCRWIDTH); 801010a6: 68 a0 0f 00 00 push $0xfa0 801010ab: 68 00 80 0b 80 push $0x800b8000 801010b0: ff 75 08 push 0x8(%ebp) 801010b3: e8 28 4c 00 00 call 80105ce0 } 801010b8: 83 c4 10 add $0x10,%esp 801010bb: c9 leave 801010bc: c3 ret 801010bd: 8d 76 00 lea 0x0(%esi),%esi 801010c0 : // Function for clearing the current screen/buffer void clearscreen(int prelocked) { 801010c0: 55 push %ebp 801010c1: 89 e5 mov %esp,%ebp 801010c3: 57 push %edi 801010c4: 56 push %esi 801010c5: 53 push %ebx 801010c6: 83 ec 0c sub $0xc,%esp 801010c9: 8b 7d 08 mov 0x8(%ebp),%edi if (myproc() == 0x0) 801010cc: e8 df 3d 00 00 call 80104eb0 801010d1: 85 c0 test %eax,%eax 801010d3: 74 4b je 80101120 inconsoleptr = myproc()->consoleptr; 801010d5: e8 d6 3d 00 00 call 80104eb0 801010da: 8b 58 7c mov 0x7c(%eax),%ebx if (inconsoleptr == 0) 801010dd: 85 db test %ebx,%ebx 801010df: 74 3f je 80101120 if (!prelocked) { acquire(&cons.lock); } int pos = TITLEOFF; clearconsole(inconsoleptr->screenbuffer); 801010e1: 8d 73 3c lea 0x3c(%ebx),%esi if (!prelocked) 801010e4: 85 ff test %edi,%edi 801010e6: 74 58 je 80101140 memset(bufferin, 0, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 801010e8: 83 ec 04 sub $0x4,%esp 801010eb: 68 a0 0f 00 00 push $0xfa0 801010f0: 6a 00 push $0x0 801010f2: 56 push %esi 801010f3: e8 48 4b 00 00 call 80105c40 inconsoleptr->pos = pos; // If the console is in use load the blank buffer into screen memory and set the cursor position if (inconsoleptr->inuse) 801010f8: 8b 83 70 10 00 00 mov 0x1070(%ebx),%eax 801010fe: 83 c4 10 add $0x10,%esp inconsoleptr->pos = pos; 80101101: c7 83 68 10 00 00 50 movl $0x50,0x1068(%ebx) 80101108: 00 00 00 if (inconsoleptr->inuse) 8010110b: 85 c0 test %eax,%eax 8010110d: 0f 85 7d 00 00 00 jne 80101190 drawtitle(); if (!prelocked) { release(&cons.lock); } } 80101113: 8d 65 f4 lea -0xc(%ebp),%esp 80101116: 5b pop %ebx 80101117: 5e pop %esi 80101118: 5f pop %edi 80101119: 5d pop %ebp drawtitle(); 8010111a: e9 71 fd ff ff jmp 80100e90 8010111f: 90 nop inconsoleptr = currentconsole; 80101120: 8b 1d 80 0e 11 80 mov 0x80110e80,%ebx if (inconsoleptr == 0) 80101126: 85 db test %ebx,%ebx 80101128: 75 b7 jne 801010e1 inconsoleptr = &consoles[0]; 8010112a: bb a0 0e 11 80 mov $0x80110ea0,%ebx clearconsole(inconsoleptr->screenbuffer); 8010112f: 8d 73 3c lea 0x3c(%ebx),%esi if (!prelocked) 80101132: 85 ff test %edi,%edi 80101134: 75 b2 jne 801010e8 80101136: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010113d: 8d 76 00 lea 0x0(%esi),%esi acquire(&cons.lock); 80101140: 83 ec 0c sub $0xc,%esp 80101143: 68 80 b6 11 80 push $0x8011b680 80101148: e8 33 4a 00 00 call 80105b80 memset(bufferin, 0, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 8010114d: 83 c4 0c add $0xc,%esp 80101150: 68 a0 0f 00 00 push $0xfa0 80101155: 6a 00 push $0x0 80101157: 56 push %esi 80101158: e8 e3 4a 00 00 call 80105c40 if (inconsoleptr->inuse) 8010115d: 8b 93 70 10 00 00 mov 0x1070(%ebx),%edx 80101163: 83 c4 10 add $0x10,%esp inconsoleptr->pos = pos; 80101166: c7 83 68 10 00 00 50 movl $0x50,0x1068(%ebx) 8010116d: 00 00 00 if (inconsoleptr->inuse) 80101170: 85 d2 test %edx,%edx 80101172: 75 1c jne 80101190 drawtitle(); 80101174: e8 17 fd ff ff call 80100e90 release(&cons.lock); 80101179: c7 45 08 80 b6 11 80 movl $0x8011b680,0x8(%ebp) } 80101180: 8d 65 f4 lea -0xc(%ebp),%esp 80101183: 5b pop %ebx 80101184: 5e pop %esi 80101185: 5f pop %edi 80101186: 5d pop %ebp release(&cons.lock); 80101187: e9 94 49 00 00 jmp 80105b20 8010118c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi memmove(crt, bufferin, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 80101190: 83 ec 04 sub $0x4,%esp asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80101193: bb d4 03 00 00 mov $0x3d4,%ebx 80101198: 68 a0 0f 00 00 push $0xfa0 8010119d: 56 push %esi 8010119e: 68 00 80 0b 80 push $0x800b8000 801011a3: e8 38 4b 00 00 call 80105ce0 801011a8: b8 0e 00 00 00 mov $0xe,%eax 801011ad: 89 da mov %ebx,%edx 801011af: ee out %al,(%dx) 801011b0: b9 d5 03 00 00 mov $0x3d5,%ecx 801011b5: 31 c0 xor %eax,%eax 801011b7: 89 ca mov %ecx,%edx 801011b9: ee out %al,(%dx) 801011ba: b8 0f 00 00 00 mov $0xf,%eax 801011bf: 89 da mov %ebx,%edx 801011c1: ee out %al,(%dx) 801011c2: b8 50 00 00 00 mov $0x50,%eax 801011c7: 89 ca mov %ecx,%edx 801011c9: ee out %al,(%dx) drawtitle(); 801011ca: e8 c1 fc ff ff call 80100e90 if (!prelocked) 801011cf: 83 c4 10 add $0x10,%esp 801011d2: 85 ff test %edi,%edi 801011d4: 74 a3 je 80101179 } 801011d6: 8d 65 f4 lea -0xc(%ebp),%esp 801011d9: 5b pop %ebx 801011da: 5e pop %esi 801011db: 5f pop %edi 801011dc: 5d pop %ebp 801011dd: c3 ret 801011de: 66 90 xchg %ax,%ax 801011e0 : void consoleinit(void) { 801011e0: 55 push %ebp 801011e1: 89 e5 mov %esp,%ebp 801011e3: 57 push %edi 801011e4: 56 push %esi 801011e5: 8d 7d e0 lea -0x20(%ebp),%edi initlock(&cons.lock, "console"); initlock(&vcons.lock, "vconglobal"); // Init all of the virtual console buffers for (int i = 0; i < MAXVCONSOLES; i++) 801011e8: 31 f6 xor %esi,%esi { 801011ea: 53 push %ebx 801011eb: bb a4 0e 11 80 mov $0x80110ea4,%ebx 801011f0: 83 ec 24 sub $0x24,%esp initlock(&cons.lock, "console"); 801011f3: 68 d3 89 10 80 push $0x801089d3 801011f8: 68 80 b6 11 80 push $0x8011b680 801011fd: e8 ae 47 00 00 call 801059b0 initlock(&vcons.lock, "vconglobal"); 80101202: 58 pop %eax 80101203: 5a pop %edx 80101204: 68 db 89 10 80 push $0x801089db 80101209: 68 40 b6 11 80 push $0x8011b640 8010120e: e8 9d 47 00 00 call 801059b0 for (int i = 0; i < MAXVCONSOLES; i++) 80101213: 83 c4 10 add $0x10,%esp 80101216: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010121d: 8d 76 00 lea 0x0(%esi),%esi consoles[i].active = 0; consoles[i].inuse = 0; consoles[i].titlebgcol = 0x4F00; char lockname[8]; sprintf(lockname, "vconsole%d", i); 80101220: 83 ec 04 sub $0x4,%esp consoles[i].consoleindex = i; 80101223: 89 73 fc mov %esi,-0x4(%ebx) sprintf(lockname, "vconsole%d", i); 80101226: 56 push %esi for (int i = 0; i < MAXVCONSOLES; i++) 80101227: 83 c6 01 add $0x1,%esi sprintf(lockname, "vconsole%d", i); 8010122a: 68 e6 89 10 80 push $0x801089e6 8010122f: 57 push %edi consoles[i].processowner = 0; 80101230: c7 43 34 00 00 00 00 movl $0x0,0x34(%ebx) consoles[i].pos = 0; 80101237: c7 83 64 10 00 00 00 movl $0x0,0x1064(%ebx) 8010123e: 00 00 00 consoles[i].active = 0; 80101241: c7 83 68 10 00 00 00 movl $0x0,0x1068(%ebx) 80101248: 00 00 00 consoles[i].inuse = 0; 8010124b: c7 83 6c 10 00 00 00 movl $0x0,0x106c(%ebx) 80101252: 00 00 00 consoles[i].titlebgcol = 0x4F00; 80101255: c7 83 70 10 00 00 00 movl $0x4f00,0x1070(%ebx) 8010125c: 4f 00 00 sprintf(lockname, "vconsole%d", i); 8010125f: e8 9c f9 ff ff call 80100c00 initlock(&consoles[i].lock, lockname); 80101264: 59 pop %ecx 80101265: 58 pop %eax 80101266: 57 push %edi 80101267: 53 push %ebx for (int i = 0; i < MAXVCONSOLES; i++) 80101268: 81 c3 b0 10 00 00 add $0x10b0,%ebx initlock(&consoles[i].lock, lockname); 8010126e: e8 3d 47 00 00 call 801059b0 for (int i = 0; i < MAXVCONSOLES; i++) 80101273: 83 c4 10 add $0x10,%esp 80101276: 83 fe 0a cmp $0xa,%esi 80101279: 75 a5 jne 80101220 } // Initialise pointer to point to our console input buffer currentconsole = &consoles[0]; 8010127b: c7 05 80 0e 11 80 a0 movl $0x80110ea0,0x80110e80 80101282: 0e 11 80 devsw[CONSOLE].write = consolewrite; devsw[CONSOLE].read = consoleread; cons.locking = 1; // Clear the screen and print the welcome message clearscreen(0); 80101285: 83 ec 0c sub $0xc,%esp 80101288: 6a 00 push $0x0 currentconsole->active = 1; 8010128a: c7 05 0c 1f 11 80 01 movl $0x1,0x80111f0c 80101291: 00 00 00 currentconsole->inuse = 1; 80101294: c7 05 10 1f 11 80 01 movl $0x1,0x80111f10 8010129b: 00 00 00 input = ¤tconsole->keybuffer; 8010129e: c7 05 80 b5 11 80 7c movl $0x80111e7c,0x8011b580 801012a5: 1e 11 80 devsw[CONSOLE].write = consolewrite; 801012a8: c7 05 8c c0 11 80 e0 movl $0x801007e0,0x8011c08c 801012af: 07 10 80 devsw[CONSOLE].read = consoleread; 801012b2: c7 05 88 c0 11 80 20 movl $0x80100320,0x8011c088 801012b9: 03 10 80 cons.locking = 1; 801012bc: c7 05 b4 b6 11 80 01 movl $0x1,0x8011b6b4 801012c3: 00 00 00 clearscreen(0); 801012c6: e8 f5 fd ff ff call 801010c0 cprintf("Welcome! you are currently in the base console\n"); 801012cb: c7 04 24 10 8a 10 80 movl $0x80108a10,(%esp) 801012d2: e8 b9 f5 ff ff call 80100890 ioapicenable(IRQ_KBD, 0); 801012d7: 58 pop %eax 801012d8: 5a pop %edx 801012d9: 6a 00 push $0x0 801012db: 6a 01 push $0x1 801012dd: e8 8e 26 00 00 call 80103970 } 801012e2: 83 c4 10 add $0x10,%esp 801012e5: 8d 65 f4 lea -0xc(%ebp),%esp 801012e8: 5b pop %ebx 801012e9: 5e pop %esi 801012ea: 5f pop %edi 801012eb: 5d pop %ebp 801012ec: c3 ret 801012ed: 8d 76 00 lea 0x0(%esi),%esi 801012f0 : // Function for "creating" a new console, in reality it sets the first non active console to active and setups the struct // if none are free it returns a nullptr/zero for the calling function to handle struct vconsole* newconsole(char* title, int bgpreset) { 801012f0: 55 push %ebp 801012f1: 89 e5 mov %esp,%ebp 801012f3: 57 push %edi 801012f4: 56 push %esi 801012f5: 53 push %ebx struct vconsole* result = 0; acquire(&vcons.lock); for (int i = 1; i < MAXVCONSOLES; i++) 801012f6: bb 01 00 00 00 mov $0x1,%ebx { 801012fb: 83 ec 28 sub $0x28,%esp acquire(&vcons.lock); 801012fe: 68 40 b6 11 80 push $0x8011b640 80101303: e8 78 48 00 00 call 80105b80 for (int i = 1; i < MAXVCONSOLES; i++) 80101308: b8 bc 2f 11 80 mov $0x80112fbc,%eax 8010130d: 83 c4 10 add $0x10,%esp { if (!consoles[i].active) 80101310: 8b 30 mov (%eax),%esi 80101312: 85 f6 test %esi,%esi 80101314: 74 2a je 80101340 for (int i = 1; i < MAXVCONSOLES; i++) 80101316: 83 c3 01 add $0x1,%ebx 80101319: 05 b0 10 00 00 add $0x10b0,%eax 8010131e: 83 fb 0a cmp $0xa,%ebx 80101321: 75 ed jne 80101310 struct vconsole* result = 0; 80101323: 31 ff xor %edi,%edi result = &consoles[i]; break; } } release(&vcons.lock); 80101325: 83 ec 0c sub $0xc,%esp 80101328: 68 40 b6 11 80 push $0x8011b640 8010132d: e8 ee 47 00 00 call 80105b20 return result; } 80101332: 8d 65 f4 lea -0xc(%ebp),%esp 80101335: 89 f8 mov %edi,%eax 80101337: 5b pop %ebx 80101338: 5e pop %esi 80101339: 5f pop %edi 8010133a: 5d pop %ebp 8010133b: c3 ret 8010133c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi consoles[i].processowner = myproc(); 80101340: e8 6b 3b 00 00 call 80104eb0 80101345: 69 d3 b0 10 00 00 imul $0x10b0,%ebx,%edx if (strlen(title) > 0) 8010134b: 83 ec 0c sub $0xc,%esp consoles[i].processowner = myproc(); 8010134e: 8d ba a0 0e 11 80 lea -0x7feef160(%edx),%edi 80101354: 89 55 e4 mov %edx,-0x1c(%ebp) 80101357: 89 47 38 mov %eax,0x38(%edi) consoles[i].titlebgcol = bgpreset; 8010135a: 8b 45 0c mov 0xc(%ebp),%eax 8010135d: 89 87 74 10 00 00 mov %eax,0x1074(%edi) if (strlen(title) > 0) 80101363: ff 75 08 push 0x8(%ebp) 80101366: e8 d5 4a 00 00 call 80105e40 8010136b: 83 c4 10 add $0x10,%esp 8010136e: 85 c0 test %eax,%eax 80101370: 7f 0e jg 80101380 consoles[i].titlelocked = 1; 80101372: 69 db b0 10 00 00 imul $0x10b0,%ebx,%ebx 80101378: 89 b3 2c 1f 11 80 mov %esi,-0x7feee0d4(%ebx) break; 8010137e: eb a5 jmp 80101325 memset(consoles[i].proctitle, 0, sizeof(consoles[i].proctitle[0]) * sizeof(consoles[i].proctitle)); 80101380: 8b 55 e4 mov -0x1c(%ebp),%edx 80101383: 83 ec 04 sub $0x4,%esp consoles[i].titlelocked = 1; 80101386: 69 db b0 10 00 00 imul $0x10b0,%ebx,%ebx memset(consoles[i].proctitle, 0, sizeof(consoles[i].proctitle[0]) * sizeof(consoles[i].proctitle)); 8010138c: 6a 14 push $0x14 8010138e: 8d b2 18 1f 11 80 lea -0x7feee0e8(%edx),%esi 80101394: 6a 00 push $0x0 80101396: 56 push %esi 80101397: e8 a4 48 00 00 call 80105c40 safestrcpy(consoles[i].proctitle, title, sizeof(consoles[i].proctitle)); 8010139c: 83 c4 0c add $0xc,%esp 8010139f: 6a 14 push $0x14 801013a1: ff 75 08 push 0x8(%ebp) 801013a4: 56 push %esi 801013a5: be 01 00 00 00 mov $0x1,%esi 801013aa: e8 51 4a 00 00 call 80105e00 consoles[i].titlelocked = 1; 801013af: 89 b3 2c 1f 11 80 mov %esi,-0x7feee0d4(%ebx) break; 801013b5: 83 c4 10 add $0x10,%esp 801013b8: e9 68 ff ff ff jmp 80101325 801013bd: 8d 76 00 lea 0x0(%esi),%esi 801013c0 : // Function to "release" all consoles from inuse, this is to stop the chance of one not clearing and causing an issue with 2 being inuse void releaseallconsoles(void) { for (int i = 0; i < MAXVCONSOLES; i++) 801013c0: b8 10 1f 11 80 mov $0x80111f10,%eax 801013c5: 8d 76 00 lea 0x0(%esi),%esi { consoles[i].inuse = 0; 801013c8: c7 00 00 00 00 00 movl $0x0,(%eax) for (int i = 0; i < MAXVCONSOLES; i++) 801013ce: 05 b0 10 00 00 add $0x10b0,%eax 801013d3: 3d f0 c5 11 80 cmp $0x8011c5f0,%eax 801013d8: 75 ee jne 801013c8 } } 801013da: c3 ret 801013db: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801013df: 90 nop 801013e0 : // Function for switching to another console using the given pointer int switchtoconsole(struct vconsole* consoleptr) { 801013e0: 55 push %ebp 801013e1: 89 e5 mov %esp,%ebp 801013e3: 57 push %edi 801013e4: 56 push %esi 801013e5: 53 push %ebx 801013e6: bb a0 0e 11 80 mov $0x80110ea0,%ebx 801013eb: 83 ec 18 sub $0x18,%esp 801013ee: 8b 75 08 mov 0x8(%ebp),%esi int pos; acquire(&vcons.lock); 801013f1: 68 40 b6 11 80 push $0x8011b640 801013f6: e8 85 47 00 00 call 80105b80 for (int i = 0; i < MAXVCONSOLES; i++) 801013fb: b8 10 1f 11 80 mov $0x80111f10,%eax 80101400: 83 c4 10 add $0x10,%esp 80101403: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101407: 90 nop consoles[i].inuse = 0; 80101408: c7 00 00 00 00 00 movl $0x0,(%eax) for (int i = 0; i < MAXVCONSOLES; i++) 8010140e: 05 b0 10 00 00 add $0x10b0,%eax 80101413: 3d f0 c5 11 80 cmp $0x8011c5f0,%eax 80101418: 75 ee jne 80101408 // Release all consoles before setting the new one to inuse releaseallconsoles(); currentconsole = consoleptr; currentconsole->inuse = 1; acquire(&cons.lock); 8010141a: 83 ec 0c sub $0xc,%esp currentconsole = consoleptr; 8010141d: 89 35 80 0e 11 80 mov %esi,0x80110e80 currentconsole->inuse = 1; 80101423: c7 86 70 10 00 00 01 movl $0x1,0x1070(%esi) 8010142a: 00 00 00 acquire(&cons.lock); 8010142d: 68 80 b6 11 80 push $0x8011b680 80101432: e8 49 47 00 00 call 80105b80 // Load the next console into screen memory loadscreenbuffer(currentconsole->screenbuffer); 80101437: a1 80 0e 11 80 mov 0x80110e80,%eax memmove(crt, bufferin, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 8010143c: 83 c4 0c add $0xc,%esp 8010143f: 68 a0 0f 00 00 push $0xfa0 loadscreenbuffer(currentconsole->screenbuffer); 80101444: 83 c0 3c add $0x3c,%eax memmove(crt, bufferin, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 80101447: 50 push %eax 80101448: 68 00 80 0b 80 push $0x800b8000 8010144d: e8 8e 48 00 00 call 80105ce0 // Checks if the console was active, if not its most likely the first switch to this so we clear and print the welcome message if (!currentconsole->active) 80101452: 8b 0d 80 0e 11 80 mov 0x80110e80,%ecx 80101458: 83 c4 10 add $0x10,%esp 8010145b: 8b b9 6c 10 00 00 mov 0x106c(%ecx),%edi 80101461: 85 ff test %edi,%edi 80101463: 0f 84 8f 00 00 00 je 801014f8 80101469: bf d4 03 00 00 mov $0x3d4,%edi 8010146e: b8 0e 00 00 00 mov $0xe,%eax 80101473: 89 fa mov %edi,%edx 80101475: ee out %al,(%dx) { // If it was already active we just set the cursor position to the one saved in the console struct pos = currentconsole->pos; outb(CRTPORT, 14); outb(CRTPORT + 1, pos >> 8); 80101476: 8b 81 68 10 00 00 mov 0x1068(%ecx),%eax 8010147c: be d5 03 00 00 mov $0x3d5,%esi 80101481: 89 f2 mov %esi,%edx 80101483: c1 f8 08 sar $0x8,%eax 80101486: ee out %al,(%dx) 80101487: b8 0f 00 00 00 mov $0xf,%eax 8010148c: 89 fa mov %edi,%edx 8010148e: ee out %al,(%dx) 8010148f: 0f b6 81 68 10 00 00 movzbl 0x1068(%ecx),%eax 80101496: 89 f2 mov %esi,%edx 80101498: ee out %al,(%dx) outb(CRTPORT, 15); outb(CRTPORT + 1, pos); } // Remove the menu if it was active and set the console as the current menu item menuactive = 0; 80101499: c7 05 bc b6 11 80 00 movl $0x0,0x8011b6bc 801014a0: 00 00 00 int resultcount = 0; 801014a3: 31 c0 xor %eax,%eax 801014a5: eb 17 jmp 801014be 801014a7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801014ae: 66 90 xchg %ax,%ax resultcount++; 801014b0: 83 c0 01 add $0x1,%eax for (int i = 0; i < MAXVCONSOLES; i++) 801014b3: 81 c3 b0 10 00 00 add $0x10b0,%ebx 801014b9: 83 f8 0a cmp $0xa,%eax 801014bc: 74 0e je 801014cc if (&consoles[i] == consolein && consoles[i].active) 801014be: 39 d9 cmp %ebx,%ecx 801014c0: 75 ee jne 801014b0 801014c2: 8b 91 6c 10 00 00 mov 0x106c(%ecx),%edx 801014c8: 85 d2 test %edx,%edx 801014ca: 74 e4 je 801014b0 currentmenuitem = getconsolemenuindex(currentconsole); release(&cons.lock); 801014cc: 83 ec 0c sub $0xc,%esp currentmenuitem = getconsolemenuindex(currentconsole); 801014cf: a3 c0 b6 11 80 mov %eax,0x8011b6c0 release(&cons.lock); 801014d4: 68 80 b6 11 80 push $0x8011b680 801014d9: e8 42 46 00 00 call 80105b20 release(&vcons.lock); 801014de: c7 04 24 40 b6 11 80 movl $0x8011b640,(%esp) 801014e5: e8 36 46 00 00 call 80105b20 return 0; } 801014ea: 8d 65 f4 lea -0xc(%ebp),%esp 801014ed: 31 c0 xor %eax,%eax 801014ef: 5b pop %ebx 801014f0: 5e pop %esi 801014f1: 5f pop %edi 801014f2: 5d pop %ebp 801014f3: c3 ret 801014f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi clearscreen(1); 801014f8: 83 ec 0c sub $0xc,%esp 801014fb: 6a 01 push $0x1 801014fd: e8 be fb ff ff call 801010c0 cprintf("Welcome to Console: %d\n", currentconsole->consoleindex); 80101502: a1 80 0e 11 80 mov 0x80110e80,%eax 80101507: 59 pop %ecx 80101508: 5e pop %esi 80101509: ff 30 push (%eax) 8010150b: 68 f1 89 10 80 push $0x801089f1 80101510: e8 7b f3 ff ff call 80100890 currentconsole->active = 1; 80101515: 8b 0d 80 0e 11 80 mov 0x80110e80,%ecx 8010151b: 83 c4 10 add $0x10,%esp 8010151e: c7 81 6c 10 00 00 01 movl $0x1,0x106c(%ecx) 80101525: 00 00 00 80101528: e9 6c ff ff ff jmp 80101499 8010152d: 8d 76 00 lea 0x0(%esi),%esi 80101530 : { 80101530: 55 push %ebp 80101531: 89 e5 mov %esp,%ebp 80101533: 57 push %edi 80101534: 56 push %esi 80101535: 53 push %ebx 80101536: 81 ec 3c 01 00 00 sub $0x13c,%esp 8010153c: 8b 45 08 mov 0x8(%ebp),%eax 8010153f: 89 85 e8 fe ff ff mov %eax,-0x118(%ebp) if (myproc() == 0x0) 80101545: e8 66 39 00 00 call 80104eb0 8010154a: 85 c0 test %eax,%eax 8010154c: 0f 84 8e 00 00 00 je 801015e0 inconsoleptr = myproc()->consoleptr; 80101552: e8 59 39 00 00 call 80104eb0 80101557: 8b 40 7c mov 0x7c(%eax),%eax 8010155a: 89 85 c4 fe ff ff mov %eax,-0x13c(%ebp) if (inconsoleptr == 0) 80101560: 85 c0 test %eax,%eax 80101562: 74 7c je 801015e0 acquire(&cons.lock); 80101564: 83 ec 0c sub $0xc,%esp 80101567: 68 80 b6 11 80 push $0x8011b680 8010156c: e8 0f 46 00 00 call 80105b80 struct kbdbuffer* consolekbdbuffer = ¤tconsole->keybuffer; 80101571: a1 80 0e 11 80 mov 0x80110e80,%eax while ((c = getc()) >= 0) 80101576: 83 c4 10 add $0x10,%esp int doconsolehome = 0; 80101579: c7 85 d4 fe ff ff 00 movl $0x0,-0x12c(%ebp) 80101580: 00 00 00 int switchto = -1; 80101583: c7 85 c0 fe ff ff ff movl $0xffffffff,-0x140(%ebp) 8010158a: ff ff ff struct kbdbuffer* consolekbdbuffer = ¤tconsole->keybuffer; 8010158d: 89 85 d8 fe ff ff mov %eax,-0x128(%ebp) int doconsoleswitch = 0; 80101593: c7 85 d0 fe ff ff 00 movl $0x0,-0x130(%ebp) 8010159a: 00 00 00 int doprocdump = 0; 8010159d: c7 85 cc fe ff ff 00 movl $0x0,-0x134(%ebp) 801015a4: 00 00 00 while ((c = getc()) >= 0) 801015a7: 8b 85 e8 fe ff ff mov -0x118(%ebp),%eax 801015ad: ff d0 call *%eax 801015af: 89 c3 mov %eax,%ebx 801015b1: 85 c0 test %eax,%eax 801015b3: 0f 88 97 00 00 00 js 80101650 switch (c) 801015b9: 83 fb 1b cmp $0x1b,%ebx 801015bc: 7f 4a jg 80101608 801015be: 83 fb 07 cmp $0x7,%ebx 801015c1: 0f 8e 19 01 00 00 jle 801016e0 801015c7: 8d 43 f8 lea -0x8(%ebx),%eax 801015ca: 83 f8 13 cmp $0x13,%eax 801015cd: 0f 87 0d 01 00 00 ja 801016e0 801015d3: ff 24 85 40 8a 10 80 jmp *-0x7fef75c0(,%eax,4) 801015da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi inconsoleptr = currentconsole; 801015e0: a1 80 0e 11 80 mov 0x80110e80,%eax 801015e5: 89 85 c4 fe ff ff mov %eax,-0x13c(%ebp) if (inconsoleptr == 0) 801015eb: 85 c0 test %eax,%eax 801015ed: 0f 85 71 ff ff ff jne 80101564 inconsoleptr = &consoles[0]; 801015f3: c7 85 c4 fe ff ff a0 movl $0x80110ea0,-0x13c(%ebp) 801015fa: 0e 11 80 801015fd: e9 62 ff ff ff jmp 80101564 80101602: 8d b6 00 00 00 00 lea 0x0(%esi),%esi switch (c) 80101608: 81 fb e2 00 00 00 cmp $0xe2,%ebx 8010160e: 0f 84 a4 04 00 00 je 80101ab8 80101614: 81 fb e3 00 00 00 cmp $0xe3,%ebx 8010161a: 0f 85 86 00 00 00 jne 801016a6 if (menuactive) 80101620: 8b 15 bc b6 11 80 mov 0x8011b6bc,%edx 80101626: 85 d2 test %edx,%edx 80101628: 0f 84 79 ff ff ff je 801015a7 navigatemenu(1); 8010162e: b8 01 00 00 00 mov $0x1,%eax 80101633: e8 48 ec ff ff call 80100280 while ((c = getc()) >= 0) 80101638: 8b 85 e8 fe ff ff mov -0x118(%ebp),%eax 8010163e: ff d0 call *%eax 80101640: 89 c3 mov %eax,%ebx 80101642: 85 c0 test %eax,%eax 80101644: 0f 89 6f ff ff ff jns 801015b9 8010164a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi release(&cons.lock); 80101650: 83 ec 0c sub $0xc,%esp 80101653: 68 80 b6 11 80 push $0x8011b680 80101658: e8 c3 44 00 00 call 80105b20 if (doprocdump && !menuactive) 8010165d: 8b 85 cc fe ff ff mov -0x134(%ebp),%eax 80101663: 83 c4 10 add $0x10,%esp 80101666: 85 c0 test %eax,%eax 80101668: 74 0d je 80101677 8010166a: a1 bc b6 11 80 mov 0x8011b6bc,%eax 8010166f: 85 c0 test %eax,%eax 80101671: 0f 84 5a 05 00 00 je 80101bd1 if (doconsolehome) 80101677: 8b 85 d4 fe ff ff mov -0x12c(%ebp),%eax 8010167d: 85 c0 test %eax,%eax 8010167f: 74 0f je 80101690 if (currentconsole->consoleindex != 0) 80101681: a1 80 0e 11 80 mov 0x80110e80,%eax 80101686: 8b 00 mov (%eax),%eax 80101688: 85 c0 test %eax,%eax 8010168a: 0f 85 4b 05 00 00 jne 80101bdb if (doconsoleswitch) 80101690: 8b 85 d0 fe ff ff mov -0x130(%ebp),%eax 80101696: 85 c0 test %eax,%eax 80101698: 0f 85 82 04 00 00 jne 80101b20 } 8010169e: 8d 65 f4 lea -0xc(%ebp),%esp 801016a1: 5b pop %ebx 801016a2: 5e pop %esi 801016a3: 5f pop %edi 801016a4: 5d pop %ebp 801016a5: c3 ret switch (c) 801016a6: 83 fb 7f cmp $0x7f,%ebx 801016a9: 75 35 jne 801016e0 if (consolekbdbuffer->e != consolekbdbuffer->w) 801016ab: 8b bd d8 fe ff ff mov -0x128(%ebp),%edi 801016b1: 8b 87 64 10 00 00 mov 0x1064(%edi),%eax 801016b7: 3b 87 60 10 00 00 cmp 0x1060(%edi),%eax 801016bd: 0f 84 e4 fe ff ff je 801015a7 consolekbdbuffer->e--; 801016c3: 83 e8 01 sub $0x1,%eax 801016c6: 89 87 64 10 00 00 mov %eax,0x1064(%edi) if (panicked) 801016cc: a1 b8 b6 11 80 mov 0x8011b6b8,%eax 801016d1: 85 c0 test %eax,%eax 801016d3: 0f 84 17 05 00 00 je 80101bf0 asm volatile ("cli"); 801016d9: fa cli for (;;) 801016da: eb fe jmp 801016da 801016dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (!menuactive) 801016e0: 8b 35 bc b6 11 80 mov 0x8011b6bc,%esi 801016e6: 85 f6 test %esi,%esi 801016e8: 0f 85 b9 fe ff ff jne 801015a7 801016ee: e9 d8 02 00 00 jmp 801019cb if (menuactive) 801016f3: 8b 1d bc b6 11 80 mov 0x8011b6bc,%ebx 801016f9: 85 db test %ebx,%ebx 801016fb: 0f 84 a6 fe ff ff je 801015a7 loadscreenbuffer(currentconsole->screenbuffer); 80101701: a1 80 0e 11 80 mov 0x80110e80,%eax memmove(crt, bufferin, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 80101706: 83 ec 04 sub $0x4,%esp asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80101709: be d4 03 00 00 mov $0x3d4,%esi 8010170e: 68 a0 0f 00 00 push $0xfa0 loadscreenbuffer(currentconsole->screenbuffer); 80101713: 83 c0 3c add $0x3c,%eax memmove(crt, bufferin, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 80101716: 50 push %eax 80101717: 68 00 80 0b 80 push $0x800b8000 8010171c: e8 bf 45 00 00 call 80105ce0 int pos = currentconsole->pos; 80101721: a1 80 0e 11 80 mov 0x80110e80,%eax 80101726: 89 f2 mov %esi,%edx 80101728: 8b 88 68 10 00 00 mov 0x1068(%eax),%ecx 8010172e: b8 0e 00 00 00 mov $0xe,%eax 80101733: ee out %al,(%dx) 80101734: bb d5 03 00 00 mov $0x3d5,%ebx outb(CRTPORT + 1, pos >> 8); 80101739: 89 c8 mov %ecx,%eax 8010173b: c1 f8 08 sar $0x8,%eax 8010173e: 89 da mov %ebx,%edx 80101740: ee out %al,(%dx) 80101741: b8 0f 00 00 00 mov $0xf,%eax 80101746: 89 f2 mov %esi,%edx 80101748: ee out %al,(%dx) 80101749: 89 c8 mov %ecx,%eax 8010174b: 89 da mov %ebx,%edx 8010174d: ee out %al,(%dx) menuactive = 0; 8010174e: c7 05 bc b6 11 80 00 movl $0x0,0x8011b6bc 80101755: 00 00 00 } 80101758: 83 c4 10 add $0x10,%esp 8010175b: e9 47 fe ff ff jmp 801015a7 while (consolekbdbuffer->e != consolekbdbuffer->w && 80101760: 8b bd d8 fe ff ff mov -0x128(%ebp),%edi 80101766: 8b 9d d8 fe ff ff mov -0x128(%ebp),%ebx 8010176c: 8b 87 64 10 00 00 mov 0x1064(%edi),%eax 80101772: 39 87 60 10 00 00 cmp %eax,0x1060(%edi) 80101778: 0f 84 29 fe ff ff je 801015a7 consolekbdbuffer->buf[(consolekbdbuffer->e - 1) % INPUT_BUF] != '\n') 8010177e: 83 e8 01 sub $0x1,%eax 80101781: 89 c2 mov %eax,%edx 80101783: 83 e2 7f and $0x7f,%edx while (consolekbdbuffer->e != consolekbdbuffer->w && 80101786: 80 bc 13 dc 0f 00 00 cmpb $0xa,0xfdc(%ebx,%edx,1) 8010178d: 0a 8010178e: 0f 84 13 fe ff ff je 801015a7 consolekbdbuffer->e--; 80101794: 89 83 64 10 00 00 mov %eax,0x1064(%ebx) if (panicked) 8010179a: a1 b8 b6 11 80 mov 0x8011b6b8,%eax 8010179f: 85 c0 test %eax,%eax 801017a1: 0f 84 2e 03 00 00 je 80101ad5 asm volatile ("cli"); 801017a7: fa cli for (;;) 801017a8: eb fe jmp 801017a8 801017aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if (!menuactive) 801017b0: a1 bc b6 11 80 mov 0x8011b6bc,%eax 801017b5: 85 c0 test %eax,%eax 801017b7: 0f 85 44 ff ff ff jne 80101701 if (myproc() == 0x0) 801017bd: e8 ee 36 00 00 call 80104eb0 801017c2: 85 c0 test %eax,%eax 801017c4: 0f 84 ef 03 00 00 je 80101bb9 inconsoleptr = myproc()->consoleptr; 801017ca: e8 e1 36 00 00 call 80104eb0 801017cf: 8b 70 7c mov 0x7c(%eax),%esi if (inconsoleptr == 0) 801017d2: 85 f6 test %esi,%esi 801017d4: 0f 84 df 03 00 00 je 80101bb9 for (int i = 0; i < MAXVCONSOLES; i++) 801017da: b8 0c 1f 11 80 mov $0x80111f0c,%eax 801017df: ba ec c5 11 80 mov $0x8011c5ec,%edx int resultcount = 0; 801017e4: 31 ff xor %edi,%edi 801017e6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801017ed: 8d 76 00 lea 0x0(%esi),%esi resultcount++; 801017f0: 83 38 01 cmpl $0x1,(%eax) 801017f3: 83 df ff sbb $0xffffffff,%edi for (int i = 0; i < MAXVCONSOLES; i++) 801017f6: 05 b0 10 00 00 add $0x10b0,%eax 801017fb: 39 c2 cmp %eax,%edx 801017fd: 75 f1 jne 801017f0 int menuindex = 0; 801017ff: 31 d2 xor %edx,%edx 80101801: 89 b5 f0 fe ff ff mov %esi,-0x110(%ebp) 80101807: bb 18 1f 11 80 mov $0x80111f18,%ebx 8010180c: 89 bd f4 fe ff ff mov %edi,-0x10c(%ebp) 80101812: 89 d6 mov %edx,%esi 80101814: eb 18 jmp 8010182e 80101816: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010181d: 8d 76 00 lea 0x0(%esi),%esi for (int i = 0; i < MAXVCONSOLES; i++) 80101820: 81 c3 b0 10 00 00 add $0x10b0,%ebx 80101826: 81 fb f8 c5 11 80 cmp $0x8011c5f8,%ebx 8010182c: 74 51 je 8010187f if (consoles[i].active) 8010182e: 8b 43 f4 mov -0xc(%ebx),%eax 80101831: 85 c0 test %eax,%eax 80101833: 74 eb je 80101820 memset(menulines[menuindex], 0, sizeof(menulines[i][0]) * sizeof(menulines[i])); 80101835: 8d 04 76 lea (%esi,%esi,2),%eax 80101838: 83 ec 04 sub $0x4,%esp 8010183b: 8d bc c5 f8 fe ff ff lea -0x108(%ebp,%eax,8),%edi 80101842: 6a 18 push $0x18 80101844: 6a 00 push $0x0 80101846: 57 push %edi 80101847: e8 f4 43 00 00 call 80105c40 sprintf(menulines[menuindex], "%d: %s", consoles[i].consoleindex, consoles[i].proctitle); 8010184c: 53 push %ebx 8010184d: ff b3 88 ef ff ff push -0x1078(%ebx) 80101853: 68 09 8a 10 80 push $0x80108a09 80101858: 57 push %edi 80101859: e8 a2 f3 ff ff call 80100c00 if (consoles[i].inuse) 8010185e: 8b 43 f8 mov -0x8(%ebx),%eax 80101861: 83 c4 20 add $0x20,%esp 80101864: 85 c0 test %eax,%eax 80101866: 74 06 je 8010186e currentmenuitem = menuindex; 80101868: 89 35 c0 b6 11 80 mov %esi,0x8011b6c0 for (int i = 0; i < MAXVCONSOLES; i++) 8010186e: 81 c3 b0 10 00 00 add $0x10b0,%ebx menuindex++; 80101874: 83 c6 01 add $0x1,%esi for (int i = 0; i < MAXVCONSOLES; i++) 80101877: 81 fb f8 c5 11 80 cmp $0x8011c5f8,%ebx 8010187d: 75 af jne 8010182e if (currentmenuitem == (y - 1)) 8010187f: a1 c0 b6 11 80 mov 0x8011b6c0,%eax 80101884: 8b bd f4 fe ff ff mov -0x10c(%ebp),%edi 8010188a: 31 db xor %ebx,%ebx 8010188c: c7 85 e0 fe ff ff 50 movl $0x50,-0x120(%ebp) 80101893: 00 00 00 80101896: 8b b5 f0 fe ff ff mov -0x110(%ebp),%esi 8010189c: 89 85 dc fe ff ff mov %eax,-0x124(%ebp) 801018a2: 8d 85 f8 fe ff ff lea -0x108(%ebp),%eax 801018a8: 89 85 e4 fe ff ff mov %eax,-0x11c(%ebp) 801018ae: 8d 47 03 lea 0x3(%edi),%eax 801018b1: 89 85 c8 fe ff ff mov %eax,-0x138(%ebp) 801018b7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801018be: 66 90 xchg %ax,%ax for (int x = 0; x < MENUWIDTH; x++) 801018c0: 8b 85 e0 fe ff ff mov -0x120(%ebp),%eax 801018c6: 89 b5 f4 fe ff ff mov %esi,-0x10c(%ebp) 801018cc: 8d 8c 00 00 80 0b 80 lea -0x7ff48000(%eax,%eax,1),%ecx 801018d3: 31 c0 xor %eax,%eax 801018d5: eb 77 jmp 8010194e 801018d7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801018de: 66 90 xchg %ax,%ax if (y == 0 || y == (rows - 2)) 801018e0: 8d 57 01 lea 0x1(%edi),%edx 801018e3: 39 da cmp %ebx,%edx 801018e5: 74 6b je 80101952 else if (y == (rows - 1)) 801018e7: 8d 57 02 lea 0x2(%edi),%edx 801018ea: 39 da cmp %ebx,%edx 801018ec: 74 73 je 80101961 if (x == 0 || x == (MENUWIDTH - 1)) 801018ee: be 01 00 00 04 mov $0x4000001,%esi 801018f3: 0f a3 c6 bt %eax,%esi 801018f6: 72 69 jb 80101961 else if (x == 1 || x == (MENUWIDTH - 2)) 801018f8: be 02 00 00 02 mov $0x2000002,%esi 801018fd: ba 20 07 00 00 mov $0x720,%edx 80101902: 0f a3 c6 bt %eax,%esi 80101905: 72 39 jb 80101940 c = (c & 0xff); 80101907: 8b b5 e4 fe ff ff mov -0x11c(%ebp),%esi 8010190d: 0f b6 54 06 e6 movzbl -0x1a(%esi,%eax,1),%edx if (currentmenuitem == (y - 1)) 80101912: 8d 73 ff lea -0x1(%ebx),%esi 80101915: 89 b5 f0 fe ff ff mov %esi,-0x110(%ebp) crt[pos] = c; 8010191b: 89 d6 mov %edx,%esi 8010191d: 80 ce cf or $0xcf,%dh 80101920: 81 ce 00 07 00 00 or $0x700,%esi 80101926: 89 b5 ec fe ff ff mov %esi,-0x114(%ebp) 8010192c: 8b b5 f0 fe ff ff mov -0x110(%ebp),%esi 80101932: 39 b5 dc fe ff ff cmp %esi,-0x124(%ebp) 80101938: 66 0f 45 95 ec fe ff cmovne -0x114(%ebp),%dx 8010193f: ff for (int x = 0; x < MENUWIDTH; x++) 80101940: 83 c0 01 add $0x1,%eax crt[pos] = c; 80101943: 66 89 11 mov %dx,(%ecx) for (int x = 0; x < MENUWIDTH; x++) 80101946: 83 c1 02 add $0x2,%ecx 80101949: 83 f8 1b cmp $0x1b,%eax 8010194c: 74 32 je 80101980 if (y == 0 || y == (rows - 2)) 8010194e: 85 db test %ebx,%ebx 80101950: 75 8e jne 801018e0 if (x == 0 || x == (MENUWIDTH - 1)) 80101952: be 01 00 00 04 mov $0x4000001,%esi 80101957: ba 20 07 00 00 mov $0x720,%edx 8010195c: 0f a3 c6 bt %eax,%esi 8010195f: 73 df jae 80101940 crt[pos] = c; 80101961: 8b b5 f4 fe ff ff mov -0x10c(%ebp),%esi for (int x = 0; x < MENUWIDTH; x++) 80101967: 83 c0 01 add $0x1,%eax 8010196a: 83 c1 02 add $0x2,%ecx crt[pos] = c; 8010196d: 0f b7 96 74 10 00 00 movzwl 0x1074(%esi),%edx 80101974: 80 ca b2 or $0xb2,%dl 80101977: 66 89 51 fe mov %dx,-0x2(%ecx) for (int x = 0; x < MENUWIDTH; x++) 8010197b: 83 f8 1b cmp $0x1b,%eax 8010197e: 75 ce jne 8010194e for (int y = 0; y < rows; y++) 80101980: 83 85 e0 fe ff ff 50 addl $0x50,-0x120(%ebp) 80101987: 8b b5 f4 fe ff ff mov -0x10c(%ebp),%esi 8010198d: 83 c3 01 add $0x1,%ebx 80101990: 83 85 e4 fe ff ff 18 addl $0x18,-0x11c(%ebp) 80101997: 3b 9d c8 fe ff ff cmp -0x138(%ebp),%ebx 8010199d: 0f 85 1d ff ff ff jne 801018c0 menuactive = 1; 801019a3: c7 05 bc b6 11 80 01 movl $0x1,0x8011b6bc 801019aa: 00 00 00 } 801019ad: e9 f5 fb ff ff jmp 801015a7 doconsolehome = 1; 801019b2: c7 85 d4 fe ff ff 01 movl $0x1,-0x12c(%ebp) 801019b9: 00 00 00 break; 801019bc: e9 e6 fb ff ff jmp 801015a7 if (menuactive) 801019c1: 8b 3d bc b6 11 80 mov 0x8011b6bc,%edi 801019c7: 85 ff test %edi,%edi 801019c9: 75 65 jne 80101a30 if (c != 0 && consolekbdbuffer->e - consolekbdbuffer->r < INPUT_BUF) 801019cb: 8b 85 c4 fe ff ff mov -0x13c(%ebp),%eax 801019d1: 8b 88 70 10 00 00 mov 0x1070(%eax),%ecx 801019d7: 85 c9 test %ecx,%ecx 801019d9: 0f 84 c8 fb ff ff je 801015a7 801019df: 85 db test %ebx,%ebx 801019e1: 0f 84 c0 fb ff ff je 801015a7 801019e7: 8b bd d8 fe ff ff mov -0x128(%ebp),%edi 801019ed: 8b 87 64 10 00 00 mov 0x1064(%edi),%eax 801019f3: 89 c2 mov %eax,%edx 801019f5: 2b 97 5c 10 00 00 sub 0x105c(%edi),%edx 801019fb: 83 fa 7f cmp $0x7f,%edx 801019fe: 0f 87 a3 fb ff ff ja 801015a7 consolekbdbuffer->buf[consolekbdbuffer->e++ % INPUT_BUF] = c; 80101a04: 8d 50 01 lea 0x1(%eax),%edx 80101a07: 83 e0 7f and $0x7f,%eax 80101a0a: 89 97 64 10 00 00 mov %edx,0x1064(%edi) if (panicked) 80101a10: 8b 15 b8 b6 11 80 mov 0x8011b6b8,%edx consolekbdbuffer->buf[consolekbdbuffer->e++ % INPUT_BUF] = c; 80101a16: 88 9c 07 dc 0f 00 00 mov %bl,0xfdc(%edi,%eax,1) if (panicked) 80101a1d: 85 d2 test %edx,%edx 80101a1f: 0f 84 65 02 00 00 je 80101c8a 80101a25: fa cli for (;;) 80101a26: eb fe jmp 80101a26 80101a28: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101a2f: 90 nop loadscreenbuffer(currentconsole->screenbuffer); 80101a30: a1 80 0e 11 80 mov 0x80110e80,%eax memmove(crt, bufferin, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 80101a35: 83 ec 04 sub $0x4,%esp asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80101a38: be d4 03 00 00 mov $0x3d4,%esi 80101a3d: 68 a0 0f 00 00 push $0xfa0 loadscreenbuffer(currentconsole->screenbuffer); 80101a42: 83 c0 3c add $0x3c,%eax memmove(crt, bufferin, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 80101a45: 50 push %eax 80101a46: 68 00 80 0b 80 push $0x800b8000 80101a4b: e8 90 42 00 00 call 80105ce0 int pos = currentconsole->pos; 80101a50: a1 80 0e 11 80 mov 0x80110e80,%eax 80101a55: 89 f2 mov %esi,%edx 80101a57: 8b 88 68 10 00 00 mov 0x1068(%eax),%ecx 80101a5d: b8 0e 00 00 00 mov $0xe,%eax 80101a62: ee out %al,(%dx) 80101a63: bb d5 03 00 00 mov $0x3d5,%ebx outb(CRTPORT + 1, pos >> 8); 80101a68: 89 c8 mov %ecx,%eax 80101a6a: c1 f8 08 sar $0x8,%eax 80101a6d: 89 da mov %ebx,%edx 80101a6f: ee out %al,(%dx) 80101a70: b8 0f 00 00 00 mov $0xf,%eax 80101a75: 89 f2 mov %esi,%edx 80101a77: ee out %al,(%dx) 80101a78: 89 c8 mov %ecx,%eax 80101a7a: 89 da mov %ebx,%edx 80101a7c: ee out %al,(%dx) switchto = currentmenuitem; 80101a7d: a1 c0 b6 11 80 mov 0x8011b6c0,%eax break; 80101a82: 83 c4 10 add $0x10,%esp menuactive = 0; 80101a85: c7 05 bc b6 11 80 00 movl $0x0,0x8011b6bc 80101a8c: 00 00 00 switchto = currentmenuitem; 80101a8f: 89 85 c0 fe ff ff mov %eax,-0x140(%ebp) doconsoleswitch = 1; 80101a95: c7 85 d0 fe ff ff 01 movl $0x1,-0x130(%ebp) 80101a9c: 00 00 00 break; 80101a9f: e9 03 fb ff ff jmp 801015a7 doprocdump = 1; 80101aa4: c7 85 cc fe ff ff 01 movl $0x1,-0x134(%ebp) 80101aab: 00 00 00 80101aae: e9 f4 fa ff ff jmp 801015a7 80101ab3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101ab7: 90 nop if (menuactive) 80101ab8: 8b 0d bc b6 11 80 mov 0x8011b6bc,%ecx 80101abe: 85 c9 test %ecx,%ecx 80101ac0: 0f 84 e1 fa ff ff je 801015a7 navigatemenu(-1); 80101ac6: b8 ff ff ff ff mov $0xffffffff,%eax 80101acb: e8 b0 e7 ff ff call 80100280 80101ad0: e9 d2 fa ff ff jmp 801015a7 uartputc('\b'); 80101ad5: 83 ec 0c sub $0xc,%esp 80101ad8: 6a 08 push $0x8 80101ada: e8 71 59 00 00 call 80107450 uartputc(' '); 80101adf: c7 04 24 20 00 00 00 movl $0x20,(%esp) 80101ae6: e8 65 59 00 00 call 80107450 uartputc('\b'); 80101aeb: c7 04 24 08 00 00 00 movl $0x8,(%esp) 80101af2: e8 59 59 00 00 call 80107450 cgaputc(c); 80101af7: b8 00 01 00 00 mov $0x100,%eax 80101afc: e8 ff e9 ff ff call 80100500 while (consolekbdbuffer->e != consolekbdbuffer->w && 80101b01: 8b 83 64 10 00 00 mov 0x1064(%ebx),%eax 80101b07: 83 c4 10 add $0x10,%esp 80101b0a: 3b 83 60 10 00 00 cmp 0x1060(%ebx),%eax 80101b10: 0f 85 68 fc ff ff jne 8010177e 80101b16: e9 8c fa ff ff jmp 801015a7 80101b1b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101b1f: 90 nop acquire(&vcons.lock); 80101b20: 83 ec 0c sub $0xc,%esp 80101b23: 68 40 b6 11 80 push $0x8011b640 80101b28: e8 53 40 00 00 call 80105b80 acquire(&cons.lock); 80101b2d: c7 04 24 80 b6 11 80 movl $0x8011b680,(%esp) 80101b34: e8 47 40 00 00 call 80105b80 if (switchto == -1) 80101b39: 83 c4 10 add $0x10,%esp int resultcount = 0; 80101b3c: 31 c9 xor %ecx,%ecx for (int i = 0; i < MAXVCONSOLES; i++) 80101b3e: 31 c0 xor %eax,%eax if (switchto == -1) 80101b40: 83 bd c0 fe ff ff ff cmpl $0xffffffff,-0x140(%ebp) 80101b47: 8b 9d c0 fe ff ff mov -0x140(%ebp),%ebx 80101b4d: 0f 84 d1 00 00 00 je 80101c24 80101b53: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101b57: 90 nop if (consoles[i].active) 80101b58: 69 d0 b0 10 00 00 imul $0x10b0,%eax,%edx 80101b5e: 8b b2 0c 1f 11 80 mov -0x7feee0f4(%edx),%esi 80101b64: 85 f6 test %esi,%esi 80101b66: 74 0b je 80101b73 if (resultcount == menuindex) 80101b68: 39 cb cmp %ecx,%ebx 80101b6a: 0f 84 05 01 00 00 je 80101c75 resultcount++; 80101b70: 83 c1 01 add $0x1,%ecx for (int i = 0; i < MAXVCONSOLES; i++) 80101b73: 83 c0 01 add $0x1,%eax 80101b76: 83 f8 0a cmp $0xa,%eax 80101b79: 75 dd jne 80101b58 toconsole = getbaseconsoleptr(); 80101b7b: bb a0 0e 11 80 mov $0x80110ea0,%ebx release(&cons.lock); 80101b80: 83 ec 0c sub $0xc,%esp 80101b83: 68 80 b6 11 80 push $0x8011b680 80101b88: e8 93 3f 00 00 call 80105b20 release(&vcons.lock); 80101b8d: c7 04 24 40 b6 11 80 movl $0x8011b640,(%esp) 80101b94: e8 87 3f 00 00 call 80105b20 if (!toconsole->inuse) 80101b99: 8b 83 70 10 00 00 mov 0x1070(%ebx),%eax 80101b9f: 83 c4 10 add $0x10,%esp 80101ba2: 85 c0 test %eax,%eax 80101ba4: 0f 85 f4 fa ff ff jne 8010169e switchtoconsole(toconsole); 80101baa: 89 5d 08 mov %ebx,0x8(%ebp) } 80101bad: 8d 65 f4 lea -0xc(%ebp),%esp 80101bb0: 5b pop %ebx 80101bb1: 5e pop %esi 80101bb2: 5f pop %edi 80101bb3: 5d pop %ebp switchtoconsole(toconsole); 80101bb4: e9 27 f8 ff ff jmp 801013e0 inconsoleptr = currentconsole; 80101bb9: 8b 35 80 0e 11 80 mov 0x80110e80,%esi if (inconsoleptr == 0) 80101bbf: 85 f6 test %esi,%esi 80101bc1: 0f 85 13 fc ff ff jne 801017da inconsoleptr = &consoles[0]; 80101bc7: be a0 0e 11 80 mov $0x80110ea0,%esi 80101bcc: e9 09 fc ff ff jmp 801017da procdump(); // now call procdump() wo. cons.lock held 80101bd1: e8 aa 3b 00 00 call 80105780 80101bd6: e9 9c fa ff ff jmp 80101677 switchtoconsole(getbaseconsoleptr()); 80101bdb: 83 ec 0c sub $0xc,%esp 80101bde: 68 a0 0e 11 80 push $0x80110ea0 80101be3: e8 f8 f7 ff ff call 801013e0 80101be8: 83 c4 10 add $0x10,%esp 80101beb: e9 a0 fa ff ff jmp 80101690 uartputc('\b'); 80101bf0: 83 ec 0c sub $0xc,%esp 80101bf3: 6a 08 push $0x8 80101bf5: e8 56 58 00 00 call 80107450 uartputc(' '); 80101bfa: c7 04 24 20 00 00 00 movl $0x20,(%esp) 80101c01: e8 4a 58 00 00 call 80107450 uartputc('\b'); 80101c06: c7 04 24 08 00 00 00 movl $0x8,(%esp) 80101c0d: e8 3e 58 00 00 call 80107450 cgaputc(c); 80101c12: b8 00 01 00 00 mov $0x100,%eax 80101c17: e8 e4 e8 ff ff call 80100500 } 80101c1c: 83 c4 10 add $0x10,%esp 80101c1f: e9 83 f9 ff ff jmp 801015a7 for (int i = (currentconsole->consoleindex + 1); i < MAXVCONSOLES; i++) 80101c24: a1 80 0e 11 80 mov 0x80110e80,%eax 80101c29: 8b 10 mov (%eax),%edx 80101c2b: 8d 42 01 lea 0x1(%edx),%eax 80101c2e: 83 f8 09 cmp $0x9,%eax 80101c31: 0f 8f 44 ff ff ff jg 80101b7b 80101c37: 69 d2 b0 10 00 00 imul $0x10b0,%edx,%edx 80101c3d: 81 c2 a0 0e 11 80 add $0x80110ea0,%edx 80101c43: eb 15 jmp 80101c5a 80101c45: 8d 76 00 lea 0x0(%esi),%esi 80101c48: 83 c0 01 add $0x1,%eax 80101c4b: 81 c2 b0 10 00 00 add $0x10b0,%edx 80101c51: 83 f8 0a cmp $0xa,%eax 80101c54: 0f 84 21 ff ff ff je 80101b7b if (consoles[i].active) 80101c5a: 8b ba 1c 21 00 00 mov 0x211c(%edx),%edi 80101c60: 85 ff test %edi,%edi 80101c62: 74 e4 je 80101c48 toconsole = &consoles[i]; 80101c64: 69 c0 b0 10 00 00 imul $0x10b0,%eax,%eax 80101c6a: 8d 98 a0 0e 11 80 lea -0x7feef160(%eax),%ebx if (toconsole == 0) 80101c70: e9 0b ff ff ff jmp 80101b80 toconsole = &consoles[getmenuindexconsole(switchto)]; 80101c75: 69 9a a0 0e 11 80 b0 imul $0x10b0,-0x7feef160(%edx),%ebx 80101c7c: 10 00 00 80101c7f: 81 c3 a0 0e 11 80 add $0x80110ea0,%ebx break; 80101c85: e9 f6 fe ff ff jmp 80101b80 if (c == BACKSPACE) 80101c8a: 81 fb 00 01 00 00 cmp $0x100,%ebx 80101c90: 74 61 je 80101cf3 uartputc(c); 80101c92: 83 ec 0c sub $0xc,%esp 80101c95: 53 push %ebx 80101c96: e8 b5 57 00 00 call 80107450 cgaputc(c); 80101c9b: 89 d8 mov %ebx,%eax 80101c9d: e8 5e e8 ff ff call 80100500 if (c == '\n' || c == C('D') || consolekbdbuffer->e == consolekbdbuffer->r + INPUT_BUF) 80101ca2: 83 c4 10 add $0x10,%esp 80101ca5: 83 fb 0a cmp $0xa,%ebx 80101ca8: 74 7a je 80101d24 80101caa: 83 fb 04 cmp $0x4,%ebx 80101cad: 74 75 je 80101d24 80101caf: 8b bd d8 fe ff ff mov -0x128(%ebp),%edi 80101cb5: 8b 87 5c 10 00 00 mov 0x105c(%edi),%eax 80101cbb: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp) 80101cc1: 83 e8 80 sub $0xffffff80,%eax 80101cc4: 39 87 64 10 00 00 cmp %eax,0x1064(%edi) 80101cca: 0f 85 d7 f8 ff ff jne 801015a7 consolekbdbuffer->w = consolekbdbuffer->e; 80101cd0: 8b bd d8 fe ff ff mov -0x128(%ebp),%edi wakeup(&(consolekbdbuffer->r)); 80101cd6: 83 ec 0c sub $0xc,%esp consolekbdbuffer->w = consolekbdbuffer->e; 80101cd9: 89 87 60 10 00 00 mov %eax,0x1060(%edi) wakeup(&(consolekbdbuffer->r)); 80101cdf: 8d 87 5c 10 00 00 lea 0x105c(%edi),%eax 80101ce5: 50 push %eax 80101ce6: e8 b5 39 00 00 call 801056a0 80101ceb: 83 c4 10 add $0x10,%esp 80101cee: e9 b4 f8 ff ff jmp 801015a7 uartputc('\b'); 80101cf3: 83 ec 0c sub $0xc,%esp 80101cf6: 6a 08 push $0x8 80101cf8: e8 53 57 00 00 call 80107450 uartputc(' '); 80101cfd: c7 04 24 20 00 00 00 movl $0x20,(%esp) 80101d04: e8 47 57 00 00 call 80107450 uartputc('\b'); 80101d09: c7 04 24 08 00 00 00 movl $0x8,(%esp) 80101d10: e8 3b 57 00 00 call 80107450 cgaputc(c); 80101d15: b8 00 01 00 00 mov $0x100,%eax 80101d1a: e8 e1 e7 ff ff call 80100500 80101d1f: 83 c4 10 add $0x10,%esp 80101d22: eb 8b jmp 80101caf consolekbdbuffer->w = consolekbdbuffer->e; 80101d24: 8b 85 d8 fe ff ff mov -0x128(%ebp),%eax 80101d2a: 8b 80 64 10 00 00 mov 0x1064(%eax),%eax 80101d30: eb 9e jmp 80101cd0 80101d32: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101d39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101d40 : // Function for closing the current console int closeconsole(void) { 80101d40: 55 push %ebp 80101d41: 89 e5 mov %esp,%ebp 80101d43: 53 push %ebx 80101d44: 83 ec 04 sub $0x4,%esp struct vconsole* consoleptr = myproc()->consoleptr; 80101d47: e8 64 31 00 00 call 80104eb0 acquire(&vcons.lock); 80101d4c: 83 ec 0c sub $0xc,%esp struct vconsole* consoleptr = myproc()->consoleptr; 80101d4f: 8b 58 7c mov 0x7c(%eax),%ebx acquire(&vcons.lock); 80101d52: 68 40 b6 11 80 push $0x8011b640 80101d57: e8 24 3e 00 00 call 80105b80 // Check if the process exiting is the consoles parent process we clear the buffer and set the active to 0 if (myproc() == consoleptr->processowner) 80101d5c: e8 4f 31 00 00 call 80104eb0 80101d61: 83 c4 10 add $0x10,%esp 80101d64: 39 43 38 cmp %eax,0x38(%ebx) 80101d67: 74 17 je 80101d80 release(&vcons.lock); switchtoconsole(&consoles[0]); return 1; } } release(&vcons.lock); 80101d69: 83 ec 0c sub $0xc,%esp 80101d6c: 68 40 b6 11 80 push $0x8011b640 80101d71: e8 aa 3d 00 00 call 80105b20 return 0; 80101d76: 83 c4 10 add $0x10,%esp 80101d79: 31 c0 xor %eax,%eax } 80101d7b: 8b 5d fc mov -0x4(%ebp),%ebx 80101d7e: c9 leave 80101d7f: c3 ret memset(bufferin, 0, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 80101d80: 83 ec 04 sub $0x4,%esp clearconsole(consoleptr->screenbuffer); 80101d83: 8d 43 3c lea 0x3c(%ebx),%eax memset(bufferin, 0, sizeof(bufferin[0]) * SCRHEIGHT * SCRWIDTH); 80101d86: 68 a0 0f 00 00 push $0xfa0 80101d8b: 6a 00 push $0x0 80101d8d: 50 push %eax 80101d8e: e8 ad 3e 00 00 call 80105c40 if (consoleptr->inuse) 80101d93: 8b 83 70 10 00 00 mov 0x1070(%ebx),%eax 80101d99: 83 c4 10 add $0x10,%esp consoleptr->active = 0; 80101d9c: c7 83 6c 10 00 00 00 movl $0x0,0x106c(%ebx) 80101da3: 00 00 00 if (consoleptr->inuse) 80101da6: 85 c0 test %eax,%eax 80101da8: 74 bf je 80101d69 consoleptr->inuse = 0; 80101daa: c7 83 70 10 00 00 00 movl $0x0,0x1070(%ebx) 80101db1: 00 00 00 release(&vcons.lock); 80101db4: 83 ec 0c sub $0xc,%esp 80101db7: 68 40 b6 11 80 push $0x8011b640 80101dbc: e8 5f 3d 00 00 call 80105b20 switchtoconsole(&consoles[0]); 80101dc1: c7 04 24 a0 0e 11 80 movl $0x80110ea0,(%esp) 80101dc8: e8 13 f6 ff ff call 801013e0 return 1; 80101dcd: 83 c4 10 add $0x10,%esp 80101dd0: b8 01 00 00 00 mov $0x1,%eax 80101dd5: eb a4 jmp 80101d7b 80101dd7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101dde: 66 90 xchg %ax,%ax 80101de0 : // Function for getting the console index of the current inuse console int getcurrentconsoleindex(void) { 80101de0: 55 push %ebp 80101de1: 89 e5 mov %esp,%ebp 80101de3: 53 push %ebx acquire(&vcons.lock); for (int i = 0; i < MAXVCONSOLES; i++) 80101de4: 31 db xor %ebx,%ebx { 80101de6: 83 ec 10 sub $0x10,%esp acquire(&vcons.lock); 80101de9: 68 40 b6 11 80 push $0x8011b640 80101dee: e8 8d 3d 00 00 call 80105b80 for (int i = 0; i < MAXVCONSOLES; i++) 80101df3: b8 10 1f 11 80 mov $0x80111f10,%eax 80101df8: 83 c4 10 add $0x10,%esp 80101dfb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101dff: 90 nop { if (consoles[i].inuse) 80101e00: 8b 10 mov (%eax),%edx 80101e02: 85 d2 test %edx,%edx 80101e04: 75 2a jne 80101e30 for (int i = 0; i < MAXVCONSOLES; i++) 80101e06: 83 c3 01 add $0x1,%ebx 80101e09: 05 b0 10 00 00 add $0x10b0,%eax 80101e0e: 83 fb 0a cmp $0xa,%ebx 80101e11: 75 ed jne 80101e00 { release(&vcons.lock); return consoles[i].consoleindex; } } release(&vcons.lock); 80101e13: 83 ec 0c sub $0xc,%esp 80101e16: 68 40 b6 11 80 push $0x8011b640 80101e1b: e8 00 3d 00 00 call 80105b20 return -1; } 80101e20: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80101e23: 83 c4 10 add $0x10,%esp 80101e26: b8 ff ff ff ff mov $0xffffffff,%eax } 80101e2b: c9 leave 80101e2c: c3 ret 80101e2d: 8d 76 00 lea 0x0(%esi),%esi release(&vcons.lock); 80101e30: 83 ec 0c sub $0xc,%esp return consoles[i].consoleindex; 80101e33: 69 db b0 10 00 00 imul $0x10b0,%ebx,%ebx release(&vcons.lock); 80101e39: 68 40 b6 11 80 push $0x8011b640 80101e3e: e8 dd 3c 00 00 call 80105b20 return consoles[i].consoleindex; 80101e43: 8b 83 a0 0e 11 80 mov -0x7feef160(%ebx),%eax 80101e49: 83 c4 10 add $0x10,%esp } 80101e4c: 8b 5d fc mov -0x4(%ebp),%ebx 80101e4f: c9 leave 80101e50: c3 ret 80101e51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101e58: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101e5f: 90 nop 80101e60 : // Function for setting the title of a console for the title bar and menu void setconsoleproctitle(struct vconsole* consoleptr, char* newtitle) { 80101e60: 55 push %ebp 80101e61: 89 e5 mov %esp,%ebp 80101e63: 56 push %esi 80101e64: 53 push %ebx 80101e65: 8b 5d 08 mov 0x8(%ebp),%ebx 80101e68: 8b 75 0c mov 0xc(%ebp),%esi if (!consoleptr->titlelocked) 80101e6b: 8b 83 8c 10 00 00 mov 0x108c(%ebx),%eax 80101e71: 85 c0 test %eax,%eax 80101e73: 74 0b je 80101e80 //Redraw the title since its been updated now drawtitle(); release(&vcons.lock); } 80101e75: 8d 65 f8 lea -0x8(%ebp),%esp 80101e78: 5b pop %ebx 80101e79: 5e pop %esi 80101e7a: 5d pop %ebp 80101e7b: c3 ret 80101e7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi acquire(&vcons.lock); 80101e80: 83 ec 0c sub $0xc,%esp memset(consoleptr->proctitle, 0, sizeof(consoleptr->proctitle[0]) * sizeof(consoleptr->proctitle)); 80101e83: 81 c3 78 10 00 00 add $0x1078,%ebx acquire(&vcons.lock); 80101e89: 68 40 b6 11 80 push $0x8011b640 80101e8e: e8 ed 3c 00 00 call 80105b80 memset(consoleptr->proctitle, 0, sizeof(consoleptr->proctitle[0]) * sizeof(consoleptr->proctitle)); 80101e93: 83 c4 0c add $0xc,%esp 80101e96: 6a 14 push $0x14 80101e98: 6a 00 push $0x0 80101e9a: 53 push %ebx 80101e9b: e8 a0 3d 00 00 call 80105c40 safestrcpy(consoleptr->proctitle, newtitle, sizeof(consoleptr->proctitle)); 80101ea0: 83 c4 0c add $0xc,%esp 80101ea3: 6a 14 push $0x14 80101ea5: 56 push %esi 80101ea6: 53 push %ebx 80101ea7: e8 54 3f 00 00 call 80105e00 drawtitle(); 80101eac: e8 df ef ff ff call 80100e90 release(&vcons.lock); 80101eb1: c7 45 08 40 b6 11 80 movl $0x8011b640,0x8(%ebp) 80101eb8: 83 c4 10 add $0x10,%esp 80101ebb: 8d 65 f8 lea -0x8(%ebp),%esp 80101ebe: 5b pop %ebx 80101ebf: 5e pop %esi 80101ec0: 5d pop %ebp release(&vcons.lock); 80101ec1: e9 5a 3c 00 00 jmp 80105b20 80101ec6: 66 90 xchg %ax,%ax 80101ec8: 66 90 xchg %ax,%ax 80101eca: 66 90 xchg %ax,%ax 80101ecc: 66 90 xchg %ax,%ax 80101ece: 66 90 xchg %ax,%ax 80101ed0 : #include "proc.h" #include "defs.h" #include "x86.h" #include "elf.h" void cleanupexec(pde_t * pgdir, struct inode *ip) { 80101ed0: 55 push %ebp 80101ed1: 89 e5 mov %esp,%ebp 80101ed3: 53 push %ebx 80101ed4: 83 ec 04 sub $0x4,%esp 80101ed7: 8b 45 08 mov 0x8(%ebp),%eax 80101eda: 8b 5d 0c mov 0xc(%ebp),%ebx if (pgdir) { 80101edd: 85 c0 test %eax,%eax 80101edf: 74 0c je 80101eed freevm(pgdir); 80101ee1: 83 ec 0c sub $0xc,%esp 80101ee4: 50 push %eax 80101ee5: e8 76 66 00 00 call 80108560 80101eea: 83 c4 10 add $0x10,%esp } if (ip) { 80101eed: 85 db test %ebx,%ebx 80101eef: 74 1f je 80101f10 iunlockput(ip); 80101ef1: 83 ec 0c sub $0xc,%esp 80101ef4: 53 push %ebx 80101ef5: e8 06 10 00 00 call 80102f00 end_op(); } } 80101efa: 8b 5d fc mov -0x4(%ebp),%ebx end_op(); 80101efd: 83 c4 10 add $0x10,%esp } 80101f00: c9 leave end_op(); 80101f01: e9 ba 23 00 00 jmp 801042c0 80101f06: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101f0d: 8d 76 00 lea 0x0(%esi),%esi } 80101f10: 8b 5d fc mov -0x4(%ebp),%ebx 80101f13: c9 leave 80101f14: c3 ret 80101f15: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101f1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101f20 : int exec(char *path, char **argv) { 80101f20: 55 push %ebp 80101f21: 89 e5 mov %esp,%ebp 80101f23: 57 push %edi 80101f24: 56 push %esi 80101f25: 53 push %ebx 80101f26: 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(); 80101f2c: e8 7f 2f 00 00 call 80104eb0 80101f31: 89 85 ec fe ff ff mov %eax,-0x114(%ebp) begin_op(); 80101f37: e8 14 23 00 00 call 80104250 if ((ip = namei(path)) == 0) { 80101f3c: 83 ec 0c sub $0xc,%esp 80101f3f: ff 75 08 push 0x8(%ebp) 80101f42: e8 49 16 00 00 call 80103590 80101f47: 83 c4 10 add $0x10,%esp 80101f4a: 85 c0 test %eax,%eax 80101f4c: 0f 84 6b 03 00 00 je 801022bd end_op(); cprintf("exec: fail\n"); return -1; } ilock(ip); 80101f52: 83 ec 0c sub $0xc,%esp 80101f55: 89 c7 mov %eax,%edi 80101f57: 50 push %eax 80101f58: e8 13 0d 00 00 call 80102c70 pgdir = 0; // Check ELF header if (readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf)) { 80101f5d: 8d 85 24 ff ff ff lea -0xdc(%ebp),%eax 80101f63: 6a 34 push $0x34 80101f65: 6a 00 push $0x0 80101f67: 50 push %eax 80101f68: 57 push %edi 80101f69: e8 12 10 00 00 call 80102f80 80101f6e: 83 c4 20 add $0x20,%esp 80101f71: 83 f8 34 cmp $0x34,%eax 80101f74: 0f 85 f8 02 00 00 jne 80102272 cleanupexec(pgdir, ip); return -1; } if (elf.magic != ELF_MAGIC) { 80101f7a: 81 bd 24 ff ff ff 7f cmpl $0x464c457f,-0xdc(%ebp) 80101f81: 45 4c 46 80101f84: 0f 85 e8 02 00 00 jne 80102272 cleanupexec(pgdir, ip); return -1; } if ((pgdir = setupkvm()) == 0) { 80101f8a: e8 51 66 00 00 call 801085e0 80101f8f: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp) 80101f95: 85 c0 test %eax,%eax 80101f97: 0f 84 d5 02 00 00 je 80102272 return -1; } // Load program into memory. sz = 0; for (i = 0, off = elf.phoff; i < elf.phnum; i++, off += sizeof(ph)) { 80101f9d: 66 83 bd 50 ff ff ff cmpw $0x0,-0xb0(%ebp) 80101fa4: 00 80101fa5: 8b 9d 40 ff ff ff mov -0xc0(%ebp),%ebx 80101fab: 0f 84 dc 02 00 00 je 8010228d sz = 0; 80101fb1: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) 80101fb8: 00 00 00 for (i = 0, off = elf.phoff; i < elf.phnum; i++, off += sizeof(ph)) { 80101fbb: 31 f6 xor %esi,%esi 80101fbd: e9 8c 00 00 00 jmp 8010204e 80101fc2: 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) { 80101fc8: 83 bd 04 ff ff ff 01 cmpl $0x1,-0xfc(%ebp) 80101fcf: 75 6c jne 8010203d continue; } if (ph.memsz < ph.filesz) { 80101fd1: 8b 85 18 ff ff ff mov -0xe8(%ebp),%eax 80101fd7: 3b 85 14 ff ff ff cmp -0xec(%ebp),%eax 80101fdd: 0f 82 87 00 00 00 jb 8010206a cleanupexec(pgdir, ip); return -1; } if (ph.vaddr + ph.memsz < ph.vaddr) { 80101fe3: 03 85 0c ff ff ff add -0xf4(%ebp),%eax 80101fe9: 72 7f jb 8010206a cleanupexec(pgdir, ip); return -1; } if ((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) { 80101feb: 83 ec 04 sub $0x4,%esp 80101fee: 50 push %eax 80101fef: ff b5 f0 fe ff ff push -0x110(%ebp) 80101ff5: ff b5 f4 fe ff ff push -0x10c(%ebp) 80101ffb: e8 00 64 00 00 call 80108400 80102000: 83 c4 10 add $0x10,%esp 80102003: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) 80102009: 85 c0 test %eax,%eax 8010200b: 74 5d je 8010206a cleanupexec(pgdir, ip); return -1; } if (ph.vaddr % PGSIZE != 0) { 8010200d: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax 80102013: a9 ff 0f 00 00 test $0xfff,%eax 80102018: 75 50 jne 8010206a cleanupexec(pgdir, ip); return -1; } if (loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) { 8010201a: 83 ec 0c sub $0xc,%esp 8010201d: ff b5 14 ff ff ff push -0xec(%ebp) 80102023: ff b5 08 ff ff ff push -0xf8(%ebp) 80102029: 57 push %edi 8010202a: 50 push %eax 8010202b: ff b5 f4 fe ff ff push -0x10c(%ebp) 80102031: e8 da 62 00 00 call 80108310 80102036: 83 c4 20 add $0x20,%esp 80102039: 85 c0 test %eax,%eax 8010203b: 78 2d js 8010206a for (i = 0, off = elf.phoff; i < elf.phnum; i++, off += sizeof(ph)) { 8010203d: 0f b7 85 50 ff ff ff movzwl -0xb0(%ebp),%eax 80102044: 83 c6 01 add $0x1,%esi 80102047: 83 c3 20 add $0x20,%ebx 8010204a: 39 f0 cmp %esi,%eax 8010204c: 7e 4a jle 80102098 if (readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) { 8010204e: 8d 85 04 ff ff ff lea -0xfc(%ebp),%eax 80102054: 6a 20 push $0x20 80102056: 53 push %ebx 80102057: 50 push %eax 80102058: 57 push %edi 80102059: e8 22 0f 00 00 call 80102f80 8010205e: 83 c4 10 add $0x10,%esp 80102061: 83 f8 20 cmp $0x20,%eax 80102064: 0f 84 5e ff ff ff je 80101fc8 freevm(pgdir); 8010206a: 83 ec 0c sub $0xc,%esp 8010206d: ff b5 f4 fe ff ff push -0x10c(%ebp) 80102073: e8 e8 64 00 00 call 80108560 iunlockput(ip); 80102078: 89 3c 24 mov %edi,(%esp) 8010207b: e8 80 0e 00 00 call 80102f00 end_op(); 80102080: e8 3b 22 00 00 call 801042c0 } 80102085: 83 c4 10 add $0x10,%esp cleanupexec(pgdir, ip); return -1; 80102088: b8 ff ff ff ff mov $0xffffffff,%eax curproc->tf->eip = elf.entry; // main curproc->tf->esp = sp; switchuvm(curproc); freevm(oldpgdir); return 0; } 8010208d: 8d 65 f4 lea -0xc(%ebp),%esp 80102090: 5b pop %ebx 80102091: 5e pop %esi 80102092: 5f pop %edi 80102093: 5d pop %ebp 80102094: c3 ret 80102095: 8d 76 00 lea 0x0(%esi),%esi sz = PGROUNDUP(sz); 80102098: 8b b5 f0 fe ff ff mov -0x110(%ebp),%esi 8010209e: 81 c6 ff 0f 00 00 add $0xfff,%esi 801020a4: 81 e6 00 f0 ff ff and $0xfffff000,%esi if ((sz = allocuvm(pgdir, sz, sz + 2 * PGSIZE)) == 0) { 801020aa: 8d 9e 00 20 00 00 lea 0x2000(%esi),%ebx iunlockput(ip); 801020b0: 83 ec 0c sub $0xc,%esp 801020b3: 57 push %edi 801020b4: e8 47 0e 00 00 call 80102f00 end_op(); 801020b9: e8 02 22 00 00 call 801042c0 if ((sz = allocuvm(pgdir, sz, sz + 2 * PGSIZE)) == 0) { 801020be: 83 c4 0c add $0xc,%esp 801020c1: 53 push %ebx 801020c2: 56 push %esi 801020c3: ff b5 f4 fe ff ff push -0x10c(%ebp) 801020c9: e8 32 63 00 00 call 80108400 801020ce: 83 c4 10 add $0x10,%esp 801020d1: 89 c7 mov %eax,%edi 801020d3: 85 c0 test %eax,%eax 801020d5: 0f 84 87 00 00 00 je 80102162 clearpteu(pgdir, (char*)(sz - 2 * PGSIZE)); 801020db: 83 ec 08 sub $0x8,%esp 801020de: 8d 80 00 e0 ff ff lea -0x2000(%eax),%eax for (argc = 0; argv[argc]; argc++) { 801020e4: 89 fb mov %edi,%ebx 801020e6: 31 f6 xor %esi,%esi clearpteu(pgdir, (char*)(sz - 2 * PGSIZE)); 801020e8: 50 push %eax 801020e9: ff b5 f4 fe ff ff push -0x10c(%ebp) 801020ef: e8 8c 65 00 00 call 80108680 for (argc = 0; argv[argc]; argc++) { 801020f4: 8b 45 0c mov 0xc(%ebp),%eax 801020f7: 83 c4 10 add $0x10,%esp 801020fa: 8b 08 mov (%eax),%ecx 801020fc: 85 c9 test %ecx,%ecx 801020fe: 0f 84 95 01 00 00 je 80102299 80102104: 89 bd f0 fe ff ff mov %edi,-0x110(%ebp) 8010210a: 8b 7d 0c mov 0xc(%ebp),%edi 8010210d: eb 1f jmp 8010212e 8010210f: 90 nop 80102110: 8d 46 01 lea 0x1(%esi),%eax ustack[3 + argc] = sp; 80102113: 89 9c b5 64 ff ff ff mov %ebx,-0x9c(%ebp,%esi,4) 8010211a: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx for (argc = 0; argv[argc]; argc++) { 80102120: 8b 0c 87 mov (%edi,%eax,4),%ecx 80102123: 85 c9 test %ecx,%ecx 80102125: 74 59 je 80102180 if (argc >= MAXARG) { 80102127: 83 f8 20 cmp $0x20,%eax 8010212a: 74 36 je 80102162 8010212c: 89 c6 mov %eax,%esi sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 8010212e: 83 ec 0c sub $0xc,%esp 80102131: 51 push %ecx 80102132: e8 09 3d 00 00 call 80105e40 if (copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) { 80102137: 5a pop %edx 80102138: ff 34 b7 push (%edi,%esi,4) sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 8010213b: 29 c3 sub %eax,%ebx 8010213d: 83 eb 01 sub $0x1,%ebx if (copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) { 80102140: e8 fb 3c 00 00 call 80105e40 sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80102145: 83 e3 fc and $0xfffffffc,%ebx if (copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) { 80102148: 83 c0 01 add $0x1,%eax 8010214b: 50 push %eax 8010214c: ff 34 b7 push (%edi,%esi,4) 8010214f: 53 push %ebx 80102150: ff b5 f4 fe ff ff push -0x10c(%ebp) 80102156: e8 15 67 00 00 call 80108870 8010215b: 83 c4 20 add $0x20,%esp 8010215e: 85 c0 test %eax,%eax 80102160: 79 ae jns 80102110 freevm(pgdir); 80102162: 83 ec 0c sub $0xc,%esp 80102165: ff b5 f4 fe ff ff push -0x10c(%ebp) 8010216b: e8 f0 63 00 00 call 80108560 } 80102170: 83 c4 10 add $0x10,%esp } 80102173: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 80102176: b8 ff ff ff ff mov $0xffffffff,%eax } 8010217b: 5b pop %ebx 8010217c: 5e pop %esi 8010217d: 5f pop %edi 8010217e: 5d pop %ebp 8010217f: c3 ret ustack[2] = sp - (argc + 1) * 4; // argv pointer 80102180: 8d 0c b5 08 00 00 00 lea 0x8(,%esi,4),%ecx ustack[3 + argc] = 0; 80102187: 8b bd f0 fe ff ff mov -0x110(%ebp),%edi 8010218d: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) 80102193: 8d 46 04 lea 0x4(%esi),%eax sp -= (3 + argc + 1) * 4; 80102196: 8d 71 0c lea 0xc(%ecx),%esi ustack[3 + argc] = 0; 80102199: c7 84 85 58 ff ff ff movl $0x0,-0xa8(%ebp,%eax,4) 801021a0: 00 00 00 00 ustack[1] = argc; 801021a4: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax if (copyout(pgdir, sp, ustack, (3 + argc + 1) * 4) < 0) { 801021aa: 56 push %esi ustack[1] = argc; 801021ab: 89 85 5c ff ff ff mov %eax,-0xa4(%ebp) ustack[2] = sp - (argc + 1) * 4; // argv pointer 801021b1: 89 d8 mov %ebx,%eax sp -= (3 + argc + 1) * 4; 801021b3: 29 f3 sub %esi,%ebx if (copyout(pgdir, sp, ustack, (3 + argc + 1) * 4) < 0) { 801021b5: 52 push %edx ustack[2] = sp - (argc + 1) * 4; // argv pointer 801021b6: 29 c8 sub %ecx,%eax if (copyout(pgdir, sp, ustack, (3 + argc + 1) * 4) < 0) { 801021b8: 53 push %ebx 801021b9: ff b5 f4 fe ff ff push -0x10c(%ebp) ustack[0] = 0xffffffff; // fake return PC 801021bf: c7 85 58 ff ff ff ff movl $0xffffffff,-0xa8(%ebp) 801021c6: ff ff ff ustack[2] = sp - (argc + 1) * 4; // argv pointer 801021c9: 89 85 60 ff ff ff mov %eax,-0xa0(%ebp) if (copyout(pgdir, sp, ustack, (3 + argc + 1) * 4) < 0) { 801021cf: e8 9c 66 00 00 call 80108870 801021d4: 83 c4 10 add $0x10,%esp 801021d7: 85 c0 test %eax,%eax 801021d9: 0f 88 fd 00 00 00 js 801022dc for (last = s = path; *s; s++) { 801021df: 8b 45 08 mov 0x8(%ebp),%eax 801021e2: 8b 55 08 mov 0x8(%ebp),%edx 801021e5: 8b 4d 08 mov 0x8(%ebp),%ecx 801021e8: 0f b6 00 movzbl (%eax),%eax 801021eb: 84 c0 test %al,%al 801021ed: 74 10 je 801021ff 801021ef: 90 nop last = s + 1; 801021f0: 83 c1 01 add $0x1,%ecx 801021f3: 3c 2f cmp $0x2f,%al for (last = s = path; *s; s++) { 801021f5: 0f b6 01 movzbl (%ecx),%eax last = s + 1; 801021f8: 0f 44 d1 cmove %ecx,%edx for (last = s = path; *s; s++) { 801021fb: 84 c0 test %al,%al 801021fd: 75 f1 jne 801021f0 safestrcpy(curproc->name, last, sizeof(curproc->name)); 801021ff: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax 80102205: 83 ec 04 sub $0x4,%esp 80102208: 6a 10 push $0x10 8010220a: 8d 70 6c lea 0x6c(%eax),%esi 8010220d: 52 push %edx 8010220e: 56 push %esi 8010220f: e8 ec 3b 00 00 call 80105e00 if (curproc->consoleptr != 0) 80102214: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax 8010221a: 83 c4 10 add $0x10,%esp 8010221d: 8b 40 7c mov 0x7c(%eax),%eax 80102220: 85 c0 test %eax,%eax 80102222: 74 0d je 80102231 setconsoleproctitle(curproc->consoleptr, curproc->name); 80102224: 83 ec 08 sub $0x8,%esp 80102227: 56 push %esi 80102228: 50 push %eax 80102229: e8 32 fc ff ff call 80101e60 8010222e: 83 c4 10 add $0x10,%esp oldpgdir = curproc->pgdir; 80102231: 8b 8d ec fe ff ff mov -0x114(%ebp),%ecx curproc->pgdir = pgdir; 80102237: 8b 95 f4 fe ff ff mov -0x10c(%ebp),%edx switchuvm(curproc); 8010223d: 83 ec 0c sub $0xc,%esp oldpgdir = curproc->pgdir; 80102240: 8b 71 04 mov 0x4(%ecx),%esi curproc->tf->eip = elf.entry; // main 80102243: 8b 41 18 mov 0x18(%ecx),%eax curproc->pgdir = pgdir; 80102246: 89 51 04 mov %edx,0x4(%ecx) curproc->sz = sz; 80102249: 89 39 mov %edi,(%ecx) curproc->tf->eip = elf.entry; // main 8010224b: 8b 95 3c ff ff ff mov -0xc4(%ebp),%edx 80102251: 89 50 38 mov %edx,0x38(%eax) curproc->tf->esp = sp; 80102254: 8b 41 18 mov 0x18(%ecx),%eax 80102257: 89 58 44 mov %ebx,0x44(%eax) switchuvm(curproc); 8010225a: 51 push %ecx 8010225b: e8 20 5f 00 00 call 80108180 freevm(oldpgdir); 80102260: 89 34 24 mov %esi,(%esp) 80102263: e8 f8 62 00 00 call 80108560 return 0; 80102268: 83 c4 10 add $0x10,%esp 8010226b: 31 c0 xor %eax,%eax 8010226d: e9 1b fe ff ff jmp 8010208d iunlockput(ip); 80102272: 83 ec 0c sub $0xc,%esp 80102275: 57 push %edi 80102276: e8 85 0c 00 00 call 80102f00 end_op(); 8010227b: e8 40 20 00 00 call 801042c0 } 80102280: 83 c4 10 add $0x10,%esp return -1; 80102283: b8 ff ff ff ff mov $0xffffffff,%eax } 80102288: e9 00 fe ff ff jmp 8010208d for (i = 0, off = elf.phoff; i < elf.phnum; i++, off += sizeof(ph)) { 8010228d: bb 00 20 00 00 mov $0x2000,%ebx 80102292: 31 f6 xor %esi,%esi 80102294: e9 17 fe ff ff jmp 801020b0 for (argc = 0; argv[argc]; argc++) { 80102299: be 10 00 00 00 mov $0x10,%esi 8010229e: b9 04 00 00 00 mov $0x4,%ecx 801022a3: b8 03 00 00 00 mov $0x3,%eax 801022a8: c7 85 f0 fe ff ff 00 movl $0x0,-0x110(%ebp) 801022af: 00 00 00 801022b2: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx 801022b8: e9 dc fe ff ff jmp 80102199 end_op(); 801022bd: e8 fe 1f 00 00 call 801042c0 cprintf("exec: fail\n"); 801022c2: 83 ec 0c sub $0xc,%esp 801022c5: 68 a1 8a 10 80 push $0x80108aa1 801022ca: e8 c1 e5 ff ff call 80100890 return -1; 801022cf: 83 c4 10 add $0x10,%esp 801022d2: b8 ff ff ff ff mov $0xffffffff,%eax 801022d7: e9 b1 fd ff ff jmp 8010208d cleanupexec(pgdir, ip); 801022dc: 50 push %eax 801022dd: 50 push %eax 801022de: 6a 00 push $0x0 801022e0: ff b5 f4 fe ff ff push -0x10c(%ebp) 801022e6: e8 e5 fb ff ff call 80101ed0 return -1; 801022eb: 83 c4 10 add $0x10,%esp 801022ee: 83 c8 ff or $0xffffffff,%eax 801022f1: e9 97 fd ff ff jmp 8010208d 801022f6: 66 90 xchg %ax,%ax 801022f8: 66 90 xchg %ax,%ax 801022fa: 66 90 xchg %ax,%ax 801022fc: 66 90 xchg %ax,%ax 801022fe: 66 90 xchg %ax,%ax 80102300 : struct { struct spinlock lock; struct file file[NFILE]; } ftable; void fileinit(void) { 80102300: 55 push %ebp 80102301: 89 e5 mov %esp,%ebp 80102303: 83 ec 10 sub $0x10,%esp initlock(&ftable.lock, "ftable"); 80102306: 68 ad 8a 10 80 push $0x80108aad 8010230b: 68 e0 b6 11 80 push $0x8011b6e0 80102310: e8 9b 36 00 00 call 801059b0 } 80102315: 83 c4 10 add $0x10,%esp 80102318: c9 leave 80102319: c3 ret 8010231a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102320 : // Allocate a file structure. struct file* filealloc(void) { 80102320: 55 push %ebp 80102321: 89 e5 mov %esp,%ebp 80102323: 53 push %ebx struct file *f; acquire(&ftable.lock); for (f = ftable.file; f < ftable.file + NFILE; f++) { 80102324: bb 14 b7 11 80 mov $0x8011b714,%ebx struct file* filealloc(void) { 80102329: 83 ec 10 sub $0x10,%esp acquire(&ftable.lock); 8010232c: 68 e0 b6 11 80 push $0x8011b6e0 80102331: e8 4a 38 00 00 call 80105b80 80102336: 83 c4 10 add $0x10,%esp 80102339: eb 10 jmp 8010234b 8010233b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010233f: 90 nop for (f = ftable.file; f < ftable.file + NFILE; f++) { 80102340: 83 c3 18 add $0x18,%ebx 80102343: 81 fb 74 c0 11 80 cmp $0x8011c074,%ebx 80102349: 74 25 je 80102370 if (f->ref == 0) { 8010234b: 8b 43 04 mov 0x4(%ebx),%eax 8010234e: 85 c0 test %eax,%eax 80102350: 75 ee jne 80102340 f->ref = 1; release(&ftable.lock); 80102352: 83 ec 0c sub $0xc,%esp f->ref = 1; 80102355: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx) release(&ftable.lock); 8010235c: 68 e0 b6 11 80 push $0x8011b6e0 80102361: e8 ba 37 00 00 call 80105b20 return f; } } release(&ftable.lock); return 0; } 80102366: 89 d8 mov %ebx,%eax return f; 80102368: 83 c4 10 add $0x10,%esp } 8010236b: 8b 5d fc mov -0x4(%ebp),%ebx 8010236e: c9 leave 8010236f: c3 ret release(&ftable.lock); 80102370: 83 ec 0c sub $0xc,%esp return 0; 80102373: 31 db xor %ebx,%ebx release(&ftable.lock); 80102375: 68 e0 b6 11 80 push $0x8011b6e0 8010237a: e8 a1 37 00 00 call 80105b20 } 8010237f: 89 d8 mov %ebx,%eax return 0; 80102381: 83 c4 10 add $0x10,%esp } 80102384: 8b 5d fc mov -0x4(%ebp),%ebx 80102387: c9 leave 80102388: c3 ret 80102389: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102390 : // Increment ref count for file f. struct file* filedup(struct file *f) { 80102390: 55 push %ebp 80102391: 89 e5 mov %esp,%ebp 80102393: 53 push %ebx 80102394: 83 ec 10 sub $0x10,%esp 80102397: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&ftable.lock); 8010239a: 68 e0 b6 11 80 push $0x8011b6e0 8010239f: e8 dc 37 00 00 call 80105b80 if (f->ref < 1) { 801023a4: 8b 43 04 mov 0x4(%ebx),%eax 801023a7: 83 c4 10 add $0x10,%esp 801023aa: 85 c0 test %eax,%eax 801023ac: 7e 1a jle 801023c8 panic("filedup"); } f->ref++; 801023ae: 83 c0 01 add $0x1,%eax release(&ftable.lock); 801023b1: 83 ec 0c sub $0xc,%esp f->ref++; 801023b4: 89 43 04 mov %eax,0x4(%ebx) release(&ftable.lock); 801023b7: 68 e0 b6 11 80 push $0x8011b6e0 801023bc: e8 5f 37 00 00 call 80105b20 return f; } 801023c1: 89 d8 mov %ebx,%eax 801023c3: 8b 5d fc mov -0x4(%ebp),%ebx 801023c6: c9 leave 801023c7: c3 ret panic("filedup"); 801023c8: 83 ec 0c sub $0xc,%esp 801023cb: 68 b4 8a 10 80 push $0x80108ab4 801023d0: e8 ab e0 ff ff call 80100480 801023d5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801023dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801023e0 : // Close file f. (Decrement ref count, close when reaches 0.) void fileclose(struct file *f) { 801023e0: 55 push %ebp 801023e1: 89 e5 mov %esp,%ebp 801023e3: 57 push %edi 801023e4: 56 push %esi 801023e5: 53 push %ebx 801023e6: 83 ec 28 sub $0x28,%esp 801023e9: 8b 5d 08 mov 0x8(%ebp),%ebx struct file ff; acquire(&ftable.lock); 801023ec: 68 e0 b6 11 80 push $0x8011b6e0 801023f1: e8 8a 37 00 00 call 80105b80 if (f->ref < 1) { 801023f6: 8b 53 04 mov 0x4(%ebx),%edx 801023f9: 83 c4 10 add $0x10,%esp 801023fc: 85 d2 test %edx,%edx 801023fe: 0f 8e a5 00 00 00 jle 801024a9 panic("fileclose"); } if (--f->ref > 0) { 80102404: 83 ea 01 sub $0x1,%edx 80102407: 89 53 04 mov %edx,0x4(%ebx) 8010240a: 75 44 jne 80102450 release(&ftable.lock); return; } ff = *f; 8010240c: 0f b6 43 09 movzbl 0x9(%ebx),%eax f->ref = 0; f->type = FD_NONE; release(&ftable.lock); 80102410: 83 ec 0c sub $0xc,%esp ff = *f; 80102413: 8b 3b mov (%ebx),%edi f->type = FD_NONE; 80102415: c7 03 00 00 00 00 movl $0x0,(%ebx) ff = *f; 8010241b: 8b 73 0c mov 0xc(%ebx),%esi 8010241e: 88 45 e7 mov %al,-0x19(%ebp) 80102421: 8b 43 10 mov 0x10(%ebx),%eax release(&ftable.lock); 80102424: 68 e0 b6 11 80 push $0x8011b6e0 ff = *f; 80102429: 89 45 e0 mov %eax,-0x20(%ebp) release(&ftable.lock); 8010242c: e8 ef 36 00 00 call 80105b20 if (ff.type == FD_PIPE) { 80102431: 83 c4 10 add $0x10,%esp 80102434: 83 ff 01 cmp $0x1,%edi 80102437: 74 57 je 80102490 pipeclose(ff.pipe, ff.writable); } else if (ff.type == FD_INODE) { 80102439: 83 ff 02 cmp $0x2,%edi 8010243c: 74 2a je 80102468 begin_op(); iput(ff.ip); end_op(); } } 8010243e: 8d 65 f4 lea -0xc(%ebp),%esp 80102441: 5b pop %ebx 80102442: 5e pop %esi 80102443: 5f pop %edi 80102444: 5d pop %ebp 80102445: c3 ret 80102446: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010244d: 8d 76 00 lea 0x0(%esi),%esi release(&ftable.lock); 80102450: c7 45 08 e0 b6 11 80 movl $0x8011b6e0,0x8(%ebp) } 80102457: 8d 65 f4 lea -0xc(%ebp),%esp 8010245a: 5b pop %ebx 8010245b: 5e pop %esi 8010245c: 5f pop %edi 8010245d: 5d pop %ebp release(&ftable.lock); 8010245e: e9 bd 36 00 00 jmp 80105b20 80102463: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102467: 90 nop begin_op(); 80102468: e8 e3 1d 00 00 call 80104250 iput(ff.ip); 8010246d: 83 ec 0c sub $0xc,%esp 80102470: ff 75 e0 push -0x20(%ebp) 80102473: e8 28 09 00 00 call 80102da0 end_op(); 80102478: 83 c4 10 add $0x10,%esp } 8010247b: 8d 65 f4 lea -0xc(%ebp),%esp 8010247e: 5b pop %ebx 8010247f: 5e pop %esi 80102480: 5f pop %edi 80102481: 5d pop %ebp end_op(); 80102482: e9 39 1e 00 00 jmp 801042c0 80102487: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010248e: 66 90 xchg %ax,%ax pipeclose(ff.pipe, ff.writable); 80102490: 0f be 5d e7 movsbl -0x19(%ebp),%ebx 80102494: 83 ec 08 sub $0x8,%esp 80102497: 53 push %ebx 80102498: 56 push %esi 80102499: e8 c2 25 00 00 call 80104a60 8010249e: 83 c4 10 add $0x10,%esp } 801024a1: 8d 65 f4 lea -0xc(%ebp),%esp 801024a4: 5b pop %ebx 801024a5: 5e pop %esi 801024a6: 5f pop %edi 801024a7: 5d pop %ebp 801024a8: c3 ret panic("fileclose"); 801024a9: 83 ec 0c sub $0xc,%esp 801024ac: 68 bc 8a 10 80 push $0x80108abc 801024b1: e8 ca df ff ff call 80100480 801024b6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801024bd: 8d 76 00 lea 0x0(%esi),%esi 801024c0 : // Get metadata about file f. int filestat(struct file *f, struct stat *st) { 801024c0: 55 push %ebp 801024c1: 89 e5 mov %esp,%ebp 801024c3: 53 push %ebx 801024c4: 83 ec 04 sub $0x4,%esp 801024c7: 8b 5d 08 mov 0x8(%ebp),%ebx if (f->type == FD_INODE) { 801024ca: 83 3b 02 cmpl $0x2,(%ebx) 801024cd: 75 31 jne 80102500 ilock(f->ip); 801024cf: 83 ec 0c sub $0xc,%esp 801024d2: ff 73 10 push 0x10(%ebx) 801024d5: e8 96 07 00 00 call 80102c70 stati(f->ip, st); 801024da: 58 pop %eax 801024db: 5a pop %edx 801024dc: ff 75 0c push 0xc(%ebp) 801024df: ff 73 10 push 0x10(%ebx) 801024e2: e8 69 0a 00 00 call 80102f50 iunlock(f->ip); 801024e7: 59 pop %ecx 801024e8: ff 73 10 push 0x10(%ebx) 801024eb: e8 60 08 00 00 call 80102d50 return 0; } return -1; } 801024f0: 8b 5d fc mov -0x4(%ebp),%ebx return 0; 801024f3: 83 c4 10 add $0x10,%esp 801024f6: 31 c0 xor %eax,%eax } 801024f8: c9 leave 801024f9: c3 ret 801024fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102500: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80102503: b8 ff ff ff ff mov $0xffffffff,%eax } 80102508: c9 leave 80102509: c3 ret 8010250a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102510 : // Read from file f. int fileread(struct file *f, char *addr, int n) { 80102510: 55 push %ebp 80102511: 89 e5 mov %esp,%ebp 80102513: 57 push %edi 80102514: 56 push %esi 80102515: 53 push %ebx 80102516: 83 ec 0c sub $0xc,%esp 80102519: 8b 5d 08 mov 0x8(%ebp),%ebx 8010251c: 8b 75 0c mov 0xc(%ebp),%esi 8010251f: 8b 7d 10 mov 0x10(%ebp),%edi int r; if (f->readable == 0) { 80102522: 80 7b 08 00 cmpb $0x0,0x8(%ebx) 80102526: 74 60 je 80102588 return -1; } if (f->type == FD_PIPE) { 80102528: 8b 03 mov (%ebx),%eax 8010252a: 83 f8 01 cmp $0x1,%eax 8010252d: 74 41 je 80102570 return piperead(f->pipe, addr, n); } if (f->type == FD_INODE) { 8010252f: 83 f8 02 cmp $0x2,%eax 80102532: 75 5b jne 8010258f ilock(f->ip); 80102534: 83 ec 0c sub $0xc,%esp 80102537: ff 73 10 push 0x10(%ebx) 8010253a: e8 31 07 00 00 call 80102c70 if ((r = readi(f->ip, addr, f->off, n)) > 0) { 8010253f: 57 push %edi 80102540: ff 73 14 push 0x14(%ebx) 80102543: 56 push %esi 80102544: ff 73 10 push 0x10(%ebx) 80102547: e8 34 0a 00 00 call 80102f80 8010254c: 83 c4 20 add $0x20,%esp 8010254f: 89 c6 mov %eax,%esi 80102551: 85 c0 test %eax,%eax 80102553: 7e 03 jle 80102558 f->off += r; 80102555: 01 43 14 add %eax,0x14(%ebx) } iunlock(f->ip); 80102558: 83 ec 0c sub $0xc,%esp 8010255b: ff 73 10 push 0x10(%ebx) 8010255e: e8 ed 07 00 00 call 80102d50 return r; 80102563: 83 c4 10 add $0x10,%esp } panic("fileread"); } 80102566: 8d 65 f4 lea -0xc(%ebp),%esp 80102569: 89 f0 mov %esi,%eax 8010256b: 5b pop %ebx 8010256c: 5e pop %esi 8010256d: 5f pop %edi 8010256e: 5d pop %ebp 8010256f: c3 ret return piperead(f->pipe, addr, n); 80102570: 8b 43 0c mov 0xc(%ebx),%eax 80102573: 89 45 08 mov %eax,0x8(%ebp) } 80102576: 8d 65 f4 lea -0xc(%ebp),%esp 80102579: 5b pop %ebx 8010257a: 5e pop %esi 8010257b: 5f pop %edi 8010257c: 5d pop %ebp return piperead(f->pipe, addr, n); 8010257d: e9 7e 26 00 00 jmp 80104c00 80102582: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return -1; 80102588: be ff ff ff ff mov $0xffffffff,%esi 8010258d: eb d7 jmp 80102566 panic("fileread"); 8010258f: 83 ec 0c sub $0xc,%esp 80102592: 68 c6 8a 10 80 push $0x80108ac6 80102597: e8 e4 de ff ff call 80100480 8010259c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801025a0 : // Write to file f. int filewrite(struct file *f, char *addr, int n) { 801025a0: 55 push %ebp 801025a1: 89 e5 mov %esp,%ebp 801025a3: 57 push %edi 801025a4: 56 push %esi 801025a5: 53 push %ebx 801025a6: 83 ec 1c sub $0x1c,%esp 801025a9: 8b 45 0c mov 0xc(%ebp),%eax 801025ac: 8b 5d 08 mov 0x8(%ebp),%ebx 801025af: 89 45 dc mov %eax,-0x24(%ebp) 801025b2: 8b 45 10 mov 0x10(%ebp),%eax int r; if (f->writable == 0) { 801025b5: 80 7b 09 00 cmpb $0x0,0x9(%ebx) int filewrite(struct file *f, char *addr, int n) { 801025b9: 89 45 e4 mov %eax,-0x1c(%ebp) if (f->writable == 0) { 801025bc: 0f 84 bd 00 00 00 je 8010267f return -1; } if (f->type == FD_PIPE) { 801025c2: 8b 03 mov (%ebx),%eax 801025c4: 83 f8 01 cmp $0x1,%eax 801025c7: 0f 84 bf 00 00 00 je 8010268c return pipewrite(f->pipe, addr, n); } if (f->type == FD_INODE) { 801025cd: 83 f8 02 cmp $0x2,%eax 801025d0: 0f 85 c8 00 00 00 jne 8010269e // 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) { 801025d6: 8b 45 e4 mov -0x1c(%ebp),%eax int i = 0; 801025d9: 31 f6 xor %esi,%esi while (i < n) { 801025db: 85 c0 test %eax,%eax 801025dd: 7f 30 jg 8010260f 801025df: e9 94 00 00 00 jmp 80102678 801025e4: 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; 801025e8: 01 43 14 add %eax,0x14(%ebx) } iunlock(f->ip); 801025eb: 83 ec 0c sub $0xc,%esp 801025ee: ff 73 10 push 0x10(%ebx) f->off += r; 801025f1: 89 45 e0 mov %eax,-0x20(%ebp) iunlock(f->ip); 801025f4: e8 57 07 00 00 call 80102d50 end_op(); 801025f9: e8 c2 1c 00 00 call 801042c0 if (r < 0) { break; } if (r != n1) { 801025fe: 8b 45 e0 mov -0x20(%ebp),%eax 80102601: 83 c4 10 add $0x10,%esp 80102604: 39 c7 cmp %eax,%edi 80102606: 75 5c jne 80102664 panic("short filewrite"); } i += r; 80102608: 01 fe add %edi,%esi while (i < n) { 8010260a: 39 75 e4 cmp %esi,-0x1c(%ebp) 8010260d: 7e 69 jle 80102678 int n1 = n - i; 8010260f: 8b 7d e4 mov -0x1c(%ebp),%edi 80102612: b8 00 06 00 00 mov $0x600,%eax 80102617: 29 f7 sub %esi,%edi 80102619: 39 c7 cmp %eax,%edi 8010261b: 0f 4f f8 cmovg %eax,%edi begin_op(); 8010261e: e8 2d 1c 00 00 call 80104250 ilock(f->ip); 80102623: 83 ec 0c sub $0xc,%esp 80102626: ff 73 10 push 0x10(%ebx) 80102629: e8 42 06 00 00 call 80102c70 if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) { 8010262e: 8b 45 dc mov -0x24(%ebp),%eax 80102631: 57 push %edi 80102632: ff 73 14 push 0x14(%ebx) 80102635: 01 f0 add %esi,%eax 80102637: 50 push %eax 80102638: ff 73 10 push 0x10(%ebx) 8010263b: e8 40 0a 00 00 call 80103080 80102640: 83 c4 20 add $0x20,%esp 80102643: 85 c0 test %eax,%eax 80102645: 7f a1 jg 801025e8 iunlock(f->ip); 80102647: 83 ec 0c sub $0xc,%esp 8010264a: ff 73 10 push 0x10(%ebx) 8010264d: 89 45 e4 mov %eax,-0x1c(%ebp) 80102650: e8 fb 06 00 00 call 80102d50 end_op(); 80102655: e8 66 1c 00 00 call 801042c0 if (r < 0) { 8010265a: 8b 45 e4 mov -0x1c(%ebp),%eax 8010265d: 83 c4 10 add $0x10,%esp 80102660: 85 c0 test %eax,%eax 80102662: 75 1b jne 8010267f panic("short filewrite"); 80102664: 83 ec 0c sub $0xc,%esp 80102667: 68 cf 8a 10 80 push $0x80108acf 8010266c: e8 0f de ff ff call 80100480 80102671: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } return i == n ? n : -1; 80102678: 89 f0 mov %esi,%eax 8010267a: 3b 75 e4 cmp -0x1c(%ebp),%esi 8010267d: 74 05 je 80102684 8010267f: b8 ff ff ff ff mov $0xffffffff,%eax } panic("filewrite"); } 80102684: 8d 65 f4 lea -0xc(%ebp),%esp 80102687: 5b pop %ebx 80102688: 5e pop %esi 80102689: 5f pop %edi 8010268a: 5d pop %ebp 8010268b: c3 ret return pipewrite(f->pipe, addr, n); 8010268c: 8b 43 0c mov 0xc(%ebx),%eax 8010268f: 89 45 08 mov %eax,0x8(%ebp) } 80102692: 8d 65 f4 lea -0xc(%ebp),%esp 80102695: 5b pop %ebx 80102696: 5e pop %esi 80102697: 5f pop %edi 80102698: 5d pop %ebp return pipewrite(f->pipe, addr, n); 80102699: e9 62 24 00 00 jmp 80104b00 panic("filewrite"); 8010269e: 83 ec 0c sub $0xc,%esp 801026a1: 68 d5 8a 10 80 push $0x80108ad5 801026a6: e8 d5 dd ff ff call 80100480 801026ab: 66 90 xchg %ax,%ax 801026ad: 66 90 xchg %ax,%ax 801026af: 90 nop 801026b0 : } panic("balloc: out of blocks"); } // Free a disk block. static void bfree(int dev, uint b) { 801026b0: 55 push %ebp 801026b1: 89 c1 mov %eax,%ecx struct buf *bp; int bi, m; bp = bread(dev, BBLOCK(b, sb)); 801026b3: 89 d0 mov %edx,%eax 801026b5: c1 e8 0c shr $0xc,%eax 801026b8: 03 05 4c dd 11 80 add 0x8011dd4c,%eax static void bfree(int dev, uint b) { 801026be: 89 e5 mov %esp,%ebp 801026c0: 56 push %esi 801026c1: 53 push %ebx 801026c2: 89 d3 mov %edx,%ebx bp = bread(dev, BBLOCK(b, sb)); 801026c4: 83 ec 08 sub $0x8,%esp 801026c7: 50 push %eax 801026c8: 51 push %ecx 801026c9: e8 02 da ff ff call 801000d0 bi = b % BPB; m = 1 << (bi % 8); 801026ce: 89 d9 mov %ebx,%ecx if ((bp->data[bi / 8] & m) == 0) { 801026d0: c1 fb 03 sar $0x3,%ebx 801026d3: 83 c4 10 add $0x10,%esp bp = bread(dev, BBLOCK(b, sb)); 801026d6: 89 c6 mov %eax,%esi m = 1 << (bi % 8); 801026d8: 83 e1 07 and $0x7,%ecx 801026db: b8 01 00 00 00 mov $0x1,%eax if ((bp->data[bi / 8] & m) == 0) { 801026e0: 81 e3 ff 01 00 00 and $0x1ff,%ebx m = 1 << (bi % 8); 801026e6: d3 e0 shl %cl,%eax if ((bp->data[bi / 8] & m) == 0) { 801026e8: 0f b6 4c 1e 5c movzbl 0x5c(%esi,%ebx,1),%ecx 801026ed: 85 c1 test %eax,%ecx 801026ef: 74 23 je 80102714 panic("freeing free block"); } bp->data[bi / 8] &= ~m; 801026f1: f7 d0 not %eax log_write(bp); 801026f3: 83 ec 0c sub $0xc,%esp bp->data[bi / 8] &= ~m; 801026f6: 21 c8 and %ecx,%eax 801026f8: 88 44 1e 5c mov %al,0x5c(%esi,%ebx,1) log_write(bp); 801026fc: 56 push %esi 801026fd: e8 2e 1d 00 00 call 80104430 brelse(bp); 80102702: 89 34 24 mov %esi,(%esp) 80102705: e8 e6 da ff ff call 801001f0 } 8010270a: 83 c4 10 add $0x10,%esp 8010270d: 8d 65 f8 lea -0x8(%ebp),%esp 80102710: 5b pop %ebx 80102711: 5e pop %esi 80102712: 5d pop %ebp 80102713: c3 ret panic("freeing free block"); 80102714: 83 ec 0c sub $0xc,%esp 80102717: 68 df 8a 10 80 push $0x80108adf 8010271c: e8 5f dd ff ff call 80100480 80102721: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102728: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010272f: 90 nop 80102730 : static uint balloc(uint dev) { 80102730: 55 push %ebp 80102731: 89 e5 mov %esp,%ebp 80102733: 57 push %edi 80102734: 56 push %esi 80102735: 53 push %ebx 80102736: 83 ec 1c sub $0x1c,%esp for (b = 0; b < sb.size; b += BPB) { 80102739: 8b 0d 34 dd 11 80 mov 0x8011dd34,%ecx static uint balloc(uint dev) { 8010273f: 89 45 d8 mov %eax,-0x28(%ebp) for (b = 0; b < sb.size; b += BPB) { 80102742: 85 c9 test %ecx,%ecx 80102744: 0f 84 87 00 00 00 je 801027d1 8010274a: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) bp = bread(dev, BBLOCK(b, sb)); 80102751: 8b 75 dc mov -0x24(%ebp),%esi 80102754: 83 ec 08 sub $0x8,%esp 80102757: 89 f0 mov %esi,%eax 80102759: c1 f8 0c sar $0xc,%eax 8010275c: 03 05 4c dd 11 80 add 0x8011dd4c,%eax 80102762: 50 push %eax 80102763: ff 75 d8 push -0x28(%ebp) 80102766: e8 65 d9 ff ff call 801000d0 8010276b: 83 c4 10 add $0x10,%esp 8010276e: 89 45 e4 mov %eax,-0x1c(%ebp) for (bi = 0; bi < BPB && b + bi < sb.size; bi++) { 80102771: a1 34 dd 11 80 mov 0x8011dd34,%eax 80102776: 89 45 e0 mov %eax,-0x20(%ebp) 80102779: 31 c0 xor %eax,%eax 8010277b: eb 2f jmp 801027ac 8010277d: 8d 76 00 lea 0x0(%esi),%esi m = 1 << (bi % 8); 80102780: 89 c1 mov %eax,%ecx 80102782: bb 01 00 00 00 mov $0x1,%ebx if ((bp->data[bi / 8] & m) == 0) { // Is block free? 80102787: 8b 55 e4 mov -0x1c(%ebp),%edx m = 1 << (bi % 8); 8010278a: 83 e1 07 and $0x7,%ecx 8010278d: d3 e3 shl %cl,%ebx if ((bp->data[bi / 8] & m) == 0) { // Is block free? 8010278f: 89 c1 mov %eax,%ecx 80102791: c1 f9 03 sar $0x3,%ecx 80102794: 0f b6 7c 0a 5c movzbl 0x5c(%edx,%ecx,1),%edi 80102799: 89 fa mov %edi,%edx 8010279b: 85 df test %ebx,%edi 8010279d: 74 41 je 801027e0 for (bi = 0; bi < BPB && b + bi < sb.size; bi++) { 8010279f: 83 c0 01 add $0x1,%eax 801027a2: 83 c6 01 add $0x1,%esi 801027a5: 3d 00 10 00 00 cmp $0x1000,%eax 801027aa: 74 05 je 801027b1 801027ac: 39 75 e0 cmp %esi,-0x20(%ebp) 801027af: 77 cf ja 80102780 brelse(bp); 801027b1: 83 ec 0c sub $0xc,%esp 801027b4: ff 75 e4 push -0x1c(%ebp) 801027b7: e8 34 da ff ff call 801001f0 for (b = 0; b < sb.size; b += BPB) { 801027bc: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp) 801027c3: 83 c4 10 add $0x10,%esp 801027c6: 8b 45 dc mov -0x24(%ebp),%eax 801027c9: 39 05 34 dd 11 80 cmp %eax,0x8011dd34 801027cf: 77 80 ja 80102751 panic("balloc: out of blocks"); 801027d1: 83 ec 0c sub $0xc,%esp 801027d4: 68 f2 8a 10 80 push $0x80108af2 801027d9: e8 a2 dc ff ff call 80100480 801027de: 66 90 xchg %ax,%ax bp->data[bi / 8] |= m; // Mark block in use. 801027e0: 8b 7d e4 mov -0x1c(%ebp),%edi log_write(bp); 801027e3: 83 ec 0c sub $0xc,%esp bp->data[bi / 8] |= m; // Mark block in use. 801027e6: 09 da or %ebx,%edx 801027e8: 88 54 0f 5c mov %dl,0x5c(%edi,%ecx,1) log_write(bp); 801027ec: 57 push %edi 801027ed: e8 3e 1c 00 00 call 80104430 brelse(bp); 801027f2: 89 3c 24 mov %edi,(%esp) 801027f5: e8 f6 d9 ff ff call 801001f0 bp = bread(dev, bno); 801027fa: 58 pop %eax 801027fb: 5a pop %edx 801027fc: 56 push %esi 801027fd: ff 75 d8 push -0x28(%ebp) 80102800: e8 cb d8 ff ff call 801000d0 memset(bp->data, 0, BSIZE); 80102805: 83 c4 0c add $0xc,%esp bp = bread(dev, bno); 80102808: 89 c3 mov %eax,%ebx memset(bp->data, 0, BSIZE); 8010280a: 8d 40 5c lea 0x5c(%eax),%eax 8010280d: 68 00 02 00 00 push $0x200 80102812: 6a 00 push $0x0 80102814: 50 push %eax 80102815: e8 26 34 00 00 call 80105c40 log_write(bp); 8010281a: 89 1c 24 mov %ebx,(%esp) 8010281d: e8 0e 1c 00 00 call 80104430 brelse(bp); 80102822: 89 1c 24 mov %ebx,(%esp) 80102825: e8 c6 d9 ff ff call 801001f0 } 8010282a: 8d 65 f4 lea -0xc(%ebp),%esp 8010282d: 89 f0 mov %esi,%eax 8010282f: 5b pop %ebx 80102830: 5e pop %esi 80102831: 5f pop %edi 80102832: 5d pop %ebp 80102833: c3 ret 80102834: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010283b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010283f: 90 nop 80102840 : } // 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) { 80102840: 55 push %ebp 80102841: 89 e5 mov %esp,%ebp 80102843: 57 push %edi 80102844: 89 c7 mov %eax,%edi 80102846: 56 push %esi struct inode *ip, *empty; acquire(&icache.lock); // Is the inode already cached? empty = 0; 80102847: 31 f6 xor %esi,%esi static struct inode* iget(uint dev, uint inum) { 80102849: 53 push %ebx for (ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++) { 8010284a: bb 14 c1 11 80 mov $0x8011c114,%ebx static struct inode* iget(uint dev, uint inum) { 8010284f: 83 ec 28 sub $0x28,%esp 80102852: 89 55 e4 mov %edx,-0x1c(%ebp) acquire(&icache.lock); 80102855: 68 e0 c0 11 80 push $0x8011c0e0 8010285a: e8 21 33 00 00 call 80105b80 for (ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++) { 8010285f: 8b 55 e4 mov -0x1c(%ebp),%edx acquire(&icache.lock); 80102862: 83 c4 10 add $0x10,%esp 80102865: eb 1b jmp 80102882 80102867: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010286e: 66 90 xchg %ax,%ax if (ip->ref > 0 && ip->dev == dev && ip->inum == inum) { 80102870: 39 3b cmp %edi,(%ebx) 80102872: 74 6c je 801028e0 for (ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++) { 80102874: 81 c3 90 00 00 00 add $0x90,%ebx 8010287a: 81 fb 34 dd 11 80 cmp $0x8011dd34,%ebx 80102880: 73 26 jae 801028a8 if (ip->ref > 0 && ip->dev == dev && ip->inum == inum) { 80102882: 8b 43 08 mov 0x8(%ebx),%eax 80102885: 85 c0 test %eax,%eax 80102887: 7f e7 jg 80102870 ip->ref++; release(&icache.lock); return ip; } if (empty == 0 && ip->ref == 0) { // Remember empty slot. 80102889: 85 f6 test %esi,%esi 8010288b: 75 e7 jne 80102874 8010288d: 85 c0 test %eax,%eax 8010288f: 75 76 jne 80102907 80102891: 89 de mov %ebx,%esi for (ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++) { 80102893: 81 c3 90 00 00 00 add $0x90,%ebx 80102899: 81 fb 34 dd 11 80 cmp $0x8011dd34,%ebx 8010289f: 72 e1 jb 80102882 801028a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi empty = ip; } } // Recycle an inode cache entry. if (empty == 0) { 801028a8: 85 f6 test %esi,%esi 801028aa: 74 79 je 80102925 ip = empty; ip->dev = dev; ip->inum = inum; ip->ref = 1; ip->valid = 0; release(&icache.lock); 801028ac: 83 ec 0c sub $0xc,%esp ip->dev = dev; 801028af: 89 3e mov %edi,(%esi) ip->inum = inum; 801028b1: 89 56 04 mov %edx,0x4(%esi) ip->ref = 1; 801028b4: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi) ip->valid = 0; 801028bb: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi) release(&icache.lock); 801028c2: 68 e0 c0 11 80 push $0x8011c0e0 801028c7: e8 54 32 00 00 call 80105b20 return ip; 801028cc: 83 c4 10 add $0x10,%esp } 801028cf: 8d 65 f4 lea -0xc(%ebp),%esp 801028d2: 89 f0 mov %esi,%eax 801028d4: 5b pop %ebx 801028d5: 5e pop %esi 801028d6: 5f pop %edi 801028d7: 5d pop %ebp 801028d8: c3 ret 801028d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (ip->ref > 0 && ip->dev == dev && ip->inum == inum) { 801028e0: 39 53 04 cmp %edx,0x4(%ebx) 801028e3: 75 8f jne 80102874 release(&icache.lock); 801028e5: 83 ec 0c sub $0xc,%esp ip->ref++; 801028e8: 83 c0 01 add $0x1,%eax return ip; 801028eb: 89 de mov %ebx,%esi release(&icache.lock); 801028ed: 68 e0 c0 11 80 push $0x8011c0e0 ip->ref++; 801028f2: 89 43 08 mov %eax,0x8(%ebx) release(&icache.lock); 801028f5: e8 26 32 00 00 call 80105b20 return ip; 801028fa: 83 c4 10 add $0x10,%esp } 801028fd: 8d 65 f4 lea -0xc(%ebp),%esp 80102900: 89 f0 mov %esi,%eax 80102902: 5b pop %ebx 80102903: 5e pop %esi 80102904: 5f pop %edi 80102905: 5d pop %ebp 80102906: c3 ret for (ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++) { 80102907: 81 c3 90 00 00 00 add $0x90,%ebx 8010290d: 81 fb 34 dd 11 80 cmp $0x8011dd34,%ebx 80102913: 73 10 jae 80102925 if (ip->ref > 0 && ip->dev == dev && ip->inum == inum) { 80102915: 8b 43 08 mov 0x8(%ebx),%eax 80102918: 85 c0 test %eax,%eax 8010291a: 0f 8f 50 ff ff ff jg 80102870 80102920: e9 68 ff ff ff jmp 8010288d panic("iget: no inodes"); 80102925: 83 ec 0c sub $0xc,%esp 80102928: 68 08 8b 10 80 push $0x80108b08 8010292d: e8 4e db ff ff call 80100480 80102932: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102939: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102940 : // 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) { 80102940: 55 push %ebp 80102941: 89 e5 mov %esp,%ebp 80102943: 57 push %edi 80102944: 56 push %esi 80102945: 89 c6 mov %eax,%esi 80102947: 53 push %ebx 80102948: 83 ec 1c sub $0x1c,%esp uint addr, *a; struct buf *bp; if (bn < NDIRECT) { 8010294b: 83 fa 0b cmp $0xb,%edx 8010294e: 0f 86 8c 00 00 00 jbe 801029e0 if ((addr = ip->addrs[bn]) == 0) { ip->addrs[bn] = addr = balloc(ip->dev); } return addr; } bn -= NDIRECT; 80102954: 8d 5a f4 lea -0xc(%edx),%ebx if (bn < NINDIRECT) { 80102957: 83 fb 7f cmp $0x7f,%ebx 8010295a: 0f 87 a2 00 00 00 ja 80102a02 // Load indirect block, allocating if necessary. if ((addr = ip->addrs[NDIRECT]) == 0) { 80102960: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax 80102966: 85 c0 test %eax,%eax 80102968: 74 5e je 801029c8 ip->addrs[NDIRECT] = addr = balloc(ip->dev); } bp = bread(ip->dev, addr); 8010296a: 83 ec 08 sub $0x8,%esp 8010296d: 50 push %eax 8010296e: ff 36 push (%esi) 80102970: e8 5b d7 ff ff call 801000d0 a = (uint*)bp->data; if ((addr = a[bn]) == 0) { 80102975: 83 c4 10 add $0x10,%esp 80102978: 8d 5c 98 5c lea 0x5c(%eax,%ebx,4),%ebx bp = bread(ip->dev, addr); 8010297c: 89 c2 mov %eax,%edx if ((addr = a[bn]) == 0) { 8010297e: 8b 3b mov (%ebx),%edi 80102980: 85 ff test %edi,%edi 80102982: 74 1c je 801029a0 a[bn] = addr = balloc(ip->dev); log_write(bp); } brelse(bp); 80102984: 83 ec 0c sub $0xc,%esp 80102987: 52 push %edx 80102988: e8 63 d8 ff ff call 801001f0 8010298d: 83 c4 10 add $0x10,%esp return addr; } panic("bmap: out of range"); } 80102990: 8d 65 f4 lea -0xc(%ebp),%esp 80102993: 89 f8 mov %edi,%eax 80102995: 5b pop %ebx 80102996: 5e pop %esi 80102997: 5f pop %edi 80102998: 5d pop %ebp 80102999: c3 ret 8010299a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801029a0: 89 45 e4 mov %eax,-0x1c(%ebp) a[bn] = addr = balloc(ip->dev); 801029a3: 8b 06 mov (%esi),%eax 801029a5: e8 86 fd ff ff call 80102730 log_write(bp); 801029aa: 8b 55 e4 mov -0x1c(%ebp),%edx 801029ad: 83 ec 0c sub $0xc,%esp a[bn] = addr = balloc(ip->dev); 801029b0: 89 03 mov %eax,(%ebx) 801029b2: 89 c7 mov %eax,%edi log_write(bp); 801029b4: 52 push %edx 801029b5: e8 76 1a 00 00 call 80104430 801029ba: 8b 55 e4 mov -0x1c(%ebp),%edx 801029bd: 83 c4 10 add $0x10,%esp 801029c0: eb c2 jmp 80102984 801029c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ip->addrs[NDIRECT] = addr = balloc(ip->dev); 801029c8: 8b 06 mov (%esi),%eax 801029ca: e8 61 fd ff ff call 80102730 801029cf: 89 86 8c 00 00 00 mov %eax,0x8c(%esi) 801029d5: eb 93 jmp 8010296a 801029d7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801029de: 66 90 xchg %ax,%ax if ((addr = ip->addrs[bn]) == 0) { 801029e0: 8d 5a 14 lea 0x14(%edx),%ebx 801029e3: 8b 7c 98 0c mov 0xc(%eax,%ebx,4),%edi 801029e7: 85 ff test %edi,%edi 801029e9: 75 a5 jne 80102990 ip->addrs[bn] = addr = balloc(ip->dev); 801029eb: 8b 00 mov (%eax),%eax 801029ed: e8 3e fd ff ff call 80102730 801029f2: 89 44 9e 0c mov %eax,0xc(%esi,%ebx,4) 801029f6: 89 c7 mov %eax,%edi } 801029f8: 8d 65 f4 lea -0xc(%ebp),%esp 801029fb: 5b pop %ebx 801029fc: 89 f8 mov %edi,%eax 801029fe: 5e pop %esi 801029ff: 5f pop %edi 80102a00: 5d pop %ebp 80102a01: c3 ret panic("bmap: out of range"); 80102a02: 83 ec 0c sub $0xc,%esp 80102a05: 68 18 8b 10 80 push $0x80108b18 80102a0a: e8 71 da ff ff call 80100480 80102a0f: 90 nop 80102a10 : void readsb(int dev, struct superblock *sb) { 80102a10: 55 push %ebp 80102a11: 89 e5 mov %esp,%ebp 80102a13: 56 push %esi 80102a14: 53 push %ebx 80102a15: 8b 75 0c mov 0xc(%ebp),%esi bp = bread(dev, 1); 80102a18: 83 ec 08 sub $0x8,%esp 80102a1b: 6a 01 push $0x1 80102a1d: ff 75 08 push 0x8(%ebp) 80102a20: e8 ab d6 ff ff call 801000d0 memmove(sb, bp->data, sizeof(*sb)); 80102a25: 83 c4 0c add $0xc,%esp bp = bread(dev, 1); 80102a28: 89 c3 mov %eax,%ebx memmove(sb, bp->data, sizeof(*sb)); 80102a2a: 8d 40 5c lea 0x5c(%eax),%eax 80102a2d: 6a 1c push $0x1c 80102a2f: 50 push %eax 80102a30: 56 push %esi 80102a31: e8 aa 32 00 00 call 80105ce0 brelse(bp); 80102a36: 89 5d 08 mov %ebx,0x8(%ebp) 80102a39: 83 c4 10 add $0x10,%esp } 80102a3c: 8d 65 f8 lea -0x8(%ebp),%esp 80102a3f: 5b pop %ebx 80102a40: 5e pop %esi 80102a41: 5d pop %ebp brelse(bp); 80102a42: e9 a9 d7 ff ff jmp 801001f0 80102a47: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102a4e: 66 90 xchg %ax,%ax 80102a50 : void iinit(int dev) { 80102a50: 55 push %ebp 80102a51: 89 e5 mov %esp,%ebp 80102a53: 53 push %ebx 80102a54: bb 20 c1 11 80 mov $0x8011c120,%ebx 80102a59: 83 ec 0c sub $0xc,%esp initlock(&icache.lock, "icache"); 80102a5c: 68 2b 8b 10 80 push $0x80108b2b 80102a61: 68 e0 c0 11 80 push $0x8011c0e0 80102a66: e8 45 2f 00 00 call 801059b0 for (i = 0; i < NINODE; i++) { 80102a6b: 83 c4 10 add $0x10,%esp 80102a6e: 66 90 xchg %ax,%ax initsleeplock(&icache.inode[i].lock, "inode"); 80102a70: 83 ec 08 sub $0x8,%esp 80102a73: 68 32 8b 10 80 push $0x80108b32 80102a78: 53 push %ebx for (i = 0; i < NINODE; i++) { 80102a79: 81 c3 90 00 00 00 add $0x90,%ebx initsleeplock(&icache.inode[i].lock, "inode"); 80102a7f: e8 fc 2d 00 00 call 80105880 for (i = 0; i < NINODE; i++) { 80102a84: 83 c4 10 add $0x10,%esp 80102a87: 81 fb 40 dd 11 80 cmp $0x8011dd40,%ebx 80102a8d: 75 e1 jne 80102a70 bp = bread(dev, 1); 80102a8f: 83 ec 08 sub $0x8,%esp 80102a92: 6a 01 push $0x1 80102a94: ff 75 08 push 0x8(%ebp) 80102a97: e8 34 d6 ff ff call 801000d0 memmove(sb, bp->data, sizeof(*sb)); 80102a9c: 83 c4 0c add $0xc,%esp bp = bread(dev, 1); 80102a9f: 89 c3 mov %eax,%ebx memmove(sb, bp->data, sizeof(*sb)); 80102aa1: 8d 40 5c lea 0x5c(%eax),%eax 80102aa4: 6a 1c push $0x1c 80102aa6: 50 push %eax 80102aa7: 68 34 dd 11 80 push $0x8011dd34 80102aac: e8 2f 32 00 00 call 80105ce0 brelse(bp); 80102ab1: 89 1c 24 mov %ebx,(%esp) 80102ab4: e8 37 d7 ff ff call 801001f0 cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\ 80102ab9: ff 35 4c dd 11 80 push 0x8011dd4c 80102abf: ff 35 48 dd 11 80 push 0x8011dd48 80102ac5: ff 35 44 dd 11 80 push 0x8011dd44 80102acb: ff 35 40 dd 11 80 push 0x8011dd40 80102ad1: ff 35 3c dd 11 80 push 0x8011dd3c 80102ad7: ff 35 38 dd 11 80 push 0x8011dd38 80102add: ff 35 34 dd 11 80 push 0x8011dd34 80102ae3: 68 98 8b 10 80 push $0x80108b98 80102ae8: e8 a3 dd ff ff call 80100890 } 80102aed: 8b 5d fc mov -0x4(%ebp),%ebx 80102af0: 83 c4 30 add $0x30,%esp 80102af3: c9 leave 80102af4: c3 ret 80102af5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102afc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102b00 : struct inode* ialloc(uint dev, short type) { 80102b00: 55 push %ebp 80102b01: 89 e5 mov %esp,%ebp 80102b03: 57 push %edi 80102b04: 56 push %esi 80102b05: 53 push %ebx 80102b06: 83 ec 1c sub $0x1c,%esp 80102b09: 8b 45 0c mov 0xc(%ebp),%eax for (inum = 1; inum < sb.ninodes; inum++) { 80102b0c: 83 3d 3c dd 11 80 01 cmpl $0x1,0x8011dd3c struct inode* ialloc(uint dev, short type) { 80102b13: 8b 75 08 mov 0x8(%ebp),%esi 80102b16: 89 45 e4 mov %eax,-0x1c(%ebp) for (inum = 1; inum < sb.ninodes; inum++) { 80102b19: 0f 86 91 00 00 00 jbe 80102bb0 80102b1f: bf 01 00 00 00 mov $0x1,%edi 80102b24: eb 21 jmp 80102b47 80102b26: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102b2d: 8d 76 00 lea 0x0(%esi),%esi brelse(bp); 80102b30: 83 ec 0c sub $0xc,%esp for (inum = 1; inum < sb.ninodes; inum++) { 80102b33: 83 c7 01 add $0x1,%edi brelse(bp); 80102b36: 53 push %ebx 80102b37: e8 b4 d6 ff ff call 801001f0 for (inum = 1; inum < sb.ninodes; inum++) { 80102b3c: 83 c4 10 add $0x10,%esp 80102b3f: 3b 3d 3c dd 11 80 cmp 0x8011dd3c,%edi 80102b45: 73 69 jae 80102bb0 bp = bread(dev, IBLOCK(inum, sb)); 80102b47: 89 f8 mov %edi,%eax 80102b49: 83 ec 08 sub $0x8,%esp 80102b4c: c1 e8 03 shr $0x3,%eax 80102b4f: 03 05 48 dd 11 80 add 0x8011dd48,%eax 80102b55: 50 push %eax 80102b56: 56 push %esi 80102b57: e8 74 d5 ff ff call 801000d0 if (dip->type == 0) { // a free inode 80102b5c: 83 c4 10 add $0x10,%esp bp = bread(dev, IBLOCK(inum, sb)); 80102b5f: 89 c3 mov %eax,%ebx dip = (struct dinode*)bp->data + inum % IPB; 80102b61: 89 f8 mov %edi,%eax 80102b63: 83 e0 07 and $0x7,%eax 80102b66: c1 e0 06 shl $0x6,%eax 80102b69: 8d 4c 03 5c lea 0x5c(%ebx,%eax,1),%ecx if (dip->type == 0) { // a free inode 80102b6d: 66 83 39 00 cmpw $0x0,(%ecx) 80102b71: 75 bd jne 80102b30 memset(dip, 0, sizeof(*dip)); 80102b73: 83 ec 04 sub $0x4,%esp 80102b76: 89 4d e0 mov %ecx,-0x20(%ebp) 80102b79: 6a 40 push $0x40 80102b7b: 6a 00 push $0x0 80102b7d: 51 push %ecx 80102b7e: e8 bd 30 00 00 call 80105c40 dip->type = type; 80102b83: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax 80102b87: 8b 4d e0 mov -0x20(%ebp),%ecx 80102b8a: 66 89 01 mov %ax,(%ecx) log_write(bp); // mark it allocated on the disk 80102b8d: 89 1c 24 mov %ebx,(%esp) 80102b90: e8 9b 18 00 00 call 80104430 brelse(bp); 80102b95: 89 1c 24 mov %ebx,(%esp) 80102b98: e8 53 d6 ff ff call 801001f0 return iget(dev, inum); 80102b9d: 83 c4 10 add $0x10,%esp } 80102ba0: 8d 65 f4 lea -0xc(%ebp),%esp return iget(dev, inum); 80102ba3: 89 fa mov %edi,%edx } 80102ba5: 5b pop %ebx return iget(dev, inum); 80102ba6: 89 f0 mov %esi,%eax } 80102ba8: 5e pop %esi 80102ba9: 5f pop %edi 80102baa: 5d pop %ebp return iget(dev, inum); 80102bab: e9 90 fc ff ff jmp 80102840 panic("ialloc: no inodes"); 80102bb0: 83 ec 0c sub $0xc,%esp 80102bb3: 68 38 8b 10 80 push $0x80108b38 80102bb8: e8 c3 d8 ff ff call 80100480 80102bbd: 8d 76 00 lea 0x0(%esi),%esi 80102bc0 : void iupdate(struct inode *ip) { 80102bc0: 55 push %ebp 80102bc1: 89 e5 mov %esp,%ebp 80102bc3: 56 push %esi 80102bc4: 53 push %ebx 80102bc5: 8b 5d 08 mov 0x8(%ebp),%ebx bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 80102bc8: 8b 43 04 mov 0x4(%ebx),%eax memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 80102bcb: 83 c3 5c add $0x5c,%ebx bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 80102bce: 83 ec 08 sub $0x8,%esp 80102bd1: c1 e8 03 shr $0x3,%eax 80102bd4: 03 05 48 dd 11 80 add 0x8011dd48,%eax 80102bda: 50 push %eax 80102bdb: ff 73 a4 push -0x5c(%ebx) 80102bde: e8 ed d4 ff ff call 801000d0 dip->type = ip->type; 80102be3: 0f b7 53 f4 movzwl -0xc(%ebx),%edx memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 80102be7: 83 c4 0c add $0xc,%esp bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 80102bea: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum % IPB; 80102bec: 8b 43 a8 mov -0x58(%ebx),%eax 80102bef: 83 e0 07 and $0x7,%eax 80102bf2: c1 e0 06 shl $0x6,%eax 80102bf5: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax dip->type = ip->type; 80102bf9: 66 89 10 mov %dx,(%eax) dip->major = ip->major; 80102bfc: 0f b7 53 f6 movzwl -0xa(%ebx),%edx memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 80102c00: 83 c0 0c add $0xc,%eax dip->major = ip->major; 80102c03: 66 89 50 f6 mov %dx,-0xa(%eax) dip->minor = ip->minor; 80102c07: 0f b7 53 f8 movzwl -0x8(%ebx),%edx 80102c0b: 66 89 50 f8 mov %dx,-0x8(%eax) dip->nlink = ip->nlink; 80102c0f: 0f b7 53 fa movzwl -0x6(%ebx),%edx 80102c13: 66 89 50 fa mov %dx,-0x6(%eax) dip->size = ip->size; 80102c17: 8b 53 fc mov -0x4(%ebx),%edx 80102c1a: 89 50 fc mov %edx,-0x4(%eax) memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 80102c1d: 6a 34 push $0x34 80102c1f: 53 push %ebx 80102c20: 50 push %eax 80102c21: e8 ba 30 00 00 call 80105ce0 log_write(bp); 80102c26: 89 34 24 mov %esi,(%esp) 80102c29: e8 02 18 00 00 call 80104430 brelse(bp); 80102c2e: 89 75 08 mov %esi,0x8(%ebp) 80102c31: 83 c4 10 add $0x10,%esp } 80102c34: 8d 65 f8 lea -0x8(%ebp),%esp 80102c37: 5b pop %ebx 80102c38: 5e pop %esi 80102c39: 5d pop %ebp brelse(bp); 80102c3a: e9 b1 d5 ff ff jmp 801001f0 80102c3f: 90 nop 80102c40 : struct inode* idup(struct inode *ip) { 80102c40: 55 push %ebp 80102c41: 89 e5 mov %esp,%ebp 80102c43: 53 push %ebx 80102c44: 83 ec 10 sub $0x10,%esp 80102c47: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&icache.lock); 80102c4a: 68 e0 c0 11 80 push $0x8011c0e0 80102c4f: e8 2c 2f 00 00 call 80105b80 ip->ref++; 80102c54: 83 43 08 01 addl $0x1,0x8(%ebx) release(&icache.lock); 80102c58: c7 04 24 e0 c0 11 80 movl $0x8011c0e0,(%esp) 80102c5f: e8 bc 2e 00 00 call 80105b20 } 80102c64: 89 d8 mov %ebx,%eax 80102c66: 8b 5d fc mov -0x4(%ebp),%ebx 80102c69: c9 leave 80102c6a: c3 ret 80102c6b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102c6f: 90 nop 80102c70 : void ilock(struct inode *ip) { 80102c70: 55 push %ebp 80102c71: 89 e5 mov %esp,%ebp 80102c73: 56 push %esi 80102c74: 53 push %ebx 80102c75: 8b 5d 08 mov 0x8(%ebp),%ebx if (ip == 0 || ip->ref < 1) { 80102c78: 85 db test %ebx,%ebx 80102c7a: 0f 84 b7 00 00 00 je 80102d37 80102c80: 8b 53 08 mov 0x8(%ebx),%edx 80102c83: 85 d2 test %edx,%edx 80102c85: 0f 8e ac 00 00 00 jle 80102d37 acquiresleep(&ip->lock); 80102c8b: 83 ec 0c sub $0xc,%esp 80102c8e: 8d 43 0c lea 0xc(%ebx),%eax 80102c91: 50 push %eax 80102c92: e8 29 2c 00 00 call 801058c0 if (ip->valid == 0) { 80102c97: 8b 43 4c mov 0x4c(%ebx),%eax 80102c9a: 83 c4 10 add $0x10,%esp 80102c9d: 85 c0 test %eax,%eax 80102c9f: 74 0f je 80102cb0 } 80102ca1: 8d 65 f8 lea -0x8(%ebp),%esp 80102ca4: 5b pop %ebx 80102ca5: 5e pop %esi 80102ca6: 5d pop %ebp 80102ca7: c3 ret 80102ca8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102caf: 90 nop bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 80102cb0: 8b 43 04 mov 0x4(%ebx),%eax 80102cb3: 83 ec 08 sub $0x8,%esp 80102cb6: c1 e8 03 shr $0x3,%eax 80102cb9: 03 05 48 dd 11 80 add 0x8011dd48,%eax 80102cbf: 50 push %eax 80102cc0: ff 33 push (%ebx) 80102cc2: e8 09 d4 ff ff call 801000d0 memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 80102cc7: 83 c4 0c add $0xc,%esp bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 80102cca: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum % IPB; 80102ccc: 8b 43 04 mov 0x4(%ebx),%eax 80102ccf: 83 e0 07 and $0x7,%eax 80102cd2: c1 e0 06 shl $0x6,%eax 80102cd5: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax ip->type = dip->type; 80102cd9: 0f b7 10 movzwl (%eax),%edx memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 80102cdc: 83 c0 0c add $0xc,%eax ip->type = dip->type; 80102cdf: 66 89 53 50 mov %dx,0x50(%ebx) ip->major = dip->major; 80102ce3: 0f b7 50 f6 movzwl -0xa(%eax),%edx 80102ce7: 66 89 53 52 mov %dx,0x52(%ebx) ip->minor = dip->minor; 80102ceb: 0f b7 50 f8 movzwl -0x8(%eax),%edx 80102cef: 66 89 53 54 mov %dx,0x54(%ebx) ip->nlink = dip->nlink; 80102cf3: 0f b7 50 fa movzwl -0x6(%eax),%edx 80102cf7: 66 89 53 56 mov %dx,0x56(%ebx) ip->size = dip->size; 80102cfb: 8b 50 fc mov -0x4(%eax),%edx 80102cfe: 89 53 58 mov %edx,0x58(%ebx) memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 80102d01: 6a 34 push $0x34 80102d03: 50 push %eax 80102d04: 8d 43 5c lea 0x5c(%ebx),%eax 80102d07: 50 push %eax 80102d08: e8 d3 2f 00 00 call 80105ce0 brelse(bp); 80102d0d: 89 34 24 mov %esi,(%esp) 80102d10: e8 db d4 ff ff call 801001f0 if (ip->type == 0) { 80102d15: 83 c4 10 add $0x10,%esp 80102d18: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx) ip->valid = 1; 80102d1d: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) if (ip->type == 0) { 80102d24: 0f 85 77 ff ff ff jne 80102ca1 panic("ilock: no type"); 80102d2a: 83 ec 0c sub $0xc,%esp 80102d2d: 68 50 8b 10 80 push $0x80108b50 80102d32: e8 49 d7 ff ff call 80100480 panic("ilock"); 80102d37: 83 ec 0c sub $0xc,%esp 80102d3a: 68 4a 8b 10 80 push $0x80108b4a 80102d3f: e8 3c d7 ff ff call 80100480 80102d44: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102d4b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102d4f: 90 nop 80102d50 : void iunlock(struct inode *ip) { 80102d50: 55 push %ebp 80102d51: 89 e5 mov %esp,%ebp 80102d53: 56 push %esi 80102d54: 53 push %ebx 80102d55: 8b 5d 08 mov 0x8(%ebp),%ebx if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80102d58: 85 db test %ebx,%ebx 80102d5a: 74 28 je 80102d84 80102d5c: 83 ec 0c sub $0xc,%esp 80102d5f: 8d 73 0c lea 0xc(%ebx),%esi 80102d62: 56 push %esi 80102d63: e8 f8 2b 00 00 call 80105960 80102d68: 83 c4 10 add $0x10,%esp 80102d6b: 85 c0 test %eax,%eax 80102d6d: 74 15 je 80102d84 80102d6f: 8b 43 08 mov 0x8(%ebx),%eax 80102d72: 85 c0 test %eax,%eax 80102d74: 7e 0e jle 80102d84 releasesleep(&ip->lock); 80102d76: 89 75 08 mov %esi,0x8(%ebp) } 80102d79: 8d 65 f8 lea -0x8(%ebp),%esp 80102d7c: 5b pop %ebx 80102d7d: 5e pop %esi 80102d7e: 5d pop %ebp releasesleep(&ip->lock); 80102d7f: e9 9c 2b 00 00 jmp 80105920 panic("iunlock"); 80102d84: 83 ec 0c sub $0xc,%esp 80102d87: 68 5f 8b 10 80 push $0x80108b5f 80102d8c: e8 ef d6 ff ff call 80100480 80102d91: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102d98: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102d9f: 90 nop 80102da0 : void iput(struct inode *ip) { 80102da0: 55 push %ebp 80102da1: 89 e5 mov %esp,%ebp 80102da3: 57 push %edi 80102da4: 56 push %esi 80102da5: 53 push %ebx 80102da6: 83 ec 28 sub $0x28,%esp 80102da9: 8b 5d 08 mov 0x8(%ebp),%ebx acquiresleep(&ip->lock); 80102dac: 8d 7b 0c lea 0xc(%ebx),%edi 80102daf: 57 push %edi 80102db0: e8 0b 2b 00 00 call 801058c0 if (ip->valid && ip->nlink == 0) { 80102db5: 8b 53 4c mov 0x4c(%ebx),%edx 80102db8: 83 c4 10 add $0x10,%esp 80102dbb: 85 d2 test %edx,%edx 80102dbd: 74 07 je 80102dc6 80102dbf: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) 80102dc4: 74 32 je 80102df8 releasesleep(&ip->lock); 80102dc6: 83 ec 0c sub $0xc,%esp 80102dc9: 57 push %edi 80102dca: e8 51 2b 00 00 call 80105920 acquire(&icache.lock); 80102dcf: c7 04 24 e0 c0 11 80 movl $0x8011c0e0,(%esp) 80102dd6: e8 a5 2d 00 00 call 80105b80 ip->ref--; 80102ddb: 83 6b 08 01 subl $0x1,0x8(%ebx) release(&icache.lock); 80102ddf: 83 c4 10 add $0x10,%esp 80102de2: c7 45 08 e0 c0 11 80 movl $0x8011c0e0,0x8(%ebp) } 80102de9: 8d 65 f4 lea -0xc(%ebp),%esp 80102dec: 5b pop %ebx 80102ded: 5e pop %esi 80102dee: 5f pop %edi 80102def: 5d pop %ebp release(&icache.lock); 80102df0: e9 2b 2d 00 00 jmp 80105b20 80102df5: 8d 76 00 lea 0x0(%esi),%esi acquire(&icache.lock); 80102df8: 83 ec 0c sub $0xc,%esp 80102dfb: 68 e0 c0 11 80 push $0x8011c0e0 80102e00: e8 7b 2d 00 00 call 80105b80 int r = ip->ref; 80102e05: 8b 73 08 mov 0x8(%ebx),%esi release(&icache.lock); 80102e08: c7 04 24 e0 c0 11 80 movl $0x8011c0e0,(%esp) 80102e0f: e8 0c 2d 00 00 call 80105b20 if (r == 1) { 80102e14: 83 c4 10 add $0x10,%esp 80102e17: 83 fe 01 cmp $0x1,%esi 80102e1a: 75 aa jne 80102dc6 80102e1c: 8d 8b 8c 00 00 00 lea 0x8c(%ebx),%ecx 80102e22: 89 7d e4 mov %edi,-0x1c(%ebp) 80102e25: 8d 73 5c lea 0x5c(%ebx),%esi 80102e28: 89 cf mov %ecx,%edi 80102e2a: eb 0b jmp 80102e37 80102e2c: 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++) { 80102e30: 83 c6 04 add $0x4,%esi 80102e33: 39 fe cmp %edi,%esi 80102e35: 74 19 je 80102e50 if (ip->addrs[i]) { 80102e37: 8b 16 mov (%esi),%edx 80102e39: 85 d2 test %edx,%edx 80102e3b: 74 f3 je 80102e30 bfree(ip->dev, ip->addrs[i]); 80102e3d: 8b 03 mov (%ebx),%eax 80102e3f: e8 6c f8 ff ff call 801026b0 ip->addrs[i] = 0; 80102e44: c7 06 00 00 00 00 movl $0x0,(%esi) 80102e4a: eb e4 jmp 80102e30 80102e4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } } if (ip->addrs[NDIRECT]) { 80102e50: 8b 83 8c 00 00 00 mov 0x8c(%ebx),%eax 80102e56: 8b 7d e4 mov -0x1c(%ebp),%edi 80102e59: 85 c0 test %eax,%eax 80102e5b: 75 2d jne 80102e8a bfree(ip->dev, ip->addrs[NDIRECT]); ip->addrs[NDIRECT] = 0; } ip->size = 0; iupdate(ip); 80102e5d: 83 ec 0c sub $0xc,%esp ip->size = 0; 80102e60: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) iupdate(ip); 80102e67: 53 push %ebx 80102e68: e8 53 fd ff ff call 80102bc0 ip->type = 0; 80102e6d: 31 c0 xor %eax,%eax 80102e6f: 66 89 43 50 mov %ax,0x50(%ebx) iupdate(ip); 80102e73: 89 1c 24 mov %ebx,(%esp) 80102e76: e8 45 fd ff ff call 80102bc0 ip->valid = 0; 80102e7b: c7 43 4c 00 00 00 00 movl $0x0,0x4c(%ebx) 80102e82: 83 c4 10 add $0x10,%esp 80102e85: e9 3c ff ff ff jmp 80102dc6 bp = bread(ip->dev, ip->addrs[NDIRECT]); 80102e8a: 83 ec 08 sub $0x8,%esp 80102e8d: 50 push %eax 80102e8e: ff 33 push (%ebx) 80102e90: e8 3b d2 ff ff call 801000d0 80102e95: 89 7d e0 mov %edi,-0x20(%ebp) 80102e98: 83 c4 10 add $0x10,%esp 80102e9b: 8d 88 5c 02 00 00 lea 0x25c(%eax),%ecx 80102ea1: 89 45 e4 mov %eax,-0x1c(%ebp) for (j = 0; j < NINDIRECT; j++) { 80102ea4: 8d 70 5c lea 0x5c(%eax),%esi 80102ea7: 89 cf mov %ecx,%edi 80102ea9: eb 0c jmp 80102eb7 80102eab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102eaf: 90 nop 80102eb0: 83 c6 04 add $0x4,%esi 80102eb3: 39 f7 cmp %esi,%edi 80102eb5: 74 0f je 80102ec6 if (a[j]) { 80102eb7: 8b 16 mov (%esi),%edx 80102eb9: 85 d2 test %edx,%edx 80102ebb: 74 f3 je 80102eb0 bfree(ip->dev, a[j]); 80102ebd: 8b 03 mov (%ebx),%eax 80102ebf: e8 ec f7 ff ff call 801026b0 80102ec4: eb ea jmp 80102eb0 brelse(bp); 80102ec6: 83 ec 0c sub $0xc,%esp 80102ec9: ff 75 e4 push -0x1c(%ebp) 80102ecc: 8b 7d e0 mov -0x20(%ebp),%edi 80102ecf: e8 1c d3 ff ff call 801001f0 bfree(ip->dev, ip->addrs[NDIRECT]); 80102ed4: 8b 93 8c 00 00 00 mov 0x8c(%ebx),%edx 80102eda: 8b 03 mov (%ebx),%eax 80102edc: e8 cf f7 ff ff call 801026b0 ip->addrs[NDIRECT] = 0; 80102ee1: 83 c4 10 add $0x10,%esp 80102ee4: c7 83 8c 00 00 00 00 movl $0x0,0x8c(%ebx) 80102eeb: 00 00 00 80102eee: e9 6a ff ff ff jmp 80102e5d 80102ef3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102efa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102f00 : void iunlockput(struct inode *ip) { 80102f00: 55 push %ebp 80102f01: 89 e5 mov %esp,%ebp 80102f03: 56 push %esi 80102f04: 53 push %ebx 80102f05: 8b 5d 08 mov 0x8(%ebp),%ebx if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80102f08: 85 db test %ebx,%ebx 80102f0a: 74 34 je 80102f40 80102f0c: 83 ec 0c sub $0xc,%esp 80102f0f: 8d 73 0c lea 0xc(%ebx),%esi 80102f12: 56 push %esi 80102f13: e8 48 2a 00 00 call 80105960 80102f18: 83 c4 10 add $0x10,%esp 80102f1b: 85 c0 test %eax,%eax 80102f1d: 74 21 je 80102f40 80102f1f: 8b 43 08 mov 0x8(%ebx),%eax 80102f22: 85 c0 test %eax,%eax 80102f24: 7e 1a jle 80102f40 releasesleep(&ip->lock); 80102f26: 83 ec 0c sub $0xc,%esp 80102f29: 56 push %esi 80102f2a: e8 f1 29 00 00 call 80105920 iput(ip); 80102f2f: 89 5d 08 mov %ebx,0x8(%ebp) 80102f32: 83 c4 10 add $0x10,%esp } 80102f35: 8d 65 f8 lea -0x8(%ebp),%esp 80102f38: 5b pop %ebx 80102f39: 5e pop %esi 80102f3a: 5d pop %ebp iput(ip); 80102f3b: e9 60 fe ff ff jmp 80102da0 panic("iunlock"); 80102f40: 83 ec 0c sub $0xc,%esp 80102f43: 68 5f 8b 10 80 push $0x80108b5f 80102f48: e8 33 d5 ff ff call 80100480 80102f4d: 8d 76 00 lea 0x0(%esi),%esi 80102f50 : } // Copy stat information from inode. // Caller must hold ip->lock. void stati(struct inode *ip, struct stat *st) { 80102f50: 55 push %ebp 80102f51: 89 e5 mov %esp,%ebp 80102f53: 8b 55 08 mov 0x8(%ebp),%edx 80102f56: 8b 45 0c mov 0xc(%ebp),%eax st->dev = ip->dev; 80102f59: 8b 0a mov (%edx),%ecx 80102f5b: 89 48 04 mov %ecx,0x4(%eax) st->ino = ip->inum; 80102f5e: 8b 4a 04 mov 0x4(%edx),%ecx 80102f61: 89 48 08 mov %ecx,0x8(%eax) st->type = ip->type; 80102f64: 0f b7 4a 50 movzwl 0x50(%edx),%ecx 80102f68: 66 89 08 mov %cx,(%eax) st->nlink = ip->nlink; 80102f6b: 0f b7 4a 56 movzwl 0x56(%edx),%ecx 80102f6f: 66 89 48 0c mov %cx,0xc(%eax) st->size = ip->size; 80102f73: 8b 52 58 mov 0x58(%edx),%edx 80102f76: 89 50 10 mov %edx,0x10(%eax) } 80102f79: 5d pop %ebp 80102f7a: c3 ret 80102f7b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102f7f: 90 nop 80102f80 : // Read data from inode. // Caller must hold ip->lock. int readi(struct inode *ip, char *dst, uint off, uint n) { 80102f80: 55 push %ebp 80102f81: 89 e5 mov %esp,%ebp 80102f83: 57 push %edi 80102f84: 56 push %esi 80102f85: 53 push %ebx 80102f86: 83 ec 1c sub $0x1c,%esp 80102f89: 8b 7d 0c mov 0xc(%ebp),%edi 80102f8c: 8b 45 08 mov 0x8(%ebp),%eax 80102f8f: 8b 75 10 mov 0x10(%ebp),%esi 80102f92: 89 7d e0 mov %edi,-0x20(%ebp) 80102f95: 8b 7d 14 mov 0x14(%ebp),%edi uint tot, m; struct buf *bp; if (ip->type == T_DEV) { 80102f98: 66 83 78 50 03 cmpw $0x3,0x50(%eax) int readi(struct inode *ip, char *dst, uint off, uint n) { 80102f9d: 89 45 d8 mov %eax,-0x28(%ebp) 80102fa0: 89 7d e4 mov %edi,-0x1c(%ebp) if (ip->type == T_DEV) { 80102fa3: 0f 84 a7 00 00 00 je 80103050 return -1; } return devsw[ip->major].read(ip, dst, n); } if (off > ip->size || off + n < off) { 80102fa9: 8b 45 d8 mov -0x28(%ebp),%eax 80102fac: 8b 40 58 mov 0x58(%eax),%eax 80102faf: 39 c6 cmp %eax,%esi 80102fb1: 0f 87 ba 00 00 00 ja 80103071 80102fb7: 8b 5d e4 mov -0x1c(%ebp),%ebx 80102fba: 31 c9 xor %ecx,%ecx 80102fbc: 89 da mov %ebx,%edx 80102fbe: 01 f2 add %esi,%edx 80102fc0: 0f 92 c1 setb %cl 80102fc3: 89 cf mov %ecx,%edi 80102fc5: 0f 82 a6 00 00 00 jb 80103071 return -1; } if (off + n > ip->size) { n = ip->size - off; 80102fcb: 89 c1 mov %eax,%ecx 80102fcd: 29 f1 sub %esi,%ecx 80102fcf: 39 d0 cmp %edx,%eax 80102fd1: 0f 43 cb cmovae %ebx,%ecx 80102fd4: 89 4d e4 mov %ecx,-0x1c(%ebp) } for (tot = 0; tot < n; tot += m, off += m, dst += m) { 80102fd7: 85 c9 test %ecx,%ecx 80102fd9: 74 67 je 80103042 80102fdb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102fdf: 90 nop bp = bread(ip->dev, bmap(ip, off / BSIZE)); 80102fe0: 8b 5d d8 mov -0x28(%ebp),%ebx 80102fe3: 89 f2 mov %esi,%edx 80102fe5: c1 ea 09 shr $0x9,%edx 80102fe8: 89 d8 mov %ebx,%eax 80102fea: e8 51 f9 ff ff call 80102940 80102fef: 83 ec 08 sub $0x8,%esp 80102ff2: 50 push %eax 80102ff3: ff 33 push (%ebx) 80102ff5: e8 d6 d0 ff ff call 801000d0 m = min(n - tot, BSIZE - off % BSIZE); 80102ffa: 8b 5d e4 mov -0x1c(%ebp),%ebx 80102ffd: b9 00 02 00 00 mov $0x200,%ecx bp = bread(ip->dev, bmap(ip, off / BSIZE)); 80103002: 89 c2 mov %eax,%edx m = min(n - tot, BSIZE - off % BSIZE); 80103004: 89 f0 mov %esi,%eax 80103006: 25 ff 01 00 00 and $0x1ff,%eax 8010300b: 29 fb sub %edi,%ebx memmove(dst, bp->data + off % BSIZE, m); 8010300d: 89 55 dc mov %edx,-0x24(%ebp) m = min(n - tot, BSIZE - off % BSIZE); 80103010: 29 c1 sub %eax,%ecx memmove(dst, bp->data + off % BSIZE, m); 80103012: 8d 44 02 5c lea 0x5c(%edx,%eax,1),%eax m = min(n - tot, BSIZE - off % BSIZE); 80103016: 39 d9 cmp %ebx,%ecx 80103018: 0f 46 d9 cmovbe %ecx,%ebx memmove(dst, bp->data + off % BSIZE, m); 8010301b: 83 c4 0c add $0xc,%esp 8010301e: 53 push %ebx for (tot = 0; tot < n; tot += m, off += m, dst += m) { 8010301f: 01 df add %ebx,%edi 80103021: 01 de add %ebx,%esi memmove(dst, bp->data + off % BSIZE, m); 80103023: 50 push %eax 80103024: ff 75 e0 push -0x20(%ebp) 80103027: e8 b4 2c 00 00 call 80105ce0 brelse(bp); 8010302c: 8b 55 dc mov -0x24(%ebp),%edx 8010302f: 89 14 24 mov %edx,(%esp) 80103032: e8 b9 d1 ff ff call 801001f0 for (tot = 0; tot < n; tot += m, off += m, dst += m) { 80103037: 01 5d e0 add %ebx,-0x20(%ebp) 8010303a: 83 c4 10 add $0x10,%esp 8010303d: 39 7d e4 cmp %edi,-0x1c(%ebp) 80103040: 77 9e ja 80102fe0 } return n; 80103042: 8b 45 e4 mov -0x1c(%ebp),%eax } 80103045: 8d 65 f4 lea -0xc(%ebp),%esp 80103048: 5b pop %ebx 80103049: 5e pop %esi 8010304a: 5f pop %edi 8010304b: 5d pop %ebp 8010304c: c3 ret 8010304d: 8d 76 00 lea 0x0(%esi),%esi if (ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) { 80103050: 0f bf 40 52 movswl 0x52(%eax),%eax 80103054: 66 83 f8 09 cmp $0x9,%ax 80103058: 77 17 ja 80103071 8010305a: 8b 04 c5 80 c0 11 80 mov -0x7fee3f80(,%eax,8),%eax 80103061: 85 c0 test %eax,%eax 80103063: 74 0c je 80103071 return devsw[ip->major].read(ip, dst, n); 80103065: 89 7d 10 mov %edi,0x10(%ebp) } 80103068: 8d 65 f4 lea -0xc(%ebp),%esp 8010306b: 5b pop %ebx 8010306c: 5e pop %esi 8010306d: 5f pop %edi 8010306e: 5d pop %ebp return devsw[ip->major].read(ip, dst, n); 8010306f: ff e0 jmp *%eax return -1; 80103071: b8 ff ff ff ff mov $0xffffffff,%eax 80103076: eb cd jmp 80103045 80103078: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010307f: 90 nop 80103080 : // Write data to inode. // Caller must hold ip->lock. int writei(struct inode *ip, char *src, uint off, uint n) { 80103080: 55 push %ebp 80103081: 89 e5 mov %esp,%ebp 80103083: 57 push %edi 80103084: 56 push %esi 80103085: 53 push %ebx 80103086: 83 ec 1c sub $0x1c,%esp 80103089: 8b 45 08 mov 0x8(%ebp),%eax 8010308c: 8b 75 0c mov 0xc(%ebp),%esi 8010308f: 8b 55 14 mov 0x14(%ebp),%edx uint tot, m; struct buf *bp; if (ip->type == T_DEV) { 80103092: 66 83 78 50 03 cmpw $0x3,0x50(%eax) int writei(struct inode *ip, char *src, uint off, uint n) { 80103097: 89 75 dc mov %esi,-0x24(%ebp) 8010309a: 89 45 d8 mov %eax,-0x28(%ebp) 8010309d: 8b 75 10 mov 0x10(%ebp),%esi 801030a0: 89 55 e0 mov %edx,-0x20(%ebp) if (ip->type == T_DEV) { 801030a3: 0f 84 b7 00 00 00 je 80103160 return -1; } return devsw[ip->major].write(ip, src, n); } if (off > ip->size || off + n < off) { 801030a9: 8b 45 d8 mov -0x28(%ebp),%eax 801030ac: 3b 70 58 cmp 0x58(%eax),%esi 801030af: 0f 87 e7 00 00 00 ja 8010319c 801030b5: 8b 7d e0 mov -0x20(%ebp),%edi 801030b8: 31 d2 xor %edx,%edx 801030ba: 89 f8 mov %edi,%eax 801030bc: 01 f0 add %esi,%eax 801030be: 0f 92 c2 setb %dl return -1; } if (off + n > MAXFILE * BSIZE) { 801030c1: 3d 00 18 01 00 cmp $0x11800,%eax 801030c6: 0f 87 d0 00 00 00 ja 8010319c 801030cc: 85 d2 test %edx,%edx 801030ce: 0f 85 c8 00 00 00 jne 8010319c return -1; } for (tot = 0; tot < n; tot += m, off += m, src += m) { 801030d4: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 801030db: 85 ff test %edi,%edi 801030dd: 74 72 je 80103151 801030df: 90 nop bp = bread(ip->dev, bmap(ip, off / BSIZE)); 801030e0: 8b 7d d8 mov -0x28(%ebp),%edi 801030e3: 89 f2 mov %esi,%edx 801030e5: c1 ea 09 shr $0x9,%edx 801030e8: 89 f8 mov %edi,%eax 801030ea: e8 51 f8 ff ff call 80102940 801030ef: 83 ec 08 sub $0x8,%esp 801030f2: 50 push %eax 801030f3: ff 37 push (%edi) 801030f5: e8 d6 cf ff ff call 801000d0 m = min(n - tot, BSIZE - off % BSIZE); 801030fa: b9 00 02 00 00 mov $0x200,%ecx 801030ff: 8b 5d e0 mov -0x20(%ebp),%ebx 80103102: 2b 5d e4 sub -0x1c(%ebp),%ebx bp = bread(ip->dev, bmap(ip, off / BSIZE)); 80103105: 89 c7 mov %eax,%edi m = min(n - tot, BSIZE - off % BSIZE); 80103107: 89 f0 mov %esi,%eax 80103109: 25 ff 01 00 00 and $0x1ff,%eax 8010310e: 29 c1 sub %eax,%ecx memmove(bp->data + off % BSIZE, src, m); 80103110: 8d 44 07 5c lea 0x5c(%edi,%eax,1),%eax m = min(n - tot, BSIZE - off % BSIZE); 80103114: 39 d9 cmp %ebx,%ecx 80103116: 0f 46 d9 cmovbe %ecx,%ebx memmove(bp->data + off % BSIZE, src, m); 80103119: 83 c4 0c add $0xc,%esp 8010311c: 53 push %ebx for (tot = 0; tot < n; tot += m, off += m, src += m) { 8010311d: 01 de add %ebx,%esi memmove(bp->data + off % BSIZE, src, m); 8010311f: ff 75 dc push -0x24(%ebp) 80103122: 50 push %eax 80103123: e8 b8 2b 00 00 call 80105ce0 log_write(bp); 80103128: 89 3c 24 mov %edi,(%esp) 8010312b: e8 00 13 00 00 call 80104430 brelse(bp); 80103130: 89 3c 24 mov %edi,(%esp) 80103133: e8 b8 d0 ff ff call 801001f0 for (tot = 0; tot < n; tot += m, off += m, src += m) { 80103138: 01 5d e4 add %ebx,-0x1c(%ebp) 8010313b: 83 c4 10 add $0x10,%esp 8010313e: 8b 45 e4 mov -0x1c(%ebp),%eax 80103141: 01 5d dc add %ebx,-0x24(%ebp) 80103144: 39 45 e0 cmp %eax,-0x20(%ebp) 80103147: 77 97 ja 801030e0 } if (n > 0 && off > ip->size) { 80103149: 8b 45 d8 mov -0x28(%ebp),%eax 8010314c: 3b 70 58 cmp 0x58(%eax),%esi 8010314f: 77 37 ja 80103188 ip->size = off; iupdate(ip); } return n; 80103151: 8b 45 e0 mov -0x20(%ebp),%eax } 80103154: 8d 65 f4 lea -0xc(%ebp),%esp 80103157: 5b pop %ebx 80103158: 5e pop %esi 80103159: 5f pop %edi 8010315a: 5d pop %ebp 8010315b: c3 ret 8010315c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) { 80103160: 0f bf 40 52 movswl 0x52(%eax),%eax 80103164: 66 83 f8 09 cmp $0x9,%ax 80103168: 77 32 ja 8010319c 8010316a: 8b 04 c5 84 c0 11 80 mov -0x7fee3f7c(,%eax,8),%eax 80103171: 85 c0 test %eax,%eax 80103173: 74 27 je 8010319c return devsw[ip->major].write(ip, src, n); 80103175: 89 55 10 mov %edx,0x10(%ebp) } 80103178: 8d 65 f4 lea -0xc(%ebp),%esp 8010317b: 5b pop %ebx 8010317c: 5e pop %esi 8010317d: 5f pop %edi 8010317e: 5d pop %ebp return devsw[ip->major].write(ip, src, n); 8010317f: ff e0 jmp *%eax 80103181: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ip->size = off; 80103188: 8b 45 d8 mov -0x28(%ebp),%eax iupdate(ip); 8010318b: 83 ec 0c sub $0xc,%esp ip->size = off; 8010318e: 89 70 58 mov %esi,0x58(%eax) iupdate(ip); 80103191: 50 push %eax 80103192: e8 29 fa ff ff call 80102bc0 80103197: 83 c4 10 add $0x10,%esp 8010319a: eb b5 jmp 80103151 return -1; 8010319c: b8 ff ff ff ff mov $0xffffffff,%eax 801031a1: eb b1 jmp 80103154 801031a3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801031aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801031b0 : // Directories int namecmp(const char *s, const char *t) { 801031b0: 55 push %ebp 801031b1: 89 e5 mov %esp,%ebp 801031b3: 83 ec 0c sub $0xc,%esp return strncmp(s, t, DIRSIZ); 801031b6: 6a 0e push $0xe 801031b8: ff 75 0c push 0xc(%ebp) 801031bb: ff 75 08 push 0x8(%ebp) 801031be: e8 8d 2b 00 00 call 80105d50 } 801031c3: c9 leave 801031c4: c3 ret 801031c5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801031cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801031d0 : // 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) { 801031d0: 55 push %ebp 801031d1: 89 e5 mov %esp,%ebp 801031d3: 57 push %edi 801031d4: 56 push %esi 801031d5: 53 push %ebx 801031d6: 83 ec 1c sub $0x1c,%esp 801031d9: 8b 5d 08 mov 0x8(%ebp),%ebx uint off, inum; struct dirent de; if (dp->type != T_DIR) { 801031dc: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 801031e1: 0f 85 85 00 00 00 jne 8010326c panic("dirlookup not DIR"); } for (off = 0; off < dp->size; off += sizeof(de)) { 801031e7: 8b 53 58 mov 0x58(%ebx),%edx 801031ea: 31 ff xor %edi,%edi 801031ec: 8d 75 d8 lea -0x28(%ebp),%esi 801031ef: 85 d2 test %edx,%edx 801031f1: 74 3e je 80103231 801031f3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801031f7: 90 nop if (readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 801031f8: 6a 10 push $0x10 801031fa: 57 push %edi 801031fb: 56 push %esi 801031fc: 53 push %ebx 801031fd: e8 7e fd ff ff call 80102f80 80103202: 83 c4 10 add $0x10,%esp 80103205: 83 f8 10 cmp $0x10,%eax 80103208: 75 55 jne 8010325f panic("dirlookup read"); } if (de.inum == 0) { 8010320a: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 8010320f: 74 18 je 80103229 return strncmp(s, t, DIRSIZ); 80103211: 83 ec 04 sub $0x4,%esp 80103214: 8d 45 da lea -0x26(%ebp),%eax 80103217: 6a 0e push $0xe 80103219: 50 push %eax 8010321a: ff 75 0c push 0xc(%ebp) 8010321d: e8 2e 2b 00 00 call 80105d50 continue; } if (namecmp(name, de.name) == 0) { 80103222: 83 c4 10 add $0x10,%esp 80103225: 85 c0 test %eax,%eax 80103227: 74 17 je 80103240 for (off = 0; off < dp->size; off += sizeof(de)) { 80103229: 83 c7 10 add $0x10,%edi 8010322c: 3b 7b 58 cmp 0x58(%ebx),%edi 8010322f: 72 c7 jb 801031f8 return iget(dp->dev, inum); } } return 0; } 80103231: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80103234: 31 c0 xor %eax,%eax } 80103236: 5b pop %ebx 80103237: 5e pop %esi 80103238: 5f pop %edi 80103239: 5d pop %ebp 8010323a: c3 ret 8010323b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010323f: 90 nop if (poff) { 80103240: 8b 45 10 mov 0x10(%ebp),%eax 80103243: 85 c0 test %eax,%eax 80103245: 74 05 je 8010324c *poff = off; 80103247: 8b 45 10 mov 0x10(%ebp),%eax 8010324a: 89 38 mov %edi,(%eax) inum = de.inum; 8010324c: 0f b7 55 d8 movzwl -0x28(%ebp),%edx return iget(dp->dev, inum); 80103250: 8b 03 mov (%ebx),%eax 80103252: e8 e9 f5 ff ff call 80102840 } 80103257: 8d 65 f4 lea -0xc(%ebp),%esp 8010325a: 5b pop %ebx 8010325b: 5e pop %esi 8010325c: 5f pop %edi 8010325d: 5d pop %ebp 8010325e: c3 ret panic("dirlookup read"); 8010325f: 83 ec 0c sub $0xc,%esp 80103262: 68 79 8b 10 80 push $0x80108b79 80103267: e8 14 d2 ff ff call 80100480 panic("dirlookup not DIR"); 8010326c: 83 ec 0c sub $0xc,%esp 8010326f: 68 67 8b 10 80 push $0x80108b67 80103274: e8 07 d2 ff ff call 80100480 80103279: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103280 : // 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) { 80103280: 55 push %ebp 80103281: 89 e5 mov %esp,%ebp 80103283: 57 push %edi 80103284: 56 push %esi 80103285: 53 push %ebx 80103286: 89 c3 mov %eax,%ebx 80103288: 83 ec 1c sub $0x1c,%esp struct inode *ip, *next; if (*path == '/') { 8010328b: 80 38 2f cmpb $0x2f,(%eax) static struct inode* namex(char *path, int nameiparent, char *name) { 8010328e: 89 55 dc mov %edx,-0x24(%ebp) 80103291: 89 4d e4 mov %ecx,-0x1c(%ebp) if (*path == '/') { 80103294: 0f 84 64 01 00 00 je 801033fe ip = iget(ROOTDEV, ROOTINO); } else { ip = idup(myproc()->cwd); 8010329a: e8 11 1c 00 00 call 80104eb0 acquire(&icache.lock); 8010329f: 83 ec 0c sub $0xc,%esp ip = idup(myproc()->cwd); 801032a2: 8b 70 68 mov 0x68(%eax),%esi acquire(&icache.lock); 801032a5: 68 e0 c0 11 80 push $0x8011c0e0 801032aa: e8 d1 28 00 00 call 80105b80 ip->ref++; 801032af: 83 46 08 01 addl $0x1,0x8(%esi) release(&icache.lock); 801032b3: c7 04 24 e0 c0 11 80 movl $0x8011c0e0,(%esp) 801032ba: e8 61 28 00 00 call 80105b20 801032bf: 83 c4 10 add $0x10,%esp 801032c2: eb 07 jmp 801032cb 801032c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi path++; 801032c8: 83 c3 01 add $0x1,%ebx while (*path == '/') { 801032cb: 0f b6 03 movzbl (%ebx),%eax 801032ce: 3c 2f cmp $0x2f,%al 801032d0: 74 f6 je 801032c8 if (*path == 0) { 801032d2: 84 c0 test %al,%al 801032d4: 0f 84 06 01 00 00 je 801033e0 while (*path != '/' && *path != 0) { 801032da: 0f b6 03 movzbl (%ebx),%eax 801032dd: 84 c0 test %al,%al 801032df: 0f 84 10 01 00 00 je 801033f5 801032e5: 89 df mov %ebx,%edi 801032e7: 3c 2f cmp $0x2f,%al 801032e9: 0f 84 06 01 00 00 je 801033f5 801032ef: 90 nop 801032f0: 0f b6 47 01 movzbl 0x1(%edi),%eax path++; 801032f4: 83 c7 01 add $0x1,%edi while (*path != '/' && *path != 0) { 801032f7: 3c 2f cmp $0x2f,%al 801032f9: 74 04 je 801032ff 801032fb: 84 c0 test %al,%al 801032fd: 75 f1 jne 801032f0 len = path - s; 801032ff: 89 f8 mov %edi,%eax 80103301: 29 d8 sub %ebx,%eax if (len >= DIRSIZ) { 80103303: 83 f8 0d cmp $0xd,%eax 80103306: 0f 8e ac 00 00 00 jle 801033b8 memmove(name, s, DIRSIZ); 8010330c: 83 ec 04 sub $0x4,%esp 8010330f: 6a 0e push $0xe 80103311: 53 push %ebx path++; 80103312: 89 fb mov %edi,%ebx memmove(name, s, DIRSIZ); 80103314: ff 75 e4 push -0x1c(%ebp) 80103317: e8 c4 29 00 00 call 80105ce0 8010331c: 83 c4 10 add $0x10,%esp while (*path == '/') { 8010331f: 80 3f 2f cmpb $0x2f,(%edi) 80103322: 75 0c jne 80103330 80103324: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi path++; 80103328: 83 c3 01 add $0x1,%ebx while (*path == '/') { 8010332b: 80 3b 2f cmpb $0x2f,(%ebx) 8010332e: 74 f8 je 80103328 } while ((path = skipelem(path, name)) != 0) { ilock(ip); 80103330: 83 ec 0c sub $0xc,%esp 80103333: 56 push %esi 80103334: e8 37 f9 ff ff call 80102c70 if (ip->type != T_DIR) { 80103339: 83 c4 10 add $0x10,%esp 8010333c: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) 80103341: 0f 85 cd 00 00 00 jne 80103414 iunlockput(ip); return 0; } if (nameiparent && *path == '\0') { 80103347: 8b 45 dc mov -0x24(%ebp),%eax 8010334a: 85 c0 test %eax,%eax 8010334c: 74 09 je 80103357 8010334e: 80 3b 00 cmpb $0x0,(%ebx) 80103351: 0f 84 22 01 00 00 je 80103479 // Stop one level early. iunlock(ip); return ip; } if ((next = dirlookup(ip, name, 0)) == 0) { 80103357: 83 ec 04 sub $0x4,%esp 8010335a: 6a 00 push $0x0 8010335c: ff 75 e4 push -0x1c(%ebp) 8010335f: 56 push %esi 80103360: e8 6b fe ff ff call 801031d0 if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80103365: 8d 56 0c lea 0xc(%esi),%edx if ((next = dirlookup(ip, name, 0)) == 0) { 80103368: 83 c4 10 add $0x10,%esp 8010336b: 89 c7 mov %eax,%edi 8010336d: 85 c0 test %eax,%eax 8010336f: 0f 84 e1 00 00 00 je 80103456 if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80103375: 83 ec 0c sub $0xc,%esp 80103378: 89 55 e0 mov %edx,-0x20(%ebp) 8010337b: 52 push %edx 8010337c: e8 df 25 00 00 call 80105960 80103381: 83 c4 10 add $0x10,%esp 80103384: 85 c0 test %eax,%eax 80103386: 0f 84 30 01 00 00 je 801034bc 8010338c: 8b 56 08 mov 0x8(%esi),%edx 8010338f: 85 d2 test %edx,%edx 80103391: 0f 8e 25 01 00 00 jle 801034bc releasesleep(&ip->lock); 80103397: 8b 55 e0 mov -0x20(%ebp),%edx 8010339a: 83 ec 0c sub $0xc,%esp 8010339d: 52 push %edx 8010339e: e8 7d 25 00 00 call 80105920 iput(ip); 801033a3: 89 34 24 mov %esi,(%esp) 801033a6: 89 fe mov %edi,%esi 801033a8: e8 f3 f9 ff ff call 80102da0 801033ad: 83 c4 10 add $0x10,%esp 801033b0: e9 16 ff ff ff jmp 801032cb 801033b5: 8d 76 00 lea 0x0(%esi),%esi name[len] = 0; 801033b8: 8b 4d e4 mov -0x1c(%ebp),%ecx 801033bb: 8d 14 01 lea (%ecx,%eax,1),%edx memmove(name, s, len); 801033be: 83 ec 04 sub $0x4,%esp 801033c1: 89 55 e0 mov %edx,-0x20(%ebp) 801033c4: 50 push %eax 801033c5: 53 push %ebx name[len] = 0; 801033c6: 89 fb mov %edi,%ebx memmove(name, s, len); 801033c8: ff 75 e4 push -0x1c(%ebp) 801033cb: e8 10 29 00 00 call 80105ce0 name[len] = 0; 801033d0: 8b 55 e0 mov -0x20(%ebp),%edx 801033d3: 83 c4 10 add $0x10,%esp 801033d6: c6 02 00 movb $0x0,(%edx) 801033d9: e9 41 ff ff ff jmp 8010331f 801033de: 66 90 xchg %ax,%ax return 0; } iunlockput(ip); ip = next; } if (nameiparent) { 801033e0: 8b 45 dc mov -0x24(%ebp),%eax 801033e3: 85 c0 test %eax,%eax 801033e5: 0f 85 be 00 00 00 jne 801034a9 iput(ip); return 0; } return ip; } 801033eb: 8d 65 f4 lea -0xc(%ebp),%esp 801033ee: 89 f0 mov %esi,%eax 801033f0: 5b pop %ebx 801033f1: 5e pop %esi 801033f2: 5f pop %edi 801033f3: 5d pop %ebp 801033f4: c3 ret while (*path != '/' && *path != 0) { 801033f5: 8b 55 e4 mov -0x1c(%ebp),%edx 801033f8: 89 df mov %ebx,%edi 801033fa: 31 c0 xor %eax,%eax 801033fc: eb c0 jmp 801033be ip = iget(ROOTDEV, ROOTINO); 801033fe: ba 01 00 00 00 mov $0x1,%edx 80103403: b8 01 00 00 00 mov $0x1,%eax 80103408: e8 33 f4 ff ff call 80102840 8010340d: 89 c6 mov %eax,%esi 8010340f: e9 b7 fe ff ff jmp 801032cb if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80103414: 83 ec 0c sub $0xc,%esp 80103417: 8d 5e 0c lea 0xc(%esi),%ebx 8010341a: 53 push %ebx 8010341b: e8 40 25 00 00 call 80105960 80103420: 83 c4 10 add $0x10,%esp 80103423: 85 c0 test %eax,%eax 80103425: 0f 84 91 00 00 00 je 801034bc 8010342b: 8b 46 08 mov 0x8(%esi),%eax 8010342e: 85 c0 test %eax,%eax 80103430: 0f 8e 86 00 00 00 jle 801034bc releasesleep(&ip->lock); 80103436: 83 ec 0c sub $0xc,%esp 80103439: 53 push %ebx 8010343a: e8 e1 24 00 00 call 80105920 iput(ip); 8010343f: 89 34 24 mov %esi,(%esp) return 0; 80103442: 31 f6 xor %esi,%esi iput(ip); 80103444: e8 57 f9 ff ff call 80102da0 return 0; 80103449: 83 c4 10 add $0x10,%esp } 8010344c: 8d 65 f4 lea -0xc(%ebp),%esp 8010344f: 89 f0 mov %esi,%eax 80103451: 5b pop %ebx 80103452: 5e pop %esi 80103453: 5f pop %edi 80103454: 5d pop %ebp 80103455: c3 ret if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80103456: 83 ec 0c sub $0xc,%esp 80103459: 89 55 e4 mov %edx,-0x1c(%ebp) 8010345c: 52 push %edx 8010345d: e8 fe 24 00 00 call 80105960 80103462: 83 c4 10 add $0x10,%esp 80103465: 85 c0 test %eax,%eax 80103467: 74 53 je 801034bc 80103469: 8b 4e 08 mov 0x8(%esi),%ecx 8010346c: 85 c9 test %ecx,%ecx 8010346e: 7e 4c jle 801034bc releasesleep(&ip->lock); 80103470: 8b 55 e4 mov -0x1c(%ebp),%edx 80103473: 83 ec 0c sub $0xc,%esp 80103476: 52 push %edx 80103477: eb c1 jmp 8010343a if (ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) { 80103479: 83 ec 0c sub $0xc,%esp 8010347c: 8d 5e 0c lea 0xc(%esi),%ebx 8010347f: 53 push %ebx 80103480: e8 db 24 00 00 call 80105960 80103485: 83 c4 10 add $0x10,%esp 80103488: 85 c0 test %eax,%eax 8010348a: 74 30 je 801034bc 8010348c: 8b 7e 08 mov 0x8(%esi),%edi 8010348f: 85 ff test %edi,%edi 80103491: 7e 29 jle 801034bc releasesleep(&ip->lock); 80103493: 83 ec 0c sub $0xc,%esp 80103496: 53 push %ebx 80103497: e8 84 24 00 00 call 80105920 } 8010349c: 83 c4 10 add $0x10,%esp } 8010349f: 8d 65 f4 lea -0xc(%ebp),%esp 801034a2: 89 f0 mov %esi,%eax 801034a4: 5b pop %ebx 801034a5: 5e pop %esi 801034a6: 5f pop %edi 801034a7: 5d pop %ebp 801034a8: c3 ret iput(ip); 801034a9: 83 ec 0c sub $0xc,%esp 801034ac: 56 push %esi return 0; 801034ad: 31 f6 xor %esi,%esi iput(ip); 801034af: e8 ec f8 ff ff call 80102da0 return 0; 801034b4: 83 c4 10 add $0x10,%esp 801034b7: e9 2f ff ff ff jmp 801033eb panic("iunlock"); 801034bc: 83 ec 0c sub $0xc,%esp 801034bf: 68 5f 8b 10 80 push $0x80108b5f 801034c4: e8 b7 cf ff ff call 80100480 801034c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801034d0 : int dirlink(struct inode *dp, char *name, uint inum) { 801034d0: 55 push %ebp 801034d1: 89 e5 mov %esp,%ebp 801034d3: 57 push %edi 801034d4: 56 push %esi 801034d5: 53 push %ebx 801034d6: 83 ec 20 sub $0x20,%esp 801034d9: 8b 5d 08 mov 0x8(%ebp),%ebx if ((ip = dirlookup(dp, name, 0)) != 0) { 801034dc: 6a 00 push $0x0 801034de: ff 75 0c push 0xc(%ebp) 801034e1: 53 push %ebx 801034e2: e8 e9 fc ff ff call 801031d0 801034e7: 83 c4 10 add $0x10,%esp 801034ea: 85 c0 test %eax,%eax 801034ec: 75 67 jne 80103555 for (off = 0; off < dp->size; off += sizeof(de)) { 801034ee: 8b 7b 58 mov 0x58(%ebx),%edi 801034f1: 8d 75 d8 lea -0x28(%ebp),%esi 801034f4: 85 ff test %edi,%edi 801034f6: 74 29 je 80103521 801034f8: 31 ff xor %edi,%edi 801034fa: 8d 75 d8 lea -0x28(%ebp),%esi 801034fd: eb 09 jmp 80103508 801034ff: 90 nop 80103500: 83 c7 10 add $0x10,%edi 80103503: 3b 7b 58 cmp 0x58(%ebx),%edi 80103506: 73 19 jae 80103521 if (readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 80103508: 6a 10 push $0x10 8010350a: 57 push %edi 8010350b: 56 push %esi 8010350c: 53 push %ebx 8010350d: e8 6e fa ff ff call 80102f80 80103512: 83 c4 10 add $0x10,%esp 80103515: 83 f8 10 cmp $0x10,%eax 80103518: 75 4e jne 80103568 if (de.inum == 0) { 8010351a: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 8010351f: 75 df jne 80103500 strncpy(de.name, name, DIRSIZ); 80103521: 83 ec 04 sub $0x4,%esp 80103524: 8d 45 da lea -0x26(%ebp),%eax 80103527: 6a 0e push $0xe 80103529: ff 75 0c push 0xc(%ebp) 8010352c: 50 push %eax 8010352d: e8 6e 28 00 00 call 80105da0 if (writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 80103532: 6a 10 push $0x10 de.inum = inum; 80103534: 8b 45 10 mov 0x10(%ebp),%eax if (writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 80103537: 57 push %edi 80103538: 56 push %esi 80103539: 53 push %ebx de.inum = inum; 8010353a: 66 89 45 d8 mov %ax,-0x28(%ebp) if (writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 8010353e: e8 3d fb ff ff call 80103080 80103543: 83 c4 20 add $0x20,%esp 80103546: 83 f8 10 cmp $0x10,%eax 80103549: 75 2a jne 80103575 return 0; 8010354b: 31 c0 xor %eax,%eax } 8010354d: 8d 65 f4 lea -0xc(%ebp),%esp 80103550: 5b pop %ebx 80103551: 5e pop %esi 80103552: 5f pop %edi 80103553: 5d pop %ebp 80103554: c3 ret iput(ip); 80103555: 83 ec 0c sub $0xc,%esp 80103558: 50 push %eax 80103559: e8 42 f8 ff ff call 80102da0 return -1; 8010355e: 83 c4 10 add $0x10,%esp 80103561: b8 ff ff ff ff mov $0xffffffff,%eax 80103566: eb e5 jmp 8010354d panic("dirlink read"); 80103568: 83 ec 0c sub $0xc,%esp 8010356b: 68 88 8b 10 80 push $0x80108b88 80103570: e8 0b cf ff ff call 80100480 panic("dirlink"); 80103575: 83 ec 0c sub $0xc,%esp 80103578: 68 f2 91 10 80 push $0x801091f2 8010357d: e8 fe ce ff ff call 80100480 80103582: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103589: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103590 : struct inode* namei(char *path) { 80103590: 55 push %ebp char name[DIRSIZ]; return namex(path, 0, name); 80103591: 31 d2 xor %edx,%edx struct inode* namei(char *path) { 80103593: 89 e5 mov %esp,%ebp 80103595: 83 ec 18 sub $0x18,%esp return namex(path, 0, name); 80103598: 8b 45 08 mov 0x8(%ebp),%eax 8010359b: 8d 4d ea lea -0x16(%ebp),%ecx 8010359e: e8 dd fc ff ff call 80103280 } 801035a3: c9 leave 801035a4: c3 ret 801035a5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801035ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801035b0 : struct inode*nameiparent(char *path, char *name) { 801035b0: 55 push %ebp return namex(path, 1, name); 801035b1: ba 01 00 00 00 mov $0x1,%edx struct inode*nameiparent(char *path, char *name) { 801035b6: 89 e5 mov %esp,%ebp return namex(path, 1, name); 801035b8: 8b 4d 0c mov 0xc(%ebp),%ecx 801035bb: 8b 45 08 mov 0x8(%ebp),%eax } 801035be: 5d pop %ebp return namex(path, 1, name); 801035bf: e9 bc fc ff ff jmp 80103280 801035c4: 66 90 xchg %ax,%ax 801035c6: 66 90 xchg %ax,%ax 801035c8: 66 90 xchg %ax,%ax 801035ca: 66 90 xchg %ax,%ax 801035cc: 66 90 xchg %ax,%ax 801035ce: 66 90 xchg %ax,%ax 801035d0 : // 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) { 801035d0: 55 push %ebp 801035d1: 89 e5 mov %esp,%ebp 801035d3: 57 push %edi 801035d4: 56 push %esi 801035d5: 53 push %ebx 801035d6: 83 ec 0c sub $0xc,%esp if (b == 0) { 801035d9: 85 c0 test %eax,%eax 801035db: 0f 84 b4 00 00 00 je 80103695 panic("idestart"); } if (b->blockno >= FSSIZE) { 801035e1: 8b 70 08 mov 0x8(%eax),%esi 801035e4: 89 c3 mov %eax,%ebx 801035e6: 81 fe e7 03 00 00 cmp $0x3e7,%esi 801035ec: 0f 87 96 00 00 00 ja 80103688 asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 801035f2: b9 f7 01 00 00 mov $0x1f7,%ecx 801035f7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801035fe: 66 90 xchg %ax,%ax 80103600: 89 ca mov %ecx,%edx 80103602: ec in (%dx),%al while (((r = inb(0x1f7)) & (IDE_BSY | IDE_DRDY)) != IDE_DRDY) { 80103603: 83 e0 c0 and $0xffffffc0,%eax 80103606: 3c 40 cmp $0x40,%al 80103608: 75 f6 jne 80103600 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 8010360a: 31 ff xor %edi,%edi 8010360c: ba f6 03 00 00 mov $0x3f6,%edx 80103611: 89 f8 mov %edi,%eax 80103613: ee out %al,(%dx) 80103614: b8 01 00 00 00 mov $0x1,%eax 80103619: ba f2 01 00 00 mov $0x1f2,%edx 8010361e: ee out %al,(%dx) 8010361f: ba f3 01 00 00 mov $0x1f3,%edx 80103624: 89 f0 mov %esi,%eax 80103626: 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); 80103627: 89 f0 mov %esi,%eax 80103629: ba f4 01 00 00 mov $0x1f4,%edx 8010362e: c1 f8 08 sar $0x8,%eax 80103631: ee out %al,(%dx) 80103632: ba f5 01 00 00 mov $0x1f5,%edx 80103637: 89 f8 mov %edi,%eax 80103639: ee out %al,(%dx) outb(0x1f5, (sector >> 16) & 0xff); outb(0x1f6, 0xe0 | ((b->dev & 1) << 4) | ((sector >> 24) & 0x0f)); 8010363a: 0f b6 43 04 movzbl 0x4(%ebx),%eax 8010363e: ba f6 01 00 00 mov $0x1f6,%edx 80103643: c1 e0 04 shl $0x4,%eax 80103646: 83 e0 10 and $0x10,%eax 80103649: 83 c8 e0 or $0xffffffe0,%eax 8010364c: ee out %al,(%dx) if (b->flags & B_DIRTY) { 8010364d: f6 03 04 testb $0x4,(%ebx) 80103650: 75 16 jne 80103668 80103652: b8 20 00 00 00 mov $0x20,%eax 80103657: 89 ca mov %ecx,%edx 80103659: ee out %al,(%dx) outsl(0x1f0, b->data, BSIZE / 4); } else { outb(0x1f7, read_cmd); } } 8010365a: 8d 65 f4 lea -0xc(%ebp),%esp 8010365d: 5b pop %ebx 8010365e: 5e pop %esi 8010365f: 5f pop %edi 80103660: 5d pop %ebp 80103661: c3 ret 80103662: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103668: b8 30 00 00 00 mov $0x30,%eax 8010366d: 89 ca mov %ecx,%edx 8010366f: ee out %al,(%dx) asm volatile ("cld; rep outsl" : 80103670: b9 80 00 00 00 mov $0x80,%ecx outsl(0x1f0, b->data, BSIZE / 4); 80103675: 8d 73 5c lea 0x5c(%ebx),%esi 80103678: ba f0 01 00 00 mov $0x1f0,%edx 8010367d: fc cld 8010367e: f3 6f rep outsl %ds:(%esi),(%dx) } 80103680: 8d 65 f4 lea -0xc(%ebp),%esp 80103683: 5b pop %ebx 80103684: 5e pop %esi 80103685: 5f pop %edi 80103686: 5d pop %ebp 80103687: c3 ret panic("incorrect blockno"); 80103688: 83 ec 0c sub $0xc,%esp 8010368b: 68 f4 8b 10 80 push $0x80108bf4 80103690: e8 eb cd ff ff call 80100480 panic("idestart"); 80103695: 83 ec 0c sub $0xc,%esp 80103698: 68 eb 8b 10 80 push $0x80108beb 8010369d: e8 de cd ff ff call 80100480 801036a2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801036a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801036b0 : void ideinit(void) { 801036b0: 55 push %ebp 801036b1: 89 e5 mov %esp,%ebp 801036b3: 83 ec 10 sub $0x10,%esp initlock(&idelock, "ide"); 801036b6: 68 06 8c 10 80 push $0x80108c06 801036bb: 68 80 dd 11 80 push $0x8011dd80 801036c0: e8 eb 22 00 00 call 801059b0 ioapicenable(IRQ_IDE, ncpu - 1); 801036c5: 58 pop %eax 801036c6: a1 04 df 11 80 mov 0x8011df04,%eax 801036cb: 5a pop %edx 801036cc: 83 e8 01 sub $0x1,%eax 801036cf: 50 push %eax 801036d0: 6a 0e push $0xe 801036d2: e8 99 02 00 00 call 80103970 while (((r = inb(0x1f7)) & (IDE_BSY | IDE_DRDY)) != IDE_DRDY) { 801036d7: 83 c4 10 add $0x10,%esp asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 801036da: ba f7 01 00 00 mov $0x1f7,%edx 801036df: 90 nop 801036e0: ec in (%dx),%al 801036e1: 83 e0 c0 and $0xffffffc0,%eax 801036e4: 3c 40 cmp $0x40,%al 801036e6: 75 f8 jne 801036e0 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 801036e8: b8 f0 ff ff ff mov $0xfffffff0,%eax 801036ed: ba f6 01 00 00 mov $0x1f6,%edx 801036f2: ee out %al,(%dx) 801036f3: b9 e8 03 00 00 mov $0x3e8,%ecx asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 801036f8: ba f7 01 00 00 mov $0x1f7,%edx 801036fd: eb 06 jmp 80103705 801036ff: 90 nop for (i = 0; i < 1000; i++) { 80103700: 83 e9 01 sub $0x1,%ecx 80103703: 74 0f je 80103714 80103705: ec in (%dx),%al if (inb(0x1f7) != 0) { 80103706: 84 c0 test %al,%al 80103708: 74 f6 je 80103700 havedisk1 = 1; 8010370a: c7 05 60 dd 11 80 01 movl $0x1,0x8011dd60 80103711: 00 00 00 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103714: b8 e0 ff ff ff mov $0xffffffe0,%eax 80103719: ba f6 01 00 00 mov $0x1f6,%edx 8010371e: ee out %al,(%dx) } 8010371f: c9 leave 80103720: c3 ret 80103721: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103728: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010372f: 90 nop 80103730 : // Interrupt handler. void ideintr(void) { 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 18 sub $0x18,%esp struct buf *b; // First queued buffer is the active request. acquire(&idelock); 80103739: 68 80 dd 11 80 push $0x8011dd80 8010373e: e8 3d 24 00 00 call 80105b80 if ((b = idequeue) == 0) { 80103743: 8b 1d 64 dd 11 80 mov 0x8011dd64,%ebx 80103749: 83 c4 10 add $0x10,%esp 8010374c: 85 db test %ebx,%ebx 8010374e: 74 63 je 801037b3 release(&idelock); return; } idequeue = b->qnext; 80103750: 8b 43 58 mov 0x58(%ebx),%eax 80103753: a3 64 dd 11 80 mov %eax,0x8011dd64 // Read data if needed. if (!(b->flags & B_DIRTY) && idewait(1) >= 0) { 80103758: 8b 33 mov (%ebx),%esi 8010375a: f7 c6 04 00 00 00 test $0x4,%esi 80103760: 75 2f jne 80103791 asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103762: ba f7 01 00 00 mov $0x1f7,%edx 80103767: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010376e: 66 90 xchg %ax,%ax 80103770: ec in (%dx),%al while (((r = inb(0x1f7)) & (IDE_BSY | IDE_DRDY)) != IDE_DRDY) { 80103771: 89 c1 mov %eax,%ecx 80103773: 83 e1 c0 and $0xffffffc0,%ecx 80103776: 80 f9 40 cmp $0x40,%cl 80103779: 75 f5 jne 80103770 if (checkerr && (r & (IDE_DF | IDE_ERR)) != 0) { 8010377b: a8 21 test $0x21,%al 8010377d: 75 12 jne 80103791 insl(0x1f0, b->data, BSIZE / 4); 8010377f: 8d 7b 5c lea 0x5c(%ebx),%edi asm volatile ("cld; rep insl" : 80103782: b9 80 00 00 00 mov $0x80,%ecx 80103787: ba f0 01 00 00 mov $0x1f0,%edx 8010378c: fc cld 8010378d: f3 6d rep insl (%dx),%es:(%edi) } // Wake process waiting for this buf. b->flags |= B_VALID; 8010378f: 8b 33 mov (%ebx),%esi b->flags &= ~B_DIRTY; 80103791: 83 e6 fb and $0xfffffffb,%esi wakeup(b); 80103794: 83 ec 0c sub $0xc,%esp b->flags &= ~B_DIRTY; 80103797: 83 ce 02 or $0x2,%esi 8010379a: 89 33 mov %esi,(%ebx) wakeup(b); 8010379c: 53 push %ebx 8010379d: e8 fe 1e 00 00 call 801056a0 // Start disk on next buf in queue. if (idequeue != 0) { 801037a2: a1 64 dd 11 80 mov 0x8011dd64,%eax 801037a7: 83 c4 10 add $0x10,%esp 801037aa: 85 c0 test %eax,%eax 801037ac: 74 05 je 801037b3 idestart(idequeue); 801037ae: e8 1d fe ff ff call 801035d0 release(&idelock); 801037b3: 83 ec 0c sub $0xc,%esp 801037b6: 68 80 dd 11 80 push $0x8011dd80 801037bb: e8 60 23 00 00 call 80105b20 } release(&idelock); } 801037c0: 8d 65 f4 lea -0xc(%ebp),%esp 801037c3: 5b pop %ebx 801037c4: 5e pop %esi 801037c5: 5f pop %edi 801037c6: 5d pop %ebp 801037c7: c3 ret 801037c8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801037cf: 90 nop 801037d0 : // 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) { 801037d0: 55 push %ebp 801037d1: 89 e5 mov %esp,%ebp 801037d3: 53 push %ebx 801037d4: 83 ec 10 sub $0x10,%esp 801037d7: 8b 5d 08 mov 0x8(%ebp),%ebx struct buf **pp; if (!holdingsleep(&b->lock)) { 801037da: 8d 43 0c lea 0xc(%ebx),%eax 801037dd: 50 push %eax 801037de: e8 7d 21 00 00 call 80105960 801037e3: 83 c4 10 add $0x10,%esp 801037e6: 85 c0 test %eax,%eax 801037e8: 0f 84 c3 00 00 00 je 801038b1 panic("iderw: buf not locked"); } if ((b->flags & (B_VALID | B_DIRTY)) == B_VALID) { 801037ee: 8b 03 mov (%ebx),%eax 801037f0: 83 e0 06 and $0x6,%eax 801037f3: 83 f8 02 cmp $0x2,%eax 801037f6: 0f 84 a8 00 00 00 je 801038a4 panic("iderw: nothing to do"); } if (b->dev != 0 && !havedisk1) { 801037fc: 8b 53 04 mov 0x4(%ebx),%edx 801037ff: 85 d2 test %edx,%edx 80103801: 74 0d je 80103810 80103803: a1 60 dd 11 80 mov 0x8011dd60,%eax 80103808: 85 c0 test %eax,%eax 8010380a: 0f 84 87 00 00 00 je 80103897 panic("iderw: ide disk 1 not present"); } acquire(&idelock); //DOC:acquire-lock 80103810: 83 ec 0c sub $0xc,%esp 80103813: 68 80 dd 11 80 push $0x8011dd80 80103818: e8 63 23 00 00 call 80105b80 // Append b to idequeue. b->qnext = 0; for (pp = &idequeue; *pp; pp = &(*pp)->qnext) { //DOC:insert-queue 8010381d: a1 64 dd 11 80 mov 0x8011dd64,%eax b->qnext = 0; 80103822: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) for (pp = &idequeue; *pp; pp = &(*pp)->qnext) { //DOC:insert-queue 80103829: 83 c4 10 add $0x10,%esp 8010382c: 85 c0 test %eax,%eax 8010382e: 74 60 je 80103890 80103830: 89 c2 mov %eax,%edx 80103832: 8b 40 58 mov 0x58(%eax),%eax 80103835: 85 c0 test %eax,%eax 80103837: 75 f7 jne 80103830 80103839: 83 c2 58 add $0x58,%edx ; } *pp = b; 8010383c: 89 1a mov %ebx,(%edx) // Start disk if necessary. if (idequeue == b) { 8010383e: 39 1d 64 dd 11 80 cmp %ebx,0x8011dd64 80103844: 74 3a je 80103880 idestart(b); } // Wait for request to finish. while ((b->flags & (B_VALID | B_DIRTY)) != B_VALID) { 80103846: 8b 03 mov (%ebx),%eax 80103848: 83 e0 06 and $0x6,%eax 8010384b: 83 f8 02 cmp $0x2,%eax 8010384e: 74 1b je 8010386b sleep(b, &idelock); 80103850: 83 ec 08 sub $0x8,%esp 80103853: 68 80 dd 11 80 push $0x8011dd80 80103858: 53 push %ebx 80103859: e8 82 1d 00 00 call 801055e0 while ((b->flags & (B_VALID | B_DIRTY)) != B_VALID) { 8010385e: 8b 03 mov (%ebx),%eax 80103860: 83 c4 10 add $0x10,%esp 80103863: 83 e0 06 and $0x6,%eax 80103866: 83 f8 02 cmp $0x2,%eax 80103869: 75 e5 jne 80103850 } release(&idelock); 8010386b: c7 45 08 80 dd 11 80 movl $0x8011dd80,0x8(%ebp) } 80103872: 8b 5d fc mov -0x4(%ebp),%ebx 80103875: c9 leave release(&idelock); 80103876: e9 a5 22 00 00 jmp 80105b20 8010387b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010387f: 90 nop idestart(b); 80103880: 89 d8 mov %ebx,%eax 80103882: e8 49 fd ff ff call 801035d0 80103887: eb bd jmp 80103846 80103889: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for (pp = &idequeue; *pp; pp = &(*pp)->qnext) { //DOC:insert-queue 80103890: ba 64 dd 11 80 mov $0x8011dd64,%edx 80103895: eb a5 jmp 8010383c panic("iderw: ide disk 1 not present"); 80103897: 83 ec 0c sub $0xc,%esp 8010389a: 68 35 8c 10 80 push $0x80108c35 8010389f: e8 dc cb ff ff call 80100480 panic("iderw: nothing to do"); 801038a4: 83 ec 0c sub $0xc,%esp 801038a7: 68 20 8c 10 80 push $0x80108c20 801038ac: e8 cf cb ff ff call 80100480 panic("iderw: buf not locked"); 801038b1: 83 ec 0c sub $0xc,%esp 801038b4: 68 0a 8c 10 80 push $0x80108c0a 801038b9: e8 c2 cb ff ff call 80100480 801038be: 66 90 xchg %ax,%ax 801038c0 : static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; ioapic->data = data; } void ioapicinit(void) { 801038c0: 55 push %ebp int i, id, maxintr; ioapic = (volatile struct ioapic*)IOAPIC; 801038c1: c7 05 b4 dd 11 80 00 movl $0xfec00000,0x8011ddb4 801038c8: 00 c0 fe void ioapicinit(void) { 801038cb: 89 e5 mov %esp,%ebp 801038cd: 56 push %esi 801038ce: 53 push %ebx ioapic->reg = reg; 801038cf: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000 801038d6: 00 00 00 return ioapic->data; 801038d9: 8b 15 b4 dd 11 80 mov 0x8011ddb4,%edx 801038df: 8b 72 10 mov 0x10(%edx),%esi ioapic->reg = reg; 801038e2: c7 02 00 00 00 00 movl $0x0,(%edx) return ioapic->data; 801038e8: 8b 0d b4 dd 11 80 mov 0x8011ddb4,%ecx maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; id = ioapicread(REG_ID) >> 24; if (id != ioapicid) { 801038ee: 0f b6 15 00 df 11 80 movzbl 0x8011df00,%edx maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; 801038f5: c1 ee 10 shr $0x10,%esi 801038f8: 89 f0 mov %esi,%eax 801038fa: 0f b6 f0 movzbl %al,%esi return ioapic->data; 801038fd: 8b 41 10 mov 0x10(%ecx),%eax id = ioapicread(REG_ID) >> 24; 80103900: c1 e8 18 shr $0x18,%eax if (id != ioapicid) { 80103903: 39 c2 cmp %eax,%edx 80103905: 74 16 je 8010391d cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); 80103907: 83 ec 0c sub $0xc,%esp 8010390a: 68 54 8c 10 80 push $0x80108c54 8010390f: e8 7c cf ff ff call 80100890 ioapic->reg = reg; 80103914: 8b 0d b4 dd 11 80 mov 0x8011ddb4,%ecx 8010391a: 83 c4 10 add $0x10,%esp 8010391d: 83 c6 21 add $0x21,%esi void ioapicinit(void) { 80103920: ba 10 00 00 00 mov $0x10,%edx 80103925: b8 20 00 00 00 mov $0x20,%eax 8010392a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ioapic->reg = reg; 80103930: 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)); 80103932: 89 c3 mov %eax,%ebx ioapic->data = data; 80103934: 8b 0d b4 dd 11 80 mov 0x8011ddb4,%ecx for (i = 0; i <= maxintr; i++) { 8010393a: 83 c0 01 add $0x1,%eax ioapicwrite(REG_TABLE + 2 * i, INT_DISABLED | (T_IRQ0 + i)); 8010393d: 81 cb 00 00 01 00 or $0x10000,%ebx ioapic->data = data; 80103943: 89 59 10 mov %ebx,0x10(%ecx) ioapic->reg = reg; 80103946: 8d 5a 01 lea 0x1(%edx),%ebx for (i = 0; i <= maxintr; i++) { 80103949: 83 c2 02 add $0x2,%edx ioapic->reg = reg; 8010394c: 89 19 mov %ebx,(%ecx) ioapic->data = data; 8010394e: 8b 0d b4 dd 11 80 mov 0x8011ddb4,%ecx 80103954: c7 41 10 00 00 00 00 movl $0x0,0x10(%ecx) for (i = 0; i <= maxintr; i++) { 8010395b: 39 f0 cmp %esi,%eax 8010395d: 75 d1 jne 80103930 ioapicwrite(REG_TABLE + 2 * i + 1, 0); } } 8010395f: 8d 65 f8 lea -0x8(%ebp),%esp 80103962: 5b pop %ebx 80103963: 5e pop %esi 80103964: 5d pop %ebp 80103965: c3 ret 80103966: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010396d: 8d 76 00 lea 0x0(%esi),%esi 80103970 : void ioapicenable(int irq, int cpunum) { 80103970: 55 push %ebp ioapic->reg = reg; 80103971: 8b 0d b4 dd 11 80 mov 0x8011ddb4,%ecx void ioapicenable(int irq, int cpunum) { 80103977: 89 e5 mov %esp,%ebp 80103979: 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); 8010397c: 8d 50 20 lea 0x20(%eax),%edx 8010397f: 8d 44 00 10 lea 0x10(%eax,%eax,1),%eax ioapic->reg = reg; 80103983: 89 01 mov %eax,(%ecx) ioapic->data = data; 80103985: 8b 0d b4 dd 11 80 mov 0x8011ddb4,%ecx ioapicwrite(REG_TABLE + 2 * irq + 1, cpunum << 24); 8010398b: 83 c0 01 add $0x1,%eax ioapic->data = data; 8010398e: 89 51 10 mov %edx,0x10(%ecx) ioapicwrite(REG_TABLE + 2 * irq + 1, cpunum << 24); 80103991: 8b 55 0c mov 0xc(%ebp),%edx ioapic->reg = reg; 80103994: 89 01 mov %eax,(%ecx) ioapic->data = data; 80103996: a1 b4 dd 11 80 mov 0x8011ddb4,%eax ioapicwrite(REG_TABLE + 2 * irq + 1, cpunum << 24); 8010399b: c1 e2 18 shl $0x18,%edx ioapic->data = data; 8010399e: 89 50 10 mov %edx,0x10(%eax) } 801039a1: 5d pop %ebp 801039a2: c3 ret 801039a3: 66 90 xchg %ax,%ax 801039a5: 66 90 xchg %ax,%ax 801039a7: 66 90 xchg %ax,%ax 801039a9: 66 90 xchg %ax,%ax 801039ab: 66 90 xchg %ax,%ax 801039ad: 66 90 xchg %ax,%ax 801039af: 90 nop 801039b0 : // 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) { 801039b0: 55 push %ebp 801039b1: 89 e5 mov %esp,%ebp 801039b3: 53 push %ebx 801039b4: 83 ec 04 sub $0x4,%esp 801039b7: 8b 5d 08 mov 0x8(%ebp),%ebx struct run *r; if ((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP) { 801039ba: f7 c3 ff 0f 00 00 test $0xfff,%ebx 801039c0: 75 76 jne 80103a38 801039c2: 81 fb 50 22 12 80 cmp $0x80122250,%ebx 801039c8: 72 6e jb 80103a38 801039ca: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 801039d0: 3d ff ff ff 0d cmp $0xdffffff,%eax 801039d5: 77 61 ja 80103a38 panic("kfree"); } // Fill with junk to catch dangling refs. memset(v, 1, PGSIZE); 801039d7: 83 ec 04 sub $0x4,%esp 801039da: 68 00 10 00 00 push $0x1000 801039df: 6a 01 push $0x1 801039e1: 53 push %ebx 801039e2: e8 59 22 00 00 call 80105c40 if (kmem.use_lock) { 801039e7: 8b 15 f4 dd 11 80 mov 0x8011ddf4,%edx 801039ed: 83 c4 10 add $0x10,%esp 801039f0: 85 d2 test %edx,%edx 801039f2: 75 1c jne 80103a10 acquire(&kmem.lock); } r = (struct run*)v; r->next = kmem.freelist; 801039f4: a1 f8 dd 11 80 mov 0x8011ddf8,%eax 801039f9: 89 03 mov %eax,(%ebx) kmem.freelist = r; if (kmem.use_lock) { 801039fb: a1 f4 dd 11 80 mov 0x8011ddf4,%eax kmem.freelist = r; 80103a00: 89 1d f8 dd 11 80 mov %ebx,0x8011ddf8 if (kmem.use_lock) { 80103a06: 85 c0 test %eax,%eax 80103a08: 75 1e jne 80103a28 release(&kmem.lock); } } 80103a0a: 8b 5d fc mov -0x4(%ebp),%ebx 80103a0d: c9 leave 80103a0e: c3 ret 80103a0f: 90 nop acquire(&kmem.lock); 80103a10: 83 ec 0c sub $0xc,%esp 80103a13: 68 c0 dd 11 80 push $0x8011ddc0 80103a18: e8 63 21 00 00 call 80105b80 80103a1d: 83 c4 10 add $0x10,%esp 80103a20: eb d2 jmp 801039f4 80103a22: 8d b6 00 00 00 00 lea 0x0(%esi),%esi release(&kmem.lock); 80103a28: c7 45 08 c0 dd 11 80 movl $0x8011ddc0,0x8(%ebp) } 80103a2f: 8b 5d fc mov -0x4(%ebp),%ebx 80103a32: c9 leave release(&kmem.lock); 80103a33: e9 e8 20 00 00 jmp 80105b20 panic("kfree"); 80103a38: 83 ec 0c sub $0xc,%esp 80103a3b: 68 86 8c 10 80 push $0x80108c86 80103a40: e8 3b ca ff ff call 80100480 80103a45: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103a4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103a50 : void freerange(void *vstart, void *vend) { 80103a50: 55 push %ebp 80103a51: 89 e5 mov %esp,%ebp 80103a53: 56 push %esi p = (char*)PGROUNDUP((uint)vstart); 80103a54: 8b 45 08 mov 0x8(%ebp),%eax void freerange(void *vstart, void *vend) { 80103a57: 8b 75 0c mov 0xc(%ebp),%esi 80103a5a: 53 push %ebx p = (char*)PGROUNDUP((uint)vstart); 80103a5b: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 80103a61: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80103a67: 81 c3 00 10 00 00 add $0x1000,%ebx 80103a6d: 39 de cmp %ebx,%esi 80103a6f: 72 23 jb 80103a94 80103a71: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi kfree(p); 80103a78: 83 ec 0c sub $0xc,%esp 80103a7b: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80103a81: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 80103a87: 50 push %eax 80103a88: e8 23 ff ff ff call 801039b0 for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80103a8d: 83 c4 10 add $0x10,%esp 80103a90: 39 f3 cmp %esi,%ebx 80103a92: 76 e4 jbe 80103a78 } 80103a94: 8d 65 f8 lea -0x8(%ebp),%esp 80103a97: 5b pop %ebx 80103a98: 5e pop %esi 80103a99: 5d pop %ebp 80103a9a: c3 ret 80103a9b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103a9f: 90 nop 80103aa0 : void kinit2(void *vstart, void *vend) { 80103aa0: 55 push %ebp 80103aa1: 89 e5 mov %esp,%ebp 80103aa3: 56 push %esi p = (char*)PGROUNDUP((uint)vstart); 80103aa4: 8b 45 08 mov 0x8(%ebp),%eax void kinit2(void *vstart, void *vend) { 80103aa7: 8b 75 0c mov 0xc(%ebp),%esi 80103aaa: 53 push %ebx p = (char*)PGROUNDUP((uint)vstart); 80103aab: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 80103ab1: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80103ab7: 81 c3 00 10 00 00 add $0x1000,%ebx 80103abd: 39 de cmp %ebx,%esi 80103abf: 72 23 jb 80103ae4 80103ac1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi kfree(p); 80103ac8: 83 ec 0c sub $0xc,%esp 80103acb: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80103ad1: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 80103ad7: 50 push %eax 80103ad8: e8 d3 fe ff ff call 801039b0 for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80103add: 83 c4 10 add $0x10,%esp 80103ae0: 39 de cmp %ebx,%esi 80103ae2: 73 e4 jae 80103ac8 kmem.use_lock = 1; 80103ae4: c7 05 f4 dd 11 80 01 movl $0x1,0x8011ddf4 80103aeb: 00 00 00 } 80103aee: 8d 65 f8 lea -0x8(%ebp),%esp 80103af1: 5b pop %ebx 80103af2: 5e pop %esi 80103af3: 5d pop %ebp 80103af4: c3 ret 80103af5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103afc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103b00 : void kinit1(void *vstart, void *vend) { 80103b00: 55 push %ebp 80103b01: 89 e5 mov %esp,%ebp 80103b03: 56 push %esi 80103b04: 53 push %ebx 80103b05: 8b 75 0c mov 0xc(%ebp),%esi initlock(&kmem.lock, "kmem"); 80103b08: 83 ec 08 sub $0x8,%esp 80103b0b: 68 8c 8c 10 80 push $0x80108c8c 80103b10: 68 c0 dd 11 80 push $0x8011ddc0 80103b15: e8 96 1e 00 00 call 801059b0 p = (char*)PGROUNDUP((uint)vstart); 80103b1a: 8b 45 08 mov 0x8(%ebp),%eax for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80103b1d: 83 c4 10 add $0x10,%esp kmem.use_lock = 0; 80103b20: c7 05 f4 dd 11 80 00 movl $0x0,0x8011ddf4 80103b27: 00 00 00 p = (char*)PGROUNDUP((uint)vstart); 80103b2a: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 80103b30: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80103b36: 81 c3 00 10 00 00 add $0x1000,%ebx 80103b3c: 39 de cmp %ebx,%esi 80103b3e: 72 1c jb 80103b5c kfree(p); 80103b40: 83 ec 0c sub $0xc,%esp 80103b43: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80103b49: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 80103b4f: 50 push %eax 80103b50: e8 5b fe ff ff call 801039b0 for (; p + PGSIZE <= (char*)vend; p += PGSIZE) { 80103b55: 83 c4 10 add $0x10,%esp 80103b58: 39 de cmp %ebx,%esi 80103b5a: 73 e4 jae 80103b40 } 80103b5c: 8d 65 f8 lea -0x8(%ebp),%esp 80103b5f: 5b pop %ebx 80103b60: 5e pop %esi 80103b61: 5d pop %ebp 80103b62: c3 ret 80103b63: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103b6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103b70 : // 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) { 80103b70: a1 f4 dd 11 80 mov 0x8011ddf4,%eax 80103b75: 85 c0 test %eax,%eax 80103b77: 75 1f jne 80103b98 acquire(&kmem.lock); } r = kmem.freelist; 80103b79: a1 f8 dd 11 80 mov 0x8011ddf8,%eax if (r) { 80103b7e: 85 c0 test %eax,%eax 80103b80: 74 0e je 80103b90 kmem.freelist = r->next; 80103b82: 8b 10 mov (%eax),%edx 80103b84: 89 15 f8 dd 11 80 mov %edx,0x8011ddf8 } if (kmem.use_lock) { 80103b8a: c3 ret 80103b8b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103b8f: 90 nop release(&kmem.lock); } return (char*)r; } 80103b90: c3 ret 80103b91: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi char* kalloc(void) { 80103b98: 55 push %ebp 80103b99: 89 e5 mov %esp,%ebp 80103b9b: 83 ec 24 sub $0x24,%esp acquire(&kmem.lock); 80103b9e: 68 c0 dd 11 80 push $0x8011ddc0 80103ba3: e8 d8 1f 00 00 call 80105b80 r = kmem.freelist; 80103ba8: a1 f8 dd 11 80 mov 0x8011ddf8,%eax if (kmem.use_lock) { 80103bad: 8b 15 f4 dd 11 80 mov 0x8011ddf4,%edx if (r) { 80103bb3: 83 c4 10 add $0x10,%esp 80103bb6: 85 c0 test %eax,%eax 80103bb8: 74 08 je 80103bc2 kmem.freelist = r->next; 80103bba: 8b 08 mov (%eax),%ecx 80103bbc: 89 0d f8 dd 11 80 mov %ecx,0x8011ddf8 if (kmem.use_lock) { 80103bc2: 85 d2 test %edx,%edx 80103bc4: 74 16 je 80103bdc release(&kmem.lock); 80103bc6: 83 ec 0c sub $0xc,%esp 80103bc9: 89 45 f4 mov %eax,-0xc(%ebp) 80103bcc: 68 c0 dd 11 80 push $0x8011ddc0 80103bd1: e8 4a 1f 00 00 call 80105b20 return (char*)r; 80103bd6: 8b 45 f4 mov -0xc(%ebp),%eax release(&kmem.lock); 80103bd9: 83 c4 10 add $0x10,%esp } 80103bdc: c9 leave 80103bdd: c3 ret 80103bde: 66 90 xchg %ax,%ax 80103be0 : asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103be0: ba 64 00 00 00 mov $0x64,%edx 80103be5: ec in (%dx),%al normalmap, shiftmap, ctlmap, ctlmap }; uint st, data, c; st = inb(KBSTATP); if ((st & KBS_DIB) == 0) { 80103be6: a8 01 test $0x1,%al 80103be8: 0f 84 c2 00 00 00 je 80103cb0 int kbdgetc(void) { 80103bee: 55 push %ebp 80103bef: ba 60 00 00 00 mov $0x60,%edx 80103bf4: 89 e5 mov %esp,%ebp 80103bf6: 53 push %ebx 80103bf7: ec in (%dx),%al return -1; } data = inb(KBDATAP); if (data == 0xE0) { shift |= E0ESC; 80103bf8: 8b 1d fc dd 11 80 mov 0x8011ddfc,%ebx data = inb(KBDATAP); 80103bfe: 0f b6 c8 movzbl %al,%ecx if (data == 0xE0) { 80103c01: 3c e0 cmp $0xe0,%al 80103c03: 74 5b je 80103c60 return 0; } else if (data & 0x80) { // Key released data = (shift & E0ESC ? data : data & 0x7F); 80103c05: 89 da mov %ebx,%edx 80103c07: 83 e2 40 and $0x40,%edx else if (data & 0x80) { 80103c0a: 84 c0 test %al,%al 80103c0c: 78 62 js 80103c70 shift &= ~(shiftcode[data] | E0ESC); return 0; } else if (shift & E0ESC) { 80103c0e: 85 d2 test %edx,%edx 80103c10: 74 09 je 80103c1b // Last character was an E0 escape; or with 0x80 data |= 0x80; 80103c12: 83 c8 80 or $0xffffff80,%eax shift &= ~E0ESC; 80103c15: 83 e3 bf and $0xffffffbf,%ebx data |= 0x80; 80103c18: 0f b6 c8 movzbl %al,%ecx } shift |= shiftcode[data]; 80103c1b: 0f b6 91 c0 8d 10 80 movzbl -0x7fef7240(%ecx),%edx shift ^= togglecode[data]; 80103c22: 0f b6 81 c0 8c 10 80 movzbl -0x7fef7340(%ecx),%eax shift |= shiftcode[data]; 80103c29: 09 da or %ebx,%edx shift ^= togglecode[data]; 80103c2b: 31 c2 xor %eax,%edx c = charcode[shift & (CTL | SHIFT)][data]; 80103c2d: 89 d0 mov %edx,%eax shift ^= togglecode[data]; 80103c2f: 89 15 fc dd 11 80 mov %edx,0x8011ddfc c = charcode[shift & (CTL | SHIFT)][data]; 80103c35: 83 e0 03 and $0x3,%eax if (shift & CAPSLOCK) { 80103c38: 83 e2 08 and $0x8,%edx c = charcode[shift & (CTL | SHIFT)][data]; 80103c3b: 8b 04 85 a0 8c 10 80 mov -0x7fef7360(,%eax,4),%eax 80103c42: 0f b6 04 08 movzbl (%eax,%ecx,1),%eax if (shift & CAPSLOCK) { 80103c46: 74 0b je 80103c53 if ('a' <= c && c <= 'z') { 80103c48: 8d 50 9f lea -0x61(%eax),%edx 80103c4b: 83 fa 19 cmp $0x19,%edx 80103c4e: 77 48 ja 80103c98 c += 'A' - 'a'; 80103c50: 83 e8 20 sub $0x20,%eax else if ('A' <= c && c <= 'Z') { c += 'a' - 'A'; } } return c; } 80103c53: 8b 5d fc mov -0x4(%ebp),%ebx 80103c56: c9 leave 80103c57: c3 ret 80103c58: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103c5f: 90 nop shift |= E0ESC; 80103c60: 83 cb 40 or $0x40,%ebx return 0; 80103c63: 31 c0 xor %eax,%eax shift |= E0ESC; 80103c65: 89 1d fc dd 11 80 mov %ebx,0x8011ddfc } 80103c6b: 8b 5d fc mov -0x4(%ebp),%ebx 80103c6e: c9 leave 80103c6f: c3 ret data = (shift & E0ESC ? data : data & 0x7F); 80103c70: 83 e0 7f and $0x7f,%eax 80103c73: 85 d2 test %edx,%edx 80103c75: 0f 44 c8 cmove %eax,%ecx shift &= ~(shiftcode[data] | E0ESC); 80103c78: 0f b6 81 c0 8d 10 80 movzbl -0x7fef7240(%ecx),%eax 80103c7f: 83 c8 40 or $0x40,%eax 80103c82: 0f b6 c0 movzbl %al,%eax 80103c85: f7 d0 not %eax 80103c87: 21 d8 and %ebx,%eax } 80103c89: 8b 5d fc mov -0x4(%ebp),%ebx shift &= ~(shiftcode[data] | E0ESC); 80103c8c: a3 fc dd 11 80 mov %eax,0x8011ddfc return 0; 80103c91: 31 c0 xor %eax,%eax } 80103c93: c9 leave 80103c94: c3 ret 80103c95: 8d 76 00 lea 0x0(%esi),%esi else if ('A' <= c && c <= 'Z') { 80103c98: 8d 48 bf lea -0x41(%eax),%ecx c += 'a' - 'A'; 80103c9b: 8d 50 20 lea 0x20(%eax),%edx } 80103c9e: 8b 5d fc mov -0x4(%ebp),%ebx 80103ca1: c9 leave c += 'a' - 'A'; 80103ca2: 83 f9 1a cmp $0x1a,%ecx 80103ca5: 0f 42 c2 cmovb %edx,%eax } 80103ca8: c3 ret 80103ca9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return -1; 80103cb0: b8 ff ff ff ff mov $0xffffffff,%eax } 80103cb5: c3 ret 80103cb6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103cbd: 8d 76 00 lea 0x0(%esi),%esi 80103cc0 : void kbdintr(void) { 80103cc0: 55 push %ebp 80103cc1: 89 e5 mov %esp,%ebp 80103cc3: 83 ec 14 sub $0x14,%esp consoleintr(kbdgetc); 80103cc6: 68 e0 3b 10 80 push $0x80103be0 80103ccb: e8 60 d8 ff ff call 80101530 } 80103cd0: 83 c4 10 add $0x10,%esp 80103cd3: c9 leave 80103cd4: c3 ret 80103cd5: 66 90 xchg %ax,%ax 80103cd7: 66 90 xchg %ax,%ax 80103cd9: 66 90 xchg %ax,%ax 80103cdb: 66 90 xchg %ax,%ax 80103cdd: 66 90 xchg %ax,%ax 80103cdf: 90 nop 80103ce0 : lapic[index] = value; lapic[ID]; // wait for write to finish, by reading } void lapicinit(void) { if (!lapic) { 80103ce0: a1 00 de 11 80 mov 0x8011de00,%eax 80103ce5: 85 c0 test %eax,%eax 80103ce7: 0f 84 cb 00 00 00 je 80103db8 lapic[index] = value; 80103ced: c7 80 f0 00 00 00 3f movl $0x13f,0xf0(%eax) 80103cf4: 01 00 00 lapic[ID]; // wait for write to finish, by reading 80103cf7: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80103cfa: c7 80 e0 03 00 00 0b movl $0xb,0x3e0(%eax) 80103d01: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80103d04: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80103d07: c7 80 20 03 00 00 20 movl $0x20020,0x320(%eax) 80103d0e: 00 02 00 lapic[ID]; // wait for write to finish, by reading 80103d11: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80103d14: c7 80 80 03 00 00 80 movl $0x989680,0x380(%eax) 80103d1b: 96 98 00 lapic[ID]; // wait for write to finish, by reading 80103d1e: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80103d21: c7 80 50 03 00 00 00 movl $0x10000,0x350(%eax) 80103d28: 00 01 00 lapic[ID]; // wait for write to finish, by reading 80103d2b: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80103d2e: c7 80 60 03 00 00 00 movl $0x10000,0x360(%eax) 80103d35: 00 01 00 lapic[ID]; // wait for write to finish, by reading 80103d38: 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) { 80103d3b: 8b 50 30 mov 0x30(%eax),%edx 80103d3e: c1 ea 10 shr $0x10,%edx 80103d41: 81 e2 fc 00 00 00 and $0xfc,%edx 80103d47: 75 77 jne 80103dc0 lapic[index] = value; 80103d49: c7 80 70 03 00 00 33 movl $0x33,0x370(%eax) 80103d50: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80103d53: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80103d56: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) 80103d5d: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80103d60: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80103d63: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) 80103d6a: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80103d6d: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80103d70: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) 80103d77: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80103d7a: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80103d7d: c7 80 10 03 00 00 00 movl $0x0,0x310(%eax) 80103d84: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80103d87: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80103d8a: c7 80 00 03 00 00 00 movl $0x88500,0x300(%eax) 80103d91: 85 08 00 lapic[ID]; // wait for write to finish, by reading 80103d94: 8b 50 20 mov 0x20(%eax),%edx 80103d97: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103d9e: 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) { 80103da0: 8b 90 00 03 00 00 mov 0x300(%eax),%edx 80103da6: 80 e6 10 and $0x10,%dh 80103da9: 75 f5 jne 80103da0 lapic[index] = value; 80103dab: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax) 80103db2: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80103db5: 8b 40 20 mov 0x20(%eax),%eax ; } // Enable interrupts on the APIC (but not on the processor). lapicw(TPR, 0); } 80103db8: c3 ret 80103db9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi lapic[index] = value; 80103dc0: c7 80 40 03 00 00 00 movl $0x10000,0x340(%eax) 80103dc7: 00 01 00 lapic[ID]; // wait for write to finish, by reading 80103dca: 8b 50 20 mov 0x20(%eax),%edx } 80103dcd: e9 77 ff ff ff jmp 80103d49 80103dd2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103dd9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103de0 : int lapicid(void) { if (!lapic) { 80103de0: a1 00 de 11 80 mov 0x8011de00,%eax 80103de5: 85 c0 test %eax,%eax 80103de7: 74 07 je 80103df0 return 0; } return lapic[ID] >> 24; 80103de9: 8b 40 20 mov 0x20(%eax),%eax 80103dec: c1 e8 18 shr $0x18,%eax 80103def: c3 ret return 0; 80103df0: 31 c0 xor %eax,%eax } 80103df2: c3 ret 80103df3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103dfa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103e00 : // Acknowledge interrupt. void lapiceoi(void) { if (lapic) { 80103e00: a1 00 de 11 80 mov 0x8011de00,%eax 80103e05: 85 c0 test %eax,%eax 80103e07: 74 0d je 80103e16 lapic[index] = value; 80103e09: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) 80103e10: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80103e13: 8b 40 20 mov 0x20(%eax),%eax lapicw(EOI, 0); } } 80103e16: c3 ret 80103e17: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103e1e: 66 90 xchg %ax,%ax 80103e20 : // Spin for a given number of microseconds. // On real hardware would want to tune this dynamically. void microdelay(int us) { } 80103e20: c3 ret 80103e21: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103e28: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103e2f: 90 nop 80103e30 : #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) { 80103e30: 55 push %ebp asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103e31: b8 0f 00 00 00 mov $0xf,%eax 80103e36: ba 70 00 00 00 mov $0x70,%edx 80103e3b: 89 e5 mov %esp,%ebp 80103e3d: 53 push %ebx 80103e3e: 8b 4d 0c mov 0xc(%ebp),%ecx 80103e41: 8b 5d 08 mov 0x8(%ebp),%ebx 80103e44: ee out %al,(%dx) 80103e45: b8 0a 00 00 00 mov $0xa,%eax 80103e4a: ba 71 00 00 00 mov $0x71,%edx 80103e4f: 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; 80103e50: 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); 80103e52: c1 e3 18 shl $0x18,%ebx wrv[0] = 0; 80103e55: 66 a3 67 04 00 80 mov %ax,0x80000467 wrv[1] = addr >> 4; 80103e5b: 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)); 80103e5d: c1 e9 0c shr $0xc,%ecx lapicw(ICRHI, apicid << 24); 80103e60: 89 da mov %ebx,%edx wrv[1] = addr >> 4; 80103e62: c1 e8 04 shr $0x4,%eax lapicw(ICRLO, STARTUP | (addr >> 12)); 80103e65: 80 cd 06 or $0x6,%ch wrv[1] = addr >> 4; 80103e68: 66 a3 69 04 00 80 mov %ax,0x80000469 lapic[index] = value; 80103e6e: a1 00 de 11 80 mov 0x8011de00,%eax 80103e73: 89 98 10 03 00 00 mov %ebx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 80103e79: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80103e7c: c7 80 00 03 00 00 00 movl $0xc500,0x300(%eax) 80103e83: c5 00 00 lapic[ID]; // wait for write to finish, by reading 80103e86: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80103e89: c7 80 00 03 00 00 00 movl $0x8500,0x300(%eax) 80103e90: 85 00 00 lapic[ID]; // wait for write to finish, by reading 80103e93: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80103e96: 89 90 10 03 00 00 mov %edx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 80103e9c: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80103e9f: 89 88 00 03 00 00 mov %ecx,0x300(%eax) lapic[ID]; // wait for write to finish, by reading 80103ea5: 8b 58 20 mov 0x20(%eax),%ebx lapic[index] = value; 80103ea8: 89 90 10 03 00 00 mov %edx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 80103eae: 8b 50 20 mov 0x20(%eax),%edx lapic[index] = value; 80103eb1: 89 88 00 03 00 00 mov %ecx,0x300(%eax) lapic[ID]; // wait for write to finish, by reading 80103eb7: 8b 40 20 mov 0x20(%eax),%eax microdelay(200); } } 80103eba: 8b 5d fc mov -0x4(%ebp),%ebx 80103ebd: c9 leave 80103ebe: c3 ret 80103ebf: 90 nop 80103ec0 : 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) { 80103ec0: 55 push %ebp 80103ec1: b8 0b 00 00 00 mov $0xb,%eax 80103ec6: ba 70 00 00 00 mov $0x70,%edx 80103ecb: 89 e5 mov %esp,%ebp 80103ecd: 57 push %edi 80103ece: 56 push %esi 80103ecf: 53 push %ebx 80103ed0: 83 ec 4c sub $0x4c,%esp 80103ed3: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103ed4: ba 71 00 00 00 mov $0x71,%edx 80103ed9: ec in (%dx),%al struct rtcdate t1, t2; int sb, bcd; sb = cmos_read(CMOS_STATB); bcd = (sb & (1 << 2)) == 0; 80103eda: 83 e0 04 and $0x4,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103edd: bb 70 00 00 00 mov $0x70,%ebx 80103ee2: 88 45 b3 mov %al,-0x4d(%ebp) 80103ee5: 8d 76 00 lea 0x0(%esi),%esi 80103ee8: 31 c0 xor %eax,%eax 80103eea: 89 da mov %ebx,%edx 80103eec: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103eed: b9 71 00 00 00 mov $0x71,%ecx 80103ef2: 89 ca mov %ecx,%edx 80103ef4: ec in (%dx),%al 80103ef5: 88 45 b7 mov %al,-0x49(%ebp) asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103ef8: 89 da mov %ebx,%edx 80103efa: b8 02 00 00 00 mov $0x2,%eax 80103eff: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103f00: 89 ca mov %ecx,%edx 80103f02: ec in (%dx),%al 80103f03: 88 45 b6 mov %al,-0x4a(%ebp) asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103f06: 89 da mov %ebx,%edx 80103f08: b8 04 00 00 00 mov $0x4,%eax 80103f0d: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103f0e: 89 ca mov %ecx,%edx 80103f10: ec in (%dx),%al 80103f11: 88 45 b5 mov %al,-0x4b(%ebp) asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103f14: 89 da mov %ebx,%edx 80103f16: b8 07 00 00 00 mov $0x7,%eax 80103f1b: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103f1c: 89 ca mov %ecx,%edx 80103f1e: ec in (%dx),%al 80103f1f: 88 45 b4 mov %al,-0x4c(%ebp) asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103f22: 89 da mov %ebx,%edx 80103f24: b8 08 00 00 00 mov $0x8,%eax 80103f29: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103f2a: 89 ca mov %ecx,%edx 80103f2c: ec in (%dx),%al 80103f2d: 89 c7 mov %eax,%edi asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103f2f: 89 da mov %ebx,%edx 80103f31: b8 09 00 00 00 mov $0x9,%eax 80103f36: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103f37: 89 ca mov %ecx,%edx 80103f39: ec in (%dx),%al 80103f3a: 89 c6 mov %eax,%esi asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103f3c: 89 da mov %ebx,%edx 80103f3e: b8 0a 00 00 00 mov $0xa,%eax 80103f43: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103f44: 89 ca mov %ecx,%edx 80103f46: 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) { 80103f47: 84 c0 test %al,%al 80103f49: 78 9d js 80103ee8 return inb(CMOS_RETURN); 80103f4b: 0f b6 45 b7 movzbl -0x49(%ebp),%eax 80103f4f: 89 fa mov %edi,%edx 80103f51: 0f b6 fa movzbl %dl,%edi 80103f54: 89 f2 mov %esi,%edx 80103f56: 89 45 b8 mov %eax,-0x48(%ebp) 80103f59: 0f b6 45 b6 movzbl -0x4a(%ebp),%eax 80103f5d: 0f b6 f2 movzbl %dl,%esi asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103f60: 89 da mov %ebx,%edx 80103f62: 89 7d c8 mov %edi,-0x38(%ebp) 80103f65: 89 45 bc mov %eax,-0x44(%ebp) 80103f68: 0f b6 45 b5 movzbl -0x4b(%ebp),%eax 80103f6c: 89 75 cc mov %esi,-0x34(%ebp) 80103f6f: 89 45 c0 mov %eax,-0x40(%ebp) 80103f72: 0f b6 45 b4 movzbl -0x4c(%ebp),%eax 80103f76: 89 45 c4 mov %eax,-0x3c(%ebp) 80103f79: 31 c0 xor %eax,%eax 80103f7b: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103f7c: 89 ca mov %ecx,%edx 80103f7e: ec in (%dx),%al 80103f7f: 0f b6 c0 movzbl %al,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103f82: 89 da mov %ebx,%edx 80103f84: 89 45 d0 mov %eax,-0x30(%ebp) 80103f87: b8 02 00 00 00 mov $0x2,%eax 80103f8c: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103f8d: 89 ca mov %ecx,%edx 80103f8f: ec in (%dx),%al 80103f90: 0f b6 c0 movzbl %al,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103f93: 89 da mov %ebx,%edx 80103f95: 89 45 d4 mov %eax,-0x2c(%ebp) 80103f98: b8 04 00 00 00 mov $0x4,%eax 80103f9d: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103f9e: 89 ca mov %ecx,%edx 80103fa0: ec in (%dx),%al 80103fa1: 0f b6 c0 movzbl %al,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103fa4: 89 da mov %ebx,%edx 80103fa6: 89 45 d8 mov %eax,-0x28(%ebp) 80103fa9: b8 07 00 00 00 mov $0x7,%eax 80103fae: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103faf: 89 ca mov %ecx,%edx 80103fb1: ec in (%dx),%al 80103fb2: 0f b6 c0 movzbl %al,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103fb5: 89 da mov %ebx,%edx 80103fb7: 89 45 dc mov %eax,-0x24(%ebp) 80103fba: b8 08 00 00 00 mov $0x8,%eax 80103fbf: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103fc0: 89 ca mov %ecx,%edx 80103fc2: ec in (%dx),%al 80103fc3: 0f b6 c0 movzbl %al,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80103fc6: 89 da mov %ebx,%edx 80103fc8: 89 45 e0 mov %eax,-0x20(%ebp) 80103fcb: b8 09 00 00 00 mov $0x9,%eax 80103fd0: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80103fd1: 89 ca mov %ecx,%edx 80103fd3: ec in (%dx),%al 80103fd4: 0f b6 c0 movzbl %al,%eax continue; } fill_rtcdate(&t2); if (memcmp(&t1, &t2, sizeof(t1)) == 0) { 80103fd7: 83 ec 04 sub $0x4,%esp return inb(CMOS_RETURN); 80103fda: 89 45 e4 mov %eax,-0x1c(%ebp) if (memcmp(&t1, &t2, sizeof(t1)) == 0) { 80103fdd: 8d 45 d0 lea -0x30(%ebp),%eax 80103fe0: 6a 18 push $0x18 80103fe2: 50 push %eax 80103fe3: 8d 45 b8 lea -0x48(%ebp),%eax 80103fe6: 50 push %eax 80103fe7: e8 a4 1c 00 00 call 80105c90 80103fec: 83 c4 10 add $0x10,%esp 80103fef: 85 c0 test %eax,%eax 80103ff1: 0f 85 f1 fe ff ff jne 80103ee8 break; } } // convert if (bcd) { 80103ff7: 80 7d b3 00 cmpb $0x0,-0x4d(%ebp) 80103ffb: 75 78 jne 80104075 #define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf)) CONV(second); 80103ffd: 8b 45 b8 mov -0x48(%ebp),%eax 80104000: 89 c2 mov %eax,%edx 80104002: 83 e0 0f and $0xf,%eax 80104005: c1 ea 04 shr $0x4,%edx 80104008: 8d 14 92 lea (%edx,%edx,4),%edx 8010400b: 8d 04 50 lea (%eax,%edx,2),%eax 8010400e: 89 45 b8 mov %eax,-0x48(%ebp) CONV(minute); 80104011: 8b 45 bc mov -0x44(%ebp),%eax 80104014: 89 c2 mov %eax,%edx 80104016: 83 e0 0f and $0xf,%eax 80104019: c1 ea 04 shr $0x4,%edx 8010401c: 8d 14 92 lea (%edx,%edx,4),%edx 8010401f: 8d 04 50 lea (%eax,%edx,2),%eax 80104022: 89 45 bc mov %eax,-0x44(%ebp) CONV(hour ); 80104025: 8b 45 c0 mov -0x40(%ebp),%eax 80104028: 89 c2 mov %eax,%edx 8010402a: 83 e0 0f and $0xf,%eax 8010402d: c1 ea 04 shr $0x4,%edx 80104030: 8d 14 92 lea (%edx,%edx,4),%edx 80104033: 8d 04 50 lea (%eax,%edx,2),%eax 80104036: 89 45 c0 mov %eax,-0x40(%ebp) CONV(day ); 80104039: 8b 45 c4 mov -0x3c(%ebp),%eax 8010403c: 89 c2 mov %eax,%edx 8010403e: 83 e0 0f and $0xf,%eax 80104041: c1 ea 04 shr $0x4,%edx 80104044: 8d 14 92 lea (%edx,%edx,4),%edx 80104047: 8d 04 50 lea (%eax,%edx,2),%eax 8010404a: 89 45 c4 mov %eax,-0x3c(%ebp) CONV(month ); 8010404d: 8b 45 c8 mov -0x38(%ebp),%eax 80104050: 89 c2 mov %eax,%edx 80104052: 83 e0 0f and $0xf,%eax 80104055: c1 ea 04 shr $0x4,%edx 80104058: 8d 14 92 lea (%edx,%edx,4),%edx 8010405b: 8d 04 50 lea (%eax,%edx,2),%eax 8010405e: 89 45 c8 mov %eax,-0x38(%ebp) CONV(year ); 80104061: 8b 45 cc mov -0x34(%ebp),%eax 80104064: 89 c2 mov %eax,%edx 80104066: 83 e0 0f and $0xf,%eax 80104069: c1 ea 04 shr $0x4,%edx 8010406c: 8d 14 92 lea (%edx,%edx,4),%edx 8010406f: 8d 04 50 lea (%eax,%edx,2),%eax 80104072: 89 45 cc mov %eax,-0x34(%ebp) #undef CONV } *r = t1; 80104075: 8b 75 08 mov 0x8(%ebp),%esi 80104078: 8b 45 b8 mov -0x48(%ebp),%eax 8010407b: 89 06 mov %eax,(%esi) 8010407d: 8b 45 bc mov -0x44(%ebp),%eax 80104080: 89 46 04 mov %eax,0x4(%esi) 80104083: 8b 45 c0 mov -0x40(%ebp),%eax 80104086: 89 46 08 mov %eax,0x8(%esi) 80104089: 8b 45 c4 mov -0x3c(%ebp),%eax 8010408c: 89 46 0c mov %eax,0xc(%esi) 8010408f: 8b 45 c8 mov -0x38(%ebp),%eax 80104092: 89 46 10 mov %eax,0x10(%esi) 80104095: 8b 45 cc mov -0x34(%ebp),%eax 80104098: 89 46 14 mov %eax,0x14(%esi) r->year += 2000; 8010409b: 81 46 14 d0 07 00 00 addl $0x7d0,0x14(%esi) } 801040a2: 8d 65 f4 lea -0xc(%ebp),%esp 801040a5: 5b pop %ebx 801040a6: 5e pop %esi 801040a7: 5f pop %edi 801040a8: 5d pop %ebp 801040a9: c3 ret 801040aa: 66 90 xchg %ax,%ax 801040ac: 66 90 xchg %ax,%ax 801040ae: 66 90 xchg %ax,%ax 801040b0 : static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 801040b0: 8b 0d 68 de 11 80 mov 0x8011de68,%ecx 801040b6: 85 c9 test %ecx,%ecx 801040b8: 0f 8e 8a 00 00 00 jle 80104148 { 801040be: 55 push %ebp 801040bf: 89 e5 mov %esp,%ebp 801040c1: 57 push %edi for (tail = 0; tail < log.lh.n; tail++) { 801040c2: 31 ff xor %edi,%edi { 801040c4: 56 push %esi 801040c5: 53 push %ebx 801040c6: 83 ec 0c sub $0xc,%esp 801040c9: 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 801040d0: a1 54 de 11 80 mov 0x8011de54,%eax 801040d5: 83 ec 08 sub $0x8,%esp 801040d8: 01 f8 add %edi,%eax 801040da: 83 c0 01 add $0x1,%eax 801040dd: 50 push %eax 801040de: ff 35 64 de 11 80 push 0x8011de64 801040e4: e8 e7 bf ff ff call 801000d0 801040e9: 89 c6 mov %eax,%esi struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 801040eb: 58 pop %eax 801040ec: 5a pop %edx 801040ed: ff 34 bd 6c de 11 80 push -0x7fee2194(,%edi,4) 801040f4: ff 35 64 de 11 80 push 0x8011de64 for (tail = 0; tail < log.lh.n; tail++) { 801040fa: 83 c7 01 add $0x1,%edi struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 801040fd: e8 ce bf ff ff call 801000d0 memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 80104102: 83 c4 0c add $0xc,%esp struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 80104105: 89 c3 mov %eax,%ebx memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 80104107: 8d 46 5c lea 0x5c(%esi),%eax 8010410a: 68 00 02 00 00 push $0x200 8010410f: 50 push %eax 80104110: 8d 43 5c lea 0x5c(%ebx),%eax 80104113: 50 push %eax 80104114: e8 c7 1b 00 00 call 80105ce0 bwrite(dbuf); // write dst to disk 80104119: 89 1c 24 mov %ebx,(%esp) 8010411c: e8 8f c0 ff ff call 801001b0 brelse(lbuf); 80104121: 89 34 24 mov %esi,(%esp) 80104124: e8 c7 c0 ff ff call 801001f0 brelse(dbuf); 80104129: 89 1c 24 mov %ebx,(%esp) 8010412c: e8 bf c0 ff ff call 801001f0 for (tail = 0; tail < log.lh.n; tail++) { 80104131: 83 c4 10 add $0x10,%esp 80104134: 39 3d 68 de 11 80 cmp %edi,0x8011de68 8010413a: 7f 94 jg 801040d0 } } 8010413c: 8d 65 f4 lea -0xc(%ebp),%esp 8010413f: 5b pop %ebx 80104140: 5e pop %esi 80104141: 5f pop %edi 80104142: 5d pop %ebp 80104143: c3 ret 80104144: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104148: c3 ret 80104149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104150 : // Write in-memory log header to disk. // This is the true point at which the // current transaction commits. static void write_head(void) { 80104150: 55 push %ebp 80104151: 89 e5 mov %esp,%ebp 80104153: 53 push %ebx 80104154: 83 ec 0c sub $0xc,%esp struct buf *buf = bread(log.dev, log.start); 80104157: ff 35 54 de 11 80 push 0x8011de54 8010415d: ff 35 64 de 11 80 push 0x8011de64 80104163: e8 68 bf 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++) { 80104168: 83 c4 10 add $0x10,%esp struct buf *buf = bread(log.dev, log.start); 8010416b: 89 c3 mov %eax,%ebx hb->n = log.lh.n; 8010416d: a1 68 de 11 80 mov 0x8011de68,%eax 80104172: 89 43 5c mov %eax,0x5c(%ebx) for (i = 0; i < log.lh.n; i++) { 80104175: 85 c0 test %eax,%eax 80104177: 7e 19 jle 80104192 80104179: 31 d2 xor %edx,%edx 8010417b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010417f: 90 nop hb->block[i] = log.lh.block[i]; 80104180: 8b 0c 95 6c de 11 80 mov -0x7fee2194(,%edx,4),%ecx 80104187: 89 4c 93 60 mov %ecx,0x60(%ebx,%edx,4) for (i = 0; i < log.lh.n; i++) { 8010418b: 83 c2 01 add $0x1,%edx 8010418e: 39 d0 cmp %edx,%eax 80104190: 75 ee jne 80104180 } bwrite(buf); 80104192: 83 ec 0c sub $0xc,%esp 80104195: 53 push %ebx 80104196: e8 15 c0 ff ff call 801001b0 brelse(buf); 8010419b: 89 1c 24 mov %ebx,(%esp) 8010419e: e8 4d c0 ff ff call 801001f0 } 801041a3: 8b 5d fc mov -0x4(%ebp),%ebx 801041a6: 83 c4 10 add $0x10,%esp 801041a9: c9 leave 801041aa: c3 ret 801041ab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801041af: 90 nop 801041b0 : { 801041b0: 55 push %ebp 801041b1: 89 e5 mov %esp,%ebp 801041b3: 53 push %ebx 801041b4: 83 ec 2c sub $0x2c,%esp 801041b7: 8b 5d 08 mov 0x8(%ebp),%ebx initlock(&log.lock, "log"); 801041ba: 68 c0 8e 10 80 push $0x80108ec0 801041bf: 68 20 de 11 80 push $0x8011de20 801041c4: e8 e7 17 00 00 call 801059b0 readsb(dev, &sb); 801041c9: 58 pop %eax 801041ca: 8d 45 dc lea -0x24(%ebp),%eax 801041cd: 5a pop %edx 801041ce: 50 push %eax 801041cf: 53 push %ebx 801041d0: e8 3b e8 ff ff call 80102a10 log.start = sb.logstart; 801041d5: 8b 45 ec mov -0x14(%ebp),%eax struct buf *buf = bread(log.dev, log.start); 801041d8: 59 pop %ecx log.dev = dev; 801041d9: 89 1d 64 de 11 80 mov %ebx,0x8011de64 log.size = sb.nlog; 801041df: 8b 55 e8 mov -0x18(%ebp),%edx log.start = sb.logstart; 801041e2: a3 54 de 11 80 mov %eax,0x8011de54 log.size = sb.nlog; 801041e7: 89 15 58 de 11 80 mov %edx,0x8011de58 struct buf *buf = bread(log.dev, log.start); 801041ed: 5a pop %edx 801041ee: 50 push %eax 801041ef: 53 push %ebx 801041f0: e8 db be ff ff call 801000d0 for (i = 0; i < log.lh.n; i++) { 801041f5: 83 c4 10 add $0x10,%esp log.lh.n = lh->n; 801041f8: 8b 58 5c mov 0x5c(%eax),%ebx 801041fb: 89 1d 68 de 11 80 mov %ebx,0x8011de68 for (i = 0; i < log.lh.n; i++) { 80104201: 85 db test %ebx,%ebx 80104203: 7e 1d jle 80104222 80104205: 31 d2 xor %edx,%edx 80104207: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010420e: 66 90 xchg %ax,%ax log.lh.block[i] = lh->block[i]; 80104210: 8b 4c 90 60 mov 0x60(%eax,%edx,4),%ecx 80104214: 89 0c 95 6c de 11 80 mov %ecx,-0x7fee2194(,%edx,4) for (i = 0; i < log.lh.n; i++) { 8010421b: 83 c2 01 add $0x1,%edx 8010421e: 39 d3 cmp %edx,%ebx 80104220: 75 ee jne 80104210 brelse(buf); 80104222: 83 ec 0c sub $0xc,%esp 80104225: 50 push %eax 80104226: e8 c5 bf ff ff call 801001f0 static void recover_from_log(void) { read_head(); install_trans(); // if committed, copy from log to disk 8010422b: e8 80 fe ff ff call 801040b0 log.lh.n = 0; 80104230: c7 05 68 de 11 80 00 movl $0x0,0x8011de68 80104237: 00 00 00 write_head(); // clear the log 8010423a: e8 11 ff ff ff call 80104150 } 8010423f: 8b 5d fc mov -0x4(%ebp),%ebx 80104242: 83 c4 10 add $0x10,%esp 80104245: c9 leave 80104246: c3 ret 80104247: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010424e: 66 90 xchg %ax,%ax 80104250 : } // called at the start of each FS system call. void begin_op(void) { 80104250: 55 push %ebp 80104251: 89 e5 mov %esp,%ebp 80104253: 83 ec 14 sub $0x14,%esp acquire(&log.lock); 80104256: 68 20 de 11 80 push $0x8011de20 8010425b: e8 20 19 00 00 call 80105b80 80104260: 83 c4 10 add $0x10,%esp 80104263: eb 18 jmp 8010427d 80104265: 8d 76 00 lea 0x0(%esi),%esi while(1){ if(log.committing){ sleep(&log, &log.lock); 80104268: 83 ec 08 sub $0x8,%esp 8010426b: 68 20 de 11 80 push $0x8011de20 80104270: 68 20 de 11 80 push $0x8011de20 80104275: e8 66 13 00 00 call 801055e0 8010427a: 83 c4 10 add $0x10,%esp if(log.committing){ 8010427d: a1 60 de 11 80 mov 0x8011de60,%eax 80104282: 85 c0 test %eax,%eax 80104284: 75 e2 jne 80104268 } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ 80104286: a1 5c de 11 80 mov 0x8011de5c,%eax 8010428b: 8b 15 68 de 11 80 mov 0x8011de68,%edx 80104291: 83 c0 01 add $0x1,%eax 80104294: 8d 0c 80 lea (%eax,%eax,4),%ecx 80104297: 8d 14 4a lea (%edx,%ecx,2),%edx 8010429a: 83 fa 1e cmp $0x1e,%edx 8010429d: 7f c9 jg 80104268 // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); } else { log.outstanding += 1; release(&log.lock); 8010429f: 83 ec 0c sub $0xc,%esp log.outstanding += 1; 801042a2: a3 5c de 11 80 mov %eax,0x8011de5c release(&log.lock); 801042a7: 68 20 de 11 80 push $0x8011de20 801042ac: e8 6f 18 00 00 call 80105b20 break; } } } 801042b1: 83 c4 10 add $0x10,%esp 801042b4: c9 leave 801042b5: c3 ret 801042b6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801042bd: 8d 76 00 lea 0x0(%esi),%esi 801042c0 : // called at the end of each FS system call. // commits if this was the last outstanding operation. void end_op(void) { 801042c0: 55 push %ebp 801042c1: 89 e5 mov %esp,%ebp 801042c3: 57 push %edi 801042c4: 56 push %esi 801042c5: 53 push %ebx 801042c6: 83 ec 18 sub $0x18,%esp int do_commit = 0; acquire(&log.lock); 801042c9: 68 20 de 11 80 push $0x8011de20 801042ce: e8 ad 18 00 00 call 80105b80 log.outstanding -= 1; 801042d3: a1 5c de 11 80 mov 0x8011de5c,%eax if(log.committing) 801042d8: 8b 35 60 de 11 80 mov 0x8011de60,%esi 801042de: 83 c4 10 add $0x10,%esp log.outstanding -= 1; 801042e1: 8d 58 ff lea -0x1(%eax),%ebx 801042e4: 89 1d 5c de 11 80 mov %ebx,0x8011de5c if(log.committing) 801042ea: 85 f6 test %esi,%esi 801042ec: 0f 85 22 01 00 00 jne 80104414 panic("log.committing"); if(log.outstanding == 0){ 801042f2: 85 db test %ebx,%ebx 801042f4: 0f 85 f6 00 00 00 jne 801043f0 do_commit = 1; log.committing = 1; 801042fa: c7 05 60 de 11 80 01 movl $0x1,0x8011de60 80104301: 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); 80104304: 83 ec 0c sub $0xc,%esp 80104307: 68 20 de 11 80 push $0x8011de20 8010430c: e8 0f 18 00 00 call 80105b20 } static void commit() { if (log.lh.n > 0) { 80104311: 8b 0d 68 de 11 80 mov 0x8011de68,%ecx 80104317: 83 c4 10 add $0x10,%esp 8010431a: 85 c9 test %ecx,%ecx 8010431c: 7f 42 jg 80104360 acquire(&log.lock); 8010431e: 83 ec 0c sub $0xc,%esp 80104321: 68 20 de 11 80 push $0x8011de20 80104326: e8 55 18 00 00 call 80105b80 wakeup(&log); 8010432b: c7 04 24 20 de 11 80 movl $0x8011de20,(%esp) log.committing = 0; 80104332: c7 05 60 de 11 80 00 movl $0x0,0x8011de60 80104339: 00 00 00 wakeup(&log); 8010433c: e8 5f 13 00 00 call 801056a0 release(&log.lock); 80104341: c7 04 24 20 de 11 80 movl $0x8011de20,(%esp) 80104348: e8 d3 17 00 00 call 80105b20 8010434d: 83 c4 10 add $0x10,%esp } 80104350: 8d 65 f4 lea -0xc(%ebp),%esp 80104353: 5b pop %ebx 80104354: 5e pop %esi 80104355: 5f pop %edi 80104356: 5d pop %ebp 80104357: c3 ret 80104358: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010435f: 90 nop struct buf *to = bread(log.dev, log.start+tail+1); // log block 80104360: a1 54 de 11 80 mov 0x8011de54,%eax 80104365: 83 ec 08 sub $0x8,%esp 80104368: 01 d8 add %ebx,%eax 8010436a: 83 c0 01 add $0x1,%eax 8010436d: 50 push %eax 8010436e: ff 35 64 de 11 80 push 0x8011de64 80104374: e8 57 bd ff ff call 801000d0 80104379: 89 c6 mov %eax,%esi struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 8010437b: 58 pop %eax 8010437c: 5a pop %edx 8010437d: ff 34 9d 6c de 11 80 push -0x7fee2194(,%ebx,4) 80104384: ff 35 64 de 11 80 push 0x8011de64 for (tail = 0; tail < log.lh.n; tail++) { 8010438a: 83 c3 01 add $0x1,%ebx struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 8010438d: e8 3e bd ff ff call 801000d0 memmove(to->data, from->data, BSIZE); 80104392: 83 c4 0c add $0xc,%esp struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80104395: 89 c7 mov %eax,%edi memmove(to->data, from->data, BSIZE); 80104397: 8d 40 5c lea 0x5c(%eax),%eax 8010439a: 68 00 02 00 00 push $0x200 8010439f: 50 push %eax 801043a0: 8d 46 5c lea 0x5c(%esi),%eax 801043a3: 50 push %eax 801043a4: e8 37 19 00 00 call 80105ce0 bwrite(to); // write the log 801043a9: 89 34 24 mov %esi,(%esp) 801043ac: e8 ff bd ff ff call 801001b0 brelse(from); 801043b1: 89 3c 24 mov %edi,(%esp) 801043b4: e8 37 be ff ff call 801001f0 brelse(to); 801043b9: 89 34 24 mov %esi,(%esp) 801043bc: e8 2f be ff ff call 801001f0 for (tail = 0; tail < log.lh.n; tail++) { 801043c1: 83 c4 10 add $0x10,%esp 801043c4: 3b 1d 68 de 11 80 cmp 0x8011de68,%ebx 801043ca: 7c 94 jl 80104360 write_log(); // Write modified blocks from cache to log write_head(); // Write header to disk -- the real commit 801043cc: e8 7f fd ff ff call 80104150 install_trans(); // Now install writes to home locations 801043d1: e8 da fc ff ff call 801040b0 log.lh.n = 0; 801043d6: c7 05 68 de 11 80 00 movl $0x0,0x8011de68 801043dd: 00 00 00 write_head(); // Erase the transaction from the log 801043e0: e8 6b fd ff ff call 80104150 801043e5: e9 34 ff ff ff jmp 8010431e 801043ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi wakeup(&log); 801043f0: 83 ec 0c sub $0xc,%esp 801043f3: 68 20 de 11 80 push $0x8011de20 801043f8: e8 a3 12 00 00 call 801056a0 release(&log.lock); 801043fd: c7 04 24 20 de 11 80 movl $0x8011de20,(%esp) 80104404: e8 17 17 00 00 call 80105b20 80104409: 83 c4 10 add $0x10,%esp } 8010440c: 8d 65 f4 lea -0xc(%ebp),%esp 8010440f: 5b pop %ebx 80104410: 5e pop %esi 80104411: 5f pop %edi 80104412: 5d pop %ebp 80104413: c3 ret panic("log.committing"); 80104414: 83 ec 0c sub $0xc,%esp 80104417: 68 c4 8e 10 80 push $0x80108ec4 8010441c: e8 5f c0 ff ff call 80100480 80104421: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104428: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010442f: 90 nop 80104430 : // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { 80104430: 55 push %ebp 80104431: 89 e5 mov %esp,%ebp 80104433: 53 push %ebx 80104434: 83 ec 04 sub $0x4,%esp int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80104437: 8b 15 68 de 11 80 mov 0x8011de68,%edx { 8010443d: 8b 5d 08 mov 0x8(%ebp),%ebx if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80104440: 83 fa 1d cmp $0x1d,%edx 80104443: 0f 8f 85 00 00 00 jg 801044ce 80104449: a1 58 de 11 80 mov 0x8011de58,%eax 8010444e: 83 e8 01 sub $0x1,%eax 80104451: 39 c2 cmp %eax,%edx 80104453: 7d 79 jge 801044ce panic("too big a transaction"); if (log.outstanding < 1) 80104455: a1 5c de 11 80 mov 0x8011de5c,%eax 8010445a: 85 c0 test %eax,%eax 8010445c: 7e 7d jle 801044db panic("log_write outside of trans"); acquire(&log.lock); 8010445e: 83 ec 0c sub $0xc,%esp 80104461: 68 20 de 11 80 push $0x8011de20 80104466: e8 15 17 00 00 call 80105b80 for (i = 0; i < log.lh.n; i++) { 8010446b: 8b 15 68 de 11 80 mov 0x8011de68,%edx 80104471: 83 c4 10 add $0x10,%esp 80104474: 85 d2 test %edx,%edx 80104476: 7e 4a jle 801044c2 if (log.lh.block[i] == b->blockno) // log absorbtion 80104478: 8b 4b 08 mov 0x8(%ebx),%ecx for (i = 0; i < log.lh.n; i++) { 8010447b: 31 c0 xor %eax,%eax 8010447d: eb 08 jmp 80104487 8010447f: 90 nop 80104480: 83 c0 01 add $0x1,%eax 80104483: 39 c2 cmp %eax,%edx 80104485: 74 29 je 801044b0 if (log.lh.block[i] == b->blockno) // log absorbtion 80104487: 39 0c 85 6c de 11 80 cmp %ecx,-0x7fee2194(,%eax,4) 8010448e: 75 f0 jne 80104480 break; } log.lh.block[i] = b->blockno; 80104490: 89 0c 85 6c de 11 80 mov %ecx,-0x7fee2194(,%eax,4) if (i == log.lh.n) log.lh.n++; b->flags |= B_DIRTY; // prevent eviction 80104497: 83 0b 04 orl $0x4,(%ebx) release(&log.lock); } 8010449a: 8b 5d fc mov -0x4(%ebp),%ebx release(&log.lock); 8010449d: c7 45 08 20 de 11 80 movl $0x8011de20,0x8(%ebp) } 801044a4: c9 leave release(&log.lock); 801044a5: e9 76 16 00 00 jmp 80105b20 801044aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi log.lh.block[i] = b->blockno; 801044b0: 89 0c 95 6c de 11 80 mov %ecx,-0x7fee2194(,%edx,4) log.lh.n++; 801044b7: 83 c2 01 add $0x1,%edx 801044ba: 89 15 68 de 11 80 mov %edx,0x8011de68 801044c0: eb d5 jmp 80104497 log.lh.block[i] = b->blockno; 801044c2: 8b 43 08 mov 0x8(%ebx),%eax 801044c5: a3 6c de 11 80 mov %eax,0x8011de6c if (i == log.lh.n) 801044ca: 75 cb jne 80104497 801044cc: eb e9 jmp 801044b7 panic("too big a transaction"); 801044ce: 83 ec 0c sub $0xc,%esp 801044d1: 68 d3 8e 10 80 push $0x80108ed3 801044d6: e8 a5 bf ff ff call 80100480 panic("log_write outside of trans"); 801044db: 83 ec 0c sub $0xc,%esp 801044de: 68 e9 8e 10 80 push $0x80108ee9 801044e3: e8 98 bf ff ff call 80100480 801044e8: 66 90 xchg %ax,%ax 801044ea: 66 90 xchg %ax,%ax 801044ec: 66 90 xchg %ax,%ax 801044ee: 66 90 xchg %ax,%ax 801044f0 : lapicinit(); mpmain(); } // Common CPU setup code. static void mpmain(void) { 801044f0: 55 push %ebp 801044f1: 89 e5 mov %esp,%ebp 801044f3: 53 push %ebx 801044f4: 83 ec 04 sub $0x4,%esp cprintf("cpu%d: starting %d\n", cpuid(), cpuid()); 801044f7: e8 94 09 00 00 call 80104e90 801044fc: 89 c3 mov %eax,%ebx 801044fe: e8 8d 09 00 00 call 80104e90 80104503: 83 ec 04 sub $0x4,%esp 80104506: 53 push %ebx 80104507: 50 push %eax 80104508: 68 04 8f 10 80 push $0x80108f04 8010450d: e8 7e c3 ff ff call 80100890 idtinit(); // load idt register 80104512: e8 69 2b 00 00 call 80107080 xchg(&(mycpu()->started), 1); // tell startothers() we're up 80104517: e8 14 09 00 00 call 80104e30 8010451c: 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" : 8010451e: b8 01 00 00 00 mov $0x1,%eax 80104523: f0 87 82 a0 00 00 00 lock xchg %eax,0xa0(%edx) scheduler(); // start running processes 8010452a: e8 61 0c 00 00 call 80105190 8010452f: 90 nop 80104530 : static void mpenter(void) { 80104530: 55 push %ebp 80104531: 89 e5 mov %esp,%ebp 80104533: 83 ec 08 sub $0x8,%esp switchkvm(); 80104536: e8 35 3c 00 00 call 80108170 seginit(); 8010453b: e8 a0 3b 00 00 call 801080e0 lapicinit(); 80104540: e8 9b f7 ff ff call 80103ce0 mpmain(); 80104545: e8 a6 ff ff ff call 801044f0 8010454a: 66 90 xchg %ax,%ax 8010454c: 66 90 xchg %ax,%ax 8010454e: 66 90 xchg %ax,%ax 80104550
: int main(void) { 80104550: 8d 4c 24 04 lea 0x4(%esp),%ecx 80104554: 83 e4 f0 and $0xfffffff0,%esp 80104557: ff 71 fc push -0x4(%ecx) 8010455a: 55 push %ebp 8010455b: 89 e5 mov %esp,%ebp 8010455d: 53 push %ebx 8010455e: 51 push %ecx kinit1(end, P2V(4 * 1024 * 1024)); // phys page allocator 8010455f: 83 ec 08 sub $0x8,%esp 80104562: 68 00 00 40 80 push $0x80400000 80104567: 68 50 22 12 80 push $0x80122250 8010456c: e8 8f f5 ff ff call 80103b00 kvmalloc(); // kernel page table 80104571: e8 ea 40 00 00 call 80108660 mpinit(); // detect other processors 80104576: e8 85 01 00 00 call 80104700 lapicinit(); // interrupt controller 8010457b: e8 60 f7 ff ff call 80103ce0 seginit(); // segment descriptors 80104580: e8 5b 3b 00 00 call 801080e0 picinit(); // disable pic 80104585: e8 76 03 00 00 call 80104900 ioapicinit(); // another interrupt controller 8010458a: e8 31 f3 ff ff call 801038c0 consoleinit(); // console hardware 8010458f: e8 4c cc ff ff call 801011e0 uartinit(); // serial port 80104594: e8 d7 2d 00 00 call 80107370 pinit(); // process table 80104599: e8 72 08 00 00 call 80104e10 tvinit(); // trap vectors 8010459e: e8 5d 2a 00 00 call 80107000 binit(); // buffer cache 801045a3: e8 98 ba ff ff call 80100040 fileinit(); // file table 801045a8: e8 53 dd ff ff call 80102300 ideinit(); // disk 801045ad: e8 fe f0 ff ff call 801036b0 // 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); 801045b2: 83 c4 0c add $0xc,%esp 801045b5: 68 7a 00 00 00 push $0x7a 801045ba: 68 8c c4 10 80 push $0x8010c48c 801045bf: 68 00 70 00 80 push $0x80007000 801045c4: e8 17 17 00 00 call 80105ce0 for (c = cpus; c < cpus + ncpu; c++) { 801045c9: 83 c4 10 add $0x10,%esp 801045cc: 69 05 04 df 11 80 b0 imul $0xb0,0x8011df04,%eax 801045d3: 00 00 00 801045d6: 05 20 df 11 80 add $0x8011df20,%eax 801045db: 3d 20 df 11 80 cmp $0x8011df20,%eax 801045e0: 76 7e jbe 80104660 801045e2: bb 20 df 11 80 mov $0x8011df20,%ebx 801045e7: eb 20 jmp 80104609 801045e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801045f0: 69 05 04 df 11 80 b0 imul $0xb0,0x8011df04,%eax 801045f7: 00 00 00 801045fa: 81 c3 b0 00 00 00 add $0xb0,%ebx 80104600: 05 20 df 11 80 add $0x8011df20,%eax 80104605: 39 c3 cmp %eax,%ebx 80104607: 73 57 jae 80104660 if (c == mycpu()) { // We've started already. 80104609: e8 22 08 00 00 call 80104e30 8010460e: 39 c3 cmp %eax,%ebx 80104610: 74 de je 801045f0 } // 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(); 80104612: e8 59 f5 ff ff call 80103b70 *(void**)(code - 4) = stack + KSTACKSIZE; *(void(**)(void))(code - 8) = mpenter; *(int**)(code - 12) = (void *) V2P(entrypgdir); lapicstartap(c->apicid, V2P(code)); 80104617: 83 ec 08 sub $0x8,%esp *(void(**)(void))(code - 8) = mpenter; 8010461a: c7 05 f8 6f 00 80 30 movl $0x80104530,0x80006ff8 80104621: 45 10 80 *(int**)(code - 12) = (void *) V2P(entrypgdir); 80104624: c7 05 f4 6f 00 80 00 movl $0x10b000,0x80006ff4 8010462b: b0 10 00 *(void**)(code - 4) = stack + KSTACKSIZE; 8010462e: 05 00 10 00 00 add $0x1000,%eax 80104633: a3 fc 6f 00 80 mov %eax,0x80006ffc lapicstartap(c->apicid, V2P(code)); 80104638: 0f b6 03 movzbl (%ebx),%eax 8010463b: 68 00 70 00 00 push $0x7000 80104640: 50 push %eax 80104641: e8 ea f7 ff ff call 80103e30 // wait for cpu to finish mpmain() while (c->started == 0) { 80104646: 83 c4 10 add $0x10,%esp 80104649: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104650: 8b 83 a0 00 00 00 mov 0xa0(%ebx),%eax 80104656: 85 c0 test %eax,%eax 80104658: 74 f6 je 80104650 8010465a: eb 94 jmp 801045f0 8010465c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi kinit2(P2V(4 * 1024 * 1024), P2V(PHYSTOP)); // must come after startothers() 80104660: 83 ec 08 sub $0x8,%esp 80104663: 68 00 00 00 8e push $0x8e000000 80104668: 68 00 00 40 80 push $0x80400000 8010466d: e8 2e f4 ff ff call 80103aa0 userinit(); // first user process 80104672: e8 69 08 00 00 call 80104ee0 mpmain(); // finish this processor's setup 80104677: e8 74 fe ff ff call 801044f0 8010467c: 66 90 xchg %ax,%ax 8010467e: 66 90 xchg %ax,%ax 80104680 : } return sum; } // Look for an MP structure in the len bytes at addr. static struct mp*mpsearch1(uint a, int len) { 80104680: 55 push %ebp 80104681: 89 e5 mov %esp,%ebp 80104683: 57 push %edi 80104684: 56 push %esi uchar *e, *p, *addr; addr = P2V(a); 80104685: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi static struct mp*mpsearch1(uint a, int len) { 8010468b: 53 push %ebx e = addr + len; 8010468c: 8d 1c 16 lea (%esi,%edx,1),%ebx static struct mp*mpsearch1(uint a, int len) { 8010468f: 83 ec 0c sub $0xc,%esp for (p = addr; p < e; p += sizeof(struct mp)) { 80104692: 39 de cmp %ebx,%esi 80104694: 72 10 jb 801046a6 80104696: eb 50 jmp 801046e8 80104698: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010469f: 90 nop 801046a0: 89 fe mov %edi,%esi 801046a2: 39 fb cmp %edi,%ebx 801046a4: 76 42 jbe 801046e8 if (memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) { 801046a6: 83 ec 04 sub $0x4,%esp 801046a9: 8d 7e 10 lea 0x10(%esi),%edi 801046ac: 6a 04 push $0x4 801046ae: 68 18 8f 10 80 push $0x80108f18 801046b3: 56 push %esi 801046b4: e8 d7 15 00 00 call 80105c90 801046b9: 83 c4 10 add $0x10,%esp 801046bc: 85 c0 test %eax,%eax 801046be: 75 e0 jne 801046a0 801046c0: 89 f2 mov %esi,%edx 801046c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi sum += addr[i]; 801046c8: 0f b6 0a movzbl (%edx),%ecx for (i = 0; i < len; i++) { 801046cb: 83 c2 01 add $0x1,%edx sum += addr[i]; 801046ce: 01 c8 add %ecx,%eax for (i = 0; i < len; i++) { 801046d0: 39 fa cmp %edi,%edx 801046d2: 75 f4 jne 801046c8 if (memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) { 801046d4: 84 c0 test %al,%al 801046d6: 75 c8 jne 801046a0 return (struct mp*)p; } } return 0; } 801046d8: 8d 65 f4 lea -0xc(%ebp),%esp 801046db: 89 f0 mov %esi,%eax 801046dd: 5b pop %ebx 801046de: 5e pop %esi 801046df: 5f pop %edi 801046e0: 5d pop %ebp 801046e1: c3 ret 801046e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801046e8: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 801046eb: 31 f6 xor %esi,%esi } 801046ed: 5b pop %ebx 801046ee: 89 f0 mov %esi,%eax 801046f0: 5e pop %esi 801046f1: 5f pop %edi 801046f2: 5d pop %ebp 801046f3: c3 ret 801046f4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801046fb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801046ff: 90 nop 80104700 : } *pmp = mp; return conf; } void mpinit(void) { 80104700: 55 push %ebp 80104701: 89 e5 mov %esp,%ebp 80104703: 57 push %edi 80104704: 56 push %esi 80104705: 53 push %ebx 80104706: 83 ec 1c sub $0x1c,%esp if ((p = ((bda[0x0F] << 8) | bda[0x0E]) << 4)) { 80104709: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax 80104710: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx 80104717: c1 e0 08 shl $0x8,%eax 8010471a: 09 d0 or %edx,%eax 8010471c: c1 e0 04 shl $0x4,%eax 8010471f: 75 1b jne 8010473c p = ((bda[0x14] << 8) | bda[0x13]) * 1024; 80104721: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax 80104728: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx 8010472f: c1 e0 08 shl $0x8,%eax 80104732: 09 d0 or %edx,%eax 80104734: c1 e0 0a shl $0xa,%eax if ((mp = mpsearch1(p - 1024, 1024))) { 80104737: 2d 00 04 00 00 sub $0x400,%eax if ((mp = mpsearch1(p, 1024))) { 8010473c: ba 00 04 00 00 mov $0x400,%edx 80104741: e8 3a ff ff ff call 80104680 80104746: 89 c3 mov %eax,%ebx 80104748: 85 c0 test %eax,%eax 8010474a: 0f 84 40 01 00 00 je 80104890 if ((mp = mpsearch()) == 0 || mp->physaddr == 0) { 80104750: 8b 73 04 mov 0x4(%ebx),%esi 80104753: 85 f6 test %esi,%esi 80104755: 0f 84 25 01 00 00 je 80104880 if (memcmp(conf, "PCMP", 4) != 0) { 8010475b: 83 ec 04 sub $0x4,%esp conf = (struct mpconf*) P2V((uint) mp->physaddr); 8010475e: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax if (memcmp(conf, "PCMP", 4) != 0) { 80104764: 6a 04 push $0x4 80104766: 68 1d 8f 10 80 push $0x80108f1d 8010476b: 50 push %eax conf = (struct mpconf*) P2V((uint) mp->physaddr); 8010476c: 89 45 e4 mov %eax,-0x1c(%ebp) if (memcmp(conf, "PCMP", 4) != 0) { 8010476f: e8 1c 15 00 00 call 80105c90 80104774: 83 c4 10 add $0x10,%esp 80104777: 85 c0 test %eax,%eax 80104779: 0f 85 01 01 00 00 jne 80104880 if (conf->version != 1 && conf->version != 4) { 8010477f: 0f b6 86 06 00 00 80 movzbl -0x7ffffffa(%esi),%eax 80104786: 3c 01 cmp $0x1,%al 80104788: 74 08 je 80104792 8010478a: 3c 04 cmp $0x4,%al 8010478c: 0f 85 ee 00 00 00 jne 80104880 if (sum((uchar*)conf, conf->length) != 0) { 80104792: 0f b7 96 04 00 00 80 movzwl -0x7ffffffc(%esi),%edx for (i = 0; i < len; i++) { 80104799: 66 85 d2 test %dx,%dx 8010479c: 74 22 je 801047c0 8010479e: 8d 3c 32 lea (%edx,%esi,1),%edi 801047a1: 89 f0 mov %esi,%eax sum = 0; 801047a3: 31 d2 xor %edx,%edx 801047a5: 8d 76 00 lea 0x0(%esi),%esi sum += addr[i]; 801047a8: 0f b6 88 00 00 00 80 movzbl -0x80000000(%eax),%ecx for (i = 0; i < len; i++) { 801047af: 83 c0 01 add $0x1,%eax sum += addr[i]; 801047b2: 01 ca add %ecx,%edx for (i = 0; i < len; i++) { 801047b4: 39 c7 cmp %eax,%edi 801047b6: 75 f0 jne 801047a8 if (sum((uchar*)conf, conf->length) != 0) { 801047b8: 84 d2 test %dl,%dl 801047ba: 0f 85 c0 00 00 00 jne 80104880 if ((conf = mpconfig(&mp)) == 0) { panic("Expect to run on an SMP"); } ismp = 1; lapic = (uint*)conf->lapicaddr; 801047c0: 8b 86 24 00 00 80 mov -0x7fffffdc(%esi),%eax 801047c6: a3 00 de 11 80 mov %eax,0x8011de00 for (p = (uchar*)(conf + 1), e = (uchar*)conf + conf->length; p < e;) { 801047cb: 0f b7 96 04 00 00 80 movzwl -0x7ffffffc(%esi),%edx 801047d2: 8d 86 2c 00 00 80 lea -0x7fffffd4(%esi),%eax ismp = 1; 801047d8: be 01 00 00 00 mov $0x1,%esi for (p = (uchar*)(conf + 1), e = (uchar*)conf + conf->length; p < e;) { 801047dd: 03 55 e4 add -0x1c(%ebp),%edx 801047e0: 89 5d e4 mov %ebx,-0x1c(%ebp) 801047e3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801047e7: 90 nop 801047e8: 39 d0 cmp %edx,%eax 801047ea: 73 15 jae 80104801 switch (*p) { 801047ec: 0f b6 08 movzbl (%eax),%ecx 801047ef: 80 f9 02 cmp $0x2,%cl 801047f2: 74 4c je 80104840 801047f4: 77 3a ja 80104830 801047f6: 84 c9 test %cl,%cl 801047f8: 74 56 je 80104850 p += sizeof(struct mpioapic); continue; case MPBUS: case MPIOINTR: case MPLINTR: p += 8; 801047fa: 83 c0 08 add $0x8,%eax for (p = (uchar*)(conf + 1), e = (uchar*)conf + conf->length; p < e;) { 801047fd: 39 d0 cmp %edx,%eax 801047ff: 72 eb jb 801047ec default: ismp = 0; break; } } if (!ismp) { 80104801: 8b 5d e4 mov -0x1c(%ebp),%ebx 80104804: 85 f6 test %esi,%esi 80104806: 0f 84 d9 00 00 00 je 801048e5 panic("Didn't find a suitable machine"); } if (mp->imcrp) { 8010480c: 80 7b 0c 00 cmpb $0x0,0xc(%ebx) 80104810: 74 15 je 80104827 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80104812: b8 70 00 00 00 mov $0x70,%eax 80104817: ba 22 00 00 00 mov $0x22,%edx 8010481c: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 8010481d: ba 23 00 00 00 mov $0x23,%edx 80104822: 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. 80104823: 83 c8 01 or $0x1,%eax asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80104826: ee out %al,(%dx) } } 80104827: 8d 65 f4 lea -0xc(%ebp),%esp 8010482a: 5b pop %ebx 8010482b: 5e pop %esi 8010482c: 5f pop %edi 8010482d: 5d pop %ebp 8010482e: c3 ret 8010482f: 90 nop switch (*p) { 80104830: 83 e9 03 sub $0x3,%ecx 80104833: 80 f9 01 cmp $0x1,%cl 80104836: 76 c2 jbe 801047fa 80104838: 31 f6 xor %esi,%esi 8010483a: eb ac jmp 801047e8 8010483c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ioapicid = ioapic->apicno; 80104840: 0f b6 48 01 movzbl 0x1(%eax),%ecx p += sizeof(struct mpioapic); 80104844: 83 c0 08 add $0x8,%eax ioapicid = ioapic->apicno; 80104847: 88 0d 00 df 11 80 mov %cl,0x8011df00 continue; 8010484d: eb 99 jmp 801047e8 8010484f: 90 nop if (ncpu < NCPU) { 80104850: 8b 0d 04 df 11 80 mov 0x8011df04,%ecx 80104856: 83 f9 07 cmp $0x7,%ecx 80104859: 7f 19 jg 80104874 cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu 8010485b: 69 f9 b0 00 00 00 imul $0xb0,%ecx,%edi 80104861: 0f b6 58 01 movzbl 0x1(%eax),%ebx ncpu++; 80104865: 83 c1 01 add $0x1,%ecx 80104868: 89 0d 04 df 11 80 mov %ecx,0x8011df04 cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu 8010486e: 88 9f 20 df 11 80 mov %bl,-0x7fee20e0(%edi) p += sizeof(struct mpproc); 80104874: 83 c0 14 add $0x14,%eax continue; 80104877: e9 6c ff ff ff jmp 801047e8 8010487c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi panic("Expect to run on an SMP"); 80104880: 83 ec 0c sub $0xc,%esp 80104883: 68 22 8f 10 80 push $0x80108f22 80104888: e8 f3 bb ff ff call 80100480 8010488d: 8d 76 00 lea 0x0(%esi),%esi void mpinit(void) { 80104890: bb 00 00 0f 80 mov $0x800f0000,%ebx 80104895: eb 13 jmp 801048aa 80104897: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010489e: 66 90 xchg %ax,%ax for (p = addr; p < e; p += sizeof(struct mp)) { 801048a0: 89 f3 mov %esi,%ebx 801048a2: 81 fe 00 00 10 80 cmp $0x80100000,%esi 801048a8: 74 d6 je 80104880 if (memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) { 801048aa: 83 ec 04 sub $0x4,%esp 801048ad: 8d 73 10 lea 0x10(%ebx),%esi 801048b0: 6a 04 push $0x4 801048b2: 68 18 8f 10 80 push $0x80108f18 801048b7: 53 push %ebx 801048b8: e8 d3 13 00 00 call 80105c90 801048bd: 83 c4 10 add $0x10,%esp 801048c0: 85 c0 test %eax,%eax 801048c2: 75 dc jne 801048a0 801048c4: 89 da mov %ebx,%edx 801048c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801048cd: 8d 76 00 lea 0x0(%esi),%esi sum += addr[i]; 801048d0: 0f b6 0a movzbl (%edx),%ecx for (i = 0; i < len; i++) { 801048d3: 83 c2 01 add $0x1,%edx sum += addr[i]; 801048d6: 01 c8 add %ecx,%eax for (i = 0; i < len; i++) { 801048d8: 39 d6 cmp %edx,%esi 801048da: 75 f4 jne 801048d0 if (memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) { 801048dc: 84 c0 test %al,%al 801048de: 75 c0 jne 801048a0 801048e0: e9 6b fe ff ff jmp 80104750 panic("Didn't find a suitable machine"); 801048e5: 83 ec 0c sub $0xc,%esp 801048e8: 68 3c 8f 10 80 push $0x80108f3c 801048ed: e8 8e bb ff ff call 80100480 801048f2: 66 90 xchg %ax,%ax 801048f4: 66 90 xchg %ax,%ax 801048f6: 66 90 xchg %ax,%ax 801048f8: 66 90 xchg %ax,%ax 801048fa: 66 90 xchg %ax,%ax 801048fc: 66 90 xchg %ax,%ax 801048fe: 66 90 xchg %ax,%ax 80104900 : 80104900: b8 ff ff ff ff mov $0xffffffff,%eax 80104905: ba 21 00 00 00 mov $0x21,%edx 8010490a: ee out %al,(%dx) 8010490b: ba a1 00 00 00 mov $0xa1,%edx 80104910: 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); } 80104911: c3 ret 80104912: 66 90 xchg %ax,%ax 80104914: 66 90 xchg %ax,%ax 80104916: 66 90 xchg %ax,%ax 80104918: 66 90 xchg %ax,%ax 8010491a: 66 90 xchg %ax,%ax 8010491c: 66 90 xchg %ax,%ax 8010491e: 66 90 xchg %ax,%ax 80104920 : 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) { 80104920: 55 push %ebp 80104921: 89 e5 mov %esp,%ebp 80104923: 56 push %esi 80104924: 8b 45 08 mov 0x8(%ebp),%eax 80104927: 8b 75 0c mov 0xc(%ebp),%esi 8010492a: 53 push %ebx 8010492b: 8b 5d 10 mov 0x10(%ebp),%ebx if (p) { 8010492e: 85 c0 test %eax,%eax 80104930: 74 0c je 8010493e kfree((char*)p); 80104932: 83 ec 0c sub $0xc,%esp 80104935: 50 push %eax 80104936: e8 75 f0 ff ff call 801039b0 8010493b: 83 c4 10 add $0x10,%esp } if (*f0) { 8010493e: 8b 06 mov (%esi),%eax 80104940: 85 c0 test %eax,%eax 80104942: 74 0c je 80104950 fileclose(*f0); 80104944: 83 ec 0c sub $0xc,%esp 80104947: 50 push %eax 80104948: e8 93 da ff ff call 801023e0 8010494d: 83 c4 10 add $0x10,%esp } if (*f1) { 80104950: 8b 03 mov (%ebx),%eax 80104952: 85 c0 test %eax,%eax 80104954: 74 12 je 80104968 fileclose(*f1); 80104956: 89 45 08 mov %eax,0x8(%ebp) } } 80104959: 8d 65 f8 lea -0x8(%ebp),%esp 8010495c: 5b pop %ebx 8010495d: 5e pop %esi 8010495e: 5d pop %ebp fileclose(*f1); 8010495f: e9 7c da ff ff jmp 801023e0 80104964: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } 80104968: 8d 65 f8 lea -0x8(%ebp),%esp 8010496b: 5b pop %ebx 8010496c: 5e pop %esi 8010496d: 5d pop %ebp 8010496e: c3 ret 8010496f: 90 nop 80104970 : int pipealloc(struct file **f0, struct file **f1) { 80104970: 55 push %ebp 80104971: 89 e5 mov %esp,%ebp 80104973: 57 push %edi 80104974: 56 push %esi 80104975: 53 push %ebx 80104976: 83 ec 0c sub $0xc,%esp 80104979: 8b 75 08 mov 0x8(%ebp),%esi 8010497c: 8b 7d 0c mov 0xc(%ebp),%edi struct pipe *p; p = 0; *f0 = *f1 = 0; 8010497f: c7 07 00 00 00 00 movl $0x0,(%edi) 80104985: c7 06 00 00 00 00 movl $0x0,(%esi) if ((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) { 8010498b: e8 90 d9 ff ff call 80102320 80104990: 89 06 mov %eax,(%esi) 80104992: 85 c0 test %eax,%eax 80104994: 0f 84 a5 00 00 00 je 80104a3f 8010499a: e8 81 d9 ff ff call 80102320 8010499f: 89 07 mov %eax,(%edi) 801049a1: 85 c0 test %eax,%eax 801049a3: 0f 84 84 00 00 00 je 80104a2d cleanuppipealloc(p, f0, f1); return -1; } if ((p = (struct pipe*)kalloc()) == 0) { 801049a9: e8 c2 f1 ff ff call 80103b70 801049ae: 89 c3 mov %eax,%ebx 801049b0: 85 c0 test %eax,%eax 801049b2: 0f 84 a0 00 00 00 je 80104a58 cleanuppipealloc(p, f0, f1); return -1; } p->readopen = 1; 801049b8: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax) 801049bf: 00 00 00 p->writeopen = 1; p->nwrite = 0; p->nread = 0; initlock(&p->lock, "pipe"); 801049c2: 83 ec 08 sub $0x8,%esp p->writeopen = 1; 801049c5: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax) 801049cc: 00 00 00 p->nwrite = 0; 801049cf: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax) 801049d6: 00 00 00 p->nread = 0; 801049d9: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax) 801049e0: 00 00 00 initlock(&p->lock, "pipe"); 801049e3: 68 5b 8f 10 80 push $0x80108f5b 801049e8: 50 push %eax 801049e9: e8 c2 0f 00 00 call 801059b0 (*f0)->type = FD_PIPE; 801049ee: 8b 06 mov (%esi),%eax (*f0)->pipe = p; (*f1)->type = FD_PIPE; (*f1)->readable = 0; (*f1)->writable = 1; (*f1)->pipe = p; return 0; 801049f0: 83 c4 10 add $0x10,%esp (*f0)->type = FD_PIPE; 801049f3: c7 00 01 00 00 00 movl $0x1,(%eax) (*f0)->readable = 1; 801049f9: 8b 06 mov (%esi),%eax 801049fb: c6 40 08 01 movb $0x1,0x8(%eax) (*f0)->writable = 0; 801049ff: 8b 06 mov (%esi),%eax 80104a01: c6 40 09 00 movb $0x0,0x9(%eax) (*f0)->pipe = p; 80104a05: 8b 06 mov (%esi),%eax 80104a07: 89 58 0c mov %ebx,0xc(%eax) (*f1)->type = FD_PIPE; 80104a0a: 8b 07 mov (%edi),%eax 80104a0c: c7 00 01 00 00 00 movl $0x1,(%eax) (*f1)->readable = 0; 80104a12: 8b 07 mov (%edi),%eax 80104a14: c6 40 08 00 movb $0x0,0x8(%eax) (*f1)->writable = 1; 80104a18: 8b 07 mov (%edi),%eax 80104a1a: c6 40 09 01 movb $0x1,0x9(%eax) (*f1)->pipe = p; 80104a1e: 8b 07 mov (%edi),%eax 80104a20: 89 58 0c mov %ebx,0xc(%eax) return 0; 80104a23: 31 c0 xor %eax,%eax } 80104a25: 8d 65 f4 lea -0xc(%ebp),%esp 80104a28: 5b pop %ebx 80104a29: 5e pop %esi 80104a2a: 5f pop %edi 80104a2b: 5d pop %ebp 80104a2c: c3 ret if (*f0) { 80104a2d: 8b 06 mov (%esi),%eax 80104a2f: 85 c0 test %eax,%eax 80104a31: 74 1e je 80104a51 fileclose(*f0); 80104a33: 83 ec 0c sub $0xc,%esp 80104a36: 50 push %eax 80104a37: e8 a4 d9 ff ff call 801023e0 80104a3c: 83 c4 10 add $0x10,%esp if (*f1) { 80104a3f: 8b 07 mov (%edi),%eax 80104a41: 85 c0 test %eax,%eax 80104a43: 74 0c je 80104a51 fileclose(*f1); 80104a45: 83 ec 0c sub $0xc,%esp 80104a48: 50 push %eax 80104a49: e8 92 d9 ff ff call 801023e0 80104a4e: 83 c4 10 add $0x10,%esp return -1; 80104a51: b8 ff ff ff ff mov $0xffffffff,%eax 80104a56: eb cd jmp 80104a25 if (*f0) { 80104a58: 8b 06 mov (%esi),%eax 80104a5a: 85 c0 test %eax,%eax 80104a5c: 75 d5 jne 80104a33 80104a5e: eb df jmp 80104a3f 80104a60 : void pipeclose(struct pipe *p, int writable) { 80104a60: 55 push %ebp 80104a61: 89 e5 mov %esp,%ebp 80104a63: 56 push %esi 80104a64: 53 push %ebx 80104a65: 8b 5d 08 mov 0x8(%ebp),%ebx 80104a68: 8b 75 0c mov 0xc(%ebp),%esi acquire(&p->lock); 80104a6b: 83 ec 0c sub $0xc,%esp 80104a6e: 53 push %ebx 80104a6f: e8 0c 11 00 00 call 80105b80 if (writable) { 80104a74: 83 c4 10 add $0x10,%esp 80104a77: 85 f6 test %esi,%esi 80104a79: 74 65 je 80104ae0 p->writeopen = 0; wakeup(&p->nread); 80104a7b: 83 ec 0c sub $0xc,%esp 80104a7e: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax p->writeopen = 0; 80104a84: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx) 80104a8b: 00 00 00 wakeup(&p->nread); 80104a8e: 50 push %eax 80104a8f: e8 0c 0c 00 00 call 801056a0 80104a94: 83 c4 10 add $0x10,%esp } else { p->readopen = 0; wakeup(&p->nwrite); } if (p->readopen == 0 && p->writeopen == 0) { 80104a97: 8b 93 3c 02 00 00 mov 0x23c(%ebx),%edx 80104a9d: 85 d2 test %edx,%edx 80104a9f: 75 0a jne 80104aab 80104aa1: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax 80104aa7: 85 c0 test %eax,%eax 80104aa9: 74 15 je 80104ac0 release(&p->lock); kfree((char*)p); } else { release(&p->lock); 80104aab: 89 5d 08 mov %ebx,0x8(%ebp) } } 80104aae: 8d 65 f8 lea -0x8(%ebp),%esp 80104ab1: 5b pop %ebx 80104ab2: 5e pop %esi 80104ab3: 5d pop %ebp release(&p->lock); 80104ab4: e9 67 10 00 00 jmp 80105b20 80104ab9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi release(&p->lock); 80104ac0: 83 ec 0c sub $0xc,%esp 80104ac3: 53 push %ebx 80104ac4: e8 57 10 00 00 call 80105b20 kfree((char*)p); 80104ac9: 89 5d 08 mov %ebx,0x8(%ebp) 80104acc: 83 c4 10 add $0x10,%esp } 80104acf: 8d 65 f8 lea -0x8(%ebp),%esp 80104ad2: 5b pop %ebx 80104ad3: 5e pop %esi 80104ad4: 5d pop %ebp kfree((char*)p); 80104ad5: e9 d6 ee ff ff jmp 801039b0 80104ada: 8d b6 00 00 00 00 lea 0x0(%esi),%esi wakeup(&p->nwrite); 80104ae0: 83 ec 0c sub $0xc,%esp 80104ae3: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax p->readopen = 0; 80104ae9: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx) 80104af0: 00 00 00 wakeup(&p->nwrite); 80104af3: 50 push %eax 80104af4: e8 a7 0b 00 00 call 801056a0 80104af9: 83 c4 10 add $0x10,%esp 80104afc: eb 99 jmp 80104a97 80104afe: 66 90 xchg %ax,%ax 80104b00 : int pipewrite(struct pipe *p, char *addr, int n) { 80104b00: 55 push %ebp 80104b01: 89 e5 mov %esp,%ebp 80104b03: 57 push %edi 80104b04: 56 push %esi 80104b05: 53 push %ebx 80104b06: 83 ec 28 sub $0x28,%esp 80104b09: 8b 5d 08 mov 0x8(%ebp),%ebx int i; acquire(&p->lock); 80104b0c: 53 push %ebx 80104b0d: e8 6e 10 00 00 call 80105b80 for (i = 0; i < n; i++) { 80104b12: 8b 45 10 mov 0x10(%ebp),%eax 80104b15: 83 c4 10 add $0x10,%esp 80104b18: 85 c0 test %eax,%eax 80104b1a: 0f 8e c0 00 00 00 jle 80104be0 80104b20: 8b 45 0c mov 0xc(%ebp),%eax while (p->nwrite == p->nread + PIPESIZE) { //DOC: pipewrite-full 80104b23: 8b 8b 38 02 00 00 mov 0x238(%ebx),%ecx if (p->readopen == 0 || myproc()->killed) { release(&p->lock); return -1; } wakeup(&p->nread); 80104b29: 8d bb 34 02 00 00 lea 0x234(%ebx),%edi 80104b2f: 89 45 e4 mov %eax,-0x1c(%ebp) 80104b32: 03 45 10 add 0x10(%ebp),%eax 80104b35: 89 45 e0 mov %eax,-0x20(%ebp) while (p->nwrite == p->nread + PIPESIZE) { //DOC: pipewrite-full 80104b38: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 80104b3e: 8d b3 38 02 00 00 lea 0x238(%ebx),%esi while (p->nwrite == p->nread + PIPESIZE) { //DOC: pipewrite-full 80104b44: 89 ca mov %ecx,%edx 80104b46: 05 00 02 00 00 add $0x200,%eax 80104b4b: 39 c1 cmp %eax,%ecx 80104b4d: 74 3f je 80104b8e 80104b4f: eb 67 jmp 80104bb8 80104b51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (p->readopen == 0 || myproc()->killed) { 80104b58: e8 53 03 00 00 call 80104eb0 80104b5d: 8b 48 24 mov 0x24(%eax),%ecx 80104b60: 85 c9 test %ecx,%ecx 80104b62: 75 34 jne 80104b98 wakeup(&p->nread); 80104b64: 83 ec 0c sub $0xc,%esp 80104b67: 57 push %edi 80104b68: e8 33 0b 00 00 call 801056a0 sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 80104b6d: 58 pop %eax 80104b6e: 5a pop %edx 80104b6f: 53 push %ebx 80104b70: 56 push %esi 80104b71: e8 6a 0a 00 00 call 801055e0 while (p->nwrite == p->nread + PIPESIZE) { //DOC: pipewrite-full 80104b76: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax 80104b7c: 8b 93 38 02 00 00 mov 0x238(%ebx),%edx 80104b82: 83 c4 10 add $0x10,%esp 80104b85: 05 00 02 00 00 add $0x200,%eax 80104b8a: 39 c2 cmp %eax,%edx 80104b8c: 75 2a jne 80104bb8 if (p->readopen == 0 || myproc()->killed) { 80104b8e: 8b 83 3c 02 00 00 mov 0x23c(%ebx),%eax 80104b94: 85 c0 test %eax,%eax 80104b96: 75 c0 jne 80104b58 release(&p->lock); 80104b98: 83 ec 0c sub $0xc,%esp 80104b9b: 53 push %ebx 80104b9c: e8 7f 0f 00 00 call 80105b20 return -1; 80104ba1: 83 c4 10 add $0x10,%esp 80104ba4: 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; } 80104ba9: 8d 65 f4 lea -0xc(%ebp),%esp 80104bac: 5b pop %ebx 80104bad: 5e pop %esi 80104bae: 5f pop %edi 80104baf: 5d pop %ebp 80104bb0: c3 ret 80104bb1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi p->data[p->nwrite++ % PIPESIZE] = addr[i]; 80104bb8: 8b 75 e4 mov -0x1c(%ebp),%esi 80104bbb: 8d 4a 01 lea 0x1(%edx),%ecx 80104bbe: 81 e2 ff 01 00 00 and $0x1ff,%edx 80104bc4: 89 8b 38 02 00 00 mov %ecx,0x238(%ebx) 80104bca: 0f b6 06 movzbl (%esi),%eax for (i = 0; i < n; i++) { 80104bcd: 83 c6 01 add $0x1,%esi 80104bd0: 89 75 e4 mov %esi,-0x1c(%ebp) p->data[p->nwrite++ % PIPESIZE] = addr[i]; 80104bd3: 88 44 13 34 mov %al,0x34(%ebx,%edx,1) for (i = 0; i < n; i++) { 80104bd7: 3b 75 e0 cmp -0x20(%ebp),%esi 80104bda: 0f 85 58 ff ff ff jne 80104b38 wakeup(&p->nread); //DOC: pipewrite-wakeup1 80104be0: 83 ec 0c sub $0xc,%esp 80104be3: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax 80104be9: 50 push %eax 80104bea: e8 b1 0a 00 00 call 801056a0 release(&p->lock); 80104bef: 89 1c 24 mov %ebx,(%esp) 80104bf2: e8 29 0f 00 00 call 80105b20 return n; 80104bf7: 8b 45 10 mov 0x10(%ebp),%eax 80104bfa: 83 c4 10 add $0x10,%esp 80104bfd: eb aa jmp 80104ba9 80104bff: 90 nop 80104c00 : int piperead(struct pipe *p, char *addr, int n) { 80104c00: 55 push %ebp 80104c01: 89 e5 mov %esp,%ebp 80104c03: 57 push %edi 80104c04: 56 push %esi 80104c05: 53 push %ebx 80104c06: 83 ec 18 sub $0x18,%esp 80104c09: 8b 75 08 mov 0x8(%ebp),%esi 80104c0c: 8b 7d 0c mov 0xc(%ebp),%edi int i; acquire(&p->lock); 80104c0f: 56 push %esi 80104c10: 8d 9e 34 02 00 00 lea 0x234(%esi),%ebx 80104c16: e8 65 0f 00 00 call 80105b80 while (p->nread == p->nwrite && p->writeopen) { //DOC: pipe-empty 80104c1b: 8b 86 34 02 00 00 mov 0x234(%esi),%eax 80104c21: 83 c4 10 add $0x10,%esp 80104c24: 39 86 38 02 00 00 cmp %eax,0x238(%esi) 80104c2a: 74 2f je 80104c5b 80104c2c: eb 37 jmp 80104c65 80104c2e: 66 90 xchg %ax,%ax if (myproc()->killed) { 80104c30: e8 7b 02 00 00 call 80104eb0 80104c35: 8b 48 24 mov 0x24(%eax),%ecx 80104c38: 85 c9 test %ecx,%ecx 80104c3a: 0f 85 80 00 00 00 jne 80104cc0 release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep 80104c40: 83 ec 08 sub $0x8,%esp 80104c43: 56 push %esi 80104c44: 53 push %ebx 80104c45: e8 96 09 00 00 call 801055e0 while (p->nread == p->nwrite && p->writeopen) { //DOC: pipe-empty 80104c4a: 8b 86 38 02 00 00 mov 0x238(%esi),%eax 80104c50: 83 c4 10 add $0x10,%esp 80104c53: 39 86 34 02 00 00 cmp %eax,0x234(%esi) 80104c59: 75 0a jne 80104c65 80104c5b: 8b 86 40 02 00 00 mov 0x240(%esi),%eax 80104c61: 85 c0 test %eax,%eax 80104c63: 75 cb jne 80104c30 } for (i = 0; i < n; i++) { //DOC: piperead-copy 80104c65: 8b 55 10 mov 0x10(%ebp),%edx 80104c68: 31 db xor %ebx,%ebx 80104c6a: 85 d2 test %edx,%edx 80104c6c: 7f 20 jg 80104c8e 80104c6e: eb 2c jmp 80104c9c if (p->nread == p->nwrite) { break; } addr[i] = p->data[p->nread++ % PIPESIZE]; 80104c70: 8d 48 01 lea 0x1(%eax),%ecx 80104c73: 25 ff 01 00 00 and $0x1ff,%eax 80104c78: 89 8e 34 02 00 00 mov %ecx,0x234(%esi) 80104c7e: 0f b6 44 06 34 movzbl 0x34(%esi,%eax,1),%eax 80104c83: 88 04 1f mov %al,(%edi,%ebx,1) for (i = 0; i < n; i++) { //DOC: piperead-copy 80104c86: 83 c3 01 add $0x1,%ebx 80104c89: 39 5d 10 cmp %ebx,0x10(%ebp) 80104c8c: 74 0e je 80104c9c if (p->nread == p->nwrite) { 80104c8e: 8b 86 34 02 00 00 mov 0x234(%esi),%eax 80104c94: 3b 86 38 02 00 00 cmp 0x238(%esi),%eax 80104c9a: 75 d4 jne 80104c70 } wakeup(&p->nwrite); //DOC: piperead-wakeup 80104c9c: 83 ec 0c sub $0xc,%esp 80104c9f: 8d 86 38 02 00 00 lea 0x238(%esi),%eax 80104ca5: 50 push %eax 80104ca6: e8 f5 09 00 00 call 801056a0 release(&p->lock); 80104cab: 89 34 24 mov %esi,(%esp) 80104cae: e8 6d 0e 00 00 call 80105b20 return i; 80104cb3: 83 c4 10 add $0x10,%esp } 80104cb6: 8d 65 f4 lea -0xc(%ebp),%esp 80104cb9: 89 d8 mov %ebx,%eax 80104cbb: 5b pop %ebx 80104cbc: 5e pop %esi 80104cbd: 5f pop %edi 80104cbe: 5d pop %ebp 80104cbf: c3 ret release(&p->lock); 80104cc0: 83 ec 0c sub $0xc,%esp return -1; 80104cc3: bb ff ff ff ff mov $0xffffffff,%ebx release(&p->lock); 80104cc8: 56 push %esi 80104cc9: e8 52 0e 00 00 call 80105b20 return -1; 80104cce: 83 c4 10 add $0x10,%esp } 80104cd1: 8d 65 f4 lea -0xc(%ebp),%esp 80104cd4: 89 d8 mov %ebx,%eax 80104cd6: 5b pop %ebx 80104cd7: 5e pop %esi 80104cd8: 5f pop %edi 80104cd9: 5d pop %ebp 80104cda: c3 ret 80104cdb: 66 90 xchg %ax,%ax 80104cdd: 66 90 xchg %ax,%ax 80104cdf: 90 nop 80104ce0 : // 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) { 80104ce0: 55 push %ebp 80104ce1: 89 e5 mov %esp,%ebp 80104ce3: 53 push %ebx char *sp; int found = 0; acquire(&ptable.lock); p = ptable.proc; 80104ce4: bb d4 e4 11 80 mov $0x8011e4d4,%ebx static struct proc* allocproc(void) { 80104ce9: 83 ec 10 sub $0x10,%esp acquire(&ptable.lock); 80104cec: 68 a0 e4 11 80 push $0x8011e4a0 80104cf1: e8 8a 0e 00 00 call 80105b80 80104cf6: 83 c4 10 add $0x10,%esp while (p < &ptable.proc[NPROC] && !found) { if (p->state == UNUSED) { 80104cf9: 8b 43 0c mov 0xc(%ebx),%eax 80104cfc: 85 c0 test %eax,%eax 80104cfe: 74 30 je 80104d30 found = 1; } else { p++; 80104d00: 81 c3 94 00 00 00 add $0x94,%ebx while (p < &ptable.proc[NPROC] && !found) { 80104d06: 81 fb d4 09 12 80 cmp $0x801209d4,%ebx 80104d0c: 75 eb jne 80104cf9 } } if (!found) { release(&ptable.lock); 80104d0e: 83 ec 0c sub $0xc,%esp return 0; 80104d11: 31 db xor %ebx,%ebx release(&ptable.lock); 80104d13: 68 a0 e4 11 80 push $0x8011e4a0 80104d18: e8 03 0e 00 00 call 80105b20 memset(p->context, 0, sizeof *p->context); p->context->eip = (uint)forkret; p->consoleptr = getbaseconsoleptr(); return p; } 80104d1d: 89 d8 mov %ebx,%eax return 0; 80104d1f: 83 c4 10 add $0x10,%esp } 80104d22: 8b 5d fc mov -0x4(%ebp),%ebx 80104d25: c9 leave 80104d26: c3 ret 80104d27: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104d2e: 66 90 xchg %ax,%ax p->pid = nextpid++; 80104d30: a1 04 c0 10 80 mov 0x8010c004,%eax release(&ptable.lock); 80104d35: 83 ec 0c sub $0xc,%esp p->state = EMBRYO; 80104d38: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx) p->pid = nextpid++; 80104d3f: 89 43 10 mov %eax,0x10(%ebx) 80104d42: 8d 50 01 lea 0x1(%eax),%edx release(&ptable.lock); 80104d45: 68 a0 e4 11 80 push $0x8011e4a0 p->pid = nextpid++; 80104d4a: 89 15 04 c0 10 80 mov %edx,0x8010c004 release(&ptable.lock); 80104d50: e8 cb 0d 00 00 call 80105b20 if ((p->kstack = kalloc()) == 0) { 80104d55: e8 16 ee ff ff call 80103b70 80104d5a: 83 c4 10 add $0x10,%esp 80104d5d: 89 43 08 mov %eax,0x8(%ebx) 80104d60: 85 c0 test %eax,%eax 80104d62: 74 44 je 80104da8 sp -= sizeof *p->tf; 80104d64: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx memset(p->context, 0, sizeof *p->context); 80104d6a: 83 ec 04 sub $0x4,%esp sp -= sizeof *p->context; 80104d6d: 05 9c 0f 00 00 add $0xf9c,%eax sp -= sizeof *p->tf; 80104d72: 89 53 18 mov %edx,0x18(%ebx) *(uint*)sp = (uint)trapret; 80104d75: c7 40 14 e9 6f 10 80 movl $0x80106fe9,0x14(%eax) p->context = (struct context*)sp; 80104d7c: 89 43 1c mov %eax,0x1c(%ebx) memset(p->context, 0, sizeof *p->context); 80104d7f: 6a 14 push $0x14 80104d81: 6a 00 push $0x0 80104d83: 50 push %eax 80104d84: e8 b7 0e 00 00 call 80105c40 p->context->eip = (uint)forkret; 80104d89: 8b 43 1c mov 0x1c(%ebx),%eax 80104d8c: c7 40 10 c0 4d 10 80 movl $0x80104dc0,0x10(%eax) p->consoleptr = getbaseconsoleptr(); 80104d93: e8 b8 c2 ff ff call 80101050 return p; 80104d98: 83 c4 10 add $0x10,%esp p->consoleptr = getbaseconsoleptr(); 80104d9b: 89 43 7c mov %eax,0x7c(%ebx) } 80104d9e: 89 d8 mov %ebx,%eax 80104da0: 8b 5d fc mov -0x4(%ebp),%ebx 80104da3: c9 leave 80104da4: c3 ret 80104da5: 8d 76 00 lea 0x0(%esi),%esi p->state = UNUSED; 80104da8: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) return 0; 80104daf: 31 db xor %ebx,%ebx } 80104db1: 89 d8 mov %ebx,%eax 80104db3: 8b 5d fc mov -0x4(%ebp),%ebx 80104db6: c9 leave 80104db7: c3 ret 80104db8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104dbf: 90 nop 80104dc0 : release(&ptable.lock); } // A fork child's very first scheduling by scheduler() // will swtch here. "Return" to user space. void forkret(void) { 80104dc0: 55 push %ebp 80104dc1: 89 e5 mov %esp,%ebp 80104dc3: 83 ec 14 sub $0x14,%esp static int first = 1; // Still holding ptable.lock from scheduler. release(&ptable.lock); 80104dc6: 68 a0 e4 11 80 push $0x8011e4a0 80104dcb: e8 50 0d 00 00 call 80105b20 if (first) { 80104dd0: a1 00 c0 10 80 mov 0x8010c000,%eax 80104dd5: 83 c4 10 add $0x10,%esp 80104dd8: 85 c0 test %eax,%eax 80104dda: 75 04 jne 80104de0 iinit(ROOTDEV); initlog(ROOTDEV); } // Return to "caller", actually trapret (see allocproc). } 80104ddc: c9 leave 80104ddd: c3 ret 80104dde: 66 90 xchg %ax,%ax first = 0; 80104de0: c7 05 00 c0 10 80 00 movl $0x0,0x8010c000 80104de7: 00 00 00 iinit(ROOTDEV); 80104dea: 83 ec 0c sub $0xc,%esp 80104ded: 6a 01 push $0x1 80104def: e8 5c dc ff ff call 80102a50 initlog(ROOTDEV); 80104df4: c7 04 24 01 00 00 00 movl $0x1,(%esp) 80104dfb: e8 b0 f3 ff ff call 801041b0 } 80104e00: 83 c4 10 add $0x10,%esp 80104e03: c9 leave 80104e04: c3 ret 80104e05: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104e0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104e10 : void pinit(void) { 80104e10: 55 push %ebp 80104e11: 89 e5 mov %esp,%ebp 80104e13: 83 ec 10 sub $0x10,%esp initlock(&ptable.lock, "ptable"); 80104e16: 68 60 8f 10 80 push $0x80108f60 80104e1b: 68 a0 e4 11 80 push $0x8011e4a0 80104e20: e8 8b 0b 00 00 call 801059b0 } 80104e25: 83 c4 10 add $0x10,%esp 80104e28: c9 leave 80104e29: c3 ret 80104e2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104e30 : struct cpu*mycpu(void) { 80104e30: 55 push %ebp 80104e31: 89 e5 mov %esp,%ebp 80104e33: 56 push %esi 80104e34: 53 push %ebx asm volatile ("pushfl; popl %0" : "=r" (eflags)); 80104e35: 9c pushf 80104e36: 58 pop %eax if (readeflags() & FL_IF) { 80104e37: f6 c4 02 test $0x2,%ah 80104e3a: 75 46 jne 80104e82 apicid = lapicid(); 80104e3c: e8 9f ef ff ff call 80103de0 for (i = 0; i < ncpu; ++i) { 80104e41: 8b 35 04 df 11 80 mov 0x8011df04,%esi 80104e47: 85 f6 test %esi,%esi 80104e49: 7e 2a jle 80104e75 80104e4b: 31 d2 xor %edx,%edx 80104e4d: eb 08 jmp 80104e57 80104e4f: 90 nop 80104e50: 83 c2 01 add $0x1,%edx 80104e53: 39 f2 cmp %esi,%edx 80104e55: 74 1e je 80104e75 if (cpus[i].apicid == apicid) { 80104e57: 69 ca b0 00 00 00 imul $0xb0,%edx,%ecx 80104e5d: 0f b6 99 20 df 11 80 movzbl -0x7fee20e0(%ecx),%ebx 80104e64: 39 c3 cmp %eax,%ebx 80104e66: 75 e8 jne 80104e50 } 80104e68: 8d 65 f8 lea -0x8(%ebp),%esp return &cpus[i]; 80104e6b: 8d 81 20 df 11 80 lea -0x7fee20e0(%ecx),%eax } 80104e71: 5b pop %ebx 80104e72: 5e pop %esi 80104e73: 5d pop %ebp 80104e74: c3 ret panic("unknown apicid\n"); 80104e75: 83 ec 0c sub $0xc,%esp 80104e78: 68 67 8f 10 80 push $0x80108f67 80104e7d: e8 fe b5 ff ff call 80100480 panic("mycpu called with interrupts enabled\n"); 80104e82: 83 ec 0c sub $0xc,%esp 80104e85: 68 58 90 10 80 push $0x80109058 80104e8a: e8 f1 b5 ff ff call 80100480 80104e8f: 90 nop 80104e90 : int cpuid() { 80104e90: 55 push %ebp 80104e91: 89 e5 mov %esp,%ebp 80104e93: 83 ec 08 sub $0x8,%esp return mycpu() - cpus; 80104e96: e8 95 ff ff ff call 80104e30 } 80104e9b: c9 leave return mycpu() - cpus; 80104e9c: 2d 20 df 11 80 sub $0x8011df20,%eax 80104ea1: c1 f8 04 sar $0x4,%eax 80104ea4: 69 c0 a3 8b 2e ba imul $0xba2e8ba3,%eax,%eax } 80104eaa: c3 ret 80104eab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104eaf: 90 nop 80104eb0 : struct proc*myproc(void) { 80104eb0: 55 push %ebp 80104eb1: 89 e5 mov %esp,%ebp 80104eb3: 53 push %ebx 80104eb4: 83 ec 04 sub $0x4,%esp pushcli(); 80104eb7: e8 74 0b 00 00 call 80105a30 c = mycpu(); 80104ebc: e8 6f ff ff ff call 80104e30 p = c->proc; 80104ec1: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80104ec7: e8 b4 0b 00 00 call 80105a80 } 80104ecc: 89 d8 mov %ebx,%eax 80104ece: 8b 5d fc mov -0x4(%ebp),%ebx 80104ed1: c9 leave 80104ed2: c3 ret 80104ed3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104eda: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104ee0 : void userinit(void) { 80104ee0: 55 push %ebp 80104ee1: 89 e5 mov %esp,%ebp 80104ee3: 53 push %ebx 80104ee4: 83 ec 04 sub $0x4,%esp p = allocproc(); 80104ee7: e8 f4 fd ff ff call 80104ce0 80104eec: 89 c3 mov %eax,%ebx initproc = p; 80104eee: a3 d4 09 12 80 mov %eax,0x801209d4 if ((p->pgdir = setupkvm()) == 0) { 80104ef3: e8 e8 36 00 00 call 801085e0 80104ef8: 89 43 04 mov %eax,0x4(%ebx) 80104efb: 85 c0 test %eax,%eax 80104efd: 0f 84 db 00 00 00 je 80104fde inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); 80104f03: 83 ec 04 sub $0x4,%esp 80104f06: 68 2c 00 00 00 push $0x2c 80104f0b: 68 60 c4 10 80 push $0x8010c460 80104f10: 50 push %eax 80104f11: e8 7a 33 00 00 call 80108290 memset(p->tf, 0, sizeof(*p->tf)); 80104f16: 83 c4 0c add $0xc,%esp p->sz = PGSIZE; 80104f19: c7 03 00 10 00 00 movl $0x1000,(%ebx) memset(p->tf, 0, sizeof(*p->tf)); 80104f1f: 6a 4c push $0x4c 80104f21: 6a 00 push $0x0 80104f23: ff 73 18 push 0x18(%ebx) 80104f26: e8 15 0d 00 00 call 80105c40 p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 80104f2b: 8b 43 18 mov 0x18(%ebx),%eax 80104f2e: ba 1b 00 00 00 mov $0x1b,%edx safestrcpy(p->name, "initcode", sizeof(p->name)); 80104f33: 83 c4 0c add $0xc,%esp p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 80104f36: b9 23 00 00 00 mov $0x23,%ecx p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 80104f3b: 66 89 50 3c mov %dx,0x3c(%eax) p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 80104f3f: 8b 43 18 mov 0x18(%ebx),%eax 80104f42: 66 89 48 2c mov %cx,0x2c(%eax) p->tf->es = p->tf->ds; 80104f46: 8b 43 18 mov 0x18(%ebx),%eax 80104f49: 0f b7 50 2c movzwl 0x2c(%eax),%edx 80104f4d: 66 89 50 28 mov %dx,0x28(%eax) p->tf->ss = p->tf->ds; 80104f51: 8b 43 18 mov 0x18(%ebx),%eax 80104f54: 0f b7 50 2c movzwl 0x2c(%eax),%edx 80104f58: 66 89 50 48 mov %dx,0x48(%eax) p->tf->eflags = FL_IF; 80104f5c: 8b 43 18 mov 0x18(%ebx),%eax 80104f5f: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax) p->tf->esp = PGSIZE; 80104f66: 8b 43 18 mov 0x18(%ebx),%eax 80104f69: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) p->tf->eip = 0; // beginning of initcode.S 80104f70: 8b 43 18 mov 0x18(%ebx),%eax 80104f73: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) safestrcpy(p->name, "initcode", sizeof(p->name)); 80104f7a: 8d 43 6c lea 0x6c(%ebx),%eax 80104f7d: 6a 10 push $0x10 80104f7f: 68 90 8f 10 80 push $0x80108f90 80104f84: 50 push %eax 80104f85: e8 76 0e 00 00 call 80105e00 p->cwd = namei("/"); 80104f8a: c7 04 24 99 8f 10 80 movl $0x80108f99,(%esp) 80104f91: e8 fa e5 ff ff call 80103590 80104f96: 89 43 68 mov %eax,0x68(%ebx) p->consoleptr = getbaseconsoleptr(); 80104f99: e8 b2 c0 ff ff call 80101050 safestrcpy(p->title, "Shell (Root)", sizeof(p->title)); 80104f9e: 83 c4 0c add $0xc,%esp p->consoleptr = getbaseconsoleptr(); 80104fa1: 89 43 7c mov %eax,0x7c(%ebx) safestrcpy(p->title, "Shell (Root)", sizeof(p->title)); 80104fa4: 8d 83 80 00 00 00 lea 0x80(%ebx),%eax 80104faa: 6a 14 push $0x14 80104fac: 68 9b 8f 10 80 push $0x80108f9b 80104fb1: 50 push %eax 80104fb2: e8 49 0e 00 00 call 80105e00 acquire(&ptable.lock); 80104fb7: c7 04 24 a0 e4 11 80 movl $0x8011e4a0,(%esp) 80104fbe: e8 bd 0b 00 00 call 80105b80 p->state = RUNNABLE; 80104fc3: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) release(&ptable.lock); 80104fca: c7 04 24 a0 e4 11 80 movl $0x8011e4a0,(%esp) 80104fd1: e8 4a 0b 00 00 call 80105b20 } 80104fd6: 8b 5d fc mov -0x4(%ebp),%ebx 80104fd9: 83 c4 10 add $0x10,%esp 80104fdc: c9 leave 80104fdd: c3 ret panic("userinit: out of memory?"); 80104fde: 83 ec 0c sub $0xc,%esp 80104fe1: 68 77 8f 10 80 push $0x80108f77 80104fe6: e8 95 b4 ff ff call 80100480 80104feb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104fef: 90 nop 80104ff0 : int growproc(int n) { 80104ff0: 55 push %ebp 80104ff1: 89 e5 mov %esp,%ebp 80104ff3: 56 push %esi 80104ff4: 53 push %ebx 80104ff5: 8b 75 08 mov 0x8(%ebp),%esi pushcli(); 80104ff8: e8 33 0a 00 00 call 80105a30 c = mycpu(); 80104ffd: e8 2e fe ff ff call 80104e30 p = c->proc; 80105002: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80105008: e8 73 0a 00 00 call 80105a80 sz = curproc->sz; 8010500d: 8b 03 mov (%ebx),%eax if (n > 0) { 8010500f: 85 f6 test %esi,%esi 80105011: 7f 1d jg 80105030 else if (n < 0) { 80105013: 75 3b jne 80105050 switchuvm(curproc); 80105015: 83 ec 0c sub $0xc,%esp curproc->sz = sz; 80105018: 89 03 mov %eax,(%ebx) switchuvm(curproc); 8010501a: 53 push %ebx 8010501b: e8 60 31 00 00 call 80108180 return 0; 80105020: 83 c4 10 add $0x10,%esp 80105023: 31 c0 xor %eax,%eax } 80105025: 8d 65 f8 lea -0x8(%ebp),%esp 80105028: 5b pop %ebx 80105029: 5e pop %esi 8010502a: 5d pop %ebp 8010502b: c3 ret 8010502c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if ((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) { 80105030: 83 ec 04 sub $0x4,%esp 80105033: 01 c6 add %eax,%esi 80105035: 56 push %esi 80105036: 50 push %eax 80105037: ff 73 04 push 0x4(%ebx) 8010503a: e8 c1 33 00 00 call 80108400 8010503f: 83 c4 10 add $0x10,%esp 80105042: 85 c0 test %eax,%eax 80105044: 75 cf jne 80105015 return -1; 80105046: b8 ff ff ff ff mov $0xffffffff,%eax 8010504b: eb d8 jmp 80105025 8010504d: 8d 76 00 lea 0x0(%esi),%esi if ((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) { 80105050: 83 ec 04 sub $0x4,%esp 80105053: 01 c6 add %eax,%esi 80105055: 56 push %esi 80105056: 50 push %eax 80105057: ff 73 04 push 0x4(%ebx) 8010505a: e8 d1 34 00 00 call 80108530 8010505f: 83 c4 10 add $0x10,%esp 80105062: 85 c0 test %eax,%eax 80105064: 75 af jne 80105015 80105066: eb de jmp 80105046 80105068: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010506f: 90 nop 80105070 : int fork(void) { 80105070: 55 push %ebp 80105071: 89 e5 mov %esp,%ebp 80105073: 57 push %edi 80105074: 56 push %esi 80105075: 53 push %ebx 80105076: 83 ec 1c sub $0x1c,%esp pushcli(); 80105079: e8 b2 09 00 00 call 80105a30 c = mycpu(); 8010507e: e8 ad fd ff ff call 80104e30 p = c->proc; 80105083: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80105089: e8 f2 09 00 00 call 80105a80 if ((np = allocproc()) == 0) { 8010508e: e8 4d fc ff ff call 80104ce0 80105093: 89 45 e4 mov %eax,-0x1c(%ebp) 80105096: 85 c0 test %eax,%eax 80105098: 0f 84 bd 00 00 00 je 8010515b if ((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0) { 8010509e: 83 ec 08 sub $0x8,%esp 801050a1: ff 33 push (%ebx) 801050a3: 89 c7 mov %eax,%edi 801050a5: ff 73 04 push 0x4(%ebx) 801050a8: e8 23 36 00 00 call 801086d0 801050ad: 83 c4 10 add $0x10,%esp 801050b0: 89 47 04 mov %eax,0x4(%edi) 801050b3: 85 c0 test %eax,%eax 801050b5: 0f 84 a7 00 00 00 je 80105162 np->sz = curproc->sz; 801050bb: 8b 03 mov (%ebx),%eax 801050bd: 8b 4d e4 mov -0x1c(%ebp),%ecx 801050c0: 89 01 mov %eax,(%ecx) *np->tf = *curproc->tf; 801050c2: 8b 79 18 mov 0x18(%ecx),%edi np->parent = curproc; 801050c5: 89 c8 mov %ecx,%eax 801050c7: 89 59 14 mov %ebx,0x14(%ecx) *np->tf = *curproc->tf; 801050ca: b9 13 00 00 00 mov $0x13,%ecx 801050cf: 8b 73 18 mov 0x18(%ebx),%esi 801050d2: f3 a5 rep movsl %ds:(%esi),%es:(%edi) for (i = 0; i < NOFILE; i++) { 801050d4: 31 f6 xor %esi,%esi np->tf->eax = 0; 801050d6: 8b 40 18 mov 0x18(%eax),%eax 801050d9: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) if (curproc->ofile[i]) { 801050e0: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax 801050e4: 85 c0 test %eax,%eax 801050e6: 74 13 je 801050fb np->ofile[i] = filedup(curproc->ofile[i]); 801050e8: 83 ec 0c sub $0xc,%esp 801050eb: 50 push %eax 801050ec: e8 9f d2 ff ff call 80102390 801050f1: 8b 55 e4 mov -0x1c(%ebp),%edx 801050f4: 83 c4 10 add $0x10,%esp 801050f7: 89 44 b2 28 mov %eax,0x28(%edx,%esi,4) for (i = 0; i < NOFILE; i++) { 801050fb: 83 c6 01 add $0x1,%esi 801050fe: 83 fe 10 cmp $0x10,%esi 80105101: 75 dd jne 801050e0 np->cwd = idup(curproc->cwd); 80105103: 83 ec 0c sub $0xc,%esp 80105106: ff 73 68 push 0x68(%ebx) 80105109: e8 32 db ff ff call 80102c40 8010510e: 8b 7d e4 mov -0x1c(%ebp),%edi safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 80105111: 83 c4 0c add $0xc,%esp np->cwd = idup(curproc->cwd); 80105114: 89 47 68 mov %eax,0x68(%edi) safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 80105117: 8d 43 6c lea 0x6c(%ebx),%eax 8010511a: 6a 10 push $0x10 8010511c: 50 push %eax 8010511d: 8d 47 6c lea 0x6c(%edi),%eax 80105120: 50 push %eax 80105121: e8 da 0c 00 00 call 80105e00 pid = np->pid; 80105126: 8b 77 10 mov 0x10(%edi),%esi acquire(&ptable.lock); 80105129: c7 04 24 a0 e4 11 80 movl $0x8011e4a0,(%esp) 80105130: e8 4b 0a 00 00 call 80105b80 np->state = RUNNABLE; 80105135: c7 47 0c 03 00 00 00 movl $0x3,0xc(%edi) np->consoleptr = curproc->consoleptr; 8010513c: 8b 43 7c mov 0x7c(%ebx),%eax 8010513f: 89 47 7c mov %eax,0x7c(%edi) release(&ptable.lock); 80105142: c7 04 24 a0 e4 11 80 movl $0x8011e4a0,(%esp) 80105149: e8 d2 09 00 00 call 80105b20 return pid; 8010514e: 83 c4 10 add $0x10,%esp } 80105151: 8d 65 f4 lea -0xc(%ebp),%esp 80105154: 89 f0 mov %esi,%eax 80105156: 5b pop %ebx 80105157: 5e pop %esi 80105158: 5f pop %edi 80105159: 5d pop %ebp 8010515a: c3 ret return -1; 8010515b: be ff ff ff ff mov $0xffffffff,%esi 80105160: eb ef jmp 80105151 kfree(np->kstack); 80105162: 8b 5d e4 mov -0x1c(%ebp),%ebx 80105165: 83 ec 0c sub $0xc,%esp return -1; 80105168: be ff ff ff ff mov $0xffffffff,%esi kfree(np->kstack); 8010516d: ff 73 08 push 0x8(%ebx) 80105170: e8 3b e8 ff ff call 801039b0 np->kstack = 0; 80105175: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) return -1; 8010517c: 83 c4 10 add $0x10,%esp np->state = UNUSED; 8010517f: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) return -1; 80105186: eb c9 jmp 80105151 80105188: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010518f: 90 nop 80105190 : void scheduler(void) { 80105190: 55 push %ebp 80105191: 89 e5 mov %esp,%ebp 80105193: 57 push %edi 80105194: 56 push %esi 80105195: 53 push %ebx 80105196: 83 ec 0c sub $0xc,%esp struct cpu *c = mycpu(); 80105199: e8 92 fc ff ff call 80104e30 c->proc = 0; 8010519e: c7 80 ac 00 00 00 00 movl $0x0,0xac(%eax) 801051a5: 00 00 00 struct cpu *c = mycpu(); 801051a8: 89 c6 mov %eax,%esi c->proc = 0; 801051aa: 8d 78 04 lea 0x4(%eax),%edi 801051ad: 8d 76 00 lea 0x0(%esi),%esi asm volatile ("sti"); 801051b0: fb sti acquire(&ptable.lock); 801051b1: 83 ec 0c sub $0xc,%esp for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 801051b4: bb d4 e4 11 80 mov $0x8011e4d4,%ebx acquire(&ptable.lock); 801051b9: 68 a0 e4 11 80 push $0x8011e4a0 801051be: e8 bd 09 00 00 call 80105b80 801051c3: 83 c4 10 add $0x10,%esp 801051c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801051cd: 8d 76 00 lea 0x0(%esi),%esi if (p->state != RUNNABLE) { 801051d0: 83 7b 0c 03 cmpl $0x3,0xc(%ebx) 801051d4: 75 33 jne 80105209 switchuvm(p); 801051d6: 83 ec 0c sub $0xc,%esp c->proc = p; 801051d9: 89 9e ac 00 00 00 mov %ebx,0xac(%esi) switchuvm(p); 801051df: 53 push %ebx 801051e0: e8 9b 2f 00 00 call 80108180 swtch(&(c->scheduler), p->context); 801051e5: 58 pop %eax 801051e6: 5a pop %edx 801051e7: ff 73 1c push 0x1c(%ebx) 801051ea: 57 push %edi p->state = RUNNING; 801051eb: c7 43 0c 04 00 00 00 movl $0x4,0xc(%ebx) swtch(&(c->scheduler), p->context); 801051f2: e8 64 0c 00 00 call 80105e5b switchkvm(); 801051f7: e8 74 2f 00 00 call 80108170 c->proc = 0; 801051fc: 83 c4 10 add $0x10,%esp 801051ff: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi) 80105206: 00 00 00 for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 80105209: 81 c3 94 00 00 00 add $0x94,%ebx 8010520f: 81 fb d4 09 12 80 cmp $0x801209d4,%ebx 80105215: 75 b9 jne 801051d0 release(&ptable.lock); 80105217: 83 ec 0c sub $0xc,%esp 8010521a: 68 a0 e4 11 80 push $0x8011e4a0 8010521f: e8 fc 08 00 00 call 80105b20 sti(); 80105224: 83 c4 10 add $0x10,%esp 80105227: eb 87 jmp 801051b0 80105229: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105230 : void sched(void) { 80105230: 55 push %ebp 80105231: 89 e5 mov %esp,%ebp 80105233: 56 push %esi 80105234: 53 push %ebx pushcli(); 80105235: e8 f6 07 00 00 call 80105a30 c = mycpu(); 8010523a: e8 f1 fb ff ff call 80104e30 p = c->proc; 8010523f: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80105245: e8 36 08 00 00 call 80105a80 if (!holding(&ptable.lock)) { 8010524a: 83 ec 0c sub $0xc,%esp 8010524d: 68 a0 e4 11 80 push $0x8011e4a0 80105252: e8 89 08 00 00 call 80105ae0 80105257: 83 c4 10 add $0x10,%esp 8010525a: 85 c0 test %eax,%eax 8010525c: 74 4f je 801052ad if (mycpu()->ncli != 1) { 8010525e: e8 cd fb ff ff call 80104e30 80105263: 83 b8 a4 00 00 00 01 cmpl $0x1,0xa4(%eax) 8010526a: 75 68 jne 801052d4 if (p->state == RUNNING) { 8010526c: 83 7b 0c 04 cmpl $0x4,0xc(%ebx) 80105270: 74 55 je 801052c7 asm volatile ("pushfl; popl %0" : "=r" (eflags)); 80105272: 9c pushf 80105273: 58 pop %eax if (readeflags() & FL_IF) { 80105274: f6 c4 02 test $0x2,%ah 80105277: 75 41 jne 801052ba intena = mycpu()->intena; 80105279: e8 b2 fb ff ff call 80104e30 swtch(&p->context, mycpu()->scheduler); 8010527e: 83 c3 1c add $0x1c,%ebx intena = mycpu()->intena; 80105281: 8b b0 a8 00 00 00 mov 0xa8(%eax),%esi swtch(&p->context, mycpu()->scheduler); 80105287: e8 a4 fb ff ff call 80104e30 8010528c: 83 ec 08 sub $0x8,%esp 8010528f: ff 70 04 push 0x4(%eax) 80105292: 53 push %ebx 80105293: e8 c3 0b 00 00 call 80105e5b mycpu()->intena = intena; 80105298: e8 93 fb ff ff call 80104e30 } 8010529d: 83 c4 10 add $0x10,%esp mycpu()->intena = intena; 801052a0: 89 b0 a8 00 00 00 mov %esi,0xa8(%eax) } 801052a6: 8d 65 f8 lea -0x8(%ebp),%esp 801052a9: 5b pop %ebx 801052aa: 5e pop %esi 801052ab: 5d pop %ebp 801052ac: c3 ret panic("sched ptable.lock"); 801052ad: 83 ec 0c sub $0xc,%esp 801052b0: 68 a8 8f 10 80 push $0x80108fa8 801052b5: e8 c6 b1 ff ff call 80100480 panic("sched interruptible"); 801052ba: 83 ec 0c sub $0xc,%esp 801052bd: 68 d4 8f 10 80 push $0x80108fd4 801052c2: e8 b9 b1 ff ff call 80100480 panic("sched running"); 801052c7: 83 ec 0c sub $0xc,%esp 801052ca: 68 c6 8f 10 80 push $0x80108fc6 801052cf: e8 ac b1 ff ff call 80100480 panic("sched locks"); 801052d4: 83 ec 0c sub $0xc,%esp 801052d7: 68 ba 8f 10 80 push $0x80108fba 801052dc: e8 9f b1 ff ff call 80100480 801052e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801052e8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801052ef: 90 nop 801052f0 : void exit(void) { 801052f0: 55 push %ebp 801052f1: 89 e5 mov %esp,%ebp 801052f3: 57 push %edi 801052f4: 56 push %esi 801052f5: 53 push %ebx 801052f6: 83 ec 0c sub $0xc,%esp struct proc *curproc = myproc(); 801052f9: e8 b2 fb ff ff call 80104eb0 if (curproc == initproc) { 801052fe: 39 05 d4 09 12 80 cmp %eax,0x801209d4 80105304: 0f 84 39 01 00 00 je 80105443 8010530a: 89 c6 mov %eax,%esi 8010530c: 8d 58 28 lea 0x28(%eax),%ebx 8010530f: 8d 78 68 lea 0x68(%eax),%edi 80105312: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if (curproc->ofile[fd]) { 80105318: 8b 03 mov (%ebx),%eax 8010531a: 85 c0 test %eax,%eax 8010531c: 74 12 je 80105330 fileclose(curproc->ofile[fd]); 8010531e: 83 ec 0c sub $0xc,%esp 80105321: 50 push %eax 80105322: e8 b9 d0 ff ff call 801023e0 curproc->ofile[fd] = 0; 80105327: c7 03 00 00 00 00 movl $0x0,(%ebx) 8010532d: 83 c4 10 add $0x10,%esp for (fd = 0; fd < NOFILE; fd++) { 80105330: 83 c3 04 add $0x4,%ebx 80105333: 39 df cmp %ebx,%edi 80105335: 75 e1 jne 80105318 begin_op(); 80105337: e8 14 ef ff ff call 80104250 iput(curproc->cwd); 8010533c: 83 ec 0c sub $0xc,%esp 8010533f: ff 76 68 push 0x68(%esi) 80105342: e8 59 da ff ff call 80102da0 end_op(); 80105347: e8 74 ef ff ff call 801042c0 curproc->cwd = 0; 8010534c: c7 46 68 00 00 00 00 movl $0x0,0x68(%esi) acquire(&ptable.lock); 80105353: c7 04 24 a0 e4 11 80 movl $0x8011e4a0,(%esp) 8010535a: e8 21 08 00 00 call 80105b80 wakeup1(curproc->parent); 8010535f: 8b 56 14 mov 0x14(%esi),%edx 80105362: 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++) { 80105365: b8 d4 e4 11 80 mov $0x8011e4d4,%eax 8010536a: eb 10 jmp 8010537c 8010536c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105370: 05 94 00 00 00 add $0x94,%eax 80105375: 3d d4 09 12 80 cmp $0x801209d4,%eax 8010537a: 74 1e je 8010539a if (p->state == SLEEPING && p->chan == chan) { 8010537c: 83 78 0c 02 cmpl $0x2,0xc(%eax) 80105380: 75 ee jne 80105370 80105382: 3b 50 20 cmp 0x20(%eax),%edx 80105385: 75 e9 jne 80105370 p->state = RUNNABLE; 80105387: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 8010538e: 05 94 00 00 00 add $0x94,%eax 80105393: 3d d4 09 12 80 cmp $0x801209d4,%eax 80105398: 75 e2 jne 8010537c for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 8010539a: bb d4 e4 11 80 mov $0x8011e4d4,%ebx 8010539f: eb 15 jmp 801053b6 801053a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801053a8: 81 c3 94 00 00 00 add $0x94,%ebx 801053ae: 81 fb d4 09 12 80 cmp $0x801209d4,%ebx 801053b4: 74 4a je 80105400 if (p->parent == curproc) { 801053b6: 39 73 14 cmp %esi,0x14(%ebx) 801053b9: 75 ed jne 801053a8 p->parent = initproc; 801053bb: a1 d4 09 12 80 mov 0x801209d4,%eax 801053c0: 89 43 14 mov %eax,0x14(%ebx) p->consoleptr = getbaseconsoleptr(); 801053c3: e8 88 bc ff ff call 80101050 if (p->state == ZOMBIE) { 801053c8: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) p->consoleptr = getbaseconsoleptr(); 801053cc: 89 43 7c mov %eax,0x7c(%ebx) if (p->state == ZOMBIE) { 801053cf: 75 d7 jne 801053a8 wakeup1(initproc); 801053d1: 8b 15 d4 09 12 80 mov 0x801209d4,%edx for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 801053d7: b8 d4 e4 11 80 mov $0x8011e4d4,%eax 801053dc: eb 0e jmp 801053ec 801053de: 66 90 xchg %ax,%ax 801053e0: 05 94 00 00 00 add $0x94,%eax 801053e5: 3d d4 09 12 80 cmp $0x801209d4,%eax 801053ea: 74 bc je 801053a8 if (p->state == SLEEPING && p->chan == chan) { 801053ec: 83 78 0c 02 cmpl $0x2,0xc(%eax) 801053f0: 75 ee jne 801053e0 801053f2: 3b 50 20 cmp 0x20(%eax),%edx 801053f5: 75 e9 jne 801053e0 p->state = RUNNABLE; 801053f7: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) 801053fe: eb e0 jmp 801053e0 if (curproc->consoleptr != getbaseconsoleptr()) 80105400: 8b 5e 7c mov 0x7c(%esi),%ebx 80105403: e8 48 bc ff ff call 80101050 80105408: 39 c3 cmp %eax,%ebx 8010540a: 74 05 je 80105411 closeconsole(); 8010540c: e8 2f c9 ff ff call 80101d40 if (curproc->consoleptr != 0) 80105411: 8b 46 7c mov 0x7c(%esi),%eax 80105414: 85 c0 test %eax,%eax 80105416: 74 12 je 8010542a setconsoleproctitle(curproc->consoleptr, curproc->parent->name); 80105418: 52 push %edx 80105419: 52 push %edx 8010541a: 8b 4e 14 mov 0x14(%esi),%ecx 8010541d: 8d 51 6c lea 0x6c(%ecx),%edx 80105420: 52 push %edx 80105421: 50 push %eax 80105422: e8 39 ca ff ff call 80101e60 80105427: 83 c4 10 add $0x10,%esp curproc->state = ZOMBIE; 8010542a: c7 46 0c 05 00 00 00 movl $0x5,0xc(%esi) sched(); 80105431: e8 fa fd ff ff call 80105230 panic("zombie exit"); 80105436: 83 ec 0c sub $0xc,%esp 80105439: 68 f5 8f 10 80 push $0x80108ff5 8010543e: e8 3d b0 ff ff call 80100480 panic("init exiting"); 80105443: 83 ec 0c sub $0xc,%esp 80105446: 68 e8 8f 10 80 push $0x80108fe8 8010544b: e8 30 b0 ff ff call 80100480 80105450 : int wait(void) { 80105450: 55 push %ebp 80105451: 89 e5 mov %esp,%ebp 80105453: 56 push %esi 80105454: 53 push %ebx pushcli(); 80105455: e8 d6 05 00 00 call 80105a30 c = mycpu(); 8010545a: e8 d1 f9 ff ff call 80104e30 p = c->proc; 8010545f: 8b b0 ac 00 00 00 mov 0xac(%eax),%esi popcli(); 80105465: e8 16 06 00 00 call 80105a80 acquire(&ptable.lock); 8010546a: 83 ec 0c sub $0xc,%esp 8010546d: 68 a0 e4 11 80 push $0x8011e4a0 80105472: e8 09 07 00 00 call 80105b80 80105477: 83 c4 10 add $0x10,%esp havekids = 0; 8010547a: 31 c0 xor %eax,%eax for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 8010547c: bb d4 e4 11 80 mov $0x8011e4d4,%ebx 80105481: eb 13 jmp 80105496 80105483: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105487: 90 nop 80105488: 81 c3 94 00 00 00 add $0x94,%ebx 8010548e: 81 fb d4 09 12 80 cmp $0x801209d4,%ebx 80105494: 74 1e je 801054b4 if (p->parent != curproc) { 80105496: 39 73 14 cmp %esi,0x14(%ebx) 80105499: 75 ed jne 80105488 if (p->state == ZOMBIE) { 8010549b: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) 8010549f: 74 5f je 80105500 for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 801054a1: 81 c3 94 00 00 00 add $0x94,%ebx havekids = 1; 801054a7: b8 01 00 00 00 mov $0x1,%eax for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 801054ac: 81 fb d4 09 12 80 cmp $0x801209d4,%ebx 801054b2: 75 e2 jne 80105496 if (!havekids || curproc->killed) { 801054b4: 85 c0 test %eax,%eax 801054b6: 0f 84 a1 00 00 00 je 8010555d 801054bc: 8b 46 24 mov 0x24(%esi),%eax 801054bf: 85 c0 test %eax,%eax 801054c1: 0f 85 96 00 00 00 jne 8010555d pushcli(); 801054c7: e8 64 05 00 00 call 80105a30 c = mycpu(); 801054cc: e8 5f f9 ff ff call 80104e30 p = c->proc; 801054d1: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 801054d7: e8 a4 05 00 00 call 80105a80 if (p == 0) { 801054dc: 85 db test %ebx,%ebx 801054de: 0f 84 90 00 00 00 je 80105574 p->chan = chan; 801054e4: 89 73 20 mov %esi,0x20(%ebx) p->state = SLEEPING; 801054e7: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); 801054ee: e8 3d fd ff ff call 80105230 p->chan = 0; 801054f3: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) } 801054fa: e9 7b ff ff ff jmp 8010547a 801054ff: 90 nop kfree(p->kstack); 80105500: 83 ec 0c sub $0xc,%esp pid = p->pid; 80105503: 8b 73 10 mov 0x10(%ebx),%esi kfree(p->kstack); 80105506: ff 73 08 push 0x8(%ebx) 80105509: e8 a2 e4 ff ff call 801039b0 p->kstack = 0; 8010550e: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) freevm(p->pgdir); 80105515: 5a pop %edx 80105516: ff 73 04 push 0x4(%ebx) 80105519: e8 42 30 00 00 call 80108560 p->pid = 0; 8010551e: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx) p->parent = 0; 80105525: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) p->name[0] = 0; 8010552c: c6 43 6c 00 movb $0x0,0x6c(%ebx) p->killed = 0; 80105530: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx) p->state = UNUSED; 80105537: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) p->consoleptr = 0; 8010553e: c7 43 7c 00 00 00 00 movl $0x0,0x7c(%ebx) release(&ptable.lock); 80105545: c7 04 24 a0 e4 11 80 movl $0x8011e4a0,(%esp) 8010554c: e8 cf 05 00 00 call 80105b20 return pid; 80105551: 83 c4 10 add $0x10,%esp } 80105554: 8d 65 f8 lea -0x8(%ebp),%esp 80105557: 89 f0 mov %esi,%eax 80105559: 5b pop %ebx 8010555a: 5e pop %esi 8010555b: 5d pop %ebp 8010555c: c3 ret release(&ptable.lock); 8010555d: 83 ec 0c sub $0xc,%esp return -1; 80105560: be ff ff ff ff mov $0xffffffff,%esi release(&ptable.lock); 80105565: 68 a0 e4 11 80 push $0x8011e4a0 8010556a: e8 b1 05 00 00 call 80105b20 return -1; 8010556f: 83 c4 10 add $0x10,%esp 80105572: eb e0 jmp 80105554 panic("sleep"); 80105574: 83 ec 0c sub $0xc,%esp 80105577: 68 01 90 10 80 push $0x80109001 8010557c: e8 ff ae ff ff call 80100480 80105581: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105588: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010558f: 90 nop 80105590 : void yield(void) { 80105590: 55 push %ebp 80105591: 89 e5 mov %esp,%ebp 80105593: 53 push %ebx 80105594: 83 ec 10 sub $0x10,%esp acquire(&ptable.lock); //DOC: yieldlock 80105597: 68 a0 e4 11 80 push $0x8011e4a0 8010559c: e8 df 05 00 00 call 80105b80 pushcli(); 801055a1: e8 8a 04 00 00 call 80105a30 c = mycpu(); 801055a6: e8 85 f8 ff ff call 80104e30 p = c->proc; 801055ab: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 801055b1: e8 ca 04 00 00 call 80105a80 myproc()->state = RUNNABLE; 801055b6: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) sched(); 801055bd: e8 6e fc ff ff call 80105230 release(&ptable.lock); 801055c2: c7 04 24 a0 e4 11 80 movl $0x8011e4a0,(%esp) 801055c9: e8 52 05 00 00 call 80105b20 } 801055ce: 8b 5d fc mov -0x4(%ebp),%ebx 801055d1: 83 c4 10 add $0x10,%esp 801055d4: c9 leave 801055d5: c3 ret 801055d6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801055dd: 8d 76 00 lea 0x0(%esi),%esi 801055e0 : void sleep(void *chan, struct spinlock *lk) { 801055e0: 55 push %ebp 801055e1: 89 e5 mov %esp,%ebp 801055e3: 57 push %edi 801055e4: 56 push %esi 801055e5: 53 push %ebx 801055e6: 83 ec 0c sub $0xc,%esp 801055e9: 8b 7d 08 mov 0x8(%ebp),%edi 801055ec: 8b 75 0c mov 0xc(%ebp),%esi pushcli(); 801055ef: e8 3c 04 00 00 call 80105a30 c = mycpu(); 801055f4: e8 37 f8 ff ff call 80104e30 p = c->proc; 801055f9: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 801055ff: e8 7c 04 00 00 call 80105a80 if (p == 0) { 80105604: 85 db test %ebx,%ebx 80105606: 0f 84 87 00 00 00 je 80105693 if (lk == 0) { 8010560c: 85 f6 test %esi,%esi 8010560e: 74 76 je 80105686 if (lk != &ptable.lock) { //DOC: sleeplock0 80105610: 81 fe a0 e4 11 80 cmp $0x8011e4a0,%esi 80105616: 74 50 je 80105668 acquire(&ptable.lock); //DOC: sleeplock1 80105618: 83 ec 0c sub $0xc,%esp 8010561b: 68 a0 e4 11 80 push $0x8011e4a0 80105620: e8 5b 05 00 00 call 80105b80 release(lk); 80105625: 89 34 24 mov %esi,(%esp) 80105628: e8 f3 04 00 00 call 80105b20 p->chan = chan; 8010562d: 89 7b 20 mov %edi,0x20(%ebx) p->state = SLEEPING; 80105630: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); 80105637: e8 f4 fb ff ff call 80105230 p->chan = 0; 8010563c: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) release(&ptable.lock); 80105643: c7 04 24 a0 e4 11 80 movl $0x8011e4a0,(%esp) 8010564a: e8 d1 04 00 00 call 80105b20 acquire(lk); 8010564f: 89 75 08 mov %esi,0x8(%ebp) 80105652: 83 c4 10 add $0x10,%esp } 80105655: 8d 65 f4 lea -0xc(%ebp),%esp 80105658: 5b pop %ebx 80105659: 5e pop %esi 8010565a: 5f pop %edi 8010565b: 5d pop %ebp acquire(lk); 8010565c: e9 1f 05 00 00 jmp 80105b80 80105661: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi p->chan = chan; 80105668: 89 7b 20 mov %edi,0x20(%ebx) p->state = SLEEPING; 8010566b: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); 80105672: e8 b9 fb ff ff call 80105230 p->chan = 0; 80105677: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) } 8010567e: 8d 65 f4 lea -0xc(%ebp),%esp 80105681: 5b pop %ebx 80105682: 5e pop %esi 80105683: 5f pop %edi 80105684: 5d pop %ebp 80105685: c3 ret panic("sleep without lk"); 80105686: 83 ec 0c sub $0xc,%esp 80105689: 68 07 90 10 80 push $0x80109007 8010568e: e8 ed ad ff ff call 80100480 panic("sleep"); 80105693: 83 ec 0c sub $0xc,%esp 80105696: 68 01 90 10 80 push $0x80109001 8010569b: e8 e0 ad ff ff call 80100480 801056a0 : } } } // Wake up all processes sleeping on chan. void wakeup(void *chan) { 801056a0: 55 push %ebp 801056a1: 89 e5 mov %esp,%ebp 801056a3: 53 push %ebx 801056a4: 83 ec 10 sub $0x10,%esp 801056a7: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&ptable.lock); 801056aa: 68 a0 e4 11 80 push $0x8011e4a0 801056af: e8 cc 04 00 00 call 80105b80 801056b4: 83 c4 10 add $0x10,%esp for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 801056b7: b8 d4 e4 11 80 mov $0x8011e4d4,%eax 801056bc: eb 0e jmp 801056cc 801056be: 66 90 xchg %ax,%ax 801056c0: 05 94 00 00 00 add $0x94,%eax 801056c5: 3d d4 09 12 80 cmp $0x801209d4,%eax 801056ca: 74 1e je 801056ea if (p->state == SLEEPING && p->chan == chan) { 801056cc: 83 78 0c 02 cmpl $0x2,0xc(%eax) 801056d0: 75 ee jne 801056c0 801056d2: 3b 58 20 cmp 0x20(%eax),%ebx 801056d5: 75 e9 jne 801056c0 p->state = RUNNABLE; 801056d7: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 801056de: 05 94 00 00 00 add $0x94,%eax 801056e3: 3d d4 09 12 80 cmp $0x801209d4,%eax 801056e8: 75 e2 jne 801056cc wakeup1(chan); release(&ptable.lock); 801056ea: c7 45 08 a0 e4 11 80 movl $0x8011e4a0,0x8(%ebp) } 801056f1: 8b 5d fc mov -0x4(%ebp),%ebx 801056f4: c9 leave release(&ptable.lock); 801056f5: e9 26 04 00 00 jmp 80105b20 801056fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105700 : // 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) { 80105700: 55 push %ebp 80105701: 89 e5 mov %esp,%ebp 80105703: 53 push %ebx 80105704: 83 ec 10 sub $0x10,%esp 80105707: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *p; acquire(&ptable.lock); 8010570a: 68 a0 e4 11 80 push $0x8011e4a0 8010570f: e8 6c 04 00 00 call 80105b80 80105714: 83 c4 10 add $0x10,%esp for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 80105717: b8 d4 e4 11 80 mov $0x8011e4d4,%eax 8010571c: eb 0e jmp 8010572c 8010571e: 66 90 xchg %ax,%ax 80105720: 05 94 00 00 00 add $0x94,%eax 80105725: 3d d4 09 12 80 cmp $0x801209d4,%eax 8010572a: 74 34 je 80105760 if (p->pid == pid) { 8010572c: 39 58 10 cmp %ebx,0x10(%eax) 8010572f: 75 ef jne 80105720 p->killed = 1; // Wake process from sleep if necessary. if (p->state == SLEEPING) { 80105731: 83 78 0c 02 cmpl $0x2,0xc(%eax) p->killed = 1; 80105735: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) if (p->state == SLEEPING) { 8010573c: 75 07 jne 80105745 p->state = RUNNABLE; 8010573e: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) } release(&ptable.lock); 80105745: 83 ec 0c sub $0xc,%esp 80105748: 68 a0 e4 11 80 push $0x8011e4a0 8010574d: e8 ce 03 00 00 call 80105b20 return 0; } } release(&ptable.lock); return -1; } 80105752: 8b 5d fc mov -0x4(%ebp),%ebx return 0; 80105755: 83 c4 10 add $0x10,%esp 80105758: 31 c0 xor %eax,%eax } 8010575a: c9 leave 8010575b: c3 ret 8010575c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi release(&ptable.lock); 80105760: 83 ec 0c sub $0xc,%esp 80105763: 68 a0 e4 11 80 push $0x8011e4a0 80105768: e8 b3 03 00 00 call 80105b20 } 8010576d: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80105770: 83 c4 10 add $0x10,%esp 80105773: b8 ff ff ff ff mov $0xffffffff,%eax } 80105778: c9 leave 80105779: c3 ret 8010577a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105780 : // 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) { 80105780: 55 push %ebp 80105781: 89 e5 mov %esp,%ebp 80105783: 57 push %edi 80105784: 56 push %esi 80105785: 53 push %ebx 80105786: bb 40 e5 11 80 mov $0x8011e540,%ebx 8010578b: 83 ec 48 sub $0x48,%esp int i; struct proc *p; char *state; uint pc[10]; cprintf("Listing Processes\nPid(Parent) State Name(console)\n"); 8010578e: 68 80 90 10 80 push $0x80109080 80105793: e8 f8 b0 ff ff call 80100890 cprintf("-------------------------------\n"); 80105798: c7 04 24 b4 90 10 80 movl $0x801090b4,(%esp) 8010579f: e8 ec b0 ff ff call 80100890 for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 801057a4: 83 c4 10 add $0x10,%esp 801057a7: eb 29 jmp 801057d2 801057a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi // was 10 for (i = 0; i < 5 && pc[i] != 0; i++) { cprintf(" %p", pc[i]); } } cprintf("\n"); 801057b0: 83 ec 0c sub $0xc,%esp 801057b3: 68 b3 94 10 80 push $0x801094b3 801057b8: e8 d3 b0 ff ff call 80100890 801057bd: 83 c4 10 add $0x10,%esp for (p = ptable.proc; p < &ptable.proc[NPROC]; p++) { 801057c0: 81 c3 94 00 00 00 add $0x94,%ebx 801057c6: 81 fb 40 0a 12 80 cmp $0x80120a40,%ebx 801057cc: 0f 84 9e 00 00 00 je 80105870 if (p->state == UNUSED) { 801057d2: 8b 43 a0 mov -0x60(%ebx),%eax 801057d5: 85 c0 test %eax,%eax 801057d7: 74 e7 je 801057c0 state = "???"; 801057d9: bf 18 90 10 80 mov $0x80109018,%edi if (p->state >= 0 && p->state < NELEM(states) && states[p->state]) { 801057de: 83 f8 05 cmp $0x5,%eax 801057e1: 77 11 ja 801057f4 801057e3: 8b 3c 85 d8 90 10 80 mov -0x7fef6f28(,%eax,4),%edi state = "???"; 801057ea: b8 18 90 10 80 mov $0x80109018,%eax 801057ef: 85 ff test %edi,%edi 801057f1: 0f 44 f8 cmove %eax,%edi if (p->parent != 0x0) 801057f4: 8b 43 a8 mov -0x58(%ebx),%eax int parentpid = 0; 801057f7: 31 f6 xor %esi,%esi if (p->parent != 0x0) 801057f9: 85 c0 test %eax,%eax 801057fb: 74 03 je 80105800 parentpid = p->parent->pid; 801057fd: 8b 70 10 mov 0x10(%eax),%esi cprintf("%d(%d) %s %s(%d)", p->pid, parentpid, state, p->name, getconsoleindex(p->consoleptr)); 80105800: 83 ec 0c sub $0xc,%esp 80105803: ff 73 10 push 0x10(%ebx) 80105806: e8 65 ac ff ff call 80100470 8010580b: 5a pop %edx 8010580c: 59 pop %ecx 8010580d: 50 push %eax 8010580e: 53 push %ebx 8010580f: 57 push %edi 80105810: 56 push %esi 80105811: ff 73 a4 push -0x5c(%ebx) 80105814: 68 1c 90 10 80 push $0x8010901c 80105819: e8 72 b0 ff ff call 80100890 if (p->state == SLEEPING) { 8010581e: 83 c4 20 add $0x20,%esp 80105821: 83 7b a0 02 cmpl $0x2,-0x60(%ebx) 80105825: 75 89 jne 801057b0 getcallerpcs((uint*)p->context->ebp + 2, pc); 80105827: 83 ec 08 sub $0x8,%esp 8010582a: 8d 45 c0 lea -0x40(%ebp),%eax 8010582d: 8d 75 c0 lea -0x40(%ebp),%esi 80105830: 50 push %eax 80105831: 8b 43 b0 mov -0x50(%ebx),%eax 80105834: 8d 7d d4 lea -0x2c(%ebp),%edi 80105837: 8b 40 0c mov 0xc(%eax),%eax 8010583a: 83 c0 08 add $0x8,%eax 8010583d: 50 push %eax 8010583e: e8 8d 01 00 00 call 801059d0 for (i = 0; i < 5 && pc[i] != 0; i++) { 80105843: 83 c4 10 add $0x10,%esp 80105846: 8b 16 mov (%esi),%edx 80105848: 85 d2 test %edx,%edx 8010584a: 0f 84 60 ff ff ff je 801057b0 cprintf(" %p", pc[i]); 80105850: 83 ec 08 sub $0x8,%esp for (i = 0; i < 5 && pc[i] != 0; i++) { 80105853: 83 c6 04 add $0x4,%esi cprintf(" %p", pc[i]); 80105856: 52 push %edx 80105857: 68 a1 89 10 80 push $0x801089a1 8010585c: e8 2f b0 ff ff call 80100890 for (i = 0; i < 5 && pc[i] != 0; i++) { 80105861: 83 c4 10 add $0x10,%esp 80105864: 39 f7 cmp %esi,%edi 80105866: 75 de jne 80105846 80105868: e9 43 ff ff ff jmp 801057b0 8010586d: 8d 76 00 lea 0x0(%esi),%esi } } 80105870: 8d 65 f4 lea -0xc(%ebp),%esp 80105873: 5b pop %ebx 80105874: 5e pop %esi 80105875: 5f pop %edi 80105876: 5d pop %ebp 80105877: c3 ret 80105878: 66 90 xchg %ax,%ax 8010587a: 66 90 xchg %ax,%ax 8010587c: 66 90 xchg %ax,%ax 8010587e: 66 90 xchg %ax,%ax 80105880 : #include "mmu.h" #include "proc.h" #include "spinlock.h" #include "sleeplock.h" void initsleeplock(struct sleeplock *lk, char *name) { 80105880: 55 push %ebp 80105881: 89 e5 mov %esp,%ebp 80105883: 53 push %ebx 80105884: 83 ec 0c sub $0xc,%esp 80105887: 8b 5d 08 mov 0x8(%ebp),%ebx initlock(&lk->lk, "sleep lock"); 8010588a: 68 f0 90 10 80 push $0x801090f0 8010588f: 8d 43 04 lea 0x4(%ebx),%eax 80105892: 50 push %eax 80105893: e8 18 01 00 00 call 801059b0 lk->name = name; 80105898: 8b 45 0c mov 0xc(%ebp),%eax lk->locked = 0; 8010589b: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; } 801058a1: 83 c4 10 add $0x10,%esp lk->pid = 0; 801058a4: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) lk->name = name; 801058ab: 89 43 38 mov %eax,0x38(%ebx) } 801058ae: 8b 5d fc mov -0x4(%ebp),%ebx 801058b1: c9 leave 801058b2: c3 ret 801058b3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801058ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801058c0 : void acquiresleep(struct sleeplock *lk) { 801058c0: 55 push %ebp 801058c1: 89 e5 mov %esp,%ebp 801058c3: 56 push %esi 801058c4: 53 push %ebx 801058c5: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&lk->lk); 801058c8: 8d 73 04 lea 0x4(%ebx),%esi 801058cb: 83 ec 0c sub $0xc,%esp 801058ce: 56 push %esi 801058cf: e8 ac 02 00 00 call 80105b80 while (lk->locked) { 801058d4: 8b 13 mov (%ebx),%edx 801058d6: 83 c4 10 add $0x10,%esp 801058d9: 85 d2 test %edx,%edx 801058db: 74 16 je 801058f3 801058dd: 8d 76 00 lea 0x0(%esi),%esi sleep(lk, &lk->lk); 801058e0: 83 ec 08 sub $0x8,%esp 801058e3: 56 push %esi 801058e4: 53 push %ebx 801058e5: e8 f6 fc ff ff call 801055e0 while (lk->locked) { 801058ea: 8b 03 mov (%ebx),%eax 801058ec: 83 c4 10 add $0x10,%esp 801058ef: 85 c0 test %eax,%eax 801058f1: 75 ed jne 801058e0 } lk->locked = 1; 801058f3: c7 03 01 00 00 00 movl $0x1,(%ebx) lk->pid = myproc()->pid; 801058f9: e8 b2 f5 ff ff call 80104eb0 801058fe: 8b 40 10 mov 0x10(%eax),%eax 80105901: 89 43 3c mov %eax,0x3c(%ebx) release(&lk->lk); 80105904: 89 75 08 mov %esi,0x8(%ebp) } 80105907: 8d 65 f8 lea -0x8(%ebp),%esp 8010590a: 5b pop %ebx 8010590b: 5e pop %esi 8010590c: 5d pop %ebp release(&lk->lk); 8010590d: e9 0e 02 00 00 jmp 80105b20 80105912: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105919: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105920 : void releasesleep(struct sleeplock *lk) { 80105920: 55 push %ebp 80105921: 89 e5 mov %esp,%ebp 80105923: 56 push %esi 80105924: 53 push %ebx 80105925: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&lk->lk); 80105928: 8d 73 04 lea 0x4(%ebx),%esi 8010592b: 83 ec 0c sub $0xc,%esp 8010592e: 56 push %esi 8010592f: e8 4c 02 00 00 call 80105b80 lk->locked = 0; 80105934: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; 8010593a: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) wakeup(lk); 80105941: 89 1c 24 mov %ebx,(%esp) 80105944: e8 57 fd ff ff call 801056a0 release(&lk->lk); 80105949: 89 75 08 mov %esi,0x8(%ebp) 8010594c: 83 c4 10 add $0x10,%esp } 8010594f: 8d 65 f8 lea -0x8(%ebp),%esp 80105952: 5b pop %ebx 80105953: 5e pop %esi 80105954: 5d pop %ebp release(&lk->lk); 80105955: e9 c6 01 00 00 jmp 80105b20 8010595a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105960 : int holdingsleep(struct sleeplock *lk) { 80105960: 55 push %ebp 80105961: 89 e5 mov %esp,%ebp 80105963: 57 push %edi 80105964: 31 ff xor %edi,%edi 80105966: 56 push %esi 80105967: 53 push %ebx 80105968: 83 ec 18 sub $0x18,%esp 8010596b: 8b 5d 08 mov 0x8(%ebp),%ebx int r; acquire(&lk->lk); 8010596e: 8d 73 04 lea 0x4(%ebx),%esi 80105971: 56 push %esi 80105972: e8 09 02 00 00 call 80105b80 r = lk->locked && (lk->pid == myproc()->pid); 80105977: 8b 03 mov (%ebx),%eax 80105979: 83 c4 10 add $0x10,%esp 8010597c: 85 c0 test %eax,%eax 8010597e: 75 18 jne 80105998 release(&lk->lk); 80105980: 83 ec 0c sub $0xc,%esp 80105983: 56 push %esi 80105984: e8 97 01 00 00 call 80105b20 return r; } 80105989: 8d 65 f4 lea -0xc(%ebp),%esp 8010598c: 89 f8 mov %edi,%eax 8010598e: 5b pop %ebx 8010598f: 5e pop %esi 80105990: 5f pop %edi 80105991: 5d pop %ebp 80105992: c3 ret 80105993: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105997: 90 nop r = lk->locked && (lk->pid == myproc()->pid); 80105998: 8b 5b 3c mov 0x3c(%ebx),%ebx 8010599b: e8 10 f5 ff ff call 80104eb0 801059a0: 39 58 10 cmp %ebx,0x10(%eax) 801059a3: 0f 94 c0 sete %al 801059a6: 0f b6 c0 movzbl %al,%eax 801059a9: 89 c7 mov %eax,%edi 801059ab: eb d3 jmp 80105980 801059ad: 66 90 xchg %ax,%ax 801059af: 90 nop 801059b0 : #include "memlayout.h" #include "mmu.h" #include "proc.h" #include "spinlock.h" void initlock(struct spinlock *lk, char *name) { 801059b0: 55 push %ebp 801059b1: 89 e5 mov %esp,%ebp 801059b3: 8b 45 08 mov 0x8(%ebp),%eax lk->name = name; 801059b6: 8b 55 0c mov 0xc(%ebp),%edx lk->locked = 0; 801059b9: c7 00 00 00 00 00 movl $0x0,(%eax) lk->name = name; 801059bf: 89 50 04 mov %edx,0x4(%eax) lk->cpu = 0; 801059c2: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 801059c9: 5d pop %ebp 801059ca: c3 ret 801059cb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801059cf: 90 nop 801059d0 : popcli(); } // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { 801059d0: 55 push %ebp uint *ebp; int i; ebp = (uint*)v - 2; for (i = 0; i < 10; i++) { 801059d1: 31 d2 xor %edx,%edx void getcallerpcs(void *v, uint pcs[]) { 801059d3: 89 e5 mov %esp,%ebp 801059d5: 53 push %ebx ebp = (uint*)v - 2; 801059d6: 8b 45 08 mov 0x8(%ebp),%eax void getcallerpcs(void *v, uint pcs[]) { 801059d9: 8b 4d 0c mov 0xc(%ebp),%ecx ebp = (uint*)v - 2; 801059dc: 83 e8 08 sub $0x8,%eax for (i = 0; i < 10; i++) { 801059df: 90 nop if (ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) { 801059e0: 8d 98 00 00 00 80 lea -0x80000000(%eax),%ebx 801059e6: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx 801059ec: 77 1a ja 80105a08 break; } pcs[i] = ebp[1]; // saved %eip 801059ee: 8b 58 04 mov 0x4(%eax),%ebx 801059f1: 89 1c 91 mov %ebx,(%ecx,%edx,4) for (i = 0; i < 10; i++) { 801059f4: 83 c2 01 add $0x1,%edx ebp = (uint*)ebp[0]; // saved %ebp 801059f7: 8b 00 mov (%eax),%eax for (i = 0; i < 10; i++) { 801059f9: 83 fa 0a cmp $0xa,%edx 801059fc: 75 e2 jne 801059e0 } for (; i < 10; i++) { pcs[i] = 0; } } 801059fe: 8b 5d fc mov -0x4(%ebp),%ebx 80105a01: c9 leave 80105a02: c3 ret 80105a03: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105a07: 90 nop for (; i < 10; i++) { 80105a08: 8d 04 91 lea (%ecx,%edx,4),%eax 80105a0b: 8d 51 28 lea 0x28(%ecx),%edx 80105a0e: 66 90 xchg %ax,%ax pcs[i] = 0; 80105a10: c7 00 00 00 00 00 movl $0x0,(%eax) for (; i < 10; i++) { 80105a16: 83 c0 04 add $0x4,%eax 80105a19: 39 d0 cmp %edx,%eax 80105a1b: 75 f3 jne 80105a10 } 80105a1d: 8b 5d fc mov -0x4(%ebp),%ebx 80105a20: c9 leave 80105a21: c3 ret 80105a22: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105a29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105a30 : // 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) { 80105a30: 55 push %ebp 80105a31: 89 e5 mov %esp,%ebp 80105a33: 53 push %ebx 80105a34: 83 ec 04 sub $0x4,%esp 80105a37: 9c pushf 80105a38: 5b pop %ebx asm volatile ("cli"); 80105a39: fa cli int eflags; eflags = readeflags(); cli(); if (mycpu()->ncli == 0) { 80105a3a: e8 f1 f3 ff ff call 80104e30 80105a3f: 8b 80 a4 00 00 00 mov 0xa4(%eax),%eax 80105a45: 85 c0 test %eax,%eax 80105a47: 74 17 je 80105a60 mycpu()->intena = eflags & FL_IF; } mycpu()->ncli += 1; 80105a49: e8 e2 f3 ff ff call 80104e30 80105a4e: 83 80 a4 00 00 00 01 addl $0x1,0xa4(%eax) } 80105a55: 8b 5d fc mov -0x4(%ebp),%ebx 80105a58: c9 leave 80105a59: c3 ret 80105a5a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi mycpu()->intena = eflags & FL_IF; 80105a60: e8 cb f3 ff ff call 80104e30 80105a65: 81 e3 00 02 00 00 and $0x200,%ebx 80105a6b: 89 98 a8 00 00 00 mov %ebx,0xa8(%eax) 80105a71: eb d6 jmp 80105a49 80105a73: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105a7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105a80 : void popcli(void) { 80105a80: 55 push %ebp 80105a81: 89 e5 mov %esp,%ebp 80105a83: 83 ec 08 sub $0x8,%esp asm volatile ("pushfl; popl %0" : "=r" (eflags)); 80105a86: 9c pushf 80105a87: 58 pop %eax if (readeflags() & FL_IF) { 80105a88: f6 c4 02 test $0x2,%ah 80105a8b: 75 35 jne 80105ac2 panic("popcli - interruptible"); } if (--mycpu()->ncli < 0) { 80105a8d: e8 9e f3 ff ff call 80104e30 80105a92: 83 a8 a4 00 00 00 01 subl $0x1,0xa4(%eax) 80105a99: 78 34 js 80105acf panic("popcli"); } if (mycpu()->ncli == 0 && mycpu()->intena) { 80105a9b: e8 90 f3 ff ff call 80104e30 80105aa0: 8b 90 a4 00 00 00 mov 0xa4(%eax),%edx 80105aa6: 85 d2 test %edx,%edx 80105aa8: 74 06 je 80105ab0 sti(); } } 80105aaa: c9 leave 80105aab: c3 ret 80105aac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (mycpu()->ncli == 0 && mycpu()->intena) { 80105ab0: e8 7b f3 ff ff call 80104e30 80105ab5: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax 80105abb: 85 c0 test %eax,%eax 80105abd: 74 eb je 80105aaa asm volatile ("sti"); 80105abf: fb sti } 80105ac0: c9 leave 80105ac1: c3 ret panic("popcli - interruptible"); 80105ac2: 83 ec 0c sub $0xc,%esp 80105ac5: 68 fb 90 10 80 push $0x801090fb 80105aca: e8 b1 a9 ff ff call 80100480 panic("popcli"); 80105acf: 83 ec 0c sub $0xc,%esp 80105ad2: 68 12 91 10 80 push $0x80109112 80105ad7: e8 a4 a9 ff ff call 80100480 80105adc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105ae0 : int holding(struct spinlock *lock) { 80105ae0: 55 push %ebp 80105ae1: 89 e5 mov %esp,%ebp 80105ae3: 56 push %esi 80105ae4: 53 push %ebx 80105ae5: 8b 75 08 mov 0x8(%ebp),%esi 80105ae8: 31 db xor %ebx,%ebx pushcli(); 80105aea: e8 41 ff ff ff call 80105a30 r = lock->locked && lock->cpu == mycpu(); 80105aef: 8b 06 mov (%esi),%eax 80105af1: 85 c0 test %eax,%eax 80105af3: 75 0b jne 80105b00 popcli(); 80105af5: e8 86 ff ff ff call 80105a80 } 80105afa: 89 d8 mov %ebx,%eax 80105afc: 5b pop %ebx 80105afd: 5e pop %esi 80105afe: 5d pop %ebp 80105aff: c3 ret r = lock->locked && lock->cpu == mycpu(); 80105b00: 8b 5e 08 mov 0x8(%esi),%ebx 80105b03: e8 28 f3 ff ff call 80104e30 80105b08: 39 c3 cmp %eax,%ebx 80105b0a: 0f 94 c3 sete %bl popcli(); 80105b0d: e8 6e ff ff ff call 80105a80 r = lock->locked && lock->cpu == mycpu(); 80105b12: 0f b6 db movzbl %bl,%ebx } 80105b15: 89 d8 mov %ebx,%eax 80105b17: 5b pop %ebx 80105b18: 5e pop %esi 80105b19: 5d pop %ebp 80105b1a: c3 ret 80105b1b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105b1f: 90 nop 80105b20 : void release(struct spinlock *lk) { 80105b20: 55 push %ebp 80105b21: 89 e5 mov %esp,%ebp 80105b23: 56 push %esi 80105b24: 53 push %ebx 80105b25: 8b 5d 08 mov 0x8(%ebp),%ebx pushcli(); 80105b28: e8 03 ff ff ff call 80105a30 r = lock->locked && lock->cpu == mycpu(); 80105b2d: 8b 03 mov (%ebx),%eax 80105b2f: 85 c0 test %eax,%eax 80105b31: 75 15 jne 80105b48 popcli(); 80105b33: e8 48 ff ff ff call 80105a80 panic("release"); 80105b38: 83 ec 0c sub $0xc,%esp 80105b3b: 68 19 91 10 80 push $0x80109119 80105b40: e8 3b a9 ff ff call 80100480 80105b45: 8d 76 00 lea 0x0(%esi),%esi r = lock->locked && lock->cpu == mycpu(); 80105b48: 8b 73 08 mov 0x8(%ebx),%esi 80105b4b: e8 e0 f2 ff ff call 80104e30 80105b50: 39 c6 cmp %eax,%esi 80105b52: 75 df jne 80105b33 popcli(); 80105b54: e8 27 ff ff ff call 80105a80 lk->pcs[0] = 0; 80105b59: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) lk->cpu = 0; 80105b60: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) __sync_synchronize(); 80105b67: f0 83 0c 24 00 lock orl $0x0,(%esp) asm volatile ("movl $0, %0" : "+m" (lk->locked) :); 80105b6c: c7 03 00 00 00 00 movl $0x0,(%ebx) } 80105b72: 8d 65 f8 lea -0x8(%ebp),%esp 80105b75: 5b pop %ebx 80105b76: 5e pop %esi 80105b77: 5d pop %ebp popcli(); 80105b78: e9 03 ff ff ff jmp 80105a80 80105b7d: 8d 76 00 lea 0x0(%esi),%esi 80105b80 : void acquire(struct spinlock *lk) { 80105b80: 55 push %ebp 80105b81: 89 e5 mov %esp,%ebp 80105b83: 53 push %ebx 80105b84: 83 ec 04 sub $0x4,%esp pushcli(); // disable interrupts to avoid deadlock. 80105b87: e8 a4 fe ff ff call 80105a30 if (holding(lk)) { 80105b8c: 8b 5d 08 mov 0x8(%ebp),%ebx pushcli(); 80105b8f: e8 9c fe ff ff call 80105a30 r = lock->locked && lock->cpu == mycpu(); 80105b94: 8b 03 mov (%ebx),%eax 80105b96: 85 c0 test %eax,%eax 80105b98: 75 7e jne 80105c18 popcli(); 80105b9a: e8 e1 fe ff ff call 80105a80 asm volatile ("lock; xchgl %0, %1" : 80105b9f: b9 01 00 00 00 mov $0x1,%ecx 80105ba4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi while (xchg(&lk->locked, 1) != 0) { 80105ba8: 8b 55 08 mov 0x8(%ebp),%edx 80105bab: 89 c8 mov %ecx,%eax 80105bad: f0 87 02 lock xchg %eax,(%edx) 80105bb0: 85 c0 test %eax,%eax 80105bb2: 75 f4 jne 80105ba8 __sync_synchronize(); 80105bb4: f0 83 0c 24 00 lock orl $0x0,(%esp) lk->cpu = mycpu(); 80105bb9: 8b 5d 08 mov 0x8(%ebp),%ebx 80105bbc: e8 6f f2 ff ff call 80104e30 getcallerpcs(&lk, lk->pcs); 80105bc1: 8b 4d 08 mov 0x8(%ebp),%ecx ebp = (uint*)v - 2; 80105bc4: 89 ea mov %ebp,%edx lk->cpu = mycpu(); 80105bc6: 89 43 08 mov %eax,0x8(%ebx) for (i = 0; i < 10; i++) { 80105bc9: 31 c0 xor %eax,%eax 80105bcb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105bcf: 90 nop if (ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) { 80105bd0: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx 80105bd6: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx 80105bdc: 77 1a ja 80105bf8 pcs[i] = ebp[1]; // saved %eip 80105bde: 8b 5a 04 mov 0x4(%edx),%ebx 80105be1: 89 5c 81 0c mov %ebx,0xc(%ecx,%eax,4) for (i = 0; i < 10; i++) { 80105be5: 83 c0 01 add $0x1,%eax ebp = (uint*)ebp[0]; // saved %ebp 80105be8: 8b 12 mov (%edx),%edx for (i = 0; i < 10; i++) { 80105bea: 83 f8 0a cmp $0xa,%eax 80105bed: 75 e1 jne 80105bd0 } 80105bef: 8b 5d fc mov -0x4(%ebp),%ebx 80105bf2: c9 leave 80105bf3: c3 ret 80105bf4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for (; i < 10; i++) { 80105bf8: 8d 44 81 0c lea 0xc(%ecx,%eax,4),%eax 80105bfc: 8d 51 34 lea 0x34(%ecx),%edx 80105bff: 90 nop pcs[i] = 0; 80105c00: c7 00 00 00 00 00 movl $0x0,(%eax) for (; i < 10; i++) { 80105c06: 83 c0 04 add $0x4,%eax 80105c09: 39 c2 cmp %eax,%edx 80105c0b: 75 f3 jne 80105c00 } 80105c0d: 8b 5d fc mov -0x4(%ebp),%ebx 80105c10: c9 leave 80105c11: c3 ret 80105c12: 8d b6 00 00 00 00 lea 0x0(%esi),%esi r = lock->locked && lock->cpu == mycpu(); 80105c18: 8b 5b 08 mov 0x8(%ebx),%ebx 80105c1b: e8 10 f2 ff ff call 80104e30 80105c20: 39 c3 cmp %eax,%ebx 80105c22: 0f 85 72 ff ff ff jne 80105b9a popcli(); 80105c28: e8 53 fe ff ff call 80105a80 panic("acquire"); 80105c2d: 83 ec 0c sub $0xc,%esp 80105c30: 68 21 91 10 80 push $0x80109121 80105c35: e8 46 a8 ff ff call 80100480 80105c3a: 66 90 xchg %ax,%ax 80105c3c: 66 90 xchg %ax,%ax 80105c3e: 66 90 xchg %ax,%ax 80105c40 : #include "types.h" #include "x86.h" void* memset(void *dst, int c, uint n) { 80105c40: 55 push %ebp 80105c41: 89 e5 mov %esp,%ebp 80105c43: 57 push %edi 80105c44: 8b 55 08 mov 0x8(%ebp),%edx 80105c47: 8b 4d 10 mov 0x10(%ebp),%ecx 80105c4a: 53 push %ebx 80105c4b: 8b 45 0c mov 0xc(%ebp),%eax if ((int)dst % 4 == 0 && n % 4 == 0) { 80105c4e: 89 d7 mov %edx,%edi 80105c50: 09 cf or %ecx,%edi 80105c52: 83 e7 03 and $0x3,%edi 80105c55: 75 29 jne 80105c80 c &= 0xFF; 80105c57: 0f b6 f8 movzbl %al,%edi stosl(dst, (c << 24) | (c << 16) | (c << 8) | c, n / 4); 80105c5a: c1 e0 18 shl $0x18,%eax 80105c5d: 89 fb mov %edi,%ebx 80105c5f: c1 e9 02 shr $0x2,%ecx 80105c62: c1 e3 10 shl $0x10,%ebx 80105c65: 09 d8 or %ebx,%eax 80105c67: 09 f8 or %edi,%eax 80105c69: c1 e7 08 shl $0x8,%edi 80105c6c: 09 f8 or %edi,%eax asm volatile ("cld; rep stosl" : 80105c6e: 89 d7 mov %edx,%edi 80105c70: fc cld 80105c71: f3 ab rep stos %eax,%es:(%edi) } else { stosb(dst, c, n); } return dst; } 80105c73: 5b pop %ebx 80105c74: 89 d0 mov %edx,%eax 80105c76: 5f pop %edi 80105c77: 5d pop %ebp 80105c78: c3 ret 80105c79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi asm volatile ("cld; rep stosb" : 80105c80: 89 d7 mov %edx,%edi 80105c82: fc cld 80105c83: f3 aa rep stos %al,%es:(%edi) 80105c85: 5b pop %ebx 80105c86: 89 d0 mov %edx,%eax 80105c88: 5f pop %edi 80105c89: 5d pop %ebp 80105c8a: c3 ret 80105c8b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105c8f: 90 nop 80105c90 : int memcmp(const void *v1, const void *v2, uint n) { 80105c90: 55 push %ebp 80105c91: 89 e5 mov %esp,%ebp 80105c93: 56 push %esi 80105c94: 8b 75 10 mov 0x10(%ebp),%esi 80105c97: 8b 55 08 mov 0x8(%ebp),%edx 80105c9a: 53 push %ebx 80105c9b: 8b 45 0c mov 0xc(%ebp),%eax const uchar *s1, *s2; s1 = v1; s2 = v2; while (n-- > 0) { 80105c9e: 85 f6 test %esi,%esi 80105ca0: 74 2e je 80105cd0 80105ca2: 01 c6 add %eax,%esi 80105ca4: eb 14 jmp 80105cba 80105ca6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105cad: 8d 76 00 lea 0x0(%esi),%esi if (*s1 != *s2) { return *s1 - *s2; } s1++, s2++; 80105cb0: 83 c0 01 add $0x1,%eax 80105cb3: 83 c2 01 add $0x1,%edx while (n-- > 0) { 80105cb6: 39 f0 cmp %esi,%eax 80105cb8: 74 16 je 80105cd0 if (*s1 != *s2) { 80105cba: 0f b6 0a movzbl (%edx),%ecx 80105cbd: 0f b6 18 movzbl (%eax),%ebx 80105cc0: 38 d9 cmp %bl,%cl 80105cc2: 74 ec je 80105cb0 return *s1 - *s2; 80105cc4: 0f b6 c1 movzbl %cl,%eax 80105cc7: 29 d8 sub %ebx,%eax } return 0; } 80105cc9: 5b pop %ebx 80105cca: 5e pop %esi 80105ccb: 5d pop %ebp 80105ccc: c3 ret 80105ccd: 8d 76 00 lea 0x0(%esi),%esi 80105cd0: 5b pop %ebx return 0; 80105cd1: 31 c0 xor %eax,%eax } 80105cd3: 5e pop %esi 80105cd4: 5d pop %ebp 80105cd5: c3 ret 80105cd6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105cdd: 8d 76 00 lea 0x0(%esi),%esi 80105ce0 : void* memmove(void *dst, const void *src, uint n) { 80105ce0: 55 push %ebp 80105ce1: 89 e5 mov %esp,%ebp 80105ce3: 57 push %edi 80105ce4: 8b 55 08 mov 0x8(%ebp),%edx 80105ce7: 8b 4d 10 mov 0x10(%ebp),%ecx 80105cea: 56 push %esi 80105ceb: 8b 75 0c mov 0xc(%ebp),%esi const char *s; char *d; s = src; d = dst; if (s < d && s + n > d) { 80105cee: 39 d6 cmp %edx,%esi 80105cf0: 73 26 jae 80105d18 80105cf2: 8d 3c 0e lea (%esi,%ecx,1),%edi 80105cf5: 39 fa cmp %edi,%edx 80105cf7: 73 1f jae 80105d18 80105cf9: 8d 41 ff lea -0x1(%ecx),%eax s += n; d += n; while (n-- > 0) { 80105cfc: 85 c9 test %ecx,%ecx 80105cfe: 74 0c je 80105d0c *--d = *--s; 80105d00: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx 80105d04: 88 0c 02 mov %cl,(%edx,%eax,1) while (n-- > 0) { 80105d07: 83 e8 01 sub $0x1,%eax 80105d0a: 73 f4 jae 80105d00 *d++ = *s++; } } return dst; } 80105d0c: 5e pop %esi 80105d0d: 89 d0 mov %edx,%eax 80105d0f: 5f pop %edi 80105d10: 5d pop %ebp 80105d11: c3 ret 80105d12: 8d b6 00 00 00 00 lea 0x0(%esi),%esi while (n-- > 0) { 80105d18: 8d 04 0e lea (%esi,%ecx,1),%eax 80105d1b: 89 d7 mov %edx,%edi 80105d1d: 85 c9 test %ecx,%ecx 80105d1f: 74 eb je 80105d0c 80105d21: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi *d++ = *s++; 80105d28: a4 movsb %ds:(%esi),%es:(%edi) while (n-- > 0) { 80105d29: 39 c6 cmp %eax,%esi 80105d2b: 75 fb jne 80105d28 } 80105d2d: 5e pop %esi 80105d2e: 89 d0 mov %edx,%eax 80105d30: 5f pop %edi 80105d31: 5d pop %ebp 80105d32: c3 ret 80105d33: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105d3a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105d40 : // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { return memmove(dst, src, n); 80105d40: eb 9e jmp 80105ce0 80105d42: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105d49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105d50 : } int strncmp(const char *p, const char *q, uint n) { 80105d50: 55 push %ebp 80105d51: 89 e5 mov %esp,%ebp 80105d53: 56 push %esi 80105d54: 8b 75 10 mov 0x10(%ebp),%esi 80105d57: 8b 4d 08 mov 0x8(%ebp),%ecx 80105d5a: 53 push %ebx 80105d5b: 8b 55 0c mov 0xc(%ebp),%edx while (n > 0 && *p && *p == *q) { 80105d5e: 85 f6 test %esi,%esi 80105d60: 74 2e je 80105d90 80105d62: 01 d6 add %edx,%esi 80105d64: eb 18 jmp 80105d7e 80105d66: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105d6d: 8d 76 00 lea 0x0(%esi),%esi 80105d70: 38 d8 cmp %bl,%al 80105d72: 75 14 jne 80105d88 n--, p++, q++; 80105d74: 83 c2 01 add $0x1,%edx 80105d77: 83 c1 01 add $0x1,%ecx while (n > 0 && *p && *p == *q) { 80105d7a: 39 f2 cmp %esi,%edx 80105d7c: 74 12 je 80105d90 80105d7e: 0f b6 01 movzbl (%ecx),%eax 80105d81: 0f b6 1a movzbl (%edx),%ebx 80105d84: 84 c0 test %al,%al 80105d86: 75 e8 jne 80105d70 } if (n == 0) { return 0; } return (uchar) * p - (uchar) * q; 80105d88: 29 d8 sub %ebx,%eax } 80105d8a: 5b pop %ebx 80105d8b: 5e pop %esi 80105d8c: 5d pop %ebp 80105d8d: c3 ret 80105d8e: 66 90 xchg %ax,%ax 80105d90: 5b pop %ebx return 0; 80105d91: 31 c0 xor %eax,%eax } 80105d93: 5e pop %esi 80105d94: 5d pop %ebp 80105d95: c3 ret 80105d96: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105d9d: 8d 76 00 lea 0x0(%esi),%esi 80105da0 : char* strncpy(char *s, const char *t, int n) { 80105da0: 55 push %ebp 80105da1: 89 e5 mov %esp,%ebp 80105da3: 57 push %edi 80105da4: 56 push %esi 80105da5: 8b 75 08 mov 0x8(%ebp),%esi 80105da8: 53 push %ebx 80105da9: 8b 4d 10 mov 0x10(%ebp),%ecx char *os; os = s; while (n-- > 0 && (*s++ = *t++) != 0) { 80105dac: 89 f0 mov %esi,%eax 80105dae: eb 15 jmp 80105dc5 80105db0: 83 45 0c 01 addl $0x1,0xc(%ebp) 80105db4: 8b 7d 0c mov 0xc(%ebp),%edi 80105db7: 83 c0 01 add $0x1,%eax 80105dba: 0f b6 57 ff movzbl -0x1(%edi),%edx 80105dbe: 88 50 ff mov %dl,-0x1(%eax) 80105dc1: 84 d2 test %dl,%dl 80105dc3: 74 09 je 80105dce 80105dc5: 89 cb mov %ecx,%ebx 80105dc7: 83 e9 01 sub $0x1,%ecx 80105dca: 85 db test %ebx,%ebx 80105dcc: 7f e2 jg 80105db0 ; } while (n-- > 0) { 80105dce: 89 c2 mov %eax,%edx 80105dd0: 85 c9 test %ecx,%ecx 80105dd2: 7e 17 jle 80105deb 80105dd4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *s++ = 0; 80105dd8: 83 c2 01 add $0x1,%edx 80105ddb: 89 c1 mov %eax,%ecx 80105ddd: c6 42 ff 00 movb $0x0,-0x1(%edx) while (n-- > 0) { 80105de1: 29 d1 sub %edx,%ecx 80105de3: 8d 4c 0b ff lea -0x1(%ebx,%ecx,1),%ecx 80105de7: 85 c9 test %ecx,%ecx 80105de9: 7f ed jg 80105dd8 } return os; } 80105deb: 5b pop %ebx 80105dec: 89 f0 mov %esi,%eax 80105dee: 5e pop %esi 80105def: 5f pop %edi 80105df0: 5d pop %ebp 80105df1: c3 ret 80105df2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105df9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105e00 : // Like strncpy but guaranteed to NUL-terminate. char* safestrcpy(char *s, const char *t, int n) { 80105e00: 55 push %ebp 80105e01: 89 e5 mov %esp,%ebp 80105e03: 56 push %esi 80105e04: 8b 55 10 mov 0x10(%ebp),%edx 80105e07: 8b 75 08 mov 0x8(%ebp),%esi 80105e0a: 53 push %ebx 80105e0b: 8b 45 0c mov 0xc(%ebp),%eax char *os; os = s; if (n <= 0) { 80105e0e: 85 d2 test %edx,%edx 80105e10: 7e 25 jle 80105e37 80105e12: 8d 5c 10 ff lea -0x1(%eax,%edx,1),%ebx 80105e16: 89 f2 mov %esi,%edx 80105e18: eb 16 jmp 80105e30 80105e1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return os; } while (--n > 0 && (*s++ = *t++) != 0) { 80105e20: 0f b6 08 movzbl (%eax),%ecx 80105e23: 83 c0 01 add $0x1,%eax 80105e26: 83 c2 01 add $0x1,%edx 80105e29: 88 4a ff mov %cl,-0x1(%edx) 80105e2c: 84 c9 test %cl,%cl 80105e2e: 74 04 je 80105e34 80105e30: 39 d8 cmp %ebx,%eax 80105e32: 75 ec jne 80105e20 ; } *s = 0; 80105e34: c6 02 00 movb $0x0,(%edx) return os; } 80105e37: 89 f0 mov %esi,%eax 80105e39: 5b pop %ebx 80105e3a: 5e pop %esi 80105e3b: 5d pop %ebp 80105e3c: c3 ret 80105e3d: 8d 76 00 lea 0x0(%esi),%esi 80105e40 : int strlen(const char *s) { 80105e40: 55 push %ebp int n; for (n = 0; s[n]; n++) { 80105e41: 31 c0 xor %eax,%eax int strlen(const char *s) { 80105e43: 89 e5 mov %esp,%ebp 80105e45: 8b 55 08 mov 0x8(%ebp),%edx for (n = 0; s[n]; n++) { 80105e48: 80 3a 00 cmpb $0x0,(%edx) 80105e4b: 74 0c je 80105e59 80105e4d: 8d 76 00 lea 0x0(%esi),%esi 80105e50: 83 c0 01 add $0x1,%eax 80105e53: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) 80105e57: 75 f7 jne 80105e50 ; } return n; } 80105e59: 5d pop %ebp 80105e5a: c3 ret 80105e5b : # 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 80105e5b: 8b 44 24 04 mov 0x4(%esp),%eax movl 8(%esp), %edx 80105e5f: 8b 54 24 08 mov 0x8(%esp),%edx # Save old callee-saved registers pushl %ebp 80105e63: 55 push %ebp pushl %ebx 80105e64: 53 push %ebx pushl %esi 80105e65: 56 push %esi pushl %edi 80105e66: 57 push %edi # Switch stacks movl %esp, (%eax) 80105e67: 89 20 mov %esp,(%eax) movl %edx, %esp 80105e69: 89 d4 mov %edx,%esp # Load new callee-saved registers popl %edi 80105e6b: 5f pop %edi popl %esi 80105e6c: 5e pop %esi popl %ebx 80105e6d: 5b pop %ebx popl %ebp 80105e6e: 5d pop %ebp ret 80105e6f: c3 ret 80105e70 : // 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) { 80105e70: 55 push %ebp 80105e71: 89 e5 mov %esp,%ebp 80105e73: 53 push %ebx 80105e74: 83 ec 04 sub $0x4,%esp 80105e77: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *curproc = myproc(); 80105e7a: e8 31 f0 ff ff call 80104eb0 if (addr >= curproc->sz || addr + 4 > curproc->sz) { 80105e7f: 8b 00 mov (%eax),%eax 80105e81: 39 d8 cmp %ebx,%eax 80105e83: 76 1b jbe 80105ea0 80105e85: 8d 53 04 lea 0x4(%ebx),%edx 80105e88: 39 d0 cmp %edx,%eax 80105e8a: 72 14 jb 80105ea0 return -1; } *ip = *(int*)(addr); 80105e8c: 8b 45 0c mov 0xc(%ebp),%eax 80105e8f: 8b 13 mov (%ebx),%edx 80105e91: 89 10 mov %edx,(%eax) return 0; 80105e93: 31 c0 xor %eax,%eax } 80105e95: 8b 5d fc mov -0x4(%ebp),%ebx 80105e98: c9 leave 80105e99: c3 ret 80105e9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return -1; 80105ea0: b8 ff ff ff ff mov $0xffffffff,%eax 80105ea5: eb ee jmp 80105e95 80105ea7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105eae: 66 90 xchg %ax,%ax 80105eb0 : // 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) { 80105eb0: 55 push %ebp 80105eb1: 89 e5 mov %esp,%ebp 80105eb3: 53 push %ebx 80105eb4: 83 ec 04 sub $0x4,%esp 80105eb7: 8b 5d 08 mov 0x8(%ebp),%ebx char *s, *ep; struct proc *curproc = myproc(); 80105eba: e8 f1 ef ff ff call 80104eb0 if (addr >= curproc->sz) { 80105ebf: 39 18 cmp %ebx,(%eax) 80105ec1: 76 2d jbe 80105ef0 return -1; } *pp = (char*)addr; 80105ec3: 8b 55 0c mov 0xc(%ebp),%edx 80105ec6: 89 1a mov %ebx,(%edx) ep = (char*)curproc->sz; 80105ec8: 8b 10 mov (%eax),%edx for (s = *pp; s < ep; s++) { 80105eca: 39 d3 cmp %edx,%ebx 80105ecc: 73 22 jae 80105ef0 80105ece: 89 d8 mov %ebx,%eax 80105ed0: eb 0d jmp 80105edf 80105ed2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105ed8: 83 c0 01 add $0x1,%eax 80105edb: 39 c2 cmp %eax,%edx 80105edd: 76 11 jbe 80105ef0 if (*s == 0) { 80105edf: 80 38 00 cmpb $0x0,(%eax) 80105ee2: 75 f4 jne 80105ed8 return s - *pp; 80105ee4: 29 d8 sub %ebx,%eax } } return -1; } 80105ee6: 8b 5d fc mov -0x4(%ebp),%ebx 80105ee9: c9 leave 80105eea: c3 ret 80105eeb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105eef: 90 nop 80105ef0: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80105ef3: b8 ff ff ff ff mov $0xffffffff,%eax } 80105ef8: c9 leave 80105ef9: c3 ret 80105efa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105f00 : // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { 80105f00: 55 push %ebp 80105f01: 89 e5 mov %esp,%ebp 80105f03: 56 push %esi 80105f04: 53 push %ebx return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80105f05: e8 a6 ef ff ff call 80104eb0 80105f0a: 8b 55 08 mov 0x8(%ebp),%edx 80105f0d: 8b 40 18 mov 0x18(%eax),%eax 80105f10: 8b 40 44 mov 0x44(%eax),%eax 80105f13: 8d 1c 90 lea (%eax,%edx,4),%ebx struct proc *curproc = myproc(); 80105f16: e8 95 ef ff ff call 80104eb0 return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80105f1b: 8d 73 04 lea 0x4(%ebx),%esi if (addr >= curproc->sz || addr + 4 > curproc->sz) { 80105f1e: 8b 00 mov (%eax),%eax 80105f20: 39 c6 cmp %eax,%esi 80105f22: 73 1c jae 80105f40 80105f24: 8d 53 08 lea 0x8(%ebx),%edx 80105f27: 39 d0 cmp %edx,%eax 80105f29: 72 15 jb 80105f40 *ip = *(int*)(addr); 80105f2b: 8b 45 0c mov 0xc(%ebp),%eax 80105f2e: 8b 53 04 mov 0x4(%ebx),%edx 80105f31: 89 10 mov %edx,(%eax) return 0; 80105f33: 31 c0 xor %eax,%eax } 80105f35: 5b pop %ebx 80105f36: 5e pop %esi 80105f37: 5d pop %ebp 80105f38: c3 ret 80105f39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return -1; 80105f40: b8 ff ff ff ff mov $0xffffffff,%eax return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80105f45: eb ee jmp 80105f35 80105f47: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105f4e: 66 90 xchg %ax,%ax 80105f50 : // 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) { 80105f50: 55 push %ebp 80105f51: 89 e5 mov %esp,%ebp 80105f53: 57 push %edi 80105f54: 56 push %esi 80105f55: 53 push %ebx 80105f56: 83 ec 0c sub $0xc,%esp int i; struct proc *curproc = myproc(); 80105f59: e8 52 ef ff ff call 80104eb0 80105f5e: 89 c6 mov %eax,%esi return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80105f60: e8 4b ef ff ff call 80104eb0 80105f65: 8b 55 08 mov 0x8(%ebp),%edx 80105f68: 8b 40 18 mov 0x18(%eax),%eax 80105f6b: 8b 40 44 mov 0x44(%eax),%eax 80105f6e: 8d 1c 90 lea (%eax,%edx,4),%ebx struct proc *curproc = myproc(); 80105f71: e8 3a ef ff ff call 80104eb0 return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80105f76: 8d 7b 04 lea 0x4(%ebx),%edi if (addr >= curproc->sz || addr + 4 > curproc->sz) { 80105f79: 8b 00 mov (%eax),%eax 80105f7b: 39 c7 cmp %eax,%edi 80105f7d: 73 31 jae 80105fb0 80105f7f: 8d 4b 08 lea 0x8(%ebx),%ecx 80105f82: 39 c8 cmp %ecx,%eax 80105f84: 72 2a jb 80105fb0 if (argint(n, &i) < 0) { return -1; } if (size < 0 || (uint)i >= curproc->sz || (uint)i + size > curproc->sz) { 80105f86: 8b 55 10 mov 0x10(%ebp),%edx *ip = *(int*)(addr); 80105f89: 8b 43 04 mov 0x4(%ebx),%eax if (size < 0 || (uint)i >= curproc->sz || (uint)i + size > curproc->sz) { 80105f8c: 85 d2 test %edx,%edx 80105f8e: 78 20 js 80105fb0 80105f90: 8b 16 mov (%esi),%edx 80105f92: 39 c2 cmp %eax,%edx 80105f94: 76 1a jbe 80105fb0 80105f96: 8b 5d 10 mov 0x10(%ebp),%ebx 80105f99: 01 c3 add %eax,%ebx 80105f9b: 39 da cmp %ebx,%edx 80105f9d: 72 11 jb 80105fb0 return -1; } *pp = (char*)i; 80105f9f: 8b 55 0c mov 0xc(%ebp),%edx 80105fa2: 89 02 mov %eax,(%edx) return 0; 80105fa4: 31 c0 xor %eax,%eax } 80105fa6: 83 c4 0c add $0xc,%esp 80105fa9: 5b pop %ebx 80105faa: 5e pop %esi 80105fab: 5f pop %edi 80105fac: 5d pop %ebp 80105fad: c3 ret 80105fae: 66 90 xchg %ax,%ax return -1; 80105fb0: b8 ff ff ff ff mov $0xffffffff,%eax 80105fb5: eb ef jmp 80105fa6 80105fb7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105fbe: 66 90 xchg %ax,%ax 80105fc0 : // 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) { 80105fc0: 55 push %ebp 80105fc1: 89 e5 mov %esp,%ebp 80105fc3: 56 push %esi 80105fc4: 53 push %ebx return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80105fc5: e8 e6 ee ff ff call 80104eb0 80105fca: 8b 55 08 mov 0x8(%ebp),%edx 80105fcd: 8b 40 18 mov 0x18(%eax),%eax 80105fd0: 8b 40 44 mov 0x44(%eax),%eax 80105fd3: 8d 1c 90 lea (%eax,%edx,4),%ebx struct proc *curproc = myproc(); 80105fd6: e8 d5 ee ff ff call 80104eb0 return fetchint((myproc()->tf->esp) + 4 + 4 * n, ip); 80105fdb: 8d 73 04 lea 0x4(%ebx),%esi if (addr >= curproc->sz || addr + 4 > curproc->sz) { 80105fde: 8b 00 mov (%eax),%eax 80105fe0: 39 c6 cmp %eax,%esi 80105fe2: 73 44 jae 80106028 80105fe4: 8d 53 08 lea 0x8(%ebx),%edx 80105fe7: 39 d0 cmp %edx,%eax 80105fe9: 72 3d jb 80106028 *ip = *(int*)(addr); 80105feb: 8b 5b 04 mov 0x4(%ebx),%ebx struct proc *curproc = myproc(); 80105fee: e8 bd ee ff ff call 80104eb0 if (addr >= curproc->sz) { 80105ff3: 3b 18 cmp (%eax),%ebx 80105ff5: 73 31 jae 80106028 *pp = (char*)addr; 80105ff7: 8b 55 0c mov 0xc(%ebp),%edx 80105ffa: 89 1a mov %ebx,(%edx) ep = (char*)curproc->sz; 80105ffc: 8b 10 mov (%eax),%edx for (s = *pp; s < ep; s++) { 80105ffe: 39 d3 cmp %edx,%ebx 80106000: 73 26 jae 80106028 80106002: 89 d8 mov %ebx,%eax 80106004: eb 11 jmp 80106017 80106006: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010600d: 8d 76 00 lea 0x0(%esi),%esi 80106010: 83 c0 01 add $0x1,%eax 80106013: 39 c2 cmp %eax,%edx 80106015: 76 11 jbe 80106028 if (*s == 0) { 80106017: 80 38 00 cmpb $0x0,(%eax) 8010601a: 75 f4 jne 80106010 return s - *pp; 8010601c: 29 d8 sub %ebx,%eax int addr; if (argint(n, &addr) < 0) { return -1; } return fetchstr(addr, pp); } 8010601e: 5b pop %ebx 8010601f: 5e pop %esi 80106020: 5d pop %ebp 80106021: c3 ret 80106022: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106028: 5b pop %ebx return -1; 80106029: b8 ff ff ff ff mov $0xffffffff,%eax } 8010602e: 5e pop %esi 8010602f: 5d pop %ebp 80106030: c3 ret 80106031: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106038: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010603f: 90 nop 80106040 : void syscall(void) { 80106040: 55 push %ebp 80106041: 89 e5 mov %esp,%ebp 80106043: 53 push %ebx 80106044: 83 ec 04 sub $0x4,%esp int num; struct proc *curproc = myproc(); 80106047: e8 64 ee ff ff call 80104eb0 8010604c: 89 c3 mov %eax,%ebx num = curproc->tf->eax; 8010604e: 8b 40 18 mov 0x18(%eax),%eax 80106051: 8b 40 1c mov 0x1c(%eax),%eax if (num > 0 && num < NELEM(syscalls) && syscalls[num]) { 80106054: 8d 50 ff lea -0x1(%eax),%edx 80106057: 83 fa 19 cmp $0x19,%edx 8010605a: 77 24 ja 80106080 8010605c: 8b 14 85 60 91 10 80 mov -0x7fef6ea0(,%eax,4),%edx 80106063: 85 d2 test %edx,%edx 80106065: 74 19 je 80106080 curproc->tf->eax = syscalls[num](); 80106067: ff d2 call *%edx 80106069: 89 c2 mov %eax,%edx 8010606b: 8b 43 18 mov 0x18(%ebx),%eax 8010606e: 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; } } 80106071: 8b 5d fc mov -0x4(%ebp),%ebx 80106074: c9 leave 80106075: c3 ret 80106076: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010607d: 8d 76 00 lea 0x0(%esi),%esi cprintf("%d %s: unknown sys call %d\n", 80106080: 50 push %eax curproc->pid, curproc->name, num); 80106081: 8d 43 6c lea 0x6c(%ebx),%eax cprintf("%d %s: unknown sys call %d\n", 80106084: 50 push %eax 80106085: ff 73 10 push 0x10(%ebx) 80106088: 68 29 91 10 80 push $0x80109129 8010608d: e8 fe a7 ff ff call 80100890 curproc->tf->eax = -1; 80106092: 8b 43 18 mov 0x18(%ebx),%eax 80106095: 83 c4 10 add $0x10,%esp 80106098: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax) } 8010609f: 8b 5d fc mov -0x4(%ebp),%ebx 801060a2: c9 leave 801060a3: c3 ret 801060a4: 66 90 xchg %ax,%ax 801060a6: 66 90 xchg %ax,%ax 801060a8: 66 90 xchg %ax,%ax 801060aa: 66 90 xchg %ax,%ax 801060ac: 66 90 xchg %ax,%ax 801060ae: 66 90 xchg %ax,%ax 801060b0 : end_op(); return 0; } static struct inode* create(char *path, short type, short major, short minor) { 801060b0: 55 push %ebp 801060b1: 89 e5 mov %esp,%ebp 801060b3: 57 push %edi 801060b4: 56 push %esi struct inode *ip, *dp; char name[DIRSIZ]; if ((dp = nameiparent(path, name)) == 0) { 801060b5: 8d 7d da lea -0x26(%ebp),%edi static struct inode* create(char *path, short type, short major, short minor) { 801060b8: 53 push %ebx 801060b9: 83 ec 34 sub $0x34,%esp 801060bc: 89 4d d0 mov %ecx,-0x30(%ebp) 801060bf: 8b 4d 08 mov 0x8(%ebp),%ecx if ((dp = nameiparent(path, name)) == 0) { 801060c2: 57 push %edi 801060c3: 50 push %eax static struct inode* create(char *path, short type, short major, short minor) { 801060c4: 89 55 d4 mov %edx,-0x2c(%ebp) 801060c7: 89 4d cc mov %ecx,-0x34(%ebp) if ((dp = nameiparent(path, name)) == 0) { 801060ca: e8 e1 d4 ff ff call 801035b0 801060cf: 83 c4 10 add $0x10,%esp 801060d2: 85 c0 test %eax,%eax 801060d4: 0f 84 46 01 00 00 je 80106220 return 0; } ilock(dp); 801060da: 83 ec 0c sub $0xc,%esp 801060dd: 89 c3 mov %eax,%ebx 801060df: 50 push %eax 801060e0: e8 8b cb ff ff call 80102c70 if ((ip = dirlookup(dp, name, 0)) != 0) { 801060e5: 83 c4 0c add $0xc,%esp 801060e8: 6a 00 push $0x0 801060ea: 57 push %edi 801060eb: 53 push %ebx 801060ec: e8 df d0 ff ff call 801031d0 801060f1: 83 c4 10 add $0x10,%esp 801060f4: 89 c6 mov %eax,%esi 801060f6: 85 c0 test %eax,%eax 801060f8: 74 56 je 80106150 iunlockput(dp); 801060fa: 83 ec 0c sub $0xc,%esp 801060fd: 53 push %ebx 801060fe: e8 fd cd ff ff call 80102f00 ilock(ip); 80106103: 89 34 24 mov %esi,(%esp) 80106106: e8 65 cb ff ff call 80102c70 if (type == T_FILE && ip->type == T_FILE) { 8010610b: 83 c4 10 add $0x10,%esp 8010610e: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp) 80106113: 75 1b jne 80106130 80106115: 66 83 7e 50 02 cmpw $0x2,0x50(%esi) 8010611a: 75 14 jne 80106130 } iunlockput(dp); return ip; } 8010611c: 8d 65 f4 lea -0xc(%ebp),%esp 8010611f: 89 f0 mov %esi,%eax 80106121: 5b pop %ebx 80106122: 5e pop %esi 80106123: 5f pop %edi 80106124: 5d pop %ebp 80106125: c3 ret 80106126: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010612d: 8d 76 00 lea 0x0(%esi),%esi iunlockput(ip); 80106130: 83 ec 0c sub $0xc,%esp 80106133: 56 push %esi return 0; 80106134: 31 f6 xor %esi,%esi iunlockput(ip); 80106136: e8 c5 cd ff ff call 80102f00 return 0; 8010613b: 83 c4 10 add $0x10,%esp } 8010613e: 8d 65 f4 lea -0xc(%ebp),%esp 80106141: 89 f0 mov %esi,%eax 80106143: 5b pop %ebx 80106144: 5e pop %esi 80106145: 5f pop %edi 80106146: 5d pop %ebp 80106147: c3 ret 80106148: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010614f: 90 nop if ((ip = ialloc(dp->dev, type)) == 0) { 80106150: 0f bf 45 d4 movswl -0x2c(%ebp),%eax 80106154: 83 ec 08 sub $0x8,%esp 80106157: 50 push %eax 80106158: ff 33 push (%ebx) 8010615a: e8 a1 c9 ff ff call 80102b00 8010615f: 83 c4 10 add $0x10,%esp 80106162: 89 c6 mov %eax,%esi 80106164: 85 c0 test %eax,%eax 80106166: 0f 84 cd 00 00 00 je 80106239 ilock(ip); 8010616c: 83 ec 0c sub $0xc,%esp 8010616f: 50 push %eax 80106170: e8 fb ca ff ff call 80102c70 ip->major = major; 80106175: 0f b7 45 d0 movzwl -0x30(%ebp),%eax 80106179: 66 89 46 52 mov %ax,0x52(%esi) ip->minor = minor; 8010617d: 0f b7 45 cc movzwl -0x34(%ebp),%eax 80106181: 66 89 46 54 mov %ax,0x54(%esi) ip->nlink = 1; 80106185: b8 01 00 00 00 mov $0x1,%eax 8010618a: 66 89 46 56 mov %ax,0x56(%esi) iupdate(ip); 8010618e: 89 34 24 mov %esi,(%esp) 80106191: e8 2a ca ff ff call 80102bc0 if (type == T_DIR) { // Create . and .. entries. 80106196: 83 c4 10 add $0x10,%esp 80106199: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp) 8010619e: 74 30 je 801061d0 if (dirlink(dp, name, ip->inum) < 0) { 801061a0: 83 ec 04 sub $0x4,%esp 801061a3: ff 76 04 push 0x4(%esi) 801061a6: 57 push %edi 801061a7: 53 push %ebx 801061a8: e8 23 d3 ff ff call 801034d0 801061ad: 83 c4 10 add $0x10,%esp 801061b0: 85 c0 test %eax,%eax 801061b2: 78 78 js 8010622c iunlockput(dp); 801061b4: 83 ec 0c sub $0xc,%esp 801061b7: 53 push %ebx 801061b8: e8 43 cd ff ff call 80102f00 return ip; 801061bd: 83 c4 10 add $0x10,%esp } 801061c0: 8d 65 f4 lea -0xc(%ebp),%esp 801061c3: 89 f0 mov %esi,%eax 801061c5: 5b pop %ebx 801061c6: 5e pop %esi 801061c7: 5f pop %edi 801061c8: 5d pop %ebp 801061c9: c3 ret 801061ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi iupdate(dp); 801061d0: 83 ec 0c sub $0xc,%esp dp->nlink++; // for ".." 801061d3: 66 83 43 56 01 addw $0x1,0x56(%ebx) iupdate(dp); 801061d8: 53 push %ebx 801061d9: e8 e2 c9 ff ff call 80102bc0 if (dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) { 801061de: 83 c4 0c add $0xc,%esp 801061e1: ff 76 04 push 0x4(%esi) 801061e4: 68 e8 91 10 80 push $0x801091e8 801061e9: 56 push %esi 801061ea: e8 e1 d2 ff ff call 801034d0 801061ef: 83 c4 10 add $0x10,%esp 801061f2: 85 c0 test %eax,%eax 801061f4: 78 18 js 8010620e 801061f6: 83 ec 04 sub $0x4,%esp 801061f9: ff 73 04 push 0x4(%ebx) 801061fc: 68 e7 91 10 80 push $0x801091e7 80106201: 56 push %esi 80106202: e8 c9 d2 ff ff call 801034d0 80106207: 83 c4 10 add $0x10,%esp 8010620a: 85 c0 test %eax,%eax 8010620c: 79 92 jns 801061a0 panic("create dots"); 8010620e: 83 ec 0c sub $0xc,%esp 80106211: 68 db 91 10 80 push $0x801091db 80106216: e8 65 a2 ff ff call 80100480 8010621b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010621f: 90 nop } 80106220: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80106223: 31 f6 xor %esi,%esi } 80106225: 5b pop %ebx 80106226: 89 f0 mov %esi,%eax 80106228: 5e pop %esi 80106229: 5f pop %edi 8010622a: 5d pop %ebp 8010622b: c3 ret panic("create: dirlink"); 8010622c: 83 ec 0c sub $0xc,%esp 8010622f: 68 ea 91 10 80 push $0x801091ea 80106234: e8 47 a2 ff ff call 80100480 panic("create: ialloc"); 80106239: 83 ec 0c sub $0xc,%esp 8010623c: 68 cc 91 10 80 push $0x801091cc 80106241: e8 3a a2 ff ff call 80100480 80106246: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010624d: 8d 76 00 lea 0x0(%esi),%esi 80106250 : int sys_dup(void) { 80106250: 55 push %ebp 80106251: 89 e5 mov %esp,%ebp 80106253: 56 push %esi 80106254: 53 push %ebx if (argint(n, &fd) < 0) { 80106255: 8d 45 f4 lea -0xc(%ebp),%eax int sys_dup(void) { 80106258: 83 ec 18 sub $0x18,%esp if (argint(n, &fd) < 0) { 8010625b: 50 push %eax 8010625c: 6a 00 push $0x0 8010625e: e8 9d fc ff ff call 80105f00 80106263: 83 c4 10 add $0x10,%esp 80106266: 85 c0 test %eax,%eax 80106268: 78 36 js 801062a0 if (fd < 0 || fd >= NOFILE || (f = myproc()->ofile[fd]) == 0) { 8010626a: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 8010626e: 77 30 ja 801062a0 80106270: e8 3b ec ff ff call 80104eb0 80106275: 8b 55 f4 mov -0xc(%ebp),%edx 80106278: 8b 74 90 28 mov 0x28(%eax,%edx,4),%esi 8010627c: 85 f6 test %esi,%esi 8010627e: 74 20 je 801062a0 struct proc *curproc = myproc(); 80106280: e8 2b ec ff ff call 80104eb0 for (fd = 0; fd < NOFILE; fd++) { 80106285: 31 db xor %ebx,%ebx 80106287: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010628e: 66 90 xchg %ax,%ax if (curproc->ofile[fd] == 0) { 80106290: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx 80106294: 85 d2 test %edx,%edx 80106296: 74 18 je 801062b0 for (fd = 0; fd < NOFILE; fd++) { 80106298: 83 c3 01 add $0x1,%ebx 8010629b: 83 fb 10 cmp $0x10,%ebx 8010629e: 75 f0 jne 80106290 } 801062a0: 8d 65 f8 lea -0x8(%ebp),%esp return -1; 801062a3: bb ff ff ff ff mov $0xffffffff,%ebx } 801062a8: 89 d8 mov %ebx,%eax 801062aa: 5b pop %ebx 801062ab: 5e pop %esi 801062ac: 5d pop %ebp 801062ad: c3 ret 801062ae: 66 90 xchg %ax,%ax filedup(f); 801062b0: 83 ec 0c sub $0xc,%esp curproc->ofile[fd] = f; 801062b3: 89 74 98 28 mov %esi,0x28(%eax,%ebx,4) filedup(f); 801062b7: 56 push %esi 801062b8: e8 d3 c0 ff ff call 80102390 return fd; 801062bd: 83 c4 10 add $0x10,%esp } 801062c0: 8d 65 f8 lea -0x8(%ebp),%esp 801062c3: 89 d8 mov %ebx,%eax 801062c5: 5b pop %ebx 801062c6: 5e pop %esi 801062c7: 5d pop %ebp 801062c8: c3 ret 801062c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801062d0 : int sys_read(void) { 801062d0: 55 push %ebp 801062d1: 89 e5 mov %esp,%ebp 801062d3: 56 push %esi 801062d4: 53 push %ebx if (argint(n, &fd) < 0) { 801062d5: 8d 5d f4 lea -0xc(%ebp),%ebx int sys_read(void) { 801062d8: 83 ec 18 sub $0x18,%esp if (argint(n, &fd) < 0) { 801062db: 53 push %ebx 801062dc: 6a 00 push $0x0 801062de: e8 1d fc ff ff call 80105f00 801062e3: 83 c4 10 add $0x10,%esp 801062e6: 85 c0 test %eax,%eax 801062e8: 78 5e js 80106348 if (fd < 0 || fd >= NOFILE || (f = myproc()->ofile[fd]) == 0) { 801062ea: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 801062ee: 77 58 ja 80106348 801062f0: e8 bb eb ff ff call 80104eb0 801062f5: 8b 55 f4 mov -0xc(%ebp),%edx 801062f8: 8b 74 90 28 mov 0x28(%eax,%edx,4),%esi 801062fc: 85 f6 test %esi,%esi 801062fe: 74 48 je 80106348 if (argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) { 80106300: 83 ec 08 sub $0x8,%esp 80106303: 8d 45 f0 lea -0x10(%ebp),%eax 80106306: 50 push %eax 80106307: 6a 02 push $0x2 80106309: e8 f2 fb ff ff call 80105f00 8010630e: 83 c4 10 add $0x10,%esp 80106311: 85 c0 test %eax,%eax 80106313: 78 33 js 80106348 80106315: 83 ec 04 sub $0x4,%esp 80106318: ff 75 f0 push -0x10(%ebp) 8010631b: 53 push %ebx 8010631c: 6a 01 push $0x1 8010631e: e8 2d fc ff ff call 80105f50 80106323: 83 c4 10 add $0x10,%esp 80106326: 85 c0 test %eax,%eax 80106328: 78 1e js 80106348 return fileread(f, p, n); 8010632a: 83 ec 04 sub $0x4,%esp 8010632d: ff 75 f0 push -0x10(%ebp) 80106330: ff 75 f4 push -0xc(%ebp) 80106333: 56 push %esi 80106334: e8 d7 c1 ff ff call 80102510 80106339: 83 c4 10 add $0x10,%esp } 8010633c: 8d 65 f8 lea -0x8(%ebp),%esp 8010633f: 5b pop %ebx 80106340: 5e pop %esi 80106341: 5d pop %ebp 80106342: c3 ret 80106343: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106347: 90 nop return -1; 80106348: b8 ff ff ff ff mov $0xffffffff,%eax 8010634d: eb ed jmp 8010633c 8010634f: 90 nop 80106350 : int sys_write(void) { 80106350: 55 push %ebp 80106351: 89 e5 mov %esp,%ebp 80106353: 56 push %esi 80106354: 53 push %ebx if (argint(n, &fd) < 0) { 80106355: 8d 5d f4 lea -0xc(%ebp),%ebx int sys_write(void) { 80106358: 83 ec 18 sub $0x18,%esp if (argint(n, &fd) < 0) { 8010635b: 53 push %ebx 8010635c: 6a 00 push $0x0 8010635e: e8 9d fb ff ff call 80105f00 80106363: 83 c4 10 add $0x10,%esp 80106366: 85 c0 test %eax,%eax 80106368: 78 5e js 801063c8 if (fd < 0 || fd >= NOFILE || (f = myproc()->ofile[fd]) == 0) { 8010636a: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 8010636e: 77 58 ja 801063c8 80106370: e8 3b eb ff ff call 80104eb0 80106375: 8b 55 f4 mov -0xc(%ebp),%edx 80106378: 8b 74 90 28 mov 0x28(%eax,%edx,4),%esi 8010637c: 85 f6 test %esi,%esi 8010637e: 74 48 je 801063c8 if (argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) { 80106380: 83 ec 08 sub $0x8,%esp 80106383: 8d 45 f0 lea -0x10(%ebp),%eax 80106386: 50 push %eax 80106387: 6a 02 push $0x2 80106389: e8 72 fb ff ff call 80105f00 8010638e: 83 c4 10 add $0x10,%esp 80106391: 85 c0 test %eax,%eax 80106393: 78 33 js 801063c8 80106395: 83 ec 04 sub $0x4,%esp 80106398: ff 75 f0 push -0x10(%ebp) 8010639b: 53 push %ebx 8010639c: 6a 01 push $0x1 8010639e: e8 ad fb ff ff call 80105f50 801063a3: 83 c4 10 add $0x10,%esp 801063a6: 85 c0 test %eax,%eax 801063a8: 78 1e js 801063c8 return filewrite(f, p, n); 801063aa: 83 ec 04 sub $0x4,%esp 801063ad: ff 75 f0 push -0x10(%ebp) 801063b0: ff 75 f4 push -0xc(%ebp) 801063b3: 56 push %esi 801063b4: e8 e7 c1 ff ff call 801025a0 801063b9: 83 c4 10 add $0x10,%esp } 801063bc: 8d 65 f8 lea -0x8(%ebp),%esp 801063bf: 5b pop %ebx 801063c0: 5e pop %esi 801063c1: 5d pop %ebp 801063c2: c3 ret 801063c3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801063c7: 90 nop return -1; 801063c8: b8 ff ff ff ff mov $0xffffffff,%eax 801063cd: eb ed jmp 801063bc 801063cf: 90 nop 801063d0 : int sys_close(void) { 801063d0: 55 push %ebp 801063d1: 89 e5 mov %esp,%ebp 801063d3: 56 push %esi 801063d4: 53 push %ebx if (argint(n, &fd) < 0) { 801063d5: 8d 45 f4 lea -0xc(%ebp),%eax int sys_close(void) { 801063d8: 83 ec 18 sub $0x18,%esp if (argint(n, &fd) < 0) { 801063db: 50 push %eax 801063dc: 6a 00 push $0x0 801063de: e8 1d fb ff ff call 80105f00 801063e3: 83 c4 10 add $0x10,%esp 801063e6: 85 c0 test %eax,%eax 801063e8: 78 3e js 80106428 if (fd < 0 || fd >= NOFILE || (f = myproc()->ofile[fd]) == 0) { 801063ea: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 801063ee: 77 38 ja 80106428 801063f0: e8 bb ea ff ff call 80104eb0 801063f5: 8b 55 f4 mov -0xc(%ebp),%edx 801063f8: 8d 5a 08 lea 0x8(%edx),%ebx 801063fb: 8b 74 98 08 mov 0x8(%eax,%ebx,4),%esi 801063ff: 85 f6 test %esi,%esi 80106401: 74 25 je 80106428 myproc()->ofile[fd] = 0; 80106403: e8 a8 ea ff ff call 80104eb0 fileclose(f); 80106408: 83 ec 0c sub $0xc,%esp myproc()->ofile[fd] = 0; 8010640b: c7 44 98 08 00 00 00 movl $0x0,0x8(%eax,%ebx,4) 80106412: 00 fileclose(f); 80106413: 56 push %esi 80106414: e8 c7 bf ff ff call 801023e0 return 0; 80106419: 83 c4 10 add $0x10,%esp 8010641c: 31 c0 xor %eax,%eax } 8010641e: 8d 65 f8 lea -0x8(%ebp),%esp 80106421: 5b pop %ebx 80106422: 5e pop %esi 80106423: 5d pop %ebp 80106424: c3 ret 80106425: 8d 76 00 lea 0x0(%esi),%esi return -1; 80106428: b8 ff ff ff ff mov $0xffffffff,%eax 8010642d: eb ef jmp 8010641e 8010642f: 90 nop 80106430 : int sys_fstat(void) { 80106430: 55 push %ebp 80106431: 89 e5 mov %esp,%ebp 80106433: 56 push %esi 80106434: 53 push %ebx if (argint(n, &fd) < 0) { 80106435: 8d 5d f4 lea -0xc(%ebp),%ebx int sys_fstat(void) { 80106438: 83 ec 18 sub $0x18,%esp if (argint(n, &fd) < 0) { 8010643b: 53 push %ebx 8010643c: 6a 00 push $0x0 8010643e: e8 bd fa ff ff call 80105f00 80106443: 83 c4 10 add $0x10,%esp 80106446: 85 c0 test %eax,%eax 80106448: 78 46 js 80106490 if (fd < 0 || fd >= NOFILE || (f = myproc()->ofile[fd]) == 0) { 8010644a: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 8010644e: 77 40 ja 80106490 80106450: e8 5b ea ff ff call 80104eb0 80106455: 8b 55 f4 mov -0xc(%ebp),%edx 80106458: 8b 74 90 28 mov 0x28(%eax,%edx,4),%esi 8010645c: 85 f6 test %esi,%esi 8010645e: 74 30 je 80106490 if (argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) { 80106460: 83 ec 04 sub $0x4,%esp 80106463: 6a 14 push $0x14 80106465: 53 push %ebx 80106466: 6a 01 push $0x1 80106468: e8 e3 fa ff ff call 80105f50 8010646d: 83 c4 10 add $0x10,%esp 80106470: 85 c0 test %eax,%eax 80106472: 78 1c js 80106490 return filestat(f, st); 80106474: 83 ec 08 sub $0x8,%esp 80106477: ff 75 f4 push -0xc(%ebp) 8010647a: 56 push %esi 8010647b: e8 40 c0 ff ff call 801024c0 80106480: 83 c4 10 add $0x10,%esp } 80106483: 8d 65 f8 lea -0x8(%ebp),%esp 80106486: 5b pop %ebx 80106487: 5e pop %esi 80106488: 5d pop %ebp 80106489: c3 ret 8010648a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return -1; 80106490: b8 ff ff ff ff mov $0xffffffff,%eax 80106495: eb ec jmp 80106483 80106497: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010649e: 66 90 xchg %ax,%ax 801064a0 : void cleanupsyslink(struct inode * ip) { 801064a0: 55 push %ebp 801064a1: 89 e5 mov %esp,%ebp 801064a3: 53 push %ebx 801064a4: 83 ec 10 sub $0x10,%esp 801064a7: 8b 5d 08 mov 0x8(%ebp),%ebx ilock(ip); 801064aa: 53 push %ebx 801064ab: e8 c0 c7 ff ff call 80102c70 ip->nlink--; 801064b0: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); 801064b5: 89 1c 24 mov %ebx,(%esp) 801064b8: e8 03 c7 ff ff call 80102bc0 iunlockput(ip); 801064bd: 89 1c 24 mov %ebx,(%esp) 801064c0: e8 3b ca ff ff call 80102f00 } 801064c5: 8b 5d fc mov -0x4(%ebp),%ebx end_op(); 801064c8: 83 c4 10 add $0x10,%esp } 801064cb: c9 leave end_op(); 801064cc: e9 ef dd ff ff jmp 801042c0 801064d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801064d8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801064df: 90 nop 801064e0 : int sys_link(void) { 801064e0: 55 push %ebp 801064e1: 89 e5 mov %esp,%ebp 801064e3: 57 push %edi 801064e4: 56 push %esi if (argstr(0, &old) < 0 || argstr(1, &new) < 0) { 801064e5: 8d 45 d4 lea -0x2c(%ebp),%eax int sys_link(void) { 801064e8: 53 push %ebx 801064e9: 83 ec 34 sub $0x34,%esp if (argstr(0, &old) < 0 || argstr(1, &new) < 0) { 801064ec: 50 push %eax 801064ed: 6a 00 push $0x0 801064ef: e8 cc fa ff ff call 80105fc0 801064f4: 83 c4 10 add $0x10,%esp 801064f7: 85 c0 test %eax,%eax 801064f9: 0f 88 ff 00 00 00 js 801065fe 801064ff: 83 ec 08 sub $0x8,%esp 80106502: 8d 45 d0 lea -0x30(%ebp),%eax 80106505: 50 push %eax 80106506: 6a 01 push $0x1 80106508: e8 b3 fa ff ff call 80105fc0 8010650d: 83 c4 10 add $0x10,%esp 80106510: 85 c0 test %eax,%eax 80106512: 0f 88 e6 00 00 00 js 801065fe begin_op(); 80106518: e8 33 dd ff ff call 80104250 if ((ip = namei(old)) == 0) { 8010651d: 83 ec 0c sub $0xc,%esp 80106520: ff 75 d4 push -0x2c(%ebp) 80106523: e8 68 d0 ff ff call 80103590 80106528: 83 c4 10 add $0x10,%esp 8010652b: 89 c3 mov %eax,%ebx 8010652d: 85 c0 test %eax,%eax 8010652f: 0f 84 e8 00 00 00 je 8010661d ilock(ip); 80106535: 83 ec 0c sub $0xc,%esp 80106538: 50 push %eax 80106539: e8 32 c7 ff ff call 80102c70 if (ip->type == T_DIR) { 8010653e: 83 c4 10 add $0x10,%esp 80106541: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80106546: 0f 84 b9 00 00 00 je 80106605 iupdate(ip); 8010654c: 83 ec 0c sub $0xc,%esp ip->nlink++; 8010654f: 66 83 43 56 01 addw $0x1,0x56(%ebx) if ((dp = nameiparent(new, name)) == 0) { 80106554: 8d 7d da lea -0x26(%ebp),%edi iupdate(ip); 80106557: 53 push %ebx 80106558: e8 63 c6 ff ff call 80102bc0 iunlock(ip); 8010655d: 89 1c 24 mov %ebx,(%esp) 80106560: e8 eb c7 ff ff call 80102d50 if ((dp = nameiparent(new, name)) == 0) { 80106565: 58 pop %eax 80106566: 5a pop %edx 80106567: 57 push %edi 80106568: ff 75 d0 push -0x30(%ebp) 8010656b: e8 40 d0 ff ff call 801035b0 80106570: 83 c4 10 add $0x10,%esp 80106573: 89 c6 mov %eax,%esi 80106575: 85 c0 test %eax,%eax 80106577: 0f 84 ac 00 00 00 je 80106629 ilock(dp); 8010657d: 83 ec 0c sub $0xc,%esp 80106580: 50 push %eax 80106581: e8 ea c6 ff ff call 80102c70 if (dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0) { 80106586: 8b 03 mov (%ebx),%eax 80106588: 83 c4 10 add $0x10,%esp 8010658b: 39 06 cmp %eax,(%esi) 8010658d: 75 41 jne 801065d0 8010658f: 83 ec 04 sub $0x4,%esp 80106592: ff 73 04 push 0x4(%ebx) 80106595: 57 push %edi 80106596: 56 push %esi 80106597: e8 34 cf ff ff call 801034d0 8010659c: 83 c4 10 add $0x10,%esp 8010659f: 85 c0 test %eax,%eax 801065a1: 78 2d js 801065d0 iunlockput(dp); 801065a3: 83 ec 0c sub $0xc,%esp 801065a6: 56 push %esi 801065a7: e8 54 c9 ff ff call 80102f00 iput(ip); 801065ac: 89 1c 24 mov %ebx,(%esp) 801065af: e8 ec c7 ff ff call 80102da0 end_op(); 801065b4: e8 07 dd ff ff call 801042c0 return 0; 801065b9: 83 c4 10 add $0x10,%esp 801065bc: 31 c0 xor %eax,%eax } 801065be: 8d 65 f4 lea -0xc(%ebp),%esp 801065c1: 5b pop %ebx 801065c2: 5e pop %esi 801065c3: 5f pop %edi 801065c4: 5d pop %ebp 801065c5: c3 ret 801065c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801065cd: 8d 76 00 lea 0x0(%esi),%esi iunlockput(dp); 801065d0: 83 ec 0c sub $0xc,%esp 801065d3: 56 push %esi 801065d4: e8 27 c9 ff ff call 80102f00 ilock(ip); 801065d9: 89 1c 24 mov %ebx,(%esp) 801065dc: e8 8f c6 ff ff call 80102c70 ip->nlink--; 801065e1: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); 801065e6: 89 1c 24 mov %ebx,(%esp) 801065e9: e8 d2 c5 ff ff call 80102bc0 iunlockput(ip); 801065ee: 89 1c 24 mov %ebx,(%esp) 801065f1: e8 0a c9 ff ff call 80102f00 end_op(); 801065f6: e8 c5 dc ff ff call 801042c0 } 801065fb: 83 c4 10 add $0x10,%esp return -1; 801065fe: b8 ff ff ff ff mov $0xffffffff,%eax } 80106603: eb b9 jmp 801065be iunlockput(ip); 80106605: 83 ec 0c sub $0xc,%esp 80106608: 53 push %ebx 80106609: e8 f2 c8 ff ff call 80102f00 end_op(); 8010660e: e8 ad dc ff ff call 801042c0 return -1; 80106613: 83 c4 10 add $0x10,%esp 80106616: b8 ff ff ff ff mov $0xffffffff,%eax 8010661b: eb a1 jmp 801065be end_op(); 8010661d: e8 9e dc ff ff call 801042c0 return -1; 80106622: b8 ff ff ff ff mov $0xffffffff,%eax 80106627: eb 95 jmp 801065be ilock(ip); 80106629: 83 ec 0c sub $0xc,%esp 8010662c: 53 push %ebx 8010662d: eb ad jmp 801065dc 8010662f: 90 nop 80106630 : int sys_unlink(void) { 80106630: 55 push %ebp 80106631: 89 e5 mov %esp,%ebp 80106633: 57 push %edi 80106634: 56 push %esi if (argstr(0, &path) < 0) { 80106635: 8d 45 c0 lea -0x40(%ebp),%eax int sys_unlink(void) { 80106638: 53 push %ebx 80106639: 83 ec 54 sub $0x54,%esp if (argstr(0, &path) < 0) { 8010663c: 50 push %eax 8010663d: 6a 00 push $0x0 8010663f: e8 7c f9 ff ff call 80105fc0 80106644: 83 c4 10 add $0x10,%esp 80106647: 85 c0 test %eax,%eax 80106649: 0f 88 4c 01 00 00 js 8010679b begin_op(); 8010664f: e8 fc db ff ff call 80104250 if ((dp = nameiparent(path, name)) == 0) { 80106654: 8d 5d ca lea -0x36(%ebp),%ebx 80106657: 83 ec 08 sub $0x8,%esp 8010665a: 53 push %ebx 8010665b: ff 75 c0 push -0x40(%ebp) 8010665e: e8 4d cf ff ff call 801035b0 80106663: 83 c4 10 add $0x10,%esp 80106666: 89 45 b4 mov %eax,-0x4c(%ebp) 80106669: 85 c0 test %eax,%eax 8010666b: 0f 84 55 01 00 00 je 801067c6 ilock(dp); 80106671: 83 ec 0c sub $0xc,%esp 80106674: ff 75 b4 push -0x4c(%ebp) 80106677: e8 f4 c5 ff ff call 80102c70 if (namecmp(name, ".") == 0 || namecmp(name, "..") == 0) { 8010667c: 5a pop %edx 8010667d: 59 pop %ecx 8010667e: 68 e8 91 10 80 push $0x801091e8 80106683: 53 push %ebx 80106684: e8 27 cb ff ff call 801031b0 80106689: 83 c4 10 add $0x10,%esp 8010668c: 85 c0 test %eax,%eax 8010668e: 0f 84 2d 01 00 00 je 801067c1 80106694: 83 ec 08 sub $0x8,%esp 80106697: 68 e7 91 10 80 push $0x801091e7 8010669c: 53 push %ebx 8010669d: e8 0e cb ff ff call 801031b0 801066a2: 83 c4 10 add $0x10,%esp 801066a5: 85 c0 test %eax,%eax 801066a7: 0f 84 14 01 00 00 je 801067c1 if ((ip = dirlookup(dp, name, &off)) == 0) { 801066ad: 83 ec 04 sub $0x4,%esp 801066b0: 8d 45 c4 lea -0x3c(%ebp),%eax 801066b3: 50 push %eax 801066b4: 53 push %ebx 801066b5: ff 75 b4 push -0x4c(%ebp) 801066b8: e8 13 cb ff ff call 801031d0 801066bd: 83 c4 10 add $0x10,%esp 801066c0: 89 c3 mov %eax,%ebx 801066c2: 85 c0 test %eax,%eax 801066c4: 0f 84 f7 00 00 00 je 801067c1 ilock(ip); 801066ca: 83 ec 0c sub $0xc,%esp 801066cd: 50 push %eax 801066ce: e8 9d c5 ff ff call 80102c70 if (ip->nlink < 1) { 801066d3: 83 c4 10 add $0x10,%esp 801066d6: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) 801066db: 0f 8e 01 01 00 00 jle 801067e2 if (ip->type == T_DIR && !isdirempty(ip)) { 801066e1: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 801066e6: 8d 7d d8 lea -0x28(%ebp),%edi 801066e9: 74 65 je 80106750 memset(&de, 0, sizeof(de)); 801066eb: 83 ec 04 sub $0x4,%esp 801066ee: 6a 10 push $0x10 801066f0: 6a 00 push $0x0 801066f2: 57 push %edi 801066f3: e8 48 f5 ff ff call 80105c40 if (writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 801066f8: 6a 10 push $0x10 801066fa: ff 75 c4 push -0x3c(%ebp) 801066fd: 57 push %edi 801066fe: ff 75 b4 push -0x4c(%ebp) 80106701: e8 7a c9 ff ff call 80103080 80106706: 83 c4 20 add $0x20,%esp 80106709: 83 f8 10 cmp $0x10,%eax 8010670c: 0f 85 dd 00 00 00 jne 801067ef if (ip->type == T_DIR) { 80106712: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80106717: 0f 84 8b 00 00 00 je 801067a8 iunlockput(dp); 8010671d: 83 ec 0c sub $0xc,%esp 80106720: ff 75 b4 push -0x4c(%ebp) 80106723: e8 d8 c7 ff ff call 80102f00 ip->nlink--; 80106728: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); 8010672d: 89 1c 24 mov %ebx,(%esp) 80106730: e8 8b c4 ff ff call 80102bc0 iunlockput(ip); 80106735: 89 1c 24 mov %ebx,(%esp) 80106738: e8 c3 c7 ff ff call 80102f00 end_op(); 8010673d: e8 7e db ff ff call 801042c0 return 0; 80106742: 83 c4 10 add $0x10,%esp 80106745: 31 c0 xor %eax,%eax } 80106747: 8d 65 f4 lea -0xc(%ebp),%esp 8010674a: 5b pop %ebx 8010674b: 5e pop %esi 8010674c: 5f pop %edi 8010674d: 5d pop %ebp 8010674e: c3 ret 8010674f: 90 nop for (off = 2 * sizeof(de); off < dp->size; off += sizeof(de)) { 80106750: 83 7b 58 20 cmpl $0x20,0x58(%ebx) 80106754: 76 95 jbe 801066eb 80106756: be 20 00 00 00 mov $0x20,%esi 8010675b: eb 0b jmp 80106768 8010675d: 8d 76 00 lea 0x0(%esi),%esi 80106760: 83 c6 10 add $0x10,%esi 80106763: 39 73 58 cmp %esi,0x58(%ebx) 80106766: 76 83 jbe 801066eb if (readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) { 80106768: 6a 10 push $0x10 8010676a: 56 push %esi 8010676b: 57 push %edi 8010676c: 53 push %ebx 8010676d: e8 0e c8 ff ff call 80102f80 80106772: 83 c4 10 add $0x10,%esp 80106775: 83 f8 10 cmp $0x10,%eax 80106778: 75 5b jne 801067d5 if (de.inum != 0) { 8010677a: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 8010677f: 74 df je 80106760 iunlockput(ip); 80106781: 83 ec 0c sub $0xc,%esp 80106784: 53 push %ebx 80106785: e8 76 c7 ff ff call 80102f00 iunlockput(dp); 8010678a: 58 pop %eax 8010678b: ff 75 b4 push -0x4c(%ebp) 8010678e: e8 6d c7 ff ff call 80102f00 end_op(); 80106793: e8 28 db ff ff call 801042c0 return -1; 80106798: 83 c4 10 add $0x10,%esp 8010679b: b8 ff ff ff ff mov $0xffffffff,%eax 801067a0: eb a5 jmp 80106747 801067a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi dp->nlink--; 801067a8: 8b 45 b4 mov -0x4c(%ebp),%eax iupdate(dp); 801067ab: 83 ec 0c sub $0xc,%esp dp->nlink--; 801067ae: 66 83 68 56 01 subw $0x1,0x56(%eax) iupdate(dp); 801067b3: 50 push %eax 801067b4: e8 07 c4 ff ff call 80102bc0 801067b9: 83 c4 10 add $0x10,%esp 801067bc: e9 5c ff ff ff jmp 8010671d iunlockput(dp); 801067c1: 83 ec 0c sub $0xc,%esp 801067c4: eb c5 jmp 8010678b end_op(); 801067c6: e8 f5 da ff ff call 801042c0 return -1; 801067cb: b8 ff ff ff ff mov $0xffffffff,%eax 801067d0: e9 72 ff ff ff jmp 80106747 panic("isdirempty: readi"); 801067d5: 83 ec 0c sub $0xc,%esp 801067d8: 68 0c 92 10 80 push $0x8010920c 801067dd: e8 9e 9c ff ff call 80100480 panic("unlink: nlink < 1"); 801067e2: 83 ec 0c sub $0xc,%esp 801067e5: 68 fa 91 10 80 push $0x801091fa 801067ea: e8 91 9c ff ff call 80100480 panic("unlink: writei"); 801067ef: 83 ec 0c sub $0xc,%esp 801067f2: 68 1e 92 10 80 push $0x8010921e 801067f7: e8 84 9c ff ff call 80100480 801067fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106800 : int sys_open(void) { 80106800: 55 push %ebp 80106801: 89 e5 mov %esp,%ebp 80106803: 57 push %edi 80106804: 56 push %esi char *path; int fd, omode; struct file *f; struct inode *ip; if (argstr(0, &path) < 0 || argint(1, &omode) < 0) { 80106805: 8d 45 e0 lea -0x20(%ebp),%eax int sys_open(void) { 80106808: 53 push %ebx 80106809: 83 ec 24 sub $0x24,%esp if (argstr(0, &path) < 0 || argint(1, &omode) < 0) { 8010680c: 50 push %eax 8010680d: 6a 00 push $0x0 8010680f: e8 ac f7 ff ff call 80105fc0 80106814: 83 c4 10 add $0x10,%esp 80106817: 85 c0 test %eax,%eax 80106819: 0f 88 8e 00 00 00 js 801068ad 8010681f: 83 ec 08 sub $0x8,%esp 80106822: 8d 45 e4 lea -0x1c(%ebp),%eax 80106825: 50 push %eax 80106826: 6a 01 push $0x1 80106828: e8 d3 f6 ff ff call 80105f00 8010682d: 83 c4 10 add $0x10,%esp 80106830: 85 c0 test %eax,%eax 80106832: 78 79 js 801068ad return -1; } begin_op(); 80106834: e8 17 da ff ff call 80104250 if (omode & O_CREATE) { 80106839: f6 45 e5 02 testb $0x2,-0x1b(%ebp) 8010683d: 75 79 jne 801068b8 end_op(); return -1; } } else { if ((ip = namei(path)) == 0) { 8010683f: 83 ec 0c sub $0xc,%esp 80106842: ff 75 e0 push -0x20(%ebp) 80106845: e8 46 cd ff ff call 80103590 8010684a: 83 c4 10 add $0x10,%esp 8010684d: 89 c6 mov %eax,%esi 8010684f: 85 c0 test %eax,%eax 80106851: 0f 84 7e 00 00 00 je 801068d5 end_op(); return -1; } ilock(ip); 80106857: 83 ec 0c sub $0xc,%esp 8010685a: 50 push %eax 8010685b: e8 10 c4 ff ff call 80102c70 if (ip->type == T_DIR && omode != O_RDONLY) { 80106860: 83 c4 10 add $0x10,%esp 80106863: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) 80106868: 0f 84 c2 00 00 00 je 80106930 end_op(); return -1; } } if ((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0) { 8010686e: e8 ad ba ff ff call 80102320 80106873: 89 c7 mov %eax,%edi 80106875: 85 c0 test %eax,%eax 80106877: 74 23 je 8010689c struct proc *curproc = myproc(); 80106879: e8 32 e6 ff ff call 80104eb0 for (fd = 0; fd < NOFILE; fd++) { 8010687e: 31 db xor %ebx,%ebx if (curproc->ofile[fd] == 0) { 80106880: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx 80106884: 85 d2 test %edx,%edx 80106886: 74 60 je 801068e8 for (fd = 0; fd < NOFILE; fd++) { 80106888: 83 c3 01 add $0x1,%ebx 8010688b: 83 fb 10 cmp $0x10,%ebx 8010688e: 75 f0 jne 80106880 if (f) { fileclose(f); 80106890: 83 ec 0c sub $0xc,%esp 80106893: 57 push %edi 80106894: e8 47 bb ff ff call 801023e0 80106899: 83 c4 10 add $0x10,%esp } iunlockput(ip); 8010689c: 83 ec 0c sub $0xc,%esp 8010689f: 56 push %esi 801068a0: e8 5b c6 ff ff call 80102f00 end_op(); 801068a5: e8 16 da ff ff call 801042c0 return -1; 801068aa: 83 c4 10 add $0x10,%esp 801068ad: bb ff ff ff ff mov $0xffffffff,%ebx 801068b2: eb 6d jmp 80106921 801068b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ip = create(path, T_FILE, 0, 0); 801068b8: 83 ec 0c sub $0xc,%esp 801068bb: 8b 45 e0 mov -0x20(%ebp),%eax 801068be: 31 c9 xor %ecx,%ecx 801068c0: ba 02 00 00 00 mov $0x2,%edx 801068c5: 6a 00 push $0x0 801068c7: e8 e4 f7 ff ff call 801060b0 if (ip == 0) { 801068cc: 83 c4 10 add $0x10,%esp ip = create(path, T_FILE, 0, 0); 801068cf: 89 c6 mov %eax,%esi if (ip == 0) { 801068d1: 85 c0 test %eax,%eax 801068d3: 75 99 jne 8010686e end_op(); 801068d5: e8 e6 d9 ff ff call 801042c0 return -1; 801068da: bb ff ff ff ff mov $0xffffffff,%ebx 801068df: eb 40 jmp 80106921 801068e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } iunlock(ip); 801068e8: 83 ec 0c sub $0xc,%esp curproc->ofile[fd] = f; 801068eb: 89 7c 98 28 mov %edi,0x28(%eax,%ebx,4) iunlock(ip); 801068ef: 56 push %esi 801068f0: e8 5b c4 ff ff call 80102d50 end_op(); 801068f5: e8 c6 d9 ff ff call 801042c0 f->type = FD_INODE; 801068fa: c7 07 02 00 00 00 movl $0x2,(%edi) f->ip = ip; f->off = 0; f->readable = !(omode & O_WRONLY); 80106900: 8b 55 e4 mov -0x1c(%ebp),%edx f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 80106903: 83 c4 10 add $0x10,%esp f->ip = ip; 80106906: 89 77 10 mov %esi,0x10(%edi) f->readable = !(omode & O_WRONLY); 80106909: 89 d0 mov %edx,%eax f->off = 0; 8010690b: c7 47 14 00 00 00 00 movl $0x0,0x14(%edi) f->readable = !(omode & O_WRONLY); 80106912: f7 d0 not %eax 80106914: 83 e0 01 and $0x1,%eax f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 80106917: 83 e2 03 and $0x3,%edx f->readable = !(omode & O_WRONLY); 8010691a: 88 47 08 mov %al,0x8(%edi) f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 8010691d: 0f 95 47 09 setne 0x9(%edi) return fd; } 80106921: 8d 65 f4 lea -0xc(%ebp),%esp 80106924: 89 d8 mov %ebx,%eax 80106926: 5b pop %ebx 80106927: 5e pop %esi 80106928: 5f pop %edi 80106929: 5d pop %ebp 8010692a: c3 ret 8010692b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010692f: 90 nop if (ip->type == T_DIR && omode != O_RDONLY) { 80106930: 8b 4d e4 mov -0x1c(%ebp),%ecx 80106933: 85 c9 test %ecx,%ecx 80106935: 0f 84 33 ff ff ff je 8010686e 8010693b: e9 5c ff ff ff jmp 8010689c 80106940 : int sys_mkdir(void) { 80106940: 55 push %ebp 80106941: 89 e5 mov %esp,%ebp 80106943: 83 ec 18 sub $0x18,%esp char *path; struct inode *ip; begin_op(); 80106946: e8 05 d9 ff ff call 80104250 if (argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0) { 8010694b: 83 ec 08 sub $0x8,%esp 8010694e: 8d 45 f4 lea -0xc(%ebp),%eax 80106951: 50 push %eax 80106952: 6a 00 push $0x0 80106954: e8 67 f6 ff ff call 80105fc0 80106959: 83 c4 10 add $0x10,%esp 8010695c: 85 c0 test %eax,%eax 8010695e: 78 30 js 80106990 80106960: 83 ec 0c sub $0xc,%esp 80106963: 8b 45 f4 mov -0xc(%ebp),%eax 80106966: 31 c9 xor %ecx,%ecx 80106968: ba 01 00 00 00 mov $0x1,%edx 8010696d: 6a 00 push $0x0 8010696f: e8 3c f7 ff ff call 801060b0 80106974: 83 c4 10 add $0x10,%esp 80106977: 85 c0 test %eax,%eax 80106979: 74 15 je 80106990 end_op(); return -1; } iunlockput(ip); 8010697b: 83 ec 0c sub $0xc,%esp 8010697e: 50 push %eax 8010697f: e8 7c c5 ff ff call 80102f00 end_op(); 80106984: e8 37 d9 ff ff call 801042c0 return 0; 80106989: 83 c4 10 add $0x10,%esp 8010698c: 31 c0 xor %eax,%eax } 8010698e: c9 leave 8010698f: c3 ret end_op(); 80106990: e8 2b d9 ff ff call 801042c0 return -1; 80106995: b8 ff ff ff ff mov $0xffffffff,%eax } 8010699a: c9 leave 8010699b: c3 ret 8010699c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801069a0 : int sys_mknod(void) { 801069a0: 55 push %ebp 801069a1: 89 e5 mov %esp,%ebp 801069a3: 83 ec 18 sub $0x18,%esp struct inode *ip; char *path; int major, minor; begin_op(); 801069a6: e8 a5 d8 ff ff call 80104250 if ((argstr(0, &path)) < 0 || 801069ab: 83 ec 08 sub $0x8,%esp 801069ae: 8d 45 ec lea -0x14(%ebp),%eax 801069b1: 50 push %eax 801069b2: 6a 00 push $0x0 801069b4: e8 07 f6 ff ff call 80105fc0 801069b9: 83 c4 10 add $0x10,%esp 801069bc: 85 c0 test %eax,%eax 801069be: 78 60 js 80106a20 argint(1, &major) < 0 || 801069c0: 83 ec 08 sub $0x8,%esp 801069c3: 8d 45 f0 lea -0x10(%ebp),%eax 801069c6: 50 push %eax 801069c7: 6a 01 push $0x1 801069c9: e8 32 f5 ff ff call 80105f00 if ((argstr(0, &path)) < 0 || 801069ce: 83 c4 10 add $0x10,%esp 801069d1: 85 c0 test %eax,%eax 801069d3: 78 4b js 80106a20 argint(2, &minor) < 0 || 801069d5: 83 ec 08 sub $0x8,%esp 801069d8: 8d 45 f4 lea -0xc(%ebp),%eax 801069db: 50 push %eax 801069dc: 6a 02 push $0x2 801069de: e8 1d f5 ff ff call 80105f00 argint(1, &major) < 0 || 801069e3: 83 c4 10 add $0x10,%esp 801069e6: 85 c0 test %eax,%eax 801069e8: 78 36 js 80106a20 (ip = create(path, T_DEV, major, minor)) == 0) { 801069ea: 0f bf 45 f4 movswl -0xc(%ebp),%eax 801069ee: 83 ec 0c sub $0xc,%esp 801069f1: 0f bf 4d f0 movswl -0x10(%ebp),%ecx 801069f5: ba 03 00 00 00 mov $0x3,%edx 801069fa: 50 push %eax 801069fb: 8b 45 ec mov -0x14(%ebp),%eax 801069fe: e8 ad f6 ff ff call 801060b0 argint(2, &minor) < 0 || 80106a03: 83 c4 10 add $0x10,%esp 80106a06: 85 c0 test %eax,%eax 80106a08: 74 16 je 80106a20 end_op(); return -1; } iunlockput(ip); 80106a0a: 83 ec 0c sub $0xc,%esp 80106a0d: 50 push %eax 80106a0e: e8 ed c4 ff ff call 80102f00 end_op(); 80106a13: e8 a8 d8 ff ff call 801042c0 return 0; 80106a18: 83 c4 10 add $0x10,%esp 80106a1b: 31 c0 xor %eax,%eax } 80106a1d: c9 leave 80106a1e: c3 ret 80106a1f: 90 nop end_op(); 80106a20: e8 9b d8 ff ff call 801042c0 return -1; 80106a25: b8 ff ff ff ff mov $0xffffffff,%eax } 80106a2a: c9 leave 80106a2b: c3 ret 80106a2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106a30 : int sys_chdir(void) { 80106a30: 55 push %ebp 80106a31: 89 e5 mov %esp,%ebp 80106a33: 56 push %esi 80106a34: 53 push %ebx 80106a35: 83 ec 10 sub $0x10,%esp char *path; struct inode *ip; struct proc *curproc = myproc(); 80106a38: e8 73 e4 ff ff call 80104eb0 80106a3d: 89 c6 mov %eax,%esi begin_op(); 80106a3f: e8 0c d8 ff ff call 80104250 if (argstr(0, &path) < 0 || (ip = namei(path)) == 0) { 80106a44: 83 ec 08 sub $0x8,%esp 80106a47: 8d 45 f4 lea -0xc(%ebp),%eax 80106a4a: 50 push %eax 80106a4b: 6a 00 push $0x0 80106a4d: e8 6e f5 ff ff call 80105fc0 80106a52: 83 c4 10 add $0x10,%esp 80106a55: 85 c0 test %eax,%eax 80106a57: 78 77 js 80106ad0 80106a59: 83 ec 0c sub $0xc,%esp 80106a5c: ff 75 f4 push -0xc(%ebp) 80106a5f: e8 2c cb ff ff call 80103590 80106a64: 83 c4 10 add $0x10,%esp 80106a67: 89 c3 mov %eax,%ebx 80106a69: 85 c0 test %eax,%eax 80106a6b: 74 63 je 80106ad0 end_op(); return -1; } ilock(ip); 80106a6d: 83 ec 0c sub $0xc,%esp 80106a70: 50 push %eax 80106a71: e8 fa c1 ff ff call 80102c70 if (ip->type != T_DIR) { 80106a76: 83 c4 10 add $0x10,%esp 80106a79: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80106a7e: 75 30 jne 80106ab0 iunlockput(ip); end_op(); return -1; } iunlock(ip); 80106a80: 83 ec 0c sub $0xc,%esp 80106a83: 53 push %ebx 80106a84: e8 c7 c2 ff ff call 80102d50 iput(curproc->cwd); 80106a89: 58 pop %eax 80106a8a: ff 76 68 push 0x68(%esi) 80106a8d: e8 0e c3 ff ff call 80102da0 end_op(); 80106a92: e8 29 d8 ff ff call 801042c0 curproc->cwd = ip; 80106a97: 89 5e 68 mov %ebx,0x68(%esi) return 0; 80106a9a: 83 c4 10 add $0x10,%esp 80106a9d: 31 c0 xor %eax,%eax } 80106a9f: 8d 65 f8 lea -0x8(%ebp),%esp 80106aa2: 5b pop %ebx 80106aa3: 5e pop %esi 80106aa4: 5d pop %ebp 80106aa5: c3 ret 80106aa6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106aad: 8d 76 00 lea 0x0(%esi),%esi iunlockput(ip); 80106ab0: 83 ec 0c sub $0xc,%esp 80106ab3: 53 push %ebx 80106ab4: e8 47 c4 ff ff call 80102f00 end_op(); 80106ab9: e8 02 d8 ff ff call 801042c0 return -1; 80106abe: 83 c4 10 add $0x10,%esp 80106ac1: b8 ff ff ff ff mov $0xffffffff,%eax 80106ac6: eb d7 jmp 80106a9f 80106ac8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106acf: 90 nop end_op(); 80106ad0: e8 eb d7 ff ff call 801042c0 return -1; 80106ad5: b8 ff ff ff ff mov $0xffffffff,%eax 80106ada: eb c3 jmp 80106a9f 80106adc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106ae0 : int sys_exec(void) { 80106ae0: 55 push %ebp 80106ae1: 89 e5 mov %esp,%ebp 80106ae3: 57 push %edi 80106ae4: 56 push %esi char *path, *argv[MAXARG]; int i; uint uargv, uarg; if (argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0) { 80106ae5: 8d 85 5c ff ff ff lea -0xa4(%ebp),%eax int sys_exec(void) { 80106aeb: 53 push %ebx 80106aec: 81 ec a4 00 00 00 sub $0xa4,%esp if (argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0) { 80106af2: 50 push %eax 80106af3: 6a 00 push $0x0 80106af5: e8 c6 f4 ff ff call 80105fc0 80106afa: 83 c4 10 add $0x10,%esp 80106afd: 85 c0 test %eax,%eax 80106aff: 0f 88 87 00 00 00 js 80106b8c 80106b05: 83 ec 08 sub $0x8,%esp 80106b08: 8d 85 60 ff ff ff lea -0xa0(%ebp),%eax 80106b0e: 50 push %eax 80106b0f: 6a 01 push $0x1 80106b11: e8 ea f3 ff ff call 80105f00 80106b16: 83 c4 10 add $0x10,%esp 80106b19: 85 c0 test %eax,%eax 80106b1b: 78 6f js 80106b8c return -1; } memset(argv, 0, sizeof(argv)); 80106b1d: 83 ec 04 sub $0x4,%esp 80106b20: 8d b5 68 ff ff ff lea -0x98(%ebp),%esi for (i = 0;; i++) { 80106b26: 31 db xor %ebx,%ebx memset(argv, 0, sizeof(argv)); 80106b28: 68 80 00 00 00 push $0x80 80106b2d: 6a 00 push $0x0 80106b2f: 56 push %esi 80106b30: e8 0b f1 ff ff call 80105c40 80106b35: 83 c4 10 add $0x10,%esp 80106b38: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106b3f: 90 nop if (i >= NELEM(argv)) { return -1; } if (fetchint(uargv + 4 * i, (int*)&uarg) < 0) { 80106b40: 83 ec 08 sub $0x8,%esp 80106b43: 8d 85 64 ff ff ff lea -0x9c(%ebp),%eax 80106b49: 8d 3c 9d 00 00 00 00 lea 0x0(,%ebx,4),%edi 80106b50: 50 push %eax 80106b51: 8b 85 60 ff ff ff mov -0xa0(%ebp),%eax 80106b57: 01 f8 add %edi,%eax 80106b59: 50 push %eax 80106b5a: e8 11 f3 ff ff call 80105e70 80106b5f: 83 c4 10 add $0x10,%esp 80106b62: 85 c0 test %eax,%eax 80106b64: 78 26 js 80106b8c return -1; } if (uarg == 0) { 80106b66: 8b 85 64 ff ff ff mov -0x9c(%ebp),%eax 80106b6c: 85 c0 test %eax,%eax 80106b6e: 74 30 je 80106ba0 argv[i] = 0; break; } if (fetchstr(uarg, &argv[i]) < 0) { 80106b70: 83 ec 08 sub $0x8,%esp 80106b73: 8d 14 3e lea (%esi,%edi,1),%edx 80106b76: 52 push %edx 80106b77: 50 push %eax 80106b78: e8 33 f3 ff ff call 80105eb0 80106b7d: 83 c4 10 add $0x10,%esp 80106b80: 85 c0 test %eax,%eax 80106b82: 78 08 js 80106b8c for (i = 0;; i++) { 80106b84: 83 c3 01 add $0x1,%ebx if (i >= NELEM(argv)) { 80106b87: 83 fb 20 cmp $0x20,%ebx 80106b8a: 75 b4 jne 80106b40 return -1; } } return exec(path, argv); } 80106b8c: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 80106b8f: b8 ff ff ff ff mov $0xffffffff,%eax } 80106b94: 5b pop %ebx 80106b95: 5e pop %esi 80106b96: 5f pop %edi 80106b97: 5d pop %ebp 80106b98: c3 ret 80106b99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi argv[i] = 0; 80106ba0: c7 84 9d 68 ff ff ff movl $0x0,-0x98(%ebp,%ebx,4) 80106ba7: 00 00 00 00 return exec(path, argv); 80106bab: 83 ec 08 sub $0x8,%esp 80106bae: 56 push %esi 80106baf: ff b5 5c ff ff ff push -0xa4(%ebp) 80106bb5: e8 66 b3 ff ff call 80101f20 80106bba: 83 c4 10 add $0x10,%esp } 80106bbd: 8d 65 f4 lea -0xc(%ebp),%esp 80106bc0: 5b pop %ebx 80106bc1: 5e pop %esi 80106bc2: 5f pop %edi 80106bc3: 5d pop %ebp 80106bc4: c3 ret 80106bc5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106bcc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106bd0 : int sys_pipe(void) { 80106bd0: 55 push %ebp 80106bd1: 89 e5 mov %esp,%ebp 80106bd3: 57 push %edi 80106bd4: 56 push %esi int *fd; struct file *rf, *wf; int fd0, fd1; if (argptr(0, (void*)&fd, 2 * sizeof(fd[0])) < 0) { 80106bd5: 8d 45 dc lea -0x24(%ebp),%eax int sys_pipe(void) { 80106bd8: 53 push %ebx 80106bd9: 83 ec 20 sub $0x20,%esp if (argptr(0, (void*)&fd, 2 * sizeof(fd[0])) < 0) { 80106bdc: 6a 08 push $0x8 80106bde: 50 push %eax 80106bdf: 6a 00 push $0x0 80106be1: e8 6a f3 ff ff call 80105f50 80106be6: 83 c4 10 add $0x10,%esp 80106be9: 85 c0 test %eax,%eax 80106beb: 78 4a js 80106c37 return -1; } if (pipealloc(&rf, &wf) < 0) { 80106bed: 83 ec 08 sub $0x8,%esp 80106bf0: 8d 45 e4 lea -0x1c(%ebp),%eax 80106bf3: 50 push %eax 80106bf4: 8d 45 e0 lea -0x20(%ebp),%eax 80106bf7: 50 push %eax 80106bf8: e8 73 dd ff ff call 80104970 80106bfd: 83 c4 10 add $0x10,%esp 80106c00: 85 c0 test %eax,%eax 80106c02: 78 33 js 80106c37 return -1; } fd0 = -1; if ((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0) { 80106c04: 8b 7d e0 mov -0x20(%ebp),%edi for (fd = 0; fd < NOFILE; fd++) { 80106c07: 31 db xor %ebx,%ebx struct proc *curproc = myproc(); 80106c09: e8 a2 e2 ff ff call 80104eb0 for (fd = 0; fd < NOFILE; fd++) { 80106c0e: 66 90 xchg %ax,%ax if (curproc->ofile[fd] == 0) { 80106c10: 8b 74 98 28 mov 0x28(%eax,%ebx,4),%esi 80106c14: 85 f6 test %esi,%esi 80106c16: 74 28 je 80106c40 for (fd = 0; fd < NOFILE; fd++) { 80106c18: 83 c3 01 add $0x1,%ebx 80106c1b: 83 fb 10 cmp $0x10,%ebx 80106c1e: 75 f0 jne 80106c10 if (fd0 >= 0) { myproc()->ofile[fd0] = 0; } fileclose(rf); 80106c20: 83 ec 0c sub $0xc,%esp 80106c23: ff 75 e0 push -0x20(%ebp) 80106c26: e8 b5 b7 ff ff call 801023e0 fileclose(wf); 80106c2b: 58 pop %eax 80106c2c: ff 75 e4 push -0x1c(%ebp) 80106c2f: e8 ac b7 ff ff call 801023e0 return -1; 80106c34: 83 c4 10 add $0x10,%esp 80106c37: b8 ff ff ff ff mov $0xffffffff,%eax 80106c3c: eb 53 jmp 80106c91 80106c3e: 66 90 xchg %ax,%ax curproc->ofile[fd] = f; 80106c40: 8d 73 08 lea 0x8(%ebx),%esi 80106c43: 89 7c b0 08 mov %edi,0x8(%eax,%esi,4) if ((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0) { 80106c47: 8b 7d e4 mov -0x1c(%ebp),%edi struct proc *curproc = myproc(); 80106c4a: e8 61 e2 ff ff call 80104eb0 for (fd = 0; fd < NOFILE; fd++) { 80106c4f: 31 d2 xor %edx,%edx 80106c51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (curproc->ofile[fd] == 0) { 80106c58: 8b 4c 90 28 mov 0x28(%eax,%edx,4),%ecx 80106c5c: 85 c9 test %ecx,%ecx 80106c5e: 74 20 je 80106c80 for (fd = 0; fd < NOFILE; fd++) { 80106c60: 83 c2 01 add $0x1,%edx 80106c63: 83 fa 10 cmp $0x10,%edx 80106c66: 75 f0 jne 80106c58 myproc()->ofile[fd0] = 0; 80106c68: e8 43 e2 ff ff call 80104eb0 80106c6d: c7 44 b0 08 00 00 00 movl $0x0,0x8(%eax,%esi,4) 80106c74: 00 80106c75: eb a9 jmp 80106c20 80106c77: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106c7e: 66 90 xchg %ax,%ax curproc->ofile[fd] = f; 80106c80: 89 7c 90 28 mov %edi,0x28(%eax,%edx,4) } fd[0] = fd0; 80106c84: 8b 45 dc mov -0x24(%ebp),%eax 80106c87: 89 18 mov %ebx,(%eax) fd[1] = fd1; 80106c89: 8b 45 dc mov -0x24(%ebp),%eax 80106c8c: 89 50 04 mov %edx,0x4(%eax) return 0; 80106c8f: 31 c0 xor %eax,%eax } 80106c91: 8d 65 f4 lea -0xc(%ebp),%esp 80106c94: 5b pop %ebx 80106c95: 5e pop %esi 80106c96: 5f pop %edi 80106c97: 5d pop %ebp 80106c98: c3 ret 80106c99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106ca0 : int sys_getch(void) { return consoleget(); 80106ca0: e9 0b a3 ff ff jmp 80100fb0 80106ca5: 66 90 xchg %ax,%ax 80106ca7: 66 90 xchg %ax,%ax 80106ca9: 66 90 xchg %ax,%ax 80106cab: 66 90 xchg %ax,%ax 80106cad: 66 90 xchg %ax,%ax 80106caf: 90 nop 80106cb0 : #include "mmu.h" #include "proc.h" int sys_fork(void) { return fork(); 80106cb0: e9 bb e3 ff ff jmp 80105070 80106cb5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106cbc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106cc0 : } int sys_exit(void) { 80106cc0: 55 push %ebp 80106cc1: 89 e5 mov %esp,%ebp 80106cc3: 83 ec 08 sub $0x8,%esp exit(); 80106cc6: e8 25 e6 ff ff call 801052f0 return 0; // not reached } 80106ccb: 31 c0 xor %eax,%eax 80106ccd: c9 leave 80106cce: c3 ret 80106ccf: 90 nop 80106cd0 : int sys_wait(void) { return wait(); 80106cd0: e9 7b e7 ff ff jmp 80105450 80106cd5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106cdc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106ce0 : } int sys_kill(void) { 80106ce0: 55 push %ebp 80106ce1: 89 e5 mov %esp,%ebp 80106ce3: 83 ec 20 sub $0x20,%esp int pid; if (argint(0, &pid) < 0) 80106ce6: 8d 45 f4 lea -0xc(%ebp),%eax 80106ce9: 50 push %eax 80106cea: 6a 00 push $0x0 80106cec: e8 0f f2 ff ff call 80105f00 80106cf1: 83 c4 10 add $0x10,%esp 80106cf4: 85 c0 test %eax,%eax 80106cf6: 78 18 js 80106d10 { return -1; } return kill(pid); 80106cf8: 83 ec 0c sub $0xc,%esp 80106cfb: ff 75 f4 push -0xc(%ebp) 80106cfe: e8 fd e9 ff ff call 80105700 80106d03: 83 c4 10 add $0x10,%esp } 80106d06: c9 leave 80106d07: c3 ret 80106d08: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106d0f: 90 nop 80106d10: c9 leave return -1; 80106d11: b8 ff ff ff ff mov $0xffffffff,%eax } 80106d16: c3 ret 80106d17: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106d1e: 66 90 xchg %ax,%ax 80106d20 : int sys_getpid(void) { 80106d20: 55 push %ebp 80106d21: 89 e5 mov %esp,%ebp 80106d23: 83 ec 08 sub $0x8,%esp return myproc()->pid; 80106d26: e8 85 e1 ff ff call 80104eb0 80106d2b: 8b 40 10 mov 0x10(%eax),%eax } 80106d2e: c9 leave 80106d2f: c3 ret 80106d30 : int sys_sbrk(void) { 80106d30: 55 push %ebp 80106d31: 89 e5 mov %esp,%ebp 80106d33: 53 push %ebx int addr; int n; if (argint(0, &n) < 0) 80106d34: 8d 45 f4 lea -0xc(%ebp),%eax { 80106d37: 83 ec 1c sub $0x1c,%esp if (argint(0, &n) < 0) 80106d3a: 50 push %eax 80106d3b: 6a 00 push $0x0 80106d3d: e8 be f1 ff ff call 80105f00 80106d42: 83 c4 10 add $0x10,%esp 80106d45: 85 c0 test %eax,%eax 80106d47: 78 27 js 80106d70 { return -1; } addr = myproc()->sz; 80106d49: e8 62 e1 ff ff call 80104eb0 if (growproc(n) < 0) 80106d4e: 83 ec 0c sub $0xc,%esp addr = myproc()->sz; 80106d51: 8b 18 mov (%eax),%ebx if (growproc(n) < 0) 80106d53: ff 75 f4 push -0xc(%ebp) 80106d56: e8 95 e2 ff ff call 80104ff0 80106d5b: 83 c4 10 add $0x10,%esp 80106d5e: 85 c0 test %eax,%eax 80106d60: 78 0e js 80106d70 { return -1; } return addr; } 80106d62: 89 d8 mov %ebx,%eax 80106d64: 8b 5d fc mov -0x4(%ebp),%ebx 80106d67: c9 leave 80106d68: c3 ret 80106d69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return -1; 80106d70: bb ff ff ff ff mov $0xffffffff,%ebx 80106d75: eb eb jmp 80106d62 80106d77: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106d7e: 66 90 xchg %ax,%ax 80106d80 : int sys_sleep(void) { 80106d80: 55 push %ebp 80106d81: 89 e5 mov %esp,%ebp 80106d83: 53 push %ebx int n; uint ticks0; if (argint(0, &n) < 0) 80106d84: 8d 45 f4 lea -0xc(%ebp),%eax { 80106d87: 83 ec 1c sub $0x1c,%esp if (argint(0, &n) < 0) 80106d8a: 50 push %eax 80106d8b: 6a 00 push $0x0 80106d8d: e8 6e f1 ff ff call 80105f00 80106d92: 83 c4 10 add $0x10,%esp 80106d95: 85 c0 test %eax,%eax 80106d97: 0f 88 8a 00 00 00 js 80106e27 { return -1; } acquire(&tickslock); 80106d9d: 83 ec 0c sub $0xc,%esp 80106da0: 68 00 0a 12 80 push $0x80120a00 80106da5: e8 d6 ed ff ff call 80105b80 ticks0 = ticks; while (ticks - ticks0 < n) 80106daa: 8b 55 f4 mov -0xc(%ebp),%edx ticks0 = ticks; 80106dad: 8b 1d e0 09 12 80 mov 0x801209e0,%ebx while (ticks - ticks0 < n) 80106db3: 83 c4 10 add $0x10,%esp 80106db6: 85 d2 test %edx,%edx 80106db8: 75 27 jne 80106de1 80106dba: eb 54 jmp 80106e10 80106dbc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (myproc()->killed) { release(&tickslock); return -1; } sleep(&ticks, &tickslock); 80106dc0: 83 ec 08 sub $0x8,%esp 80106dc3: 68 00 0a 12 80 push $0x80120a00 80106dc8: 68 e0 09 12 80 push $0x801209e0 80106dcd: e8 0e e8 ff ff call 801055e0 while (ticks - ticks0 < n) 80106dd2: a1 e0 09 12 80 mov 0x801209e0,%eax 80106dd7: 83 c4 10 add $0x10,%esp 80106dda: 29 d8 sub %ebx,%eax 80106ddc: 3b 45 f4 cmp -0xc(%ebp),%eax 80106ddf: 73 2f jae 80106e10 if (myproc()->killed) 80106de1: e8 ca e0 ff ff call 80104eb0 80106de6: 8b 40 24 mov 0x24(%eax),%eax 80106de9: 85 c0 test %eax,%eax 80106deb: 74 d3 je 80106dc0 release(&tickslock); 80106ded: 83 ec 0c sub $0xc,%esp 80106df0: 68 00 0a 12 80 push $0x80120a00 80106df5: e8 26 ed ff ff call 80105b20 } release(&tickslock); return 0; } 80106dfa: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80106dfd: 83 c4 10 add $0x10,%esp 80106e00: b8 ff ff ff ff mov $0xffffffff,%eax } 80106e05: c9 leave 80106e06: c3 ret 80106e07: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106e0e: 66 90 xchg %ax,%ax release(&tickslock); 80106e10: 83 ec 0c sub $0xc,%esp 80106e13: 68 00 0a 12 80 push $0x80120a00 80106e18: e8 03 ed ff ff call 80105b20 return 0; 80106e1d: 83 c4 10 add $0x10,%esp 80106e20: 31 c0 xor %eax,%eax } 80106e22: 8b 5d fc mov -0x4(%ebp),%ebx 80106e25: c9 leave 80106e26: c3 ret return -1; 80106e27: b8 ff ff ff ff mov $0xffffffff,%eax 80106e2c: eb f4 jmp 80106e22 80106e2e: 66 90 xchg %ax,%ax 80106e30 : // return how many clock tick interrupts have occurred // since start. int sys_uptime(void) { 80106e30: 55 push %ebp 80106e31: 89 e5 mov %esp,%ebp 80106e33: 53 push %ebx 80106e34: 83 ec 10 sub $0x10,%esp uint xticks; acquire(&tickslock); 80106e37: 68 00 0a 12 80 push $0x80120a00 80106e3c: e8 3f ed ff ff call 80105b80 xticks = ticks; 80106e41: 8b 1d e0 09 12 80 mov 0x801209e0,%ebx release(&tickslock); 80106e47: c7 04 24 00 0a 12 80 movl $0x80120a00,(%esp) 80106e4e: e8 cd ec ff ff call 80105b20 return xticks; } 80106e53: 89 d8 mov %ebx,%eax 80106e55: 8b 5d fc mov -0x4(%ebp),%ebx 80106e58: c9 leave 80106e59: c3 ret 80106e5a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106e60 : // System call i used to debug and test the consoles, it returns useful information in relation to the current console/process int sys_greeting(void) { 80106e60: 55 push %ebp 80106e61: 89 e5 mov %esp,%ebp 80106e63: 83 ec 14 sub $0x14,%esp cprintf("Hello! here is the info you requested...\n"); 80106e66: 68 30 92 10 80 push $0x80109230 80106e6b: e8 20 9a ff ff call 80100890 cprintf("Using Console: %d\n", getcurrentconsoleindex()); 80106e70: e8 6b af ff ff call 80101de0 80106e75: 5a pop %edx 80106e76: 59 pop %ecx 80106e77: 50 push %eax 80106e78: 68 84 92 10 80 push $0x80109284 80106e7d: e8 0e 9a ff ff call 80100890 cprintf("Current PID: %d\n", myproc()->pid); 80106e82: e8 29 e0 ff ff call 80104eb0 80106e87: 5a pop %edx 80106e88: 59 pop %ecx 80106e89: ff 70 10 push 0x10(%eax) 80106e8c: 68 97 92 10 80 push $0x80109297 80106e91: e8 fa 99 ff ff call 80100890 cprintf("Current Parent PID: %d\n", myproc()->parent->pid); 80106e96: e8 15 e0 ff ff call 80104eb0 80106e9b: 5a pop %edx 80106e9c: 59 pop %ecx 80106e9d: 8b 40 14 mov 0x14(%eax),%eax 80106ea0: ff 70 10 push 0x10(%eax) 80106ea3: 68 a8 92 10 80 push $0x801092a8 80106ea8: e8 e3 99 ff ff call 80100890 cprintf("Process Console: %d\n", getconsoleindex(myproc()->consoleptr)); 80106ead: e8 fe df ff ff call 80104eb0 80106eb2: 5a pop %edx 80106eb3: ff 70 7c push 0x7c(%eax) 80106eb6: e8 b5 95 ff ff call 80100470 80106ebb: 59 pop %ecx 80106ebc: 5a pop %edx 80106ebd: 50 push %eax 80106ebe: 68 c0 92 10 80 push $0x801092c0 80106ec3: e8 c8 99 ff ff call 80100890 return 0; } 80106ec8: 31 c0 xor %eax,%eax 80106eca: c9 leave 80106ecb: c3 ret 80106ecc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106ed0 : // System call to shutdown or restart the OS int sys_shutdown(void) { 80106ed0: 55 push %ebp 80106ed1: 89 e5 mov %esp,%ebp 80106ed3: 83 ec 20 sub $0x20,%esp int restart; if (argint(0, &restart) < 0) 80106ed6: 8d 45 f4 lea -0xc(%ebp),%eax 80106ed9: 50 push %eax 80106eda: 6a 00 push $0x0 80106edc: e8 1f f0 ff ff call 80105f00 80106ee1: 83 c4 10 add $0x10,%esp 80106ee4: 85 c0 test %eax,%eax 80106ee6: 78 2f js 80106f17 { return -1; } if (restart == 1) 80106ee8: 83 7d f4 01 cmpl $0x1,-0xc(%ebp) 80106eec: 74 12 je 80106f00 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80106eee: b8 00 20 00 00 mov $0x2000,%eax 80106ef3: ba 04 06 00 00 mov $0x604,%edx 80106ef8: 66 ef out %ax,(%dx) else { outw(0x604, 0x2000); } return 0; } 80106efa: c9 leave return 0; 80106efb: 31 c0 xor %eax,%eax } 80106efd: c3 ret 80106efe: 66 90 xchg %ax,%ax asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80106f00: ba 64 00 00 00 mov $0x64,%edx 80106f05: 8d 76 00 lea 0x0(%esi),%esi 80106f08: ec in (%dx),%al while (good & 0x02) { 80106f09: a8 02 test $0x2,%al 80106f0b: 75 fb jne 80106f08 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80106f0d: b8 fe ff ff ff mov $0xfffffffe,%eax 80106f12: ee out %al,(%dx) } 80106f13: c9 leave return 0; 80106f14: 31 c0 xor %eax,%eax } 80106f16: c3 ret 80106f17: c9 leave return -1; 80106f18: b8 ff ff ff ff mov $0xffffffff,%eax } 80106f1d: c3 ret 80106f1e: 66 90 xchg %ax,%ax 80106f20 : // System call for handling the new screen user app int sys_screen(void) { 80106f20: 55 push %ebp 80106f21: 89 e5 mov %esp,%ebp 80106f23: 53 push %ebx 80106f24: 83 ec 14 sub $0x14,%esp struct proc *curproc = myproc(); 80106f27: e8 84 df ff ff call 80104eb0 struct vconsole* consoleptr = 0; int bgcol; char *title; // Get the background color value if (argint(1, &bgcol) < 0) 80106f2c: 83 ec 08 sub $0x8,%esp struct proc *curproc = myproc(); 80106f2f: 89 c3 mov %eax,%ebx if (argint(1, &bgcol) < 0) 80106f31: 8d 45 f0 lea -0x10(%ebp),%eax 80106f34: 50 push %eax 80106f35: 6a 01 push $0x1 80106f37: e8 c4 ef ff ff call 80105f00 80106f3c: 83 c4 10 add $0x10,%esp 80106f3f: 85 c0 test %eax,%eax 80106f41: 78 4d js 80106f90 { return -1; } // Get the title arg value if (argstr(0, &title) < 0) 80106f43: 83 ec 08 sub $0x8,%esp 80106f46: 8d 45 f4 lea -0xc(%ebp),%eax 80106f49: 50 push %eax 80106f4a: 6a 00 push $0x0 80106f4c: e8 6f f0 ff ff call 80105fc0 80106f51: 83 c4 10 add $0x10,%esp 80106f54: 85 c0 test %eax,%eax 80106f56: 78 38 js 80106f90 { return -1; } // Try to setup an unused console from the pool if ((consoleptr = newconsole(title, bgcol)) != 0) 80106f58: 83 ec 08 sub $0x8,%esp 80106f5b: ff 75 f0 push -0x10(%ebp) 80106f5e: ff 75 f4 push -0xc(%ebp) 80106f61: e8 8a a3 ff ff call 801012f0 80106f66: 83 c4 10 add $0x10,%esp 80106f69: 85 c0 test %eax,%eax 80106f6b: 74 33 je 80106fa0 { // New console was successful, set the pointer and switch to it curproc->consoleptr = consoleptr; switchtoconsole(consoleptr); 80106f6d: 83 ec 0c sub $0xc,%esp curproc->consoleptr = consoleptr; 80106f70: 89 43 7c mov %eax,0x7c(%ebx) switchtoconsole(consoleptr); 80106f73: 50 push %eax 80106f74: e8 67 a4 ff ff call 801013e0 else { cprintf("screen: failed to create a new console\n"); } return result; } 80106f79: 8b 5d fc mov -0x4(%ebp),%ebx 80106f7c: 83 c4 10 add $0x10,%esp result = 1; 80106f7f: b8 01 00 00 00 mov $0x1,%eax } 80106f84: c9 leave 80106f85: c3 ret 80106f86: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106f8d: 8d 76 00 lea 0x0(%esi),%esi 80106f90: 8b 5d fc mov -0x4(%ebp),%ebx return -1; 80106f93: b8 ff ff ff ff mov $0xffffffff,%eax } 80106f98: c9 leave 80106f99: c3 ret 80106f9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cprintf("screen: failed to create a new console\n"); 80106fa0: 83 ec 0c sub $0xc,%esp 80106fa3: 68 5c 92 10 80 push $0x8010925c 80106fa8: e8 e3 98 ff ff call 80100890 } 80106fad: 8b 5d fc mov -0x4(%ebp),%ebx cprintf("screen: failed to create a new console\n"); 80106fb0: 83 c4 10 add $0x10,%esp int result = 0; 80106fb3: 31 c0 xor %eax,%eax } 80106fb5: c9 leave 80106fb6: c3 ret 80106fb7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106fbe: 66 90 xchg %ax,%ax 80106fc0 : // System call to clear the screen int sys_cls(void) { 80106fc0: 55 push %ebp 80106fc1: 89 e5 mov %esp,%ebp 80106fc3: 83 ec 14 sub $0x14,%esp clearscreen(0); 80106fc6: 6a 00 push $0x0 80106fc8: e8 f3 a0 ff ff call 801010c0 return 0; 80106fcd: 31 c0 xor %eax,%eax 80106fcf: c9 leave 80106fd0: c3 ret 80106fd1 : # vectors.S sends all traps here. .globl alltraps alltraps: # Build trap frame. pushl %ds 80106fd1: 1e push %ds pushl %es 80106fd2: 06 push %es pushl %fs 80106fd3: 0f a0 push %fs pushl %gs 80106fd5: 0f a8 push %gs pushal 80106fd7: 60 pusha # Set up data segments. movw $(SEG_KDATA<<3), %ax 80106fd8: 66 b8 10 00 mov $0x10,%ax movw %ax, %ds 80106fdc: 8e d8 mov %eax,%ds movw %ax, %es 80106fde: 8e c0 mov %eax,%es # Call trap(tf), where tf=%esp pushl %esp 80106fe0: 54 push %esp call trap 80106fe1: e8 ca 00 00 00 call 801070b0 addl $4, %esp 80106fe6: 83 c4 04 add $0x4,%esp 80106fe9 : # Return falls through to trapret... .globl trapret trapret: popal 80106fe9: 61 popa popl %gs 80106fea: 0f a9 pop %gs popl %fs 80106fec: 0f a1 pop %fs popl %es 80106fee: 07 pop %es popl %ds 80106fef: 1f pop %ds addl $0x8, %esp # trapno and errcode 80106ff0: 83 c4 08 add $0x8,%esp iret 80106ff3: cf iret 80106ff4: 66 90 xchg %ax,%ax 80106ff6: 66 90 xchg %ax,%ax 80106ff8: 66 90 xchg %ax,%ax 80106ffa: 66 90 xchg %ax,%ax 80106ffc: 66 90 xchg %ax,%ax 80106ffe: 66 90 xchg %ax,%ax 80107000 : struct gatedesc idt[256]; extern uint vectors[]; // in vectors.S: array of 256 entry pointers struct spinlock tickslock; uint ticks; void tvinit(void) { 80107000: 55 push %ebp int i; for (i = 0; i < 256; i++) { 80107001: 31 c0 xor %eax,%eax void tvinit(void) { 80107003: 89 e5 mov %esp,%ebp 80107005: 83 ec 08 sub $0x8,%esp 80107008: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010700f: 90 nop SETGATE(idt[i], 0, SEG_KCODE << 3, vectors[i], 0); 80107010: 8b 14 85 08 c0 10 80 mov -0x7fef3ff8(,%eax,4),%edx 80107017: c7 04 c5 42 0a 12 80 movl $0x8e000008,-0x7fedf5be(,%eax,8) 8010701e: 08 00 00 8e 80107022: 66 89 14 c5 40 0a 12 mov %dx,-0x7fedf5c0(,%eax,8) 80107029: 80 8010702a: c1 ea 10 shr $0x10,%edx 8010702d: 66 89 14 c5 46 0a 12 mov %dx,-0x7fedf5ba(,%eax,8) 80107034: 80 for (i = 0; i < 256; i++) { 80107035: 83 c0 01 add $0x1,%eax 80107038: 3d 00 01 00 00 cmp $0x100,%eax 8010703d: 75 d1 jne 80107010 } SETGATE(idt[T_SYSCALL], 1, SEG_KCODE << 3, vectors[T_SYSCALL], DPL_USER); initlock(&tickslock, "time"); 8010703f: 83 ec 08 sub $0x8,%esp SETGATE(idt[T_SYSCALL], 1, SEG_KCODE << 3, vectors[T_SYSCALL], DPL_USER); 80107042: a1 08 c1 10 80 mov 0x8010c108,%eax 80107047: c7 05 42 0c 12 80 08 movl $0xef000008,0x80120c42 8010704e: 00 00 ef initlock(&tickslock, "time"); 80107051: 68 d5 92 10 80 push $0x801092d5 80107056: 68 00 0a 12 80 push $0x80120a00 SETGATE(idt[T_SYSCALL], 1, SEG_KCODE << 3, vectors[T_SYSCALL], DPL_USER); 8010705b: 66 a3 40 0c 12 80 mov %ax,0x80120c40 80107061: c1 e8 10 shr $0x10,%eax 80107064: 66 a3 46 0c 12 80 mov %ax,0x80120c46 initlock(&tickslock, "time"); 8010706a: e8 41 e9 ff ff call 801059b0 } 8010706f: 83 c4 10 add $0x10,%esp 80107072: c9 leave 80107073: c3 ret 80107074: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010707b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010707f: 90 nop 80107080 : void idtinit(void) { 80107080: 55 push %ebp pd[0] = size - 1; 80107081: b8 ff 07 00 00 mov $0x7ff,%eax 80107086: 89 e5 mov %esp,%ebp 80107088: 83 ec 10 sub $0x10,%esp 8010708b: 66 89 45 fa mov %ax,-0x6(%ebp) pd[1] = (uint)p; 8010708f: b8 40 0a 12 80 mov $0x80120a40,%eax 80107094: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; 80107098: c1 e8 10 shr $0x10,%eax 8010709b: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile ("lidt (%0)" : : "r" (pd)); 8010709f: 8d 45 fa lea -0x6(%ebp),%eax 801070a2: 0f 01 18 lidtl (%eax) lidt(idt, sizeof(idt)); } 801070a5: c9 leave 801070a6: c3 ret 801070a7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801070ae: 66 90 xchg %ax,%ax 801070b0 : void trap(struct trapframe *tf) { 801070b0: 55 push %ebp 801070b1: 89 e5 mov %esp,%ebp 801070b3: 57 push %edi 801070b4: 56 push %esi 801070b5: 53 push %ebx 801070b6: 83 ec 1c sub $0x1c,%esp 801070b9: 8b 5d 08 mov 0x8(%ebp),%ebx if (tf->trapno == T_SYSCALL) { 801070bc: 8b 43 30 mov 0x30(%ebx),%eax 801070bf: 83 f8 40 cmp $0x40,%eax 801070c2: 0f 84 68 01 00 00 je 80107230 exit(); } return; } switch (tf->trapno) { 801070c8: 83 e8 20 sub $0x20,%eax 801070cb: 83 f8 1f cmp $0x1f,%eax 801070ce: 0f 87 8c 00 00 00 ja 80107160 801070d4: ff 24 85 7c 93 10 80 jmp *-0x7fef6c84(,%eax,4) 801070db: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801070df: 90 nop release(&tickslock); } lapiceoi(); break; case T_IRQ0 + IRQ_IDE: ideintr(); 801070e0: e8 4b c6 ff ff call 80103730 lapiceoi(); 801070e5: e8 16 cd ff ff call 80103e00 } // 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) { 801070ea: e8 c1 dd ff ff call 80104eb0 801070ef: 85 c0 test %eax,%eax 801070f1: 74 1d je 80107110 801070f3: e8 b8 dd ff ff call 80104eb0 801070f8: 8b 50 24 mov 0x24(%eax),%edx 801070fb: 85 d2 test %edx,%edx 801070fd: 74 11 je 80107110 801070ff: 0f b7 43 3c movzwl 0x3c(%ebx),%eax 80107103: 83 e0 03 and $0x3,%eax 80107106: 66 83 f8 03 cmp $0x3,%ax 8010710a: 0f 84 e8 01 00 00 je 801072f8 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 && 80107110: e8 9b dd ff ff call 80104eb0 80107115: 85 c0 test %eax,%eax 80107117: 74 0f je 80107128 80107119: e8 92 dd ff ff call 80104eb0 8010711e: 83 78 0c 04 cmpl $0x4,0xc(%eax) 80107122: 0f 84 b8 00 00 00 je 801071e0 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) { 80107128: e8 83 dd ff ff call 80104eb0 8010712d: 85 c0 test %eax,%eax 8010712f: 74 1d je 8010714e 80107131: e8 7a dd ff ff call 80104eb0 80107136: 8b 40 24 mov 0x24(%eax),%eax 80107139: 85 c0 test %eax,%eax 8010713b: 74 11 je 8010714e 8010713d: 0f b7 43 3c movzwl 0x3c(%ebx),%eax 80107141: 83 e0 03 and $0x3,%eax 80107144: 66 83 f8 03 cmp $0x3,%ax 80107148: 0f 84 0f 01 00 00 je 8010725d exit(); } } 8010714e: 8d 65 f4 lea -0xc(%ebp),%esp 80107151: 5b pop %ebx 80107152: 5e pop %esi 80107153: 5f pop %edi 80107154: 5d pop %ebp 80107155: c3 ret 80107156: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010715d: 8d 76 00 lea 0x0(%esi),%esi if (myproc() == 0 || (tf->cs & 3) == 0) { 80107160: e8 4b dd ff ff call 80104eb0 80107165: 8b 7b 38 mov 0x38(%ebx),%edi 80107168: 85 c0 test %eax,%eax 8010716a: 0f 84 a2 01 00 00 je 80107312 80107170: f6 43 3c 03 testb $0x3,0x3c(%ebx) 80107174: 0f 84 98 01 00 00 je 80107312 return result; } static inline uint rcr2(void) { uint val; asm volatile ("movl %%cr2,%0" : "=r" (val)); 8010717a: 0f 20 d1 mov %cr2,%ecx 8010717d: 89 4d d8 mov %ecx,-0x28(%ebp) cprintf("pid %d %s: trap %d err %d on cpu %d " 80107180: e8 0b dd ff ff call 80104e90 80107185: 8b 73 30 mov 0x30(%ebx),%esi 80107188: 89 45 dc mov %eax,-0x24(%ebp) 8010718b: 8b 43 34 mov 0x34(%ebx),%eax 8010718e: 89 45 e4 mov %eax,-0x1c(%ebp) myproc()->pid, myproc()->name, tf->trapno, 80107191: e8 1a dd ff ff call 80104eb0 80107196: 89 45 e0 mov %eax,-0x20(%ebp) 80107199: e8 12 dd ff ff call 80104eb0 cprintf("pid %d %s: trap %d err %d on cpu %d " 8010719e: 8b 4d d8 mov -0x28(%ebp),%ecx 801071a1: 8b 55 dc mov -0x24(%ebp),%edx 801071a4: 51 push %ecx 801071a5: 57 push %edi 801071a6: 52 push %edx 801071a7: ff 75 e4 push -0x1c(%ebp) 801071aa: 56 push %esi myproc()->pid, myproc()->name, tf->trapno, 801071ab: 8b 75 e0 mov -0x20(%ebp),%esi 801071ae: 83 c6 6c add $0x6c,%esi cprintf("pid %d %s: trap %d err %d on cpu %d " 801071b1: 56 push %esi 801071b2: ff 70 10 push 0x10(%eax) 801071b5: 68 38 93 10 80 push $0x80109338 801071ba: e8 d1 96 ff ff call 80100890 myproc()->killed = 1; 801071bf: 83 c4 20 add $0x20,%esp 801071c2: e8 e9 dc ff ff call 80104eb0 801071c7: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) if (myproc() && myproc()->killed && (tf->cs & 3) == DPL_USER) { 801071ce: e8 dd dc ff ff call 80104eb0 801071d3: 85 c0 test %eax,%eax 801071d5: 0f 85 18 ff ff ff jne 801070f3 801071db: e9 30 ff ff ff jmp 80107110 if (myproc() && myproc()->state == RUNNING && 801071e0: 83 7b 30 20 cmpl $0x20,0x30(%ebx) 801071e4: 0f 85 3e ff ff ff jne 80107128 yield(); 801071ea: e8 a1 e3 ff ff call 80105590 801071ef: e9 34 ff ff ff jmp 80107128 801071f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi cprintf("cpu%d: spurious interrupt at %x:%x\n", 801071f8: 8b 7b 38 mov 0x38(%ebx),%edi 801071fb: 0f b7 73 3c movzwl 0x3c(%ebx),%esi 801071ff: e8 8c dc ff ff call 80104e90 80107204: 57 push %edi 80107205: 56 push %esi 80107206: 50 push %eax 80107207: 68 e0 92 10 80 push $0x801092e0 8010720c: e8 7f 96 ff ff call 80100890 lapiceoi(); 80107211: e8 ea cb ff ff call 80103e00 break; 80107216: 83 c4 10 add $0x10,%esp if (myproc() && myproc()->killed && (tf->cs & 3) == DPL_USER) { 80107219: e8 92 dc ff ff call 80104eb0 8010721e: 85 c0 test %eax,%eax 80107220: 0f 85 cd fe ff ff jne 801070f3 80107226: e9 e5 fe ff ff jmp 80107110 8010722b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010722f: 90 nop if (myproc()->killed) { 80107230: e8 7b dc ff ff call 80104eb0 80107235: 8b 70 24 mov 0x24(%eax),%esi 80107238: 85 f6 test %esi,%esi 8010723a: 0f 85 c8 00 00 00 jne 80107308 myproc()->tf = tf; 80107240: e8 6b dc ff ff call 80104eb0 80107245: 89 58 18 mov %ebx,0x18(%eax) syscall(); 80107248: e8 f3 ed ff ff call 80106040 if (myproc()->killed) { 8010724d: e8 5e dc ff ff call 80104eb0 80107252: 8b 48 24 mov 0x24(%eax),%ecx 80107255: 85 c9 test %ecx,%ecx 80107257: 0f 84 f1 fe ff ff je 8010714e } 8010725d: 8d 65 f4 lea -0xc(%ebp),%esp 80107260: 5b pop %ebx 80107261: 5e pop %esi 80107262: 5f pop %edi 80107263: 5d pop %ebp exit(); 80107264: e9 87 e0 ff ff jmp 801052f0 80107269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi uartintr(); 80107270: e8 3b 02 00 00 call 801074b0 lapiceoi(); 80107275: e8 86 cb ff ff call 80103e00 if (myproc() && myproc()->killed && (tf->cs & 3) == DPL_USER) { 8010727a: e8 31 dc ff ff call 80104eb0 8010727f: 85 c0 test %eax,%eax 80107281: 0f 85 6c fe ff ff jne 801070f3 80107287: e9 84 fe ff ff jmp 80107110 8010728c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi kbdintr(); 80107290: e8 2b ca ff ff call 80103cc0 lapiceoi(); 80107295: e8 66 cb ff ff call 80103e00 if (myproc() && myproc()->killed && (tf->cs & 3) == DPL_USER) { 8010729a: e8 11 dc ff ff call 80104eb0 8010729f: 85 c0 test %eax,%eax 801072a1: 0f 85 4c fe ff ff jne 801070f3 801072a7: e9 64 fe ff ff jmp 80107110 801072ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if (cpuid() == 0) { 801072b0: e8 db db ff ff call 80104e90 801072b5: 85 c0 test %eax,%eax 801072b7: 0f 85 28 fe ff ff jne 801070e5 acquire(&tickslock); 801072bd: 83 ec 0c sub $0xc,%esp 801072c0: 68 00 0a 12 80 push $0x80120a00 801072c5: e8 b6 e8 ff ff call 80105b80 wakeup(&ticks); 801072ca: c7 04 24 e0 09 12 80 movl $0x801209e0,(%esp) ticks++; 801072d1: 83 05 e0 09 12 80 01 addl $0x1,0x801209e0 wakeup(&ticks); 801072d8: e8 c3 e3 ff ff call 801056a0 release(&tickslock); 801072dd: c7 04 24 00 0a 12 80 movl $0x80120a00,(%esp) 801072e4: e8 37 e8 ff ff call 80105b20 801072e9: 83 c4 10 add $0x10,%esp lapiceoi(); 801072ec: e9 f4 fd ff ff jmp 801070e5 801072f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi exit(); 801072f8: e8 f3 df ff ff call 801052f0 801072fd: e9 0e fe ff ff jmp 80107110 80107302: 8d b6 00 00 00 00 lea 0x0(%esi),%esi exit(); 80107308: e8 e3 df ff ff call 801052f0 8010730d: e9 2e ff ff ff jmp 80107240 80107312: 0f 20 d6 mov %cr2,%esi cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", 80107315: e8 76 db ff ff call 80104e90 8010731a: 83 ec 0c sub $0xc,%esp 8010731d: 56 push %esi 8010731e: 57 push %edi 8010731f: 50 push %eax 80107320: ff 73 30 push 0x30(%ebx) 80107323: 68 04 93 10 80 push $0x80109304 80107328: e8 63 95 ff ff call 80100890 panic("trap"); 8010732d: 83 c4 14 add $0x14,%esp 80107330: 68 da 92 10 80 push $0x801092da 80107335: e8 46 91 ff ff call 80100480 8010733a: 66 90 xchg %ax,%ax 8010733c: 66 90 xchg %ax,%ax 8010733e: 66 90 xchg %ax,%ax 80107340 : } outb(COM1 + 0, c); } static int uartgetc(void) { if (!uart) { 80107340: a1 40 12 12 80 mov 0x80121240,%eax 80107345: 85 c0 test %eax,%eax 80107347: 74 17 je 80107360 asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 80107349: ba fd 03 00 00 mov $0x3fd,%edx 8010734e: ec in (%dx),%al return -1; } if (!(inb(COM1 + 5) & 0x01)) { 8010734f: a8 01 test $0x1,%al 80107351: 74 0d je 80107360 80107353: ba f8 03 00 00 mov $0x3f8,%edx 80107358: ec in (%dx),%al return -1; } return inb(COM1 + 0); 80107359: 0f b6 c0 movzbl %al,%eax 8010735c: c3 ret 8010735d: 8d 76 00 lea 0x0(%esi),%esi return -1; 80107360: b8 ff ff ff ff mov $0xffffffff,%eax } 80107365: c3 ret 80107366: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010736d: 8d 76 00 lea 0x0(%esi),%esi 80107370 : void uartinit(void) { 80107370: 55 push %ebp asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80107371: 31 c9 xor %ecx,%ecx 80107373: 89 c8 mov %ecx,%eax 80107375: 89 e5 mov %esp,%ebp 80107377: 57 push %edi 80107378: bf fa 03 00 00 mov $0x3fa,%edi 8010737d: 56 push %esi 8010737e: 89 fa mov %edi,%edx 80107380: 53 push %ebx 80107381: 83 ec 1c sub $0x1c,%esp 80107384: ee out %al,(%dx) 80107385: be fb 03 00 00 mov $0x3fb,%esi 8010738a: b8 80 ff ff ff mov $0xffffff80,%eax 8010738f: 89 f2 mov %esi,%edx 80107391: ee out %al,(%dx) 80107392: b8 0c 00 00 00 mov $0xc,%eax 80107397: ba f8 03 00 00 mov $0x3f8,%edx 8010739c: ee out %al,(%dx) 8010739d: bb f9 03 00 00 mov $0x3f9,%ebx 801073a2: 89 c8 mov %ecx,%eax 801073a4: 89 da mov %ebx,%edx 801073a6: ee out %al,(%dx) 801073a7: b8 03 00 00 00 mov $0x3,%eax 801073ac: 89 f2 mov %esi,%edx 801073ae: ee out %al,(%dx) 801073af: ba fc 03 00 00 mov $0x3fc,%edx 801073b4: 89 c8 mov %ecx,%eax 801073b6: ee out %al,(%dx) 801073b7: b8 01 00 00 00 mov $0x1,%eax 801073bc: 89 da mov %ebx,%edx 801073be: ee out %al,(%dx) asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 801073bf: ba fd 03 00 00 mov $0x3fd,%edx 801073c4: ec in (%dx),%al if (inb(COM1 + 5) == 0xFF) { 801073c5: 3c ff cmp $0xff,%al 801073c7: 74 78 je 80107441 uart = 1; 801073c9: c7 05 40 12 12 80 01 movl $0x1,0x80121240 801073d0: 00 00 00 801073d3: 89 fa mov %edi,%edx 801073d5: ec in (%dx),%al 801073d6: ba f8 03 00 00 mov $0x3f8,%edx 801073db: ec in (%dx),%al ioapicenable(IRQ_COM1, 0); 801073dc: 83 ec 08 sub $0x8,%esp for (p = "xv6...\n"; *p; p++) { 801073df: bf fc 93 10 80 mov $0x801093fc,%edi 801073e4: be fd 03 00 00 mov $0x3fd,%esi ioapicenable(IRQ_COM1, 0); 801073e9: 6a 00 push $0x0 801073eb: 6a 04 push $0x4 801073ed: e8 7e c5 ff ff call 80103970 for (p = "xv6...\n"; *p; p++) { 801073f2: c6 45 e7 78 movb $0x78,-0x19(%ebp) ioapicenable(IRQ_COM1, 0); 801073f6: 83 c4 10 add $0x10,%esp 801073f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if (!uart) { 80107400: a1 40 12 12 80 mov 0x80121240,%eax 80107405: bb 80 00 00 00 mov $0x80,%ebx 8010740a: 85 c0 test %eax,%eax 8010740c: 75 14 jne 80107422 8010740e: eb 23 jmp 80107433 microdelay(10); 80107410: 83 ec 0c sub $0xc,%esp 80107413: 6a 0a push $0xa 80107415: e8 06 ca ff ff call 80103e20 for (i = 0; i < 128 && !(inb(COM1 + 5) & 0x20); i++) { 8010741a: 83 c4 10 add $0x10,%esp 8010741d: 83 eb 01 sub $0x1,%ebx 80107420: 74 07 je 80107429 80107422: 89 f2 mov %esi,%edx 80107424: ec in (%dx),%al 80107425: a8 20 test $0x20,%al 80107427: 74 e7 je 80107410 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80107429: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 8010742d: ba f8 03 00 00 mov $0x3f8,%edx 80107432: ee out %al,(%dx) for (p = "xv6...\n"; *p; p++) { 80107433: 0f b6 47 01 movzbl 0x1(%edi),%eax 80107437: 83 c7 01 add $0x1,%edi 8010743a: 88 45 e7 mov %al,-0x19(%ebp) 8010743d: 84 c0 test %al,%al 8010743f: 75 bf jne 80107400 } 80107441: 8d 65 f4 lea -0xc(%ebp),%esp 80107444: 5b pop %ebx 80107445: 5e pop %esi 80107446: 5f pop %edi 80107447: 5d pop %ebp 80107448: c3 ret 80107449: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80107450 : if (!uart) { 80107450: a1 40 12 12 80 mov 0x80121240,%eax 80107455: 85 c0 test %eax,%eax 80107457: 74 47 je 801074a0 void uartputc(int c) { 80107459: 55 push %ebp 8010745a: 89 e5 mov %esp,%ebp 8010745c: 56 push %esi asm volatile ("in %1,%0" : "=a" (data) : "d" (port)); 8010745d: be fd 03 00 00 mov $0x3fd,%esi 80107462: 53 push %ebx 80107463: bb 80 00 00 00 mov $0x80,%ebx 80107468: eb 18 jmp 80107482 8010746a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi microdelay(10); 80107470: 83 ec 0c sub $0xc,%esp 80107473: 6a 0a push $0xa 80107475: e8 a6 c9 ff ff call 80103e20 for (i = 0; i < 128 && !(inb(COM1 + 5) & 0x20); i++) { 8010747a: 83 c4 10 add $0x10,%esp 8010747d: 83 eb 01 sub $0x1,%ebx 80107480: 74 07 je 80107489 80107482: 89 f2 mov %esi,%edx 80107484: ec in (%dx),%al 80107485: a8 20 test $0x20,%al 80107487: 74 e7 je 80107470 asm volatile ("out %0,%1" : : "a" (data), "d" (port)); 80107489: 8b 45 08 mov 0x8(%ebp),%eax 8010748c: ba f8 03 00 00 mov $0x3f8,%edx 80107491: ee out %al,(%dx) } 80107492: 8d 65 f8 lea -0x8(%ebp),%esp 80107495: 5b pop %ebx 80107496: 5e pop %esi 80107497: 5d pop %ebp 80107498: c3 ret 80107499: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801074a0: c3 ret 801074a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801074a8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801074af: 90 nop 801074b0 : void uartintr(void) { 801074b0: 55 push %ebp 801074b1: 89 e5 mov %esp,%ebp 801074b3: 83 ec 14 sub $0x14,%esp consoleintr(uartgetc); 801074b6: 68 40 73 10 80 push $0x80107340 801074bb: e8 70 a0 ff ff call 80101530 } 801074c0: 83 c4 10 add $0x10,%esp 801074c3: c9 leave 801074c4: c3 ret 801074c5 : # generated by vectors.pl - do not edit # handlers .globl alltraps .globl vector0 vector0: pushl $0 801074c5: 6a 00 push $0x0 pushl $0 801074c7: 6a 00 push $0x0 jmp alltraps 801074c9: e9 03 fb ff ff jmp 80106fd1 801074ce : .globl vector1 vector1: pushl $0 801074ce: 6a 00 push $0x0 pushl $1 801074d0: 6a 01 push $0x1 jmp alltraps 801074d2: e9 fa fa ff ff jmp 80106fd1 801074d7 : .globl vector2 vector2: pushl $0 801074d7: 6a 00 push $0x0 pushl $2 801074d9: 6a 02 push $0x2 jmp alltraps 801074db: e9 f1 fa ff ff jmp 80106fd1 801074e0 : .globl vector3 vector3: pushl $0 801074e0: 6a 00 push $0x0 pushl $3 801074e2: 6a 03 push $0x3 jmp alltraps 801074e4: e9 e8 fa ff ff jmp 80106fd1 801074e9 : .globl vector4 vector4: pushl $0 801074e9: 6a 00 push $0x0 pushl $4 801074eb: 6a 04 push $0x4 jmp alltraps 801074ed: e9 df fa ff ff jmp 80106fd1 801074f2 : .globl vector5 vector5: pushl $0 801074f2: 6a 00 push $0x0 pushl $5 801074f4: 6a 05 push $0x5 jmp alltraps 801074f6: e9 d6 fa ff ff jmp 80106fd1 801074fb : .globl vector6 vector6: pushl $0 801074fb: 6a 00 push $0x0 pushl $6 801074fd: 6a 06 push $0x6 jmp alltraps 801074ff: e9 cd fa ff ff jmp 80106fd1 80107504 : .globl vector7 vector7: pushl $0 80107504: 6a 00 push $0x0 pushl $7 80107506: 6a 07 push $0x7 jmp alltraps 80107508: e9 c4 fa ff ff jmp 80106fd1 8010750d : .globl vector8 vector8: pushl $8 8010750d: 6a 08 push $0x8 jmp alltraps 8010750f: e9 bd fa ff ff jmp 80106fd1 80107514 : .globl vector9 vector9: pushl $0 80107514: 6a 00 push $0x0 pushl $9 80107516: 6a 09 push $0x9 jmp alltraps 80107518: e9 b4 fa ff ff jmp 80106fd1 8010751d : .globl vector10 vector10: pushl $10 8010751d: 6a 0a push $0xa jmp alltraps 8010751f: e9 ad fa ff ff jmp 80106fd1 80107524 : .globl vector11 vector11: pushl $11 80107524: 6a 0b push $0xb jmp alltraps 80107526: e9 a6 fa ff ff jmp 80106fd1 8010752b : .globl vector12 vector12: pushl $12 8010752b: 6a 0c push $0xc jmp alltraps 8010752d: e9 9f fa ff ff jmp 80106fd1 80107532 : .globl vector13 vector13: pushl $13 80107532: 6a 0d push $0xd jmp alltraps 80107534: e9 98 fa ff ff jmp 80106fd1 80107539 : .globl vector14 vector14: pushl $14 80107539: 6a 0e push $0xe jmp alltraps 8010753b: e9 91 fa ff ff jmp 80106fd1 80107540 : .globl vector15 vector15: pushl $0 80107540: 6a 00 push $0x0 pushl $15 80107542: 6a 0f push $0xf jmp alltraps 80107544: e9 88 fa ff ff jmp 80106fd1 80107549 : .globl vector16 vector16: pushl $0 80107549: 6a 00 push $0x0 pushl $16 8010754b: 6a 10 push $0x10 jmp alltraps 8010754d: e9 7f fa ff ff jmp 80106fd1 80107552 : .globl vector17 vector17: pushl $17 80107552: 6a 11 push $0x11 jmp alltraps 80107554: e9 78 fa ff ff jmp 80106fd1 80107559 : .globl vector18 vector18: pushl $0 80107559: 6a 00 push $0x0 pushl $18 8010755b: 6a 12 push $0x12 jmp alltraps 8010755d: e9 6f fa ff ff jmp 80106fd1 80107562 : .globl vector19 vector19: pushl $0 80107562: 6a 00 push $0x0 pushl $19 80107564: 6a 13 push $0x13 jmp alltraps 80107566: e9 66 fa ff ff jmp 80106fd1 8010756b : .globl vector20 vector20: pushl $0 8010756b: 6a 00 push $0x0 pushl $20 8010756d: 6a 14 push $0x14 jmp alltraps 8010756f: e9 5d fa ff ff jmp 80106fd1 80107574 : .globl vector21 vector21: pushl $0 80107574: 6a 00 push $0x0 pushl $21 80107576: 6a 15 push $0x15 jmp alltraps 80107578: e9 54 fa ff ff jmp 80106fd1 8010757d : .globl vector22 vector22: pushl $0 8010757d: 6a 00 push $0x0 pushl $22 8010757f: 6a 16 push $0x16 jmp alltraps 80107581: e9 4b fa ff ff jmp 80106fd1 80107586 : .globl vector23 vector23: pushl $0 80107586: 6a 00 push $0x0 pushl $23 80107588: 6a 17 push $0x17 jmp alltraps 8010758a: e9 42 fa ff ff jmp 80106fd1 8010758f : .globl vector24 vector24: pushl $0 8010758f: 6a 00 push $0x0 pushl $24 80107591: 6a 18 push $0x18 jmp alltraps 80107593: e9 39 fa ff ff jmp 80106fd1 80107598 : .globl vector25 vector25: pushl $0 80107598: 6a 00 push $0x0 pushl $25 8010759a: 6a 19 push $0x19 jmp alltraps 8010759c: e9 30 fa ff ff jmp 80106fd1 801075a1 : .globl vector26 vector26: pushl $0 801075a1: 6a 00 push $0x0 pushl $26 801075a3: 6a 1a push $0x1a jmp alltraps 801075a5: e9 27 fa ff ff jmp 80106fd1 801075aa : .globl vector27 vector27: pushl $0 801075aa: 6a 00 push $0x0 pushl $27 801075ac: 6a 1b push $0x1b jmp alltraps 801075ae: e9 1e fa ff ff jmp 80106fd1 801075b3 : .globl vector28 vector28: pushl $0 801075b3: 6a 00 push $0x0 pushl $28 801075b5: 6a 1c push $0x1c jmp alltraps 801075b7: e9 15 fa ff ff jmp 80106fd1 801075bc : .globl vector29 vector29: pushl $0 801075bc: 6a 00 push $0x0 pushl $29 801075be: 6a 1d push $0x1d jmp alltraps 801075c0: e9 0c fa ff ff jmp 80106fd1 801075c5 : .globl vector30 vector30: pushl $0 801075c5: 6a 00 push $0x0 pushl $30 801075c7: 6a 1e push $0x1e jmp alltraps 801075c9: e9 03 fa ff ff jmp 80106fd1 801075ce : .globl vector31 vector31: pushl $0 801075ce: 6a 00 push $0x0 pushl $31 801075d0: 6a 1f push $0x1f jmp alltraps 801075d2: e9 fa f9 ff ff jmp 80106fd1 801075d7 : .globl vector32 vector32: pushl $0 801075d7: 6a 00 push $0x0 pushl $32 801075d9: 6a 20 push $0x20 jmp alltraps 801075db: e9 f1 f9 ff ff jmp 80106fd1 801075e0 : .globl vector33 vector33: pushl $0 801075e0: 6a 00 push $0x0 pushl $33 801075e2: 6a 21 push $0x21 jmp alltraps 801075e4: e9 e8 f9 ff ff jmp 80106fd1 801075e9 : .globl vector34 vector34: pushl $0 801075e9: 6a 00 push $0x0 pushl $34 801075eb: 6a 22 push $0x22 jmp alltraps 801075ed: e9 df f9 ff ff jmp 80106fd1 801075f2 : .globl vector35 vector35: pushl $0 801075f2: 6a 00 push $0x0 pushl $35 801075f4: 6a 23 push $0x23 jmp alltraps 801075f6: e9 d6 f9 ff ff jmp 80106fd1 801075fb : .globl vector36 vector36: pushl $0 801075fb: 6a 00 push $0x0 pushl $36 801075fd: 6a 24 push $0x24 jmp alltraps 801075ff: e9 cd f9 ff ff jmp 80106fd1 80107604 : .globl vector37 vector37: pushl $0 80107604: 6a 00 push $0x0 pushl $37 80107606: 6a 25 push $0x25 jmp alltraps 80107608: e9 c4 f9 ff ff jmp 80106fd1 8010760d : .globl vector38 vector38: pushl $0 8010760d: 6a 00 push $0x0 pushl $38 8010760f: 6a 26 push $0x26 jmp alltraps 80107611: e9 bb f9 ff ff jmp 80106fd1 80107616 : .globl vector39 vector39: pushl $0 80107616: 6a 00 push $0x0 pushl $39 80107618: 6a 27 push $0x27 jmp alltraps 8010761a: e9 b2 f9 ff ff jmp 80106fd1 8010761f : .globl vector40 vector40: pushl $0 8010761f: 6a 00 push $0x0 pushl $40 80107621: 6a 28 push $0x28 jmp alltraps 80107623: e9 a9 f9 ff ff jmp 80106fd1 80107628 : .globl vector41 vector41: pushl $0 80107628: 6a 00 push $0x0 pushl $41 8010762a: 6a 29 push $0x29 jmp alltraps 8010762c: e9 a0 f9 ff ff jmp 80106fd1 80107631 : .globl vector42 vector42: pushl $0 80107631: 6a 00 push $0x0 pushl $42 80107633: 6a 2a push $0x2a jmp alltraps 80107635: e9 97 f9 ff ff jmp 80106fd1 8010763a : .globl vector43 vector43: pushl $0 8010763a: 6a 00 push $0x0 pushl $43 8010763c: 6a 2b push $0x2b jmp alltraps 8010763e: e9 8e f9 ff ff jmp 80106fd1 80107643 : .globl vector44 vector44: pushl $0 80107643: 6a 00 push $0x0 pushl $44 80107645: 6a 2c push $0x2c jmp alltraps 80107647: e9 85 f9 ff ff jmp 80106fd1 8010764c : .globl vector45 vector45: pushl $0 8010764c: 6a 00 push $0x0 pushl $45 8010764e: 6a 2d push $0x2d jmp alltraps 80107650: e9 7c f9 ff ff jmp 80106fd1 80107655 : .globl vector46 vector46: pushl $0 80107655: 6a 00 push $0x0 pushl $46 80107657: 6a 2e push $0x2e jmp alltraps 80107659: e9 73 f9 ff ff jmp 80106fd1 8010765e : .globl vector47 vector47: pushl $0 8010765e: 6a 00 push $0x0 pushl $47 80107660: 6a 2f push $0x2f jmp alltraps 80107662: e9 6a f9 ff ff jmp 80106fd1 80107667 : .globl vector48 vector48: pushl $0 80107667: 6a 00 push $0x0 pushl $48 80107669: 6a 30 push $0x30 jmp alltraps 8010766b: e9 61 f9 ff ff jmp 80106fd1 80107670 : .globl vector49 vector49: pushl $0 80107670: 6a 00 push $0x0 pushl $49 80107672: 6a 31 push $0x31 jmp alltraps 80107674: e9 58 f9 ff ff jmp 80106fd1 80107679 : .globl vector50 vector50: pushl $0 80107679: 6a 00 push $0x0 pushl $50 8010767b: 6a 32 push $0x32 jmp alltraps 8010767d: e9 4f f9 ff ff jmp 80106fd1 80107682 : .globl vector51 vector51: pushl $0 80107682: 6a 00 push $0x0 pushl $51 80107684: 6a 33 push $0x33 jmp alltraps 80107686: e9 46 f9 ff ff jmp 80106fd1 8010768b : .globl vector52 vector52: pushl $0 8010768b: 6a 00 push $0x0 pushl $52 8010768d: 6a 34 push $0x34 jmp alltraps 8010768f: e9 3d f9 ff ff jmp 80106fd1 80107694 : .globl vector53 vector53: pushl $0 80107694: 6a 00 push $0x0 pushl $53 80107696: 6a 35 push $0x35 jmp alltraps 80107698: e9 34 f9 ff ff jmp 80106fd1 8010769d : .globl vector54 vector54: pushl $0 8010769d: 6a 00 push $0x0 pushl $54 8010769f: 6a 36 push $0x36 jmp alltraps 801076a1: e9 2b f9 ff ff jmp 80106fd1 801076a6 : .globl vector55 vector55: pushl $0 801076a6: 6a 00 push $0x0 pushl $55 801076a8: 6a 37 push $0x37 jmp alltraps 801076aa: e9 22 f9 ff ff jmp 80106fd1 801076af : .globl vector56 vector56: pushl $0 801076af: 6a 00 push $0x0 pushl $56 801076b1: 6a 38 push $0x38 jmp alltraps 801076b3: e9 19 f9 ff ff jmp 80106fd1 801076b8 : .globl vector57 vector57: pushl $0 801076b8: 6a 00 push $0x0 pushl $57 801076ba: 6a 39 push $0x39 jmp alltraps 801076bc: e9 10 f9 ff ff jmp 80106fd1 801076c1 : .globl vector58 vector58: pushl $0 801076c1: 6a 00 push $0x0 pushl $58 801076c3: 6a 3a push $0x3a jmp alltraps 801076c5: e9 07 f9 ff ff jmp 80106fd1 801076ca : .globl vector59 vector59: pushl $0 801076ca: 6a 00 push $0x0 pushl $59 801076cc: 6a 3b push $0x3b jmp alltraps 801076ce: e9 fe f8 ff ff jmp 80106fd1 801076d3 : .globl vector60 vector60: pushl $0 801076d3: 6a 00 push $0x0 pushl $60 801076d5: 6a 3c push $0x3c jmp alltraps 801076d7: e9 f5 f8 ff ff jmp 80106fd1 801076dc : .globl vector61 vector61: pushl $0 801076dc: 6a 00 push $0x0 pushl $61 801076de: 6a 3d push $0x3d jmp alltraps 801076e0: e9 ec f8 ff ff jmp 80106fd1 801076e5 : .globl vector62 vector62: pushl $0 801076e5: 6a 00 push $0x0 pushl $62 801076e7: 6a 3e push $0x3e jmp alltraps 801076e9: e9 e3 f8 ff ff jmp 80106fd1 801076ee : .globl vector63 vector63: pushl $0 801076ee: 6a 00 push $0x0 pushl $63 801076f0: 6a 3f push $0x3f jmp alltraps 801076f2: e9 da f8 ff ff jmp 80106fd1 801076f7 : .globl vector64 vector64: pushl $0 801076f7: 6a 00 push $0x0 pushl $64 801076f9: 6a 40 push $0x40 jmp alltraps 801076fb: e9 d1 f8 ff ff jmp 80106fd1 80107700 : .globl vector65 vector65: pushl $0 80107700: 6a 00 push $0x0 pushl $65 80107702: 6a 41 push $0x41 jmp alltraps 80107704: e9 c8 f8 ff ff jmp 80106fd1 80107709 : .globl vector66 vector66: pushl $0 80107709: 6a 00 push $0x0 pushl $66 8010770b: 6a 42 push $0x42 jmp alltraps 8010770d: e9 bf f8 ff ff jmp 80106fd1 80107712 : .globl vector67 vector67: pushl $0 80107712: 6a 00 push $0x0 pushl $67 80107714: 6a 43 push $0x43 jmp alltraps 80107716: e9 b6 f8 ff ff jmp 80106fd1 8010771b : .globl vector68 vector68: pushl $0 8010771b: 6a 00 push $0x0 pushl $68 8010771d: 6a 44 push $0x44 jmp alltraps 8010771f: e9 ad f8 ff ff jmp 80106fd1 80107724 : .globl vector69 vector69: pushl $0 80107724: 6a 00 push $0x0 pushl $69 80107726: 6a 45 push $0x45 jmp alltraps 80107728: e9 a4 f8 ff ff jmp 80106fd1 8010772d : .globl vector70 vector70: pushl $0 8010772d: 6a 00 push $0x0 pushl $70 8010772f: 6a 46 push $0x46 jmp alltraps 80107731: e9 9b f8 ff ff jmp 80106fd1 80107736 : .globl vector71 vector71: pushl $0 80107736: 6a 00 push $0x0 pushl $71 80107738: 6a 47 push $0x47 jmp alltraps 8010773a: e9 92 f8 ff ff jmp 80106fd1 8010773f : .globl vector72 vector72: pushl $0 8010773f: 6a 00 push $0x0 pushl $72 80107741: 6a 48 push $0x48 jmp alltraps 80107743: e9 89 f8 ff ff jmp 80106fd1 80107748 : .globl vector73 vector73: pushl $0 80107748: 6a 00 push $0x0 pushl $73 8010774a: 6a 49 push $0x49 jmp alltraps 8010774c: e9 80 f8 ff ff jmp 80106fd1 80107751 : .globl vector74 vector74: pushl $0 80107751: 6a 00 push $0x0 pushl $74 80107753: 6a 4a push $0x4a jmp alltraps 80107755: e9 77 f8 ff ff jmp 80106fd1 8010775a : .globl vector75 vector75: pushl $0 8010775a: 6a 00 push $0x0 pushl $75 8010775c: 6a 4b push $0x4b jmp alltraps 8010775e: e9 6e f8 ff ff jmp 80106fd1 80107763 : .globl vector76 vector76: pushl $0 80107763: 6a 00 push $0x0 pushl $76 80107765: 6a 4c push $0x4c jmp alltraps 80107767: e9 65 f8 ff ff jmp 80106fd1 8010776c : .globl vector77 vector77: pushl $0 8010776c: 6a 00 push $0x0 pushl $77 8010776e: 6a 4d push $0x4d jmp alltraps 80107770: e9 5c f8 ff ff jmp 80106fd1 80107775 : .globl vector78 vector78: pushl $0 80107775: 6a 00 push $0x0 pushl $78 80107777: 6a 4e push $0x4e jmp alltraps 80107779: e9 53 f8 ff ff jmp 80106fd1 8010777e : .globl vector79 vector79: pushl $0 8010777e: 6a 00 push $0x0 pushl $79 80107780: 6a 4f push $0x4f jmp alltraps 80107782: e9 4a f8 ff ff jmp 80106fd1 80107787 : .globl vector80 vector80: pushl $0 80107787: 6a 00 push $0x0 pushl $80 80107789: 6a 50 push $0x50 jmp alltraps 8010778b: e9 41 f8 ff ff jmp 80106fd1 80107790 : .globl vector81 vector81: pushl $0 80107790: 6a 00 push $0x0 pushl $81 80107792: 6a 51 push $0x51 jmp alltraps 80107794: e9 38 f8 ff ff jmp 80106fd1 80107799 : .globl vector82 vector82: pushl $0 80107799: 6a 00 push $0x0 pushl $82 8010779b: 6a 52 push $0x52 jmp alltraps 8010779d: e9 2f f8 ff ff jmp 80106fd1 801077a2 : .globl vector83 vector83: pushl $0 801077a2: 6a 00 push $0x0 pushl $83 801077a4: 6a 53 push $0x53 jmp alltraps 801077a6: e9 26 f8 ff ff jmp 80106fd1 801077ab : .globl vector84 vector84: pushl $0 801077ab: 6a 00 push $0x0 pushl $84 801077ad: 6a 54 push $0x54 jmp alltraps 801077af: e9 1d f8 ff ff jmp 80106fd1 801077b4 : .globl vector85 vector85: pushl $0 801077b4: 6a 00 push $0x0 pushl $85 801077b6: 6a 55 push $0x55 jmp alltraps 801077b8: e9 14 f8 ff ff jmp 80106fd1 801077bd : .globl vector86 vector86: pushl $0 801077bd: 6a 00 push $0x0 pushl $86 801077bf: 6a 56 push $0x56 jmp alltraps 801077c1: e9 0b f8 ff ff jmp 80106fd1 801077c6 : .globl vector87 vector87: pushl $0 801077c6: 6a 00 push $0x0 pushl $87 801077c8: 6a 57 push $0x57 jmp alltraps 801077ca: e9 02 f8 ff ff jmp 80106fd1 801077cf : .globl vector88 vector88: pushl $0 801077cf: 6a 00 push $0x0 pushl $88 801077d1: 6a 58 push $0x58 jmp alltraps 801077d3: e9 f9 f7 ff ff jmp 80106fd1 801077d8 : .globl vector89 vector89: pushl $0 801077d8: 6a 00 push $0x0 pushl $89 801077da: 6a 59 push $0x59 jmp alltraps 801077dc: e9 f0 f7 ff ff jmp 80106fd1 801077e1 : .globl vector90 vector90: pushl $0 801077e1: 6a 00 push $0x0 pushl $90 801077e3: 6a 5a push $0x5a jmp alltraps 801077e5: e9 e7 f7 ff ff jmp 80106fd1 801077ea : .globl vector91 vector91: pushl $0 801077ea: 6a 00 push $0x0 pushl $91 801077ec: 6a 5b push $0x5b jmp alltraps 801077ee: e9 de f7 ff ff jmp 80106fd1 801077f3 : .globl vector92 vector92: pushl $0 801077f3: 6a 00 push $0x0 pushl $92 801077f5: 6a 5c push $0x5c jmp alltraps 801077f7: e9 d5 f7 ff ff jmp 80106fd1 801077fc : .globl vector93 vector93: pushl $0 801077fc: 6a 00 push $0x0 pushl $93 801077fe: 6a 5d push $0x5d jmp alltraps 80107800: e9 cc f7 ff ff jmp 80106fd1 80107805 : .globl vector94 vector94: pushl $0 80107805: 6a 00 push $0x0 pushl $94 80107807: 6a 5e push $0x5e jmp alltraps 80107809: e9 c3 f7 ff ff jmp 80106fd1 8010780e : .globl vector95 vector95: pushl $0 8010780e: 6a 00 push $0x0 pushl $95 80107810: 6a 5f push $0x5f jmp alltraps 80107812: e9 ba f7 ff ff jmp 80106fd1 80107817 : .globl vector96 vector96: pushl $0 80107817: 6a 00 push $0x0 pushl $96 80107819: 6a 60 push $0x60 jmp alltraps 8010781b: e9 b1 f7 ff ff jmp 80106fd1 80107820 : .globl vector97 vector97: pushl $0 80107820: 6a 00 push $0x0 pushl $97 80107822: 6a 61 push $0x61 jmp alltraps 80107824: e9 a8 f7 ff ff jmp 80106fd1 80107829 : .globl vector98 vector98: pushl $0 80107829: 6a 00 push $0x0 pushl $98 8010782b: 6a 62 push $0x62 jmp alltraps 8010782d: e9 9f f7 ff ff jmp 80106fd1 80107832 : .globl vector99 vector99: pushl $0 80107832: 6a 00 push $0x0 pushl $99 80107834: 6a 63 push $0x63 jmp alltraps 80107836: e9 96 f7 ff ff jmp 80106fd1 8010783b : .globl vector100 vector100: pushl $0 8010783b: 6a 00 push $0x0 pushl $100 8010783d: 6a 64 push $0x64 jmp alltraps 8010783f: e9 8d f7 ff ff jmp 80106fd1 80107844 : .globl vector101 vector101: pushl $0 80107844: 6a 00 push $0x0 pushl $101 80107846: 6a 65 push $0x65 jmp alltraps 80107848: e9 84 f7 ff ff jmp 80106fd1 8010784d : .globl vector102 vector102: pushl $0 8010784d: 6a 00 push $0x0 pushl $102 8010784f: 6a 66 push $0x66 jmp alltraps 80107851: e9 7b f7 ff ff jmp 80106fd1 80107856 : .globl vector103 vector103: pushl $0 80107856: 6a 00 push $0x0 pushl $103 80107858: 6a 67 push $0x67 jmp alltraps 8010785a: e9 72 f7 ff ff jmp 80106fd1 8010785f : .globl vector104 vector104: pushl $0 8010785f: 6a 00 push $0x0 pushl $104 80107861: 6a 68 push $0x68 jmp alltraps 80107863: e9 69 f7 ff ff jmp 80106fd1 80107868 : .globl vector105 vector105: pushl $0 80107868: 6a 00 push $0x0 pushl $105 8010786a: 6a 69 push $0x69 jmp alltraps 8010786c: e9 60 f7 ff ff jmp 80106fd1 80107871 : .globl vector106 vector106: pushl $0 80107871: 6a 00 push $0x0 pushl $106 80107873: 6a 6a push $0x6a jmp alltraps 80107875: e9 57 f7 ff ff jmp 80106fd1 8010787a : .globl vector107 vector107: pushl $0 8010787a: 6a 00 push $0x0 pushl $107 8010787c: 6a 6b push $0x6b jmp alltraps 8010787e: e9 4e f7 ff ff jmp 80106fd1 80107883 : .globl vector108 vector108: pushl $0 80107883: 6a 00 push $0x0 pushl $108 80107885: 6a 6c push $0x6c jmp alltraps 80107887: e9 45 f7 ff ff jmp 80106fd1 8010788c : .globl vector109 vector109: pushl $0 8010788c: 6a 00 push $0x0 pushl $109 8010788e: 6a 6d push $0x6d jmp alltraps 80107890: e9 3c f7 ff ff jmp 80106fd1 80107895 : .globl vector110 vector110: pushl $0 80107895: 6a 00 push $0x0 pushl $110 80107897: 6a 6e push $0x6e jmp alltraps 80107899: e9 33 f7 ff ff jmp 80106fd1 8010789e : .globl vector111 vector111: pushl $0 8010789e: 6a 00 push $0x0 pushl $111 801078a0: 6a 6f push $0x6f jmp alltraps 801078a2: e9 2a f7 ff ff jmp 80106fd1 801078a7 : .globl vector112 vector112: pushl $0 801078a7: 6a 00 push $0x0 pushl $112 801078a9: 6a 70 push $0x70 jmp alltraps 801078ab: e9 21 f7 ff ff jmp 80106fd1 801078b0 : .globl vector113 vector113: pushl $0 801078b0: 6a 00 push $0x0 pushl $113 801078b2: 6a 71 push $0x71 jmp alltraps 801078b4: e9 18 f7 ff ff jmp 80106fd1 801078b9 : .globl vector114 vector114: pushl $0 801078b9: 6a 00 push $0x0 pushl $114 801078bb: 6a 72 push $0x72 jmp alltraps 801078bd: e9 0f f7 ff ff jmp 80106fd1 801078c2 : .globl vector115 vector115: pushl $0 801078c2: 6a 00 push $0x0 pushl $115 801078c4: 6a 73 push $0x73 jmp alltraps 801078c6: e9 06 f7 ff ff jmp 80106fd1 801078cb : .globl vector116 vector116: pushl $0 801078cb: 6a 00 push $0x0 pushl $116 801078cd: 6a 74 push $0x74 jmp alltraps 801078cf: e9 fd f6 ff ff jmp 80106fd1 801078d4 : .globl vector117 vector117: pushl $0 801078d4: 6a 00 push $0x0 pushl $117 801078d6: 6a 75 push $0x75 jmp alltraps 801078d8: e9 f4 f6 ff ff jmp 80106fd1 801078dd : .globl vector118 vector118: pushl $0 801078dd: 6a 00 push $0x0 pushl $118 801078df: 6a 76 push $0x76 jmp alltraps 801078e1: e9 eb f6 ff ff jmp 80106fd1 801078e6 : .globl vector119 vector119: pushl $0 801078e6: 6a 00 push $0x0 pushl $119 801078e8: 6a 77 push $0x77 jmp alltraps 801078ea: e9 e2 f6 ff ff jmp 80106fd1 801078ef : .globl vector120 vector120: pushl $0 801078ef: 6a 00 push $0x0 pushl $120 801078f1: 6a 78 push $0x78 jmp alltraps 801078f3: e9 d9 f6 ff ff jmp 80106fd1 801078f8 : .globl vector121 vector121: pushl $0 801078f8: 6a 00 push $0x0 pushl $121 801078fa: 6a 79 push $0x79 jmp alltraps 801078fc: e9 d0 f6 ff ff jmp 80106fd1 80107901 : .globl vector122 vector122: pushl $0 80107901: 6a 00 push $0x0 pushl $122 80107903: 6a 7a push $0x7a jmp alltraps 80107905: e9 c7 f6 ff ff jmp 80106fd1 8010790a : .globl vector123 vector123: pushl $0 8010790a: 6a 00 push $0x0 pushl $123 8010790c: 6a 7b push $0x7b jmp alltraps 8010790e: e9 be f6 ff ff jmp 80106fd1 80107913 : .globl vector124 vector124: pushl $0 80107913: 6a 00 push $0x0 pushl $124 80107915: 6a 7c push $0x7c jmp alltraps 80107917: e9 b5 f6 ff ff jmp 80106fd1 8010791c : .globl vector125 vector125: pushl $0 8010791c: 6a 00 push $0x0 pushl $125 8010791e: 6a 7d push $0x7d jmp alltraps 80107920: e9 ac f6 ff ff jmp 80106fd1 80107925 : .globl vector126 vector126: pushl $0 80107925: 6a 00 push $0x0 pushl $126 80107927: 6a 7e push $0x7e jmp alltraps 80107929: e9 a3 f6 ff ff jmp 80106fd1 8010792e : .globl vector127 vector127: pushl $0 8010792e: 6a 00 push $0x0 pushl $127 80107930: 6a 7f push $0x7f jmp alltraps 80107932: e9 9a f6 ff ff jmp 80106fd1 80107937 : .globl vector128 vector128: pushl $0 80107937: 6a 00 push $0x0 pushl $128 80107939: 68 80 00 00 00 push $0x80 jmp alltraps 8010793e: e9 8e f6 ff ff jmp 80106fd1 80107943 : .globl vector129 vector129: pushl $0 80107943: 6a 00 push $0x0 pushl $129 80107945: 68 81 00 00 00 push $0x81 jmp alltraps 8010794a: e9 82 f6 ff ff jmp 80106fd1 8010794f : .globl vector130 vector130: pushl $0 8010794f: 6a 00 push $0x0 pushl $130 80107951: 68 82 00 00 00 push $0x82 jmp alltraps 80107956: e9 76 f6 ff ff jmp 80106fd1 8010795b : .globl vector131 vector131: pushl $0 8010795b: 6a 00 push $0x0 pushl $131 8010795d: 68 83 00 00 00 push $0x83 jmp alltraps 80107962: e9 6a f6 ff ff jmp 80106fd1 80107967 : .globl vector132 vector132: pushl $0 80107967: 6a 00 push $0x0 pushl $132 80107969: 68 84 00 00 00 push $0x84 jmp alltraps 8010796e: e9 5e f6 ff ff jmp 80106fd1 80107973 : .globl vector133 vector133: pushl $0 80107973: 6a 00 push $0x0 pushl $133 80107975: 68 85 00 00 00 push $0x85 jmp alltraps 8010797a: e9 52 f6 ff ff jmp 80106fd1 8010797f : .globl vector134 vector134: pushl $0 8010797f: 6a 00 push $0x0 pushl $134 80107981: 68 86 00 00 00 push $0x86 jmp alltraps 80107986: e9 46 f6 ff ff jmp 80106fd1 8010798b : .globl vector135 vector135: pushl $0 8010798b: 6a 00 push $0x0 pushl $135 8010798d: 68 87 00 00 00 push $0x87 jmp alltraps 80107992: e9 3a f6 ff ff jmp 80106fd1 80107997 : .globl vector136 vector136: pushl $0 80107997: 6a 00 push $0x0 pushl $136 80107999: 68 88 00 00 00 push $0x88 jmp alltraps 8010799e: e9 2e f6 ff ff jmp 80106fd1 801079a3 : .globl vector137 vector137: pushl $0 801079a3: 6a 00 push $0x0 pushl $137 801079a5: 68 89 00 00 00 push $0x89 jmp alltraps 801079aa: e9 22 f6 ff ff jmp 80106fd1 801079af : .globl vector138 vector138: pushl $0 801079af: 6a 00 push $0x0 pushl $138 801079b1: 68 8a 00 00 00 push $0x8a jmp alltraps 801079b6: e9 16 f6 ff ff jmp 80106fd1 801079bb : .globl vector139 vector139: pushl $0 801079bb: 6a 00 push $0x0 pushl $139 801079bd: 68 8b 00 00 00 push $0x8b jmp alltraps 801079c2: e9 0a f6 ff ff jmp 80106fd1 801079c7 : .globl vector140 vector140: pushl $0 801079c7: 6a 00 push $0x0 pushl $140 801079c9: 68 8c 00 00 00 push $0x8c jmp alltraps 801079ce: e9 fe f5 ff ff jmp 80106fd1 801079d3 : .globl vector141 vector141: pushl $0 801079d3: 6a 00 push $0x0 pushl $141 801079d5: 68 8d 00 00 00 push $0x8d jmp alltraps 801079da: e9 f2 f5 ff ff jmp 80106fd1 801079df : .globl vector142 vector142: pushl $0 801079df: 6a 00 push $0x0 pushl $142 801079e1: 68 8e 00 00 00 push $0x8e jmp alltraps 801079e6: e9 e6 f5 ff ff jmp 80106fd1 801079eb : .globl vector143 vector143: pushl $0 801079eb: 6a 00 push $0x0 pushl $143 801079ed: 68 8f 00 00 00 push $0x8f jmp alltraps 801079f2: e9 da f5 ff ff jmp 80106fd1 801079f7 : .globl vector144 vector144: pushl $0 801079f7: 6a 00 push $0x0 pushl $144 801079f9: 68 90 00 00 00 push $0x90 jmp alltraps 801079fe: e9 ce f5 ff ff jmp 80106fd1 80107a03 : .globl vector145 vector145: pushl $0 80107a03: 6a 00 push $0x0 pushl $145 80107a05: 68 91 00 00 00 push $0x91 jmp alltraps 80107a0a: e9 c2 f5 ff ff jmp 80106fd1 80107a0f : .globl vector146 vector146: pushl $0 80107a0f: 6a 00 push $0x0 pushl $146 80107a11: 68 92 00 00 00 push $0x92 jmp alltraps 80107a16: e9 b6 f5 ff ff jmp 80106fd1 80107a1b : .globl vector147 vector147: pushl $0 80107a1b: 6a 00 push $0x0 pushl $147 80107a1d: 68 93 00 00 00 push $0x93 jmp alltraps 80107a22: e9 aa f5 ff ff jmp 80106fd1 80107a27 : .globl vector148 vector148: pushl $0 80107a27: 6a 00 push $0x0 pushl $148 80107a29: 68 94 00 00 00 push $0x94 jmp alltraps 80107a2e: e9 9e f5 ff ff jmp 80106fd1 80107a33 : .globl vector149 vector149: pushl $0 80107a33: 6a 00 push $0x0 pushl $149 80107a35: 68 95 00 00 00 push $0x95 jmp alltraps 80107a3a: e9 92 f5 ff ff jmp 80106fd1 80107a3f : .globl vector150 vector150: pushl $0 80107a3f: 6a 00 push $0x0 pushl $150 80107a41: 68 96 00 00 00 push $0x96 jmp alltraps 80107a46: e9 86 f5 ff ff jmp 80106fd1 80107a4b : .globl vector151 vector151: pushl $0 80107a4b: 6a 00 push $0x0 pushl $151 80107a4d: 68 97 00 00 00 push $0x97 jmp alltraps 80107a52: e9 7a f5 ff ff jmp 80106fd1 80107a57 : .globl vector152 vector152: pushl $0 80107a57: 6a 00 push $0x0 pushl $152 80107a59: 68 98 00 00 00 push $0x98 jmp alltraps 80107a5e: e9 6e f5 ff ff jmp 80106fd1 80107a63 : .globl vector153 vector153: pushl $0 80107a63: 6a 00 push $0x0 pushl $153 80107a65: 68 99 00 00 00 push $0x99 jmp alltraps 80107a6a: e9 62 f5 ff ff jmp 80106fd1 80107a6f : .globl vector154 vector154: pushl $0 80107a6f: 6a 00 push $0x0 pushl $154 80107a71: 68 9a 00 00 00 push $0x9a jmp alltraps 80107a76: e9 56 f5 ff ff jmp 80106fd1 80107a7b : .globl vector155 vector155: pushl $0 80107a7b: 6a 00 push $0x0 pushl $155 80107a7d: 68 9b 00 00 00 push $0x9b jmp alltraps 80107a82: e9 4a f5 ff ff jmp 80106fd1 80107a87 : .globl vector156 vector156: pushl $0 80107a87: 6a 00 push $0x0 pushl $156 80107a89: 68 9c 00 00 00 push $0x9c jmp alltraps 80107a8e: e9 3e f5 ff ff jmp 80106fd1 80107a93 : .globl vector157 vector157: pushl $0 80107a93: 6a 00 push $0x0 pushl $157 80107a95: 68 9d 00 00 00 push $0x9d jmp alltraps 80107a9a: e9 32 f5 ff ff jmp 80106fd1 80107a9f : .globl vector158 vector158: pushl $0 80107a9f: 6a 00 push $0x0 pushl $158 80107aa1: 68 9e 00 00 00 push $0x9e jmp alltraps 80107aa6: e9 26 f5 ff ff jmp 80106fd1 80107aab : .globl vector159 vector159: pushl $0 80107aab: 6a 00 push $0x0 pushl $159 80107aad: 68 9f 00 00 00 push $0x9f jmp alltraps 80107ab2: e9 1a f5 ff ff jmp 80106fd1 80107ab7 : .globl vector160 vector160: pushl $0 80107ab7: 6a 00 push $0x0 pushl $160 80107ab9: 68 a0 00 00 00 push $0xa0 jmp alltraps 80107abe: e9 0e f5 ff ff jmp 80106fd1 80107ac3 : .globl vector161 vector161: pushl $0 80107ac3: 6a 00 push $0x0 pushl $161 80107ac5: 68 a1 00 00 00 push $0xa1 jmp alltraps 80107aca: e9 02 f5 ff ff jmp 80106fd1 80107acf : .globl vector162 vector162: pushl $0 80107acf: 6a 00 push $0x0 pushl $162 80107ad1: 68 a2 00 00 00 push $0xa2 jmp alltraps 80107ad6: e9 f6 f4 ff ff jmp 80106fd1 80107adb : .globl vector163 vector163: pushl $0 80107adb: 6a 00 push $0x0 pushl $163 80107add: 68 a3 00 00 00 push $0xa3 jmp alltraps 80107ae2: e9 ea f4 ff ff jmp 80106fd1 80107ae7 : .globl vector164 vector164: pushl $0 80107ae7: 6a 00 push $0x0 pushl $164 80107ae9: 68 a4 00 00 00 push $0xa4 jmp alltraps 80107aee: e9 de f4 ff ff jmp 80106fd1 80107af3 : .globl vector165 vector165: pushl $0 80107af3: 6a 00 push $0x0 pushl $165 80107af5: 68 a5 00 00 00 push $0xa5 jmp alltraps 80107afa: e9 d2 f4 ff ff jmp 80106fd1 80107aff : .globl vector166 vector166: pushl $0 80107aff: 6a 00 push $0x0 pushl $166 80107b01: 68 a6 00 00 00 push $0xa6 jmp alltraps 80107b06: e9 c6 f4 ff ff jmp 80106fd1 80107b0b : .globl vector167 vector167: pushl $0 80107b0b: 6a 00 push $0x0 pushl $167 80107b0d: 68 a7 00 00 00 push $0xa7 jmp alltraps 80107b12: e9 ba f4 ff ff jmp 80106fd1 80107b17 : .globl vector168 vector168: pushl $0 80107b17: 6a 00 push $0x0 pushl $168 80107b19: 68 a8 00 00 00 push $0xa8 jmp alltraps 80107b1e: e9 ae f4 ff ff jmp 80106fd1 80107b23 : .globl vector169 vector169: pushl $0 80107b23: 6a 00 push $0x0 pushl $169 80107b25: 68 a9 00 00 00 push $0xa9 jmp alltraps 80107b2a: e9 a2 f4 ff ff jmp 80106fd1 80107b2f : .globl vector170 vector170: pushl $0 80107b2f: 6a 00 push $0x0 pushl $170 80107b31: 68 aa 00 00 00 push $0xaa jmp alltraps 80107b36: e9 96 f4 ff ff jmp 80106fd1 80107b3b : .globl vector171 vector171: pushl $0 80107b3b: 6a 00 push $0x0 pushl $171 80107b3d: 68 ab 00 00 00 push $0xab jmp alltraps 80107b42: e9 8a f4 ff ff jmp 80106fd1 80107b47 : .globl vector172 vector172: pushl $0 80107b47: 6a 00 push $0x0 pushl $172 80107b49: 68 ac 00 00 00 push $0xac jmp alltraps 80107b4e: e9 7e f4 ff ff jmp 80106fd1 80107b53 : .globl vector173 vector173: pushl $0 80107b53: 6a 00 push $0x0 pushl $173 80107b55: 68 ad 00 00 00 push $0xad jmp alltraps 80107b5a: e9 72 f4 ff ff jmp 80106fd1 80107b5f : .globl vector174 vector174: pushl $0 80107b5f: 6a 00 push $0x0 pushl $174 80107b61: 68 ae 00 00 00 push $0xae jmp alltraps 80107b66: e9 66 f4 ff ff jmp 80106fd1 80107b6b : .globl vector175 vector175: pushl $0 80107b6b: 6a 00 push $0x0 pushl $175 80107b6d: 68 af 00 00 00 push $0xaf jmp alltraps 80107b72: e9 5a f4 ff ff jmp 80106fd1 80107b77 : .globl vector176 vector176: pushl $0 80107b77: 6a 00 push $0x0 pushl $176 80107b79: 68 b0 00 00 00 push $0xb0 jmp alltraps 80107b7e: e9 4e f4 ff ff jmp 80106fd1 80107b83 : .globl vector177 vector177: pushl $0 80107b83: 6a 00 push $0x0 pushl $177 80107b85: 68 b1 00 00 00 push $0xb1 jmp alltraps 80107b8a: e9 42 f4 ff ff jmp 80106fd1 80107b8f : .globl vector178 vector178: pushl $0 80107b8f: 6a 00 push $0x0 pushl $178 80107b91: 68 b2 00 00 00 push $0xb2 jmp alltraps 80107b96: e9 36 f4 ff ff jmp 80106fd1 80107b9b : .globl vector179 vector179: pushl $0 80107b9b: 6a 00 push $0x0 pushl $179 80107b9d: 68 b3 00 00 00 push $0xb3 jmp alltraps 80107ba2: e9 2a f4 ff ff jmp 80106fd1 80107ba7 : .globl vector180 vector180: pushl $0 80107ba7: 6a 00 push $0x0 pushl $180 80107ba9: 68 b4 00 00 00 push $0xb4 jmp alltraps 80107bae: e9 1e f4 ff ff jmp 80106fd1 80107bb3 : .globl vector181 vector181: pushl $0 80107bb3: 6a 00 push $0x0 pushl $181 80107bb5: 68 b5 00 00 00 push $0xb5 jmp alltraps 80107bba: e9 12 f4 ff ff jmp 80106fd1 80107bbf : .globl vector182 vector182: pushl $0 80107bbf: 6a 00 push $0x0 pushl $182 80107bc1: 68 b6 00 00 00 push $0xb6 jmp alltraps 80107bc6: e9 06 f4 ff ff jmp 80106fd1 80107bcb : .globl vector183 vector183: pushl $0 80107bcb: 6a 00 push $0x0 pushl $183 80107bcd: 68 b7 00 00 00 push $0xb7 jmp alltraps 80107bd2: e9 fa f3 ff ff jmp 80106fd1 80107bd7 : .globl vector184 vector184: pushl $0 80107bd7: 6a 00 push $0x0 pushl $184 80107bd9: 68 b8 00 00 00 push $0xb8 jmp alltraps 80107bde: e9 ee f3 ff ff jmp 80106fd1 80107be3 : .globl vector185 vector185: pushl $0 80107be3: 6a 00 push $0x0 pushl $185 80107be5: 68 b9 00 00 00 push $0xb9 jmp alltraps 80107bea: e9 e2 f3 ff ff jmp 80106fd1 80107bef : .globl vector186 vector186: pushl $0 80107bef: 6a 00 push $0x0 pushl $186 80107bf1: 68 ba 00 00 00 push $0xba jmp alltraps 80107bf6: e9 d6 f3 ff ff jmp 80106fd1 80107bfb : .globl vector187 vector187: pushl $0 80107bfb: 6a 00 push $0x0 pushl $187 80107bfd: 68 bb 00 00 00 push $0xbb jmp alltraps 80107c02: e9 ca f3 ff ff jmp 80106fd1 80107c07 : .globl vector188 vector188: pushl $0 80107c07: 6a 00 push $0x0 pushl $188 80107c09: 68 bc 00 00 00 push $0xbc jmp alltraps 80107c0e: e9 be f3 ff ff jmp 80106fd1 80107c13 : .globl vector189 vector189: pushl $0 80107c13: 6a 00 push $0x0 pushl $189 80107c15: 68 bd 00 00 00 push $0xbd jmp alltraps 80107c1a: e9 b2 f3 ff ff jmp 80106fd1 80107c1f : .globl vector190 vector190: pushl $0 80107c1f: 6a 00 push $0x0 pushl $190 80107c21: 68 be 00 00 00 push $0xbe jmp alltraps 80107c26: e9 a6 f3 ff ff jmp 80106fd1 80107c2b : .globl vector191 vector191: pushl $0 80107c2b: 6a 00 push $0x0 pushl $191 80107c2d: 68 bf 00 00 00 push $0xbf jmp alltraps 80107c32: e9 9a f3 ff ff jmp 80106fd1 80107c37 : .globl vector192 vector192: pushl $0 80107c37: 6a 00 push $0x0 pushl $192 80107c39: 68 c0 00 00 00 push $0xc0 jmp alltraps 80107c3e: e9 8e f3 ff ff jmp 80106fd1 80107c43 : .globl vector193 vector193: pushl $0 80107c43: 6a 00 push $0x0 pushl $193 80107c45: 68 c1 00 00 00 push $0xc1 jmp alltraps 80107c4a: e9 82 f3 ff ff jmp 80106fd1 80107c4f : .globl vector194 vector194: pushl $0 80107c4f: 6a 00 push $0x0 pushl $194 80107c51: 68 c2 00 00 00 push $0xc2 jmp alltraps 80107c56: e9 76 f3 ff ff jmp 80106fd1 80107c5b : .globl vector195 vector195: pushl $0 80107c5b: 6a 00 push $0x0 pushl $195 80107c5d: 68 c3 00 00 00 push $0xc3 jmp alltraps 80107c62: e9 6a f3 ff ff jmp 80106fd1 80107c67 : .globl vector196 vector196: pushl $0 80107c67: 6a 00 push $0x0 pushl $196 80107c69: 68 c4 00 00 00 push $0xc4 jmp alltraps 80107c6e: e9 5e f3 ff ff jmp 80106fd1 80107c73 : .globl vector197 vector197: pushl $0 80107c73: 6a 00 push $0x0 pushl $197 80107c75: 68 c5 00 00 00 push $0xc5 jmp alltraps 80107c7a: e9 52 f3 ff ff jmp 80106fd1 80107c7f : .globl vector198 vector198: pushl $0 80107c7f: 6a 00 push $0x0 pushl $198 80107c81: 68 c6 00 00 00 push $0xc6 jmp alltraps 80107c86: e9 46 f3 ff ff jmp 80106fd1 80107c8b : .globl vector199 vector199: pushl $0 80107c8b: 6a 00 push $0x0 pushl $199 80107c8d: 68 c7 00 00 00 push $0xc7 jmp alltraps 80107c92: e9 3a f3 ff ff jmp 80106fd1 80107c97 : .globl vector200 vector200: pushl $0 80107c97: 6a 00 push $0x0 pushl $200 80107c99: 68 c8 00 00 00 push $0xc8 jmp alltraps 80107c9e: e9 2e f3 ff ff jmp 80106fd1 80107ca3 : .globl vector201 vector201: pushl $0 80107ca3: 6a 00 push $0x0 pushl $201 80107ca5: 68 c9 00 00 00 push $0xc9 jmp alltraps 80107caa: e9 22 f3 ff ff jmp 80106fd1 80107caf : .globl vector202 vector202: pushl $0 80107caf: 6a 00 push $0x0 pushl $202 80107cb1: 68 ca 00 00 00 push $0xca jmp alltraps 80107cb6: e9 16 f3 ff ff jmp 80106fd1 80107cbb : .globl vector203 vector203: pushl $0 80107cbb: 6a 00 push $0x0 pushl $203 80107cbd: 68 cb 00 00 00 push $0xcb jmp alltraps 80107cc2: e9 0a f3 ff ff jmp 80106fd1 80107cc7 : .globl vector204 vector204: pushl $0 80107cc7: 6a 00 push $0x0 pushl $204 80107cc9: 68 cc 00 00 00 push $0xcc jmp alltraps 80107cce: e9 fe f2 ff ff jmp 80106fd1 80107cd3 : .globl vector205 vector205: pushl $0 80107cd3: 6a 00 push $0x0 pushl $205 80107cd5: 68 cd 00 00 00 push $0xcd jmp alltraps 80107cda: e9 f2 f2 ff ff jmp 80106fd1 80107cdf : .globl vector206 vector206: pushl $0 80107cdf: 6a 00 push $0x0 pushl $206 80107ce1: 68 ce 00 00 00 push $0xce jmp alltraps 80107ce6: e9 e6 f2 ff ff jmp 80106fd1 80107ceb : .globl vector207 vector207: pushl $0 80107ceb: 6a 00 push $0x0 pushl $207 80107ced: 68 cf 00 00 00 push $0xcf jmp alltraps 80107cf2: e9 da f2 ff ff jmp 80106fd1 80107cf7 : .globl vector208 vector208: pushl $0 80107cf7: 6a 00 push $0x0 pushl $208 80107cf9: 68 d0 00 00 00 push $0xd0 jmp alltraps 80107cfe: e9 ce f2 ff ff jmp 80106fd1 80107d03 : .globl vector209 vector209: pushl $0 80107d03: 6a 00 push $0x0 pushl $209 80107d05: 68 d1 00 00 00 push $0xd1 jmp alltraps 80107d0a: e9 c2 f2 ff ff jmp 80106fd1 80107d0f : .globl vector210 vector210: pushl $0 80107d0f: 6a 00 push $0x0 pushl $210 80107d11: 68 d2 00 00 00 push $0xd2 jmp alltraps 80107d16: e9 b6 f2 ff ff jmp 80106fd1 80107d1b : .globl vector211 vector211: pushl $0 80107d1b: 6a 00 push $0x0 pushl $211 80107d1d: 68 d3 00 00 00 push $0xd3 jmp alltraps 80107d22: e9 aa f2 ff ff jmp 80106fd1 80107d27 : .globl vector212 vector212: pushl $0 80107d27: 6a 00 push $0x0 pushl $212 80107d29: 68 d4 00 00 00 push $0xd4 jmp alltraps 80107d2e: e9 9e f2 ff ff jmp 80106fd1 80107d33 : .globl vector213 vector213: pushl $0 80107d33: 6a 00 push $0x0 pushl $213 80107d35: 68 d5 00 00 00 push $0xd5 jmp alltraps 80107d3a: e9 92 f2 ff ff jmp 80106fd1 80107d3f : .globl vector214 vector214: pushl $0 80107d3f: 6a 00 push $0x0 pushl $214 80107d41: 68 d6 00 00 00 push $0xd6 jmp alltraps 80107d46: e9 86 f2 ff ff jmp 80106fd1 80107d4b : .globl vector215 vector215: pushl $0 80107d4b: 6a 00 push $0x0 pushl $215 80107d4d: 68 d7 00 00 00 push $0xd7 jmp alltraps 80107d52: e9 7a f2 ff ff jmp 80106fd1 80107d57 : .globl vector216 vector216: pushl $0 80107d57: 6a 00 push $0x0 pushl $216 80107d59: 68 d8 00 00 00 push $0xd8 jmp alltraps 80107d5e: e9 6e f2 ff ff jmp 80106fd1 80107d63 : .globl vector217 vector217: pushl $0 80107d63: 6a 00 push $0x0 pushl $217 80107d65: 68 d9 00 00 00 push $0xd9 jmp alltraps 80107d6a: e9 62 f2 ff ff jmp 80106fd1 80107d6f : .globl vector218 vector218: pushl $0 80107d6f: 6a 00 push $0x0 pushl $218 80107d71: 68 da 00 00 00 push $0xda jmp alltraps 80107d76: e9 56 f2 ff ff jmp 80106fd1 80107d7b : .globl vector219 vector219: pushl $0 80107d7b: 6a 00 push $0x0 pushl $219 80107d7d: 68 db 00 00 00 push $0xdb jmp alltraps 80107d82: e9 4a f2 ff ff jmp 80106fd1 80107d87 : .globl vector220 vector220: pushl $0 80107d87: 6a 00 push $0x0 pushl $220 80107d89: 68 dc 00 00 00 push $0xdc jmp alltraps 80107d8e: e9 3e f2 ff ff jmp 80106fd1 80107d93 : .globl vector221 vector221: pushl $0 80107d93: 6a 00 push $0x0 pushl $221 80107d95: 68 dd 00 00 00 push $0xdd jmp alltraps 80107d9a: e9 32 f2 ff ff jmp 80106fd1 80107d9f : .globl vector222 vector222: pushl $0 80107d9f: 6a 00 push $0x0 pushl $222 80107da1: 68 de 00 00 00 push $0xde jmp alltraps 80107da6: e9 26 f2 ff ff jmp 80106fd1 80107dab : .globl vector223 vector223: pushl $0 80107dab: 6a 00 push $0x0 pushl $223 80107dad: 68 df 00 00 00 push $0xdf jmp alltraps 80107db2: e9 1a f2 ff ff jmp 80106fd1 80107db7 : .globl vector224 vector224: pushl $0 80107db7: 6a 00 push $0x0 pushl $224 80107db9: 68 e0 00 00 00 push $0xe0 jmp alltraps 80107dbe: e9 0e f2 ff ff jmp 80106fd1 80107dc3 : .globl vector225 vector225: pushl $0 80107dc3: 6a 00 push $0x0 pushl $225 80107dc5: 68 e1 00 00 00 push $0xe1 jmp alltraps 80107dca: e9 02 f2 ff ff jmp 80106fd1 80107dcf : .globl vector226 vector226: pushl $0 80107dcf: 6a 00 push $0x0 pushl $226 80107dd1: 68 e2 00 00 00 push $0xe2 jmp alltraps 80107dd6: e9 f6 f1 ff ff jmp 80106fd1 80107ddb : .globl vector227 vector227: pushl $0 80107ddb: 6a 00 push $0x0 pushl $227 80107ddd: 68 e3 00 00 00 push $0xe3 jmp alltraps 80107de2: e9 ea f1 ff ff jmp 80106fd1 80107de7 : .globl vector228 vector228: pushl $0 80107de7: 6a 00 push $0x0 pushl $228 80107de9: 68 e4 00 00 00 push $0xe4 jmp alltraps 80107dee: e9 de f1 ff ff jmp 80106fd1 80107df3 : .globl vector229 vector229: pushl $0 80107df3: 6a 00 push $0x0 pushl $229 80107df5: 68 e5 00 00 00 push $0xe5 jmp alltraps 80107dfa: e9 d2 f1 ff ff jmp 80106fd1 80107dff : .globl vector230 vector230: pushl $0 80107dff: 6a 00 push $0x0 pushl $230 80107e01: 68 e6 00 00 00 push $0xe6 jmp alltraps 80107e06: e9 c6 f1 ff ff jmp 80106fd1 80107e0b : .globl vector231 vector231: pushl $0 80107e0b: 6a 00 push $0x0 pushl $231 80107e0d: 68 e7 00 00 00 push $0xe7 jmp alltraps 80107e12: e9 ba f1 ff ff jmp 80106fd1 80107e17 : .globl vector232 vector232: pushl $0 80107e17: 6a 00 push $0x0 pushl $232 80107e19: 68 e8 00 00 00 push $0xe8 jmp alltraps 80107e1e: e9 ae f1 ff ff jmp 80106fd1 80107e23 : .globl vector233 vector233: pushl $0 80107e23: 6a 00 push $0x0 pushl $233 80107e25: 68 e9 00 00 00 push $0xe9 jmp alltraps 80107e2a: e9 a2 f1 ff ff jmp 80106fd1 80107e2f : .globl vector234 vector234: pushl $0 80107e2f: 6a 00 push $0x0 pushl $234 80107e31: 68 ea 00 00 00 push $0xea jmp alltraps 80107e36: e9 96 f1 ff ff jmp 80106fd1 80107e3b : .globl vector235 vector235: pushl $0 80107e3b: 6a 00 push $0x0 pushl $235 80107e3d: 68 eb 00 00 00 push $0xeb jmp alltraps 80107e42: e9 8a f1 ff ff jmp 80106fd1 80107e47 : .globl vector236 vector236: pushl $0 80107e47: 6a 00 push $0x0 pushl $236 80107e49: 68 ec 00 00 00 push $0xec jmp alltraps 80107e4e: e9 7e f1 ff ff jmp 80106fd1 80107e53 : .globl vector237 vector237: pushl $0 80107e53: 6a 00 push $0x0 pushl $237 80107e55: 68 ed 00 00 00 push $0xed jmp alltraps 80107e5a: e9 72 f1 ff ff jmp 80106fd1 80107e5f : .globl vector238 vector238: pushl $0 80107e5f: 6a 00 push $0x0 pushl $238 80107e61: 68 ee 00 00 00 push $0xee jmp alltraps 80107e66: e9 66 f1 ff ff jmp 80106fd1 80107e6b : .globl vector239 vector239: pushl $0 80107e6b: 6a 00 push $0x0 pushl $239 80107e6d: 68 ef 00 00 00 push $0xef jmp alltraps 80107e72: e9 5a f1 ff ff jmp 80106fd1 80107e77 : .globl vector240 vector240: pushl $0 80107e77: 6a 00 push $0x0 pushl $240 80107e79: 68 f0 00 00 00 push $0xf0 jmp alltraps 80107e7e: e9 4e f1 ff ff jmp 80106fd1 80107e83 : .globl vector241 vector241: pushl $0 80107e83: 6a 00 push $0x0 pushl $241 80107e85: 68 f1 00 00 00 push $0xf1 jmp alltraps 80107e8a: e9 42 f1 ff ff jmp 80106fd1 80107e8f : .globl vector242 vector242: pushl $0 80107e8f: 6a 00 push $0x0 pushl $242 80107e91: 68 f2 00 00 00 push $0xf2 jmp alltraps 80107e96: e9 36 f1 ff ff jmp 80106fd1 80107e9b : .globl vector243 vector243: pushl $0 80107e9b: 6a 00 push $0x0 pushl $243 80107e9d: 68 f3 00 00 00 push $0xf3 jmp alltraps 80107ea2: e9 2a f1 ff ff jmp 80106fd1 80107ea7 : .globl vector244 vector244: pushl $0 80107ea7: 6a 00 push $0x0 pushl $244 80107ea9: 68 f4 00 00 00 push $0xf4 jmp alltraps 80107eae: e9 1e f1 ff ff jmp 80106fd1 80107eb3 : .globl vector245 vector245: pushl $0 80107eb3: 6a 00 push $0x0 pushl $245 80107eb5: 68 f5 00 00 00 push $0xf5 jmp alltraps 80107eba: e9 12 f1 ff ff jmp 80106fd1 80107ebf : .globl vector246 vector246: pushl $0 80107ebf: 6a 00 push $0x0 pushl $246 80107ec1: 68 f6 00 00 00 push $0xf6 jmp alltraps 80107ec6: e9 06 f1 ff ff jmp 80106fd1 80107ecb : .globl vector247 vector247: pushl $0 80107ecb: 6a 00 push $0x0 pushl $247 80107ecd: 68 f7 00 00 00 push $0xf7 jmp alltraps 80107ed2: e9 fa f0 ff ff jmp 80106fd1 80107ed7 : .globl vector248 vector248: pushl $0 80107ed7: 6a 00 push $0x0 pushl $248 80107ed9: 68 f8 00 00 00 push $0xf8 jmp alltraps 80107ede: e9 ee f0 ff ff jmp 80106fd1 80107ee3 : .globl vector249 vector249: pushl $0 80107ee3: 6a 00 push $0x0 pushl $249 80107ee5: 68 f9 00 00 00 push $0xf9 jmp alltraps 80107eea: e9 e2 f0 ff ff jmp 80106fd1 80107eef : .globl vector250 vector250: pushl $0 80107eef: 6a 00 push $0x0 pushl $250 80107ef1: 68 fa 00 00 00 push $0xfa jmp alltraps 80107ef6: e9 d6 f0 ff ff jmp 80106fd1 80107efb : .globl vector251 vector251: pushl $0 80107efb: 6a 00 push $0x0 pushl $251 80107efd: 68 fb 00 00 00 push $0xfb jmp alltraps 80107f02: e9 ca f0 ff ff jmp 80106fd1 80107f07 : .globl vector252 vector252: pushl $0 80107f07: 6a 00 push $0x0 pushl $252 80107f09: 68 fc 00 00 00 push $0xfc jmp alltraps 80107f0e: e9 be f0 ff ff jmp 80106fd1 80107f13 : .globl vector253 vector253: pushl $0 80107f13: 6a 00 push $0x0 pushl $253 80107f15: 68 fd 00 00 00 push $0xfd jmp alltraps 80107f1a: e9 b2 f0 ff ff jmp 80106fd1 80107f1f : .globl vector254 vector254: pushl $0 80107f1f: 6a 00 push $0x0 pushl $254 80107f21: 68 fe 00 00 00 push $0xfe jmp alltraps 80107f26: e9 a6 f0 ff ff jmp 80106fd1 80107f2b : .globl vector255 vector255: pushl $0 80107f2b: 6a 00 push $0x0 pushl $255 80107f2d: 68 ff 00 00 00 push $0xff jmp alltraps 80107f32: e9 9a f0 ff ff jmp 80106fd1 80107f37: 66 90 xchg %ax,%ax 80107f39: 66 90 xchg %ax,%ax 80107f3b: 66 90 xchg %ax,%ax 80107f3d: 66 90 xchg %ax,%ax 80107f3f: 90 nop 80107f40 : // 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) { 80107f40: 55 push %ebp 80107f41: 89 e5 mov %esp,%ebp 80107f43: 57 push %edi 80107f44: 56 push %esi 80107f45: 53 push %ebx if (newsz >= oldsz) { return oldsz; } a = PGROUNDUP(newsz); 80107f46: 8d 99 ff 0f 00 00 lea 0xfff(%ecx),%ebx 80107f4c: 81 e3 00 f0 ff ff and $0xfffff000,%ebx int deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 80107f52: 83 ec 1c sub $0x1c,%esp 80107f55: 89 4d e0 mov %ecx,-0x20(%ebp) for (; a < oldsz; a += PGSIZE) { 80107f58: 39 d3 cmp %edx,%ebx 80107f5a: 73 49 jae 80107fa5 80107f5c: 89 c7 mov %eax,%edi 80107f5e: eb 0c jmp 80107f6c pte = walkpgdir(pgdir, (char*)a, 0); if (!pte) { a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; 80107f60: 83 c0 01 add $0x1,%eax 80107f63: c1 e0 16 shl $0x16,%eax 80107f66: 89 c3 mov %eax,%ebx for (; a < oldsz; a += PGSIZE) { 80107f68: 39 da cmp %ebx,%edx 80107f6a: 76 39 jbe 80107fa5 pde = &pgdir[PDX(va)]; 80107f6c: 89 d8 mov %ebx,%eax 80107f6e: c1 e8 16 shr $0x16,%eax if (*pde & PTE_P) { 80107f71: 8b 0c 87 mov (%edi,%eax,4),%ecx 80107f74: f6 c1 01 test $0x1,%cl 80107f77: 74 e7 je 80107f60 return &pgtab[PTX(va)]; 80107f79: 89 de mov %ebx,%esi pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 80107f7b: 81 e1 00 f0 ff ff and $0xfffff000,%ecx return &pgtab[PTX(va)]; 80107f81: c1 ee 0a shr $0xa,%esi 80107f84: 81 e6 fc 0f 00 00 and $0xffc,%esi 80107f8a: 8d b4 31 00 00 00 80 lea -0x80000000(%ecx,%esi,1),%esi if (!pte) { 80107f91: 85 f6 test %esi,%esi 80107f93: 74 cb je 80107f60 } else if ((*pte & PTE_P) != 0) { 80107f95: 8b 06 mov (%esi),%eax 80107f97: a8 01 test $0x1,%al 80107f99: 75 15 jne 80107fb0 for (; a < oldsz; a += PGSIZE) { 80107f9b: 81 c3 00 10 00 00 add $0x1000,%ebx 80107fa1: 39 da cmp %ebx,%edx 80107fa3: 77 c7 ja 80107f6c kfree(v); *pte = 0; } } return newsz; } 80107fa5: 8b 45 e0 mov -0x20(%ebp),%eax 80107fa8: 8d 65 f4 lea -0xc(%ebp),%esp 80107fab: 5b pop %ebx 80107fac: 5e pop %esi 80107fad: 5f pop %edi 80107fae: 5d pop %ebp 80107faf: c3 ret if (pa == 0) { 80107fb0: 25 00 f0 ff ff and $0xfffff000,%eax 80107fb5: 74 25 je 80107fdc kfree(v); 80107fb7: 83 ec 0c sub $0xc,%esp char *v = P2V(pa); 80107fba: 05 00 00 00 80 add $0x80000000,%eax 80107fbf: 89 55 e4 mov %edx,-0x1c(%ebp) for (; a < oldsz; a += PGSIZE) { 80107fc2: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(v); 80107fc8: 50 push %eax 80107fc9: e8 e2 b9 ff ff call 801039b0 *pte = 0; 80107fce: c7 06 00 00 00 00 movl $0x0,(%esi) for (; a < oldsz; a += PGSIZE) { 80107fd4: 8b 55 e4 mov -0x1c(%ebp),%edx 80107fd7: 83 c4 10 add $0x10,%esp 80107fda: eb 8c jmp 80107f68 panic("kfree"); 80107fdc: 83 ec 0c sub $0xc,%esp 80107fdf: 68 86 8c 10 80 push $0x80108c86 80107fe4: e8 97 84 ff ff call 80100480 80107fe9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80107ff0 : static int mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm) { 80107ff0: 55 push %ebp 80107ff1: 89 e5 mov %esp,%ebp 80107ff3: 57 push %edi 80107ff4: 56 push %esi 80107ff5: 53 push %ebx a = (char*)PGROUNDDOWN((uint)va); 80107ff6: 89 d3 mov %edx,%ebx 80107ff8: 81 e3 00 f0 ff ff and $0xfffff000,%ebx static int mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm) { 80107ffe: 83 ec 1c sub $0x1c,%esp 80108001: 89 45 e4 mov %eax,-0x1c(%ebp) last = (char*)PGROUNDDOWN(((uint)va) + size - 1); 80108004: 8d 44 0a ff lea -0x1(%edx,%ecx,1),%eax 80108008: 25 00 f0 ff ff and $0xfffff000,%eax 8010800d: 89 45 dc mov %eax,-0x24(%ebp) 80108010: 8b 45 08 mov 0x8(%ebp),%eax 80108013: 29 d8 sub %ebx,%eax 80108015: 89 45 e0 mov %eax,-0x20(%ebp) 80108018: eb 3d jmp 80108057 8010801a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return &pgtab[PTX(va)]; 80108020: 89 da mov %ebx,%edx pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 80108022: 25 00 f0 ff ff and $0xfffff000,%eax return &pgtab[PTX(va)]; 80108027: c1 ea 0a shr $0xa,%edx 8010802a: 81 e2 fc 0f 00 00 and $0xffc,%edx 80108030: 8d 84 10 00 00 00 80 lea -0x80000000(%eax,%edx,1),%eax if ((pte = walkpgdir(pgdir, a, 1)) == 0) { 80108037: 85 c0 test %eax,%eax 80108039: 74 75 je 801080b0 if (*pte & PTE_P) { 8010803b: f6 00 01 testb $0x1,(%eax) 8010803e: 0f 85 86 00 00 00 jne 801080ca *pte = pa | perm | PTE_P; 80108044: 0b 75 0c or 0xc(%ebp),%esi 80108047: 83 ce 01 or $0x1,%esi 8010804a: 89 30 mov %esi,(%eax) if (a == last) { 8010804c: 3b 5d dc cmp -0x24(%ebp),%ebx 8010804f: 74 6f je 801080c0 a += PGSIZE; 80108051: 81 c3 00 10 00 00 add $0x1000,%ebx for (;;) { 80108057: 8b 45 e0 mov -0x20(%ebp),%eax pde = &pgdir[PDX(va)]; 8010805a: 8b 4d e4 mov -0x1c(%ebp),%ecx 8010805d: 8d 34 18 lea (%eax,%ebx,1),%esi 80108060: 89 d8 mov %ebx,%eax 80108062: c1 e8 16 shr $0x16,%eax 80108065: 8d 3c 81 lea (%ecx,%eax,4),%edi if (*pde & PTE_P) { 80108068: 8b 07 mov (%edi),%eax 8010806a: a8 01 test $0x1,%al 8010806c: 75 b2 jne 80108020 if (!alloc || (pgtab = (pte_t*)kalloc()) == 0) { 8010806e: e8 fd ba ff ff call 80103b70 80108073: 85 c0 test %eax,%eax 80108075: 74 39 je 801080b0 memset(pgtab, 0, PGSIZE); 80108077: 83 ec 04 sub $0x4,%esp 8010807a: 89 45 d8 mov %eax,-0x28(%ebp) 8010807d: 68 00 10 00 00 push $0x1000 80108082: 6a 00 push $0x0 80108084: 50 push %eax 80108085: e8 b6 db ff ff call 80105c40 *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; 8010808a: 8b 55 d8 mov -0x28(%ebp),%edx return &pgtab[PTX(va)]; 8010808d: 83 c4 10 add $0x10,%esp *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; 80108090: 8d 82 00 00 00 80 lea -0x80000000(%edx),%eax 80108096: 83 c8 07 or $0x7,%eax 80108099: 89 07 mov %eax,(%edi) return &pgtab[PTX(va)]; 8010809b: 89 d8 mov %ebx,%eax 8010809d: c1 e8 0a shr $0xa,%eax 801080a0: 25 fc 0f 00 00 and $0xffc,%eax 801080a5: 01 d0 add %edx,%eax 801080a7: eb 92 jmp 8010803b 801080a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } 801080b0: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 801080b3: b8 ff ff ff ff mov $0xffffffff,%eax } 801080b8: 5b pop %ebx 801080b9: 5e pop %esi 801080ba: 5f pop %edi 801080bb: 5d pop %ebp 801080bc: c3 ret 801080bd: 8d 76 00 lea 0x0(%esi),%esi 801080c0: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 801080c3: 31 c0 xor %eax,%eax } 801080c5: 5b pop %ebx 801080c6: 5e pop %esi 801080c7: 5f pop %edi 801080c8: 5d pop %ebp 801080c9: c3 ret panic("remap"); 801080ca: 83 ec 0c sub $0xc,%esp 801080cd: 68 04 94 10 80 push $0x80109404 801080d2: e8 a9 83 ff ff call 80100480 801080d7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801080de: 66 90 xchg %ax,%ax 801080e0 : void seginit(void) { 801080e0: 55 push %ebp 801080e1: 89 e5 mov %esp,%ebp 801080e3: 83 ec 18 sub $0x18,%esp c = &cpus[cpuid()]; 801080e6: e8 a5 cd ff ff call 80104e90 pd[0] = size - 1; 801080eb: ba 2f 00 00 00 mov $0x2f,%edx 801080f0: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax 801080f6: 66 89 55 f2 mov %dx,-0xe(%ebp) c->gdt[SEG_KCODE] = SEG(STA_X | STA_R, 0, 0xffffffff, 0); 801080fa: c7 80 98 df 11 80 ff movl $0xffff,-0x7fee2068(%eax) 80108101: ff 00 00 80108104: c7 80 9c df 11 80 00 movl $0xcf9a00,-0x7fee2064(%eax) 8010810b: 9a cf 00 c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); 8010810e: c7 80 a0 df 11 80 ff movl $0xffff,-0x7fee2060(%eax) 80108115: ff 00 00 80108118: c7 80 a4 df 11 80 00 movl $0xcf9200,-0x7fee205c(%eax) 8010811f: 92 cf 00 c->gdt[SEG_UCODE] = SEG(STA_X | STA_R, 0, 0xffffffff, DPL_USER); 80108122: c7 80 a8 df 11 80 ff movl $0xffff,-0x7fee2058(%eax) 80108129: ff 00 00 8010812c: c7 80 ac df 11 80 00 movl $0xcffa00,-0x7fee2054(%eax) 80108133: fa cf 00 c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); 80108136: c7 80 b0 df 11 80 ff movl $0xffff,-0x7fee2050(%eax) 8010813d: ff 00 00 80108140: c7 80 b4 df 11 80 00 movl $0xcff200,-0x7fee204c(%eax) 80108147: f2 cf 00 lgdt(c->gdt, sizeof(c->gdt)); 8010814a: 05 90 df 11 80 add $0x8011df90,%eax pd[1] = (uint)p; 8010814f: 66 89 45 f4 mov %ax,-0xc(%ebp) pd[2] = (uint)p >> 16; 80108153: c1 e8 10 shr $0x10,%eax 80108156: 66 89 45 f6 mov %ax,-0xa(%ebp) asm volatile ("lgdt (%0)" : : "r" (pd)); 8010815a: 8d 45 f2 lea -0xe(%ebp),%eax 8010815d: 0f 01 10 lgdtl (%eax) } 80108160: c9 leave 80108161: c3 ret 80108162: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80108169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80108170 : lcr3(V2P(kpgdir)); // switch to the kernel page table 80108170: a1 44 12 12 80 mov 0x80121244,%eax 80108175: 05 00 00 00 80 add $0x80000000,%eax return val; } static inline void lcr3(uint val) { asm volatile ("movl %0,%%cr3" : : "r" (val)); 8010817a: 0f 22 d8 mov %eax,%cr3 } 8010817d: c3 ret 8010817e: 66 90 xchg %ax,%ax 80108180 : void switchuvm(struct proc *p) { 80108180: 55 push %ebp 80108181: 89 e5 mov %esp,%ebp 80108183: 57 push %edi 80108184: 56 push %esi 80108185: 53 push %ebx 80108186: 83 ec 1c sub $0x1c,%esp 80108189: 8b 75 08 mov 0x8(%ebp),%esi if (p == 0) { 8010818c: 85 f6 test %esi,%esi 8010818e: 0f 84 cb 00 00 00 je 8010825f if (p->kstack == 0) { 80108194: 8b 46 08 mov 0x8(%esi),%eax 80108197: 85 c0 test %eax,%eax 80108199: 0f 84 da 00 00 00 je 80108279 if (p->pgdir == 0) { 8010819f: 8b 46 04 mov 0x4(%esi),%eax 801081a2: 85 c0 test %eax,%eax 801081a4: 0f 84 c2 00 00 00 je 8010826c pushcli(); 801081aa: e8 81 d8 ff ff call 80105a30 mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, 801081af: e8 7c cc ff ff call 80104e30 801081b4: 89 c3 mov %eax,%ebx 801081b6: e8 75 cc ff ff call 80104e30 801081bb: 89 c7 mov %eax,%edi 801081bd: e8 6e cc ff ff call 80104e30 801081c2: 83 c7 08 add $0x8,%edi 801081c5: 89 45 e4 mov %eax,-0x1c(%ebp) 801081c8: e8 63 cc ff ff call 80104e30 801081cd: 8b 4d e4 mov -0x1c(%ebp),%ecx 801081d0: ba 67 00 00 00 mov $0x67,%edx 801081d5: 66 89 bb 9a 00 00 00 mov %di,0x9a(%ebx) 801081dc: 83 c0 08 add $0x8,%eax 801081df: 66 89 93 98 00 00 00 mov %dx,0x98(%ebx) mycpu()->ts.iomb = (ushort) 0xFFFF; 801081e6: bf ff ff ff ff mov $0xffffffff,%edi mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, 801081eb: 83 c1 08 add $0x8,%ecx 801081ee: c1 e8 18 shr $0x18,%eax 801081f1: c1 e9 10 shr $0x10,%ecx 801081f4: 88 83 9f 00 00 00 mov %al,0x9f(%ebx) 801081fa: 88 8b 9c 00 00 00 mov %cl,0x9c(%ebx) 80108200: b9 99 40 00 00 mov $0x4099,%ecx 80108205: 66 89 8b 9d 00 00 00 mov %cx,0x9d(%ebx) mycpu()->ts.ss0 = SEG_KDATA << 3; 8010820c: bb 10 00 00 00 mov $0x10,%ebx mycpu()->gdt[SEG_TSS].s = 0; 80108211: e8 1a cc ff ff call 80104e30 80108216: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax) mycpu()->ts.ss0 = SEG_KDATA << 3; 8010821d: e8 0e cc ff ff call 80104e30 80108222: 66 89 58 10 mov %bx,0x10(%eax) mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE; 80108226: 8b 5e 08 mov 0x8(%esi),%ebx 80108229: 81 c3 00 10 00 00 add $0x1000,%ebx 8010822f: e8 fc cb ff ff call 80104e30 80108234: 89 58 0c mov %ebx,0xc(%eax) mycpu()->ts.iomb = (ushort) 0xFFFF; 80108237: e8 f4 cb ff ff call 80104e30 8010823c: 66 89 78 6e mov %di,0x6e(%eax) asm volatile ("ltr %0" : : "r" (sel)); 80108240: b8 28 00 00 00 mov $0x28,%eax 80108245: 0f 00 d8 ltr %ax lcr3(V2P(p->pgdir)); // switch to process's address space 80108248: 8b 46 04 mov 0x4(%esi),%eax 8010824b: 05 00 00 00 80 add $0x80000000,%eax asm volatile ("movl %0,%%cr3" : : "r" (val)); 80108250: 0f 22 d8 mov %eax,%cr3 } 80108253: 8d 65 f4 lea -0xc(%ebp),%esp 80108256: 5b pop %ebx 80108257: 5e pop %esi 80108258: 5f pop %edi 80108259: 5d pop %ebp popcli(); 8010825a: e9 21 d8 ff ff jmp 80105a80 panic("switchuvm: no process"); 8010825f: 83 ec 0c sub $0xc,%esp 80108262: 68 0a 94 10 80 push $0x8010940a 80108267: e8 14 82 ff ff call 80100480 panic("switchuvm: no pgdir"); 8010826c: 83 ec 0c sub $0xc,%esp 8010826f: 68 35 94 10 80 push $0x80109435 80108274: e8 07 82 ff ff call 80100480 panic("switchuvm: no kstack"); 80108279: 83 ec 0c sub $0xc,%esp 8010827c: 68 20 94 10 80 push $0x80109420 80108281: e8 fa 81 ff ff call 80100480 80108286: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010828d: 8d 76 00 lea 0x0(%esi),%esi 80108290 : void inituvm(pde_t *pgdir, char *init, uint sz) { 80108290: 55 push %ebp 80108291: 89 e5 mov %esp,%ebp 80108293: 57 push %edi 80108294: 56 push %esi 80108295: 53 push %ebx 80108296: 83 ec 1c sub $0x1c,%esp 80108299: 8b 45 0c mov 0xc(%ebp),%eax 8010829c: 8b 75 10 mov 0x10(%ebp),%esi 8010829f: 8b 7d 08 mov 0x8(%ebp),%edi 801082a2: 89 45 e4 mov %eax,-0x1c(%ebp) if (sz >= PGSIZE) { 801082a5: 81 fe ff 0f 00 00 cmp $0xfff,%esi 801082ab: 77 4b ja 801082f8 mem = kalloc(); 801082ad: e8 be b8 ff ff call 80103b70 memset(mem, 0, PGSIZE); 801082b2: 83 ec 04 sub $0x4,%esp 801082b5: 68 00 10 00 00 push $0x1000 mem = kalloc(); 801082ba: 89 c3 mov %eax,%ebx memset(mem, 0, PGSIZE); 801082bc: 6a 00 push $0x0 801082be: 50 push %eax 801082bf: e8 7c d9 ff ff call 80105c40 mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W | PTE_U); 801082c4: 58 pop %eax 801082c5: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 801082cb: 5a pop %edx 801082cc: 6a 06 push $0x6 801082ce: b9 00 10 00 00 mov $0x1000,%ecx 801082d3: 31 d2 xor %edx,%edx 801082d5: 50 push %eax 801082d6: 89 f8 mov %edi,%eax 801082d8: e8 13 fd ff ff call 80107ff0 memmove(mem, init, sz); 801082dd: 8b 45 e4 mov -0x1c(%ebp),%eax 801082e0: 89 75 10 mov %esi,0x10(%ebp) 801082e3: 83 c4 10 add $0x10,%esp 801082e6: 89 5d 08 mov %ebx,0x8(%ebp) 801082e9: 89 45 0c mov %eax,0xc(%ebp) } 801082ec: 8d 65 f4 lea -0xc(%ebp),%esp 801082ef: 5b pop %ebx 801082f0: 5e pop %esi 801082f1: 5f pop %edi 801082f2: 5d pop %ebp memmove(mem, init, sz); 801082f3: e9 e8 d9 ff ff jmp 80105ce0 panic("inituvm: more than a page"); 801082f8: 83 ec 0c sub $0xc,%esp 801082fb: 68 49 94 10 80 push $0x80109449 80108300: e8 7b 81 ff ff call 80100480 80108305: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010830c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80108310 : int loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz) { 80108310: 55 push %ebp 80108311: 89 e5 mov %esp,%ebp 80108313: 57 push %edi 80108314: 56 push %esi 80108315: 53 push %ebx 80108316: 83 ec 1c sub $0x1c,%esp 80108319: 8b 45 0c mov 0xc(%ebp),%eax 8010831c: 8b 75 18 mov 0x18(%ebp),%esi if ((uint) addr % PGSIZE != 0) { 8010831f: a9 ff 0f 00 00 test $0xfff,%eax 80108324: 0f 85 bb 00 00 00 jne 801083e5 for (i = 0; i < sz; i += PGSIZE) { 8010832a: 01 f0 add %esi,%eax 8010832c: 89 f3 mov %esi,%ebx 8010832e: 89 45 e4 mov %eax,-0x1c(%ebp) if (readi(ip, P2V(pa), offset + i, n) != n) { 80108331: 8b 45 14 mov 0x14(%ebp),%eax 80108334: 01 f0 add %esi,%eax 80108336: 89 45 e0 mov %eax,-0x20(%ebp) for (i = 0; i < sz; i += PGSIZE) { 80108339: 85 f6 test %esi,%esi 8010833b: 0f 84 87 00 00 00 je 801083c8 80108341: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi pde = &pgdir[PDX(va)]; 80108348: 8b 45 e4 mov -0x1c(%ebp),%eax if (*pde & PTE_P) { 8010834b: 8b 4d 08 mov 0x8(%ebp),%ecx 8010834e: 29 d8 sub %ebx,%eax pde = &pgdir[PDX(va)]; 80108350: 89 c2 mov %eax,%edx 80108352: c1 ea 16 shr $0x16,%edx if (*pde & PTE_P) { 80108355: 8b 14 91 mov (%ecx,%edx,4),%edx 80108358: f6 c2 01 test $0x1,%dl 8010835b: 75 13 jne 80108370 panic("loaduvm: address should exist"); 8010835d: 83 ec 0c sub $0xc,%esp 80108360: 68 63 94 10 80 push $0x80109463 80108365: e8 16 81 ff ff call 80100480 8010836a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return &pgtab[PTX(va)]; 80108370: c1 e8 0a shr $0xa,%eax pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 80108373: 81 e2 00 f0 ff ff and $0xfffff000,%edx return &pgtab[PTX(va)]; 80108379: 25 fc 0f 00 00 and $0xffc,%eax 8010837e: 8d 84 02 00 00 00 80 lea -0x80000000(%edx,%eax,1),%eax if ((pte = walkpgdir(pgdir, addr + i, 0)) == 0) { 80108385: 85 c0 test %eax,%eax 80108387: 74 d4 je 8010835d pa = PTE_ADDR(*pte); 80108389: 8b 00 mov (%eax),%eax if (readi(ip, P2V(pa), offset + i, n) != n) { 8010838b: 8b 4d e0 mov -0x20(%ebp),%ecx if (sz - i < PGSIZE) { 8010838e: bf 00 10 00 00 mov $0x1000,%edi pa = PTE_ADDR(*pte); 80108393: 25 00 f0 ff ff and $0xfffff000,%eax if (sz - i < PGSIZE) { 80108398: 81 fb ff 0f 00 00 cmp $0xfff,%ebx 8010839e: 0f 46 fb cmovbe %ebx,%edi if (readi(ip, P2V(pa), offset + i, n) != n) { 801083a1: 29 d9 sub %ebx,%ecx 801083a3: 05 00 00 00 80 add $0x80000000,%eax 801083a8: 57 push %edi 801083a9: 51 push %ecx 801083aa: 50 push %eax 801083ab: ff 75 10 push 0x10(%ebp) 801083ae: e8 cd ab ff ff call 80102f80 801083b3: 83 c4 10 add $0x10,%esp 801083b6: 39 f8 cmp %edi,%eax 801083b8: 75 1e jne 801083d8 for (i = 0; i < sz; i += PGSIZE) { 801083ba: 81 eb 00 10 00 00 sub $0x1000,%ebx 801083c0: 89 f0 mov %esi,%eax 801083c2: 29 d8 sub %ebx,%eax 801083c4: 39 c6 cmp %eax,%esi 801083c6: 77 80 ja 80108348 } 801083c8: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 801083cb: 31 c0 xor %eax,%eax } 801083cd: 5b pop %ebx 801083ce: 5e pop %esi 801083cf: 5f pop %edi 801083d0: 5d pop %ebp 801083d1: c3 ret 801083d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801083d8: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 801083db: b8 ff ff ff ff mov $0xffffffff,%eax } 801083e0: 5b pop %ebx 801083e1: 5e pop %esi 801083e2: 5f pop %edi 801083e3: 5d pop %ebp 801083e4: c3 ret panic("loaduvm: addr must be page aligned"); 801083e5: 83 ec 0c sub $0xc,%esp 801083e8: 68 04 95 10 80 push $0x80109504 801083ed: e8 8e 80 ff ff call 80100480 801083f2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801083f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80108400 : int allocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 80108400: 55 push %ebp 80108401: 89 e5 mov %esp,%ebp 80108403: 57 push %edi 80108404: 56 push %esi 80108405: 53 push %ebx 80108406: 83 ec 1c sub $0x1c,%esp if (newsz >= KERNBASE) { 80108409: 8b 45 10 mov 0x10(%ebp),%eax int allocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 8010840c: 8b 7d 08 mov 0x8(%ebp),%edi if (newsz >= KERNBASE) { 8010840f: 89 45 e4 mov %eax,-0x1c(%ebp) 80108412: 85 c0 test %eax,%eax 80108414: 0f 88 b6 00 00 00 js 801084d0 if (newsz < oldsz) { 8010841a: 3b 45 0c cmp 0xc(%ebp),%eax return oldsz; 8010841d: 8b 45 0c mov 0xc(%ebp),%eax if (newsz < oldsz) { 80108420: 0f 82 9a 00 00 00 jb 801084c0 a = PGROUNDUP(oldsz); 80108426: 8d b0 ff 0f 00 00 lea 0xfff(%eax),%esi 8010842c: 81 e6 00 f0 ff ff and $0xfffff000,%esi for (; a < newsz; a += PGSIZE) { 80108432: 39 75 10 cmp %esi,0x10(%ebp) 80108435: 77 44 ja 8010847b 80108437: e9 87 00 00 00 jmp 801084c3 8010843c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi memset(mem, 0, PGSIZE); 80108440: 83 ec 04 sub $0x4,%esp 80108443: 68 00 10 00 00 push $0x1000 80108448: 6a 00 push $0x0 8010844a: 50 push %eax 8010844b: e8 f0 d7 ff ff call 80105c40 if (mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W | PTE_U) < 0) { 80108450: 58 pop %eax 80108451: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 80108457: 5a pop %edx 80108458: 6a 06 push $0x6 8010845a: b9 00 10 00 00 mov $0x1000,%ecx 8010845f: 89 f2 mov %esi,%edx 80108461: 50 push %eax 80108462: 89 f8 mov %edi,%eax 80108464: e8 87 fb ff ff call 80107ff0 80108469: 83 c4 10 add $0x10,%esp 8010846c: 85 c0 test %eax,%eax 8010846e: 78 78 js 801084e8 for (; a < newsz; a += PGSIZE) { 80108470: 81 c6 00 10 00 00 add $0x1000,%esi 80108476: 39 75 10 cmp %esi,0x10(%ebp) 80108479: 76 48 jbe 801084c3 mem = kalloc(); 8010847b: e8 f0 b6 ff ff call 80103b70 80108480: 89 c3 mov %eax,%ebx if (mem == 0) { 80108482: 85 c0 test %eax,%eax 80108484: 75 ba jne 80108440 cprintf("allocuvm out of memory\n"); 80108486: 83 ec 0c sub $0xc,%esp 80108489: 68 81 94 10 80 push $0x80109481 8010848e: e8 fd 83 ff ff call 80100890 if (newsz >= oldsz) { 80108493: 8b 45 0c mov 0xc(%ebp),%eax 80108496: 83 c4 10 add $0x10,%esp 80108499: 39 45 10 cmp %eax,0x10(%ebp) 8010849c: 74 32 je 801084d0 8010849e: 8b 55 10 mov 0x10(%ebp),%edx 801084a1: 89 c1 mov %eax,%ecx 801084a3: 89 f8 mov %edi,%eax 801084a5: e8 96 fa ff ff call 80107f40 return 0; 801084aa: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) } 801084b1: 8b 45 e4 mov -0x1c(%ebp),%eax 801084b4: 8d 65 f4 lea -0xc(%ebp),%esp 801084b7: 5b pop %ebx 801084b8: 5e pop %esi 801084b9: 5f pop %edi 801084ba: 5d pop %ebp 801084bb: c3 ret 801084bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return oldsz; 801084c0: 89 45 e4 mov %eax,-0x1c(%ebp) } 801084c3: 8b 45 e4 mov -0x1c(%ebp),%eax 801084c6: 8d 65 f4 lea -0xc(%ebp),%esp 801084c9: 5b pop %ebx 801084ca: 5e pop %esi 801084cb: 5f pop %edi 801084cc: 5d pop %ebp 801084cd: c3 ret 801084ce: 66 90 xchg %ax,%ax return 0; 801084d0: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) } 801084d7: 8b 45 e4 mov -0x1c(%ebp),%eax 801084da: 8d 65 f4 lea -0xc(%ebp),%esp 801084dd: 5b pop %ebx 801084de: 5e pop %esi 801084df: 5f pop %edi 801084e0: 5d pop %ebp 801084e1: c3 ret 801084e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cprintf("allocuvm out of memory (2)\n"); 801084e8: 83 ec 0c sub $0xc,%esp 801084eb: 68 99 94 10 80 push $0x80109499 801084f0: e8 9b 83 ff ff call 80100890 if (newsz >= oldsz) { 801084f5: 8b 45 0c mov 0xc(%ebp),%eax 801084f8: 83 c4 10 add $0x10,%esp 801084fb: 39 45 10 cmp %eax,0x10(%ebp) 801084fe: 74 0c je 8010850c 80108500: 8b 55 10 mov 0x10(%ebp),%edx 80108503: 89 c1 mov %eax,%ecx 80108505: 89 f8 mov %edi,%eax 80108507: e8 34 fa ff ff call 80107f40 kfree(mem); 8010850c: 83 ec 0c sub $0xc,%esp 8010850f: 53 push %ebx 80108510: e8 9b b4 ff ff call 801039b0 return 0; 80108515: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 8010851c: 83 c4 10 add $0x10,%esp } 8010851f: 8b 45 e4 mov -0x1c(%ebp),%eax 80108522: 8d 65 f4 lea -0xc(%ebp),%esp 80108525: 5b pop %ebx 80108526: 5e pop %esi 80108527: 5f pop %edi 80108528: 5d pop %ebp 80108529: c3 ret 8010852a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80108530 : int deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) { 80108530: 55 push %ebp 80108531: 89 e5 mov %esp,%ebp 80108533: 8b 55 0c mov 0xc(%ebp),%edx 80108536: 8b 4d 10 mov 0x10(%ebp),%ecx 80108539: 8b 45 08 mov 0x8(%ebp),%eax if (newsz >= oldsz) { 8010853c: 39 d1 cmp %edx,%ecx 8010853e: 73 10 jae 80108550 } 80108540: 5d pop %ebp 80108541: e9 fa f9 ff ff jmp 80107f40 80108546: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010854d: 8d 76 00 lea 0x0(%esi),%esi 80108550: 89 d0 mov %edx,%eax 80108552: 5d pop %ebp 80108553: c3 ret 80108554: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010855b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010855f: 90 nop 80108560 : // Free a page table and all the physical memory pages // in the user part. void freevm(pde_t *pgdir) { 80108560: 55 push %ebp 80108561: 89 e5 mov %esp,%ebp 80108563: 57 push %edi 80108564: 56 push %esi 80108565: 53 push %ebx 80108566: 83 ec 0c sub $0xc,%esp 80108569: 8b 75 08 mov 0x8(%ebp),%esi uint i; if (pgdir == 0) { 8010856c: 85 f6 test %esi,%esi 8010856e: 74 59 je 801085c9 if (newsz >= oldsz) { 80108570: 31 c9 xor %ecx,%ecx 80108572: ba 00 00 00 80 mov $0x80000000,%edx 80108577: 89 f0 mov %esi,%eax 80108579: 89 f3 mov %esi,%ebx 8010857b: e8 c0 f9 ff ff call 80107f40 panic("freevm: no pgdir"); } deallocuvm(pgdir, KERNBASE, 0); for (i = 0; i < NPDENTRIES; i++) { 80108580: 8d be 00 10 00 00 lea 0x1000(%esi),%edi 80108586: eb 0f jmp 80108597 80108588: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010858f: 90 nop 80108590: 83 c3 04 add $0x4,%ebx 80108593: 39 df cmp %ebx,%edi 80108595: 74 23 je 801085ba if (pgdir[i] & PTE_P) { 80108597: 8b 03 mov (%ebx),%eax 80108599: a8 01 test $0x1,%al 8010859b: 74 f3 je 80108590 char * v = P2V(PTE_ADDR(pgdir[i])); 8010859d: 25 00 f0 ff ff and $0xfffff000,%eax kfree(v); 801085a2: 83 ec 0c sub $0xc,%esp for (i = 0; i < NPDENTRIES; i++) { 801085a5: 83 c3 04 add $0x4,%ebx char * v = P2V(PTE_ADDR(pgdir[i])); 801085a8: 05 00 00 00 80 add $0x80000000,%eax kfree(v); 801085ad: 50 push %eax 801085ae: e8 fd b3 ff ff call 801039b0 801085b3: 83 c4 10 add $0x10,%esp for (i = 0; i < NPDENTRIES; i++) { 801085b6: 39 df cmp %ebx,%edi 801085b8: 75 dd jne 80108597 } } kfree((char*)pgdir); 801085ba: 89 75 08 mov %esi,0x8(%ebp) } 801085bd: 8d 65 f4 lea -0xc(%ebp),%esp 801085c0: 5b pop %ebx 801085c1: 5e pop %esi 801085c2: 5f pop %edi 801085c3: 5d pop %ebp kfree((char*)pgdir); 801085c4: e9 e7 b3 ff ff jmp 801039b0 panic("freevm: no pgdir"); 801085c9: 83 ec 0c sub $0xc,%esp 801085cc: 68 b5 94 10 80 push $0x801094b5 801085d1: e8 aa 7e ff ff call 80100480 801085d6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801085dd: 8d 76 00 lea 0x0(%esi),%esi 801085e0 : pde_t*setupkvm(void) { 801085e0: 55 push %ebp 801085e1: 89 e5 mov %esp,%ebp 801085e3: 56 push %esi 801085e4: 53 push %ebx if ((pgdir = (pde_t*)kalloc()) == 0) { 801085e5: e8 86 b5 ff ff call 80103b70 801085ea: 89 c6 mov %eax,%esi 801085ec: 85 c0 test %eax,%eax 801085ee: 74 42 je 80108632 memset(pgdir, 0, PGSIZE); 801085f0: 83 ec 04 sub $0x4,%esp for (k = kmap; k < &kmap[NELEM(kmap)]; k++) { 801085f3: bb 20 c4 10 80 mov $0x8010c420,%ebx memset(pgdir, 0, PGSIZE); 801085f8: 68 00 10 00 00 push $0x1000 801085fd: 6a 00 push $0x0 801085ff: 50 push %eax 80108600: e8 3b d6 ff ff call 80105c40 80108605: 83 c4 10 add $0x10,%esp (uint)k->phys_start, k->perm) < 0) { 80108608: 8b 43 04 mov 0x4(%ebx),%eax if (mappages(pgdir, k->virt, k->phys_end - k->phys_start, 8010860b: 83 ec 08 sub $0x8,%esp 8010860e: 8b 4b 08 mov 0x8(%ebx),%ecx 80108611: ff 73 0c push 0xc(%ebx) 80108614: 8b 13 mov (%ebx),%edx 80108616: 50 push %eax 80108617: 29 c1 sub %eax,%ecx 80108619: 89 f0 mov %esi,%eax 8010861b: e8 d0 f9 ff ff call 80107ff0 80108620: 83 c4 10 add $0x10,%esp 80108623: 85 c0 test %eax,%eax 80108625: 78 19 js 80108640 for (k = kmap; k < &kmap[NELEM(kmap)]; k++) { 80108627: 83 c3 10 add $0x10,%ebx 8010862a: 81 fb 60 c4 10 80 cmp $0x8010c460,%ebx 80108630: 75 d6 jne 80108608 } 80108632: 8d 65 f8 lea -0x8(%ebp),%esp 80108635: 89 f0 mov %esi,%eax 80108637: 5b pop %ebx 80108638: 5e pop %esi 80108639: 5d pop %ebp 8010863a: c3 ret 8010863b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010863f: 90 nop freevm(pgdir); 80108640: 83 ec 0c sub $0xc,%esp 80108643: 56 push %esi return 0; 80108644: 31 f6 xor %esi,%esi freevm(pgdir); 80108646: e8 15 ff ff ff call 80108560 return 0; 8010864b: 83 c4 10 add $0x10,%esp } 8010864e: 8d 65 f8 lea -0x8(%ebp),%esp 80108651: 89 f0 mov %esi,%eax 80108653: 5b pop %ebx 80108654: 5e pop %esi 80108655: 5d pop %ebp 80108656: c3 ret 80108657: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010865e: 66 90 xchg %ax,%ax 80108660 : void kvmalloc(void) { 80108660: 55 push %ebp 80108661: 89 e5 mov %esp,%ebp 80108663: 83 ec 08 sub $0x8,%esp kpgdir = setupkvm(); 80108666: e8 75 ff ff ff call 801085e0 8010866b: a3 44 12 12 80 mov %eax,0x80121244 lcr3(V2P(kpgdir)); // switch to the kernel page table 80108670: 05 00 00 00 80 add $0x80000000,%eax 80108675: 0f 22 d8 mov %eax,%cr3 } 80108678: c9 leave 80108679: c3 ret 8010867a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80108680 : // Clear PTE_U on a page. Used to create an inaccessible // page beneath the user stack. void clearpteu(pde_t *pgdir, char *uva) { 80108680: 55 push %ebp 80108681: 89 e5 mov %esp,%ebp 80108683: 83 ec 08 sub $0x8,%esp 80108686: 8b 45 0c mov 0xc(%ebp),%eax if (*pde & PTE_P) { 80108689: 8b 55 08 mov 0x8(%ebp),%edx pde = &pgdir[PDX(va)]; 8010868c: 89 c1 mov %eax,%ecx 8010868e: c1 e9 16 shr $0x16,%ecx if (*pde & PTE_P) { 80108691: 8b 14 8a mov (%edx,%ecx,4),%edx 80108694: f6 c2 01 test $0x1,%dl 80108697: 75 17 jne 801086b0 pte_t *pte; pte = walkpgdir(pgdir, uva, 0); if (pte == 0) { panic("clearpteu"); 80108699: 83 ec 0c sub $0xc,%esp 8010869c: 68 c6 94 10 80 push $0x801094c6 801086a1: e8 da 7d ff ff call 80100480 801086a6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801086ad: 8d 76 00 lea 0x0(%esi),%esi return &pgtab[PTX(va)]; 801086b0: c1 e8 0a shr $0xa,%eax pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 801086b3: 81 e2 00 f0 ff ff and $0xfffff000,%edx return &pgtab[PTX(va)]; 801086b9: 25 fc 0f 00 00 and $0xffc,%eax 801086be: 8d 84 02 00 00 00 80 lea -0x80000000(%edx,%eax,1),%eax if (pte == 0) { 801086c5: 85 c0 test %eax,%eax 801086c7: 74 d0 je 80108699 } *pte &= ~PTE_U; 801086c9: 83 20 fb andl $0xfffffffb,(%eax) } 801086cc: c9 leave 801086cd: c3 ret 801086ce: 66 90 xchg %ax,%ax 801086d0 : // Given a parent process's page table, create a copy // of it for a child. pde_t* copyuvm(pde_t *pgdir, uint sz) { 801086d0: 55 push %ebp 801086d1: 89 e5 mov %esp,%ebp 801086d3: 57 push %edi 801086d4: 56 push %esi 801086d5: 53 push %ebx 801086d6: 83 ec 1c sub $0x1c,%esp pde_t *d; pte_t *pte; uint pa, i, flags; char *mem; if ((d = setupkvm()) == 0) { 801086d9: e8 02 ff ff ff call 801085e0 801086de: 89 45 e0 mov %eax,-0x20(%ebp) 801086e1: 85 c0 test %eax,%eax 801086e3: 0f 84 bd 00 00 00 je 801087a6 return 0; } for (i = 0; i < sz; i += PGSIZE) { 801086e9: 8b 5d 0c mov 0xc(%ebp),%ebx 801086ec: 85 db test %ebx,%ebx 801086ee: 0f 84 b2 00 00 00 je 801087a6 801086f4: 31 f6 xor %esi,%esi 801086f6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801086fd: 8d 76 00 lea 0x0(%esi),%esi if (*pde & PTE_P) { 80108700: 8b 4d 08 mov 0x8(%ebp),%ecx pde = &pgdir[PDX(va)]; 80108703: 89 f0 mov %esi,%eax 80108705: c1 e8 16 shr $0x16,%eax if (*pde & PTE_P) { 80108708: 8b 04 81 mov (%ecx,%eax,4),%eax 8010870b: a8 01 test $0x1,%al 8010870d: 75 11 jne 80108720 if ((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) { panic("copyuvm: pte should exist"); 8010870f: 83 ec 0c sub $0xc,%esp 80108712: 68 d0 94 10 80 push $0x801094d0 80108717: e8 64 7d ff ff call 80100480 8010871c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return &pgtab[PTX(va)]; 80108720: 89 f2 mov %esi,%edx pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 80108722: 25 00 f0 ff ff and $0xfffff000,%eax return &pgtab[PTX(va)]; 80108727: c1 ea 0a shr $0xa,%edx 8010872a: 81 e2 fc 0f 00 00 and $0xffc,%edx 80108730: 8d 84 10 00 00 00 80 lea -0x80000000(%eax,%edx,1),%eax if ((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) { 80108737: 85 c0 test %eax,%eax 80108739: 74 d4 je 8010870f } if (!(*pte & PTE_P)) { 8010873b: 8b 00 mov (%eax),%eax 8010873d: a8 01 test $0x1,%al 8010873f: 0f 84 c2 00 00 00 je 80108807 panic("copyuvm: page not present"); } pa = PTE_ADDR(*pte); 80108745: 89 c7 mov %eax,%edi flags = PTE_FLAGS(*pte); 80108747: 25 ff 0f 00 00 and $0xfff,%eax 8010874c: 89 45 e4 mov %eax,-0x1c(%ebp) pa = PTE_ADDR(*pte); 8010874f: 81 e7 00 f0 ff ff and $0xfffff000,%edi if ((mem = kalloc()) == 0) { 80108755: e8 16 b4 ff ff call 80103b70 8010875a: 89 c3 mov %eax,%ebx 8010875c: 85 c0 test %eax,%eax 8010875e: 74 58 je 801087b8 freevm(d); return 0; } memmove(mem, (char*)P2V(pa), PGSIZE); 80108760: 83 ec 04 sub $0x4,%esp 80108763: 81 c7 00 00 00 80 add $0x80000000,%edi 80108769: 68 00 10 00 00 push $0x1000 8010876e: 57 push %edi 8010876f: 50 push %eax 80108770: e8 6b d5 ff ff call 80105ce0 if (mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) { 80108775: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 8010877b: 5a pop %edx 8010877c: 59 pop %ecx 8010877d: ff 75 e4 push -0x1c(%ebp) 80108780: b9 00 10 00 00 mov $0x1000,%ecx 80108785: 89 f2 mov %esi,%edx 80108787: 50 push %eax 80108788: 8b 45 e0 mov -0x20(%ebp),%eax 8010878b: e8 60 f8 ff ff call 80107ff0 80108790: 83 c4 10 add $0x10,%esp 80108793: 85 c0 test %eax,%eax 80108795: 78 49 js 801087e0 for (i = 0; i < sz; i += PGSIZE) { 80108797: 81 c6 00 10 00 00 add $0x1000,%esi 8010879d: 39 75 0c cmp %esi,0xc(%ebp) 801087a0: 0f 87 5a ff ff ff ja 80108700 freevm(d); return 0; } } return d; } 801087a6: 8b 45 e0 mov -0x20(%ebp),%eax 801087a9: 8d 65 f4 lea -0xc(%ebp),%esp 801087ac: 5b pop %ebx 801087ad: 5e pop %esi 801087ae: 5f pop %edi 801087af: 5d pop %ebp 801087b0: c3 ret 801087b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi freevm(d); 801087b8: 83 ec 0c sub $0xc,%esp 801087bb: ff 75 e0 push -0x20(%ebp) 801087be: e8 9d fd ff ff call 80108560 return 0; 801087c3: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) 801087ca: 83 c4 10 add $0x10,%esp } 801087cd: 8b 45 e0 mov -0x20(%ebp),%eax 801087d0: 8d 65 f4 lea -0xc(%ebp),%esp 801087d3: 5b pop %ebx 801087d4: 5e pop %esi 801087d5: 5f pop %edi 801087d6: 5d pop %ebp 801087d7: c3 ret 801087d8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801087df: 90 nop kfree(mem); 801087e0: 83 ec 0c sub $0xc,%esp 801087e3: 53 push %ebx 801087e4: e8 c7 b1 ff ff call 801039b0 freevm(d); 801087e9: 58 pop %eax 801087ea: ff 75 e0 push -0x20(%ebp) 801087ed: e8 6e fd ff ff call 80108560 return 0; 801087f2: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp) 801087f9: 83 c4 10 add $0x10,%esp } 801087fc: 8b 45 e0 mov -0x20(%ebp),%eax 801087ff: 8d 65 f4 lea -0xc(%ebp),%esp 80108802: 5b pop %ebx 80108803: 5e pop %esi 80108804: 5f pop %edi 80108805: 5d pop %ebp 80108806: c3 ret panic("copyuvm: page not present"); 80108807: 83 ec 0c sub $0xc,%esp 8010880a: 68 ea 94 10 80 push $0x801094ea 8010880f: e8 6c 7c ff ff call 80100480 80108814: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010881b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010881f: 90 nop 80108820 : // Map user virtual address to kernel address. char*uva2ka(pde_t *pgdir, char *uva) { 80108820: 55 push %ebp 80108821: 89 e5 mov %esp,%ebp 80108823: 8b 45 0c mov 0xc(%ebp),%eax if (*pde & PTE_P) { 80108826: 8b 55 08 mov 0x8(%ebp),%edx pde = &pgdir[PDX(va)]; 80108829: 89 c1 mov %eax,%ecx 8010882b: c1 e9 16 shr $0x16,%ecx if (*pde & PTE_P) { 8010882e: 8b 14 8a mov (%edx,%ecx,4),%edx 80108831: f6 c2 01 test $0x1,%dl 80108834: 0f 84 00 01 00 00 je 8010893a return &pgtab[PTX(va)]; 8010883a: c1 e8 0c shr $0xc,%eax pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 8010883d: 81 e2 00 f0 ff ff and $0xfffff000,%edx } if ((*pte & PTE_U) == 0) { return 0; } return (char*)P2V(PTE_ADDR(*pte)); } 80108843: 5d pop %ebp return &pgtab[PTX(va)]; 80108844: 25 ff 03 00 00 and $0x3ff,%eax if ((*pte & PTE_P) == 0) { 80108849: 8b 84 82 00 00 00 80 mov -0x80000000(%edx,%eax,4),%eax if ((*pte & PTE_U) == 0) { 80108850: 89 c2 mov %eax,%edx return (char*)P2V(PTE_ADDR(*pte)); 80108852: 25 00 f0 ff ff and $0xfffff000,%eax if ((*pte & PTE_U) == 0) { 80108857: 83 e2 05 and $0x5,%edx return (char*)P2V(PTE_ADDR(*pte)); 8010885a: 05 00 00 00 80 add $0x80000000,%eax 8010885f: 83 fa 05 cmp $0x5,%edx 80108862: ba 00 00 00 00 mov $0x0,%edx 80108867: 0f 45 c2 cmovne %edx,%eax } 8010886a: c3 ret 8010886b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010886f: 90 nop 80108870 : // 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) { 80108870: 55 push %ebp 80108871: 89 e5 mov %esp,%ebp 80108873: 57 push %edi 80108874: 56 push %esi 80108875: 53 push %ebx 80108876: 83 ec 0c sub $0xc,%esp 80108879: 8b 75 14 mov 0x14(%ebp),%esi 8010887c: 8b 45 0c mov 0xc(%ebp),%eax 8010887f: 8b 55 10 mov 0x10(%ebp),%edx char *buf, *pa0; uint n, va0; buf = (char*)p; while (len > 0) { 80108882: 85 f6 test %esi,%esi 80108884: 75 51 jne 801088d7 80108886: e9 a5 00 00 00 jmp 80108930 8010888b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 8010888f: 90 nop return (char*)P2V(PTE_ADDR(*pte)); 80108890: 81 e3 00 f0 ff ff and $0xfffff000,%ebx 80108896: 8d 8b 00 00 00 80 lea -0x80000000(%ebx),%ecx va0 = (uint)PGROUNDDOWN(va); pa0 = uva2ka(pgdir, (char*)va0); if (pa0 == 0) { 8010889c: 81 fb 00 00 00 80 cmp $0x80000000,%ebx 801088a2: 74 75 je 80108919 return -1; } n = PGSIZE - (va - va0); 801088a4: 89 fb mov %edi,%ebx if (n > len) { n = len; } memmove(pa0 + (va - va0), buf, n); 801088a6: 89 55 10 mov %edx,0x10(%ebp) n = PGSIZE - (va - va0); 801088a9: 29 c3 sub %eax,%ebx 801088ab: 81 c3 00 10 00 00 add $0x1000,%ebx 801088b1: 39 f3 cmp %esi,%ebx 801088b3: 0f 47 de cmova %esi,%ebx memmove(pa0 + (va - va0), buf, n); 801088b6: 29 f8 sub %edi,%eax 801088b8: 83 ec 04 sub $0x4,%esp 801088bb: 01 c1 add %eax,%ecx 801088bd: 53 push %ebx 801088be: 52 push %edx 801088bf: 51 push %ecx 801088c0: e8 1b d4 ff ff call 80105ce0 len -= n; buf += n; 801088c5: 8b 55 10 mov 0x10(%ebp),%edx va = va0 + PGSIZE; 801088c8: 8d 87 00 10 00 00 lea 0x1000(%edi),%eax while (len > 0) { 801088ce: 83 c4 10 add $0x10,%esp buf += n; 801088d1: 01 da add %ebx,%edx while (len > 0) { 801088d3: 29 de sub %ebx,%esi 801088d5: 74 59 je 80108930 if (*pde & PTE_P) { 801088d7: 8b 5d 08 mov 0x8(%ebp),%ebx pde = &pgdir[PDX(va)]; 801088da: 89 c1 mov %eax,%ecx va0 = (uint)PGROUNDDOWN(va); 801088dc: 89 c7 mov %eax,%edi pde = &pgdir[PDX(va)]; 801088de: c1 e9 16 shr $0x16,%ecx va0 = (uint)PGROUNDDOWN(va); 801088e1: 81 e7 00 f0 ff ff and $0xfffff000,%edi if (*pde & PTE_P) { 801088e7: 8b 0c 8b mov (%ebx,%ecx,4),%ecx 801088ea: f6 c1 01 test $0x1,%cl 801088ed: 0f 84 4e 00 00 00 je 80108941 return &pgtab[PTX(va)]; 801088f3: 89 fb mov %edi,%ebx pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 801088f5: 81 e1 00 f0 ff ff and $0xfffff000,%ecx return &pgtab[PTX(va)]; 801088fb: c1 eb 0c shr $0xc,%ebx 801088fe: 81 e3 ff 03 00 00 and $0x3ff,%ebx if ((*pte & PTE_P) == 0) { 80108904: 8b 9c 99 00 00 00 80 mov -0x80000000(%ecx,%ebx,4),%ebx if ((*pte & PTE_U) == 0) { 8010890b: 89 d9 mov %ebx,%ecx 8010890d: 83 e1 05 and $0x5,%ecx 80108910: 83 f9 05 cmp $0x5,%ecx 80108913: 0f 84 77 ff ff ff je 80108890 } return 0; } 80108919: 8d 65 f4 lea -0xc(%ebp),%esp return -1; 8010891c: b8 ff ff ff ff mov $0xffffffff,%eax } 80108921: 5b pop %ebx 80108922: 5e pop %esi 80108923: 5f pop %edi 80108924: 5d pop %ebp 80108925: c3 ret 80108926: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8010892d: 8d 76 00 lea 0x0(%esi),%esi 80108930: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 80108933: 31 c0 xor %eax,%eax } 80108935: 5b pop %ebx 80108936: 5e pop %esi 80108937: 5f pop %edi 80108938: 5d pop %ebp 80108939: c3 ret 8010893a : if ((*pte & PTE_P) == 0) { 8010893a: a1 00 00 00 00 mov 0x0,%eax 8010893f: 0f 0b ud2 80108941 : 80108941: a1 00 00 00 00 mov 0x0,%eax 80108946: 0f 0b ud2