Skip to content

Instantly share code, notes, and snippets.

@jasonpr59
Last active August 29, 2015 14:07
Show Gist options
  • Save jasonpr59/2a9567419c4ef7080d5e to your computer and use it in GitHub Desktop.
Save jasonpr59/2a9567419c4ef7080d5e to your computer and use it in GitHub Desktop.
kernel: file format elf32-i386
Disassembly of section .text:
80100000 <multiboot_header>:
80100000: 02 b0 ad 1b 00 00 add 0x1bad(%eax),%dh
80100006: 00 00 add %al,(%eax)
80100008: fe 4f 52 decb 0x52(%edi)
8010000b: e4 0f in $0xf,%al
8010000c <entry>:
# Entering xv6 on boot processor, with paging off.
.globl entry
entry:
# Turn on page size extension for 4Mbyte pages
movl %cr4, %eax
8010000c: 0f 20 e0 mov %cr4,%eax
orl $(CR4_PSE), %eax
8010000f: 83 c8 10 or $0x10,%eax
movl %eax, %cr4
80100012: 0f 22 e0 mov %eax,%cr4
# Set page directory
movl $(V2P_WO(entrypgdir)), %eax
80100015: b8 00 a0 10 00 mov $0x10a000,%eax
movl %eax, %cr3
8010001a: 0f 22 d8 mov %eax,%cr3
# Turn on paging.
movl %cr0, %eax
8010001d: 0f 20 c0 mov %cr0,%eax
orl $(CR0_PG|CR0_WP), %eax
80100020: 0d 00 00 01 80 or $0x80010000,%eax
movl %eax, %cr0
80100025: 0f 22 c0 mov %eax,%cr0
# Set up the stack pointer.
movl $(stack + KSTACKSIZE), %esp
80100028: bc b0 c6 10 80 mov $0x8010c6b0,%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 1a 37 10 80 mov $0x8010371a,%eax
jmp *%eax
80100032: ff e0 jmp *%eax
80100034 <binit>:
struct buf head;
} bcache;
void
binit(void)
{
80100034: 55 push %ebp
80100035: 89 e5 mov %esp,%ebp
80100037: 83 ec 28 sub $0x28,%esp
struct buf *b;
initlock(&bcache.lock, "bcache");
8010003a: c7 44 24 04 f0 83 10 movl $0x801083f0,0x4(%esp)
80100041: 80
80100042: c7 04 24 c0 c6 10 80 movl $0x8010c6c0,(%esp)
80100049: e8 7e 4d 00 00 call 80104dcc <initlock>
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
8010004e: c7 05 d0 05 11 80 c4 movl $0x801105c4,0x801105d0
80100055: 05 11 80
bcache.head.next = &bcache.head;
80100058: c7 05 d4 05 11 80 c4 movl $0x801105c4,0x801105d4
8010005f: 05 11 80
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100062: c7 45 f4 f4 c6 10 80 movl $0x8010c6f4,-0xc(%ebp)
80100069: eb 3a jmp 801000a5 <binit+0x71>
b->next = bcache.head.next;
8010006b: 8b 15 d4 05 11 80 mov 0x801105d4,%edx
80100071: 8b 45 f4 mov -0xc(%ebp),%eax
80100074: 89 50 10 mov %edx,0x10(%eax)
b->prev = &bcache.head;
80100077: 8b 45 f4 mov -0xc(%ebp),%eax
8010007a: c7 40 0c c4 05 11 80 movl $0x801105c4,0xc(%eax)
b->dev = -1;
80100081: 8b 45 f4 mov -0xc(%ebp),%eax
80100084: c7 40 04 ff ff ff ff movl $0xffffffff,0x4(%eax)
bcache.head.next->prev = b;
8010008b: a1 d4 05 11 80 mov 0x801105d4,%eax
80100090: 8b 55 f4 mov -0xc(%ebp),%edx
80100093: 89 50 0c mov %edx,0xc(%eax)
bcache.head.next = b;
80100096: 8b 45 f4 mov -0xc(%ebp),%eax
80100099: a3 d4 05 11 80 mov %eax,0x801105d4
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
8010009e: 81 45 f4 18 02 00 00 addl $0x218,-0xc(%ebp)
801000a5: 81 7d f4 c4 05 11 80 cmpl $0x801105c4,-0xc(%ebp)
801000ac: 72 bd jb 8010006b <binit+0x37>
b->prev = &bcache.head;
b->dev = -1;
bcache.head.next->prev = b;
bcache.head.next = b;
}
}
801000ae: c9 leave
801000af: c3 ret
801000b0 <bget>:
// Look through buffer cache for sector on device dev.
// If not found, allocate a buffer.
// In either case, return B_BUSY buffer.
static struct buf*
bget(uint dev, uint sector)
{
801000b0: 55 push %ebp
801000b1: 89 e5 mov %esp,%ebp
801000b3: 83 ec 28 sub $0x28,%esp
struct buf *b;
acquire(&bcache.lock);
801000b6: c7 04 24 c0 c6 10 80 movl $0x8010c6c0,(%esp)
801000bd: e8 2b 4d 00 00 call 80104ded <acquire>
loop:
// Is the sector already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000c2: a1 d4 05 11 80 mov 0x801105d4,%eax
801000c7: 89 45 f4 mov %eax,-0xc(%ebp)
801000ca: eb 63 jmp 8010012f <bget+0x7f>
if(b->dev == dev && b->sector == sector){
801000cc: 8b 45 f4 mov -0xc(%ebp),%eax
801000cf: 8b 40 04 mov 0x4(%eax),%eax
801000d2: 3b 45 08 cmp 0x8(%ebp),%eax
801000d5: 75 4f jne 80100126 <bget+0x76>
801000d7: 8b 45 f4 mov -0xc(%ebp),%eax
801000da: 8b 40 08 mov 0x8(%eax),%eax
801000dd: 3b 45 0c cmp 0xc(%ebp),%eax
801000e0: 75 44 jne 80100126 <bget+0x76>
if(!(b->flags & B_BUSY)){
801000e2: 8b 45 f4 mov -0xc(%ebp),%eax
801000e5: 8b 00 mov (%eax),%eax
801000e7: 83 e0 01 and $0x1,%eax
801000ea: 85 c0 test %eax,%eax
801000ec: 75 23 jne 80100111 <bget+0x61>
b->flags |= B_BUSY;
801000ee: 8b 45 f4 mov -0xc(%ebp),%eax
801000f1: 8b 00 mov (%eax),%eax
801000f3: 83 c8 01 or $0x1,%eax
801000f6: 89 c2 mov %eax,%edx
801000f8: 8b 45 f4 mov -0xc(%ebp),%eax
801000fb: 89 10 mov %edx,(%eax)
release(&bcache.lock);
801000fd: c7 04 24 c0 c6 10 80 movl $0x8010c6c0,(%esp)
80100104: e8 46 4d 00 00 call 80104e4f <release>
return b;
80100109: 8b 45 f4 mov -0xc(%ebp),%eax
8010010c: e9 93 00 00 00 jmp 801001a4 <bget+0xf4>
}
sleep(b, &bcache.lock);
80100111: c7 44 24 04 c0 c6 10 movl $0x8010c6c0,0x4(%esp)
80100118: 80
80100119: 8b 45 f4 mov -0xc(%ebp),%eax
8010011c: 89 04 24 mov %eax,(%esp)
8010011f: e8 ff 49 00 00 call 80104b23 <sleep>
goto loop;
80100124: eb 9c jmp 801000c2 <bget+0x12>
acquire(&bcache.lock);
loop:
// Is the sector already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
80100126: 8b 45 f4 mov -0xc(%ebp),%eax
80100129: 8b 40 10 mov 0x10(%eax),%eax
8010012c: 89 45 f4 mov %eax,-0xc(%ebp)
8010012f: 81 7d f4 c4 05 11 80 cmpl $0x801105c4,-0xc(%ebp)
80100136: 75 94 jne 801000cc <bget+0x1c>
}
// Not cached; recycle some non-busy and clean buffer.
// "clean" because B_DIRTY and !B_BUSY means log.c
// hasn't yet committed the changes to the buffer.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100138: a1 d0 05 11 80 mov 0x801105d0,%eax
8010013d: 89 45 f4 mov %eax,-0xc(%ebp)
80100140: eb 4d jmp 8010018f <bget+0xdf>
if((b->flags & B_BUSY) == 0 && (b->flags & B_DIRTY) == 0){
80100142: 8b 45 f4 mov -0xc(%ebp),%eax
80100145: 8b 00 mov (%eax),%eax
80100147: 83 e0 01 and $0x1,%eax
8010014a: 85 c0 test %eax,%eax
8010014c: 75 38 jne 80100186 <bget+0xd6>
8010014e: 8b 45 f4 mov -0xc(%ebp),%eax
80100151: 8b 00 mov (%eax),%eax
80100153: 83 e0 04 and $0x4,%eax
80100156: 85 c0 test %eax,%eax
80100158: 75 2c jne 80100186 <bget+0xd6>
b->dev = dev;
8010015a: 8b 45 f4 mov -0xc(%ebp),%eax
8010015d: 8b 55 08 mov 0x8(%ebp),%edx
80100160: 89 50 04 mov %edx,0x4(%eax)
b->sector = sector;
80100163: 8b 45 f4 mov -0xc(%ebp),%eax
80100166: 8b 55 0c mov 0xc(%ebp),%edx
80100169: 89 50 08 mov %edx,0x8(%eax)
b->flags = B_BUSY;
8010016c: 8b 45 f4 mov -0xc(%ebp),%eax
8010016f: c7 00 01 00 00 00 movl $0x1,(%eax)
release(&bcache.lock);
80100175: c7 04 24 c0 c6 10 80 movl $0x8010c6c0,(%esp)
8010017c: e8 ce 4c 00 00 call 80104e4f <release>
return b;
80100181: 8b 45 f4 mov -0xc(%ebp),%eax
80100184: eb 1e jmp 801001a4 <bget+0xf4>
}
// Not cached; recycle some non-busy and clean buffer.
// "clean" because B_DIRTY and !B_BUSY means log.c
// hasn't yet committed the changes to the buffer.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100186: 8b 45 f4 mov -0xc(%ebp),%eax
80100189: 8b 40 0c mov 0xc(%eax),%eax
8010018c: 89 45 f4 mov %eax,-0xc(%ebp)
8010018f: 81 7d f4 c4 05 11 80 cmpl $0x801105c4,-0xc(%ebp)
80100196: 75 aa jne 80100142 <bget+0x92>
b->flags = B_BUSY;
release(&bcache.lock);
return b;
}
}
panic("bget: no buffers");
80100198: c7 04 24 f7 83 10 80 movl $0x801083f7,(%esp)
8010019f: e8 96 03 00 00 call 8010053a <panic>
}
801001a4: c9 leave
801001a5: c3 ret
801001a6 <bread>:
// Return a B_BUSY buf with the contents of the indicated disk sector.
struct buf*
bread(uint dev, uint sector)
{
801001a6: 55 push %ebp
801001a7: 89 e5 mov %esp,%ebp
801001a9: 83 ec 28 sub $0x28,%esp
struct buf *b;
b = bget(dev, sector);
801001ac: 8b 45 0c mov 0xc(%ebp),%eax
801001af: 89 44 24 04 mov %eax,0x4(%esp)
801001b3: 8b 45 08 mov 0x8(%ebp),%eax
801001b6: 89 04 24 mov %eax,(%esp)
801001b9: e8 f2 fe ff ff call 801000b0 <bget>
801001be: 89 45 f4 mov %eax,-0xc(%ebp)
if(!(b->flags & B_VALID))
801001c1: 8b 45 f4 mov -0xc(%ebp),%eax
801001c4: 8b 00 mov (%eax),%eax
801001c6: 83 e0 02 and $0x2,%eax
801001c9: 85 c0 test %eax,%eax
801001cb: 75 0b jne 801001d8 <bread+0x32>
iderw(b);
801001cd: 8b 45 f4 mov -0xc(%ebp),%eax
801001d0: 89 04 24 mov %eax,(%esp)
801001d3: e8 e4 25 00 00 call 801027bc <iderw>
return b;
801001d8: 8b 45 f4 mov -0xc(%ebp),%eax
}
801001db: c9 leave
801001dc: c3 ret
801001dd <bwrite>:
// Write b's contents to disk. Must be B_BUSY.
void
bwrite(struct buf *b)
{
801001dd: 55 push %ebp
801001de: 89 e5 mov %esp,%ebp
801001e0: 83 ec 18 sub $0x18,%esp
if((b->flags & B_BUSY) == 0)
801001e3: 8b 45 08 mov 0x8(%ebp),%eax
801001e6: 8b 00 mov (%eax),%eax
801001e8: 83 e0 01 and $0x1,%eax
801001eb: 85 c0 test %eax,%eax
801001ed: 75 0c jne 801001fb <bwrite+0x1e>
panic("bwrite");
801001ef: c7 04 24 08 84 10 80 movl $0x80108408,(%esp)
801001f6: e8 3f 03 00 00 call 8010053a <panic>
b->flags |= B_DIRTY;
801001fb: 8b 45 08 mov 0x8(%ebp),%eax
801001fe: 8b 00 mov (%eax),%eax
80100200: 83 c8 04 or $0x4,%eax
80100203: 89 c2 mov %eax,%edx
80100205: 8b 45 08 mov 0x8(%ebp),%eax
80100208: 89 10 mov %edx,(%eax)
iderw(b);
8010020a: 8b 45 08 mov 0x8(%ebp),%eax
8010020d: 89 04 24 mov %eax,(%esp)
80100210: e8 a7 25 00 00 call 801027bc <iderw>
}
80100215: c9 leave
80100216: c3 ret
80100217 <brelse>:
// Release a B_BUSY buffer.
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
80100217: 55 push %ebp
80100218: 89 e5 mov %esp,%ebp
8010021a: 83 ec 18 sub $0x18,%esp
if((b->flags & B_BUSY) == 0)
8010021d: 8b 45 08 mov 0x8(%ebp),%eax
80100220: 8b 00 mov (%eax),%eax
80100222: 83 e0 01 and $0x1,%eax
80100225: 85 c0 test %eax,%eax
80100227: 75 0c jne 80100235 <brelse+0x1e>
panic("brelse");
80100229: c7 04 24 0f 84 10 80 movl $0x8010840f,(%esp)
80100230: e8 05 03 00 00 call 8010053a <panic>
acquire(&bcache.lock);
80100235: c7 04 24 c0 c6 10 80 movl $0x8010c6c0,(%esp)
8010023c: e8 ac 4b 00 00 call 80104ded <acquire>
b->next->prev = b->prev;
80100241: 8b 45 08 mov 0x8(%ebp),%eax
80100244: 8b 40 10 mov 0x10(%eax),%eax
80100247: 8b 55 08 mov 0x8(%ebp),%edx
8010024a: 8b 52 0c mov 0xc(%edx),%edx
8010024d: 89 50 0c mov %edx,0xc(%eax)
b->prev->next = b->next;
80100250: 8b 45 08 mov 0x8(%ebp),%eax
80100253: 8b 40 0c mov 0xc(%eax),%eax
80100256: 8b 55 08 mov 0x8(%ebp),%edx
80100259: 8b 52 10 mov 0x10(%edx),%edx
8010025c: 89 50 10 mov %edx,0x10(%eax)
b->next = bcache.head.next;
8010025f: 8b 15 d4 05 11 80 mov 0x801105d4,%edx
80100265: 8b 45 08 mov 0x8(%ebp),%eax
80100268: 89 50 10 mov %edx,0x10(%eax)
b->prev = &bcache.head;
8010026b: 8b 45 08 mov 0x8(%ebp),%eax
8010026e: c7 40 0c c4 05 11 80 movl $0x801105c4,0xc(%eax)
bcache.head.next->prev = b;
80100275: a1 d4 05 11 80 mov 0x801105d4,%eax
8010027a: 8b 55 08 mov 0x8(%ebp),%edx
8010027d: 89 50 0c mov %edx,0xc(%eax)
bcache.head.next = b;
80100280: 8b 45 08 mov 0x8(%ebp),%eax
80100283: a3 d4 05 11 80 mov %eax,0x801105d4
b->flags &= ~B_BUSY;
80100288: 8b 45 08 mov 0x8(%ebp),%eax
8010028b: 8b 00 mov (%eax),%eax
8010028d: 83 e0 fe and $0xfffffffe,%eax
80100290: 89 c2 mov %eax,%edx
80100292: 8b 45 08 mov 0x8(%ebp),%eax
80100295: 89 10 mov %edx,(%eax)
wakeup(b);
80100297: 8b 45 08 mov 0x8(%ebp),%eax
8010029a: 89 04 24 mov %eax,(%esp)
8010029d: e8 5a 49 00 00 call 80104bfc <wakeup>
release(&bcache.lock);
801002a2: c7 04 24 c0 c6 10 80 movl $0x8010c6c0,(%esp)
801002a9: e8 a1 4b 00 00 call 80104e4f <release>
}
801002ae: c9 leave
801002af: c3 ret
801002b0 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
801002b0: 55 push %ebp
801002b1: 89 e5 mov %esp,%ebp
801002b3: 83 ec 14 sub $0x14,%esp
801002b6: 8b 45 08 mov 0x8(%ebp),%eax
801002b9: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801002bd: 0f b7 45 ec movzwl -0x14(%ebp),%eax
801002c1: 89 c2 mov %eax,%edx
801002c3: ec in (%dx),%al
801002c4: 88 45 ff mov %al,-0x1(%ebp)
return data;
801002c7: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
801002cb: c9 leave
801002cc: c3 ret
801002cd <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
801002cd: 55 push %ebp
801002ce: 89 e5 mov %esp,%ebp
801002d0: 83 ec 08 sub $0x8,%esp
801002d3: 8b 55 08 mov 0x8(%ebp),%edx
801002d6: 8b 45 0c mov 0xc(%ebp),%eax
801002d9: 66 89 55 fc mov %dx,-0x4(%ebp)
801002dd: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801002e0: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
801002e4: 0f b7 55 fc movzwl -0x4(%ebp),%edx
801002e8: ee out %al,(%dx)
}
801002e9: c9 leave
801002ea: c3 ret
801002eb <cli>:
asm volatile("movw %0, %%gs" : : "r" (v));
}
static inline void
cli(void)
{
801002eb: 55 push %ebp
801002ec: 89 e5 mov %esp,%ebp
asm volatile("cli");
801002ee: fa cli
}
801002ef: 5d pop %ebp
801002f0: c3 ret
801002f1 <printint>:
int locking;
} cons;
static void
printint(int xx, int base, int sign)
{
801002f1: 55 push %ebp
801002f2: 89 e5 mov %esp,%ebp
801002f4: 56 push %esi
801002f5: 53 push %ebx
801002f6: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789abcdef";
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
801002f9: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801002fd: 74 1c je 8010031b <printint+0x2a>
801002ff: 8b 45 08 mov 0x8(%ebp),%eax
80100302: c1 e8 1f shr $0x1f,%eax
80100305: 0f b6 c0 movzbl %al,%eax
80100308: 89 45 10 mov %eax,0x10(%ebp)
8010030b: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
8010030f: 74 0a je 8010031b <printint+0x2a>
x = -xx;
80100311: 8b 45 08 mov 0x8(%ebp),%eax
80100314: f7 d8 neg %eax
80100316: 89 45 f0 mov %eax,-0x10(%ebp)
80100319: eb 06 jmp 80100321 <printint+0x30>
else
x = xx;
8010031b: 8b 45 08 mov 0x8(%ebp),%eax
8010031e: 89 45 f0 mov %eax,-0x10(%ebp)
i = 0;
80100321: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
80100328: 8b 4d f4 mov -0xc(%ebp),%ecx
8010032b: 8d 41 01 lea 0x1(%ecx),%eax
8010032e: 89 45 f4 mov %eax,-0xc(%ebp)
80100331: 8b 5d 0c mov 0xc(%ebp),%ebx
80100334: 8b 45 f0 mov -0x10(%ebp),%eax
80100337: ba 00 00 00 00 mov $0x0,%edx
8010033c: f7 f3 div %ebx
8010033e: 89 d0 mov %edx,%eax
80100340: 0f b6 80 04 90 10 80 movzbl -0x7fef6ffc(%eax),%eax
80100347: 88 44 0d e0 mov %al,-0x20(%ebp,%ecx,1)
}while((x /= base) != 0);
8010034b: 8b 75 0c mov 0xc(%ebp),%esi
8010034e: 8b 45 f0 mov -0x10(%ebp),%eax
80100351: ba 00 00 00 00 mov $0x0,%edx
80100356: f7 f6 div %esi
80100358: 89 45 f0 mov %eax,-0x10(%ebp)
8010035b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010035f: 75 c7 jne 80100328 <printint+0x37>
if(sign)
80100361: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80100365: 74 10 je 80100377 <printint+0x86>
buf[i++] = '-';
80100367: 8b 45 f4 mov -0xc(%ebp),%eax
8010036a: 8d 50 01 lea 0x1(%eax),%edx
8010036d: 89 55 f4 mov %edx,-0xc(%ebp)
80100370: c6 44 05 e0 2d movb $0x2d,-0x20(%ebp,%eax,1)
while(--i >= 0)
80100375: eb 18 jmp 8010038f <printint+0x9e>
80100377: eb 16 jmp 8010038f <printint+0x9e>
consputc(buf[i]);
80100379: 8d 55 e0 lea -0x20(%ebp),%edx
8010037c: 8b 45 f4 mov -0xc(%ebp),%eax
8010037f: 01 d0 add %edx,%eax
80100381: 0f b6 00 movzbl (%eax),%eax
80100384: 0f be c0 movsbl %al,%eax
80100387: 89 04 24 mov %eax,(%esp)
8010038a: e8 c1 03 00 00 call 80100750 <consputc>
}while((x /= base) != 0);
if(sign)
buf[i++] = '-';
while(--i >= 0)
8010038f: 83 6d f4 01 subl $0x1,-0xc(%ebp)
80100393: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100397: 79 e0 jns 80100379 <printint+0x88>
consputc(buf[i]);
}
80100399: 83 c4 30 add $0x30,%esp
8010039c: 5b pop %ebx
8010039d: 5e pop %esi
8010039e: 5d pop %ebp
8010039f: c3 ret
801003a0 <cprintf>:
//PAGEBREAK: 50
// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
801003a0: 55 push %ebp
801003a1: 89 e5 mov %esp,%ebp
801003a3: 83 ec 38 sub $0x38,%esp
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
801003a6: a1 54 b6 10 80 mov 0x8010b654,%eax
801003ab: 89 45 e8 mov %eax,-0x18(%ebp)
if(locking)
801003ae: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
801003b2: 74 0c je 801003c0 <cprintf+0x20>
acquire(&cons.lock);
801003b4: c7 04 24 20 b6 10 80 movl $0x8010b620,(%esp)
801003bb: e8 2d 4a 00 00 call 80104ded <acquire>
if (fmt == 0)
801003c0: 8b 45 08 mov 0x8(%ebp),%eax
801003c3: 85 c0 test %eax,%eax
801003c5: 75 0c jne 801003d3 <cprintf+0x33>
panic("null fmt");
801003c7: c7 04 24 16 84 10 80 movl $0x80108416,(%esp)
801003ce: e8 67 01 00 00 call 8010053a <panic>
argp = (uint*)(void*)(&fmt + 1);
801003d3: 8d 45 0c lea 0xc(%ebp),%eax
801003d6: 89 45 f0 mov %eax,-0x10(%ebp)
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801003d9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801003e0: e9 21 01 00 00 jmp 80100506 <cprintf+0x166>
if(c != '%'){
801003e5: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
801003e9: 74 10 je 801003fb <cprintf+0x5b>
consputc(c);
801003eb: 8b 45 e4 mov -0x1c(%ebp),%eax
801003ee: 89 04 24 mov %eax,(%esp)
801003f1: e8 5a 03 00 00 call 80100750 <consputc>
continue;
801003f6: e9 07 01 00 00 jmp 80100502 <cprintf+0x162>
}
c = fmt[++i] & 0xff;
801003fb: 8b 55 08 mov 0x8(%ebp),%edx
801003fe: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100402: 8b 45 f4 mov -0xc(%ebp),%eax
80100405: 01 d0 add %edx,%eax
80100407: 0f b6 00 movzbl (%eax),%eax
8010040a: 0f be c0 movsbl %al,%eax
8010040d: 25 ff 00 00 00 and $0xff,%eax
80100412: 89 45 e4 mov %eax,-0x1c(%ebp)
if(c == 0)
80100415: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
80100419: 75 05 jne 80100420 <cprintf+0x80>
break;
8010041b: e9 06 01 00 00 jmp 80100526 <cprintf+0x186>
switch(c){
80100420: 8b 45 e4 mov -0x1c(%ebp),%eax
80100423: 83 f8 70 cmp $0x70,%eax
80100426: 74 4f je 80100477 <cprintf+0xd7>
80100428: 83 f8 70 cmp $0x70,%eax
8010042b: 7f 13 jg 80100440 <cprintf+0xa0>
8010042d: 83 f8 25 cmp $0x25,%eax
80100430: 0f 84 a6 00 00 00 je 801004dc <cprintf+0x13c>
80100436: 83 f8 64 cmp $0x64,%eax
80100439: 74 14 je 8010044f <cprintf+0xaf>
8010043b: e9 aa 00 00 00 jmp 801004ea <cprintf+0x14a>
80100440: 83 f8 73 cmp $0x73,%eax
80100443: 74 57 je 8010049c <cprintf+0xfc>
80100445: 83 f8 78 cmp $0x78,%eax
80100448: 74 2d je 80100477 <cprintf+0xd7>
8010044a: e9 9b 00 00 00 jmp 801004ea <cprintf+0x14a>
case 'd':
printint(*argp++, 10, 1);
8010044f: 8b 45 f0 mov -0x10(%ebp),%eax
80100452: 8d 50 04 lea 0x4(%eax),%edx
80100455: 89 55 f0 mov %edx,-0x10(%ebp)
80100458: 8b 00 mov (%eax),%eax
8010045a: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
80100461: 00
80100462: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80100469: 00
8010046a: 89 04 24 mov %eax,(%esp)
8010046d: e8 7f fe ff ff call 801002f1 <printint>
break;
80100472: e9 8b 00 00 00 jmp 80100502 <cprintf+0x162>
case 'x':
case 'p':
printint(*argp++, 16, 0);
80100477: 8b 45 f0 mov -0x10(%ebp),%eax
8010047a: 8d 50 04 lea 0x4(%eax),%edx
8010047d: 89 55 f0 mov %edx,-0x10(%ebp)
80100480: 8b 00 mov (%eax),%eax
80100482: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80100489: 00
8010048a: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp)
80100491: 00
80100492: 89 04 24 mov %eax,(%esp)
80100495: e8 57 fe ff ff call 801002f1 <printint>
break;
8010049a: eb 66 jmp 80100502 <cprintf+0x162>
case 's':
if((s = (char*)*argp++) == 0)
8010049c: 8b 45 f0 mov -0x10(%ebp),%eax
8010049f: 8d 50 04 lea 0x4(%eax),%edx
801004a2: 89 55 f0 mov %edx,-0x10(%ebp)
801004a5: 8b 00 mov (%eax),%eax
801004a7: 89 45 ec mov %eax,-0x14(%ebp)
801004aa: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
801004ae: 75 09 jne 801004b9 <cprintf+0x119>
s = "(null)";
801004b0: c7 45 ec 1f 84 10 80 movl $0x8010841f,-0x14(%ebp)
for(; *s; s++)
801004b7: eb 17 jmp 801004d0 <cprintf+0x130>
801004b9: eb 15 jmp 801004d0 <cprintf+0x130>
consputc(*s);
801004bb: 8b 45 ec mov -0x14(%ebp),%eax
801004be: 0f b6 00 movzbl (%eax),%eax
801004c1: 0f be c0 movsbl %al,%eax
801004c4: 89 04 24 mov %eax,(%esp)
801004c7: e8 84 02 00 00 call 80100750 <consputc>
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
s = "(null)";
for(; *s; s++)
801004cc: 83 45 ec 01 addl $0x1,-0x14(%ebp)
801004d0: 8b 45 ec mov -0x14(%ebp),%eax
801004d3: 0f b6 00 movzbl (%eax),%eax
801004d6: 84 c0 test %al,%al
801004d8: 75 e1 jne 801004bb <cprintf+0x11b>
consputc(*s);
break;
801004da: eb 26 jmp 80100502 <cprintf+0x162>
case '%':
consputc('%');
801004dc: c7 04 24 25 00 00 00 movl $0x25,(%esp)
801004e3: e8 68 02 00 00 call 80100750 <consputc>
break;
801004e8: eb 18 jmp 80100502 <cprintf+0x162>
default:
// Print unknown % sequence to draw attention.
consputc('%');
801004ea: c7 04 24 25 00 00 00 movl $0x25,(%esp)
801004f1: e8 5a 02 00 00 call 80100750 <consputc>
consputc(c);
801004f6: 8b 45 e4 mov -0x1c(%ebp),%eax
801004f9: 89 04 24 mov %eax,(%esp)
801004fc: e8 4f 02 00 00 call 80100750 <consputc>
break;
80100501: 90 nop
if (fmt == 0)
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
80100502: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100506: 8b 55 08 mov 0x8(%ebp),%edx
80100509: 8b 45 f4 mov -0xc(%ebp),%eax
8010050c: 01 d0 add %edx,%eax
8010050e: 0f b6 00 movzbl (%eax),%eax
80100511: 0f be c0 movsbl %al,%eax
80100514: 25 ff 00 00 00 and $0xff,%eax
80100519: 89 45 e4 mov %eax,-0x1c(%ebp)
8010051c: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
80100520: 0f 85 bf fe ff ff jne 801003e5 <cprintf+0x45>
consputc(c);
break;
}
}
if(locking)
80100526: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
8010052a: 74 0c je 80100538 <cprintf+0x198>
release(&cons.lock);
8010052c: c7 04 24 20 b6 10 80 movl $0x8010b620,(%esp)
80100533: e8 17 49 00 00 call 80104e4f <release>
}
80100538: c9 leave
80100539: c3 ret
8010053a <panic>:
void
panic(char *s)
{
8010053a: 55 push %ebp
8010053b: 89 e5 mov %esp,%ebp
8010053d: 83 ec 48 sub $0x48,%esp
int i;
uint pcs[10];
cli();
80100540: e8 a6 fd ff ff call 801002eb <cli>
cons.locking = 0;
80100545: c7 05 54 b6 10 80 00 movl $0x0,0x8010b654
8010054c: 00 00 00
cprintf("cpu%d: panic: ", cpu->id);
8010054f: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80100555: 0f b6 00 movzbl (%eax),%eax
80100558: 0f b6 c0 movzbl %al,%eax
8010055b: 89 44 24 04 mov %eax,0x4(%esp)
8010055f: c7 04 24 26 84 10 80 movl $0x80108426,(%esp)
80100566: e8 35 fe ff ff call 801003a0 <cprintf>
cprintf(s);
8010056b: 8b 45 08 mov 0x8(%ebp),%eax
8010056e: 89 04 24 mov %eax,(%esp)
80100571: e8 2a fe ff ff call 801003a0 <cprintf>
cprintf("\n");
80100576: c7 04 24 35 84 10 80 movl $0x80108435,(%esp)
8010057d: e8 1e fe ff ff call 801003a0 <cprintf>
getcallerpcs(&s, pcs);
80100582: 8d 45 cc lea -0x34(%ebp),%eax
80100585: 89 44 24 04 mov %eax,0x4(%esp)
80100589: 8d 45 08 lea 0x8(%ebp),%eax
8010058c: 89 04 24 mov %eax,(%esp)
8010058f: e8 0a 49 00 00 call 80104e9e <getcallerpcs>
for(i=0; i<10; i++)
80100594: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010059b: eb 1b jmp 801005b8 <panic+0x7e>
cprintf(" %p", pcs[i]);
8010059d: 8b 45 f4 mov -0xc(%ebp),%eax
801005a0: 8b 44 85 cc mov -0x34(%ebp,%eax,4),%eax
801005a4: 89 44 24 04 mov %eax,0x4(%esp)
801005a8: c7 04 24 37 84 10 80 movl $0x80108437,(%esp)
801005af: e8 ec fd ff ff call 801003a0 <cprintf>
cons.locking = 0;
cprintf("cpu%d: panic: ", cpu->id);
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
for(i=0; i<10; i++)
801005b4: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801005b8: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
801005bc: 7e df jle 8010059d <panic+0x63>
cprintf(" %p", pcs[i]);
panicked = 1; // freeze other CPU
801005be: c7 05 00 b6 10 80 01 movl $0x1,0x8010b600
801005c5: 00 00 00
for(;;)
;
801005c8: eb fe jmp 801005c8 <panic+0x8e>
801005ca <cgaputc>:
#define CRTPORT 0x3d4
static ushort *crt = (ushort*)P2V(0xb8000); // CGA memory
static void
cgaputc(int c)
{
801005ca: 55 push %ebp
801005cb: 89 e5 mov %esp,%ebp
801005cd: 83 ec 28 sub $0x28,%esp
int pos;
// Cursor position: col + 80*row.
outb(CRTPORT, 14);
801005d0: c7 44 24 04 0e 00 00 movl $0xe,0x4(%esp)
801005d7: 00
801005d8: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp)
801005df: e8 e9 fc ff ff call 801002cd <outb>
pos = inb(CRTPORT+1) << 8;
801005e4: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp)
801005eb: e8 c0 fc ff ff call 801002b0 <inb>
801005f0: 0f b6 c0 movzbl %al,%eax
801005f3: c1 e0 08 shl $0x8,%eax
801005f6: 89 45 f4 mov %eax,-0xc(%ebp)
outb(CRTPORT, 15);
801005f9: c7 44 24 04 0f 00 00 movl $0xf,0x4(%esp)
80100600: 00
80100601: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp)
80100608: e8 c0 fc ff ff call 801002cd <outb>
pos |= inb(CRTPORT+1);
8010060d: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp)
80100614: e8 97 fc ff ff call 801002b0 <inb>
80100619: 0f b6 c0 movzbl %al,%eax
8010061c: 09 45 f4 or %eax,-0xc(%ebp)
if(c == '\n')
8010061f: 83 7d 08 0a cmpl $0xa,0x8(%ebp)
80100623: 75 30 jne 80100655 <cgaputc+0x8b>
pos += 80 - pos%80;
80100625: 8b 4d f4 mov -0xc(%ebp),%ecx
80100628: ba 67 66 66 66 mov $0x66666667,%edx
8010062d: 89 c8 mov %ecx,%eax
8010062f: f7 ea imul %edx
80100631: c1 fa 05 sar $0x5,%edx
80100634: 89 c8 mov %ecx,%eax
80100636: c1 f8 1f sar $0x1f,%eax
80100639: 29 c2 sub %eax,%edx
8010063b: 89 d0 mov %edx,%eax
8010063d: c1 e0 02 shl $0x2,%eax
80100640: 01 d0 add %edx,%eax
80100642: c1 e0 04 shl $0x4,%eax
80100645: 29 c1 sub %eax,%ecx
80100647: 89 ca mov %ecx,%edx
80100649: b8 50 00 00 00 mov $0x50,%eax
8010064e: 29 d0 sub %edx,%eax
80100650: 01 45 f4 add %eax,-0xc(%ebp)
80100653: eb 35 jmp 8010068a <cgaputc+0xc0>
else if(c == BACKSPACE){
80100655: 81 7d 08 00 01 00 00 cmpl $0x100,0x8(%ebp)
8010065c: 75 0c jne 8010066a <cgaputc+0xa0>
if(pos > 0) --pos;
8010065e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100662: 7e 26 jle 8010068a <cgaputc+0xc0>
80100664: 83 6d f4 01 subl $0x1,-0xc(%ebp)
80100668: eb 20 jmp 8010068a <cgaputc+0xc0>
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
8010066a: 8b 0d 00 90 10 80 mov 0x80109000,%ecx
80100670: 8b 45 f4 mov -0xc(%ebp),%eax
80100673: 8d 50 01 lea 0x1(%eax),%edx
80100676: 89 55 f4 mov %edx,-0xc(%ebp)
80100679: 01 c0 add %eax,%eax
8010067b: 8d 14 01 lea (%ecx,%eax,1),%edx
8010067e: 8b 45 08 mov 0x8(%ebp),%eax
80100681: 0f b6 c0 movzbl %al,%eax
80100684: 80 cc 07 or $0x7,%ah
80100687: 66 89 02 mov %ax,(%edx)
if((pos/80) >= 24){ // Scroll up.
8010068a: 81 7d f4 7f 07 00 00 cmpl $0x77f,-0xc(%ebp)
80100691: 7e 53 jle 801006e6 <cgaputc+0x11c>
memmove(crt, crt+80, sizeof(crt[0])*23*80);
80100693: a1 00 90 10 80 mov 0x80109000,%eax
80100698: 8d 90 a0 00 00 00 lea 0xa0(%eax),%edx
8010069e: a1 00 90 10 80 mov 0x80109000,%eax
801006a3: c7 44 24 08 60 0e 00 movl $0xe60,0x8(%esp)
801006aa: 00
801006ab: 89 54 24 04 mov %edx,0x4(%esp)
801006af: 89 04 24 mov %eax,(%esp)
801006b2: e8 59 4a 00 00 call 80105110 <memmove>
pos -= 80;
801006b7: 83 6d f4 50 subl $0x50,-0xc(%ebp)
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
801006bb: b8 80 07 00 00 mov $0x780,%eax
801006c0: 2b 45 f4 sub -0xc(%ebp),%eax
801006c3: 8d 14 00 lea (%eax,%eax,1),%edx
801006c6: a1 00 90 10 80 mov 0x80109000,%eax
801006cb: 8b 4d f4 mov -0xc(%ebp),%ecx
801006ce: 01 c9 add %ecx,%ecx
801006d0: 01 c8 add %ecx,%eax
801006d2: 89 54 24 08 mov %edx,0x8(%esp)
801006d6: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801006dd: 00
801006de: 89 04 24 mov %eax,(%esp)
801006e1: e8 5b 49 00 00 call 80105041 <memset>
}
outb(CRTPORT, 14);
801006e6: c7 44 24 04 0e 00 00 movl $0xe,0x4(%esp)
801006ed: 00
801006ee: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp)
801006f5: e8 d3 fb ff ff call 801002cd <outb>
outb(CRTPORT+1, pos>>8);
801006fa: 8b 45 f4 mov -0xc(%ebp),%eax
801006fd: c1 f8 08 sar $0x8,%eax
80100700: 0f b6 c0 movzbl %al,%eax
80100703: 89 44 24 04 mov %eax,0x4(%esp)
80100707: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp)
8010070e: e8 ba fb ff ff call 801002cd <outb>
outb(CRTPORT, 15);
80100713: c7 44 24 04 0f 00 00 movl $0xf,0x4(%esp)
8010071a: 00
8010071b: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp)
80100722: e8 a6 fb ff ff call 801002cd <outb>
outb(CRTPORT+1, pos);
80100727: 8b 45 f4 mov -0xc(%ebp),%eax
8010072a: 0f b6 c0 movzbl %al,%eax
8010072d: 89 44 24 04 mov %eax,0x4(%esp)
80100731: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp)
80100738: e8 90 fb ff ff call 801002cd <outb>
crt[pos] = ' ' | 0x0700;
8010073d: a1 00 90 10 80 mov 0x80109000,%eax
80100742: 8b 55 f4 mov -0xc(%ebp),%edx
80100745: 01 d2 add %edx,%edx
80100747: 01 d0 add %edx,%eax
80100749: 66 c7 00 20 07 movw $0x720,(%eax)
}
8010074e: c9 leave
8010074f: c3 ret
80100750 <consputc>:
void
consputc(int c)
{
80100750: 55 push %ebp
80100751: 89 e5 mov %esp,%ebp
80100753: 83 ec 18 sub $0x18,%esp
if(panicked){
80100756: a1 00 b6 10 80 mov 0x8010b600,%eax
8010075b: 85 c0 test %eax,%eax
8010075d: 74 07 je 80100766 <consputc+0x16>
cli();
8010075f: e8 87 fb ff ff call 801002eb <cli>
for(;;)
;
80100764: eb fe jmp 80100764 <consputc+0x14>
}
if(c == BACKSPACE){
80100766: 81 7d 08 00 01 00 00 cmpl $0x100,0x8(%ebp)
8010076d: 75 26 jne 80100795 <consputc+0x45>
uartputc('\b'); uartputc(' '); uartputc('\b');
8010076f: c7 04 24 08 00 00 00 movl $0x8,(%esp)
80100776: e8 b6 62 00 00 call 80106a31 <uartputc>
8010077b: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80100782: e8 aa 62 00 00 call 80106a31 <uartputc>
80100787: c7 04 24 08 00 00 00 movl $0x8,(%esp)
8010078e: e8 9e 62 00 00 call 80106a31 <uartputc>
80100793: eb 0b jmp 801007a0 <consputc+0x50>
} else
uartputc(c);
80100795: 8b 45 08 mov 0x8(%ebp),%eax
80100798: 89 04 24 mov %eax,(%esp)
8010079b: e8 91 62 00 00 call 80106a31 <uartputc>
cgaputc(c);
801007a0: 8b 45 08 mov 0x8(%ebp),%eax
801007a3: 89 04 24 mov %eax,(%esp)
801007a6: e8 1f fe ff ff call 801005ca <cgaputc>
}
801007ab: c9 leave
801007ac: c3 ret
801007ad <consoleintr>:
#define C(x) ((x)-'@') // Control-x
void
consoleintr(int (*getc)(void))
{
801007ad: 55 push %ebp
801007ae: 89 e5 mov %esp,%ebp
801007b0: 83 ec 28 sub $0x28,%esp
int c;
acquire(&input.lock);
801007b3: c7 04 24 e0 07 11 80 movl $0x801107e0,(%esp)
801007ba: e8 2e 46 00 00 call 80104ded <acquire>
while((c = getc()) >= 0){
801007bf: e9 37 01 00 00 jmp 801008fb <consoleintr+0x14e>
switch(c){
801007c4: 8b 45 f4 mov -0xc(%ebp),%eax
801007c7: 83 f8 10 cmp $0x10,%eax
801007ca: 74 1e je 801007ea <consoleintr+0x3d>
801007cc: 83 f8 10 cmp $0x10,%eax
801007cf: 7f 0a jg 801007db <consoleintr+0x2e>
801007d1: 83 f8 08 cmp $0x8,%eax
801007d4: 74 64 je 8010083a <consoleintr+0x8d>
801007d6: e9 91 00 00 00 jmp 8010086c <consoleintr+0xbf>
801007db: 83 f8 15 cmp $0x15,%eax
801007de: 74 2f je 8010080f <consoleintr+0x62>
801007e0: 83 f8 7f cmp $0x7f,%eax
801007e3: 74 55 je 8010083a <consoleintr+0x8d>
801007e5: e9 82 00 00 00 jmp 8010086c <consoleintr+0xbf>
case C('P'): // Process listing.
procdump();
801007ea: e8 b0 44 00 00 call 80104c9f <procdump>
break;
801007ef: e9 07 01 00 00 jmp 801008fb <consoleintr+0x14e>
case C('U'): // Kill line.
while(input.e != input.w &&
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
801007f4: a1 9c 08 11 80 mov 0x8011089c,%eax
801007f9: 83 e8 01 sub $0x1,%eax
801007fc: a3 9c 08 11 80 mov %eax,0x8011089c
consputc(BACKSPACE);
80100801: c7 04 24 00 01 00 00 movl $0x100,(%esp)
80100808: e8 43 ff ff ff call 80100750 <consputc>
8010080d: eb 01 jmp 80100810 <consoleintr+0x63>
switch(c){
case C('P'): // Process listing.
procdump();
break;
case C('U'): // Kill line.
while(input.e != input.w &&
8010080f: 90 nop
80100810: 8b 15 9c 08 11 80 mov 0x8011089c,%edx
80100816: a1 98 08 11 80 mov 0x80110898,%eax
8010081b: 39 c2 cmp %eax,%edx
8010081d: 74 16 je 80100835 <consoleintr+0x88>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
8010081f: a1 9c 08 11 80 mov 0x8011089c,%eax
80100824: 83 e8 01 sub $0x1,%eax
80100827: 83 e0 7f and $0x7f,%eax
8010082a: 0f b6 80 14 08 11 80 movzbl -0x7feef7ec(%eax),%eax
switch(c){
case C('P'): // Process listing.
procdump();
break;
case C('U'): // Kill line.
while(input.e != input.w &&
80100831: 3c 0a cmp $0xa,%al
80100833: 75 bf jne 801007f4 <consoleintr+0x47>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
consputc(BACKSPACE);
}
break;
80100835: e9 c1 00 00 00 jmp 801008fb <consoleintr+0x14e>
case C('H'): case '\x7f': // Backspace
if(input.e != input.w){
8010083a: 8b 15 9c 08 11 80 mov 0x8011089c,%edx
80100840: a1 98 08 11 80 mov 0x80110898,%eax
80100845: 39 c2 cmp %eax,%edx
80100847: 74 1e je 80100867 <consoleintr+0xba>
input.e--;
80100849: a1 9c 08 11 80 mov 0x8011089c,%eax
8010084e: 83 e8 01 sub $0x1,%eax
80100851: a3 9c 08 11 80 mov %eax,0x8011089c
consputc(BACKSPACE);
80100856: c7 04 24 00 01 00 00 movl $0x100,(%esp)
8010085d: e8 ee fe ff ff call 80100750 <consputc>
}
break;
80100862: e9 94 00 00 00 jmp 801008fb <consoleintr+0x14e>
80100867: e9 8f 00 00 00 jmp 801008fb <consoleintr+0x14e>
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
8010086c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100870: 0f 84 84 00 00 00 je 801008fa <consoleintr+0x14d>
80100876: 8b 15 9c 08 11 80 mov 0x8011089c,%edx
8010087c: a1 94 08 11 80 mov 0x80110894,%eax
80100881: 29 c2 sub %eax,%edx
80100883: 89 d0 mov %edx,%eax
80100885: 83 f8 7f cmp $0x7f,%eax
80100888: 77 70 ja 801008fa <consoleintr+0x14d>
c = (c == '\r') ? '\n' : c;
8010088a: 83 7d f4 0d cmpl $0xd,-0xc(%ebp)
8010088e: 74 05 je 80100895 <consoleintr+0xe8>
80100890: 8b 45 f4 mov -0xc(%ebp),%eax
80100893: eb 05 jmp 8010089a <consoleintr+0xed>
80100895: b8 0a 00 00 00 mov $0xa,%eax
8010089a: 89 45 f4 mov %eax,-0xc(%ebp)
input.buf[input.e++ % INPUT_BUF] = c;
8010089d: a1 9c 08 11 80 mov 0x8011089c,%eax
801008a2: 8d 50 01 lea 0x1(%eax),%edx
801008a5: 89 15 9c 08 11 80 mov %edx,0x8011089c
801008ab: 83 e0 7f and $0x7f,%eax
801008ae: 89 c2 mov %eax,%edx
801008b0: 8b 45 f4 mov -0xc(%ebp),%eax
801008b3: 88 82 14 08 11 80 mov %al,-0x7feef7ec(%edx)
consputc(c);
801008b9: 8b 45 f4 mov -0xc(%ebp),%eax
801008bc: 89 04 24 mov %eax,(%esp)
801008bf: e8 8c fe ff ff call 80100750 <consputc>
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
801008c4: 83 7d f4 0a cmpl $0xa,-0xc(%ebp)
801008c8: 74 18 je 801008e2 <consoleintr+0x135>
801008ca: 83 7d f4 04 cmpl $0x4,-0xc(%ebp)
801008ce: 74 12 je 801008e2 <consoleintr+0x135>
801008d0: a1 9c 08 11 80 mov 0x8011089c,%eax
801008d5: 8b 15 94 08 11 80 mov 0x80110894,%edx
801008db: 83 ea 80 sub $0xffffff80,%edx
801008de: 39 d0 cmp %edx,%eax
801008e0: 75 18 jne 801008fa <consoleintr+0x14d>
input.w = input.e;
801008e2: a1 9c 08 11 80 mov 0x8011089c,%eax
801008e7: a3 98 08 11 80 mov %eax,0x80110898
wakeup(&input.r);
801008ec: c7 04 24 94 08 11 80 movl $0x80110894,(%esp)
801008f3: e8 04 43 00 00 call 80104bfc <wakeup>
}
}
break;
801008f8: eb 00 jmp 801008fa <consoleintr+0x14d>
801008fa: 90 nop
consoleintr(int (*getc)(void))
{
int c;
acquire(&input.lock);
while((c = getc()) >= 0){
801008fb: 8b 45 08 mov 0x8(%ebp),%eax
801008fe: ff d0 call *%eax
80100900: 89 45 f4 mov %eax,-0xc(%ebp)
80100903: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100907: 0f 89 b7 fe ff ff jns 801007c4 <consoleintr+0x17>
}
}
break;
}
}
release(&input.lock);
8010090d: c7 04 24 e0 07 11 80 movl $0x801107e0,(%esp)
80100914: e8 36 45 00 00 call 80104e4f <release>
}
80100919: c9 leave
8010091a: c3 ret
8010091b <consoleread>:
int
consoleread(struct inode *ip, char *dst, int n)
{
8010091b: 55 push %ebp
8010091c: 89 e5 mov %esp,%ebp
8010091e: 83 ec 28 sub $0x28,%esp
uint target;
int c;
iunlock(ip);
80100921: 8b 45 08 mov 0x8(%ebp),%eax
80100924: 89 04 24 mov %eax,(%esp)
80100927: e8 98 10 00 00 call 801019c4 <iunlock>
target = n;
8010092c: 8b 45 10 mov 0x10(%ebp),%eax
8010092f: 89 45 f4 mov %eax,-0xc(%ebp)
acquire(&input.lock);
80100932: c7 04 24 e0 07 11 80 movl $0x801107e0,(%esp)
80100939: e8 af 44 00 00 call 80104ded <acquire>
while(n > 0){
8010093e: e9 aa 00 00 00 jmp 801009ed <consoleread+0xd2>
while(input.r == input.w){
80100943: eb 42 jmp 80100987 <consoleread+0x6c>
if(proc->killed){
80100945: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010094b: 8b 40 24 mov 0x24(%eax),%eax
8010094e: 85 c0 test %eax,%eax
80100950: 74 21 je 80100973 <consoleread+0x58>
release(&input.lock);
80100952: c7 04 24 e0 07 11 80 movl $0x801107e0,(%esp)
80100959: e8 f1 44 00 00 call 80104e4f <release>
ilock(ip);
8010095e: 8b 45 08 mov 0x8(%ebp),%eax
80100961: 89 04 24 mov %eax,(%esp)
80100964: e8 0d 0f 00 00 call 80101876 <ilock>
return -1;
80100969: b8 ff ff ff ff mov $0xffffffff,%eax
8010096e: e9 a5 00 00 00 jmp 80100a18 <consoleread+0xfd>
}
sleep(&input.r, &input.lock);
80100973: c7 44 24 04 e0 07 11 movl $0x801107e0,0x4(%esp)
8010097a: 80
8010097b: c7 04 24 94 08 11 80 movl $0x80110894,(%esp)
80100982: e8 9c 41 00 00 call 80104b23 <sleep>
iunlock(ip);
target = n;
acquire(&input.lock);
while(n > 0){
while(input.r == input.w){
80100987: 8b 15 94 08 11 80 mov 0x80110894,%edx
8010098d: a1 98 08 11 80 mov 0x80110898,%eax
80100992: 39 c2 cmp %eax,%edx
80100994: 74 af je 80100945 <consoleread+0x2a>
ilock(ip);
return -1;
}
sleep(&input.r, &input.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
80100996: a1 94 08 11 80 mov 0x80110894,%eax
8010099b: 8d 50 01 lea 0x1(%eax),%edx
8010099e: 89 15 94 08 11 80 mov %edx,0x80110894
801009a4: 83 e0 7f and $0x7f,%eax
801009a7: 0f b6 80 14 08 11 80 movzbl -0x7feef7ec(%eax),%eax
801009ae: 0f be c0 movsbl %al,%eax
801009b1: 89 45 f0 mov %eax,-0x10(%ebp)
if(c == C('D')){ // EOF
801009b4: 83 7d f0 04 cmpl $0x4,-0x10(%ebp)
801009b8: 75 19 jne 801009d3 <consoleread+0xb8>
if(n < target){
801009ba: 8b 45 10 mov 0x10(%ebp),%eax
801009bd: 3b 45 f4 cmp -0xc(%ebp),%eax
801009c0: 73 0f jae 801009d1 <consoleread+0xb6>
// Save ^D for next time, to make sure
// caller gets a 0-byte result.
input.r--;
801009c2: a1 94 08 11 80 mov 0x80110894,%eax
801009c7: 83 e8 01 sub $0x1,%eax
801009ca: a3 94 08 11 80 mov %eax,0x80110894
}
break;
801009cf: eb 26 jmp 801009f7 <consoleread+0xdc>
801009d1: eb 24 jmp 801009f7 <consoleread+0xdc>
}
*dst++ = c;
801009d3: 8b 45 0c mov 0xc(%ebp),%eax
801009d6: 8d 50 01 lea 0x1(%eax),%edx
801009d9: 89 55 0c mov %edx,0xc(%ebp)
801009dc: 8b 55 f0 mov -0x10(%ebp),%edx
801009df: 88 10 mov %dl,(%eax)
--n;
801009e1: 83 6d 10 01 subl $0x1,0x10(%ebp)
if(c == '\n')
801009e5: 83 7d f0 0a cmpl $0xa,-0x10(%ebp)
801009e9: 75 02 jne 801009ed <consoleread+0xd2>
break;
801009eb: eb 0a jmp 801009f7 <consoleread+0xdc>
int c;
iunlock(ip);
target = n;
acquire(&input.lock);
while(n > 0){
801009ed: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801009f1: 0f 8f 4c ff ff ff jg 80100943 <consoleread+0x28>
*dst++ = c;
--n;
if(c == '\n')
break;
}
release(&input.lock);
801009f7: c7 04 24 e0 07 11 80 movl $0x801107e0,(%esp)
801009fe: e8 4c 44 00 00 call 80104e4f <release>
ilock(ip);
80100a03: 8b 45 08 mov 0x8(%ebp),%eax
80100a06: 89 04 24 mov %eax,(%esp)
80100a09: e8 68 0e 00 00 call 80101876 <ilock>
return target - n;
80100a0e: 8b 45 10 mov 0x10(%ebp),%eax
80100a11: 8b 55 f4 mov -0xc(%ebp),%edx
80100a14: 29 c2 sub %eax,%edx
80100a16: 89 d0 mov %edx,%eax
}
80100a18: c9 leave
80100a19: c3 ret
80100a1a <consolewrite>:
int
consolewrite(struct inode *ip, char *buf, int n)
{
80100a1a: 55 push %ebp
80100a1b: 89 e5 mov %esp,%ebp
80100a1d: 83 ec 28 sub $0x28,%esp
int i;
iunlock(ip);
80100a20: 8b 45 08 mov 0x8(%ebp),%eax
80100a23: 89 04 24 mov %eax,(%esp)
80100a26: e8 99 0f 00 00 call 801019c4 <iunlock>
acquire(&cons.lock);
80100a2b: c7 04 24 20 b6 10 80 movl $0x8010b620,(%esp)
80100a32: e8 b6 43 00 00 call 80104ded <acquire>
for(i = 0; i < n; i++)
80100a37: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80100a3e: eb 1d jmp 80100a5d <consolewrite+0x43>
consputc(buf[i] & 0xff);
80100a40: 8b 55 f4 mov -0xc(%ebp),%edx
80100a43: 8b 45 0c mov 0xc(%ebp),%eax
80100a46: 01 d0 add %edx,%eax
80100a48: 0f b6 00 movzbl (%eax),%eax
80100a4b: 0f be c0 movsbl %al,%eax
80100a4e: 0f b6 c0 movzbl %al,%eax
80100a51: 89 04 24 mov %eax,(%esp)
80100a54: e8 f7 fc ff ff call 80100750 <consputc>
{
int i;
iunlock(ip);
acquire(&cons.lock);
for(i = 0; i < n; i++)
80100a59: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100a5d: 8b 45 f4 mov -0xc(%ebp),%eax
80100a60: 3b 45 10 cmp 0x10(%ebp),%eax
80100a63: 7c db jl 80100a40 <consolewrite+0x26>
consputc(buf[i] & 0xff);
release(&cons.lock);
80100a65: c7 04 24 20 b6 10 80 movl $0x8010b620,(%esp)
80100a6c: e8 de 43 00 00 call 80104e4f <release>
ilock(ip);
80100a71: 8b 45 08 mov 0x8(%ebp),%eax
80100a74: 89 04 24 mov %eax,(%esp)
80100a77: e8 fa 0d 00 00 call 80101876 <ilock>
return n;
80100a7c: 8b 45 10 mov 0x10(%ebp),%eax
}
80100a7f: c9 leave
80100a80: c3 ret
80100a81 <consoleinit>:
void
consoleinit(void)
{
80100a81: 55 push %ebp
80100a82: 89 e5 mov %esp,%ebp
80100a84: 83 ec 18 sub $0x18,%esp
initlock(&cons.lock, "console");
80100a87: c7 44 24 04 3b 84 10 movl $0x8010843b,0x4(%esp)
80100a8e: 80
80100a8f: c7 04 24 20 b6 10 80 movl $0x8010b620,(%esp)
80100a96: e8 31 43 00 00 call 80104dcc <initlock>
initlock(&input.lock, "input");
80100a9b: c7 44 24 04 43 84 10 movl $0x80108443,0x4(%esp)
80100aa2: 80
80100aa3: c7 04 24 e0 07 11 80 movl $0x801107e0,(%esp)
80100aaa: e8 1d 43 00 00 call 80104dcc <initlock>
devsw[CONSOLE].write = consolewrite;
80100aaf: c7 05 4c 12 11 80 1a movl $0x80100a1a,0x8011124c
80100ab6: 0a 10 80
devsw[CONSOLE].read = consoleread;
80100ab9: c7 05 48 12 11 80 1b movl $0x8010091b,0x80111248
80100ac0: 09 10 80
cons.locking = 1;
80100ac3: c7 05 54 b6 10 80 01 movl $0x1,0x8010b654
80100aca: 00 00 00
picenable(IRQ_KBD);
80100acd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80100ad4: e8 de 32 00 00 call 80103db7 <picenable>
ioapicenable(IRQ_KBD, 0);
80100ad9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80100ae0: 00
80100ae1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80100ae8: e8 8b 1e 00 00 call 80102978 <ioapicenable>
}
80100aed: c9 leave
80100aee: c3 ret
80100aef <exec>:
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
{
80100aef: 55 push %ebp
80100af0: 89 e5 mov %esp,%ebp
80100af2: 81 ec 38 01 00 00 sub $0x138,%esp
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
pde_t *pgdir, *oldpgdir;
begin_op();
80100af8: e8 2e 29 00 00 call 8010342b <begin_op>
if((ip = namei(path)) == 0){
80100afd: 8b 45 08 mov 0x8(%ebp),%eax
80100b00: 89 04 24 mov %eax,(%esp)
80100b03: e8 19 19 00 00 call 80102421 <namei>
80100b08: 89 45 d8 mov %eax,-0x28(%ebp)
80100b0b: 83 7d d8 00 cmpl $0x0,-0x28(%ebp)
80100b0f: 75 0f jne 80100b20 <exec+0x31>
end_op();
80100b11: e8 99 29 00 00 call 801034af <end_op>
return -1;
80100b16: b8 ff ff ff ff mov $0xffffffff,%eax
80100b1b: e9 e8 03 00 00 jmp 80100f08 <exec+0x419>
}
ilock(ip);
80100b20: 8b 45 d8 mov -0x28(%ebp),%eax
80100b23: 89 04 24 mov %eax,(%esp)
80100b26: e8 4b 0d 00 00 call 80101876 <ilock>
pgdir = 0;
80100b2b: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
80100b32: c7 44 24 0c 34 00 00 movl $0x34,0xc(%esp)
80100b39: 00
80100b3a: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80100b41: 00
80100b42: 8d 85 0c ff ff ff lea -0xf4(%ebp),%eax
80100b48: 89 44 24 04 mov %eax,0x4(%esp)
80100b4c: 8b 45 d8 mov -0x28(%ebp),%eax
80100b4f: 89 04 24 mov %eax,(%esp)
80100b52: e8 2c 12 00 00 call 80101d83 <readi>
80100b57: 83 f8 33 cmp $0x33,%eax
80100b5a: 77 05 ja 80100b61 <exec+0x72>
goto bad;
80100b5c: e9 7b 03 00 00 jmp 80100edc <exec+0x3ed>
if(elf.magic != ELF_MAGIC)
80100b61: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax
80100b67: 3d 7f 45 4c 46 cmp $0x464c457f,%eax
80100b6c: 74 05 je 80100b73 <exec+0x84>
goto bad;
80100b6e: e9 69 03 00 00 jmp 80100edc <exec+0x3ed>
if((pgdir = setupkvm()) == 0)
80100b73: e8 0a 70 00 00 call 80107b82 <setupkvm>
80100b78: 89 45 d4 mov %eax,-0x2c(%ebp)
80100b7b: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
80100b7f: 75 05 jne 80100b86 <exec+0x97>
goto bad;
80100b81: e9 56 03 00 00 jmp 80100edc <exec+0x3ed>
// Load program into memory.
sz = 0;
80100b86: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100b8d: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
80100b94: 8b 85 28 ff ff ff mov -0xd8(%ebp),%eax
80100b9a: 89 45 e8 mov %eax,-0x18(%ebp)
80100b9d: e9 cb 00 00 00 jmp 80100c6d <exec+0x17e>
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100ba2: 8b 45 e8 mov -0x18(%ebp),%eax
80100ba5: c7 44 24 0c 20 00 00 movl $0x20,0xc(%esp)
80100bac: 00
80100bad: 89 44 24 08 mov %eax,0x8(%esp)
80100bb1: 8d 85 ec fe ff ff lea -0x114(%ebp),%eax
80100bb7: 89 44 24 04 mov %eax,0x4(%esp)
80100bbb: 8b 45 d8 mov -0x28(%ebp),%eax
80100bbe: 89 04 24 mov %eax,(%esp)
80100bc1: e8 bd 11 00 00 call 80101d83 <readi>
80100bc6: 83 f8 20 cmp $0x20,%eax
80100bc9: 74 05 je 80100bd0 <exec+0xe1>
goto bad;
80100bcb: e9 0c 03 00 00 jmp 80100edc <exec+0x3ed>
if(ph.type != ELF_PROG_LOAD)
80100bd0: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax
80100bd6: 83 f8 01 cmp $0x1,%eax
80100bd9: 74 05 je 80100be0 <exec+0xf1>
continue;
80100bdb: e9 80 00 00 00 jmp 80100c60 <exec+0x171>
if(ph.memsz < ph.filesz)
80100be0: 8b 95 00 ff ff ff mov -0x100(%ebp),%edx
80100be6: 8b 85 fc fe ff ff mov -0x104(%ebp),%eax
80100bec: 39 c2 cmp %eax,%edx
80100bee: 73 05 jae 80100bf5 <exec+0x106>
goto bad;
80100bf0: e9 e7 02 00 00 jmp 80100edc <exec+0x3ed>
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100bf5: 8b 95 f4 fe ff ff mov -0x10c(%ebp),%edx
80100bfb: 8b 85 00 ff ff ff mov -0x100(%ebp),%eax
80100c01: 01 d0 add %edx,%eax
80100c03: 89 44 24 08 mov %eax,0x8(%esp)
80100c07: 8b 45 e0 mov -0x20(%ebp),%eax
80100c0a: 89 44 24 04 mov %eax,0x4(%esp)
80100c0e: 8b 45 d4 mov -0x2c(%ebp),%eax
80100c11: 89 04 24 mov %eax,(%esp)
80100c14: e8 37 73 00 00 call 80107f50 <allocuvm>
80100c19: 89 45 e0 mov %eax,-0x20(%ebp)
80100c1c: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
80100c20: 75 05 jne 80100c27 <exec+0x138>
goto bad;
80100c22: e9 b5 02 00 00 jmp 80100edc <exec+0x3ed>
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100c27: 8b 8d fc fe ff ff mov -0x104(%ebp),%ecx
80100c2d: 8b 95 f0 fe ff ff mov -0x110(%ebp),%edx
80100c33: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100c39: 89 4c 24 10 mov %ecx,0x10(%esp)
80100c3d: 89 54 24 0c mov %edx,0xc(%esp)
80100c41: 8b 55 d8 mov -0x28(%ebp),%edx
80100c44: 89 54 24 08 mov %edx,0x8(%esp)
80100c48: 89 44 24 04 mov %eax,0x4(%esp)
80100c4c: 8b 45 d4 mov -0x2c(%ebp),%eax
80100c4f: 89 04 24 mov %eax,(%esp)
80100c52: e8 0e 72 00 00 call 80107e65 <loaduvm>
80100c57: 85 c0 test %eax,%eax
80100c59: 79 05 jns 80100c60 <exec+0x171>
goto bad;
80100c5b: e9 7c 02 00 00 jmp 80100edc <exec+0x3ed>
if((pgdir = setupkvm()) == 0)
goto bad;
// Load program into memory.
sz = 0;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100c60: 83 45 ec 01 addl $0x1,-0x14(%ebp)
80100c64: 8b 45 e8 mov -0x18(%ebp),%eax
80100c67: 83 c0 20 add $0x20,%eax
80100c6a: 89 45 e8 mov %eax,-0x18(%ebp)
80100c6d: 0f b7 85 38 ff ff ff movzwl -0xc8(%ebp),%eax
80100c74: 0f b7 c0 movzwl %ax,%eax
80100c77: 3b 45 ec cmp -0x14(%ebp),%eax
80100c7a: 0f 8f 22 ff ff ff jg 80100ba2 <exec+0xb3>
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
goto bad;
}
iunlockput(ip);
80100c80: 8b 45 d8 mov -0x28(%ebp),%eax
80100c83: 89 04 24 mov %eax,(%esp)
80100c86: e8 6f 0e 00 00 call 80101afa <iunlockput>
end_op();
80100c8b: e8 1f 28 00 00 call 801034af <end_op>
ip = 0;
80100c90: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp)
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
80100c97: 8b 45 e0 mov -0x20(%ebp),%eax
80100c9a: 05 ff 0f 00 00 add $0xfff,%eax
80100c9f: 25 00 f0 ff ff and $0xfffff000,%eax
80100ca4: 89 45 e0 mov %eax,-0x20(%ebp)
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100ca7: 8b 45 e0 mov -0x20(%ebp),%eax
80100caa: 05 00 20 00 00 add $0x2000,%eax
80100caf: 89 44 24 08 mov %eax,0x8(%esp)
80100cb3: 8b 45 e0 mov -0x20(%ebp),%eax
80100cb6: 89 44 24 04 mov %eax,0x4(%esp)
80100cba: 8b 45 d4 mov -0x2c(%ebp),%eax
80100cbd: 89 04 24 mov %eax,(%esp)
80100cc0: e8 8b 72 00 00 call 80107f50 <allocuvm>
80100cc5: 89 45 e0 mov %eax,-0x20(%ebp)
80100cc8: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
80100ccc: 75 05 jne 80100cd3 <exec+0x1e4>
goto bad;
80100cce: e9 09 02 00 00 jmp 80100edc <exec+0x3ed>
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100cd3: 8b 45 e0 mov -0x20(%ebp),%eax
80100cd6: 2d 00 20 00 00 sub $0x2000,%eax
80100cdb: 89 44 24 04 mov %eax,0x4(%esp)
80100cdf: 8b 45 d4 mov -0x2c(%ebp),%eax
80100ce2: 89 04 24 mov %eax,(%esp)
80100ce5: e8 96 74 00 00 call 80108180 <clearpteu>
sp = sz;
80100cea: 8b 45 e0 mov -0x20(%ebp),%eax
80100ced: 89 45 dc mov %eax,-0x24(%ebp)
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100cf0: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
80100cf7: e9 9a 00 00 00 jmp 80100d96 <exec+0x2a7>
if(argc >= MAXARG)
80100cfc: 83 7d e4 1f cmpl $0x1f,-0x1c(%ebp)
80100d00: 76 05 jbe 80100d07 <exec+0x218>
goto bad;
80100d02: e9 d5 01 00 00 jmp 80100edc <exec+0x3ed>
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100d07: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d0a: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100d11: 8b 45 0c mov 0xc(%ebp),%eax
80100d14: 01 d0 add %edx,%eax
80100d16: 8b 00 mov (%eax),%eax
80100d18: 89 04 24 mov %eax,(%esp)
80100d1b: e8 8b 45 00 00 call 801052ab <strlen>
80100d20: 8b 55 dc mov -0x24(%ebp),%edx
80100d23: 29 c2 sub %eax,%edx
80100d25: 89 d0 mov %edx,%eax
80100d27: 83 e8 01 sub $0x1,%eax
80100d2a: 83 e0 fc and $0xfffffffc,%eax
80100d2d: 89 45 dc mov %eax,-0x24(%ebp)
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100d30: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d33: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100d3a: 8b 45 0c mov 0xc(%ebp),%eax
80100d3d: 01 d0 add %edx,%eax
80100d3f: 8b 00 mov (%eax),%eax
80100d41: 89 04 24 mov %eax,(%esp)
80100d44: e8 62 45 00 00 call 801052ab <strlen>
80100d49: 83 c0 01 add $0x1,%eax
80100d4c: 89 c2 mov %eax,%edx
80100d4e: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d51: 8d 0c 85 00 00 00 00 lea 0x0(,%eax,4),%ecx
80100d58: 8b 45 0c mov 0xc(%ebp),%eax
80100d5b: 01 c8 add %ecx,%eax
80100d5d: 8b 00 mov (%eax),%eax
80100d5f: 89 54 24 0c mov %edx,0xc(%esp)
80100d63: 89 44 24 08 mov %eax,0x8(%esp)
80100d67: 8b 45 dc mov -0x24(%ebp),%eax
80100d6a: 89 44 24 04 mov %eax,0x4(%esp)
80100d6e: 8b 45 d4 mov -0x2c(%ebp),%eax
80100d71: 89 04 24 mov %eax,(%esp)
80100d74: e8 cc 75 00 00 call 80108345 <copyout>
80100d79: 85 c0 test %eax,%eax
80100d7b: 79 05 jns 80100d82 <exec+0x293>
goto bad;
80100d7d: e9 5a 01 00 00 jmp 80100edc <exec+0x3ed>
ustack[3+argc] = sp;
80100d82: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d85: 8d 50 03 lea 0x3(%eax),%edx
80100d88: 8b 45 dc mov -0x24(%ebp),%eax
80100d8b: 89 84 95 40 ff ff ff mov %eax,-0xc0(%ebp,%edx,4)
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100d92: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
80100d96: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d99: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100da0: 8b 45 0c mov 0xc(%ebp),%eax
80100da3: 01 d0 add %edx,%eax
80100da5: 8b 00 mov (%eax),%eax
80100da7: 85 c0 test %eax,%eax
80100da9: 0f 85 4d ff ff ff jne 80100cfc <exec+0x20d>
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
ustack[3+argc] = sp;
}
ustack[3+argc] = 0;
80100daf: 8b 45 e4 mov -0x1c(%ebp),%eax
80100db2: 83 c0 03 add $0x3,%eax
80100db5: c7 84 85 40 ff ff ff movl $0x0,-0xc0(%ebp,%eax,4)
80100dbc: 00 00 00 00
ustack[0] = 0xffffffff; // fake return PC
80100dc0: c7 85 40 ff ff ff ff movl $0xffffffff,-0xc0(%ebp)
80100dc7: ff ff ff
ustack[1] = argc;
80100dca: 8b 45 e4 mov -0x1c(%ebp),%eax
80100dcd: 89 85 44 ff ff ff mov %eax,-0xbc(%ebp)
ustack[2] = sp - (argc+1)*4; // argv pointer
80100dd3: 8b 45 e4 mov -0x1c(%ebp),%eax
80100dd6: 83 c0 01 add $0x1,%eax
80100dd9: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100de0: 8b 45 dc mov -0x24(%ebp),%eax
80100de3: 29 d0 sub %edx,%eax
80100de5: 89 85 48 ff ff ff mov %eax,-0xb8(%ebp)
sp -= (3+argc+1) * 4;
80100deb: 8b 45 e4 mov -0x1c(%ebp),%eax
80100dee: 83 c0 04 add $0x4,%eax
80100df1: c1 e0 02 shl $0x2,%eax
80100df4: 29 45 dc sub %eax,-0x24(%ebp)
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100df7: 8b 45 e4 mov -0x1c(%ebp),%eax
80100dfa: 83 c0 04 add $0x4,%eax
80100dfd: c1 e0 02 shl $0x2,%eax
80100e00: 89 44 24 0c mov %eax,0xc(%esp)
80100e04: 8d 85 40 ff ff ff lea -0xc0(%ebp),%eax
80100e0a: 89 44 24 08 mov %eax,0x8(%esp)
80100e0e: 8b 45 dc mov -0x24(%ebp),%eax
80100e11: 89 44 24 04 mov %eax,0x4(%esp)
80100e15: 8b 45 d4 mov -0x2c(%ebp),%eax
80100e18: 89 04 24 mov %eax,(%esp)
80100e1b: e8 25 75 00 00 call 80108345 <copyout>
80100e20: 85 c0 test %eax,%eax
80100e22: 79 05 jns 80100e29 <exec+0x33a>
goto bad;
80100e24: e9 b3 00 00 00 jmp 80100edc <exec+0x3ed>
// Save program name for debugging.
for(last=s=path; *s; s++)
80100e29: 8b 45 08 mov 0x8(%ebp),%eax
80100e2c: 89 45 f4 mov %eax,-0xc(%ebp)
80100e2f: 8b 45 f4 mov -0xc(%ebp),%eax
80100e32: 89 45 f0 mov %eax,-0x10(%ebp)
80100e35: eb 17 jmp 80100e4e <exec+0x35f>
if(*s == '/')
80100e37: 8b 45 f4 mov -0xc(%ebp),%eax
80100e3a: 0f b6 00 movzbl (%eax),%eax
80100e3d: 3c 2f cmp $0x2f,%al
80100e3f: 75 09 jne 80100e4a <exec+0x35b>
last = s+1;
80100e41: 8b 45 f4 mov -0xc(%ebp),%eax
80100e44: 83 c0 01 add $0x1,%eax
80100e47: 89 45 f0 mov %eax,-0x10(%ebp)
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100e4a: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100e4e: 8b 45 f4 mov -0xc(%ebp),%eax
80100e51: 0f b6 00 movzbl (%eax),%eax
80100e54: 84 c0 test %al,%al
80100e56: 75 df jne 80100e37 <exec+0x348>
if(*s == '/')
last = s+1;
safestrcpy(proc->name, last, sizeof(proc->name));
80100e58: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e5e: 8d 50 6c lea 0x6c(%eax),%edx
80100e61: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80100e68: 00
80100e69: 8b 45 f0 mov -0x10(%ebp),%eax
80100e6c: 89 44 24 04 mov %eax,0x4(%esp)
80100e70: 89 14 24 mov %edx,(%esp)
80100e73: e8 e9 43 00 00 call 80105261 <safestrcpy>
// Commit to the user image.
oldpgdir = proc->pgdir;
80100e78: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e7e: 8b 40 04 mov 0x4(%eax),%eax
80100e81: 89 45 d0 mov %eax,-0x30(%ebp)
proc->pgdir = pgdir;
80100e84: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e8a: 8b 55 d4 mov -0x2c(%ebp),%edx
80100e8d: 89 50 04 mov %edx,0x4(%eax)
proc->sz = sz;
80100e90: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e96: 8b 55 e0 mov -0x20(%ebp),%edx
80100e99: 89 10 mov %edx,(%eax)
proc->tf->eip = elf.entry; // main
80100e9b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100ea1: 8b 40 18 mov 0x18(%eax),%eax
80100ea4: 8b 95 24 ff ff ff mov -0xdc(%ebp),%edx
80100eaa: 89 50 38 mov %edx,0x38(%eax)
proc->tf->esp = sp;
80100ead: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100eb3: 8b 40 18 mov 0x18(%eax),%eax
80100eb6: 8b 55 dc mov -0x24(%ebp),%edx
80100eb9: 89 50 44 mov %edx,0x44(%eax)
switchuvm(proc);
80100ebc: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100ec2: 89 04 24 mov %eax,(%esp)
80100ec5: e8 a9 6d 00 00 call 80107c73 <switchuvm>
freevm(oldpgdir);
80100eca: 8b 45 d0 mov -0x30(%ebp),%eax
80100ecd: 89 04 24 mov %eax,(%esp)
80100ed0: e8 11 72 00 00 call 801080e6 <freevm>
return 0;
80100ed5: b8 00 00 00 00 mov $0x0,%eax
80100eda: eb 2c jmp 80100f08 <exec+0x419>
bad:
if(pgdir)
80100edc: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
80100ee0: 74 0b je 80100eed <exec+0x3fe>
freevm(pgdir);
80100ee2: 8b 45 d4 mov -0x2c(%ebp),%eax
80100ee5: 89 04 24 mov %eax,(%esp)
80100ee8: e8 f9 71 00 00 call 801080e6 <freevm>
if(ip){
80100eed: 83 7d d8 00 cmpl $0x0,-0x28(%ebp)
80100ef1: 74 10 je 80100f03 <exec+0x414>
iunlockput(ip);
80100ef3: 8b 45 d8 mov -0x28(%ebp),%eax
80100ef6: 89 04 24 mov %eax,(%esp)
80100ef9: e8 fc 0b 00 00 call 80101afa <iunlockput>
end_op();
80100efe: e8 ac 25 00 00 call 801034af <end_op>
}
return -1;
80100f03: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100f08: c9 leave
80100f09: c3 ret
80100f0a <cli>:
asm volatile("movw %0, %%gs" : : "r" (v));
}
static inline void
cli(void)
{
80100f0a: 55 push %ebp
80100f0b: 89 e5 mov %esp,%ebp
asm volatile("cli");
80100f0d: fa cli
}
80100f0e: 5d pop %ebp
80100f0f: c3 ret
80100f10 <sti>:
static inline void
sti(void)
{
80100f10: 55 push %ebp
80100f11: 89 e5 mov %esp,%ebp
asm volatile("sti");
80100f13: fb sti
}
80100f14: 5d pop %ebp
80100f15: c3 ret
80100f16 <fileinit>:
struct file file[NFILE];
} ftable;
void
fileinit(void)
{
80100f16: 55 push %ebp
80100f17: 89 e5 mov %esp,%ebp
80100f19: 83 ec 18 sub $0x18,%esp
initlock(&ftable.lock, "ftable");
80100f1c: c7 44 24 04 49 84 10 movl $0x80108449,0x4(%esp)
80100f23: 80
80100f24: c7 04 24 a0 08 11 80 movl $0x801108a0,(%esp)
80100f2b: e8 9c 3e 00 00 call 80104dcc <initlock>
}
80100f30: c9 leave
80100f31: c3 ret
80100f32 <filealloc>:
// Allocate a file structure.
struct file*
filealloc(void)
{
80100f32: 55 push %ebp
80100f33: 89 e5 mov %esp,%ebp
80100f35: 83 ec 28 sub $0x28,%esp
struct file *f;
acquire(&ftable.lock);
80100f38: c7 04 24 a0 08 11 80 movl $0x801108a0,(%esp)
80100f3f: e8 a9 3e 00 00 call 80104ded <acquire>
sti();
80100f44: e8 c7 ff ff ff call 80100f10 <sti>
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f49: c7 45 f4 d4 08 11 80 movl $0x801108d4,-0xc(%ebp)
80100f50: eb 2e jmp 80100f80 <filealloc+0x4e>
if(f->ref == 0){
80100f52: 8b 45 f4 mov -0xc(%ebp),%eax
80100f55: 8b 40 04 mov 0x4(%eax),%eax
80100f58: 85 c0 test %eax,%eax
80100f5a: 75 20 jne 80100f7c <filealloc+0x4a>
f->ref = 1;
80100f5c: 8b 45 f4 mov -0xc(%ebp),%eax
80100f5f: c7 40 04 01 00 00 00 movl $0x1,0x4(%eax)
cli();
80100f66: e8 9f ff ff ff call 80100f0a <cli>
release(&ftable.lock);
80100f6b: c7 04 24 a0 08 11 80 movl $0x801108a0,(%esp)
80100f72: e8 d8 3e 00 00 call 80104e4f <release>
return f;
80100f77: 8b 45 f4 mov -0xc(%ebp),%eax
80100f7a: eb 23 jmp 80100f9f <filealloc+0x6d>
{
struct file *f;
acquire(&ftable.lock);
sti();
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f7c: 83 45 f4 18 addl $0x18,-0xc(%ebp)
80100f80: 81 7d f4 34 12 11 80 cmpl $0x80111234,-0xc(%ebp)
80100f87: 72 c9 jb 80100f52 <filealloc+0x20>
cli();
release(&ftable.lock);
return f;
}
}
cli();
80100f89: e8 7c ff ff ff call 80100f0a <cli>
release(&ftable.lock);
80100f8e: c7 04 24 a0 08 11 80 movl $0x801108a0,(%esp)
80100f95: e8 b5 3e 00 00 call 80104e4f <release>
return 0;
80100f9a: b8 00 00 00 00 mov $0x0,%eax
}
80100f9f: c9 leave
80100fa0: c3 ret
80100fa1 <filedup>:
// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
80100fa1: 55 push %ebp
80100fa2: 89 e5 mov %esp,%ebp
80100fa4: 83 ec 18 sub $0x18,%esp
acquire(&ftable.lock);
80100fa7: c7 04 24 a0 08 11 80 movl $0x801108a0,(%esp)
80100fae: e8 3a 3e 00 00 call 80104ded <acquire>
if(f->ref < 1)
80100fb3: 8b 45 08 mov 0x8(%ebp),%eax
80100fb6: 8b 40 04 mov 0x4(%eax),%eax
80100fb9: 85 c0 test %eax,%eax
80100fbb: 7f 0c jg 80100fc9 <filedup+0x28>
panic("filedup");
80100fbd: c7 04 24 50 84 10 80 movl $0x80108450,(%esp)
80100fc4: e8 71 f5 ff ff call 8010053a <panic>
f->ref++;
80100fc9: 8b 45 08 mov 0x8(%ebp),%eax
80100fcc: 8b 40 04 mov 0x4(%eax),%eax
80100fcf: 8d 50 01 lea 0x1(%eax),%edx
80100fd2: 8b 45 08 mov 0x8(%ebp),%eax
80100fd5: 89 50 04 mov %edx,0x4(%eax)
release(&ftable.lock);
80100fd8: c7 04 24 a0 08 11 80 movl $0x801108a0,(%esp)
80100fdf: e8 6b 3e 00 00 call 80104e4f <release>
return f;
80100fe4: 8b 45 08 mov 0x8(%ebp),%eax
}
80100fe7: c9 leave
80100fe8: c3 ret
80100fe9 <fileclose>:
// Close file f. (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
80100fe9: 55 push %ebp
80100fea: 89 e5 mov %esp,%ebp
80100fec: 83 ec 38 sub $0x38,%esp
struct file ff;
acquire(&ftable.lock);
80100fef: c7 04 24 a0 08 11 80 movl $0x801108a0,(%esp)
80100ff6: e8 f2 3d 00 00 call 80104ded <acquire>
if(f->ref < 1)
80100ffb: 8b 45 08 mov 0x8(%ebp),%eax
80100ffe: 8b 40 04 mov 0x4(%eax),%eax
80101001: 85 c0 test %eax,%eax
80101003: 7f 0c jg 80101011 <fileclose+0x28>
panic("fileclose");
80101005: c7 04 24 58 84 10 80 movl $0x80108458,(%esp)
8010100c: e8 29 f5 ff ff call 8010053a <panic>
if(--f->ref > 0){
80101011: 8b 45 08 mov 0x8(%ebp),%eax
80101014: 8b 40 04 mov 0x4(%eax),%eax
80101017: 8d 50 ff lea -0x1(%eax),%edx
8010101a: 8b 45 08 mov 0x8(%ebp),%eax
8010101d: 89 50 04 mov %edx,0x4(%eax)
80101020: 8b 45 08 mov 0x8(%ebp),%eax
80101023: 8b 40 04 mov 0x4(%eax),%eax
80101026: 85 c0 test %eax,%eax
80101028: 7e 11 jle 8010103b <fileclose+0x52>
release(&ftable.lock);
8010102a: c7 04 24 a0 08 11 80 movl $0x801108a0,(%esp)
80101031: e8 19 3e 00 00 call 80104e4f <release>
80101036: e9 82 00 00 00 jmp 801010bd <fileclose+0xd4>
return;
}
ff = *f;
8010103b: 8b 45 08 mov 0x8(%ebp),%eax
8010103e: 8b 10 mov (%eax),%edx
80101040: 89 55 e0 mov %edx,-0x20(%ebp)
80101043: 8b 50 04 mov 0x4(%eax),%edx
80101046: 89 55 e4 mov %edx,-0x1c(%ebp)
80101049: 8b 50 08 mov 0x8(%eax),%edx
8010104c: 89 55 e8 mov %edx,-0x18(%ebp)
8010104f: 8b 50 0c mov 0xc(%eax),%edx
80101052: 89 55 ec mov %edx,-0x14(%ebp)
80101055: 8b 50 10 mov 0x10(%eax),%edx
80101058: 89 55 f0 mov %edx,-0x10(%ebp)
8010105b: 8b 40 14 mov 0x14(%eax),%eax
8010105e: 89 45 f4 mov %eax,-0xc(%ebp)
f->ref = 0;
80101061: 8b 45 08 mov 0x8(%ebp),%eax
80101064: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
f->type = FD_NONE;
8010106b: 8b 45 08 mov 0x8(%ebp),%eax
8010106e: c7 00 00 00 00 00 movl $0x0,(%eax)
release(&ftable.lock);
80101074: c7 04 24 a0 08 11 80 movl $0x801108a0,(%esp)
8010107b: e8 cf 3d 00 00 call 80104e4f <release>
if(ff.type == FD_PIPE)
80101080: 8b 45 e0 mov -0x20(%ebp),%eax
80101083: 83 f8 01 cmp $0x1,%eax
80101086: 75 18 jne 801010a0 <fileclose+0xb7>
pipeclose(ff.pipe, ff.writable);
80101088: 0f b6 45 e9 movzbl -0x17(%ebp),%eax
8010108c: 0f be d0 movsbl %al,%edx
8010108f: 8b 45 ec mov -0x14(%ebp),%eax
80101092: 89 54 24 04 mov %edx,0x4(%esp)
80101096: 89 04 24 mov %eax,(%esp)
80101099: e8 c9 2f 00 00 call 80104067 <pipeclose>
8010109e: eb 1d jmp 801010bd <fileclose+0xd4>
else if(ff.type == FD_INODE){
801010a0: 8b 45 e0 mov -0x20(%ebp),%eax
801010a3: 83 f8 02 cmp $0x2,%eax
801010a6: 75 15 jne 801010bd <fileclose+0xd4>
begin_op();
801010a8: e8 7e 23 00 00 call 8010342b <begin_op>
iput(ff.ip);
801010ad: 8b 45 f0 mov -0x10(%ebp),%eax
801010b0: 89 04 24 mov %eax,(%esp)
801010b3: e8 71 09 00 00 call 80101a29 <iput>
end_op();
801010b8: e8 f2 23 00 00 call 801034af <end_op>
}
}
801010bd: c9 leave
801010be: c3 ret
801010bf <filestat>:
// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
801010bf: 55 push %ebp
801010c0: 89 e5 mov %esp,%ebp
801010c2: 83 ec 18 sub $0x18,%esp
if(f->type == FD_INODE){
801010c5: 8b 45 08 mov 0x8(%ebp),%eax
801010c8: 8b 00 mov (%eax),%eax
801010ca: 83 f8 02 cmp $0x2,%eax
801010cd: 75 38 jne 80101107 <filestat+0x48>
ilock(f->ip);
801010cf: 8b 45 08 mov 0x8(%ebp),%eax
801010d2: 8b 40 10 mov 0x10(%eax),%eax
801010d5: 89 04 24 mov %eax,(%esp)
801010d8: e8 99 07 00 00 call 80101876 <ilock>
stati(f->ip, st);
801010dd: 8b 45 08 mov 0x8(%ebp),%eax
801010e0: 8b 40 10 mov 0x10(%eax),%eax
801010e3: 8b 55 0c mov 0xc(%ebp),%edx
801010e6: 89 54 24 04 mov %edx,0x4(%esp)
801010ea: 89 04 24 mov %eax,(%esp)
801010ed: e8 4c 0c 00 00 call 80101d3e <stati>
iunlock(f->ip);
801010f2: 8b 45 08 mov 0x8(%ebp),%eax
801010f5: 8b 40 10 mov 0x10(%eax),%eax
801010f8: 89 04 24 mov %eax,(%esp)
801010fb: e8 c4 08 00 00 call 801019c4 <iunlock>
return 0;
80101100: b8 00 00 00 00 mov $0x0,%eax
80101105: eb 05 jmp 8010110c <filestat+0x4d>
}
return -1;
80101107: b8 ff ff ff ff mov $0xffffffff,%eax
}
8010110c: c9 leave
8010110d: c3 ret
8010110e <fileread>:
// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
8010110e: 55 push %ebp
8010110f: 89 e5 mov %esp,%ebp
80101111: 83 ec 28 sub $0x28,%esp
int r;
if(f->readable == 0)
80101114: 8b 45 08 mov 0x8(%ebp),%eax
80101117: 0f b6 40 08 movzbl 0x8(%eax),%eax
8010111b: 84 c0 test %al,%al
8010111d: 75 0a jne 80101129 <fileread+0x1b>
return -1;
8010111f: b8 ff ff ff ff mov $0xffffffff,%eax
80101124: e9 9f 00 00 00 jmp 801011c8 <fileread+0xba>
if(f->type == FD_PIPE)
80101129: 8b 45 08 mov 0x8(%ebp),%eax
8010112c: 8b 00 mov (%eax),%eax
8010112e: 83 f8 01 cmp $0x1,%eax
80101131: 75 1e jne 80101151 <fileread+0x43>
return piperead(f->pipe, addr, n);
80101133: 8b 45 08 mov 0x8(%ebp),%eax
80101136: 8b 40 0c mov 0xc(%eax),%eax
80101139: 8b 55 10 mov 0x10(%ebp),%edx
8010113c: 89 54 24 08 mov %edx,0x8(%esp)
80101140: 8b 55 0c mov 0xc(%ebp),%edx
80101143: 89 54 24 04 mov %edx,0x4(%esp)
80101147: 89 04 24 mov %eax,(%esp)
8010114a: e8 99 30 00 00 call 801041e8 <piperead>
8010114f: eb 77 jmp 801011c8 <fileread+0xba>
if(f->type == FD_INODE){
80101151: 8b 45 08 mov 0x8(%ebp),%eax
80101154: 8b 00 mov (%eax),%eax
80101156: 83 f8 02 cmp $0x2,%eax
80101159: 75 61 jne 801011bc <fileread+0xae>
ilock(f->ip);
8010115b: 8b 45 08 mov 0x8(%ebp),%eax
8010115e: 8b 40 10 mov 0x10(%eax),%eax
80101161: 89 04 24 mov %eax,(%esp)
80101164: e8 0d 07 00 00 call 80101876 <ilock>
if((r = readi(f->ip, addr, f->off, n)) > 0)
80101169: 8b 4d 10 mov 0x10(%ebp),%ecx
8010116c: 8b 45 08 mov 0x8(%ebp),%eax
8010116f: 8b 50 14 mov 0x14(%eax),%edx
80101172: 8b 45 08 mov 0x8(%ebp),%eax
80101175: 8b 40 10 mov 0x10(%eax),%eax
80101178: 89 4c 24 0c mov %ecx,0xc(%esp)
8010117c: 89 54 24 08 mov %edx,0x8(%esp)
80101180: 8b 55 0c mov 0xc(%ebp),%edx
80101183: 89 54 24 04 mov %edx,0x4(%esp)
80101187: 89 04 24 mov %eax,(%esp)
8010118a: e8 f4 0b 00 00 call 80101d83 <readi>
8010118f: 89 45 f4 mov %eax,-0xc(%ebp)
80101192: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101196: 7e 11 jle 801011a9 <fileread+0x9b>
f->off += r;
80101198: 8b 45 08 mov 0x8(%ebp),%eax
8010119b: 8b 50 14 mov 0x14(%eax),%edx
8010119e: 8b 45 f4 mov -0xc(%ebp),%eax
801011a1: 01 c2 add %eax,%edx
801011a3: 8b 45 08 mov 0x8(%ebp),%eax
801011a6: 89 50 14 mov %edx,0x14(%eax)
iunlock(f->ip);
801011a9: 8b 45 08 mov 0x8(%ebp),%eax
801011ac: 8b 40 10 mov 0x10(%eax),%eax
801011af: 89 04 24 mov %eax,(%esp)
801011b2: e8 0d 08 00 00 call 801019c4 <iunlock>
return r;
801011b7: 8b 45 f4 mov -0xc(%ebp),%eax
801011ba: eb 0c jmp 801011c8 <fileread+0xba>
}
panic("fileread");
801011bc: c7 04 24 62 84 10 80 movl $0x80108462,(%esp)
801011c3: e8 72 f3 ff ff call 8010053a <panic>
}
801011c8: c9 leave
801011c9: c3 ret
801011ca <filewrite>:
//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
801011ca: 55 push %ebp
801011cb: 89 e5 mov %esp,%ebp
801011cd: 53 push %ebx
801011ce: 83 ec 24 sub $0x24,%esp
int r;
if(f->writable == 0)
801011d1: 8b 45 08 mov 0x8(%ebp),%eax
801011d4: 0f b6 40 09 movzbl 0x9(%eax),%eax
801011d8: 84 c0 test %al,%al
801011da: 75 0a jne 801011e6 <filewrite+0x1c>
return -1;
801011dc: b8 ff ff ff ff mov $0xffffffff,%eax
801011e1: e9 20 01 00 00 jmp 80101306 <filewrite+0x13c>
if(f->type == FD_PIPE)
801011e6: 8b 45 08 mov 0x8(%ebp),%eax
801011e9: 8b 00 mov (%eax),%eax
801011eb: 83 f8 01 cmp $0x1,%eax
801011ee: 75 21 jne 80101211 <filewrite+0x47>
return pipewrite(f->pipe, addr, n);
801011f0: 8b 45 08 mov 0x8(%ebp),%eax
801011f3: 8b 40 0c mov 0xc(%eax),%eax
801011f6: 8b 55 10 mov 0x10(%ebp),%edx
801011f9: 89 54 24 08 mov %edx,0x8(%esp)
801011fd: 8b 55 0c mov 0xc(%ebp),%edx
80101200: 89 54 24 04 mov %edx,0x4(%esp)
80101204: 89 04 24 mov %eax,(%esp)
80101207: e8 ed 2e 00 00 call 801040f9 <pipewrite>
8010120c: e9 f5 00 00 00 jmp 80101306 <filewrite+0x13c>
if(f->type == FD_INODE){
80101211: 8b 45 08 mov 0x8(%ebp),%eax
80101214: 8b 00 mov (%eax),%eax
80101216: 83 f8 02 cmp $0x2,%eax
80101219: 0f 85 db 00 00 00 jne 801012fa <filewrite+0x130>
// the maximum log transaction size, including
// i-node, indirect block, allocation blocks,
// 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 = ((LOGSIZE-1-1-2) / 2) * 512;
8010121f: c7 45 ec 00 1a 00 00 movl $0x1a00,-0x14(%ebp)
int i = 0;
80101226: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
while(i < n){
8010122d: e9 a8 00 00 00 jmp 801012da <filewrite+0x110>
int n1 = n - i;
80101232: 8b 45 f4 mov -0xc(%ebp),%eax
80101235: 8b 55 10 mov 0x10(%ebp),%edx
80101238: 29 c2 sub %eax,%edx
8010123a: 89 d0 mov %edx,%eax
8010123c: 89 45 f0 mov %eax,-0x10(%ebp)
if(n1 > max)
8010123f: 8b 45 f0 mov -0x10(%ebp),%eax
80101242: 3b 45 ec cmp -0x14(%ebp),%eax
80101245: 7e 06 jle 8010124d <filewrite+0x83>
n1 = max;
80101247: 8b 45 ec mov -0x14(%ebp),%eax
8010124a: 89 45 f0 mov %eax,-0x10(%ebp)
begin_op();
8010124d: e8 d9 21 00 00 call 8010342b <begin_op>
ilock(f->ip);
80101252: 8b 45 08 mov 0x8(%ebp),%eax
80101255: 8b 40 10 mov 0x10(%eax),%eax
80101258: 89 04 24 mov %eax,(%esp)
8010125b: e8 16 06 00 00 call 80101876 <ilock>
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
80101260: 8b 4d f0 mov -0x10(%ebp),%ecx
80101263: 8b 45 08 mov 0x8(%ebp),%eax
80101266: 8b 50 14 mov 0x14(%eax),%edx
80101269: 8b 5d f4 mov -0xc(%ebp),%ebx
8010126c: 8b 45 0c mov 0xc(%ebp),%eax
8010126f: 01 c3 add %eax,%ebx
80101271: 8b 45 08 mov 0x8(%ebp),%eax
80101274: 8b 40 10 mov 0x10(%eax),%eax
80101277: 89 4c 24 0c mov %ecx,0xc(%esp)
8010127b: 89 54 24 08 mov %edx,0x8(%esp)
8010127f: 89 5c 24 04 mov %ebx,0x4(%esp)
80101283: 89 04 24 mov %eax,(%esp)
80101286: e8 5c 0c 00 00 call 80101ee7 <writei>
8010128b: 89 45 e8 mov %eax,-0x18(%ebp)
8010128e: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
80101292: 7e 11 jle 801012a5 <filewrite+0xdb>
f->off += r;
80101294: 8b 45 08 mov 0x8(%ebp),%eax
80101297: 8b 50 14 mov 0x14(%eax),%edx
8010129a: 8b 45 e8 mov -0x18(%ebp),%eax
8010129d: 01 c2 add %eax,%edx
8010129f: 8b 45 08 mov 0x8(%ebp),%eax
801012a2: 89 50 14 mov %edx,0x14(%eax)
iunlock(f->ip);
801012a5: 8b 45 08 mov 0x8(%ebp),%eax
801012a8: 8b 40 10 mov 0x10(%eax),%eax
801012ab: 89 04 24 mov %eax,(%esp)
801012ae: e8 11 07 00 00 call 801019c4 <iunlock>
end_op();
801012b3: e8 f7 21 00 00 call 801034af <end_op>
if(r < 0)
801012b8: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
801012bc: 79 02 jns 801012c0 <filewrite+0xf6>
break;
801012be: eb 26 jmp 801012e6 <filewrite+0x11c>
if(r != n1)
801012c0: 8b 45 e8 mov -0x18(%ebp),%eax
801012c3: 3b 45 f0 cmp -0x10(%ebp),%eax
801012c6: 74 0c je 801012d4 <filewrite+0x10a>
panic("short filewrite");
801012c8: c7 04 24 6b 84 10 80 movl $0x8010846b,(%esp)
801012cf: e8 66 f2 ff ff call 8010053a <panic>
i += r;
801012d4: 8b 45 e8 mov -0x18(%ebp),%eax
801012d7: 01 45 f4 add %eax,-0xc(%ebp)
// 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 = ((LOGSIZE-1-1-2) / 2) * 512;
int i = 0;
while(i < n){
801012da: 8b 45 f4 mov -0xc(%ebp),%eax
801012dd: 3b 45 10 cmp 0x10(%ebp),%eax
801012e0: 0f 8c 4c ff ff ff jl 80101232 <filewrite+0x68>
break;
if(r != n1)
panic("short filewrite");
i += r;
}
return i == n ? n : -1;
801012e6: 8b 45 f4 mov -0xc(%ebp),%eax
801012e9: 3b 45 10 cmp 0x10(%ebp),%eax
801012ec: 75 05 jne 801012f3 <filewrite+0x129>
801012ee: 8b 45 10 mov 0x10(%ebp),%eax
801012f1: eb 05 jmp 801012f8 <filewrite+0x12e>
801012f3: b8 ff ff ff ff mov $0xffffffff,%eax
801012f8: eb 0c jmp 80101306 <filewrite+0x13c>
}
panic("filewrite");
801012fa: c7 04 24 7b 84 10 80 movl $0x8010847b,(%esp)
80101301: e8 34 f2 ff ff call 8010053a <panic>
}
80101306: 83 c4 24 add $0x24,%esp
80101309: 5b pop %ebx
8010130a: 5d pop %ebp
8010130b: c3 ret
8010130c <readsb>:
static void itrunc(struct inode*);
// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
8010130c: 55 push %ebp
8010130d: 89 e5 mov %esp,%ebp
8010130f: 83 ec 28 sub $0x28,%esp
struct buf *bp;
bp = bread(dev, 1);
80101312: 8b 45 08 mov 0x8(%ebp),%eax
80101315: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
8010131c: 00
8010131d: 89 04 24 mov %eax,(%esp)
80101320: e8 81 ee ff ff call 801001a6 <bread>
80101325: 89 45 f4 mov %eax,-0xc(%ebp)
memmove(sb, bp->data, sizeof(*sb));
80101328: 8b 45 f4 mov -0xc(%ebp),%eax
8010132b: 83 c0 18 add $0x18,%eax
8010132e: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80101335: 00
80101336: 89 44 24 04 mov %eax,0x4(%esp)
8010133a: 8b 45 0c mov 0xc(%ebp),%eax
8010133d: 89 04 24 mov %eax,(%esp)
80101340: e8 cb 3d 00 00 call 80105110 <memmove>
brelse(bp);
80101345: 8b 45 f4 mov -0xc(%ebp),%eax
80101348: 89 04 24 mov %eax,(%esp)
8010134b: e8 c7 ee ff ff call 80100217 <brelse>
}
80101350: c9 leave
80101351: c3 ret
80101352 <bzero>:
// Zero a block.
static void
bzero(int dev, int bno)
{
80101352: 55 push %ebp
80101353: 89 e5 mov %esp,%ebp
80101355: 83 ec 28 sub $0x28,%esp
struct buf *bp;
bp = bread(dev, bno);
80101358: 8b 55 0c mov 0xc(%ebp),%edx
8010135b: 8b 45 08 mov 0x8(%ebp),%eax
8010135e: 89 54 24 04 mov %edx,0x4(%esp)
80101362: 89 04 24 mov %eax,(%esp)
80101365: e8 3c ee ff ff call 801001a6 <bread>
8010136a: 89 45 f4 mov %eax,-0xc(%ebp)
memset(bp->data, 0, BSIZE);
8010136d: 8b 45 f4 mov -0xc(%ebp),%eax
80101370: 83 c0 18 add $0x18,%eax
80101373: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
8010137a: 00
8010137b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80101382: 00
80101383: 89 04 24 mov %eax,(%esp)
80101386: e8 b6 3c 00 00 call 80105041 <memset>
log_write(bp);
8010138b: 8b 45 f4 mov -0xc(%ebp),%eax
8010138e: 89 04 24 mov %eax,(%esp)
80101391: e8 a0 22 00 00 call 80103636 <log_write>
brelse(bp);
80101396: 8b 45 f4 mov -0xc(%ebp),%eax
80101399: 89 04 24 mov %eax,(%esp)
8010139c: e8 76 ee ff ff call 80100217 <brelse>
}
801013a1: c9 leave
801013a2: c3 ret
801013a3 <balloc>:
// Blocks.
// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
801013a3: 55 push %ebp
801013a4: 89 e5 mov %esp,%ebp
801013a6: 83 ec 38 sub $0x38,%esp
int b, bi, m;
struct buf *bp;
struct superblock sb;
bp = 0;
801013a9: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
readsb(dev, &sb);
801013b0: 8b 45 08 mov 0x8(%ebp),%eax
801013b3: 8d 55 d8 lea -0x28(%ebp),%edx
801013b6: 89 54 24 04 mov %edx,0x4(%esp)
801013ba: 89 04 24 mov %eax,(%esp)
801013bd: e8 4a ff ff ff call 8010130c <readsb>
for(b = 0; b < sb.size; b += BPB){
801013c2: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801013c9: e9 07 01 00 00 jmp 801014d5 <balloc+0x132>
bp = bread(dev, BBLOCK(b, sb.ninodes));
801013ce: 8b 45 f4 mov -0xc(%ebp),%eax
801013d1: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx
801013d7: 85 c0 test %eax,%eax
801013d9: 0f 48 c2 cmovs %edx,%eax
801013dc: c1 f8 0c sar $0xc,%eax
801013df: 8b 55 e0 mov -0x20(%ebp),%edx
801013e2: c1 ea 03 shr $0x3,%edx
801013e5: 01 d0 add %edx,%eax
801013e7: 83 c0 03 add $0x3,%eax
801013ea: 89 44 24 04 mov %eax,0x4(%esp)
801013ee: 8b 45 08 mov 0x8(%ebp),%eax
801013f1: 89 04 24 mov %eax,(%esp)
801013f4: e8 ad ed ff ff call 801001a6 <bread>
801013f9: 89 45 ec mov %eax,-0x14(%ebp)
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
801013fc: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
80101403: e9 9d 00 00 00 jmp 801014a5 <balloc+0x102>
m = 1 << (bi % 8);
80101408: 8b 45 f0 mov -0x10(%ebp),%eax
8010140b: 99 cltd
8010140c: c1 ea 1d shr $0x1d,%edx
8010140f: 01 d0 add %edx,%eax
80101411: 83 e0 07 and $0x7,%eax
80101414: 29 d0 sub %edx,%eax
80101416: ba 01 00 00 00 mov $0x1,%edx
8010141b: 89 c1 mov %eax,%ecx
8010141d: d3 e2 shl %cl,%edx
8010141f: 89 d0 mov %edx,%eax
80101421: 89 45 e8 mov %eax,-0x18(%ebp)
if((bp->data[bi/8] & m) == 0){ // Is block free?
80101424: 8b 45 f0 mov -0x10(%ebp),%eax
80101427: 8d 50 07 lea 0x7(%eax),%edx
8010142a: 85 c0 test %eax,%eax
8010142c: 0f 48 c2 cmovs %edx,%eax
8010142f: c1 f8 03 sar $0x3,%eax
80101432: 8b 55 ec mov -0x14(%ebp),%edx
80101435: 0f b6 44 02 18 movzbl 0x18(%edx,%eax,1),%eax
8010143a: 0f b6 c0 movzbl %al,%eax
8010143d: 23 45 e8 and -0x18(%ebp),%eax
80101440: 85 c0 test %eax,%eax
80101442: 75 5d jne 801014a1 <balloc+0xfe>
bp->data[bi/8] |= m; // Mark block in use.
80101444: 8b 45 f0 mov -0x10(%ebp),%eax
80101447: 8d 50 07 lea 0x7(%eax),%edx
8010144a: 85 c0 test %eax,%eax
8010144c: 0f 48 c2 cmovs %edx,%eax
8010144f: c1 f8 03 sar $0x3,%eax
80101452: 8b 55 ec mov -0x14(%ebp),%edx
80101455: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx
8010145a: 89 d1 mov %edx,%ecx
8010145c: 8b 55 e8 mov -0x18(%ebp),%edx
8010145f: 09 ca or %ecx,%edx
80101461: 89 d1 mov %edx,%ecx
80101463: 8b 55 ec mov -0x14(%ebp),%edx
80101466: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1)
log_write(bp);
8010146a: 8b 45 ec mov -0x14(%ebp),%eax
8010146d: 89 04 24 mov %eax,(%esp)
80101470: e8 c1 21 00 00 call 80103636 <log_write>
brelse(bp);
80101475: 8b 45 ec mov -0x14(%ebp),%eax
80101478: 89 04 24 mov %eax,(%esp)
8010147b: e8 97 ed ff ff call 80100217 <brelse>
bzero(dev, b + bi);
80101480: 8b 45 f0 mov -0x10(%ebp),%eax
80101483: 8b 55 f4 mov -0xc(%ebp),%edx
80101486: 01 c2 add %eax,%edx
80101488: 8b 45 08 mov 0x8(%ebp),%eax
8010148b: 89 54 24 04 mov %edx,0x4(%esp)
8010148f: 89 04 24 mov %eax,(%esp)
80101492: e8 bb fe ff ff call 80101352 <bzero>
return b + bi;
80101497: 8b 45 f0 mov -0x10(%ebp),%eax
8010149a: 8b 55 f4 mov -0xc(%ebp),%edx
8010149d: 01 d0 add %edx,%eax
8010149f: eb 4e jmp 801014ef <balloc+0x14c>
bp = 0;
readsb(dev, &sb);
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb.ninodes));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
801014a1: 83 45 f0 01 addl $0x1,-0x10(%ebp)
801014a5: 81 7d f0 ff 0f 00 00 cmpl $0xfff,-0x10(%ebp)
801014ac: 7f 15 jg 801014c3 <balloc+0x120>
801014ae: 8b 45 f0 mov -0x10(%ebp),%eax
801014b1: 8b 55 f4 mov -0xc(%ebp),%edx
801014b4: 01 d0 add %edx,%eax
801014b6: 89 c2 mov %eax,%edx
801014b8: 8b 45 d8 mov -0x28(%ebp),%eax
801014bb: 39 c2 cmp %eax,%edx
801014bd: 0f 82 45 ff ff ff jb 80101408 <balloc+0x65>
brelse(bp);
bzero(dev, b + bi);
return b + bi;
}
}
brelse(bp);
801014c3: 8b 45 ec mov -0x14(%ebp),%eax
801014c6: 89 04 24 mov %eax,(%esp)
801014c9: e8 49 ed ff ff call 80100217 <brelse>
struct buf *bp;
struct superblock sb;
bp = 0;
readsb(dev, &sb);
for(b = 0; b < sb.size; b += BPB){
801014ce: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
801014d5: 8b 55 f4 mov -0xc(%ebp),%edx
801014d8: 8b 45 d8 mov -0x28(%ebp),%eax
801014db: 39 c2 cmp %eax,%edx
801014dd: 0f 82 eb fe ff ff jb 801013ce <balloc+0x2b>
return b + bi;
}
}
brelse(bp);
}
panic("balloc: out of blocks");
801014e3: c7 04 24 85 84 10 80 movl $0x80108485,(%esp)
801014ea: e8 4b f0 ff ff call 8010053a <panic>
}
801014ef: c9 leave
801014f0: c3 ret
801014f1 <bfree>:
// Free a disk block.
static void
bfree(int dev, uint b)
{
801014f1: 55 push %ebp
801014f2: 89 e5 mov %esp,%ebp
801014f4: 83 ec 38 sub $0x38,%esp
struct buf *bp;
struct superblock sb;
int bi, m;
readsb(dev, &sb);
801014f7: 8d 45 dc lea -0x24(%ebp),%eax
801014fa: 89 44 24 04 mov %eax,0x4(%esp)
801014fe: 8b 45 08 mov 0x8(%ebp),%eax
80101501: 89 04 24 mov %eax,(%esp)
80101504: e8 03 fe ff ff call 8010130c <readsb>
bp = bread(dev, BBLOCK(b, sb.ninodes));
80101509: 8b 45 0c mov 0xc(%ebp),%eax
8010150c: c1 e8 0c shr $0xc,%eax
8010150f: 89 c2 mov %eax,%edx
80101511: 8b 45 e4 mov -0x1c(%ebp),%eax
80101514: c1 e8 03 shr $0x3,%eax
80101517: 01 d0 add %edx,%eax
80101519: 8d 50 03 lea 0x3(%eax),%edx
8010151c: 8b 45 08 mov 0x8(%ebp),%eax
8010151f: 89 54 24 04 mov %edx,0x4(%esp)
80101523: 89 04 24 mov %eax,(%esp)
80101526: e8 7b ec ff ff call 801001a6 <bread>
8010152b: 89 45 f4 mov %eax,-0xc(%ebp)
bi = b % BPB;
8010152e: 8b 45 0c mov 0xc(%ebp),%eax
80101531: 25 ff 0f 00 00 and $0xfff,%eax
80101536: 89 45 f0 mov %eax,-0x10(%ebp)
m = 1 << (bi % 8);
80101539: 8b 45 f0 mov -0x10(%ebp),%eax
8010153c: 99 cltd
8010153d: c1 ea 1d shr $0x1d,%edx
80101540: 01 d0 add %edx,%eax
80101542: 83 e0 07 and $0x7,%eax
80101545: 29 d0 sub %edx,%eax
80101547: ba 01 00 00 00 mov $0x1,%edx
8010154c: 89 c1 mov %eax,%ecx
8010154e: d3 e2 shl %cl,%edx
80101550: 89 d0 mov %edx,%eax
80101552: 89 45 ec mov %eax,-0x14(%ebp)
if((bp->data[bi/8] & m) == 0)
80101555: 8b 45 f0 mov -0x10(%ebp),%eax
80101558: 8d 50 07 lea 0x7(%eax),%edx
8010155b: 85 c0 test %eax,%eax
8010155d: 0f 48 c2 cmovs %edx,%eax
80101560: c1 f8 03 sar $0x3,%eax
80101563: 8b 55 f4 mov -0xc(%ebp),%edx
80101566: 0f b6 44 02 18 movzbl 0x18(%edx,%eax,1),%eax
8010156b: 0f b6 c0 movzbl %al,%eax
8010156e: 23 45 ec and -0x14(%ebp),%eax
80101571: 85 c0 test %eax,%eax
80101573: 75 0c jne 80101581 <bfree+0x90>
panic("freeing free block");
80101575: c7 04 24 9b 84 10 80 movl $0x8010849b,(%esp)
8010157c: e8 b9 ef ff ff call 8010053a <panic>
bp->data[bi/8] &= ~m;
80101581: 8b 45 f0 mov -0x10(%ebp),%eax
80101584: 8d 50 07 lea 0x7(%eax),%edx
80101587: 85 c0 test %eax,%eax
80101589: 0f 48 c2 cmovs %edx,%eax
8010158c: c1 f8 03 sar $0x3,%eax
8010158f: 8b 55 f4 mov -0xc(%ebp),%edx
80101592: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx
80101597: 8b 4d ec mov -0x14(%ebp),%ecx
8010159a: f7 d1 not %ecx
8010159c: 21 ca and %ecx,%edx
8010159e: 89 d1 mov %edx,%ecx
801015a0: 8b 55 f4 mov -0xc(%ebp),%edx
801015a3: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1)
log_write(bp);
801015a7: 8b 45 f4 mov -0xc(%ebp),%eax
801015aa: 89 04 24 mov %eax,(%esp)
801015ad: e8 84 20 00 00 call 80103636 <log_write>
brelse(bp);
801015b2: 8b 45 f4 mov -0xc(%ebp),%eax
801015b5: 89 04 24 mov %eax,(%esp)
801015b8: e8 5a ec ff ff call 80100217 <brelse>
}
801015bd: c9 leave
801015be: c3 ret
801015bf <iinit>:
struct inode inode[NINODE];
} icache;
void
iinit(void)
{
801015bf: 55 push %ebp
801015c0: 89 e5 mov %esp,%ebp
801015c2: 83 ec 18 sub $0x18,%esp
initlock(&icache.lock, "icache");
801015c5: c7 44 24 04 ae 84 10 movl $0x801084ae,0x4(%esp)
801015cc: 80
801015cd: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
801015d4: e8 f3 37 00 00 call 80104dcc <initlock>
}
801015d9: c9 leave
801015da: c3 ret
801015db <ialloc>:
//PAGEBREAK!
// Allocate a new inode with the given type on device dev.
// A free inode has a type of zero.
struct inode*
ialloc(uint dev, short type)
{
801015db: 55 push %ebp
801015dc: 89 e5 mov %esp,%ebp
801015de: 83 ec 38 sub $0x38,%esp
801015e1: 8b 45 0c mov 0xc(%ebp),%eax
801015e4: 66 89 45 d4 mov %ax,-0x2c(%ebp)
int inum;
struct buf *bp;
struct dinode *dip;
struct superblock sb;
readsb(dev, &sb);
801015e8: 8b 45 08 mov 0x8(%ebp),%eax
801015eb: 8d 55 dc lea -0x24(%ebp),%edx
801015ee: 89 54 24 04 mov %edx,0x4(%esp)
801015f2: 89 04 24 mov %eax,(%esp)
801015f5: e8 12 fd ff ff call 8010130c <readsb>
for(inum = 1; inum < sb.ninodes; inum++){
801015fa: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
80101601: e9 98 00 00 00 jmp 8010169e <ialloc+0xc3>
bp = bread(dev, IBLOCK(inum));
80101606: 8b 45 f4 mov -0xc(%ebp),%eax
80101609: c1 e8 03 shr $0x3,%eax
8010160c: 83 c0 02 add $0x2,%eax
8010160f: 89 44 24 04 mov %eax,0x4(%esp)
80101613: 8b 45 08 mov 0x8(%ebp),%eax
80101616: 89 04 24 mov %eax,(%esp)
80101619: e8 88 eb ff ff call 801001a6 <bread>
8010161e: 89 45 f0 mov %eax,-0x10(%ebp)
dip = (struct dinode*)bp->data + inum%IPB;
80101621: 8b 45 f0 mov -0x10(%ebp),%eax
80101624: 8d 50 18 lea 0x18(%eax),%edx
80101627: 8b 45 f4 mov -0xc(%ebp),%eax
8010162a: 83 e0 07 and $0x7,%eax
8010162d: c1 e0 06 shl $0x6,%eax
80101630: 01 d0 add %edx,%eax
80101632: 89 45 ec mov %eax,-0x14(%ebp)
if(dip->type == 0){ // a free inode
80101635: 8b 45 ec mov -0x14(%ebp),%eax
80101638: 0f b7 00 movzwl (%eax),%eax
8010163b: 66 85 c0 test %ax,%ax
8010163e: 75 4f jne 8010168f <ialloc+0xb4>
memset(dip, 0, sizeof(*dip));
80101640: c7 44 24 08 40 00 00 movl $0x40,0x8(%esp)
80101647: 00
80101648: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010164f: 00
80101650: 8b 45 ec mov -0x14(%ebp),%eax
80101653: 89 04 24 mov %eax,(%esp)
80101656: e8 e6 39 00 00 call 80105041 <memset>
dip->type = type;
8010165b: 8b 45 ec mov -0x14(%ebp),%eax
8010165e: 0f b7 55 d4 movzwl -0x2c(%ebp),%edx
80101662: 66 89 10 mov %dx,(%eax)
log_write(bp); // mark it allocated on the disk
80101665: 8b 45 f0 mov -0x10(%ebp),%eax
80101668: 89 04 24 mov %eax,(%esp)
8010166b: e8 c6 1f 00 00 call 80103636 <log_write>
brelse(bp);
80101670: 8b 45 f0 mov -0x10(%ebp),%eax
80101673: 89 04 24 mov %eax,(%esp)
80101676: e8 9c eb ff ff call 80100217 <brelse>
return iget(dev, inum);
8010167b: 8b 45 f4 mov -0xc(%ebp),%eax
8010167e: 89 44 24 04 mov %eax,0x4(%esp)
80101682: 8b 45 08 mov 0x8(%ebp),%eax
80101685: 89 04 24 mov %eax,(%esp)
80101688: e8 e5 00 00 00 call 80101772 <iget>
8010168d: eb 29 jmp 801016b8 <ialloc+0xdd>
}
brelse(bp);
8010168f: 8b 45 f0 mov -0x10(%ebp),%eax
80101692: 89 04 24 mov %eax,(%esp)
80101695: e8 7d eb ff ff call 80100217 <brelse>
struct dinode *dip;
struct superblock sb;
readsb(dev, &sb);
for(inum = 1; inum < sb.ninodes; inum++){
8010169a: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010169e: 8b 55 f4 mov -0xc(%ebp),%edx
801016a1: 8b 45 e4 mov -0x1c(%ebp),%eax
801016a4: 39 c2 cmp %eax,%edx
801016a6: 0f 82 5a ff ff ff jb 80101606 <ialloc+0x2b>
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
}
panic("ialloc: no inodes");
801016ac: c7 04 24 b5 84 10 80 movl $0x801084b5,(%esp)
801016b3: e8 82 ee ff ff call 8010053a <panic>
}
801016b8: c9 leave
801016b9: c3 ret
801016ba <iupdate>:
// Copy a modified in-memory inode to disk.
void
iupdate(struct inode *ip)
{
801016ba: 55 push %ebp
801016bb: 89 e5 mov %esp,%ebp
801016bd: 83 ec 28 sub $0x28,%esp
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum));
801016c0: 8b 45 08 mov 0x8(%ebp),%eax
801016c3: 8b 40 04 mov 0x4(%eax),%eax
801016c6: c1 e8 03 shr $0x3,%eax
801016c9: 8d 50 02 lea 0x2(%eax),%edx
801016cc: 8b 45 08 mov 0x8(%ebp),%eax
801016cf: 8b 00 mov (%eax),%eax
801016d1: 89 54 24 04 mov %edx,0x4(%esp)
801016d5: 89 04 24 mov %eax,(%esp)
801016d8: e8 c9 ea ff ff call 801001a6 <bread>
801016dd: 89 45 f4 mov %eax,-0xc(%ebp)
dip = (struct dinode*)bp->data + ip->inum%IPB;
801016e0: 8b 45 f4 mov -0xc(%ebp),%eax
801016e3: 8d 50 18 lea 0x18(%eax),%edx
801016e6: 8b 45 08 mov 0x8(%ebp),%eax
801016e9: 8b 40 04 mov 0x4(%eax),%eax
801016ec: 83 e0 07 and $0x7,%eax
801016ef: c1 e0 06 shl $0x6,%eax
801016f2: 01 d0 add %edx,%eax
801016f4: 89 45 f0 mov %eax,-0x10(%ebp)
dip->type = ip->type;
801016f7: 8b 45 08 mov 0x8(%ebp),%eax
801016fa: 0f b7 50 10 movzwl 0x10(%eax),%edx
801016fe: 8b 45 f0 mov -0x10(%ebp),%eax
80101701: 66 89 10 mov %dx,(%eax)
dip->major = ip->major;
80101704: 8b 45 08 mov 0x8(%ebp),%eax
80101707: 0f b7 50 12 movzwl 0x12(%eax),%edx
8010170b: 8b 45 f0 mov -0x10(%ebp),%eax
8010170e: 66 89 50 02 mov %dx,0x2(%eax)
dip->minor = ip->minor;
80101712: 8b 45 08 mov 0x8(%ebp),%eax
80101715: 0f b7 50 14 movzwl 0x14(%eax),%edx
80101719: 8b 45 f0 mov -0x10(%ebp),%eax
8010171c: 66 89 50 04 mov %dx,0x4(%eax)
dip->nlink = ip->nlink;
80101720: 8b 45 08 mov 0x8(%ebp),%eax
80101723: 0f b7 50 16 movzwl 0x16(%eax),%edx
80101727: 8b 45 f0 mov -0x10(%ebp),%eax
8010172a: 66 89 50 06 mov %dx,0x6(%eax)
dip->size = ip->size;
8010172e: 8b 45 08 mov 0x8(%ebp),%eax
80101731: 8b 50 18 mov 0x18(%eax),%edx
80101734: 8b 45 f0 mov -0x10(%ebp),%eax
80101737: 89 50 08 mov %edx,0x8(%eax)
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
8010173a: 8b 45 08 mov 0x8(%ebp),%eax
8010173d: 8d 50 1c lea 0x1c(%eax),%edx
80101740: 8b 45 f0 mov -0x10(%ebp),%eax
80101743: 83 c0 0c add $0xc,%eax
80101746: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp)
8010174d: 00
8010174e: 89 54 24 04 mov %edx,0x4(%esp)
80101752: 89 04 24 mov %eax,(%esp)
80101755: e8 b6 39 00 00 call 80105110 <memmove>
log_write(bp);
8010175a: 8b 45 f4 mov -0xc(%ebp),%eax
8010175d: 89 04 24 mov %eax,(%esp)
80101760: e8 d1 1e 00 00 call 80103636 <log_write>
brelse(bp);
80101765: 8b 45 f4 mov -0xc(%ebp),%eax
80101768: 89 04 24 mov %eax,(%esp)
8010176b: e8 a7 ea ff ff call 80100217 <brelse>
}
80101770: c9 leave
80101771: c3 ret
80101772 <iget>:
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
80101772: 55 push %ebp
80101773: 89 e5 mov %esp,%ebp
80101775: 83 ec 28 sub $0x28,%esp
struct inode *ip, *empty;
acquire(&icache.lock);
80101778: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
8010177f: e8 69 36 00 00 call 80104ded <acquire>
// Is the inode already cached?
empty = 0;
80101784: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010178b: c7 45 f4 d4 12 11 80 movl $0x801112d4,-0xc(%ebp)
80101792: eb 59 jmp 801017ed <iget+0x7b>
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
80101794: 8b 45 f4 mov -0xc(%ebp),%eax
80101797: 8b 40 08 mov 0x8(%eax),%eax
8010179a: 85 c0 test %eax,%eax
8010179c: 7e 35 jle 801017d3 <iget+0x61>
8010179e: 8b 45 f4 mov -0xc(%ebp),%eax
801017a1: 8b 00 mov (%eax),%eax
801017a3: 3b 45 08 cmp 0x8(%ebp),%eax
801017a6: 75 2b jne 801017d3 <iget+0x61>
801017a8: 8b 45 f4 mov -0xc(%ebp),%eax
801017ab: 8b 40 04 mov 0x4(%eax),%eax
801017ae: 3b 45 0c cmp 0xc(%ebp),%eax
801017b1: 75 20 jne 801017d3 <iget+0x61>
ip->ref++;
801017b3: 8b 45 f4 mov -0xc(%ebp),%eax
801017b6: 8b 40 08 mov 0x8(%eax),%eax
801017b9: 8d 50 01 lea 0x1(%eax),%edx
801017bc: 8b 45 f4 mov -0xc(%ebp),%eax
801017bf: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
801017c2: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
801017c9: e8 81 36 00 00 call 80104e4f <release>
return ip;
801017ce: 8b 45 f4 mov -0xc(%ebp),%eax
801017d1: eb 6f jmp 80101842 <iget+0xd0>
}
if(empty == 0 && ip->ref == 0) // Remember empty slot.
801017d3: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801017d7: 75 10 jne 801017e9 <iget+0x77>
801017d9: 8b 45 f4 mov -0xc(%ebp),%eax
801017dc: 8b 40 08 mov 0x8(%eax),%eax
801017df: 85 c0 test %eax,%eax
801017e1: 75 06 jne 801017e9 <iget+0x77>
empty = ip;
801017e3: 8b 45 f4 mov -0xc(%ebp),%eax
801017e6: 89 45 f0 mov %eax,-0x10(%ebp)
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
801017e9: 83 45 f4 50 addl $0x50,-0xc(%ebp)
801017ed: 81 7d f4 74 22 11 80 cmpl $0x80112274,-0xc(%ebp)
801017f4: 72 9e jb 80101794 <iget+0x22>
if(empty == 0 && ip->ref == 0) // Remember empty slot.
empty = ip;
}
// Recycle an inode cache entry.
if(empty == 0)
801017f6: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801017fa: 75 0c jne 80101808 <iget+0x96>
panic("iget: no inodes");
801017fc: c7 04 24 c7 84 10 80 movl $0x801084c7,(%esp)
80101803: e8 32 ed ff ff call 8010053a <panic>
ip = empty;
80101808: 8b 45 f0 mov -0x10(%ebp),%eax
8010180b: 89 45 f4 mov %eax,-0xc(%ebp)
ip->dev = dev;
8010180e: 8b 45 f4 mov -0xc(%ebp),%eax
80101811: 8b 55 08 mov 0x8(%ebp),%edx
80101814: 89 10 mov %edx,(%eax)
ip->inum = inum;
80101816: 8b 45 f4 mov -0xc(%ebp),%eax
80101819: 8b 55 0c mov 0xc(%ebp),%edx
8010181c: 89 50 04 mov %edx,0x4(%eax)
ip->ref = 1;
8010181f: 8b 45 f4 mov -0xc(%ebp),%eax
80101822: c7 40 08 01 00 00 00 movl $0x1,0x8(%eax)
ip->flags = 0;
80101829: 8b 45 f4 mov -0xc(%ebp),%eax
8010182c: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
release(&icache.lock);
80101833: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
8010183a: e8 10 36 00 00 call 80104e4f <release>
return ip;
8010183f: 8b 45 f4 mov -0xc(%ebp),%eax
}
80101842: c9 leave
80101843: c3 ret
80101844 <idup>:
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
80101844: 55 push %ebp
80101845: 89 e5 mov %esp,%ebp
80101847: 83 ec 18 sub $0x18,%esp
acquire(&icache.lock);
8010184a: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
80101851: e8 97 35 00 00 call 80104ded <acquire>
ip->ref++;
80101856: 8b 45 08 mov 0x8(%ebp),%eax
80101859: 8b 40 08 mov 0x8(%eax),%eax
8010185c: 8d 50 01 lea 0x1(%eax),%edx
8010185f: 8b 45 08 mov 0x8(%ebp),%eax
80101862: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
80101865: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
8010186c: e8 de 35 00 00 call 80104e4f <release>
return ip;
80101871: 8b 45 08 mov 0x8(%ebp),%eax
}
80101874: c9 leave
80101875: c3 ret
80101876 <ilock>:
// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
80101876: 55 push %ebp
80101877: 89 e5 mov %esp,%ebp
80101879: 83 ec 28 sub $0x28,%esp
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
8010187c: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80101880: 74 0a je 8010188c <ilock+0x16>
80101882: 8b 45 08 mov 0x8(%ebp),%eax
80101885: 8b 40 08 mov 0x8(%eax),%eax
80101888: 85 c0 test %eax,%eax
8010188a: 7f 0c jg 80101898 <ilock+0x22>
panic("ilock");
8010188c: c7 04 24 d7 84 10 80 movl $0x801084d7,(%esp)
80101893: e8 a2 ec ff ff call 8010053a <panic>
acquire(&icache.lock);
80101898: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
8010189f: e8 49 35 00 00 call 80104ded <acquire>
while(ip->flags & I_BUSY)
801018a4: eb 13 jmp 801018b9 <ilock+0x43>
sleep(ip, &icache.lock);
801018a6: c7 44 24 04 a0 12 11 movl $0x801112a0,0x4(%esp)
801018ad: 80
801018ae: 8b 45 08 mov 0x8(%ebp),%eax
801018b1: 89 04 24 mov %eax,(%esp)
801018b4: e8 6a 32 00 00 call 80104b23 <sleep>
if(ip == 0 || ip->ref < 1)
panic("ilock");
acquire(&icache.lock);
while(ip->flags & I_BUSY)
801018b9: 8b 45 08 mov 0x8(%ebp),%eax
801018bc: 8b 40 0c mov 0xc(%eax),%eax
801018bf: 83 e0 01 and $0x1,%eax
801018c2: 85 c0 test %eax,%eax
801018c4: 75 e0 jne 801018a6 <ilock+0x30>
sleep(ip, &icache.lock);
ip->flags |= I_BUSY;
801018c6: 8b 45 08 mov 0x8(%ebp),%eax
801018c9: 8b 40 0c mov 0xc(%eax),%eax
801018cc: 83 c8 01 or $0x1,%eax
801018cf: 89 c2 mov %eax,%edx
801018d1: 8b 45 08 mov 0x8(%ebp),%eax
801018d4: 89 50 0c mov %edx,0xc(%eax)
release(&icache.lock);
801018d7: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
801018de: e8 6c 35 00 00 call 80104e4f <release>
if(!(ip->flags & I_VALID)){
801018e3: 8b 45 08 mov 0x8(%ebp),%eax
801018e6: 8b 40 0c mov 0xc(%eax),%eax
801018e9: 83 e0 02 and $0x2,%eax
801018ec: 85 c0 test %eax,%eax
801018ee: 0f 85 ce 00 00 00 jne 801019c2 <ilock+0x14c>
bp = bread(ip->dev, IBLOCK(ip->inum));
801018f4: 8b 45 08 mov 0x8(%ebp),%eax
801018f7: 8b 40 04 mov 0x4(%eax),%eax
801018fa: c1 e8 03 shr $0x3,%eax
801018fd: 8d 50 02 lea 0x2(%eax),%edx
80101900: 8b 45 08 mov 0x8(%ebp),%eax
80101903: 8b 00 mov (%eax),%eax
80101905: 89 54 24 04 mov %edx,0x4(%esp)
80101909: 89 04 24 mov %eax,(%esp)
8010190c: e8 95 e8 ff ff call 801001a6 <bread>
80101911: 89 45 f4 mov %eax,-0xc(%ebp)
dip = (struct dinode*)bp->data + ip->inum%IPB;
80101914: 8b 45 f4 mov -0xc(%ebp),%eax
80101917: 8d 50 18 lea 0x18(%eax),%edx
8010191a: 8b 45 08 mov 0x8(%ebp),%eax
8010191d: 8b 40 04 mov 0x4(%eax),%eax
80101920: 83 e0 07 and $0x7,%eax
80101923: c1 e0 06 shl $0x6,%eax
80101926: 01 d0 add %edx,%eax
80101928: 89 45 f0 mov %eax,-0x10(%ebp)
ip->type = dip->type;
8010192b: 8b 45 f0 mov -0x10(%ebp),%eax
8010192e: 0f b7 10 movzwl (%eax),%edx
80101931: 8b 45 08 mov 0x8(%ebp),%eax
80101934: 66 89 50 10 mov %dx,0x10(%eax)
ip->major = dip->major;
80101938: 8b 45 f0 mov -0x10(%ebp),%eax
8010193b: 0f b7 50 02 movzwl 0x2(%eax),%edx
8010193f: 8b 45 08 mov 0x8(%ebp),%eax
80101942: 66 89 50 12 mov %dx,0x12(%eax)
ip->minor = dip->minor;
80101946: 8b 45 f0 mov -0x10(%ebp),%eax
80101949: 0f b7 50 04 movzwl 0x4(%eax),%edx
8010194d: 8b 45 08 mov 0x8(%ebp),%eax
80101950: 66 89 50 14 mov %dx,0x14(%eax)
ip->nlink = dip->nlink;
80101954: 8b 45 f0 mov -0x10(%ebp),%eax
80101957: 0f b7 50 06 movzwl 0x6(%eax),%edx
8010195b: 8b 45 08 mov 0x8(%ebp),%eax
8010195e: 66 89 50 16 mov %dx,0x16(%eax)
ip->size = dip->size;
80101962: 8b 45 f0 mov -0x10(%ebp),%eax
80101965: 8b 50 08 mov 0x8(%eax),%edx
80101968: 8b 45 08 mov 0x8(%ebp),%eax
8010196b: 89 50 18 mov %edx,0x18(%eax)
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
8010196e: 8b 45 f0 mov -0x10(%ebp),%eax
80101971: 8d 50 0c lea 0xc(%eax),%edx
80101974: 8b 45 08 mov 0x8(%ebp),%eax
80101977: 83 c0 1c add $0x1c,%eax
8010197a: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp)
80101981: 00
80101982: 89 54 24 04 mov %edx,0x4(%esp)
80101986: 89 04 24 mov %eax,(%esp)
80101989: e8 82 37 00 00 call 80105110 <memmove>
brelse(bp);
8010198e: 8b 45 f4 mov -0xc(%ebp),%eax
80101991: 89 04 24 mov %eax,(%esp)
80101994: e8 7e e8 ff ff call 80100217 <brelse>
ip->flags |= I_VALID;
80101999: 8b 45 08 mov 0x8(%ebp),%eax
8010199c: 8b 40 0c mov 0xc(%eax),%eax
8010199f: 83 c8 02 or $0x2,%eax
801019a2: 89 c2 mov %eax,%edx
801019a4: 8b 45 08 mov 0x8(%ebp),%eax
801019a7: 89 50 0c mov %edx,0xc(%eax)
if(ip->type == 0)
801019aa: 8b 45 08 mov 0x8(%ebp),%eax
801019ad: 0f b7 40 10 movzwl 0x10(%eax),%eax
801019b1: 66 85 c0 test %ax,%ax
801019b4: 75 0c jne 801019c2 <ilock+0x14c>
panic("ilock: no type");
801019b6: c7 04 24 dd 84 10 80 movl $0x801084dd,(%esp)
801019bd: e8 78 eb ff ff call 8010053a <panic>
}
}
801019c2: c9 leave
801019c3: c3 ret
801019c4 <iunlock>:
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
801019c4: 55 push %ebp
801019c5: 89 e5 mov %esp,%ebp
801019c7: 83 ec 18 sub $0x18,%esp
if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1)
801019ca: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801019ce: 74 17 je 801019e7 <iunlock+0x23>
801019d0: 8b 45 08 mov 0x8(%ebp),%eax
801019d3: 8b 40 0c mov 0xc(%eax),%eax
801019d6: 83 e0 01 and $0x1,%eax
801019d9: 85 c0 test %eax,%eax
801019db: 74 0a je 801019e7 <iunlock+0x23>
801019dd: 8b 45 08 mov 0x8(%ebp),%eax
801019e0: 8b 40 08 mov 0x8(%eax),%eax
801019e3: 85 c0 test %eax,%eax
801019e5: 7f 0c jg 801019f3 <iunlock+0x2f>
panic("iunlock");
801019e7: c7 04 24 ec 84 10 80 movl $0x801084ec,(%esp)
801019ee: e8 47 eb ff ff call 8010053a <panic>
acquire(&icache.lock);
801019f3: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
801019fa: e8 ee 33 00 00 call 80104ded <acquire>
ip->flags &= ~I_BUSY;
801019ff: 8b 45 08 mov 0x8(%ebp),%eax
80101a02: 8b 40 0c mov 0xc(%eax),%eax
80101a05: 83 e0 fe and $0xfffffffe,%eax
80101a08: 89 c2 mov %eax,%edx
80101a0a: 8b 45 08 mov 0x8(%ebp),%eax
80101a0d: 89 50 0c mov %edx,0xc(%eax)
wakeup(ip);
80101a10: 8b 45 08 mov 0x8(%ebp),%eax
80101a13: 89 04 24 mov %eax,(%esp)
80101a16: e8 e1 31 00 00 call 80104bfc <wakeup>
release(&icache.lock);
80101a1b: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
80101a22: e8 28 34 00 00 call 80104e4f <release>
}
80101a27: c9 leave
80101a28: c3 ret
80101a29 <iput>:
// to it, free the inode (and its content) on disk.
// All calls to iput() must be inside a transaction in
// case it has to free the inode.
void
iput(struct inode *ip)
{
80101a29: 55 push %ebp
80101a2a: 89 e5 mov %esp,%ebp
80101a2c: 83 ec 18 sub $0x18,%esp
acquire(&icache.lock);
80101a2f: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
80101a36: e8 b2 33 00 00 call 80104ded <acquire>
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
80101a3b: 8b 45 08 mov 0x8(%ebp),%eax
80101a3e: 8b 40 08 mov 0x8(%eax),%eax
80101a41: 83 f8 01 cmp $0x1,%eax
80101a44: 0f 85 93 00 00 00 jne 80101add <iput+0xb4>
80101a4a: 8b 45 08 mov 0x8(%ebp),%eax
80101a4d: 8b 40 0c mov 0xc(%eax),%eax
80101a50: 83 e0 02 and $0x2,%eax
80101a53: 85 c0 test %eax,%eax
80101a55: 0f 84 82 00 00 00 je 80101add <iput+0xb4>
80101a5b: 8b 45 08 mov 0x8(%ebp),%eax
80101a5e: 0f b7 40 16 movzwl 0x16(%eax),%eax
80101a62: 66 85 c0 test %ax,%ax
80101a65: 75 76 jne 80101add <iput+0xb4>
// inode has no links and no other references: truncate and free.
if(ip->flags & I_BUSY)
80101a67: 8b 45 08 mov 0x8(%ebp),%eax
80101a6a: 8b 40 0c mov 0xc(%eax),%eax
80101a6d: 83 e0 01 and $0x1,%eax
80101a70: 85 c0 test %eax,%eax
80101a72: 74 0c je 80101a80 <iput+0x57>
panic("iput busy");
80101a74: c7 04 24 f4 84 10 80 movl $0x801084f4,(%esp)
80101a7b: e8 ba ea ff ff call 8010053a <panic>
ip->flags |= I_BUSY;
80101a80: 8b 45 08 mov 0x8(%ebp),%eax
80101a83: 8b 40 0c mov 0xc(%eax),%eax
80101a86: 83 c8 01 or $0x1,%eax
80101a89: 89 c2 mov %eax,%edx
80101a8b: 8b 45 08 mov 0x8(%ebp),%eax
80101a8e: 89 50 0c mov %edx,0xc(%eax)
release(&icache.lock);
80101a91: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
80101a98: e8 b2 33 00 00 call 80104e4f <release>
itrunc(ip);
80101a9d: 8b 45 08 mov 0x8(%ebp),%eax
80101aa0: 89 04 24 mov %eax,(%esp)
80101aa3: e8 7d 01 00 00 call 80101c25 <itrunc>
ip->type = 0;
80101aa8: 8b 45 08 mov 0x8(%ebp),%eax
80101aab: 66 c7 40 10 00 00 movw $0x0,0x10(%eax)
iupdate(ip);
80101ab1: 8b 45 08 mov 0x8(%ebp),%eax
80101ab4: 89 04 24 mov %eax,(%esp)
80101ab7: e8 fe fb ff ff call 801016ba <iupdate>
acquire(&icache.lock);
80101abc: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
80101ac3: e8 25 33 00 00 call 80104ded <acquire>
ip->flags = 0;
80101ac8: 8b 45 08 mov 0x8(%ebp),%eax
80101acb: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
wakeup(ip);
80101ad2: 8b 45 08 mov 0x8(%ebp),%eax
80101ad5: 89 04 24 mov %eax,(%esp)
80101ad8: e8 1f 31 00 00 call 80104bfc <wakeup>
}
ip->ref--;
80101add: 8b 45 08 mov 0x8(%ebp),%eax
80101ae0: 8b 40 08 mov 0x8(%eax),%eax
80101ae3: 8d 50 ff lea -0x1(%eax),%edx
80101ae6: 8b 45 08 mov 0x8(%ebp),%eax
80101ae9: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
80101aec: c7 04 24 a0 12 11 80 movl $0x801112a0,(%esp)
80101af3: e8 57 33 00 00 call 80104e4f <release>
}
80101af8: c9 leave
80101af9: c3 ret
80101afa <iunlockput>:
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
80101afa: 55 push %ebp
80101afb: 89 e5 mov %esp,%ebp
80101afd: 83 ec 18 sub $0x18,%esp
iunlock(ip);
80101b00: 8b 45 08 mov 0x8(%ebp),%eax
80101b03: 89 04 24 mov %eax,(%esp)
80101b06: e8 b9 fe ff ff call 801019c4 <iunlock>
iput(ip);
80101b0b: 8b 45 08 mov 0x8(%ebp),%eax
80101b0e: 89 04 24 mov %eax,(%esp)
80101b11: e8 13 ff ff ff call 80101a29 <iput>
}
80101b16: c9 leave
80101b17: c3 ret
80101b18 <bmap>:
// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
80101b18: 55 push %ebp
80101b19: 89 e5 mov %esp,%ebp
80101b1b: 53 push %ebx
80101b1c: 83 ec 24 sub $0x24,%esp
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
80101b1f: 83 7d 0c 0b cmpl $0xb,0xc(%ebp)
80101b23: 77 3e ja 80101b63 <bmap+0x4b>
if((addr = ip->addrs[bn]) == 0)
80101b25: 8b 45 08 mov 0x8(%ebp),%eax
80101b28: 8b 55 0c mov 0xc(%ebp),%edx
80101b2b: 83 c2 04 add $0x4,%edx
80101b2e: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax
80101b32: 89 45 f4 mov %eax,-0xc(%ebp)
80101b35: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101b39: 75 20 jne 80101b5b <bmap+0x43>
ip->addrs[bn] = addr = balloc(ip->dev);
80101b3b: 8b 45 08 mov 0x8(%ebp),%eax
80101b3e: 8b 00 mov (%eax),%eax
80101b40: 89 04 24 mov %eax,(%esp)
80101b43: e8 5b f8 ff ff call 801013a3 <balloc>
80101b48: 89 45 f4 mov %eax,-0xc(%ebp)
80101b4b: 8b 45 08 mov 0x8(%ebp),%eax
80101b4e: 8b 55 0c mov 0xc(%ebp),%edx
80101b51: 8d 4a 04 lea 0x4(%edx),%ecx
80101b54: 8b 55 f4 mov -0xc(%ebp),%edx
80101b57: 89 54 88 0c mov %edx,0xc(%eax,%ecx,4)
return addr;
80101b5b: 8b 45 f4 mov -0xc(%ebp),%eax
80101b5e: e9 bc 00 00 00 jmp 80101c1f <bmap+0x107>
}
bn -= NDIRECT;
80101b63: 83 6d 0c 0c subl $0xc,0xc(%ebp)
if(bn < NINDIRECT){
80101b67: 83 7d 0c 7f cmpl $0x7f,0xc(%ebp)
80101b6b: 0f 87 a2 00 00 00 ja 80101c13 <bmap+0xfb>
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
80101b71: 8b 45 08 mov 0x8(%ebp),%eax
80101b74: 8b 40 4c mov 0x4c(%eax),%eax
80101b77: 89 45 f4 mov %eax,-0xc(%ebp)
80101b7a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101b7e: 75 19 jne 80101b99 <bmap+0x81>
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80101b80: 8b 45 08 mov 0x8(%ebp),%eax
80101b83: 8b 00 mov (%eax),%eax
80101b85: 89 04 24 mov %eax,(%esp)
80101b88: e8 16 f8 ff ff call 801013a3 <balloc>
80101b8d: 89 45 f4 mov %eax,-0xc(%ebp)
80101b90: 8b 45 08 mov 0x8(%ebp),%eax
80101b93: 8b 55 f4 mov -0xc(%ebp),%edx
80101b96: 89 50 4c mov %edx,0x4c(%eax)
bp = bread(ip->dev, addr);
80101b99: 8b 45 08 mov 0x8(%ebp),%eax
80101b9c: 8b 00 mov (%eax),%eax
80101b9e: 8b 55 f4 mov -0xc(%ebp),%edx
80101ba1: 89 54 24 04 mov %edx,0x4(%esp)
80101ba5: 89 04 24 mov %eax,(%esp)
80101ba8: e8 f9 e5 ff ff call 801001a6 <bread>
80101bad: 89 45 f0 mov %eax,-0x10(%ebp)
a = (uint*)bp->data;
80101bb0: 8b 45 f0 mov -0x10(%ebp),%eax
80101bb3: 83 c0 18 add $0x18,%eax
80101bb6: 89 45 ec mov %eax,-0x14(%ebp)
if((addr = a[bn]) == 0){
80101bb9: 8b 45 0c mov 0xc(%ebp),%eax
80101bbc: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101bc3: 8b 45 ec mov -0x14(%ebp),%eax
80101bc6: 01 d0 add %edx,%eax
80101bc8: 8b 00 mov (%eax),%eax
80101bca: 89 45 f4 mov %eax,-0xc(%ebp)
80101bcd: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101bd1: 75 30 jne 80101c03 <bmap+0xeb>
a[bn] = addr = balloc(ip->dev);
80101bd3: 8b 45 0c mov 0xc(%ebp),%eax
80101bd6: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101bdd: 8b 45 ec mov -0x14(%ebp),%eax
80101be0: 8d 1c 02 lea (%edx,%eax,1),%ebx
80101be3: 8b 45 08 mov 0x8(%ebp),%eax
80101be6: 8b 00 mov (%eax),%eax
80101be8: 89 04 24 mov %eax,(%esp)
80101beb: e8 b3 f7 ff ff call 801013a3 <balloc>
80101bf0: 89 45 f4 mov %eax,-0xc(%ebp)
80101bf3: 8b 45 f4 mov -0xc(%ebp),%eax
80101bf6: 89 03 mov %eax,(%ebx)
log_write(bp);
80101bf8: 8b 45 f0 mov -0x10(%ebp),%eax
80101bfb: 89 04 24 mov %eax,(%esp)
80101bfe: e8 33 1a 00 00 call 80103636 <log_write>
}
brelse(bp);
80101c03: 8b 45 f0 mov -0x10(%ebp),%eax
80101c06: 89 04 24 mov %eax,(%esp)
80101c09: e8 09 e6 ff ff call 80100217 <brelse>
return addr;
80101c0e: 8b 45 f4 mov -0xc(%ebp),%eax
80101c11: eb 0c jmp 80101c1f <bmap+0x107>
}
panic("bmap: out of range");
80101c13: c7 04 24 fe 84 10 80 movl $0x801084fe,(%esp)
80101c1a: e8 1b e9 ff ff call 8010053a <panic>
}
80101c1f: 83 c4 24 add $0x24,%esp
80101c22: 5b pop %ebx
80101c23: 5d pop %ebp
80101c24: c3 ret
80101c25 <itrunc>:
// to it (no directory entries referring to it)
// and has no in-memory reference to it (is
// not an open file or current directory).
static void
itrunc(struct inode *ip)
{
80101c25: 55 push %ebp
80101c26: 89 e5 mov %esp,%ebp
80101c28: 83 ec 28 sub $0x28,%esp
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101c2b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80101c32: eb 44 jmp 80101c78 <itrunc+0x53>
if(ip->addrs[i]){
80101c34: 8b 45 08 mov 0x8(%ebp),%eax
80101c37: 8b 55 f4 mov -0xc(%ebp),%edx
80101c3a: 83 c2 04 add $0x4,%edx
80101c3d: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax
80101c41: 85 c0 test %eax,%eax
80101c43: 74 2f je 80101c74 <itrunc+0x4f>
bfree(ip->dev, ip->addrs[i]);
80101c45: 8b 45 08 mov 0x8(%ebp),%eax
80101c48: 8b 55 f4 mov -0xc(%ebp),%edx
80101c4b: 83 c2 04 add $0x4,%edx
80101c4e: 8b 54 90 0c mov 0xc(%eax,%edx,4),%edx
80101c52: 8b 45 08 mov 0x8(%ebp),%eax
80101c55: 8b 00 mov (%eax),%eax
80101c57: 89 54 24 04 mov %edx,0x4(%esp)
80101c5b: 89 04 24 mov %eax,(%esp)
80101c5e: e8 8e f8 ff ff call 801014f1 <bfree>
ip->addrs[i] = 0;
80101c63: 8b 45 08 mov 0x8(%ebp),%eax
80101c66: 8b 55 f4 mov -0xc(%ebp),%edx
80101c69: 83 c2 04 add $0x4,%edx
80101c6c: c7 44 90 0c 00 00 00 movl $0x0,0xc(%eax,%edx,4)
80101c73: 00
{
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101c74: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80101c78: 83 7d f4 0b cmpl $0xb,-0xc(%ebp)
80101c7c: 7e b6 jle 80101c34 <itrunc+0xf>
bfree(ip->dev, ip->addrs[i]);
ip->addrs[i] = 0;
}
}
if(ip->addrs[NDIRECT]){
80101c7e: 8b 45 08 mov 0x8(%ebp),%eax
80101c81: 8b 40 4c mov 0x4c(%eax),%eax
80101c84: 85 c0 test %eax,%eax
80101c86: 0f 84 9b 00 00 00 je 80101d27 <itrunc+0x102>
bp = bread(ip->dev, ip->addrs[NDIRECT]);
80101c8c: 8b 45 08 mov 0x8(%ebp),%eax
80101c8f: 8b 50 4c mov 0x4c(%eax),%edx
80101c92: 8b 45 08 mov 0x8(%ebp),%eax
80101c95: 8b 00 mov (%eax),%eax
80101c97: 89 54 24 04 mov %edx,0x4(%esp)
80101c9b: 89 04 24 mov %eax,(%esp)
80101c9e: e8 03 e5 ff ff call 801001a6 <bread>
80101ca3: 89 45 ec mov %eax,-0x14(%ebp)
a = (uint*)bp->data;
80101ca6: 8b 45 ec mov -0x14(%ebp),%eax
80101ca9: 83 c0 18 add $0x18,%eax
80101cac: 89 45 e8 mov %eax,-0x18(%ebp)
for(j = 0; j < NINDIRECT; j++){
80101caf: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
80101cb6: eb 3b jmp 80101cf3 <itrunc+0xce>
if(a[j])
80101cb8: 8b 45 f0 mov -0x10(%ebp),%eax
80101cbb: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101cc2: 8b 45 e8 mov -0x18(%ebp),%eax
80101cc5: 01 d0 add %edx,%eax
80101cc7: 8b 00 mov (%eax),%eax
80101cc9: 85 c0 test %eax,%eax
80101ccb: 74 22 je 80101cef <itrunc+0xca>
bfree(ip->dev, a[j]);
80101ccd: 8b 45 f0 mov -0x10(%ebp),%eax
80101cd0: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101cd7: 8b 45 e8 mov -0x18(%ebp),%eax
80101cda: 01 d0 add %edx,%eax
80101cdc: 8b 10 mov (%eax),%edx
80101cde: 8b 45 08 mov 0x8(%ebp),%eax
80101ce1: 8b 00 mov (%eax),%eax
80101ce3: 89 54 24 04 mov %edx,0x4(%esp)
80101ce7: 89 04 24 mov %eax,(%esp)
80101cea: e8 02 f8 ff ff call 801014f1 <bfree>
}
if(ip->addrs[NDIRECT]){
bp = bread(ip->dev, ip->addrs[NDIRECT]);
a = (uint*)bp->data;
for(j = 0; j < NINDIRECT; j++){
80101cef: 83 45 f0 01 addl $0x1,-0x10(%ebp)
80101cf3: 8b 45 f0 mov -0x10(%ebp),%eax
80101cf6: 83 f8 7f cmp $0x7f,%eax
80101cf9: 76 bd jbe 80101cb8 <itrunc+0x93>
if(a[j])
bfree(ip->dev, a[j]);
}
brelse(bp);
80101cfb: 8b 45 ec mov -0x14(%ebp),%eax
80101cfe: 89 04 24 mov %eax,(%esp)
80101d01: e8 11 e5 ff ff call 80100217 <brelse>
bfree(ip->dev, ip->addrs[NDIRECT]);
80101d06: 8b 45 08 mov 0x8(%ebp),%eax
80101d09: 8b 50 4c mov 0x4c(%eax),%edx
80101d0c: 8b 45 08 mov 0x8(%ebp),%eax
80101d0f: 8b 00 mov (%eax),%eax
80101d11: 89 54 24 04 mov %edx,0x4(%esp)
80101d15: 89 04 24 mov %eax,(%esp)
80101d18: e8 d4 f7 ff ff call 801014f1 <bfree>
ip->addrs[NDIRECT] = 0;
80101d1d: 8b 45 08 mov 0x8(%ebp),%eax
80101d20: c7 40 4c 00 00 00 00 movl $0x0,0x4c(%eax)
}
ip->size = 0;
80101d27: 8b 45 08 mov 0x8(%ebp),%eax
80101d2a: c7 40 18 00 00 00 00 movl $0x0,0x18(%eax)
iupdate(ip);
80101d31: 8b 45 08 mov 0x8(%ebp),%eax
80101d34: 89 04 24 mov %eax,(%esp)
80101d37: e8 7e f9 ff ff call 801016ba <iupdate>
}
80101d3c: c9 leave
80101d3d: c3 ret
80101d3e <stati>:
// Copy stat information from inode.
void
stati(struct inode *ip, struct stat *st)
{
80101d3e: 55 push %ebp
80101d3f: 89 e5 mov %esp,%ebp
st->dev = ip->dev;
80101d41: 8b 45 08 mov 0x8(%ebp),%eax
80101d44: 8b 00 mov (%eax),%eax
80101d46: 89 c2 mov %eax,%edx
80101d48: 8b 45 0c mov 0xc(%ebp),%eax
80101d4b: 89 50 04 mov %edx,0x4(%eax)
st->ino = ip->inum;
80101d4e: 8b 45 08 mov 0x8(%ebp),%eax
80101d51: 8b 50 04 mov 0x4(%eax),%edx
80101d54: 8b 45 0c mov 0xc(%ebp),%eax
80101d57: 89 50 08 mov %edx,0x8(%eax)
st->type = ip->type;
80101d5a: 8b 45 08 mov 0x8(%ebp),%eax
80101d5d: 0f b7 50 10 movzwl 0x10(%eax),%edx
80101d61: 8b 45 0c mov 0xc(%ebp),%eax
80101d64: 66 89 10 mov %dx,(%eax)
st->nlink = ip->nlink;
80101d67: 8b 45 08 mov 0x8(%ebp),%eax
80101d6a: 0f b7 50 16 movzwl 0x16(%eax),%edx
80101d6e: 8b 45 0c mov 0xc(%ebp),%eax
80101d71: 66 89 50 0c mov %dx,0xc(%eax)
st->size = ip->size;
80101d75: 8b 45 08 mov 0x8(%ebp),%eax
80101d78: 8b 50 18 mov 0x18(%eax),%edx
80101d7b: 8b 45 0c mov 0xc(%ebp),%eax
80101d7e: 89 50 10 mov %edx,0x10(%eax)
}
80101d81: 5d pop %ebp
80101d82: c3 ret
80101d83 <readi>:
//PAGEBREAK!
// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101d83: 55 push %ebp
80101d84: 89 e5 mov %esp,%ebp
80101d86: 83 ec 28 sub $0x28,%esp
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101d89: 8b 45 08 mov 0x8(%ebp),%eax
80101d8c: 0f b7 40 10 movzwl 0x10(%eax),%eax
80101d90: 66 83 f8 03 cmp $0x3,%ax
80101d94: 75 60 jne 80101df6 <readi+0x73>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101d96: 8b 45 08 mov 0x8(%ebp),%eax
80101d99: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101d9d: 66 85 c0 test %ax,%ax
80101da0: 78 20 js 80101dc2 <readi+0x3f>
80101da2: 8b 45 08 mov 0x8(%ebp),%eax
80101da5: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101da9: 66 83 f8 09 cmp $0x9,%ax
80101dad: 7f 13 jg 80101dc2 <readi+0x3f>
80101daf: 8b 45 08 mov 0x8(%ebp),%eax
80101db2: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101db6: 98 cwtl
80101db7: 8b 04 c5 40 12 11 80 mov -0x7feeedc0(,%eax,8),%eax
80101dbe: 85 c0 test %eax,%eax
80101dc0: 75 0a jne 80101dcc <readi+0x49>
return -1;
80101dc2: b8 ff ff ff ff mov $0xffffffff,%eax
80101dc7: e9 19 01 00 00 jmp 80101ee5 <readi+0x162>
return devsw[ip->major].read(ip, dst, n);
80101dcc: 8b 45 08 mov 0x8(%ebp),%eax
80101dcf: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101dd3: 98 cwtl
80101dd4: 8b 04 c5 40 12 11 80 mov -0x7feeedc0(,%eax,8),%eax
80101ddb: 8b 55 14 mov 0x14(%ebp),%edx
80101dde: 89 54 24 08 mov %edx,0x8(%esp)
80101de2: 8b 55 0c mov 0xc(%ebp),%edx
80101de5: 89 54 24 04 mov %edx,0x4(%esp)
80101de9: 8b 55 08 mov 0x8(%ebp),%edx
80101dec: 89 14 24 mov %edx,(%esp)
80101def: ff d0 call *%eax
80101df1: e9 ef 00 00 00 jmp 80101ee5 <readi+0x162>
}
if(off > ip->size || off + n < off)
80101df6: 8b 45 08 mov 0x8(%ebp),%eax
80101df9: 8b 40 18 mov 0x18(%eax),%eax
80101dfc: 3b 45 10 cmp 0x10(%ebp),%eax
80101dff: 72 0d jb 80101e0e <readi+0x8b>
80101e01: 8b 45 14 mov 0x14(%ebp),%eax
80101e04: 8b 55 10 mov 0x10(%ebp),%edx
80101e07: 01 d0 add %edx,%eax
80101e09: 3b 45 10 cmp 0x10(%ebp),%eax
80101e0c: 73 0a jae 80101e18 <readi+0x95>
return -1;
80101e0e: b8 ff ff ff ff mov $0xffffffff,%eax
80101e13: e9 cd 00 00 00 jmp 80101ee5 <readi+0x162>
if(off + n > ip->size)
80101e18: 8b 45 14 mov 0x14(%ebp),%eax
80101e1b: 8b 55 10 mov 0x10(%ebp),%edx
80101e1e: 01 c2 add %eax,%edx
80101e20: 8b 45 08 mov 0x8(%ebp),%eax
80101e23: 8b 40 18 mov 0x18(%eax),%eax
80101e26: 39 c2 cmp %eax,%edx
80101e28: 76 0c jbe 80101e36 <readi+0xb3>
n = ip->size - off;
80101e2a: 8b 45 08 mov 0x8(%ebp),%eax
80101e2d: 8b 40 18 mov 0x18(%eax),%eax
80101e30: 2b 45 10 sub 0x10(%ebp),%eax
80101e33: 89 45 14 mov %eax,0x14(%ebp)
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101e36: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80101e3d: e9 94 00 00 00 jmp 80101ed6 <readi+0x153>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101e42: 8b 45 10 mov 0x10(%ebp),%eax
80101e45: c1 e8 09 shr $0x9,%eax
80101e48: 89 44 24 04 mov %eax,0x4(%esp)
80101e4c: 8b 45 08 mov 0x8(%ebp),%eax
80101e4f: 89 04 24 mov %eax,(%esp)
80101e52: e8 c1 fc ff ff call 80101b18 <bmap>
80101e57: 8b 55 08 mov 0x8(%ebp),%edx
80101e5a: 8b 12 mov (%edx),%edx
80101e5c: 89 44 24 04 mov %eax,0x4(%esp)
80101e60: 89 14 24 mov %edx,(%esp)
80101e63: e8 3e e3 ff ff call 801001a6 <bread>
80101e68: 89 45 f0 mov %eax,-0x10(%ebp)
m = min(n - tot, BSIZE - off%BSIZE);
80101e6b: 8b 45 10 mov 0x10(%ebp),%eax
80101e6e: 25 ff 01 00 00 and $0x1ff,%eax
80101e73: 89 c2 mov %eax,%edx
80101e75: b8 00 02 00 00 mov $0x200,%eax
80101e7a: 29 d0 sub %edx,%eax
80101e7c: 89 c2 mov %eax,%edx
80101e7e: 8b 45 f4 mov -0xc(%ebp),%eax
80101e81: 8b 4d 14 mov 0x14(%ebp),%ecx
80101e84: 29 c1 sub %eax,%ecx
80101e86: 89 c8 mov %ecx,%eax
80101e88: 39 c2 cmp %eax,%edx
80101e8a: 0f 46 c2 cmovbe %edx,%eax
80101e8d: 89 45 ec mov %eax,-0x14(%ebp)
memmove(dst, bp->data + off%BSIZE, m);
80101e90: 8b 45 10 mov 0x10(%ebp),%eax
80101e93: 25 ff 01 00 00 and $0x1ff,%eax
80101e98: 8d 50 10 lea 0x10(%eax),%edx
80101e9b: 8b 45 f0 mov -0x10(%ebp),%eax
80101e9e: 01 d0 add %edx,%eax
80101ea0: 8d 50 08 lea 0x8(%eax),%edx
80101ea3: 8b 45 ec mov -0x14(%ebp),%eax
80101ea6: 89 44 24 08 mov %eax,0x8(%esp)
80101eaa: 89 54 24 04 mov %edx,0x4(%esp)
80101eae: 8b 45 0c mov 0xc(%ebp),%eax
80101eb1: 89 04 24 mov %eax,(%esp)
80101eb4: e8 57 32 00 00 call 80105110 <memmove>
brelse(bp);
80101eb9: 8b 45 f0 mov -0x10(%ebp),%eax
80101ebc: 89 04 24 mov %eax,(%esp)
80101ebf: e8 53 e3 ff ff call 80100217 <brelse>
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101ec4: 8b 45 ec mov -0x14(%ebp),%eax
80101ec7: 01 45 f4 add %eax,-0xc(%ebp)
80101eca: 8b 45 ec mov -0x14(%ebp),%eax
80101ecd: 01 45 10 add %eax,0x10(%ebp)
80101ed0: 8b 45 ec mov -0x14(%ebp),%eax
80101ed3: 01 45 0c add %eax,0xc(%ebp)
80101ed6: 8b 45 f4 mov -0xc(%ebp),%eax
80101ed9: 3b 45 14 cmp 0x14(%ebp),%eax
80101edc: 0f 82 60 ff ff ff jb 80101e42 <readi+0xbf>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}
return n;
80101ee2: 8b 45 14 mov 0x14(%ebp),%eax
}
80101ee5: c9 leave
80101ee6: c3 ret
80101ee7 <writei>:
// PAGEBREAK!
// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101ee7: 55 push %ebp
80101ee8: 89 e5 mov %esp,%ebp
80101eea: 83 ec 28 sub $0x28,%esp
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101eed: 8b 45 08 mov 0x8(%ebp),%eax
80101ef0: 0f b7 40 10 movzwl 0x10(%eax),%eax
80101ef4: 66 83 f8 03 cmp $0x3,%ax
80101ef8: 75 60 jne 80101f5a <writei+0x73>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
80101efa: 8b 45 08 mov 0x8(%ebp),%eax
80101efd: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101f01: 66 85 c0 test %ax,%ax
80101f04: 78 20 js 80101f26 <writei+0x3f>
80101f06: 8b 45 08 mov 0x8(%ebp),%eax
80101f09: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101f0d: 66 83 f8 09 cmp $0x9,%ax
80101f11: 7f 13 jg 80101f26 <writei+0x3f>
80101f13: 8b 45 08 mov 0x8(%ebp),%eax
80101f16: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101f1a: 98 cwtl
80101f1b: 8b 04 c5 44 12 11 80 mov -0x7feeedbc(,%eax,8),%eax
80101f22: 85 c0 test %eax,%eax
80101f24: 75 0a jne 80101f30 <writei+0x49>
return -1;
80101f26: b8 ff ff ff ff mov $0xffffffff,%eax
80101f2b: e9 44 01 00 00 jmp 80102074 <writei+0x18d>
return devsw[ip->major].write(ip, src, n);
80101f30: 8b 45 08 mov 0x8(%ebp),%eax
80101f33: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101f37: 98 cwtl
80101f38: 8b 04 c5 44 12 11 80 mov -0x7feeedbc(,%eax,8),%eax
80101f3f: 8b 55 14 mov 0x14(%ebp),%edx
80101f42: 89 54 24 08 mov %edx,0x8(%esp)
80101f46: 8b 55 0c mov 0xc(%ebp),%edx
80101f49: 89 54 24 04 mov %edx,0x4(%esp)
80101f4d: 8b 55 08 mov 0x8(%ebp),%edx
80101f50: 89 14 24 mov %edx,(%esp)
80101f53: ff d0 call *%eax
80101f55: e9 1a 01 00 00 jmp 80102074 <writei+0x18d>
}
if(off > ip->size || off + n < off)
80101f5a: 8b 45 08 mov 0x8(%ebp),%eax
80101f5d: 8b 40 18 mov 0x18(%eax),%eax
80101f60: 3b 45 10 cmp 0x10(%ebp),%eax
80101f63: 72 0d jb 80101f72 <writei+0x8b>
80101f65: 8b 45 14 mov 0x14(%ebp),%eax
80101f68: 8b 55 10 mov 0x10(%ebp),%edx
80101f6b: 01 d0 add %edx,%eax
80101f6d: 3b 45 10 cmp 0x10(%ebp),%eax
80101f70: 73 0a jae 80101f7c <writei+0x95>
return -1;
80101f72: b8 ff ff ff ff mov $0xffffffff,%eax
80101f77: e9 f8 00 00 00 jmp 80102074 <writei+0x18d>
if(off + n > MAXFILE*BSIZE)
80101f7c: 8b 45 14 mov 0x14(%ebp),%eax
80101f7f: 8b 55 10 mov 0x10(%ebp),%edx
80101f82: 01 d0 add %edx,%eax
80101f84: 3d 00 18 01 00 cmp $0x11800,%eax
80101f89: 76 0a jbe 80101f95 <writei+0xae>
return -1;
80101f8b: b8 ff ff ff ff mov $0xffffffff,%eax
80101f90: e9 df 00 00 00 jmp 80102074 <writei+0x18d>
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101f95: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80101f9c: e9 9f 00 00 00 jmp 80102040 <writei+0x159>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101fa1: 8b 45 10 mov 0x10(%ebp),%eax
80101fa4: c1 e8 09 shr $0x9,%eax
80101fa7: 89 44 24 04 mov %eax,0x4(%esp)
80101fab: 8b 45 08 mov 0x8(%ebp),%eax
80101fae: 89 04 24 mov %eax,(%esp)
80101fb1: e8 62 fb ff ff call 80101b18 <bmap>
80101fb6: 8b 55 08 mov 0x8(%ebp),%edx
80101fb9: 8b 12 mov (%edx),%edx
80101fbb: 89 44 24 04 mov %eax,0x4(%esp)
80101fbf: 89 14 24 mov %edx,(%esp)
80101fc2: e8 df e1 ff ff call 801001a6 <bread>
80101fc7: 89 45 f0 mov %eax,-0x10(%ebp)
m = min(n - tot, BSIZE - off%BSIZE);
80101fca: 8b 45 10 mov 0x10(%ebp),%eax
80101fcd: 25 ff 01 00 00 and $0x1ff,%eax
80101fd2: 89 c2 mov %eax,%edx
80101fd4: b8 00 02 00 00 mov $0x200,%eax
80101fd9: 29 d0 sub %edx,%eax
80101fdb: 89 c2 mov %eax,%edx
80101fdd: 8b 45 f4 mov -0xc(%ebp),%eax
80101fe0: 8b 4d 14 mov 0x14(%ebp),%ecx
80101fe3: 29 c1 sub %eax,%ecx
80101fe5: 89 c8 mov %ecx,%eax
80101fe7: 39 c2 cmp %eax,%edx
80101fe9: 0f 46 c2 cmovbe %edx,%eax
80101fec: 89 45 ec mov %eax,-0x14(%ebp)
memmove(bp->data + off%BSIZE, src, m);
80101fef: 8b 45 10 mov 0x10(%ebp),%eax
80101ff2: 25 ff 01 00 00 and $0x1ff,%eax
80101ff7: 8d 50 10 lea 0x10(%eax),%edx
80101ffa: 8b 45 f0 mov -0x10(%ebp),%eax
80101ffd: 01 d0 add %edx,%eax
80101fff: 8d 50 08 lea 0x8(%eax),%edx
80102002: 8b 45 ec mov -0x14(%ebp),%eax
80102005: 89 44 24 08 mov %eax,0x8(%esp)
80102009: 8b 45 0c mov 0xc(%ebp),%eax
8010200c: 89 44 24 04 mov %eax,0x4(%esp)
80102010: 89 14 24 mov %edx,(%esp)
80102013: e8 f8 30 00 00 call 80105110 <memmove>
log_write(bp);
80102018: 8b 45 f0 mov -0x10(%ebp),%eax
8010201b: 89 04 24 mov %eax,(%esp)
8010201e: e8 13 16 00 00 call 80103636 <log_write>
brelse(bp);
80102023: 8b 45 f0 mov -0x10(%ebp),%eax
80102026: 89 04 24 mov %eax,(%esp)
80102029: e8 e9 e1 ff ff call 80100217 <brelse>
if(off > ip->size || off + n < off)
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
8010202e: 8b 45 ec mov -0x14(%ebp),%eax
80102031: 01 45 f4 add %eax,-0xc(%ebp)
80102034: 8b 45 ec mov -0x14(%ebp),%eax
80102037: 01 45 10 add %eax,0x10(%ebp)
8010203a: 8b 45 ec mov -0x14(%ebp),%eax
8010203d: 01 45 0c add %eax,0xc(%ebp)
80102040: 8b 45 f4 mov -0xc(%ebp),%eax
80102043: 3b 45 14 cmp 0x14(%ebp),%eax
80102046: 0f 82 55 ff ff ff jb 80101fa1 <writei+0xba>
memmove(bp->data + off%BSIZE, src, m);
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
8010204c: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
80102050: 74 1f je 80102071 <writei+0x18a>
80102052: 8b 45 08 mov 0x8(%ebp),%eax
80102055: 8b 40 18 mov 0x18(%eax),%eax
80102058: 3b 45 10 cmp 0x10(%ebp),%eax
8010205b: 73 14 jae 80102071 <writei+0x18a>
ip->size = off;
8010205d: 8b 45 08 mov 0x8(%ebp),%eax
80102060: 8b 55 10 mov 0x10(%ebp),%edx
80102063: 89 50 18 mov %edx,0x18(%eax)
iupdate(ip);
80102066: 8b 45 08 mov 0x8(%ebp),%eax
80102069: 89 04 24 mov %eax,(%esp)
8010206c: e8 49 f6 ff ff call 801016ba <iupdate>
}
return n;
80102071: 8b 45 14 mov 0x14(%ebp),%eax
}
80102074: c9 leave
80102075: c3 ret
80102076 <namecmp>:
//PAGEBREAK!
// Directories
int
namecmp(const char *s, const char *t)
{
80102076: 55 push %ebp
80102077: 89 e5 mov %esp,%ebp
80102079: 83 ec 18 sub $0x18,%esp
return strncmp(s, t, DIRSIZ);
8010207c: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80102083: 00
80102084: 8b 45 0c mov 0xc(%ebp),%eax
80102087: 89 44 24 04 mov %eax,0x4(%esp)
8010208b: 8b 45 08 mov 0x8(%ebp),%eax
8010208e: 89 04 24 mov %eax,(%esp)
80102091: e8 1d 31 00 00 call 801051b3 <strncmp>
}
80102096: c9 leave
80102097: c3 ret
80102098 <dirlookup>:
// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
80102098: 55 push %ebp
80102099: 89 e5 mov %esp,%ebp
8010209b: 83 ec 38 sub $0x38,%esp
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
8010209e: 8b 45 08 mov 0x8(%ebp),%eax
801020a1: 0f b7 40 10 movzwl 0x10(%eax),%eax
801020a5: 66 83 f8 01 cmp $0x1,%ax
801020a9: 74 0c je 801020b7 <dirlookup+0x1f>
panic("dirlookup not DIR");
801020ab: c7 04 24 11 85 10 80 movl $0x80108511,(%esp)
801020b2: e8 83 e4 ff ff call 8010053a <panic>
for(off = 0; off < dp->size; off += sizeof(de)){
801020b7: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801020be: e9 88 00 00 00 jmp 8010214b <dirlookup+0xb3>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801020c3: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
801020ca: 00
801020cb: 8b 45 f4 mov -0xc(%ebp),%eax
801020ce: 89 44 24 08 mov %eax,0x8(%esp)
801020d2: 8d 45 e0 lea -0x20(%ebp),%eax
801020d5: 89 44 24 04 mov %eax,0x4(%esp)
801020d9: 8b 45 08 mov 0x8(%ebp),%eax
801020dc: 89 04 24 mov %eax,(%esp)
801020df: e8 9f fc ff ff call 80101d83 <readi>
801020e4: 83 f8 10 cmp $0x10,%eax
801020e7: 74 0c je 801020f5 <dirlookup+0x5d>
panic("dirlink read");
801020e9: c7 04 24 23 85 10 80 movl $0x80108523,(%esp)
801020f0: e8 45 e4 ff ff call 8010053a <panic>
if(de.inum == 0)
801020f5: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
801020f9: 66 85 c0 test %ax,%ax
801020fc: 75 02 jne 80102100 <dirlookup+0x68>
continue;
801020fe: eb 47 jmp 80102147 <dirlookup+0xaf>
if(namecmp(name, de.name) == 0){
80102100: 8d 45 e0 lea -0x20(%ebp),%eax
80102103: 83 c0 02 add $0x2,%eax
80102106: 89 44 24 04 mov %eax,0x4(%esp)
8010210a: 8b 45 0c mov 0xc(%ebp),%eax
8010210d: 89 04 24 mov %eax,(%esp)
80102110: e8 61 ff ff ff call 80102076 <namecmp>
80102115: 85 c0 test %eax,%eax
80102117: 75 2e jne 80102147 <dirlookup+0xaf>
// entry matches path element
if(poff)
80102119: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
8010211d: 74 08 je 80102127 <dirlookup+0x8f>
*poff = off;
8010211f: 8b 45 10 mov 0x10(%ebp),%eax
80102122: 8b 55 f4 mov -0xc(%ebp),%edx
80102125: 89 10 mov %edx,(%eax)
inum = de.inum;
80102127: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
8010212b: 0f b7 c0 movzwl %ax,%eax
8010212e: 89 45 f0 mov %eax,-0x10(%ebp)
return iget(dp->dev, inum);
80102131: 8b 45 08 mov 0x8(%ebp),%eax
80102134: 8b 00 mov (%eax),%eax
80102136: 8b 55 f0 mov -0x10(%ebp),%edx
80102139: 89 54 24 04 mov %edx,0x4(%esp)
8010213d: 89 04 24 mov %eax,(%esp)
80102140: e8 2d f6 ff ff call 80101772 <iget>
80102145: eb 18 jmp 8010215f <dirlookup+0xc7>
struct dirent de;
if(dp->type != T_DIR)
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
80102147: 83 45 f4 10 addl $0x10,-0xc(%ebp)
8010214b: 8b 45 08 mov 0x8(%ebp),%eax
8010214e: 8b 40 18 mov 0x18(%eax),%eax
80102151: 3b 45 f4 cmp -0xc(%ebp),%eax
80102154: 0f 87 69 ff ff ff ja 801020c3 <dirlookup+0x2b>
inum = de.inum;
return iget(dp->dev, inum);
}
}
return 0;
8010215a: b8 00 00 00 00 mov $0x0,%eax
}
8010215f: c9 leave
80102160: c3 ret
80102161 <dirlink>:
// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
80102161: 55 push %ebp
80102162: 89 e5 mov %esp,%ebp
80102164: 83 ec 38 sub $0x38,%esp
int off;
struct dirent de;
struct inode *ip;
// Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){
80102167: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
8010216e: 00
8010216f: 8b 45 0c mov 0xc(%ebp),%eax
80102172: 89 44 24 04 mov %eax,0x4(%esp)
80102176: 8b 45 08 mov 0x8(%ebp),%eax
80102179: 89 04 24 mov %eax,(%esp)
8010217c: e8 17 ff ff ff call 80102098 <dirlookup>
80102181: 89 45 f0 mov %eax,-0x10(%ebp)
80102184: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80102188: 74 15 je 8010219f <dirlink+0x3e>
iput(ip);
8010218a: 8b 45 f0 mov -0x10(%ebp),%eax
8010218d: 89 04 24 mov %eax,(%esp)
80102190: e8 94 f8 ff ff call 80101a29 <iput>
return -1;
80102195: b8 ff ff ff ff mov $0xffffffff,%eax
8010219a: e9 b7 00 00 00 jmp 80102256 <dirlink+0xf5>
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
8010219f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801021a6: eb 46 jmp 801021ee <dirlink+0x8d>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801021a8: 8b 45 f4 mov -0xc(%ebp),%eax
801021ab: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
801021b2: 00
801021b3: 89 44 24 08 mov %eax,0x8(%esp)
801021b7: 8d 45 e0 lea -0x20(%ebp),%eax
801021ba: 89 44 24 04 mov %eax,0x4(%esp)
801021be: 8b 45 08 mov 0x8(%ebp),%eax
801021c1: 89 04 24 mov %eax,(%esp)
801021c4: e8 ba fb ff ff call 80101d83 <readi>
801021c9: 83 f8 10 cmp $0x10,%eax
801021cc: 74 0c je 801021da <dirlink+0x79>
panic("dirlink read");
801021ce: c7 04 24 23 85 10 80 movl $0x80108523,(%esp)
801021d5: e8 60 e3 ff ff call 8010053a <panic>
if(de.inum == 0)
801021da: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
801021de: 66 85 c0 test %ax,%ax
801021e1: 75 02 jne 801021e5 <dirlink+0x84>
break;
801021e3: eb 16 jmp 801021fb <dirlink+0x9a>
iput(ip);
return -1;
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
801021e5: 8b 45 f4 mov -0xc(%ebp),%eax
801021e8: 83 c0 10 add $0x10,%eax
801021eb: 89 45 f4 mov %eax,-0xc(%ebp)
801021ee: 8b 55 f4 mov -0xc(%ebp),%edx
801021f1: 8b 45 08 mov 0x8(%ebp),%eax
801021f4: 8b 40 18 mov 0x18(%eax),%eax
801021f7: 39 c2 cmp %eax,%edx
801021f9: 72 ad jb 801021a8 <dirlink+0x47>
panic("dirlink read");
if(de.inum == 0)
break;
}
strncpy(de.name, name, DIRSIZ);
801021fb: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80102202: 00
80102203: 8b 45 0c mov 0xc(%ebp),%eax
80102206: 89 44 24 04 mov %eax,0x4(%esp)
8010220a: 8d 45 e0 lea -0x20(%ebp),%eax
8010220d: 83 c0 02 add $0x2,%eax
80102210: 89 04 24 mov %eax,(%esp)
80102213: e8 f1 2f 00 00 call 80105209 <strncpy>
de.inum = inum;
80102218: 8b 45 10 mov 0x10(%ebp),%eax
8010221b: 66 89 45 e0 mov %ax,-0x20(%ebp)
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
8010221f: 8b 45 f4 mov -0xc(%ebp),%eax
80102222: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80102229: 00
8010222a: 89 44 24 08 mov %eax,0x8(%esp)
8010222e: 8d 45 e0 lea -0x20(%ebp),%eax
80102231: 89 44 24 04 mov %eax,0x4(%esp)
80102235: 8b 45 08 mov 0x8(%ebp),%eax
80102238: 89 04 24 mov %eax,(%esp)
8010223b: e8 a7 fc ff ff call 80101ee7 <writei>
80102240: 83 f8 10 cmp $0x10,%eax
80102243: 74 0c je 80102251 <dirlink+0xf0>
panic("dirlink");
80102245: c7 04 24 30 85 10 80 movl $0x80108530,(%esp)
8010224c: e8 e9 e2 ff ff call 8010053a <panic>
return 0;
80102251: b8 00 00 00 00 mov $0x0,%eax
}
80102256: c9 leave
80102257: c3 ret
80102258 <skipelem>:
// skipelem("a", name) = "", setting name = "a"
// skipelem("", name) = skipelem("////", name) = 0
//
static char*
skipelem(char *path, char *name)
{
80102258: 55 push %ebp
80102259: 89 e5 mov %esp,%ebp
8010225b: 83 ec 28 sub $0x28,%esp
char *s;
int len;
while(*path == '/')
8010225e: eb 04 jmp 80102264 <skipelem+0xc>
path++;
80102260: 83 45 08 01 addl $0x1,0x8(%ebp)
skipelem(char *path, char *name)
{
char *s;
int len;
while(*path == '/')
80102264: 8b 45 08 mov 0x8(%ebp),%eax
80102267: 0f b6 00 movzbl (%eax),%eax
8010226a: 3c 2f cmp $0x2f,%al
8010226c: 74 f2 je 80102260 <skipelem+0x8>
path++;
if(*path == 0)
8010226e: 8b 45 08 mov 0x8(%ebp),%eax
80102271: 0f b6 00 movzbl (%eax),%eax
80102274: 84 c0 test %al,%al
80102276: 75 0a jne 80102282 <skipelem+0x2a>
return 0;
80102278: b8 00 00 00 00 mov $0x0,%eax
8010227d: e9 86 00 00 00 jmp 80102308 <skipelem+0xb0>
s = path;
80102282: 8b 45 08 mov 0x8(%ebp),%eax
80102285: 89 45 f4 mov %eax,-0xc(%ebp)
while(*path != '/' && *path != 0)
80102288: eb 04 jmp 8010228e <skipelem+0x36>
path++;
8010228a: 83 45 08 01 addl $0x1,0x8(%ebp)
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
8010228e: 8b 45 08 mov 0x8(%ebp),%eax
80102291: 0f b6 00 movzbl (%eax),%eax
80102294: 3c 2f cmp $0x2f,%al
80102296: 74 0a je 801022a2 <skipelem+0x4a>
80102298: 8b 45 08 mov 0x8(%ebp),%eax
8010229b: 0f b6 00 movzbl (%eax),%eax
8010229e: 84 c0 test %al,%al
801022a0: 75 e8 jne 8010228a <skipelem+0x32>
path++;
len = path - s;
801022a2: 8b 55 08 mov 0x8(%ebp),%edx
801022a5: 8b 45 f4 mov -0xc(%ebp),%eax
801022a8: 29 c2 sub %eax,%edx
801022aa: 89 d0 mov %edx,%eax
801022ac: 89 45 f0 mov %eax,-0x10(%ebp)
if(len >= DIRSIZ)
801022af: 83 7d f0 0d cmpl $0xd,-0x10(%ebp)
801022b3: 7e 1c jle 801022d1 <skipelem+0x79>
memmove(name, s, DIRSIZ);
801022b5: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
801022bc: 00
801022bd: 8b 45 f4 mov -0xc(%ebp),%eax
801022c0: 89 44 24 04 mov %eax,0x4(%esp)
801022c4: 8b 45 0c mov 0xc(%ebp),%eax
801022c7: 89 04 24 mov %eax,(%esp)
801022ca: e8 41 2e 00 00 call 80105110 <memmove>
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
801022cf: eb 2a jmp 801022fb <skipelem+0xa3>
path++;
len = path - s;
if(len >= DIRSIZ)
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
801022d1: 8b 45 f0 mov -0x10(%ebp),%eax
801022d4: 89 44 24 08 mov %eax,0x8(%esp)
801022d8: 8b 45 f4 mov -0xc(%ebp),%eax
801022db: 89 44 24 04 mov %eax,0x4(%esp)
801022df: 8b 45 0c mov 0xc(%ebp),%eax
801022e2: 89 04 24 mov %eax,(%esp)
801022e5: e8 26 2e 00 00 call 80105110 <memmove>
name[len] = 0;
801022ea: 8b 55 f0 mov -0x10(%ebp),%edx
801022ed: 8b 45 0c mov 0xc(%ebp),%eax
801022f0: 01 d0 add %edx,%eax
801022f2: c6 00 00 movb $0x0,(%eax)
}
while(*path == '/')
801022f5: eb 04 jmp 801022fb <skipelem+0xa3>
path++;
801022f7: 83 45 08 01 addl $0x1,0x8(%ebp)
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
801022fb: 8b 45 08 mov 0x8(%ebp),%eax
801022fe: 0f b6 00 movzbl (%eax),%eax
80102301: 3c 2f cmp $0x2f,%al
80102303: 74 f2 je 801022f7 <skipelem+0x9f>
path++;
return path;
80102305: 8b 45 08 mov 0x8(%ebp),%eax
}
80102308: c9 leave
80102309: c3 ret
8010230a <namex>:
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
// Must be called inside a transaction since it calls iput().
static struct inode*
namex(char *path, int nameiparent, char *name)
{
8010230a: 55 push %ebp
8010230b: 89 e5 mov %esp,%ebp
8010230d: 83 ec 28 sub $0x28,%esp
struct inode *ip, *next;
if(*path == '/')
80102310: 8b 45 08 mov 0x8(%ebp),%eax
80102313: 0f b6 00 movzbl (%eax),%eax
80102316: 3c 2f cmp $0x2f,%al
80102318: 75 1c jne 80102336 <namex+0x2c>
ip = iget(ROOTDEV, ROOTINO);
8010231a: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80102321: 00
80102322: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80102329: e8 44 f4 ff ff call 80101772 <iget>
8010232e: 89 45 f4 mov %eax,-0xc(%ebp)
else
ip = idup(proc->cwd);
while((path = skipelem(path, name)) != 0){
80102331: e9 af 00 00 00 jmp 801023e5 <namex+0xdb>
struct inode *ip, *next;
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(proc->cwd);
80102336: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010233c: 8b 40 68 mov 0x68(%eax),%eax
8010233f: 89 04 24 mov %eax,(%esp)
80102342: e8 fd f4 ff ff call 80101844 <idup>
80102347: 89 45 f4 mov %eax,-0xc(%ebp)
while((path = skipelem(path, name)) != 0){
8010234a: e9 96 00 00 00 jmp 801023e5 <namex+0xdb>
ilock(ip);
8010234f: 8b 45 f4 mov -0xc(%ebp),%eax
80102352: 89 04 24 mov %eax,(%esp)
80102355: e8 1c f5 ff ff call 80101876 <ilock>
if(ip->type != T_DIR){
8010235a: 8b 45 f4 mov -0xc(%ebp),%eax
8010235d: 0f b7 40 10 movzwl 0x10(%eax),%eax
80102361: 66 83 f8 01 cmp $0x1,%ax
80102365: 74 15 je 8010237c <namex+0x72>
iunlockput(ip);
80102367: 8b 45 f4 mov -0xc(%ebp),%eax
8010236a: 89 04 24 mov %eax,(%esp)
8010236d: e8 88 f7 ff ff call 80101afa <iunlockput>
return 0;
80102372: b8 00 00 00 00 mov $0x0,%eax
80102377: e9 a3 00 00 00 jmp 8010241f <namex+0x115>
}
if(nameiparent && *path == '\0'){
8010237c: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80102380: 74 1d je 8010239f <namex+0x95>
80102382: 8b 45 08 mov 0x8(%ebp),%eax
80102385: 0f b6 00 movzbl (%eax),%eax
80102388: 84 c0 test %al,%al
8010238a: 75 13 jne 8010239f <namex+0x95>
// Stop one level early.
iunlock(ip);
8010238c: 8b 45 f4 mov -0xc(%ebp),%eax
8010238f: 89 04 24 mov %eax,(%esp)
80102392: e8 2d f6 ff ff call 801019c4 <iunlock>
return ip;
80102397: 8b 45 f4 mov -0xc(%ebp),%eax
8010239a: e9 80 00 00 00 jmp 8010241f <namex+0x115>
}
if((next = dirlookup(ip, name, 0)) == 0){
8010239f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
801023a6: 00
801023a7: 8b 45 10 mov 0x10(%ebp),%eax
801023aa: 89 44 24 04 mov %eax,0x4(%esp)
801023ae: 8b 45 f4 mov -0xc(%ebp),%eax
801023b1: 89 04 24 mov %eax,(%esp)
801023b4: e8 df fc ff ff call 80102098 <dirlookup>
801023b9: 89 45 f0 mov %eax,-0x10(%ebp)
801023bc: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801023c0: 75 12 jne 801023d4 <namex+0xca>
iunlockput(ip);
801023c2: 8b 45 f4 mov -0xc(%ebp),%eax
801023c5: 89 04 24 mov %eax,(%esp)
801023c8: e8 2d f7 ff ff call 80101afa <iunlockput>
return 0;
801023cd: b8 00 00 00 00 mov $0x0,%eax
801023d2: eb 4b jmp 8010241f <namex+0x115>
}
iunlockput(ip);
801023d4: 8b 45 f4 mov -0xc(%ebp),%eax
801023d7: 89 04 24 mov %eax,(%esp)
801023da: e8 1b f7 ff ff call 80101afa <iunlockput>
ip = next;
801023df: 8b 45 f0 mov -0x10(%ebp),%eax
801023e2: 89 45 f4 mov %eax,-0xc(%ebp)
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(proc->cwd);
while((path = skipelem(path, name)) != 0){
801023e5: 8b 45 10 mov 0x10(%ebp),%eax
801023e8: 89 44 24 04 mov %eax,0x4(%esp)
801023ec: 8b 45 08 mov 0x8(%ebp),%eax
801023ef: 89 04 24 mov %eax,(%esp)
801023f2: e8 61 fe ff ff call 80102258 <skipelem>
801023f7: 89 45 08 mov %eax,0x8(%ebp)
801023fa: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801023fe: 0f 85 4b ff ff ff jne 8010234f <namex+0x45>
return 0;
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
80102404: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80102408: 74 12 je 8010241c <namex+0x112>
iput(ip);
8010240a: 8b 45 f4 mov -0xc(%ebp),%eax
8010240d: 89 04 24 mov %eax,(%esp)
80102410: e8 14 f6 ff ff call 80101a29 <iput>
return 0;
80102415: b8 00 00 00 00 mov $0x0,%eax
8010241a: eb 03 jmp 8010241f <namex+0x115>
}
return ip;
8010241c: 8b 45 f4 mov -0xc(%ebp),%eax
}
8010241f: c9 leave
80102420: c3 ret
80102421 <namei>:
struct inode*
namei(char *path)
{
80102421: 55 push %ebp
80102422: 89 e5 mov %esp,%ebp
80102424: 83 ec 28 sub $0x28,%esp
char name[DIRSIZ];
return namex(path, 0, name);
80102427: 8d 45 ea lea -0x16(%ebp),%eax
8010242a: 89 44 24 08 mov %eax,0x8(%esp)
8010242e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102435: 00
80102436: 8b 45 08 mov 0x8(%ebp),%eax
80102439: 89 04 24 mov %eax,(%esp)
8010243c: e8 c9 fe ff ff call 8010230a <namex>
}
80102441: c9 leave
80102442: c3 ret
80102443 <nameiparent>:
struct inode*
nameiparent(char *path, char *name)
{
80102443: 55 push %ebp
80102444: 89 e5 mov %esp,%ebp
80102446: 83 ec 18 sub $0x18,%esp
return namex(path, 1, name);
80102449: 8b 45 0c mov 0xc(%ebp),%eax
8010244c: 89 44 24 08 mov %eax,0x8(%esp)
80102450: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80102457: 00
80102458: 8b 45 08 mov 0x8(%ebp),%eax
8010245b: 89 04 24 mov %eax,(%esp)
8010245e: e8 a7 fe ff ff call 8010230a <namex>
}
80102463: c9 leave
80102464: c3 ret
80102465 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80102465: 55 push %ebp
80102466: 89 e5 mov %esp,%ebp
80102468: 83 ec 14 sub $0x14,%esp
8010246b: 8b 45 08 mov 0x8(%ebp),%eax
8010246e: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102472: 0f b7 45 ec movzwl -0x14(%ebp),%eax
80102476: 89 c2 mov %eax,%edx
80102478: ec in (%dx),%al
80102479: 88 45 ff mov %al,-0x1(%ebp)
return data;
8010247c: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
80102480: c9 leave
80102481: c3 ret
80102482 <insl>:
static inline void
insl(int port, void *addr, int cnt)
{
80102482: 55 push %ebp
80102483: 89 e5 mov %esp,%ebp
80102485: 57 push %edi
80102486: 53 push %ebx
asm volatile("cld; rep insl" :
80102487: 8b 55 08 mov 0x8(%ebp),%edx
8010248a: 8b 4d 0c mov 0xc(%ebp),%ecx
8010248d: 8b 45 10 mov 0x10(%ebp),%eax
80102490: 89 cb mov %ecx,%ebx
80102492: 89 df mov %ebx,%edi
80102494: 89 c1 mov %eax,%ecx
80102496: fc cld
80102497: f3 6d rep insl (%dx),%es:(%edi)
80102499: 89 c8 mov %ecx,%eax
8010249b: 89 fb mov %edi,%ebx
8010249d: 89 5d 0c mov %ebx,0xc(%ebp)
801024a0: 89 45 10 mov %eax,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"d" (port), "0" (addr), "1" (cnt) :
"memory", "cc");
}
801024a3: 5b pop %ebx
801024a4: 5f pop %edi
801024a5: 5d pop %ebp
801024a6: c3 ret
801024a7 <outb>:
static inline void
outb(ushort port, uchar data)
{
801024a7: 55 push %ebp
801024a8: 89 e5 mov %esp,%ebp
801024aa: 83 ec 08 sub $0x8,%esp
801024ad: 8b 55 08 mov 0x8(%ebp),%edx
801024b0: 8b 45 0c mov 0xc(%ebp),%eax
801024b3: 66 89 55 fc mov %dx,-0x4(%ebp)
801024b7: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801024ba: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
801024be: 0f b7 55 fc movzwl -0x4(%ebp),%edx
801024c2: ee out %al,(%dx)
}
801024c3: c9 leave
801024c4: c3 ret
801024c5 <outsl>:
asm volatile("out %0,%1" : : "a" (data), "d" (port));
}
static inline void
outsl(int port, const void *addr, int cnt)
{
801024c5: 55 push %ebp
801024c6: 89 e5 mov %esp,%ebp
801024c8: 56 push %esi
801024c9: 53 push %ebx
asm volatile("cld; rep outsl" :
801024ca: 8b 55 08 mov 0x8(%ebp),%edx
801024cd: 8b 4d 0c mov 0xc(%ebp),%ecx
801024d0: 8b 45 10 mov 0x10(%ebp),%eax
801024d3: 89 cb mov %ecx,%ebx
801024d5: 89 de mov %ebx,%esi
801024d7: 89 c1 mov %eax,%ecx
801024d9: fc cld
801024da: f3 6f rep outsl %ds:(%esi),(%dx)
801024dc: 89 c8 mov %ecx,%eax
801024de: 89 f3 mov %esi,%ebx
801024e0: 89 5d 0c mov %ebx,0xc(%ebp)
801024e3: 89 45 10 mov %eax,0x10(%ebp)
"=S" (addr), "=c" (cnt) :
"d" (port), "0" (addr), "1" (cnt) :
"cc");
}
801024e6: 5b pop %ebx
801024e7: 5e pop %esi
801024e8: 5d pop %ebp
801024e9: c3 ret
801024ea <idewait>:
static void idestart(struct buf*);
// Wait for IDE disk to become ready.
static int
idewait(int checkerr)
{
801024ea: 55 push %ebp
801024eb: 89 e5 mov %esp,%ebp
801024ed: 83 ec 14 sub $0x14,%esp
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
801024f0: 90 nop
801024f1: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
801024f8: e8 68 ff ff ff call 80102465 <inb>
801024fd: 0f b6 c0 movzbl %al,%eax
80102500: 89 45 fc mov %eax,-0x4(%ebp)
80102503: 8b 45 fc mov -0x4(%ebp),%eax
80102506: 25 c0 00 00 00 and $0xc0,%eax
8010250b: 83 f8 40 cmp $0x40,%eax
8010250e: 75 e1 jne 801024f1 <idewait+0x7>
;
if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
80102510: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80102514: 74 11 je 80102527 <idewait+0x3d>
80102516: 8b 45 fc mov -0x4(%ebp),%eax
80102519: 83 e0 21 and $0x21,%eax
8010251c: 85 c0 test %eax,%eax
8010251e: 74 07 je 80102527 <idewait+0x3d>
return -1;
80102520: b8 ff ff ff ff mov $0xffffffff,%eax
80102525: eb 05 jmp 8010252c <idewait+0x42>
return 0;
80102527: b8 00 00 00 00 mov $0x0,%eax
}
8010252c: c9 leave
8010252d: c3 ret
8010252e <ideinit>:
void
ideinit(void)
{
8010252e: 55 push %ebp
8010252f: 89 e5 mov %esp,%ebp
80102531: 83 ec 28 sub $0x28,%esp
int i;
initlock(&idelock, "ide");
80102534: c7 44 24 04 38 85 10 movl $0x80108538,0x4(%esp)
8010253b: 80
8010253c: c7 04 24 60 b6 10 80 movl $0x8010b660,(%esp)
80102543: e8 84 28 00 00 call 80104dcc <initlock>
picenable(IRQ_IDE);
80102548: c7 04 24 0e 00 00 00 movl $0xe,(%esp)
8010254f: e8 63 18 00 00 call 80103db7 <picenable>
ioapicenable(IRQ_IDE, ncpu - 1);
80102554: a1 a0 29 11 80 mov 0x801129a0,%eax
80102559: 83 e8 01 sub $0x1,%eax
8010255c: 89 44 24 04 mov %eax,0x4(%esp)
80102560: c7 04 24 0e 00 00 00 movl $0xe,(%esp)
80102567: e8 0c 04 00 00 call 80102978 <ioapicenable>
idewait(0);
8010256c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80102573: e8 72 ff ff ff call 801024ea <idewait>
// Check if disk 1 is present
outb(0x1f6, 0xe0 | (1<<4));
80102578: c7 44 24 04 f0 00 00 movl $0xf0,0x4(%esp)
8010257f: 00
80102580: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp)
80102587: e8 1b ff ff ff call 801024a7 <outb>
for(i=0; i<1000; i++){
8010258c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80102593: eb 20 jmp 801025b5 <ideinit+0x87>
if(inb(0x1f7) != 0){
80102595: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
8010259c: e8 c4 fe ff ff call 80102465 <inb>
801025a1: 84 c0 test %al,%al
801025a3: 74 0c je 801025b1 <ideinit+0x83>
havedisk1 = 1;
801025a5: c7 05 98 b6 10 80 01 movl $0x1,0x8010b698
801025ac: 00 00 00
break;
801025af: eb 0d jmp 801025be <ideinit+0x90>
ioapicenable(IRQ_IDE, ncpu - 1);
idewait(0);
// Check if disk 1 is present
outb(0x1f6, 0xe0 | (1<<4));
for(i=0; i<1000; i++){
801025b1: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801025b5: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp)
801025bc: 7e d7 jle 80102595 <ideinit+0x67>
break;
}
}
// Switch back to disk 0.
outb(0x1f6, 0xe0 | (0<<4));
801025be: c7 44 24 04 e0 00 00 movl $0xe0,0x4(%esp)
801025c5: 00
801025c6: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp)
801025cd: e8 d5 fe ff ff call 801024a7 <outb>
}
801025d2: c9 leave
801025d3: c3 ret
801025d4 <idestart>:
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
801025d4: 55 push %ebp
801025d5: 89 e5 mov %esp,%ebp
801025d7: 83 ec 18 sub $0x18,%esp
if(b == 0)
801025da: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801025de: 75 0c jne 801025ec <idestart+0x18>
panic("idestart");
801025e0: c7 04 24 3c 85 10 80 movl $0x8010853c,(%esp)
801025e7: e8 4e df ff ff call 8010053a <panic>
idewait(0);
801025ec: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801025f3: e8 f2 fe ff ff call 801024ea <idewait>
outb(0x3f6, 0); // generate interrupt
801025f8: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801025ff: 00
80102600: c7 04 24 f6 03 00 00 movl $0x3f6,(%esp)
80102607: e8 9b fe ff ff call 801024a7 <outb>
outb(0x1f2, 1); // number of sectors
8010260c: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80102613: 00
80102614: c7 04 24 f2 01 00 00 movl $0x1f2,(%esp)
8010261b: e8 87 fe ff ff call 801024a7 <outb>
outb(0x1f3, b->sector & 0xff);
80102620: 8b 45 08 mov 0x8(%ebp),%eax
80102623: 8b 40 08 mov 0x8(%eax),%eax
80102626: 0f b6 c0 movzbl %al,%eax
80102629: 89 44 24 04 mov %eax,0x4(%esp)
8010262d: c7 04 24 f3 01 00 00 movl $0x1f3,(%esp)
80102634: e8 6e fe ff ff call 801024a7 <outb>
outb(0x1f4, (b->sector >> 8) & 0xff);
80102639: 8b 45 08 mov 0x8(%ebp),%eax
8010263c: 8b 40 08 mov 0x8(%eax),%eax
8010263f: c1 e8 08 shr $0x8,%eax
80102642: 0f b6 c0 movzbl %al,%eax
80102645: 89 44 24 04 mov %eax,0x4(%esp)
80102649: c7 04 24 f4 01 00 00 movl $0x1f4,(%esp)
80102650: e8 52 fe ff ff call 801024a7 <outb>
outb(0x1f5, (b->sector >> 16) & 0xff);
80102655: 8b 45 08 mov 0x8(%ebp),%eax
80102658: 8b 40 08 mov 0x8(%eax),%eax
8010265b: c1 e8 10 shr $0x10,%eax
8010265e: 0f b6 c0 movzbl %al,%eax
80102661: 89 44 24 04 mov %eax,0x4(%esp)
80102665: c7 04 24 f5 01 00 00 movl $0x1f5,(%esp)
8010266c: e8 36 fe ff ff call 801024a7 <outb>
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((b->sector>>24)&0x0f));
80102671: 8b 45 08 mov 0x8(%ebp),%eax
80102674: 8b 40 04 mov 0x4(%eax),%eax
80102677: 83 e0 01 and $0x1,%eax
8010267a: c1 e0 04 shl $0x4,%eax
8010267d: 89 c2 mov %eax,%edx
8010267f: 8b 45 08 mov 0x8(%ebp),%eax
80102682: 8b 40 08 mov 0x8(%eax),%eax
80102685: c1 e8 18 shr $0x18,%eax
80102688: 83 e0 0f and $0xf,%eax
8010268b: 09 d0 or %edx,%eax
8010268d: 83 c8 e0 or $0xffffffe0,%eax
80102690: 0f b6 c0 movzbl %al,%eax
80102693: 89 44 24 04 mov %eax,0x4(%esp)
80102697: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp)
8010269e: e8 04 fe ff ff call 801024a7 <outb>
if(b->flags & B_DIRTY){
801026a3: 8b 45 08 mov 0x8(%ebp),%eax
801026a6: 8b 00 mov (%eax),%eax
801026a8: 83 e0 04 and $0x4,%eax
801026ab: 85 c0 test %eax,%eax
801026ad: 74 34 je 801026e3 <idestart+0x10f>
outb(0x1f7, IDE_CMD_WRITE);
801026af: c7 44 24 04 30 00 00 movl $0x30,0x4(%esp)
801026b6: 00
801026b7: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
801026be: e8 e4 fd ff ff call 801024a7 <outb>
outsl(0x1f0, b->data, 512/4);
801026c3: 8b 45 08 mov 0x8(%ebp),%eax
801026c6: 83 c0 18 add $0x18,%eax
801026c9: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp)
801026d0: 00
801026d1: 89 44 24 04 mov %eax,0x4(%esp)
801026d5: c7 04 24 f0 01 00 00 movl $0x1f0,(%esp)
801026dc: e8 e4 fd ff ff call 801024c5 <outsl>
801026e1: eb 14 jmp 801026f7 <idestart+0x123>
} else {
outb(0x1f7, IDE_CMD_READ);
801026e3: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp)
801026ea: 00
801026eb: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
801026f2: e8 b0 fd ff ff call 801024a7 <outb>
}
}
801026f7: c9 leave
801026f8: c3 ret
801026f9 <ideintr>:
// Interrupt handler.
void
ideintr(void)
{
801026f9: 55 push %ebp
801026fa: 89 e5 mov %esp,%ebp
801026fc: 83 ec 28 sub $0x28,%esp
struct buf *b;
// First queued buffer is the active request.
acquire(&idelock);
801026ff: c7 04 24 60 b6 10 80 movl $0x8010b660,(%esp)
80102706: e8 e2 26 00 00 call 80104ded <acquire>
if((b = idequeue) == 0){
8010270b: a1 94 b6 10 80 mov 0x8010b694,%eax
80102710: 89 45 f4 mov %eax,-0xc(%ebp)
80102713: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80102717: 75 11 jne 8010272a <ideintr+0x31>
release(&idelock);
80102719: c7 04 24 60 b6 10 80 movl $0x8010b660,(%esp)
80102720: e8 2a 27 00 00 call 80104e4f <release>
// cprintf("spurious IDE interrupt\n");
return;
80102725: e9 90 00 00 00 jmp 801027ba <ideintr+0xc1>
}
idequeue = b->qnext;
8010272a: 8b 45 f4 mov -0xc(%ebp),%eax
8010272d: 8b 40 14 mov 0x14(%eax),%eax
80102730: a3 94 b6 10 80 mov %eax,0x8010b694
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
80102735: 8b 45 f4 mov -0xc(%ebp),%eax
80102738: 8b 00 mov (%eax),%eax
8010273a: 83 e0 04 and $0x4,%eax
8010273d: 85 c0 test %eax,%eax
8010273f: 75 2e jne 8010276f <ideintr+0x76>
80102741: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80102748: e8 9d fd ff ff call 801024ea <idewait>
8010274d: 85 c0 test %eax,%eax
8010274f: 78 1e js 8010276f <ideintr+0x76>
insl(0x1f0, b->data, 512/4);
80102751: 8b 45 f4 mov -0xc(%ebp),%eax
80102754: 83 c0 18 add $0x18,%eax
80102757: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp)
8010275e: 00
8010275f: 89 44 24 04 mov %eax,0x4(%esp)
80102763: c7 04 24 f0 01 00 00 movl $0x1f0,(%esp)
8010276a: e8 13 fd ff ff call 80102482 <insl>
// Wake process waiting for this buf.
b->flags |= B_VALID;
8010276f: 8b 45 f4 mov -0xc(%ebp),%eax
80102772: 8b 00 mov (%eax),%eax
80102774: 83 c8 02 or $0x2,%eax
80102777: 89 c2 mov %eax,%edx
80102779: 8b 45 f4 mov -0xc(%ebp),%eax
8010277c: 89 10 mov %edx,(%eax)
b->flags &= ~B_DIRTY;
8010277e: 8b 45 f4 mov -0xc(%ebp),%eax
80102781: 8b 00 mov (%eax),%eax
80102783: 83 e0 fb and $0xfffffffb,%eax
80102786: 89 c2 mov %eax,%edx
80102788: 8b 45 f4 mov -0xc(%ebp),%eax
8010278b: 89 10 mov %edx,(%eax)
wakeup(b);
8010278d: 8b 45 f4 mov -0xc(%ebp),%eax
80102790: 89 04 24 mov %eax,(%esp)
80102793: e8 64 24 00 00 call 80104bfc <wakeup>
// Start disk on next buf in queue.
if(idequeue != 0)
80102798: a1 94 b6 10 80 mov 0x8010b694,%eax
8010279d: 85 c0 test %eax,%eax
8010279f: 74 0d je 801027ae <ideintr+0xb5>
idestart(idequeue);
801027a1: a1 94 b6 10 80 mov 0x8010b694,%eax
801027a6: 89 04 24 mov %eax,(%esp)
801027a9: e8 26 fe ff ff call 801025d4 <idestart>
release(&idelock);
801027ae: c7 04 24 60 b6 10 80 movl $0x8010b660,(%esp)
801027b5: e8 95 26 00 00 call 80104e4f <release>
}
801027ba: c9 leave
801027bb: c3 ret
801027bc <iderw>:
// Sync buf with disk.
// If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
// Else if B_VALID is not set, read buf from disk, set B_VALID.
void
iderw(struct buf *b)
{
801027bc: 55 push %ebp
801027bd: 89 e5 mov %esp,%ebp
801027bf: 83 ec 28 sub $0x28,%esp
struct buf **pp;
if(!(b->flags & B_BUSY))
801027c2: 8b 45 08 mov 0x8(%ebp),%eax
801027c5: 8b 00 mov (%eax),%eax
801027c7: 83 e0 01 and $0x1,%eax
801027ca: 85 c0 test %eax,%eax
801027cc: 75 0c jne 801027da <iderw+0x1e>
panic("iderw: buf not busy");
801027ce: c7 04 24 45 85 10 80 movl $0x80108545,(%esp)
801027d5: e8 60 dd ff ff call 8010053a <panic>
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
801027da: 8b 45 08 mov 0x8(%ebp),%eax
801027dd: 8b 00 mov (%eax),%eax
801027df: 83 e0 06 and $0x6,%eax
801027e2: 83 f8 02 cmp $0x2,%eax
801027e5: 75 0c jne 801027f3 <iderw+0x37>
panic("iderw: nothing to do");
801027e7: c7 04 24 59 85 10 80 movl $0x80108559,(%esp)
801027ee: e8 47 dd ff ff call 8010053a <panic>
if(b->dev != 0 && !havedisk1)
801027f3: 8b 45 08 mov 0x8(%ebp),%eax
801027f6: 8b 40 04 mov 0x4(%eax),%eax
801027f9: 85 c0 test %eax,%eax
801027fb: 74 15 je 80102812 <iderw+0x56>
801027fd: a1 98 b6 10 80 mov 0x8010b698,%eax
80102802: 85 c0 test %eax,%eax
80102804: 75 0c jne 80102812 <iderw+0x56>
panic("iderw: ide disk 1 not present");
80102806: c7 04 24 6e 85 10 80 movl $0x8010856e,(%esp)
8010280d: e8 28 dd ff ff call 8010053a <panic>
acquire(&idelock); //DOC:acquire-lock
80102812: c7 04 24 60 b6 10 80 movl $0x8010b660,(%esp)
80102819: e8 cf 25 00 00 call 80104ded <acquire>
// Append b to idequeue.
b->qnext = 0;
8010281e: 8b 45 08 mov 0x8(%ebp),%eax
80102821: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
80102828: c7 45 f4 94 b6 10 80 movl $0x8010b694,-0xc(%ebp)
8010282f: eb 0b jmp 8010283c <iderw+0x80>
80102831: 8b 45 f4 mov -0xc(%ebp),%eax
80102834: 8b 00 mov (%eax),%eax
80102836: 83 c0 14 add $0x14,%eax
80102839: 89 45 f4 mov %eax,-0xc(%ebp)
8010283c: 8b 45 f4 mov -0xc(%ebp),%eax
8010283f: 8b 00 mov (%eax),%eax
80102841: 85 c0 test %eax,%eax
80102843: 75 ec jne 80102831 <iderw+0x75>
;
*pp = b;
80102845: 8b 45 f4 mov -0xc(%ebp),%eax
80102848: 8b 55 08 mov 0x8(%ebp),%edx
8010284b: 89 10 mov %edx,(%eax)
// Start disk if necessary.
if(idequeue == b)
8010284d: a1 94 b6 10 80 mov 0x8010b694,%eax
80102852: 3b 45 08 cmp 0x8(%ebp),%eax
80102855: 75 0d jne 80102864 <iderw+0xa8>
idestart(b);
80102857: 8b 45 08 mov 0x8(%ebp),%eax
8010285a: 89 04 24 mov %eax,(%esp)
8010285d: e8 72 fd ff ff call 801025d4 <idestart>
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
80102862: eb 15 jmp 80102879 <iderw+0xbd>
80102864: eb 13 jmp 80102879 <iderw+0xbd>
sleep(b, &idelock);
80102866: c7 44 24 04 60 b6 10 movl $0x8010b660,0x4(%esp)
8010286d: 80
8010286e: 8b 45 08 mov 0x8(%ebp),%eax
80102871: 89 04 24 mov %eax,(%esp)
80102874: e8 aa 22 00 00 call 80104b23 <sleep>
// Start disk if necessary.
if(idequeue == b)
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
80102879: 8b 45 08 mov 0x8(%ebp),%eax
8010287c: 8b 00 mov (%eax),%eax
8010287e: 83 e0 06 and $0x6,%eax
80102881: 83 f8 02 cmp $0x2,%eax
80102884: 75 e0 jne 80102866 <iderw+0xaa>
sleep(b, &idelock);
}
release(&idelock);
80102886: c7 04 24 60 b6 10 80 movl $0x8010b660,(%esp)
8010288d: e8 bd 25 00 00 call 80104e4f <release>
}
80102892: c9 leave
80102893: c3 ret
80102894 <ioapicread>:
uint data;
};
static uint
ioapicread(int reg)
{
80102894: 55 push %ebp
80102895: 89 e5 mov %esp,%ebp
ioapic->reg = reg;
80102897: a1 74 22 11 80 mov 0x80112274,%eax
8010289c: 8b 55 08 mov 0x8(%ebp),%edx
8010289f: 89 10 mov %edx,(%eax)
return ioapic->data;
801028a1: a1 74 22 11 80 mov 0x80112274,%eax
801028a6: 8b 40 10 mov 0x10(%eax),%eax
}
801028a9: 5d pop %ebp
801028aa: c3 ret
801028ab <ioapicwrite>:
static void
ioapicwrite(int reg, uint data)
{
801028ab: 55 push %ebp
801028ac: 89 e5 mov %esp,%ebp
ioapic->reg = reg;
801028ae: a1 74 22 11 80 mov 0x80112274,%eax
801028b3: 8b 55 08 mov 0x8(%ebp),%edx
801028b6: 89 10 mov %edx,(%eax)
ioapic->data = data;
801028b8: a1 74 22 11 80 mov 0x80112274,%eax
801028bd: 8b 55 0c mov 0xc(%ebp),%edx
801028c0: 89 50 10 mov %edx,0x10(%eax)
}
801028c3: 5d pop %ebp
801028c4: c3 ret
801028c5 <ioapicinit>:
void
ioapicinit(void)
{
801028c5: 55 push %ebp
801028c6: 89 e5 mov %esp,%ebp
801028c8: 83 ec 28 sub $0x28,%esp
int i, id, maxintr;
if(!ismp)
801028cb: a1 a4 23 11 80 mov 0x801123a4,%eax
801028d0: 85 c0 test %eax,%eax
801028d2: 75 05 jne 801028d9 <ioapicinit+0x14>
return;
801028d4: e9 9d 00 00 00 jmp 80102976 <ioapicinit+0xb1>
ioapic = (volatile struct ioapic*)IOAPIC;
801028d9: c7 05 74 22 11 80 00 movl $0xfec00000,0x80112274
801028e0: 00 c0 fe
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
801028e3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801028ea: e8 a5 ff ff ff call 80102894 <ioapicread>
801028ef: c1 e8 10 shr $0x10,%eax
801028f2: 25 ff 00 00 00 and $0xff,%eax
801028f7: 89 45 f0 mov %eax,-0x10(%ebp)
id = ioapicread(REG_ID) >> 24;
801028fa: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80102901: e8 8e ff ff ff call 80102894 <ioapicread>
80102906: c1 e8 18 shr $0x18,%eax
80102909: 89 45 ec mov %eax,-0x14(%ebp)
if(id != ioapicid)
8010290c: 0f b6 05 a0 23 11 80 movzbl 0x801123a0,%eax
80102913: 0f b6 c0 movzbl %al,%eax
80102916: 3b 45 ec cmp -0x14(%ebp),%eax
80102919: 74 0c je 80102927 <ioapicinit+0x62>
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
8010291b: c7 04 24 8c 85 10 80 movl $0x8010858c,(%esp)
80102922: e8 79 da ff ff call 801003a0 <cprintf>
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
80102927: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010292e: eb 3e jmp 8010296e <ioapicinit+0xa9>
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
80102930: 8b 45 f4 mov -0xc(%ebp),%eax
80102933: 83 c0 20 add $0x20,%eax
80102936: 0d 00 00 01 00 or $0x10000,%eax
8010293b: 8b 55 f4 mov -0xc(%ebp),%edx
8010293e: 83 c2 08 add $0x8,%edx
80102941: 01 d2 add %edx,%edx
80102943: 89 44 24 04 mov %eax,0x4(%esp)
80102947: 89 14 24 mov %edx,(%esp)
8010294a: e8 5c ff ff ff call 801028ab <ioapicwrite>
ioapicwrite(REG_TABLE+2*i+1, 0);
8010294f: 8b 45 f4 mov -0xc(%ebp),%eax
80102952: 83 c0 08 add $0x8,%eax
80102955: 01 c0 add %eax,%eax
80102957: 83 c0 01 add $0x1,%eax
8010295a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102961: 00
80102962: 89 04 24 mov %eax,(%esp)
80102965: e8 41 ff ff ff call 801028ab <ioapicwrite>
if(id != ioapicid)
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
8010296a: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010296e: 8b 45 f4 mov -0xc(%ebp),%eax
80102971: 3b 45 f0 cmp -0x10(%ebp),%eax
80102974: 7e ba jle 80102930 <ioapicinit+0x6b>
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
ioapicwrite(REG_TABLE+2*i+1, 0);
}
}
80102976: c9 leave
80102977: c3 ret
80102978 <ioapicenable>:
void
ioapicenable(int irq, int cpunum)
{
80102978: 55 push %ebp
80102979: 89 e5 mov %esp,%ebp
8010297b: 83 ec 08 sub $0x8,%esp
if(!ismp)
8010297e: a1 a4 23 11 80 mov 0x801123a4,%eax
80102983: 85 c0 test %eax,%eax
80102985: 75 02 jne 80102989 <ioapicenable+0x11>
return;
80102987: eb 37 jmp 801029c0 <ioapicenable+0x48>
// 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);
80102989: 8b 45 08 mov 0x8(%ebp),%eax
8010298c: 83 c0 20 add $0x20,%eax
8010298f: 8b 55 08 mov 0x8(%ebp),%edx
80102992: 83 c2 08 add $0x8,%edx
80102995: 01 d2 add %edx,%edx
80102997: 89 44 24 04 mov %eax,0x4(%esp)
8010299b: 89 14 24 mov %edx,(%esp)
8010299e: e8 08 ff ff ff call 801028ab <ioapicwrite>
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
801029a3: 8b 45 0c mov 0xc(%ebp),%eax
801029a6: c1 e0 18 shl $0x18,%eax
801029a9: 8b 55 08 mov 0x8(%ebp),%edx
801029ac: 83 c2 08 add $0x8,%edx
801029af: 01 d2 add %edx,%edx
801029b1: 83 c2 01 add $0x1,%edx
801029b4: 89 44 24 04 mov %eax,0x4(%esp)
801029b8: 89 14 24 mov %edx,(%esp)
801029bb: e8 eb fe ff ff call 801028ab <ioapicwrite>
}
801029c0: c9 leave
801029c1: c3 ret
801029c2 <v2p>:
#define KERNBASE 0x80000000 // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
#ifndef __ASSEMBLER__
static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; }
801029c2: 55 push %ebp
801029c3: 89 e5 mov %esp,%ebp
801029c5: 8b 45 08 mov 0x8(%ebp),%eax
801029c8: 05 00 00 00 80 add $0x80000000,%eax
801029cd: 5d pop %ebp
801029ce: c3 ret
801029cf <kinit1>:
// the pages mapped by entrypgdir on free list.
// 2. main() calls kinit2() with the rest of the physical pages
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
801029cf: 55 push %ebp
801029d0: 89 e5 mov %esp,%ebp
801029d2: 83 ec 18 sub $0x18,%esp
initlock(&kmem.lock, "kmem");
801029d5: c7 44 24 04 be 85 10 movl $0x801085be,0x4(%esp)
801029dc: 80
801029dd: c7 04 24 80 22 11 80 movl $0x80112280,(%esp)
801029e4: e8 e3 23 00 00 call 80104dcc <initlock>
kmem.use_lock = 0;
801029e9: c7 05 b4 22 11 80 00 movl $0x0,0x801122b4
801029f0: 00 00 00
freerange(vstart, vend);
801029f3: 8b 45 0c mov 0xc(%ebp),%eax
801029f6: 89 44 24 04 mov %eax,0x4(%esp)
801029fa: 8b 45 08 mov 0x8(%ebp),%eax
801029fd: 89 04 24 mov %eax,(%esp)
80102a00: e8 26 00 00 00 call 80102a2b <freerange>
}
80102a05: c9 leave
80102a06: c3 ret
80102a07 <kinit2>:
void
kinit2(void *vstart, void *vend)
{
80102a07: 55 push %ebp
80102a08: 89 e5 mov %esp,%ebp
80102a0a: 83 ec 18 sub $0x18,%esp
freerange(vstart, vend);
80102a0d: 8b 45 0c mov 0xc(%ebp),%eax
80102a10: 89 44 24 04 mov %eax,0x4(%esp)
80102a14: 8b 45 08 mov 0x8(%ebp),%eax
80102a17: 89 04 24 mov %eax,(%esp)
80102a1a: e8 0c 00 00 00 call 80102a2b <freerange>
kmem.use_lock = 1;
80102a1f: c7 05 b4 22 11 80 01 movl $0x1,0x801122b4
80102a26: 00 00 00
}
80102a29: c9 leave
80102a2a: c3 ret
80102a2b <freerange>:
void
freerange(void *vstart, void *vend)
{
80102a2b: 55 push %ebp
80102a2c: 89 e5 mov %esp,%ebp
80102a2e: 83 ec 28 sub $0x28,%esp
char *p;
p = (char*)PGROUNDUP((uint)vstart);
80102a31: 8b 45 08 mov 0x8(%ebp),%eax
80102a34: 05 ff 0f 00 00 add $0xfff,%eax
80102a39: 25 00 f0 ff ff and $0xfffff000,%eax
80102a3e: 89 45 f4 mov %eax,-0xc(%ebp)
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102a41: eb 12 jmp 80102a55 <freerange+0x2a>
kfree(p);
80102a43: 8b 45 f4 mov -0xc(%ebp),%eax
80102a46: 89 04 24 mov %eax,(%esp)
80102a49: e8 16 00 00 00 call 80102a64 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102a4e: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80102a55: 8b 45 f4 mov -0xc(%ebp),%eax
80102a58: 05 00 10 00 00 add $0x1000,%eax
80102a5d: 3b 45 0c cmp 0xc(%ebp),%eax
80102a60: 76 e1 jbe 80102a43 <freerange+0x18>
kfree(p);
}
80102a62: c9 leave
80102a63: c3 ret
80102a64 <kfree>:
// which normally should have been returned by a
// call to kalloc(). (The exception is when
// initializing the allocator; see kinit above.)
void
kfree(char *v)
{
80102a64: 55 push %ebp
80102a65: 89 e5 mov %esp,%ebp
80102a67: 83 ec 28 sub $0x28,%esp
struct run *r;
if((uint)v % PGSIZE || v < end || v2p(v) >= PHYSTOP)
80102a6a: 8b 45 08 mov 0x8(%ebp),%eax
80102a6d: 25 ff 0f 00 00 and $0xfff,%eax
80102a72: 85 c0 test %eax,%eax
80102a74: 75 1b jne 80102a91 <kfree+0x2d>
80102a76: 81 7d 08 9c 51 11 80 cmpl $0x8011519c,0x8(%ebp)
80102a7d: 72 12 jb 80102a91 <kfree+0x2d>
80102a7f: 8b 45 08 mov 0x8(%ebp),%eax
80102a82: 89 04 24 mov %eax,(%esp)
80102a85: e8 38 ff ff ff call 801029c2 <v2p>
80102a8a: 3d ff ff ff 0d cmp $0xdffffff,%eax
80102a8f: 76 0c jbe 80102a9d <kfree+0x39>
panic("kfree");
80102a91: c7 04 24 c3 85 10 80 movl $0x801085c3,(%esp)
80102a98: e8 9d da ff ff call 8010053a <panic>
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
80102a9d: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80102aa4: 00
80102aa5: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80102aac: 00
80102aad: 8b 45 08 mov 0x8(%ebp),%eax
80102ab0: 89 04 24 mov %eax,(%esp)
80102ab3: e8 89 25 00 00 call 80105041 <memset>
if(kmem.use_lock)
80102ab8: a1 b4 22 11 80 mov 0x801122b4,%eax
80102abd: 85 c0 test %eax,%eax
80102abf: 74 0c je 80102acd <kfree+0x69>
acquire(&kmem.lock);
80102ac1: c7 04 24 80 22 11 80 movl $0x80112280,(%esp)
80102ac8: e8 20 23 00 00 call 80104ded <acquire>
r = (struct run*)v;
80102acd: 8b 45 08 mov 0x8(%ebp),%eax
80102ad0: 89 45 f4 mov %eax,-0xc(%ebp)
r->next = kmem.freelist;
80102ad3: 8b 15 b8 22 11 80 mov 0x801122b8,%edx
80102ad9: 8b 45 f4 mov -0xc(%ebp),%eax
80102adc: 89 10 mov %edx,(%eax)
kmem.freelist = r;
80102ade: 8b 45 f4 mov -0xc(%ebp),%eax
80102ae1: a3 b8 22 11 80 mov %eax,0x801122b8
if(kmem.use_lock)
80102ae6: a1 b4 22 11 80 mov 0x801122b4,%eax
80102aeb: 85 c0 test %eax,%eax
80102aed: 74 0c je 80102afb <kfree+0x97>
release(&kmem.lock);
80102aef: c7 04 24 80 22 11 80 movl $0x80112280,(%esp)
80102af6: e8 54 23 00 00 call 80104e4f <release>
}
80102afb: c9 leave
80102afc: c3 ret
80102afd <kalloc>:
// Allocate one 4096-byte page of physical memory.
// Returns a pointer that the kernel can use.
// Returns 0 if the memory cannot be allocated.
char*
kalloc(void)
{
80102afd: 55 push %ebp
80102afe: 89 e5 mov %esp,%ebp
80102b00: 83 ec 28 sub $0x28,%esp
struct run *r;
if(kmem.use_lock)
80102b03: a1 b4 22 11 80 mov 0x801122b4,%eax
80102b08: 85 c0 test %eax,%eax
80102b0a: 74 0c je 80102b18 <kalloc+0x1b>
acquire(&kmem.lock);
80102b0c: c7 04 24 80 22 11 80 movl $0x80112280,(%esp)
80102b13: e8 d5 22 00 00 call 80104ded <acquire>
r = kmem.freelist;
80102b18: a1 b8 22 11 80 mov 0x801122b8,%eax
80102b1d: 89 45 f4 mov %eax,-0xc(%ebp)
if(r)
80102b20: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80102b24: 74 0a je 80102b30 <kalloc+0x33>
kmem.freelist = r->next;
80102b26: 8b 45 f4 mov -0xc(%ebp),%eax
80102b29: 8b 00 mov (%eax),%eax
80102b2b: a3 b8 22 11 80 mov %eax,0x801122b8
if(kmem.use_lock)
80102b30: a1 b4 22 11 80 mov 0x801122b4,%eax
80102b35: 85 c0 test %eax,%eax
80102b37: 74 0c je 80102b45 <kalloc+0x48>
release(&kmem.lock);
80102b39: c7 04 24 80 22 11 80 movl $0x80112280,(%esp)
80102b40: e8 0a 23 00 00 call 80104e4f <release>
return (char*)r;
80102b45: 8b 45 f4 mov -0xc(%ebp),%eax
}
80102b48: c9 leave
80102b49: c3 ret
80102b4a <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80102b4a: 55 push %ebp
80102b4b: 89 e5 mov %esp,%ebp
80102b4d: 83 ec 14 sub $0x14,%esp
80102b50: 8b 45 08 mov 0x8(%ebp),%eax
80102b53: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102b57: 0f b7 45 ec movzwl -0x14(%ebp),%eax
80102b5b: 89 c2 mov %eax,%edx
80102b5d: ec in (%dx),%al
80102b5e: 88 45 ff mov %al,-0x1(%ebp)
return data;
80102b61: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
80102b65: c9 leave
80102b66: c3 ret
80102b67 <kbdgetc>:
#include "defs.h"
#include "kbd.h"
int
kbdgetc(void)
{
80102b67: 55 push %ebp
80102b68: 89 e5 mov %esp,%ebp
80102b6a: 83 ec 14 sub $0x14,%esp
static uchar *charcode[4] = {
normalmap, shiftmap, ctlmap, ctlmap
};
uint st, data, c;
st = inb(KBSTATP);
80102b6d: c7 04 24 64 00 00 00 movl $0x64,(%esp)
80102b74: e8 d1 ff ff ff call 80102b4a <inb>
80102b79: 0f b6 c0 movzbl %al,%eax
80102b7c: 89 45 f4 mov %eax,-0xc(%ebp)
if((st & KBS_DIB) == 0)
80102b7f: 8b 45 f4 mov -0xc(%ebp),%eax
80102b82: 83 e0 01 and $0x1,%eax
80102b85: 85 c0 test %eax,%eax
80102b87: 75 0a jne 80102b93 <kbdgetc+0x2c>
return -1;
80102b89: b8 ff ff ff ff mov $0xffffffff,%eax
80102b8e: e9 25 01 00 00 jmp 80102cb8 <kbdgetc+0x151>
data = inb(KBDATAP);
80102b93: c7 04 24 60 00 00 00 movl $0x60,(%esp)
80102b9a: e8 ab ff ff ff call 80102b4a <inb>
80102b9f: 0f b6 c0 movzbl %al,%eax
80102ba2: 89 45 fc mov %eax,-0x4(%ebp)
if(data == 0xE0){
80102ba5: 81 7d fc e0 00 00 00 cmpl $0xe0,-0x4(%ebp)
80102bac: 75 17 jne 80102bc5 <kbdgetc+0x5e>
shift |= E0ESC;
80102bae: a1 9c b6 10 80 mov 0x8010b69c,%eax
80102bb3: 83 c8 40 or $0x40,%eax
80102bb6: a3 9c b6 10 80 mov %eax,0x8010b69c
return 0;
80102bbb: b8 00 00 00 00 mov $0x0,%eax
80102bc0: e9 f3 00 00 00 jmp 80102cb8 <kbdgetc+0x151>
} else if(data & 0x80){
80102bc5: 8b 45 fc mov -0x4(%ebp),%eax
80102bc8: 25 80 00 00 00 and $0x80,%eax
80102bcd: 85 c0 test %eax,%eax
80102bcf: 74 45 je 80102c16 <kbdgetc+0xaf>
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
80102bd1: a1 9c b6 10 80 mov 0x8010b69c,%eax
80102bd6: 83 e0 40 and $0x40,%eax
80102bd9: 85 c0 test %eax,%eax
80102bdb: 75 08 jne 80102be5 <kbdgetc+0x7e>
80102bdd: 8b 45 fc mov -0x4(%ebp),%eax
80102be0: 83 e0 7f and $0x7f,%eax
80102be3: eb 03 jmp 80102be8 <kbdgetc+0x81>
80102be5: 8b 45 fc mov -0x4(%ebp),%eax
80102be8: 89 45 fc mov %eax,-0x4(%ebp)
shift &= ~(shiftcode[data] | E0ESC);
80102beb: 8b 45 fc mov -0x4(%ebp),%eax
80102bee: 05 20 90 10 80 add $0x80109020,%eax
80102bf3: 0f b6 00 movzbl (%eax),%eax
80102bf6: 83 c8 40 or $0x40,%eax
80102bf9: 0f b6 c0 movzbl %al,%eax
80102bfc: f7 d0 not %eax
80102bfe: 89 c2 mov %eax,%edx
80102c00: a1 9c b6 10 80 mov 0x8010b69c,%eax
80102c05: 21 d0 and %edx,%eax
80102c07: a3 9c b6 10 80 mov %eax,0x8010b69c
return 0;
80102c0c: b8 00 00 00 00 mov $0x0,%eax
80102c11: e9 a2 00 00 00 jmp 80102cb8 <kbdgetc+0x151>
} else if(shift & E0ESC){
80102c16: a1 9c b6 10 80 mov 0x8010b69c,%eax
80102c1b: 83 e0 40 and $0x40,%eax
80102c1e: 85 c0 test %eax,%eax
80102c20: 74 14 je 80102c36 <kbdgetc+0xcf>
// Last character was an E0 escape; or with 0x80
data |= 0x80;
80102c22: 81 4d fc 80 00 00 00 orl $0x80,-0x4(%ebp)
shift &= ~E0ESC;
80102c29: a1 9c b6 10 80 mov 0x8010b69c,%eax
80102c2e: 83 e0 bf and $0xffffffbf,%eax
80102c31: a3 9c b6 10 80 mov %eax,0x8010b69c
}
shift |= shiftcode[data];
80102c36: 8b 45 fc mov -0x4(%ebp),%eax
80102c39: 05 20 90 10 80 add $0x80109020,%eax
80102c3e: 0f b6 00 movzbl (%eax),%eax
80102c41: 0f b6 d0 movzbl %al,%edx
80102c44: a1 9c b6 10 80 mov 0x8010b69c,%eax
80102c49: 09 d0 or %edx,%eax
80102c4b: a3 9c b6 10 80 mov %eax,0x8010b69c
shift ^= togglecode[data];
80102c50: 8b 45 fc mov -0x4(%ebp),%eax
80102c53: 05 20 91 10 80 add $0x80109120,%eax
80102c58: 0f b6 00 movzbl (%eax),%eax
80102c5b: 0f b6 d0 movzbl %al,%edx
80102c5e: a1 9c b6 10 80 mov 0x8010b69c,%eax
80102c63: 31 d0 xor %edx,%eax
80102c65: a3 9c b6 10 80 mov %eax,0x8010b69c
c = charcode[shift & (CTL | SHIFT)][data];
80102c6a: a1 9c b6 10 80 mov 0x8010b69c,%eax
80102c6f: 83 e0 03 and $0x3,%eax
80102c72: 8b 14 85 20 95 10 80 mov -0x7fef6ae0(,%eax,4),%edx
80102c79: 8b 45 fc mov -0x4(%ebp),%eax
80102c7c: 01 d0 add %edx,%eax
80102c7e: 0f b6 00 movzbl (%eax),%eax
80102c81: 0f b6 c0 movzbl %al,%eax
80102c84: 89 45 f8 mov %eax,-0x8(%ebp)
if(shift & CAPSLOCK){
80102c87: a1 9c b6 10 80 mov 0x8010b69c,%eax
80102c8c: 83 e0 08 and $0x8,%eax
80102c8f: 85 c0 test %eax,%eax
80102c91: 74 22 je 80102cb5 <kbdgetc+0x14e>
if('a' <= c && c <= 'z')
80102c93: 83 7d f8 60 cmpl $0x60,-0x8(%ebp)
80102c97: 76 0c jbe 80102ca5 <kbdgetc+0x13e>
80102c99: 83 7d f8 7a cmpl $0x7a,-0x8(%ebp)
80102c9d: 77 06 ja 80102ca5 <kbdgetc+0x13e>
c += 'A' - 'a';
80102c9f: 83 6d f8 20 subl $0x20,-0x8(%ebp)
80102ca3: eb 10 jmp 80102cb5 <kbdgetc+0x14e>
else if('A' <= c && c <= 'Z')
80102ca5: 83 7d f8 40 cmpl $0x40,-0x8(%ebp)
80102ca9: 76 0a jbe 80102cb5 <kbdgetc+0x14e>
80102cab: 83 7d f8 5a cmpl $0x5a,-0x8(%ebp)
80102caf: 77 04 ja 80102cb5 <kbdgetc+0x14e>
c += 'a' - 'A';
80102cb1: 83 45 f8 20 addl $0x20,-0x8(%ebp)
}
return c;
80102cb5: 8b 45 f8 mov -0x8(%ebp),%eax
}
80102cb8: c9 leave
80102cb9: c3 ret
80102cba <kbdintr>:
void
kbdintr(void)
{
80102cba: 55 push %ebp
80102cbb: 89 e5 mov %esp,%ebp
80102cbd: 83 ec 18 sub $0x18,%esp
consoleintr(kbdgetc);
80102cc0: c7 04 24 67 2b 10 80 movl $0x80102b67,(%esp)
80102cc7: e8 e1 da ff ff call 801007ad <consoleintr>
}
80102ccc: c9 leave
80102ccd: c3 ret
80102cce <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80102cce: 55 push %ebp
80102ccf: 89 e5 mov %esp,%ebp
80102cd1: 83 ec 14 sub $0x14,%esp
80102cd4: 8b 45 08 mov 0x8(%ebp),%eax
80102cd7: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102cdb: 0f b7 45 ec movzwl -0x14(%ebp),%eax
80102cdf: 89 c2 mov %eax,%edx
80102ce1: ec in (%dx),%al
80102ce2: 88 45 ff mov %al,-0x1(%ebp)
return data;
80102ce5: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
80102ce9: c9 leave
80102cea: c3 ret
80102ceb <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80102ceb: 55 push %ebp
80102cec: 89 e5 mov %esp,%ebp
80102cee: 83 ec 08 sub $0x8,%esp
80102cf1: 8b 55 08 mov 0x8(%ebp),%edx
80102cf4: 8b 45 0c mov 0xc(%ebp),%eax
80102cf7: 66 89 55 fc mov %dx,-0x4(%ebp)
80102cfb: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102cfe: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80102d02: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80102d06: ee out %al,(%dx)
}
80102d07: c9 leave
80102d08: c3 ret
80102d09 <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
80102d09: 55 push %ebp
80102d0a: 89 e5 mov %esp,%ebp
80102d0c: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80102d0f: 9c pushf
80102d10: 58 pop %eax
80102d11: 89 45 fc mov %eax,-0x4(%ebp)
return eflags;
80102d14: 8b 45 fc mov -0x4(%ebp),%eax
}
80102d17: c9 leave
80102d18: c3 ret
80102d19 <lapicw>:
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
80102d19: 55 push %ebp
80102d1a: 89 e5 mov %esp,%ebp
lapic[index] = value;
80102d1c: a1 bc 22 11 80 mov 0x801122bc,%eax
80102d21: 8b 55 08 mov 0x8(%ebp),%edx
80102d24: c1 e2 02 shl $0x2,%edx
80102d27: 01 c2 add %eax,%edx
80102d29: 8b 45 0c mov 0xc(%ebp),%eax
80102d2c: 89 02 mov %eax,(%edx)
lapic[ID]; // wait for write to finish, by reading
80102d2e: a1 bc 22 11 80 mov 0x801122bc,%eax
80102d33: 83 c0 20 add $0x20,%eax
80102d36: 8b 00 mov (%eax),%eax
}
80102d38: 5d pop %ebp
80102d39: c3 ret
80102d3a <lapicinit>:
//PAGEBREAK!
void
lapicinit(void)
{
80102d3a: 55 push %ebp
80102d3b: 89 e5 mov %esp,%ebp
80102d3d: 83 ec 08 sub $0x8,%esp
if(!lapic)
80102d40: a1 bc 22 11 80 mov 0x801122bc,%eax
80102d45: 85 c0 test %eax,%eax
80102d47: 75 05 jne 80102d4e <lapicinit+0x14>
return;
80102d49: e9 43 01 00 00 jmp 80102e91 <lapicinit+0x157>
// Enable local APIC; set spurious interrupt vector.
lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS));
80102d4e: c7 44 24 04 3f 01 00 movl $0x13f,0x4(%esp)
80102d55: 00
80102d56: c7 04 24 3c 00 00 00 movl $0x3c,(%esp)
80102d5d: e8 b7 ff ff ff call 80102d19 <lapicw>
// The timer repeatedly counts down at bus frequency
// from lapic[TICR] and then issues an interrupt.
// If xv6 cared more about precise timekeeping,
// TICR would be calibrated using an external time source.
lapicw(TDCR, X1);
80102d62: c7 44 24 04 0b 00 00 movl $0xb,0x4(%esp)
80102d69: 00
80102d6a: c7 04 24 f8 00 00 00 movl $0xf8,(%esp)
80102d71: e8 a3 ff ff ff call 80102d19 <lapicw>
lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER));
80102d76: c7 44 24 04 20 00 02 movl $0x20020,0x4(%esp)
80102d7d: 00
80102d7e: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
80102d85: e8 8f ff ff ff call 80102d19 <lapicw>
lapicw(TICR, 10000000);
80102d8a: c7 44 24 04 80 96 98 movl $0x989680,0x4(%esp)
80102d91: 00
80102d92: c7 04 24 e0 00 00 00 movl $0xe0,(%esp)
80102d99: e8 7b ff ff ff call 80102d19 <lapicw>
// Disable logical interrupt lines.
lapicw(LINT0, MASKED);
80102d9e: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80102da5: 00
80102da6: c7 04 24 d4 00 00 00 movl $0xd4,(%esp)
80102dad: e8 67 ff ff ff call 80102d19 <lapicw>
lapicw(LINT1, MASKED);
80102db2: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80102db9: 00
80102dba: c7 04 24 d8 00 00 00 movl $0xd8,(%esp)
80102dc1: e8 53 ff ff ff call 80102d19 <lapicw>
// Disable performance counter overflow interrupts
// on machines that provide that interrupt entry.
if(((lapic[VER]>>16) & 0xFF) >= 4)
80102dc6: a1 bc 22 11 80 mov 0x801122bc,%eax
80102dcb: 83 c0 30 add $0x30,%eax
80102dce: 8b 00 mov (%eax),%eax
80102dd0: c1 e8 10 shr $0x10,%eax
80102dd3: 0f b6 c0 movzbl %al,%eax
80102dd6: 83 f8 03 cmp $0x3,%eax
80102dd9: 76 14 jbe 80102def <lapicinit+0xb5>
lapicw(PCINT, MASKED);
80102ddb: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80102de2: 00
80102de3: c7 04 24 d0 00 00 00 movl $0xd0,(%esp)
80102dea: e8 2a ff ff ff call 80102d19 <lapicw>
// Map error interrupt to IRQ_ERROR.
lapicw(ERROR, T_IRQ0 + IRQ_ERROR);
80102def: c7 44 24 04 33 00 00 movl $0x33,0x4(%esp)
80102df6: 00
80102df7: c7 04 24 dc 00 00 00 movl $0xdc,(%esp)
80102dfe: e8 16 ff ff ff call 80102d19 <lapicw>
// Clear error status register (requires back-to-back writes).
lapicw(ESR, 0);
80102e03: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102e0a: 00
80102e0b: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80102e12: e8 02 ff ff ff call 80102d19 <lapicw>
lapicw(ESR, 0);
80102e17: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102e1e: 00
80102e1f: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80102e26: e8 ee fe ff ff call 80102d19 <lapicw>
// Ack any outstanding interrupts.
lapicw(EOI, 0);
80102e2b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102e32: 00
80102e33: c7 04 24 2c 00 00 00 movl $0x2c,(%esp)
80102e3a: e8 da fe ff ff call 80102d19 <lapicw>
// Send an Init Level De-Assert to synchronise arbitration ID's.
lapicw(ICRHI, 0);
80102e3f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102e46: 00
80102e47: c7 04 24 c4 00 00 00 movl $0xc4,(%esp)
80102e4e: e8 c6 fe ff ff call 80102d19 <lapicw>
lapicw(ICRLO, BCAST | INIT | LEVEL);
80102e53: c7 44 24 04 00 85 08 movl $0x88500,0x4(%esp)
80102e5a: 00
80102e5b: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80102e62: e8 b2 fe ff ff call 80102d19 <lapicw>
while(lapic[ICRLO] & DELIVS)
80102e67: 90 nop
80102e68: a1 bc 22 11 80 mov 0x801122bc,%eax
80102e6d: 05 00 03 00 00 add $0x300,%eax
80102e72: 8b 00 mov (%eax),%eax
80102e74: 25 00 10 00 00 and $0x1000,%eax
80102e79: 85 c0 test %eax,%eax
80102e7b: 75 eb jne 80102e68 <lapicinit+0x12e>
;
// Enable interrupts on the APIC (but not on the processor).
lapicw(TPR, 0);
80102e7d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102e84: 00
80102e85: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80102e8c: e8 88 fe ff ff call 80102d19 <lapicw>
}
80102e91: c9 leave
80102e92: c3 ret
80102e93 <cpunum>:
int
cpunum(void)
{
80102e93: 55 push %ebp
80102e94: 89 e5 mov %esp,%ebp
80102e96: 83 ec 18 sub $0x18,%esp
// Cannot call cpu when interrupts are enabled:
// result not guaranteed to last long enough to be used!
// Would prefer to panic but even printing is chancy here:
// almost everything, including cprintf and panic, calls cpu,
// often indirectly through acquire and release.
if(readeflags()&FL_IF){
80102e99: e8 6b fe ff ff call 80102d09 <readeflags>
80102e9e: 25 00 02 00 00 and $0x200,%eax
80102ea3: 85 c0 test %eax,%eax
80102ea5: 74 25 je 80102ecc <cpunum+0x39>
static int n;
if(n++ == 0)
80102ea7: a1 a0 b6 10 80 mov 0x8010b6a0,%eax
80102eac: 8d 50 01 lea 0x1(%eax),%edx
80102eaf: 89 15 a0 b6 10 80 mov %edx,0x8010b6a0
80102eb5: 85 c0 test %eax,%eax
80102eb7: 75 13 jne 80102ecc <cpunum+0x39>
cprintf("cpu called from %x with interrupts enabled\n",
80102eb9: 8b 45 04 mov 0x4(%ebp),%eax
80102ebc: 89 44 24 04 mov %eax,0x4(%esp)
80102ec0: c7 04 24 cc 85 10 80 movl $0x801085cc,(%esp)
80102ec7: e8 d4 d4 ff ff call 801003a0 <cprintf>
__builtin_return_address(0));
}
if(lapic)
80102ecc: a1 bc 22 11 80 mov 0x801122bc,%eax
80102ed1: 85 c0 test %eax,%eax
80102ed3: 74 0f je 80102ee4 <cpunum+0x51>
return lapic[ID]>>24;
80102ed5: a1 bc 22 11 80 mov 0x801122bc,%eax
80102eda: 83 c0 20 add $0x20,%eax
80102edd: 8b 00 mov (%eax),%eax
80102edf: c1 e8 18 shr $0x18,%eax
80102ee2: eb 05 jmp 80102ee9 <cpunum+0x56>
return 0;
80102ee4: b8 00 00 00 00 mov $0x0,%eax
}
80102ee9: c9 leave
80102eea: c3 ret
80102eeb <lapiceoi>:
// Acknowledge interrupt.
void
lapiceoi(void)
{
80102eeb: 55 push %ebp
80102eec: 89 e5 mov %esp,%ebp
80102eee: 83 ec 08 sub $0x8,%esp
if(lapic)
80102ef1: a1 bc 22 11 80 mov 0x801122bc,%eax
80102ef6: 85 c0 test %eax,%eax
80102ef8: 74 14 je 80102f0e <lapiceoi+0x23>
lapicw(EOI, 0);
80102efa: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102f01: 00
80102f02: c7 04 24 2c 00 00 00 movl $0x2c,(%esp)
80102f09: e8 0b fe ff ff call 80102d19 <lapicw>
}
80102f0e: c9 leave
80102f0f: c3 ret
80102f10 <microdelay>:
// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
80102f10: 55 push %ebp
80102f11: 89 e5 mov %esp,%ebp
}
80102f13: 5d pop %ebp
80102f14: c3 ret
80102f15 <lapicstartap>:
// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
80102f15: 55 push %ebp
80102f16: 89 e5 mov %esp,%ebp
80102f18: 83 ec 1c sub $0x1c,%esp
80102f1b: 8b 45 08 mov 0x8(%ebp),%eax
80102f1e: 88 45 ec mov %al,-0x14(%ebp)
ushort *wrv;
// "The BSP must initialize CMOS shutdown code to 0AH
// 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
80102f21: c7 44 24 04 0f 00 00 movl $0xf,0x4(%esp)
80102f28: 00
80102f29: c7 04 24 70 00 00 00 movl $0x70,(%esp)
80102f30: e8 b6 fd ff ff call 80102ceb <outb>
outb(CMOS_PORT+1, 0x0A);
80102f35: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80102f3c: 00
80102f3d: c7 04 24 71 00 00 00 movl $0x71,(%esp)
80102f44: e8 a2 fd ff ff call 80102ceb <outb>
wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector
80102f49: c7 45 f8 67 04 00 80 movl $0x80000467,-0x8(%ebp)
wrv[0] = 0;
80102f50: 8b 45 f8 mov -0x8(%ebp),%eax
80102f53: 66 c7 00 00 00 movw $0x0,(%eax)
wrv[1] = addr >> 4;
80102f58: 8b 45 f8 mov -0x8(%ebp),%eax
80102f5b: 8d 50 02 lea 0x2(%eax),%edx
80102f5e: 8b 45 0c mov 0xc(%ebp),%eax
80102f61: c1 e8 04 shr $0x4,%eax
80102f64: 66 89 02 mov %ax,(%edx)
// "Universal startup algorithm."
// Send INIT (level-triggered) interrupt to reset other CPU.
lapicw(ICRHI, apicid<<24);
80102f67: 0f b6 45 ec movzbl -0x14(%ebp),%eax
80102f6b: c1 e0 18 shl $0x18,%eax
80102f6e: 89 44 24 04 mov %eax,0x4(%esp)
80102f72: c7 04 24 c4 00 00 00 movl $0xc4,(%esp)
80102f79: e8 9b fd ff ff call 80102d19 <lapicw>
lapicw(ICRLO, INIT | LEVEL | ASSERT);
80102f7e: c7 44 24 04 00 c5 00 movl $0xc500,0x4(%esp)
80102f85: 00
80102f86: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80102f8d: e8 87 fd ff ff call 80102d19 <lapicw>
microdelay(200);
80102f92: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
80102f99: e8 72 ff ff ff call 80102f10 <microdelay>
lapicw(ICRLO, INIT | LEVEL);
80102f9e: c7 44 24 04 00 85 00 movl $0x8500,0x4(%esp)
80102fa5: 00
80102fa6: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80102fad: e8 67 fd ff ff call 80102d19 <lapicw>
microdelay(100); // should be 10ms, but too slow in Bochs!
80102fb2: c7 04 24 64 00 00 00 movl $0x64,(%esp)
80102fb9: e8 52 ff ff ff call 80102f10 <microdelay>
// Send startup IPI (twice!) to enter code.
// Regular hardware is supposed to only accept a STARTUP
// 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++){
80102fbe: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
80102fc5: eb 40 jmp 80103007 <lapicstartap+0xf2>
lapicw(ICRHI, apicid<<24);
80102fc7: 0f b6 45 ec movzbl -0x14(%ebp),%eax
80102fcb: c1 e0 18 shl $0x18,%eax
80102fce: 89 44 24 04 mov %eax,0x4(%esp)
80102fd2: c7 04 24 c4 00 00 00 movl $0xc4,(%esp)
80102fd9: e8 3b fd ff ff call 80102d19 <lapicw>
lapicw(ICRLO, STARTUP | (addr>>12));
80102fde: 8b 45 0c mov 0xc(%ebp),%eax
80102fe1: c1 e8 0c shr $0xc,%eax
80102fe4: 80 cc 06 or $0x6,%ah
80102fe7: 89 44 24 04 mov %eax,0x4(%esp)
80102feb: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80102ff2: e8 22 fd ff ff call 80102d19 <lapicw>
microdelay(200);
80102ff7: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
80102ffe: e8 0d ff ff ff call 80102f10 <microdelay>
// Send startup IPI (twice!) to enter code.
// Regular hardware is supposed to only accept a STARTUP
// 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++){
80103003: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80103007: 83 7d fc 01 cmpl $0x1,-0x4(%ebp)
8010300b: 7e ba jle 80102fc7 <lapicstartap+0xb2>
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
microdelay(200);
}
}
8010300d: c9 leave
8010300e: c3 ret
8010300f <cmos_read>:
#define DAY 0x07
#define MONTH 0x08
#define YEAR 0x09
static uint cmos_read(uint reg)
{
8010300f: 55 push %ebp
80103010: 89 e5 mov %esp,%ebp
80103012: 83 ec 08 sub $0x8,%esp
outb(CMOS_PORT, reg);
80103015: 8b 45 08 mov 0x8(%ebp),%eax
80103018: 0f b6 c0 movzbl %al,%eax
8010301b: 89 44 24 04 mov %eax,0x4(%esp)
8010301f: c7 04 24 70 00 00 00 movl $0x70,(%esp)
80103026: e8 c0 fc ff ff call 80102ceb <outb>
microdelay(200);
8010302b: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
80103032: e8 d9 fe ff ff call 80102f10 <microdelay>
return inb(CMOS_RETURN);
80103037: c7 04 24 71 00 00 00 movl $0x71,(%esp)
8010303e: e8 8b fc ff ff call 80102cce <inb>
80103043: 0f b6 c0 movzbl %al,%eax
}
80103046: c9 leave
80103047: c3 ret
80103048 <fill_rtcdate>:
static void fill_rtcdate(struct rtcdate *r)
{
80103048: 55 push %ebp
80103049: 89 e5 mov %esp,%ebp
8010304b: 83 ec 04 sub $0x4,%esp
r->second = cmos_read(SECS);
8010304e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80103055: e8 b5 ff ff ff call 8010300f <cmos_read>
8010305a: 8b 55 08 mov 0x8(%ebp),%edx
8010305d: 89 02 mov %eax,(%edx)
r->minute = cmos_read(MINS);
8010305f: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80103066: e8 a4 ff ff ff call 8010300f <cmos_read>
8010306b: 8b 55 08 mov 0x8(%ebp),%edx
8010306e: 89 42 04 mov %eax,0x4(%edx)
r->hour = cmos_read(HOURS);
80103071: c7 04 24 04 00 00 00 movl $0x4,(%esp)
80103078: e8 92 ff ff ff call 8010300f <cmos_read>
8010307d: 8b 55 08 mov 0x8(%ebp),%edx
80103080: 89 42 08 mov %eax,0x8(%edx)
r->day = cmos_read(DAY);
80103083: c7 04 24 07 00 00 00 movl $0x7,(%esp)
8010308a: e8 80 ff ff ff call 8010300f <cmos_read>
8010308f: 8b 55 08 mov 0x8(%ebp),%edx
80103092: 89 42 0c mov %eax,0xc(%edx)
r->month = cmos_read(MONTH);
80103095: c7 04 24 08 00 00 00 movl $0x8,(%esp)
8010309c: e8 6e ff ff ff call 8010300f <cmos_read>
801030a1: 8b 55 08 mov 0x8(%ebp),%edx
801030a4: 89 42 10 mov %eax,0x10(%edx)
r->year = cmos_read(YEAR);
801030a7: c7 04 24 09 00 00 00 movl $0x9,(%esp)
801030ae: e8 5c ff ff ff call 8010300f <cmos_read>
801030b3: 8b 55 08 mov 0x8(%ebp),%edx
801030b6: 89 42 14 mov %eax,0x14(%edx)
}
801030b9: c9 leave
801030ba: c3 ret
801030bb <cmostime>:
// qemu seems to use 24-hour GWT and the values are BCD encoded
void cmostime(struct rtcdate *r)
{
801030bb: 55 push %ebp
801030bc: 89 e5 mov %esp,%ebp
801030be: 83 ec 58 sub $0x58,%esp
struct rtcdate t1, t2;
int sb, bcd;
sb = cmos_read(CMOS_STATB);
801030c1: c7 04 24 0b 00 00 00 movl $0xb,(%esp)
801030c8: e8 42 ff ff ff call 8010300f <cmos_read>
801030cd: 89 45 f4 mov %eax,-0xc(%ebp)
bcd = (sb & (1 << 2)) == 0;
801030d0: 8b 45 f4 mov -0xc(%ebp),%eax
801030d3: 83 e0 04 and $0x4,%eax
801030d6: 85 c0 test %eax,%eax
801030d8: 0f 94 c0 sete %al
801030db: 0f b6 c0 movzbl %al,%eax
801030de: 89 45 f0 mov %eax,-0x10(%ebp)
// make sure CMOS doesn't modify time while we read it
for (;;) {
fill_rtcdate(&t1);
801030e1: 8d 45 d8 lea -0x28(%ebp),%eax
801030e4: 89 04 24 mov %eax,(%esp)
801030e7: e8 5c ff ff ff call 80103048 <fill_rtcdate>
if (cmos_read(CMOS_STATA) & CMOS_UIP)
801030ec: c7 04 24 0a 00 00 00 movl $0xa,(%esp)
801030f3: e8 17 ff ff ff call 8010300f <cmos_read>
801030f8: 25 80 00 00 00 and $0x80,%eax
801030fd: 85 c0 test %eax,%eax
801030ff: 74 02 je 80103103 <cmostime+0x48>
continue;
80103101: eb 36 jmp 80103139 <cmostime+0x7e>
fill_rtcdate(&t2);
80103103: 8d 45 c0 lea -0x40(%ebp),%eax
80103106: 89 04 24 mov %eax,(%esp)
80103109: e8 3a ff ff ff call 80103048 <fill_rtcdate>
if (memcmp(&t1, &t2, sizeof(t1)) == 0)
8010310e: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp)
80103115: 00
80103116: 8d 45 c0 lea -0x40(%ebp),%eax
80103119: 89 44 24 04 mov %eax,0x4(%esp)
8010311d: 8d 45 d8 lea -0x28(%ebp),%eax
80103120: 89 04 24 mov %eax,(%esp)
80103123: e8 90 1f 00 00 call 801050b8 <memcmp>
80103128: 85 c0 test %eax,%eax
8010312a: 75 0d jne 80103139 <cmostime+0x7e>
break;
8010312c: 90 nop
}
// convert
if (bcd) {
8010312d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80103131: 0f 84 ac 00 00 00 je 801031e3 <cmostime+0x128>
80103137: eb 02 jmp 8010313b <cmostime+0x80>
if (cmos_read(CMOS_STATA) & CMOS_UIP)
continue;
fill_rtcdate(&t2);
if (memcmp(&t1, &t2, sizeof(t1)) == 0)
break;
}
80103139: eb a6 jmp 801030e1 <cmostime+0x26>
// convert
if (bcd) {
#define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf))
CONV(second);
8010313b: 8b 45 d8 mov -0x28(%ebp),%eax
8010313e: c1 e8 04 shr $0x4,%eax
80103141: 89 c2 mov %eax,%edx
80103143: 89 d0 mov %edx,%eax
80103145: c1 e0 02 shl $0x2,%eax
80103148: 01 d0 add %edx,%eax
8010314a: 01 c0 add %eax,%eax
8010314c: 8b 55 d8 mov -0x28(%ebp),%edx
8010314f: 83 e2 0f and $0xf,%edx
80103152: 01 d0 add %edx,%eax
80103154: 89 45 d8 mov %eax,-0x28(%ebp)
CONV(minute);
80103157: 8b 45 dc mov -0x24(%ebp),%eax
8010315a: c1 e8 04 shr $0x4,%eax
8010315d: 89 c2 mov %eax,%edx
8010315f: 89 d0 mov %edx,%eax
80103161: c1 e0 02 shl $0x2,%eax
80103164: 01 d0 add %edx,%eax
80103166: 01 c0 add %eax,%eax
80103168: 8b 55 dc mov -0x24(%ebp),%edx
8010316b: 83 e2 0f and $0xf,%edx
8010316e: 01 d0 add %edx,%eax
80103170: 89 45 dc mov %eax,-0x24(%ebp)
CONV(hour );
80103173: 8b 45 e0 mov -0x20(%ebp),%eax
80103176: c1 e8 04 shr $0x4,%eax
80103179: 89 c2 mov %eax,%edx
8010317b: 89 d0 mov %edx,%eax
8010317d: c1 e0 02 shl $0x2,%eax
80103180: 01 d0 add %edx,%eax
80103182: 01 c0 add %eax,%eax
80103184: 8b 55 e0 mov -0x20(%ebp),%edx
80103187: 83 e2 0f and $0xf,%edx
8010318a: 01 d0 add %edx,%eax
8010318c: 89 45 e0 mov %eax,-0x20(%ebp)
CONV(day );
8010318f: 8b 45 e4 mov -0x1c(%ebp),%eax
80103192: c1 e8 04 shr $0x4,%eax
80103195: 89 c2 mov %eax,%edx
80103197: 89 d0 mov %edx,%eax
80103199: c1 e0 02 shl $0x2,%eax
8010319c: 01 d0 add %edx,%eax
8010319e: 01 c0 add %eax,%eax
801031a0: 8b 55 e4 mov -0x1c(%ebp),%edx
801031a3: 83 e2 0f and $0xf,%edx
801031a6: 01 d0 add %edx,%eax
801031a8: 89 45 e4 mov %eax,-0x1c(%ebp)
CONV(month );
801031ab: 8b 45 e8 mov -0x18(%ebp),%eax
801031ae: c1 e8 04 shr $0x4,%eax
801031b1: 89 c2 mov %eax,%edx
801031b3: 89 d0 mov %edx,%eax
801031b5: c1 e0 02 shl $0x2,%eax
801031b8: 01 d0 add %edx,%eax
801031ba: 01 c0 add %eax,%eax
801031bc: 8b 55 e8 mov -0x18(%ebp),%edx
801031bf: 83 e2 0f and $0xf,%edx
801031c2: 01 d0 add %edx,%eax
801031c4: 89 45 e8 mov %eax,-0x18(%ebp)
CONV(year );
801031c7: 8b 45 ec mov -0x14(%ebp),%eax
801031ca: c1 e8 04 shr $0x4,%eax
801031cd: 89 c2 mov %eax,%edx
801031cf: 89 d0 mov %edx,%eax
801031d1: c1 e0 02 shl $0x2,%eax
801031d4: 01 d0 add %edx,%eax
801031d6: 01 c0 add %eax,%eax
801031d8: 8b 55 ec mov -0x14(%ebp),%edx
801031db: 83 e2 0f and $0xf,%edx
801031de: 01 d0 add %edx,%eax
801031e0: 89 45 ec mov %eax,-0x14(%ebp)
#undef CONV
}
*r = t1;
801031e3: 8b 45 08 mov 0x8(%ebp),%eax
801031e6: 8b 55 d8 mov -0x28(%ebp),%edx
801031e9: 89 10 mov %edx,(%eax)
801031eb: 8b 55 dc mov -0x24(%ebp),%edx
801031ee: 89 50 04 mov %edx,0x4(%eax)
801031f1: 8b 55 e0 mov -0x20(%ebp),%edx
801031f4: 89 50 08 mov %edx,0x8(%eax)
801031f7: 8b 55 e4 mov -0x1c(%ebp),%edx
801031fa: 89 50 0c mov %edx,0xc(%eax)
801031fd: 8b 55 e8 mov -0x18(%ebp),%edx
80103200: 89 50 10 mov %edx,0x10(%eax)
80103203: 8b 55 ec mov -0x14(%ebp),%edx
80103206: 89 50 14 mov %edx,0x14(%eax)
r->year += 2000;
80103209: 8b 45 08 mov 0x8(%ebp),%eax
8010320c: 8b 40 14 mov 0x14(%eax),%eax
8010320f: 8d 90 d0 07 00 00 lea 0x7d0(%eax),%edx
80103215: 8b 45 08 mov 0x8(%ebp),%eax
80103218: 89 50 14 mov %edx,0x14(%eax)
}
8010321b: c9 leave
8010321c: c3 ret
8010321d <initlog>:
static void recover_from_log(void);
static void commit();
void
initlog(void)
{
8010321d: 55 push %ebp
8010321e: 89 e5 mov %esp,%ebp
80103220: 83 ec 28 sub $0x28,%esp
if (sizeof(struct logheader) >= BSIZE)
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
80103223: c7 44 24 04 f8 85 10 movl $0x801085f8,0x4(%esp)
8010322a: 80
8010322b: c7 04 24 c0 22 11 80 movl $0x801122c0,(%esp)
80103232: e8 95 1b 00 00 call 80104dcc <initlock>
readsb(ROOTDEV, &sb);
80103237: 8d 45 e8 lea -0x18(%ebp),%eax
8010323a: 89 44 24 04 mov %eax,0x4(%esp)
8010323e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80103245: e8 c2 e0 ff ff call 8010130c <readsb>
log.start = sb.size - sb.nlog;
8010324a: 8b 55 e8 mov -0x18(%ebp),%edx
8010324d: 8b 45 f4 mov -0xc(%ebp),%eax
80103250: 29 c2 sub %eax,%edx
80103252: 89 d0 mov %edx,%eax
80103254: a3 f4 22 11 80 mov %eax,0x801122f4
log.size = sb.nlog;
80103259: 8b 45 f4 mov -0xc(%ebp),%eax
8010325c: a3 f8 22 11 80 mov %eax,0x801122f8
log.dev = ROOTDEV;
80103261: c7 05 04 23 11 80 01 movl $0x1,0x80112304
80103268: 00 00 00
recover_from_log();
8010326b: e8 9a 01 00 00 call 8010340a <recover_from_log>
}
80103270: c9 leave
80103271: c3 ret
80103272 <install_trans>:
// Copy committed blocks from log to their home location
static void
install_trans(void)
{
80103272: 55 push %ebp
80103273: 89 e5 mov %esp,%ebp
80103275: 83 ec 28 sub $0x28,%esp
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80103278: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010327f: e9 8c 00 00 00 jmp 80103310 <install_trans+0x9e>
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
80103284: 8b 15 f4 22 11 80 mov 0x801122f4,%edx
8010328a: 8b 45 f4 mov -0xc(%ebp),%eax
8010328d: 01 d0 add %edx,%eax
8010328f: 83 c0 01 add $0x1,%eax
80103292: 89 c2 mov %eax,%edx
80103294: a1 04 23 11 80 mov 0x80112304,%eax
80103299: 89 54 24 04 mov %edx,0x4(%esp)
8010329d: 89 04 24 mov %eax,(%esp)
801032a0: e8 01 cf ff ff call 801001a6 <bread>
801032a5: 89 45 f0 mov %eax,-0x10(%ebp)
struct buf *dbuf = bread(log.dev, log.lh.sector[tail]); // read dst
801032a8: 8b 45 f4 mov -0xc(%ebp),%eax
801032ab: 83 c0 10 add $0x10,%eax
801032ae: 8b 04 85 cc 22 11 80 mov -0x7feedd34(,%eax,4),%eax
801032b5: 89 c2 mov %eax,%edx
801032b7: a1 04 23 11 80 mov 0x80112304,%eax
801032bc: 89 54 24 04 mov %edx,0x4(%esp)
801032c0: 89 04 24 mov %eax,(%esp)
801032c3: e8 de ce ff ff call 801001a6 <bread>
801032c8: 89 45 ec mov %eax,-0x14(%ebp)
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
801032cb: 8b 45 f0 mov -0x10(%ebp),%eax
801032ce: 8d 50 18 lea 0x18(%eax),%edx
801032d1: 8b 45 ec mov -0x14(%ebp),%eax
801032d4: 83 c0 18 add $0x18,%eax
801032d7: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
801032de: 00
801032df: 89 54 24 04 mov %edx,0x4(%esp)
801032e3: 89 04 24 mov %eax,(%esp)
801032e6: e8 25 1e 00 00 call 80105110 <memmove>
bwrite(dbuf); // write dst to disk
801032eb: 8b 45 ec mov -0x14(%ebp),%eax
801032ee: 89 04 24 mov %eax,(%esp)
801032f1: e8 e7 ce ff ff call 801001dd <bwrite>
brelse(lbuf);
801032f6: 8b 45 f0 mov -0x10(%ebp),%eax
801032f9: 89 04 24 mov %eax,(%esp)
801032fc: e8 16 cf ff ff call 80100217 <brelse>
brelse(dbuf);
80103301: 8b 45 ec mov -0x14(%ebp),%eax
80103304: 89 04 24 mov %eax,(%esp)
80103307: e8 0b cf ff ff call 80100217 <brelse>
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
8010330c: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80103310: a1 08 23 11 80 mov 0x80112308,%eax
80103315: 3b 45 f4 cmp -0xc(%ebp),%eax
80103318: 0f 8f 66 ff ff ff jg 80103284 <install_trans+0x12>
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
bwrite(dbuf); // write dst to disk
brelse(lbuf);
brelse(dbuf);
}
}
8010331e: c9 leave
8010331f: c3 ret
80103320 <read_head>:
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
80103320: 55 push %ebp
80103321: 89 e5 mov %esp,%ebp
80103323: 83 ec 28 sub $0x28,%esp
struct buf *buf = bread(log.dev, log.start);
80103326: a1 f4 22 11 80 mov 0x801122f4,%eax
8010332b: 89 c2 mov %eax,%edx
8010332d: a1 04 23 11 80 mov 0x80112304,%eax
80103332: 89 54 24 04 mov %edx,0x4(%esp)
80103336: 89 04 24 mov %eax,(%esp)
80103339: e8 68 ce ff ff call 801001a6 <bread>
8010333e: 89 45 f0 mov %eax,-0x10(%ebp)
struct logheader *lh = (struct logheader *) (buf->data);
80103341: 8b 45 f0 mov -0x10(%ebp),%eax
80103344: 83 c0 18 add $0x18,%eax
80103347: 89 45 ec mov %eax,-0x14(%ebp)
int i;
log.lh.n = lh->n;
8010334a: 8b 45 ec mov -0x14(%ebp),%eax
8010334d: 8b 00 mov (%eax),%eax
8010334f: a3 08 23 11 80 mov %eax,0x80112308
for (i = 0; i < log.lh.n; i++) {
80103354: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010335b: eb 1b jmp 80103378 <read_head+0x58>
log.lh.sector[i] = lh->sector[i];
8010335d: 8b 45 ec mov -0x14(%ebp),%eax
80103360: 8b 55 f4 mov -0xc(%ebp),%edx
80103363: 8b 44 90 04 mov 0x4(%eax,%edx,4),%eax
80103367: 8b 55 f4 mov -0xc(%ebp),%edx
8010336a: 83 c2 10 add $0x10,%edx
8010336d: 89 04 95 cc 22 11 80 mov %eax,-0x7feedd34(,%edx,4)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
for (i = 0; i < log.lh.n; i++) {
80103374: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80103378: a1 08 23 11 80 mov 0x80112308,%eax
8010337d: 3b 45 f4 cmp -0xc(%ebp),%eax
80103380: 7f db jg 8010335d <read_head+0x3d>
log.lh.sector[i] = lh->sector[i];
}
brelse(buf);
80103382: 8b 45 f0 mov -0x10(%ebp),%eax
80103385: 89 04 24 mov %eax,(%esp)
80103388: e8 8a ce ff ff call 80100217 <brelse>
}
8010338d: c9 leave
8010338e: c3 ret
8010338f <write_head>:
// Write in-memory log header to disk.
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
8010338f: 55 push %ebp
80103390: 89 e5 mov %esp,%ebp
80103392: 83 ec 28 sub $0x28,%esp
struct buf *buf = bread(log.dev, log.start);
80103395: a1 f4 22 11 80 mov 0x801122f4,%eax
8010339a: 89 c2 mov %eax,%edx
8010339c: a1 04 23 11 80 mov 0x80112304,%eax
801033a1: 89 54 24 04 mov %edx,0x4(%esp)
801033a5: 89 04 24 mov %eax,(%esp)
801033a8: e8 f9 cd ff ff call 801001a6 <bread>
801033ad: 89 45 f0 mov %eax,-0x10(%ebp)
struct logheader *hb = (struct logheader *) (buf->data);
801033b0: 8b 45 f0 mov -0x10(%ebp),%eax
801033b3: 83 c0 18 add $0x18,%eax
801033b6: 89 45 ec mov %eax,-0x14(%ebp)
int i;
hb->n = log.lh.n;
801033b9: 8b 15 08 23 11 80 mov 0x80112308,%edx
801033bf: 8b 45 ec mov -0x14(%ebp),%eax
801033c2: 89 10 mov %edx,(%eax)
for (i = 0; i < log.lh.n; i++) {
801033c4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801033cb: eb 1b jmp 801033e8 <write_head+0x59>
hb->sector[i] = log.lh.sector[i];
801033cd: 8b 45 f4 mov -0xc(%ebp),%eax
801033d0: 83 c0 10 add $0x10,%eax
801033d3: 8b 0c 85 cc 22 11 80 mov -0x7feedd34(,%eax,4),%ecx
801033da: 8b 45 ec mov -0x14(%ebp),%eax
801033dd: 8b 55 f4 mov -0xc(%ebp),%edx
801033e0: 89 4c 90 04 mov %ecx,0x4(%eax,%edx,4)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
for (i = 0; i < log.lh.n; i++) {
801033e4: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801033e8: a1 08 23 11 80 mov 0x80112308,%eax
801033ed: 3b 45 f4 cmp -0xc(%ebp),%eax
801033f0: 7f db jg 801033cd <write_head+0x3e>
hb->sector[i] = log.lh.sector[i];
}
bwrite(buf);
801033f2: 8b 45 f0 mov -0x10(%ebp),%eax
801033f5: 89 04 24 mov %eax,(%esp)
801033f8: e8 e0 cd ff ff call 801001dd <bwrite>
brelse(buf);
801033fd: 8b 45 f0 mov -0x10(%ebp),%eax
80103400: 89 04 24 mov %eax,(%esp)
80103403: e8 0f ce ff ff call 80100217 <brelse>
}
80103408: c9 leave
80103409: c3 ret
8010340a <recover_from_log>:
static void
recover_from_log(void)
{
8010340a: 55 push %ebp
8010340b: 89 e5 mov %esp,%ebp
8010340d: 83 ec 08 sub $0x8,%esp
read_head();
80103410: e8 0b ff ff ff call 80103320 <read_head>
install_trans(); // if committed, copy from log to disk
80103415: e8 58 fe ff ff call 80103272 <install_trans>
log.lh.n = 0;
8010341a: c7 05 08 23 11 80 00 movl $0x0,0x80112308
80103421: 00 00 00
write_head(); // clear the log
80103424: e8 66 ff ff ff call 8010338f <write_head>
}
80103429: c9 leave
8010342a: c3 ret
8010342b <begin_op>:
// called at the start of each FS system call.
void
begin_op(void)
{
8010342b: 55 push %ebp
8010342c: 89 e5 mov %esp,%ebp
8010342e: 83 ec 18 sub $0x18,%esp
acquire(&log.lock);
80103431: c7 04 24 c0 22 11 80 movl $0x801122c0,(%esp)
80103438: e8 b0 19 00 00 call 80104ded <acquire>
while(1){
if(log.committing){
8010343d: a1 00 23 11 80 mov 0x80112300,%eax
80103442: 85 c0 test %eax,%eax
80103444: 74 16 je 8010345c <begin_op+0x31>
sleep(&log, &log.lock);
80103446: c7 44 24 04 c0 22 11 movl $0x801122c0,0x4(%esp)
8010344d: 80
8010344e: c7 04 24 c0 22 11 80 movl $0x801122c0,(%esp)
80103455: e8 c9 16 00 00 call 80104b23 <sleep>
8010345a: eb 4f jmp 801034ab <begin_op+0x80>
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
8010345c: 8b 0d 08 23 11 80 mov 0x80112308,%ecx
80103462: a1 fc 22 11 80 mov 0x801122fc,%eax
80103467: 8d 50 01 lea 0x1(%eax),%edx
8010346a: 89 d0 mov %edx,%eax
8010346c: c1 e0 02 shl $0x2,%eax
8010346f: 01 d0 add %edx,%eax
80103471: 01 c0 add %eax,%eax
80103473: 01 c8 add %ecx,%eax
80103475: 83 f8 1e cmp $0x1e,%eax
80103478: 7e 16 jle 80103490 <begin_op+0x65>
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
8010347a: c7 44 24 04 c0 22 11 movl $0x801122c0,0x4(%esp)
80103481: 80
80103482: c7 04 24 c0 22 11 80 movl $0x801122c0,(%esp)
80103489: e8 95 16 00 00 call 80104b23 <sleep>
8010348e: eb 1b jmp 801034ab <begin_op+0x80>
} else {
log.outstanding += 1;
80103490: a1 fc 22 11 80 mov 0x801122fc,%eax
80103495: 83 c0 01 add $0x1,%eax
80103498: a3 fc 22 11 80 mov %eax,0x801122fc
release(&log.lock);
8010349d: c7 04 24 c0 22 11 80 movl $0x801122c0,(%esp)
801034a4: e8 a6 19 00 00 call 80104e4f <release>
break;
801034a9: eb 02 jmp 801034ad <begin_op+0x82>
}
}
801034ab: eb 90 jmp 8010343d <begin_op+0x12>
}
801034ad: c9 leave
801034ae: c3 ret
801034af <end_op>:
// called at the end of each FS system call.
// commits if this was the last outstanding operation.
void
end_op(void)
{
801034af: 55 push %ebp
801034b0: 89 e5 mov %esp,%ebp
801034b2: 83 ec 28 sub $0x28,%esp
int do_commit = 0;
801034b5: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
acquire(&log.lock);
801034bc: c7 04 24 c0 22 11 80 movl $0x801122c0,(%esp)
801034c3: e8 25 19 00 00 call 80104ded <acquire>
log.outstanding -= 1;
801034c8: a1 fc 22 11 80 mov 0x801122fc,%eax
801034cd: 83 e8 01 sub $0x1,%eax
801034d0: a3 fc 22 11 80 mov %eax,0x801122fc
if(log.committing)
801034d5: a1 00 23 11 80 mov 0x80112300,%eax
801034da: 85 c0 test %eax,%eax
801034dc: 74 0c je 801034ea <end_op+0x3b>
panic("log.committing");
801034de: c7 04 24 fc 85 10 80 movl $0x801085fc,(%esp)
801034e5: e8 50 d0 ff ff call 8010053a <panic>
if(log.outstanding == 0){
801034ea: a1 fc 22 11 80 mov 0x801122fc,%eax
801034ef: 85 c0 test %eax,%eax
801034f1: 75 13 jne 80103506 <end_op+0x57>
do_commit = 1;
801034f3: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
log.committing = 1;
801034fa: c7 05 00 23 11 80 01 movl $0x1,0x80112300
80103501: 00 00 00
80103504: eb 0c jmp 80103512 <end_op+0x63>
} else {
// begin_op() may be waiting for log space.
wakeup(&log);
80103506: c7 04 24 c0 22 11 80 movl $0x801122c0,(%esp)
8010350d: e8 ea 16 00 00 call 80104bfc <wakeup>
}
release(&log.lock);
80103512: c7 04 24 c0 22 11 80 movl $0x801122c0,(%esp)
80103519: e8 31 19 00 00 call 80104e4f <release>
if(do_commit){
8010351e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80103522: 74 33 je 80103557 <end_op+0xa8>
// call commit w/o holding locks, since not allowed
// to sleep with locks.
commit();
80103524: e8 de 00 00 00 call 80103607 <commit>
acquire(&log.lock);
80103529: c7 04 24 c0 22 11 80 movl $0x801122c0,(%esp)
80103530: e8 b8 18 00 00 call 80104ded <acquire>
log.committing = 0;
80103535: c7 05 00 23 11 80 00 movl $0x0,0x80112300
8010353c: 00 00 00
wakeup(&log);
8010353f: c7 04 24 c0 22 11 80 movl $0x801122c0,(%esp)
80103546: e8 b1 16 00 00 call 80104bfc <wakeup>
release(&log.lock);
8010354b: c7 04 24 c0 22 11 80 movl $0x801122c0,(%esp)
80103552: e8 f8 18 00 00 call 80104e4f <release>
}
}
80103557: c9 leave
80103558: c3 ret
80103559 <write_log>:
// Copy modified blocks from cache to log.
static void
write_log(void)
{
80103559: 55 push %ebp
8010355a: 89 e5 mov %esp,%ebp
8010355c: 83 ec 28 sub $0x28,%esp
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
8010355f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103566: e9 8c 00 00 00 jmp 801035f7 <write_log+0x9e>
struct buf *to = bread(log.dev, log.start+tail+1); // log block
8010356b: 8b 15 f4 22 11 80 mov 0x801122f4,%edx
80103571: 8b 45 f4 mov -0xc(%ebp),%eax
80103574: 01 d0 add %edx,%eax
80103576: 83 c0 01 add $0x1,%eax
80103579: 89 c2 mov %eax,%edx
8010357b: a1 04 23 11 80 mov 0x80112304,%eax
80103580: 89 54 24 04 mov %edx,0x4(%esp)
80103584: 89 04 24 mov %eax,(%esp)
80103587: e8 1a cc ff ff call 801001a6 <bread>
8010358c: 89 45 f0 mov %eax,-0x10(%ebp)
struct buf *from = bread(log.dev, log.lh.sector[tail]); // cache block
8010358f: 8b 45 f4 mov -0xc(%ebp),%eax
80103592: 83 c0 10 add $0x10,%eax
80103595: 8b 04 85 cc 22 11 80 mov -0x7feedd34(,%eax,4),%eax
8010359c: 89 c2 mov %eax,%edx
8010359e: a1 04 23 11 80 mov 0x80112304,%eax
801035a3: 89 54 24 04 mov %edx,0x4(%esp)
801035a7: 89 04 24 mov %eax,(%esp)
801035aa: e8 f7 cb ff ff call 801001a6 <bread>
801035af: 89 45 ec mov %eax,-0x14(%ebp)
memmove(to->data, from->data, BSIZE);
801035b2: 8b 45 ec mov -0x14(%ebp),%eax
801035b5: 8d 50 18 lea 0x18(%eax),%edx
801035b8: 8b 45 f0 mov -0x10(%ebp),%eax
801035bb: 83 c0 18 add $0x18,%eax
801035be: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
801035c5: 00
801035c6: 89 54 24 04 mov %edx,0x4(%esp)
801035ca: 89 04 24 mov %eax,(%esp)
801035cd: e8 3e 1b 00 00 call 80105110 <memmove>
bwrite(to); // write the log
801035d2: 8b 45 f0 mov -0x10(%ebp),%eax
801035d5: 89 04 24 mov %eax,(%esp)
801035d8: e8 00 cc ff ff call 801001dd <bwrite>
brelse(from);
801035dd: 8b 45 ec mov -0x14(%ebp),%eax
801035e0: 89 04 24 mov %eax,(%esp)
801035e3: e8 2f cc ff ff call 80100217 <brelse>
brelse(to);
801035e8: 8b 45 f0 mov -0x10(%ebp),%eax
801035eb: 89 04 24 mov %eax,(%esp)
801035ee: e8 24 cc ff ff call 80100217 <brelse>
static void
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
801035f3: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801035f7: a1 08 23 11 80 mov 0x80112308,%eax
801035fc: 3b 45 f4 cmp -0xc(%ebp),%eax
801035ff: 0f 8f 66 ff ff ff jg 8010356b <write_log+0x12>
memmove(to->data, from->data, BSIZE);
bwrite(to); // write the log
brelse(from);
brelse(to);
}
}
80103605: c9 leave
80103606: c3 ret
80103607 <commit>:
static void
commit()
{
80103607: 55 push %ebp
80103608: 89 e5 mov %esp,%ebp
8010360a: 83 ec 08 sub $0x8,%esp
if (log.lh.n > 0) {
8010360d: a1 08 23 11 80 mov 0x80112308,%eax
80103612: 85 c0 test %eax,%eax
80103614: 7e 1e jle 80103634 <commit+0x2d>
write_log(); // Write modified blocks from cache to log
80103616: e8 3e ff ff ff call 80103559 <write_log>
write_head(); // Write header to disk -- the real commit
8010361b: e8 6f fd ff ff call 8010338f <write_head>
install_trans(); // Now install writes to home locations
80103620: e8 4d fc ff ff call 80103272 <install_trans>
log.lh.n = 0;
80103625: c7 05 08 23 11 80 00 movl $0x0,0x80112308
8010362c: 00 00 00
write_head(); // Erase the transaction from the log
8010362f: e8 5b fd ff ff call 8010338f <write_head>
}
}
80103634: c9 leave
80103635: c3 ret
80103636 <log_write>:
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80103636: 55 push %ebp
80103637: 89 e5 mov %esp,%ebp
80103639: 83 ec 28 sub $0x28,%esp
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
8010363c: a1 08 23 11 80 mov 0x80112308,%eax
80103641: 83 f8 1d cmp $0x1d,%eax
80103644: 7f 12 jg 80103658 <log_write+0x22>
80103646: a1 08 23 11 80 mov 0x80112308,%eax
8010364b: 8b 15 f8 22 11 80 mov 0x801122f8,%edx
80103651: 83 ea 01 sub $0x1,%edx
80103654: 39 d0 cmp %edx,%eax
80103656: 7c 0c jl 80103664 <log_write+0x2e>
panic("too big a transaction");
80103658: c7 04 24 0b 86 10 80 movl $0x8010860b,(%esp)
8010365f: e8 d6 ce ff ff call 8010053a <panic>
if (log.outstanding < 1)
80103664: a1 fc 22 11 80 mov 0x801122fc,%eax
80103669: 85 c0 test %eax,%eax
8010366b: 7f 0c jg 80103679 <log_write+0x43>
panic("log_write outside of trans");
8010366d: c7 04 24 21 86 10 80 movl $0x80108621,(%esp)
80103674: e8 c1 ce ff ff call 8010053a <panic>
for (i = 0; i < log.lh.n; i++) {
80103679: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103680: eb 1f jmp 801036a1 <log_write+0x6b>
if (log.lh.sector[i] == b->sector) // log absorbtion
80103682: 8b 45 f4 mov -0xc(%ebp),%eax
80103685: 83 c0 10 add $0x10,%eax
80103688: 8b 04 85 cc 22 11 80 mov -0x7feedd34(,%eax,4),%eax
8010368f: 89 c2 mov %eax,%edx
80103691: 8b 45 08 mov 0x8(%ebp),%eax
80103694: 8b 40 08 mov 0x8(%eax),%eax
80103697: 39 c2 cmp %eax,%edx
80103699: 75 02 jne 8010369d <log_write+0x67>
break;
8010369b: eb 0e jmp 801036ab <log_write+0x75>
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
panic("too big a transaction");
if (log.outstanding < 1)
panic("log_write outside of trans");
for (i = 0; i < log.lh.n; i++) {
8010369d: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801036a1: a1 08 23 11 80 mov 0x80112308,%eax
801036a6: 3b 45 f4 cmp -0xc(%ebp),%eax
801036a9: 7f d7 jg 80103682 <log_write+0x4c>
if (log.lh.sector[i] == b->sector) // log absorbtion
break;
}
log.lh.sector[i] = b->sector;
801036ab: 8b 45 08 mov 0x8(%ebp),%eax
801036ae: 8b 40 08 mov 0x8(%eax),%eax
801036b1: 8b 55 f4 mov -0xc(%ebp),%edx
801036b4: 83 c2 10 add $0x10,%edx
801036b7: 89 04 95 cc 22 11 80 mov %eax,-0x7feedd34(,%edx,4)
if (i == log.lh.n)
801036be: a1 08 23 11 80 mov 0x80112308,%eax
801036c3: 3b 45 f4 cmp -0xc(%ebp),%eax
801036c6: 75 0d jne 801036d5 <log_write+0x9f>
log.lh.n++;
801036c8: a1 08 23 11 80 mov 0x80112308,%eax
801036cd: 83 c0 01 add $0x1,%eax
801036d0: a3 08 23 11 80 mov %eax,0x80112308
b->flags |= B_DIRTY; // prevent eviction
801036d5: 8b 45 08 mov 0x8(%ebp),%eax
801036d8: 8b 00 mov (%eax),%eax
801036da: 83 c8 04 or $0x4,%eax
801036dd: 89 c2 mov %eax,%edx
801036df: 8b 45 08 mov 0x8(%ebp),%eax
801036e2: 89 10 mov %edx,(%eax)
}
801036e4: c9 leave
801036e5: c3 ret
801036e6 <v2p>:
801036e6: 55 push %ebp
801036e7: 89 e5 mov %esp,%ebp
801036e9: 8b 45 08 mov 0x8(%ebp),%eax
801036ec: 05 00 00 00 80 add $0x80000000,%eax
801036f1: 5d pop %ebp
801036f2: c3 ret
801036f3 <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
801036f3: 55 push %ebp
801036f4: 89 e5 mov %esp,%ebp
801036f6: 8b 45 08 mov 0x8(%ebp),%eax
801036f9: 05 00 00 00 80 add $0x80000000,%eax
801036fe: 5d pop %ebp
801036ff: c3 ret
80103700 <xchg>:
asm volatile("sti");
}
static inline uint
xchg(volatile uint *addr, uint newval)
{
80103700: 55 push %ebp
80103701: 89 e5 mov %esp,%ebp
80103703: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
80103706: 8b 55 08 mov 0x8(%ebp),%edx
80103709: 8b 45 0c mov 0xc(%ebp),%eax
8010370c: 8b 4d 08 mov 0x8(%ebp),%ecx
8010370f: f0 87 02 lock xchg %eax,(%edx)
80103712: 89 45 fc mov %eax,-0x4(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
80103715: 8b 45 fc mov -0x4(%ebp),%eax
}
80103718: c9 leave
80103719: c3 ret
8010371a <main>:
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
8010371a: 55 push %ebp
8010371b: 89 e5 mov %esp,%ebp
8010371d: 83 e4 f0 and $0xfffffff0,%esp
80103720: 83 ec 10 sub $0x10,%esp
kinit1(end, P2V(4*1024*1024)); // phys page allocator
80103723: c7 44 24 04 00 00 40 movl $0x80400000,0x4(%esp)
8010372a: 80
8010372b: c7 04 24 9c 51 11 80 movl $0x8011519c,(%esp)
80103732: e8 98 f2 ff ff call 801029cf <kinit1>
kvmalloc(); // kernel page table
80103737: e8 03 45 00 00 call 80107c3f <kvmalloc>
mpinit(); // collect info about this machine
8010373c: e8 46 04 00 00 call 80103b87 <mpinit>
lapicinit();
80103741: e8 f4 f5 ff ff call 80102d3a <lapicinit>
seginit(); // set up segments
80103746: e8 87 3e 00 00 call 801075d2 <seginit>
cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
8010374b: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80103751: 0f b6 00 movzbl (%eax),%eax
80103754: 0f b6 c0 movzbl %al,%eax
80103757: 89 44 24 04 mov %eax,0x4(%esp)
8010375b: c7 04 24 3c 86 10 80 movl $0x8010863c,(%esp)
80103762: e8 39 cc ff ff call 801003a0 <cprintf>
picinit(); // interrupt controller
80103767: e8 79 06 00 00 call 80103de5 <picinit>
ioapicinit(); // another interrupt controller
8010376c: e8 54 f1 ff ff call 801028c5 <ioapicinit>
consoleinit(); // I/O devices & their interrupts
80103771: e8 0b d3 ff ff call 80100a81 <consoleinit>
uartinit(); // serial port
80103776: e8 a6 31 00 00 call 80106921 <uartinit>
pinit(); // process table
8010377b: e8 6f 0b 00 00 call 801042ef <pinit>
tvinit(); // trap vectors
80103780: e8 4e 2d 00 00 call 801064d3 <tvinit>
binit(); // buffer cache
80103785: e8 aa c8 ff ff call 80100034 <binit>
fileinit(); // file table
8010378a: e8 87 d7 ff ff call 80100f16 <fileinit>
iinit(); // inode cache
8010378f: e8 2b de ff ff call 801015bf <iinit>
ideinit(); // disk
80103794: e8 95 ed ff ff call 8010252e <ideinit>
if(!ismp)
80103799: a1 a4 23 11 80 mov 0x801123a4,%eax
8010379e: 85 c0 test %eax,%eax
801037a0: 75 05 jne 801037a7 <main+0x8d>
timerinit(); // uniprocessor timer
801037a2: e8 77 2c 00 00 call 8010641e <timerinit>
startothers(); // start other processors
801037a7: e8 7f 00 00 00 call 8010382b <startothers>
kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
801037ac: c7 44 24 04 00 00 00 movl $0x8e000000,0x4(%esp)
801037b3: 8e
801037b4: c7 04 24 00 00 40 80 movl $0x80400000,(%esp)
801037bb: e8 47 f2 ff ff call 80102a07 <kinit2>
userinit(); // first user process
801037c0: e8 45 0c 00 00 call 8010440a <userinit>
// Finish setting up this processor in mpmain.
mpmain();
801037c5: e8 1a 00 00 00 call 801037e4 <mpmain>
801037ca <mpenter>:
}
// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
801037ca: 55 push %ebp
801037cb: 89 e5 mov %esp,%ebp
801037cd: 83 ec 08 sub $0x8,%esp
switchkvm();
801037d0: e8 81 44 00 00 call 80107c56 <switchkvm>
seginit();
801037d5: e8 f8 3d 00 00 call 801075d2 <seginit>
lapicinit();
801037da: e8 5b f5 ff ff call 80102d3a <lapicinit>
mpmain();
801037df: e8 00 00 00 00 call 801037e4 <mpmain>
801037e4 <mpmain>:
}
// Common CPU setup code.
static void
mpmain(void)
{
801037e4: 55 push %ebp
801037e5: 89 e5 mov %esp,%ebp
801037e7: 83 ec 18 sub $0x18,%esp
cprintf("cpu%d: starting\n", cpu->id);
801037ea: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801037f0: 0f b6 00 movzbl (%eax),%eax
801037f3: 0f b6 c0 movzbl %al,%eax
801037f6: 89 44 24 04 mov %eax,0x4(%esp)
801037fa: c7 04 24 53 86 10 80 movl $0x80108653,(%esp)
80103801: e8 9a cb ff ff call 801003a0 <cprintf>
idtinit(); // load idt register
80103806: e8 3c 2e 00 00 call 80106647 <idtinit>
xchg(&cpu->started, 1); // tell startothers() we're up
8010380b: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80103811: 05 a8 00 00 00 add $0xa8,%eax
80103816: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
8010381d: 00
8010381e: 89 04 24 mov %eax,(%esp)
80103821: e8 da fe ff ff call 80103700 <xchg>
scheduler(); // start running processes
80103826: e8 50 11 00 00 call 8010497b <scheduler>
8010382b <startothers>:
pde_t entrypgdir[]; // For entry.S
// Start the non-boot (AP) processors.
static void
startothers(void)
{
8010382b: 55 push %ebp
8010382c: 89 e5 mov %esp,%ebp
8010382e: 53 push %ebx
8010382f: 83 ec 24 sub $0x24,%esp
char *stack;
// Write entry code to unused memory at 0x7000.
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = p2v(0x7000);
80103832: c7 04 24 00 70 00 00 movl $0x7000,(%esp)
80103839: e8 b5 fe ff ff call 801036f3 <p2v>
8010383e: 89 45 f0 mov %eax,-0x10(%ebp)
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
80103841: b8 8a 00 00 00 mov $0x8a,%eax
80103846: 89 44 24 08 mov %eax,0x8(%esp)
8010384a: c7 44 24 04 6c b5 10 movl $0x8010b56c,0x4(%esp)
80103851: 80
80103852: 8b 45 f0 mov -0x10(%ebp),%eax
80103855: 89 04 24 mov %eax,(%esp)
80103858: e8 b3 18 00 00 call 80105110 <memmove>
for(c = cpus; c < cpus+ncpu; c++){
8010385d: c7 45 f4 c0 23 11 80 movl $0x801123c0,-0xc(%ebp)
80103864: e9 85 00 00 00 jmp 801038ee <startothers+0xc3>
if(c == cpus+cpunum()) // We've started already.
80103869: e8 25 f6 ff ff call 80102e93 <cpunum>
8010386e: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80103874: 05 c0 23 11 80 add $0x801123c0,%eax
80103879: 3b 45 f4 cmp -0xc(%ebp),%eax
8010387c: 75 02 jne 80103880 <startothers+0x55>
continue;
8010387e: eb 67 jmp 801038e7 <startothers+0xbc>
// 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();
80103880: e8 78 f2 ff ff call 80102afd <kalloc>
80103885: 89 45 ec mov %eax,-0x14(%ebp)
*(void**)(code-4) = stack + KSTACKSIZE;
80103888: 8b 45 f0 mov -0x10(%ebp),%eax
8010388b: 83 e8 04 sub $0x4,%eax
8010388e: 8b 55 ec mov -0x14(%ebp),%edx
80103891: 81 c2 00 10 00 00 add $0x1000,%edx
80103897: 89 10 mov %edx,(%eax)
*(void**)(code-8) = mpenter;
80103899: 8b 45 f0 mov -0x10(%ebp),%eax
8010389c: 83 e8 08 sub $0x8,%eax
8010389f: c7 00 ca 37 10 80 movl $0x801037ca,(%eax)
*(int**)(code-12) = (void *) v2p(entrypgdir);
801038a5: 8b 45 f0 mov -0x10(%ebp),%eax
801038a8: 8d 58 f4 lea -0xc(%eax),%ebx
801038ab: c7 04 24 00 a0 10 80 movl $0x8010a000,(%esp)
801038b2: e8 2f fe ff ff call 801036e6 <v2p>
801038b7: 89 03 mov %eax,(%ebx)
lapicstartap(c->id, v2p(code));
801038b9: 8b 45 f0 mov -0x10(%ebp),%eax
801038bc: 89 04 24 mov %eax,(%esp)
801038bf: e8 22 fe ff ff call 801036e6 <v2p>
801038c4: 8b 55 f4 mov -0xc(%ebp),%edx
801038c7: 0f b6 12 movzbl (%edx),%edx
801038ca: 0f b6 d2 movzbl %dl,%edx
801038cd: 89 44 24 04 mov %eax,0x4(%esp)
801038d1: 89 14 24 mov %edx,(%esp)
801038d4: e8 3c f6 ff ff call 80102f15 <lapicstartap>
// wait for cpu to finish mpmain()
while(c->started == 0)
801038d9: 90 nop
801038da: 8b 45 f4 mov -0xc(%ebp),%eax
801038dd: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax
801038e3: 85 c0 test %eax,%eax
801038e5: 74 f3 je 801038da <startothers+0xaf>
// 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);
for(c = cpus; c < cpus+ncpu; c++){
801038e7: 81 45 f4 bc 00 00 00 addl $0xbc,-0xc(%ebp)
801038ee: a1 a0 29 11 80 mov 0x801129a0,%eax
801038f3: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
801038f9: 05 c0 23 11 80 add $0x801123c0,%eax
801038fe: 3b 45 f4 cmp -0xc(%ebp),%eax
80103901: 0f 87 62 ff ff ff ja 80103869 <startothers+0x3e>
// wait for cpu to finish mpmain()
while(c->started == 0)
;
}
}
80103907: 83 c4 24 add $0x24,%esp
8010390a: 5b pop %ebx
8010390b: 5d pop %ebp
8010390c: c3 ret
8010390d <p2v>:
8010390d: 55 push %ebp
8010390e: 89 e5 mov %esp,%ebp
80103910: 8b 45 08 mov 0x8(%ebp),%eax
80103913: 05 00 00 00 80 add $0x80000000,%eax
80103918: 5d pop %ebp
80103919: c3 ret
8010391a <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
8010391a: 55 push %ebp
8010391b: 89 e5 mov %esp,%ebp
8010391d: 83 ec 14 sub $0x14,%esp
80103920: 8b 45 08 mov 0x8(%ebp),%eax
80103923: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80103927: 0f b7 45 ec movzwl -0x14(%ebp),%eax
8010392b: 89 c2 mov %eax,%edx
8010392d: ec in (%dx),%al
8010392e: 88 45 ff mov %al,-0x1(%ebp)
return data;
80103931: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
80103935: c9 leave
80103936: c3 ret
80103937 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80103937: 55 push %ebp
80103938: 89 e5 mov %esp,%ebp
8010393a: 83 ec 08 sub $0x8,%esp
8010393d: 8b 55 08 mov 0x8(%ebp),%edx
80103940: 8b 45 0c mov 0xc(%ebp),%eax
80103943: 66 89 55 fc mov %dx,-0x4(%ebp)
80103947: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010394a: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
8010394e: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80103952: ee out %al,(%dx)
}
80103953: c9 leave
80103954: c3 ret
80103955 <mpbcpu>:
int ncpu;
uchar ioapicid;
int
mpbcpu(void)
{
80103955: 55 push %ebp
80103956: 89 e5 mov %esp,%ebp
return bcpu-cpus;
80103958: a1 a4 b6 10 80 mov 0x8010b6a4,%eax
8010395d: 89 c2 mov %eax,%edx
8010395f: b8 c0 23 11 80 mov $0x801123c0,%eax
80103964: 29 c2 sub %eax,%edx
80103966: 89 d0 mov %edx,%eax
80103968: c1 f8 02 sar $0x2,%eax
8010396b: 69 c0 cf 46 7d 67 imul $0x677d46cf,%eax,%eax
}
80103971: 5d pop %ebp
80103972: c3 ret
80103973 <sum>:
static uchar
sum(uchar *addr, int len)
{
80103973: 55 push %ebp
80103974: 89 e5 mov %esp,%ebp
80103976: 83 ec 10 sub $0x10,%esp
int i, sum;
sum = 0;
80103979: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp)
for(i=0; i<len; i++)
80103980: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
80103987: eb 15 jmp 8010399e <sum+0x2b>
sum += addr[i];
80103989: 8b 55 fc mov -0x4(%ebp),%edx
8010398c: 8b 45 08 mov 0x8(%ebp),%eax
8010398f: 01 d0 add %edx,%eax
80103991: 0f b6 00 movzbl (%eax),%eax
80103994: 0f b6 c0 movzbl %al,%eax
80103997: 01 45 f8 add %eax,-0x8(%ebp)
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
8010399a: 83 45 fc 01 addl $0x1,-0x4(%ebp)
8010399e: 8b 45 fc mov -0x4(%ebp),%eax
801039a1: 3b 45 0c cmp 0xc(%ebp),%eax
801039a4: 7c e3 jl 80103989 <sum+0x16>
sum += addr[i];
return sum;
801039a6: 8b 45 f8 mov -0x8(%ebp),%eax
}
801039a9: c9 leave
801039aa: c3 ret
801039ab <mpsearch1>:
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
801039ab: 55 push %ebp
801039ac: 89 e5 mov %esp,%ebp
801039ae: 83 ec 28 sub $0x28,%esp
uchar *e, *p, *addr;
addr = p2v(a);
801039b1: 8b 45 08 mov 0x8(%ebp),%eax
801039b4: 89 04 24 mov %eax,(%esp)
801039b7: e8 51 ff ff ff call 8010390d <p2v>
801039bc: 89 45 f0 mov %eax,-0x10(%ebp)
e = addr+len;
801039bf: 8b 55 0c mov 0xc(%ebp),%edx
801039c2: 8b 45 f0 mov -0x10(%ebp),%eax
801039c5: 01 d0 add %edx,%eax
801039c7: 89 45 ec mov %eax,-0x14(%ebp)
for(p = addr; p < e; p += sizeof(struct mp))
801039ca: 8b 45 f0 mov -0x10(%ebp),%eax
801039cd: 89 45 f4 mov %eax,-0xc(%ebp)
801039d0: eb 3f jmp 80103a11 <mpsearch1+0x66>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
801039d2: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp)
801039d9: 00
801039da: c7 44 24 04 64 86 10 movl $0x80108664,0x4(%esp)
801039e1: 80
801039e2: 8b 45 f4 mov -0xc(%ebp),%eax
801039e5: 89 04 24 mov %eax,(%esp)
801039e8: e8 cb 16 00 00 call 801050b8 <memcmp>
801039ed: 85 c0 test %eax,%eax
801039ef: 75 1c jne 80103a0d <mpsearch1+0x62>
801039f1: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp)
801039f8: 00
801039f9: 8b 45 f4 mov -0xc(%ebp),%eax
801039fc: 89 04 24 mov %eax,(%esp)
801039ff: e8 6f ff ff ff call 80103973 <sum>
80103a04: 84 c0 test %al,%al
80103a06: 75 05 jne 80103a0d <mpsearch1+0x62>
return (struct mp*)p;
80103a08: 8b 45 f4 mov -0xc(%ebp),%eax
80103a0b: eb 11 jmp 80103a1e <mpsearch1+0x73>
{
uchar *e, *p, *addr;
addr = p2v(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
80103a0d: 83 45 f4 10 addl $0x10,-0xc(%ebp)
80103a11: 8b 45 f4 mov -0xc(%ebp),%eax
80103a14: 3b 45 ec cmp -0x14(%ebp),%eax
80103a17: 72 b9 jb 801039d2 <mpsearch1+0x27>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
return (struct mp*)p;
return 0;
80103a19: b8 00 00 00 00 mov $0x0,%eax
}
80103a1e: c9 leave
80103a1f: c3 ret
80103a20 <mpsearch>:
// 1) in the first KB of the EBDA;
// 2) in the last KB of system base memory;
// 3) in the BIOS ROM between 0xE0000 and 0xFFFFF.
static struct mp*
mpsearch(void)
{
80103a20: 55 push %ebp
80103a21: 89 e5 mov %esp,%ebp
80103a23: 83 ec 28 sub $0x28,%esp
uchar *bda;
uint p;
struct mp *mp;
bda = (uchar *) P2V(0x400);
80103a26: c7 45 f4 00 04 00 80 movl $0x80000400,-0xc(%ebp)
if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
80103a2d: 8b 45 f4 mov -0xc(%ebp),%eax
80103a30: 83 c0 0f add $0xf,%eax
80103a33: 0f b6 00 movzbl (%eax),%eax
80103a36: 0f b6 c0 movzbl %al,%eax
80103a39: c1 e0 08 shl $0x8,%eax
80103a3c: 89 c2 mov %eax,%edx
80103a3e: 8b 45 f4 mov -0xc(%ebp),%eax
80103a41: 83 c0 0e add $0xe,%eax
80103a44: 0f b6 00 movzbl (%eax),%eax
80103a47: 0f b6 c0 movzbl %al,%eax
80103a4a: 09 d0 or %edx,%eax
80103a4c: c1 e0 04 shl $0x4,%eax
80103a4f: 89 45 f0 mov %eax,-0x10(%ebp)
80103a52: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80103a56: 74 21 je 80103a79 <mpsearch+0x59>
if((mp = mpsearch1(p, 1024)))
80103a58: c7 44 24 04 00 04 00 movl $0x400,0x4(%esp)
80103a5f: 00
80103a60: 8b 45 f0 mov -0x10(%ebp),%eax
80103a63: 89 04 24 mov %eax,(%esp)
80103a66: e8 40 ff ff ff call 801039ab <mpsearch1>
80103a6b: 89 45 ec mov %eax,-0x14(%ebp)
80103a6e: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80103a72: 74 50 je 80103ac4 <mpsearch+0xa4>
return mp;
80103a74: 8b 45 ec mov -0x14(%ebp),%eax
80103a77: eb 5f jmp 80103ad8 <mpsearch+0xb8>
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
80103a79: 8b 45 f4 mov -0xc(%ebp),%eax
80103a7c: 83 c0 14 add $0x14,%eax
80103a7f: 0f b6 00 movzbl (%eax),%eax
80103a82: 0f b6 c0 movzbl %al,%eax
80103a85: c1 e0 08 shl $0x8,%eax
80103a88: 89 c2 mov %eax,%edx
80103a8a: 8b 45 f4 mov -0xc(%ebp),%eax
80103a8d: 83 c0 13 add $0x13,%eax
80103a90: 0f b6 00 movzbl (%eax),%eax
80103a93: 0f b6 c0 movzbl %al,%eax
80103a96: 09 d0 or %edx,%eax
80103a98: c1 e0 0a shl $0xa,%eax
80103a9b: 89 45 f0 mov %eax,-0x10(%ebp)
if((mp = mpsearch1(p-1024, 1024)))
80103a9e: 8b 45 f0 mov -0x10(%ebp),%eax
80103aa1: 2d 00 04 00 00 sub $0x400,%eax
80103aa6: c7 44 24 04 00 04 00 movl $0x400,0x4(%esp)
80103aad: 00
80103aae: 89 04 24 mov %eax,(%esp)
80103ab1: e8 f5 fe ff ff call 801039ab <mpsearch1>
80103ab6: 89 45 ec mov %eax,-0x14(%ebp)
80103ab9: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80103abd: 74 05 je 80103ac4 <mpsearch+0xa4>
return mp;
80103abf: 8b 45 ec mov -0x14(%ebp),%eax
80103ac2: eb 14 jmp 80103ad8 <mpsearch+0xb8>
}
return mpsearch1(0xF0000, 0x10000);
80103ac4: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80103acb: 00
80103acc: c7 04 24 00 00 0f 00 movl $0xf0000,(%esp)
80103ad3: e8 d3 fe ff ff call 801039ab <mpsearch1>
}
80103ad8: c9 leave
80103ad9: c3 ret
80103ada <mpconfig>:
// Check for correct signature, calculate the checksum and,
// if correct, check the version.
// To do: check extended table checksum.
static struct mpconf*
mpconfig(struct mp **pmp)
{
80103ada: 55 push %ebp
80103adb: 89 e5 mov %esp,%ebp
80103add: 83 ec 28 sub $0x28,%esp
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103ae0: e8 3b ff ff ff call 80103a20 <mpsearch>
80103ae5: 89 45 f4 mov %eax,-0xc(%ebp)
80103ae8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80103aec: 74 0a je 80103af8 <mpconfig+0x1e>
80103aee: 8b 45 f4 mov -0xc(%ebp),%eax
80103af1: 8b 40 04 mov 0x4(%eax),%eax
80103af4: 85 c0 test %eax,%eax
80103af6: 75 0a jne 80103b02 <mpconfig+0x28>
return 0;
80103af8: b8 00 00 00 00 mov $0x0,%eax
80103afd: e9 83 00 00 00 jmp 80103b85 <mpconfig+0xab>
conf = (struct mpconf*) p2v((uint) mp->physaddr);
80103b02: 8b 45 f4 mov -0xc(%ebp),%eax
80103b05: 8b 40 04 mov 0x4(%eax),%eax
80103b08: 89 04 24 mov %eax,(%esp)
80103b0b: e8 fd fd ff ff call 8010390d <p2v>
80103b10: 89 45 f0 mov %eax,-0x10(%ebp)
if(memcmp(conf, "PCMP", 4) != 0)
80103b13: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp)
80103b1a: 00
80103b1b: c7 44 24 04 69 86 10 movl $0x80108669,0x4(%esp)
80103b22: 80
80103b23: 8b 45 f0 mov -0x10(%ebp),%eax
80103b26: 89 04 24 mov %eax,(%esp)
80103b29: e8 8a 15 00 00 call 801050b8 <memcmp>
80103b2e: 85 c0 test %eax,%eax
80103b30: 74 07 je 80103b39 <mpconfig+0x5f>
return 0;
80103b32: b8 00 00 00 00 mov $0x0,%eax
80103b37: eb 4c jmp 80103b85 <mpconfig+0xab>
if(conf->version != 1 && conf->version != 4)
80103b39: 8b 45 f0 mov -0x10(%ebp),%eax
80103b3c: 0f b6 40 06 movzbl 0x6(%eax),%eax
80103b40: 3c 01 cmp $0x1,%al
80103b42: 74 12 je 80103b56 <mpconfig+0x7c>
80103b44: 8b 45 f0 mov -0x10(%ebp),%eax
80103b47: 0f b6 40 06 movzbl 0x6(%eax),%eax
80103b4b: 3c 04 cmp $0x4,%al
80103b4d: 74 07 je 80103b56 <mpconfig+0x7c>
return 0;
80103b4f: b8 00 00 00 00 mov $0x0,%eax
80103b54: eb 2f jmp 80103b85 <mpconfig+0xab>
if(sum((uchar*)conf, conf->length) != 0)
80103b56: 8b 45 f0 mov -0x10(%ebp),%eax
80103b59: 0f b7 40 04 movzwl 0x4(%eax),%eax
80103b5d: 0f b7 c0 movzwl %ax,%eax
80103b60: 89 44 24 04 mov %eax,0x4(%esp)
80103b64: 8b 45 f0 mov -0x10(%ebp),%eax
80103b67: 89 04 24 mov %eax,(%esp)
80103b6a: e8 04 fe ff ff call 80103973 <sum>
80103b6f: 84 c0 test %al,%al
80103b71: 74 07 je 80103b7a <mpconfig+0xa0>
return 0;
80103b73: b8 00 00 00 00 mov $0x0,%eax
80103b78: eb 0b jmp 80103b85 <mpconfig+0xab>
*pmp = mp;
80103b7a: 8b 45 08 mov 0x8(%ebp),%eax
80103b7d: 8b 55 f4 mov -0xc(%ebp),%edx
80103b80: 89 10 mov %edx,(%eax)
return conf;
80103b82: 8b 45 f0 mov -0x10(%ebp),%eax
}
80103b85: c9 leave
80103b86: c3 ret
80103b87 <mpinit>:
void
mpinit(void)
{
80103b87: 55 push %ebp
80103b88: 89 e5 mov %esp,%ebp
80103b8a: 83 ec 38 sub $0x38,%esp
struct mp *mp;
struct mpconf *conf;
struct mpproc *proc;
struct mpioapic *ioapic;
bcpu = &cpus[0];
80103b8d: c7 05 a4 b6 10 80 c0 movl $0x801123c0,0x8010b6a4
80103b94: 23 11 80
if((conf = mpconfig(&mp)) == 0)
80103b97: 8d 45 e0 lea -0x20(%ebp),%eax
80103b9a: 89 04 24 mov %eax,(%esp)
80103b9d: e8 38 ff ff ff call 80103ada <mpconfig>
80103ba2: 89 45 f0 mov %eax,-0x10(%ebp)
80103ba5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80103ba9: 75 05 jne 80103bb0 <mpinit+0x29>
return;
80103bab: e9 9c 01 00 00 jmp 80103d4c <mpinit+0x1c5>
ismp = 1;
80103bb0: c7 05 a4 23 11 80 01 movl $0x1,0x801123a4
80103bb7: 00 00 00
lapic = (uint*)conf->lapicaddr;
80103bba: 8b 45 f0 mov -0x10(%ebp),%eax
80103bbd: 8b 40 24 mov 0x24(%eax),%eax
80103bc0: a3 bc 22 11 80 mov %eax,0x801122bc
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103bc5: 8b 45 f0 mov -0x10(%ebp),%eax
80103bc8: 83 c0 2c add $0x2c,%eax
80103bcb: 89 45 f4 mov %eax,-0xc(%ebp)
80103bce: 8b 45 f0 mov -0x10(%ebp),%eax
80103bd1: 0f b7 40 04 movzwl 0x4(%eax),%eax
80103bd5: 0f b7 d0 movzwl %ax,%edx
80103bd8: 8b 45 f0 mov -0x10(%ebp),%eax
80103bdb: 01 d0 add %edx,%eax
80103bdd: 89 45 ec mov %eax,-0x14(%ebp)
80103be0: e9 f4 00 00 00 jmp 80103cd9 <mpinit+0x152>
switch(*p){
80103be5: 8b 45 f4 mov -0xc(%ebp),%eax
80103be8: 0f b6 00 movzbl (%eax),%eax
80103beb: 0f b6 c0 movzbl %al,%eax
80103bee: 83 f8 04 cmp $0x4,%eax
80103bf1: 0f 87 bf 00 00 00 ja 80103cb6 <mpinit+0x12f>
80103bf7: 8b 04 85 ac 86 10 80 mov -0x7fef7954(,%eax,4),%eax
80103bfe: ff e0 jmp *%eax
case MPPROC:
proc = (struct mpproc*)p;
80103c00: 8b 45 f4 mov -0xc(%ebp),%eax
80103c03: 89 45 e8 mov %eax,-0x18(%ebp)
if(ncpu != proc->apicid){
80103c06: 8b 45 e8 mov -0x18(%ebp),%eax
80103c09: 0f b6 40 01 movzbl 0x1(%eax),%eax
80103c0d: 0f b6 d0 movzbl %al,%edx
80103c10: a1 a0 29 11 80 mov 0x801129a0,%eax
80103c15: 39 c2 cmp %eax,%edx
80103c17: 74 2d je 80103c46 <mpinit+0xbf>
cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid);
80103c19: 8b 45 e8 mov -0x18(%ebp),%eax
80103c1c: 0f b6 40 01 movzbl 0x1(%eax),%eax
80103c20: 0f b6 d0 movzbl %al,%edx
80103c23: a1 a0 29 11 80 mov 0x801129a0,%eax
80103c28: 89 54 24 08 mov %edx,0x8(%esp)
80103c2c: 89 44 24 04 mov %eax,0x4(%esp)
80103c30: c7 04 24 6e 86 10 80 movl $0x8010866e,(%esp)
80103c37: e8 64 c7 ff ff call 801003a0 <cprintf>
ismp = 0;
80103c3c: c7 05 a4 23 11 80 00 movl $0x0,0x801123a4
80103c43: 00 00 00
}
if(proc->flags & MPBOOT)
80103c46: 8b 45 e8 mov -0x18(%ebp),%eax
80103c49: 0f b6 40 03 movzbl 0x3(%eax),%eax
80103c4d: 0f b6 c0 movzbl %al,%eax
80103c50: 83 e0 02 and $0x2,%eax
80103c53: 85 c0 test %eax,%eax
80103c55: 74 15 je 80103c6c <mpinit+0xe5>
bcpu = &cpus[ncpu];
80103c57: a1 a0 29 11 80 mov 0x801129a0,%eax
80103c5c: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80103c62: 05 c0 23 11 80 add $0x801123c0,%eax
80103c67: a3 a4 b6 10 80 mov %eax,0x8010b6a4
cpus[ncpu].id = ncpu;
80103c6c: 8b 15 a0 29 11 80 mov 0x801129a0,%edx
80103c72: a1 a0 29 11 80 mov 0x801129a0,%eax
80103c77: 69 d2 bc 00 00 00 imul $0xbc,%edx,%edx
80103c7d: 81 c2 c0 23 11 80 add $0x801123c0,%edx
80103c83: 88 02 mov %al,(%edx)
ncpu++;
80103c85: a1 a0 29 11 80 mov 0x801129a0,%eax
80103c8a: 83 c0 01 add $0x1,%eax
80103c8d: a3 a0 29 11 80 mov %eax,0x801129a0
p += sizeof(struct mpproc);
80103c92: 83 45 f4 14 addl $0x14,-0xc(%ebp)
continue;
80103c96: eb 41 jmp 80103cd9 <mpinit+0x152>
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
80103c98: 8b 45 f4 mov -0xc(%ebp),%eax
80103c9b: 89 45 e4 mov %eax,-0x1c(%ebp)
ioapicid = ioapic->apicno;
80103c9e: 8b 45 e4 mov -0x1c(%ebp),%eax
80103ca1: 0f b6 40 01 movzbl 0x1(%eax),%eax
80103ca5: a2 a0 23 11 80 mov %al,0x801123a0
p += sizeof(struct mpioapic);
80103caa: 83 45 f4 08 addl $0x8,-0xc(%ebp)
continue;
80103cae: eb 29 jmp 80103cd9 <mpinit+0x152>
case MPBUS:
case MPIOINTR:
case MPLINTR:
p += 8;
80103cb0: 83 45 f4 08 addl $0x8,-0xc(%ebp)
continue;
80103cb4: eb 23 jmp 80103cd9 <mpinit+0x152>
default:
cprintf("mpinit: unknown config type %x\n", *p);
80103cb6: 8b 45 f4 mov -0xc(%ebp),%eax
80103cb9: 0f b6 00 movzbl (%eax),%eax
80103cbc: 0f b6 c0 movzbl %al,%eax
80103cbf: 89 44 24 04 mov %eax,0x4(%esp)
80103cc3: c7 04 24 8c 86 10 80 movl $0x8010868c,(%esp)
80103cca: e8 d1 c6 ff ff call 801003a0 <cprintf>
ismp = 0;
80103ccf: c7 05 a4 23 11 80 00 movl $0x0,0x801123a4
80103cd6: 00 00 00
bcpu = &cpus[0];
if((conf = mpconfig(&mp)) == 0)
return;
ismp = 1;
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103cd9: 8b 45 f4 mov -0xc(%ebp),%eax
80103cdc: 3b 45 ec cmp -0x14(%ebp),%eax
80103cdf: 0f 82 00 ff ff ff jb 80103be5 <mpinit+0x5e>
default:
cprintf("mpinit: unknown config type %x\n", *p);
ismp = 0;
}
}
if(!ismp){
80103ce5: a1 a4 23 11 80 mov 0x801123a4,%eax
80103cea: 85 c0 test %eax,%eax
80103cec: 75 1d jne 80103d0b <mpinit+0x184>
// Didn't like what we found; fall back to no MP.
ncpu = 1;
80103cee: c7 05 a0 29 11 80 01 movl $0x1,0x801129a0
80103cf5: 00 00 00
lapic = 0;
80103cf8: c7 05 bc 22 11 80 00 movl $0x0,0x801122bc
80103cff: 00 00 00
ioapicid = 0;
80103d02: c6 05 a0 23 11 80 00 movb $0x0,0x801123a0
return;
80103d09: eb 41 jmp 80103d4c <mpinit+0x1c5>
}
if(mp->imcrp){
80103d0b: 8b 45 e0 mov -0x20(%ebp),%eax
80103d0e: 0f b6 40 0c movzbl 0xc(%eax),%eax
80103d12: 84 c0 test %al,%al
80103d14: 74 36 je 80103d4c <mpinit+0x1c5>
// Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware.
outb(0x22, 0x70); // Select IMCR
80103d16: c7 44 24 04 70 00 00 movl $0x70,0x4(%esp)
80103d1d: 00
80103d1e: c7 04 24 22 00 00 00 movl $0x22,(%esp)
80103d25: e8 0d fc ff ff call 80103937 <outb>
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
80103d2a: c7 04 24 23 00 00 00 movl $0x23,(%esp)
80103d31: e8 e4 fb ff ff call 8010391a <inb>
80103d36: 83 c8 01 or $0x1,%eax
80103d39: 0f b6 c0 movzbl %al,%eax
80103d3c: 89 44 24 04 mov %eax,0x4(%esp)
80103d40: c7 04 24 23 00 00 00 movl $0x23,(%esp)
80103d47: e8 eb fb ff ff call 80103937 <outb>
}
}
80103d4c: c9 leave
80103d4d: c3 ret
80103d4e <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80103d4e: 55 push %ebp
80103d4f: 89 e5 mov %esp,%ebp
80103d51: 83 ec 08 sub $0x8,%esp
80103d54: 8b 55 08 mov 0x8(%ebp),%edx
80103d57: 8b 45 0c mov 0xc(%ebp),%eax
80103d5a: 66 89 55 fc mov %dx,-0x4(%ebp)
80103d5e: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103d61: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80103d65: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80103d69: ee out %al,(%dx)
}
80103d6a: c9 leave
80103d6b: c3 ret
80103d6c <picsetmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE);
static void
picsetmask(ushort mask)
{
80103d6c: 55 push %ebp
80103d6d: 89 e5 mov %esp,%ebp
80103d6f: 83 ec 0c sub $0xc,%esp
80103d72: 8b 45 08 mov 0x8(%ebp),%eax
80103d75: 66 89 45 fc mov %ax,-0x4(%ebp)
irqmask = mask;
80103d79: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103d7d: 66 a3 00 b0 10 80 mov %ax,0x8010b000
outb(IO_PIC1+1, mask);
80103d83: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103d87: 0f b6 c0 movzbl %al,%eax
80103d8a: 89 44 24 04 mov %eax,0x4(%esp)
80103d8e: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103d95: e8 b4 ff ff ff call 80103d4e <outb>
outb(IO_PIC2+1, mask >> 8);
80103d9a: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103d9e: 66 c1 e8 08 shr $0x8,%ax
80103da2: 0f b6 c0 movzbl %al,%eax
80103da5: 89 44 24 04 mov %eax,0x4(%esp)
80103da9: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103db0: e8 99 ff ff ff call 80103d4e <outb>
}
80103db5: c9 leave
80103db6: c3 ret
80103db7 <picenable>:
void
picenable(int irq)
{
80103db7: 55 push %ebp
80103db8: 89 e5 mov %esp,%ebp
80103dba: 83 ec 04 sub $0x4,%esp
picsetmask(irqmask & ~(1<<irq));
80103dbd: 8b 45 08 mov 0x8(%ebp),%eax
80103dc0: ba 01 00 00 00 mov $0x1,%edx
80103dc5: 89 c1 mov %eax,%ecx
80103dc7: d3 e2 shl %cl,%edx
80103dc9: 89 d0 mov %edx,%eax
80103dcb: f7 d0 not %eax
80103dcd: 89 c2 mov %eax,%edx
80103dcf: 0f b7 05 00 b0 10 80 movzwl 0x8010b000,%eax
80103dd6: 21 d0 and %edx,%eax
80103dd8: 0f b7 c0 movzwl %ax,%eax
80103ddb: 89 04 24 mov %eax,(%esp)
80103dde: e8 89 ff ff ff call 80103d6c <picsetmask>
}
80103de3: c9 leave
80103de4: c3 ret
80103de5 <picinit>:
// Initialize the 8259A interrupt controllers.
void
picinit(void)
{
80103de5: 55 push %ebp
80103de6: 89 e5 mov %esp,%ebp
80103de8: 83 ec 08 sub $0x8,%esp
// mask all interrupts
outb(IO_PIC1+1, 0xFF);
80103deb: c7 44 24 04 ff 00 00 movl $0xff,0x4(%esp)
80103df2: 00
80103df3: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103dfa: e8 4f ff ff ff call 80103d4e <outb>
outb(IO_PIC2+1, 0xFF);
80103dff: c7 44 24 04 ff 00 00 movl $0xff,0x4(%esp)
80103e06: 00
80103e07: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103e0e: e8 3b ff ff ff call 80103d4e <outb>
// ICW1: 0001g0hi
// g: 0 = edge triggering, 1 = level triggering
// h: 0 = cascaded PICs, 1 = master only
// i: 0 = no ICW4, 1 = ICW4 required
outb(IO_PIC1, 0x11);
80103e13: c7 44 24 04 11 00 00 movl $0x11,0x4(%esp)
80103e1a: 00
80103e1b: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80103e22: e8 27 ff ff ff call 80103d4e <outb>
// ICW2: Vector offset
outb(IO_PIC1+1, T_IRQ0);
80103e27: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp)
80103e2e: 00
80103e2f: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103e36: e8 13 ff ff ff call 80103d4e <outb>
// ICW3: (master PIC) bit mask of IR lines connected to slaves
// (slave PIC) 3-bit # of slave's connection to master
outb(IO_PIC1+1, 1<<IRQ_SLAVE);
80103e3b: c7 44 24 04 04 00 00 movl $0x4,0x4(%esp)
80103e42: 00
80103e43: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103e4a: e8 ff fe ff ff call 80103d4e <outb>
// m: 0 = slave PIC, 1 = master PIC
// (ignored when b is 0, as the master/slave role
// can be hardwired).
// a: 1 = Automatic EOI mode
// p: 0 = MCS-80/85 mode, 1 = intel x86 mode
outb(IO_PIC1+1, 0x3);
80103e4f: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
80103e56: 00
80103e57: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103e5e: e8 eb fe ff ff call 80103d4e <outb>
// Set up slave (8259A-2)
outb(IO_PIC2, 0x11); // ICW1
80103e63: c7 44 24 04 11 00 00 movl $0x11,0x4(%esp)
80103e6a: 00
80103e6b: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80103e72: e8 d7 fe ff ff call 80103d4e <outb>
outb(IO_PIC2+1, T_IRQ0 + 8); // ICW2
80103e77: c7 44 24 04 28 00 00 movl $0x28,0x4(%esp)
80103e7e: 00
80103e7f: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103e86: e8 c3 fe ff ff call 80103d4e <outb>
outb(IO_PIC2+1, IRQ_SLAVE); // ICW3
80103e8b: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
80103e92: 00
80103e93: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103e9a: e8 af fe ff ff call 80103d4e <outb>
// NB Automatic EOI mode doesn't tend to work on the slave.
// Linux source code says it's "to be investigated".
outb(IO_PIC2+1, 0x3); // ICW4
80103e9f: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
80103ea6: 00
80103ea7: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103eae: e8 9b fe ff ff call 80103d4e <outb>
// OCW3: 0ef01prs
// ef: 0x = NOP, 10 = clear specific mask, 11 = set specific mask
// p: 0 = no polling, 1 = polling mode
// rs: 0x = NOP, 10 = read IRR, 11 = read ISR
outb(IO_PIC1, 0x68); // clear specific mask
80103eb3: c7 44 24 04 68 00 00 movl $0x68,0x4(%esp)
80103eba: 00
80103ebb: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80103ec2: e8 87 fe ff ff call 80103d4e <outb>
outb(IO_PIC1, 0x0a); // read IRR by default
80103ec7: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80103ece: 00
80103ecf: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80103ed6: e8 73 fe ff ff call 80103d4e <outb>
outb(IO_PIC2, 0x68); // OCW3
80103edb: c7 44 24 04 68 00 00 movl $0x68,0x4(%esp)
80103ee2: 00
80103ee3: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80103eea: e8 5f fe ff ff call 80103d4e <outb>
outb(IO_PIC2, 0x0a); // OCW3
80103eef: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80103ef6: 00
80103ef7: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80103efe: e8 4b fe ff ff call 80103d4e <outb>
if(irqmask != 0xFFFF)
80103f03: 0f b7 05 00 b0 10 80 movzwl 0x8010b000,%eax
80103f0a: 66 83 f8 ff cmp $0xffff,%ax
80103f0e: 74 12 je 80103f22 <picinit+0x13d>
picsetmask(irqmask);
80103f10: 0f b7 05 00 b0 10 80 movzwl 0x8010b000,%eax
80103f17: 0f b7 c0 movzwl %ax,%eax
80103f1a: 89 04 24 mov %eax,(%esp)
80103f1d: e8 4a fe ff ff call 80103d6c <picsetmask>
}
80103f22: c9 leave
80103f23: c3 ret
80103f24 <pipealloc>:
int writeopen; // write fd is still open
};
int
pipealloc(struct file **f0, struct file **f1)
{
80103f24: 55 push %ebp
80103f25: 89 e5 mov %esp,%ebp
80103f27: 83 ec 28 sub $0x28,%esp
struct pipe *p;
p = 0;
80103f2a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
*f0 = *f1 = 0;
80103f31: 8b 45 0c mov 0xc(%ebp),%eax
80103f34: c7 00 00 00 00 00 movl $0x0,(%eax)
80103f3a: 8b 45 0c mov 0xc(%ebp),%eax
80103f3d: 8b 10 mov (%eax),%edx
80103f3f: 8b 45 08 mov 0x8(%ebp),%eax
80103f42: 89 10 mov %edx,(%eax)
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
80103f44: e8 e9 cf ff ff call 80100f32 <filealloc>
80103f49: 8b 55 08 mov 0x8(%ebp),%edx
80103f4c: 89 02 mov %eax,(%edx)
80103f4e: 8b 45 08 mov 0x8(%ebp),%eax
80103f51: 8b 00 mov (%eax),%eax
80103f53: 85 c0 test %eax,%eax
80103f55: 0f 84 c8 00 00 00 je 80104023 <pipealloc+0xff>
80103f5b: e8 d2 cf ff ff call 80100f32 <filealloc>
80103f60: 8b 55 0c mov 0xc(%ebp),%edx
80103f63: 89 02 mov %eax,(%edx)
80103f65: 8b 45 0c mov 0xc(%ebp),%eax
80103f68: 8b 00 mov (%eax),%eax
80103f6a: 85 c0 test %eax,%eax
80103f6c: 0f 84 b1 00 00 00 je 80104023 <pipealloc+0xff>
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
80103f72: e8 86 eb ff ff call 80102afd <kalloc>
80103f77: 89 45 f4 mov %eax,-0xc(%ebp)
80103f7a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80103f7e: 75 05 jne 80103f85 <pipealloc+0x61>
goto bad;
80103f80: e9 9e 00 00 00 jmp 80104023 <pipealloc+0xff>
p->readopen = 1;
80103f85: 8b 45 f4 mov -0xc(%ebp),%eax
80103f88: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax)
80103f8f: 00 00 00
p->writeopen = 1;
80103f92: 8b 45 f4 mov -0xc(%ebp),%eax
80103f95: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax)
80103f9c: 00 00 00
p->nwrite = 0;
80103f9f: 8b 45 f4 mov -0xc(%ebp),%eax
80103fa2: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax)
80103fa9: 00 00 00
p->nread = 0;
80103fac: 8b 45 f4 mov -0xc(%ebp),%eax
80103faf: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax)
80103fb6: 00 00 00
initlock(&p->lock, "pipe");
80103fb9: 8b 45 f4 mov -0xc(%ebp),%eax
80103fbc: c7 44 24 04 c0 86 10 movl $0x801086c0,0x4(%esp)
80103fc3: 80
80103fc4: 89 04 24 mov %eax,(%esp)
80103fc7: e8 00 0e 00 00 call 80104dcc <initlock>
(*f0)->type = FD_PIPE;
80103fcc: 8b 45 08 mov 0x8(%ebp),%eax
80103fcf: 8b 00 mov (%eax),%eax
80103fd1: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f0)->readable = 1;
80103fd7: 8b 45 08 mov 0x8(%ebp),%eax
80103fda: 8b 00 mov (%eax),%eax
80103fdc: c6 40 08 01 movb $0x1,0x8(%eax)
(*f0)->writable = 0;
80103fe0: 8b 45 08 mov 0x8(%ebp),%eax
80103fe3: 8b 00 mov (%eax),%eax
80103fe5: c6 40 09 00 movb $0x0,0x9(%eax)
(*f0)->pipe = p;
80103fe9: 8b 45 08 mov 0x8(%ebp),%eax
80103fec: 8b 00 mov (%eax),%eax
80103fee: 8b 55 f4 mov -0xc(%ebp),%edx
80103ff1: 89 50 0c mov %edx,0xc(%eax)
(*f1)->type = FD_PIPE;
80103ff4: 8b 45 0c mov 0xc(%ebp),%eax
80103ff7: 8b 00 mov (%eax),%eax
80103ff9: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f1)->readable = 0;
80103fff: 8b 45 0c mov 0xc(%ebp),%eax
80104002: 8b 00 mov (%eax),%eax
80104004: c6 40 08 00 movb $0x0,0x8(%eax)
(*f1)->writable = 1;
80104008: 8b 45 0c mov 0xc(%ebp),%eax
8010400b: 8b 00 mov (%eax),%eax
8010400d: c6 40 09 01 movb $0x1,0x9(%eax)
(*f1)->pipe = p;
80104011: 8b 45 0c mov 0xc(%ebp),%eax
80104014: 8b 00 mov (%eax),%eax
80104016: 8b 55 f4 mov -0xc(%ebp),%edx
80104019: 89 50 0c mov %edx,0xc(%eax)
return 0;
8010401c: b8 00 00 00 00 mov $0x0,%eax
80104021: eb 42 jmp 80104065 <pipealloc+0x141>
//PAGEBREAK: 20
bad:
if(p)
80104023: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80104027: 74 0b je 80104034 <pipealloc+0x110>
kfree((char*)p);
80104029: 8b 45 f4 mov -0xc(%ebp),%eax
8010402c: 89 04 24 mov %eax,(%esp)
8010402f: e8 30 ea ff ff call 80102a64 <kfree>
if(*f0)
80104034: 8b 45 08 mov 0x8(%ebp),%eax
80104037: 8b 00 mov (%eax),%eax
80104039: 85 c0 test %eax,%eax
8010403b: 74 0d je 8010404a <pipealloc+0x126>
fileclose(*f0);
8010403d: 8b 45 08 mov 0x8(%ebp),%eax
80104040: 8b 00 mov (%eax),%eax
80104042: 89 04 24 mov %eax,(%esp)
80104045: e8 9f cf ff ff call 80100fe9 <fileclose>
if(*f1)
8010404a: 8b 45 0c mov 0xc(%ebp),%eax
8010404d: 8b 00 mov (%eax),%eax
8010404f: 85 c0 test %eax,%eax
80104051: 74 0d je 80104060 <pipealloc+0x13c>
fileclose(*f1);
80104053: 8b 45 0c mov 0xc(%ebp),%eax
80104056: 8b 00 mov (%eax),%eax
80104058: 89 04 24 mov %eax,(%esp)
8010405b: e8 89 cf ff ff call 80100fe9 <fileclose>
return -1;
80104060: b8 ff ff ff ff mov $0xffffffff,%eax
}
80104065: c9 leave
80104066: c3 ret
80104067 <pipeclose>:
void
pipeclose(struct pipe *p, int writable)
{
80104067: 55 push %ebp
80104068: 89 e5 mov %esp,%ebp
8010406a: 83 ec 18 sub $0x18,%esp
acquire(&p->lock);
8010406d: 8b 45 08 mov 0x8(%ebp),%eax
80104070: 89 04 24 mov %eax,(%esp)
80104073: e8 75 0d 00 00 call 80104ded <acquire>
if(writable){
80104078: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
8010407c: 74 1f je 8010409d <pipeclose+0x36>
p->writeopen = 0;
8010407e: 8b 45 08 mov 0x8(%ebp),%eax
80104081: c7 80 40 02 00 00 00 movl $0x0,0x240(%eax)
80104088: 00 00 00
wakeup(&p->nread);
8010408b: 8b 45 08 mov 0x8(%ebp),%eax
8010408e: 05 34 02 00 00 add $0x234,%eax
80104093: 89 04 24 mov %eax,(%esp)
80104096: e8 61 0b 00 00 call 80104bfc <wakeup>
8010409b: eb 1d jmp 801040ba <pipeclose+0x53>
} else {
p->readopen = 0;
8010409d: 8b 45 08 mov 0x8(%ebp),%eax
801040a0: c7 80 3c 02 00 00 00 movl $0x0,0x23c(%eax)
801040a7: 00 00 00
wakeup(&p->nwrite);
801040aa: 8b 45 08 mov 0x8(%ebp),%eax
801040ad: 05 38 02 00 00 add $0x238,%eax
801040b2: 89 04 24 mov %eax,(%esp)
801040b5: e8 42 0b 00 00 call 80104bfc <wakeup>
}
if(p->readopen == 0 && p->writeopen == 0){
801040ba: 8b 45 08 mov 0x8(%ebp),%eax
801040bd: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax
801040c3: 85 c0 test %eax,%eax
801040c5: 75 25 jne 801040ec <pipeclose+0x85>
801040c7: 8b 45 08 mov 0x8(%ebp),%eax
801040ca: 8b 80 40 02 00 00 mov 0x240(%eax),%eax
801040d0: 85 c0 test %eax,%eax
801040d2: 75 18 jne 801040ec <pipeclose+0x85>
release(&p->lock);
801040d4: 8b 45 08 mov 0x8(%ebp),%eax
801040d7: 89 04 24 mov %eax,(%esp)
801040da: e8 70 0d 00 00 call 80104e4f <release>
kfree((char*)p);
801040df: 8b 45 08 mov 0x8(%ebp),%eax
801040e2: 89 04 24 mov %eax,(%esp)
801040e5: e8 7a e9 ff ff call 80102a64 <kfree>
801040ea: eb 0b jmp 801040f7 <pipeclose+0x90>
} else
release(&p->lock);
801040ec: 8b 45 08 mov 0x8(%ebp),%eax
801040ef: 89 04 24 mov %eax,(%esp)
801040f2: e8 58 0d 00 00 call 80104e4f <release>
}
801040f7: c9 leave
801040f8: c3 ret
801040f9 <pipewrite>:
//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
801040f9: 55 push %ebp
801040fa: 89 e5 mov %esp,%ebp
801040fc: 83 ec 28 sub $0x28,%esp
int i;
acquire(&p->lock);
801040ff: 8b 45 08 mov 0x8(%ebp),%eax
80104102: 89 04 24 mov %eax,(%esp)
80104105: e8 e3 0c 00 00 call 80104ded <acquire>
for(i = 0; i < n; i++){
8010410a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80104111: e9 a6 00 00 00 jmp 801041bc <pipewrite+0xc3>
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
80104116: eb 57 jmp 8010416f <pipewrite+0x76>
if(p->readopen == 0 || proc->killed){
80104118: 8b 45 08 mov 0x8(%ebp),%eax
8010411b: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax
80104121: 85 c0 test %eax,%eax
80104123: 74 0d je 80104132 <pipewrite+0x39>
80104125: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010412b: 8b 40 24 mov 0x24(%eax),%eax
8010412e: 85 c0 test %eax,%eax
80104130: 74 15 je 80104147 <pipewrite+0x4e>
release(&p->lock);
80104132: 8b 45 08 mov 0x8(%ebp),%eax
80104135: 89 04 24 mov %eax,(%esp)
80104138: e8 12 0d 00 00 call 80104e4f <release>
return -1;
8010413d: b8 ff ff ff ff mov $0xffffffff,%eax
80104142: e9 9f 00 00 00 jmp 801041e6 <pipewrite+0xed>
}
wakeup(&p->nread);
80104147: 8b 45 08 mov 0x8(%ebp),%eax
8010414a: 05 34 02 00 00 add $0x234,%eax
8010414f: 89 04 24 mov %eax,(%esp)
80104152: e8 a5 0a 00 00 call 80104bfc <wakeup>
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
80104157: 8b 45 08 mov 0x8(%ebp),%eax
8010415a: 8b 55 08 mov 0x8(%ebp),%edx
8010415d: 81 c2 38 02 00 00 add $0x238,%edx
80104163: 89 44 24 04 mov %eax,0x4(%esp)
80104167: 89 14 24 mov %edx,(%esp)
8010416a: e8 b4 09 00 00 call 80104b23 <sleep>
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
8010416f: 8b 45 08 mov 0x8(%ebp),%eax
80104172: 8b 90 38 02 00 00 mov 0x238(%eax),%edx
80104178: 8b 45 08 mov 0x8(%ebp),%eax
8010417b: 8b 80 34 02 00 00 mov 0x234(%eax),%eax
80104181: 05 00 02 00 00 add $0x200,%eax
80104186: 39 c2 cmp %eax,%edx
80104188: 74 8e je 80104118 <pipewrite+0x1f>
return -1;
}
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
8010418a: 8b 45 08 mov 0x8(%ebp),%eax
8010418d: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
80104193: 8d 48 01 lea 0x1(%eax),%ecx
80104196: 8b 55 08 mov 0x8(%ebp),%edx
80104199: 89 8a 38 02 00 00 mov %ecx,0x238(%edx)
8010419f: 25 ff 01 00 00 and $0x1ff,%eax
801041a4: 89 c1 mov %eax,%ecx
801041a6: 8b 55 f4 mov -0xc(%ebp),%edx
801041a9: 8b 45 0c mov 0xc(%ebp),%eax
801041ac: 01 d0 add %edx,%eax
801041ae: 0f b6 10 movzbl (%eax),%edx
801041b1: 8b 45 08 mov 0x8(%ebp),%eax
801041b4: 88 54 08 34 mov %dl,0x34(%eax,%ecx,1)
pipewrite(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
801041b8: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801041bc: 8b 45 f4 mov -0xc(%ebp),%eax
801041bf: 3b 45 10 cmp 0x10(%ebp),%eax
801041c2: 0f 8c 4e ff ff ff jl 80104116 <pipewrite+0x1d>
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
}
wakeup(&p->nread); //DOC: pipewrite-wakeup1
801041c8: 8b 45 08 mov 0x8(%ebp),%eax
801041cb: 05 34 02 00 00 add $0x234,%eax
801041d0: 89 04 24 mov %eax,(%esp)
801041d3: e8 24 0a 00 00 call 80104bfc <wakeup>
release(&p->lock);
801041d8: 8b 45 08 mov 0x8(%ebp),%eax
801041db: 89 04 24 mov %eax,(%esp)
801041de: e8 6c 0c 00 00 call 80104e4f <release>
return n;
801041e3: 8b 45 10 mov 0x10(%ebp),%eax
}
801041e6: c9 leave
801041e7: c3 ret
801041e8 <piperead>:
int
piperead(struct pipe *p, char *addr, int n)
{
801041e8: 55 push %ebp
801041e9: 89 e5 mov %esp,%ebp
801041eb: 53 push %ebx
801041ec: 83 ec 24 sub $0x24,%esp
int i;
acquire(&p->lock);
801041ef: 8b 45 08 mov 0x8(%ebp),%eax
801041f2: 89 04 24 mov %eax,(%esp)
801041f5: e8 f3 0b 00 00 call 80104ded <acquire>
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
801041fa: eb 3a jmp 80104236 <piperead+0x4e>
if(proc->killed){
801041fc: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104202: 8b 40 24 mov 0x24(%eax),%eax
80104205: 85 c0 test %eax,%eax
80104207: 74 15 je 8010421e <piperead+0x36>
release(&p->lock);
80104209: 8b 45 08 mov 0x8(%ebp),%eax
8010420c: 89 04 24 mov %eax,(%esp)
8010420f: e8 3b 0c 00 00 call 80104e4f <release>
return -1;
80104214: b8 ff ff ff ff mov $0xffffffff,%eax
80104219: e9 b5 00 00 00 jmp 801042d3 <piperead+0xeb>
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
8010421e: 8b 45 08 mov 0x8(%ebp),%eax
80104221: 8b 55 08 mov 0x8(%ebp),%edx
80104224: 81 c2 34 02 00 00 add $0x234,%edx
8010422a: 89 44 24 04 mov %eax,0x4(%esp)
8010422e: 89 14 24 mov %edx,(%esp)
80104231: e8 ed 08 00 00 call 80104b23 <sleep>
piperead(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
80104236: 8b 45 08 mov 0x8(%ebp),%eax
80104239: 8b 90 34 02 00 00 mov 0x234(%eax),%edx
8010423f: 8b 45 08 mov 0x8(%ebp),%eax
80104242: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
80104248: 39 c2 cmp %eax,%edx
8010424a: 75 0d jne 80104259 <piperead+0x71>
8010424c: 8b 45 08 mov 0x8(%ebp),%eax
8010424f: 8b 80 40 02 00 00 mov 0x240(%eax),%eax
80104255: 85 c0 test %eax,%eax
80104257: 75 a3 jne 801041fc <piperead+0x14>
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
80104259: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80104260: eb 4b jmp 801042ad <piperead+0xc5>
if(p->nread == p->nwrite)
80104262: 8b 45 08 mov 0x8(%ebp),%eax
80104265: 8b 90 34 02 00 00 mov 0x234(%eax),%edx
8010426b: 8b 45 08 mov 0x8(%ebp),%eax
8010426e: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
80104274: 39 c2 cmp %eax,%edx
80104276: 75 02 jne 8010427a <piperead+0x92>
break;
80104278: eb 3b jmp 801042b5 <piperead+0xcd>
addr[i] = p->data[p->nread++ % PIPESIZE];
8010427a: 8b 55 f4 mov -0xc(%ebp),%edx
8010427d: 8b 45 0c mov 0xc(%ebp),%eax
80104280: 8d 1c 02 lea (%edx,%eax,1),%ebx
80104283: 8b 45 08 mov 0x8(%ebp),%eax
80104286: 8b 80 34 02 00 00 mov 0x234(%eax),%eax
8010428c: 8d 48 01 lea 0x1(%eax),%ecx
8010428f: 8b 55 08 mov 0x8(%ebp),%edx
80104292: 89 8a 34 02 00 00 mov %ecx,0x234(%edx)
80104298: 25 ff 01 00 00 and $0x1ff,%eax
8010429d: 89 c2 mov %eax,%edx
8010429f: 8b 45 08 mov 0x8(%ebp),%eax
801042a2: 0f b6 44 10 34 movzbl 0x34(%eax,%edx,1),%eax
801042a7: 88 03 mov %al,(%ebx)
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
801042a9: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801042ad: 8b 45 f4 mov -0xc(%ebp),%eax
801042b0: 3b 45 10 cmp 0x10(%ebp),%eax
801042b3: 7c ad jl 80104262 <piperead+0x7a>
if(p->nread == p->nwrite)
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
801042b5: 8b 45 08 mov 0x8(%ebp),%eax
801042b8: 05 38 02 00 00 add $0x238,%eax
801042bd: 89 04 24 mov %eax,(%esp)
801042c0: e8 37 09 00 00 call 80104bfc <wakeup>
release(&p->lock);
801042c5: 8b 45 08 mov 0x8(%ebp),%eax
801042c8: 89 04 24 mov %eax,(%esp)
801042cb: e8 7f 0b 00 00 call 80104e4f <release>
return i;
801042d0: 8b 45 f4 mov -0xc(%ebp),%eax
}
801042d3: 83 c4 24 add $0x24,%esp
801042d6: 5b pop %ebx
801042d7: 5d pop %ebp
801042d8: c3 ret
801042d9 <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
801042d9: 55 push %ebp
801042da: 89 e5 mov %esp,%ebp
801042dc: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
801042df: 9c pushf
801042e0: 58 pop %eax
801042e1: 89 45 fc mov %eax,-0x4(%ebp)
return eflags;
801042e4: 8b 45 fc mov -0x4(%ebp),%eax
}
801042e7: c9 leave
801042e8: c3 ret
801042e9 <sti>:
asm volatile("cli");
}
static inline void
sti(void)
{
801042e9: 55 push %ebp
801042ea: 89 e5 mov %esp,%ebp
asm volatile("sti");
801042ec: fb sti
}
801042ed: 5d pop %ebp
801042ee: c3 ret
801042ef <pinit>:
static void wakeup1(void *chan);
void
pinit(void)
{
801042ef: 55 push %ebp
801042f0: 89 e5 mov %esp,%ebp
801042f2: 83 ec 18 sub $0x18,%esp
initlock(&ptable.lock, "ptable");
801042f5: c7 44 24 04 c5 86 10 movl $0x801086c5,0x4(%esp)
801042fc: 80
801042fd: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104304: e8 c3 0a 00 00 call 80104dcc <initlock>
}
80104309: c9 leave
8010430a: c3 ret
8010430b <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
8010430b: 55 push %ebp
8010430c: 89 e5 mov %esp,%ebp
8010430e: 83 ec 28 sub $0x28,%esp
struct proc *p;
char *sp;
acquire(&ptable.lock);
80104311: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104318: e8 d0 0a 00 00 call 80104ded <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
8010431d: c7 45 f4 f4 29 11 80 movl $0x801129f4,-0xc(%ebp)
80104324: eb 50 jmp 80104376 <allocproc+0x6b>
if(p->state == UNUSED)
80104326: 8b 45 f4 mov -0xc(%ebp),%eax
80104329: 8b 40 0c mov 0xc(%eax),%eax
8010432c: 85 c0 test %eax,%eax
8010432e: 75 42 jne 80104372 <allocproc+0x67>
goto found;
80104330: 90 nop
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
80104331: 8b 45 f4 mov -0xc(%ebp),%eax
80104334: c7 40 0c 01 00 00 00 movl $0x1,0xc(%eax)
p->pid = nextpid++;
8010433b: a1 04 b0 10 80 mov 0x8010b004,%eax
80104340: 8d 50 01 lea 0x1(%eax),%edx
80104343: 89 15 04 b0 10 80 mov %edx,0x8010b004
80104349: 8b 55 f4 mov -0xc(%ebp),%edx
8010434c: 89 42 10 mov %eax,0x10(%edx)
release(&ptable.lock);
8010434f: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104356: e8 f4 0a 00 00 call 80104e4f <release>
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
8010435b: e8 9d e7 ff ff call 80102afd <kalloc>
80104360: 8b 55 f4 mov -0xc(%ebp),%edx
80104363: 89 42 08 mov %eax,0x8(%edx)
80104366: 8b 45 f4 mov -0xc(%ebp),%eax
80104369: 8b 40 08 mov 0x8(%eax),%eax
8010436c: 85 c0 test %eax,%eax
8010436e: 75 33 jne 801043a3 <allocproc+0x98>
80104370: eb 20 jmp 80104392 <allocproc+0x87>
{
struct proc *p;
char *sp;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104372: 83 45 f4 7c addl $0x7c,-0xc(%ebp)
80104376: 81 7d f4 f4 48 11 80 cmpl $0x801148f4,-0xc(%ebp)
8010437d: 72 a7 jb 80104326 <allocproc+0x1b>
if(p->state == UNUSED)
goto found;
release(&ptable.lock);
8010437f: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104386: e8 c4 0a 00 00 call 80104e4f <release>
return 0;
8010438b: b8 00 00 00 00 mov $0x0,%eax
80104390: eb 76 jmp 80104408 <allocproc+0xfd>
p->pid = nextpid++;
release(&ptable.lock);
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
p->state = UNUSED;
80104392: 8b 45 f4 mov -0xc(%ebp),%eax
80104395: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
return 0;
8010439c: b8 00 00 00 00 mov $0x0,%eax
801043a1: eb 65 jmp 80104408 <allocproc+0xfd>
}
sp = p->kstack + KSTACKSIZE;
801043a3: 8b 45 f4 mov -0xc(%ebp),%eax
801043a6: 8b 40 08 mov 0x8(%eax),%eax
801043a9: 05 00 10 00 00 add $0x1000,%eax
801043ae: 89 45 f0 mov %eax,-0x10(%ebp)
// Leave room for trap frame.
sp -= sizeof *p->tf;
801043b1: 83 6d f0 4c subl $0x4c,-0x10(%ebp)
p->tf = (struct trapframe*)sp;
801043b5: 8b 45 f4 mov -0xc(%ebp),%eax
801043b8: 8b 55 f0 mov -0x10(%ebp),%edx
801043bb: 89 50 18 mov %edx,0x18(%eax)
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
801043be: 83 6d f0 04 subl $0x4,-0x10(%ebp)
*(uint*)sp = (uint)trapret;
801043c2: ba 8e 64 10 80 mov $0x8010648e,%edx
801043c7: 8b 45 f0 mov -0x10(%ebp),%eax
801043ca: 89 10 mov %edx,(%eax)
sp -= sizeof *p->context;
801043cc: 83 6d f0 14 subl $0x14,-0x10(%ebp)
p->context = (struct context*)sp;
801043d0: 8b 45 f4 mov -0xc(%ebp),%eax
801043d3: 8b 55 f0 mov -0x10(%ebp),%edx
801043d6: 89 50 1c mov %edx,0x1c(%eax)
memset(p->context, 0, sizeof *p->context);
801043d9: 8b 45 f4 mov -0xc(%ebp),%eax
801043dc: 8b 40 1c mov 0x1c(%eax),%eax
801043df: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp)
801043e6: 00
801043e7: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801043ee: 00
801043ef: 89 04 24 mov %eax,(%esp)
801043f2: e8 4a 0c 00 00 call 80105041 <memset>
p->context->eip = (uint)forkret;
801043f7: 8b 45 f4 mov -0xc(%ebp),%eax
801043fa: 8b 40 1c mov 0x1c(%eax),%eax
801043fd: ba f7 4a 10 80 mov $0x80104af7,%edx
80104402: 89 50 10 mov %edx,0x10(%eax)
return p;
80104405: 8b 45 f4 mov -0xc(%ebp),%eax
}
80104408: c9 leave
80104409: c3 ret
8010440a <userinit>:
//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
8010440a: 55 push %ebp
8010440b: 89 e5 mov %esp,%ebp
8010440d: 83 ec 28 sub $0x28,%esp
struct proc *p;
extern char _binary_initcode_start[], _binary_initcode_size[];
p = allocproc();
80104410: e8 f6 fe ff ff call 8010430b <allocproc>
80104415: 89 45 f4 mov %eax,-0xc(%ebp)
initproc = p;
80104418: 8b 45 f4 mov -0xc(%ebp),%eax
8010441b: a3 a8 b6 10 80 mov %eax,0x8010b6a8
if((p->pgdir = setupkvm()) == 0)
80104420: e8 5d 37 00 00 call 80107b82 <setupkvm>
80104425: 8b 55 f4 mov -0xc(%ebp),%edx
80104428: 89 42 04 mov %eax,0x4(%edx)
8010442b: 8b 45 f4 mov -0xc(%ebp),%eax
8010442e: 8b 40 04 mov 0x4(%eax),%eax
80104431: 85 c0 test %eax,%eax
80104433: 75 0c jne 80104441 <userinit+0x37>
panic("userinit: out of memory?");
80104435: c7 04 24 cc 86 10 80 movl $0x801086cc,(%esp)
8010443c: e8 f9 c0 ff ff call 8010053a <panic>
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
80104441: ba 2c 00 00 00 mov $0x2c,%edx
80104446: 8b 45 f4 mov -0xc(%ebp),%eax
80104449: 8b 40 04 mov 0x4(%eax),%eax
8010444c: 89 54 24 08 mov %edx,0x8(%esp)
80104450: c7 44 24 04 40 b5 10 movl $0x8010b540,0x4(%esp)
80104457: 80
80104458: 89 04 24 mov %eax,(%esp)
8010445b: e8 7a 39 00 00 call 80107dda <inituvm>
p->sz = PGSIZE;
80104460: 8b 45 f4 mov -0xc(%ebp),%eax
80104463: c7 00 00 10 00 00 movl $0x1000,(%eax)
memset(p->tf, 0, sizeof(*p->tf));
80104469: 8b 45 f4 mov -0xc(%ebp),%eax
8010446c: 8b 40 18 mov 0x18(%eax),%eax
8010446f: c7 44 24 08 4c 00 00 movl $0x4c,0x8(%esp)
80104476: 00
80104477: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010447e: 00
8010447f: 89 04 24 mov %eax,(%esp)
80104482: e8 ba 0b 00 00 call 80105041 <memset>
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
80104487: 8b 45 f4 mov -0xc(%ebp),%eax
8010448a: 8b 40 18 mov 0x18(%eax),%eax
8010448d: 66 c7 40 3c 23 00 movw $0x23,0x3c(%eax)
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
80104493: 8b 45 f4 mov -0xc(%ebp),%eax
80104496: 8b 40 18 mov 0x18(%eax),%eax
80104499: 66 c7 40 2c 2b 00 movw $0x2b,0x2c(%eax)
p->tf->es = p->tf->ds;
8010449f: 8b 45 f4 mov -0xc(%ebp),%eax
801044a2: 8b 40 18 mov 0x18(%eax),%eax
801044a5: 8b 55 f4 mov -0xc(%ebp),%edx
801044a8: 8b 52 18 mov 0x18(%edx),%edx
801044ab: 0f b7 52 2c movzwl 0x2c(%edx),%edx
801044af: 66 89 50 28 mov %dx,0x28(%eax)
p->tf->ss = p->tf->ds;
801044b3: 8b 45 f4 mov -0xc(%ebp),%eax
801044b6: 8b 40 18 mov 0x18(%eax),%eax
801044b9: 8b 55 f4 mov -0xc(%ebp),%edx
801044bc: 8b 52 18 mov 0x18(%edx),%edx
801044bf: 0f b7 52 2c movzwl 0x2c(%edx),%edx
801044c3: 66 89 50 48 mov %dx,0x48(%eax)
p->tf->eflags = FL_IF;
801044c7: 8b 45 f4 mov -0xc(%ebp),%eax
801044ca: 8b 40 18 mov 0x18(%eax),%eax
801044cd: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax)
p->tf->esp = PGSIZE;
801044d4: 8b 45 f4 mov -0xc(%ebp),%eax
801044d7: 8b 40 18 mov 0x18(%eax),%eax
801044da: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax)
p->tf->eip = 0; // beginning of initcode.S
801044e1: 8b 45 f4 mov -0xc(%ebp),%eax
801044e4: 8b 40 18 mov 0x18(%eax),%eax
801044e7: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax)
safestrcpy(p->name, "initcode", sizeof(p->name));
801044ee: 8b 45 f4 mov -0xc(%ebp),%eax
801044f1: 83 c0 6c add $0x6c,%eax
801044f4: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
801044fb: 00
801044fc: c7 44 24 04 e5 86 10 movl $0x801086e5,0x4(%esp)
80104503: 80
80104504: 89 04 24 mov %eax,(%esp)
80104507: e8 55 0d 00 00 call 80105261 <safestrcpy>
p->cwd = namei("/");
8010450c: c7 04 24 ee 86 10 80 movl $0x801086ee,(%esp)
80104513: e8 09 df ff ff call 80102421 <namei>
80104518: 8b 55 f4 mov -0xc(%ebp),%edx
8010451b: 89 42 68 mov %eax,0x68(%edx)
p->state = RUNNABLE;
8010451e: 8b 45 f4 mov -0xc(%ebp),%eax
80104521: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
}
80104528: c9 leave
80104529: c3 ret
8010452a <growproc>:
// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
8010452a: 55 push %ebp
8010452b: 89 e5 mov %esp,%ebp
8010452d: 83 ec 28 sub $0x28,%esp
uint sz;
sz = proc->sz;
80104530: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104536: 8b 00 mov (%eax),%eax
80104538: 89 45 f4 mov %eax,-0xc(%ebp)
if(n > 0){
8010453b: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
8010453f: 7e 34 jle 80104575 <growproc+0x4b>
if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
80104541: 8b 55 08 mov 0x8(%ebp),%edx
80104544: 8b 45 f4 mov -0xc(%ebp),%eax
80104547: 01 c2 add %eax,%edx
80104549: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010454f: 8b 40 04 mov 0x4(%eax),%eax
80104552: 89 54 24 08 mov %edx,0x8(%esp)
80104556: 8b 55 f4 mov -0xc(%ebp),%edx
80104559: 89 54 24 04 mov %edx,0x4(%esp)
8010455d: 89 04 24 mov %eax,(%esp)
80104560: e8 eb 39 00 00 call 80107f50 <allocuvm>
80104565: 89 45 f4 mov %eax,-0xc(%ebp)
80104568: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010456c: 75 41 jne 801045af <growproc+0x85>
return -1;
8010456e: b8 ff ff ff ff mov $0xffffffff,%eax
80104573: eb 58 jmp 801045cd <growproc+0xa3>
} else if(n < 0){
80104575: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80104579: 79 34 jns 801045af <growproc+0x85>
if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0)
8010457b: 8b 55 08 mov 0x8(%ebp),%edx
8010457e: 8b 45 f4 mov -0xc(%ebp),%eax
80104581: 01 c2 add %eax,%edx
80104583: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104589: 8b 40 04 mov 0x4(%eax),%eax
8010458c: 89 54 24 08 mov %edx,0x8(%esp)
80104590: 8b 55 f4 mov -0xc(%ebp),%edx
80104593: 89 54 24 04 mov %edx,0x4(%esp)
80104597: 89 04 24 mov %eax,(%esp)
8010459a: e8 8b 3a 00 00 call 8010802a <deallocuvm>
8010459f: 89 45 f4 mov %eax,-0xc(%ebp)
801045a2: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801045a6: 75 07 jne 801045af <growproc+0x85>
return -1;
801045a8: b8 ff ff ff ff mov $0xffffffff,%eax
801045ad: eb 1e jmp 801045cd <growproc+0xa3>
}
proc->sz = sz;
801045af: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801045b5: 8b 55 f4 mov -0xc(%ebp),%edx
801045b8: 89 10 mov %edx,(%eax)
switchuvm(proc);
801045ba: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801045c0: 89 04 24 mov %eax,(%esp)
801045c3: e8 ab 36 00 00 call 80107c73 <switchuvm>
return 0;
801045c8: b8 00 00 00 00 mov $0x0,%eax
}
801045cd: c9 leave
801045ce: c3 ret
801045cf <fork>:
// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void)
{
801045cf: 55 push %ebp
801045d0: 89 e5 mov %esp,%ebp
801045d2: 57 push %edi
801045d3: 56 push %esi
801045d4: 53 push %ebx
801045d5: 83 ec 2c sub $0x2c,%esp
int i, pid;
struct proc *np;
// Allocate process.
if((np = allocproc()) == 0)
801045d8: e8 2e fd ff ff call 8010430b <allocproc>
801045dd: 89 45 e0 mov %eax,-0x20(%ebp)
801045e0: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
801045e4: 75 0a jne 801045f0 <fork+0x21>
return -1;
801045e6: b8 ff ff ff ff mov $0xffffffff,%eax
801045eb: e9 52 01 00 00 jmp 80104742 <fork+0x173>
// Copy process state from p.
if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
801045f0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801045f6: 8b 10 mov (%eax),%edx
801045f8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801045fe: 8b 40 04 mov 0x4(%eax),%eax
80104601: 89 54 24 04 mov %edx,0x4(%esp)
80104605: 89 04 24 mov %eax,(%esp)
80104608: e8 b9 3b 00 00 call 801081c6 <copyuvm>
8010460d: 8b 55 e0 mov -0x20(%ebp),%edx
80104610: 89 42 04 mov %eax,0x4(%edx)
80104613: 8b 45 e0 mov -0x20(%ebp),%eax
80104616: 8b 40 04 mov 0x4(%eax),%eax
80104619: 85 c0 test %eax,%eax
8010461b: 75 2c jne 80104649 <fork+0x7a>
kfree(np->kstack);
8010461d: 8b 45 e0 mov -0x20(%ebp),%eax
80104620: 8b 40 08 mov 0x8(%eax),%eax
80104623: 89 04 24 mov %eax,(%esp)
80104626: e8 39 e4 ff ff call 80102a64 <kfree>
np->kstack = 0;
8010462b: 8b 45 e0 mov -0x20(%ebp),%eax
8010462e: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
np->state = UNUSED;
80104635: 8b 45 e0 mov -0x20(%ebp),%eax
80104638: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
return -1;
8010463f: b8 ff ff ff ff mov $0xffffffff,%eax
80104644: e9 f9 00 00 00 jmp 80104742 <fork+0x173>
}
np->sz = proc->sz;
80104649: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010464f: 8b 10 mov (%eax),%edx
80104651: 8b 45 e0 mov -0x20(%ebp),%eax
80104654: 89 10 mov %edx,(%eax)
np->parent = proc;
80104656: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
8010465d: 8b 45 e0 mov -0x20(%ebp),%eax
80104660: 89 50 14 mov %edx,0x14(%eax)
*np->tf = *proc->tf;
80104663: 8b 45 e0 mov -0x20(%ebp),%eax
80104666: 8b 50 18 mov 0x18(%eax),%edx
80104669: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010466f: 8b 40 18 mov 0x18(%eax),%eax
80104672: 89 c3 mov %eax,%ebx
80104674: b8 13 00 00 00 mov $0x13,%eax
80104679: 89 d7 mov %edx,%edi
8010467b: 89 de mov %ebx,%esi
8010467d: 89 c1 mov %eax,%ecx
8010467f: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
80104681: 8b 45 e0 mov -0x20(%ebp),%eax
80104684: 8b 40 18 mov 0x18(%eax),%eax
80104687: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax)
for(i = 0; i < NOFILE; i++)
8010468e: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
80104695: eb 3d jmp 801046d4 <fork+0x105>
if(proc->ofile[i])
80104697: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010469d: 8b 55 e4 mov -0x1c(%ebp),%edx
801046a0: 83 c2 08 add $0x8,%edx
801046a3: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
801046a7: 85 c0 test %eax,%eax
801046a9: 74 25 je 801046d0 <fork+0x101>
np->ofile[i] = filedup(proc->ofile[i]);
801046ab: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801046b1: 8b 55 e4 mov -0x1c(%ebp),%edx
801046b4: 83 c2 08 add $0x8,%edx
801046b7: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
801046bb: 89 04 24 mov %eax,(%esp)
801046be: e8 de c8 ff ff call 80100fa1 <filedup>
801046c3: 8b 55 e0 mov -0x20(%ebp),%edx
801046c6: 8b 4d e4 mov -0x1c(%ebp),%ecx
801046c9: 83 c1 08 add $0x8,%ecx
801046cc: 89 44 8a 08 mov %eax,0x8(%edx,%ecx,4)
*np->tf = *proc->tf;
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
801046d0: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
801046d4: 83 7d e4 0f cmpl $0xf,-0x1c(%ebp)
801046d8: 7e bd jle 80104697 <fork+0xc8>
if(proc->ofile[i])
np->ofile[i] = filedup(proc->ofile[i]);
np->cwd = idup(proc->cwd);
801046da: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801046e0: 8b 40 68 mov 0x68(%eax),%eax
801046e3: 89 04 24 mov %eax,(%esp)
801046e6: e8 59 d1 ff ff call 80101844 <idup>
801046eb: 8b 55 e0 mov -0x20(%ebp),%edx
801046ee: 89 42 68 mov %eax,0x68(%edx)
safestrcpy(np->name, proc->name, sizeof(proc->name));
801046f1: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801046f7: 8d 50 6c lea 0x6c(%eax),%edx
801046fa: 8b 45 e0 mov -0x20(%ebp),%eax
801046fd: 83 c0 6c add $0x6c,%eax
80104700: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80104707: 00
80104708: 89 54 24 04 mov %edx,0x4(%esp)
8010470c: 89 04 24 mov %eax,(%esp)
8010470f: e8 4d 0b 00 00 call 80105261 <safestrcpy>
pid = np->pid;
80104714: 8b 45 e0 mov -0x20(%ebp),%eax
80104717: 8b 40 10 mov 0x10(%eax),%eax
8010471a: 89 45 dc mov %eax,-0x24(%ebp)
// lock to force the compiler to emit the np->state write last.
acquire(&ptable.lock);
8010471d: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104724: e8 c4 06 00 00 call 80104ded <acquire>
np->state = RUNNABLE;
80104729: 8b 45 e0 mov -0x20(%ebp),%eax
8010472c: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
release(&ptable.lock);
80104733: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
8010473a: e8 10 07 00 00 call 80104e4f <release>
return pid;
8010473f: 8b 45 dc mov -0x24(%ebp),%eax
}
80104742: 83 c4 2c add $0x2c,%esp
80104745: 5b pop %ebx
80104746: 5e pop %esi
80104747: 5f pop %edi
80104748: 5d pop %ebp
80104749: c3 ret
8010474a <exit>:
// Exit the current process. Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
8010474a: 55 push %ebp
8010474b: 89 e5 mov %esp,%ebp
8010474d: 83 ec 28 sub $0x28,%esp
struct proc *p;
int fd;
if(proc == initproc)
80104750: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80104757: a1 a8 b6 10 80 mov 0x8010b6a8,%eax
8010475c: 39 c2 cmp %eax,%edx
8010475e: 75 0c jne 8010476c <exit+0x22>
panic("init exiting");
80104760: c7 04 24 f0 86 10 80 movl $0x801086f0,(%esp)
80104767: e8 ce bd ff ff call 8010053a <panic>
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
8010476c: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
80104773: eb 44 jmp 801047b9 <exit+0x6f>
if(proc->ofile[fd]){
80104775: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010477b: 8b 55 f0 mov -0x10(%ebp),%edx
8010477e: 83 c2 08 add $0x8,%edx
80104781: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104785: 85 c0 test %eax,%eax
80104787: 74 2c je 801047b5 <exit+0x6b>
fileclose(proc->ofile[fd]);
80104789: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010478f: 8b 55 f0 mov -0x10(%ebp),%edx
80104792: 83 c2 08 add $0x8,%edx
80104795: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104799: 89 04 24 mov %eax,(%esp)
8010479c: e8 48 c8 ff ff call 80100fe9 <fileclose>
proc->ofile[fd] = 0;
801047a1: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801047a7: 8b 55 f0 mov -0x10(%ebp),%edx
801047aa: 83 c2 08 add $0x8,%edx
801047ad: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
801047b4: 00
if(proc == initproc)
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
801047b5: 83 45 f0 01 addl $0x1,-0x10(%ebp)
801047b9: 83 7d f0 0f cmpl $0xf,-0x10(%ebp)
801047bd: 7e b6 jle 80104775 <exit+0x2b>
fileclose(proc->ofile[fd]);
proc->ofile[fd] = 0;
}
}
begin_op();
801047bf: e8 67 ec ff ff call 8010342b <begin_op>
iput(proc->cwd);
801047c4: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801047ca: 8b 40 68 mov 0x68(%eax),%eax
801047cd: 89 04 24 mov %eax,(%esp)
801047d0: e8 54 d2 ff ff call 80101a29 <iput>
end_op();
801047d5: e8 d5 ec ff ff call 801034af <end_op>
proc->cwd = 0;
801047da: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801047e0: c7 40 68 00 00 00 00 movl $0x0,0x68(%eax)
acquire(&ptable.lock);
801047e7: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
801047ee: e8 fa 05 00 00 call 80104ded <acquire>
// Parent might be sleeping in wait().
wakeup1(proc->parent);
801047f3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801047f9: 8b 40 14 mov 0x14(%eax),%eax
801047fc: 89 04 24 mov %eax,(%esp)
801047ff: e8 ba 03 00 00 call 80104bbe <wakeup1>
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104804: c7 45 f4 f4 29 11 80 movl $0x801129f4,-0xc(%ebp)
8010480b: eb 38 jmp 80104845 <exit+0xfb>
if(p->parent == proc){
8010480d: 8b 45 f4 mov -0xc(%ebp),%eax
80104810: 8b 50 14 mov 0x14(%eax),%edx
80104813: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104819: 39 c2 cmp %eax,%edx
8010481b: 75 24 jne 80104841 <exit+0xf7>
p->parent = initproc;
8010481d: 8b 15 a8 b6 10 80 mov 0x8010b6a8,%edx
80104823: 8b 45 f4 mov -0xc(%ebp),%eax
80104826: 89 50 14 mov %edx,0x14(%eax)
if(p->state == ZOMBIE)
80104829: 8b 45 f4 mov -0xc(%ebp),%eax
8010482c: 8b 40 0c mov 0xc(%eax),%eax
8010482f: 83 f8 05 cmp $0x5,%eax
80104832: 75 0d jne 80104841 <exit+0xf7>
wakeup1(initproc);
80104834: a1 a8 b6 10 80 mov 0x8010b6a8,%eax
80104839: 89 04 24 mov %eax,(%esp)
8010483c: e8 7d 03 00 00 call 80104bbe <wakeup1>
// Parent might be sleeping in wait().
wakeup1(proc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104841: 83 45 f4 7c addl $0x7c,-0xc(%ebp)
80104845: 81 7d f4 f4 48 11 80 cmpl $0x801148f4,-0xc(%ebp)
8010484c: 72 bf jb 8010480d <exit+0xc3>
wakeup1(initproc);
}
}
// Jump into the scheduler, never to return.
proc->state = ZOMBIE;
8010484e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104854: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax)
sched();
8010485b: e8 b3 01 00 00 call 80104a13 <sched>
panic("zombie exit");
80104860: c7 04 24 fd 86 10 80 movl $0x801086fd,(%esp)
80104867: e8 ce bc ff ff call 8010053a <panic>
8010486c <wait>:
// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
8010486c: 55 push %ebp
8010486d: 89 e5 mov %esp,%ebp
8010486f: 83 ec 28 sub $0x28,%esp
struct proc *p;
int havekids, pid;
acquire(&ptable.lock);
80104872: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104879: e8 6f 05 00 00 call 80104ded <acquire>
for(;;){
// Scan through table looking for zombie children.
havekids = 0;
8010487e: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104885: c7 45 f4 f4 29 11 80 movl $0x801129f4,-0xc(%ebp)
8010488c: e9 9a 00 00 00 jmp 8010492b <wait+0xbf>
if(p->parent != proc)
80104891: 8b 45 f4 mov -0xc(%ebp),%eax
80104894: 8b 50 14 mov 0x14(%eax),%edx
80104897: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010489d: 39 c2 cmp %eax,%edx
8010489f: 74 05 je 801048a6 <wait+0x3a>
continue;
801048a1: e9 81 00 00 00 jmp 80104927 <wait+0xbb>
havekids = 1;
801048a6: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
if(p->state == ZOMBIE){
801048ad: 8b 45 f4 mov -0xc(%ebp),%eax
801048b0: 8b 40 0c mov 0xc(%eax),%eax
801048b3: 83 f8 05 cmp $0x5,%eax
801048b6: 75 6f jne 80104927 <wait+0xbb>
// Found one.
pid = p->pid;
801048b8: 8b 45 f4 mov -0xc(%ebp),%eax
801048bb: 8b 40 10 mov 0x10(%eax),%eax
801048be: 89 45 ec mov %eax,-0x14(%ebp)
kfree(p->kstack);
801048c1: 8b 45 f4 mov -0xc(%ebp),%eax
801048c4: 8b 40 08 mov 0x8(%eax),%eax
801048c7: 89 04 24 mov %eax,(%esp)
801048ca: e8 95 e1 ff ff call 80102a64 <kfree>
p->kstack = 0;
801048cf: 8b 45 f4 mov -0xc(%ebp),%eax
801048d2: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
freevm(p->pgdir);
801048d9: 8b 45 f4 mov -0xc(%ebp),%eax
801048dc: 8b 40 04 mov 0x4(%eax),%eax
801048df: 89 04 24 mov %eax,(%esp)
801048e2: e8 ff 37 00 00 call 801080e6 <freevm>
p->state = UNUSED;
801048e7: 8b 45 f4 mov -0xc(%ebp),%eax
801048ea: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
p->pid = 0;
801048f1: 8b 45 f4 mov -0xc(%ebp),%eax
801048f4: c7 40 10 00 00 00 00 movl $0x0,0x10(%eax)
p->parent = 0;
801048fb: 8b 45 f4 mov -0xc(%ebp),%eax
801048fe: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
p->name[0] = 0;
80104905: 8b 45 f4 mov -0xc(%ebp),%eax
80104908: c6 40 6c 00 movb $0x0,0x6c(%eax)
p->killed = 0;
8010490c: 8b 45 f4 mov -0xc(%ebp),%eax
8010490f: c7 40 24 00 00 00 00 movl $0x0,0x24(%eax)
release(&ptable.lock);
80104916: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
8010491d: e8 2d 05 00 00 call 80104e4f <release>
return pid;
80104922: 8b 45 ec mov -0x14(%ebp),%eax
80104925: eb 52 jmp 80104979 <wait+0x10d>
acquire(&ptable.lock);
for(;;){
// Scan through table looking for zombie children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104927: 83 45 f4 7c addl $0x7c,-0xc(%ebp)
8010492b: 81 7d f4 f4 48 11 80 cmpl $0x801148f4,-0xc(%ebp)
80104932: 0f 82 59 ff ff ff jb 80104891 <wait+0x25>
return pid;
}
}
// No point waiting if we don't have any children.
if(!havekids || proc->killed){
80104938: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010493c: 74 0d je 8010494b <wait+0xdf>
8010493e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104944: 8b 40 24 mov 0x24(%eax),%eax
80104947: 85 c0 test %eax,%eax
80104949: 74 13 je 8010495e <wait+0xf2>
release(&ptable.lock);
8010494b: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104952: e8 f8 04 00 00 call 80104e4f <release>
return -1;
80104957: b8 ff ff ff ff mov $0xffffffff,%eax
8010495c: eb 1b jmp 80104979 <wait+0x10d>
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
8010495e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104964: c7 44 24 04 c0 29 11 movl $0x801129c0,0x4(%esp)
8010496b: 80
8010496c: 89 04 24 mov %eax,(%esp)
8010496f: e8 af 01 00 00 call 80104b23 <sleep>
}
80104974: e9 05 ff ff ff jmp 8010487e <wait+0x12>
}
80104979: c9 leave
8010497a: c3 ret
8010497b <scheduler>:
// - swtch to start running that process
// - eventually that process transfers control
// via swtch back to the scheduler.
void
scheduler(void)
{
8010497b: 55 push %ebp
8010497c: 89 e5 mov %esp,%ebp
8010497e: 83 ec 28 sub $0x28,%esp
struct proc *p;
for(;;){
// Enable interrupts on this processor.
sti();
80104981: e8 63 f9 ff ff call 801042e9 <sti>
// Loop over process table looking for process to run.
acquire(&ptable.lock);
80104986: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
8010498d: e8 5b 04 00 00 call 80104ded <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104992: c7 45 f4 f4 29 11 80 movl $0x801129f4,-0xc(%ebp)
80104999: eb 5e jmp 801049f9 <scheduler+0x7e>
if(p->state != RUNNABLE)
8010499b: 8b 45 f4 mov -0xc(%ebp),%eax
8010499e: 8b 40 0c mov 0xc(%eax),%eax
801049a1: 83 f8 03 cmp $0x3,%eax
801049a4: 74 02 je 801049a8 <scheduler+0x2d>
continue;
801049a6: eb 4d jmp 801049f5 <scheduler+0x7a>
// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
proc = p;
801049a8: 8b 45 f4 mov -0xc(%ebp),%eax
801049ab: 65 a3 04 00 00 00 mov %eax,%gs:0x4
switchuvm(p);
801049b1: 8b 45 f4 mov -0xc(%ebp),%eax
801049b4: 89 04 24 mov %eax,(%esp)
801049b7: e8 b7 32 00 00 call 80107c73 <switchuvm>
p->state = RUNNING;
801049bc: 8b 45 f4 mov -0xc(%ebp),%eax
801049bf: c7 40 0c 04 00 00 00 movl $0x4,0xc(%eax)
swtch(&cpu->scheduler, proc->context);
801049c6: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801049cc: 8b 40 1c mov 0x1c(%eax),%eax
801049cf: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
801049d6: 83 c2 04 add $0x4,%edx
801049d9: 89 44 24 04 mov %eax,0x4(%esp)
801049dd: 89 14 24 mov %edx,(%esp)
801049e0: e8 ed 08 00 00 call 801052d2 <swtch>
switchkvm();
801049e5: e8 6c 32 00 00 call 80107c56 <switchkvm>
// Process is done running for now.
// It should have changed its p->state before coming back.
proc = 0;
801049ea: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
801049f1: 00 00 00 00
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801049f5: 83 45 f4 7c addl $0x7c,-0xc(%ebp)
801049f9: 81 7d f4 f4 48 11 80 cmpl $0x801148f4,-0xc(%ebp)
80104a00: 72 99 jb 8010499b <scheduler+0x20>
// Process is done running for now.
// It should have changed its p->state before coming back.
proc = 0;
}
release(&ptable.lock);
80104a02: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104a09: e8 41 04 00 00 call 80104e4f <release>
}
80104a0e: e9 6e ff ff ff jmp 80104981 <scheduler+0x6>
80104a13 <sched>:
// Enter scheduler. Must hold only ptable.lock
// and have changed proc->state.
void
sched(void)
{
80104a13: 55 push %ebp
80104a14: 89 e5 mov %esp,%ebp
80104a16: 83 ec 28 sub $0x28,%esp
int intena;
if(!holding(&ptable.lock))
80104a19: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104a20: e8 f2 04 00 00 call 80104f17 <holding>
80104a25: 85 c0 test %eax,%eax
80104a27: 75 0c jne 80104a35 <sched+0x22>
panic("sched ptable.lock");
80104a29: c7 04 24 09 87 10 80 movl $0x80108709,(%esp)
80104a30: e8 05 bb ff ff call 8010053a <panic>
if(cpu->ncli != 1)
80104a35: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104a3b: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
80104a41: 83 f8 01 cmp $0x1,%eax
80104a44: 74 0c je 80104a52 <sched+0x3f>
panic("sched locks");
80104a46: c7 04 24 1b 87 10 80 movl $0x8010871b,(%esp)
80104a4d: e8 e8 ba ff ff call 8010053a <panic>
if(proc->state == RUNNING)
80104a52: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104a58: 8b 40 0c mov 0xc(%eax),%eax
80104a5b: 83 f8 04 cmp $0x4,%eax
80104a5e: 75 0c jne 80104a6c <sched+0x59>
panic("sched running");
80104a60: c7 04 24 27 87 10 80 movl $0x80108727,(%esp)
80104a67: e8 ce ba ff ff call 8010053a <panic>
if(readeflags()&FL_IF)
80104a6c: e8 68 f8 ff ff call 801042d9 <readeflags>
80104a71: 25 00 02 00 00 and $0x200,%eax
80104a76: 85 c0 test %eax,%eax
80104a78: 74 0c je 80104a86 <sched+0x73>
panic("sched interruptible");
80104a7a: c7 04 24 35 87 10 80 movl $0x80108735,(%esp)
80104a81: e8 b4 ba ff ff call 8010053a <panic>
intena = cpu->intena;
80104a86: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104a8c: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax
80104a92: 89 45 f4 mov %eax,-0xc(%ebp)
swtch(&proc->context, cpu->scheduler);
80104a95: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104a9b: 8b 40 04 mov 0x4(%eax),%eax
80104a9e: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80104aa5: 83 c2 1c add $0x1c,%edx
80104aa8: 89 44 24 04 mov %eax,0x4(%esp)
80104aac: 89 14 24 mov %edx,(%esp)
80104aaf: e8 1e 08 00 00 call 801052d2 <swtch>
cpu->intena = intena;
80104ab4: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104aba: 8b 55 f4 mov -0xc(%ebp),%edx
80104abd: 89 90 b0 00 00 00 mov %edx,0xb0(%eax)
}
80104ac3: c9 leave
80104ac4: c3 ret
80104ac5 <yield>:
// Give up the CPU for one scheduling round.
void
yield(void)
{
80104ac5: 55 push %ebp
80104ac6: 89 e5 mov %esp,%ebp
80104ac8: 83 ec 18 sub $0x18,%esp
acquire(&ptable.lock); //DOC: yieldlock
80104acb: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104ad2: e8 16 03 00 00 call 80104ded <acquire>
proc->state = RUNNABLE;
80104ad7: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104add: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
sched();
80104ae4: e8 2a ff ff ff call 80104a13 <sched>
release(&ptable.lock);
80104ae9: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104af0: e8 5a 03 00 00 call 80104e4f <release>
}
80104af5: c9 leave
80104af6: c3 ret
80104af7 <forkret>:
// A fork child's very first scheduling by scheduler()
// will swtch here. "Return" to user space.
void
forkret(void)
{
80104af7: 55 push %ebp
80104af8: 89 e5 mov %esp,%ebp
80104afa: 83 ec 18 sub $0x18,%esp
static int first = 1;
// Still holding ptable.lock from scheduler.
release(&ptable.lock);
80104afd: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104b04: e8 46 03 00 00 call 80104e4f <release>
if (first) {
80104b09: a1 08 b0 10 80 mov 0x8010b008,%eax
80104b0e: 85 c0 test %eax,%eax
80104b10: 74 0f je 80104b21 <forkret+0x2a>
// Some initialization functions must be run in the context
// of a regular process (e.g., they call sleep), and thus cannot
// be run from main().
first = 0;
80104b12: c7 05 08 b0 10 80 00 movl $0x0,0x8010b008
80104b19: 00 00 00
initlog();
80104b1c: e8 fc e6 ff ff call 8010321d <initlog>
}
// Return to "caller", actually trapret (see allocproc).
}
80104b21: c9 leave
80104b22: c3 ret
80104b23 <sleep>:
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80104b23: 55 push %ebp
80104b24: 89 e5 mov %esp,%ebp
80104b26: 83 ec 18 sub $0x18,%esp
if(proc == 0)
80104b29: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b2f: 85 c0 test %eax,%eax
80104b31: 75 0c jne 80104b3f <sleep+0x1c>
panic("sleep");
80104b33: c7 04 24 49 87 10 80 movl $0x80108749,(%esp)
80104b3a: e8 fb b9 ff ff call 8010053a <panic>
if(lk == 0)
80104b3f: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80104b43: 75 0c jne 80104b51 <sleep+0x2e>
panic("sleep without lk");
80104b45: c7 04 24 4f 87 10 80 movl $0x8010874f,(%esp)
80104b4c: e8 e9 b9 ff ff call 8010053a <panic>
// change p->state and then call sched.
// Once we hold ptable.lock, we can be
// guaranteed that we won't miss any wakeup
// (wakeup runs with ptable.lock locked),
// so it's okay to release lk.
if(lk != &ptable.lock){ //DOC: sleeplock0
80104b51: 81 7d 0c c0 29 11 80 cmpl $0x801129c0,0xc(%ebp)
80104b58: 74 17 je 80104b71 <sleep+0x4e>
acquire(&ptable.lock); //DOC: sleeplock1
80104b5a: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104b61: e8 87 02 00 00 call 80104ded <acquire>
release(lk);
80104b66: 8b 45 0c mov 0xc(%ebp),%eax
80104b69: 89 04 24 mov %eax,(%esp)
80104b6c: e8 de 02 00 00 call 80104e4f <release>
}
// Go to sleep.
proc->chan = chan;
80104b71: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b77: 8b 55 08 mov 0x8(%ebp),%edx
80104b7a: 89 50 20 mov %edx,0x20(%eax)
proc->state = SLEEPING;
80104b7d: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b83: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax)
sched();
80104b8a: e8 84 fe ff ff call 80104a13 <sched>
// Tidy up.
proc->chan = 0;
80104b8f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b95: c7 40 20 00 00 00 00 movl $0x0,0x20(%eax)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
80104b9c: 81 7d 0c c0 29 11 80 cmpl $0x801129c0,0xc(%ebp)
80104ba3: 74 17 je 80104bbc <sleep+0x99>
release(&ptable.lock);
80104ba5: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104bac: e8 9e 02 00 00 call 80104e4f <release>
acquire(lk);
80104bb1: 8b 45 0c mov 0xc(%ebp),%eax
80104bb4: 89 04 24 mov %eax,(%esp)
80104bb7: e8 31 02 00 00 call 80104ded <acquire>
}
}
80104bbc: c9 leave
80104bbd: c3 ret
80104bbe <wakeup1>:
//PAGEBREAK!
// Wake up all processes sleeping on chan.
// The ptable lock must be held.
static void
wakeup1(void *chan)
{
80104bbe: 55 push %ebp
80104bbf: 89 e5 mov %esp,%ebp
80104bc1: 83 ec 10 sub $0x10,%esp
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104bc4: c7 45 fc f4 29 11 80 movl $0x801129f4,-0x4(%ebp)
80104bcb: eb 24 jmp 80104bf1 <wakeup1+0x33>
if(p->state == SLEEPING && p->chan == chan)
80104bcd: 8b 45 fc mov -0x4(%ebp),%eax
80104bd0: 8b 40 0c mov 0xc(%eax),%eax
80104bd3: 83 f8 02 cmp $0x2,%eax
80104bd6: 75 15 jne 80104bed <wakeup1+0x2f>
80104bd8: 8b 45 fc mov -0x4(%ebp),%eax
80104bdb: 8b 40 20 mov 0x20(%eax),%eax
80104bde: 3b 45 08 cmp 0x8(%ebp),%eax
80104be1: 75 0a jne 80104bed <wakeup1+0x2f>
p->state = RUNNABLE;
80104be3: 8b 45 fc mov -0x4(%ebp),%eax
80104be6: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104bed: 83 45 fc 7c addl $0x7c,-0x4(%ebp)
80104bf1: 81 7d fc f4 48 11 80 cmpl $0x801148f4,-0x4(%ebp)
80104bf8: 72 d3 jb 80104bcd <wakeup1+0xf>
if(p->state == SLEEPING && p->chan == chan)
p->state = RUNNABLE;
}
80104bfa: c9 leave
80104bfb: c3 ret
80104bfc <wakeup>:
// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80104bfc: 55 push %ebp
80104bfd: 89 e5 mov %esp,%ebp
80104bff: 83 ec 18 sub $0x18,%esp
acquire(&ptable.lock);
80104c02: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104c09: e8 df 01 00 00 call 80104ded <acquire>
wakeup1(chan);
80104c0e: 8b 45 08 mov 0x8(%ebp),%eax
80104c11: 89 04 24 mov %eax,(%esp)
80104c14: e8 a5 ff ff ff call 80104bbe <wakeup1>
release(&ptable.lock);
80104c19: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104c20: e8 2a 02 00 00 call 80104e4f <release>
}
80104c25: c9 leave
80104c26: c3 ret
80104c27 <kill>:
// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid)
{
80104c27: 55 push %ebp
80104c28: 89 e5 mov %esp,%ebp
80104c2a: 83 ec 28 sub $0x28,%esp
struct proc *p;
acquire(&ptable.lock);
80104c2d: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104c34: e8 b4 01 00 00 call 80104ded <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104c39: c7 45 f4 f4 29 11 80 movl $0x801129f4,-0xc(%ebp)
80104c40: eb 41 jmp 80104c83 <kill+0x5c>
if(p->pid == pid){
80104c42: 8b 45 f4 mov -0xc(%ebp),%eax
80104c45: 8b 40 10 mov 0x10(%eax),%eax
80104c48: 3b 45 08 cmp 0x8(%ebp),%eax
80104c4b: 75 32 jne 80104c7f <kill+0x58>
p->killed = 1;
80104c4d: 8b 45 f4 mov -0xc(%ebp),%eax
80104c50: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
80104c57: 8b 45 f4 mov -0xc(%ebp),%eax
80104c5a: 8b 40 0c mov 0xc(%eax),%eax
80104c5d: 83 f8 02 cmp $0x2,%eax
80104c60: 75 0a jne 80104c6c <kill+0x45>
p->state = RUNNABLE;
80104c62: 8b 45 f4 mov -0xc(%ebp),%eax
80104c65: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
release(&ptable.lock);
80104c6c: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104c73: e8 d7 01 00 00 call 80104e4f <release>
return 0;
80104c78: b8 00 00 00 00 mov $0x0,%eax
80104c7d: eb 1e jmp 80104c9d <kill+0x76>
kill(int pid)
{
struct proc *p;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104c7f: 83 45 f4 7c addl $0x7c,-0xc(%ebp)
80104c83: 81 7d f4 f4 48 11 80 cmpl $0x801148f4,-0xc(%ebp)
80104c8a: 72 b6 jb 80104c42 <kill+0x1b>
p->state = RUNNABLE;
release(&ptable.lock);
return 0;
}
}
release(&ptable.lock);
80104c8c: c7 04 24 c0 29 11 80 movl $0x801129c0,(%esp)
80104c93: e8 b7 01 00 00 call 80104e4f <release>
return -1;
80104c98: b8 ff ff ff ff mov $0xffffffff,%eax
}
80104c9d: c9 leave
80104c9e: c3 ret
80104c9f <procdump>:
// Print a process listing to console. For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
80104c9f: 55 push %ebp
80104ca0: 89 e5 mov %esp,%ebp
80104ca2: 83 ec 58 sub $0x58,%esp
int i;
struct proc *p;
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104ca5: c7 45 f0 f4 29 11 80 movl $0x801129f4,-0x10(%ebp)
80104cac: e9 d6 00 00 00 jmp 80104d87 <procdump+0xe8>
if(p->state == UNUSED)
80104cb1: 8b 45 f0 mov -0x10(%ebp),%eax
80104cb4: 8b 40 0c mov 0xc(%eax),%eax
80104cb7: 85 c0 test %eax,%eax
80104cb9: 75 05 jne 80104cc0 <procdump+0x21>
continue;
80104cbb: e9 c3 00 00 00 jmp 80104d83 <procdump+0xe4>
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
80104cc0: 8b 45 f0 mov -0x10(%ebp),%eax
80104cc3: 8b 40 0c mov 0xc(%eax),%eax
80104cc6: 83 f8 05 cmp $0x5,%eax
80104cc9: 77 23 ja 80104cee <procdump+0x4f>
80104ccb: 8b 45 f0 mov -0x10(%ebp),%eax
80104cce: 8b 40 0c mov 0xc(%eax),%eax
80104cd1: 8b 04 85 0c b0 10 80 mov -0x7fef4ff4(,%eax,4),%eax
80104cd8: 85 c0 test %eax,%eax
80104cda: 74 12 je 80104cee <procdump+0x4f>
state = states[p->state];
80104cdc: 8b 45 f0 mov -0x10(%ebp),%eax
80104cdf: 8b 40 0c mov 0xc(%eax),%eax
80104ce2: 8b 04 85 0c b0 10 80 mov -0x7fef4ff4(,%eax,4),%eax
80104ce9: 89 45 ec mov %eax,-0x14(%ebp)
80104cec: eb 07 jmp 80104cf5 <procdump+0x56>
else
state = "???";
80104cee: c7 45 ec 60 87 10 80 movl $0x80108760,-0x14(%ebp)
cprintf("%d %s %s", p->pid, state, p->name);
80104cf5: 8b 45 f0 mov -0x10(%ebp),%eax
80104cf8: 8d 50 6c lea 0x6c(%eax),%edx
80104cfb: 8b 45 f0 mov -0x10(%ebp),%eax
80104cfe: 8b 40 10 mov 0x10(%eax),%eax
80104d01: 89 54 24 0c mov %edx,0xc(%esp)
80104d05: 8b 55 ec mov -0x14(%ebp),%edx
80104d08: 89 54 24 08 mov %edx,0x8(%esp)
80104d0c: 89 44 24 04 mov %eax,0x4(%esp)
80104d10: c7 04 24 64 87 10 80 movl $0x80108764,(%esp)
80104d17: e8 84 b6 ff ff call 801003a0 <cprintf>
if(p->state == SLEEPING){
80104d1c: 8b 45 f0 mov -0x10(%ebp),%eax
80104d1f: 8b 40 0c mov 0xc(%eax),%eax
80104d22: 83 f8 02 cmp $0x2,%eax
80104d25: 75 50 jne 80104d77 <procdump+0xd8>
getcallerpcs((uint*)p->context->ebp+2, pc);
80104d27: 8b 45 f0 mov -0x10(%ebp),%eax
80104d2a: 8b 40 1c mov 0x1c(%eax),%eax
80104d2d: 8b 40 0c mov 0xc(%eax),%eax
80104d30: 83 c0 08 add $0x8,%eax
80104d33: 8d 55 c4 lea -0x3c(%ebp),%edx
80104d36: 89 54 24 04 mov %edx,0x4(%esp)
80104d3a: 89 04 24 mov %eax,(%esp)
80104d3d: e8 5c 01 00 00 call 80104e9e <getcallerpcs>
for(i=0; i<10 && pc[i] != 0; i++)
80104d42: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80104d49: eb 1b jmp 80104d66 <procdump+0xc7>
cprintf(" %p", pc[i]);
80104d4b: 8b 45 f4 mov -0xc(%ebp),%eax
80104d4e: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax
80104d52: 89 44 24 04 mov %eax,0x4(%esp)
80104d56: c7 04 24 6d 87 10 80 movl $0x8010876d,(%esp)
80104d5d: e8 3e b6 ff ff call 801003a0 <cprintf>
else
state = "???";
cprintf("%d %s %s", p->pid, state, p->name);
if(p->state == SLEEPING){
getcallerpcs((uint*)p->context->ebp+2, pc);
for(i=0; i<10 && pc[i] != 0; i++)
80104d62: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80104d66: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
80104d6a: 7f 0b jg 80104d77 <procdump+0xd8>
80104d6c: 8b 45 f4 mov -0xc(%ebp),%eax
80104d6f: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax
80104d73: 85 c0 test %eax,%eax
80104d75: 75 d4 jne 80104d4b <procdump+0xac>
cprintf(" %p", pc[i]);
}
cprintf("\n");
80104d77: c7 04 24 71 87 10 80 movl $0x80108771,(%esp)
80104d7e: e8 1d b6 ff ff call 801003a0 <cprintf>
int i;
struct proc *p;
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104d83: 83 45 f0 7c addl $0x7c,-0x10(%ebp)
80104d87: 81 7d f0 f4 48 11 80 cmpl $0x801148f4,-0x10(%ebp)
80104d8e: 0f 82 1d ff ff ff jb 80104cb1 <procdump+0x12>
for(i=0; i<10 && pc[i] != 0; i++)
cprintf(" %p", pc[i]);
}
cprintf("\n");
}
}
80104d94: c9 leave
80104d95: c3 ret
80104d96 <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
80104d96: 55 push %ebp
80104d97: 89 e5 mov %esp,%ebp
80104d99: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80104d9c: 9c pushf
80104d9d: 58 pop %eax
80104d9e: 89 45 fc mov %eax,-0x4(%ebp)
return eflags;
80104da1: 8b 45 fc mov -0x4(%ebp),%eax
}
80104da4: c9 leave
80104da5: c3 ret
80104da6 <cli>:
asm volatile("movw %0, %%gs" : : "r" (v));
}
static inline void
cli(void)
{
80104da6: 55 push %ebp
80104da7: 89 e5 mov %esp,%ebp
asm volatile("cli");
80104da9: fa cli
}
80104daa: 5d pop %ebp
80104dab: c3 ret
80104dac <sti>:
static inline void
sti(void)
{
80104dac: 55 push %ebp
80104dad: 89 e5 mov %esp,%ebp
asm volatile("sti");
80104daf: fb sti
}
80104db0: 5d pop %ebp
80104db1: c3 ret
80104db2 <xchg>:
static inline uint
xchg(volatile uint *addr, uint newval)
{
80104db2: 55 push %ebp
80104db3: 89 e5 mov %esp,%ebp
80104db5: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
80104db8: 8b 55 08 mov 0x8(%ebp),%edx
80104dbb: 8b 45 0c mov 0xc(%ebp),%eax
80104dbe: 8b 4d 08 mov 0x8(%ebp),%ecx
80104dc1: f0 87 02 lock xchg %eax,(%edx)
80104dc4: 89 45 fc mov %eax,-0x4(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
80104dc7: 8b 45 fc mov -0x4(%ebp),%eax
}
80104dca: c9 leave
80104dcb: c3 ret
80104dcc <initlock>:
#include "proc.h"
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
80104dcc: 55 push %ebp
80104dcd: 89 e5 mov %esp,%ebp
lk->name = name;
80104dcf: 8b 45 08 mov 0x8(%ebp),%eax
80104dd2: 8b 55 0c mov 0xc(%ebp),%edx
80104dd5: 89 50 04 mov %edx,0x4(%eax)
lk->locked = 0;
80104dd8: 8b 45 08 mov 0x8(%ebp),%eax
80104ddb: c7 00 00 00 00 00 movl $0x0,(%eax)
lk->cpu = 0;
80104de1: 8b 45 08 mov 0x8(%ebp),%eax
80104de4: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
80104deb: 5d pop %ebp
80104dec: c3 ret
80104ded <acquire>:
// Loops (spins) until the lock is acquired.
// Holding a lock for a long time may cause
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
80104ded: 55 push %ebp
80104dee: 89 e5 mov %esp,%ebp
80104df0: 83 ec 18 sub $0x18,%esp
pushcli(); // disable interrupts to avoid deadlock.
80104df3: e8 49 01 00 00 call 80104f41 <pushcli>
if(holding(lk))
80104df8: 8b 45 08 mov 0x8(%ebp),%eax
80104dfb: 89 04 24 mov %eax,(%esp)
80104dfe: e8 14 01 00 00 call 80104f17 <holding>
80104e03: 85 c0 test %eax,%eax
80104e05: 74 0c je 80104e13 <acquire+0x26>
panic("acquire");
80104e07: c7 04 24 9d 87 10 80 movl $0x8010879d,(%esp)
80104e0e: e8 27 b7 ff ff call 8010053a <panic>
// The xchg is atomic.
// It also serializes, so that reads after acquire are not
// reordered before it.
while(xchg(&lk->locked, 1) != 0)
80104e13: 90 nop
80104e14: 8b 45 08 mov 0x8(%ebp),%eax
80104e17: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80104e1e: 00
80104e1f: 89 04 24 mov %eax,(%esp)
80104e22: e8 8b ff ff ff call 80104db2 <xchg>
80104e27: 85 c0 test %eax,%eax
80104e29: 75 e9 jne 80104e14 <acquire+0x27>
;
// Record info about lock acquisition for debugging.
lk->cpu = cpu;
80104e2b: 8b 45 08 mov 0x8(%ebp),%eax
80104e2e: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80104e35: 89 50 08 mov %edx,0x8(%eax)
getcallerpcs(&lk, lk->pcs);
80104e38: 8b 45 08 mov 0x8(%ebp),%eax
80104e3b: 83 c0 0c add $0xc,%eax
80104e3e: 89 44 24 04 mov %eax,0x4(%esp)
80104e42: 8d 45 08 lea 0x8(%ebp),%eax
80104e45: 89 04 24 mov %eax,(%esp)
80104e48: e8 51 00 00 00 call 80104e9e <getcallerpcs>
}
80104e4d: c9 leave
80104e4e: c3 ret
80104e4f <release>:
// Release the lock.
void
release(struct spinlock *lk)
{
80104e4f: 55 push %ebp
80104e50: 89 e5 mov %esp,%ebp
80104e52: 83 ec 18 sub $0x18,%esp
if(!holding(lk))
80104e55: 8b 45 08 mov 0x8(%ebp),%eax
80104e58: 89 04 24 mov %eax,(%esp)
80104e5b: e8 b7 00 00 00 call 80104f17 <holding>
80104e60: 85 c0 test %eax,%eax
80104e62: 75 0c jne 80104e70 <release+0x21>
panic("release");
80104e64: c7 04 24 a5 87 10 80 movl $0x801087a5,(%esp)
80104e6b: e8 ca b6 ff ff call 8010053a <panic>
lk->pcs[0] = 0;
80104e70: 8b 45 08 mov 0x8(%ebp),%eax
80104e73: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
lk->cpu = 0;
80104e7a: 8b 45 08 mov 0x8(%ebp),%eax
80104e7d: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
// But the 2007 Intel 64 Architecture Memory Ordering White
// Paper says that Intel 64 and IA-32 will not move a load
// after a store. So lock->locked = 0 would work here.
// The xchg being asm volatile ensures gcc emits it after
// the above assignments (and after the critical section).
xchg(&lk->locked, 0);
80104e84: 8b 45 08 mov 0x8(%ebp),%eax
80104e87: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80104e8e: 00
80104e8f: 89 04 24 mov %eax,(%esp)
80104e92: e8 1b ff ff ff call 80104db2 <xchg>
popcli();
80104e97: e8 e9 00 00 00 call 80104f85 <popcli>
}
80104e9c: c9 leave
80104e9d: c3 ret
80104e9e <getcallerpcs>:
// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
80104e9e: 55 push %ebp
80104e9f: 89 e5 mov %esp,%ebp
80104ea1: 83 ec 10 sub $0x10,%esp
uint *ebp;
int i;
ebp = (uint*)v - 2;
80104ea4: 8b 45 08 mov 0x8(%ebp),%eax
80104ea7: 83 e8 08 sub $0x8,%eax
80104eaa: 89 45 fc mov %eax,-0x4(%ebp)
for(i = 0; i < 10; i++){
80104ead: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp)
80104eb4: eb 38 jmp 80104eee <getcallerpcs+0x50>
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
80104eb6: 83 7d fc 00 cmpl $0x0,-0x4(%ebp)
80104eba: 74 38 je 80104ef4 <getcallerpcs+0x56>
80104ebc: 81 7d fc ff ff ff 7f cmpl $0x7fffffff,-0x4(%ebp)
80104ec3: 76 2f jbe 80104ef4 <getcallerpcs+0x56>
80104ec5: 83 7d fc ff cmpl $0xffffffff,-0x4(%ebp)
80104ec9: 74 29 je 80104ef4 <getcallerpcs+0x56>
break;
pcs[i] = ebp[1]; // saved %eip
80104ecb: 8b 45 f8 mov -0x8(%ebp),%eax
80104ece: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80104ed5: 8b 45 0c mov 0xc(%ebp),%eax
80104ed8: 01 c2 add %eax,%edx
80104eda: 8b 45 fc mov -0x4(%ebp),%eax
80104edd: 8b 40 04 mov 0x4(%eax),%eax
80104ee0: 89 02 mov %eax,(%edx)
ebp = (uint*)ebp[0]; // saved %ebp
80104ee2: 8b 45 fc mov -0x4(%ebp),%eax
80104ee5: 8b 00 mov (%eax),%eax
80104ee7: 89 45 fc mov %eax,-0x4(%ebp)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80104eea: 83 45 f8 01 addl $0x1,-0x8(%ebp)
80104eee: 83 7d f8 09 cmpl $0x9,-0x8(%ebp)
80104ef2: 7e c2 jle 80104eb6 <getcallerpcs+0x18>
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
80104ef4: eb 19 jmp 80104f0f <getcallerpcs+0x71>
pcs[i] = 0;
80104ef6: 8b 45 f8 mov -0x8(%ebp),%eax
80104ef9: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80104f00: 8b 45 0c mov 0xc(%ebp),%eax
80104f03: 01 d0 add %edx,%eax
80104f05: c7 00 00 00 00 00 movl $0x0,(%eax)
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
80104f0b: 83 45 f8 01 addl $0x1,-0x8(%ebp)
80104f0f: 83 7d f8 09 cmpl $0x9,-0x8(%ebp)
80104f13: 7e e1 jle 80104ef6 <getcallerpcs+0x58>
pcs[i] = 0;
}
80104f15: c9 leave
80104f16: c3 ret
80104f17 <holding>:
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80104f17: 55 push %ebp
80104f18: 89 e5 mov %esp,%ebp
return lock->locked && lock->cpu == cpu;
80104f1a: 8b 45 08 mov 0x8(%ebp),%eax
80104f1d: 8b 00 mov (%eax),%eax
80104f1f: 85 c0 test %eax,%eax
80104f21: 74 17 je 80104f3a <holding+0x23>
80104f23: 8b 45 08 mov 0x8(%ebp),%eax
80104f26: 8b 50 08 mov 0x8(%eax),%edx
80104f29: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104f2f: 39 c2 cmp %eax,%edx
80104f31: 75 07 jne 80104f3a <holding+0x23>
80104f33: b8 01 00 00 00 mov $0x1,%eax
80104f38: eb 05 jmp 80104f3f <holding+0x28>
80104f3a: b8 00 00 00 00 mov $0x0,%eax
}
80104f3f: 5d pop %ebp
80104f40: c3 ret
80104f41 <pushcli>:
// it takes two popcli to undo two pushcli. Also, if interrupts
// are off, then pushcli, popcli leaves them off.
void
pushcli(void)
{
80104f41: 55 push %ebp
80104f42: 89 e5 mov %esp,%ebp
80104f44: 83 ec 10 sub $0x10,%esp
int eflags;
eflags = readeflags();
80104f47: e8 4a fe ff ff call 80104d96 <readeflags>
80104f4c: 89 45 fc mov %eax,-0x4(%ebp)
cli();
80104f4f: e8 52 fe ff ff call 80104da6 <cli>
if(cpu->ncli++ == 0)
80104f54: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80104f5b: 8b 82 ac 00 00 00 mov 0xac(%edx),%eax
80104f61: 8d 48 01 lea 0x1(%eax),%ecx
80104f64: 89 8a ac 00 00 00 mov %ecx,0xac(%edx)
80104f6a: 85 c0 test %eax,%eax
80104f6c: 75 15 jne 80104f83 <pushcli+0x42>
cpu->intena = eflags & FL_IF;
80104f6e: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104f74: 8b 55 fc mov -0x4(%ebp),%edx
80104f77: 81 e2 00 02 00 00 and $0x200,%edx
80104f7d: 89 90 b0 00 00 00 mov %edx,0xb0(%eax)
}
80104f83: c9 leave
80104f84: c3 ret
80104f85 <popcli>:
void
popcli(void)
{
80104f85: 55 push %ebp
80104f86: 89 e5 mov %esp,%ebp
80104f88: 83 ec 18 sub $0x18,%esp
if(readeflags()&FL_IF)
80104f8b: e8 06 fe ff ff call 80104d96 <readeflags>
80104f90: 25 00 02 00 00 and $0x200,%eax
80104f95: 85 c0 test %eax,%eax
80104f97: 74 0c je 80104fa5 <popcli+0x20>
panic("popcli - interruptible");
80104f99: c7 04 24 ad 87 10 80 movl $0x801087ad,(%esp)
80104fa0: e8 95 b5 ff ff call 8010053a <panic>
if(--cpu->ncli < 0)
80104fa5: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104fab: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx
80104fb1: 83 ea 01 sub $0x1,%edx
80104fb4: 89 90 ac 00 00 00 mov %edx,0xac(%eax)
80104fba: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
80104fc0: 85 c0 test %eax,%eax
80104fc2: 79 0c jns 80104fd0 <popcli+0x4b>
panic("popcli");
80104fc4: c7 04 24 c4 87 10 80 movl $0x801087c4,(%esp)
80104fcb: e8 6a b5 ff ff call 8010053a <panic>
if(cpu->ncli == 0 && cpu->intena)
80104fd0: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104fd6: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
80104fdc: 85 c0 test %eax,%eax
80104fde: 75 15 jne 80104ff5 <popcli+0x70>
80104fe0: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104fe6: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax
80104fec: 85 c0 test %eax,%eax
80104fee: 74 05 je 80104ff5 <popcli+0x70>
sti();
80104ff0: e8 b7 fd ff ff call 80104dac <sti>
}
80104ff5: c9 leave
80104ff6: c3 ret
80104ff7 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
80104ff7: 55 push %ebp
80104ff8: 89 e5 mov %esp,%ebp
80104ffa: 57 push %edi
80104ffb: 53 push %ebx
asm volatile("cld; rep stosb" :
80104ffc: 8b 4d 08 mov 0x8(%ebp),%ecx
80104fff: 8b 55 10 mov 0x10(%ebp),%edx
80105002: 8b 45 0c mov 0xc(%ebp),%eax
80105005: 89 cb mov %ecx,%ebx
80105007: 89 df mov %ebx,%edi
80105009: 89 d1 mov %edx,%ecx
8010500b: fc cld
8010500c: f3 aa rep stos %al,%es:(%edi)
8010500e: 89 ca mov %ecx,%edx
80105010: 89 fb mov %edi,%ebx
80105012: 89 5d 08 mov %ebx,0x8(%ebp)
80105015: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
80105018: 5b pop %ebx
80105019: 5f pop %edi
8010501a: 5d pop %ebp
8010501b: c3 ret
8010501c <stosl>:
static inline void
stosl(void *addr, int data, int cnt)
{
8010501c: 55 push %ebp
8010501d: 89 e5 mov %esp,%ebp
8010501f: 57 push %edi
80105020: 53 push %ebx
asm volatile("cld; rep stosl" :
80105021: 8b 4d 08 mov 0x8(%ebp),%ecx
80105024: 8b 55 10 mov 0x10(%ebp),%edx
80105027: 8b 45 0c mov 0xc(%ebp),%eax
8010502a: 89 cb mov %ecx,%ebx
8010502c: 89 df mov %ebx,%edi
8010502e: 89 d1 mov %edx,%ecx
80105030: fc cld
80105031: f3 ab rep stos %eax,%es:(%edi)
80105033: 89 ca mov %ecx,%edx
80105035: 89 fb mov %edi,%ebx
80105037: 89 5d 08 mov %ebx,0x8(%ebp)
8010503a: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
8010503d: 5b pop %ebx
8010503e: 5f pop %edi
8010503f: 5d pop %ebp
80105040: c3 ret
80105041 <memset>:
#include "types.h"
#include "x86.h"
void*
memset(void *dst, int c, uint n)
{
80105041: 55 push %ebp
80105042: 89 e5 mov %esp,%ebp
80105044: 83 ec 0c sub $0xc,%esp
if ((int)dst%4 == 0 && n%4 == 0){
80105047: 8b 45 08 mov 0x8(%ebp),%eax
8010504a: 83 e0 03 and $0x3,%eax
8010504d: 85 c0 test %eax,%eax
8010504f: 75 49 jne 8010509a <memset+0x59>
80105051: 8b 45 10 mov 0x10(%ebp),%eax
80105054: 83 e0 03 and $0x3,%eax
80105057: 85 c0 test %eax,%eax
80105059: 75 3f jne 8010509a <memset+0x59>
c &= 0xFF;
8010505b: 81 65 0c ff 00 00 00 andl $0xff,0xc(%ebp)
stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
80105062: 8b 45 10 mov 0x10(%ebp),%eax
80105065: c1 e8 02 shr $0x2,%eax
80105068: 89 c2 mov %eax,%edx
8010506a: 8b 45 0c mov 0xc(%ebp),%eax
8010506d: c1 e0 18 shl $0x18,%eax
80105070: 89 c1 mov %eax,%ecx
80105072: 8b 45 0c mov 0xc(%ebp),%eax
80105075: c1 e0 10 shl $0x10,%eax
80105078: 09 c1 or %eax,%ecx
8010507a: 8b 45 0c mov 0xc(%ebp),%eax
8010507d: c1 e0 08 shl $0x8,%eax
80105080: 09 c8 or %ecx,%eax
80105082: 0b 45 0c or 0xc(%ebp),%eax
80105085: 89 54 24 08 mov %edx,0x8(%esp)
80105089: 89 44 24 04 mov %eax,0x4(%esp)
8010508d: 8b 45 08 mov 0x8(%ebp),%eax
80105090: 89 04 24 mov %eax,(%esp)
80105093: e8 84 ff ff ff call 8010501c <stosl>
80105098: eb 19 jmp 801050b3 <memset+0x72>
} else
stosb(dst, c, n);
8010509a: 8b 45 10 mov 0x10(%ebp),%eax
8010509d: 89 44 24 08 mov %eax,0x8(%esp)
801050a1: 8b 45 0c mov 0xc(%ebp),%eax
801050a4: 89 44 24 04 mov %eax,0x4(%esp)
801050a8: 8b 45 08 mov 0x8(%ebp),%eax
801050ab: 89 04 24 mov %eax,(%esp)
801050ae: e8 44 ff ff ff call 80104ff7 <stosb>
return dst;
801050b3: 8b 45 08 mov 0x8(%ebp),%eax
}
801050b6: c9 leave
801050b7: c3 ret
801050b8 <memcmp>:
int
memcmp(const void *v1, const void *v2, uint n)
{
801050b8: 55 push %ebp
801050b9: 89 e5 mov %esp,%ebp
801050bb: 83 ec 10 sub $0x10,%esp
const uchar *s1, *s2;
s1 = v1;
801050be: 8b 45 08 mov 0x8(%ebp),%eax
801050c1: 89 45 fc mov %eax,-0x4(%ebp)
s2 = v2;
801050c4: 8b 45 0c mov 0xc(%ebp),%eax
801050c7: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0){
801050ca: eb 30 jmp 801050fc <memcmp+0x44>
if(*s1 != *s2)
801050cc: 8b 45 fc mov -0x4(%ebp),%eax
801050cf: 0f b6 10 movzbl (%eax),%edx
801050d2: 8b 45 f8 mov -0x8(%ebp),%eax
801050d5: 0f b6 00 movzbl (%eax),%eax
801050d8: 38 c2 cmp %al,%dl
801050da: 74 18 je 801050f4 <memcmp+0x3c>
return *s1 - *s2;
801050dc: 8b 45 fc mov -0x4(%ebp),%eax
801050df: 0f b6 00 movzbl (%eax),%eax
801050e2: 0f b6 d0 movzbl %al,%edx
801050e5: 8b 45 f8 mov -0x8(%ebp),%eax
801050e8: 0f b6 00 movzbl (%eax),%eax
801050eb: 0f b6 c0 movzbl %al,%eax
801050ee: 29 c2 sub %eax,%edx
801050f0: 89 d0 mov %edx,%eax
801050f2: eb 1a jmp 8010510e <memcmp+0x56>
s1++, s2++;
801050f4: 83 45 fc 01 addl $0x1,-0x4(%ebp)
801050f8: 83 45 f8 01 addl $0x1,-0x8(%ebp)
{
const uchar *s1, *s2;
s1 = v1;
s2 = v2;
while(n-- > 0){
801050fc: 8b 45 10 mov 0x10(%ebp),%eax
801050ff: 8d 50 ff lea -0x1(%eax),%edx
80105102: 89 55 10 mov %edx,0x10(%ebp)
80105105: 85 c0 test %eax,%eax
80105107: 75 c3 jne 801050cc <memcmp+0x14>
if(*s1 != *s2)
return *s1 - *s2;
s1++, s2++;
}
return 0;
80105109: b8 00 00 00 00 mov $0x0,%eax
}
8010510e: c9 leave
8010510f: c3 ret
80105110 <memmove>:
void*
memmove(void *dst, const void *src, uint n)
{
80105110: 55 push %ebp
80105111: 89 e5 mov %esp,%ebp
80105113: 83 ec 10 sub $0x10,%esp
const char *s;
char *d;
s = src;
80105116: 8b 45 0c mov 0xc(%ebp),%eax
80105119: 89 45 fc mov %eax,-0x4(%ebp)
d = dst;
8010511c: 8b 45 08 mov 0x8(%ebp),%eax
8010511f: 89 45 f8 mov %eax,-0x8(%ebp)
if(s < d && s + n > d){
80105122: 8b 45 fc mov -0x4(%ebp),%eax
80105125: 3b 45 f8 cmp -0x8(%ebp),%eax
80105128: 73 3d jae 80105167 <memmove+0x57>
8010512a: 8b 45 10 mov 0x10(%ebp),%eax
8010512d: 8b 55 fc mov -0x4(%ebp),%edx
80105130: 01 d0 add %edx,%eax
80105132: 3b 45 f8 cmp -0x8(%ebp),%eax
80105135: 76 30 jbe 80105167 <memmove+0x57>
s += n;
80105137: 8b 45 10 mov 0x10(%ebp),%eax
8010513a: 01 45 fc add %eax,-0x4(%ebp)
d += n;
8010513d: 8b 45 10 mov 0x10(%ebp),%eax
80105140: 01 45 f8 add %eax,-0x8(%ebp)
while(n-- > 0)
80105143: eb 13 jmp 80105158 <memmove+0x48>
*--d = *--s;
80105145: 83 6d f8 01 subl $0x1,-0x8(%ebp)
80105149: 83 6d fc 01 subl $0x1,-0x4(%ebp)
8010514d: 8b 45 fc mov -0x4(%ebp),%eax
80105150: 0f b6 10 movzbl (%eax),%edx
80105153: 8b 45 f8 mov -0x8(%ebp),%eax
80105156: 88 10 mov %dl,(%eax)
s = src;
d = dst;
if(s < d && s + n > d){
s += n;
d += n;
while(n-- > 0)
80105158: 8b 45 10 mov 0x10(%ebp),%eax
8010515b: 8d 50 ff lea -0x1(%eax),%edx
8010515e: 89 55 10 mov %edx,0x10(%ebp)
80105161: 85 c0 test %eax,%eax
80105163: 75 e0 jne 80105145 <memmove+0x35>
const char *s;
char *d;
s = src;
d = dst;
if(s < d && s + n > d){
80105165: eb 26 jmp 8010518d <memmove+0x7d>
s += n;
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
80105167: eb 17 jmp 80105180 <memmove+0x70>
*d++ = *s++;
80105169: 8b 45 f8 mov -0x8(%ebp),%eax
8010516c: 8d 50 01 lea 0x1(%eax),%edx
8010516f: 89 55 f8 mov %edx,-0x8(%ebp)
80105172: 8b 55 fc mov -0x4(%ebp),%edx
80105175: 8d 4a 01 lea 0x1(%edx),%ecx
80105178: 89 4d fc mov %ecx,-0x4(%ebp)
8010517b: 0f b6 12 movzbl (%edx),%edx
8010517e: 88 10 mov %dl,(%eax)
s += n;
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
80105180: 8b 45 10 mov 0x10(%ebp),%eax
80105183: 8d 50 ff lea -0x1(%eax),%edx
80105186: 89 55 10 mov %edx,0x10(%ebp)
80105189: 85 c0 test %eax,%eax
8010518b: 75 dc jne 80105169 <memmove+0x59>
*d++ = *s++;
return dst;
8010518d: 8b 45 08 mov 0x8(%ebp),%eax
}
80105190: c9 leave
80105191: c3 ret
80105192 <memcpy>:
// memcpy exists to placate GCC. Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
80105192: 55 push %ebp
80105193: 89 e5 mov %esp,%ebp
80105195: 83 ec 0c sub $0xc,%esp
return memmove(dst, src, n);
80105198: 8b 45 10 mov 0x10(%ebp),%eax
8010519b: 89 44 24 08 mov %eax,0x8(%esp)
8010519f: 8b 45 0c mov 0xc(%ebp),%eax
801051a2: 89 44 24 04 mov %eax,0x4(%esp)
801051a6: 8b 45 08 mov 0x8(%ebp),%eax
801051a9: 89 04 24 mov %eax,(%esp)
801051ac: e8 5f ff ff ff call 80105110 <memmove>
}
801051b1: c9 leave
801051b2: c3 ret
801051b3 <strncmp>:
int
strncmp(const char *p, const char *q, uint n)
{
801051b3: 55 push %ebp
801051b4: 89 e5 mov %esp,%ebp
while(n > 0 && *p && *p == *q)
801051b6: eb 0c jmp 801051c4 <strncmp+0x11>
n--, p++, q++;
801051b8: 83 6d 10 01 subl $0x1,0x10(%ebp)
801051bc: 83 45 08 01 addl $0x1,0x8(%ebp)
801051c0: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strncmp(const char *p, const char *q, uint n)
{
while(n > 0 && *p && *p == *q)
801051c4: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801051c8: 74 1a je 801051e4 <strncmp+0x31>
801051ca: 8b 45 08 mov 0x8(%ebp),%eax
801051cd: 0f b6 00 movzbl (%eax),%eax
801051d0: 84 c0 test %al,%al
801051d2: 74 10 je 801051e4 <strncmp+0x31>
801051d4: 8b 45 08 mov 0x8(%ebp),%eax
801051d7: 0f b6 10 movzbl (%eax),%edx
801051da: 8b 45 0c mov 0xc(%ebp),%eax
801051dd: 0f b6 00 movzbl (%eax),%eax
801051e0: 38 c2 cmp %al,%dl
801051e2: 74 d4 je 801051b8 <strncmp+0x5>
n--, p++, q++;
if(n == 0)
801051e4: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801051e8: 75 07 jne 801051f1 <strncmp+0x3e>
return 0;
801051ea: b8 00 00 00 00 mov $0x0,%eax
801051ef: eb 16 jmp 80105207 <strncmp+0x54>
return (uchar)*p - (uchar)*q;
801051f1: 8b 45 08 mov 0x8(%ebp),%eax
801051f4: 0f b6 00 movzbl (%eax),%eax
801051f7: 0f b6 d0 movzbl %al,%edx
801051fa: 8b 45 0c mov 0xc(%ebp),%eax
801051fd: 0f b6 00 movzbl (%eax),%eax
80105200: 0f b6 c0 movzbl %al,%eax
80105203: 29 c2 sub %eax,%edx
80105205: 89 d0 mov %edx,%eax
}
80105207: 5d pop %ebp
80105208: c3 ret
80105209 <strncpy>:
char*
strncpy(char *s, const char *t, int n)
{
80105209: 55 push %ebp
8010520a: 89 e5 mov %esp,%ebp
8010520c: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
8010520f: 8b 45 08 mov 0x8(%ebp),%eax
80105212: 89 45 fc mov %eax,-0x4(%ebp)
while(n-- > 0 && (*s++ = *t++) != 0)
80105215: 90 nop
80105216: 8b 45 10 mov 0x10(%ebp),%eax
80105219: 8d 50 ff lea -0x1(%eax),%edx
8010521c: 89 55 10 mov %edx,0x10(%ebp)
8010521f: 85 c0 test %eax,%eax
80105221: 7e 1e jle 80105241 <strncpy+0x38>
80105223: 8b 45 08 mov 0x8(%ebp),%eax
80105226: 8d 50 01 lea 0x1(%eax),%edx
80105229: 89 55 08 mov %edx,0x8(%ebp)
8010522c: 8b 55 0c mov 0xc(%ebp),%edx
8010522f: 8d 4a 01 lea 0x1(%edx),%ecx
80105232: 89 4d 0c mov %ecx,0xc(%ebp)
80105235: 0f b6 12 movzbl (%edx),%edx
80105238: 88 10 mov %dl,(%eax)
8010523a: 0f b6 00 movzbl (%eax),%eax
8010523d: 84 c0 test %al,%al
8010523f: 75 d5 jne 80105216 <strncpy+0xd>
;
while(n-- > 0)
80105241: eb 0c jmp 8010524f <strncpy+0x46>
*s++ = 0;
80105243: 8b 45 08 mov 0x8(%ebp),%eax
80105246: 8d 50 01 lea 0x1(%eax),%edx
80105249: 89 55 08 mov %edx,0x8(%ebp)
8010524c: c6 00 00 movb $0x0,(%eax)
char *os;
os = s;
while(n-- > 0 && (*s++ = *t++) != 0)
;
while(n-- > 0)
8010524f: 8b 45 10 mov 0x10(%ebp),%eax
80105252: 8d 50 ff lea -0x1(%eax),%edx
80105255: 89 55 10 mov %edx,0x10(%ebp)
80105258: 85 c0 test %eax,%eax
8010525a: 7f e7 jg 80105243 <strncpy+0x3a>
*s++ = 0;
return os;
8010525c: 8b 45 fc mov -0x4(%ebp),%eax
}
8010525f: c9 leave
80105260: c3 ret
80105261 <safestrcpy>:
// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
80105261: 55 push %ebp
80105262: 89 e5 mov %esp,%ebp
80105264: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
80105267: 8b 45 08 mov 0x8(%ebp),%eax
8010526a: 89 45 fc mov %eax,-0x4(%ebp)
if(n <= 0)
8010526d: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80105271: 7f 05 jg 80105278 <safestrcpy+0x17>
return os;
80105273: 8b 45 fc mov -0x4(%ebp),%eax
80105276: eb 31 jmp 801052a9 <safestrcpy+0x48>
while(--n > 0 && (*s++ = *t++) != 0)
80105278: 83 6d 10 01 subl $0x1,0x10(%ebp)
8010527c: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80105280: 7e 1e jle 801052a0 <safestrcpy+0x3f>
80105282: 8b 45 08 mov 0x8(%ebp),%eax
80105285: 8d 50 01 lea 0x1(%eax),%edx
80105288: 89 55 08 mov %edx,0x8(%ebp)
8010528b: 8b 55 0c mov 0xc(%ebp),%edx
8010528e: 8d 4a 01 lea 0x1(%edx),%ecx
80105291: 89 4d 0c mov %ecx,0xc(%ebp)
80105294: 0f b6 12 movzbl (%edx),%edx
80105297: 88 10 mov %dl,(%eax)
80105299: 0f b6 00 movzbl (%eax),%eax
8010529c: 84 c0 test %al,%al
8010529e: 75 d8 jne 80105278 <safestrcpy+0x17>
;
*s = 0;
801052a0: 8b 45 08 mov 0x8(%ebp),%eax
801052a3: c6 00 00 movb $0x0,(%eax)
return os;
801052a6: 8b 45 fc mov -0x4(%ebp),%eax
}
801052a9: c9 leave
801052aa: c3 ret
801052ab <strlen>:
int
strlen(const char *s)
{
801052ab: 55 push %ebp
801052ac: 89 e5 mov %esp,%ebp
801052ae: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
801052b1: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
801052b8: eb 04 jmp 801052be <strlen+0x13>
801052ba: 83 45 fc 01 addl $0x1,-0x4(%ebp)
801052be: 8b 55 fc mov -0x4(%ebp),%edx
801052c1: 8b 45 08 mov 0x8(%ebp),%eax
801052c4: 01 d0 add %edx,%eax
801052c6: 0f b6 00 movzbl (%eax),%eax
801052c9: 84 c0 test %al,%al
801052cb: 75 ed jne 801052ba <strlen+0xf>
;
return n;
801052cd: 8b 45 fc mov -0x4(%ebp),%eax
}
801052d0: c9 leave
801052d1: c3 ret
801052d2 <swtch>:
# Save current register context in old
# and then load register context from new.
.globl swtch
swtch:
movl 4(%esp), %eax
801052d2: 8b 44 24 04 mov 0x4(%esp),%eax
movl 8(%esp), %edx
801052d6: 8b 54 24 08 mov 0x8(%esp),%edx
# Save old callee-save registers
pushl %ebp
801052da: 55 push %ebp
pushl %ebx
801052db: 53 push %ebx
pushl %esi
801052dc: 56 push %esi
pushl %edi
801052dd: 57 push %edi
# Switch stacks
movl %esp, (%eax)
801052de: 89 20 mov %esp,(%eax)
movl %edx, %esp
801052e0: 89 d4 mov %edx,%esp
# Load new callee-save registers
popl %edi
801052e2: 5f pop %edi
popl %esi
801052e3: 5e pop %esi
popl %ebx
801052e4: 5b pop %ebx
popl %ebp
801052e5: 5d pop %ebp
ret
801052e6: c3 ret
801052e7 <fetchint>:
// to a saved program counter, and then the first argument.
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
801052e7: 55 push %ebp
801052e8: 89 e5 mov %esp,%ebp
if(addr >= proc->sz || addr+4 > proc->sz)
801052ea: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801052f0: 8b 00 mov (%eax),%eax
801052f2: 3b 45 08 cmp 0x8(%ebp),%eax
801052f5: 76 12 jbe 80105309 <fetchint+0x22>
801052f7: 8b 45 08 mov 0x8(%ebp),%eax
801052fa: 8d 50 04 lea 0x4(%eax),%edx
801052fd: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105303: 8b 00 mov (%eax),%eax
80105305: 39 c2 cmp %eax,%edx
80105307: 76 07 jbe 80105310 <fetchint+0x29>
return -1;
80105309: b8 ff ff ff ff mov $0xffffffff,%eax
8010530e: eb 0f jmp 8010531f <fetchint+0x38>
*ip = *(int*)(addr);
80105310: 8b 45 08 mov 0x8(%ebp),%eax
80105313: 8b 10 mov (%eax),%edx
80105315: 8b 45 0c mov 0xc(%ebp),%eax
80105318: 89 10 mov %edx,(%eax)
return 0;
8010531a: b8 00 00 00 00 mov $0x0,%eax
}
8010531f: 5d pop %ebp
80105320: c3 ret
80105321 <fetchstr>:
// Fetch the nul-terminated string at addr from the current process.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(uint addr, char **pp)
{
80105321: 55 push %ebp
80105322: 89 e5 mov %esp,%ebp
80105324: 83 ec 10 sub $0x10,%esp
char *s, *ep;
if(addr >= proc->sz)
80105327: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010532d: 8b 00 mov (%eax),%eax
8010532f: 3b 45 08 cmp 0x8(%ebp),%eax
80105332: 77 07 ja 8010533b <fetchstr+0x1a>
return -1;
80105334: b8 ff ff ff ff mov $0xffffffff,%eax
80105339: eb 46 jmp 80105381 <fetchstr+0x60>
*pp = (char*)addr;
8010533b: 8b 55 08 mov 0x8(%ebp),%edx
8010533e: 8b 45 0c mov 0xc(%ebp),%eax
80105341: 89 10 mov %edx,(%eax)
ep = (char*)proc->sz;
80105343: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105349: 8b 00 mov (%eax),%eax
8010534b: 89 45 f8 mov %eax,-0x8(%ebp)
for(s = *pp; s < ep; s++)
8010534e: 8b 45 0c mov 0xc(%ebp),%eax
80105351: 8b 00 mov (%eax),%eax
80105353: 89 45 fc mov %eax,-0x4(%ebp)
80105356: eb 1c jmp 80105374 <fetchstr+0x53>
if(*s == 0)
80105358: 8b 45 fc mov -0x4(%ebp),%eax
8010535b: 0f b6 00 movzbl (%eax),%eax
8010535e: 84 c0 test %al,%al
80105360: 75 0e jne 80105370 <fetchstr+0x4f>
return s - *pp;
80105362: 8b 55 fc mov -0x4(%ebp),%edx
80105365: 8b 45 0c mov 0xc(%ebp),%eax
80105368: 8b 00 mov (%eax),%eax
8010536a: 29 c2 sub %eax,%edx
8010536c: 89 d0 mov %edx,%eax
8010536e: eb 11 jmp 80105381 <fetchstr+0x60>
if(addr >= proc->sz)
return -1;
*pp = (char*)addr;
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
80105370: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80105374: 8b 45 fc mov -0x4(%ebp),%eax
80105377: 3b 45 f8 cmp -0x8(%ebp),%eax
8010537a: 72 dc jb 80105358 <fetchstr+0x37>
if(*s == 0)
return s - *pp;
return -1;
8010537c: b8 ff ff ff ff mov $0xffffffff,%eax
}
80105381: c9 leave
80105382: c3 ret
80105383 <argint>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
80105383: 55 push %ebp
80105384: 89 e5 mov %esp,%ebp
80105386: 83 ec 08 sub $0x8,%esp
return fetchint(proc->tf->esp + 4 + 4*n, ip);
80105389: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010538f: 8b 40 18 mov 0x18(%eax),%eax
80105392: 8b 50 44 mov 0x44(%eax),%edx
80105395: 8b 45 08 mov 0x8(%ebp),%eax
80105398: c1 e0 02 shl $0x2,%eax
8010539b: 01 d0 add %edx,%eax
8010539d: 8d 50 04 lea 0x4(%eax),%edx
801053a0: 8b 45 0c mov 0xc(%ebp),%eax
801053a3: 89 44 24 04 mov %eax,0x4(%esp)
801053a7: 89 14 24 mov %edx,(%esp)
801053aa: e8 38 ff ff ff call 801052e7 <fetchint>
}
801053af: c9 leave
801053b0: c3 ret
801053b1 <argptr>:
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size n bytes. Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
801053b1: 55 push %ebp
801053b2: 89 e5 mov %esp,%ebp
801053b4: 83 ec 18 sub $0x18,%esp
int i;
if(argint(n, &i) < 0)
801053b7: 8d 45 fc lea -0x4(%ebp),%eax
801053ba: 89 44 24 04 mov %eax,0x4(%esp)
801053be: 8b 45 08 mov 0x8(%ebp),%eax
801053c1: 89 04 24 mov %eax,(%esp)
801053c4: e8 ba ff ff ff call 80105383 <argint>
801053c9: 85 c0 test %eax,%eax
801053cb: 79 07 jns 801053d4 <argptr+0x23>
return -1;
801053cd: b8 ff ff ff ff mov $0xffffffff,%eax
801053d2: eb 3d jmp 80105411 <argptr+0x60>
if((uint)i >= proc->sz || (uint)i+size > proc->sz)
801053d4: 8b 45 fc mov -0x4(%ebp),%eax
801053d7: 89 c2 mov %eax,%edx
801053d9: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801053df: 8b 00 mov (%eax),%eax
801053e1: 39 c2 cmp %eax,%edx
801053e3: 73 16 jae 801053fb <argptr+0x4a>
801053e5: 8b 45 fc mov -0x4(%ebp),%eax
801053e8: 89 c2 mov %eax,%edx
801053ea: 8b 45 10 mov 0x10(%ebp),%eax
801053ed: 01 c2 add %eax,%edx
801053ef: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801053f5: 8b 00 mov (%eax),%eax
801053f7: 39 c2 cmp %eax,%edx
801053f9: 76 07 jbe 80105402 <argptr+0x51>
return -1;
801053fb: b8 ff ff ff ff mov $0xffffffff,%eax
80105400: eb 0f jmp 80105411 <argptr+0x60>
*pp = (char*)i;
80105402: 8b 45 fc mov -0x4(%ebp),%eax
80105405: 89 c2 mov %eax,%edx
80105407: 8b 45 0c mov 0xc(%ebp),%eax
8010540a: 89 10 mov %edx,(%eax)
return 0;
8010540c: b8 00 00 00 00 mov $0x0,%eax
}
80105411: c9 leave
80105412: c3 ret
80105413 <argstr>:
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
80105413: 55 push %ebp
80105414: 89 e5 mov %esp,%ebp
80105416: 83 ec 18 sub $0x18,%esp
int addr;
if(argint(n, &addr) < 0)
80105419: 8d 45 fc lea -0x4(%ebp),%eax
8010541c: 89 44 24 04 mov %eax,0x4(%esp)
80105420: 8b 45 08 mov 0x8(%ebp),%eax
80105423: 89 04 24 mov %eax,(%esp)
80105426: e8 58 ff ff ff call 80105383 <argint>
8010542b: 85 c0 test %eax,%eax
8010542d: 79 07 jns 80105436 <argstr+0x23>
return -1;
8010542f: b8 ff ff ff ff mov $0xffffffff,%eax
80105434: eb 12 jmp 80105448 <argstr+0x35>
return fetchstr(addr, pp);
80105436: 8b 45 fc mov -0x4(%ebp),%eax
80105439: 8b 55 0c mov 0xc(%ebp),%edx
8010543c: 89 54 24 04 mov %edx,0x4(%esp)
80105440: 89 04 24 mov %eax,(%esp)
80105443: e8 d9 fe ff ff call 80105321 <fetchstr>
}
80105448: c9 leave
80105449: c3 ret
8010544a <syscall>:
#define SHOULD_PRINT_SYSCALLS 0
void
syscall(void)
{
8010544a: 55 push %ebp
8010544b: 89 e5 mov %esp,%ebp
8010544d: 53 push %ebx
8010544e: 83 ec 24 sub $0x24,%esp
int num;
int return_value;
num = proc->tf->eax;
80105451: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105457: 8b 40 18 mov 0x18(%eax),%eax
8010545a: 8b 40 1c mov 0x1c(%eax),%eax
8010545d: 89 45 f4 mov %eax,-0xc(%ebp)
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
80105460: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105464: 7e 36 jle 8010549c <syscall+0x52>
80105466: 8b 45 f4 mov -0xc(%ebp),%eax
80105469: 83 f8 16 cmp $0x16,%eax
8010546c: 77 2e ja 8010549c <syscall+0x52>
8010546e: 8b 45 f4 mov -0xc(%ebp),%eax
80105471: 8b 04 85 40 b0 10 80 mov -0x7fef4fc0(,%eax,4),%eax
80105478: 85 c0 test %eax,%eax
8010547a: 74 20 je 8010549c <syscall+0x52>
return_value = proc->tf->eax = syscalls[num]();
8010547c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105482: 8b 58 18 mov 0x18(%eax),%ebx
80105485: 8b 45 f4 mov -0xc(%ebp),%eax
80105488: 8b 04 85 40 b0 10 80 mov -0x7fef4fc0(,%eax,4),%eax
8010548f: ff d0 call *%eax
80105491: 89 43 1c mov %eax,0x1c(%ebx)
80105494: 8b 43 1c mov 0x1c(%ebx),%eax
80105497: 89 45 f0 mov %eax,-0x10(%ebp)
if (SHOULD_PRINT_SYSCALLS) {
8010549a: eb 3d jmp 801054d9 <syscall+0x8f>
cprintf("%s -> %d\n", syscall_names[num], return_value);
}
} else {
cprintf("%d %s: unknown sys call %d\n",
proc->pid, proc->name, num);
8010549c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801054a2: 8d 48 6c lea 0x6c(%eax),%ecx
801054a5: 65 a1 04 00 00 00 mov %gs:0x4,%eax
return_value = proc->tf->eax = syscalls[num]();
if (SHOULD_PRINT_SYSCALLS) {
cprintf("%s -> %d\n", syscall_names[num], return_value);
}
} else {
cprintf("%d %s: unknown sys call %d\n",
801054ab: 8b 40 10 mov 0x10(%eax),%eax
801054ae: 8b 55 f4 mov -0xc(%ebp),%edx
801054b1: 89 54 24 0c mov %edx,0xc(%esp)
801054b5: 89 4c 24 08 mov %ecx,0x8(%esp)
801054b9: 89 44 24 04 mov %eax,0x4(%esp)
801054bd: c7 04 24 45 88 10 80 movl $0x80108845,(%esp)
801054c4: e8 d7 ae ff ff call 801003a0 <cprintf>
proc->pid, proc->name, num);
proc->tf->eax = -1;
801054c9: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801054cf: 8b 40 18 mov 0x18(%eax),%eax
801054d2: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax)
}
}
801054d9: 83 c4 24 add $0x24,%esp
801054dc: 5b pop %ebx
801054dd: 5d pop %ebp
801054de: c3 ret
801054df <argfd>:
// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
{
801054df: 55 push %ebp
801054e0: 89 e5 mov %esp,%ebp
801054e2: 83 ec 28 sub $0x28,%esp
int fd;
struct file *f;
if(argint(n, &fd) < 0)
801054e5: 8d 45 f0 lea -0x10(%ebp),%eax
801054e8: 89 44 24 04 mov %eax,0x4(%esp)
801054ec: 8b 45 08 mov 0x8(%ebp),%eax
801054ef: 89 04 24 mov %eax,(%esp)
801054f2: e8 8c fe ff ff call 80105383 <argint>
801054f7: 85 c0 test %eax,%eax
801054f9: 79 07 jns 80105502 <argfd+0x23>
return -1;
801054fb: b8 ff ff ff ff mov $0xffffffff,%eax
80105500: eb 50 jmp 80105552 <argfd+0x73>
if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
80105502: 8b 45 f0 mov -0x10(%ebp),%eax
80105505: 85 c0 test %eax,%eax
80105507: 78 21 js 8010552a <argfd+0x4b>
80105509: 8b 45 f0 mov -0x10(%ebp),%eax
8010550c: 83 f8 0f cmp $0xf,%eax
8010550f: 7f 19 jg 8010552a <argfd+0x4b>
80105511: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105517: 8b 55 f0 mov -0x10(%ebp),%edx
8010551a: 83 c2 08 add $0x8,%edx
8010551d: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80105521: 89 45 f4 mov %eax,-0xc(%ebp)
80105524: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105528: 75 07 jne 80105531 <argfd+0x52>
return -1;
8010552a: b8 ff ff ff ff mov $0xffffffff,%eax
8010552f: eb 21 jmp 80105552 <argfd+0x73>
if(pfd)
80105531: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80105535: 74 08 je 8010553f <argfd+0x60>
*pfd = fd;
80105537: 8b 55 f0 mov -0x10(%ebp),%edx
8010553a: 8b 45 0c mov 0xc(%ebp),%eax
8010553d: 89 10 mov %edx,(%eax)
if(pf)
8010553f: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80105543: 74 08 je 8010554d <argfd+0x6e>
*pf = f;
80105545: 8b 45 10 mov 0x10(%ebp),%eax
80105548: 8b 55 f4 mov -0xc(%ebp),%edx
8010554b: 89 10 mov %edx,(%eax)
return 0;
8010554d: b8 00 00 00 00 mov $0x0,%eax
}
80105552: c9 leave
80105553: c3 ret
80105554 <fdalloc>:
// Allocate a file descriptor for the given file.
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
80105554: 55 push %ebp
80105555: 89 e5 mov %esp,%ebp
80105557: 83 ec 10 sub $0x10,%esp
int fd;
for(fd = 0; fd < NOFILE; fd++){
8010555a: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
80105561: eb 30 jmp 80105593 <fdalloc+0x3f>
if(proc->ofile[fd] == 0){
80105563: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105569: 8b 55 fc mov -0x4(%ebp),%edx
8010556c: 83 c2 08 add $0x8,%edx
8010556f: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80105573: 85 c0 test %eax,%eax
80105575: 75 18 jne 8010558f <fdalloc+0x3b>
proc->ofile[fd] = f;
80105577: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010557d: 8b 55 fc mov -0x4(%ebp),%edx
80105580: 8d 4a 08 lea 0x8(%edx),%ecx
80105583: 8b 55 08 mov 0x8(%ebp),%edx
80105586: 89 54 88 08 mov %edx,0x8(%eax,%ecx,4)
return fd;
8010558a: 8b 45 fc mov -0x4(%ebp),%eax
8010558d: eb 0f jmp 8010559e <fdalloc+0x4a>
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
8010558f: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80105593: 83 7d fc 0f cmpl $0xf,-0x4(%ebp)
80105597: 7e ca jle 80105563 <fdalloc+0xf>
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
return fd;
}
}
return -1;
80105599: b8 ff ff ff ff mov $0xffffffff,%eax
}
8010559e: c9 leave
8010559f: c3 ret
801055a0 <sys_dup>:
int
sys_dup(void)
{
801055a0: 55 push %ebp
801055a1: 89 e5 mov %esp,%ebp
801055a3: 83 ec 28 sub $0x28,%esp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
801055a6: 8d 45 f0 lea -0x10(%ebp),%eax
801055a9: 89 44 24 08 mov %eax,0x8(%esp)
801055ad: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801055b4: 00
801055b5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801055bc: e8 1e ff ff ff call 801054df <argfd>
801055c1: 85 c0 test %eax,%eax
801055c3: 79 07 jns 801055cc <sys_dup+0x2c>
return -1;
801055c5: b8 ff ff ff ff mov $0xffffffff,%eax
801055ca: eb 29 jmp 801055f5 <sys_dup+0x55>
if((fd=fdalloc(f)) < 0)
801055cc: 8b 45 f0 mov -0x10(%ebp),%eax
801055cf: 89 04 24 mov %eax,(%esp)
801055d2: e8 7d ff ff ff call 80105554 <fdalloc>
801055d7: 89 45 f4 mov %eax,-0xc(%ebp)
801055da: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801055de: 79 07 jns 801055e7 <sys_dup+0x47>
return -1;
801055e0: b8 ff ff ff ff mov $0xffffffff,%eax
801055e5: eb 0e jmp 801055f5 <sys_dup+0x55>
filedup(f);
801055e7: 8b 45 f0 mov -0x10(%ebp),%eax
801055ea: 89 04 24 mov %eax,(%esp)
801055ed: e8 af b9 ff ff call 80100fa1 <filedup>
return fd;
801055f2: 8b 45 f4 mov -0xc(%ebp),%eax
}
801055f5: c9 leave
801055f6: c3 ret
801055f7 <sys_read>:
int
sys_read(void)
{
801055f7: 55 push %ebp
801055f8: 89 e5 mov %esp,%ebp
801055fa: 83 ec 28 sub $0x28,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
801055fd: 8d 45 f4 lea -0xc(%ebp),%eax
80105600: 89 44 24 08 mov %eax,0x8(%esp)
80105604: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010560b: 00
8010560c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105613: e8 c7 fe ff ff call 801054df <argfd>
80105618: 85 c0 test %eax,%eax
8010561a: 78 35 js 80105651 <sys_read+0x5a>
8010561c: 8d 45 f0 lea -0x10(%ebp),%eax
8010561f: 89 44 24 04 mov %eax,0x4(%esp)
80105623: c7 04 24 02 00 00 00 movl $0x2,(%esp)
8010562a: e8 54 fd ff ff call 80105383 <argint>
8010562f: 85 c0 test %eax,%eax
80105631: 78 1e js 80105651 <sys_read+0x5a>
80105633: 8b 45 f0 mov -0x10(%ebp),%eax
80105636: 89 44 24 08 mov %eax,0x8(%esp)
8010563a: 8d 45 ec lea -0x14(%ebp),%eax
8010563d: 89 44 24 04 mov %eax,0x4(%esp)
80105641: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105648: e8 64 fd ff ff call 801053b1 <argptr>
8010564d: 85 c0 test %eax,%eax
8010564f: 79 07 jns 80105658 <sys_read+0x61>
return -1;
80105651: b8 ff ff ff ff mov $0xffffffff,%eax
80105656: eb 19 jmp 80105671 <sys_read+0x7a>
return fileread(f, p, n);
80105658: 8b 4d f0 mov -0x10(%ebp),%ecx
8010565b: 8b 55 ec mov -0x14(%ebp),%edx
8010565e: 8b 45 f4 mov -0xc(%ebp),%eax
80105661: 89 4c 24 08 mov %ecx,0x8(%esp)
80105665: 89 54 24 04 mov %edx,0x4(%esp)
80105669: 89 04 24 mov %eax,(%esp)
8010566c: e8 9d ba ff ff call 8010110e <fileread>
}
80105671: c9 leave
80105672: c3 ret
80105673 <sys_write>:
int
sys_write(void)
{
80105673: 55 push %ebp
80105674: 89 e5 mov %esp,%ebp
80105676: 83 ec 28 sub $0x28,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80105679: 8d 45 f4 lea -0xc(%ebp),%eax
8010567c: 89 44 24 08 mov %eax,0x8(%esp)
80105680: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105687: 00
80105688: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010568f: e8 4b fe ff ff call 801054df <argfd>
80105694: 85 c0 test %eax,%eax
80105696: 78 35 js 801056cd <sys_write+0x5a>
80105698: 8d 45 f0 lea -0x10(%ebp),%eax
8010569b: 89 44 24 04 mov %eax,0x4(%esp)
8010569f: c7 04 24 02 00 00 00 movl $0x2,(%esp)
801056a6: e8 d8 fc ff ff call 80105383 <argint>
801056ab: 85 c0 test %eax,%eax
801056ad: 78 1e js 801056cd <sys_write+0x5a>
801056af: 8b 45 f0 mov -0x10(%ebp),%eax
801056b2: 89 44 24 08 mov %eax,0x8(%esp)
801056b6: 8d 45 ec lea -0x14(%ebp),%eax
801056b9: 89 44 24 04 mov %eax,0x4(%esp)
801056bd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801056c4: e8 e8 fc ff ff call 801053b1 <argptr>
801056c9: 85 c0 test %eax,%eax
801056cb: 79 07 jns 801056d4 <sys_write+0x61>
return -1;
801056cd: b8 ff ff ff ff mov $0xffffffff,%eax
801056d2: eb 19 jmp 801056ed <sys_write+0x7a>
return filewrite(f, p, n);
801056d4: 8b 4d f0 mov -0x10(%ebp),%ecx
801056d7: 8b 55 ec mov -0x14(%ebp),%edx
801056da: 8b 45 f4 mov -0xc(%ebp),%eax
801056dd: 89 4c 24 08 mov %ecx,0x8(%esp)
801056e1: 89 54 24 04 mov %edx,0x4(%esp)
801056e5: 89 04 24 mov %eax,(%esp)
801056e8: e8 dd ba ff ff call 801011ca <filewrite>
}
801056ed: c9 leave
801056ee: c3 ret
801056ef <sys_close>:
int
sys_close(void)
{
801056ef: 55 push %ebp
801056f0: 89 e5 mov %esp,%ebp
801056f2: 83 ec 28 sub $0x28,%esp
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
801056f5: 8d 45 f0 lea -0x10(%ebp),%eax
801056f8: 89 44 24 08 mov %eax,0x8(%esp)
801056fc: 8d 45 f4 lea -0xc(%ebp),%eax
801056ff: 89 44 24 04 mov %eax,0x4(%esp)
80105703: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010570a: e8 d0 fd ff ff call 801054df <argfd>
8010570f: 85 c0 test %eax,%eax
80105711: 79 07 jns 8010571a <sys_close+0x2b>
return -1;
80105713: b8 ff ff ff ff mov $0xffffffff,%eax
80105718: eb 24 jmp 8010573e <sys_close+0x4f>
proc->ofile[fd] = 0;
8010571a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105720: 8b 55 f4 mov -0xc(%ebp),%edx
80105723: 83 c2 08 add $0x8,%edx
80105726: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
8010572d: 00
fileclose(f);
8010572e: 8b 45 f0 mov -0x10(%ebp),%eax
80105731: 89 04 24 mov %eax,(%esp)
80105734: e8 b0 b8 ff ff call 80100fe9 <fileclose>
return 0;
80105739: b8 00 00 00 00 mov $0x0,%eax
}
8010573e: c9 leave
8010573f: c3 ret
80105740 <sys_fstat>:
int
sys_fstat(void)
{
80105740: 55 push %ebp
80105741: 89 e5 mov %esp,%ebp
80105743: 83 ec 28 sub $0x28,%esp
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
80105746: 8d 45 f4 lea -0xc(%ebp),%eax
80105749: 89 44 24 08 mov %eax,0x8(%esp)
8010574d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105754: 00
80105755: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010575c: e8 7e fd ff ff call 801054df <argfd>
80105761: 85 c0 test %eax,%eax
80105763: 78 1f js 80105784 <sys_fstat+0x44>
80105765: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp)
8010576c: 00
8010576d: 8d 45 f0 lea -0x10(%ebp),%eax
80105770: 89 44 24 04 mov %eax,0x4(%esp)
80105774: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010577b: e8 31 fc ff ff call 801053b1 <argptr>
80105780: 85 c0 test %eax,%eax
80105782: 79 07 jns 8010578b <sys_fstat+0x4b>
return -1;
80105784: b8 ff ff ff ff mov $0xffffffff,%eax
80105789: eb 12 jmp 8010579d <sys_fstat+0x5d>
return filestat(f, st);
8010578b: 8b 55 f0 mov -0x10(%ebp),%edx
8010578e: 8b 45 f4 mov -0xc(%ebp),%eax
80105791: 89 54 24 04 mov %edx,0x4(%esp)
80105795: 89 04 24 mov %eax,(%esp)
80105798: e8 22 b9 ff ff call 801010bf <filestat>
}
8010579d: c9 leave
8010579e: c3 ret
8010579f <sys_link>:
// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
8010579f: 55 push %ebp
801057a0: 89 e5 mov %esp,%ebp
801057a2: 83 ec 38 sub $0x38,%esp
char name[DIRSIZ], *new, *old;
struct inode *dp, *ip;
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
801057a5: 8d 45 d8 lea -0x28(%ebp),%eax
801057a8: 89 44 24 04 mov %eax,0x4(%esp)
801057ac: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801057b3: e8 5b fc ff ff call 80105413 <argstr>
801057b8: 85 c0 test %eax,%eax
801057ba: 78 17 js 801057d3 <sys_link+0x34>
801057bc: 8d 45 dc lea -0x24(%ebp),%eax
801057bf: 89 44 24 04 mov %eax,0x4(%esp)
801057c3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801057ca: e8 44 fc ff ff call 80105413 <argstr>
801057cf: 85 c0 test %eax,%eax
801057d1: 79 0a jns 801057dd <sys_link+0x3e>
return -1;
801057d3: b8 ff ff ff ff mov $0xffffffff,%eax
801057d8: e9 42 01 00 00 jmp 8010591f <sys_link+0x180>
begin_op();
801057dd: e8 49 dc ff ff call 8010342b <begin_op>
if((ip = namei(old)) == 0){
801057e2: 8b 45 d8 mov -0x28(%ebp),%eax
801057e5: 89 04 24 mov %eax,(%esp)
801057e8: e8 34 cc ff ff call 80102421 <namei>
801057ed: 89 45 f4 mov %eax,-0xc(%ebp)
801057f0: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801057f4: 75 0f jne 80105805 <sys_link+0x66>
end_op();
801057f6: e8 b4 dc ff ff call 801034af <end_op>
return -1;
801057fb: b8 ff ff ff ff mov $0xffffffff,%eax
80105800: e9 1a 01 00 00 jmp 8010591f <sys_link+0x180>
}
ilock(ip);
80105805: 8b 45 f4 mov -0xc(%ebp),%eax
80105808: 89 04 24 mov %eax,(%esp)
8010580b: e8 66 c0 ff ff call 80101876 <ilock>
if(ip->type == T_DIR){
80105810: 8b 45 f4 mov -0xc(%ebp),%eax
80105813: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105817: 66 83 f8 01 cmp $0x1,%ax
8010581b: 75 1a jne 80105837 <sys_link+0x98>
iunlockput(ip);
8010581d: 8b 45 f4 mov -0xc(%ebp),%eax
80105820: 89 04 24 mov %eax,(%esp)
80105823: e8 d2 c2 ff ff call 80101afa <iunlockput>
end_op();
80105828: e8 82 dc ff ff call 801034af <end_op>
return -1;
8010582d: b8 ff ff ff ff mov $0xffffffff,%eax
80105832: e9 e8 00 00 00 jmp 8010591f <sys_link+0x180>
}
ip->nlink++;
80105837: 8b 45 f4 mov -0xc(%ebp),%eax
8010583a: 0f b7 40 16 movzwl 0x16(%eax),%eax
8010583e: 8d 50 01 lea 0x1(%eax),%edx
80105841: 8b 45 f4 mov -0xc(%ebp),%eax
80105844: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
80105848: 8b 45 f4 mov -0xc(%ebp),%eax
8010584b: 89 04 24 mov %eax,(%esp)
8010584e: e8 67 be ff ff call 801016ba <iupdate>
iunlock(ip);
80105853: 8b 45 f4 mov -0xc(%ebp),%eax
80105856: 89 04 24 mov %eax,(%esp)
80105859: e8 66 c1 ff ff call 801019c4 <iunlock>
if((dp = nameiparent(new, name)) == 0)
8010585e: 8b 45 dc mov -0x24(%ebp),%eax
80105861: 8d 55 e2 lea -0x1e(%ebp),%edx
80105864: 89 54 24 04 mov %edx,0x4(%esp)
80105868: 89 04 24 mov %eax,(%esp)
8010586b: e8 d3 cb ff ff call 80102443 <nameiparent>
80105870: 89 45 f0 mov %eax,-0x10(%ebp)
80105873: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105877: 75 02 jne 8010587b <sys_link+0xdc>
goto bad;
80105879: eb 68 jmp 801058e3 <sys_link+0x144>
ilock(dp);
8010587b: 8b 45 f0 mov -0x10(%ebp),%eax
8010587e: 89 04 24 mov %eax,(%esp)
80105881: e8 f0 bf ff ff call 80101876 <ilock>
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
80105886: 8b 45 f0 mov -0x10(%ebp),%eax
80105889: 8b 10 mov (%eax),%edx
8010588b: 8b 45 f4 mov -0xc(%ebp),%eax
8010588e: 8b 00 mov (%eax),%eax
80105890: 39 c2 cmp %eax,%edx
80105892: 75 20 jne 801058b4 <sys_link+0x115>
80105894: 8b 45 f4 mov -0xc(%ebp),%eax
80105897: 8b 40 04 mov 0x4(%eax),%eax
8010589a: 89 44 24 08 mov %eax,0x8(%esp)
8010589e: 8d 45 e2 lea -0x1e(%ebp),%eax
801058a1: 89 44 24 04 mov %eax,0x4(%esp)
801058a5: 8b 45 f0 mov -0x10(%ebp),%eax
801058a8: 89 04 24 mov %eax,(%esp)
801058ab: e8 b1 c8 ff ff call 80102161 <dirlink>
801058b0: 85 c0 test %eax,%eax
801058b2: 79 0d jns 801058c1 <sys_link+0x122>
iunlockput(dp);
801058b4: 8b 45 f0 mov -0x10(%ebp),%eax
801058b7: 89 04 24 mov %eax,(%esp)
801058ba: e8 3b c2 ff ff call 80101afa <iunlockput>
goto bad;
801058bf: eb 22 jmp 801058e3 <sys_link+0x144>
}
iunlockput(dp);
801058c1: 8b 45 f0 mov -0x10(%ebp),%eax
801058c4: 89 04 24 mov %eax,(%esp)
801058c7: e8 2e c2 ff ff call 80101afa <iunlockput>
iput(ip);
801058cc: 8b 45 f4 mov -0xc(%ebp),%eax
801058cf: 89 04 24 mov %eax,(%esp)
801058d2: e8 52 c1 ff ff call 80101a29 <iput>
end_op();
801058d7: e8 d3 db ff ff call 801034af <end_op>
return 0;
801058dc: b8 00 00 00 00 mov $0x0,%eax
801058e1: eb 3c jmp 8010591f <sys_link+0x180>
bad:
ilock(ip);
801058e3: 8b 45 f4 mov -0xc(%ebp),%eax
801058e6: 89 04 24 mov %eax,(%esp)
801058e9: e8 88 bf ff ff call 80101876 <ilock>
ip->nlink--;
801058ee: 8b 45 f4 mov -0xc(%ebp),%eax
801058f1: 0f b7 40 16 movzwl 0x16(%eax),%eax
801058f5: 8d 50 ff lea -0x1(%eax),%edx
801058f8: 8b 45 f4 mov -0xc(%ebp),%eax
801058fb: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
801058ff: 8b 45 f4 mov -0xc(%ebp),%eax
80105902: 89 04 24 mov %eax,(%esp)
80105905: e8 b0 bd ff ff call 801016ba <iupdate>
iunlockput(ip);
8010590a: 8b 45 f4 mov -0xc(%ebp),%eax
8010590d: 89 04 24 mov %eax,(%esp)
80105910: e8 e5 c1 ff ff call 80101afa <iunlockput>
end_op();
80105915: e8 95 db ff ff call 801034af <end_op>
return -1;
8010591a: b8 ff ff ff ff mov $0xffffffff,%eax
}
8010591f: c9 leave
80105920: c3 ret
80105921 <isdirempty>:
// Is the directory dp empty except for "." and ".." ?
static int
isdirempty(struct inode *dp)
{
80105921: 55 push %ebp
80105922: 89 e5 mov %esp,%ebp
80105924: 83 ec 38 sub $0x38,%esp
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80105927: c7 45 f4 20 00 00 00 movl $0x20,-0xc(%ebp)
8010592e: eb 4b jmp 8010597b <isdirempty+0x5a>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80105930: 8b 45 f4 mov -0xc(%ebp),%eax
80105933: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
8010593a: 00
8010593b: 89 44 24 08 mov %eax,0x8(%esp)
8010593f: 8d 45 e4 lea -0x1c(%ebp),%eax
80105942: 89 44 24 04 mov %eax,0x4(%esp)
80105946: 8b 45 08 mov 0x8(%ebp),%eax
80105949: 89 04 24 mov %eax,(%esp)
8010594c: e8 32 c4 ff ff call 80101d83 <readi>
80105951: 83 f8 10 cmp $0x10,%eax
80105954: 74 0c je 80105962 <isdirempty+0x41>
panic("isdirempty: readi");
80105956: c7 04 24 61 88 10 80 movl $0x80108861,(%esp)
8010595d: e8 d8 ab ff ff call 8010053a <panic>
if(de.inum != 0)
80105962: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax
80105966: 66 85 c0 test %ax,%ax
80105969: 74 07 je 80105972 <isdirempty+0x51>
return 0;
8010596b: b8 00 00 00 00 mov $0x0,%eax
80105970: eb 1b jmp 8010598d <isdirempty+0x6c>
isdirempty(struct inode *dp)
{
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80105972: 8b 45 f4 mov -0xc(%ebp),%eax
80105975: 83 c0 10 add $0x10,%eax
80105978: 89 45 f4 mov %eax,-0xc(%ebp)
8010597b: 8b 55 f4 mov -0xc(%ebp),%edx
8010597e: 8b 45 08 mov 0x8(%ebp),%eax
80105981: 8b 40 18 mov 0x18(%eax),%eax
80105984: 39 c2 cmp %eax,%edx
80105986: 72 a8 jb 80105930 <isdirempty+0xf>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("isdirempty: readi");
if(de.inum != 0)
return 0;
}
return 1;
80105988: b8 01 00 00 00 mov $0x1,%eax
}
8010598d: c9 leave
8010598e: c3 ret
8010598f <sys_unlink>:
//PAGEBREAK!
int
sys_unlink(void)
{
8010598f: 55 push %ebp
80105990: 89 e5 mov %esp,%ebp
80105992: 83 ec 48 sub $0x48,%esp
struct inode *ip, *dp;
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
80105995: 8d 45 cc lea -0x34(%ebp),%eax
80105998: 89 44 24 04 mov %eax,0x4(%esp)
8010599c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801059a3: e8 6b fa ff ff call 80105413 <argstr>
801059a8: 85 c0 test %eax,%eax
801059aa: 79 0a jns 801059b6 <sys_unlink+0x27>
return -1;
801059ac: b8 ff ff ff ff mov $0xffffffff,%eax
801059b1: e9 af 01 00 00 jmp 80105b65 <sys_unlink+0x1d6>
begin_op();
801059b6: e8 70 da ff ff call 8010342b <begin_op>
if((dp = nameiparent(path, name)) == 0){
801059bb: 8b 45 cc mov -0x34(%ebp),%eax
801059be: 8d 55 d2 lea -0x2e(%ebp),%edx
801059c1: 89 54 24 04 mov %edx,0x4(%esp)
801059c5: 89 04 24 mov %eax,(%esp)
801059c8: e8 76 ca ff ff call 80102443 <nameiparent>
801059cd: 89 45 f4 mov %eax,-0xc(%ebp)
801059d0: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801059d4: 75 0f jne 801059e5 <sys_unlink+0x56>
end_op();
801059d6: e8 d4 da ff ff call 801034af <end_op>
return -1;
801059db: b8 ff ff ff ff mov $0xffffffff,%eax
801059e0: e9 80 01 00 00 jmp 80105b65 <sys_unlink+0x1d6>
}
ilock(dp);
801059e5: 8b 45 f4 mov -0xc(%ebp),%eax
801059e8: 89 04 24 mov %eax,(%esp)
801059eb: e8 86 be ff ff call 80101876 <ilock>
// Cannot unlink "." or "..".
if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
801059f0: c7 44 24 04 73 88 10 movl $0x80108873,0x4(%esp)
801059f7: 80
801059f8: 8d 45 d2 lea -0x2e(%ebp),%eax
801059fb: 89 04 24 mov %eax,(%esp)
801059fe: e8 73 c6 ff ff call 80102076 <namecmp>
80105a03: 85 c0 test %eax,%eax
80105a05: 0f 84 45 01 00 00 je 80105b50 <sys_unlink+0x1c1>
80105a0b: c7 44 24 04 75 88 10 movl $0x80108875,0x4(%esp)
80105a12: 80
80105a13: 8d 45 d2 lea -0x2e(%ebp),%eax
80105a16: 89 04 24 mov %eax,(%esp)
80105a19: e8 58 c6 ff ff call 80102076 <namecmp>
80105a1e: 85 c0 test %eax,%eax
80105a20: 0f 84 2a 01 00 00 je 80105b50 <sys_unlink+0x1c1>
goto bad;
if((ip = dirlookup(dp, name, &off)) == 0)
80105a26: 8d 45 c8 lea -0x38(%ebp),%eax
80105a29: 89 44 24 08 mov %eax,0x8(%esp)
80105a2d: 8d 45 d2 lea -0x2e(%ebp),%eax
80105a30: 89 44 24 04 mov %eax,0x4(%esp)
80105a34: 8b 45 f4 mov -0xc(%ebp),%eax
80105a37: 89 04 24 mov %eax,(%esp)
80105a3a: e8 59 c6 ff ff call 80102098 <dirlookup>
80105a3f: 89 45 f0 mov %eax,-0x10(%ebp)
80105a42: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105a46: 75 05 jne 80105a4d <sys_unlink+0xbe>
goto bad;
80105a48: e9 03 01 00 00 jmp 80105b50 <sys_unlink+0x1c1>
ilock(ip);
80105a4d: 8b 45 f0 mov -0x10(%ebp),%eax
80105a50: 89 04 24 mov %eax,(%esp)
80105a53: e8 1e be ff ff call 80101876 <ilock>
if(ip->nlink < 1)
80105a58: 8b 45 f0 mov -0x10(%ebp),%eax
80105a5b: 0f b7 40 16 movzwl 0x16(%eax),%eax
80105a5f: 66 85 c0 test %ax,%ax
80105a62: 7f 0c jg 80105a70 <sys_unlink+0xe1>
panic("unlink: nlink < 1");
80105a64: c7 04 24 78 88 10 80 movl $0x80108878,(%esp)
80105a6b: e8 ca aa ff ff call 8010053a <panic>
if(ip->type == T_DIR && !isdirempty(ip)){
80105a70: 8b 45 f0 mov -0x10(%ebp),%eax
80105a73: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105a77: 66 83 f8 01 cmp $0x1,%ax
80105a7b: 75 1f jne 80105a9c <sys_unlink+0x10d>
80105a7d: 8b 45 f0 mov -0x10(%ebp),%eax
80105a80: 89 04 24 mov %eax,(%esp)
80105a83: e8 99 fe ff ff call 80105921 <isdirempty>
80105a88: 85 c0 test %eax,%eax
80105a8a: 75 10 jne 80105a9c <sys_unlink+0x10d>
iunlockput(ip);
80105a8c: 8b 45 f0 mov -0x10(%ebp),%eax
80105a8f: 89 04 24 mov %eax,(%esp)
80105a92: e8 63 c0 ff ff call 80101afa <iunlockput>
goto bad;
80105a97: e9 b4 00 00 00 jmp 80105b50 <sys_unlink+0x1c1>
}
memset(&de, 0, sizeof(de));
80105a9c: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80105aa3: 00
80105aa4: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105aab: 00
80105aac: 8d 45 e0 lea -0x20(%ebp),%eax
80105aaf: 89 04 24 mov %eax,(%esp)
80105ab2: e8 8a f5 ff ff call 80105041 <memset>
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80105ab7: 8b 45 c8 mov -0x38(%ebp),%eax
80105aba: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80105ac1: 00
80105ac2: 89 44 24 08 mov %eax,0x8(%esp)
80105ac6: 8d 45 e0 lea -0x20(%ebp),%eax
80105ac9: 89 44 24 04 mov %eax,0x4(%esp)
80105acd: 8b 45 f4 mov -0xc(%ebp),%eax
80105ad0: 89 04 24 mov %eax,(%esp)
80105ad3: e8 0f c4 ff ff call 80101ee7 <writei>
80105ad8: 83 f8 10 cmp $0x10,%eax
80105adb: 74 0c je 80105ae9 <sys_unlink+0x15a>
panic("unlink: writei");
80105add: c7 04 24 8a 88 10 80 movl $0x8010888a,(%esp)
80105ae4: e8 51 aa ff ff call 8010053a <panic>
if(ip->type == T_DIR){
80105ae9: 8b 45 f0 mov -0x10(%ebp),%eax
80105aec: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105af0: 66 83 f8 01 cmp $0x1,%ax
80105af4: 75 1c jne 80105b12 <sys_unlink+0x183>
dp->nlink--;
80105af6: 8b 45 f4 mov -0xc(%ebp),%eax
80105af9: 0f b7 40 16 movzwl 0x16(%eax),%eax
80105afd: 8d 50 ff lea -0x1(%eax),%edx
80105b00: 8b 45 f4 mov -0xc(%ebp),%eax
80105b03: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(dp);
80105b07: 8b 45 f4 mov -0xc(%ebp),%eax
80105b0a: 89 04 24 mov %eax,(%esp)
80105b0d: e8 a8 bb ff ff call 801016ba <iupdate>
}
iunlockput(dp);
80105b12: 8b 45 f4 mov -0xc(%ebp),%eax
80105b15: 89 04 24 mov %eax,(%esp)
80105b18: e8 dd bf ff ff call 80101afa <iunlockput>
ip->nlink--;
80105b1d: 8b 45 f0 mov -0x10(%ebp),%eax
80105b20: 0f b7 40 16 movzwl 0x16(%eax),%eax
80105b24: 8d 50 ff lea -0x1(%eax),%edx
80105b27: 8b 45 f0 mov -0x10(%ebp),%eax
80105b2a: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
80105b2e: 8b 45 f0 mov -0x10(%ebp),%eax
80105b31: 89 04 24 mov %eax,(%esp)
80105b34: e8 81 bb ff ff call 801016ba <iupdate>
iunlockput(ip);
80105b39: 8b 45 f0 mov -0x10(%ebp),%eax
80105b3c: 89 04 24 mov %eax,(%esp)
80105b3f: e8 b6 bf ff ff call 80101afa <iunlockput>
end_op();
80105b44: e8 66 d9 ff ff call 801034af <end_op>
return 0;
80105b49: b8 00 00 00 00 mov $0x0,%eax
80105b4e: eb 15 jmp 80105b65 <sys_unlink+0x1d6>
bad:
iunlockput(dp);
80105b50: 8b 45 f4 mov -0xc(%ebp),%eax
80105b53: 89 04 24 mov %eax,(%esp)
80105b56: e8 9f bf ff ff call 80101afa <iunlockput>
end_op();
80105b5b: e8 4f d9 ff ff call 801034af <end_op>
return -1;
80105b60: b8 ff ff ff ff mov $0xffffffff,%eax
}
80105b65: c9 leave
80105b66: c3 ret
80105b67 <create>:
static struct inode*
create(char *path, short type, short major, short minor)
{
80105b67: 55 push %ebp
80105b68: 89 e5 mov %esp,%ebp
80105b6a: 83 ec 48 sub $0x48,%esp
80105b6d: 8b 4d 0c mov 0xc(%ebp),%ecx
80105b70: 8b 55 10 mov 0x10(%ebp),%edx
80105b73: 8b 45 14 mov 0x14(%ebp),%eax
80105b76: 66 89 4d d4 mov %cx,-0x2c(%ebp)
80105b7a: 66 89 55 d0 mov %dx,-0x30(%ebp)
80105b7e: 66 89 45 cc mov %ax,-0x34(%ebp)
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
80105b82: 8d 45 de lea -0x22(%ebp),%eax
80105b85: 89 44 24 04 mov %eax,0x4(%esp)
80105b89: 8b 45 08 mov 0x8(%ebp),%eax
80105b8c: 89 04 24 mov %eax,(%esp)
80105b8f: e8 af c8 ff ff call 80102443 <nameiparent>
80105b94: 89 45 f4 mov %eax,-0xc(%ebp)
80105b97: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105b9b: 75 0a jne 80105ba7 <create+0x40>
return 0;
80105b9d: b8 00 00 00 00 mov $0x0,%eax
80105ba2: e9 7e 01 00 00 jmp 80105d25 <create+0x1be>
ilock(dp);
80105ba7: 8b 45 f4 mov -0xc(%ebp),%eax
80105baa: 89 04 24 mov %eax,(%esp)
80105bad: e8 c4 bc ff ff call 80101876 <ilock>
if((ip = dirlookup(dp, name, &off)) != 0){
80105bb2: 8d 45 ec lea -0x14(%ebp),%eax
80105bb5: 89 44 24 08 mov %eax,0x8(%esp)
80105bb9: 8d 45 de lea -0x22(%ebp),%eax
80105bbc: 89 44 24 04 mov %eax,0x4(%esp)
80105bc0: 8b 45 f4 mov -0xc(%ebp),%eax
80105bc3: 89 04 24 mov %eax,(%esp)
80105bc6: e8 cd c4 ff ff call 80102098 <dirlookup>
80105bcb: 89 45 f0 mov %eax,-0x10(%ebp)
80105bce: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105bd2: 74 47 je 80105c1b <create+0xb4>
iunlockput(dp);
80105bd4: 8b 45 f4 mov -0xc(%ebp),%eax
80105bd7: 89 04 24 mov %eax,(%esp)
80105bda: e8 1b bf ff ff call 80101afa <iunlockput>
ilock(ip);
80105bdf: 8b 45 f0 mov -0x10(%ebp),%eax
80105be2: 89 04 24 mov %eax,(%esp)
80105be5: e8 8c bc ff ff call 80101876 <ilock>
if(type == T_FILE && ip->type == T_FILE)
80105bea: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp)
80105bef: 75 15 jne 80105c06 <create+0x9f>
80105bf1: 8b 45 f0 mov -0x10(%ebp),%eax
80105bf4: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105bf8: 66 83 f8 02 cmp $0x2,%ax
80105bfc: 75 08 jne 80105c06 <create+0x9f>
return ip;
80105bfe: 8b 45 f0 mov -0x10(%ebp),%eax
80105c01: e9 1f 01 00 00 jmp 80105d25 <create+0x1be>
iunlockput(ip);
80105c06: 8b 45 f0 mov -0x10(%ebp),%eax
80105c09: 89 04 24 mov %eax,(%esp)
80105c0c: e8 e9 be ff ff call 80101afa <iunlockput>
return 0;
80105c11: b8 00 00 00 00 mov $0x0,%eax
80105c16: e9 0a 01 00 00 jmp 80105d25 <create+0x1be>
}
if((ip = ialloc(dp->dev, type)) == 0)
80105c1b: 0f bf 55 d4 movswl -0x2c(%ebp),%edx
80105c1f: 8b 45 f4 mov -0xc(%ebp),%eax
80105c22: 8b 00 mov (%eax),%eax
80105c24: 89 54 24 04 mov %edx,0x4(%esp)
80105c28: 89 04 24 mov %eax,(%esp)
80105c2b: e8 ab b9 ff ff call 801015db <ialloc>
80105c30: 89 45 f0 mov %eax,-0x10(%ebp)
80105c33: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105c37: 75 0c jne 80105c45 <create+0xde>
panic("create: ialloc");
80105c39: c7 04 24 99 88 10 80 movl $0x80108899,(%esp)
80105c40: e8 f5 a8 ff ff call 8010053a <panic>
ilock(ip);
80105c45: 8b 45 f0 mov -0x10(%ebp),%eax
80105c48: 89 04 24 mov %eax,(%esp)
80105c4b: e8 26 bc ff ff call 80101876 <ilock>
ip->major = major;
80105c50: 8b 45 f0 mov -0x10(%ebp),%eax
80105c53: 0f b7 55 d0 movzwl -0x30(%ebp),%edx
80105c57: 66 89 50 12 mov %dx,0x12(%eax)
ip->minor = minor;
80105c5b: 8b 45 f0 mov -0x10(%ebp),%eax
80105c5e: 0f b7 55 cc movzwl -0x34(%ebp),%edx
80105c62: 66 89 50 14 mov %dx,0x14(%eax)
ip->nlink = 1;
80105c66: 8b 45 f0 mov -0x10(%ebp),%eax
80105c69: 66 c7 40 16 01 00 movw $0x1,0x16(%eax)
iupdate(ip);
80105c6f: 8b 45 f0 mov -0x10(%ebp),%eax
80105c72: 89 04 24 mov %eax,(%esp)
80105c75: e8 40 ba ff ff call 801016ba <iupdate>
if(type == T_DIR){ // Create . and .. entries.
80105c7a: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp)
80105c7f: 75 6a jne 80105ceb <create+0x184>
dp->nlink++; // for ".."
80105c81: 8b 45 f4 mov -0xc(%ebp),%eax
80105c84: 0f b7 40 16 movzwl 0x16(%eax),%eax
80105c88: 8d 50 01 lea 0x1(%eax),%edx
80105c8b: 8b 45 f4 mov -0xc(%ebp),%eax
80105c8e: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(dp);
80105c92: 8b 45 f4 mov -0xc(%ebp),%eax
80105c95: 89 04 24 mov %eax,(%esp)
80105c98: e8 1d ba ff ff call 801016ba <iupdate>
// No ip->nlink++ for ".": avoid cyclic ref count.
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
80105c9d: 8b 45 f0 mov -0x10(%ebp),%eax
80105ca0: 8b 40 04 mov 0x4(%eax),%eax
80105ca3: 89 44 24 08 mov %eax,0x8(%esp)
80105ca7: c7 44 24 04 73 88 10 movl $0x80108873,0x4(%esp)
80105cae: 80
80105caf: 8b 45 f0 mov -0x10(%ebp),%eax
80105cb2: 89 04 24 mov %eax,(%esp)
80105cb5: e8 a7 c4 ff ff call 80102161 <dirlink>
80105cba: 85 c0 test %eax,%eax
80105cbc: 78 21 js 80105cdf <create+0x178>
80105cbe: 8b 45 f4 mov -0xc(%ebp),%eax
80105cc1: 8b 40 04 mov 0x4(%eax),%eax
80105cc4: 89 44 24 08 mov %eax,0x8(%esp)
80105cc8: c7 44 24 04 75 88 10 movl $0x80108875,0x4(%esp)
80105ccf: 80
80105cd0: 8b 45 f0 mov -0x10(%ebp),%eax
80105cd3: 89 04 24 mov %eax,(%esp)
80105cd6: e8 86 c4 ff ff call 80102161 <dirlink>
80105cdb: 85 c0 test %eax,%eax
80105cdd: 79 0c jns 80105ceb <create+0x184>
panic("create dots");
80105cdf: c7 04 24 a8 88 10 80 movl $0x801088a8,(%esp)
80105ce6: e8 4f a8 ff ff call 8010053a <panic>
}
if(dirlink(dp, name, ip->inum) < 0)
80105ceb: 8b 45 f0 mov -0x10(%ebp),%eax
80105cee: 8b 40 04 mov 0x4(%eax),%eax
80105cf1: 89 44 24 08 mov %eax,0x8(%esp)
80105cf5: 8d 45 de lea -0x22(%ebp),%eax
80105cf8: 89 44 24 04 mov %eax,0x4(%esp)
80105cfc: 8b 45 f4 mov -0xc(%ebp),%eax
80105cff: 89 04 24 mov %eax,(%esp)
80105d02: e8 5a c4 ff ff call 80102161 <dirlink>
80105d07: 85 c0 test %eax,%eax
80105d09: 79 0c jns 80105d17 <create+0x1b0>
panic("create: dirlink");
80105d0b: c7 04 24 b4 88 10 80 movl $0x801088b4,(%esp)
80105d12: e8 23 a8 ff ff call 8010053a <panic>
iunlockput(dp);
80105d17: 8b 45 f4 mov -0xc(%ebp),%eax
80105d1a: 89 04 24 mov %eax,(%esp)
80105d1d: e8 d8 bd ff ff call 80101afa <iunlockput>
return ip;
80105d22: 8b 45 f0 mov -0x10(%ebp),%eax
}
80105d25: c9 leave
80105d26: c3 ret
80105d27 <sys_open>:
int
sys_open(void)
{
80105d27: 55 push %ebp
80105d28: 89 e5 mov %esp,%ebp
80105d2a: 83 ec 38 sub $0x38,%esp
char *path;
int fd, omode;
struct file *f;
struct inode *ip;
if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
80105d2d: 8d 45 e8 lea -0x18(%ebp),%eax
80105d30: 89 44 24 04 mov %eax,0x4(%esp)
80105d34: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105d3b: e8 d3 f6 ff ff call 80105413 <argstr>
80105d40: 85 c0 test %eax,%eax
80105d42: 78 17 js 80105d5b <sys_open+0x34>
80105d44: 8d 45 e4 lea -0x1c(%ebp),%eax
80105d47: 89 44 24 04 mov %eax,0x4(%esp)
80105d4b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105d52: e8 2c f6 ff ff call 80105383 <argint>
80105d57: 85 c0 test %eax,%eax
80105d59: 79 0a jns 80105d65 <sys_open+0x3e>
return -1;
80105d5b: b8 ff ff ff ff mov $0xffffffff,%eax
80105d60: e9 5c 01 00 00 jmp 80105ec1 <sys_open+0x19a>
begin_op();
80105d65: e8 c1 d6 ff ff call 8010342b <begin_op>
if(omode & O_CREATE){
80105d6a: 8b 45 e4 mov -0x1c(%ebp),%eax
80105d6d: 25 00 02 00 00 and $0x200,%eax
80105d72: 85 c0 test %eax,%eax
80105d74: 74 3b je 80105db1 <sys_open+0x8a>
ip = create(path, T_FILE, 0, 0);
80105d76: 8b 45 e8 mov -0x18(%ebp),%eax
80105d79: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
80105d80: 00
80105d81: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80105d88: 00
80105d89: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
80105d90: 00
80105d91: 89 04 24 mov %eax,(%esp)
80105d94: e8 ce fd ff ff call 80105b67 <create>
80105d99: 89 45 f4 mov %eax,-0xc(%ebp)
if(ip == 0){
80105d9c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105da0: 75 6b jne 80105e0d <sys_open+0xe6>
end_op();
80105da2: e8 08 d7 ff ff call 801034af <end_op>
return -1;
80105da7: b8 ff ff ff ff mov $0xffffffff,%eax
80105dac: e9 10 01 00 00 jmp 80105ec1 <sys_open+0x19a>
}
} else {
if((ip = namei(path)) == 0){
80105db1: 8b 45 e8 mov -0x18(%ebp),%eax
80105db4: 89 04 24 mov %eax,(%esp)
80105db7: e8 65 c6 ff ff call 80102421 <namei>
80105dbc: 89 45 f4 mov %eax,-0xc(%ebp)
80105dbf: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105dc3: 75 0f jne 80105dd4 <sys_open+0xad>
end_op();
80105dc5: e8 e5 d6 ff ff call 801034af <end_op>
return -1;
80105dca: b8 ff ff ff ff mov $0xffffffff,%eax
80105dcf: e9 ed 00 00 00 jmp 80105ec1 <sys_open+0x19a>
}
ilock(ip);
80105dd4: 8b 45 f4 mov -0xc(%ebp),%eax
80105dd7: 89 04 24 mov %eax,(%esp)
80105dda: e8 97 ba ff ff call 80101876 <ilock>
if(ip->type == T_DIR && omode != O_RDONLY){
80105ddf: 8b 45 f4 mov -0xc(%ebp),%eax
80105de2: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105de6: 66 83 f8 01 cmp $0x1,%ax
80105dea: 75 21 jne 80105e0d <sys_open+0xe6>
80105dec: 8b 45 e4 mov -0x1c(%ebp),%eax
80105def: 85 c0 test %eax,%eax
80105df1: 74 1a je 80105e0d <sys_open+0xe6>
iunlockput(ip);
80105df3: 8b 45 f4 mov -0xc(%ebp),%eax
80105df6: 89 04 24 mov %eax,(%esp)
80105df9: e8 fc bc ff ff call 80101afa <iunlockput>
end_op();
80105dfe: e8 ac d6 ff ff call 801034af <end_op>
return -1;
80105e03: b8 ff ff ff ff mov $0xffffffff,%eax
80105e08: e9 b4 00 00 00 jmp 80105ec1 <sys_open+0x19a>
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
80105e0d: e8 20 b1 ff ff call 80100f32 <filealloc>
80105e12: 89 45 f0 mov %eax,-0x10(%ebp)
80105e15: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105e19: 74 14 je 80105e2f <sys_open+0x108>
80105e1b: 8b 45 f0 mov -0x10(%ebp),%eax
80105e1e: 89 04 24 mov %eax,(%esp)
80105e21: e8 2e f7 ff ff call 80105554 <fdalloc>
80105e26: 89 45 ec mov %eax,-0x14(%ebp)
80105e29: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80105e2d: 79 28 jns 80105e57 <sys_open+0x130>
if(f)
80105e2f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105e33: 74 0b je 80105e40 <sys_open+0x119>
fileclose(f);
80105e35: 8b 45 f0 mov -0x10(%ebp),%eax
80105e38: 89 04 24 mov %eax,(%esp)
80105e3b: e8 a9 b1 ff ff call 80100fe9 <fileclose>
iunlockput(ip);
80105e40: 8b 45 f4 mov -0xc(%ebp),%eax
80105e43: 89 04 24 mov %eax,(%esp)
80105e46: e8 af bc ff ff call 80101afa <iunlockput>
end_op();
80105e4b: e8 5f d6 ff ff call 801034af <end_op>
return -1;
80105e50: b8 ff ff ff ff mov $0xffffffff,%eax
80105e55: eb 6a jmp 80105ec1 <sys_open+0x19a>
}
iunlock(ip);
80105e57: 8b 45 f4 mov -0xc(%ebp),%eax
80105e5a: 89 04 24 mov %eax,(%esp)
80105e5d: e8 62 bb ff ff call 801019c4 <iunlock>
end_op();
80105e62: e8 48 d6 ff ff call 801034af <end_op>
f->type = FD_INODE;
80105e67: 8b 45 f0 mov -0x10(%ebp),%eax
80105e6a: c7 00 02 00 00 00 movl $0x2,(%eax)
f->ip = ip;
80105e70: 8b 45 f0 mov -0x10(%ebp),%eax
80105e73: 8b 55 f4 mov -0xc(%ebp),%edx
80105e76: 89 50 10 mov %edx,0x10(%eax)
f->off = 0;
80105e79: 8b 45 f0 mov -0x10(%ebp),%eax
80105e7c: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
f->readable = !(omode & O_WRONLY);
80105e83: 8b 45 e4 mov -0x1c(%ebp),%eax
80105e86: 83 e0 01 and $0x1,%eax
80105e89: 85 c0 test %eax,%eax
80105e8b: 0f 94 c0 sete %al
80105e8e: 89 c2 mov %eax,%edx
80105e90: 8b 45 f0 mov -0x10(%ebp),%eax
80105e93: 88 50 08 mov %dl,0x8(%eax)
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80105e96: 8b 45 e4 mov -0x1c(%ebp),%eax
80105e99: 83 e0 01 and $0x1,%eax
80105e9c: 85 c0 test %eax,%eax
80105e9e: 75 0a jne 80105eaa <sys_open+0x183>
80105ea0: 8b 45 e4 mov -0x1c(%ebp),%eax
80105ea3: 83 e0 02 and $0x2,%eax
80105ea6: 85 c0 test %eax,%eax
80105ea8: 74 07 je 80105eb1 <sys_open+0x18a>
80105eaa: b8 01 00 00 00 mov $0x1,%eax
80105eaf: eb 05 jmp 80105eb6 <sys_open+0x18f>
80105eb1: b8 00 00 00 00 mov $0x0,%eax
80105eb6: 89 c2 mov %eax,%edx
80105eb8: 8b 45 f0 mov -0x10(%ebp),%eax
80105ebb: 88 50 09 mov %dl,0x9(%eax)
return fd;
80105ebe: 8b 45 ec mov -0x14(%ebp),%eax
}
80105ec1: c9 leave
80105ec2: c3 ret
80105ec3 <sys_mkdir>:
int
sys_mkdir(void)
{
80105ec3: 55 push %ebp
80105ec4: 89 e5 mov %esp,%ebp
80105ec6: 83 ec 28 sub $0x28,%esp
char *path;
struct inode *ip;
begin_op();
80105ec9: e8 5d d5 ff ff call 8010342b <begin_op>
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
80105ece: 8d 45 f0 lea -0x10(%ebp),%eax
80105ed1: 89 44 24 04 mov %eax,0x4(%esp)
80105ed5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105edc: e8 32 f5 ff ff call 80105413 <argstr>
80105ee1: 85 c0 test %eax,%eax
80105ee3: 78 2c js 80105f11 <sys_mkdir+0x4e>
80105ee5: 8b 45 f0 mov -0x10(%ebp),%eax
80105ee8: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
80105eef: 00
80105ef0: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80105ef7: 00
80105ef8: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80105eff: 00
80105f00: 89 04 24 mov %eax,(%esp)
80105f03: e8 5f fc ff ff call 80105b67 <create>
80105f08: 89 45 f4 mov %eax,-0xc(%ebp)
80105f0b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105f0f: 75 0c jne 80105f1d <sys_mkdir+0x5a>
end_op();
80105f11: e8 99 d5 ff ff call 801034af <end_op>
return -1;
80105f16: b8 ff ff ff ff mov $0xffffffff,%eax
80105f1b: eb 15 jmp 80105f32 <sys_mkdir+0x6f>
}
iunlockput(ip);
80105f1d: 8b 45 f4 mov -0xc(%ebp),%eax
80105f20: 89 04 24 mov %eax,(%esp)
80105f23: e8 d2 bb ff ff call 80101afa <iunlockput>
end_op();
80105f28: e8 82 d5 ff ff call 801034af <end_op>
return 0;
80105f2d: b8 00 00 00 00 mov $0x0,%eax
}
80105f32: c9 leave
80105f33: c3 ret
80105f34 <sys_mknod>:
int
sys_mknod(void)
{
80105f34: 55 push %ebp
80105f35: 89 e5 mov %esp,%ebp
80105f37: 83 ec 38 sub $0x38,%esp
struct inode *ip;
char *path;
int len;
int major, minor;
begin_op();
80105f3a: e8 ec d4 ff ff call 8010342b <begin_op>
if((len=argstr(0, &path)) < 0 ||
80105f3f: 8d 45 ec lea -0x14(%ebp),%eax
80105f42: 89 44 24 04 mov %eax,0x4(%esp)
80105f46: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105f4d: e8 c1 f4 ff ff call 80105413 <argstr>
80105f52: 89 45 f4 mov %eax,-0xc(%ebp)
80105f55: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105f59: 78 5e js 80105fb9 <sys_mknod+0x85>
argint(1, &major) < 0 ||
80105f5b: 8d 45 e8 lea -0x18(%ebp),%eax
80105f5e: 89 44 24 04 mov %eax,0x4(%esp)
80105f62: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105f69: e8 15 f4 ff ff call 80105383 <argint>
char *path;
int len;
int major, minor;
begin_op();
if((len=argstr(0, &path)) < 0 ||
80105f6e: 85 c0 test %eax,%eax
80105f70: 78 47 js 80105fb9 <sys_mknod+0x85>
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105f72: 8d 45 e4 lea -0x1c(%ebp),%eax
80105f75: 89 44 24 04 mov %eax,0x4(%esp)
80105f79: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80105f80: e8 fe f3 ff ff call 80105383 <argint>
int len;
int major, minor;
begin_op();
if((len=argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
80105f85: 85 c0 test %eax,%eax
80105f87: 78 30 js 80105fb9 <sys_mknod+0x85>
argint(2, &minor) < 0 ||
(ip = create(path, T_DEV, major, minor)) == 0){
80105f89: 8b 45 e4 mov -0x1c(%ebp),%eax
80105f8c: 0f bf c8 movswl %ax,%ecx
80105f8f: 8b 45 e8 mov -0x18(%ebp),%eax
80105f92: 0f bf d0 movswl %ax,%edx
80105f95: 8b 45 ec mov -0x14(%ebp),%eax
int major, minor;
begin_op();
if((len=argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105f98: 89 4c 24 0c mov %ecx,0xc(%esp)
80105f9c: 89 54 24 08 mov %edx,0x8(%esp)
80105fa0: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
80105fa7: 00
80105fa8: 89 04 24 mov %eax,(%esp)
80105fab: e8 b7 fb ff ff call 80105b67 <create>
80105fb0: 89 45 f0 mov %eax,-0x10(%ebp)
80105fb3: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105fb7: 75 0c jne 80105fc5 <sys_mknod+0x91>
(ip = create(path, T_DEV, major, minor)) == 0){
end_op();
80105fb9: e8 f1 d4 ff ff call 801034af <end_op>
return -1;
80105fbe: b8 ff ff ff ff mov $0xffffffff,%eax
80105fc3: eb 15 jmp 80105fda <sys_mknod+0xa6>
}
iunlockput(ip);
80105fc5: 8b 45 f0 mov -0x10(%ebp),%eax
80105fc8: 89 04 24 mov %eax,(%esp)
80105fcb: e8 2a bb ff ff call 80101afa <iunlockput>
end_op();
80105fd0: e8 da d4 ff ff call 801034af <end_op>
return 0;
80105fd5: b8 00 00 00 00 mov $0x0,%eax
}
80105fda: c9 leave
80105fdb: c3 ret
80105fdc <sys_chdir>:
int
sys_chdir(void)
{
80105fdc: 55 push %ebp
80105fdd: 89 e5 mov %esp,%ebp
80105fdf: 83 ec 28 sub $0x28,%esp
char *path;
struct inode *ip;
begin_op();
80105fe2: e8 44 d4 ff ff call 8010342b <begin_op>
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
80105fe7: 8d 45 f0 lea -0x10(%ebp),%eax
80105fea: 89 44 24 04 mov %eax,0x4(%esp)
80105fee: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105ff5: e8 19 f4 ff ff call 80105413 <argstr>
80105ffa: 85 c0 test %eax,%eax
80105ffc: 78 14 js 80106012 <sys_chdir+0x36>
80105ffe: 8b 45 f0 mov -0x10(%ebp),%eax
80106001: 89 04 24 mov %eax,(%esp)
80106004: e8 18 c4 ff ff call 80102421 <namei>
80106009: 89 45 f4 mov %eax,-0xc(%ebp)
8010600c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80106010: 75 0c jne 8010601e <sys_chdir+0x42>
end_op();
80106012: e8 98 d4 ff ff call 801034af <end_op>
return -1;
80106017: b8 ff ff ff ff mov $0xffffffff,%eax
8010601c: eb 61 jmp 8010607f <sys_chdir+0xa3>
}
ilock(ip);
8010601e: 8b 45 f4 mov -0xc(%ebp),%eax
80106021: 89 04 24 mov %eax,(%esp)
80106024: e8 4d b8 ff ff call 80101876 <ilock>
if(ip->type != T_DIR){
80106029: 8b 45 f4 mov -0xc(%ebp),%eax
8010602c: 0f b7 40 10 movzwl 0x10(%eax),%eax
80106030: 66 83 f8 01 cmp $0x1,%ax
80106034: 74 17 je 8010604d <sys_chdir+0x71>
iunlockput(ip);
80106036: 8b 45 f4 mov -0xc(%ebp),%eax
80106039: 89 04 24 mov %eax,(%esp)
8010603c: e8 b9 ba ff ff call 80101afa <iunlockput>
end_op();
80106041: e8 69 d4 ff ff call 801034af <end_op>
return -1;
80106046: b8 ff ff ff ff mov $0xffffffff,%eax
8010604b: eb 32 jmp 8010607f <sys_chdir+0xa3>
}
iunlock(ip);
8010604d: 8b 45 f4 mov -0xc(%ebp),%eax
80106050: 89 04 24 mov %eax,(%esp)
80106053: e8 6c b9 ff ff call 801019c4 <iunlock>
iput(proc->cwd);
80106058: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010605e: 8b 40 68 mov 0x68(%eax),%eax
80106061: 89 04 24 mov %eax,(%esp)
80106064: e8 c0 b9 ff ff call 80101a29 <iput>
end_op();
80106069: e8 41 d4 ff ff call 801034af <end_op>
proc->cwd = ip;
8010606e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106074: 8b 55 f4 mov -0xc(%ebp),%edx
80106077: 89 50 68 mov %edx,0x68(%eax)
return 0;
8010607a: b8 00 00 00 00 mov $0x0,%eax
}
8010607f: c9 leave
80106080: c3 ret
80106081 <sys_exec>:
int
sys_exec(void)
{
80106081: 55 push %ebp
80106082: 89 e5 mov %esp,%ebp
80106084: 81 ec a8 00 00 00 sub $0xa8,%esp
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
8010608a: 8d 45 f0 lea -0x10(%ebp),%eax
8010608d: 89 44 24 04 mov %eax,0x4(%esp)
80106091: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80106098: e8 76 f3 ff ff call 80105413 <argstr>
8010609d: 85 c0 test %eax,%eax
8010609f: 78 1a js 801060bb <sys_exec+0x3a>
801060a1: 8d 85 6c ff ff ff lea -0x94(%ebp),%eax
801060a7: 89 44 24 04 mov %eax,0x4(%esp)
801060ab: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801060b2: e8 cc f2 ff ff call 80105383 <argint>
801060b7: 85 c0 test %eax,%eax
801060b9: 79 0a jns 801060c5 <sys_exec+0x44>
return -1;
801060bb: b8 ff ff ff ff mov $0xffffffff,%eax
801060c0: e9 c8 00 00 00 jmp 8010618d <sys_exec+0x10c>
}
memset(argv, 0, sizeof(argv));
801060c5: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp)
801060cc: 00
801060cd: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801060d4: 00
801060d5: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax
801060db: 89 04 24 mov %eax,(%esp)
801060de: e8 5e ef ff ff call 80105041 <memset>
for(i=0;; i++){
801060e3: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
if(i >= NELEM(argv))
801060ea: 8b 45 f4 mov -0xc(%ebp),%eax
801060ed: 83 f8 1f cmp $0x1f,%eax
801060f0: 76 0a jbe 801060fc <sys_exec+0x7b>
return -1;
801060f2: b8 ff ff ff ff mov $0xffffffff,%eax
801060f7: e9 91 00 00 00 jmp 8010618d <sys_exec+0x10c>
if(fetchint(uargv+4*i, (int*)&uarg) < 0)
801060fc: 8b 45 f4 mov -0xc(%ebp),%eax
801060ff: c1 e0 02 shl $0x2,%eax
80106102: 89 c2 mov %eax,%edx
80106104: 8b 85 6c ff ff ff mov -0x94(%ebp),%eax
8010610a: 01 c2 add %eax,%edx
8010610c: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
80106112: 89 44 24 04 mov %eax,0x4(%esp)
80106116: 89 14 24 mov %edx,(%esp)
80106119: e8 c9 f1 ff ff call 801052e7 <fetchint>
8010611e: 85 c0 test %eax,%eax
80106120: 79 07 jns 80106129 <sys_exec+0xa8>
return -1;
80106122: b8 ff ff ff ff mov $0xffffffff,%eax
80106127: eb 64 jmp 8010618d <sys_exec+0x10c>
if(uarg == 0){
80106129: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax
8010612f: 85 c0 test %eax,%eax
80106131: 75 26 jne 80106159 <sys_exec+0xd8>
argv[i] = 0;
80106133: 8b 45 f4 mov -0xc(%ebp),%eax
80106136: c7 84 85 70 ff ff ff movl $0x0,-0x90(%ebp,%eax,4)
8010613d: 00 00 00 00
break;
80106141: 90 nop
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
80106142: 8b 45 f0 mov -0x10(%ebp),%eax
80106145: 8d 95 70 ff ff ff lea -0x90(%ebp),%edx
8010614b: 89 54 24 04 mov %edx,0x4(%esp)
8010614f: 89 04 24 mov %eax,(%esp)
80106152: e8 98 a9 ff ff call 80100aef <exec>
80106157: eb 34 jmp 8010618d <sys_exec+0x10c>
return -1;
if(uarg == 0){
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
80106159: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax
8010615f: 8b 55 f4 mov -0xc(%ebp),%edx
80106162: c1 e2 02 shl $0x2,%edx
80106165: 01 c2 add %eax,%edx
80106167: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax
8010616d: 89 54 24 04 mov %edx,0x4(%esp)
80106171: 89 04 24 mov %eax,(%esp)
80106174: e8 a8 f1 ff ff call 80105321 <fetchstr>
80106179: 85 c0 test %eax,%eax
8010617b: 79 07 jns 80106184 <sys_exec+0x103>
return -1;
8010617d: b8 ff ff ff ff mov $0xffffffff,%eax
80106182: eb 09 jmp 8010618d <sys_exec+0x10c>
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
}
memset(argv, 0, sizeof(argv));
for(i=0;; i++){
80106184: 83 45 f4 01 addl $0x1,-0xc(%ebp)
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
80106188: e9 5d ff ff ff jmp 801060ea <sys_exec+0x69>
return exec(path, argv);
}
8010618d: c9 leave
8010618e: c3 ret
8010618f <sys_pipe>:
int
sys_pipe(void)
{
8010618f: 55 push %ebp
80106190: 89 e5 mov %esp,%ebp
80106192: 83 ec 38 sub $0x38,%esp
int *fd;
struct file *rf, *wf;
int fd0, fd1;
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
80106195: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp)
8010619c: 00
8010619d: 8d 45 ec lea -0x14(%ebp),%eax
801061a0: 89 44 24 04 mov %eax,0x4(%esp)
801061a4: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801061ab: e8 01 f2 ff ff call 801053b1 <argptr>
801061b0: 85 c0 test %eax,%eax
801061b2: 79 0a jns 801061be <sys_pipe+0x2f>
return -1;
801061b4: b8 ff ff ff ff mov $0xffffffff,%eax
801061b9: e9 9b 00 00 00 jmp 80106259 <sys_pipe+0xca>
if(pipealloc(&rf, &wf) < 0)
801061be: 8d 45 e4 lea -0x1c(%ebp),%eax
801061c1: 89 44 24 04 mov %eax,0x4(%esp)
801061c5: 8d 45 e8 lea -0x18(%ebp),%eax
801061c8: 89 04 24 mov %eax,(%esp)
801061cb: e8 54 dd ff ff call 80103f24 <pipealloc>
801061d0: 85 c0 test %eax,%eax
801061d2: 79 07 jns 801061db <sys_pipe+0x4c>
return -1;
801061d4: b8 ff ff ff ff mov $0xffffffff,%eax
801061d9: eb 7e jmp 80106259 <sys_pipe+0xca>
fd0 = -1;
801061db: c7 45 f4 ff ff ff ff movl $0xffffffff,-0xc(%ebp)
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
801061e2: 8b 45 e8 mov -0x18(%ebp),%eax
801061e5: 89 04 24 mov %eax,(%esp)
801061e8: e8 67 f3 ff ff call 80105554 <fdalloc>
801061ed: 89 45 f4 mov %eax,-0xc(%ebp)
801061f0: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801061f4: 78 14 js 8010620a <sys_pipe+0x7b>
801061f6: 8b 45 e4 mov -0x1c(%ebp),%eax
801061f9: 89 04 24 mov %eax,(%esp)
801061fc: e8 53 f3 ff ff call 80105554 <fdalloc>
80106201: 89 45 f0 mov %eax,-0x10(%ebp)
80106204: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80106208: 79 37 jns 80106241 <sys_pipe+0xb2>
if(fd0 >= 0)
8010620a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010620e: 78 14 js 80106224 <sys_pipe+0x95>
proc->ofile[fd0] = 0;
80106210: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106216: 8b 55 f4 mov -0xc(%ebp),%edx
80106219: 83 c2 08 add $0x8,%edx
8010621c: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
80106223: 00
fileclose(rf);
80106224: 8b 45 e8 mov -0x18(%ebp),%eax
80106227: 89 04 24 mov %eax,(%esp)
8010622a: e8 ba ad ff ff call 80100fe9 <fileclose>
fileclose(wf);
8010622f: 8b 45 e4 mov -0x1c(%ebp),%eax
80106232: 89 04 24 mov %eax,(%esp)
80106235: e8 af ad ff ff call 80100fe9 <fileclose>
return -1;
8010623a: b8 ff ff ff ff mov $0xffffffff,%eax
8010623f: eb 18 jmp 80106259 <sys_pipe+0xca>
}
fd[0] = fd0;
80106241: 8b 45 ec mov -0x14(%ebp),%eax
80106244: 8b 55 f4 mov -0xc(%ebp),%edx
80106247: 89 10 mov %edx,(%eax)
fd[1] = fd1;
80106249: 8b 45 ec mov -0x14(%ebp),%eax
8010624c: 8d 50 04 lea 0x4(%eax),%edx
8010624f: 8b 45 f0 mov -0x10(%ebp),%eax
80106252: 89 02 mov %eax,(%edx)
return 0;
80106254: b8 00 00 00 00 mov $0x0,%eax
}
80106259: c9 leave
8010625a: c3 ret
8010625b <sys_fork>:
#include "mmu.h"
#include "proc.h"
int
sys_fork(void)
{
8010625b: 55 push %ebp
8010625c: 89 e5 mov %esp,%ebp
8010625e: 83 ec 08 sub $0x8,%esp
return fork();
80106261: e8 69 e3 ff ff call 801045cf <fork>
}
80106266: c9 leave
80106267: c3 ret
80106268 <sys_exit>:
int
sys_exit(void)
{
80106268: 55 push %ebp
80106269: 89 e5 mov %esp,%ebp
8010626b: 83 ec 08 sub $0x8,%esp
exit();
8010626e: e8 d7 e4 ff ff call 8010474a <exit>
return 0; // not reached
80106273: b8 00 00 00 00 mov $0x0,%eax
}
80106278: c9 leave
80106279: c3 ret
8010627a <sys_wait>:
int
sys_wait(void)
{
8010627a: 55 push %ebp
8010627b: 89 e5 mov %esp,%ebp
8010627d: 83 ec 08 sub $0x8,%esp
return wait();
80106280: e8 e7 e5 ff ff call 8010486c <wait>
}
80106285: c9 leave
80106286: c3 ret
80106287 <sys_kill>:
int
sys_kill(void)
{
80106287: 55 push %ebp
80106288: 89 e5 mov %esp,%ebp
8010628a: 83 ec 28 sub $0x28,%esp
int pid;
if(argint(0, &pid) < 0)
8010628d: 8d 45 f4 lea -0xc(%ebp),%eax
80106290: 89 44 24 04 mov %eax,0x4(%esp)
80106294: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010629b: e8 e3 f0 ff ff call 80105383 <argint>
801062a0: 85 c0 test %eax,%eax
801062a2: 79 07 jns 801062ab <sys_kill+0x24>
return -1;
801062a4: b8 ff ff ff ff mov $0xffffffff,%eax
801062a9: eb 0b jmp 801062b6 <sys_kill+0x2f>
return kill(pid);
801062ab: 8b 45 f4 mov -0xc(%ebp),%eax
801062ae: 89 04 24 mov %eax,(%esp)
801062b1: e8 71 e9 ff ff call 80104c27 <kill>
}
801062b6: c9 leave
801062b7: c3 ret
801062b8 <sys_getpid>:
int
sys_getpid(void)
{
801062b8: 55 push %ebp
801062b9: 89 e5 mov %esp,%ebp
return proc->pid;
801062bb: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801062c1: 8b 40 10 mov 0x10(%eax),%eax
}
801062c4: 5d pop %ebp
801062c5: c3 ret
801062c6 <sys_sbrk>:
int
sys_sbrk(void)
{
801062c6: 55 push %ebp
801062c7: 89 e5 mov %esp,%ebp
801062c9: 83 ec 28 sub $0x28,%esp
int addr;
int n;
if(argint(0, &n) < 0)
801062cc: 8d 45 f0 lea -0x10(%ebp),%eax
801062cf: 89 44 24 04 mov %eax,0x4(%esp)
801062d3: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801062da: e8 a4 f0 ff ff call 80105383 <argint>
801062df: 85 c0 test %eax,%eax
801062e1: 79 07 jns 801062ea <sys_sbrk+0x24>
return -1;
801062e3: b8 ff ff ff ff mov $0xffffffff,%eax
801062e8: eb 24 jmp 8010630e <sys_sbrk+0x48>
addr = proc->sz;
801062ea: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801062f0: 8b 00 mov (%eax),%eax
801062f2: 89 45 f4 mov %eax,-0xc(%ebp)
if(growproc(n) < 0)
801062f5: 8b 45 f0 mov -0x10(%ebp),%eax
801062f8: 89 04 24 mov %eax,(%esp)
801062fb: e8 2a e2 ff ff call 8010452a <growproc>
80106300: 85 c0 test %eax,%eax
80106302: 79 07 jns 8010630b <sys_sbrk+0x45>
return -1;
80106304: b8 ff ff ff ff mov $0xffffffff,%eax
80106309: eb 03 jmp 8010630e <sys_sbrk+0x48>
return addr;
8010630b: 8b 45 f4 mov -0xc(%ebp),%eax
}
8010630e: c9 leave
8010630f: c3 ret
80106310 <sys_sleep>:
int
sys_sleep(void)
{
80106310: 55 push %ebp
80106311: 89 e5 mov %esp,%ebp
80106313: 83 ec 28 sub $0x28,%esp
int n;
uint ticks0;
if(argint(0, &n) < 0)
80106316: 8d 45 f0 lea -0x10(%ebp),%eax
80106319: 89 44 24 04 mov %eax,0x4(%esp)
8010631d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80106324: e8 5a f0 ff ff call 80105383 <argint>
80106329: 85 c0 test %eax,%eax
8010632b: 79 07 jns 80106334 <sys_sleep+0x24>
return -1;
8010632d: b8 ff ff ff ff mov $0xffffffff,%eax
80106332: eb 6c jmp 801063a0 <sys_sleep+0x90>
acquire(&tickslock);
80106334: c7 04 24 00 49 11 80 movl $0x80114900,(%esp)
8010633b: e8 ad ea ff ff call 80104ded <acquire>
ticks0 = ticks;
80106340: a1 40 51 11 80 mov 0x80115140,%eax
80106345: 89 45 f4 mov %eax,-0xc(%ebp)
while(ticks - ticks0 < n){
80106348: eb 34 jmp 8010637e <sys_sleep+0x6e>
if(proc->killed){
8010634a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106350: 8b 40 24 mov 0x24(%eax),%eax
80106353: 85 c0 test %eax,%eax
80106355: 74 13 je 8010636a <sys_sleep+0x5a>
release(&tickslock);
80106357: c7 04 24 00 49 11 80 movl $0x80114900,(%esp)
8010635e: e8 ec ea ff ff call 80104e4f <release>
return -1;
80106363: b8 ff ff ff ff mov $0xffffffff,%eax
80106368: eb 36 jmp 801063a0 <sys_sleep+0x90>
}
sleep(&ticks, &tickslock);
8010636a: c7 44 24 04 00 49 11 movl $0x80114900,0x4(%esp)
80106371: 80
80106372: c7 04 24 40 51 11 80 movl $0x80115140,(%esp)
80106379: e8 a5 e7 ff ff call 80104b23 <sleep>
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
while(ticks - ticks0 < n){
8010637e: a1 40 51 11 80 mov 0x80115140,%eax
80106383: 2b 45 f4 sub -0xc(%ebp),%eax
80106386: 89 c2 mov %eax,%edx
80106388: 8b 45 f0 mov -0x10(%ebp),%eax
8010638b: 39 c2 cmp %eax,%edx
8010638d: 72 bb jb 8010634a <sys_sleep+0x3a>
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
8010638f: c7 04 24 00 49 11 80 movl $0x80114900,(%esp)
80106396: e8 b4 ea ff ff call 80104e4f <release>
return 0;
8010639b: b8 00 00 00 00 mov $0x0,%eax
}
801063a0: c9 leave
801063a1: c3 ret
801063a2 <sys_uptime>:
// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
801063a2: 55 push %ebp
801063a3: 89 e5 mov %esp,%ebp
801063a5: 83 ec 28 sub $0x28,%esp
uint xticks;
acquire(&tickslock);
801063a8: c7 04 24 00 49 11 80 movl $0x80114900,(%esp)
801063af: e8 39 ea ff ff call 80104ded <acquire>
xticks = ticks;
801063b4: a1 40 51 11 80 mov 0x80115140,%eax
801063b9: 89 45 f4 mov %eax,-0xc(%ebp)
release(&tickslock);
801063bc: c7 04 24 00 49 11 80 movl $0x80114900,(%esp)
801063c3: e8 87 ea ff ff call 80104e4f <release>
return xticks;
801063c8: 8b 45 f4 mov -0xc(%ebp),%eax
}
801063cb: c9 leave
801063cc: c3 ret
801063cd <sys_date>:
int
sys_date(void)
{
801063cd: 55 push %ebp
801063ce: 89 e5 mov %esp,%ebp
801063d0: 83 ec 28 sub $0x28,%esp
struct rtcdate *r;
argptr(0, (void *)&r, sizeof(struct rtcdate));
801063d3: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp)
801063da: 00
801063db: 8d 45 f4 lea -0xc(%ebp),%eax
801063de: 89 44 24 04 mov %eax,0x4(%esp)
801063e2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801063e9: e8 c3 ef ff ff call 801053b1 <argptr>
cmostime(r);
801063ee: 8b 45 f4 mov -0xc(%ebp),%eax
801063f1: 89 04 24 mov %eax,(%esp)
801063f4: e8 c2 cc ff ff call 801030bb <cmostime>
return 0;
801063f9: b8 00 00 00 00 mov $0x0,%eax
}
801063fe: c9 leave
801063ff: c3 ret
80106400 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80106400: 55 push %ebp
80106401: 89 e5 mov %esp,%ebp
80106403: 83 ec 08 sub $0x8,%esp
80106406: 8b 55 08 mov 0x8(%ebp),%edx
80106409: 8b 45 0c mov 0xc(%ebp),%eax
8010640c: 66 89 55 fc mov %dx,-0x4(%ebp)
80106410: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80106413: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80106417: 0f b7 55 fc movzwl -0x4(%ebp),%edx
8010641b: ee out %al,(%dx)
}
8010641c: c9 leave
8010641d: c3 ret
8010641e <timerinit>:
#define TIMER_RATEGEN 0x04 // mode 2, rate generator
#define TIMER_16BIT 0x30 // r/w counter 16 bits, LSB first
void
timerinit(void)
{
8010641e: 55 push %ebp
8010641f: 89 e5 mov %esp,%ebp
80106421: 83 ec 18 sub $0x18,%esp
// Interrupt 100 times/sec.
outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
80106424: c7 44 24 04 34 00 00 movl $0x34,0x4(%esp)
8010642b: 00
8010642c: c7 04 24 43 00 00 00 movl $0x43,(%esp)
80106433: e8 c8 ff ff ff call 80106400 <outb>
outb(IO_TIMER1, TIMER_DIV(100) % 256);
80106438: c7 44 24 04 9c 00 00 movl $0x9c,0x4(%esp)
8010643f: 00
80106440: c7 04 24 40 00 00 00 movl $0x40,(%esp)
80106447: e8 b4 ff ff ff call 80106400 <outb>
outb(IO_TIMER1, TIMER_DIV(100) / 256);
8010644c: c7 44 24 04 2e 00 00 movl $0x2e,0x4(%esp)
80106453: 00
80106454: c7 04 24 40 00 00 00 movl $0x40,(%esp)
8010645b: e8 a0 ff ff ff call 80106400 <outb>
picenable(IRQ_TIMER);
80106460: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80106467: e8 4b d9 ff ff call 80103db7 <picenable>
}
8010646c: c9 leave
8010646d: c3 ret
8010646e <alltraps>:
# vectors.S sends all traps here.
.globl alltraps
alltraps:
# Build trap frame.
pushl %ds
8010646e: 1e push %ds
pushl %es
8010646f: 06 push %es
pushl %fs
80106470: 0f a0 push %fs
pushl %gs
80106472: 0f a8 push %gs
pushal
80106474: 60 pusha
# Set up data and per-cpu segments.
movw $(SEG_KDATA<<3), %ax
80106475: 66 b8 10 00 mov $0x10,%ax
movw %ax, %ds
80106479: 8e d8 mov %eax,%ds
movw %ax, %es
8010647b: 8e c0 mov %eax,%es
movw $(SEG_KCPU<<3), %ax
8010647d: 66 b8 18 00 mov $0x18,%ax
movw %ax, %fs
80106481: 8e e0 mov %eax,%fs
movw %ax, %gs
80106483: 8e e8 mov %eax,%gs
# Call trap(tf), where tf=%esp
pushl %esp
80106485: 54 push %esp
call trap
80106486: e8 d8 01 00 00 call 80106663 <trap>
addl $4, %esp
8010648b: 83 c4 04 add $0x4,%esp
8010648e <trapret>:
# Return falls through to trapret...
.globl trapret
trapret:
popal
8010648e: 61 popa
popl %gs
8010648f: 0f a9 pop %gs
popl %fs
80106491: 0f a1 pop %fs
popl %es
80106493: 07 pop %es
popl %ds
80106494: 1f pop %ds
addl $0x8, %esp # trapno and errcode
80106495: 83 c4 08 add $0x8,%esp
iret
80106498: cf iret
80106499 <lidt>:
struct gatedesc;
static inline void
lidt(struct gatedesc *p, int size)
{
80106499: 55 push %ebp
8010649a: 89 e5 mov %esp,%ebp
8010649c: 83 ec 10 sub $0x10,%esp
volatile ushort pd[3];
pd[0] = size-1;
8010649f: 8b 45 0c mov 0xc(%ebp),%eax
801064a2: 83 e8 01 sub $0x1,%eax
801064a5: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
801064a9: 8b 45 08 mov 0x8(%ebp),%eax
801064ac: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
801064b0: 8b 45 08 mov 0x8(%ebp),%eax
801064b3: c1 e8 10 shr $0x10,%eax
801064b6: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lidt (%0)" : : "r" (pd));
801064ba: 8d 45 fa lea -0x6(%ebp),%eax
801064bd: 0f 01 18 lidtl (%eax)
}
801064c0: c9 leave
801064c1: c3 ret
801064c2 <rcr2>:
return result;
}
static inline uint
rcr2(void)
{
801064c2: 55 push %ebp
801064c3: 89 e5 mov %esp,%ebp
801064c5: 83 ec 10 sub $0x10,%esp
uint val;
asm volatile("movl %%cr2,%0" : "=r" (val));
801064c8: 0f 20 d0 mov %cr2,%eax
801064cb: 89 45 fc mov %eax,-0x4(%ebp)
return val;
801064ce: 8b 45 fc mov -0x4(%ebp),%eax
}
801064d1: c9 leave
801064d2: c3 ret
801064d3 <tvinit>:
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
801064d3: 55 push %ebp
801064d4: 89 e5 mov %esp,%ebp
801064d6: 83 ec 28 sub $0x28,%esp
int i;
for(i = 0; i < 256; i++)
801064d9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801064e0: e9 c3 00 00 00 jmp 801065a8 <tvinit+0xd5>
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
801064e5: 8b 45 f4 mov -0xc(%ebp),%eax
801064e8: 8b 04 85 fc b0 10 80 mov -0x7fef4f04(,%eax,4),%eax
801064ef: 89 c2 mov %eax,%edx
801064f1: 8b 45 f4 mov -0xc(%ebp),%eax
801064f4: 66 89 14 c5 40 49 11 mov %dx,-0x7feeb6c0(,%eax,8)
801064fb: 80
801064fc: 8b 45 f4 mov -0xc(%ebp),%eax
801064ff: 66 c7 04 c5 42 49 11 movw $0x8,-0x7feeb6be(,%eax,8)
80106506: 80 08 00
80106509: 8b 45 f4 mov -0xc(%ebp),%eax
8010650c: 0f b6 14 c5 44 49 11 movzbl -0x7feeb6bc(,%eax,8),%edx
80106513: 80
80106514: 83 e2 e0 and $0xffffffe0,%edx
80106517: 88 14 c5 44 49 11 80 mov %dl,-0x7feeb6bc(,%eax,8)
8010651e: 8b 45 f4 mov -0xc(%ebp),%eax
80106521: 0f b6 14 c5 44 49 11 movzbl -0x7feeb6bc(,%eax,8),%edx
80106528: 80
80106529: 83 e2 1f and $0x1f,%edx
8010652c: 88 14 c5 44 49 11 80 mov %dl,-0x7feeb6bc(,%eax,8)
80106533: 8b 45 f4 mov -0xc(%ebp),%eax
80106536: 0f b6 14 c5 45 49 11 movzbl -0x7feeb6bb(,%eax,8),%edx
8010653d: 80
8010653e: 83 e2 f0 and $0xfffffff0,%edx
80106541: 83 ca 0e or $0xe,%edx
80106544: 88 14 c5 45 49 11 80 mov %dl,-0x7feeb6bb(,%eax,8)
8010654b: 8b 45 f4 mov -0xc(%ebp),%eax
8010654e: 0f b6 14 c5 45 49 11 movzbl -0x7feeb6bb(,%eax,8),%edx
80106555: 80
80106556: 83 e2 ef and $0xffffffef,%edx
80106559: 88 14 c5 45 49 11 80 mov %dl,-0x7feeb6bb(,%eax,8)
80106560: 8b 45 f4 mov -0xc(%ebp),%eax
80106563: 0f b6 14 c5 45 49 11 movzbl -0x7feeb6bb(,%eax,8),%edx
8010656a: 80
8010656b: 83 e2 9f and $0xffffff9f,%edx
8010656e: 88 14 c5 45 49 11 80 mov %dl,-0x7feeb6bb(,%eax,8)
80106575: 8b 45 f4 mov -0xc(%ebp),%eax
80106578: 0f b6 14 c5 45 49 11 movzbl -0x7feeb6bb(,%eax,8),%edx
8010657f: 80
80106580: 83 ca 80 or $0xffffff80,%edx
80106583: 88 14 c5 45 49 11 80 mov %dl,-0x7feeb6bb(,%eax,8)
8010658a: 8b 45 f4 mov -0xc(%ebp),%eax
8010658d: 8b 04 85 fc b0 10 80 mov -0x7fef4f04(,%eax,4),%eax
80106594: c1 e8 10 shr $0x10,%eax
80106597: 89 c2 mov %eax,%edx
80106599: 8b 45 f4 mov -0xc(%ebp),%eax
8010659c: 66 89 14 c5 46 49 11 mov %dx,-0x7feeb6ba(,%eax,8)
801065a3: 80
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
801065a4: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801065a8: 81 7d f4 ff 00 00 00 cmpl $0xff,-0xc(%ebp)
801065af: 0f 8e 30 ff ff ff jle 801064e5 <tvinit+0x12>
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
801065b5: a1 fc b1 10 80 mov 0x8010b1fc,%eax
801065ba: 66 a3 40 4b 11 80 mov %ax,0x80114b40
801065c0: 66 c7 05 42 4b 11 80 movw $0x8,0x80114b42
801065c7: 08 00
801065c9: 0f b6 05 44 4b 11 80 movzbl 0x80114b44,%eax
801065d0: 83 e0 e0 and $0xffffffe0,%eax
801065d3: a2 44 4b 11 80 mov %al,0x80114b44
801065d8: 0f b6 05 44 4b 11 80 movzbl 0x80114b44,%eax
801065df: 83 e0 1f and $0x1f,%eax
801065e2: a2 44 4b 11 80 mov %al,0x80114b44
801065e7: 0f b6 05 45 4b 11 80 movzbl 0x80114b45,%eax
801065ee: 83 c8 0f or $0xf,%eax
801065f1: a2 45 4b 11 80 mov %al,0x80114b45
801065f6: 0f b6 05 45 4b 11 80 movzbl 0x80114b45,%eax
801065fd: 83 e0 ef and $0xffffffef,%eax
80106600: a2 45 4b 11 80 mov %al,0x80114b45
80106605: 0f b6 05 45 4b 11 80 movzbl 0x80114b45,%eax
8010660c: 83 c8 60 or $0x60,%eax
8010660f: a2 45 4b 11 80 mov %al,0x80114b45
80106614: 0f b6 05 45 4b 11 80 movzbl 0x80114b45,%eax
8010661b: 83 c8 80 or $0xffffff80,%eax
8010661e: a2 45 4b 11 80 mov %al,0x80114b45
80106623: a1 fc b1 10 80 mov 0x8010b1fc,%eax
80106628: c1 e8 10 shr $0x10,%eax
8010662b: 66 a3 46 4b 11 80 mov %ax,0x80114b46
initlock(&tickslock, "time");
80106631: c7 44 24 04 c4 88 10 movl $0x801088c4,0x4(%esp)
80106638: 80
80106639: c7 04 24 00 49 11 80 movl $0x80114900,(%esp)
80106640: e8 87 e7 ff ff call 80104dcc <initlock>
}
80106645: c9 leave
80106646: c3 ret
80106647 <idtinit>:
void
idtinit(void)
{
80106647: 55 push %ebp
80106648: 89 e5 mov %esp,%ebp
8010664a: 83 ec 08 sub $0x8,%esp
lidt(idt, sizeof(idt));
8010664d: c7 44 24 04 00 08 00 movl $0x800,0x4(%esp)
80106654: 00
80106655: c7 04 24 40 49 11 80 movl $0x80114940,(%esp)
8010665c: e8 38 fe ff ff call 80106499 <lidt>
}
80106661: c9 leave
80106662: c3 ret
80106663 <trap>:
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
80106663: 55 push %ebp
80106664: 89 e5 mov %esp,%ebp
80106666: 57 push %edi
80106667: 56 push %esi
80106668: 53 push %ebx
80106669: 83 ec 3c sub $0x3c,%esp
if(tf->trapno == T_SYSCALL){
8010666c: 8b 45 08 mov 0x8(%ebp),%eax
8010666f: 8b 40 30 mov 0x30(%eax),%eax
80106672: 83 f8 40 cmp $0x40,%eax
80106675: 75 3f jne 801066b6 <trap+0x53>
if(proc->killed)
80106677: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010667d: 8b 40 24 mov 0x24(%eax),%eax
80106680: 85 c0 test %eax,%eax
80106682: 74 05 je 80106689 <trap+0x26>
exit();
80106684: e8 c1 e0 ff ff call 8010474a <exit>
proc->tf = tf;
80106689: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010668f: 8b 55 08 mov 0x8(%ebp),%edx
80106692: 89 50 18 mov %edx,0x18(%eax)
syscall();
80106695: e8 b0 ed ff ff call 8010544a <syscall>
if(proc->killed)
8010669a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801066a0: 8b 40 24 mov 0x24(%eax),%eax
801066a3: 85 c0 test %eax,%eax
801066a5: 74 0a je 801066b1 <trap+0x4e>
exit();
801066a7: e8 9e e0 ff ff call 8010474a <exit>
return;
801066ac: e9 2d 02 00 00 jmp 801068de <trap+0x27b>
801066b1: e9 28 02 00 00 jmp 801068de <trap+0x27b>
}
switch(tf->trapno){
801066b6: 8b 45 08 mov 0x8(%ebp),%eax
801066b9: 8b 40 30 mov 0x30(%eax),%eax
801066bc: 83 e8 20 sub $0x20,%eax
801066bf: 83 f8 1f cmp $0x1f,%eax
801066c2: 0f 87 bc 00 00 00 ja 80106784 <trap+0x121>
801066c8: 8b 04 85 6c 89 10 80 mov -0x7fef7694(,%eax,4),%eax
801066cf: ff e0 jmp *%eax
case T_IRQ0 + IRQ_TIMER:
if(cpu->id == 0){
801066d1: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801066d7: 0f b6 00 movzbl (%eax),%eax
801066da: 84 c0 test %al,%al
801066dc: 75 31 jne 8010670f <trap+0xac>
acquire(&tickslock);
801066de: c7 04 24 00 49 11 80 movl $0x80114900,(%esp)
801066e5: e8 03 e7 ff ff call 80104ded <acquire>
ticks++;
801066ea: a1 40 51 11 80 mov 0x80115140,%eax
801066ef: 83 c0 01 add $0x1,%eax
801066f2: a3 40 51 11 80 mov %eax,0x80115140
wakeup(&ticks);
801066f7: c7 04 24 40 51 11 80 movl $0x80115140,(%esp)
801066fe: e8 f9 e4 ff ff call 80104bfc <wakeup>
release(&tickslock);
80106703: c7 04 24 00 49 11 80 movl $0x80114900,(%esp)
8010670a: e8 40 e7 ff ff call 80104e4f <release>
}
lapiceoi();
8010670f: e8 d7 c7 ff ff call 80102eeb <lapiceoi>
break;
80106714: e9 41 01 00 00 jmp 8010685a <trap+0x1f7>
case T_IRQ0 + IRQ_IDE:
ideintr();
80106719: e8 db bf ff ff call 801026f9 <ideintr>
lapiceoi();
8010671e: e8 c8 c7 ff ff call 80102eeb <lapiceoi>
break;
80106723: e9 32 01 00 00 jmp 8010685a <trap+0x1f7>
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
case T_IRQ0 + IRQ_KBD:
kbdintr();
80106728: e8 8d c5 ff ff call 80102cba <kbdintr>
lapiceoi();
8010672d: e8 b9 c7 ff ff call 80102eeb <lapiceoi>
break;
80106732: e9 23 01 00 00 jmp 8010685a <trap+0x1f7>
case T_IRQ0 + IRQ_COM1:
uartintr();
80106737: e8 97 03 00 00 call 80106ad3 <uartintr>
lapiceoi();
8010673c: e8 aa c7 ff ff call 80102eeb <lapiceoi>
break;
80106741: e9 14 01 00 00 jmp 8010685a <trap+0x1f7>
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106746: 8b 45 08 mov 0x8(%ebp),%eax
80106749: 8b 48 38 mov 0x38(%eax),%ecx
cpu->id, tf->cs, tf->eip);
8010674c: 8b 45 08 mov 0x8(%ebp),%eax
8010674f: 0f b7 40 3c movzwl 0x3c(%eax),%eax
uartintr();
lapiceoi();
break;
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106753: 0f b7 d0 movzwl %ax,%edx
cpu->id, tf->cs, tf->eip);
80106756: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010675c: 0f b6 00 movzbl (%eax),%eax
uartintr();
lapiceoi();
break;
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
8010675f: 0f b6 c0 movzbl %al,%eax
80106762: 89 4c 24 0c mov %ecx,0xc(%esp)
80106766: 89 54 24 08 mov %edx,0x8(%esp)
8010676a: 89 44 24 04 mov %eax,0x4(%esp)
8010676e: c7 04 24 cc 88 10 80 movl $0x801088cc,(%esp)
80106775: e8 26 9c ff ff call 801003a0 <cprintf>
cpu->id, tf->cs, tf->eip);
lapiceoi();
8010677a: e8 6c c7 ff ff call 80102eeb <lapiceoi>
break;
8010677f: e9 d6 00 00 00 jmp 8010685a <trap+0x1f7>
//PAGEBREAK: 13
default:
if(proc == 0 || (tf->cs&3) == 0){
80106784: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010678a: 85 c0 test %eax,%eax
8010678c: 74 11 je 8010679f <trap+0x13c>
8010678e: 8b 45 08 mov 0x8(%ebp),%eax
80106791: 0f b7 40 3c movzwl 0x3c(%eax),%eax
80106795: 0f b7 c0 movzwl %ax,%eax
80106798: 83 e0 03 and $0x3,%eax
8010679b: 85 c0 test %eax,%eax
8010679d: 75 46 jne 801067e5 <trap+0x182>
// In kernel, it must be our mistake.
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
8010679f: e8 1e fd ff ff call 801064c2 <rcr2>
801067a4: 8b 55 08 mov 0x8(%ebp),%edx
801067a7: 8b 5a 38 mov 0x38(%edx),%ebx
tf->trapno, cpu->id, tf->eip, rcr2());
801067aa: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
801067b1: 0f b6 12 movzbl (%edx),%edx
//PAGEBREAK: 13
default:
if(proc == 0 || (tf->cs&3) == 0){
// In kernel, it must be our mistake.
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
801067b4: 0f b6 ca movzbl %dl,%ecx
801067b7: 8b 55 08 mov 0x8(%ebp),%edx
801067ba: 8b 52 30 mov 0x30(%edx),%edx
801067bd: 89 44 24 10 mov %eax,0x10(%esp)
801067c1: 89 5c 24 0c mov %ebx,0xc(%esp)
801067c5: 89 4c 24 08 mov %ecx,0x8(%esp)
801067c9: 89 54 24 04 mov %edx,0x4(%esp)
801067cd: c7 04 24 f0 88 10 80 movl $0x801088f0,(%esp)
801067d4: e8 c7 9b ff ff call 801003a0 <cprintf>
tf->trapno, cpu->id, tf->eip, rcr2());
panic("trap");
801067d9: c7 04 24 22 89 10 80 movl $0x80108922,(%esp)
801067e0: e8 55 9d ff ff call 8010053a <panic>
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801067e5: e8 d8 fc ff ff call 801064c2 <rcr2>
801067ea: 89 c2 mov %eax,%edx
801067ec: 8b 45 08 mov 0x8(%ebp),%eax
801067ef: 8b 78 38 mov 0x38(%eax),%edi
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
801067f2: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801067f8: 0f b6 00 movzbl (%eax),%eax
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpu->id, tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801067fb: 0f b6 f0 movzbl %al,%esi
801067fe: 8b 45 08 mov 0x8(%ebp),%eax
80106801: 8b 58 34 mov 0x34(%eax),%ebx
80106804: 8b 45 08 mov 0x8(%ebp),%eax
80106807: 8b 48 30 mov 0x30(%eax),%ecx
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
8010680a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106810: 83 c0 6c add $0x6c,%eax
80106813: 89 45 e4 mov %eax,-0x1c(%ebp)
80106816: 65 a1 04 00 00 00 mov %gs:0x4,%eax
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpu->id, tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
8010681c: 8b 40 10 mov 0x10(%eax),%eax
8010681f: 89 54 24 1c mov %edx,0x1c(%esp)
80106823: 89 7c 24 18 mov %edi,0x18(%esp)
80106827: 89 74 24 14 mov %esi,0x14(%esp)
8010682b: 89 5c 24 10 mov %ebx,0x10(%esp)
8010682f: 89 4c 24 0c mov %ecx,0xc(%esp)
80106833: 8b 75 e4 mov -0x1c(%ebp),%esi
80106836: 89 74 24 08 mov %esi,0x8(%esp)
8010683a: 89 44 24 04 mov %eax,0x4(%esp)
8010683e: c7 04 24 28 89 10 80 movl $0x80108928,(%esp)
80106845: e8 56 9b ff ff call 801003a0 <cprintf>
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
rcr2());
proc->killed = 1;
8010684a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106850: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
80106857: eb 01 jmp 8010685a <trap+0x1f7>
ideintr();
lapiceoi();
break;
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
80106859: 90 nop
}
// 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(proc && proc->killed && (tf->cs&3) == DPL_USER)
8010685a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106860: 85 c0 test %eax,%eax
80106862: 74 24 je 80106888 <trap+0x225>
80106864: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010686a: 8b 40 24 mov 0x24(%eax),%eax
8010686d: 85 c0 test %eax,%eax
8010686f: 74 17 je 80106888 <trap+0x225>
80106871: 8b 45 08 mov 0x8(%ebp),%eax
80106874: 0f b7 40 3c movzwl 0x3c(%eax),%eax
80106878: 0f b7 c0 movzwl %ax,%eax
8010687b: 83 e0 03 and $0x3,%eax
8010687e: 83 f8 03 cmp $0x3,%eax
80106881: 75 05 jne 80106888 <trap+0x225>
exit();
80106883: e8 c2 de ff ff call 8010474a <exit>
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
80106888: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010688e: 85 c0 test %eax,%eax
80106890: 74 1e je 801068b0 <trap+0x24d>
80106892: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106898: 8b 40 0c mov 0xc(%eax),%eax
8010689b: 83 f8 04 cmp $0x4,%eax
8010689e: 75 10 jne 801068b0 <trap+0x24d>
801068a0: 8b 45 08 mov 0x8(%ebp),%eax
801068a3: 8b 40 30 mov 0x30(%eax),%eax
801068a6: 83 f8 20 cmp $0x20,%eax
801068a9: 75 05 jne 801068b0 <trap+0x24d>
yield();
801068ab: e8 15 e2 ff ff call 80104ac5 <yield>
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
801068b0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801068b6: 85 c0 test %eax,%eax
801068b8: 74 24 je 801068de <trap+0x27b>
801068ba: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801068c0: 8b 40 24 mov 0x24(%eax),%eax
801068c3: 85 c0 test %eax,%eax
801068c5: 74 17 je 801068de <trap+0x27b>
801068c7: 8b 45 08 mov 0x8(%ebp),%eax
801068ca: 0f b7 40 3c movzwl 0x3c(%eax),%eax
801068ce: 0f b7 c0 movzwl %ax,%eax
801068d1: 83 e0 03 and $0x3,%eax
801068d4: 83 f8 03 cmp $0x3,%eax
801068d7: 75 05 jne 801068de <trap+0x27b>
exit();
801068d9: e8 6c de ff ff call 8010474a <exit>
}
801068de: 83 c4 3c add $0x3c,%esp
801068e1: 5b pop %ebx
801068e2: 5e pop %esi
801068e3: 5f pop %edi
801068e4: 5d pop %ebp
801068e5: c3 ret
801068e6 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
801068e6: 55 push %ebp
801068e7: 89 e5 mov %esp,%ebp
801068e9: 83 ec 14 sub $0x14,%esp
801068ec: 8b 45 08 mov 0x8(%ebp),%eax
801068ef: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801068f3: 0f b7 45 ec movzwl -0x14(%ebp),%eax
801068f7: 89 c2 mov %eax,%edx
801068f9: ec in (%dx),%al
801068fa: 88 45 ff mov %al,-0x1(%ebp)
return data;
801068fd: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
80106901: c9 leave
80106902: c3 ret
80106903 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80106903: 55 push %ebp
80106904: 89 e5 mov %esp,%ebp
80106906: 83 ec 08 sub $0x8,%esp
80106909: 8b 55 08 mov 0x8(%ebp),%edx
8010690c: 8b 45 0c mov 0xc(%ebp),%eax
8010690f: 66 89 55 fc mov %dx,-0x4(%ebp)
80106913: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80106916: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
8010691a: 0f b7 55 fc movzwl -0x4(%ebp),%edx
8010691e: ee out %al,(%dx)
}
8010691f: c9 leave
80106920: c3 ret
80106921 <uartinit>:
static int uart; // is there a uart?
void
uartinit(void)
{
80106921: 55 push %ebp
80106922: 89 e5 mov %esp,%ebp
80106924: 83 ec 28 sub $0x28,%esp
char *p;
// Turn off the FIFO
outb(COM1+2, 0);
80106927: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010692e: 00
8010692f: c7 04 24 fa 03 00 00 movl $0x3fa,(%esp)
80106936: e8 c8 ff ff ff call 80106903 <outb>
// 9600 baud, 8 data bits, 1 stop bit, parity off.
outb(COM1+3, 0x80); // Unlock divisor
8010693b: c7 44 24 04 80 00 00 movl $0x80,0x4(%esp)
80106942: 00
80106943: c7 04 24 fb 03 00 00 movl $0x3fb,(%esp)
8010694a: e8 b4 ff ff ff call 80106903 <outb>
outb(COM1+0, 115200/9600);
8010694f: c7 44 24 04 0c 00 00 movl $0xc,0x4(%esp)
80106956: 00
80106957: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
8010695e: e8 a0 ff ff ff call 80106903 <outb>
outb(COM1+1, 0);
80106963: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010696a: 00
8010696b: c7 04 24 f9 03 00 00 movl $0x3f9,(%esp)
80106972: e8 8c ff ff ff call 80106903 <outb>
outb(COM1+3, 0x03); // Lock divisor, 8 data bits.
80106977: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
8010697e: 00
8010697f: c7 04 24 fb 03 00 00 movl $0x3fb,(%esp)
80106986: e8 78 ff ff ff call 80106903 <outb>
outb(COM1+4, 0);
8010698b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80106992: 00
80106993: c7 04 24 fc 03 00 00 movl $0x3fc,(%esp)
8010699a: e8 64 ff ff ff call 80106903 <outb>
outb(COM1+1, 0x01); // Enable receive interrupts.
8010699f: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
801069a6: 00
801069a7: c7 04 24 f9 03 00 00 movl $0x3f9,(%esp)
801069ae: e8 50 ff ff ff call 80106903 <outb>
// If status is 0xFF, no serial port.
if(inb(COM1+5) == 0xFF)
801069b3: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp)
801069ba: e8 27 ff ff ff call 801068e6 <inb>
801069bf: 3c ff cmp $0xff,%al
801069c1: 75 02 jne 801069c5 <uartinit+0xa4>
return;
801069c3: eb 6a jmp 80106a2f <uartinit+0x10e>
uart = 1;
801069c5: c7 05 ac b6 10 80 01 movl $0x1,0x8010b6ac
801069cc: 00 00 00
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb(COM1+2);
801069cf: c7 04 24 fa 03 00 00 movl $0x3fa,(%esp)
801069d6: e8 0b ff ff ff call 801068e6 <inb>
inb(COM1+0);
801069db: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
801069e2: e8 ff fe ff ff call 801068e6 <inb>
picenable(IRQ_COM1);
801069e7: c7 04 24 04 00 00 00 movl $0x4,(%esp)
801069ee: e8 c4 d3 ff ff call 80103db7 <picenable>
ioapicenable(IRQ_COM1, 0);
801069f3: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801069fa: 00
801069fb: c7 04 24 04 00 00 00 movl $0x4,(%esp)
80106a02: e8 71 bf ff ff call 80102978 <ioapicenable>
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80106a07: c7 45 f4 ec 89 10 80 movl $0x801089ec,-0xc(%ebp)
80106a0e: eb 15 jmp 80106a25 <uartinit+0x104>
uartputc(*p);
80106a10: 8b 45 f4 mov -0xc(%ebp),%eax
80106a13: 0f b6 00 movzbl (%eax),%eax
80106a16: 0f be c0 movsbl %al,%eax
80106a19: 89 04 24 mov %eax,(%esp)
80106a1c: e8 10 00 00 00 call 80106a31 <uartputc>
inb(COM1+0);
picenable(IRQ_COM1);
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80106a21: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80106a25: 8b 45 f4 mov -0xc(%ebp),%eax
80106a28: 0f b6 00 movzbl (%eax),%eax
80106a2b: 84 c0 test %al,%al
80106a2d: 75 e1 jne 80106a10 <uartinit+0xef>
uartputc(*p);
}
80106a2f: c9 leave
80106a30: c3 ret
80106a31 <uartputc>:
void
uartputc(int c)
{
80106a31: 55 push %ebp
80106a32: 89 e5 mov %esp,%ebp
80106a34: 83 ec 28 sub $0x28,%esp
int i;
if(!uart)
80106a37: a1 ac b6 10 80 mov 0x8010b6ac,%eax
80106a3c: 85 c0 test %eax,%eax
80106a3e: 75 02 jne 80106a42 <uartputc+0x11>
return;
80106a40: eb 4b jmp 80106a8d <uartputc+0x5c>
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80106a42: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80106a49: eb 10 jmp 80106a5b <uartputc+0x2a>
microdelay(10);
80106a4b: c7 04 24 0a 00 00 00 movl $0xa,(%esp)
80106a52: e8 b9 c4 ff ff call 80102f10 <microdelay>
{
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80106a57: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80106a5b: 83 7d f4 7f cmpl $0x7f,-0xc(%ebp)
80106a5f: 7f 16 jg 80106a77 <uartputc+0x46>
80106a61: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp)
80106a68: e8 79 fe ff ff call 801068e6 <inb>
80106a6d: 0f b6 c0 movzbl %al,%eax
80106a70: 83 e0 20 and $0x20,%eax
80106a73: 85 c0 test %eax,%eax
80106a75: 74 d4 je 80106a4b <uartputc+0x1a>
microdelay(10);
outb(COM1+0, c);
80106a77: 8b 45 08 mov 0x8(%ebp),%eax
80106a7a: 0f b6 c0 movzbl %al,%eax
80106a7d: 89 44 24 04 mov %eax,0x4(%esp)
80106a81: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
80106a88: e8 76 fe ff ff call 80106903 <outb>
}
80106a8d: c9 leave
80106a8e: c3 ret
80106a8f <uartgetc>:
static int
uartgetc(void)
{
80106a8f: 55 push %ebp
80106a90: 89 e5 mov %esp,%ebp
80106a92: 83 ec 04 sub $0x4,%esp
if(!uart)
80106a95: a1 ac b6 10 80 mov 0x8010b6ac,%eax
80106a9a: 85 c0 test %eax,%eax
80106a9c: 75 07 jne 80106aa5 <uartgetc+0x16>
return -1;
80106a9e: b8 ff ff ff ff mov $0xffffffff,%eax
80106aa3: eb 2c jmp 80106ad1 <uartgetc+0x42>
if(!(inb(COM1+5) & 0x01))
80106aa5: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp)
80106aac: e8 35 fe ff ff call 801068e6 <inb>
80106ab1: 0f b6 c0 movzbl %al,%eax
80106ab4: 83 e0 01 and $0x1,%eax
80106ab7: 85 c0 test %eax,%eax
80106ab9: 75 07 jne 80106ac2 <uartgetc+0x33>
return -1;
80106abb: b8 ff ff ff ff mov $0xffffffff,%eax
80106ac0: eb 0f jmp 80106ad1 <uartgetc+0x42>
return inb(COM1+0);
80106ac2: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
80106ac9: e8 18 fe ff ff call 801068e6 <inb>
80106ace: 0f b6 c0 movzbl %al,%eax
}
80106ad1: c9 leave
80106ad2: c3 ret
80106ad3 <uartintr>:
void
uartintr(void)
{
80106ad3: 55 push %ebp
80106ad4: 89 e5 mov %esp,%ebp
80106ad6: 83 ec 18 sub $0x18,%esp
consoleintr(uartgetc);
80106ad9: c7 04 24 8f 6a 10 80 movl $0x80106a8f,(%esp)
80106ae0: e8 c8 9c ff ff call 801007ad <consoleintr>
}
80106ae5: c9 leave
80106ae6: c3 ret
80106ae7 <vector0>:
# generated by vectors.pl - do not edit
# handlers
.globl alltraps
.globl vector0
vector0:
pushl $0
80106ae7: 6a 00 push $0x0
pushl $0
80106ae9: 6a 00 push $0x0
jmp alltraps
80106aeb: e9 7e f9 ff ff jmp 8010646e <alltraps>
80106af0 <vector1>:
.globl vector1
vector1:
pushl $0
80106af0: 6a 00 push $0x0
pushl $1
80106af2: 6a 01 push $0x1
jmp alltraps
80106af4: e9 75 f9 ff ff jmp 8010646e <alltraps>
80106af9 <vector2>:
.globl vector2
vector2:
pushl $0
80106af9: 6a 00 push $0x0
pushl $2
80106afb: 6a 02 push $0x2
jmp alltraps
80106afd: e9 6c f9 ff ff jmp 8010646e <alltraps>
80106b02 <vector3>:
.globl vector3
vector3:
pushl $0
80106b02: 6a 00 push $0x0
pushl $3
80106b04: 6a 03 push $0x3
jmp alltraps
80106b06: e9 63 f9 ff ff jmp 8010646e <alltraps>
80106b0b <vector4>:
.globl vector4
vector4:
pushl $0
80106b0b: 6a 00 push $0x0
pushl $4
80106b0d: 6a 04 push $0x4
jmp alltraps
80106b0f: e9 5a f9 ff ff jmp 8010646e <alltraps>
80106b14 <vector5>:
.globl vector5
vector5:
pushl $0
80106b14: 6a 00 push $0x0
pushl $5
80106b16: 6a 05 push $0x5
jmp alltraps
80106b18: e9 51 f9 ff ff jmp 8010646e <alltraps>
80106b1d <vector6>:
.globl vector6
vector6:
pushl $0
80106b1d: 6a 00 push $0x0
pushl $6
80106b1f: 6a 06 push $0x6
jmp alltraps
80106b21: e9 48 f9 ff ff jmp 8010646e <alltraps>
80106b26 <vector7>:
.globl vector7
vector7:
pushl $0
80106b26: 6a 00 push $0x0
pushl $7
80106b28: 6a 07 push $0x7
jmp alltraps
80106b2a: e9 3f f9 ff ff jmp 8010646e <alltraps>
80106b2f <vector8>:
.globl vector8
vector8:
pushl $8
80106b2f: 6a 08 push $0x8
jmp alltraps
80106b31: e9 38 f9 ff ff jmp 8010646e <alltraps>
80106b36 <vector9>:
.globl vector9
vector9:
pushl $0
80106b36: 6a 00 push $0x0
pushl $9
80106b38: 6a 09 push $0x9
jmp alltraps
80106b3a: e9 2f f9 ff ff jmp 8010646e <alltraps>
80106b3f <vector10>:
.globl vector10
vector10:
pushl $10
80106b3f: 6a 0a push $0xa
jmp alltraps
80106b41: e9 28 f9 ff ff jmp 8010646e <alltraps>
80106b46 <vector11>:
.globl vector11
vector11:
pushl $11
80106b46: 6a 0b push $0xb
jmp alltraps
80106b48: e9 21 f9 ff ff jmp 8010646e <alltraps>
80106b4d <vector12>:
.globl vector12
vector12:
pushl $12
80106b4d: 6a 0c push $0xc
jmp alltraps
80106b4f: e9 1a f9 ff ff jmp 8010646e <alltraps>
80106b54 <vector13>:
.globl vector13
vector13:
pushl $13
80106b54: 6a 0d push $0xd
jmp alltraps
80106b56: e9 13 f9 ff ff jmp 8010646e <alltraps>
80106b5b <vector14>:
.globl vector14
vector14:
pushl $14
80106b5b: 6a 0e push $0xe
jmp alltraps
80106b5d: e9 0c f9 ff ff jmp 8010646e <alltraps>
80106b62 <vector15>:
.globl vector15
vector15:
pushl $0
80106b62: 6a 00 push $0x0
pushl $15
80106b64: 6a 0f push $0xf
jmp alltraps
80106b66: e9 03 f9 ff ff jmp 8010646e <alltraps>
80106b6b <vector16>:
.globl vector16
vector16:
pushl $0
80106b6b: 6a 00 push $0x0
pushl $16
80106b6d: 6a 10 push $0x10
jmp alltraps
80106b6f: e9 fa f8 ff ff jmp 8010646e <alltraps>
80106b74 <vector17>:
.globl vector17
vector17:
pushl $17
80106b74: 6a 11 push $0x11
jmp alltraps
80106b76: e9 f3 f8 ff ff jmp 8010646e <alltraps>
80106b7b <vector18>:
.globl vector18
vector18:
pushl $0
80106b7b: 6a 00 push $0x0
pushl $18
80106b7d: 6a 12 push $0x12
jmp alltraps
80106b7f: e9 ea f8 ff ff jmp 8010646e <alltraps>
80106b84 <vector19>:
.globl vector19
vector19:
pushl $0
80106b84: 6a 00 push $0x0
pushl $19
80106b86: 6a 13 push $0x13
jmp alltraps
80106b88: e9 e1 f8 ff ff jmp 8010646e <alltraps>
80106b8d <vector20>:
.globl vector20
vector20:
pushl $0
80106b8d: 6a 00 push $0x0
pushl $20
80106b8f: 6a 14 push $0x14
jmp alltraps
80106b91: e9 d8 f8 ff ff jmp 8010646e <alltraps>
80106b96 <vector21>:
.globl vector21
vector21:
pushl $0
80106b96: 6a 00 push $0x0
pushl $21
80106b98: 6a 15 push $0x15
jmp alltraps
80106b9a: e9 cf f8 ff ff jmp 8010646e <alltraps>
80106b9f <vector22>:
.globl vector22
vector22:
pushl $0
80106b9f: 6a 00 push $0x0
pushl $22
80106ba1: 6a 16 push $0x16
jmp alltraps
80106ba3: e9 c6 f8 ff ff jmp 8010646e <alltraps>
80106ba8 <vector23>:
.globl vector23
vector23:
pushl $0
80106ba8: 6a 00 push $0x0
pushl $23
80106baa: 6a 17 push $0x17
jmp alltraps
80106bac: e9 bd f8 ff ff jmp 8010646e <alltraps>
80106bb1 <vector24>:
.globl vector24
vector24:
pushl $0
80106bb1: 6a 00 push $0x0
pushl $24
80106bb3: 6a 18 push $0x18
jmp alltraps
80106bb5: e9 b4 f8 ff ff jmp 8010646e <alltraps>
80106bba <vector25>:
.globl vector25
vector25:
pushl $0
80106bba: 6a 00 push $0x0
pushl $25
80106bbc: 6a 19 push $0x19
jmp alltraps
80106bbe: e9 ab f8 ff ff jmp 8010646e <alltraps>
80106bc3 <vector26>:
.globl vector26
vector26:
pushl $0
80106bc3: 6a 00 push $0x0
pushl $26
80106bc5: 6a 1a push $0x1a
jmp alltraps
80106bc7: e9 a2 f8 ff ff jmp 8010646e <alltraps>
80106bcc <vector27>:
.globl vector27
vector27:
pushl $0
80106bcc: 6a 00 push $0x0
pushl $27
80106bce: 6a 1b push $0x1b
jmp alltraps
80106bd0: e9 99 f8 ff ff jmp 8010646e <alltraps>
80106bd5 <vector28>:
.globl vector28
vector28:
pushl $0
80106bd5: 6a 00 push $0x0
pushl $28
80106bd7: 6a 1c push $0x1c
jmp alltraps
80106bd9: e9 90 f8 ff ff jmp 8010646e <alltraps>
80106bde <vector29>:
.globl vector29
vector29:
pushl $0
80106bde: 6a 00 push $0x0
pushl $29
80106be0: 6a 1d push $0x1d
jmp alltraps
80106be2: e9 87 f8 ff ff jmp 8010646e <alltraps>
80106be7 <vector30>:
.globl vector30
vector30:
pushl $0
80106be7: 6a 00 push $0x0
pushl $30
80106be9: 6a 1e push $0x1e
jmp alltraps
80106beb: e9 7e f8 ff ff jmp 8010646e <alltraps>
80106bf0 <vector31>:
.globl vector31
vector31:
pushl $0
80106bf0: 6a 00 push $0x0
pushl $31
80106bf2: 6a 1f push $0x1f
jmp alltraps
80106bf4: e9 75 f8 ff ff jmp 8010646e <alltraps>
80106bf9 <vector32>:
.globl vector32
vector32:
pushl $0
80106bf9: 6a 00 push $0x0
pushl $32
80106bfb: 6a 20 push $0x20
jmp alltraps
80106bfd: e9 6c f8 ff ff jmp 8010646e <alltraps>
80106c02 <vector33>:
.globl vector33
vector33:
pushl $0
80106c02: 6a 00 push $0x0
pushl $33
80106c04: 6a 21 push $0x21
jmp alltraps
80106c06: e9 63 f8 ff ff jmp 8010646e <alltraps>
80106c0b <vector34>:
.globl vector34
vector34:
pushl $0
80106c0b: 6a 00 push $0x0
pushl $34
80106c0d: 6a 22 push $0x22
jmp alltraps
80106c0f: e9 5a f8 ff ff jmp 8010646e <alltraps>
80106c14 <vector35>:
.globl vector35
vector35:
pushl $0
80106c14: 6a 00 push $0x0
pushl $35
80106c16: 6a 23 push $0x23
jmp alltraps
80106c18: e9 51 f8 ff ff jmp 8010646e <alltraps>
80106c1d <vector36>:
.globl vector36
vector36:
pushl $0
80106c1d: 6a 00 push $0x0
pushl $36
80106c1f: 6a 24 push $0x24
jmp alltraps
80106c21: e9 48 f8 ff ff jmp 8010646e <alltraps>
80106c26 <vector37>:
.globl vector37
vector37:
pushl $0
80106c26: 6a 00 push $0x0
pushl $37
80106c28: 6a 25 push $0x25
jmp alltraps
80106c2a: e9 3f f8 ff ff jmp 8010646e <alltraps>
80106c2f <vector38>:
.globl vector38
vector38:
pushl $0
80106c2f: 6a 00 push $0x0
pushl $38
80106c31: 6a 26 push $0x26
jmp alltraps
80106c33: e9 36 f8 ff ff jmp 8010646e <alltraps>
80106c38 <vector39>:
.globl vector39
vector39:
pushl $0
80106c38: 6a 00 push $0x0
pushl $39
80106c3a: 6a 27 push $0x27
jmp alltraps
80106c3c: e9 2d f8 ff ff jmp 8010646e <alltraps>
80106c41 <vector40>:
.globl vector40
vector40:
pushl $0
80106c41: 6a 00 push $0x0
pushl $40
80106c43: 6a 28 push $0x28
jmp alltraps
80106c45: e9 24 f8 ff ff jmp 8010646e <alltraps>
80106c4a <vector41>:
.globl vector41
vector41:
pushl $0
80106c4a: 6a 00 push $0x0
pushl $41
80106c4c: 6a 29 push $0x29
jmp alltraps
80106c4e: e9 1b f8 ff ff jmp 8010646e <alltraps>
80106c53 <vector42>:
.globl vector42
vector42:
pushl $0
80106c53: 6a 00 push $0x0
pushl $42
80106c55: 6a 2a push $0x2a
jmp alltraps
80106c57: e9 12 f8 ff ff jmp 8010646e <alltraps>
80106c5c <vector43>:
.globl vector43
vector43:
pushl $0
80106c5c: 6a 00 push $0x0
pushl $43
80106c5e: 6a 2b push $0x2b
jmp alltraps
80106c60: e9 09 f8 ff ff jmp 8010646e <alltraps>
80106c65 <vector44>:
.globl vector44
vector44:
pushl $0
80106c65: 6a 00 push $0x0
pushl $44
80106c67: 6a 2c push $0x2c
jmp alltraps
80106c69: e9 00 f8 ff ff jmp 8010646e <alltraps>
80106c6e <vector45>:
.globl vector45
vector45:
pushl $0
80106c6e: 6a 00 push $0x0
pushl $45
80106c70: 6a 2d push $0x2d
jmp alltraps
80106c72: e9 f7 f7 ff ff jmp 8010646e <alltraps>
80106c77 <vector46>:
.globl vector46
vector46:
pushl $0
80106c77: 6a 00 push $0x0
pushl $46
80106c79: 6a 2e push $0x2e
jmp alltraps
80106c7b: e9 ee f7 ff ff jmp 8010646e <alltraps>
80106c80 <vector47>:
.globl vector47
vector47:
pushl $0
80106c80: 6a 00 push $0x0
pushl $47
80106c82: 6a 2f push $0x2f
jmp alltraps
80106c84: e9 e5 f7 ff ff jmp 8010646e <alltraps>
80106c89 <vector48>:
.globl vector48
vector48:
pushl $0
80106c89: 6a 00 push $0x0
pushl $48
80106c8b: 6a 30 push $0x30
jmp alltraps
80106c8d: e9 dc f7 ff ff jmp 8010646e <alltraps>
80106c92 <vector49>:
.globl vector49
vector49:
pushl $0
80106c92: 6a 00 push $0x0
pushl $49
80106c94: 6a 31 push $0x31
jmp alltraps
80106c96: e9 d3 f7 ff ff jmp 8010646e <alltraps>
80106c9b <vector50>:
.globl vector50
vector50:
pushl $0
80106c9b: 6a 00 push $0x0
pushl $50
80106c9d: 6a 32 push $0x32
jmp alltraps
80106c9f: e9 ca f7 ff ff jmp 8010646e <alltraps>
80106ca4 <vector51>:
.globl vector51
vector51:
pushl $0
80106ca4: 6a 00 push $0x0
pushl $51
80106ca6: 6a 33 push $0x33
jmp alltraps
80106ca8: e9 c1 f7 ff ff jmp 8010646e <alltraps>
80106cad <vector52>:
.globl vector52
vector52:
pushl $0
80106cad: 6a 00 push $0x0
pushl $52
80106caf: 6a 34 push $0x34
jmp alltraps
80106cb1: e9 b8 f7 ff ff jmp 8010646e <alltraps>
80106cb6 <vector53>:
.globl vector53
vector53:
pushl $0
80106cb6: 6a 00 push $0x0
pushl $53
80106cb8: 6a 35 push $0x35
jmp alltraps
80106cba: e9 af f7 ff ff jmp 8010646e <alltraps>
80106cbf <vector54>:
.globl vector54
vector54:
pushl $0
80106cbf: 6a 00 push $0x0
pushl $54
80106cc1: 6a 36 push $0x36
jmp alltraps
80106cc3: e9 a6 f7 ff ff jmp 8010646e <alltraps>
80106cc8 <vector55>:
.globl vector55
vector55:
pushl $0
80106cc8: 6a 00 push $0x0
pushl $55
80106cca: 6a 37 push $0x37
jmp alltraps
80106ccc: e9 9d f7 ff ff jmp 8010646e <alltraps>
80106cd1 <vector56>:
.globl vector56
vector56:
pushl $0
80106cd1: 6a 00 push $0x0
pushl $56
80106cd3: 6a 38 push $0x38
jmp alltraps
80106cd5: e9 94 f7 ff ff jmp 8010646e <alltraps>
80106cda <vector57>:
.globl vector57
vector57:
pushl $0
80106cda: 6a 00 push $0x0
pushl $57
80106cdc: 6a 39 push $0x39
jmp alltraps
80106cde: e9 8b f7 ff ff jmp 8010646e <alltraps>
80106ce3 <vector58>:
.globl vector58
vector58:
pushl $0
80106ce3: 6a 00 push $0x0
pushl $58
80106ce5: 6a 3a push $0x3a
jmp alltraps
80106ce7: e9 82 f7 ff ff jmp 8010646e <alltraps>
80106cec <vector59>:
.globl vector59
vector59:
pushl $0
80106cec: 6a 00 push $0x0
pushl $59
80106cee: 6a 3b push $0x3b
jmp alltraps
80106cf0: e9 79 f7 ff ff jmp 8010646e <alltraps>
80106cf5 <vector60>:
.globl vector60
vector60:
pushl $0
80106cf5: 6a 00 push $0x0
pushl $60
80106cf7: 6a 3c push $0x3c
jmp alltraps
80106cf9: e9 70 f7 ff ff jmp 8010646e <alltraps>
80106cfe <vector61>:
.globl vector61
vector61:
pushl $0
80106cfe: 6a 00 push $0x0
pushl $61
80106d00: 6a 3d push $0x3d
jmp alltraps
80106d02: e9 67 f7 ff ff jmp 8010646e <alltraps>
80106d07 <vector62>:
.globl vector62
vector62:
pushl $0
80106d07: 6a 00 push $0x0
pushl $62
80106d09: 6a 3e push $0x3e
jmp alltraps
80106d0b: e9 5e f7 ff ff jmp 8010646e <alltraps>
80106d10 <vector63>:
.globl vector63
vector63:
pushl $0
80106d10: 6a 00 push $0x0
pushl $63
80106d12: 6a 3f push $0x3f
jmp alltraps
80106d14: e9 55 f7 ff ff jmp 8010646e <alltraps>
80106d19 <vector64>:
.globl vector64
vector64:
pushl $0
80106d19: 6a 00 push $0x0
pushl $64
80106d1b: 6a 40 push $0x40
jmp alltraps
80106d1d: e9 4c f7 ff ff jmp 8010646e <alltraps>
80106d22 <vector65>:
.globl vector65
vector65:
pushl $0
80106d22: 6a 00 push $0x0
pushl $65
80106d24: 6a 41 push $0x41
jmp alltraps
80106d26: e9 43 f7 ff ff jmp 8010646e <alltraps>
80106d2b <vector66>:
.globl vector66
vector66:
pushl $0
80106d2b: 6a 00 push $0x0
pushl $66
80106d2d: 6a 42 push $0x42
jmp alltraps
80106d2f: e9 3a f7 ff ff jmp 8010646e <alltraps>
80106d34 <vector67>:
.globl vector67
vector67:
pushl $0
80106d34: 6a 00 push $0x0
pushl $67
80106d36: 6a 43 push $0x43
jmp alltraps
80106d38: e9 31 f7 ff ff jmp 8010646e <alltraps>
80106d3d <vector68>:
.globl vector68
vector68:
pushl $0
80106d3d: 6a 00 push $0x0
pushl $68
80106d3f: 6a 44 push $0x44
jmp alltraps
80106d41: e9 28 f7 ff ff jmp 8010646e <alltraps>
80106d46 <vector69>:
.globl vector69
vector69:
pushl $0
80106d46: 6a 00 push $0x0
pushl $69
80106d48: 6a 45 push $0x45
jmp alltraps
80106d4a: e9 1f f7 ff ff jmp 8010646e <alltraps>
80106d4f <vector70>:
.globl vector70
vector70:
pushl $0
80106d4f: 6a 00 push $0x0
pushl $70
80106d51: 6a 46 push $0x46
jmp alltraps
80106d53: e9 16 f7 ff ff jmp 8010646e <alltraps>
80106d58 <vector71>:
.globl vector71
vector71:
pushl $0
80106d58: 6a 00 push $0x0
pushl $71
80106d5a: 6a 47 push $0x47
jmp alltraps
80106d5c: e9 0d f7 ff ff jmp 8010646e <alltraps>
80106d61 <vector72>:
.globl vector72
vector72:
pushl $0
80106d61: 6a 00 push $0x0
pushl $72
80106d63: 6a 48 push $0x48
jmp alltraps
80106d65: e9 04 f7 ff ff jmp 8010646e <alltraps>
80106d6a <vector73>:
.globl vector73
vector73:
pushl $0
80106d6a: 6a 00 push $0x0
pushl $73
80106d6c: 6a 49 push $0x49
jmp alltraps
80106d6e: e9 fb f6 ff ff jmp 8010646e <alltraps>
80106d73 <vector74>:
.globl vector74
vector74:
pushl $0
80106d73: 6a 00 push $0x0
pushl $74
80106d75: 6a 4a push $0x4a
jmp alltraps
80106d77: e9 f2 f6 ff ff jmp 8010646e <alltraps>
80106d7c <vector75>:
.globl vector75
vector75:
pushl $0
80106d7c: 6a 00 push $0x0
pushl $75
80106d7e: 6a 4b push $0x4b
jmp alltraps
80106d80: e9 e9 f6 ff ff jmp 8010646e <alltraps>
80106d85 <vector76>:
.globl vector76
vector76:
pushl $0
80106d85: 6a 00 push $0x0
pushl $76
80106d87: 6a 4c push $0x4c
jmp alltraps
80106d89: e9 e0 f6 ff ff jmp 8010646e <alltraps>
80106d8e <vector77>:
.globl vector77
vector77:
pushl $0
80106d8e: 6a 00 push $0x0
pushl $77
80106d90: 6a 4d push $0x4d
jmp alltraps
80106d92: e9 d7 f6 ff ff jmp 8010646e <alltraps>
80106d97 <vector78>:
.globl vector78
vector78:
pushl $0
80106d97: 6a 00 push $0x0
pushl $78
80106d99: 6a 4e push $0x4e
jmp alltraps
80106d9b: e9 ce f6 ff ff jmp 8010646e <alltraps>
80106da0 <vector79>:
.globl vector79
vector79:
pushl $0
80106da0: 6a 00 push $0x0
pushl $79
80106da2: 6a 4f push $0x4f
jmp alltraps
80106da4: e9 c5 f6 ff ff jmp 8010646e <alltraps>
80106da9 <vector80>:
.globl vector80
vector80:
pushl $0
80106da9: 6a 00 push $0x0
pushl $80
80106dab: 6a 50 push $0x50
jmp alltraps
80106dad: e9 bc f6 ff ff jmp 8010646e <alltraps>
80106db2 <vector81>:
.globl vector81
vector81:
pushl $0
80106db2: 6a 00 push $0x0
pushl $81
80106db4: 6a 51 push $0x51
jmp alltraps
80106db6: e9 b3 f6 ff ff jmp 8010646e <alltraps>
80106dbb <vector82>:
.globl vector82
vector82:
pushl $0
80106dbb: 6a 00 push $0x0
pushl $82
80106dbd: 6a 52 push $0x52
jmp alltraps
80106dbf: e9 aa f6 ff ff jmp 8010646e <alltraps>
80106dc4 <vector83>:
.globl vector83
vector83:
pushl $0
80106dc4: 6a 00 push $0x0
pushl $83
80106dc6: 6a 53 push $0x53
jmp alltraps
80106dc8: e9 a1 f6 ff ff jmp 8010646e <alltraps>
80106dcd <vector84>:
.globl vector84
vector84:
pushl $0
80106dcd: 6a 00 push $0x0
pushl $84
80106dcf: 6a 54 push $0x54
jmp alltraps
80106dd1: e9 98 f6 ff ff jmp 8010646e <alltraps>
80106dd6 <vector85>:
.globl vector85
vector85:
pushl $0
80106dd6: 6a 00 push $0x0
pushl $85
80106dd8: 6a 55 push $0x55
jmp alltraps
80106dda: e9 8f f6 ff ff jmp 8010646e <alltraps>
80106ddf <vector86>:
.globl vector86
vector86:
pushl $0
80106ddf: 6a 00 push $0x0
pushl $86
80106de1: 6a 56 push $0x56
jmp alltraps
80106de3: e9 86 f6 ff ff jmp 8010646e <alltraps>
80106de8 <vector87>:
.globl vector87
vector87:
pushl $0
80106de8: 6a 00 push $0x0
pushl $87
80106dea: 6a 57 push $0x57
jmp alltraps
80106dec: e9 7d f6 ff ff jmp 8010646e <alltraps>
80106df1 <vector88>:
.globl vector88
vector88:
pushl $0
80106df1: 6a 00 push $0x0
pushl $88
80106df3: 6a 58 push $0x58
jmp alltraps
80106df5: e9 74 f6 ff ff jmp 8010646e <alltraps>
80106dfa <vector89>:
.globl vector89
vector89:
pushl $0
80106dfa: 6a 00 push $0x0
pushl $89
80106dfc: 6a 59 push $0x59
jmp alltraps
80106dfe: e9 6b f6 ff ff jmp 8010646e <alltraps>
80106e03 <vector90>:
.globl vector90
vector90:
pushl $0
80106e03: 6a 00 push $0x0
pushl $90
80106e05: 6a 5a push $0x5a
jmp alltraps
80106e07: e9 62 f6 ff ff jmp 8010646e <alltraps>
80106e0c <vector91>:
.globl vector91
vector91:
pushl $0
80106e0c: 6a 00 push $0x0
pushl $91
80106e0e: 6a 5b push $0x5b
jmp alltraps
80106e10: e9 59 f6 ff ff jmp 8010646e <alltraps>
80106e15 <vector92>:
.globl vector92
vector92:
pushl $0
80106e15: 6a 00 push $0x0
pushl $92
80106e17: 6a 5c push $0x5c
jmp alltraps
80106e19: e9 50 f6 ff ff jmp 8010646e <alltraps>
80106e1e <vector93>:
.globl vector93
vector93:
pushl $0
80106e1e: 6a 00 push $0x0
pushl $93
80106e20: 6a 5d push $0x5d
jmp alltraps
80106e22: e9 47 f6 ff ff jmp 8010646e <alltraps>
80106e27 <vector94>:
.globl vector94
vector94:
pushl $0
80106e27: 6a 00 push $0x0
pushl $94
80106e29: 6a 5e push $0x5e
jmp alltraps
80106e2b: e9 3e f6 ff ff jmp 8010646e <alltraps>
80106e30 <vector95>:
.globl vector95
vector95:
pushl $0
80106e30: 6a 00 push $0x0
pushl $95
80106e32: 6a 5f push $0x5f
jmp alltraps
80106e34: e9 35 f6 ff ff jmp 8010646e <alltraps>
80106e39 <vector96>:
.globl vector96
vector96:
pushl $0
80106e39: 6a 00 push $0x0
pushl $96
80106e3b: 6a 60 push $0x60
jmp alltraps
80106e3d: e9 2c f6 ff ff jmp 8010646e <alltraps>
80106e42 <vector97>:
.globl vector97
vector97:
pushl $0
80106e42: 6a 00 push $0x0
pushl $97
80106e44: 6a 61 push $0x61
jmp alltraps
80106e46: e9 23 f6 ff ff jmp 8010646e <alltraps>
80106e4b <vector98>:
.globl vector98
vector98:
pushl $0
80106e4b: 6a 00 push $0x0
pushl $98
80106e4d: 6a 62 push $0x62
jmp alltraps
80106e4f: e9 1a f6 ff ff jmp 8010646e <alltraps>
80106e54 <vector99>:
.globl vector99
vector99:
pushl $0
80106e54: 6a 00 push $0x0
pushl $99
80106e56: 6a 63 push $0x63
jmp alltraps
80106e58: e9 11 f6 ff ff jmp 8010646e <alltraps>
80106e5d <vector100>:
.globl vector100
vector100:
pushl $0
80106e5d: 6a 00 push $0x0
pushl $100
80106e5f: 6a 64 push $0x64
jmp alltraps
80106e61: e9 08 f6 ff ff jmp 8010646e <alltraps>
80106e66 <vector101>:
.globl vector101
vector101:
pushl $0
80106e66: 6a 00 push $0x0
pushl $101
80106e68: 6a 65 push $0x65
jmp alltraps
80106e6a: e9 ff f5 ff ff jmp 8010646e <alltraps>
80106e6f <vector102>:
.globl vector102
vector102:
pushl $0
80106e6f: 6a 00 push $0x0
pushl $102
80106e71: 6a 66 push $0x66
jmp alltraps
80106e73: e9 f6 f5 ff ff jmp 8010646e <alltraps>
80106e78 <vector103>:
.globl vector103
vector103:
pushl $0
80106e78: 6a 00 push $0x0
pushl $103
80106e7a: 6a 67 push $0x67
jmp alltraps
80106e7c: e9 ed f5 ff ff jmp 8010646e <alltraps>
80106e81 <vector104>:
.globl vector104
vector104:
pushl $0
80106e81: 6a 00 push $0x0
pushl $104
80106e83: 6a 68 push $0x68
jmp alltraps
80106e85: e9 e4 f5 ff ff jmp 8010646e <alltraps>
80106e8a <vector105>:
.globl vector105
vector105:
pushl $0
80106e8a: 6a 00 push $0x0
pushl $105
80106e8c: 6a 69 push $0x69
jmp alltraps
80106e8e: e9 db f5 ff ff jmp 8010646e <alltraps>
80106e93 <vector106>:
.globl vector106
vector106:
pushl $0
80106e93: 6a 00 push $0x0
pushl $106
80106e95: 6a 6a push $0x6a
jmp alltraps
80106e97: e9 d2 f5 ff ff jmp 8010646e <alltraps>
80106e9c <vector107>:
.globl vector107
vector107:
pushl $0
80106e9c: 6a 00 push $0x0
pushl $107
80106e9e: 6a 6b push $0x6b
jmp alltraps
80106ea0: e9 c9 f5 ff ff jmp 8010646e <alltraps>
80106ea5 <vector108>:
.globl vector108
vector108:
pushl $0
80106ea5: 6a 00 push $0x0
pushl $108
80106ea7: 6a 6c push $0x6c
jmp alltraps
80106ea9: e9 c0 f5 ff ff jmp 8010646e <alltraps>
80106eae <vector109>:
.globl vector109
vector109:
pushl $0
80106eae: 6a 00 push $0x0
pushl $109
80106eb0: 6a 6d push $0x6d
jmp alltraps
80106eb2: e9 b7 f5 ff ff jmp 8010646e <alltraps>
80106eb7 <vector110>:
.globl vector110
vector110:
pushl $0
80106eb7: 6a 00 push $0x0
pushl $110
80106eb9: 6a 6e push $0x6e
jmp alltraps
80106ebb: e9 ae f5 ff ff jmp 8010646e <alltraps>
80106ec0 <vector111>:
.globl vector111
vector111:
pushl $0
80106ec0: 6a 00 push $0x0
pushl $111
80106ec2: 6a 6f push $0x6f
jmp alltraps
80106ec4: e9 a5 f5 ff ff jmp 8010646e <alltraps>
80106ec9 <vector112>:
.globl vector112
vector112:
pushl $0
80106ec9: 6a 00 push $0x0
pushl $112
80106ecb: 6a 70 push $0x70
jmp alltraps
80106ecd: e9 9c f5 ff ff jmp 8010646e <alltraps>
80106ed2 <vector113>:
.globl vector113
vector113:
pushl $0
80106ed2: 6a 00 push $0x0
pushl $113
80106ed4: 6a 71 push $0x71
jmp alltraps
80106ed6: e9 93 f5 ff ff jmp 8010646e <alltraps>
80106edb <vector114>:
.globl vector114
vector114:
pushl $0
80106edb: 6a 00 push $0x0
pushl $114
80106edd: 6a 72 push $0x72
jmp alltraps
80106edf: e9 8a f5 ff ff jmp 8010646e <alltraps>
80106ee4 <vector115>:
.globl vector115
vector115:
pushl $0
80106ee4: 6a 00 push $0x0
pushl $115
80106ee6: 6a 73 push $0x73
jmp alltraps
80106ee8: e9 81 f5 ff ff jmp 8010646e <alltraps>
80106eed <vector116>:
.globl vector116
vector116:
pushl $0
80106eed: 6a 00 push $0x0
pushl $116
80106eef: 6a 74 push $0x74
jmp alltraps
80106ef1: e9 78 f5 ff ff jmp 8010646e <alltraps>
80106ef6 <vector117>:
.globl vector117
vector117:
pushl $0
80106ef6: 6a 00 push $0x0
pushl $117
80106ef8: 6a 75 push $0x75
jmp alltraps
80106efa: e9 6f f5 ff ff jmp 8010646e <alltraps>
80106eff <vector118>:
.globl vector118
vector118:
pushl $0
80106eff: 6a 00 push $0x0
pushl $118
80106f01: 6a 76 push $0x76
jmp alltraps
80106f03: e9 66 f5 ff ff jmp 8010646e <alltraps>
80106f08 <vector119>:
.globl vector119
vector119:
pushl $0
80106f08: 6a 00 push $0x0
pushl $119
80106f0a: 6a 77 push $0x77
jmp alltraps
80106f0c: e9 5d f5 ff ff jmp 8010646e <alltraps>
80106f11 <vector120>:
.globl vector120
vector120:
pushl $0
80106f11: 6a 00 push $0x0
pushl $120
80106f13: 6a 78 push $0x78
jmp alltraps
80106f15: e9 54 f5 ff ff jmp 8010646e <alltraps>
80106f1a <vector121>:
.globl vector121
vector121:
pushl $0
80106f1a: 6a 00 push $0x0
pushl $121
80106f1c: 6a 79 push $0x79
jmp alltraps
80106f1e: e9 4b f5 ff ff jmp 8010646e <alltraps>
80106f23 <vector122>:
.globl vector122
vector122:
pushl $0
80106f23: 6a 00 push $0x0
pushl $122
80106f25: 6a 7a push $0x7a
jmp alltraps
80106f27: e9 42 f5 ff ff jmp 8010646e <alltraps>
80106f2c <vector123>:
.globl vector123
vector123:
pushl $0
80106f2c: 6a 00 push $0x0
pushl $123
80106f2e: 6a 7b push $0x7b
jmp alltraps
80106f30: e9 39 f5 ff ff jmp 8010646e <alltraps>
80106f35 <vector124>:
.globl vector124
vector124:
pushl $0
80106f35: 6a 00 push $0x0
pushl $124
80106f37: 6a 7c push $0x7c
jmp alltraps
80106f39: e9 30 f5 ff ff jmp 8010646e <alltraps>
80106f3e <vector125>:
.globl vector125
vector125:
pushl $0
80106f3e: 6a 00 push $0x0
pushl $125
80106f40: 6a 7d push $0x7d
jmp alltraps
80106f42: e9 27 f5 ff ff jmp 8010646e <alltraps>
80106f47 <vector126>:
.globl vector126
vector126:
pushl $0
80106f47: 6a 00 push $0x0
pushl $126
80106f49: 6a 7e push $0x7e
jmp alltraps
80106f4b: e9 1e f5 ff ff jmp 8010646e <alltraps>
80106f50 <vector127>:
.globl vector127
vector127:
pushl $0
80106f50: 6a 00 push $0x0
pushl $127
80106f52: 6a 7f push $0x7f
jmp alltraps
80106f54: e9 15 f5 ff ff jmp 8010646e <alltraps>
80106f59 <vector128>:
.globl vector128
vector128:
pushl $0
80106f59: 6a 00 push $0x0
pushl $128
80106f5b: 68 80 00 00 00 push $0x80
jmp alltraps
80106f60: e9 09 f5 ff ff jmp 8010646e <alltraps>
80106f65 <vector129>:
.globl vector129
vector129:
pushl $0
80106f65: 6a 00 push $0x0
pushl $129
80106f67: 68 81 00 00 00 push $0x81
jmp alltraps
80106f6c: e9 fd f4 ff ff jmp 8010646e <alltraps>
80106f71 <vector130>:
.globl vector130
vector130:
pushl $0
80106f71: 6a 00 push $0x0
pushl $130
80106f73: 68 82 00 00 00 push $0x82
jmp alltraps
80106f78: e9 f1 f4 ff ff jmp 8010646e <alltraps>
80106f7d <vector131>:
.globl vector131
vector131:
pushl $0
80106f7d: 6a 00 push $0x0
pushl $131
80106f7f: 68 83 00 00 00 push $0x83
jmp alltraps
80106f84: e9 e5 f4 ff ff jmp 8010646e <alltraps>
80106f89 <vector132>:
.globl vector132
vector132:
pushl $0
80106f89: 6a 00 push $0x0
pushl $132
80106f8b: 68 84 00 00 00 push $0x84
jmp alltraps
80106f90: e9 d9 f4 ff ff jmp 8010646e <alltraps>
80106f95 <vector133>:
.globl vector133
vector133:
pushl $0
80106f95: 6a 00 push $0x0
pushl $133
80106f97: 68 85 00 00 00 push $0x85
jmp alltraps
80106f9c: e9 cd f4 ff ff jmp 8010646e <alltraps>
80106fa1 <vector134>:
.globl vector134
vector134:
pushl $0
80106fa1: 6a 00 push $0x0
pushl $134
80106fa3: 68 86 00 00 00 push $0x86
jmp alltraps
80106fa8: e9 c1 f4 ff ff jmp 8010646e <alltraps>
80106fad <vector135>:
.globl vector135
vector135:
pushl $0
80106fad: 6a 00 push $0x0
pushl $135
80106faf: 68 87 00 00 00 push $0x87
jmp alltraps
80106fb4: e9 b5 f4 ff ff jmp 8010646e <alltraps>
80106fb9 <vector136>:
.globl vector136
vector136:
pushl $0
80106fb9: 6a 00 push $0x0
pushl $136
80106fbb: 68 88 00 00 00 push $0x88
jmp alltraps
80106fc0: e9 a9 f4 ff ff jmp 8010646e <alltraps>
80106fc5 <vector137>:
.globl vector137
vector137:
pushl $0
80106fc5: 6a 00 push $0x0
pushl $137
80106fc7: 68 89 00 00 00 push $0x89
jmp alltraps
80106fcc: e9 9d f4 ff ff jmp 8010646e <alltraps>
80106fd1 <vector138>:
.globl vector138
vector138:
pushl $0
80106fd1: 6a 00 push $0x0
pushl $138
80106fd3: 68 8a 00 00 00 push $0x8a
jmp alltraps
80106fd8: e9 91 f4 ff ff jmp 8010646e <alltraps>
80106fdd <vector139>:
.globl vector139
vector139:
pushl $0
80106fdd: 6a 00 push $0x0
pushl $139
80106fdf: 68 8b 00 00 00 push $0x8b
jmp alltraps
80106fe4: e9 85 f4 ff ff jmp 8010646e <alltraps>
80106fe9 <vector140>:
.globl vector140
vector140:
pushl $0
80106fe9: 6a 00 push $0x0
pushl $140
80106feb: 68 8c 00 00 00 push $0x8c
jmp alltraps
80106ff0: e9 79 f4 ff ff jmp 8010646e <alltraps>
80106ff5 <vector141>:
.globl vector141
vector141:
pushl $0
80106ff5: 6a 00 push $0x0
pushl $141
80106ff7: 68 8d 00 00 00 push $0x8d
jmp alltraps
80106ffc: e9 6d f4 ff ff jmp 8010646e <alltraps>
80107001 <vector142>:
.globl vector142
vector142:
pushl $0
80107001: 6a 00 push $0x0
pushl $142
80107003: 68 8e 00 00 00 push $0x8e
jmp alltraps
80107008: e9 61 f4 ff ff jmp 8010646e <alltraps>
8010700d <vector143>:
.globl vector143
vector143:
pushl $0
8010700d: 6a 00 push $0x0
pushl $143
8010700f: 68 8f 00 00 00 push $0x8f
jmp alltraps
80107014: e9 55 f4 ff ff jmp 8010646e <alltraps>
80107019 <vector144>:
.globl vector144
vector144:
pushl $0
80107019: 6a 00 push $0x0
pushl $144
8010701b: 68 90 00 00 00 push $0x90
jmp alltraps
80107020: e9 49 f4 ff ff jmp 8010646e <alltraps>
80107025 <vector145>:
.globl vector145
vector145:
pushl $0
80107025: 6a 00 push $0x0
pushl $145
80107027: 68 91 00 00 00 push $0x91
jmp alltraps
8010702c: e9 3d f4 ff ff jmp 8010646e <alltraps>
80107031 <vector146>:
.globl vector146
vector146:
pushl $0
80107031: 6a 00 push $0x0
pushl $146
80107033: 68 92 00 00 00 push $0x92
jmp alltraps
80107038: e9 31 f4 ff ff jmp 8010646e <alltraps>
8010703d <vector147>:
.globl vector147
vector147:
pushl $0
8010703d: 6a 00 push $0x0
pushl $147
8010703f: 68 93 00 00 00 push $0x93
jmp alltraps
80107044: e9 25 f4 ff ff jmp 8010646e <alltraps>
80107049 <vector148>:
.globl vector148
vector148:
pushl $0
80107049: 6a 00 push $0x0
pushl $148
8010704b: 68 94 00 00 00 push $0x94
jmp alltraps
80107050: e9 19 f4 ff ff jmp 8010646e <alltraps>
80107055 <vector149>:
.globl vector149
vector149:
pushl $0
80107055: 6a 00 push $0x0
pushl $149
80107057: 68 95 00 00 00 push $0x95
jmp alltraps
8010705c: e9 0d f4 ff ff jmp 8010646e <alltraps>
80107061 <vector150>:
.globl vector150
vector150:
pushl $0
80107061: 6a 00 push $0x0
pushl $150
80107063: 68 96 00 00 00 push $0x96
jmp alltraps
80107068: e9 01 f4 ff ff jmp 8010646e <alltraps>
8010706d <vector151>:
.globl vector151
vector151:
pushl $0
8010706d: 6a 00 push $0x0
pushl $151
8010706f: 68 97 00 00 00 push $0x97
jmp alltraps
80107074: e9 f5 f3 ff ff jmp 8010646e <alltraps>
80107079 <vector152>:
.globl vector152
vector152:
pushl $0
80107079: 6a 00 push $0x0
pushl $152
8010707b: 68 98 00 00 00 push $0x98
jmp alltraps
80107080: e9 e9 f3 ff ff jmp 8010646e <alltraps>
80107085 <vector153>:
.globl vector153
vector153:
pushl $0
80107085: 6a 00 push $0x0
pushl $153
80107087: 68 99 00 00 00 push $0x99
jmp alltraps
8010708c: e9 dd f3 ff ff jmp 8010646e <alltraps>
80107091 <vector154>:
.globl vector154
vector154:
pushl $0
80107091: 6a 00 push $0x0
pushl $154
80107093: 68 9a 00 00 00 push $0x9a
jmp alltraps
80107098: e9 d1 f3 ff ff jmp 8010646e <alltraps>
8010709d <vector155>:
.globl vector155
vector155:
pushl $0
8010709d: 6a 00 push $0x0
pushl $155
8010709f: 68 9b 00 00 00 push $0x9b
jmp alltraps
801070a4: e9 c5 f3 ff ff jmp 8010646e <alltraps>
801070a9 <vector156>:
.globl vector156
vector156:
pushl $0
801070a9: 6a 00 push $0x0
pushl $156
801070ab: 68 9c 00 00 00 push $0x9c
jmp alltraps
801070b0: e9 b9 f3 ff ff jmp 8010646e <alltraps>
801070b5 <vector157>:
.globl vector157
vector157:
pushl $0
801070b5: 6a 00 push $0x0
pushl $157
801070b7: 68 9d 00 00 00 push $0x9d
jmp alltraps
801070bc: e9 ad f3 ff ff jmp 8010646e <alltraps>
801070c1 <vector158>:
.globl vector158
vector158:
pushl $0
801070c1: 6a 00 push $0x0
pushl $158
801070c3: 68 9e 00 00 00 push $0x9e
jmp alltraps
801070c8: e9 a1 f3 ff ff jmp 8010646e <alltraps>
801070cd <vector159>:
.globl vector159
vector159:
pushl $0
801070cd: 6a 00 push $0x0
pushl $159
801070cf: 68 9f 00 00 00 push $0x9f
jmp alltraps
801070d4: e9 95 f3 ff ff jmp 8010646e <alltraps>
801070d9 <vector160>:
.globl vector160
vector160:
pushl $0
801070d9: 6a 00 push $0x0
pushl $160
801070db: 68 a0 00 00 00 push $0xa0
jmp alltraps
801070e0: e9 89 f3 ff ff jmp 8010646e <alltraps>
801070e5 <vector161>:
.globl vector161
vector161:
pushl $0
801070e5: 6a 00 push $0x0
pushl $161
801070e7: 68 a1 00 00 00 push $0xa1
jmp alltraps
801070ec: e9 7d f3 ff ff jmp 8010646e <alltraps>
801070f1 <vector162>:
.globl vector162
vector162:
pushl $0
801070f1: 6a 00 push $0x0
pushl $162
801070f3: 68 a2 00 00 00 push $0xa2
jmp alltraps
801070f8: e9 71 f3 ff ff jmp 8010646e <alltraps>
801070fd <vector163>:
.globl vector163
vector163:
pushl $0
801070fd: 6a 00 push $0x0
pushl $163
801070ff: 68 a3 00 00 00 push $0xa3
jmp alltraps
80107104: e9 65 f3 ff ff jmp 8010646e <alltraps>
80107109 <vector164>:
.globl vector164
vector164:
pushl $0
80107109: 6a 00 push $0x0
pushl $164
8010710b: 68 a4 00 00 00 push $0xa4
jmp alltraps
80107110: e9 59 f3 ff ff jmp 8010646e <alltraps>
80107115 <vector165>:
.globl vector165
vector165:
pushl $0
80107115: 6a 00 push $0x0
pushl $165
80107117: 68 a5 00 00 00 push $0xa5
jmp alltraps
8010711c: e9 4d f3 ff ff jmp 8010646e <alltraps>
80107121 <vector166>:
.globl vector166
vector166:
pushl $0
80107121: 6a 00 push $0x0
pushl $166
80107123: 68 a6 00 00 00 push $0xa6
jmp alltraps
80107128: e9 41 f3 ff ff jmp 8010646e <alltraps>
8010712d <vector167>:
.globl vector167
vector167:
pushl $0
8010712d: 6a 00 push $0x0
pushl $167
8010712f: 68 a7 00 00 00 push $0xa7
jmp alltraps
80107134: e9 35 f3 ff ff jmp 8010646e <alltraps>
80107139 <vector168>:
.globl vector168
vector168:
pushl $0
80107139: 6a 00 push $0x0
pushl $168
8010713b: 68 a8 00 00 00 push $0xa8
jmp alltraps
80107140: e9 29 f3 ff ff jmp 8010646e <alltraps>
80107145 <vector169>:
.globl vector169
vector169:
pushl $0
80107145: 6a 00 push $0x0
pushl $169
80107147: 68 a9 00 00 00 push $0xa9
jmp alltraps
8010714c: e9 1d f3 ff ff jmp 8010646e <alltraps>
80107151 <vector170>:
.globl vector170
vector170:
pushl $0
80107151: 6a 00 push $0x0
pushl $170
80107153: 68 aa 00 00 00 push $0xaa
jmp alltraps
80107158: e9 11 f3 ff ff jmp 8010646e <alltraps>
8010715d <vector171>:
.globl vector171
vector171:
pushl $0
8010715d: 6a 00 push $0x0
pushl $171
8010715f: 68 ab 00 00 00 push $0xab
jmp alltraps
80107164: e9 05 f3 ff ff jmp 8010646e <alltraps>
80107169 <vector172>:
.globl vector172
vector172:
pushl $0
80107169: 6a 00 push $0x0
pushl $172
8010716b: 68 ac 00 00 00 push $0xac
jmp alltraps
80107170: e9 f9 f2 ff ff jmp 8010646e <alltraps>
80107175 <vector173>:
.globl vector173
vector173:
pushl $0
80107175: 6a 00 push $0x0
pushl $173
80107177: 68 ad 00 00 00 push $0xad
jmp alltraps
8010717c: e9 ed f2 ff ff jmp 8010646e <alltraps>
80107181 <vector174>:
.globl vector174
vector174:
pushl $0
80107181: 6a 00 push $0x0
pushl $174
80107183: 68 ae 00 00 00 push $0xae
jmp alltraps
80107188: e9 e1 f2 ff ff jmp 8010646e <alltraps>
8010718d <vector175>:
.globl vector175
vector175:
pushl $0
8010718d: 6a 00 push $0x0
pushl $175
8010718f: 68 af 00 00 00 push $0xaf
jmp alltraps
80107194: e9 d5 f2 ff ff jmp 8010646e <alltraps>
80107199 <vector176>:
.globl vector176
vector176:
pushl $0
80107199: 6a 00 push $0x0
pushl $176
8010719b: 68 b0 00 00 00 push $0xb0
jmp alltraps
801071a0: e9 c9 f2 ff ff jmp 8010646e <alltraps>
801071a5 <vector177>:
.globl vector177
vector177:
pushl $0
801071a5: 6a 00 push $0x0
pushl $177
801071a7: 68 b1 00 00 00 push $0xb1
jmp alltraps
801071ac: e9 bd f2 ff ff jmp 8010646e <alltraps>
801071b1 <vector178>:
.globl vector178
vector178:
pushl $0
801071b1: 6a 00 push $0x0
pushl $178
801071b3: 68 b2 00 00 00 push $0xb2
jmp alltraps
801071b8: e9 b1 f2 ff ff jmp 8010646e <alltraps>
801071bd <vector179>:
.globl vector179
vector179:
pushl $0
801071bd: 6a 00 push $0x0
pushl $179
801071bf: 68 b3 00 00 00 push $0xb3
jmp alltraps
801071c4: e9 a5 f2 ff ff jmp 8010646e <alltraps>
801071c9 <vector180>:
.globl vector180
vector180:
pushl $0
801071c9: 6a 00 push $0x0
pushl $180
801071cb: 68 b4 00 00 00 push $0xb4
jmp alltraps
801071d0: e9 99 f2 ff ff jmp 8010646e <alltraps>
801071d5 <vector181>:
.globl vector181
vector181:
pushl $0
801071d5: 6a 00 push $0x0
pushl $181
801071d7: 68 b5 00 00 00 push $0xb5
jmp alltraps
801071dc: e9 8d f2 ff ff jmp 8010646e <alltraps>
801071e1 <vector182>:
.globl vector182
vector182:
pushl $0
801071e1: 6a 00 push $0x0
pushl $182
801071e3: 68 b6 00 00 00 push $0xb6
jmp alltraps
801071e8: e9 81 f2 ff ff jmp 8010646e <alltraps>
801071ed <vector183>:
.globl vector183
vector183:
pushl $0
801071ed: 6a 00 push $0x0
pushl $183
801071ef: 68 b7 00 00 00 push $0xb7
jmp alltraps
801071f4: e9 75 f2 ff ff jmp 8010646e <alltraps>
801071f9 <vector184>:
.globl vector184
vector184:
pushl $0
801071f9: 6a 00 push $0x0
pushl $184
801071fb: 68 b8 00 00 00 push $0xb8
jmp alltraps
80107200: e9 69 f2 ff ff jmp 8010646e <alltraps>
80107205 <vector185>:
.globl vector185
vector185:
pushl $0
80107205: 6a 00 push $0x0
pushl $185
80107207: 68 b9 00 00 00 push $0xb9
jmp alltraps
8010720c: e9 5d f2 ff ff jmp 8010646e <alltraps>
80107211 <vector186>:
.globl vector186
vector186:
pushl $0
80107211: 6a 00 push $0x0
pushl $186
80107213: 68 ba 00 00 00 push $0xba
jmp alltraps
80107218: e9 51 f2 ff ff jmp 8010646e <alltraps>
8010721d <vector187>:
.globl vector187
vector187:
pushl $0
8010721d: 6a 00 push $0x0
pushl $187
8010721f: 68 bb 00 00 00 push $0xbb
jmp alltraps
80107224: e9 45 f2 ff ff jmp 8010646e <alltraps>
80107229 <vector188>:
.globl vector188
vector188:
pushl $0
80107229: 6a 00 push $0x0
pushl $188
8010722b: 68 bc 00 00 00 push $0xbc
jmp alltraps
80107230: e9 39 f2 ff ff jmp 8010646e <alltraps>
80107235 <vector189>:
.globl vector189
vector189:
pushl $0
80107235: 6a 00 push $0x0
pushl $189
80107237: 68 bd 00 00 00 push $0xbd
jmp alltraps
8010723c: e9 2d f2 ff ff jmp 8010646e <alltraps>
80107241 <vector190>:
.globl vector190
vector190:
pushl $0
80107241: 6a 00 push $0x0
pushl $190
80107243: 68 be 00 00 00 push $0xbe
jmp alltraps
80107248: e9 21 f2 ff ff jmp 8010646e <alltraps>
8010724d <vector191>:
.globl vector191
vector191:
pushl $0
8010724d: 6a 00 push $0x0
pushl $191
8010724f: 68 bf 00 00 00 push $0xbf
jmp alltraps
80107254: e9 15 f2 ff ff jmp 8010646e <alltraps>
80107259 <vector192>:
.globl vector192
vector192:
pushl $0
80107259: 6a 00 push $0x0
pushl $192
8010725b: 68 c0 00 00 00 push $0xc0
jmp alltraps
80107260: e9 09 f2 ff ff jmp 8010646e <alltraps>
80107265 <vector193>:
.globl vector193
vector193:
pushl $0
80107265: 6a 00 push $0x0
pushl $193
80107267: 68 c1 00 00 00 push $0xc1
jmp alltraps
8010726c: e9 fd f1 ff ff jmp 8010646e <alltraps>
80107271 <vector194>:
.globl vector194
vector194:
pushl $0
80107271: 6a 00 push $0x0
pushl $194
80107273: 68 c2 00 00 00 push $0xc2
jmp alltraps
80107278: e9 f1 f1 ff ff jmp 8010646e <alltraps>
8010727d <vector195>:
.globl vector195
vector195:
pushl $0
8010727d: 6a 00 push $0x0
pushl $195
8010727f: 68 c3 00 00 00 push $0xc3
jmp alltraps
80107284: e9 e5 f1 ff ff jmp 8010646e <alltraps>
80107289 <vector196>:
.globl vector196
vector196:
pushl $0
80107289: 6a 00 push $0x0
pushl $196
8010728b: 68 c4 00 00 00 push $0xc4
jmp alltraps
80107290: e9 d9 f1 ff ff jmp 8010646e <alltraps>
80107295 <vector197>:
.globl vector197
vector197:
pushl $0
80107295: 6a 00 push $0x0
pushl $197
80107297: 68 c5 00 00 00 push $0xc5
jmp alltraps
8010729c: e9 cd f1 ff ff jmp 8010646e <alltraps>
801072a1 <vector198>:
.globl vector198
vector198:
pushl $0
801072a1: 6a 00 push $0x0
pushl $198
801072a3: 68 c6 00 00 00 push $0xc6
jmp alltraps
801072a8: e9 c1 f1 ff ff jmp 8010646e <alltraps>
801072ad <vector199>:
.globl vector199
vector199:
pushl $0
801072ad: 6a 00 push $0x0
pushl $199
801072af: 68 c7 00 00 00 push $0xc7
jmp alltraps
801072b4: e9 b5 f1 ff ff jmp 8010646e <alltraps>
801072b9 <vector200>:
.globl vector200
vector200:
pushl $0
801072b9: 6a 00 push $0x0
pushl $200
801072bb: 68 c8 00 00 00 push $0xc8
jmp alltraps
801072c0: e9 a9 f1 ff ff jmp 8010646e <alltraps>
801072c5 <vector201>:
.globl vector201
vector201:
pushl $0
801072c5: 6a 00 push $0x0
pushl $201
801072c7: 68 c9 00 00 00 push $0xc9
jmp alltraps
801072cc: e9 9d f1 ff ff jmp 8010646e <alltraps>
801072d1 <vector202>:
.globl vector202
vector202:
pushl $0
801072d1: 6a 00 push $0x0
pushl $202
801072d3: 68 ca 00 00 00 push $0xca
jmp alltraps
801072d8: e9 91 f1 ff ff jmp 8010646e <alltraps>
801072dd <vector203>:
.globl vector203
vector203:
pushl $0
801072dd: 6a 00 push $0x0
pushl $203
801072df: 68 cb 00 00 00 push $0xcb
jmp alltraps
801072e4: e9 85 f1 ff ff jmp 8010646e <alltraps>
801072e9 <vector204>:
.globl vector204
vector204:
pushl $0
801072e9: 6a 00 push $0x0
pushl $204
801072eb: 68 cc 00 00 00 push $0xcc
jmp alltraps
801072f0: e9 79 f1 ff ff jmp 8010646e <alltraps>
801072f5 <vector205>:
.globl vector205
vector205:
pushl $0
801072f5: 6a 00 push $0x0
pushl $205
801072f7: 68 cd 00 00 00 push $0xcd
jmp alltraps
801072fc: e9 6d f1 ff ff jmp 8010646e <alltraps>
80107301 <vector206>:
.globl vector206
vector206:
pushl $0
80107301: 6a 00 push $0x0
pushl $206
80107303: 68 ce 00 00 00 push $0xce
jmp alltraps
80107308: e9 61 f1 ff ff jmp 8010646e <alltraps>
8010730d <vector207>:
.globl vector207
vector207:
pushl $0
8010730d: 6a 00 push $0x0
pushl $207
8010730f: 68 cf 00 00 00 push $0xcf
jmp alltraps
80107314: e9 55 f1 ff ff jmp 8010646e <alltraps>
80107319 <vector208>:
.globl vector208
vector208:
pushl $0
80107319: 6a 00 push $0x0
pushl $208
8010731b: 68 d0 00 00 00 push $0xd0
jmp alltraps
80107320: e9 49 f1 ff ff jmp 8010646e <alltraps>
80107325 <vector209>:
.globl vector209
vector209:
pushl $0
80107325: 6a 00 push $0x0
pushl $209
80107327: 68 d1 00 00 00 push $0xd1
jmp alltraps
8010732c: e9 3d f1 ff ff jmp 8010646e <alltraps>
80107331 <vector210>:
.globl vector210
vector210:
pushl $0
80107331: 6a 00 push $0x0
pushl $210
80107333: 68 d2 00 00 00 push $0xd2
jmp alltraps
80107338: e9 31 f1 ff ff jmp 8010646e <alltraps>
8010733d <vector211>:
.globl vector211
vector211:
pushl $0
8010733d: 6a 00 push $0x0
pushl $211
8010733f: 68 d3 00 00 00 push $0xd3
jmp alltraps
80107344: e9 25 f1 ff ff jmp 8010646e <alltraps>
80107349 <vector212>:
.globl vector212
vector212:
pushl $0
80107349: 6a 00 push $0x0
pushl $212
8010734b: 68 d4 00 00 00 push $0xd4
jmp alltraps
80107350: e9 19 f1 ff ff jmp 8010646e <alltraps>
80107355 <vector213>:
.globl vector213
vector213:
pushl $0
80107355: 6a 00 push $0x0
pushl $213
80107357: 68 d5 00 00 00 push $0xd5
jmp alltraps
8010735c: e9 0d f1 ff ff jmp 8010646e <alltraps>
80107361 <vector214>:
.globl vector214
vector214:
pushl $0
80107361: 6a 00 push $0x0
pushl $214
80107363: 68 d6 00 00 00 push $0xd6
jmp alltraps
80107368: e9 01 f1 ff ff jmp 8010646e <alltraps>
8010736d <vector215>:
.globl vector215
vector215:
pushl $0
8010736d: 6a 00 push $0x0
pushl $215
8010736f: 68 d7 00 00 00 push $0xd7
jmp alltraps
80107374: e9 f5 f0 ff ff jmp 8010646e <alltraps>
80107379 <vector216>:
.globl vector216
vector216:
pushl $0
80107379: 6a 00 push $0x0
pushl $216
8010737b: 68 d8 00 00 00 push $0xd8
jmp alltraps
80107380: e9 e9 f0 ff ff jmp 8010646e <alltraps>
80107385 <vector217>:
.globl vector217
vector217:
pushl $0
80107385: 6a 00 push $0x0
pushl $217
80107387: 68 d9 00 00 00 push $0xd9
jmp alltraps
8010738c: e9 dd f0 ff ff jmp 8010646e <alltraps>
80107391 <vector218>:
.globl vector218
vector218:
pushl $0
80107391: 6a 00 push $0x0
pushl $218
80107393: 68 da 00 00 00 push $0xda
jmp alltraps
80107398: e9 d1 f0 ff ff jmp 8010646e <alltraps>
8010739d <vector219>:
.globl vector219
vector219:
pushl $0
8010739d: 6a 00 push $0x0
pushl $219
8010739f: 68 db 00 00 00 push $0xdb
jmp alltraps
801073a4: e9 c5 f0 ff ff jmp 8010646e <alltraps>
801073a9 <vector220>:
.globl vector220
vector220:
pushl $0
801073a9: 6a 00 push $0x0
pushl $220
801073ab: 68 dc 00 00 00 push $0xdc
jmp alltraps
801073b0: e9 b9 f0 ff ff jmp 8010646e <alltraps>
801073b5 <vector221>:
.globl vector221
vector221:
pushl $0
801073b5: 6a 00 push $0x0
pushl $221
801073b7: 68 dd 00 00 00 push $0xdd
jmp alltraps
801073bc: e9 ad f0 ff ff jmp 8010646e <alltraps>
801073c1 <vector222>:
.globl vector222
vector222:
pushl $0
801073c1: 6a 00 push $0x0
pushl $222
801073c3: 68 de 00 00 00 push $0xde
jmp alltraps
801073c8: e9 a1 f0 ff ff jmp 8010646e <alltraps>
801073cd <vector223>:
.globl vector223
vector223:
pushl $0
801073cd: 6a 00 push $0x0
pushl $223
801073cf: 68 df 00 00 00 push $0xdf
jmp alltraps
801073d4: e9 95 f0 ff ff jmp 8010646e <alltraps>
801073d9 <vector224>:
.globl vector224
vector224:
pushl $0
801073d9: 6a 00 push $0x0
pushl $224
801073db: 68 e0 00 00 00 push $0xe0
jmp alltraps
801073e0: e9 89 f0 ff ff jmp 8010646e <alltraps>
801073e5 <vector225>:
.globl vector225
vector225:
pushl $0
801073e5: 6a 00 push $0x0
pushl $225
801073e7: 68 e1 00 00 00 push $0xe1
jmp alltraps
801073ec: e9 7d f0 ff ff jmp 8010646e <alltraps>
801073f1 <vector226>:
.globl vector226
vector226:
pushl $0
801073f1: 6a 00 push $0x0
pushl $226
801073f3: 68 e2 00 00 00 push $0xe2
jmp alltraps
801073f8: e9 71 f0 ff ff jmp 8010646e <alltraps>
801073fd <vector227>:
.globl vector227
vector227:
pushl $0
801073fd: 6a 00 push $0x0
pushl $227
801073ff: 68 e3 00 00 00 push $0xe3
jmp alltraps
80107404: e9 65 f0 ff ff jmp 8010646e <alltraps>
80107409 <vector228>:
.globl vector228
vector228:
pushl $0
80107409: 6a 00 push $0x0
pushl $228
8010740b: 68 e4 00 00 00 push $0xe4
jmp alltraps
80107410: e9 59 f0 ff ff jmp 8010646e <alltraps>
80107415 <vector229>:
.globl vector229
vector229:
pushl $0
80107415: 6a 00 push $0x0
pushl $229
80107417: 68 e5 00 00 00 push $0xe5
jmp alltraps
8010741c: e9 4d f0 ff ff jmp 8010646e <alltraps>
80107421 <vector230>:
.globl vector230
vector230:
pushl $0
80107421: 6a 00 push $0x0
pushl $230
80107423: 68 e6 00 00 00 push $0xe6
jmp alltraps
80107428: e9 41 f0 ff ff jmp 8010646e <alltraps>
8010742d <vector231>:
.globl vector231
vector231:
pushl $0
8010742d: 6a 00 push $0x0
pushl $231
8010742f: 68 e7 00 00 00 push $0xe7
jmp alltraps
80107434: e9 35 f0 ff ff jmp 8010646e <alltraps>
80107439 <vector232>:
.globl vector232
vector232:
pushl $0
80107439: 6a 00 push $0x0
pushl $232
8010743b: 68 e8 00 00 00 push $0xe8
jmp alltraps
80107440: e9 29 f0 ff ff jmp 8010646e <alltraps>
80107445 <vector233>:
.globl vector233
vector233:
pushl $0
80107445: 6a 00 push $0x0
pushl $233
80107447: 68 e9 00 00 00 push $0xe9
jmp alltraps
8010744c: e9 1d f0 ff ff jmp 8010646e <alltraps>
80107451 <vector234>:
.globl vector234
vector234:
pushl $0
80107451: 6a 00 push $0x0
pushl $234
80107453: 68 ea 00 00 00 push $0xea
jmp alltraps
80107458: e9 11 f0 ff ff jmp 8010646e <alltraps>
8010745d <vector235>:
.globl vector235
vector235:
pushl $0
8010745d: 6a 00 push $0x0
pushl $235
8010745f: 68 eb 00 00 00 push $0xeb
jmp alltraps
80107464: e9 05 f0 ff ff jmp 8010646e <alltraps>
80107469 <vector236>:
.globl vector236
vector236:
pushl $0
80107469: 6a 00 push $0x0
pushl $236
8010746b: 68 ec 00 00 00 push $0xec
jmp alltraps
80107470: e9 f9 ef ff ff jmp 8010646e <alltraps>
80107475 <vector237>:
.globl vector237
vector237:
pushl $0
80107475: 6a 00 push $0x0
pushl $237
80107477: 68 ed 00 00 00 push $0xed
jmp alltraps
8010747c: e9 ed ef ff ff jmp 8010646e <alltraps>
80107481 <vector238>:
.globl vector238
vector238:
pushl $0
80107481: 6a 00 push $0x0
pushl $238
80107483: 68 ee 00 00 00 push $0xee
jmp alltraps
80107488: e9 e1 ef ff ff jmp 8010646e <alltraps>
8010748d <vector239>:
.globl vector239
vector239:
pushl $0
8010748d: 6a 00 push $0x0
pushl $239
8010748f: 68 ef 00 00 00 push $0xef
jmp alltraps
80107494: e9 d5 ef ff ff jmp 8010646e <alltraps>
80107499 <vector240>:
.globl vector240
vector240:
pushl $0
80107499: 6a 00 push $0x0
pushl $240
8010749b: 68 f0 00 00 00 push $0xf0
jmp alltraps
801074a0: e9 c9 ef ff ff jmp 8010646e <alltraps>
801074a5 <vector241>:
.globl vector241
vector241:
pushl $0
801074a5: 6a 00 push $0x0
pushl $241
801074a7: 68 f1 00 00 00 push $0xf1
jmp alltraps
801074ac: e9 bd ef ff ff jmp 8010646e <alltraps>
801074b1 <vector242>:
.globl vector242
vector242:
pushl $0
801074b1: 6a 00 push $0x0
pushl $242
801074b3: 68 f2 00 00 00 push $0xf2
jmp alltraps
801074b8: e9 b1 ef ff ff jmp 8010646e <alltraps>
801074bd <vector243>:
.globl vector243
vector243:
pushl $0
801074bd: 6a 00 push $0x0
pushl $243
801074bf: 68 f3 00 00 00 push $0xf3
jmp alltraps
801074c4: e9 a5 ef ff ff jmp 8010646e <alltraps>
801074c9 <vector244>:
.globl vector244
vector244:
pushl $0
801074c9: 6a 00 push $0x0
pushl $244
801074cb: 68 f4 00 00 00 push $0xf4
jmp alltraps
801074d0: e9 99 ef ff ff jmp 8010646e <alltraps>
801074d5 <vector245>:
.globl vector245
vector245:
pushl $0
801074d5: 6a 00 push $0x0
pushl $245
801074d7: 68 f5 00 00 00 push $0xf5
jmp alltraps
801074dc: e9 8d ef ff ff jmp 8010646e <alltraps>
801074e1 <vector246>:
.globl vector246
vector246:
pushl $0
801074e1: 6a 00 push $0x0
pushl $246
801074e3: 68 f6 00 00 00 push $0xf6
jmp alltraps
801074e8: e9 81 ef ff ff jmp 8010646e <alltraps>
801074ed <vector247>:
.globl vector247
vector247:
pushl $0
801074ed: 6a 00 push $0x0
pushl $247
801074ef: 68 f7 00 00 00 push $0xf7
jmp alltraps
801074f4: e9 75 ef ff ff jmp 8010646e <alltraps>
801074f9 <vector248>:
.globl vector248
vector248:
pushl $0
801074f9: 6a 00 push $0x0
pushl $248
801074fb: 68 f8 00 00 00 push $0xf8
jmp alltraps
80107500: e9 69 ef ff ff jmp 8010646e <alltraps>
80107505 <vector249>:
.globl vector249
vector249:
pushl $0
80107505: 6a 00 push $0x0
pushl $249
80107507: 68 f9 00 00 00 push $0xf9
jmp alltraps
8010750c: e9 5d ef ff ff jmp 8010646e <alltraps>
80107511 <vector250>:
.globl vector250
vector250:
pushl $0
80107511: 6a 00 push $0x0
pushl $250
80107513: 68 fa 00 00 00 push $0xfa
jmp alltraps
80107518: e9 51 ef ff ff jmp 8010646e <alltraps>
8010751d <vector251>:
.globl vector251
vector251:
pushl $0
8010751d: 6a 00 push $0x0
pushl $251
8010751f: 68 fb 00 00 00 push $0xfb
jmp alltraps
80107524: e9 45 ef ff ff jmp 8010646e <alltraps>
80107529 <vector252>:
.globl vector252
vector252:
pushl $0
80107529: 6a 00 push $0x0
pushl $252
8010752b: 68 fc 00 00 00 push $0xfc
jmp alltraps
80107530: e9 39 ef ff ff jmp 8010646e <alltraps>
80107535 <vector253>:
.globl vector253
vector253:
pushl $0
80107535: 6a 00 push $0x0
pushl $253
80107537: 68 fd 00 00 00 push $0xfd
jmp alltraps
8010753c: e9 2d ef ff ff jmp 8010646e <alltraps>
80107541 <vector254>:
.globl vector254
vector254:
pushl $0
80107541: 6a 00 push $0x0
pushl $254
80107543: 68 fe 00 00 00 push $0xfe
jmp alltraps
80107548: e9 21 ef ff ff jmp 8010646e <alltraps>
8010754d <vector255>:
.globl vector255
vector255:
pushl $0
8010754d: 6a 00 push $0x0
pushl $255
8010754f: 68 ff 00 00 00 push $0xff
jmp alltraps
80107554: e9 15 ef ff ff jmp 8010646e <alltraps>
80107559 <lgdt>:
struct segdesc;
static inline void
lgdt(struct segdesc *p, int size)
{
80107559: 55 push %ebp
8010755a: 89 e5 mov %esp,%ebp
8010755c: 83 ec 10 sub $0x10,%esp
volatile ushort pd[3];
pd[0] = size-1;
8010755f: 8b 45 0c mov 0xc(%ebp),%eax
80107562: 83 e8 01 sub $0x1,%eax
80107565: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
80107569: 8b 45 08 mov 0x8(%ebp),%eax
8010756c: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
80107570: 8b 45 08 mov 0x8(%ebp),%eax
80107573: c1 e8 10 shr $0x10,%eax
80107576: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lgdt (%0)" : : "r" (pd));
8010757a: 8d 45 fa lea -0x6(%ebp),%eax
8010757d: 0f 01 10 lgdtl (%eax)
}
80107580: c9 leave
80107581: c3 ret
80107582 <ltr>:
asm volatile("lidt (%0)" : : "r" (pd));
}
static inline void
ltr(ushort sel)
{
80107582: 55 push %ebp
80107583: 89 e5 mov %esp,%ebp
80107585: 83 ec 04 sub $0x4,%esp
80107588: 8b 45 08 mov 0x8(%ebp),%eax
8010758b: 66 89 45 fc mov %ax,-0x4(%ebp)
asm volatile("ltr %0" : : "r" (sel));
8010758f: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80107593: 0f 00 d8 ltr %ax
}
80107596: c9 leave
80107597: c3 ret
80107598 <loadgs>:
return eflags;
}
static inline void
loadgs(ushort v)
{
80107598: 55 push %ebp
80107599: 89 e5 mov %esp,%ebp
8010759b: 83 ec 04 sub $0x4,%esp
8010759e: 8b 45 08 mov 0x8(%ebp),%eax
801075a1: 66 89 45 fc mov %ax,-0x4(%ebp)
asm volatile("movw %0, %%gs" : : "r" (v));
801075a5: 0f b7 45 fc movzwl -0x4(%ebp),%eax
801075a9: 8e e8 mov %eax,%gs
}
801075ab: c9 leave
801075ac: c3 ret
801075ad <lcr3>:
return val;
}
static inline void
lcr3(uint val)
{
801075ad: 55 push %ebp
801075ae: 89 e5 mov %esp,%ebp
asm volatile("movl %0,%%cr3" : : "r" (val));
801075b0: 8b 45 08 mov 0x8(%ebp),%eax
801075b3: 0f 22 d8 mov %eax,%cr3
}
801075b6: 5d pop %ebp
801075b7: c3 ret
801075b8 <v2p>:
#define KERNBASE 0x80000000 // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
#ifndef __ASSEMBLER__
static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; }
801075b8: 55 push %ebp
801075b9: 89 e5 mov %esp,%ebp
801075bb: 8b 45 08 mov 0x8(%ebp),%eax
801075be: 05 00 00 00 80 add $0x80000000,%eax
801075c3: 5d pop %ebp
801075c4: c3 ret
801075c5 <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
801075c5: 55 push %ebp
801075c6: 89 e5 mov %esp,%ebp
801075c8: 8b 45 08 mov 0x8(%ebp),%eax
801075cb: 05 00 00 00 80 add $0x80000000,%eax
801075d0: 5d pop %ebp
801075d1: c3 ret
801075d2 <seginit>:
// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
801075d2: 55 push %ebp
801075d3: 89 e5 mov %esp,%ebp
801075d5: 53 push %ebx
801075d6: 83 ec 24 sub $0x24,%esp
// Map "logical" addresses to virtual addresses using identity map.
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
801075d9: e8 b5 b8 ff ff call 80102e93 <cpunum>
801075de: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
801075e4: 05 c0 23 11 80 add $0x801123c0,%eax
801075e9: 89 45 f4 mov %eax,-0xc(%ebp)
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
801075ec: 8b 45 f4 mov -0xc(%ebp),%eax
801075ef: 66 c7 40 78 ff ff movw $0xffff,0x78(%eax)
801075f5: 8b 45 f4 mov -0xc(%ebp),%eax
801075f8: 66 c7 40 7a 00 00 movw $0x0,0x7a(%eax)
801075fe: 8b 45 f4 mov -0xc(%ebp),%eax
80107601: c6 40 7c 00 movb $0x0,0x7c(%eax)
80107605: 8b 45 f4 mov -0xc(%ebp),%eax
80107608: 0f b6 50 7d movzbl 0x7d(%eax),%edx
8010760c: 83 e2 f0 and $0xfffffff0,%edx
8010760f: 83 ca 0a or $0xa,%edx
80107612: 88 50 7d mov %dl,0x7d(%eax)
80107615: 8b 45 f4 mov -0xc(%ebp),%eax
80107618: 0f b6 50 7d movzbl 0x7d(%eax),%edx
8010761c: 83 ca 10 or $0x10,%edx
8010761f: 88 50 7d mov %dl,0x7d(%eax)
80107622: 8b 45 f4 mov -0xc(%ebp),%eax
80107625: 0f b6 50 7d movzbl 0x7d(%eax),%edx
80107629: 83 e2 9f and $0xffffff9f,%edx
8010762c: 88 50 7d mov %dl,0x7d(%eax)
8010762f: 8b 45 f4 mov -0xc(%ebp),%eax
80107632: 0f b6 50 7d movzbl 0x7d(%eax),%edx
80107636: 83 ca 80 or $0xffffff80,%edx
80107639: 88 50 7d mov %dl,0x7d(%eax)
8010763c: 8b 45 f4 mov -0xc(%ebp),%eax
8010763f: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107643: 83 ca 0f or $0xf,%edx
80107646: 88 50 7e mov %dl,0x7e(%eax)
80107649: 8b 45 f4 mov -0xc(%ebp),%eax
8010764c: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107650: 83 e2 ef and $0xffffffef,%edx
80107653: 88 50 7e mov %dl,0x7e(%eax)
80107656: 8b 45 f4 mov -0xc(%ebp),%eax
80107659: 0f b6 50 7e movzbl 0x7e(%eax),%edx
8010765d: 83 e2 df and $0xffffffdf,%edx
80107660: 88 50 7e mov %dl,0x7e(%eax)
80107663: 8b 45 f4 mov -0xc(%ebp),%eax
80107666: 0f b6 50 7e movzbl 0x7e(%eax),%edx
8010766a: 83 ca 40 or $0x40,%edx
8010766d: 88 50 7e mov %dl,0x7e(%eax)
80107670: 8b 45 f4 mov -0xc(%ebp),%eax
80107673: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107677: 83 ca 80 or $0xffffff80,%edx
8010767a: 88 50 7e mov %dl,0x7e(%eax)
8010767d: 8b 45 f4 mov -0xc(%ebp),%eax
80107680: c6 40 7f 00 movb $0x0,0x7f(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
80107684: 8b 45 f4 mov -0xc(%ebp),%eax
80107687: 66 c7 80 80 00 00 00 movw $0xffff,0x80(%eax)
8010768e: ff ff
80107690: 8b 45 f4 mov -0xc(%ebp),%eax
80107693: 66 c7 80 82 00 00 00 movw $0x0,0x82(%eax)
8010769a: 00 00
8010769c: 8b 45 f4 mov -0xc(%ebp),%eax
8010769f: c6 80 84 00 00 00 00 movb $0x0,0x84(%eax)
801076a6: 8b 45 f4 mov -0xc(%ebp),%eax
801076a9: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
801076b0: 83 e2 f0 and $0xfffffff0,%edx
801076b3: 83 ca 02 or $0x2,%edx
801076b6: 88 90 85 00 00 00 mov %dl,0x85(%eax)
801076bc: 8b 45 f4 mov -0xc(%ebp),%eax
801076bf: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
801076c6: 83 ca 10 or $0x10,%edx
801076c9: 88 90 85 00 00 00 mov %dl,0x85(%eax)
801076cf: 8b 45 f4 mov -0xc(%ebp),%eax
801076d2: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
801076d9: 83 e2 9f and $0xffffff9f,%edx
801076dc: 88 90 85 00 00 00 mov %dl,0x85(%eax)
801076e2: 8b 45 f4 mov -0xc(%ebp),%eax
801076e5: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
801076ec: 83 ca 80 or $0xffffff80,%edx
801076ef: 88 90 85 00 00 00 mov %dl,0x85(%eax)
801076f5: 8b 45 f4 mov -0xc(%ebp),%eax
801076f8: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
801076ff: 83 ca 0f or $0xf,%edx
80107702: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107708: 8b 45 f4 mov -0xc(%ebp),%eax
8010770b: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107712: 83 e2 ef and $0xffffffef,%edx
80107715: 88 90 86 00 00 00 mov %dl,0x86(%eax)
8010771b: 8b 45 f4 mov -0xc(%ebp),%eax
8010771e: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107725: 83 e2 df and $0xffffffdf,%edx
80107728: 88 90 86 00 00 00 mov %dl,0x86(%eax)
8010772e: 8b 45 f4 mov -0xc(%ebp),%eax
80107731: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107738: 83 ca 40 or $0x40,%edx
8010773b: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107741: 8b 45 f4 mov -0xc(%ebp),%eax
80107744: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
8010774b: 83 ca 80 or $0xffffff80,%edx
8010774e: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107754: 8b 45 f4 mov -0xc(%ebp),%eax
80107757: c6 80 87 00 00 00 00 movb $0x0,0x87(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
8010775e: 8b 45 f4 mov -0xc(%ebp),%eax
80107761: 66 c7 80 90 00 00 00 movw $0xffff,0x90(%eax)
80107768: ff ff
8010776a: 8b 45 f4 mov -0xc(%ebp),%eax
8010776d: 66 c7 80 92 00 00 00 movw $0x0,0x92(%eax)
80107774: 00 00
80107776: 8b 45 f4 mov -0xc(%ebp),%eax
80107779: c6 80 94 00 00 00 00 movb $0x0,0x94(%eax)
80107780: 8b 45 f4 mov -0xc(%ebp),%eax
80107783: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
8010778a: 83 e2 f0 and $0xfffffff0,%edx
8010778d: 83 ca 0a or $0xa,%edx
80107790: 88 90 95 00 00 00 mov %dl,0x95(%eax)
80107796: 8b 45 f4 mov -0xc(%ebp),%eax
80107799: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
801077a0: 83 ca 10 or $0x10,%edx
801077a3: 88 90 95 00 00 00 mov %dl,0x95(%eax)
801077a9: 8b 45 f4 mov -0xc(%ebp),%eax
801077ac: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
801077b3: 83 ca 60 or $0x60,%edx
801077b6: 88 90 95 00 00 00 mov %dl,0x95(%eax)
801077bc: 8b 45 f4 mov -0xc(%ebp),%eax
801077bf: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
801077c6: 83 ca 80 or $0xffffff80,%edx
801077c9: 88 90 95 00 00 00 mov %dl,0x95(%eax)
801077cf: 8b 45 f4 mov -0xc(%ebp),%eax
801077d2: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
801077d9: 83 ca 0f or $0xf,%edx
801077dc: 88 90 96 00 00 00 mov %dl,0x96(%eax)
801077e2: 8b 45 f4 mov -0xc(%ebp),%eax
801077e5: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
801077ec: 83 e2 ef and $0xffffffef,%edx
801077ef: 88 90 96 00 00 00 mov %dl,0x96(%eax)
801077f5: 8b 45 f4 mov -0xc(%ebp),%eax
801077f8: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
801077ff: 83 e2 df and $0xffffffdf,%edx
80107802: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107808: 8b 45 f4 mov -0xc(%ebp),%eax
8010780b: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107812: 83 ca 40 or $0x40,%edx
80107815: 88 90 96 00 00 00 mov %dl,0x96(%eax)
8010781b: 8b 45 f4 mov -0xc(%ebp),%eax
8010781e: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107825: 83 ca 80 or $0xffffff80,%edx
80107828: 88 90 96 00 00 00 mov %dl,0x96(%eax)
8010782e: 8b 45 f4 mov -0xc(%ebp),%eax
80107831: c6 80 97 00 00 00 00 movb $0x0,0x97(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80107838: 8b 45 f4 mov -0xc(%ebp),%eax
8010783b: 66 c7 80 98 00 00 00 movw $0xffff,0x98(%eax)
80107842: ff ff
80107844: 8b 45 f4 mov -0xc(%ebp),%eax
80107847: 66 c7 80 9a 00 00 00 movw $0x0,0x9a(%eax)
8010784e: 00 00
80107850: 8b 45 f4 mov -0xc(%ebp),%eax
80107853: c6 80 9c 00 00 00 00 movb $0x0,0x9c(%eax)
8010785a: 8b 45 f4 mov -0xc(%ebp),%eax
8010785d: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
80107864: 83 e2 f0 and $0xfffffff0,%edx
80107867: 83 ca 02 or $0x2,%edx
8010786a: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
80107870: 8b 45 f4 mov -0xc(%ebp),%eax
80107873: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
8010787a: 83 ca 10 or $0x10,%edx
8010787d: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
80107883: 8b 45 f4 mov -0xc(%ebp),%eax
80107886: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
8010788d: 83 ca 60 or $0x60,%edx
80107890: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
80107896: 8b 45 f4 mov -0xc(%ebp),%eax
80107899: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
801078a0: 83 ca 80 or $0xffffff80,%edx
801078a3: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
801078a9: 8b 45 f4 mov -0xc(%ebp),%eax
801078ac: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
801078b3: 83 ca 0f or $0xf,%edx
801078b6: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
801078bc: 8b 45 f4 mov -0xc(%ebp),%eax
801078bf: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
801078c6: 83 e2 ef and $0xffffffef,%edx
801078c9: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
801078cf: 8b 45 f4 mov -0xc(%ebp),%eax
801078d2: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
801078d9: 83 e2 df and $0xffffffdf,%edx
801078dc: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
801078e2: 8b 45 f4 mov -0xc(%ebp),%eax
801078e5: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
801078ec: 83 ca 40 or $0x40,%edx
801078ef: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
801078f5: 8b 45 f4 mov -0xc(%ebp),%eax
801078f8: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
801078ff: 83 ca 80 or $0xffffff80,%edx
80107902: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80107908: 8b 45 f4 mov -0xc(%ebp),%eax
8010790b: c6 80 9f 00 00 00 00 movb $0x0,0x9f(%eax)
// Map cpu, and curproc
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
80107912: 8b 45 f4 mov -0xc(%ebp),%eax
80107915: 05 b4 00 00 00 add $0xb4,%eax
8010791a: 89 c3 mov %eax,%ebx
8010791c: 8b 45 f4 mov -0xc(%ebp),%eax
8010791f: 05 b4 00 00 00 add $0xb4,%eax
80107924: c1 e8 10 shr $0x10,%eax
80107927: 89 c1 mov %eax,%ecx
80107929: 8b 45 f4 mov -0xc(%ebp),%eax
8010792c: 05 b4 00 00 00 add $0xb4,%eax
80107931: c1 e8 18 shr $0x18,%eax
80107934: 89 c2 mov %eax,%edx
80107936: 8b 45 f4 mov -0xc(%ebp),%eax
80107939: 66 c7 80 88 00 00 00 movw $0x0,0x88(%eax)
80107940: 00 00
80107942: 8b 45 f4 mov -0xc(%ebp),%eax
80107945: 66 89 98 8a 00 00 00 mov %bx,0x8a(%eax)
8010794c: 8b 45 f4 mov -0xc(%ebp),%eax
8010794f: 88 88 8c 00 00 00 mov %cl,0x8c(%eax)
80107955: 8b 45 f4 mov -0xc(%ebp),%eax
80107958: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
8010795f: 83 e1 f0 and $0xfffffff0,%ecx
80107962: 83 c9 02 or $0x2,%ecx
80107965: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
8010796b: 8b 45 f4 mov -0xc(%ebp),%eax
8010796e: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
80107975: 83 c9 10 or $0x10,%ecx
80107978: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
8010797e: 8b 45 f4 mov -0xc(%ebp),%eax
80107981: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
80107988: 83 e1 9f and $0xffffff9f,%ecx
8010798b: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
80107991: 8b 45 f4 mov -0xc(%ebp),%eax
80107994: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
8010799b: 83 c9 80 or $0xffffff80,%ecx
8010799e: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
801079a4: 8b 45 f4 mov -0xc(%ebp),%eax
801079a7: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
801079ae: 83 e1 f0 and $0xfffffff0,%ecx
801079b1: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
801079b7: 8b 45 f4 mov -0xc(%ebp),%eax
801079ba: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
801079c1: 83 e1 ef and $0xffffffef,%ecx
801079c4: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
801079ca: 8b 45 f4 mov -0xc(%ebp),%eax
801079cd: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
801079d4: 83 e1 df and $0xffffffdf,%ecx
801079d7: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
801079dd: 8b 45 f4 mov -0xc(%ebp),%eax
801079e0: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
801079e7: 83 c9 40 or $0x40,%ecx
801079ea: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
801079f0: 8b 45 f4 mov -0xc(%ebp),%eax
801079f3: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
801079fa: 83 c9 80 or $0xffffff80,%ecx
801079fd: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
80107a03: 8b 45 f4 mov -0xc(%ebp),%eax
80107a06: 88 90 8f 00 00 00 mov %dl,0x8f(%eax)
lgdt(c->gdt, sizeof(c->gdt));
80107a0c: 8b 45 f4 mov -0xc(%ebp),%eax
80107a0f: 83 c0 70 add $0x70,%eax
80107a12: c7 44 24 04 38 00 00 movl $0x38,0x4(%esp)
80107a19: 00
80107a1a: 89 04 24 mov %eax,(%esp)
80107a1d: e8 37 fb ff ff call 80107559 <lgdt>
loadgs(SEG_KCPU << 3);
80107a22: c7 04 24 18 00 00 00 movl $0x18,(%esp)
80107a29: e8 6a fb ff ff call 80107598 <loadgs>
// Initialize cpu-local storage.
cpu = c;
80107a2e: 8b 45 f4 mov -0xc(%ebp),%eax
80107a31: 65 a3 00 00 00 00 mov %eax,%gs:0x0
proc = 0;
80107a37: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
80107a3e: 00 00 00 00
}
80107a42: 83 c4 24 add $0x24,%esp
80107a45: 5b pop %ebx
80107a46: 5d pop %ebp
80107a47: c3 ret
80107a48 <walkpgdir>:
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va. If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
80107a48: 55 push %ebp
80107a49: 89 e5 mov %esp,%ebp
80107a4b: 83 ec 28 sub $0x28,%esp
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
80107a4e: 8b 45 0c mov 0xc(%ebp),%eax
80107a51: c1 e8 16 shr $0x16,%eax
80107a54: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80107a5b: 8b 45 08 mov 0x8(%ebp),%eax
80107a5e: 01 d0 add %edx,%eax
80107a60: 89 45 f0 mov %eax,-0x10(%ebp)
if(*pde & PTE_P){
80107a63: 8b 45 f0 mov -0x10(%ebp),%eax
80107a66: 8b 00 mov (%eax),%eax
80107a68: 83 e0 01 and $0x1,%eax
80107a6b: 85 c0 test %eax,%eax
80107a6d: 74 17 je 80107a86 <walkpgdir+0x3e>
pgtab = (pte_t*)p2v(PTE_ADDR(*pde));
80107a6f: 8b 45 f0 mov -0x10(%ebp),%eax
80107a72: 8b 00 mov (%eax),%eax
80107a74: 25 00 f0 ff ff and $0xfffff000,%eax
80107a79: 89 04 24 mov %eax,(%esp)
80107a7c: e8 44 fb ff ff call 801075c5 <p2v>
80107a81: 89 45 f4 mov %eax,-0xc(%ebp)
80107a84: eb 4b jmp 80107ad1 <walkpgdir+0x89>
} else {
if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
80107a86: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80107a8a: 74 0e je 80107a9a <walkpgdir+0x52>
80107a8c: e8 6c b0 ff ff call 80102afd <kalloc>
80107a91: 89 45 f4 mov %eax,-0xc(%ebp)
80107a94: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80107a98: 75 07 jne 80107aa1 <walkpgdir+0x59>
return 0;
80107a9a: b8 00 00 00 00 mov $0x0,%eax
80107a9f: eb 47 jmp 80107ae8 <walkpgdir+0xa0>
// Make sure all those PTE_P bits are zero.
memset(pgtab, 0, PGSIZE);
80107aa1: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80107aa8: 00
80107aa9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80107ab0: 00
80107ab1: 8b 45 f4 mov -0xc(%ebp),%eax
80107ab4: 89 04 24 mov %eax,(%esp)
80107ab7: e8 85 d5 ff ff call 80105041 <memset>
// The permissions here are overly generous, but they can
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = v2p(pgtab) | PTE_P | PTE_W | PTE_U;
80107abc: 8b 45 f4 mov -0xc(%ebp),%eax
80107abf: 89 04 24 mov %eax,(%esp)
80107ac2: e8 f1 fa ff ff call 801075b8 <v2p>
80107ac7: 83 c8 07 or $0x7,%eax
80107aca: 89 c2 mov %eax,%edx
80107acc: 8b 45 f0 mov -0x10(%ebp),%eax
80107acf: 89 10 mov %edx,(%eax)
}
return &pgtab[PTX(va)];
80107ad1: 8b 45 0c mov 0xc(%ebp),%eax
80107ad4: c1 e8 0c shr $0xc,%eax
80107ad7: 25 ff 03 00 00 and $0x3ff,%eax
80107adc: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80107ae3: 8b 45 f4 mov -0xc(%ebp),%eax
80107ae6: 01 d0 add %edx,%eax
}
80107ae8: c9 leave
80107ae9: c3 ret
80107aea <mappages>:
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
80107aea: 55 push %ebp
80107aeb: 89 e5 mov %esp,%ebp
80107aed: 83 ec 28 sub $0x28,%esp
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
80107af0: 8b 45 0c mov 0xc(%ebp),%eax
80107af3: 25 00 f0 ff ff and $0xfffff000,%eax
80107af8: 89 45 f4 mov %eax,-0xc(%ebp)
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
80107afb: 8b 55 0c mov 0xc(%ebp),%edx
80107afe: 8b 45 10 mov 0x10(%ebp),%eax
80107b01: 01 d0 add %edx,%eax
80107b03: 83 e8 01 sub $0x1,%eax
80107b06: 25 00 f0 ff ff and $0xfffff000,%eax
80107b0b: 89 45 f0 mov %eax,-0x10(%ebp)
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
80107b0e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
80107b15: 00
80107b16: 8b 45 f4 mov -0xc(%ebp),%eax
80107b19: 89 44 24 04 mov %eax,0x4(%esp)
80107b1d: 8b 45 08 mov 0x8(%ebp),%eax
80107b20: 89 04 24 mov %eax,(%esp)
80107b23: e8 20 ff ff ff call 80107a48 <walkpgdir>
80107b28: 89 45 ec mov %eax,-0x14(%ebp)
80107b2b: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80107b2f: 75 07 jne 80107b38 <mappages+0x4e>
return -1;
80107b31: b8 ff ff ff ff mov $0xffffffff,%eax
80107b36: eb 48 jmp 80107b80 <mappages+0x96>
if(*pte & PTE_P)
80107b38: 8b 45 ec mov -0x14(%ebp),%eax
80107b3b: 8b 00 mov (%eax),%eax
80107b3d: 83 e0 01 and $0x1,%eax
80107b40: 85 c0 test %eax,%eax
80107b42: 74 0c je 80107b50 <mappages+0x66>
panic("remap");
80107b44: c7 04 24 f4 89 10 80 movl $0x801089f4,(%esp)
80107b4b: e8 ea 89 ff ff call 8010053a <panic>
*pte = pa | perm | PTE_P;
80107b50: 8b 45 18 mov 0x18(%ebp),%eax
80107b53: 0b 45 14 or 0x14(%ebp),%eax
80107b56: 83 c8 01 or $0x1,%eax
80107b59: 89 c2 mov %eax,%edx
80107b5b: 8b 45 ec mov -0x14(%ebp),%eax
80107b5e: 89 10 mov %edx,(%eax)
if(a == last)
80107b60: 8b 45 f4 mov -0xc(%ebp),%eax
80107b63: 3b 45 f0 cmp -0x10(%ebp),%eax
80107b66: 75 08 jne 80107b70 <mappages+0x86>
break;
80107b68: 90 nop
a += PGSIZE;
pa += PGSIZE;
}
return 0;
80107b69: b8 00 00 00 00 mov $0x0,%eax
80107b6e: eb 10 jmp 80107b80 <mappages+0x96>
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
if(a == last)
break;
a += PGSIZE;
80107b70: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
pa += PGSIZE;
80107b77: 81 45 14 00 10 00 00 addl $0x1000,0x14(%ebp)
}
80107b7e: eb 8e jmp 80107b0e <mappages+0x24>
return 0;
}
80107b80: c9 leave
80107b81: c3 ret
80107b82 <setupkvm>:
};
// Set up kernel part of a page table.
pde_t*
setupkvm(void)
{
80107b82: 55 push %ebp
80107b83: 89 e5 mov %esp,%ebp
80107b85: 53 push %ebx
80107b86: 83 ec 34 sub $0x34,%esp
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
80107b89: e8 6f af ff ff call 80102afd <kalloc>
80107b8e: 89 45 f0 mov %eax,-0x10(%ebp)
80107b91: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80107b95: 75 0a jne 80107ba1 <setupkvm+0x1f>
return 0;
80107b97: b8 00 00 00 00 mov $0x0,%eax
80107b9c: e9 98 00 00 00 jmp 80107c39 <setupkvm+0xb7>
memset(pgdir, 0, PGSIZE);
80107ba1: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80107ba8: 00
80107ba9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80107bb0: 00
80107bb1: 8b 45 f0 mov -0x10(%ebp),%eax
80107bb4: 89 04 24 mov %eax,(%esp)
80107bb7: e8 85 d4 ff ff call 80105041 <memset>
if (p2v(PHYSTOP) > (void*)DEVSPACE)
80107bbc: c7 04 24 00 00 00 0e movl $0xe000000,(%esp)
80107bc3: e8 fd f9 ff ff call 801075c5 <p2v>
80107bc8: 3d 00 00 00 fe cmp $0xfe000000,%eax
80107bcd: 76 0c jbe 80107bdb <setupkvm+0x59>
panic("PHYSTOP too high");
80107bcf: c7 04 24 fa 89 10 80 movl $0x801089fa,(%esp)
80107bd6: e8 5f 89 ff ff call 8010053a <panic>
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80107bdb: c7 45 f4 00 b5 10 80 movl $0x8010b500,-0xc(%ebp)
80107be2: eb 49 jmp 80107c2d <setupkvm+0xab>
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
80107be4: 8b 45 f4 mov -0xc(%ebp),%eax
80107be7: 8b 48 0c mov 0xc(%eax),%ecx
80107bea: 8b 45 f4 mov -0xc(%ebp),%eax
80107bed: 8b 50 04 mov 0x4(%eax),%edx
80107bf0: 8b 45 f4 mov -0xc(%ebp),%eax
80107bf3: 8b 58 08 mov 0x8(%eax),%ebx
80107bf6: 8b 45 f4 mov -0xc(%ebp),%eax
80107bf9: 8b 40 04 mov 0x4(%eax),%eax
80107bfc: 29 c3 sub %eax,%ebx
80107bfe: 8b 45 f4 mov -0xc(%ebp),%eax
80107c01: 8b 00 mov (%eax),%eax
80107c03: 89 4c 24 10 mov %ecx,0x10(%esp)
80107c07: 89 54 24 0c mov %edx,0xc(%esp)
80107c0b: 89 5c 24 08 mov %ebx,0x8(%esp)
80107c0f: 89 44 24 04 mov %eax,0x4(%esp)
80107c13: 8b 45 f0 mov -0x10(%ebp),%eax
80107c16: 89 04 24 mov %eax,(%esp)
80107c19: e8 cc fe ff ff call 80107aea <mappages>
80107c1e: 85 c0 test %eax,%eax
80107c20: 79 07 jns 80107c29 <setupkvm+0xa7>
(uint)k->phys_start, k->perm) < 0)
return 0;
80107c22: b8 00 00 00 00 mov $0x0,%eax
80107c27: eb 10 jmp 80107c39 <setupkvm+0xb7>
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
memset(pgdir, 0, PGSIZE);
if (p2v(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80107c29: 83 45 f4 10 addl $0x10,-0xc(%ebp)
80107c2d: 81 7d f4 40 b5 10 80 cmpl $0x8010b540,-0xc(%ebp)
80107c34: 72 ae jb 80107be4 <setupkvm+0x62>
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
(uint)k->phys_start, k->perm) < 0)
return 0;
return pgdir;
80107c36: 8b 45 f0 mov -0x10(%ebp),%eax
}
80107c39: 83 c4 34 add $0x34,%esp
80107c3c: 5b pop %ebx
80107c3d: 5d pop %ebp
80107c3e: c3 ret
80107c3f <kvmalloc>:
// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
80107c3f: 55 push %ebp
80107c40: 89 e5 mov %esp,%ebp
80107c42: 83 ec 08 sub $0x8,%esp
kpgdir = setupkvm();
80107c45: e8 38 ff ff ff call 80107b82 <setupkvm>
80107c4a: a3 98 51 11 80 mov %eax,0x80115198
switchkvm();
80107c4f: e8 02 00 00 00 call 80107c56 <switchkvm>
}
80107c54: c9 leave
80107c55: c3 ret
80107c56 <switchkvm>:
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
80107c56: 55 push %ebp
80107c57: 89 e5 mov %esp,%ebp
80107c59: 83 ec 04 sub $0x4,%esp
lcr3(v2p(kpgdir)); // switch to the kernel page table
80107c5c: a1 98 51 11 80 mov 0x80115198,%eax
80107c61: 89 04 24 mov %eax,(%esp)
80107c64: e8 4f f9 ff ff call 801075b8 <v2p>
80107c69: 89 04 24 mov %eax,(%esp)
80107c6c: e8 3c f9 ff ff call 801075ad <lcr3>
}
80107c71: c9 leave
80107c72: c3 ret
80107c73 <switchuvm>:
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
80107c73: 55 push %ebp
80107c74: 89 e5 mov %esp,%ebp
80107c76: 53 push %ebx
80107c77: 83 ec 14 sub $0x14,%esp
pushcli();
80107c7a: e8 c2 d2 ff ff call 80104f41 <pushcli>
cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
80107c7f: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80107c85: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80107c8c: 83 c2 08 add $0x8,%edx
80107c8f: 89 d3 mov %edx,%ebx
80107c91: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80107c98: 83 c2 08 add $0x8,%edx
80107c9b: c1 ea 10 shr $0x10,%edx
80107c9e: 89 d1 mov %edx,%ecx
80107ca0: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80107ca7: 83 c2 08 add $0x8,%edx
80107caa: c1 ea 18 shr $0x18,%edx
80107cad: 66 c7 80 a0 00 00 00 movw $0x67,0xa0(%eax)
80107cb4: 67 00
80107cb6: 66 89 98 a2 00 00 00 mov %bx,0xa2(%eax)
80107cbd: 88 88 a4 00 00 00 mov %cl,0xa4(%eax)
80107cc3: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
80107cca: 83 e1 f0 and $0xfffffff0,%ecx
80107ccd: 83 c9 09 or $0x9,%ecx
80107cd0: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80107cd6: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
80107cdd: 83 c9 10 or $0x10,%ecx
80107ce0: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80107ce6: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
80107ced: 83 e1 9f and $0xffffff9f,%ecx
80107cf0: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80107cf6: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
80107cfd: 83 c9 80 or $0xffffff80,%ecx
80107d00: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80107d06: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
80107d0d: 83 e1 f0 and $0xfffffff0,%ecx
80107d10: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80107d16: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
80107d1d: 83 e1 ef and $0xffffffef,%ecx
80107d20: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80107d26: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
80107d2d: 83 e1 df and $0xffffffdf,%ecx
80107d30: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80107d36: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
80107d3d: 83 c9 40 or $0x40,%ecx
80107d40: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80107d46: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
80107d4d: 83 e1 7f and $0x7f,%ecx
80107d50: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80107d56: 88 90 a7 00 00 00 mov %dl,0xa7(%eax)
cpu->gdt[SEG_TSS].s = 0;
80107d5c: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80107d62: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx
80107d69: 83 e2 ef and $0xffffffef,%edx
80107d6c: 88 90 a5 00 00 00 mov %dl,0xa5(%eax)
cpu->ts.ss0 = SEG_KDATA << 3;
80107d72: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80107d78: 66 c7 40 10 10 00 movw $0x10,0x10(%eax)
cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
80107d7e: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80107d84: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80107d8b: 8b 52 08 mov 0x8(%edx),%edx
80107d8e: 81 c2 00 10 00 00 add $0x1000,%edx
80107d94: 89 50 0c mov %edx,0xc(%eax)
ltr(SEG_TSS << 3);
80107d97: c7 04 24 30 00 00 00 movl $0x30,(%esp)
80107d9e: e8 df f7 ff ff call 80107582 <ltr>
if(p->pgdir == 0)
80107da3: 8b 45 08 mov 0x8(%ebp),%eax
80107da6: 8b 40 04 mov 0x4(%eax),%eax
80107da9: 85 c0 test %eax,%eax
80107dab: 75 0c jne 80107db9 <switchuvm+0x146>
panic("switchuvm: no pgdir");
80107dad: c7 04 24 0b 8a 10 80 movl $0x80108a0b,(%esp)
80107db4: e8 81 87 ff ff call 8010053a <panic>
lcr3(v2p(p->pgdir)); // switch to new address space
80107db9: 8b 45 08 mov 0x8(%ebp),%eax
80107dbc: 8b 40 04 mov 0x4(%eax),%eax
80107dbf: 89 04 24 mov %eax,(%esp)
80107dc2: e8 f1 f7 ff ff call 801075b8 <v2p>
80107dc7: 89 04 24 mov %eax,(%esp)
80107dca: e8 de f7 ff ff call 801075ad <lcr3>
popcli();
80107dcf: e8 b1 d1 ff ff call 80104f85 <popcli>
}
80107dd4: 83 c4 14 add $0x14,%esp
80107dd7: 5b pop %ebx
80107dd8: 5d pop %ebp
80107dd9: c3 ret
80107dda <inituvm>:
// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
80107dda: 55 push %ebp
80107ddb: 89 e5 mov %esp,%ebp
80107ddd: 83 ec 38 sub $0x38,%esp
char *mem;
if(sz >= PGSIZE)
80107de0: 81 7d 10 ff 0f 00 00 cmpl $0xfff,0x10(%ebp)
80107de7: 76 0c jbe 80107df5 <inituvm+0x1b>
panic("inituvm: more than a page");
80107de9: c7 04 24 1f 8a 10 80 movl $0x80108a1f,(%esp)
80107df0: e8 45 87 ff ff call 8010053a <panic>
mem = kalloc();
80107df5: e8 03 ad ff ff call 80102afd <kalloc>
80107dfa: 89 45 f4 mov %eax,-0xc(%ebp)
memset(mem, 0, PGSIZE);
80107dfd: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80107e04: 00
80107e05: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80107e0c: 00
80107e0d: 8b 45 f4 mov -0xc(%ebp),%eax
80107e10: 89 04 24 mov %eax,(%esp)
80107e13: e8 29 d2 ff ff call 80105041 <memset>
mappages(pgdir, 0, PGSIZE, v2p(mem), PTE_W|PTE_U);
80107e18: 8b 45 f4 mov -0xc(%ebp),%eax
80107e1b: 89 04 24 mov %eax,(%esp)
80107e1e: e8 95 f7 ff ff call 801075b8 <v2p>
80107e23: c7 44 24 10 06 00 00 movl $0x6,0x10(%esp)
80107e2a: 00
80107e2b: 89 44 24 0c mov %eax,0xc(%esp)
80107e2f: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80107e36: 00
80107e37: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80107e3e: 00
80107e3f: 8b 45 08 mov 0x8(%ebp),%eax
80107e42: 89 04 24 mov %eax,(%esp)
80107e45: e8 a0 fc ff ff call 80107aea <mappages>
memmove(mem, init, sz);
80107e4a: 8b 45 10 mov 0x10(%ebp),%eax
80107e4d: 89 44 24 08 mov %eax,0x8(%esp)
80107e51: 8b 45 0c mov 0xc(%ebp),%eax
80107e54: 89 44 24 04 mov %eax,0x4(%esp)
80107e58: 8b 45 f4 mov -0xc(%ebp),%eax
80107e5b: 89 04 24 mov %eax,(%esp)
80107e5e: e8 ad d2 ff ff call 80105110 <memmove>
}
80107e63: c9 leave
80107e64: c3 ret
80107e65 <loaduvm>:
// Load a program segment into pgdir. addr must be page-aligned
// and the pages from addr to addr+sz must already be mapped.
int
loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz)
{
80107e65: 55 push %ebp
80107e66: 89 e5 mov %esp,%ebp
80107e68: 53 push %ebx
80107e69: 83 ec 24 sub $0x24,%esp
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
80107e6c: 8b 45 0c mov 0xc(%ebp),%eax
80107e6f: 25 ff 0f 00 00 and $0xfff,%eax
80107e74: 85 c0 test %eax,%eax
80107e76: 74 0c je 80107e84 <loaduvm+0x1f>
panic("loaduvm: addr must be page aligned");
80107e78: c7 04 24 3c 8a 10 80 movl $0x80108a3c,(%esp)
80107e7f: e8 b6 86 ff ff call 8010053a <panic>
for(i = 0; i < sz; i += PGSIZE){
80107e84: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80107e8b: e9 a9 00 00 00 jmp 80107f39 <loaduvm+0xd4>
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
80107e90: 8b 45 f4 mov -0xc(%ebp),%eax
80107e93: 8b 55 0c mov 0xc(%ebp),%edx
80107e96: 01 d0 add %edx,%eax
80107e98: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80107e9f: 00
80107ea0: 89 44 24 04 mov %eax,0x4(%esp)
80107ea4: 8b 45 08 mov 0x8(%ebp),%eax
80107ea7: 89 04 24 mov %eax,(%esp)
80107eaa: e8 99 fb ff ff call 80107a48 <walkpgdir>
80107eaf: 89 45 ec mov %eax,-0x14(%ebp)
80107eb2: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80107eb6: 75 0c jne 80107ec4 <loaduvm+0x5f>
panic("loaduvm: address should exist");
80107eb8: c7 04 24 5f 8a 10 80 movl $0x80108a5f,(%esp)
80107ebf: e8 76 86 ff ff call 8010053a <panic>
pa = PTE_ADDR(*pte);
80107ec4: 8b 45 ec mov -0x14(%ebp),%eax
80107ec7: 8b 00 mov (%eax),%eax
80107ec9: 25 00 f0 ff ff and $0xfffff000,%eax
80107ece: 89 45 e8 mov %eax,-0x18(%ebp)
if(sz - i < PGSIZE)
80107ed1: 8b 45 f4 mov -0xc(%ebp),%eax
80107ed4: 8b 55 18 mov 0x18(%ebp),%edx
80107ed7: 29 c2 sub %eax,%edx
80107ed9: 89 d0 mov %edx,%eax
80107edb: 3d ff 0f 00 00 cmp $0xfff,%eax
80107ee0: 77 0f ja 80107ef1 <loaduvm+0x8c>
n = sz - i;
80107ee2: 8b 45 f4 mov -0xc(%ebp),%eax
80107ee5: 8b 55 18 mov 0x18(%ebp),%edx
80107ee8: 29 c2 sub %eax,%edx
80107eea: 89 d0 mov %edx,%eax
80107eec: 89 45 f0 mov %eax,-0x10(%ebp)
80107eef: eb 07 jmp 80107ef8 <loaduvm+0x93>
else
n = PGSIZE;
80107ef1: c7 45 f0 00 10 00 00 movl $0x1000,-0x10(%ebp)
if(readi(ip, p2v(pa), offset+i, n) != n)
80107ef8: 8b 45 f4 mov -0xc(%ebp),%eax
80107efb: 8b 55 14 mov 0x14(%ebp),%edx
80107efe: 8d 1c 02 lea (%edx,%eax,1),%ebx
80107f01: 8b 45 e8 mov -0x18(%ebp),%eax
80107f04: 89 04 24 mov %eax,(%esp)
80107f07: e8 b9 f6 ff ff call 801075c5 <p2v>
80107f0c: 8b 55 f0 mov -0x10(%ebp),%edx
80107f0f: 89 54 24 0c mov %edx,0xc(%esp)
80107f13: 89 5c 24 08 mov %ebx,0x8(%esp)
80107f17: 89 44 24 04 mov %eax,0x4(%esp)
80107f1b: 8b 45 10 mov 0x10(%ebp),%eax
80107f1e: 89 04 24 mov %eax,(%esp)
80107f21: e8 5d 9e ff ff call 80101d83 <readi>
80107f26: 3b 45 f0 cmp -0x10(%ebp),%eax
80107f29: 74 07 je 80107f32 <loaduvm+0xcd>
return -1;
80107f2b: b8 ff ff ff ff mov $0xffffffff,%eax
80107f30: eb 18 jmp 80107f4a <loaduvm+0xe5>
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
80107f32: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80107f39: 8b 45 f4 mov -0xc(%ebp),%eax
80107f3c: 3b 45 18 cmp 0x18(%ebp),%eax
80107f3f: 0f 82 4b ff ff ff jb 80107e90 <loaduvm+0x2b>
else
n = PGSIZE;
if(readi(ip, p2v(pa), offset+i, n) != n)
return -1;
}
return 0;
80107f45: b8 00 00 00 00 mov $0x0,%eax
}
80107f4a: 83 c4 24 add $0x24,%esp
80107f4d: 5b pop %ebx
80107f4e: 5d pop %ebp
80107f4f: c3 ret
80107f50 <allocuvm>:
// Allocate page tables and physical memory to grow process from oldsz to
// newsz, which need not be page aligned. Returns new size or 0 on error.
int
allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80107f50: 55 push %ebp
80107f51: 89 e5 mov %esp,%ebp
80107f53: 83 ec 38 sub $0x38,%esp
char *mem;
uint a;
if(newsz >= KERNBASE)
80107f56: 8b 45 10 mov 0x10(%ebp),%eax
80107f59: 85 c0 test %eax,%eax
80107f5b: 79 0a jns 80107f67 <allocuvm+0x17>
return 0;
80107f5d: b8 00 00 00 00 mov $0x0,%eax
80107f62: e9 c1 00 00 00 jmp 80108028 <allocuvm+0xd8>
if(newsz < oldsz)
80107f67: 8b 45 10 mov 0x10(%ebp),%eax
80107f6a: 3b 45 0c cmp 0xc(%ebp),%eax
80107f6d: 73 08 jae 80107f77 <allocuvm+0x27>
return oldsz;
80107f6f: 8b 45 0c mov 0xc(%ebp),%eax
80107f72: e9 b1 00 00 00 jmp 80108028 <allocuvm+0xd8>
a = PGROUNDUP(oldsz);
80107f77: 8b 45 0c mov 0xc(%ebp),%eax
80107f7a: 05 ff 0f 00 00 add $0xfff,%eax
80107f7f: 25 00 f0 ff ff and $0xfffff000,%eax
80107f84: 89 45 f4 mov %eax,-0xc(%ebp)
for(; a < newsz; a += PGSIZE){
80107f87: e9 8d 00 00 00 jmp 80108019 <allocuvm+0xc9>
mem = kalloc();
80107f8c: e8 6c ab ff ff call 80102afd <kalloc>
80107f91: 89 45 f0 mov %eax,-0x10(%ebp)
if(mem == 0){
80107f94: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80107f98: 75 2c jne 80107fc6 <allocuvm+0x76>
cprintf("allocuvm out of memory\n");
80107f9a: c7 04 24 7d 8a 10 80 movl $0x80108a7d,(%esp)
80107fa1: e8 fa 83 ff ff call 801003a0 <cprintf>
deallocuvm(pgdir, newsz, oldsz);
80107fa6: 8b 45 0c mov 0xc(%ebp),%eax
80107fa9: 89 44 24 08 mov %eax,0x8(%esp)
80107fad: 8b 45 10 mov 0x10(%ebp),%eax
80107fb0: 89 44 24 04 mov %eax,0x4(%esp)
80107fb4: 8b 45 08 mov 0x8(%ebp),%eax
80107fb7: 89 04 24 mov %eax,(%esp)
80107fba: e8 6b 00 00 00 call 8010802a <deallocuvm>
return 0;
80107fbf: b8 00 00 00 00 mov $0x0,%eax
80107fc4: eb 62 jmp 80108028 <allocuvm+0xd8>
}
memset(mem, 0, PGSIZE);
80107fc6: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80107fcd: 00
80107fce: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80107fd5: 00
80107fd6: 8b 45 f0 mov -0x10(%ebp),%eax
80107fd9: 89 04 24 mov %eax,(%esp)
80107fdc: e8 60 d0 ff ff call 80105041 <memset>
mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
80107fe1: 8b 45 f0 mov -0x10(%ebp),%eax
80107fe4: 89 04 24 mov %eax,(%esp)
80107fe7: e8 cc f5 ff ff call 801075b8 <v2p>
80107fec: 8b 55 f4 mov -0xc(%ebp),%edx
80107fef: c7 44 24 10 06 00 00 movl $0x6,0x10(%esp)
80107ff6: 00
80107ff7: 89 44 24 0c mov %eax,0xc(%esp)
80107ffb: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80108002: 00
80108003: 89 54 24 04 mov %edx,0x4(%esp)
80108007: 8b 45 08 mov 0x8(%ebp),%eax
8010800a: 89 04 24 mov %eax,(%esp)
8010800d: e8 d8 fa ff ff call 80107aea <mappages>
return 0;
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
80108012: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80108019: 8b 45 f4 mov -0xc(%ebp),%eax
8010801c: 3b 45 10 cmp 0x10(%ebp),%eax
8010801f: 0f 82 67 ff ff ff jb 80107f8c <allocuvm+0x3c>
return 0;
}
memset(mem, 0, PGSIZE);
mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
}
return newsz;
80108025: 8b 45 10 mov 0x10(%ebp),%eax
}
80108028: c9 leave
80108029: c3 ret
8010802a <deallocuvm>:
// 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)
{
8010802a: 55 push %ebp
8010802b: 89 e5 mov %esp,%ebp
8010802d: 83 ec 28 sub $0x28,%esp
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80108030: 8b 45 10 mov 0x10(%ebp),%eax
80108033: 3b 45 0c cmp 0xc(%ebp),%eax
80108036: 72 08 jb 80108040 <deallocuvm+0x16>
return oldsz;
80108038: 8b 45 0c mov 0xc(%ebp),%eax
8010803b: e9 a4 00 00 00 jmp 801080e4 <deallocuvm+0xba>
a = PGROUNDUP(newsz);
80108040: 8b 45 10 mov 0x10(%ebp),%eax
80108043: 05 ff 0f 00 00 add $0xfff,%eax
80108048: 25 00 f0 ff ff and $0xfffff000,%eax
8010804d: 89 45 f4 mov %eax,-0xc(%ebp)
for(; a < oldsz; a += PGSIZE){
80108050: e9 80 00 00 00 jmp 801080d5 <deallocuvm+0xab>
pte = walkpgdir(pgdir, (char*)a, 0);
80108055: 8b 45 f4 mov -0xc(%ebp),%eax
80108058: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
8010805f: 00
80108060: 89 44 24 04 mov %eax,0x4(%esp)
80108064: 8b 45 08 mov 0x8(%ebp),%eax
80108067: 89 04 24 mov %eax,(%esp)
8010806a: e8 d9 f9 ff ff call 80107a48 <walkpgdir>
8010806f: 89 45 f0 mov %eax,-0x10(%ebp)
if(!pte)
80108072: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80108076: 75 09 jne 80108081 <deallocuvm+0x57>
a += (NPTENTRIES - 1) * PGSIZE;
80108078: 81 45 f4 00 f0 3f 00 addl $0x3ff000,-0xc(%ebp)
8010807f: eb 4d jmp 801080ce <deallocuvm+0xa4>
else if((*pte & PTE_P) != 0){
80108081: 8b 45 f0 mov -0x10(%ebp),%eax
80108084: 8b 00 mov (%eax),%eax
80108086: 83 e0 01 and $0x1,%eax
80108089: 85 c0 test %eax,%eax
8010808b: 74 41 je 801080ce <deallocuvm+0xa4>
pa = PTE_ADDR(*pte);
8010808d: 8b 45 f0 mov -0x10(%ebp),%eax
80108090: 8b 00 mov (%eax),%eax
80108092: 25 00 f0 ff ff and $0xfffff000,%eax
80108097: 89 45 ec mov %eax,-0x14(%ebp)
if(pa == 0)
8010809a: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
8010809e: 75 0c jne 801080ac <deallocuvm+0x82>
panic("kfree");
801080a0: c7 04 24 95 8a 10 80 movl $0x80108a95,(%esp)
801080a7: e8 8e 84 ff ff call 8010053a <panic>
char *v = p2v(pa);
801080ac: 8b 45 ec mov -0x14(%ebp),%eax
801080af: 89 04 24 mov %eax,(%esp)
801080b2: e8 0e f5 ff ff call 801075c5 <p2v>
801080b7: 89 45 e8 mov %eax,-0x18(%ebp)
kfree(v);
801080ba: 8b 45 e8 mov -0x18(%ebp),%eax
801080bd: 89 04 24 mov %eax,(%esp)
801080c0: e8 9f a9 ff ff call 80102a64 <kfree>
*pte = 0;
801080c5: 8b 45 f0 mov -0x10(%ebp),%eax
801080c8: c7 00 00 00 00 00 movl $0x0,(%eax)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
801080ce: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
801080d5: 8b 45 f4 mov -0xc(%ebp),%eax
801080d8: 3b 45 0c cmp 0xc(%ebp),%eax
801080db: 0f 82 74 ff ff ff jb 80108055 <deallocuvm+0x2b>
char *v = p2v(pa);
kfree(v);
*pte = 0;
}
}
return newsz;
801080e1: 8b 45 10 mov 0x10(%ebp),%eax
}
801080e4: c9 leave
801080e5: c3 ret
801080e6 <freevm>:
// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
801080e6: 55 push %ebp
801080e7: 89 e5 mov %esp,%ebp
801080e9: 83 ec 28 sub $0x28,%esp
uint i;
if(pgdir == 0)
801080ec: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801080f0: 75 0c jne 801080fe <freevm+0x18>
panic("freevm: no pgdir");
801080f2: c7 04 24 9b 8a 10 80 movl $0x80108a9b,(%esp)
801080f9: e8 3c 84 ff ff call 8010053a <panic>
deallocuvm(pgdir, KERNBASE, 0);
801080fe: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80108105: 00
80108106: c7 44 24 04 00 00 00 movl $0x80000000,0x4(%esp)
8010810d: 80
8010810e: 8b 45 08 mov 0x8(%ebp),%eax
80108111: 89 04 24 mov %eax,(%esp)
80108114: e8 11 ff ff ff call 8010802a <deallocuvm>
for(i = 0; i < NPDENTRIES; i++){
80108119: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80108120: eb 48 jmp 8010816a <freevm+0x84>
if(pgdir[i] & PTE_P){
80108122: 8b 45 f4 mov -0xc(%ebp),%eax
80108125: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
8010812c: 8b 45 08 mov 0x8(%ebp),%eax
8010812f: 01 d0 add %edx,%eax
80108131: 8b 00 mov (%eax),%eax
80108133: 83 e0 01 and $0x1,%eax
80108136: 85 c0 test %eax,%eax
80108138: 74 2c je 80108166 <freevm+0x80>
char * v = p2v(PTE_ADDR(pgdir[i]));
8010813a: 8b 45 f4 mov -0xc(%ebp),%eax
8010813d: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80108144: 8b 45 08 mov 0x8(%ebp),%eax
80108147: 01 d0 add %edx,%eax
80108149: 8b 00 mov (%eax),%eax
8010814b: 25 00 f0 ff ff and $0xfffff000,%eax
80108150: 89 04 24 mov %eax,(%esp)
80108153: e8 6d f4 ff ff call 801075c5 <p2v>
80108158: 89 45 f0 mov %eax,-0x10(%ebp)
kfree(v);
8010815b: 8b 45 f0 mov -0x10(%ebp),%eax
8010815e: 89 04 24 mov %eax,(%esp)
80108161: e8 fe a8 ff ff call 80102a64 <kfree>
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80108166: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010816a: 81 7d f4 ff 03 00 00 cmpl $0x3ff,-0xc(%ebp)
80108171: 76 af jbe 80108122 <freevm+0x3c>
if(pgdir[i] & PTE_P){
char * v = p2v(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
80108173: 8b 45 08 mov 0x8(%ebp),%eax
80108176: 89 04 24 mov %eax,(%esp)
80108179: e8 e6 a8 ff ff call 80102a64 <kfree>
}
8010817e: c9 leave
8010817f: c3 ret
80108180 <clearpteu>:
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
80108180: 55 push %ebp
80108181: 89 e5 mov %esp,%ebp
80108183: 83 ec 28 sub $0x28,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80108186: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
8010818d: 00
8010818e: 8b 45 0c mov 0xc(%ebp),%eax
80108191: 89 44 24 04 mov %eax,0x4(%esp)
80108195: 8b 45 08 mov 0x8(%ebp),%eax
80108198: 89 04 24 mov %eax,(%esp)
8010819b: e8 a8 f8 ff ff call 80107a48 <walkpgdir>
801081a0: 89 45 f4 mov %eax,-0xc(%ebp)
if(pte == 0)
801081a3: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801081a7: 75 0c jne 801081b5 <clearpteu+0x35>
panic("clearpteu");
801081a9: c7 04 24 ac 8a 10 80 movl $0x80108aac,(%esp)
801081b0: e8 85 83 ff ff call 8010053a <panic>
*pte &= ~PTE_U;
801081b5: 8b 45 f4 mov -0xc(%ebp),%eax
801081b8: 8b 00 mov (%eax),%eax
801081ba: 83 e0 fb and $0xfffffffb,%eax
801081bd: 89 c2 mov %eax,%edx
801081bf: 8b 45 f4 mov -0xc(%ebp),%eax
801081c2: 89 10 mov %edx,(%eax)
}
801081c4: c9 leave
801081c5: c3 ret
801081c6 <copyuvm>:
// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
801081c6: 55 push %ebp
801081c7: 89 e5 mov %esp,%ebp
801081c9: 53 push %ebx
801081ca: 83 ec 44 sub $0x44,%esp
pde_t *d;
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
801081cd: e8 b0 f9 ff ff call 80107b82 <setupkvm>
801081d2: 89 45 f0 mov %eax,-0x10(%ebp)
801081d5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801081d9: 75 0a jne 801081e5 <copyuvm+0x1f>
return 0;
801081db: b8 00 00 00 00 mov $0x0,%eax
801081e0: e9 fd 00 00 00 jmp 801082e2 <copyuvm+0x11c>
for(i = 0; i < sz; i += PGSIZE){
801081e5: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801081ec: e9 d0 00 00 00 jmp 801082c1 <copyuvm+0xfb>
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
801081f1: 8b 45 f4 mov -0xc(%ebp),%eax
801081f4: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
801081fb: 00
801081fc: 89 44 24 04 mov %eax,0x4(%esp)
80108200: 8b 45 08 mov 0x8(%ebp),%eax
80108203: 89 04 24 mov %eax,(%esp)
80108206: e8 3d f8 ff ff call 80107a48 <walkpgdir>
8010820b: 89 45 ec mov %eax,-0x14(%ebp)
8010820e: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80108212: 75 0c jne 80108220 <copyuvm+0x5a>
panic("copyuvm: pte should exist");
80108214: c7 04 24 b6 8a 10 80 movl $0x80108ab6,(%esp)
8010821b: e8 1a 83 ff ff call 8010053a <panic>
if(!(*pte & PTE_P))
80108220: 8b 45 ec mov -0x14(%ebp),%eax
80108223: 8b 00 mov (%eax),%eax
80108225: 83 e0 01 and $0x1,%eax
80108228: 85 c0 test %eax,%eax
8010822a: 75 0c jne 80108238 <copyuvm+0x72>
panic("copyuvm: page not present");
8010822c: c7 04 24 d0 8a 10 80 movl $0x80108ad0,(%esp)
80108233: e8 02 83 ff ff call 8010053a <panic>
pa = PTE_ADDR(*pte);
80108238: 8b 45 ec mov -0x14(%ebp),%eax
8010823b: 8b 00 mov (%eax),%eax
8010823d: 25 00 f0 ff ff and $0xfffff000,%eax
80108242: 89 45 e8 mov %eax,-0x18(%ebp)
flags = PTE_FLAGS(*pte);
80108245: 8b 45 ec mov -0x14(%ebp),%eax
80108248: 8b 00 mov (%eax),%eax
8010824a: 25 ff 0f 00 00 and $0xfff,%eax
8010824f: 89 45 e4 mov %eax,-0x1c(%ebp)
if((mem = kalloc()) == 0)
80108252: e8 a6 a8 ff ff call 80102afd <kalloc>
80108257: 89 45 e0 mov %eax,-0x20(%ebp)
8010825a: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
8010825e: 75 02 jne 80108262 <copyuvm+0x9c>
goto bad;
80108260: eb 70 jmp 801082d2 <copyuvm+0x10c>
memmove(mem, (char*)p2v(pa), PGSIZE);
80108262: 8b 45 e8 mov -0x18(%ebp),%eax
80108265: 89 04 24 mov %eax,(%esp)
80108268: e8 58 f3 ff ff call 801075c5 <p2v>
8010826d: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80108274: 00
80108275: 89 44 24 04 mov %eax,0x4(%esp)
80108279: 8b 45 e0 mov -0x20(%ebp),%eax
8010827c: 89 04 24 mov %eax,(%esp)
8010827f: e8 8c ce ff ff call 80105110 <memmove>
if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0)
80108284: 8b 5d e4 mov -0x1c(%ebp),%ebx
80108287: 8b 45 e0 mov -0x20(%ebp),%eax
8010828a: 89 04 24 mov %eax,(%esp)
8010828d: e8 26 f3 ff ff call 801075b8 <v2p>
80108292: 8b 55 f4 mov -0xc(%ebp),%edx
80108295: 89 5c 24 10 mov %ebx,0x10(%esp)
80108299: 89 44 24 0c mov %eax,0xc(%esp)
8010829d: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
801082a4: 00
801082a5: 89 54 24 04 mov %edx,0x4(%esp)
801082a9: 8b 45 f0 mov -0x10(%ebp),%eax
801082ac: 89 04 24 mov %eax,(%esp)
801082af: e8 36 f8 ff ff call 80107aea <mappages>
801082b4: 85 c0 test %eax,%eax
801082b6: 79 02 jns 801082ba <copyuvm+0xf4>
goto bad;
801082b8: eb 18 jmp 801082d2 <copyuvm+0x10c>
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
801082ba: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
801082c1: 8b 45 f4 mov -0xc(%ebp),%eax
801082c4: 3b 45 0c cmp 0xc(%ebp),%eax
801082c7: 0f 82 24 ff ff ff jb 801081f1 <copyuvm+0x2b>
goto bad;
memmove(mem, (char*)p2v(pa), PGSIZE);
if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0)
goto bad;
}
return d;
801082cd: 8b 45 f0 mov -0x10(%ebp),%eax
801082d0: eb 10 jmp 801082e2 <copyuvm+0x11c>
bad:
freevm(d);
801082d2: 8b 45 f0 mov -0x10(%ebp),%eax
801082d5: 89 04 24 mov %eax,(%esp)
801082d8: e8 09 fe ff ff call 801080e6 <freevm>
return 0;
801082dd: b8 00 00 00 00 mov $0x0,%eax
}
801082e2: 83 c4 44 add $0x44,%esp
801082e5: 5b pop %ebx
801082e6: 5d pop %ebp
801082e7: c3 ret
801082e8 <uva2ka>:
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
801082e8: 55 push %ebp
801082e9: 89 e5 mov %esp,%ebp
801082eb: 83 ec 28 sub $0x28,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
801082ee: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
801082f5: 00
801082f6: 8b 45 0c mov 0xc(%ebp),%eax
801082f9: 89 44 24 04 mov %eax,0x4(%esp)
801082fd: 8b 45 08 mov 0x8(%ebp),%eax
80108300: 89 04 24 mov %eax,(%esp)
80108303: e8 40 f7 ff ff call 80107a48 <walkpgdir>
80108308: 89 45 f4 mov %eax,-0xc(%ebp)
if((*pte & PTE_P) == 0)
8010830b: 8b 45 f4 mov -0xc(%ebp),%eax
8010830e: 8b 00 mov (%eax),%eax
80108310: 83 e0 01 and $0x1,%eax
80108313: 85 c0 test %eax,%eax
80108315: 75 07 jne 8010831e <uva2ka+0x36>
return 0;
80108317: b8 00 00 00 00 mov $0x0,%eax
8010831c: eb 25 jmp 80108343 <uva2ka+0x5b>
if((*pte & PTE_U) == 0)
8010831e: 8b 45 f4 mov -0xc(%ebp),%eax
80108321: 8b 00 mov (%eax),%eax
80108323: 83 e0 04 and $0x4,%eax
80108326: 85 c0 test %eax,%eax
80108328: 75 07 jne 80108331 <uva2ka+0x49>
return 0;
8010832a: b8 00 00 00 00 mov $0x0,%eax
8010832f: eb 12 jmp 80108343 <uva2ka+0x5b>
return (char*)p2v(PTE_ADDR(*pte));
80108331: 8b 45 f4 mov -0xc(%ebp),%eax
80108334: 8b 00 mov (%eax),%eax
80108336: 25 00 f0 ff ff and $0xfffff000,%eax
8010833b: 89 04 24 mov %eax,(%esp)
8010833e: e8 82 f2 ff ff call 801075c5 <p2v>
}
80108343: c9 leave
80108344: c3 ret
80108345 <copyout>:
// Copy len bytes from p to user address va in page table pgdir.
// Most useful when pgdir is not the current page table.
// uva2ka ensures this only works for PTE_U pages.
int
copyout(pde_t *pgdir, uint va, void *p, uint len)
{
80108345: 55 push %ebp
80108346: 89 e5 mov %esp,%ebp
80108348: 83 ec 28 sub $0x28,%esp
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
8010834b: 8b 45 10 mov 0x10(%ebp),%eax
8010834e: 89 45 f4 mov %eax,-0xc(%ebp)
while(len > 0){
80108351: e9 87 00 00 00 jmp 801083dd <copyout+0x98>
va0 = (uint)PGROUNDDOWN(va);
80108356: 8b 45 0c mov 0xc(%ebp),%eax
80108359: 25 00 f0 ff ff and $0xfffff000,%eax
8010835e: 89 45 ec mov %eax,-0x14(%ebp)
pa0 = uva2ka(pgdir, (char*)va0);
80108361: 8b 45 ec mov -0x14(%ebp),%eax
80108364: 89 44 24 04 mov %eax,0x4(%esp)
80108368: 8b 45 08 mov 0x8(%ebp),%eax
8010836b: 89 04 24 mov %eax,(%esp)
8010836e: e8 75 ff ff ff call 801082e8 <uva2ka>
80108373: 89 45 e8 mov %eax,-0x18(%ebp)
if(pa0 == 0)
80108376: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
8010837a: 75 07 jne 80108383 <copyout+0x3e>
return -1;
8010837c: b8 ff ff ff ff mov $0xffffffff,%eax
80108381: eb 69 jmp 801083ec <copyout+0xa7>
n = PGSIZE - (va - va0);
80108383: 8b 45 0c mov 0xc(%ebp),%eax
80108386: 8b 55 ec mov -0x14(%ebp),%edx
80108389: 29 c2 sub %eax,%edx
8010838b: 89 d0 mov %edx,%eax
8010838d: 05 00 10 00 00 add $0x1000,%eax
80108392: 89 45 f0 mov %eax,-0x10(%ebp)
if(n > len)
80108395: 8b 45 f0 mov -0x10(%ebp),%eax
80108398: 3b 45 14 cmp 0x14(%ebp),%eax
8010839b: 76 06 jbe 801083a3 <copyout+0x5e>
n = len;
8010839d: 8b 45 14 mov 0x14(%ebp),%eax
801083a0: 89 45 f0 mov %eax,-0x10(%ebp)
memmove(pa0 + (va - va0), buf, n);
801083a3: 8b 45 ec mov -0x14(%ebp),%eax
801083a6: 8b 55 0c mov 0xc(%ebp),%edx
801083a9: 29 c2 sub %eax,%edx
801083ab: 8b 45 e8 mov -0x18(%ebp),%eax
801083ae: 01 c2 add %eax,%edx
801083b0: 8b 45 f0 mov -0x10(%ebp),%eax
801083b3: 89 44 24 08 mov %eax,0x8(%esp)
801083b7: 8b 45 f4 mov -0xc(%ebp),%eax
801083ba: 89 44 24 04 mov %eax,0x4(%esp)
801083be: 89 14 24 mov %edx,(%esp)
801083c1: e8 4a cd ff ff call 80105110 <memmove>
len -= n;
801083c6: 8b 45 f0 mov -0x10(%ebp),%eax
801083c9: 29 45 14 sub %eax,0x14(%ebp)
buf += n;
801083cc: 8b 45 f0 mov -0x10(%ebp),%eax
801083cf: 01 45 f4 add %eax,-0xc(%ebp)
va = va0 + PGSIZE;
801083d2: 8b 45 ec mov -0x14(%ebp),%eax
801083d5: 05 00 10 00 00 add $0x1000,%eax
801083da: 89 45 0c mov %eax,0xc(%ebp)
{
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
801083dd: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
801083e1: 0f 85 6f ff ff ff jne 80108356 <copyout+0x11>
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
801083e7: b8 00 00 00 00 mov $0x0,%eax
}
801083ec: c9 leave
801083ed: c3 ret
jasonpr@howe-and-ser-moving:~/6.828/xv6$ make qemu-nox
gcc -fno-pic -static -fno-builtin -fno-strict-aliasing -fvar-tracking -fvar-tracking-assignments -O0 -g -Wall -MD -gdwarf-2 -m32 -Werror -fno-omit-frame-pointer -fno-stack-protector  
 -c -o file.o file.c
gcc -fno-pic -static -fno-builtin -fno-strict-aliasing -fvar-tracking -fvar-tracking-assignments -O0 -g -Wall -MD -gdwarf-2 -m32 -Werror -fno-omit-frame-pointer -fno-stack-protector  
 -c -o ide.o ide.c
ld -m    elf_i386 -T kernel.ld -o kernel entry.o bio.o console.o exec.o file.o fs.o ide.o ioapic.o kalloc.o kbd.o lapic.o log.o main.o mp.o picirq.o pipe.o proc.o spinlock.o string.o 
swtch.o syscall.o sysfile.o sysproc.o timer.o trapasm.o trap.o uart.o vectors.o vm.o  -b binary initcode entryother
objdump -S kernel > kernel.asm
objdump -t kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$/d' > kernel.sym
dd if=/dev/zero of=xv6.img count=10000
10000+0 records in
10000+0 records out
5120000 bytes (5.1 MB) copied, 0.36893 s, 13.9 MB/s
dd if=bootblock of=xv6.img conv=notrunc
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.057362 s, 8.9 kB/s
dd if=kernel of=xv6.img seek=1 conv=notrunc
277+1 records in
277+1 records out
142083 bytes (142 kB) copied, 0.0575001 s, 2.5 MB/s
qemu -nographic -hdb fs.img xv6.img -smp 2 -m 512 
xv6...
cpu1: starting
cpu0: starting
cpu1: panic: sched locks
 80104a52 80104ae9 801068b0 8010648b 80105e12 80105491 8010669a 8010648b 0 0QEMU: Terminated

Immediately after that, I confirmed that I only had added the one sti() and two cli()s:

jasonpr@howe-and-ser-moving:~/6.828/xv6$ git diff
diff --git a/file.c b/file.c
index 98cad1e..1775350 100644
--- a/file.c
+++ b/file.c
@@ -8,6 +8,7 @@
 #include "fs.h"
 #include "file.h"
 #include "spinlock.h"
+#include "x86.h"
 
 struct devsw devsw[NDEV];
 struct {
@@ -28,13 +29,16 @@ filealloc(void)
   struct file *f;
 
   acquire(&ftable.lock);
+  sti();
   for(f = ftable.file; f < ftable.file + NFILE; f++){
     if(f->ref == 0){
       f->ref = 1;
+      cli();
       release(&ftable.lock);
       return f;
     }
   }
+  cli();
   release(&ftable.lock);
   return 0;
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment