Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
16786 lines (15429 sloc) 557 KB
kernel: file format elf32-i386
Disassembly of section .text:
00100000 <binit>:
// bufhead->tail is least recently used.
struct buf bufhead;
void
binit(void)
{
100000: 55 push %ebp
100001: 89 e5 mov %esp,%ebp
100003: 83 ec 18 sub $0x18,%esp
struct buf *b;
initlock(&buf_table_lock, "buf_table");
100006: c7 44 24 04 20 60 10 movl $0x106020,0x4(%esp)
10000d: 00
10000e: c7 04 24 a0 8f 10 00 movl $0x108fa0,(%esp)
100015: e8 d6 3d 00 00 call 103df0 <initlock>
// bufhead->next is most recently used.
// bufhead->tail is least recently used.
struct buf bufhead;
void
binit(void)
10001a: ba 80 78 10 00 mov $0x107880,%edx
initlock(&buf_table_lock, "buf_table");
// Create linked list of buffers
bufhead.prev = &bufhead;
bufhead.next = &bufhead;
for(b = buf; b < buf+NBUF; b++){
10001f: b8 a0 7a 10 00 mov $0x107aa0,%eax
struct buf *b;
initlock(&buf_table_lock, "buf_table");
// Create linked list of buffers
bufhead.prev = &bufhead;
100024: c7 05 8c 78 10 00 80 movl $0x107880,0x10788c
10002b: 78 10 00
10002e: eb 04 jmp 100034 <binit+0x34>
bufhead.next = &bufhead;
for(b = buf; b < buf+NBUF; b++){
100030: 89 c2 mov %eax,%edx
100032: 89 c8 mov %ecx,%eax
100034: 8d 88 18 02 00 00 lea 0x218(%eax),%ecx
10003a: 81 f9 90 8f 10 00 cmp $0x108f90,%ecx
b->next = bufhead.next;
b->prev = &bufhead;
100040: c7 40 0c 80 78 10 00 movl $0x107880,0xc(%eax)
// Create linked list of buffers
bufhead.prev = &bufhead;
bufhead.next = &bufhead;
for(b = buf; b < buf+NBUF; b++){
b->next = bufhead.next;
100047: 89 50 10 mov %edx,0x10(%eax)
b->prev = &bufhead;
bufhead.next->prev = b;
10004a: 89 42 0c mov %eax,0xc(%edx)
initlock(&buf_table_lock, "buf_table");
// Create linked list of buffers
bufhead.prev = &bufhead;
bufhead.next = &bufhead;
for(b = buf; b < buf+NBUF; b++){
10004d: 75 e1 jne 100030 <binit+0x30>
10004f: c7 05 90 78 10 00 78 movl $0x108d78,0x107890
100056: 8d 10 00
b->next = bufhead.next;
b->prev = &bufhead;
bufhead.next->prev = b;
bufhead.next = b;
}
}
100059: c9 leave
10005a: c3 ret
10005b: 90 nop
10005c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00100060 <bread>:
}
// Return a B_BUSY buf with the contents of the indicated disk sector.
struct buf*
bread(uint dev, uint sector)
{
100060: 55 push %ebp
100061: 89 e5 mov %esp,%ebp
100063: 57 push %edi
100064: 56 push %esi
100065: 53 push %ebx
100066: 83 ec 1c sub $0x1c,%esp
100069: 8b 75 08 mov 0x8(%ebp),%esi
10006c: 8b 7d 0c mov 0xc(%ebp),%edi
static struct buf*
bget(uint dev, uint sector)
{
struct buf *b;
acquire(&buf_table_lock);
10006f: c7 04 24 a0 8f 10 00 movl $0x108fa0,(%esp)
100076: e8 75 3e 00 00 call 103ef0 <acquire>
loop:
// Try for cached block.
for(b = bufhead.next; b != &bufhead; b = b->next){
10007b: 8b 1d 90 78 10 00 mov 0x107890,%ebx
100081: 81 fb 80 78 10 00 cmp $0x107880,%ebx
100087: 75 12 jne 10009b <bread+0x3b>
100089: eb 3d jmp 1000c8 <bread+0x68>
10008b: 90 nop
10008c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
100090: 8b 5b 10 mov 0x10(%ebx),%ebx
100093: 81 fb 80 78 10 00 cmp $0x107880,%ebx
100099: 74 2d je 1000c8 <bread+0x68>
if((b->flags & (B_BUSY|B_VALID)) &&
10009b: 8b 03 mov (%ebx),%eax
10009d: a8 03 test $0x3,%al
10009f: 74 ef je 100090 <bread+0x30>
1000a1: 3b 73 04 cmp 0x4(%ebx),%esi
1000a4: 75 ea jne 100090 <bread+0x30>
b->dev == dev && b->sector == sector){
1000a6: 3b 7b 08 cmp 0x8(%ebx),%edi
1000a9: 75 e5 jne 100090 <bread+0x30>
if(b->flags & B_BUSY){
1000ab: a8 01 test $0x1,%al
1000ad: 8d 76 00 lea 0x0(%esi),%esi
1000b0: 74 71 je 100123 <bread+0xc3>
sleep(buf, &buf_table_lock);
1000b2: c7 44 24 04 a0 8f 10 movl $0x108fa0,0x4(%esp)
1000b9: 00
1000ba: c7 04 24 a0 7a 10 00 movl $0x107aa0,(%esp)
1000c1: e8 1a 38 00 00 call 1038e0 <sleep>
1000c6: eb b3 jmp 10007b <bread+0x1b>
return b;
}
}
// Allocate fresh block.
for(b = bufhead.prev; b != &bufhead; b = b->prev){
1000c8: 8b 1d 8c 78 10 00 mov 0x10788c,%ebx
1000ce: 81 fb 80 78 10 00 cmp $0x107880,%ebx
1000d4: 75 0d jne 1000e3 <bread+0x83>
1000d6: eb 3f jmp 100117 <bread+0xb7>
1000d8: 8b 5b 0c mov 0xc(%ebx),%ebx
1000db: 81 fb 80 78 10 00 cmp $0x107880,%ebx
1000e1: 74 34 je 100117 <bread+0xb7>
if((b->flags & B_BUSY) == 0){
1000e3: f6 03 01 testb $0x1,(%ebx)
1000e6: 75 f0 jne 1000d8 <bread+0x78>
b->flags = B_BUSY;
1000e8: c7 03 01 00 00 00 movl $0x1,(%ebx)
b->dev = dev;
1000ee: 89 73 04 mov %esi,0x4(%ebx)
b->sector = sector;
1000f1: 89 7b 08 mov %edi,0x8(%ebx)
release(&buf_table_lock);
1000f4: c7 04 24 a0 8f 10 00 movl $0x108fa0,(%esp)
1000fb: e8 e0 3e 00 00 call 103fe0 <release>
bread(uint dev, uint sector)
{
struct buf *b;
b = bget(dev, sector);
if(!(b->flags & B_VALID))
100100: f6 03 02 testb $0x2,(%ebx)
100103: 75 08 jne 10010d <bread+0xad>
ide_rw(b);
100105: 89 1c 24 mov %ebx,(%esp)
100108: e8 63 20 00 00 call 102170 <ide_rw>
return b;
}
10010d: 83 c4 1c add $0x1c,%esp
100110: 89 d8 mov %ebx,%eax
100112: 5b pop %ebx
100113: 5e pop %esi
100114: 5f pop %edi
100115: 5d pop %ebp
100116: c3 ret
b->sector = sector;
release(&buf_table_lock);
return b;
}
}
panic("bget: no buffers");
100117: c7 04 24 2a 60 10 00 movl $0x10602a,(%esp)
10011e: e8 dd 07 00 00 call 100900 <panic>
b->dev == dev && b->sector == sector){
if(b->flags & B_BUSY){
sleep(buf, &buf_table_lock);
goto loop;
}
b->flags |= B_BUSY;
100123: 83 c8 01 or $0x1,%eax
100126: 89 03 mov %eax,(%ebx)
release(&buf_table_lock);
100128: c7 04 24 a0 8f 10 00 movl $0x108fa0,(%esp)
10012f: e8 ac 3e 00 00 call 103fe0 <release>
100134: eb ca jmp 100100 <bread+0xa0>
100136: 8d 76 00 lea 0x0(%esi),%esi
100139: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00100140 <bwrite>:
}
// Write buf's contents to disk. Must be locked.
void
bwrite(struct buf *b)
{
100140: 55 push %ebp
100141: 89 e5 mov %esp,%ebp
100143: 83 ec 18 sub $0x18,%esp
100146: 8b 45 08 mov 0x8(%ebp),%eax
if((b->flags & B_BUSY) == 0)
100149: 8b 10 mov (%eax),%edx
10014b: f6 c2 01 test $0x1,%dl
10014e: 74 0e je 10015e <bwrite+0x1e>
panic("bwrite");
b->flags |= B_DIRTY;
100150: 83 ca 04 or $0x4,%edx
100153: 89 10 mov %edx,(%eax)
ide_rw(b);
100155: 89 45 08 mov %eax,0x8(%ebp)
}
100158: c9 leave
bwrite(struct buf *b)
{
if((b->flags & B_BUSY) == 0)
panic("bwrite");
b->flags |= B_DIRTY;
ide_rw(b);
100159: e9 12 20 00 00 jmp 102170 <ide_rw>
// Write buf's contents to disk. Must be locked.
void
bwrite(struct buf *b)
{
if((b->flags & B_BUSY) == 0)
panic("bwrite");
10015e: c7 04 24 3b 60 10 00 movl $0x10603b,(%esp)
100165: e8 96 07 00 00 call 100900 <panic>
10016a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00100170 <brelse>:
}
// Release the buffer buf.
void
brelse(struct buf *b)
{
100170: 55 push %ebp
100171: 89 e5 mov %esp,%ebp
100173: 53 push %ebx
100174: 83 ec 14 sub $0x14,%esp
100177: 8b 5d 08 mov 0x8(%ebp),%ebx
if((b->flags & B_BUSY) == 0)
10017a: f6 03 01 testb $0x1,(%ebx)
10017d: 74 58 je 1001d7 <brelse+0x67>
panic("brelse");
acquire(&buf_table_lock);
10017f: c7 04 24 a0 8f 10 00 movl $0x108fa0,(%esp)
100186: e8 65 3d 00 00 call 103ef0 <acquire>
b->next->prev = b->prev;
10018b: 8b 43 10 mov 0x10(%ebx),%eax
10018e: 8b 53 0c mov 0xc(%ebx),%edx
b->next = bufhead.next;
b->prev = &bufhead;
bufhead.next->prev = b;
bufhead.next = b;
b->flags &= ~B_BUSY;
100191: 83 23 fe andl $0xfffffffe,(%ebx)
if((b->flags & B_BUSY) == 0)
panic("brelse");
acquire(&buf_table_lock);
b->next->prev = b->prev;
100194: 89 50 0c mov %edx,0xc(%eax)
b->prev->next = b->next;
100197: 8b 53 0c mov 0xc(%ebx),%edx
b->next = bufhead.next;
b->prev = &bufhead;
10019a: c7 43 0c 80 78 10 00 movl $0x107880,0xc(%ebx)
panic("brelse");
acquire(&buf_table_lock);
b->next->prev = b->prev;
b->prev->next = b->next;
1001a1: 89 42 10 mov %eax,0x10(%edx)
b->next = bufhead.next;
1001a4: a1 90 78 10 00 mov 0x107890,%eax
1001a9: 89 43 10 mov %eax,0x10(%ebx)
b->prev = &bufhead;
bufhead.next->prev = b;
1001ac: a1 90 78 10 00 mov 0x107890,%eax
bufhead.next = b;
1001b1: 89 1d 90 78 10 00 mov %ebx,0x107890
b->next->prev = b->prev;
b->prev->next = b->next;
b->next = bufhead.next;
b->prev = &bufhead;
bufhead.next->prev = b;
1001b7: 89 58 0c mov %ebx,0xc(%eax)
bufhead.next = b;
b->flags &= ~B_BUSY;
wakeup(buf);
1001ba: c7 04 24 a0 7a 10 00 movl $0x107aa0,(%esp)
1001c1: e8 ea 37 00 00 call 1039b0 <wakeup>
release(&buf_table_lock);
1001c6: c7 45 08 a0 8f 10 00 movl $0x108fa0,0x8(%ebp)
}
1001cd: 83 c4 14 add $0x14,%esp
1001d0: 5b pop %ebx
1001d1: 5d pop %ebp
bufhead.next = b;
b->flags &= ~B_BUSY;
wakeup(buf);
release(&buf_table_lock);
1001d2: e9 09 3e 00 00 jmp 103fe0 <release>
// Release the buffer buf.
void
brelse(struct buf *b)
{
if((b->flags & B_BUSY) == 0)
panic("brelse");
1001d7: c7 04 24 42 60 10 00 movl $0x106042,(%esp)
1001de: e8 1d 07 00 00 call 100900 <panic>
1001e3: 90 nop
1001e4: 90 nop
1001e5: 90 nop
1001e6: 90 nop
1001e7: 90 nop
1001e8: 90 nop
1001e9: 90 nop
1001ea: 90 nop
1001eb: 90 nop
1001ec: 90 nop
1001ed: 90 nop
1001ee: 90 nop
1001ef: 90 nop
001001f0 <console_read>:
release(&input.lock);
}
int
console_read(struct inode *ip, char *dst, int n)
{
1001f0: 55 push %ebp
1001f1: 89 e5 mov %esp,%ebp
1001f3: 57 push %edi
1001f4: 56 push %esi
1001f5: 53 push %ebx
1001f6: 83 ec 2c sub $0x2c,%esp
1001f9: 8b 5d 10 mov 0x10(%ebp),%ebx
1001fc: 8b 75 08 mov 0x8(%ebp),%esi
uint target;
int c;
iunlock(ip);
1001ff: 89 34 24 mov %esi,(%esp)
100202: e8 09 14 00 00 call 101610 <iunlock>
target = n;
100207: 89 5d e4 mov %ebx,-0x1c(%ebp)
acquire(&input.lock);
10020a: c7 04 24 e0 8f 10 00 movl $0x108fe0,(%esp)
100211: e8 da 3c 00 00 call 103ef0 <acquire>
while(n > 0){
100216: 85 db test %ebx,%ebx
100218: 7f 26 jg 100240 <console_read+0x50>
10021a: e9 c3 00 00 00 jmp 1002e2 <console_read+0xf2>
10021f: 90 nop
while(input.r == input.w){
if(cp->killed){
100220: e8 eb 33 00 00 call 103610 <curproc>
100225: 8b 40 1c mov 0x1c(%eax),%eax
100228: 85 c0 test %eax,%eax
10022a: 75 64 jne 100290 <console_read+0xa0>
release(&input.lock);
ilock(ip);
return -1;
}
sleep(&input.r, &input.lock);
10022c: c7 44 24 04 e0 8f 10 movl $0x108fe0,0x4(%esp)
100233: 00
100234: c7 04 24 94 90 10 00 movl $0x109094,(%esp)
10023b: e8 a0 36 00 00 call 1038e0 <sleep>
iunlock(ip);
target = n;
acquire(&input.lock);
while(n > 0){
while(input.r == input.w){
100240: a1 94 90 10 00 mov 0x109094,%eax
100245: 3b 05 98 90 10 00 cmp 0x109098,%eax
10024b: 74 d3 je 100220 <console_read+0x30>
ilock(ip);
return -1;
}
sleep(&input.r, &input.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
10024d: 89 c1 mov %eax,%ecx
10024f: c1 f9 1f sar $0x1f,%ecx
100252: c1 e9 19 shr $0x19,%ecx
100255: 8d 14 08 lea (%eax,%ecx,1),%edx
100258: 83 e2 7f and $0x7f,%edx
10025b: 29 ca sub %ecx,%edx
10025d: 0f b6 8a 14 90 10 00 movzbl 0x109014(%edx),%ecx
100264: 8d 78 01 lea 0x1(%eax),%edi
100267: 89 3d 94 90 10 00 mov %edi,0x109094
10026d: 0f be d1 movsbl %cl,%edx
if(c == C('D')){ // EOF
100270: 83 fa 04 cmp $0x4,%edx
100273: 74 3c je 1002b1 <console_read+0xc1>
// caller gets a 0-byte result.
input.r--;
}
break;
}
*dst++ = c;
100275: 8b 45 0c mov 0xc(%ebp),%eax
--n;
100278: 83 eb 01 sub $0x1,%ebx
if(c == '\n')
10027b: 83 fa 0a cmp $0xa,%edx
// caller gets a 0-byte result.
input.r--;
}
break;
}
*dst++ = c;
10027e: 88 08 mov %cl,(%eax)
--n;
if(c == '\n')
100280: 74 39 je 1002bb <console_read+0xcb>
int c;
iunlock(ip);
target = n;
acquire(&input.lock);
while(n > 0){
100282: 85 db test %ebx,%ebx
100284: 7e 35 jle 1002bb <console_read+0xcb>
// caller gets a 0-byte result.
input.r--;
}
break;
}
*dst++ = c;
100286: 83 45 0c 01 addl $0x1,0xc(%ebp)
10028a: eb b4 jmp 100240 <console_read+0x50>
10028c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
target = n;
acquire(&input.lock);
while(n > 0){
while(input.r == input.w){
if(cp->killed){
release(&input.lock);
100290: c7 04 24 e0 8f 10 00 movl $0x108fe0,(%esp)
100297: e8 44 3d 00 00 call 103fe0 <release>
ilock(ip);
10029c: 89 34 24 mov %esi,(%esp)
10029f: e8 5c 12 00 00 call 101500 <ilock>
}
release(&input.lock);
ilock(ip);
return target - n;
}
1002a4: 83 c4 2c add $0x2c,%esp
while(n > 0){
while(input.r == input.w){
if(cp->killed){
release(&input.lock);
ilock(ip);
return -1;
1002a7: b8 ff ff ff ff mov $0xffffffff,%eax
}
release(&input.lock);
ilock(ip);
return target - n;
}
1002ac: 5b pop %ebx
1002ad: 5e pop %esi
1002ae: 5f pop %edi
1002af: 5d pop %ebp
1002b0: c3 ret
}
sleep(&input.r, &input.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
if(c == C('D')){ // EOF
if(n < target){
1002b1: 39 5d e4 cmp %ebx,-0x1c(%ebp)
1002b4: 76 05 jbe 1002bb <console_read+0xcb>
// Save ^D for next time, to make sure
// caller gets a 0-byte result.
input.r--;
1002b6: a3 94 90 10 00 mov %eax,0x109094
1002bb: 8b 45 e4 mov -0x1c(%ebp),%eax
1002be: 29 d8 sub %ebx,%eax
*dst++ = c;
--n;
if(c == '\n')
break;
}
release(&input.lock);
1002c0: 89 45 e0 mov %eax,-0x20(%ebp)
1002c3: c7 04 24 e0 8f 10 00 movl $0x108fe0,(%esp)
1002ca: e8 11 3d 00 00 call 103fe0 <release>
ilock(ip);
1002cf: 89 34 24 mov %esi,(%esp)
1002d2: e8 29 12 00 00 call 101500 <ilock>
1002d7: 8b 45 e0 mov -0x20(%ebp),%eax
return target - n;
}
1002da: 83 c4 2c add $0x2c,%esp
1002dd: 5b pop %ebx
1002de: 5e pop %esi
1002df: 5f pop %edi
1002e0: 5d pop %ebp
1002e1: c3 ret
int c;
iunlock(ip);
target = n;
acquire(&input.lock);
while(n > 0){
1002e2: 31 c0 xor %eax,%eax
1002e4: eb da jmp 1002c0 <console_read+0xd0>
1002e6: 8d 76 00 lea 0x0(%esi),%esi
1002e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
001002f0 <cons_putc>:
crt[pos] = ' ' | 0x0700;
}
void
cons_putc(int c)
{
1002f0: 55 push %ebp
1002f1: 89 e5 mov %esp,%ebp
1002f3: 57 push %edi
1002f4: 56 push %esi
1002f5: 53 push %ebx
1002f6: 83 ec 1c sub $0x1c,%esp
1002f9: 8b 4d 08 mov 0x8(%ebp),%ecx
if(panicked){
1002fc: 83 3d a0 77 10 00 00 cmpl $0x0,0x1077a0
100303: 0f 85 d3 00 00 00 jne 1003dc <cons_putc+0xec>
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
100309: b8 79 03 00 00 mov $0x379,%eax
10030e: 89 c2 mov %eax,%edx
100310: ec in (%dx),%al
static void
lpt_putc(int c)
{
int i;
for(i = 0; !(inb(LPTPORT+1) & 0x80) && i < 12800; i++)
100311: 84 c0 test %al,%al
100313: bb 00 32 00 00 mov $0x3200,%ebx
100318: 79 0b jns 100325 <cons_putc+0x35>
10031a: eb 0e jmp 10032a <cons_putc+0x3a>
10031c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
100320: 83 eb 01 sub $0x1,%ebx
100323: 74 05 je 10032a <cons_putc+0x3a>
100325: ec in (%dx),%al
100326: 84 c0 test %al,%al
100328: 79 f6 jns 100320 <cons_putc+0x30>
;
if(c == BACKSPACE)
10032a: 81 f9 00 01 00 00 cmp $0x100,%ecx
100330: b8 08 00 00 00 mov $0x8,%eax
100335: 0f 45 c1 cmovne %ecx,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
100338: ba 78 03 00 00 mov $0x378,%edx
10033d: ee out %al,(%dx)
10033e: b8 0d 00 00 00 mov $0xd,%eax
100343: b2 7a mov $0x7a,%dl
100345: ee out %al,(%dx)
100346: b8 08 00 00 00 mov $0x8,%eax
10034b: ee out %al,(%dx)
10034c: be d4 03 00 00 mov $0x3d4,%esi
100351: b8 0e 00 00 00 mov $0xe,%eax
100356: 89 f2 mov %esi,%edx
100358: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
100359: bf d5 03 00 00 mov $0x3d5,%edi
10035e: 89 fa mov %edi,%edx
100360: ec in (%dx),%al
{
int pos;
// Cursor position: col + 80*row.
outb(CRTPORT, 14);
pos = inb(CRTPORT+1) << 8;
100361: 0f b6 d8 movzbl %al,%ebx
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
100364: 89 f2 mov %esi,%edx
100366: c1 e3 08 shl $0x8,%ebx
100369: b8 0f 00 00 00 mov $0xf,%eax
10036e: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
10036f: 89 fa mov %edi,%edx
100371: ec in (%dx),%al
outb(CRTPORT, 15);
pos |= inb(CRTPORT+1);
100372: 0f b6 c0 movzbl %al,%eax
100375: 09 c3 or %eax,%ebx
if(c == '\n')
100377: 83 f9 0a cmp $0xa,%ecx
10037a: 74 63 je 1003df <cons_putc+0xef>
pos += 80 - pos%80;
else if(c == BACKSPACE){
10037c: 81 f9 00 01 00 00 cmp $0x100,%ecx
100382: 0f 84 b1 00 00 00 je 100439 <cons_putc+0x149>
if(pos > 0)
crt[--pos] = ' ' | 0x0700;
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
100388: 66 81 e1 ff 00 and $0xff,%cx
10038d: 80 cd 07 or $0x7,%ch
100390: 66 89 8c 1b 00 80 0b mov %cx,0xb8000(%ebx,%ebx,1)
100397: 00
100398: 83 c3 01 add $0x1,%ebx
if((pos/80) >= 24){ // Scroll up.
10039b: 81 fb 7f 07 00 00 cmp $0x77f,%ebx
1003a1: 7f 4e jg 1003f1 <cons_putc+0x101>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
1003a3: b9 d4 03 00 00 mov $0x3d4,%ecx
1003a8: b8 0e 00 00 00 mov $0xe,%eax
1003ad: 89 ca mov %ecx,%edx
1003af: ee out %al,(%dx)
1003b0: be d5 03 00 00 mov $0x3d5,%esi
pos -= 80;
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
}
outb(CRTPORT, 14);
outb(CRTPORT+1, pos>>8);
1003b5: 89 d8 mov %ebx,%eax
1003b7: c1 f8 08 sar $0x8,%eax
1003ba: 89 f2 mov %esi,%edx
1003bc: ee out %al,(%dx)
1003bd: b8 0f 00 00 00 mov $0xf,%eax
1003c2: 89 ca mov %ecx,%edx
1003c4: ee out %al,(%dx)
1003c5: 89 d8 mov %ebx,%eax
1003c7: 89 f2 mov %esi,%edx
1003c9: ee out %al,(%dx)
outb(CRTPORT, 15);
outb(CRTPORT+1, pos);
crt[pos] = ' ' | 0x0700;
1003ca: 66 c7 84 1b 00 80 0b movw $0x720,0xb8000(%ebx,%ebx,1)
1003d1: 00 20 07
;
}
lpt_putc(c);
cga_putc(c);
}
1003d4: 83 c4 1c add $0x1c,%esp
1003d7: 5b pop %ebx
1003d8: 5e pop %esi
1003d9: 5f pop %edi
1003da: 5d pop %ebp
1003db: c3 ret
}
static inline void
cli(void)
{
asm volatile("cli");
1003dc: fa cli
1003dd: eb fe jmp 1003dd <cons_putc+0xed>
pos = inb(CRTPORT+1) << 8;
outb(CRTPORT, 15);
pos |= inb(CRTPORT+1);
if(c == '\n')
pos += 80 - pos%80;
1003df: 89 da mov %ebx,%edx
1003e1: 89 d8 mov %ebx,%eax
1003e3: b1 50 mov $0x50,%cl
1003e5: 83 c3 50 add $0x50,%ebx
1003e8: c1 fa 1f sar $0x1f,%edx
1003eb: f7 f9 idiv %ecx
1003ed: 29 d3 sub %edx,%ebx
1003ef: eb aa jmp 10039b <cons_putc+0xab>
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
pos -= 80;
1003f1: 83 eb 50 sub $0x50,%ebx
crt[--pos] = ' ' | 0x0700;
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
1003f4: c7 44 24 08 60 0e 00 movl $0xe60,0x8(%esp)
1003fb: 00
1003fc: c7 44 24 04 a0 80 0b movl $0xb80a0,0x4(%esp)
100403: 00
100404: c7 04 24 00 80 0b 00 movl $0xb8000,(%esp)
10040b: e8 a0 3c 00 00 call 1040b0 <memmove>
pos -= 80;
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
100410: b8 80 07 00 00 mov $0x780,%eax
100415: 29 d8 sub %ebx,%eax
100417: 01 c0 add %eax,%eax
100419: 89 44 24 08 mov %eax,0x8(%esp)
10041d: 8d 84 1b 00 80 0b 00 lea 0xb8000(%ebx,%ebx,1),%eax
100424: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
10042b: 00
10042c: 89 04 24 mov %eax,(%esp)
10042f: e8 ec 3b 00 00 call 104020 <memset>
100434: e9 6a ff ff ff jmp 1003a3 <cons_putc+0xb3>
pos |= inb(CRTPORT+1);
if(c == '\n')
pos += 80 - pos%80;
else if(c == BACKSPACE){
if(pos > 0)
100439: 85 db test %ebx,%ebx
10043b: 0f 8e 62 ff ff ff jle 1003a3 <cons_putc+0xb3>
crt[--pos] = ' ' | 0x0700;
100441: 83 eb 01 sub $0x1,%ebx
100444: 66 c7 84 1b 00 80 0b movw $0x720,0xb8000(%ebx,%ebx,1)
10044b: 00 20 07
10044e: e9 48 ff ff ff jmp 10039b <cons_putc+0xab>
100453: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
100459: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00100460 <console_write>:
release(&console_lock);
}
int
console_write(struct inode *ip, char *buf, int n)
{
100460: 55 push %ebp
100461: 89 e5 mov %esp,%ebp
100463: 57 push %edi
100464: 56 push %esi
100465: 53 push %ebx
100466: 83 ec 1c sub $0x1c,%esp
int i;
iunlock(ip);
100469: 8b 45 08 mov 0x8(%ebp),%eax
release(&console_lock);
}
int
console_write(struct inode *ip, char *buf, int n)
{
10046c: 8b 75 10 mov 0x10(%ebp),%esi
10046f: 8b 7d 0c mov 0xc(%ebp),%edi
int i;
iunlock(ip);
100472: 89 04 24 mov %eax,(%esp)
100475: e8 96 11 00 00 call 101610 <iunlock>
acquire(&console_lock);
10047a: c7 04 24 c0 77 10 00 movl $0x1077c0,(%esp)
100481: e8 6a 3a 00 00 call 103ef0 <acquire>
for(i = 0; i < n; i++)
100486: 85 f6 test %esi,%esi
100488: 7e 19 jle 1004a3 <console_write+0x43>
10048a: 31 db xor %ebx,%ebx
10048c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
cons_putc(buf[i] & 0xff);
100490: 0f b6 14 1f movzbl (%edi,%ebx,1),%edx
{
int i;
iunlock(ip);
acquire(&console_lock);
for(i = 0; i < n; i++)
100494: 83 c3 01 add $0x1,%ebx
cons_putc(buf[i] & 0xff);
100497: 89 14 24 mov %edx,(%esp)
10049a: e8 51 fe ff ff call 1002f0 <cons_putc>
{
int i;
iunlock(ip);
acquire(&console_lock);
for(i = 0; i < n; i++)
10049f: 39 de cmp %ebx,%esi
1004a1: 7f ed jg 100490 <console_write+0x30>
cons_putc(buf[i] & 0xff);
release(&console_lock);
1004a3: c7 04 24 c0 77 10 00 movl $0x1077c0,(%esp)
1004aa: e8 31 3b 00 00 call 103fe0 <release>
ilock(ip);
1004af: 8b 45 08 mov 0x8(%ebp),%eax
1004b2: 89 04 24 mov %eax,(%esp)
1004b5: e8 46 10 00 00 call 101500 <ilock>
return n;
}
1004ba: 83 c4 1c add $0x1c,%esp
1004bd: 89 f0 mov %esi,%eax
1004bf: 5b pop %ebx
1004c0: 5e pop %esi
1004c1: 5f pop %edi
1004c2: 5d pop %ebp
1004c3: c3 ret
1004c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1004ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
001004d0 <printint>:
cga_putc(c);
}
void
printint(int xx, int base, int sgn)
{
1004d0: 55 push %ebp
1004d1: 89 e5 mov %esp,%ebp
1004d3: 57 push %edi
1004d4: 56 push %esi
1004d5: 53 push %ebx
1004d6: 83 ec 2c sub $0x2c,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i = 0, neg = 0;
uint x;
if(sgn && xx < 0){
1004d9: 8b 55 10 mov 0x10(%ebp),%edx
cga_putc(c);
}
void
printint(int xx, int base, int sgn)
{
1004dc: 8b 45 08 mov 0x8(%ebp),%eax
1004df: 8b 75 0c mov 0xc(%ebp),%esi
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i = 0, neg = 0;
uint x;
if(sgn && xx < 0){
1004e2: 85 d2 test %edx,%edx
1004e4: 74 09 je 1004ef <printint+0x1f>
1004e6: 89 c2 mov %eax,%edx
1004e8: c1 ea 1f shr $0x1f,%edx
1004eb: 84 d2 test %dl,%dl
1004ed: 75 51 jne 100540 <printint+0x70>
void
printint(int xx, int base, int sgn)
{
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i = 0, neg = 0;
1004ef: 31 ff xor %edi,%edi
1004f1: 31 c9 xor %ecx,%ecx
1004f3: 8d 5d d8 lea -0x28(%ebp),%ebx
1004f6: 66 90 xchg %ax,%ax
} else {
x = xx;
}
do{
buf[i++] = digits[x % base];
1004f8: 31 d2 xor %edx,%edx
1004fa: f7 f6 div %esi
1004fc: 0f b6 92 79 60 10 00 movzbl 0x106079(%edx),%edx
100503: 88 14 0b mov %dl,(%ebx,%ecx,1)
100506: 83 c1 01 add $0x1,%ecx
}while((x /= base) != 0);
100509: 85 c0 test %eax,%eax
10050b: 75 eb jne 1004f8 <printint+0x28>
if(neg)
10050d: 85 ff test %edi,%edi
10050f: 74 08 je 100519 <printint+0x49>
buf[i++] = '-';
100511: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
100516: 83 c1 01 add $0x1,%ecx
while(--i >= 0)
100519: 8d 71 ff lea -0x1(%ecx),%esi
10051c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
cons_putc(buf[i]);
100520: 0f be 04 33 movsbl (%ebx,%esi,1),%eax
100524: 89 04 24 mov %eax,(%esp)
100527: e8 c4 fd ff ff call 1002f0 <cons_putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
10052c: 83 ee 01 sub $0x1,%esi
10052f: 79 ef jns 100520 <printint+0x50>
cons_putc(buf[i]);
}
100531: 83 c4 2c add $0x2c,%esp
100534: 5b pop %ebx
100535: 5e pop %esi
100536: 5f pop %edi
100537: 5d pop %ebp
100538: c3 ret
100539: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
int i = 0, neg = 0;
uint x;
if(sgn && xx < 0){
neg = 1;
x = 0 - xx;
100540: f7 d8 neg %eax
char buf[16];
int i = 0, neg = 0;
uint x;
if(sgn && xx < 0){
neg = 1;
100542: bf 01 00 00 00 mov $0x1,%edi
100547: eb a8 jmp 1004f1 <printint+0x21>
100549: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00100550 <cprintf>:
}
// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
100550: 55 push %ebp
100551: 89 e5 mov %esp,%ebp
100553: 57 push %edi
100554: 56 push %esi
100555: 53 push %ebx
100556: 83 ec 2c sub $0x2c,%esp
int i, c, state, locking;
uint *argp;
char *s;
locking = use_console_lock;
100559: a1 a4 77 10 00 mov 0x1077a4,%eax
if(locking)
10055e: 85 c0 test %eax,%eax
{
int i, c, state, locking;
uint *argp;
char *s;
locking = use_console_lock;
100560: 89 45 e0 mov %eax,-0x20(%ebp)
if(locking)
100563: 0f 85 77 01 00 00 jne 1006e0 <cprintf+0x190>
acquire(&console_lock);
argp = (uint*)(void*)&fmt + 1;
state = 0;
for(i = 0; fmt[i]; i++){
100569: 8b 5d 08 mov 0x8(%ebp),%ebx
10056c: 0f b6 03 movzbl (%ebx),%eax
10056f: 84 c0 test %al,%al
100571: 74 7d je 1005f0 <cprintf+0xa0>
locking = use_console_lock;
if(locking)
acquire(&console_lock);
argp = (uint*)(void*)&fmt + 1;
100573: 8d 55 0c lea 0xc(%ebp),%edx
state = 0;
100576: 31 ff xor %edi,%edi
locking = use_console_lock;
if(locking)
acquire(&console_lock);
argp = (uint*)(void*)&fmt + 1;
100578: 89 55 e4 mov %edx,-0x1c(%ebp)
10057b: eb 26 jmp 1005a3 <cprintf+0x53>
10057d: 8d 76 00 lea 0x0(%esi),%esi
state = 0;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
switch(state){
case 0:
if(c == '%')
100580: 83 fe 25 cmp $0x25,%esi
100583: 0f 84 87 00 00 00 je 100610 <cprintf+0xc0>
state = '%';
else
cons_putc(c);
100589: 89 34 24 mov %esi,(%esp)
10058c: e8 5f fd ff ff call 1002f0 <cons_putc>
100591: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(locking)
acquire(&console_lock);
argp = (uint*)(void*)&fmt + 1;
state = 0;
for(i = 0; fmt[i]; i++){
100598: 0f b6 43 01 movzbl 0x1(%ebx),%eax
10059c: 83 c3 01 add $0x1,%ebx
10059f: 84 c0 test %al,%al
1005a1: 74 4d je 1005f0 <cprintf+0xa0>
c = fmt[i] & 0xff;
switch(state){
1005a3: 85 ff test %edi,%edi
acquire(&console_lock);
argp = (uint*)(void*)&fmt + 1;
state = 0;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
1005a5: 0f b6 f0 movzbl %al,%esi
switch(state){
1005a8: 74 d6 je 100580 <cprintf+0x30>
1005aa: 83 ff 25 cmp $0x25,%edi
1005ad: 75 e9 jne 100598 <cprintf+0x48>
else
cons_putc(c);
break;
case '%':
switch(c){
1005af: 83 fe 70 cmp $0x70,%esi
1005b2: 74 6e je 100622 <cprintf+0xd2>
1005b4: 7f 62 jg 100618 <cprintf+0xc8>
1005b6: 83 fe 25 cmp $0x25,%esi
1005b9: 0f 84 09 01 00 00 je 1006c8 <cprintf+0x178>
1005bf: 83 fe 64 cmp $0x64,%esi
1005c2: 0f 84 d0 00 00 00 je 100698 <cprintf+0x148>
case '%':
cons_putc('%');
break;
default:
// Print unknown % sequence to draw attention.
cons_putc('%');
1005c8: c7 04 24 25 00 00 00 movl $0x25,(%esp)
cons_putc(c);
break;
}
state = 0;
1005cf: 31 ff xor %edi,%edi
case '%':
cons_putc('%');
break;
default:
// Print unknown % sequence to draw attention.
cons_putc('%');
1005d1: e8 1a fd ff ff call 1002f0 <cons_putc>
cons_putc(c);
1005d6: 89 34 24 mov %esi,(%esp)
1005d9: e8 12 fd ff ff call 1002f0 <cons_putc>
if(locking)
acquire(&console_lock);
argp = (uint*)(void*)&fmt + 1;
state = 0;
for(i = 0; fmt[i]; i++){
1005de: 0f b6 43 01 movzbl 0x1(%ebx),%eax
1005e2: 83 c3 01 add $0x1,%ebx
1005e5: 84 c0 test %al,%al
1005e7: 75 ba jne 1005a3 <cprintf+0x53>
1005e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
state = 0;
break;
}
}
if(locking)
1005f0: 8b 4d e0 mov -0x20(%ebp),%ecx
1005f3: 85 c9 test %ecx,%ecx
1005f5: 74 0c je 100603 <cprintf+0xb3>
release(&console_lock);
1005f7: c7 04 24 c0 77 10 00 movl $0x1077c0,(%esp)
1005fe: e8 dd 39 00 00 call 103fe0 <release>
}
100603: 83 c4 2c add $0x2c,%esp
100606: 5b pop %ebx
100607: 5e pop %esi
100608: 5f pop %edi
100609: 5d pop %ebp
10060a: c3 ret
10060b: 90 nop
10060c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
switch(state){
case 0:
if(c == '%')
state = '%';
100610: bf 25 00 00 00 mov $0x25,%edi
100615: eb 81 jmp 100598 <cprintf+0x48>
100617: 90 nop
else
cons_putc(c);
break;
case '%':
switch(c){
100618: 83 fe 73 cmp $0x73,%esi
10061b: 74 33 je 100650 <cprintf+0x100>
10061d: 83 fe 78 cmp $0x78,%esi
100620: 75 a6 jne 1005c8 <cprintf+0x78>
case 'd':
printint(*argp++, 10, 1);
break;
case 'x':
case 'p':
printint(*argp++, 16, 0);
100622: 8b 55 e4 mov -0x1c(%ebp),%edx
// Print unknown % sequence to draw attention.
cons_putc('%');
cons_putc(c);
break;
}
state = 0;
100625: 31 ff xor %edi,%edi
case 'd':
printint(*argp++, 10, 1);
break;
case 'x':
case 'p':
printint(*argp++, 16, 0);
100627: 8b 02 mov (%edx),%eax
100629: 83 c2 04 add $0x4,%edx
10062c: 89 55 e4 mov %edx,-0x1c(%ebp)
10062f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
100636: 00
100637: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp)
10063e: 00
10063f: 89 04 24 mov %eax,(%esp)
100642: e8 89 fe ff ff call 1004d0 <printint>
break;
100647: e9 4c ff ff ff jmp 100598 <cprintf+0x48>
10064c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
case 's':
s = (char*)*argp++;
100650: 8b 45 e4 mov -0x1c(%ebp),%eax
if(s == 0)
s = "(null)";
100653: ba 49 60 10 00 mov $0x106049,%edx
case 'x':
case 'p':
printint(*argp++, 16, 0);
break;
case 's':
s = (char*)*argp++;
100658: 8b 30 mov (%eax),%esi
10065a: 83 c0 04 add $0x4,%eax
10065d: 89 45 e4 mov %eax,-0x1c(%ebp)
if(s == 0)
s = "(null)";
100660: 85 f6 test %esi,%esi
100662: 0f 44 f2 cmove %edx,%esi
// Print unknown % sequence to draw attention.
cons_putc('%');
cons_putc(c);
break;
}
state = 0;
100665: 31 ff xor %edi,%edi
break;
case 's':
s = (char*)*argp++;
if(s == 0)
s = "(null)";
for(; *s; s++)
100667: 0f b6 06 movzbl (%esi),%eax
10066a: 84 c0 test %al,%al
10066c: 0f 84 26 ff ff ff je 100598 <cprintf+0x48>
100672: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cons_putc(*s);
100678: 0f be c0 movsbl %al,%eax
break;
case 's':
s = (char*)*argp++;
if(s == 0)
s = "(null)";
for(; *s; s++)
10067b: 83 c6 01 add $0x1,%esi
cons_putc(*s);
10067e: 89 04 24 mov %eax,(%esp)
100681: e8 6a fc ff ff call 1002f0 <cons_putc>
break;
case 's':
s = (char*)*argp++;
if(s == 0)
s = "(null)";
for(; *s; s++)
100686: 0f b6 06 movzbl (%esi),%eax
100689: 84 c0 test %al,%al
10068b: 75 eb jne 100678 <cprintf+0x128>
// Print unknown % sequence to draw attention.
cons_putc('%');
cons_putc(c);
break;
}
state = 0;
10068d: 31 ff xor %edi,%edi
for(; *s; s++)
cons_putc(*s);
break;
case '%':
cons_putc('%');
break;
10068f: e9 04 ff ff ff jmp 100598 <cprintf+0x48>
100694: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
break;
case '%':
switch(c){
case 'd':
printint(*argp++, 10, 1);
100698: 8b 55 e4 mov -0x1c(%ebp),%edx
// Print unknown % sequence to draw attention.
cons_putc('%');
cons_putc(c);
break;
}
state = 0;
10069b: 31 ff xor %edi,%edi
break;
case '%':
switch(c){
case 'd':
printint(*argp++, 10, 1);
10069d: 8b 02 mov (%edx),%eax
10069f: 83 c2 04 add $0x4,%edx
1006a2: 89 55 e4 mov %edx,-0x1c(%ebp)
1006a5: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
1006ac: 00
1006ad: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
1006b4: 00
1006b5: 89 04 24 mov %eax,(%esp)
1006b8: e8 13 fe ff ff call 1004d0 <printint>
break;
1006bd: e9 d6 fe ff ff jmp 100598 <cprintf+0x48>
1006c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
s = "(null)";
for(; *s; s++)
cons_putc(*s);
break;
case '%':
cons_putc('%');
1006c8: c7 04 24 25 00 00 00 movl $0x25,(%esp)
// Print unknown % sequence to draw attention.
cons_putc('%');
cons_putc(c);
break;
}
state = 0;
1006cf: 31 ff xor %edi,%edi
s = "(null)";
for(; *s; s++)
cons_putc(*s);
break;
case '%':
cons_putc('%');
1006d1: e8 1a fc ff ff call 1002f0 <cons_putc>
1006d6: e9 bd fe ff ff jmp 100598 <cprintf+0x48>
1006db: 90 nop
1006dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint *argp;
char *s;
locking = use_console_lock;
if(locking)
acquire(&console_lock);
1006e0: c7 04 24 c0 77 10 00 movl $0x1077c0,(%esp)
1006e7: e8 04 38 00 00 call 103ef0 <acquire>
1006ec: e9 78 fe ff ff jmp 100569 <cprintf+0x19>
1006f1: eb 0d jmp 100700 <console_intr>
1006f3: 90 nop
1006f4: 90 nop
1006f5: 90 nop
1006f6: 90 nop
1006f7: 90 nop
1006f8: 90 nop
1006f9: 90 nop
1006fa: 90 nop
1006fb: 90 nop
1006fc: 90 nop
1006fd: 90 nop
1006fe: 90 nop
1006ff: 90 nop
00100700 <console_intr>:
#define C(x) ((x)-'@') // Control-x
void
console_intr(int (*getc)(void))
{
100700: 55 push %ebp
100701: 89 e5 mov %esp,%ebp
100703: 56 push %esi
100704: 53 push %ebx
100705: 83 ec 20 sub $0x20,%esp
100708: 8b 5d 08 mov 0x8(%ebp),%ebx
int c;
acquire(&input.lock);
10070b: c7 04 24 e0 8f 10 00 movl $0x108fe0,(%esp)
100712: e8 d9 37 00 00 call 103ef0 <acquire>
100717: 90 nop
while((c = getc()) >= 0){
100718: ff d3 call *%ebx
10071a: 85 c0 test %eax,%eax
10071c: 0f 88 96 00 00 00 js 1007b8 <console_intr+0xb8>
switch(c){
100722: 83 f8 10 cmp $0x10,%eax
100725: 0f 84 a5 00 00 00 je 1007d0 <console_intr+0xd0>
10072b: 83 f8 15 cmp $0x15,%eax
10072e: 66 90 xchg %ax,%ax
100730: 0f 84 da 00 00 00 je 100810 <console_intr+0x110>
100736: 83 f8 08 cmp $0x8,%eax
100739: 0f 84 a1 00 00 00 je 1007e0 <console_intr+0xe0>
input.e--;
cons_putc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e < input.r+INPUT_BUF){
10073f: 85 c0 test %eax,%eax
100741: 74 d5 je 100718 <console_intr+0x18>
100743: 8b 0d 94 90 10 00 mov 0x109094,%ecx
100749: 8b 15 9c 90 10 00 mov 0x10909c,%edx
10074f: 83 c1 7f add $0x7f,%ecx
100752: 39 d1 cmp %edx,%ecx
100754: 7c c2 jl 100718 <console_intr+0x18>
input.buf[input.e++ % INPUT_BUF] = c;
100756: 89 d6 mov %edx,%esi
100758: c1 fe 1f sar $0x1f,%esi
10075b: c1 ee 19 shr $0x19,%esi
10075e: 8d 0c 32 lea (%edx,%esi,1),%ecx
100761: 83 c2 01 add $0x1,%edx
100764: 83 e1 7f and $0x7f,%ecx
100767: 29 f1 sub %esi,%ecx
100769: 88 81 14 90 10 00 mov %al,0x109014(%ecx)
cons_putc(c);
10076f: 89 04 24 mov %eax,(%esp)
100772: 89 45 f4 mov %eax,-0xc(%ebp)
cons_putc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e < input.r+INPUT_BUF){
input.buf[input.e++ % INPUT_BUF] = c;
100775: 89 15 9c 90 10 00 mov %edx,0x10909c
cons_putc(c);
10077b: e8 70 fb ff ff call 1002f0 <cons_putc>
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
100780: 8b 45 f4 mov -0xc(%ebp),%eax
100783: 83 f8 04 cmp $0x4,%eax
100786: 0f 84 e1 00 00 00 je 10086d <console_intr+0x16d>
10078c: 83 f8 0a cmp $0xa,%eax
10078f: 0f 84 d8 00 00 00 je 10086d <console_intr+0x16d>
100795: 8b 15 94 90 10 00 mov 0x109094,%edx
10079b: a1 9c 90 10 00 mov 0x10909c,%eax
1007a0: 83 ea 80 sub $0xffffff80,%edx
1007a3: 39 d0 cmp %edx,%eax
1007a5: 0f 84 c7 00 00 00 je 100872 <console_intr+0x172>
console_intr(int (*getc)(void))
{
int c;
acquire(&input.lock);
while((c = getc()) >= 0){
1007ab: ff d3 call *%ebx
1007ad: 85 c0 test %eax,%eax
1007af: 0f 89 6d ff ff ff jns 100722 <console_intr+0x22>
1007b5: 8d 76 00 lea 0x0(%esi),%esi
}
}
break;
}
}
release(&input.lock);
1007b8: c7 45 08 e0 8f 10 00 movl $0x108fe0,0x8(%ebp)
}
1007bf: 83 c4 20 add $0x20,%esp
1007c2: 5b pop %ebx
1007c3: 5e pop %esi
1007c4: 5d pop %ebp
}
}
break;
}
}
release(&input.lock);
1007c5: e9 16 38 00 00 jmp 103fe0 <release>
1007ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
acquire(&input.lock);
while((c = getc()) >= 0){
switch(c){
case C('P'): // Process listing.
procdump();
1007d0: e8 3b 35 00 00 call 103d10 <procdump>
break;
1007d5: e9 3e ff ff ff jmp 100718 <console_intr+0x18>
1007da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
input.e--;
cons_putc(BACKSPACE);
}
break;
case C('H'): // Backspace
if(input.e > input.w){
1007e0: a1 9c 90 10 00 mov 0x10909c,%eax
1007e5: 3b 05 98 90 10 00 cmp 0x109098,%eax
1007eb: 0f 8e 27 ff ff ff jle 100718 <console_intr+0x18>
input.e--;
1007f1: 83 e8 01 sub $0x1,%eax
1007f4: a3 9c 90 10 00 mov %eax,0x10909c
cons_putc(BACKSPACE);
1007f9: c7 04 24 00 01 00 00 movl $0x100,(%esp)
100800: e8 eb fa ff ff call 1002f0 <cons_putc>
100805: e9 0e ff ff ff jmp 100718 <console_intr+0x18>
10080a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
switch(c){
case C('P'): // Process listing.
procdump();
break;
case C('U'): // Kill line.
while(input.e > input.w &&
100810: 8b 0d 9c 90 10 00 mov 0x10909c,%ecx
100816: 39 0d 98 90 10 00 cmp %ecx,0x109098
10081c: 7c 2e jl 10084c <console_intr+0x14c>
10081e: e9 f5 fe ff ff jmp 100718 <console_intr+0x18>
100823: 90 nop
100824: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
100828: 89 0d 9c 90 10 00 mov %ecx,0x10909c
cons_putc(BACKSPACE);
10082e: c7 04 24 00 01 00 00 movl $0x100,(%esp)
100835: e8 b6 fa ff ff call 1002f0 <cons_putc>
switch(c){
case C('P'): // Process listing.
procdump();
break;
case C('U'): // Kill line.
while(input.e > input.w &&
10083a: 8b 0d 9c 90 10 00 mov 0x10909c,%ecx
100840: 3b 0d 98 90 10 00 cmp 0x109098,%ecx
100846: 0f 8e cc fe ff ff jle 100718 <console_intr+0x18>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
10084c: 83 e9 01 sub $0x1,%ecx
10084f: 89 ca mov %ecx,%edx
100851: c1 fa 1f sar $0x1f,%edx
100854: c1 ea 19 shr $0x19,%edx
100857: 8d 04 11 lea (%ecx,%edx,1),%eax
10085a: 83 e0 7f and $0x7f,%eax
10085d: 29 d0 sub %edx,%eax
switch(c){
case C('P'): // Process listing.
procdump();
break;
case C('U'): // Kill line.
while(input.e > input.w &&
10085f: 80 b8 14 90 10 00 0a cmpb $0xa,0x109014(%eax)
100866: 75 c0 jne 100828 <console_intr+0x128>
100868: e9 ab fe ff ff jmp 100718 <console_intr+0x18>
break;
default:
if(c != 0 && input.e < input.r+INPUT_BUF){
input.buf[input.e++ % INPUT_BUF] = c;
cons_putc(c);
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
10086d: a1 9c 90 10 00 mov 0x10909c,%eax
input.w = input.e;
100872: a3 98 90 10 00 mov %eax,0x109098
wakeup(&input.r);
100877: c7 04 24 94 90 10 00 movl $0x109094,(%esp)
10087e: e8 2d 31 00 00 call 1039b0 <wakeup>
100883: e9 90 fe ff ff jmp 100718 <console_intr+0x18>
100888: 90 nop
100889: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00100890 <console_init>:
return target - n;
}
void
console_init(void)
{
100890: 55 push %ebp
100891: 89 e5 mov %esp,%ebp
100893: 83 ec 18 sub $0x18,%esp
initlock(&console_lock, "console");
100896: c7 44 24 04 50 60 10 movl $0x106050,0x4(%esp)
10089d: 00
10089e: c7 04 24 c0 77 10 00 movl $0x1077c0,(%esp)
1008a5: e8 46 35 00 00 call 103df0 <initlock>
initlock(&input.lock, "console input");
1008aa: c7 44 24 04 58 60 10 movl $0x106058,0x4(%esp)
1008b1: 00
1008b2: c7 04 24 e0 8f 10 00 movl $0x108fe0,(%esp)
1008b9: e8 32 35 00 00 call 103df0 <initlock>
devsw[CONSOLE].write = console_write;
devsw[CONSOLE].read = console_read;
use_console_lock = 1;
pic_enable(IRQ_KBD);
1008be: c7 04 24 01 00 00 00 movl $0x1,(%esp)
console_init(void)
{
initlock(&console_lock, "console");
initlock(&input.lock, "console input");
devsw[CONSOLE].write = console_write;
1008c5: c7 05 4c 9a 10 00 60 movl $0x100460,0x109a4c
1008cc: 04 10 00
devsw[CONSOLE].read = console_read;
1008cf: c7 05 48 9a 10 00 f0 movl $0x1001f0,0x109a48
1008d6: 01 10 00
use_console_lock = 1;
1008d9: c7 05 a4 77 10 00 01 movl $0x1,0x1077a4
1008e0: 00 00 00
pic_enable(IRQ_KBD);
1008e3: e8 28 24 00 00 call 102d10 <pic_enable>
ioapic_enable(IRQ_KBD, 0);
1008e8: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1008ef: 00
1008f0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1008f7: e8 f4 19 00 00 call 1022f0 <ioapic_enable>
}
1008fc: c9 leave
1008fd: c3 ret
1008fe: 66 90 xchg %ax,%ax
00100900 <panic>:
void
panic(char *s)
{
100900: 55 push %ebp
100901: 89 e5 mov %esp,%ebp
100903: 56 push %esi
100904: 53 push %ebx
100905: 83 ec 40 sub $0x40,%esp
int i;
uint pcs[10];
__asm __volatile("cli");
use_console_lock = 0;
100908: c7 05 a4 77 10 00 00 movl $0x0,0x1077a4
10090f: 00 00 00
panic(char *s)
{
int i;
uint pcs[10];
__asm __volatile("cli");
100912: fa cli
use_console_lock = 0;
cprintf("cpu%d: panic: ", cpu());
100913: e8 68 1e 00 00 call 102780 <cpu>
cprintf(s, 0);
cprintf("\n", 0);
getcallerpcs(&s, pcs);
100918: 8d 75 d0 lea -0x30(%ebp),%esi
for(i=0; i<10; i++)
10091b: 31 db xor %ebx,%ebx
int i;
uint pcs[10];
__asm __volatile("cli");
use_console_lock = 0;
cprintf("cpu%d: panic: ", cpu());
10091d: c7 04 24 66 60 10 00 movl $0x106066,(%esp)
100924: 89 44 24 04 mov %eax,0x4(%esp)
100928: e8 23 fc ff ff call 100550 <cprintf>
cprintf(s, 0);
10092d: 8b 45 08 mov 0x8(%ebp),%eax
100930: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
100937: 00
100938: 89 04 24 mov %eax,(%esp)
10093b: e8 10 fc ff ff call 100550 <cprintf>
cprintf("\n", 0);
100940: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
100947: 00
100948: c7 04 24 b3 64 10 00 movl $0x1064b3,(%esp)
10094f: e8 fc fb ff ff call 100550 <cprintf>
getcallerpcs(&s, pcs);
100954: 8d 45 08 lea 0x8(%ebp),%eax
100957: 89 74 24 04 mov %esi,0x4(%esp)
10095b: 89 04 24 mov %eax,(%esp)
10095e: e8 ad 34 00 00 call 103e10 <getcallerpcs>
100963: 90 nop
100964: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i=0; i<10; i++)
cprintf(" %p", pcs[i]);
100968: 8b 04 9e mov (%esi,%ebx,4),%eax
use_console_lock = 0;
cprintf("cpu%d: panic: ", cpu());
cprintf(s, 0);
cprintf("\n", 0);
getcallerpcs(&s, pcs);
for(i=0; i<10; i++)
10096b: 83 c3 01 add $0x1,%ebx
cprintf(" %p", pcs[i]);
10096e: c7 04 24 75 60 10 00 movl $0x106075,(%esp)
100975: 89 44 24 04 mov %eax,0x4(%esp)
100979: e8 d2 fb ff ff call 100550 <cprintf>
use_console_lock = 0;
cprintf("cpu%d: panic: ", cpu());
cprintf(s, 0);
cprintf("\n", 0);
getcallerpcs(&s, pcs);
for(i=0; i<10; i++)
10097e: 83 fb 0a cmp $0xa,%ebx
100981: 75 e5 jne 100968 <panic+0x68>
cprintf(" %p", pcs[i]);
panicked = 1; // freeze other CPU
100983: c7 05 a0 77 10 00 01 movl $0x1,0x1077a0
10098a: 00 00 00
10098d: eb fe jmp 10098d <panic+0x8d>
10098f: 90 nop
00100990 <exec>:
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
{
100990: 55 push %ebp
100991: 89 e5 mov %esp,%ebp
100993: 57 push %edi
100994: 56 push %esi
100995: 53 push %ebx
100996: 81 ec 9c 00 00 00 sub $0x9c,%esp
uint sz, sp, argp;
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
if((ip = namei(path)) == 0)
10099c: 8b 45 08 mov 0x8(%ebp),%eax
10099f: 89 04 24 mov %eax,(%esp)
1009a2: e8 99 15 00 00 call 101f40 <namei>
1009a7: 89 c3 mov %eax,%ebx
return -1;
1009a9: b8 ff ff ff ff mov $0xffffffff,%eax
uint sz, sp, argp;
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
if((ip = namei(path)) == 0)
1009ae: 85 db test %ebx,%ebx
1009b0: 0f 84 55 03 00 00 je 100d0b <exec+0x37b>
return -1;
ilock(ip);
1009b6: 89 1c 24 mov %ebx,(%esp)
1009b9: e8 42 0b 00 00 call 101500 <ilock>
// Compute memory size of new process.
mem = 0;
sz = 0;
// Program segments.
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
1009be: 8d 45 94 lea -0x6c(%ebp),%eax
1009c1: c7 44 24 0c 34 00 00 movl $0x34,0xc(%esp)
1009c8: 00
1009c9: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
1009d0: 00
1009d1: 89 44 24 04 mov %eax,0x4(%esp)
1009d5: 89 1c 24 mov %ebx,(%esp)
1009d8: e8 73 0f 00 00 call 101950 <readi>
1009dd: 83 f8 33 cmp $0x33,%eax
1009e0: 0f 86 44 03 00 00 jbe 100d2a <exec+0x39a>
goto bad;
if(elf.magic != ELF_MAGIC)
1009e6: 81 7d 94 7f 45 4c 46 cmpl $0x464c457f,-0x6c(%ebp)
1009ed: 0f 85 37 03 00 00 jne 100d2a <exec+0x39a>
goto bad;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
1009f3: 66 83 7d c0 00 cmpw $0x0,-0x40(%ebp)
1009f8: 8b 7d b0 mov -0x50(%ebp),%edi
1009fb: 0f 84 69 03 00 00 je 100d6a <exec+0x3da>
return -1;
ilock(ip);
// Compute memory size of new process.
mem = 0;
sz = 0;
100a01: c7 45 84 00 00 00 00 movl $0x0,-0x7c(%ebp)
// Program segments.
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
goto bad;
if(elf.magic != ELF_MAGIC)
goto bad;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
100a08: 31 f6 xor %esi,%esi
100a0a: eb 12 jmp 100a1e <exec+0x8e>
100a0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
100a10: 0f b7 45 c0 movzwl -0x40(%ebp),%eax
100a14: 83 c6 01 add $0x1,%esi
100a17: 39 f0 cmp %esi,%eax
100a19: 7e 47 jle 100a62 <exec+0xd2>
#include "defs.h"
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
100a1b: 83 c7 20 add $0x20,%edi
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
goto bad;
if(elf.magic != ELF_MAGIC)
goto bad;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
100a1e: 8d 55 c8 lea -0x38(%ebp),%edx
100a21: c7 44 24 0c 20 00 00 movl $0x20,0xc(%esp)
100a28: 00
100a29: 89 7c 24 08 mov %edi,0x8(%esp)
100a2d: 89 54 24 04 mov %edx,0x4(%esp)
100a31: 89 1c 24 mov %ebx,(%esp)
100a34: e8 17 0f 00 00 call 101950 <readi>
100a39: 83 f8 20 cmp $0x20,%eax
100a3c: 0f 85 e8 02 00 00 jne 100d2a <exec+0x39a>
goto bad;
if(ph.type != ELF_PROG_LOAD)
100a42: 83 7d c8 01 cmpl $0x1,-0x38(%ebp)
100a46: 75 c8 jne 100a10 <exec+0x80>
continue;
if(ph.memsz < ph.filesz)
100a48: 8b 45 dc mov -0x24(%ebp),%eax
100a4b: 3b 45 d8 cmp -0x28(%ebp),%eax
100a4e: 0f 82 d6 02 00 00 jb 100d2a <exec+0x39a>
goto bad;
sz += ph.memsz;
100a54: 01 45 84 add %eax,-0x7c(%ebp)
// Program segments.
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
goto bad;
if(elf.magic != ELF_MAGIC)
goto bad;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
100a57: 83 c6 01 add $0x1,%esi
100a5a: 0f b7 45 c0 movzwl -0x40(%ebp),%eax
100a5e: 39 f0 cmp %esi,%eax
100a60: 7f b9 jg 100a1b <exec+0x8b>
100a62: 8b 7d 84 mov -0x7c(%ebp),%edi
100a65: 81 c7 ff 1f 00 00 add $0x1fff,%edi
sz += ph.memsz;
}
// Arguments.
arglen = 0;
for(argc=0; argv[argc]; argc++)
100a6b: 8b 4d 0c mov 0xc(%ebp),%ecx
100a6e: 8b 11 mov (%ecx),%edx
100a70: 85 d2 test %edx,%edx
100a72: 0f 84 ca 02 00 00 je 100d42 <exec+0x3b2>
100a78: 89 7d 84 mov %edi,-0x7c(%ebp)
100a7b: 31 f6 xor %esi,%esi
100a7d: 89 cf mov %ecx,%edi
100a7f: 89 5d 80 mov %ebx,-0x80(%ebp)
100a82: 31 db xor %ebx,%ebx
100a84: c7 85 7c ff ff ff 00 movl $0x0,-0x84(%ebp)
100a8b: 00 00 00
100a8e: 66 90 xchg %ax,%ax
arglen += strlen(argv[argc]) + 1;
100a90: 89 14 24 mov %edx,(%esp)
sz += ph.memsz;
}
// Arguments.
arglen = 0;
for(argc=0; argv[argc]; argc++)
100a93: 83 c3 01 add $0x1,%ebx
arglen += strlen(argv[argc]) + 1;
100a96: e8 75 37 00 00 call 104210 <strlen>
sz += ph.memsz;
}
// Arguments.
arglen = 0;
for(argc=0; argv[argc]; argc++)
100a9b: 8b 14 9f mov (%edi,%ebx,4),%edx
100a9e: 89 d9 mov %ebx,%ecx
arglen += strlen(argv[argc]) + 1;
100aa0: 01 f0 add %esi,%eax
sz += ph.memsz;
}
// Arguments.
arglen = 0;
for(argc=0; argv[argc]; argc++)
100aa2: 85 d2 test %edx,%edx
arglen += strlen(argv[argc]) + 1;
100aa4: 8d 70 01 lea 0x1(%eax),%esi
sz += ph.memsz;
}
// Arguments.
arglen = 0;
for(argc=0; argv[argc]; argc++)
100aa7: 75 e7 jne 100a90 <exec+0x100>
100aa9: 89 9d 7c ff ff ff mov %ebx,-0x84(%ebp)
100aaf: 8b 7d 84 mov -0x7c(%ebp),%edi
100ab2: 83 c0 04 add $0x4,%eax
100ab5: 8b 5d 80 mov -0x80(%ebp),%ebx
100ab8: 83 e0 fc and $0xfffffffc,%eax
100abb: 89 85 78 ff ff ff mov %eax,-0x88(%ebp)
100ac1: 8d 44 88 04 lea 0x4(%eax,%ecx,4),%eax
100ac5: 89 8d 74 ff ff ff mov %ecx,-0x8c(%ebp)
// Stack.
sz += PAGE;
// Allocate program memory.
sz = (sz+PAGE-1) & ~(PAGE-1);
100acb: 01 f8 add %edi,%eax
100acd: 25 00 f0 ff ff and $0xfffff000,%eax
100ad2: 89 45 80 mov %eax,-0x80(%ebp)
mem = kalloc(sz);
100ad5: 89 04 24 mov %eax,(%esp)
100ad8: e8 b3 19 00 00 call 102490 <kalloc>
if(mem == 0)
100add: 85 c0 test %eax,%eax
// Stack.
sz += PAGE;
// Allocate program memory.
sz = (sz+PAGE-1) & ~(PAGE-1);
mem = kalloc(sz);
100adf: 89 45 84 mov %eax,-0x7c(%ebp)
if(mem == 0)
100ae2: 0f 84 42 02 00 00 je 100d2a <exec+0x39a>
goto bad;
memset(mem, 0, sz);
100ae8: 8b 4d 80 mov -0x80(%ebp),%ecx
100aeb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
100af2: 00
100af3: 89 04 24 mov %eax,(%esp)
100af6: 89 4c 24 08 mov %ecx,0x8(%esp)
100afa: e8 21 35 00 00 call 104020 <memset>
// Load program into memory.
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
100aff: 8b 7d b0 mov -0x50(%ebp),%edi
100b02: 66 83 7d c0 00 cmpw $0x0,-0x40(%ebp)
100b07: 0f 84 ac 00 00 00 je 100bb9 <exec+0x229>
100b0d: 31 f6 xor %esi,%esi
100b0f: eb 19 jmp 100b2a <exec+0x19a>
100b11: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
100b18: 0f b7 45 c0 movzwl -0x40(%ebp),%eax
100b1c: 83 c6 01 add $0x1,%esi
100b1f: 39 f0 cmp %esi,%eax
100b21: 0f 8e 92 00 00 00 jle 100bb9 <exec+0x229>
#include "defs.h"
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
100b27: 83 c7 20 add $0x20,%edi
goto bad;
memset(mem, 0, sz);
// Load program into memory.
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
100b2a: 8d 45 c8 lea -0x38(%ebp),%eax
100b2d: c7 44 24 0c 20 00 00 movl $0x20,0xc(%esp)
100b34: 00
100b35: 89 7c 24 08 mov %edi,0x8(%esp)
100b39: 89 44 24 04 mov %eax,0x4(%esp)
100b3d: 89 1c 24 mov %ebx,(%esp)
100b40: e8 0b 0e 00 00 call 101950 <readi>
100b45: 83 f8 20 cmp $0x20,%eax
100b48: 0f 85 ca 01 00 00 jne 100d18 <exec+0x388>
goto bad;
if(ph.type != ELF_PROG_LOAD)
100b4e: 83 7d c8 01 cmpl $0x1,-0x38(%ebp)
100b52: 75 c4 jne 100b18 <exec+0x188>
continue;
if(ph.va + ph.memsz > sz)
100b54: 8b 45 d0 mov -0x30(%ebp),%eax
100b57: 8b 55 dc mov -0x24(%ebp),%edx
100b5a: 01 c2 add %eax,%edx
100b5c: 39 55 80 cmp %edx,-0x80(%ebp)
100b5f: 0f 82 b3 01 00 00 jb 100d18 <exec+0x388>
goto bad;
if(readi(ip, mem + ph.va, ph.offset, ph.filesz) != ph.filesz)
100b65: 8b 55 d8 mov -0x28(%ebp),%edx
100b68: 03 45 84 add -0x7c(%ebp),%eax
100b6b: 89 1c 24 mov %ebx,(%esp)
100b6e: 89 54 24 0c mov %edx,0xc(%esp)
100b72: 8b 55 cc mov -0x34(%ebp),%edx
100b75: 89 44 24 04 mov %eax,0x4(%esp)
100b79: 89 54 24 08 mov %edx,0x8(%esp)
100b7d: e8 ce 0d 00 00 call 101950 <readi>
100b82: 3b 45 d8 cmp -0x28(%ebp),%eax
100b85: 0f 85 8d 01 00 00 jne 100d18 <exec+0x388>
goto bad;
memset(mem + ph.va + ph.filesz, 0, ph.memsz - ph.filesz);
100b8b: 8b 55 dc mov -0x24(%ebp),%edx
if(mem == 0)
goto bad;
memset(mem, 0, sz);
// Load program into memory.
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
100b8e: 83 c6 01 add $0x1,%esi
continue;
if(ph.va + ph.memsz > sz)
goto bad;
if(readi(ip, mem + ph.va, ph.offset, ph.filesz) != ph.filesz)
goto bad;
memset(mem + ph.va + ph.filesz, 0, ph.memsz - ph.filesz);
100b91: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
100b98: 00
100b99: 29 c2 sub %eax,%edx
100b9b: 03 45 d0 add -0x30(%ebp),%eax
100b9e: 03 45 84 add -0x7c(%ebp),%eax
100ba1: 89 54 24 08 mov %edx,0x8(%esp)
100ba5: 89 04 24 mov %eax,(%esp)
100ba8: e8 73 34 00 00 call 104020 <memset>
if(mem == 0)
goto bad;
memset(mem, 0, sz);
// Load program into memory.
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
100bad: 0f b7 45 c0 movzwl -0x40(%ebp),%eax
100bb1: 39 f0 cmp %esi,%eax
100bb3: 0f 8f 6e ff ff ff jg 100b27 <exec+0x197>
goto bad;
if(readi(ip, mem + ph.va, ph.offset, ph.filesz) != ph.filesz)
goto bad;
memset(mem + ph.va + ph.filesz, 0, ph.memsz - ph.filesz);
}
iunlockput(ip);
100bb9: 89 1c 24 mov %ebx,(%esp)
100bbc: e8 3f 0d 00 00 call 101900 <iunlockput>
// Initialize stack.
sp = sz;
argp = sz - arglen - 4*(argc+1);
100bc1: 8b 85 7c ff ff ff mov -0x84(%ebp),%eax
100bc7: 8b 55 80 mov -0x80(%ebp),%edx
100bca: 2b 95 78 ff ff ff sub -0x88(%ebp),%edx
// Copy argv strings and pointers to stack.
*(uint*)(mem+argp + 4*argc) = 0; // argv[argc]
100bd0: 8b 4d 84 mov -0x7c(%ebp),%ecx
}
iunlockput(ip);
// Initialize stack.
sp = sz;
argp = sz - arglen - 4*(argc+1);
100bd3: f7 d0 not %eax
100bd5: 8d 04 82 lea (%edx,%eax,4),%eax
// Copy argv strings and pointers to stack.
*(uint*)(mem+argp + 4*argc) = 0; // argv[argc]
100bd8: 8b 95 7c ff ff ff mov -0x84(%ebp),%edx
}
iunlockput(ip);
// Initialize stack.
sp = sz;
argp = sz - arglen - 4*(argc+1);
100bde: 89 85 78 ff ff ff mov %eax,-0x88(%ebp)
// Copy argv strings and pointers to stack.
*(uint*)(mem+argp + 4*argc) = 0; // argv[argc]
for(i=argc-1; i>=0; i--){
100be4: 89 d3 mov %edx,%ebx
100be6: 83 eb 01 sub $0x1,%ebx
// Initialize stack.
sp = sz;
argp = sz - arglen - 4*(argc+1);
// Copy argv strings and pointers to stack.
*(uint*)(mem+argp + 4*argc) = 0; // argv[argc]
100be9: 8d 04 90 lea (%eax,%edx,4),%eax
for(i=argc-1; i>=0; i--){
100bec: 83 fb ff cmp $0xffffffff,%ebx
// Initialize stack.
sp = sz;
argp = sz - arglen - 4*(argc+1);
// Copy argv strings and pointers to stack.
*(uint*)(mem+argp + 4*argc) = 0; // argv[argc]
100bef: c7 04 01 00 00 00 00 movl $0x0,(%ecx,%eax,1)
for(i=argc-1; i>=0; i--){
100bf6: 74 51 je 100c49 <exec+0x2b9>
100bf8: 8b 85 78 ff ff ff mov -0x88(%ebp),%eax
100bfe: 8b 75 80 mov -0x80(%ebp),%esi
100c01: 8d 3c 01 lea (%ecx,%eax,1),%edi
100c04: 89 bd 7c ff ff ff mov %edi,-0x84(%ebp)
100c0a: 8b 7d 0c mov 0xc(%ebp),%edi
100c0d: 8d 76 00 lea 0x0(%esi),%esi
len = strlen(argv[i]) + 1;
100c10: 8b 04 9f mov (%edi,%ebx,4),%eax
100c13: 89 04 24 mov %eax,(%esp)
100c16: e8 f5 35 00 00 call 104210 <strlen>
100c1b: 83 c0 01 add $0x1,%eax
sp -= len;
100c1e: 29 c6 sub %eax,%esi
memmove(mem+sp, argv[i], len);
100c20: 89 44 24 08 mov %eax,0x8(%esp)
100c24: 8b 04 9f mov (%edi,%ebx,4),%eax
100c27: 89 44 24 04 mov %eax,0x4(%esp)
100c2b: 8b 45 84 mov -0x7c(%ebp),%eax
100c2e: 01 f0 add %esi,%eax
100c30: 89 04 24 mov %eax,(%esp)
100c33: e8 78 34 00 00 call 1040b0 <memmove>
*(uint*)(mem+argp + 4*i) = sp; // argv[i]
100c38: 8b 95 7c ff ff ff mov -0x84(%ebp),%edx
100c3e: 89 34 9a mov %esi,(%edx,%ebx,4)
sp = sz;
argp = sz - arglen - 4*(argc+1);
// Copy argv strings and pointers to stack.
*(uint*)(mem+argp + 4*argc) = 0; // argv[argc]
for(i=argc-1; i>=0; i--){
100c41: 83 eb 01 sub $0x1,%ebx
100c44: 83 fb ff cmp $0xffffffff,%ebx
100c47: 75 c7 jne 100c10 <exec+0x280>
}
// Stack frame for main(argc, argv), below arguments.
sp = argp;
sp -= 4;
*(uint*)(mem+sp) = argp;
100c49: 8b 8d 78 ff ff ff mov -0x88(%ebp),%ecx
100c4f: 8b 45 84 mov -0x7c(%ebp),%eax
sp -= 4;
*(uint*)(mem+sp) = argc;
100c52: 8b 95 74 ff ff ff mov -0x8c(%ebp),%edx
sp -= 4;
100c58: 89 cb mov %ecx,%ebx
}
// Stack frame for main(argc, argv), below arguments.
sp = argp;
sp -= 4;
*(uint*)(mem+sp) = argp;
100c5a: 89 4c 08 fc mov %ecx,-0x4(%eax,%ecx,1)
sp -= 4;
*(uint*)(mem+sp) = argc;
sp -= 4;
100c5e: 83 eb 0c sub $0xc,%ebx
// Stack frame for main(argc, argv), below arguments.
sp = argp;
sp -= 4;
*(uint*)(mem+sp) = argp;
sp -= 4;
*(uint*)(mem+sp) = argc;
100c61: 89 54 08 f8 mov %edx,-0x8(%eax,%ecx,1)
sp -= 4;
*(uint*)(mem+sp) = 0xffffffff; // fake return pc
100c65: c7 44 08 f4 ff ff ff movl $0xffffffff,-0xc(%eax,%ecx,1)
100c6c: ff
// Save program name for debugging.
for(last=s=path; *s; s++)
100c6d: 8b 4d 08 mov 0x8(%ebp),%ecx
100c70: 0f b6 01 movzbl (%ecx),%eax
100c73: 89 ce mov %ecx,%esi
100c75: 84 c0 test %al,%al
100c77: 74 16 je 100c8f <exec+0x2ff>
#include "defs.h"
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
100c79: 8d 51 01 lea 0x1(%ecx),%edx
100c7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
sp -= 4;
*(uint*)(mem+sp) = 0xffffffff; // fake return pc
// Save program name for debugging.
for(last=s=path; *s; s++)
if(*s == '/')
100c80: 3c 2f cmp $0x2f,%al
*(uint*)(mem+sp) = argc;
sp -= 4;
*(uint*)(mem+sp) = 0xffffffff; // fake return pc
// Save program name for debugging.
for(last=s=path; *s; s++)
100c82: 0f b6 02 movzbl (%edx),%eax
if(*s == '/')
100c85: 0f 44 f2 cmove %edx,%esi
*(uint*)(mem+sp) = argc;
sp -= 4;
*(uint*)(mem+sp) = 0xffffffff; // fake return pc
// Save program name for debugging.
for(last=s=path; *s; s++)
100c88: 83 c2 01 add $0x1,%edx
100c8b: 84 c0 test %al,%al
100c8d: 75 f1 jne 100c80 <exec+0x2f0>
if(*s == '/')
last = s+1;
safestrcpy(cp->name, last, sizeof(cp->name));
100c8f: e8 7c 29 00 00 call 103610 <curproc>
100c94: 89 74 24 04 mov %esi,0x4(%esp)
100c98: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
100c9f: 00
100ca0: 05 88 00 00 00 add $0x88,%eax
100ca5: 89 04 24 mov %eax,(%esp)
100ca8: e8 23 35 00 00 call 1041d0 <safestrcpy>
// Commit to the new image.
kfree(cp->mem, cp->sz);
100cad: e8 5e 29 00 00 call 103610 <curproc>
100cb2: 8b 70 04 mov 0x4(%eax),%esi
100cb5: e8 56 29 00 00 call 103610 <curproc>
100cba: 89 74 24 04 mov %esi,0x4(%esp)
100cbe: 8b 00 mov (%eax),%eax
100cc0: 89 04 24 mov %eax,(%esp)
100cc3: e8 68 16 00 00 call 102330 <kfree>
cp->mem = mem;
100cc8: e8 43 29 00 00 call 103610 <curproc>
100ccd: 8b 55 84 mov -0x7c(%ebp),%edx
100cd0: 89 10 mov %edx,(%eax)
cp->sz = sz;
100cd2: e8 39 29 00 00 call 103610 <curproc>
100cd7: 8b 4d 80 mov -0x80(%ebp),%ecx
100cda: 89 48 04 mov %ecx,0x4(%eax)
cp->tf->eip = elf.entry; // main
100cdd: e8 2e 29 00 00 call 103610 <curproc>
100ce2: 8b 55 ac mov -0x54(%ebp),%edx
100ce5: 8b 80 84 00 00 00 mov 0x84(%eax),%eax
100ceb: 89 50 30 mov %edx,0x30(%eax)
cp->tf->esp = sp;
100cee: e8 1d 29 00 00 call 103610 <curproc>
100cf3: 8b 80 84 00 00 00 mov 0x84(%eax),%eax
100cf9: 89 58 3c mov %ebx,0x3c(%eax)
setupsegs(cp);
100cfc: e8 0f 29 00 00 call 103610 <curproc>
100d01: 89 04 24 mov %eax,(%esp)
100d04: e8 67 24 00 00 call 103170 <setupsegs>
return 0;
100d09: 31 c0 xor %eax,%eax
bad:
if(mem)
kfree(mem, sz);
iunlockput(ip);
return -1;
}
100d0b: 81 c4 9c 00 00 00 add $0x9c,%esp
100d11: 5b pop %ebx
100d12: 5e pop %esi
100d13: 5f pop %edi
100d14: 5d pop %ebp
100d15: c3 ret
100d16: 66 90 xchg %ax,%ax
setupsegs(cp);
return 0;
bad:
if(mem)
kfree(mem, sz);
100d18: 8b 45 80 mov -0x80(%ebp),%eax
100d1b: 8b 55 84 mov -0x7c(%ebp),%edx
100d1e: 89 44 24 04 mov %eax,0x4(%esp)
100d22: 89 14 24 mov %edx,(%esp)
100d25: e8 06 16 00 00 call 102330 <kfree>
iunlockput(ip);
100d2a: 89 1c 24 mov %ebx,(%esp)
100d2d: e8 ce 0b 00 00 call 101900 <iunlockput>
return -1;
}
100d32: 81 c4 9c 00 00 00 add $0x9c,%esp
bad:
if(mem)
kfree(mem, sz);
iunlockput(ip);
return -1;
100d38: b8 ff ff ff ff mov $0xffffffff,%eax
}
100d3d: 5b pop %ebx
100d3e: 5e pop %esi
100d3f: 5f pop %edi
100d40: 5d pop %ebp
100d41: c3 ret
sz += ph.memsz;
}
// Arguments.
arglen = 0;
for(argc=0; argv[argc]; argc++)
100d42: b8 04 00 00 00 mov $0x4,%eax
100d47: c7 85 78 ff ff ff 00 movl $0x0,-0x88(%ebp)
100d4e: 00 00 00
100d51: c7 85 74 ff ff ff 00 movl $0x0,-0x8c(%ebp)
100d58: 00 00 00
100d5b: c7 85 7c ff ff ff 00 movl $0x0,-0x84(%ebp)
100d62: 00 00 00
100d65: e9 61 fd ff ff jmp 100acb <exec+0x13b>
// Program segments.
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
goto bad;
if(elf.magic != ELF_MAGIC)
goto bad;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
100d6a: bf ff 1f 00 00 mov $0x1fff,%edi
100d6f: e9 f7 fc ff ff jmp 100a6b <exec+0xdb>
100d74: 90 nop
100d75: 90 nop
100d76: 90 nop
100d77: 90 nop
100d78: 90 nop
100d79: 90 nop
100d7a: 90 nop
100d7b: 90 nop
100d7c: 90 nop
100d7d: 90 nop
100d7e: 90 nop
100d7f: 90 nop
00100d80 <fileinit>:
struct spinlock file_table_lock;
struct file file[NFILE];
void
fileinit(void)
{
100d80: 55 push %ebp
100d81: 89 e5 mov %esp,%ebp
100d83: 83 ec 18 sub $0x18,%esp
initlock(&file_table_lock, "file_table");
100d86: c7 44 24 04 8a 60 10 movl $0x10608a,0x4(%esp)
100d8d: 00
100d8e: c7 04 24 00 9a 10 00 movl $0x109a00,(%esp)
100d95: e8 56 30 00 00 call 103df0 <initlock>
}
100d9a: c9 leave
100d9b: c3 ret
100d9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00100da0 <filealloc>:
// Allocate a file structure.
struct file*
filealloc(void)
{
100da0: 55 push %ebp
100da1: 89 e5 mov %esp,%ebp
100da3: 53 push %ebx
100da4: 83 ec 14 sub $0x14,%esp
int i;
acquire(&file_table_lock);
100da7: c7 04 24 00 9a 10 00 movl $0x109a00,(%esp)
100dae: e8 3d 31 00 00 call 103ef0 <acquire>
100db3: ba a0 90 10 00 mov $0x1090a0,%edx
for(i = 0; i < NFILE; i++){
100db8: 31 c0 xor %eax,%eax
100dba: eb 0f jmp 100dcb <filealloc+0x2b>
100dbc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
100dc0: 83 c0 01 add $0x1,%eax
100dc3: 83 c2 18 add $0x18,%edx
100dc6: 83 f8 64 cmp $0x64,%eax
100dc9: 74 3d je 100e08 <filealloc+0x68>
if(file[i].type == FD_CLOSED){
100dcb: 8b 0a mov (%edx),%ecx
100dcd: 85 c9 test %ecx,%ecx
100dcf: 75 ef jne 100dc0 <filealloc+0x20>
file[i].type = FD_NONE;
100dd1: 8d 04 40 lea (%eax,%eax,2),%eax
100dd4: c1 e0 03 shl $0x3,%eax
100dd7: 8d 98 a0 90 10 00 lea 0x1090a0(%eax),%ebx
100ddd: c7 80 a0 90 10 00 01 movl $0x1,0x1090a0(%eax)
100de4: 00 00 00
file[i].ref = 1;
100de7: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx)
release(&file_table_lock);
100dee: c7 04 24 00 9a 10 00 movl $0x109a00,(%esp)
100df5: e8 e6 31 00 00 call 103fe0 <release>
return file + i;
100dfa: 89 d8 mov %ebx,%eax
}
}
release(&file_table_lock);
return 0;
}
100dfc: 83 c4 14 add $0x14,%esp
100dff: 5b pop %ebx
100e00: 5d pop %ebp
100e01: c3 ret
100e02: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
file[i].ref = 1;
release(&file_table_lock);
return file + i;
}
}
release(&file_table_lock);
100e08: c7 04 24 00 9a 10 00 movl $0x109a00,(%esp)
100e0f: e8 cc 31 00 00 call 103fe0 <release>
return 0;
}
100e14: 83 c4 14 add $0x14,%esp
release(&file_table_lock);
return file + i;
}
}
release(&file_table_lock);
return 0;
100e17: 31 c0 xor %eax,%eax
}
100e19: 5b pop %ebx
100e1a: 5d pop %ebp
100e1b: c3 ret
100e1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00100e20 <filedup>:
// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
100e20: 55 push %ebp
100e21: 89 e5 mov %esp,%ebp
100e23: 53 push %ebx
100e24: 83 ec 14 sub $0x14,%esp
100e27: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&file_table_lock);
100e2a: c7 04 24 00 9a 10 00 movl $0x109a00,(%esp)
100e31: e8 ba 30 00 00 call 103ef0 <acquire>
if(f->ref < 1 || f->type == FD_CLOSED)
100e36: 8b 43 04 mov 0x4(%ebx),%eax
100e39: 85 c0 test %eax,%eax
100e3b: 7e 20 jle 100e5d <filedup+0x3d>
100e3d: 8b 13 mov (%ebx),%edx
100e3f: 85 d2 test %edx,%edx
100e41: 74 1a je 100e5d <filedup+0x3d>
panic("filedup");
f->ref++;
100e43: 83 c0 01 add $0x1,%eax
100e46: 89 43 04 mov %eax,0x4(%ebx)
release(&file_table_lock);
100e49: c7 04 24 00 9a 10 00 movl $0x109a00,(%esp)
100e50: e8 8b 31 00 00 call 103fe0 <release>
return f;
}
100e55: 89 d8 mov %ebx,%eax
100e57: 83 c4 14 add $0x14,%esp
100e5a: 5b pop %ebx
100e5b: 5d pop %ebp
100e5c: c3 ret
struct file*
filedup(struct file *f)
{
acquire(&file_table_lock);
if(f->ref < 1 || f->type == FD_CLOSED)
panic("filedup");
100e5d: c7 04 24 95 60 10 00 movl $0x106095,(%esp)
100e64: e8 97 fa ff ff call 100900 <panic>
100e69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00100e70 <fileclose>:
}
// Close file f. (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
100e70: 55 push %ebp
100e71: 89 e5 mov %esp,%ebp
100e73: 83 ec 38 sub $0x38,%esp
100e76: 89 5d f4 mov %ebx,-0xc(%ebp)
100e79: 8b 5d 08 mov 0x8(%ebp),%ebx
100e7c: 89 75 f8 mov %esi,-0x8(%ebp)
100e7f: 89 7d fc mov %edi,-0x4(%ebp)
struct file ff;
acquire(&file_table_lock);
100e82: c7 04 24 00 9a 10 00 movl $0x109a00,(%esp)
100e89: e8 62 30 00 00 call 103ef0 <acquire>
if(f->ref < 1 || f->type == FD_CLOSED)
100e8e: 8b 43 04 mov 0x4(%ebx),%eax
100e91: 85 c0 test %eax,%eax
100e93: 0f 8e 97 00 00 00 jle 100f30 <fileclose+0xc0>
100e99: 8b 33 mov (%ebx),%esi
100e9b: 85 f6 test %esi,%esi
100e9d: 0f 84 8d 00 00 00 je 100f30 <fileclose+0xc0>
panic("fileclose");
if(--f->ref > 0){
100ea3: 83 e8 01 sub $0x1,%eax
100ea6: 85 c0 test %eax,%eax
100ea8: 89 43 04 mov %eax,0x4(%ebx)
100eab: 74 1b je 100ec8 <fileclose+0x58>
release(&file_table_lock);
100ead: c7 45 08 00 9a 10 00 movl $0x109a00,0x8(%ebp)
pipeclose(ff.pipe, ff.writable);
else if(ff.type == FD_INODE)
iput(ff.ip);
else
panic("fileclose");
}
100eb4: 8b 5d f4 mov -0xc(%ebp),%ebx
100eb7: 8b 75 f8 mov -0x8(%ebp),%esi
100eba: 8b 7d fc mov -0x4(%ebp),%edi
100ebd: 89 ec mov %ebp,%esp
100ebf: 5d pop %ebp
acquire(&file_table_lock);
if(f->ref < 1 || f->type == FD_CLOSED)
panic("fileclose");
if(--f->ref > 0){
release(&file_table_lock);
100ec0: e9 1b 31 00 00 jmp 103fe0 <release>
100ec5: 8d 76 00 lea 0x0(%esi),%esi
100ec8: 0f b6 43 09 movzbl 0x9(%ebx),%eax
return;
}
ff = *f;
f->ref = 0;
100ecc: c7 43 04 00 00 00 00 movl $0x0,0x4(%ebx)
acquire(&file_table_lock);
if(f->ref < 1 || f->type == FD_CLOSED)
panic("fileclose");
if(--f->ref > 0){
release(&file_table_lock);
100ed3: 8b 7b 10 mov 0x10(%ebx),%edi
return;
}
ff = *f;
f->ref = 0;
f->type = FD_CLOSED;
100ed6: c7 03 00 00 00 00 movl $0x0,(%ebx)
acquire(&file_table_lock);
if(f->ref < 1 || f->type == FD_CLOSED)
panic("fileclose");
if(--f->ref > 0){
release(&file_table_lock);
100edc: 88 45 e7 mov %al,-0x19(%ebp)
100edf: 8b 43 0c mov 0xc(%ebx),%eax
return;
}
ff = *f;
f->ref = 0;
f->type = FD_CLOSED;
release(&file_table_lock);
100ee2: c7 04 24 00 9a 10 00 movl $0x109a00,(%esp)
acquire(&file_table_lock);
if(f->ref < 1 || f->type == FD_CLOSED)
panic("fileclose");
if(--f->ref > 0){
release(&file_table_lock);
100ee9: 89 45 e0 mov %eax,-0x20(%ebp)
return;
}
ff = *f;
f->ref = 0;
f->type = FD_CLOSED;
release(&file_table_lock);
100eec: e8 ef 30 00 00 call 103fe0 <release>
if(ff.type == FD_PIPE)
100ef1: 83 fe 02 cmp $0x2,%esi
100ef4: 74 1a je 100f10 <fileclose+0xa0>
pipeclose(ff.pipe, ff.writable);
else if(ff.type == FD_INODE)
100ef6: 83 fe 03 cmp $0x3,%esi
100ef9: 75 35 jne 100f30 <fileclose+0xc0>
iput(ff.ip);
100efb: 89 7d 08 mov %edi,0x8(%ebp)
else
panic("fileclose");
}
100efe: 8b 5d f4 mov -0xc(%ebp),%ebx
100f01: 8b 75 f8 mov -0x8(%ebp),%esi
100f04: 8b 7d fc mov -0x4(%ebp),%edi
100f07: 89 ec mov %ebp,%esp
100f09: 5d pop %ebp
release(&file_table_lock);